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