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