25 IN EFI_HII_HANDLE *HiiHandles,
26 IN EFI_HII_PACKAGE_LIST_HEADER **ListHeaders,
27 IN UINT32 ListHeaderCount,
28 IN EFI_STRING SearchString
34 UINT32 ListHeaderIndex;
35 EFI_IFR_OP_HEADER *IfrHeader;
36 EFI_HII_PACKAGE_HEADER *PkgHeader;
45 for (ListHeaderIndex = 0; HiiHandles[ListHeaderIndex] != NULL && ContextsCount <
CONTEXTS_MAX; ++ListHeaderIndex) {
48 if (ListHeaders[ListHeaderIndex] == NULL) {
55 &ListHeaders[ListHeaderIndex]->PackageListGuid
58 PkgHeader =
PADD (ListHeaders[ListHeaderIndex],
sizeof (EFI_HII_PACKAGE_LIST_HEADER));
61 DEBUG ((DEBUG_INFO,
"Package Type: %02X ", PkgHeader->Type));
63 if (PkgHeader->Type == EFI_HII_PACKAGE_END) {
67 if (PkgHeader->Type == EFI_HII_PACKAGE_FORMS) {
68 IfrHeader =
PADD (PkgHeader,
sizeof (EFI_HII_PACKAGE_HEADER));
72 if (IfrHeader->OpCode == EFI_IFR_FORM_SET_OP) {
76 &((EFI_IFR_FORM_SET *)IfrHeader)->Guid
79 if (IfrHeader->Length >= sizeof (GUID) +
sizeof (EFI_IFR_FORM_SET)) {
83 PADD (IfrHeader,
sizeof (EFI_IFR_FORM_SET))
89 if (
CompareGuid (&gEfiHiiPlatformSetupFormsetGuid,
PADD (IfrHeader,
sizeof (EFI_IFR_FORM_SET)))) {
90 Contexts[ContextsCount].
SearchText = SearchString;
91 Contexts[ContextsCount].
EfiHandle = HiiHandles[ListHeaderIndex];
92 Contexts[ContextsCount].
ListHeader = ListHeaders[ListHeaderIndex];
93 Contexts[ContextsCount].
PkgHeader = PkgHeader;
96 Contexts[ContextsCount].
IfrOneOf = NULL;
98 Contexts[ContextsCount].
Count = OptionsCount;
101 Contexts[ContextsCount].FirstIfrHeader,
104 &Contexts[ContextsCount],
108 if (Contexts[ContextsCount].Count != OptionsCount) {
109 OptionsCount = Contexts[ContextsCount].
Count;
117 PkgHeader =
PADD (PkgHeader, PkgHeader->Length);
120 DEBUG ((DEBUG_INFO,
"\n"));
123 DEBUG ((DEBUG_INFO,
"Context Count: %x Options Count %x\n", ContextsCount, OptionsCount));
126 Print (L
"Too many corresponding BIOS Options found. Try a different search string using interactive mode.\n");
127 }
else if (OptionsCount == 0) {
128 Print (L
"No corresponding BIOS Options found. Try a different search string using interactive mode.\n");
132 if (OptionsCount > 1) {
134 Print (L
"\nEnter choice (1..%x) ? ", OptionsCount);
136 }
while ((Key !=
CHAR_ESC) && ((Key <
'1') || (Key >
'0' + OptionsCount)));
144 for (ContextIndex = 0; ContextIndex < ContextsCount; ++ContextIndex) {
145 if (Contexts[ContextIndex].Count >= Index) {
146 Contexts[ContextIndex].
Count = ContextIndex == 0 ? 0 : Contexts[ContextIndex - 1].
Count;
147 Contexts[ContextIndex].
StopAt = Index;
148 Contexts[ContextIndex].
IfrOneOf = NULL;
151 Contexts[ContextIndex].FirstIfrHeader,
154 &Contexts[ContextIndex],
158 if (Contexts[ContextIndex].IfrOneOf != NULL) {
168 for (ListHeaderIndex = 0; ListHeaderIndex < ListHeaderCount; ++ListHeaderIndex) {
169 if (ListHeaders[ListHeaderIndex] != NULL) {
170 FreePool (ListHeaders[ListHeaderIndex]);
177 IN EFI_STRING SearchString
180 EFI_HII_HANDLE *HiiHandles;
181 EFI_HII_PACKAGE_LIST_HEADER **ListHeaders;
182 UINT32 ListHeaderCount;
184 Print (L
"\nBIOS Options:\n");
186 HiiHandles = HiiGetHiiHandles (NULL);
187 if (HiiHandles == NULL) {
188 Print (L
"Could not retrieve HiiHandles.\n");
189 return EFI_OUT_OF_RESOURCES;
192 for (ListHeaderCount = 0; HiiHandles[ListHeaderCount] != NULL; ++ListHeaderCount) {
200 ListHeaders = AllocatePool (
sizeof (*ListHeaders) * ListHeaderCount);
201 if (ListHeaders == NULL) {
202 Print (L
"Could not allocate memory for ListHeaders.\n");
203 FreePool (HiiHandles);
204 return EFI_OUT_OF_RESOURCES;
209 FreePool (ListHeaders);
210 FreePool (HiiHandles);
EFI_IFR_OP_HEADER * IterateOpCode(IN EFI_IFR_OP_HEADER *Header, IN UINT8 OpCode, IN OUT BOOLEAN *Stop OPTIONAL, IN VOID *Context, IN OP_CODE_HANDLER Handler)