error.c 2.7 KB

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