]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Utility.c
Rename module name from ***To*** to ***On***. AAAOnBBB means this module produce...
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / FrameworkHiiOnUefiHiiThunk / Utility.c
1 /**@file
2
3 This file contains the keyboard processing code to the HII database.
4
5 Copyright (c) 2006 - 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16
17 #include "HiiDatabase.h"
18 #include "HiiHandle.h"
19 #include <Library/DebugLib.h>
20
21 CONST EFI_GUID gZeroGuid = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
22 CONST CHAR16 FrameworkReservedVarstoreName[] = FRAMEWORK_RESERVED_VARSTORE_NAME;
23
24
25 /**
26 Find the corressponding UEFI HII Handle from a Framework HII Handle given.
27
28 @param Private The HII Thunk Module Private context.
29 @param FwHiiHandle The Framemwork HII Handle.
30
31 @return NULL If Framework HII Handle is invalid.
32 @return The corresponding UEFI HII Handle.
33 **/
34 EFI_HII_HANDLE
35 FwHiiHandleToUefiHiiHandle (
36 IN CONST HII_THUNK_PRIVATE_DATA *Private,
37 IN FRAMEWORK_EFI_HII_HANDLE FwHiiHandle
38 )
39 {
40 HII_THUNK_CONTEXT *ThunkContext;
41
42 ASSERT (FwHiiHandle != (FRAMEWORK_EFI_HII_HANDLE) 0);
43 ASSERT (Private != NULL);
44
45 ThunkContext = FwHiiHandleToThunkContext (Private, FwHiiHandle);
46
47 if (ThunkContext != NULL) {
48 return ThunkContext->UefiHiiHandle;
49 }
50
51 return (EFI_HII_HANDLE) NULL;
52 }
53
54
55 /**
56 Find the corressponding HII Thunk Context from a Framework HII Handle given.
57
58 @param Private The HII Thunk Module Private context.
59 @param FwHiiHandle The Framemwork HII Handle.
60
61 @return NULL If Framework HII Handle is invalid.
62 @return The corresponding HII Thunk Context.
63 **/
64 HII_THUNK_CONTEXT *
65 FwHiiHandleToThunkContext (
66 IN CONST HII_THUNK_PRIVATE_DATA *Private,
67 IN FRAMEWORK_EFI_HII_HANDLE FwHiiHandle
68 )
69 {
70 LIST_ENTRY *Link;
71 HII_THUNK_CONTEXT *ThunkContext;
72
73
74 Link = GetFirstNode (&Private->ThunkContextListHead);
75
76 while (!IsNull (&Private->ThunkContextListHead, Link)) {
77 ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
78
79 if (FwHiiHandle == ThunkContext->FwHiiHandle) {
80 return ThunkContext;
81 }
82
83 Link = GetNextNode (&Private->ThunkContextListHead, Link);
84 }
85
86 return NULL;
87 }
88
89 /**
90 Find the corressponding HII Thunk Context from a UEFI HII Handle given.
91
92 @param Private The HII Thunk Module Private context.
93 @param UEFIHiiHandle The UEFI HII Handle.
94
95 @return NULL If UEFI HII Handle is invalid.
96 @return The corresponding HII Thunk Context.
97 **/
98 HII_THUNK_CONTEXT *
99 UefiHiiHandleToThunkContext (
100 IN CONST HII_THUNK_PRIVATE_DATA *Private,
101 IN EFI_HII_HANDLE UefiHiiHandle
102 )
103 {
104 LIST_ENTRY *Link;
105 HII_THUNK_CONTEXT *ThunkContext;
106
107 Link = GetFirstNode (&Private->ThunkContextListHead);
108
109 while (!IsNull (&Private->ThunkContextListHead, Link)) {
110 ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
111
112 if (UefiHiiHandle == ThunkContext->UefiHiiHandle) {
113 return ThunkContext;
114 }
115 Link = GetNextNode (&Private->ThunkContextListHead, Link);
116 }
117
118 return NULL;
119 }
120
121 /**
122 Find the corressponding HII Thunk Context from a Tag GUID.
123
124 @param Private The HII Thunk Module Private context.
125 @param Guid The Tag GUID.
126
127 @return NULL No HII Thunk Context matched the Tag GUID.
128 @return The corresponding HII Thunk Context.
129 **/
130 HII_THUNK_CONTEXT *
131 TagGuidToIfrPackThunkContext (
132 IN CONST HII_THUNK_PRIVATE_DATA *Private,
133 IN CONST EFI_GUID *Guid
134 )
135 {
136 LIST_ENTRY *Link;
137 HII_THUNK_CONTEXT *ThunkContext;
138
139 Link = GetFirstNode (&Private->ThunkContextListHead);
140
141 while (!IsNull (&Private->ThunkContextListHead, Link)) {
142 ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
143
144 if (CompareGuid (Guid, &ThunkContext->TagGuid) && (ThunkContext->IfrPackageCount != 0)) {
145 return ThunkContext;
146 }
147
148 Link = GetNextNode (&Private->ThunkContextListHead, Link);
149 }
150
151 return NULL;
152
153 }
154
155 /**
156 Clean up the HII Thunk Context for a UEFI HII Handle.
157
158 @param Private The HII Thunk Module Private context.
159 @param UEFIHiiHandle The UEFI HII Handle.
160
161 **/
162 VOID
163 DestroyThunkContextForUefiHiiHandle (
164 IN HII_THUNK_PRIVATE_DATA *Private,
165 IN EFI_HII_HANDLE UefiHiiHandle
166 )
167 {
168 HII_THUNK_CONTEXT *ThunkContext;
169
170 ThunkContext = UefiHiiHandleToThunkContext (Private, UefiHiiHandle);
171 ASSERT (ThunkContext != NULL);
172
173 DestroyThunkContext (ThunkContext);
174 }
175
176
177 /**
178 This function create a HII_THUNK_CONTEXT for a package list registered
179 by a module calling EFI_HII_DATABASE_PROTOCOL.NewPackageList. It records
180 the PackageListGuid in EFI_HII_PACKAGE_LIST_HEADER in the TagGuid in
181 HII_THUNK_CONTEXT created. This TagGuid will be used as a key to s
182
183 **/
184 HII_THUNK_CONTEXT *
185 CreateThunkContextForUefiHiiHandle (
186 IN EFI_HII_HANDLE UefiHiiHandle
187 )
188 {
189 EFI_STATUS Status;
190 EFI_GUID PackageGuid;
191 HII_THUNK_CONTEXT *ThunkContext;
192
193 ThunkContext = AllocateZeroPool (sizeof (*ThunkContext));
194 ASSERT (ThunkContext != NULL);
195
196 ThunkContext->Signature = HII_THUNK_CONTEXT_SIGNATURE;
197
198 Status = AllocateHiiHandle (&ThunkContext->FwHiiHandle);
199 if (EFI_ERROR (Status)) {
200 return NULL;
201 }
202
203 ThunkContext->UefiHiiHandle = UefiHiiHandle;
204
205 Status = HiiLibExtractGuidFromHiiHandle (UefiHiiHandle, &PackageGuid);
206 ASSERT_EFI_ERROR (Status);
207
208 CopyGuid(&ThunkContext->TagGuid, &PackageGuid);
209
210 return ThunkContext;
211 }
212
213
214 /**
215 Get the number of HII Package for a Package type.
216
217 @param PackageListHeader The Package List.
218 @param PackageType The Package Type.
219
220 @return The number of Package for given type.
221 **/
222 UINTN
223 GetPackageCountByType (
224 IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader,
225 IN UINT8 PackageType
226 )
227 {
228 UINTN Count;
229 EFI_HII_PACKAGE_HEADER *PackageHeader;
230
231 PackageHeader = (EFI_HII_PACKAGE_HEADER *) ((UINT8 *) PackageListHeader + sizeof (EFI_HII_PACKAGE_LIST_HEADER));
232 Count = 0;
233
234 while (PackageHeader->Type != EFI_HII_PACKAGE_END) {
235 if (PackageHeader->Type == PackageType ) {
236 Count++;
237 }
238 PackageHeader = (EFI_HII_PACKAGE_HEADER *) ((UINT8 *) PackageHeader + PackageHeader->Length);
239 }
240
241
242 return Count;
243 }
244
245 /**
246 Get the Form Package from a Framework Package List.
247
248 @param Packages Framework Package List.
249
250 @return The Form Package Header found.
251 **/
252 EFI_HII_PACKAGE_HEADER *
253 GetIfrPackage (
254 IN CONST EFI_HII_PACKAGES *Packages
255 )
256 {
257 UINTN Index;
258 TIANO_AUTOGEN_PACKAGES_HEADER **TianoAutogenPackageHdrArray;
259
260 ASSERT (Packages != NULL);
261
262 TianoAutogenPackageHdrArray = (TIANO_AUTOGEN_PACKAGES_HEADER **) (((UINT8 *) &Packages->GuidId) + sizeof (Packages->GuidId));
263
264 for (Index = 0; Index < Packages->NumberOfPackages; Index++) {
265 //
266 // The current UEFI HII build tool generate a binary in the format defined by
267 // TIANO_AUTOGEN_PACKAGES_HEADER. We assume that all packages generated in
268 // this binary is with same package type. So the returned IfrPackageCount and StringPackageCount
269 // may not be the exact number of valid package number in the binary generated
270 // by HII Build tool.
271 //
272 switch (TianoAutogenPackageHdrArray[Index]->FrameworkPackageHeader.Type) {
273 case EFI_HII_IFR:
274 return &TianoAutogenPackageHdrArray[Index]->PackageHeader;
275 break;
276 case EFI_HII_STRING:
277 case EFI_HII_FONT:
278 break;
279
280 default:
281 ASSERT (FALSE);
282 return NULL;
283 break;
284 }
285 }
286
287 return NULL;
288 }
289
290 /**
291 Get FormSet GUID.
292
293 ASSERT if no FormSet Opcode is found.
294
295 @param Packages Form Framework Package.
296 @param FormSetGuid Return the FormSet Guid.
297
298 **/
299 VOID
300 GetFormSetGuid (
301 IN EFI_HII_PACKAGE_HEADER *Package,
302 OUT EFI_GUID *FormSetGuid
303 )
304 {
305 UINTN Offset;
306 EFI_IFR_OP_HEADER *OpCode;
307 EFI_IFR_FORM_SET *FormSet;
308
309 Offset = sizeof (EFI_HII_PACKAGE_HEADER);
310 while (Offset < Package->Length) {
311 OpCode = (EFI_IFR_OP_HEADER *)((UINT8 *) Package + Offset);
312
313 switch (OpCode->OpCode) {
314 case EFI_IFR_FORM_SET_OP:
315 FormSet = (EFI_IFR_FORM_SET *) OpCode;
316 CopyGuid (FormSetGuid, (EFI_GUID *)(VOID *)&FormSet->Guid);
317 return;
318
319 default:
320 break;
321
322 }
323 Offset += OpCode->Length;
324 }
325
326 //
327 // A proper IFR must have a formset opcode.
328 //
329 ASSERT (FALSE);
330
331 }
332
333 /**
334 Creat a Thunk Context.
335
336 ASSERT if no FormSet Opcode is found.
337
338 @param Private The HII Thunk Private Context.
339 @param StringPackageCount The String package count.
340 @param FormSetGuid The IFR Package count.
341
342 @return A newly created Thunk Context.
343 @retval NULL No resource to create a new Thunk Context.
344 **/
345 HII_THUNK_CONTEXT *
346 CreateThunkContext (
347 IN HII_THUNK_PRIVATE_DATA *Private,
348 IN UINTN StringPackageCount,
349 IN UINTN IfrPackageCount
350 )
351 {
352 EFI_STATUS Status;
353 HII_THUNK_CONTEXT *ThunkContext;
354
355 ThunkContext = AllocateZeroPool (sizeof (HII_THUNK_CONTEXT));
356 ASSERT (ThunkContext != NULL);
357
358 ThunkContext->Signature = HII_THUNK_CONTEXT_SIGNATURE;
359 ThunkContext->IfrPackageCount = IfrPackageCount;
360 ThunkContext->StringPackageCount = StringPackageCount;
361 Status = AllocateHiiHandle (&ThunkContext->FwHiiHandle);
362 if (EFI_ERROR (Status)) {
363 return NULL;
364 }
365
366 return ThunkContext;
367
368 }
369
370 /**
371 Destroy the Thunk Context and free up all resource.
372
373 @param ThunkContext The HII Thunk Private Context to be freed.
374
375 **/
376 VOID
377 DestroyThunkContext (
378 IN HII_THUNK_CONTEXT *ThunkContext
379 )
380 {
381 ASSERT (ThunkContext != NULL);
382
383 FreeHiiHandle (ThunkContext->FwHiiHandle);
384
385 RemoveEntryList (&ThunkContext->Link);
386
387 if (ThunkContext->FormSet != NULL) {
388 DestroyFormSet (ThunkContext->FormSet);
389 }
390
391 FreePool (ThunkContext);
392 }
393
394 /**
395 Get the FormSet's Default Varstore ID based on the rule (Descending Priority):
396
397 1) If VarStore ID of FRAMEWORK_RESERVED_VARSTORE_ID (0x01) is found, Var Store ID is used.
398 2) If VarStore ID of FRAMEWORK_RESERVED_VARSTORE_ID is not found, First Var Store ID is used
399 as the default Var Store ID.
400
401 @param FormSet The Form Set. The Default Varstore ID is updated if found.
402
403 **/
404 VOID
405 GetFormsetDefaultVarstoreId (
406 IN OUT FORM_BROWSER_FORMSET * FormSet
407 )
408 {
409 LIST_ENTRY *StorageList;
410 FORMSET_STORAGE *Storage;
411 FORMSET_STORAGE *DefaultStorage;
412
413 //
414 // VarStoreId 0 is invalid in UEFI IFR.
415 //
416 DefaultStorage= NULL;
417 FormSet->DefaultVarStoreId = 0;
418 StorageList = GetFirstNode (&FormSet->StorageListHead);
419
420 while (!IsNull (&FormSet->StorageListHead, StorageList)) {
421 Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
422
423 DEBUG ((EFI_D_INFO, "FormSet %g: Found Varstore ID %x Name %s Size 0x%x\n", &FormSet->Guid, Storage->VarStoreId, Storage->Name, Storage->Size));
424
425 if (Storage->VarStoreId == FRAMEWORK_RESERVED_VARSTORE_ID) {
426 //
427 // 1) If VarStore ID of FRAMEWORK_RESERVED_VARSTORE_ID (0x01) is found, Var Store ID is used.
428 //
429 FormSet->DefaultVarStoreId = FRAMEWORK_RESERVED_VARSTORE_ID;
430 DefaultStorage = Storage;
431 break;
432 }
433
434 StorageList = GetNextNode (&FormSet->StorageListHead, StorageList);
435 }
436
437 if (FormSet->DefaultVarStoreId != FRAMEWORK_RESERVED_VARSTORE_ID) {
438 //
439 //
440 // 2) If VarStore ID of FRAMEWORK_RESERVED_VARSTORE_ID is not found, First Var Store ID is used
441 // as the default Var Store ID.
442 //
443 StorageList = GetFirstNode (&FormSet->StorageListHead);
444 if (!IsNull (&FormSet->StorageListHead, StorageList)) {
445 Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
446 FormSet->DefaultVarStoreId = Storage->VarStoreId;
447 DefaultStorage = Storage;
448 }
449
450 }
451
452 DEBUG_CODE_BEGIN ();
453 if (FormSet->DefaultVarStoreId == 0) {
454 DEBUG ((EFI_D_INFO, "FormSet %g: No Varstore Found\n", &FormSet->Guid));
455 } else {
456 // The name of default VARSTORE with a Explicit declaration statement will be updated to L"Setup" to make sure
457 // the Framework HII Setup module will run correctly. Framework HII Setup module always assumed that default
458 // VARSTORE to have L"Setup" as name, Formset GUID as GUID.
459
460 DEBUG ((EFI_D_INFO, "FormSet %g: Default Varstore ID (0x%x) N(%s) G(%g)\n", &FormSet->Guid, FormSet->DefaultVarStoreId, DefaultStorage->Name, &DefaultStorage->Guid));
461
462 if (StrCmp (DefaultStorage->Name, FrameworkReservedVarstoreName) != 0) {
463 DEBUG ((EFI_D_INFO, " : Name is updated from %s to %s.\n", DefaultStorage->Name, FrameworkReservedVarstoreName));
464 FormSet->OriginalDefaultVarStoreName = DefaultStorage->Name;
465 DefaultStorage->Name = AllocateCopyPool (StrSize (FrameworkReservedVarstoreName), FrameworkReservedVarstoreName);
466 }
467 }
468 DEBUG_CODE_END ();
469
470 return;
471 }
472
473 /**
474 Fetch the Ifr binary data of a FormSet.
475
476 @param Handle PackageList Handle
477 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
478 GUID), take the first FormSet found in package
479 list.
480 @param BinaryLength The length of the FormSet IFR binary.
481 @param BinaryData The buffer designed to receive the FormSet.
482
483 @retval EFI_SUCCESS Buffer filled with the requested FormSet.
484 BufferLength was updated.
485 @retval EFI_INVALID_PARAMETER The handle is unknown.
486 @retval EFI_NOT_FOUND A form or FormSet on the requested handle cannot
487 be found with the requested FormId.
488
489 **/
490 EFI_STATUS
491 GetIfrBinaryData (
492 IN EFI_HII_HANDLE Handle,
493 IN OUT EFI_GUID *FormSetGuid,
494 OUT UINTN *BinaryLength,
495 OUT UINT8 **BinaryData
496 )
497 {
498 EFI_STATUS Status;
499 EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
500 UINTN BufferSize;
501 UINT8 *Package;
502 UINT8 *OpCodeData;
503 UINT32 Offset;
504 UINT32 Offset2;
505 BOOLEAN ReturnDefault;
506 UINT32 PackageListLength;
507 EFI_HII_PACKAGE_HEADER PackageHeader;
508
509 OpCodeData = NULL;
510 Package = NULL;
511 ZeroMem (&PackageHeader, sizeof (EFI_HII_PACKAGE_HEADER));;
512
513 //
514 // if FormSetGuid is NULL or zero GUID, return first FormSet in the package list
515 //
516 if (FormSetGuid == NULL || CompareGuid (FormSetGuid, &gZeroGuid)) {
517 ReturnDefault = TRUE;
518 } else {
519 ReturnDefault = FALSE;
520 }
521
522 //
523 // Get HII PackageList
524 //
525 BufferSize = 0;
526 HiiPackageList = NULL;
527 Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
528 if (Status == EFI_BUFFER_TOO_SMALL) {
529 HiiPackageList = AllocatePool (BufferSize);
530 ASSERT (HiiPackageList != NULL);
531
532 Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
533 }
534 if (EFI_ERROR (Status)) {
535 return Status;
536 }
537
538 //
539 // Get Form package from this HII package List
540 //
541 Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
542 Offset2 = 0;
543 CopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32));
544
545 while (Offset < PackageListLength) {
546 Package = ((UINT8 *) HiiPackageList) + Offset;
547 CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
548
549 if (PackageHeader.Type == EFI_HII_PACKAGE_FORMS) {
550 //
551 // Search FormSet in this Form Package
552 //
553 Offset2 = sizeof (EFI_HII_PACKAGE_HEADER);
554 while (Offset2 < PackageHeader.Length) {
555 OpCodeData = Package + Offset2;
556
557 if (((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_FORM_SET_OP) {
558 //
559 // Check whether return default FormSet
560 //
561 if (ReturnDefault) {
562 break;
563 }
564
565 //
566 // FormSet GUID is specified, check it
567 //
568 if (CompareGuid (FormSetGuid, (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER)))) {
569 break;
570 }
571 }
572
573 Offset2 += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
574 }
575
576 if (Offset2 < PackageHeader.Length) {
577 //
578 // Target formset found
579 //
580 break;
581 }
582 }
583
584 Offset += PackageHeader.Length;
585 }
586
587 if (Offset >= PackageListLength) {
588 //
589 // Form package not found in this Package List
590 //
591 gBS->FreePool (HiiPackageList);
592 return EFI_NOT_FOUND;
593 }
594
595 if (ReturnDefault && FormSetGuid != NULL) {
596 //
597 // Return the default FormSet GUID
598 //
599 CopyMem (FormSetGuid, &((EFI_IFR_FORM_SET *) OpCodeData)->Guid, sizeof (EFI_GUID));
600 }
601
602 //
603 // To determine the length of a whole FormSet IFR binary, one have to parse all the Opcodes
604 // in this FormSet; So, here just simply copy the data from start of a FormSet to the end
605 // of the Form Package.
606 //
607 *BinaryLength = PackageHeader.Length - Offset2;
608 *BinaryData = AllocateCopyPool (*BinaryLength, OpCodeData);
609
610 gBS->FreePool (HiiPackageList);
611
612 if (*BinaryData == NULL) {
613 return EFI_OUT_OF_RESOURCES;
614 }
615
616 return EFI_SUCCESS;
617 }
618
619 /**
620 Initialize the internal data structure of a FormSet.
621
622 @param Handle PackageList Handle
623 @param FormSetGuid GUID of a formset. If not specified (NULL or zero
624 GUID), take the first FormSet found in package
625 list.
626 @param FormSet FormSet data structure.
627
628 @retval EFI_SUCCESS The function completed successfully.
629 @retval EFI_NOT_FOUND The specified FormSet could not be found.
630
631 **/
632 EFI_STATUS
633 InitializeFormSet (
634 IN EFI_HII_HANDLE Handle,
635 IN OUT EFI_GUID *FormSetGuid,
636 OUT FORM_BROWSER_FORMSET *FormSet
637 )
638 {
639 EFI_STATUS Status;
640
641 Status = GetIfrBinaryData (Handle, FormSetGuid, &FormSet->IfrBinaryLength, &FormSet->IfrBinaryData);
642 if (EFI_ERROR (Status)) {
643 return Status;
644 }
645
646 FormSet->HiiHandle = Handle;
647 CopyMem (&FormSet->Guid, FormSetGuid, sizeof (EFI_GUID));
648
649 //
650 // Parse the IFR binary OpCodes
651 //
652 Status = ParseOpCodes (FormSet);
653 if (EFI_ERROR (Status)) {
654 return Status;
655 }
656
657 GetFormsetDefaultVarstoreId (FormSet);
658 return Status;
659 }
660
661 /**
662 Parse the Form Package and build a FORM_BROWSER_FORMSET structure.
663
664 @param UefiHiiHandle PackageList Handle
665
666 @return A pointer to FORM_BROWSER_FORMSET.
667
668 **/
669 FORM_BROWSER_FORMSET *
670 ParseFormSet (
671 IN EFI_HII_HANDLE UefiHiiHandle
672 )
673 {
674 FORM_BROWSER_FORMSET *FormSet;
675 EFI_GUID FormSetGuid;
676 EFI_STATUS Status;
677
678 FormSet = AllocateZeroPool (sizeof (FORM_BROWSER_FORMSET));
679 ASSERT (FormSet != NULL);
680
681 CopyGuid (&FormSetGuid, &gZeroGuid);
682 Status = InitializeFormSet (UefiHiiHandle, &FormSetGuid, FormSet);
683 ASSERT_EFI_ERROR (Status);
684
685 return FormSet;
686 }
687