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 - 2011, 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 <Guid/HiiResourceSampleHii.h>
18 #include <Protocol/HiiPackageList.h>
19 #include <Library/DevicePathLib.h>
20 #include <Library/UefiDriverEntryPoint.h>
21 #include <Library/UefiBootServicesTableLib.h>
22 #include <Library/UefiHiiServicesLib.h>
23 #include <Library/HiiLib.h>
27 /// HII specific Vendor Device Path definition.
30 VENDOR_DEVICE_PATH VendorDevicePath
;
31 EFI_DEVICE_PATH_PROTOCOL End
;
32 } HII_VENDOR_DEVICE_PATH
;
36 EFI_HII_HANDLE mHiiHandle
= NULL
;
37 EFI_HANDLE mDriverHandle
= NULL
;
39 HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath
= {
45 (UINT8
) (sizeof (VENDOR_DEVICE_PATH
)),
46 (UINT8
) ((sizeof (VENDOR_DEVICE_PATH
)) >> 8)
49 HII_RESOURCE_SAMPLE_FORM_SET_GUID
53 END_ENTIRE_DEVICE_PATH_SUBTYPE
,
55 (UINT8
) (END_DEVICE_PATH_LENGTH
),
56 (UINT8
) ((END_DEVICE_PATH_LENGTH
) >> 8)
62 Main entry for this driver.
64 @param[in] ImageHandle Image handle this driver.
65 @param[in] SystemTable Pointer to SystemTable.
67 @retval EFI_SUCESS This function always complete successfully.
72 HiiResourcesSampleInit (
73 IN EFI_HANDLE ImageHandle
,
74 IN EFI_SYSTEM_TABLE
*SystemTable
78 EFI_HII_PACKAGE_LIST_HEADER
*PackageList
;
81 // Retrieve HII package list from ImageHandle
83 Status
= gBS
->OpenProtocol (
85 &gEfiHiiPackageListProtocolGuid
,
86 (VOID
**) &PackageList
,
89 EFI_OPEN_PROTOCOL_GET_PROTOCOL
91 if (EFI_ERROR (Status
)) {
96 // Publish sample Fromset
98 Status
= gBS
->InstallProtocolInterface (
100 &gEfiDevicePathProtocolGuid
,
101 EFI_NATIVE_INTERFACE
,
102 &mHiiVendorDevicePath
104 if (EFI_ERROR (Status
)) {
109 // Publish HII package list to HII Database.
111 Status
= gHiiDatabase
->NewPackageList (
117 if (EFI_ERROR (Status
)) {
125 Unloads the application and its installed protocol.
127 @param[in] ImageHandle Handle that identifies the image to be unloaded.
129 @retval EFI_SUCCESS The image has been unloaded.
133 HiiResourcesSampleUnload (
134 IN EFI_HANDLE ImageHandle
137 if (mDriverHandle
!= NULL
) {
138 gBS
->UninstallProtocolInterface (
140 &gEfiDevicePathProtocolGuid
,
141 &mHiiVendorDevicePath
143 mDriverHandle
= NULL
;
146 if (mHiiHandle
!= NULL
) {
147 HiiRemovePackages (mHiiHandle
);