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