TianoCore EDK2 master
Loading...
Searching...
No Matches
EsrtFmpDebugPrint.c
Go to the documentation of this file.
1
12#include <Uefi.h>
13#include <Library/BaseLib.h>
15#include <Library/DebugLib.h>
18
30EFIAPI
33 )
34{
35 if (Entry == NULL) {
36 DEBUG ((DEBUG_INFO, "| ERROR: Invalid resource entry pointer "));
37 DEBUG ((DEBUG_INFO, " |\n"));
38 return EFI_INVALID_PARAMETER;
39 }
40
41 //
42 // GUID FW Class (36 chars plus table formatting)
43 //
44 DEBUG ((DEBUG_INFO, "| %g |", &Entry->FwClass));
45
46 //
47 // Entry Type (12 chars plus table formatting)
48 //
49 switch (Entry->FwType) {
50 case (ESRT_FW_TYPE_SYSTEMFIRMWARE):
51 DEBUG ((DEBUG_INFO, " System FW |"));
52 break;
53 case (ESRT_FW_TYPE_DEVICEFIRMWARE):
54 DEBUG ((DEBUG_INFO, " Device FW |"));
55 break;
56 case (ESRT_FW_TYPE_UEFIDRIVER):
57 DEBUG ((DEBUG_INFO, " Uefi Driver |"));
58 break;
60 DEBUG ((DEBUG_INFO, " Unknown Type |"));
61 break;
62 default:
63 DEBUG ((DEBUG_INFO, " ? 0x%8X |", Entry->FwType));
64 break;
65 }
66
67 //
68 // FW Version (10 char UINT32 string plus table formatting)
69 // Lowest Supported Version (10 char UINT32 string plus table formatting)
70 // Capsule Flags (10 char UINT32 string plus table formatting)
71 // Last Attempt Version (10 char UINT32 string plus table formatting)
72 // Last Attempt Status (10 char UINT32 string plus table formatting)
73 //
74 DEBUG ((
75 DEBUG_INFO,
76 " 0x%8X | 0x%8X | 0x%8X | 0x%8X | 0x%8X |\n",
77 Entry->FwVersion,
78 Entry->LowestSupportedFwVersion,
79 Entry->CapsuleFlags,
80 Entry->LastAttemptVersion,
81 Entry->LastAttemptStatus
82 ));
83
84 return EFI_SUCCESS;
85}
86
92VOID
93EFIAPI
96 )
97{
99 UINTN Index;
100
101 Entry = (EFI_SYSTEM_RESOURCE_ENTRY *)(((UINT8 *)Table) + sizeof (EFI_SYSTEM_RESOURCE_TABLE));
102
103 //
104 // Print ESRT table information
105 //
106 DEBUG ((DEBUG_INFO, "ESRT Table Information:\n"));
107 if (Table == NULL) {
108 DEBUG ((DEBUG_INFO, "ERROR: Invalid table pointer\n"));
109 return;
110 }
111
112 DEBUG ((DEBUG_INFO, "+--------------------------------------------------------+\n"));
113 DEBUG ((DEBUG_INFO, "| Firmware Resource Count : 0x%08x |\n", Table->FwResourceCount));
114 DEBUG ((DEBUG_INFO, "| Firmware Resource Count Max : 0x%08x |\n", Table->FwResourceCountMax));
115 DEBUG ((DEBUG_INFO, "| Firmware Resource Entry Version : 0x%016x |\n", Table->FwResourceVersion));
116 DEBUG ((DEBUG_INFO, "+--------------------------------------------------------+\n"));
117
118 //
119 // Print table entry information
120 //
121 DEBUG ((DEBUG_INFO, "ESRT Table Entries:\n"));
122 if (Table->FwResourceVersion != EFI_SYSTEM_RESOURCE_TABLE_FIRMWARE_RESOURCE_VERSION) {
123 DEBUG ((DEBUG_INFO, "ERROR: Unsupported Resource Entry Version\n"));
124 return;
125 }
126
127 DEBUG ((DEBUG_INFO, "+--------------------------------------+--------------+------------"));
128 DEBUG ((DEBUG_INFO, "+------------+------------+------------+------------+\n"));
129 DEBUG ((DEBUG_INFO, "| | | "));
130 DEBUG ((DEBUG_INFO, "| Lowest | | Last | Last |\n"));
131 DEBUG ((DEBUG_INFO, "| | Firmware | "));
132 DEBUG ((DEBUG_INFO, "| Supported | Capsule | Attempted | Attempted |\n"));
133 DEBUG ((DEBUG_INFO, "| CLASS GUID | Type | Version "));
134 DEBUG ((DEBUG_INFO, "| Version | Flags | Version | Status |\n"));
135 DEBUG ((DEBUG_INFO, "+--------------------------------------+--------------+------------"));
136 DEBUG ((DEBUG_INFO, "+------------+------------+------------+------------+\n"));
137
138 for (Index = 0; Index < Table->FwResourceCount; Index++) {
139 PrintOutEsrtEntry (&(Entry[Index]));
140 }
141
142 DEBUG ((DEBUG_INFO, "+--------------------------------------+--------------+------------"));
143 DEBUG ((DEBUG_INFO, "+------------+------------+------------+------------+\n"));
144}
UINT64 UINTN
VOID EFIAPI PrintTable(IN EFI_SYSTEM_RESOURCE_TABLE *Table)
EFI_STATUS EFIAPI PrintOutEsrtEntry(IN EFI_SYSTEM_RESOURCE_ENTRY *Entry)
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define DEBUG(Expression)
Definition: DebugLib.h:434
#define EFI_SYSTEM_RESOURCE_TABLE_FIRMWARE_RESOURCE_VERSION
#define ESRT_FW_TYPE_UNKNOWN
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112