File: error.c

package info (click to toggle)
gnu-efi 4.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,916 kB
  • sloc: ansic: 18,175; asm: 2,317; makefile: 321; sh: 102
file content (89 lines) | stat: -rw-r--r-- 2,788 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*++

Copyright (c) 1998  Intel Corporation

Module Name:

    error.c

Abstract:




Revision History

--*/

#include "lib.h"


typedef struct {
    EFI_STATUS	Code;
    WCHAR		*Desc;
} ErrorCodeTable_Type;
ErrorCodeTable_Type ErrorCodeTable[] = {
	{  EFI_SUCCESS,                u"Success"},
	{  EFI_LOAD_ERROR,             u"Load Error"},
	{  EFI_INVALID_PARAMETER,      u"Invalid Parameter"},
	{  EFI_UNSUPPORTED,            u"Unsupported"},
	{  EFI_BAD_BUFFER_SIZE,        u"Bad Buffer Size"},
	{  EFI_BUFFER_TOO_SMALL,       u"Buffer Too Small"},
	{  EFI_NOT_READY,              u"Not Ready"},
	{  EFI_DEVICE_ERROR,           u"Device Error"},
	{  EFI_WRITE_PROTECTED,        u"Write Protected"},
	{  EFI_OUT_OF_RESOURCES,       u"Out of Resources"},
	{  EFI_VOLUME_CORRUPTED,       u"Volume Corrupt"},
	{  EFI_VOLUME_FULL,            u"Volume Full"},
	{  EFI_NO_MEDIA,               u"No Media"},
	{  EFI_MEDIA_CHANGED,          u"Media changed"},
	{  EFI_NOT_FOUND,              u"Not Found"},
	{  EFI_ACCESS_DENIED,          u"Access Denied"},
	{  EFI_NO_RESPONSE,            u"No Response"},
	{  EFI_NO_MAPPING,             u"No mapping"},
	{  EFI_TIMEOUT,                u"Time out"},
	{  EFI_NOT_STARTED,            u"Not started"},
	{  EFI_ALREADY_STARTED,        u"Already started"},
	{  EFI_ABORTED,                u"Aborted"},
	{  EFI_ICMP_ERROR,             u"ICMP Error"},
	{  EFI_TFTP_ERROR,             u"TFTP Error"},
	{  EFI_PROTOCOL_ERROR,         u"Protocol Error"},
	{  EFI_INCOMPATIBLE_VERSION,   u"Incompatible Version"},
	{  EFI_SECURITY_VIOLATION,     u"Security Policy Violation"},
	{  EFI_CRC_ERROR,              u"CRC Error"},
	{  EFI_END_OF_MEDIA,           u"End of Media"},
	{  EFI_END_OF_FILE,            u"End of File"},
	{  EFI_INVALID_LANGUAGE,       u"Invalid Languages"},
	{  EFI_COMPROMISED_DATA,       u"Compromised Data"},
	{  EFI_IP_ADDRESS_CONFLICT,    u"IP Address Conflict"},
	{  EFI_HTTP_ERROR,             u"HTTP Error"},

	// warnings
	{  EFI_WARN_UNKNOWN_GLYPH,     u"Warning Unknown Glyph"},
	{  EFI_WARN_DELETE_FAILURE,    u"Warning Delete Failure"},
	{  EFI_WARN_WRITE_FAILURE,     u"Warning Write Failure"},
	{  EFI_WARN_BUFFER_TOO_SMALL,  u"Warning Buffer Too Small"},
	{  EFI_WARN_STALE_DATA,        u"Warning Stale Data"},
	{  EFI_WARN_FILE_SYSTEM,       u"Warning File System"},
	{  EFI_WARN_RESET_REQUIRED,    u"Warning Reset Required"},
	{  0, NULL}
} ;


VOID
StatusToString (
    OUT CHAR16          *Buffer,
    IN EFI_STATUS       Status
    )
{
    UINTN           Index;

    for (Index = 0; ErrorCodeTable[Index].Desc; Index +=1) {
        if (ErrorCodeTable[Index].Code == Status) {
	    StrCpy (Buffer, ErrorCodeTable[Index].Desc);
            return;
        }
    }

    UnicodeSPrint (Buffer, 0, u"%X", Status);
}