1530d68baSNigel Croxon /*++
2530d68baSNigel Croxon
3530d68baSNigel Croxon Copyright (c) 1998 Intel Corporation
4530d68baSNigel Croxon
5530d68baSNigel Croxon Module Name:
6530d68baSNigel Croxon
7530d68baSNigel Croxon error.c
8530d68baSNigel Croxon
9530d68baSNigel Croxon Abstract:
10530d68baSNigel Croxon
11530d68baSNigel Croxon
12530d68baSNigel Croxon
13530d68baSNigel Croxon
14530d68baSNigel Croxon Revision History
15530d68baSNigel Croxon
16530d68baSNigel Croxon --*/
17530d68baSNigel Croxon
18530d68baSNigel Croxon #include "lib.h"
19530d68baSNigel Croxon
20530d68baSNigel Croxon
2199730f29SCallum Farmer typedef struct {
22530d68baSNigel Croxon EFI_STATUS Code;
23530d68baSNigel Croxon WCHAR *Desc;
2499730f29SCallum Farmer } ErrorCodeTable_Type;
2599730f29SCallum Farmer ErrorCodeTable_Type ErrorCodeTable[] = {
26530d68baSNigel Croxon { EFI_SUCCESS, L"Success"},
27530d68baSNigel Croxon { EFI_LOAD_ERROR, L"Load Error"},
28530d68baSNigel Croxon { EFI_INVALID_PARAMETER, L"Invalid Parameter"},
29530d68baSNigel Croxon { EFI_UNSUPPORTED, L"Unsupported"},
30530d68baSNigel Croxon { EFI_BAD_BUFFER_SIZE, L"Bad Buffer Size"},
31530d68baSNigel Croxon { EFI_BUFFER_TOO_SMALL, L"Buffer Too Small"},
32530d68baSNigel Croxon { EFI_NOT_READY, L"Not Ready"},
33530d68baSNigel Croxon { EFI_DEVICE_ERROR, L"Device Error"},
34530d68baSNigel Croxon { EFI_WRITE_PROTECTED, L"Write Protected"},
35530d68baSNigel Croxon { EFI_OUT_OF_RESOURCES, L"Out of Resources"},
36530d68baSNigel Croxon { EFI_VOLUME_CORRUPTED, L"Volume Corrupt"},
37530d68baSNigel Croxon { EFI_VOLUME_FULL, L"Volume Full"},
38530d68baSNigel Croxon { EFI_NO_MEDIA, L"No Media"},
39530d68baSNigel Croxon { EFI_MEDIA_CHANGED, L"Media changed"},
40530d68baSNigel Croxon { EFI_NOT_FOUND, L"Not Found"},
41530d68baSNigel Croxon { EFI_ACCESS_DENIED, L"Access Denied"},
42530d68baSNigel Croxon { EFI_NO_RESPONSE, L"No Response"},
43530d68baSNigel Croxon { EFI_NO_MAPPING, L"No mapping"},
44530d68baSNigel Croxon { EFI_TIMEOUT, L"Time out"},
45530d68baSNigel Croxon { EFI_NOT_STARTED, L"Not started"},
46530d68baSNigel Croxon { EFI_ALREADY_STARTED, L"Already started"},
47530d68baSNigel Croxon { EFI_ABORTED, L"Aborted"},
48530d68baSNigel Croxon { EFI_ICMP_ERROR, L"ICMP Error"},
49530d68baSNigel Croxon { EFI_TFTP_ERROR, L"TFTP Error"},
50530d68baSNigel Croxon { EFI_PROTOCOL_ERROR, L"Protocol Error"},
5137d7bee8SNigel Croxon { EFI_INCOMPATIBLE_VERSION, L"Incompatible Version"},
5237d7bee8SNigel Croxon { EFI_SECURITY_VIOLATION, L"Security Policy Violation"},
5337d7bee8SNigel Croxon { EFI_CRC_ERROR, L"CRC Error"},
5437d7bee8SNigel Croxon { EFI_END_OF_MEDIA, L"End of Media"},
5537d7bee8SNigel Croxon { EFI_END_OF_FILE, L"End of File"},
5637d7bee8SNigel Croxon { EFI_INVALID_LANGUAGE, L"Invalid Languages"},
5737d7bee8SNigel Croxon { EFI_COMPROMISED_DATA, L"Compromised Data"},
58*de6f9259SCallum Farmer { EFI_IP_ADDRESS_CONFLICT, L"IP Address Conflict"},
59*de6f9259SCallum Farmer { EFI_HTTP_ERROR, L"HTTP Error"},
60530d68baSNigel Croxon
61530d68baSNigel Croxon // warnings
62d34132e6SNigel Croxon { EFI_WARN_UNKNOWN_GLYPH, L"Warning Unknown Glyph"},
63530d68baSNigel Croxon { EFI_WARN_DELETE_FAILURE, L"Warning Delete Failure"},
64530d68baSNigel Croxon { EFI_WARN_WRITE_FAILURE, L"Warning Write Failure"},
65530d68baSNigel Croxon { EFI_WARN_BUFFER_TOO_SMALL, L"Warning Buffer Too Small"},
66*de6f9259SCallum Farmer { EFI_WARN_STALE_DATA, L"Warning Stale Data"},
67*de6f9259SCallum Farmer { EFI_WARN_FILE_SYSTEM, L"Warning File System"},
68*de6f9259SCallum Farmer { EFI_WARN_RESET_REQUIRED, L"Warning Reset Required"},
69530d68baSNigel Croxon { 0, NULL}
70530d68baSNigel Croxon } ;
71530d68baSNigel Croxon
72530d68baSNigel Croxon
73530d68baSNigel Croxon VOID
StatusToString(OUT CHAR16 * Buffer,IN EFI_STATUS Status)74530d68baSNigel Croxon StatusToString (
75530d68baSNigel Croxon OUT CHAR16 *Buffer,
76530d68baSNigel Croxon IN EFI_STATUS Status
77530d68baSNigel Croxon )
78530d68baSNigel Croxon {
79530d68baSNigel Croxon UINTN Index;
80530d68baSNigel Croxon
81530d68baSNigel Croxon for (Index = 0; ErrorCodeTable[Index].Desc; Index +=1) {
82530d68baSNigel Croxon if (ErrorCodeTable[Index].Code == Status) {
83530d68baSNigel Croxon StrCpy (Buffer, ErrorCodeTable[Index].Desc);
84530d68baSNigel Croxon return;
85530d68baSNigel Croxon }
86530d68baSNigel Croxon }
87530d68baSNigel Croxon
88b39be0d5SPete Batard UnicodeSPrint (Buffer, 0, L"%X", Status);
89530d68baSNigel Croxon }
90