2 This is an example of how a driver retrieve HII data using HII Package List
3 Protocol, and how to publish the HII data.
5 Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
6 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
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.
17 #include <Protocol/HiiPackageList.h>
18 #include <Library/DevicePathLib.h>
19 #include <Library/UefiDriverEntryPoint.h>
20 #include <Library/UefiBootServicesTableLib.h>
21 #include <Library/UefiHiiServicesLib.h>
22 #include <Library/HiiLib.h>
26 /// HII specific Vendor Device Path definition.
29 VENDOR_DEVICE_PATH VendorDevicePath
;
30 EFI_DEVICE_PATH_PROTOCOL End
;
31 } HII_VENDOR_DEVICE_PATH
;
35 EFI_HII_HANDLE mHiiHandle
= NULL
;
36 EFI_HANDLE mDriverHandle
= NULL
;
38 HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath
= {
44 (UINT8
) (sizeof (VENDOR_DEVICE_PATH
)),
45 (UINT8
) ((sizeof (VENDOR_DEVICE_PATH
)) >> 8)
49 // {D49D2EB0-44D5-4621-9FD6-1A92C9109B99}
51 { 0xD49D2EB0, 0x44D5, 0x4621, { 0x9F, 0xD6, 0x1A, 0x92, 0xC9, 0x10, 0x9B, 0x99 } }
55 END_ENTIRE_DEVICE_PATH_SUBTYPE
,
57 (UINT8
) (END_DEVICE_PATH_LENGTH
),
58 (UINT8
) ((END_DEVICE_PATH_LENGTH
) >> 8)
64 Main entry for this driver.
66 @param[in] ImageHandle Image handle this driver.
67 @param[in] SystemTable Pointer to SystemTable.
69 @retval EFI_SUCESS This function always complete successfully.
74 HiiResourcesSampleInit (
75 IN EFI_HANDLE ImageHandle
,
76 IN EFI_SYSTEM_TABLE
*SystemTable
80 EFI_HII_PACKAGE_LIST_HEADER
*PackageList
;
83 // Retrieve HII package list from ImageHandle
85 Status
= gBS
->OpenProtocol (
87 &gEfiHiiPackageListProtocolGuid
,
88 (VOID
**) &PackageList
,
91 EFI_OPEN_PROTOCOL_GET_PROTOCOL
93 if (EFI_ERROR (Status
)) {
98 // Publish sample Fromset
100 Status
= gBS
->InstallProtocolInterface (
102 &gEfiDevicePathProtocolGuid
,
103 EFI_NATIVE_INTERFACE
,
104 &mHiiVendorDevicePath
106 if (EFI_ERROR (Status
)) {
111 // Publish HII package list to HII Database.
113 Status
= gHiiDatabase
->NewPackageList (
119 if (EFI_ERROR (Status
)) {
127 Unloads the application and its installed protocol.
129 @param[in] ImageHandle Handle that identifies the image to be unloaded.
131 @retval EFI_SUCCESS The image has been unloaded.
135 HiiResourcesSampleUnload (
136 IN EFI_HANDLE ImageHandle
139 if (mDriverHandle
!= NULL
) {
140 gBS
->UninstallProtocolInterface (
142 &gEfiDevicePathProtocolGuid
,
143 &mHiiVendorDevicePath
145 mDriverHandle
= NULL
;
148 if (mHiiHandle
!= NULL
) {
149 HiiRemovePackages (mHiiHandle
);