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