3 This file contains utility functions by HII Thunk Modules.
5 Copyright (c) 2006 - 2010, 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.
16 #ifndef _HII_THUNK_UTILITY_H_
17 #define _HII_THUNK_UTILITY_H_
21 This function returns a list of the package handles of the
22 specified type that are currently active in the HII database. The
23 pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package
26 If HandleBufferLength is NULL, then ASSERT.
27 If HandleBuffer is NULL, the ASSERT.
28 If PackageType is EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is
30 If PackageType is not EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is not
34 @param PackageType Specifies the package type of the packages
35 to list or EFI_HII_PACKAGE_TYPE_ALL for
36 all packages to be listed.
38 @param PackageGuid If PackageType is
39 EFI_HII_PACKAGE_TYPE_GUID, then this is
40 the pointer to the GUID which must match
42 EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
45 @param HandleBufferLength On output, the length of the handle buffer
46 that is required for the handles found.
48 @param HandleBuffer On output, an array of EFI_HII_HANDLE instances returned.
49 The caller is responcible to free this pointer allocated.
51 @retval EFI_SUCCESS The matching handles are outputted successfully.
52 HandleBufferLength is updated with the actual length.
53 @retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operation.
54 @retval EFI_NOT_FOUND No matching handle could not be found in database.
60 IN CONST EFI_GUID
*PackageGuid
,
61 IN OUT UINTN
*HandleBufferLength
,
62 OUT EFI_HII_HANDLE
**HandleBuffer
67 Exports the contents of one or all package lists in the HII database into a buffer.
69 If Handle is not NULL and not a valid EFI_HII_HANDLE registered in the database,
71 If PackageListHeader is NULL, then ASSERT.
72 If PackageListSize is NULL, then ASSERT.
74 @param Handle The HII Handle.
75 @param PackageListHeader A pointer to a buffer that will contain the results of
77 @param PackageListSize On output, the length of the buffer that is required for the exported data.
79 @retval EFI_SUCCESS Package exported.
81 @retval EFI_OUT_OF_RESOURCES Not enought memory to complete the operations.
87 IN EFI_HII_HANDLE Handle
,
88 OUT EFI_HII_PACKAGE_LIST_HEADER
**PackageListHeader
,
89 OUT UINTN
*PackageListSize
94 Extract Hii package list GUID for given HII handle.
96 If HiiHandle could not be found in the HII database, then ASSERT.
97 If Guid is NULL, then ASSERT.
99 @param Handle Hii handle
100 @param Guid Package list GUID
102 @retval EFI_SUCCESS Successfully extract GUID from Hii database.
107 ExtractGuidFromHiiHandle (
108 IN EFI_HII_HANDLE Handle
,
114 Find the corressponding UEFI HII Handle from a Framework HII Handle given.
116 @param Private The HII Thunk Module Private context.
117 @param FwHiiHandle The Framemwork HII Handle.
119 @return NULL If Framework HII Handle is invalid.
120 @return The corresponding UEFI HII Handle.
123 FwHiiHandleToUefiHiiHandle (
124 IN CONST HII_THUNK_PRIVATE_DATA
*Private
,
125 IN FRAMEWORK_EFI_HII_HANDLE FwHiiHandle
129 Find the corressponding HII Thunk Context from a Framework HII Handle given.
131 @param Private The HII Thunk Module Private context.
132 @param FwHiiHandle The Framemwork HII Handle.
134 @return NULL If Framework HII Handle is invalid.
135 @return The corresponding HII Thunk Context.
138 FwHiiHandleToThunkContext (
139 IN CONST HII_THUNK_PRIVATE_DATA
*Private
,
140 IN FRAMEWORK_EFI_HII_HANDLE FwHiiHandle
144 Find the corressponding HII Thunk Context from a UEFI HII Handle given.
146 @param Private The HII Thunk Module Private context.
147 @param UefiHiiHandle The UEFI HII Handle.
149 @return NULL If UEFI HII Handle is invalid.
150 @return The corresponding HII Thunk Context.
153 UefiHiiHandleToThunkContext (
154 IN CONST HII_THUNK_PRIVATE_DATA
*Private
,
155 IN EFI_HII_HANDLE UefiHiiHandle
159 Find the corressponding HII Thunk Context from a Tag GUID.
161 @param Private The HII Thunk Module Private context.
162 @param Guid The Tag GUID.
164 @return NULL No HII Thunk Context matched the Tag GUID.
165 @return The corresponding HII Thunk Context.
168 TagGuidToIfrPackThunkContext (
169 IN CONST HII_THUNK_PRIVATE_DATA
*Private
,
170 IN CONST EFI_GUID
*Guid
174 This function create a HII_THUNK_CONTEXT for the input UEFI HiiHandle
175 that is created when a package list registered by a module calling
176 EFI_HII_DATABASE_PROTOCOL.NewPackageList.
177 This function records the PackageListGuid of EFI_HII_PACKAGE_LIST_HEADER
178 into the TagGuid of the created HII_THUNK_CONTEXT.
180 @param UefiHiiHandle The UEFI HII Handle.
182 @return the new created Hii thunk context.
186 CreateThunkContextForUefiHiiHandle (
187 IN EFI_HII_HANDLE UefiHiiHandle
191 Clean up the HII Thunk Context for a UEFI HII Handle.
193 @param Private The HII Thunk Module Private context.
194 @param UefiHiiHandle The UEFI HII Handle.
198 DestroyThunkContextForUefiHiiHandle (
199 IN HII_THUNK_PRIVATE_DATA
*Private
,
200 IN EFI_HII_HANDLE UefiHiiHandle
204 Get the number of HII Package for a Package type.
206 @param PackageListHeader The Package List.
207 @param PackageType The Package Type.
209 @return The number of Package for given type.
212 GetPackageCountByType (
213 IN CONST EFI_HII_PACKAGE_LIST_HEADER
*PackageListHeader
,
218 Creat a Thunk Context.
220 ASSERT if no FormSet Opcode is found.
222 @param Private The HII Thunk Private Context.
223 @param StringPackageCount The String package count.
224 @param IfrPackageCount The IFR Package count.
226 @return A newly created Thunk Context.
227 @retval NULL No resource to create a new Thunk Context.
231 IN HII_THUNK_PRIVATE_DATA
*Private
,
232 IN UINTN StringPackageCount
,
233 IN UINTN IfrPackageCount
237 Destroy the Thunk Context and free up all resource.
239 @param ThunkContext The HII Thunk Private Context to be freed.
243 DestroyThunkContext (
244 IN HII_THUNK_CONTEXT
*ThunkContext
250 ASSERT if no FormSet Opcode is found.
252 @param Packages Form Framework Package.
253 @param FormSetGuid Return the FormSet Guid.
258 IN EFI_HII_PACKAGE_HEADER
*Package
,
259 OUT EFI_GUID
*FormSetGuid
263 Get the Form Package from a Framework Package List.
265 @param Packages Framework Package List.
267 @return The Form Package Header found.
269 EFI_HII_PACKAGE_HEADER
*
271 IN CONST EFI_HII_PACKAGES
*Packages
275 Parse the Form Package and build a FORM_BROWSER_FORMSET structure.
277 @param UefiHiiHandle PackageList Handle
279 @return A pointer to FORM_BROWSER_FORMSET.
282 FORM_BROWSER_FORMSET
*
284 IN EFI_HII_HANDLE UefiHiiHandle