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