29 Status =
gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid,
NULL, (VOID **)&HiiDatabase);
30 if (EFI_ERROR (Status)) {
40 Status = HiiDatabase->ExportPackageLists (HiiDatabase, 0, &BufferSize, Buffer);
41 if (Status == EFI_BUFFER_TOO_SMALL) {
47 Buffer = (VOID *)(
UINTN)BufferAddress;
52 Status = HiiDatabase->ExportPackageLists (HiiDatabase, 0, &BufferSize, Buffer);
55 DEBUG ((DEBUG_INFO,
"VarCheckHiiGenDxeFromHii - HII Database exported at 0x%x, size = 0x%x\n", Buffer, BufferSize));
69#ifdef DUMP_VAR_CHECK_HII
71 { EFI_IFR_VARSTORE_EFI_OP,
"EfiVarStore" },
72 { EFI_IFR_ONE_OF_OP,
"OneOf" },
73 { EFI_IFR_CHECKBOX_OP,
"CheckBox" },
74 { EFI_IFR_NUMERIC_OP,
"Numeric" },
75 { EFI_IFR_ORDERED_LIST_OP,
"OrderedList" },
93 for (Index = 0; Index <
ARRAY_SIZE (mHiiOpCodeStringTable); Index++) {
94 if (mHiiOpCodeStringTable[Index].HiiOpCode == HiiOpCode) {
95 return mHiiOpCodeStringTable[Index].HiiOpCodeStr;
99 return "<UnknownHiiOpCode>";
118 DEBUG ((DEBUG_INFO,
" VAR_CHECK_HII_QUESTION_HEADER\n"));
119 DEBUG ((DEBUG_INFO,
" OpCode - 0x%02x (%a) (%a)\n", HiiQuestion->OpCode, HiiOpCodeToStr (HiiQuestion->OpCode), (HiiQuestion->BitFieldStore ?
"bit level" :
"byte level")));
120 DEBUG ((DEBUG_INFO,
" Length - 0x%02x\n", HiiQuestion->Length));
121 DEBUG ((DEBUG_INFO,
" VarOffset - 0x%04x (%a)\n", HiiQuestion->VarOffset, (HiiQuestion->BitFieldStore ?
"bit level" :
"byte level")));
122 DEBUG ((DEBUG_INFO,
" StorageWidth - 0x%02x (%a)\n", HiiQuestion->StorageWidth, (HiiQuestion->BitFieldStore ?
"bit level" :
"byte level")));
124 switch (HiiQuestion->OpCode) {
125 case EFI_IFR_ONE_OF_OP:
127 while ((
UINTN)Ptr < ((
UINTN)HiiQuestion + HiiQuestion->Length)) {
129 if (HiiQuestion->BitFieldStore) {
133 CopyMem (&OneValue, Ptr,
sizeof (UINT32));
134 DEBUG ((DEBUG_INFO,
" OneOfOption - 0x%08x\n", OneValue));
136 CopyMem (&OneValue, Ptr, HiiQuestion->StorageWidth);
137 switch (HiiQuestion->StorageWidth) {
139 DEBUG ((DEBUG_INFO,
" OneOfOption - 0x%02x\n", OneValue));
141 case sizeof (UINT16):
142 DEBUG ((DEBUG_INFO,
" OneOfOption - 0x%04x\n", OneValue));
144 case sizeof (UINT32):
145 DEBUG ((DEBUG_INFO,
" OneOfOption - 0x%08x\n", OneValue));
147 case sizeof (UINT64):
148 DEBUG ((DEBUG_INFO,
" OneOfOption - 0x%016lx\n", OneValue));
156 if (HiiQuestion->BitFieldStore) {
157 Ptr +=
sizeof (UINT32);
159 Ptr += HiiQuestion->StorageWidth;
165 case EFI_IFR_CHECKBOX_OP:
168 case EFI_IFR_NUMERIC_OP:
172 if (HiiQuestion->BitFieldStore) {
176 CopyMem (&Minimum, Ptr,
sizeof (UINT32));
177 Ptr +=
sizeof (UINT32);
178 CopyMem (&Maximum, Ptr,
sizeof (UINT32));
179 Ptr +=
sizeof (UINT32);
181 DEBUG ((DEBUG_INFO,
" Minimum - 0x%08x\n", Minimum));
182 DEBUG ((DEBUG_INFO,
" Maximum - 0x%08x\n", Maximum));
184 CopyMem (&Minimum, Ptr, HiiQuestion->StorageWidth);
185 Ptr += HiiQuestion->StorageWidth;
186 CopyMem (&Maximum, Ptr, HiiQuestion->StorageWidth);
187 Ptr += HiiQuestion->StorageWidth;
189 switch (HiiQuestion->StorageWidth) {
191 DEBUG ((DEBUG_INFO,
" Minimum - 0x%02x\n", Minimum));
192 DEBUG ((DEBUG_INFO,
" Maximum - 0x%02x\n", Maximum));
194 case sizeof (UINT16):
195 DEBUG ((DEBUG_INFO,
" Minimum - 0x%04x\n", Minimum));
196 DEBUG ((DEBUG_INFO,
" Maximum - 0x%04x\n", Maximum));
198 case sizeof (UINT32):
199 DEBUG ((DEBUG_INFO,
" Minimum - 0x%08x\n", Minimum));
200 DEBUG ((DEBUG_INFO,
" Maximum - 0x%08x\n", Maximum));
202 case sizeof (UINT64):
203 DEBUG ((DEBUG_INFO,
" Minimum - 0x%016lx\n", Minimum));
204 DEBUG ((DEBUG_INFO,
" Maximum - 0x%016lx\n", Maximum));
214 case EFI_IFR_ORDERED_LIST_OP:
217 while ((
UINTN)Ptr < ((
UINTN)HiiQuestion + HiiQuestion->Length)) {
219 CopyMem (&OneValue, Ptr, HiiQuestion->StorageWidth);
220 switch (HiiQuestion->StorageWidth) {
222 DEBUG ((DEBUG_INFO,
" OneOfOption - 0x%02x\n", OneValue));
224 case sizeof (UINT16):
225 DEBUG ((DEBUG_INFO,
" OneOfOption - 0x%04x\n", OneValue));
227 case sizeof (UINT32):
228 DEBUG ((DEBUG_INFO,
" OneOfOption - 0x%08x\n", OneValue));
230 case sizeof (UINT64):
231 DEBUG ((DEBUG_INFO,
" OneOfOption - 0x%016lx\n", OneValue));
238 Ptr += HiiQuestion->StorageWidth;
262 DEBUG ((DEBUG_INFO,
"VAR_CHECK_HII_VARIABLE_HEADER\n"));
263 DEBUG ((DEBUG_INFO,
" Revision - 0x%04x\n", HiiVariable->Revision));
264 DEBUG ((DEBUG_INFO,
" HeaderLength - 0x%04x\n", HiiVariable->HeaderLength));
265 DEBUG ((DEBUG_INFO,
" Length - 0x%08x\n", HiiVariable->Length));
266 DEBUG ((DEBUG_INFO,
" OpCode - 0x%02x (%a)\n", HiiVariable->OpCode, HiiOpCodeToStr (HiiVariable->OpCode)));
267 DEBUG ((DEBUG_INFO,
" Size - 0x%04x\n", HiiVariable->Size));
268 DEBUG ((DEBUG_INFO,
" Attributes - 0x%08x\n", HiiVariable->Attributes));
269 DEBUG ((DEBUG_INFO,
" Guid - %g\n", &HiiVariable->Guid));
270 DEBUG ((DEBUG_INFO,
" Name - %s\n", HiiVariable + 1));
276 while ((
UINTN)HiiQuestion < ((
UINTN)HiiVariable + HiiVariable->Length)) {
280 DumpHiiQuestion (HiiQuestion);
297 IN VOID *VarCheckHiiBin,
303 DEBUG ((DEBUG_INFO,
"DumpVarCheckHii\n"));
309 while ((
UINTN)HiiVariable < ((
UINTN)VarCheckHiiBin + VarCheckHiiBinSize)) {
310 DumpHiiVariable (HiiVariable);
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
#define ARRAY_SIZE(Array)
#define GLOBAL_REMOVE_IF_UNREFERENCED
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define DEBUG_CODE(Expression)
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_SIZE_TO_PAGES(Size)
VOID DumpVarCheckHii(IN VOID *VarCheckHiiBin, IN UINTN VarCheckHiiBinSize)
VOID VarCheckParseHiiDatabase(IN VOID *HiiDatabase, IN UINTN HiiDatabaseSize)
VOID DumpHiiDatabase(IN VOID *HiiDatabase, IN UINTN HiiDatabaseSize)
VOID VarCheckHiiGenFromHiiDatabase(VOID)