2 This file contains the form processing code to the HII database.
4 Copyright (c) 2006 - 2008 Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "HiiDatabase.h"
21 IN EFI_HII_PROTOCOL
*This
,
22 IN FRAMEWORK_EFI_HII_HANDLE Handle
,
23 IN OUT UINTN
*BufferSize
,
30 This function allows a program to extract a form or form package that has
31 previously been registered with the EFI HII database.
40 return EFI_UNSUPPORTED
;
46 IN EFI_HII_PROTOCOL
*This
,
47 IN FRAMEWORK_EFI_HII_HANDLE Handle
,
48 IN EFI_FORM_ID FormId
,
49 IN OUT UINTN
*BufferLengthTemp
,
56 This function allows a program to extract a form or form package that has
57 previously been registered with the EFI HII database.
60 This - A pointer to the EFI_HII_PROTOCOL instance.
62 Handle - Handle on which the form resides. Type FRAMEWORK_EFI_HII_HANDLE is defined in
63 EFI_HII_PROTOCOL.NewPack() in the Packages section.
65 FormId - The ID of the form to return. If the ID is zero, the entire form package is returned.
66 Type EFI_FORM_ID is defined in "Related Definitions" below.
68 BufferLength - On input, the length of the Buffer. On output, the length of the returned buffer, if
69 the length was sufficient and, if it was not, the length that is required to fit the
72 Buffer - The buffer designed to receive the form(s).
76 EFI_SUCCESS - Buffer filled with the requested forms. BufferLength
79 EFI_INVALID_PARAMETER - The handle is unknown.
81 EFI_NOT_FOUND - A form on the requested handle cannot be found with the
84 EFI_BUFFER_TOO_SMALL - The buffer provided was not large enough to allow the form to be stored.
89 return EFI_UNSUPPORTED
;
95 IN EFI_HII_PROTOCOL
*This
,
96 IN FRAMEWORK_EFI_HII_HANDLE Handle
,
98 OUT EFI_HII_VARIABLE_PACK_LIST
**VariablePackList
104 This function allows a program to extract the NV Image
105 that represents the default storage image
108 This - A pointer to the EFI_HII_PROTOCOL instance.
109 Handle - The HII handle from which will have default data retrieved.
110 UINTN - Mask used to retrieve the default image.
111 VariablePackList - Callee allocated, tightly-packed, link list data
112 structure that contain all default varaible packs
113 from the Hii Database.
116 EFI_NOT_FOUND - If Hii database does not contain any default images.
117 EFI_INVALID_PARAMETER - Invalid input parameter.
118 EFI_SUCCESS - Operation successful.
126 ThunkUpdateFormCallBack (
127 IN EFI_HANDLE CallbackHandle
,
128 IN CONST HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY
*HandleMapEntry
132 EFI_FORM_CALLBACK_PROTOCOL
*FrameworkFormCallbackProtocol
;
133 EFI_HII_CONFIG_ACCESS_PROTOCOL
*ConfigAccessProtocol
;
134 EFI_HANDLE UefiDriverHandle
;
135 HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE
*ConfigAccessProtocolInstance
;
137 Status
= gBS
->HandleProtocol (
139 &gEfiFormCallbackProtocolGuid
,
140 (VOID
**) &FrameworkFormCallbackProtocol
142 if (EFI_ERROR (Status
)) {
143 return EFI_INVALID_PARAMETER
;
146 Status
= mUefiHiiDatabaseProtocol
->GetPackageListHandle (
147 mUefiHiiDatabaseProtocol
,
148 HandleMapEntry
->UefiHiiHandle
,
151 ASSERT_EFI_ERROR (Status
);
152 Status
= gBS
->HandleProtocol (
154 &gEfiHiiConfigAccessProtocolGuid
,
155 (VOID
**) &ConfigAccessProtocol
157 ASSERT_EFI_ERROR (Status
);
159 ConfigAccessProtocolInstance
= HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE_FROM_PROTOCOL (ConfigAccessProtocol
);
161 ConfigAccessProtocolInstance
->FrameworkFormCallbackProtocol
= FrameworkFormCallbackProtocol
;
169 IN EFI_HII_PROTOCOL
*This
,
170 IN FRAMEWORK_EFI_HII_HANDLE Handle
,
171 IN EFI_FORM_LABEL Label
,
173 IN EFI_HII_UPDATE_DATA
*Data
178 This function allows the caller to update a form that has
179 previously been registered with the EFI HII database.
182 Handle - Hii Handle associated with the Formset to modify
183 Label - Update information starting immediately after this label in the IFR
184 AddData - If TRUE, add data. If FALSE, remove data
185 Data - If adding data, this is the pointer to the data to add
188 EFI_SUCCESS - Update success.
194 EFI_HII_THUNK_PRIVATE_DATA
*Private
;
195 HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY
*HandleMapEntry
;
197 Private
= EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This
);
199 HandleMapEntry
= FrameworkHiiHandleToMapDatabaseEntry (Private
, Handle
);
201 if (HandleMapEntry
== NULL
) {
202 return EFI_NOT_FOUND
;
205 if (Data
->FormSetUpdate
) {
206 Status
= ThunkUpdateFormCallBack ((EFI_HANDLE
) (UINTN
) Data
->FormCallbackHandle
, HandleMapEntry
);
207 if (EFI_ERROR (Status
)) {