1/*++
2
3Copyright (c) 1998  Intel Corporation
4
5Module Name:
6
7    error.c
8
9Abstract:
10
11
12
13
14Revision History
15
16--*/
17
18#include "lib.h"
19
20
21struct {
22    EFI_STATUS      Code;
23    WCHAR	    *Desc;
24} ErrorCodeTable[] = {
25	{  EFI_SUCCESS,                L"Success"},
26	{  EFI_LOAD_ERROR,             L"Load Error"},
27	{  EFI_INVALID_PARAMETER,      L"Invalid Parameter"},
28	{  EFI_UNSUPPORTED,            L"Unsupported"},
29	{  EFI_BAD_BUFFER_SIZE,        L"Bad Buffer Size"},
30	{  EFI_BUFFER_TOO_SMALL,       L"Buffer Too Small"},
31	{  EFI_NOT_READY,              L"Not Ready"},
32	{  EFI_DEVICE_ERROR,           L"Device Error"},
33	{  EFI_WRITE_PROTECTED,        L"Write Protected"},
34	{  EFI_OUT_OF_RESOURCES,       L"Out of Resources"},
35	{  EFI_VOLUME_CORRUPTED,       L"Volume Corrupt"},
36	{  EFI_VOLUME_FULL,            L"Volume Full"},
37	{  EFI_NO_MEDIA,               L"No Media"},
38	{  EFI_MEDIA_CHANGED,          L"Media changed"},
39	{  EFI_NOT_FOUND,              L"Not Found"},
40	{  EFI_ACCESS_DENIED,          L"Access Denied"},
41	{  EFI_NO_RESPONSE,            L"No Response"},
42	{  EFI_NO_MAPPING,             L"No mapping"},
43	{  EFI_TIMEOUT,                L"Time out"},
44	{  EFI_NOT_STARTED,            L"Not started"},
45	{  EFI_ALREADY_STARTED,        L"Already started"},
46	{  EFI_ABORTED,                L"Aborted"},
47	{  EFI_ICMP_ERROR,             L"ICMP Error"},
48	{  EFI_TFTP_ERROR,             L"TFTP Error"},
49	{  EFI_PROTOCOL_ERROR,         L"Protocol Error"},
50
51	// warnings
52	{  EFI_WARN_UNKOWN_GLYPH,      L"Warning Unknown Glyph"},
53	{  EFI_WARN_DELETE_FAILURE,    L"Warning Delete Failure"},
54	{  EFI_WARN_WRITE_FAILURE,     L"Warning Write Failure"},
55	{  EFI_WARN_BUFFER_TOO_SMALL,  L"Warning Buffer Too Small"},
56	{  0, NULL}
57} ;
58
59
60VOID
61StatusToString (
62    OUT CHAR16          *Buffer,
63    IN EFI_STATUS       Status
64    )
65{
66    UINTN           Index;
67
68    for (Index = 0; ErrorCodeTable[Index].Desc; Index +=1) {
69        if (ErrorCodeTable[Index].Code == Status) {
70	    StrCpy (Buffer, ErrorCodeTable[Index].Desc);
71            return;
72        }
73    }
74
75    SPrint (Buffer, 0, L"%X", Status);
76}
77