2 This driver effectuates OVMF's platform configuration settings and exposes
5 Copyright (C) 2014, Red Hat, Inc.
6 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Library/BaseLib.h>
12 #include <Library/BaseMemoryLib.h>
13 #include <Library/DebugLib.h>
14 #include <Library/DevicePathLib.h>
15 #include <Library/HiiLib.h>
16 #include <Library/MemoryAllocationLib.h>
17 #include <Library/PrintLib.h>
18 #include <Library/UefiBootServicesTableLib.h>
19 #include <Library/UefiHiiServicesLib.h>
20 #include <Protocol/DevicePath.h>
21 #include <Protocol/GraphicsOutput.h>
22 #include <Protocol/HiiConfigAccess.h>
23 #include <Guid/MdeModuleHii.h>
24 #include <Guid/OvmfPlatformConfig.h>
27 #include "PlatformConfig.h"
30 // The HiiAddPackages() library function requires that any controller (or
31 // image) handle, to be associated with the HII packages under installation, be
32 // "decorated" with a device path. The tradition seems to be a vendor device
35 // We'd like to associate our HII packages with the driver's image handle. The
36 // first idea is to use the driver image's device path. Unfortunately, loaded
37 // images only come with an EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL (not the
38 // usual EFI_DEVICE_PATH_PROTOCOL), ie. a different GUID. In addition, even the
39 // EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL interface may be NULL, if the image
40 // has been loaded from an "unnamed" memory source buffer.
42 // Hence let's just stick with the tradition -- use a dedicated vendor device
43 // path, with the driver's FILE_GUID.
47 VENDOR_DEVICE_PATH VendorDevicePath
;
48 EFI_DEVICE_PATH_PROTOCOL End
;
52 STATIC PKG_DEVICE_PATH mPkgDevicePath
= {
58 (UINT8
)(sizeof (VENDOR_DEVICE_PATH
)),
59 (UINT8
)(sizeof (VENDOR_DEVICE_PATH
) >> 8)
66 END_ENTIRE_DEVICE_PATH_SUBTYPE
,
68 (UINT8
)(END_DEVICE_PATH_LENGTH
),
69 (UINT8
)(END_DEVICE_PATH_LENGTH
>> 8)
75 // The configuration interface between the HII engine (form display etc) and
78 STATIC EFI_HII_CONFIG_ACCESS_PROTOCOL mConfigAccess
;
81 // The handle representing our list of packages after installation.
83 STATIC EFI_HII_HANDLE mInstalledPackages
;
86 // The arrays below constitute our HII package list. They are auto-generated by
87 // the VFR compiler and linked into the driver image during the build.
89 // - The strings package receives its C identifier from the driver's BASE_NAME,
92 // - The forms package receives its C identifier from the VFR file's basename,
96 extern UINT8 PlatformDxeStrings
[];
97 extern UINT8 PlatformFormsBin
[];
100 // We want to be notified about GOP installations until we find one GOP
101 // interface that lets us populate the form.
103 STATIC EFI_EVENT mGopEvent
;
106 // The registration record underneath this pointer allows us to iterate through
107 // the GOP instances one by one.
109 STATIC VOID
*mGopTracker
;
112 // The driver image handle, used to obtain the device path for <ConfigHdr>.
114 STATIC EFI_HANDLE mImageHandle
;
117 // Cache the resolutions we get from the GOP.
124 STATIC UINTN mNumGopModes
;
125 STATIC GOP_MODE
*mGopModes
;
128 Load the persistent platform configuration and translate it to binary form
131 If the platform configuration is missing, then the function fills in a
134 @param[out] MainFormState Binary form/widget state after translation.
136 @retval EFI_SUCCESS Form/widget state ready.
137 @return Error codes from underlying functions.
142 PlatformConfigToFormState (
143 OUT MAIN_FORM_STATE
*MainFormState
147 PLATFORM_CONFIG PlatformConfig
;
148 UINT64 OptionalElements
;
151 ZeroMem (MainFormState
, sizeof *MainFormState
);
153 Status
= PlatformConfigLoad (&PlatformConfig
, &OptionalElements
);
156 if (OptionalElements
& PLATFORM_CONFIG_F_GRAPHICS_RESOLUTION
) {
158 // Format the preferred resolution as text.
160 UnicodeSPrintAsciiFormat (
161 (CHAR16
*)MainFormState
->CurrentPreferredResolution
,
162 sizeof MainFormState
->CurrentPreferredResolution
,
164 (INT64
)PlatformConfig
.HorizontalResolution
,
165 (INT64
)PlatformConfig
.VerticalResolution
169 // Try to locate it in the drop-down list too. This may not succeed, but
172 for (ModeNumber
= 0; ModeNumber
< mNumGopModes
; ++ModeNumber
) {
173 if ((mGopModes
[ModeNumber
].X
== PlatformConfig
.HorizontalResolution
) &&
174 (mGopModes
[ModeNumber
].Y
== PlatformConfig
.VerticalResolution
))
176 MainFormState
->NextPreferredResolution
= (UINT32
)ModeNumber
;
185 // fall through otherwise
189 UnicodeSPrintAsciiFormat (
190 (CHAR16
*)MainFormState
->CurrentPreferredResolution
,
191 sizeof MainFormState
->CurrentPreferredResolution
,
204 This function is called by the HII machinery when it fetches the form state.
206 See the precise documentation in the UEFI spec.
208 @param[in] This The Config Access Protocol instance.
210 @param[in] Request A <ConfigRequest> format UCS-2 string describing the
213 @param[out] Progress A pointer into Request on output, identifying the query
214 element where processing failed.
216 @param[out] Results A <MultiConfigAltResp> format UCS-2 string that has
217 all values filled in for the names in the Request
220 @retval EFI_SUCCESS Extraction of form state in <MultiConfigAltResp>
222 @return Status codes from underlying functions.
229 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
230 IN CONST EFI_STRING Request
,
231 OUT EFI_STRING
*Progress
,
232 OUT EFI_STRING
*Results
235 MAIN_FORM_STATE MainFormState
;
237 EFI_STRING ConfigRequestHdr
;
238 EFI_STRING ConfigRequest
;
240 BOOLEAN AllocatedRequest
;
242 DEBUG ((DEBUG_VERBOSE
, "%a: Request=\"%s\"\n", __FUNCTION__
, Request
));
244 if ((Progress
== NULL
) || (Results
== NULL
)) {
245 return EFI_INVALID_PARAMETER
;
248 ConfigRequestHdr
= NULL
;
249 ConfigRequest
= NULL
;
251 AllocatedRequest
= FALSE
;
254 // Check if <ConfigHdr> matches the GUID and name
257 if ((Request
!= NULL
) &&
258 !HiiIsConfigHdrMatch (
260 &gOvmfPlatformConfigGuid
,
265 return EFI_NOT_FOUND
;
268 Status
= PlatformConfigToFormState (&MainFormState
);
269 if (EFI_ERROR (Status
)) {
273 if ((Request
== NULL
) || (StrStr (Request
, L
"OFFSET") == NULL
)) {
275 // Request has no <RequestElement>, so construct full request string.
276 // Allocate and fill a buffer large enough to hold <ConfigHdr>
277 // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a
280 ConfigRequestHdr
= HiiConstructConfigHdr (
281 &gOvmfPlatformConfigGuid
,
285 if (ConfigRequestHdr
== NULL
) {
286 return EFI_OUT_OF_RESOURCES
;
289 Size
= (StrLen (ConfigRequestHdr
) + 32 + 1) * sizeof (CHAR16
);
290 ConfigRequest
= AllocateZeroPool (Size
);
291 AllocatedRequest
= TRUE
;
292 if (ConfigRequest
== NULL
) {
293 FreePool (ConfigRequestHdr
);
294 return EFI_OUT_OF_RESOURCES
;
300 L
"%s&OFFSET=0&WIDTH=%016LX",
304 FreePool (ConfigRequestHdr
);
306 ConfigRequest
= Request
;
310 // Answer the textual request keying off the binary form state.
312 Status
= gHiiConfigRouting
->BlockToConfig (
315 (VOID
*)&MainFormState
,
316 sizeof MainFormState
,
320 if (EFI_ERROR (Status
)) {
323 "%a: BlockToConfig(): %r, Progress=\"%s\"\n",
326 (Status
== EFI_DEVICE_ERROR
) ? NULL
: *Progress
329 DEBUG ((DEBUG_VERBOSE
, "%a: Results=\"%s\"\n", __FUNCTION__
, *Results
));
333 // If we used a newly allocated ConfigRequest, update Progress to point to
334 // original Request instead of ConfigRequest.
336 if (Request
== NULL
) {
338 } else if (StrStr (Request
, L
"OFFSET") == NULL
) {
339 if (EFI_ERROR (Status
)) {
341 // Since we constructed ConfigRequest, failure can only occur if there
342 // is not enough memory. In this case, we point Progress to the first
343 // character of Request.
348 // In case of success, we point Progress to the null terminator of
351 *Progress
= Request
+ StrLen (Request
);
355 if (AllocatedRequest
) {
356 FreePool (ConfigRequest
);
363 Interpret the binary form state and save it as persistent platform
366 @param[in] MainFormState Binary form/widget state to verify and save.
368 @retval EFI_SUCCESS Platform configuration saved.
369 @return Error codes from underlying functions.
374 FormStateToPlatformConfig (
375 IN CONST MAIN_FORM_STATE
*MainFormState
379 PLATFORM_CONFIG PlatformConfig
;
380 CONST GOP_MODE
*GopMode
;
383 // There's nothing to do with the textual CurrentPreferredResolution field.
384 // We verify and translate the selection in the drop-down list.
386 if (MainFormState
->NextPreferredResolution
>= mNumGopModes
) {
387 return EFI_INVALID_PARAMETER
;
390 GopMode
= mGopModes
+ MainFormState
->NextPreferredResolution
;
392 ZeroMem (&PlatformConfig
, sizeof PlatformConfig
);
393 PlatformConfig
.HorizontalResolution
= GopMode
->X
;
394 PlatformConfig
.VerticalResolution
= GopMode
->Y
;
396 Status
= PlatformConfigSave (&PlatformConfig
);
401 This function is called by the HII machinery when it wants the driver to
402 interpret and persist the form state.
404 See the precise documentation in the UEFI spec.
406 @param[in] This The Config Access Protocol instance.
408 @param[in] Configuration A <ConfigResp> format UCS-2 string describing the
411 @param[out] Progress A pointer into Configuration on output,
412 identifying the element where processing failed.
414 @retval EFI_SUCCESS Configuration verified, state permanent.
416 @return Status codes from underlying functions.
422 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
423 IN CONST EFI_STRING Configuration
,
424 OUT EFI_STRING
*Progress
427 MAIN_FORM_STATE MainFormState
;
433 "%a: Configuration=\"%s\"\n",
438 if ((Progress
== NULL
) || (Configuration
== NULL
)) {
439 return EFI_INVALID_PARAMETER
;
443 // Check if <ConfigHdr> matches the GUID and name
445 *Progress
= Configuration
;
446 if ((Configuration
!= NULL
) &&
447 !HiiIsConfigHdrMatch (
449 &gOvmfPlatformConfigGuid
,
454 return EFI_NOT_FOUND
;
458 // the "read" step in RMW
460 Status
= PlatformConfigToFormState (&MainFormState
);
461 if (EFI_ERROR (Status
)) {
462 *Progress
= Configuration
;
467 // the "modify" step in RMW
469 // (Update the binary form state. This update may be partial, which is why in
470 // general we must pre-load the form state from the platform config.)
472 BlockSize
= sizeof MainFormState
;
473 Status
= gHiiConfigRouting
->ConfigToBlock (
476 (VOID
*)&MainFormState
,
480 if (EFI_ERROR (Status
)) {
483 "%a: ConfigToBlock(): %r, Progress=\"%s\"\n",
486 (Status
== EFI_BUFFER_TOO_SMALL
) ? NULL
: *Progress
492 // the "write" step in RMW
494 Status
= FormStateToPlatformConfig (&MainFormState
);
495 if (EFI_ERROR (Status
)) {
496 *Progress
= Configuration
;
506 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL
*This
,
507 IN EFI_BROWSER_ACTION Action
,
508 IN EFI_QUESTION_ID QuestionId
,
510 IN OUT EFI_IFR_TYPE_VALUE
*Value
,
511 OUT EFI_BROWSER_ACTION_REQUEST
*ActionRequest
516 "%a: Action=0x%Lx QuestionId=%d Type=%d\n",
523 if (Action
!= EFI_BROWSER_ACTION_CHANGED
) {
524 return EFI_UNSUPPORTED
;
527 switch (QuestionId
) {
528 case QUESTION_SAVE_EXIT
:
529 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT
;
532 case QUESTION_DISCARD_EXIT
:
533 *ActionRequest
= EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT
;
544 Query and save all resolutions supported by the GOP.
546 @param[in] Gop The Graphics Output Protocol instance to query.
548 @param[out] NumGopModes The number of modes supported by the GOP. On output,
549 this parameter will be positive.
551 @param[out] GopModes On output, a dynamically allocated array containing
552 the resolutions returned by the GOP. The caller is
553 responsible for freeing the array after use.
555 @retval EFI_UNSUPPORTED No modes found.
556 @retval EFI_OUT_OF_RESOURCES Failed to allocate GopModes.
557 @return Error codes from Gop->QueryMode().
564 IN EFI_GRAPHICS_OUTPUT_PROTOCOL
*Gop
,
565 OUT UINTN
*NumGopModes
,
566 OUT GOP_MODE
**GopModes
572 if (Gop
->Mode
->MaxMode
== 0) {
573 return EFI_UNSUPPORTED
;
576 *NumGopModes
= Gop
->Mode
->MaxMode
;
578 *GopModes
= AllocatePool (Gop
->Mode
->MaxMode
* sizeof **GopModes
);
579 if (*GopModes
== NULL
) {
580 return EFI_OUT_OF_RESOURCES
;
583 for (ModeNumber
= 0; ModeNumber
< Gop
->Mode
->MaxMode
; ++ModeNumber
) {
584 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION
*Info
;
587 Status
= Gop
->QueryMode (Gop
, ModeNumber
, &SizeOfInfo
, &Info
);
588 if (EFI_ERROR (Status
)) {
592 (*GopModes
)[ModeNumber
].X
= Info
->HorizontalResolution
;
593 (*GopModes
)[ModeNumber
].Y
= Info
->VerticalResolution
;
600 FreePool (*GopModes
);
606 Create a set of "one-of-many" (ie. "drop down list") option IFR opcodes,
607 based on available GOP resolutions, to be placed under a "one-of-many" (ie.
608 "drop down list") opcode.
610 @param[in] PackageList The package list with the formset and form for
611 which the drop down options are produced. Option
612 names are added as new strings to PackageList.
614 @param[out] OpCodeBuffer On output, a dynamically allocated opcode buffer
615 with drop down list options corresponding to GOP
616 resolutions. The caller is responsible for freeing
617 OpCodeBuffer with HiiFreeOpCodeHandle() after use.
619 @param[in] NumGopModes Number of entries in GopModes.
621 @param[in] GopModes Array of resolutions retrieved from the GOP.
623 @retval EFI_SUCESS Opcodes have been successfully produced.
625 @return Status codes from underlying functions. PackageList may
626 have been extended with new strings. OpCodeBuffer is
632 CreateResolutionOptions (
633 IN EFI_HII_HANDLE PackageList
,
634 OUT VOID
**OpCodeBuffer
,
635 IN UINTN NumGopModes
,
636 IN GOP_MODE
*GopModes
643 OutputBuffer
= HiiAllocateOpCodeHandle ();
644 if (OutputBuffer
== NULL
) {
645 return EFI_OUT_OF_RESOURCES
;
648 for (ModeNumber
= 0; ModeNumber
< NumGopModes
; ++ModeNumber
) {
649 CHAR16 Desc
[MAXSIZE_RES_CUR
];
650 EFI_STRING_ID NewString
;
653 UnicodeSPrintAsciiFormat (
657 (INT64
)GopModes
[ModeNumber
].X
,
658 (INT64
)GopModes
[ModeNumber
].Y
660 NewString
= HiiSetString (
664 NULL
/* for all languages */
666 if (NewString
== 0) {
667 Status
= EFI_OUT_OF_RESOURCES
;
668 goto FreeOutputBuffer
;
671 OpCode
= HiiCreateOneOfOptionOpCode (
675 EFI_IFR_NUMERIC_SIZE_4
,
678 if (OpCode
== NULL
) {
679 Status
= EFI_OUT_OF_RESOURCES
;
680 goto FreeOutputBuffer
;
684 *OpCodeBuffer
= OutputBuffer
;
688 HiiFreeOpCodeHandle (OutputBuffer
);
694 Populate the form identified by the (PackageList, FormSetGuid, FormId)
697 The drop down list of video resolutions is generated from (NumGopModes,
700 @retval EFI_SUCESS Form successfully updated.
701 @return Status codes from underlying functions.
708 IN EFI_HII_HANDLE PackageList
,
709 IN EFI_GUID
*FormSetGuid
,
710 IN EFI_FORM_ID FormId
,
711 IN UINTN NumGopModes
,
712 IN GOP_MODE
*GopModes
718 EFI_IFR_GUID_LABEL
*Anchor
;
721 OpCodeBuffer2
= NULL
;
724 // 1. Allocate an empty opcode buffer.
726 OpCodeBuffer
= HiiAllocateOpCodeHandle ();
727 if (OpCodeBuffer
== NULL
) {
728 return EFI_OUT_OF_RESOURCES
;
732 // 2. Create a label opcode (which is a Tiano extension) inside the buffer.
733 // The label's number must match the "anchor" label in the form.
735 OpCode
= HiiCreateGuidOpCode (
738 NULL
/* optional copy origin */,
741 if (OpCode
== NULL
) {
742 Status
= EFI_OUT_OF_RESOURCES
;
743 goto FreeOpCodeBuffer
;
747 Anchor
->ExtendOpCode
= EFI_IFR_EXTEND_OP_LABEL
;
748 Anchor
->Number
= LABEL_RES_NEXT
;
751 // 3. Create the opcodes inside the buffer that are to be inserted into the
754 // 3.1. Get a list of resolutions.
756 Status
= CreateResolutionOptions (
762 if (EFI_ERROR (Status
)) {
763 goto FreeOpCodeBuffer
;
767 // 3.2. Create a one-of-many question with the above options.
769 OpCode
= HiiCreateOneOfOpCode (
770 OpCodeBuffer
, // create opcode inside this
772 QUESTION_RES_NEXT
, // ID of question,
773 FORMSTATEID_MAIN_FORM
, // identifies form state
776 MAIN_FORM_STATE
, // value of question stored
777 NextPreferredResolution
778 ), // at this offset,
779 STRING_TOKEN (STR_RES_NEXT
), // Prompt,
780 STRING_TOKEN (STR_RES_NEXT_HELP
), // Help,
782 EFI_IFR_NUMERIC_SIZE_4
, // see sizeof
783 // NextPreferredResolution,
784 OpCodeBuffer2
, // buffer with possible
786 NULL
// DEFAULT opcodes
788 if (OpCode
== NULL
) {
789 Status
= EFI_OUT_OF_RESOURCES
;
790 goto FreeOpCodeBuffer2
;
794 // 4. Update the form with the opcode buffer.
796 Status
= HiiUpdateForm (
800 OpCodeBuffer
, // buffer with head anchor, and new contents to be
802 NULL
// buffer with tail anchor, for deleting old
807 HiiFreeOpCodeHandle (OpCodeBuffer2
);
810 HiiFreeOpCodeHandle (OpCodeBuffer
);
816 Load and execute the platform configuration.
818 @retval EFI_SUCCESS Configuration loaded and executed.
819 @return Status codes from PlatformConfigLoad().
824 ExecutePlatformConfig (
829 PLATFORM_CONFIG PlatformConfig
;
830 UINT64 OptionalElements
;
831 RETURN_STATUS PcdStatus
;
833 Status
= PlatformConfigLoad (&PlatformConfig
, &OptionalElements
);
834 if (EFI_ERROR (Status
)) {
836 (Status
== EFI_NOT_FOUND
) ? DEBUG_VERBOSE
: DEBUG_ERROR
,
837 "%a: failed to load platform config: %r\n",
844 if (OptionalElements
& PLATFORM_CONFIG_F_GRAPHICS_RESOLUTION
) {
846 // Pass the preferred resolution to GraphicsConsoleDxe via dynamic PCDs.
848 PcdStatus
= PcdSet32S (
849 PcdVideoHorizontalResolution
,
850 PlatformConfig
.HorizontalResolution
852 ASSERT_RETURN_ERROR (PcdStatus
);
854 PcdStatus
= PcdSet32S (
855 PcdVideoVerticalResolution
,
856 PlatformConfig
.VerticalResolution
858 ASSERT_RETURN_ERROR (PcdStatus
);
860 PcdStatus
= PcdSet8S (PcdVideoResolutionSource
, 1);
861 ASSERT_RETURN_ERROR (PcdStatus
);
868 Notification callback for GOP interface installation.
870 @param[in] Event Event whose notification function is being invoked.
872 @param[in] Context The pointer to the notification function's context, which
873 is implementation-dependent.
884 EFI_GRAPHICS_OUTPUT_PROTOCOL
*Gop
;
886 ASSERT (Event
== mGopEvent
);
889 // Check further GOPs.
895 Status
= gBS
->LocateProtocol (
896 &gEfiGraphicsOutputProtocolGuid
,
900 if (EFI_ERROR (Status
)) {
904 Status
= QueryGopModes (Gop
, &mNumGopModes
, &mGopModes
);
905 if (EFI_ERROR (Status
)) {
909 Status
= PopulateForm (
911 &gOvmfPlatformConfigGuid
,
916 if (EFI_ERROR (Status
)) {
917 FreePool (mGopModes
);
925 // Success -- so uninstall this callback. Closing the event removes all
926 // pending notifications and all protocol registrations.
928 Status
= gBS
->CloseEvent (mGopEvent
);
929 ASSERT_EFI_ERROR (Status
);
935 Entry point for this driver.
937 @param[in] ImageHandle Image handle of this driver.
938 @param[in] SystemTable Pointer to SystemTable.
940 @retval EFI_SUCESS Driver has loaded successfully.
941 @retval EFI_OUT_OF_RESOURCES Failed to install HII packages.
942 @return Error codes from lower level functions.
948 IN EFI_HANDLE ImageHandle
,
949 IN EFI_SYSTEM_TABLE
*SystemTable
954 ExecutePlatformConfig ();
956 mConfigAccess
.ExtractConfig
= &ExtractConfig
;
957 mConfigAccess
.RouteConfig
= &RouteConfig
;
958 mConfigAccess
.Callback
= &Callback
;
961 // Declare ourselves suitable for HII communication.
963 Status
= gBS
->InstallMultipleProtocolInterfaces (
965 &gEfiDevicePathProtocolGuid
,
967 &gEfiHiiConfigAccessProtocolGuid
,
971 if (EFI_ERROR (Status
)) {
976 // Save the driver image handle.
978 mImageHandle
= ImageHandle
;
981 // Publish the HII package list to HII Database.
983 mInstalledPackages
= HiiAddPackages (
984 &gEfiCallerIdGuid
, // PackageListGuid
985 ImageHandle
, // associated DeviceHandle
986 PlatformDxeStrings
, // 1st package
987 PlatformFormsBin
, // 2nd package
990 if (mInstalledPackages
== NULL
) {
991 Status
= EFI_OUT_OF_RESOURCES
;
992 goto UninstallProtocols
;
995 Status
= gBS
->CreateEvent (
1002 if (EFI_ERROR (Status
)) {
1003 goto RemovePackages
;
1006 Status
= gBS
->RegisterProtocolNotify (
1007 &gEfiGraphicsOutputProtocolGuid
,
1011 if (EFI_ERROR (Status
)) {
1016 // Check already installed GOPs.
1018 Status
= gBS
->SignalEvent (mGopEvent
);
1019 ASSERT_EFI_ERROR (Status
);
1024 gBS
->CloseEvent (mGopEvent
);
1027 HiiRemovePackages (mInstalledPackages
);
1030 gBS
->UninstallMultipleProtocolInterfaces (
1032 &gEfiDevicePathProtocolGuid
,
1034 &gEfiHiiConfigAccessProtocolGuid
,
1044 @param[in] ImageHandle Handle that identifies the image to evict.
1046 @retval EFI_SUCCESS The image has been unloaded.
1051 IN EFI_HANDLE ImageHandle
1054 if (mGopEvent
== NULL
) {
1056 // The GOP callback ran successfully and unregistered itself. Release the
1057 // resources allocated there.
1059 ASSERT (mGopModes
!= NULL
);
1060 FreePool (mGopModes
);
1063 // Otherwise we need to unregister the callback.
1065 ASSERT (mGopModes
== NULL
);
1066 gBS
->CloseEvent (mGopEvent
);
1070 // Release resources allocated by the entry point.
1072 HiiRemovePackages (mInstalledPackages
);
1073 gBS
->UninstallMultipleProtocolInterfaces (
1075 &gEfiDevicePathProtocolGuid
,
1077 &gEfiHiiConfigAccessProtocolGuid
,