]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/HiiDatabase.h
EdkCompatibilityPkg: Fix typos in comments
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / FrameworkHiiOnUefiHiiThunk / HiiDatabase.h
CommitLineData
26a76fbc 1/** @file\r
4259256b 2\r
3 This file contains global defines and prototype definitions\r
a3318eaf 4 for the Framework HII to Uefi HII Thunk Module.\r
4259256b 5 \r
27e36f23 6Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
584d5652 7This program and the accompanying materials\r
4259256b 8are licensed and made available under the terms and conditions of the BSD License\r
9which accompanies this distribution. The full text of the license may be found at\r
10http://opensource.org/licenses/bsd-license.php\r
11\r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
26a76fbc
LG
17#ifndef _HIIDATABASE_H_\r
18#define _HIIDATABASE_H_\r
4259256b 19\r
20\r
21#include <FrameworkDxe.h>\r
22\r
23#include <Guid/GlobalVariable.h>\r
24#include <Protocol/FrameworkFormCallback.h>\r
25#include <Protocol/FrameworkHii.h>\r
137c54ac 26#include <Protocol/FrameworkFormBrowser.h>\r
4259256b 27\r
28//\r
29// UEFI HII Protocols\r
30//\r
31#include <Protocol/HiiFont.h>\r
32#include <Protocol/HiiImage.h>\r
33#include <Protocol/HiiString.h>\r
34#include <Protocol/HiiDatabase.h>\r
35#include <Protocol/HiiConfigRouting.h>\r
36#include <Protocol/HiiConfigAccess.h>\r
a235abd2 37#include <Protocol/UgaDraw.h>\r
6a824198 38#include <Guid/HiiFormMapMethodGuid.h>\r
27e36f23 39#include <Guid/FrameworkBdsFrontPageFormSet.h>\r
4259256b 40\r
41#include <Library/BaseLib.h>\r
42#include <Library/DebugLib.h>\r
43#include <Library/UefiDriverEntryPoint.h>\r
44#include <Library/MemoryAllocationLib.h>\r
45#include <Library/BaseMemoryLib.h>\r
46#include <Library/UefiBootServicesTableLib.h>\r
47#include <Library/UefiRuntimeServicesTableLib.h>\r
4259256b 48#include <Library/HiiLib.h>\r
a235abd2 49#include <Library/UefiLib.h>\r
a235abd2 50#include <Library/PcdLib.h>\r
7c9d25ae 51#include <Library/LanguageLib.h>\r
59aefb7e 52#include <Library/PrintLib.h>\r
99a83b4c 53\r
7e26c7e7 54#include <Guid/MdeModuleHii.h>\r
59336178 55\r
a9d85320 56#include "UefiIfrParser.h"\r
57\r
a3318eaf 58\r
59//\r
73d1dcbb 60// VARSTORE ID of 0 for Buffer Storage Type Storage is defined as invalid in UEFI 2.1 HII. VARSTORE ID\r
61// 0 is the default VarStore ID for storage without explicit declaration in Framework HII 0.92. EDK II UEFI VFR compiler\r
62// in compatible mode will assign 0x0001 as UEFI VARSTORE ID to this default storage id in Framework VFR without\r
63// VARSTORE declaration.\r
64// \r
65// In addition, the Name of Default VarStore is assumed to be L"Setup" for those storage without explicit VARSTORE declaration in the formset\r
66// by Framework HII. EDK II UEFI VFR compiler in compatible mode hard-coded L"Setup" as VARSTORE name.\r
a3318eaf 67//\r
a9d85320 68#define FRAMEWORK_RESERVED_VARSTORE_ID 0x0001\r
73d1dcbb 69#define FRAMEWORK_RESERVED_VARSTORE_NAME L"Setup"\r
a3318eaf 70\r
974a0271 71///\r
72/// The size of a 3 character ISO639 language code.\r
73///\r
74#define ISO_639_2_ENTRY_SIZE 3\r
75\r
88b6bcec 76#pragma pack (1)\r
4259256b 77typedef struct {\r
70d72ba9 78 EFI_HII_PACK_HEADER FrameworkPackageHeader;\r
4259256b 79 EFI_HII_PACKAGE_HEADER PackageHeader;\r
80} TIANO_AUTOGEN_PACKAGES_HEADER;\r
88b6bcec 81#pragma pack ()\r
4259256b 82\r
0368663f 83#define HII_THUNK_PRIVATE_DATA_FROM_THIS(Record) CR(Record, HII_THUNK_PRIVATE_DATA, Hii, HII_THUNK_PRIVATE_DATA_SIGNATURE)\r
a3a83173 84#define HII_THUNK_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('H', 'i', 'I', 'T')\r
4259256b 85typedef struct {\r
86 UINTN Signature;\r
87 EFI_HANDLE Handle;\r
88 EFI_HII_PROTOCOL Hii;\r
4259256b 89\r
90 //\r
0368663f 91 // The head of link list for all HII_THUNK_CONTEXT.\r
4259256b 92 //\r
0368663f 93 LIST_ENTRY ThunkContextListHead;\r
ea58467b 94\r
ea58467b 95 EFI_HANDLE RemovePackNotifyHandle;\r
96 EFI_HANDLE AddPackNotifyHandle;\r
0368663f 97} HII_THUNK_PRIVATE_DATA;\r
98\r
4259256b 99\r
100\r
0368663f 101\r
102\r
103#define QUESTION_ID_MAP_ENTRY_FROM_LINK(Record) CR(Record, QUESTION_ID_MAP_ENTRY, Link, QUESTION_ID_MAP_ENTRY_SIGNATURE)\r
a3a83173 104#define QUESTION_ID_MAP_ENTRY_SIGNATURE SIGNATURE_32 ('Q', 'I', 'M', 'E')\r
0368663f 105typedef struct {\r
106 UINT32 Signature;\r
107 LIST_ENTRY Link;\r
108 UINT16 FwQId;\r
109 EFI_QUESTION_ID UefiQid;\r
110} QUESTION_ID_MAP_ENTRY;\r
111\r
112\r
113\r
114#define QUESTION_ID_MAP_FROM_LINK(Record) CR(Record, QUESTION_ID_MAP, Link, QUESTION_ID_MAP_SIGNATURE)\r
a3a83173 115#define QUESTION_ID_MAP_SIGNATURE SIGNATURE_32 ('Q', 'I', 'M', 'P')\r
0368663f 116typedef struct {\r
117 UINT32 Signature;\r
118 LIST_ENTRY Link;\r
119 UINT16 VarStoreId;\r
120 UINTN VarSize;\r
121 LIST_ENTRY MapEntryListHead;\r
122} QUESTION_ID_MAP;\r
123\r
124\r
125\r
126#define HII_THUNK_CONTEXT_FROM_LINK(Record) CR(Record, HII_THUNK_CONTEXT, Link, HII_THUNK_CONTEXT_SIGNATURE)\r
a3a83173 127#define HII_THUNK_CONTEXT_SIGNATURE SIGNATURE_32 ('H', 'T', 'H', 'M')\r
0368663f 128typedef struct {\r
129 LIST_ENTRY Link;\r
4259256b 130 UINT32 Signature;\r
0368663f 131 FRAMEWORK_EFI_HII_HANDLE FwHiiHandle;\r
4259256b 132 EFI_HII_HANDLE UefiHiiHandle;\r
63dd6a96 133 EFI_HANDLE UefiHiiDriverHandle;\r
4259256b 134\r
0368663f 135 UINTN IfrPackageCount;\r
136 UINTN StringPackageCount;\r
137\r
d4775f2a 138 BOOLEAN ByFrameworkHiiNewPack;\r
139\r
4259256b 140 //\r
3321fa09 141 // HII Thunk will use TagGuid to associate the String Package and Form Package togehter.\r
142 // See description for TagGuid. This field is to record if either one of the following condition \r
143 // is TRUE:\r
144 // 1) if ((SharingStringPack == TRUE) && (StringPackageCount != 0 && IfrPackageCount == 0)), then this Package List only \r
145 /// has String Packages and provides Strings to other IFR package.\r
146 // 2) if ((SharingStringPack == TRUE) && (StringPackageCount == 0 && IfrPackageCount != 1)), then this Form Package\r
147 // copied String Packages from other Package List.\r
148 // 3) if ((SharingStringPack == FALSE)), this Package does not provide String Package or copy String Packages from other\r
149 // Package List.\r
150 //\r
151 //\r
152 // When a Hii->NewString() is called for this FwHiiHandle and SharingStringPack is TRUE, then all Package List that sharing\r
153 // the same TagGuid will update or create String in there respective String Packages. If SharingStringPack is FALSE, then\r
154 // only the String from String Packages in this Package List will be updated or created.\r
155 //\r
156 BOOLEAN SharingStringPack;\r
157\r
158 //\r
4259256b 159 // The HII 0.92 version of HII data implementation in EDK 1.03 and 1.04 make an the following assumption\r
160 // in both HII Database implementation and all modules that registering packages:\r
0368663f 161 // If a Package List has only IFR package and no String Package, the IFR package will reference \r
162 // String in another Package List registered with the HII database with the same EFI_HII_PACKAGES.GuidId.\r
163 // TagGuid is the used to record this GuidId.\r
4259256b 164 EFI_GUID TagGuid;\r
0368663f 165\r
0368663f 166 UINT8 *NvMapOverride;\r
167\r
a9d85320 168 FORM_BROWSER_FORMSET *FormSet;\r
169\r
0368663f 170} HII_THUNK_CONTEXT;\r
171\r
4259256b 172\r
0368663f 173\r
a3a83173 174#define BUFFER_STORAGE_ENTRY_SIGNATURE SIGNATURE_32 ('H', 'T', 's', 'k')\r
0368663f 175#define BUFFER_STORAGE_ENTRY_FROM_LINK(Record) CR(Record, BUFFER_STORAGE_ENTRY, Link, BUFFER_STORAGE_ENTRY_SIGNATURE)\r
ebbd2793 176typedef struct {\r
0368663f 177 LIST_ENTRY Link;\r
ebbd2793 178 UINT32 Signature;\r
179 EFI_GUID Guid;\r
180 CHAR16 *Name;\r
181 UINTN Size;\r
182 UINT16 VarStoreId;\r
0368663f 183} BUFFER_STORAGE_ENTRY;\r
184\r
f6f910dd 185#pragma pack(1)\r
6d931089
LG
186///\r
187/// HII specific Vendor Device Path Node definition.\r
188///\r
189typedef struct {\r
190 VENDOR_DEVICE_PATH VendorDevicePath;\r
191 UINT32 Reserved;\r
192 UINT64 UniqueId;\r
193} HII_VENDOR_DEVICE_PATH_NODE;\r
ebbd2793 194\r
f6f910dd 195///\r
196/// HII specific Vendor Device Path definition.\r
197///\r
198typedef struct {\r
6d931089 199 HII_VENDOR_DEVICE_PATH_NODE Node;\r
f6f910dd 200 EFI_DEVICE_PATH_PROTOCOL End;\r
201} HII_VENDOR_DEVICE_PATH;\r
f6f910dd 202#pragma pack()\r
0368663f 203\r
a3a83173 204#define CONFIG_ACCESS_PRIVATE_SIGNATURE SIGNATURE_32 ('H', 'T', 'c', 'a')\r
0368663f 205#define CONFIG_ACCESS_PRIVATE_FROM_PROTOCOL(Record) CR(Record, CONFIG_ACCESS_PRIVATE, ConfigAccessProtocol, CONFIG_ACCESS_PRIVATE_SIGNATURE)\r
ebbd2793 206typedef struct {\r
207 UINT32 Signature;\r
208 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccessProtocol;\r
0368663f 209 //\r
210 // Framework's callback\r
211 //\r
212 EFI_FORM_CALLBACK_PROTOCOL *FormCallbackProtocol;\r
213\r
0368663f 214 HII_THUNK_CONTEXT *ThunkContext;\r
215} CONFIG_ACCESS_PRIVATE;\r
216\r
217\r
ebbd2793 218\r
a3a83173 219#define EFI_FORMBROWSER_THUNK_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('F', 'B', 'T', 'd')\r
0368663f 220#define EFI_FORMBROWSER_THUNK_PRIVATE_DATA_FROM_THIS(Record) CR(Record, EFI_FORMBROWSER_THUNK_PRIVATE_DATA, FormBrowser, EFI_FORMBROWSER_THUNK_PRIVATE_DATA_SIGNATURE)\r
137c54ac 221typedef struct {\r
222 UINTN Signature;\r
223 EFI_HANDLE Handle;\r
0368663f 224 HII_THUNK_PRIVATE_DATA *ThunkPrivate;\r
137c54ac 225 EFI_FORM_BROWSER_PROTOCOL FormBrowser;\r
226} EFI_FORMBROWSER_THUNK_PRIVATE_DATA;\r
227\r
228\r
4259256b 229//\r
230// Extern Variables\r
231//\r
59336178 232extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;\r
59336178 233extern CONST EFI_HII_IMAGE_PROTOCOL *mHiiImageProtocol;\r
234extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProtocol;\r
133a9dfb 235extern CONST EFI_HII_FONT_PROTOCOL *mHiiFontProtocol;\r
59336178 236extern CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRoutingProtocol;\r
0368663f 237extern CONST EFI_FORM_BROWSER2_PROTOCOL *mFormBrowser2Protocol;\r
4259256b 238\r
0368663f 239extern HII_THUNK_PRIVATE_DATA *mHiiThunkPrivateData;\r
240\r
241extern BOOLEAN mInFrameworkUpdatePakcage;\r
ea58467b 242\r
243\r
26a76fbc
LG
244/**\r
245\r
246 Registers the various packages that are passed in a Package List.\r
247\r
248 @param This Pointer of Frameowk HII protocol instance.\r
249 @param Packages Pointer of HII packages.\r
250 @param Handle Handle value to be returned.\r
251\r
4fc0be87 252 @retval EFI_SUCCESS Packages has added to HII database successfully.\r
26a76fbc
LG
253 @retval EFI_INVALID_PARAMETER If Handle or Packages is NULL.\r
254\r
255**/\r
4259256b 256EFI_STATUS\r
257EFIAPI\r
258HiiNewPack (\r
26a76fbc
LG
259 IN EFI_HII_PROTOCOL *This,\r
260 IN EFI_HII_PACKAGES *Packages,\r
261 OUT FRAMEWORK_EFI_HII_HANDLE *Handle\r
e00e1d46 262 );\r
4259256b 263\r
26a76fbc
LG
264/**\r
265\r
266 Remove a package from the HII database.\r
267\r
268 @param This Pointer of Frameowk HII protocol instance.\r
269 @param Handle Handle value to be removed.\r
270\r
4fc0be87 271 @retval EFI_SUCCESS Packages has added to HII database successfully.\r
26a76fbc
LG
272 @retval EFI_INVALID_PARAMETER If Handle or Packages is NULL.\r
273\r
274**/\r
4259256b 275EFI_STATUS\r
276EFIAPI\r
277HiiRemovePack (\r
a3318eaf 278 IN EFI_HII_PROTOCOL *This,\r
4259256b 279 IN FRAMEWORK_EFI_HII_HANDLE Handle\r
e00e1d46 280 );\r
4259256b 281\r
26a76fbc
LG
282/**\r
283 Determines the handles that are currently active in the database.\r
284\r
285 This function determines the handles that are currently active in the database. \r
286 For example, a program wishing to create a Setup-like configuration utility would use this call \r
287 to determine the handles that are available. It would then use calls defined in the forms section \r
288 below to extract forms and then interpret them.\r
289\r
290 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
291 @param HandleBufferLength On input, a pointer to the length of the handle buffer. \r
292 On output, the length of the handle buffer that is required for the handles found.\r
293 @param Handle Pointer to an array of EFI_HII_HANDLE instances returned. \r
294 Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack() in the Packages section.\r
295\r
296 @retval EFI_SUCCESS Handle was updated successfully.\r
297 \r
298 @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter indicates that Handle is too small \r
299 to support the number of handles. HandleBufferLength is updated with a value that \r
300 will enable the data to fit.\r
301**/\r
4259256b 302EFI_STATUS\r
303EFIAPI\r
304HiiFindHandles (\r
26a76fbc
LG
305 IN EFI_HII_PROTOCOL *This,\r
306 IN OUT UINT16 *HandleBufferLength,\r
307 OUT FRAMEWORK_EFI_HII_HANDLE *Handle\r
e00e1d46 308 );\r
4259256b 309\r
26a76fbc
LG
310/**\r
311\r
312 This thunk module only handles UEFI HII packages. The caller of this function \r
313 won't be able to parse the content. Therefore, it is not supported.\r
314 \r
315 This function will ASSERT and return EFI_UNSUPPORTED.\r
316\r
317 @param This N.A.\r
318 @param Handle N.A.\r
319 @param BufferSize N.A.\r
320 @param Buffer N.A.\r
321\r
322 @retval EFI_UNSUPPORTED\r
323\r
324**/\r
4259256b 325EFI_STATUS\r
326EFIAPI\r
327HiiExportDatabase (\r
26a76fbc
LG
328 IN EFI_HII_PROTOCOL *This,\r
329 IN FRAMEWORK_EFI_HII_HANDLE Handle,\r
330 IN OUT UINTN *BufferSize,\r
331 OUT VOID *Buffer\r
e00e1d46 332 );\r
4259256b 333\r
26a76fbc
LG
334/**\r
335 Translates a Unicode character into the corresponding font glyph.\r
336 \r
337 Notes:\r
338 This function is only called by Graphics Console module and GraphicsLib. \r
339 Wrap the Framework HII GetGlyph function to UEFI Font Protocol.\r
340 \r
341 EDK II provides a UEFI Graphics Console module. ECP provides a GraphicsLib \r
342 complying to UEFI HII.\r
343 \r
344 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
345 @param Source A pointer to a Unicode string.\r
346 @param Index On input, the offset into the string from which to fetch the character. On successful completion, the \r
347 index is updated to the first character past the character(s) making up the just extracted glyph. \r
348 @param GlyphBuffer Pointer to an array where the glyphs corresponding to the characters in the source may be stored. \r
349 GlyphBuffer is assumed to be wide enough to accept a wide glyph character.\r
350 @param BitWidth If EFI_SUCCESS was returned, the UINT16 pointed to by this value is filled with the length of the glyph in pixels. \r
351 It is unchanged if the call was unsuccessful.\r
352 @param InternalStatus To save the time required to read the string from the beginning on each glyph extraction \r
353 (for example, to ensure that the narrow versus wide glyph mode is correct), this value is \r
354 updated each time the function is called with the status that is local to the call. The cell pointed \r
355 to by this parameter must be initialized to zero prior to invoking the call the first time for any string.\r
356\r
357 @retval EFI_SUCCESS It worked.\r
358 @retval EFI_NOT_FOUND A glyph for a character was not found.\r
359 \r
360\r
361**/\r
4259256b 362EFI_STATUS\r
363EFIAPI\r
364HiiGetGlyph (\r
26a76fbc
LG
365 IN EFI_HII_PROTOCOL *This,\r
366 IN CHAR16 *Source,\r
367 IN OUT UINT16 *Index,\r
368 OUT UINT8 **GlyphBuffer,\r
369 OUT UINT16 *BitWidth,\r
370 IN OUT UINT32 *InternalStatus\r
e00e1d46 371 );\r
4259256b 372\r
26a76fbc
LG
373/**\r
374 Translates a glyph into the format required for input to the Universal Graphics Adapter (UGA) Block Transfer (BLT) routines.\r
375 \r
376 Notes:\r
377 This function is only called by Graphics Console module and GraphicsLib. \r
378 EDK II provides a UEFI Graphics Console module. ECP provides a GraphicsLib \r
379 complying to UEFI HII.\r
380 \r
381 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
382 @param GlyphBuffer A pointer to the buffer that contains glyph data. \r
383 @param Foreground The foreground setting requested to be used for the generated BltBuffer data. Type EFI_UGA_PIXEL is defined in "Related Definitions" below.\r
384 @param Background The background setting requested to be used for the generated BltBuffer data. \r
385 @param Count The entry in the BltBuffer upon which to act.\r
386 @param Width The width in bits of the glyph being converted.\r
387 @param Height The height in bits of the glyph being converted\r
388 @param BltBuffer A pointer to the buffer that contains the data that is ready to be used by the UGA BLT routines. \r
389\r
390 @retval EFI_SUCCESS It worked.\r
391 @retval EFI_NOT_FOUND A glyph for a character was not found.\r
392 \r
393\r
394**/\r
4259256b 395EFI_STATUS\r
396EFIAPI\r
397HiiGlyphToBlt (\r
398 IN EFI_HII_PROTOCOL *This,\r
399 IN UINT8 *GlyphBuffer,\r
400 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,\r
401 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,\r
402 IN UINTN Count,\r
403 IN UINTN Width,\r
404 IN UINTN Height,\r
405 IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer\r
e00e1d46 406 );\r
4259256b 407\r
26a76fbc
LG
408/**\r
409 Create or update a String Token in a String Package.\r
410\r
411 If *Reference == 0, a new String Token is created.\r
412\r
413 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
414 @param Language Pointer to a NULL-terminated string containing a single ISO 639-2 language\r
415 identifier, indicating the language to print. A string consisting of\r
416 all spaces indicates that the string is applicable to all languages.\r
417 @param Handle The handle of the language pack to which the string is to be added.\r
418 @param Reference The string token assigned to the string.\r
419 @param NewString The string to be added.\r
420\r
421\r
422 @retval EFI_SUCCESS The string was effectively registered.\r
423 @retval EFI_INVALID_PARAMETER The Handle was unknown. The string is not created or updated in the\r
424 the string package.\r
425**/\r
4259256b 426EFI_STATUS\r
427EFIAPI\r
428HiiNewString (\r
26a76fbc
LG
429 IN EFI_HII_PROTOCOL *This,\r
430 IN CHAR16 *Language,\r
431 IN FRAMEWORK_EFI_HII_HANDLE Handle,\r
432 IN OUT STRING_REF *Reference,\r
433 IN CHAR16 *NewString\r
e00e1d46 434 );\r
4259256b 435\r
26a76fbc
LG
436/**\r
437 This function extracts a string from a package already registered with the EFI HII database.\r
438\r
439 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
440 @param Handle The HII handle on which the string resides.\r
441 @param Token The string token assigned to the string.\r
442 @param Raw If TRUE, the string is returned unedited in the internal storage format described\r
443 above. If false, the string returned is edited by replacing <cr> with <space>\r
444 and by removing special characters such as the <wide> prefix.\r
445 @param LanguageString Pointer to a NULL-terminated string containing a single ISO 639-2 language\r
446 identifier, indicating the language to print. If the LanguageString is empty (starts\r
447 with a NULL), the default system language will be used to determine the language.\r
448 @param BufferLength Length of the StringBuffer. If the status reports that the buffer width is too\r
449 small, this parameter is filled with the length of the buffer needed.\r
450 @param StringBuffer The buffer designed to receive the characters in the string. Type EFI_STRING is\r
451 defined in String.\r
452\r
453 @retval EFI_INVALID_PARAMETER If input parameter is invalid.\r
454 @retval EFI_BUFFER_TOO_SMALL If the *BufferLength is too small.\r
455 @retval EFI_SUCCESS Operation is successful.\r
456\r
457**/\r
4259256b 458EFI_STATUS\r
459EFIAPI\r
cdaf7905 460HiiThunkGetString (\r
a3318eaf 461 IN EFI_HII_PROTOCOL *This,\r
462 IN FRAMEWORK_EFI_HII_HANDLE Handle,\r
463 IN STRING_REF Token,\r
464 IN BOOLEAN Raw,\r
465 IN CHAR16 *LanguageString,\r
466 IN OUT UINTN *BufferLength,\r
467 OUT EFI_STRING StringBuffer\r
e00e1d46 468 );\r
4259256b 469\r
26a76fbc
LG
470/**\r
471 This function removes any new strings that were added after the initial string export for this handle.\r
472 UEFI HII String Protocol does not have Reset String function. This function perform nothing.\r
473\r
474 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
475 @param Handle The HII handle on which the string resides.\r
476\r
477 @retval EFI_SUCCESS This function is a NOP and always return EFI_SUCCESS.\r
478\r
479**/\r
4259256b 480EFI_STATUS\r
481EFIAPI\r
482HiiResetStrings (\r
26a76fbc
LG
483 IN EFI_HII_PROTOCOL *This,\r
484 IN FRAMEWORK_EFI_HII_HANDLE Handle\r
e00e1d46 485 );\r
4259256b 486\r
26a76fbc
LG
487/**\r
488 Test if all of the characters in a string have corresponding font characters.\r
489\r
490 This is a deprecated API. No Framework HII module is calling it. This function will ASSERT and\r
491 return EFI_UNSUPPORTED.\r
492\r
493 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
494 @param StringToTest A pointer to a Unicode string.\r
495 @param FirstMissing A pointer to an index into the string. On input, the index of \r
496 the first character in the StringToTest to examine. On exit, the index \r
497 of the first character encountered for which a glyph is unavailable. \r
498 If all glyphs in the string are available, the index is the index of the terminator \r
499 of the string. \r
500 @param GlyphBufferSize A pointer to a value. On output, if the function returns EFI_SUCCESS, \r
501 it contains the amount of memory that is required to store the string? glyph equivalent.\r
502\r
503 @retval EFI_UNSUPPORTED The function performs nothing and return EFI_UNSUPPORTED.\r
504**/\r
4259256b 505EFI_STATUS\r
506EFIAPI\r
507HiiTestString (\r
26a76fbc
LG
508 IN EFI_HII_PROTOCOL *This,\r
509 IN CHAR16 *StringToTest,\r
510 IN OUT UINT32 *FirstMissing,\r
511 OUT UINT32 *GlyphBufferSize\r
e00e1d46 512 );\r
4259256b 513\r
26a76fbc
LG
514/**\r
515 Allows a program to determine the primary languages that are supported on a given handle.\r
516\r
517 This routine is intended to be used by drivers to query the interface database for supported languages. \r
518 This routine returns a string of concatenated 3-byte language identifiers, one per string package associated with the handle.\r
519\r
520 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
521 @param Handle The handle on which the strings reside. Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack() \r
522 in the Packages section.\r
523 @param LanguageString A string allocated by GetPrimaryLanguages() that contains a list of all primary languages \r
524 registered on the handle. The routine will not return the three-spaces language identifier used in \r
525 other functions to indicate non-language-specific strings.\r
526\r
527 @retval EFI_SUCCESS LanguageString was correctly returned.\r
528 \r
529 @retval EFI_INVALID_PARAMETER The Handle was unknown.\r
530**/\r
4259256b 531EFI_STATUS\r
532EFIAPI\r
533HiiGetPrimaryLanguages (\r
26a76fbc
LG
534 IN EFI_HII_PROTOCOL *This,\r
535 IN FRAMEWORK_EFI_HII_HANDLE Handle,\r
536 OUT EFI_STRING *LanguageString\r
e00e1d46 537 );\r
4259256b 538\r
26a76fbc
LG
539/**\r
540 Allows a program to determine which secondary languages are supported on a given handle for a given primary language\r
541\r
542 This routine is intended to be used by drivers to query the interface database for supported languages. \r
543 This routine returns a string of concatenated 3-byte language identifiers, one per string package associated with the handle.\r
544\r
545 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
546 @param Handle The handle on which the strings reside. Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack() \r
547 in the Packages section.\r
548 @param PrimaryLanguage Pointer to a NULL-terminated string containing a single ISO 639-2 language identifier, indicating \r
549 the primary language.\r
550 @param LanguageString A string allocated by GetSecondaryLanguages() containing a list of all secondary languages registered \r
551 on the handle. The routine will not return the three-spaces language identifier used in other functions \r
552 to indicate non-language-specific strings, nor will it return the primary language. This function succeeds \r
553 but returns a NULL LanguageString if there are no secondary languages associated with the input Handle and \r
554 PrimaryLanguage pair. Type EFI_STRING is defined in String.\r
555 \r
556 @retval EFI_SUCCESS LanguageString was correctly returned.\r
557 @retval EFI_INVALID_PARAMETER The Handle was unknown.\r
558**/\r
4259256b 559EFI_STATUS\r
560EFIAPI\r
561HiiGetSecondaryLanguages (\r
26a76fbc
LG
562 IN EFI_HII_PROTOCOL *This,\r
563 IN FRAMEWORK_EFI_HII_HANDLE Handle,\r
564 IN CHAR16 *PrimaryLanguage,\r
565 OUT EFI_STRING *LanguageString\r
e00e1d46 566 );\r
4259256b 567\r
26a76fbc
LG
568/**\r
569\r
570 This function allows a program to extract a part of a string of not more than a given width.\r
571 With repeated calls, this allows a calling program to extract "lines" of text that fit inside\r
572 columns. The effort of measuring the fit of strings inside columns is localized to this call.\r
573\r
574 This is a deprecated API. No Framework HII module is calling it. This function will ASSERT and\r
575 return EFI_UNSUPPORTED.\r
576\r
577 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
578 @param Handle The HII handle on which the string resides.\r
579 @param Token The string token assigned to the string.\r
580 @param Index On input, the offset into the string where the line is to start.\r
581 On output, the index is updated to point to beyond the last character returned\r
582 in the call.\r
583 @param LineWidth The maximum width of the line in units of narrow glyphs.\r
584 @param LanguageString Pointer to a NULL-terminated string containing a single ISO 639-2 language\r
585 identifier, indicating the language to print. If the LanguageString is empty (starts\r
586 with a NULL), the default system language will be used to determine the language.\r
587 @param BufferLength Length of the StringBuffer. If the status reports that the buffer width is too\r
588 small, this parameter is filled with the length of the buffer needed.\r
589 @param StringBuffer The buffer designed to receive the characters in the string. Type EFI_STRING is\r
590 defined in String.\r
591\r
592 @retval EFI_UNSUPPORTED.\r
593**/\r
4259256b 594EFI_STATUS\r
595EFIAPI\r
596HiiGetLine (\r
26a76fbc
LG
597 IN EFI_HII_PROTOCOL *This,\r
598 IN FRAMEWORK_EFI_HII_HANDLE Handle,\r
599 IN STRING_REF Token,\r
600 IN OUT UINT16 *Index,\r
601 IN UINT16 LineWidth,\r
602 IN CHAR16 *LanguageString,\r
603 IN OUT UINT16 *BufferLength,\r
604 OUT EFI_STRING StringBuffer\r
e00e1d46 605 );\r
4259256b 606\r
26a76fbc
LG
607/**\r
608 This function allows a program to extract a form or form package that has\r
609 previously been registered with the EFI HII database.\r
610\r
611 In this thunk module, this function will create a IFR Package with only \r
612 one Formset. Effectively, only the GUID of the Formset is updated and return\r
613 in this IFR package to caller. This is enable the Framework modules which call \r
614 a API named GetStringFromToken. GetStringFromToken retieves a String based on\r
615 a String Token from a Package List known only by the Formset GUID.\r
616 \r
617\r
618\r
619 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
620 @param Handle Handle on which the form resides. Type FRAMEWORK_EFI_HII_HANDLE is defined in\r
621 EFI_HII_PROTOCOL.NewPack() in the Packages section.\r
622 @param FormId Ignored by this implementation.\r
623 @param BufferLengthTemp On input, the size of input buffer. On output, it\r
624 is the size of FW_HII_FORMSET_TEMPLATE.\r
625 @param Buffer The buffer designed to receive the form(s).\r
626\r
627 @retval EFI_SUCCESS Buffer filled with the requested forms. BufferLength\r
628 was updated.\r
629 @retval EFI_INVALID_PARAMETER The handle is unknown.\r
630 @retval EFI_NOT_FOUND A form on the requested handle cannot be found with the\r
631 requested FormId.\r
632 @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough to allow the form to be stored.\r
633\r
634**/\r
4259256b 635EFI_STATUS\r
636EFIAPI\r
637HiiGetForms (\r
26a76fbc
LG
638 IN EFI_HII_PROTOCOL *This,\r
639 IN FRAMEWORK_EFI_HII_HANDLE Handle,\r
640 IN EFI_FORM_ID FormId,\r
641 IN OUT UINTN *BufferLengthTemp,\r
642 OUT UINT8 *Buffer\r
e00e1d46 643 );\r
4259256b 644\r
26a76fbc
LG
645/**\r
646\r
647 This function allows a program to extract the NV Image\r
648 that represents the default storage image\r
649\r
650\r
651 @param This A pointer to the EFI_HII_PROTOCOL instance.\r
652 @param Handle The HII handle from which will have default data retrieved.\r
653 UINTN - Mask used to retrieve the default image.\r
654 @param DefaultMask EDES_TODO: Add parameter description\r
655 @param VariablePackList Callee allocated, tightly-packed, link list data\r
656 structure that contain all default varaible packs\r
657 from the Hii Database.\r
658\r
659 @retval EFI_NOT_FOUND If Hii database does not contain any default images.\r
660 @retval EFI_INVALID_PARAMETER Invalid input parameter.\r
661 @retval EFI_SUCCESS Operation successful.\r
662\r
663**/\r
4259256b 664EFI_STATUS\r
665EFIAPI\r
666HiiGetDefaultImage (\r
26a76fbc
LG
667 IN EFI_HII_PROTOCOL *This,\r
668 IN FRAMEWORK_EFI_HII_HANDLE Handle,\r
669 IN UINTN DefaultMask,\r
670 OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList\r
e00e1d46 671 );\r
4259256b 672\r
26a76fbc
LG
673/**\r
674 This function allows the caller to update a form that has\r
675 previously been registered with the EFI HII database.\r
676\r
677\r
678 @param This EDES_TODO: Add parameter description\r
679 @param Handle Hii Handle associated with the Formset to modify\r
680 @param Label Update information starting immediately after this label in the IFR\r
681 @param AddData If TRUE, add data. If FALSE, remove data\r
682 @param Data If adding data, this is the pointer to the data to add\r
683\r
684 @retval EFI_SUCCESS Update success.\r
685 @retval Other Update fail.\r
686\r
687**/\r
4259256b 688EFI_STATUS\r
689EFIAPI\r
cdaf7905 690HiiThunkUpdateForm (\r
26a76fbc
LG
691 IN EFI_HII_PROTOCOL *This,\r
692 IN FRAMEWORK_EFI_HII_HANDLE Handle,\r
693 IN EFI_FORM_LABEL Label,\r
694 IN BOOLEAN AddData,\r
695 IN EFI_HII_UPDATE_DATA *Data\r
e00e1d46 696 );\r
4259256b 697\r
26a76fbc
LG
698/**\r
699 Retrieves the current keyboard layout. \r
700 This function is not implemented by HII Thunk Module.\r
701\r
702 @param This A pointer to the EFI_HII_PROTOCOL instance. \r
703 @param DescriptorCount A pointer to the number of Descriptor entries being described in the keyboard layout being retrieved.\r
704 @param Descriptor A pointer to a buffer containing an array of EFI_KEY_DESCRIPTOR entries. Each entry will reflect the \r
705 definition of a specific physical key. Type EFI_KEY_DESCRIPTOR is defined in "Related Definitions" below.\r
706\r
707 @retval EFI_SUCCESS The keyboard layout was retrieved successfully.\r
708 \r
709**/\r
4259256b 710EFI_STATUS\r
711EFIAPI\r
712HiiGetKeyboardLayout (\r
26a76fbc
LG
713 IN EFI_HII_PROTOCOL *This,\r
714 OUT UINT16 *DescriptorCount,\r
715 OUT FRAMEWORK_EFI_KEY_DESCRIPTOR *Descriptor\r
e00e1d46 716 );\r
4259256b 717\r
26a76fbc
LG
718/**\r
719 This is the Framework Setup Browser interface which displays a FormSet.\r
720\r
721 @param This The EFI_FORM_BROWSER_PROTOCOL context.\r
722 @param UseDatabase TRUE if the FormSet is from HII database. The Thunk implementation\r
723 only support UseDatabase is TRUE.\r
724 @param Handle The Handle buffer.\r
725 @param HandleCount The number of Handle in the Handle Buffer. It must be 1 for this implementation.\r
726 @param Packet The pointer to data buffer containing IFR and String package. Not supported.\r
727 @param CallbackHandle Not supported.\r
728 @param NvMapOverride The buffer is used only when there is no NV variable to define the \r
729 current settings and the caller needs to provide to the browser the\r
730 current settings for the the "fake" NV variable. If used, no saving of\r
731 an NV variable is possbile. This parameter is also ignored if Handle is NULL.\r
732 @param ScreenDimensions \r
733 Allows the browser to be called so that it occupies a portion of the physical \r
734 screen instead of dynamically determining the screen dimensions.\r
735 @param ResetRequired This BOOLEAN value denotes whether a reset is required based on the data that \r
736 might have been changed. The ResetRequired parameter is primarily applicable \r
737 for configuration applications, and is an optional parameter.\r
738\r
739 @retval EFI_SUCCESS If the Formset is displayed correctly.\r
740 @retval EFI_UNSUPPORTED If UseDatabase is FALSE or HandleCount is not 1.\r
741 @retval EFI_INVALID_PARAMETER If the *Handle passed in is not found in the database.\r
742**/\r
137c54ac 743EFI_STATUS\r
744EFIAPI \r
745ThunkSendForm (\r
26a76fbc
LG
746 IN EFI_FORM_BROWSER_PROTOCOL *This,\r
747 IN BOOLEAN UseDatabase,\r
748 IN FRAMEWORK_EFI_HII_HANDLE *Handle,\r
749 IN UINTN HandleCount,\r
750 IN EFI_IFR_PACKET *Packet, OPTIONAL\r
751 IN EFI_HANDLE CallbackHandle, OPTIONAL\r
752 IN UINT8 *NvMapOverride, OPTIONAL\r
753 IN FRAMEWORK_EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL\r
754 OUT BOOLEAN *ResetRequired OPTIONAL\r
e00e1d46 755 );\r
137c54ac 756\r
26a76fbc
LG
757/** \r
758\r
759 Rountine used to display a generic dialog interface and return \r
760 the Key or Input from user input.\r
761\r
762 @param LinesNumber The number of lines for the dialog box.\r
763 @param HotKey Defines if a single character is parsed (TRUE) and returned in KeyValue\r
764 or if a string is returned in StringBuffer.\r
765 @param MaximumStringSize The maximum size in bytes of a typed-in string.\r
766 @param StringBuffer On return contains the typed-in string if HotKey is FALSE.\r
767 @param Key The EFI_INPUT_KEY value returned if HotKey is TRUE.\r
768 @param FirstString The pointer to the first string in the list of strings\r
769 that comprise the dialog box.\r
770 @param ... A series of NumberOfLines text strings that will be used\r
771 to construct the dialog box.\r
772 @retval EFI_SUCCESS The dialog is created successfully and user interaction was received.\r
773 @retval EFI_DEVICE_ERROR The user typed in an ESC.\r
774 @retval EFI_INVALID_PARAMETER One of the parameters was invalid.(StringBuffer == NULL && HotKey == FALSE).\r
775**/\r
137c54ac 776EFI_STATUS\r
777EFIAPI \r
778ThunkCreatePopUp (\r
a5420536 779 IN UINTN LinesNumber,\r
137c54ac 780 IN BOOLEAN HotKey,\r
781 IN UINTN MaximumStringSize,\r
782 OUT CHAR16 *StringBuffer,\r
a5420536
LG
783 OUT EFI_INPUT_KEY *Key,\r
784 IN CHAR16 *FirstString,\r
137c54ac 785 ...\r
e00e1d46 786 );\r
137c54ac 787\r
26a76fbc
LG
788/**\r
789 This notification function will be called when a Package List is removed\r
790 using UEFI HII interface. The Package List removed need to be removed from\r
791 Framework Thunk module too.\r
792\r
793 If the Package List registered is not Sting Package, \r
794 then ASSERT. If the NotifyType is not REMOVE_PACK, then ASSERT.\r
795 Both cases means UEFI HII Database itself is buggy. \r
796\r
797 @param PackageType The Package Type.\r
798 @param PackageGuid The Package GUID.\r
799 @param Package The Package Header.\r
800 @param Handle The HII Handle of this Package List.\r
801 @param NotifyType The reason of the notification. \r
802\r
803 @retval EFI_SUCCESS The notification function is successful.\r
804 \r
805**/\r
0368663f 806EFI_STATUS\r
807EFIAPI\r
808RemovePackNotify (\r
809 IN UINT8 PackageType,\r
810 IN CONST EFI_GUID *PackageGuid,\r
811 IN CONST EFI_HII_PACKAGE_HEADER *Package,\r
812 IN EFI_HII_HANDLE Handle,\r
813 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType\r
e00e1d46 814 );\r
0368663f 815\r
26a76fbc
LG
816/**\r
817 This notification function will be called when a Package List is registered\r
818 using UEFI HII interface. The Package List registered need to be recorded in\r
819 Framework Thunk module as Thunk Module may need to look for String Package in\r
820 the package registered.\r
821\r
822 If the Package List registered is not either Sting Package or IFR package, \r
823 then ASSERT. If the NotifyType is not ADD_PACK or NEW_PACK, then ASSERT.\r
824 Both cases means UEFI HII Database itself is buggy. \r
825\r
826 @param PackageType The Package Type.\r
827 @param PackageGuid The Package GUID.\r
828 @param Package The Package Header.\r
829 @param Handle The HII Handle of this Package List.\r
830 @param NotifyType The reason of the notification. \r
831\r
832 @retval EFI_SUCCESS The notification function is successful.\r
833 \r
834**/\r
0368663f 835EFI_STATUS\r
836EFIAPI\r
837NewOrAddPackNotify (\r
838 IN UINT8 PackageType,\r
839 IN CONST EFI_GUID *PackageGuid,\r
840 IN CONST EFI_HII_PACKAGE_HEADER *Package,\r
841 IN EFI_HII_HANDLE Handle,\r
842 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType\r
e00e1d46 843 );\r
0368663f 844\r
03254710 845/**\r
a5420536 846 Create a Hii Update data Handle used to call IfrLibUpdateForm.\r
03254710 847\r
a5420536
LG
848 @param ThunkContext The HII Thunk Context.\r
849 @param FwUpdateData The Framework Update Data.\r
850 @param UefiOpCodeHandle The UEFI Update Data.\r
03254710 851\r
852 @retval EFI_SUCCESS The UEFI Update Data is created successfully.\r
853 @retval EFI_UNSUPPORTED There is unsupported opcode in FwUpdateData.\r
854 @retval EFI_OUT_OF_RESOURCES There is not enough resource.\r
855**/\r
856EFI_STATUS\r
857FwUpdateDataToUefiUpdateData (\r
2d630302 858 IN HII_THUNK_CONTEXT *ThunkContext,\r
859 IN CONST EFI_HII_UPDATE_DATA *FwUpdateData,\r
860 IN VOID *UefiOpCodeHandle\r
03254710 861 )\r
862;\r
863\r
a235abd2 864/** \r
865\r
866 Initialize string packages in HII database.\r
867\r
868**/\r
869VOID\r
870InitSetBrowserStrings (\r
871 VOID\r
872 )\r
873;\r
874\r
ad5a96ab 875/**\r
8cf6dad8 876 Convert language code from RFC4646 to ISO639-2.\r
ad5a96ab 877\r
8cf6dad8 878 LanguageRfc4646 contain a single RFC 4646 code such as\r
ad5a96ab 879 "en-US" or "fr-FR".\r
880\r
8cf6dad8 881 The LanguageRfc4646 must be a buffer large enough\r
ad5a96ab 882 for ISO_639_2_ENTRY_SIZE characters.\r
883\r
8cf6dad8 884 If LanguageRfc4646 is NULL, then ASSERT.\r
ad5a96ab 885 If LanguageIso639 is NULL, then ASSERT.\r
886\r
8cf6dad8 887 @param LanguageRfc4646 RFC4646 language code.\r
ad5a96ab 888 @param LanguageIso639 ISO639-2 language code.\r
889\r
890 @retval EFI_SUCCESS Language code converted.\r
891 @retval EFI_NOT_FOUND Language code not found.\r
892\r
893**/\r
894EFI_STATUS\r
895EFIAPI\r
8cf6dad8 896ConvertRfc4646LanguageToIso639Language (\r
897 IN CHAR8 *LanguageRfc4646,\r
ad5a96ab 898 OUT CHAR8 *LanguageIso639\r
899 )\r
900;\r
901\r
902/**\r
8cf6dad8 903 Convert language code from ISO639-2 to RFC4646 and return the converted language.\r
ad5a96ab 904 Caller is responsible for freeing the allocated buffer.\r
905\r
906 LanguageIso639 contain a single ISO639-2 code such as\r
907 "eng" or "fra".\r
908\r
909 If LanguageIso639 is NULL, then ASSERT.\r
8cf6dad8 910 If LanguageRfc4646 is NULL, then ASSERT.\r
ad5a96ab 911\r
912 @param LanguageIso639 ISO639-2 language code.\r
913\r
914 @return the allocated buffer or NULL, if the language is not found.\r
915\r
916**/\r
917CHAR8*\r
918EFIAPI\r
8cf6dad8 919ConvertIso639LanguageToRfc4646Language (\r
ad5a96ab 920 IN CONST CHAR8 *LanguageIso639\r
921 )\r
922;\r
923\r
0f268521 924/**\r
925 Get next language from language code list (with separator ';').\r
926\r
927 If LangCode is NULL, then ASSERT.\r
928 If Lang is NULL, then ASSERT.\r
929\r
930 @param LangCode On input: point to first language in the list. On\r
931 output: point to next language in the list, or\r
932 NULL if no more language in the list.\r
933 @param Lang The first language in the list.\r
934\r
935**/\r
936VOID\r
937EFIAPI\r
938GetNextLanguage (\r
939 IN OUT CHAR8 **LangCode,\r
940 OUT CHAR8 *Lang\r
941 )\r
942;\r
943\r
ee3428bb 944#include "Utility.h"\r
ebbd2793 945#include "ConfigAccess.h"\r
ee3428bb 946\r
4259256b 947#endif\r