UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf\r
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf\r
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf\r
- HiiLibFramework|IntelFrameworkPkg/Library/HiiLibFramework/HiiLib.inf\r
- IfrSupportLibFramework|IntelFrameworkPkg/Library/IfrSupportLibFramework/IfrSupportLib.inf\r
+ FrameworkHiiLib|IntelFrameworkPkg/Library/FrameworkHiiLib/HiiLib.inf\r
+ FrameworkIfrSupportLib|IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrSupportLib.inf\r
PciIncompatibleDeviceSupportLib|IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.inf\r
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf\r
GraphicsLib|IntelFrameworkModulePkg/Library/GraphicsLib/GraphicsLib.inf\r
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf\r
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf\r
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf\r
- HiiLibFramework|IntelFrameworkPkg/Library/HiiLibFramework/HiiLib.inf\r
- IfrSupportLibFramework|IntelFrameworkPkg/Library/IfrSupportLibFramework/IfrSupportLib.inf\r
+ FrameworkHiiLib|IntelFrameworkPkg/Library/FrameworkHiiLib/HiiLib.inf\r
+ FrameworkIfrSupportLib|IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrSupportLib.inf\r
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf\r
\r
################################################################################\r
#include <Protocol/GraphicsOutput.h>\r
#include <Protocol/FirmwareVolume2.h>\r
#include <Protocol/UgaDraw.h>\r
-#include <Protocol/HiiFramework.h>\r
+#include <Protocol/FrameworkHii.h>\r
\r
#include <Guid/Bmp.h>\r
\r
\r
#include <PiDxe.h>\r
\r
-#include <Protocol/FormCallbackFramework.h>\r
-#include <Protocol/HiiFramework.h>\r
+#include <Protocol/FrameworkFormCallback.h>\r
+#include <Protocol/FrameworkHii.h>\r
\r
#include <Library/UefiBootServicesTableLib.h>\r
#include <Library/UefiRuntimeServicesTableLib.h>\r
#include <Library/UefiDriverEntryPoint.h>\r
#include <Library/BaseLib.h>\r
#include <Library/PrintLib.h>\r
-#include <Library/IfrSupportLibFramework.h>\r
+#include <Library/FrameworkIfrSupportLib.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
-#include <Library/HiiLibFramework.h>\r
+#include <Library/FrameworkHiiLib.h>\r
\r
#include "NVDataStruc.h"\r
\r
\r
\r
[LibraryClasses]\r
- HiiLibFramework\r
+ FrameworkHiiLib\r
MemoryAllocationLib\r
BaseMemoryLib\r
- IfrSupportLibFramework\r
+ FrameworkIfrSupportLib\r
PrintLib\r
BaseLib\r
UefiDriverEntryPoint\r
#include <PiDxe.h>\r
\r
#include <Guid/GlobalVariable.h>\r
-#include <Protocol/FormCallbackFramework.h>\r
-#include <Protocol/HiiFramework.h>\r
+#include <Protocol/FrameworkFormCallback.h>\r
+#include <Protocol/FrameworkHii.h>\r
\r
#include <Library/BaseLib.h>\r
#include <Library/DebugLib.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/UefiBootServicesTableLib.h>\r
#include <Library/UefiRuntimeServicesTableLib.h>\r
-#include <Library/IfrSupportLibFramework.h>\r
+#include <Library/FrameworkIfrSupportLib.h>\r
\r
//\r
// HII Database Global data\r
IntelFrameworkPkg/IntelFrameworkPkg.dec\r
\r
[LibraryClasses]\r
- IfrSupportLibFramework\r
+ FrameworkIfrSupportLib\r
UefiRuntimeServicesTableLib\r
UefiBootServicesTableLib\r
BaseMemoryLib\r
\r
#include <PiDxe.h>\r
\r
-#include <Protocol/FormCallbackFramework.h>\r
-#include <Protocol/FormBrowserFramework.h>\r
-#include <Protocol/HiiFramework.h>\r
+#include <Protocol/FrameworkFormCallback.h>\r
+#include <Protocol/FrameworkFormBrowser.h>\r
+#include <Protocol/FrameworkHii.h>\r
#include <Protocol/Print.h>\r
\r
#include <Library/BaseLib.h>\r
#include <Library/PrintLib.h>\r
#include <Library/UefiBootServicesTableLib.h>\r
#include <Library/UefiRuntimeServicesTableLib.h>\r
-#include <Library/HiiLibFramework.h>\r
+#include <Library/FrameworkHiiLib.h>\r
#include <Library/GraphicsLib.h>\r
\r
\r
\r
[LibraryClasses]\r
GraphicsLib\r
- HiiLibFramework\r
+ FrameworkHiiLib\r
UefiRuntimeServicesTableLib\r
UefiBootServicesTableLib\r
PrintLib\r
--- /dev/null
+/** @file\r
+ Public include file for the HII Library\r
+\r
+ Copyright (c) 2006, Intel Corporation \r
+ All rights reserved. This program and the accompanying materials \r
+ are licensed and made available under the terms and conditions of the BSD License \r
+ which accompanies this distribution. The full text of the license may be found at \r
+ http://opensource.org/licenses/bsd-license.php \r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+ Module Name: HiiLib.h\r
+\r
+**/\r
+\r
+#ifndef __HII_LIB_H__\r
+#define __HII_LIB_H__\r
+\r
+#include <Protocol/FrameworkHii.h>\r
+\r
+/**\r
+ This function allocates pool for an EFI_HII_PACKAGES structure\r
+ with enough space for the variable argument list of package pointers.\r
+ The allocated structure is initialized using NumberOfPackages, Guid, \r
+ and the variable length argument list of package pointers.\r
+\r
+ @param NumberOfPackages The number of HII packages to prepare.\r
+ @param Guid Package GUID.\r
+\r
+ @return\r
+ The allocated and initialized packages.\r
+\r
+**/\r
+EFI_HII_PACKAGES *\r
+EFIAPI\r
+PreparePackages (\r
+ IN UINTN NumberOfPackages,\r
+ IN CONST EFI_GUID *Guid OPTIONAL,\r
+ ...\r
+ )\r
+;\r
+\r
+\r
+\r
+#endif\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+Module Name:\r
+\r
+ IfrSupportLib.h\r
+\r
+Abstract:\r
+\r
+ The file contain all library function for Ifr Operations.\r
+\r
+--*/\r
+\r
+#ifndef _IFRSUPPORTLIBRARY_H\r
+#define _IFRSUPPORTLIBRARY_H\r
+\r
+#define DEFAULT_FORM_BUFFER_SIZE 0xFFFF\r
+#define DEFAULT_STRING_BUFFER_SIZE 0xFFFF\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+ CHAR16 *OptionString; // Passed in string to generate a token for in a truly dynamic form creation\r
+ STRING_REF StringToken; // This is used when creating a single op-code without generating a StringToken (have one already)\r
+ UINT16 Value;\r
+ UINT8 Flags;\r
+ UINT16 Key;\r
+} IFR_OPTION;\r
+#pragma pack()\r
+\r
+EFI_STATUS\r
+GetCurrentLanguage (\r
+ OUT CHAR16 *Lang\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Determine what is the current language setting\r
+ \r
+Arguments:\r
+\r
+ Lang - Pointer of system language\r
+ \r
+Returns: \r
+ \r
+ Status code\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+AddString (\r
+ IN VOID *StringBuffer,\r
+ IN CHAR16 *Language,\r
+ IN CHAR16 *String,\r
+ IN OUT STRING_REF *StringToken\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Add a string to the incoming buffer and return the token and offset data\r
+ \r
+Arguments:\r
+\r
+ StringBuffer - The incoming buffer\r
+ \r
+ Language - Currrent language\r
+ \r
+ String - The string to be added\r
+ \r
+ StringToken - The index where the string placed\r
+ \r
+Returns: \r
+\r
+ EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
+ \r
+ EFI_SUCCESS - String successfully added to the incoming buffer\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+AddOpCode (\r
+ IN VOID *FormBuffer,\r
+ IN OUT VOID *OpCodeData\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Add op-code data to the FormBuffer\r
+ \r
+Arguments:\r
+\r
+ FormBuffer - Form buffer to be inserted to\r
+ \r
+ OpCodeData - Op-code data to be inserted\r
+ \r
+Returns: \r
+\r
+ EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
+ \r
+ EFI_SUCCESS - Op-code data successfully inserted\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateFormSet (\r
+ IN CHAR16 *FormSetTitle,\r
+ IN EFI_GUID *Guid,\r
+ IN UINT8 Class,\r
+ IN UINT8 SubClass,\r
+ IN OUT VOID **FormBuffer,\r
+ IN OUT VOID **StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a formset\r
+ \r
+Arguments:\r
+\r
+ FormSetTitle - Title of formset\r
+ \r
+ Guid - Guid of formset\r
+ \r
+ Class - Class of formset\r
+ \r
+ SubClass - Sub class of formset\r
+ \r
+ FormBuffer - Pointer of the formset created\r
+ \r
+ StringBuffer - Pointer of FormSetTitile string created\r
+ \r
+Returns: \r
+\r
+ EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
+ \r
+ EFI_SUCCESS - Formset successfully created\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateForm (\r
+ IN CHAR16 *FormTitle,\r
+ IN UINT16 FormId,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a form\r
+ \r
+Arguments:\r
+\r
+ FormTitle - Title of the form\r
+ \r
+ FormId - Id of the form\r
+ \r
+ FormBuffer - Pointer of the form created\r
+ \r
+ StringBuffer - Pointer of FormTitil string created\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Form successfully created\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateSubTitle (\r
+ IN CHAR16 *SubTitle,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a SubTitle\r
+ \r
+Arguments:\r
+\r
+ SubTitle - Sub title to be created\r
+ \r
+ FormBuffer - Where this subtitle to add to\r
+ \r
+ StringBuffer - String buffer created for subtitle\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Subtitle successfully created\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateText (\r
+ IN CHAR16 *String,\r
+ IN CHAR16 *String2,\r
+ IN CHAR16 *String3,\r
+ IN UINT8 Flags,\r
+ IN UINT16 Key,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a line of text\r
+ \r
+Arguments:\r
+\r
+ String - First string of the text\r
+ \r
+ String2 - Second string of the text\r
+ \r
+ String3 - Help string of the text\r
+ \r
+ Flags - Flag of the text\r
+ \r
+ Key - Key of the text\r
+ \r
+ FormBuffer - The form where this text adds to\r
+ \r
+ StringBuffer - String buffer created for String, String2 and String3\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Text successfully created\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateGoto (\r
+ IN UINT16 FormId,\r
+ IN CHAR16 *Prompt,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a hyperlink\r
+ \r
+Arguments:\r
+\r
+ FormId - Form ID of the hyperlink\r
+ \r
+ Prompt - Prompt of the hyperlink\r
+ \r
+ FormBuffer - The form where this hyperlink adds to\r
+ \r
+ StringBuffer - String buffer created for Prompt\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Hyperlink successfully created\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateOneOf (\r
+ IN UINT16 QuestionId,\r
+ IN UINT8 DataWidth,\r
+ IN CHAR16 *Prompt,\r
+ IN CHAR16 *Help,\r
+ IN IFR_OPTION *OptionsList,\r
+ IN UINTN OptionCount,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a one-of question with a set of options to choose from. The\r
+ OptionsList is a pointer to a null-terminated list of option descriptions.\r
+ \r
+Arguments:\r
+\r
+ QuestionId - Question ID of the one-of box\r
+ \r
+ DataWidth - DataWidth of the one-of box\r
+ \r
+ Prompt - Prompt of the one-of box\r
+ \r
+ Help - Help of the one-of box\r
+ \r
+ OptionsList - Each string in it is an option of the one-of box\r
+ \r
+ OptionCount - Option string count\r
+ \r
+ FormBuffer - The form where this one-of box adds to\r
+ \r
+ StringBuffer - String buffer created for Prompt, Help and Option strings\r
+ \r
+Returns: \r
+\r
+ EFI_DEVICE_ERROR - DataWidth > 2\r
+\r
+ EFI_SUCCESS - One-Of box successfully created.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateOrderedList (\r
+ IN UINT16 QuestionId,\r
+ IN UINT8 MaxEntries,\r
+ IN CHAR16 *Prompt,\r
+ IN CHAR16 *Help,\r
+ IN IFR_OPTION *OptionsList,\r
+ IN UINTN OptionCount,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a one-of question with a set of options to choose from. The\r
+ OptionsList is a pointer to a null-terminated list of option descriptions.\r
+ \r
+Arguments:\r
+\r
+ QuestionId - Question ID of the ordered list\r
+ \r
+ MaxEntries - MaxEntries of the ordered list\r
+ \r
+ Prompt - Prompt of the ordered list\r
+ \r
+ Help - Help of the ordered list\r
+ \r
+ OptionsList - Each string in it is an option of the ordered list\r
+ \r
+ OptionCount - Option string count\r
+ \r
+ FormBuffer - The form where this ordered list adds to\r
+ \r
+ StringBuffer - String buffer created for Prompt, Help and Option strings\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Ordered list successfully created.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateCheckBox (\r
+ IN UINT16 QuestionId,\r
+ IN UINT8 DataWidth,\r
+ IN CHAR16 *Prompt,\r
+ IN CHAR16 *Help,\r
+ IN UINT8 Flags,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a checkbox\r
+ \r
+Arguments:\r
+\r
+ QuestionId - Question ID of the check box\r
+ \r
+ DataWidth - DataWidth of the check box\r
+ \r
+ Prompt - Prompt of the check box\r
+ \r
+ Help - Help of the check box\r
+ \r
+ Flags - Flags of the check box\r
+ \r
+ FormBuffer - The form where this check box adds to\r
+ \r
+ StringBuffer - String buffer created for Prompt and Help.\r
+ \r
+Returns: \r
+\r
+ EFI_DEVICE_ERROR - DataWidth > 1\r
+\r
+ EFI_SUCCESS - Check box successfully created\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateNumeric (\r
+ IN UINT16 QuestionId,\r
+ IN UINT8 DataWidth,\r
+ IN CHAR16 *Prompt,\r
+ IN CHAR16 *Help,\r
+ IN UINT16 Minimum,\r
+ IN UINT16 Maximum,\r
+ IN UINT16 Step,\r
+ IN UINT16 Default,\r
+ IN UINT8 Flags,\r
+ IN UINT16 Key,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a numeric\r
+ \r
+Arguments:\r
+\r
+ QuestionId - Question ID of the numeric\r
+ \r
+ DataWidth - DataWidth of the numeric\r
+ \r
+ Prompt - Prompt of the numeric\r
+ \r
+ Help - Help of the numeric\r
+ \r
+ Minimum - Minumun boundary of the numeric\r
+ \r
+ Maximum - Maximum boundary of the numeric\r
+ \r
+ Step - Step of the numeric\r
+ \r
+ Default - Default value\r
+ \r
+ Flags - Flags of the numeric\r
+ \r
+ Key - Key of the numeric\r
+ \r
+ FormBuffer - The form where this numeric adds to\r
+ \r
+ StringBuffer - String buffer created for Prompt and Help.\r
+ \r
+Returns: \r
+\r
+ EFI_DEVICE_ERROR - DataWidth > 2\r
+ \r
+ EFI_SUCCESS - Numeric is successfully created\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateString (\r
+ IN UINT16 QuestionId,\r
+ IN UINT8 DataWidth,\r
+ IN CHAR16 *Prompt,\r
+ IN CHAR16 *Help,\r
+ IN UINT8 MinSize,\r
+ IN UINT8 MaxSize,\r
+ IN UINT8 Flags,\r
+ IN UINT16 Key,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a string\r
+ \r
+Arguments:\r
+\r
+ QuestionId - Question ID of the string\r
+ \r
+ DataWidth - DataWidth of the string\r
+ \r
+ Prompt - Prompt of the string\r
+ \r
+ Help - Help of the string\r
+ \r
+ MinSize - Min size boundary of the string\r
+ \r
+ MaxSize - Max size boundary of the string\r
+ \r
+ Flags - Flags of the string\r
+ \r
+ Key - Key of the string\r
+ \r
+ FormBuffer - The form where this string adds to\r
+ \r
+ StringBuffer - String buffer created for Prompt and Help.\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - String successfully created.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+ExtractDataFromHiiHandle (\r
+ IN EFI_HII_HANDLE HiiHandle,\r
+ IN OUT UINT16 *ImageLength,\r
+ OUT UINT8 *DefaultImage,\r
+ OUT EFI_GUID *Guid\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Extract information pertaining to the HiiHandle\r
+ \r
+Arguments:\r
+\r
+ HiiHandle - Hii handle\r
+ \r
+ ImageLength - For input, length of DefaultImage;\r
+ For output, length of actually required\r
+ \r
+ DefaultImage - Image buffer prepared by caller\r
+ \r
+ Guid - Guid information about the form\r
+ \r
+Returns: \r
+\r
+ EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
+ \r
+ EFI_BUFFER_TOO_SMALL - DefualtImage has no enough ImageLength\r
+ \r
+ EFI_SUCCESS - Successfully extract data from Hii database.\r
+ \r
+ \r
+--*/\r
+;\r
+\r
+EFI_HII_HANDLE\r
+FindHiiHandle (\r
+ IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL\r
+ IN EFI_GUID *Guid\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Finds HII handle for given pack GUID previously registered with the HII.\r
+\r
+Arguments:\r
+ HiiProtocol - pointer to pointer to HII protocol interface. \r
+ If NULL, the interface will be found but not returned.\r
+ If it points to NULL, the interface will be found and \r
+ written back to the pointer that is pointed to.\r
+ Guid - The GUID of the pack that registered with the HII.\r
+\r
+Returns:\r
+ Handle to the HII pack previously registered by the memory driver.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateSubTitleOpCode (\r
+ IN STRING_REF StringToken,\r
+ IN OUT VOID *FormBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a SubTitle opcode independent of string creation\r
+ This is used primarily by users who need to create just one particular valid op-code and the string\r
+ data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
+ location to pre-defined forms in HII)\r
+ \r
+Arguments:\r
+\r
+ StringToken - StringToken of the subtitle\r
+ \r
+ FormBuffer - Output of subtitle as a form\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Subtitle created to be a form\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateTextOpCode (\r
+ IN STRING_REF StringToken,\r
+ IN STRING_REF StringTokenTwo,\r
+ IN STRING_REF StringTokenThree,\r
+ IN UINT8 Flags,\r
+ IN UINT16 Key,\r
+ IN OUT VOID *FormBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a Text opcode independent of string creation\r
+ This is used primarily by users who need to create just one particular valid op-code and the string\r
+ data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
+ location to pre-defined forms in HII)\r
+ \r
+Arguments:\r
+\r
+ StringToken - First string token of the text\r
+ \r
+ StringTokenTwo - Second string token of the text\r
+ \r
+ StringTokenThree - Help string token of the text\r
+ \r
+ Flags - Flag of the text\r
+ \r
+ Key - Key of the text\r
+ \r
+ FormBuffer - Output of text as a form\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Text created to be a form\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateGotoOpCode (\r
+ IN UINT16 FormId,\r
+ IN STRING_REF StringToken,\r
+ IN STRING_REF StringTokenTwo,\r
+ IN UINT8 Flags,\r
+ IN UINT16 Key,\r
+ IN OUT VOID *FormBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a hyperlink opcode independent of string creation\r
+ This is used primarily by users who need to create just one particular valid op-code and the string\r
+ data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
+ location to pre-defined forms in HII)\r
+ \r
+Arguments:\r
+\r
+ FormId - Form ID of the hyperlink\r
+ \r
+ StringToken - Prompt string token of the hyperlink\r
+ \r
+ StringTokenTwo - Help string token of the hyperlink\r
+ \r
+ Flags - Flags of the hyperlink\r
+ \r
+ Key - Key of the hyperlink\r
+ \r
+ FormBuffer - Output of hyperlink as a form\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Hyperlink created to be a form\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateOneOfOpCode (\r
+ IN UINT16 QuestionId,\r
+ IN UINT8 DataWidth,\r
+ IN STRING_REF PromptToken,\r
+ IN STRING_REF HelpToken,\r
+ IN IFR_OPTION *OptionsList,\r
+ IN UINTN OptionCount,\r
+ IN OUT VOID *FormBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a one-of opcode with a set of option op-codes to choose from independent of string creation.\r
+ This is used primarily by users who need to create just one particular valid op-code and the string\r
+ data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
+ location to pre-defined forms in HII)\r
+\r
+ OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken\r
+ has been filled in since this routine will not generate StringToken values.\r
+ \r
+Arguments:\r
+\r
+ QuestionId - Question ID of the one-of box\r
+ \r
+ DataWidth - DataWidth of the one-of box\r
+ \r
+ PromptToken - Prompt string token of the one-of box\r
+ \r
+ HelpToken - Help string token of the one-of box\r
+ \r
+ OptionsList - Each string in it is an option of the one-of box\r
+ \r
+ OptionCount - Option string count\r
+ \r
+ FormBuffer - Output of One-Of box as a form\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - One-Of box created to be a form\r
+ \r
+ EFI_DEVICE_ERROR - DataWidth > 2\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateOrderedListOpCode (\r
+ IN UINT16 QuestionId,\r
+ IN UINT8 MaxEntries,\r
+ IN STRING_REF PromptToken,\r
+ IN STRING_REF HelpToken,\r
+ IN IFR_OPTION *OptionsList,\r
+ IN UINTN OptionCount,\r
+ IN OUT VOID *FormBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a ordered list opcode with a set of option op-codes to choose from independent of string creation.\r
+ This is used primarily by users who need to create just one particular valid op-code and the string\r
+ data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
+ location to pre-defined forms in HII)\r
+\r
+ OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken\r
+ has been filled in since this routine will not generate StringToken values.\r
+ \r
+Arguments:\r
+\r
+ QuestionId - Question ID of the ordered list\r
+ \r
+ MaxEntries - MaxEntries of the ordered list\r
+ \r
+ PromptToken - Prompt string token of the ordered list\r
+ \r
+ HelpToken - Help string token of the ordered list\r
+ \r
+ OptionsList - Each string in it is an option of the ordered list\r
+ \r
+ OptionCount - Option string count\r
+ \r
+ FormBuffer - Output of ordered list as a form\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Ordered list created to be a form\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateCheckBoxOpCode (\r
+ IN UINT16 QuestionId,\r
+ IN UINT8 DataWidth,\r
+ IN STRING_REF PromptToken,\r
+ IN STRING_REF HelpToken,\r
+ IN UINT8 Flags,\r
+ IN UINT16 Key,\r
+ IN OUT VOID *FormBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a checkbox opcode independent of string creation\r
+ This is used primarily by users who need to create just one particular valid op-code and the string\r
+ data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
+ location to pre-defined forms in HII)\r
+ \r
+Arguments:\r
+\r
+ QuestionId - Question ID of the check box\r
+ \r
+ DataWidth - DataWidth of the check box\r
+ \r
+ PromptToken - Prompt string token of the check box\r
+ \r
+ HelpToken - Help string token of the check box\r
+ \r
+ Flags - Flags of the check box\r
+ \r
+ Key - Key of the check box\r
+ \r
+ FormBuffer - Output of the check box as a form\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Checkbox created to be a form\r
+ \r
+ EFI_DEVICE_ERROR - DataWidth > 1\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateNumericOpCode (\r
+ IN UINT16 QuestionId,\r
+ IN UINT8 DataWidth,\r
+ IN STRING_REF PromptToken,\r
+ IN STRING_REF HelpToken,\r
+ IN UINT16 Minimum,\r
+ IN UINT16 Maximum,\r
+ IN UINT16 Step,\r
+ IN UINT16 Default,\r
+ IN UINT8 Flags,\r
+ IN UINT16 Key,\r
+ IN OUT VOID *FormBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a numeric opcode independent of string creation\r
+ This is used primarily by users who need to create just one particular valid op-code and the string\r
+ data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
+ location to pre-defined forms in HII)\r
+ \r
+Arguments:\r
+\r
+ QuestionId - Question ID of the numeric\r
+ \r
+ DataWidth - DataWidth of the numeric\r
+ \r
+ PromptToken - Prompt string token of the numeric\r
+ \r
+ HelpToken - Help string token of the numeric\r
+ \r
+ Minimum - Minumun boundary of the numeric\r
+ \r
+ Maximum - Maximum boundary of the numeric\r
+ \r
+ Step - Step of the numeric\r
+ \r
+ Default - Default value of the numeric\r
+ \r
+ Flags - Flags of the numeric\r
+ \r
+ Key - Key of the numeric\r
+ \r
+ FormBuffer - Output of the numeric as a form\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - The numeric created to be a form.\r
+ \r
+ EFI_DEVICE_ERROR - DataWidth > 2\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateStringOpCode (\r
+ IN UINT16 QuestionId,\r
+ IN UINT8 DataWidth,\r
+ IN STRING_REF PromptToken,\r
+ IN STRING_REF HelpToken,\r
+ IN UINT8 MinSize,\r
+ IN UINT8 MaxSize,\r
+ IN UINT8 Flags,\r
+ IN UINT16 Key,\r
+ IN OUT VOID *FormBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a numeric opcode independent of string creation\r
+ This is used primarily by users who need to create just one particular valid op-code and the string\r
+ data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
+ location to pre-defined forms in HII)\r
+ \r
+Arguments:\r
+\r
+ QuestionId - Question ID of the string\r
+ \r
+ DataWidth - DataWidth of the string\r
+ \r
+ PromptToken - Prompt token of the string\r
+ \r
+ HelpToken - Help token of the string\r
+ \r
+ MinSize - Min size boundary of the string\r
+ \r
+ MaxSize - Max size boundary of the string\r
+ \r
+ Flags - Flags of the string\r
+ \r
+ Key - Key of the string\r
+ \r
+ FormBuffer - Output of the string as a form\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - String created to be a form.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+ValidateDataFromHiiHandle (\r
+ IN EFI_HII_HANDLE HiiHandle,\r
+ OUT BOOLEAN *Results\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Validate that the data associated with the HiiHandle in NVRAM is within\r
+ the reasonable parameters for that FormSet. Values for strings and passwords\r
+ are not verified due to their not having the equivalent of valid range settings.\r
+ \r
+Arguments:\r
+\r
+ HiiHandle - Handle of the HII database entry to query\r
+\r
+ Results - If return Status is EFI_SUCCESS, Results provides valid data\r
+ TRUE = NVRAM Data is within parameters\r
+ FALSE = NVRAM Data is NOT within parameters\r
+ \r
+Returns: \r
+\r
+ EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
+ \r
+ EFI_SUCCESS - Data successfully validated\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CreateBannerOpCode (\r
+ IN UINT16 Title,\r
+ IN UINT16 LineNumber,\r
+ IN UINT8 Alignment,\r
+ IN OUT VOID *FormBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a banner opcode. This is primarily used by the FrontPage implementation from BDS.\r
+ \r
+Arguments:\r
+\r
+ Title - Title of the banner\r
+ \r
+ LineNumber - LineNumber of the banner\r
+ \r
+ Alignment - Alignment of the banner\r
+ \r
+ FormBuffer - Output of banner as a form\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Banner created to be a form.\r
+\r
+--*/\r
+;\r
+\r
+VOID\r
+EfiLibHiiVariablePackGetMap (\r
+ IN EFI_HII_VARIABLE_PACK *Pack, \r
+ OUT CHAR16 **Name, OPTIONAL\r
+ OUT EFI_GUID **Guid, OPTIONAL\r
+ OUT UINT16 *Id, OPTIONAL\r
+ OUT VOID **Var, OPTIONAL\r
+ OUT UINTN *Size OPTIONAL\r
+ ) \r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Extracts a variable form a Pack.\r
+\r
+Arguments:\r
+\r
+ Pack - List of variables\r
+ Name - Name of the variable/map\r
+ Guid - GUID of the variable/map\r
+ Var - Pointer to the variable/map\r
+ Size - Size of the variable/map in bytes\r
+\r
+Returns: \r
+\r
+ VOID.\r
+\r
+--*/\r
+;\r
+\r
+UINTN\r
+EfiLibHiiVariablePackListGetMapCnt (\r
+ IN EFI_HII_VARIABLE_PACK_LIST *List\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Finds a count of the variables/maps in the List.\r
+\r
+Arguments:\r
+\r
+ List - List of variables\r
+\r
+Returns: \r
+\r
+ Number of Map in the variable pack list.\r
+\r
+--*/\r
+;\r
+\r
+typedef VOID (EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK) (\r
+ IN CHAR16 *Name,\r
+ IN EFI_GUID *Guid,\r
+ IN UINT16 Id,\r
+ IN VOID *Var,\r
+ IN UINTN Size\r
+ ) \r
+/*++\r
+\r
+Routine Description:\r
+\r
+ type definition for the callback to be \r
+ used with EfiLibHiiVariablePackListForEachVar().\r
+\r
+Arguments:\r
+\r
+ Id - Variable/Map ID\r
+ Name - Name of the variable/map\r
+ Guid - GUID of the variable/map\r
+ Var - Pointer to the variable/map\r
+ Size - Size of the variable/map in bytes\r
+\r
+Returns: \r
+\r
+ VOID\r
+\r
+--*/\r
+;\r
+\r
+VOID\r
+EfiLibHiiVariablePackListForEachVar (\r
+ IN EFI_HII_VARIABLE_PACK_LIST *List,\r
+ IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Will iterate all variable/maps as appearing \r
+ in List and for each, it will call the Callback.\r
+\r
+Arguments:\r
+\r
+ List - List of variables\r
+ Callback - Routine to be called for each iterated variable.\r
+\r
+Returns: \r
+\r
+ VOID\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EfiLibHiiVariablePackListGetMapByIdx (\r
+ IN UINTN Idx, \r
+ IN EFI_HII_VARIABLE_PACK_LIST *List, \r
+ OUT CHAR16 **Name, OPTIONAL\r
+ OUT EFI_GUID **Guid, OPTIONAL\r
+ OUT UINT16 *Id, OPTIONAL\r
+ OUT VOID **Var,\r
+ OUT UINTN *Size\r
+ ) \r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Finds a variable form List given \r
+ the order number as appears in the List.\r
+\r
+Arguments:\r
+\r
+ Idx - The index of the variable/map to retrieve\r
+ List - List of variables\r
+ Name - Name of the variable/map\r
+ Guid - GUID of the variable/map\r
+ Var - Pointer to the variable/map\r
+ Size - Size of the variable/map in bytes\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - Variable is found, OUT parameters are valid\r
+ EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EfiLibHiiVariablePackListGetMapById (\r
+ IN UINT16 Id, \r
+ IN EFI_HII_VARIABLE_PACK_LIST *List,\r
+ OUT CHAR16 **Name, OPTIONAL\r
+ OUT EFI_GUID **Guid, OPTIONAL\r
+ OUT VOID **Var,\r
+ OUT UINTN *Size\r
+ ) \r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Finds a variable form List given the \r
+ order number as appears in the List.\r
+\r
+Arguments:\r
+\r
+ Id - The ID of the variable/map to retrieve\r
+ List - List of variables\r
+ Name - Name of the variable/map\r
+ Guid - GUID of the variable/map\r
+ Var - Pointer to the variable/map\r
+ Size - Size of the variable/map in bytes\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - Variable is found, OUT parameters are valid\r
+ EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EfiLibHiiVariablePackListGetMap (\r
+ IN EFI_HII_VARIABLE_PACK_LIST *List,\r
+ IN CHAR16 *Name,\r
+ IN EFI_GUID *Guid,\r
+ OUT UINT16 *Id,\r
+ OUT VOID **Var, \r
+ OUT UINTN *Size\r
+ ) \r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Finds a variable form EFI_HII_VARIABLE_PACK_LIST given name and GUID.\r
+\r
+Arguments:\r
+\r
+ List - List of variables\r
+ Name - Name of the variable/map to be found\r
+ Guid - GUID of the variable/map to be found\r
+ Var - Pointer to the variable/map found\r
+ Size - Size of the variable/map in bytes found\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - variable is found, OUT parameters are valid\r
+ EFI_NOT_FOUND - variable is not found, OUT parameters are not valid\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EfiLibHiiVariableRetrieveFromNv (\r
+ IN CHAR16 *Name,\r
+ IN EFI_GUID *Guid,\r
+ IN UINTN Size,\r
+ OUT VOID **Var\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Finds out if a variable of specific Name/Guid/Size exists in NV. \r
+ If it does, it will retrieve it into the Var. \r
+\r
+Arguments:\r
+ Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.\r
+ Var - Variable will be retrieved into buffer pointed by this pointer.\r
+ If pointing to NULL, the buffer will be allocated. Caller is responsible for releasing the buffer.\r
+Returns:\r
+ EFI_SUCCESS - The variable of exact Name/Guid/Size parameters was retrieved and written to Var.\r
+ EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.\r
+ EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.\r
+\r
+--*/\r
+;\r
+\r
+////\r
+//// Variable override support.\r
+////\r
+\r
+EFI_STATUS\r
+EfiLibHiiVariableOverrideIfSuffix (\r
+ IN CHAR16 *Suffix,\r
+ IN CHAR16 *Name,\r
+ IN EFI_GUID *Guid,\r
+ IN UINTN Size,\r
+ OUT VOID *Var\r
+ ) \r
+/*++\r
+\r
+Routine Description:\r
+ Overrrides the variable with NV data if found.\r
+ But it only does it if the Name ends with specified Suffix.\r
+ For example, if Suffix="MyOverride" and the Name="XyzSetupMyOverride",\r
+ the Suffix matches the end of Name, so the variable will be loaded from NV\r
+ provided the variable exists and the GUID and Size matches.\r
+\r
+Arguments:\r
+ Suffix - Suffix the Name should end with.\r
+ Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.\r
+ Var - Variable will be retrieved into this buffer.\r
+ Caller is responsible for providing storage of exactly Size size in bytes.\r
+Returns:\r
+ EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.\r
+ EFI_INVALID_PARAMETER - The name of the variable does not end with <Suffix>.\r
+ EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.\r
+ EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EfiLibHiiVariableOverrideBySuffix (\r
+ IN CHAR16 *Suffix,\r
+ IN CHAR16 *Name,\r
+ IN EFI_GUID *Guid,\r
+ IN UINTN Size,\r
+ OUT VOID *Var\r
+ ) \r
+/*++\r
+\r
+Routine Description:\r
+ Overrrides the variable with NV data if found.\r
+ But it only does it if the NV contains the same variable with Name is appended with Suffix. \r
+ For example, if Suffix="MyOverride" and the Name="XyzSetup",\r
+ the Suffix will be appended to the end of Name, and the variable with Name="XyzSetupMyOverride"\r
+ will be loaded from NV provided the variable exists and the GUID and Size matches.\r
+\r
+Arguments:\r
+ Suffix - Suffix the variable will be appended with.\r
+ Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.\r
+ Var - Variable will be retrieved into this buffer.\r
+ Caller is responsible for providing storage of exactly Size size in bytes.\r
+\r
+Returns:\r
+ EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.\r
+ EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.\r
+ EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.\r
+\r
+--*/\r
+;\r
+\r
+#endif\r
+++ /dev/null
-/** @file\r
- Public include file for the HII Library\r
-\r
- Copyright (c) 2006, Intel Corporation \r
- All rights reserved. This program and the accompanying materials \r
- are licensed and made available under the terms and conditions of the BSD License \r
- which accompanies this distribution. The full text of the license may be found at \r
- http://opensource.org/licenses/bsd-license.php \r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
- Module Name: HiiLib.h\r
-\r
-**/\r
-\r
-#ifndef __HII_LIB_H__\r
-#define __HII_LIB_H__\r
-\r
-#include <Protocol/HiiFramework.h>\r
-\r
-/**\r
- This function allocates pool for an EFI_HII_PACKAGES structure\r
- with enough space for the variable argument list of package pointers.\r
- The allocated structure is initialized using NumberOfPackages, Guid, \r
- and the variable length argument list of package pointers.\r
-\r
- @param NumberOfPackages The number of HII packages to prepare.\r
- @param Guid Package GUID.\r
-\r
- @return\r
- The allocated and initialized packages.\r
-\r
-**/\r
-EFI_HII_PACKAGES *\r
-EFIAPI\r
-PreparePackages (\r
- IN UINTN NumberOfPackages,\r
- IN CONST EFI_GUID *Guid OPTIONAL,\r
- ...\r
- )\r
-;\r
-\r
-\r
-\r
-#endif\r
+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- IfrSupportLib.h\r
-\r
-Abstract:\r
-\r
- The file contain all library function for Ifr Operations.\r
-\r
---*/\r
-\r
-#ifndef _IFRSUPPORTLIBRARY_H\r
-#define _IFRSUPPORTLIBRARY_H\r
-\r
-#define DEFAULT_FORM_BUFFER_SIZE 0xFFFF\r
-#define DEFAULT_STRING_BUFFER_SIZE 0xFFFF\r
-\r
-#pragma pack(1)\r
-typedef struct {\r
- CHAR16 *OptionString; // Passed in string to generate a token for in a truly dynamic form creation\r
- STRING_REF StringToken; // This is used when creating a single op-code without generating a StringToken (have one already)\r
- UINT16 Value;\r
- UINT8 Flags;\r
- UINT16 Key;\r
-} IFR_OPTION;\r
-#pragma pack()\r
-\r
-EFI_STATUS\r
-GetCurrentLanguage (\r
- OUT CHAR16 *Lang\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Determine what is the current language setting\r
- \r
-Arguments:\r
-\r
- Lang - Pointer of system language\r
- \r
-Returns: \r
- \r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-AddString (\r
- IN VOID *StringBuffer,\r
- IN CHAR16 *Language,\r
- IN CHAR16 *String,\r
- IN OUT STRING_REF *StringToken\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Add a string to the incoming buffer and return the token and offset data\r
- \r
-Arguments:\r
-\r
- StringBuffer - The incoming buffer\r
- \r
- Language - Currrent language\r
- \r
- String - The string to be added\r
- \r
- StringToken - The index where the string placed\r
- \r
-Returns: \r
-\r
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
- \r
- EFI_SUCCESS - String successfully added to the incoming buffer\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-AddOpCode (\r
- IN VOID *FormBuffer,\r
- IN OUT VOID *OpCodeData\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Add op-code data to the FormBuffer\r
- \r
-Arguments:\r
-\r
- FormBuffer - Form buffer to be inserted to\r
- \r
- OpCodeData - Op-code data to be inserted\r
- \r
-Returns: \r
-\r
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
- \r
- EFI_SUCCESS - Op-code data successfully inserted\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateFormSet (\r
- IN CHAR16 *FormSetTitle,\r
- IN EFI_GUID *Guid,\r
- IN UINT8 Class,\r
- IN UINT8 SubClass,\r
- IN OUT VOID **FormBuffer,\r
- IN OUT VOID **StringBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a formset\r
- \r
-Arguments:\r
-\r
- FormSetTitle - Title of formset\r
- \r
- Guid - Guid of formset\r
- \r
- Class - Class of formset\r
- \r
- SubClass - Sub class of formset\r
- \r
- FormBuffer - Pointer of the formset created\r
- \r
- StringBuffer - Pointer of FormSetTitile string created\r
- \r
-Returns: \r
-\r
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
- \r
- EFI_SUCCESS - Formset successfully created\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateForm (\r
- IN CHAR16 *FormTitle,\r
- IN UINT16 FormId,\r
- IN OUT VOID *FormBuffer,\r
- IN OUT VOID *StringBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a form\r
- \r
-Arguments:\r
-\r
- FormTitle - Title of the form\r
- \r
- FormId - Id of the form\r
- \r
- FormBuffer - Pointer of the form created\r
- \r
- StringBuffer - Pointer of FormTitil string created\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - Form successfully created\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateSubTitle (\r
- IN CHAR16 *SubTitle,\r
- IN OUT VOID *FormBuffer,\r
- IN OUT VOID *StringBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a SubTitle\r
- \r
-Arguments:\r
-\r
- SubTitle - Sub title to be created\r
- \r
- FormBuffer - Where this subtitle to add to\r
- \r
- StringBuffer - String buffer created for subtitle\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - Subtitle successfully created\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateText (\r
- IN CHAR16 *String,\r
- IN CHAR16 *String2,\r
- IN CHAR16 *String3,\r
- IN UINT8 Flags,\r
- IN UINT16 Key,\r
- IN OUT VOID *FormBuffer,\r
- IN OUT VOID *StringBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a line of text\r
- \r
-Arguments:\r
-\r
- String - First string of the text\r
- \r
- String2 - Second string of the text\r
- \r
- String3 - Help string of the text\r
- \r
- Flags - Flag of the text\r
- \r
- Key - Key of the text\r
- \r
- FormBuffer - The form where this text adds to\r
- \r
- StringBuffer - String buffer created for String, String2 and String3\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - Text successfully created\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateGoto (\r
- IN UINT16 FormId,\r
- IN CHAR16 *Prompt,\r
- IN OUT VOID *FormBuffer,\r
- IN OUT VOID *StringBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a hyperlink\r
- \r
-Arguments:\r
-\r
- FormId - Form ID of the hyperlink\r
- \r
- Prompt - Prompt of the hyperlink\r
- \r
- FormBuffer - The form where this hyperlink adds to\r
- \r
- StringBuffer - String buffer created for Prompt\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - Hyperlink successfully created\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateOneOf (\r
- IN UINT16 QuestionId,\r
- IN UINT8 DataWidth,\r
- IN CHAR16 *Prompt,\r
- IN CHAR16 *Help,\r
- IN IFR_OPTION *OptionsList,\r
- IN UINTN OptionCount,\r
- IN OUT VOID *FormBuffer,\r
- IN OUT VOID *StringBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a one-of question with a set of options to choose from. The\r
- OptionsList is a pointer to a null-terminated list of option descriptions.\r
- \r
-Arguments:\r
-\r
- QuestionId - Question ID of the one-of box\r
- \r
- DataWidth - DataWidth of the one-of box\r
- \r
- Prompt - Prompt of the one-of box\r
- \r
- Help - Help of the one-of box\r
- \r
- OptionsList - Each string in it is an option of the one-of box\r
- \r
- OptionCount - Option string count\r
- \r
- FormBuffer - The form where this one-of box adds to\r
- \r
- StringBuffer - String buffer created for Prompt, Help and Option strings\r
- \r
-Returns: \r
-\r
- EFI_DEVICE_ERROR - DataWidth > 2\r
-\r
- EFI_SUCCESS - One-Of box successfully created.\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateOrderedList (\r
- IN UINT16 QuestionId,\r
- IN UINT8 MaxEntries,\r
- IN CHAR16 *Prompt,\r
- IN CHAR16 *Help,\r
- IN IFR_OPTION *OptionsList,\r
- IN UINTN OptionCount,\r
- IN OUT VOID *FormBuffer,\r
- IN OUT VOID *StringBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a one-of question with a set of options to choose from. The\r
- OptionsList is a pointer to a null-terminated list of option descriptions.\r
- \r
-Arguments:\r
-\r
- QuestionId - Question ID of the ordered list\r
- \r
- MaxEntries - MaxEntries of the ordered list\r
- \r
- Prompt - Prompt of the ordered list\r
- \r
- Help - Help of the ordered list\r
- \r
- OptionsList - Each string in it is an option of the ordered list\r
- \r
- OptionCount - Option string count\r
- \r
- FormBuffer - The form where this ordered list adds to\r
- \r
- StringBuffer - String buffer created for Prompt, Help and Option strings\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - Ordered list successfully created.\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateCheckBox (\r
- IN UINT16 QuestionId,\r
- IN UINT8 DataWidth,\r
- IN CHAR16 *Prompt,\r
- IN CHAR16 *Help,\r
- IN UINT8 Flags,\r
- IN OUT VOID *FormBuffer,\r
- IN OUT VOID *StringBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a checkbox\r
- \r
-Arguments:\r
-\r
- QuestionId - Question ID of the check box\r
- \r
- DataWidth - DataWidth of the check box\r
- \r
- Prompt - Prompt of the check box\r
- \r
- Help - Help of the check box\r
- \r
- Flags - Flags of the check box\r
- \r
- FormBuffer - The form where this check box adds to\r
- \r
- StringBuffer - String buffer created for Prompt and Help.\r
- \r
-Returns: \r
-\r
- EFI_DEVICE_ERROR - DataWidth > 1\r
-\r
- EFI_SUCCESS - Check box successfully created\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateNumeric (\r
- IN UINT16 QuestionId,\r
- IN UINT8 DataWidth,\r
- IN CHAR16 *Prompt,\r
- IN CHAR16 *Help,\r
- IN UINT16 Minimum,\r
- IN UINT16 Maximum,\r
- IN UINT16 Step,\r
- IN UINT16 Default,\r
- IN UINT8 Flags,\r
- IN UINT16 Key,\r
- IN OUT VOID *FormBuffer,\r
- IN OUT VOID *StringBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a numeric\r
- \r
-Arguments:\r
-\r
- QuestionId - Question ID of the numeric\r
- \r
- DataWidth - DataWidth of the numeric\r
- \r
- Prompt - Prompt of the numeric\r
- \r
- Help - Help of the numeric\r
- \r
- Minimum - Minumun boundary of the numeric\r
- \r
- Maximum - Maximum boundary of the numeric\r
- \r
- Step - Step of the numeric\r
- \r
- Default - Default value\r
- \r
- Flags - Flags of the numeric\r
- \r
- Key - Key of the numeric\r
- \r
- FormBuffer - The form where this numeric adds to\r
- \r
- StringBuffer - String buffer created for Prompt and Help.\r
- \r
-Returns: \r
-\r
- EFI_DEVICE_ERROR - DataWidth > 2\r
- \r
- EFI_SUCCESS - Numeric is successfully created\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateString (\r
- IN UINT16 QuestionId,\r
- IN UINT8 DataWidth,\r
- IN CHAR16 *Prompt,\r
- IN CHAR16 *Help,\r
- IN UINT8 MinSize,\r
- IN UINT8 MaxSize,\r
- IN UINT8 Flags,\r
- IN UINT16 Key,\r
- IN OUT VOID *FormBuffer,\r
- IN OUT VOID *StringBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a string\r
- \r
-Arguments:\r
-\r
- QuestionId - Question ID of the string\r
- \r
- DataWidth - DataWidth of the string\r
- \r
- Prompt - Prompt of the string\r
- \r
- Help - Help of the string\r
- \r
- MinSize - Min size boundary of the string\r
- \r
- MaxSize - Max size boundary of the string\r
- \r
- Flags - Flags of the string\r
- \r
- Key - Key of the string\r
- \r
- FormBuffer - The form where this string adds to\r
- \r
- StringBuffer - String buffer created for Prompt and Help.\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - String successfully created.\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-ExtractDataFromHiiHandle (\r
- IN EFI_HII_HANDLE HiiHandle,\r
- IN OUT UINT16 *ImageLength,\r
- OUT UINT8 *DefaultImage,\r
- OUT EFI_GUID *Guid\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Extract information pertaining to the HiiHandle\r
- \r
-Arguments:\r
-\r
- HiiHandle - Hii handle\r
- \r
- ImageLength - For input, length of DefaultImage;\r
- For output, length of actually required\r
- \r
- DefaultImage - Image buffer prepared by caller\r
- \r
- Guid - Guid information about the form\r
- \r
-Returns: \r
-\r
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
- \r
- EFI_BUFFER_TOO_SMALL - DefualtImage has no enough ImageLength\r
- \r
- EFI_SUCCESS - Successfully extract data from Hii database.\r
- \r
- \r
---*/\r
-;\r
-\r
-EFI_HII_HANDLE\r
-FindHiiHandle (\r
- IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL\r
- IN EFI_GUID *Guid\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Finds HII handle for given pack GUID previously registered with the HII.\r
-\r
-Arguments:\r
- HiiProtocol - pointer to pointer to HII protocol interface. \r
- If NULL, the interface will be found but not returned.\r
- If it points to NULL, the interface will be found and \r
- written back to the pointer that is pointed to.\r
- Guid - The GUID of the pack that registered with the HII.\r
-\r
-Returns:\r
- Handle to the HII pack previously registered by the memory driver.\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateSubTitleOpCode (\r
- IN STRING_REF StringToken,\r
- IN OUT VOID *FormBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a SubTitle opcode independent of string creation\r
- This is used primarily by users who need to create just one particular valid op-code and the string\r
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
- location to pre-defined forms in HII)\r
- \r
-Arguments:\r
-\r
- StringToken - StringToken of the subtitle\r
- \r
- FormBuffer - Output of subtitle as a form\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - Subtitle created to be a form\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateTextOpCode (\r
- IN STRING_REF StringToken,\r
- IN STRING_REF StringTokenTwo,\r
- IN STRING_REF StringTokenThree,\r
- IN UINT8 Flags,\r
- IN UINT16 Key,\r
- IN OUT VOID *FormBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a Text opcode independent of string creation\r
- This is used primarily by users who need to create just one particular valid op-code and the string\r
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
- location to pre-defined forms in HII)\r
- \r
-Arguments:\r
-\r
- StringToken - First string token of the text\r
- \r
- StringTokenTwo - Second string token of the text\r
- \r
- StringTokenThree - Help string token of the text\r
- \r
- Flags - Flag of the text\r
- \r
- Key - Key of the text\r
- \r
- FormBuffer - Output of text as a form\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - Text created to be a form\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateGotoOpCode (\r
- IN UINT16 FormId,\r
- IN STRING_REF StringToken,\r
- IN STRING_REF StringTokenTwo,\r
- IN UINT8 Flags,\r
- IN UINT16 Key,\r
- IN OUT VOID *FormBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a hyperlink opcode independent of string creation\r
- This is used primarily by users who need to create just one particular valid op-code and the string\r
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
- location to pre-defined forms in HII)\r
- \r
-Arguments:\r
-\r
- FormId - Form ID of the hyperlink\r
- \r
- StringToken - Prompt string token of the hyperlink\r
- \r
- StringTokenTwo - Help string token of the hyperlink\r
- \r
- Flags - Flags of the hyperlink\r
- \r
- Key - Key of the hyperlink\r
- \r
- FormBuffer - Output of hyperlink as a form\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - Hyperlink created to be a form\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateOneOfOpCode (\r
- IN UINT16 QuestionId,\r
- IN UINT8 DataWidth,\r
- IN STRING_REF PromptToken,\r
- IN STRING_REF HelpToken,\r
- IN IFR_OPTION *OptionsList,\r
- IN UINTN OptionCount,\r
- IN OUT VOID *FormBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a one-of opcode with a set of option op-codes to choose from independent of string creation.\r
- This is used primarily by users who need to create just one particular valid op-code and the string\r
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
- location to pre-defined forms in HII)\r
-\r
- OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken\r
- has been filled in since this routine will not generate StringToken values.\r
- \r
-Arguments:\r
-\r
- QuestionId - Question ID of the one-of box\r
- \r
- DataWidth - DataWidth of the one-of box\r
- \r
- PromptToken - Prompt string token of the one-of box\r
- \r
- HelpToken - Help string token of the one-of box\r
- \r
- OptionsList - Each string in it is an option of the one-of box\r
- \r
- OptionCount - Option string count\r
- \r
- FormBuffer - Output of One-Of box as a form\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - One-Of box created to be a form\r
- \r
- EFI_DEVICE_ERROR - DataWidth > 2\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateOrderedListOpCode (\r
- IN UINT16 QuestionId,\r
- IN UINT8 MaxEntries,\r
- IN STRING_REF PromptToken,\r
- IN STRING_REF HelpToken,\r
- IN IFR_OPTION *OptionsList,\r
- IN UINTN OptionCount,\r
- IN OUT VOID *FormBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a ordered list opcode with a set of option op-codes to choose from independent of string creation.\r
- This is used primarily by users who need to create just one particular valid op-code and the string\r
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
- location to pre-defined forms in HII)\r
-\r
- OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken\r
- has been filled in since this routine will not generate StringToken values.\r
- \r
-Arguments:\r
-\r
- QuestionId - Question ID of the ordered list\r
- \r
- MaxEntries - MaxEntries of the ordered list\r
- \r
- PromptToken - Prompt string token of the ordered list\r
- \r
- HelpToken - Help string token of the ordered list\r
- \r
- OptionsList - Each string in it is an option of the ordered list\r
- \r
- OptionCount - Option string count\r
- \r
- FormBuffer - Output of ordered list as a form\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - Ordered list created to be a form\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateCheckBoxOpCode (\r
- IN UINT16 QuestionId,\r
- IN UINT8 DataWidth,\r
- IN STRING_REF PromptToken,\r
- IN STRING_REF HelpToken,\r
- IN UINT8 Flags,\r
- IN UINT16 Key,\r
- IN OUT VOID *FormBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a checkbox opcode independent of string creation\r
- This is used primarily by users who need to create just one particular valid op-code and the string\r
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
- location to pre-defined forms in HII)\r
- \r
-Arguments:\r
-\r
- QuestionId - Question ID of the check box\r
- \r
- DataWidth - DataWidth of the check box\r
- \r
- PromptToken - Prompt string token of the check box\r
- \r
- HelpToken - Help string token of the check box\r
- \r
- Flags - Flags of the check box\r
- \r
- Key - Key of the check box\r
- \r
- FormBuffer - Output of the check box as a form\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - Checkbox created to be a form\r
- \r
- EFI_DEVICE_ERROR - DataWidth > 1\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateNumericOpCode (\r
- IN UINT16 QuestionId,\r
- IN UINT8 DataWidth,\r
- IN STRING_REF PromptToken,\r
- IN STRING_REF HelpToken,\r
- IN UINT16 Minimum,\r
- IN UINT16 Maximum,\r
- IN UINT16 Step,\r
- IN UINT16 Default,\r
- IN UINT8 Flags,\r
- IN UINT16 Key,\r
- IN OUT VOID *FormBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a numeric opcode independent of string creation\r
- This is used primarily by users who need to create just one particular valid op-code and the string\r
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
- location to pre-defined forms in HII)\r
- \r
-Arguments:\r
-\r
- QuestionId - Question ID of the numeric\r
- \r
- DataWidth - DataWidth of the numeric\r
- \r
- PromptToken - Prompt string token of the numeric\r
- \r
- HelpToken - Help string token of the numeric\r
- \r
- Minimum - Minumun boundary of the numeric\r
- \r
- Maximum - Maximum boundary of the numeric\r
- \r
- Step - Step of the numeric\r
- \r
- Default - Default value of the numeric\r
- \r
- Flags - Flags of the numeric\r
- \r
- Key - Key of the numeric\r
- \r
- FormBuffer - Output of the numeric as a form\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - The numeric created to be a form.\r
- \r
- EFI_DEVICE_ERROR - DataWidth > 2\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateStringOpCode (\r
- IN UINT16 QuestionId,\r
- IN UINT8 DataWidth,\r
- IN STRING_REF PromptToken,\r
- IN STRING_REF HelpToken,\r
- IN UINT8 MinSize,\r
- IN UINT8 MaxSize,\r
- IN UINT8 Flags,\r
- IN UINT16 Key,\r
- IN OUT VOID *FormBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a numeric opcode independent of string creation\r
- This is used primarily by users who need to create just one particular valid op-code and the string\r
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label\r
- location to pre-defined forms in HII)\r
- \r
-Arguments:\r
-\r
- QuestionId - Question ID of the string\r
- \r
- DataWidth - DataWidth of the string\r
- \r
- PromptToken - Prompt token of the string\r
- \r
- HelpToken - Help token of the string\r
- \r
- MinSize - Min size boundary of the string\r
- \r
- MaxSize - Max size boundary of the string\r
- \r
- Flags - Flags of the string\r
- \r
- Key - Key of the string\r
- \r
- FormBuffer - Output of the string as a form\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - String created to be a form.\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-ValidateDataFromHiiHandle (\r
- IN EFI_HII_HANDLE HiiHandle,\r
- OUT BOOLEAN *Results\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Validate that the data associated with the HiiHandle in NVRAM is within\r
- the reasonable parameters for that FormSet. Values for strings and passwords\r
- are not verified due to their not having the equivalent of valid range settings.\r
- \r
-Arguments:\r
-\r
- HiiHandle - Handle of the HII database entry to query\r
-\r
- Results - If return Status is EFI_SUCCESS, Results provides valid data\r
- TRUE = NVRAM Data is within parameters\r
- FALSE = NVRAM Data is NOT within parameters\r
- \r
-Returns: \r
-\r
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
- \r
- EFI_SUCCESS - Data successfully validated\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CreateBannerOpCode (\r
- IN UINT16 Title,\r
- IN UINT16 LineNumber,\r
- IN UINT8 Alignment,\r
- IN OUT VOID *FormBuffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Create a banner opcode. This is primarily used by the FrontPage implementation from BDS.\r
- \r
-Arguments:\r
-\r
- Title - Title of the banner\r
- \r
- LineNumber - LineNumber of the banner\r
- \r
- Alignment - Alignment of the banner\r
- \r
- FormBuffer - Output of banner as a form\r
- \r
-Returns: \r
-\r
- EFI_SUCCESS - Banner created to be a form.\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-EfiLibHiiVariablePackGetMap (\r
- IN EFI_HII_VARIABLE_PACK *Pack, \r
- OUT CHAR16 **Name, OPTIONAL\r
- OUT EFI_GUID **Guid, OPTIONAL\r
- OUT UINT16 *Id, OPTIONAL\r
- OUT VOID **Var, OPTIONAL\r
- OUT UINTN *Size OPTIONAL\r
- ) \r
-/*++\r
-\r
-Routine Description:\r
-\r
- Extracts a variable form a Pack.\r
-\r
-Arguments:\r
-\r
- Pack - List of variables\r
- Name - Name of the variable/map\r
- Guid - GUID of the variable/map\r
- Var - Pointer to the variable/map\r
- Size - Size of the variable/map in bytes\r
-\r
-Returns: \r
-\r
- VOID.\r
-\r
---*/\r
-;\r
-\r
-UINTN\r
-EfiLibHiiVariablePackListGetMapCnt (\r
- IN EFI_HII_VARIABLE_PACK_LIST *List\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Finds a count of the variables/maps in the List.\r
-\r
-Arguments:\r
-\r
- List - List of variables\r
-\r
-Returns: \r
-\r
- Number of Map in the variable pack list.\r
-\r
---*/\r
-;\r
-\r
-typedef VOID (EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK) (\r
- IN CHAR16 *Name,\r
- IN EFI_GUID *Guid,\r
- IN UINT16 Id,\r
- IN VOID *Var,\r
- IN UINTN Size\r
- ) \r
-/*++\r
-\r
-Routine Description:\r
-\r
- type definition for the callback to be \r
- used with EfiLibHiiVariablePackListForEachVar().\r
-\r
-Arguments:\r
-\r
- Id - Variable/Map ID\r
- Name - Name of the variable/map\r
- Guid - GUID of the variable/map\r
- Var - Pointer to the variable/map\r
- Size - Size of the variable/map in bytes\r
-\r
-Returns: \r
-\r
- VOID\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-EfiLibHiiVariablePackListForEachVar (\r
- IN EFI_HII_VARIABLE_PACK_LIST *List,\r
- IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Will iterate all variable/maps as appearing \r
- in List and for each, it will call the Callback.\r
-\r
-Arguments:\r
-\r
- List - List of variables\r
- Callback - Routine to be called for each iterated variable.\r
-\r
-Returns: \r
-\r
- VOID\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiLibHiiVariablePackListGetMapByIdx (\r
- IN UINTN Idx, \r
- IN EFI_HII_VARIABLE_PACK_LIST *List, \r
- OUT CHAR16 **Name, OPTIONAL\r
- OUT EFI_GUID **Guid, OPTIONAL\r
- OUT UINT16 *Id, OPTIONAL\r
- OUT VOID **Var,\r
- OUT UINTN *Size\r
- ) \r
-/*++\r
-\r
-Routine Description:\r
-\r
- Finds a variable form List given \r
- the order number as appears in the List.\r
-\r
-Arguments:\r
-\r
- Idx - The index of the variable/map to retrieve\r
- List - List of variables\r
- Name - Name of the variable/map\r
- Guid - GUID of the variable/map\r
- Var - Pointer to the variable/map\r
- Size - Size of the variable/map in bytes\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Variable is found, OUT parameters are valid\r
- EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiLibHiiVariablePackListGetMapById (\r
- IN UINT16 Id, \r
- IN EFI_HII_VARIABLE_PACK_LIST *List,\r
- OUT CHAR16 **Name, OPTIONAL\r
- OUT EFI_GUID **Guid, OPTIONAL\r
- OUT VOID **Var,\r
- OUT UINTN *Size\r
- ) \r
-/*++\r
-\r
-Routine Description:\r
-\r
- Finds a variable form List given the \r
- order number as appears in the List.\r
-\r
-Arguments:\r
-\r
- Id - The ID of the variable/map to retrieve\r
- List - List of variables\r
- Name - Name of the variable/map\r
- Guid - GUID of the variable/map\r
- Var - Pointer to the variable/map\r
- Size - Size of the variable/map in bytes\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Variable is found, OUT parameters are valid\r
- EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiLibHiiVariablePackListGetMap (\r
- IN EFI_HII_VARIABLE_PACK_LIST *List,\r
- IN CHAR16 *Name,\r
- IN EFI_GUID *Guid,\r
- OUT UINT16 *Id,\r
- OUT VOID **Var, \r
- OUT UINTN *Size\r
- ) \r
-/*++\r
-\r
-Routine Description:\r
-\r
- Finds a variable form EFI_HII_VARIABLE_PACK_LIST given name and GUID.\r
-\r
-Arguments:\r
-\r
- List - List of variables\r
- Name - Name of the variable/map to be found\r
- Guid - GUID of the variable/map to be found\r
- Var - Pointer to the variable/map found\r
- Size - Size of the variable/map in bytes found\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - variable is found, OUT parameters are valid\r
- EFI_NOT_FOUND - variable is not found, OUT parameters are not valid\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiLibHiiVariableRetrieveFromNv (\r
- IN CHAR16 *Name,\r
- IN EFI_GUID *Guid,\r
- IN UINTN Size,\r
- OUT VOID **Var\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Finds out if a variable of specific Name/Guid/Size exists in NV. \r
- If it does, it will retrieve it into the Var. \r
-\r
-Arguments:\r
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.\r
- Var - Variable will be retrieved into buffer pointed by this pointer.\r
- If pointing to NULL, the buffer will be allocated. Caller is responsible for releasing the buffer.\r
-Returns:\r
- EFI_SUCCESS - The variable of exact Name/Guid/Size parameters was retrieved and written to Var.\r
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.\r
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.\r
-\r
---*/\r
-;\r
-\r
-////\r
-//// Variable override support.\r
-////\r
-\r
-EFI_STATUS\r
-EfiLibHiiVariableOverrideIfSuffix (\r
- IN CHAR16 *Suffix,\r
- IN CHAR16 *Name,\r
- IN EFI_GUID *Guid,\r
- IN UINTN Size,\r
- OUT VOID *Var\r
- ) \r
-/*++\r
-\r
-Routine Description:\r
- Overrrides the variable with NV data if found.\r
- But it only does it if the Name ends with specified Suffix.\r
- For example, if Suffix="MyOverride" and the Name="XyzSetupMyOverride",\r
- the Suffix matches the end of Name, so the variable will be loaded from NV\r
- provided the variable exists and the GUID and Size matches.\r
-\r
-Arguments:\r
- Suffix - Suffix the Name should end with.\r
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.\r
- Var - Variable will be retrieved into this buffer.\r
- Caller is responsible for providing storage of exactly Size size in bytes.\r
-Returns:\r
- EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.\r
- EFI_INVALID_PARAMETER - The name of the variable does not end with <Suffix>.\r
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.\r
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiLibHiiVariableOverrideBySuffix (\r
- IN CHAR16 *Suffix,\r
- IN CHAR16 *Name,\r
- IN EFI_GUID *Guid,\r
- IN UINTN Size,\r
- OUT VOID *Var\r
- ) \r
-/*++\r
-\r
-Routine Description:\r
- Overrrides the variable with NV data if found.\r
- But it only does it if the NV contains the same variable with Name is appended with Suffix. \r
- For example, if Suffix="MyOverride" and the Name="XyzSetup",\r
- the Suffix will be appended to the end of Name, and the variable with Name="XyzSetupMyOverride"\r
- will be loaded from NV provided the variable exists and the GUID and Size matches.\r
-\r
-Arguments:\r
- Suffix - Suffix the variable will be appended with.\r
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.\r
- Var - Variable will be retrieved into this buffer.\r
- Caller is responsible for providing storage of exactly Size size in bytes.\r
-\r
-Returns:\r
- EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.\r
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.\r
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.\r
-\r
---*/\r
-;\r
-\r
-#endif\r
+++ /dev/null
-/** @file\r
- The EFI_FORM_BROWSER_PROTOCOL is the interface to the EFI\r
- Configuration Driver. This will allow the caller to direct the\r
- configuration driver to use either the HII database or use the passed\r
- in packet of data. This will also allow the caller to post messages\r
- into the configuration drivers internal mailbox.\r
-\r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- Module Name: FrameworkFormBrowser.h\r
-\r
- @par Revision Reference:\r
- This protocol is defined in HII spec 0.92.\r
-\r
-**/\r
-\r
-#ifndef __FRAMEWORK_FORM_BROWSER_H__\r
-#define __FRAMEWORK_FORM_BROWSER_H__\r
-\r
-#include <Protocol/HiiFramework.h>\r
-\r
-\r
-#define EFI_FORM_BROWSER_PROTOCOL_GUID \\r
- { \\r
- 0xe5a1333e, 0xe1b4, 0x4d55, {0xce, 0xeb, 0x35, 0xc3, 0xef, 0x13, 0x34, 0x43 } \\r
- }\r
-\r
-typedef struct _EFI_FORM_BROWSER_PROTOCOL EFI_FORM_BROWSER_PROTOCOL;\r
-\r
-typedef struct {\r
- UINT32 Length;\r
- UINT16 Type;\r
- UINT8 Data[1];\r
-} EFI_HII_PACKET;\r
-\r
-typedef struct {\r
- EFI_HII_IFR_PACK *IfrData;\r
- EFI_HII_STRING_PACK *StringData;\r
-} EFI_IFR_PACKET;\r
-\r
-typedef struct {\r
- UINTN LeftColumn;\r
- UINTN RightColumn;\r
- UINTN TopRow;\r
- UINTN BottomRow;\r
-} EFI_SCREEN_DESCRIPTOR;\r
-\r
-/**\r
- Provides direction to the configuration driver whether to use the HII\r
- database or a passed-in set of data. This function also establishes a\r
- pointer to the calling driver's callback interface.\r
-\r
- @param This A pointer to the EFI_FORM_BROWSER_PROTOCOL instance.\r
- @param UseDatabase Determines whether the HII database is to be\r
- used to gather information. If the value is FALSE, the configuration\r
- driver will get the information provided in the passed-in Packet parameters.\r
- @param Handle A pointer to an array of HII handles to display. This value\r
- should correspond to the value of the HII form package that is required to\r
- be displayed.\r
- @param HandleCount The number of handles in the array specified by Handle.\r
- @param Packet A pointer to a set of data containing pointers to IFR\r
- and/or string data.\r
- @param CallbackHandle The handle to the driver's callback interface.\r
- This parameter is used only when the UseDatabase parameter is FALSE\r
- and an application wants to register a callback with the browser\r
- @param NvMapOverride This buffer is used only when there is no NV variable\r
- to define the current settings and the caller needs to provide to the browser\r
- the current settings for the "fake" NV variable.\r
- @param ScreenDimensions Allows the browser to be called so that it occupies\r
- a portion of the physical screen instead of dynamically determining the\r
- screen dimensions.\r
- @param ResetRequired This BOOLEAN value will tell the caller if a reset\r
- is required based on the data that might have been changed. The ResetRequired\r
- parameter is primarily applicable for configuration applications, and is an\r
- optional parameter.\r
-\r
- @retval EFI_SUCCESS The function completed successfully\r
- @retval EFI_NOT_FOUND The variable was not found.\r
- @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result.\r
- DataSize has been updated with the size needed to complete the request.\r
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
- @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_SEND_FORM) (\r
- IN EFI_FORM_BROWSER_PROTOCOL *This,\r
- IN BOOLEAN UseDatabase,\r
- IN EFI_HII_HANDLE *Handle,\r
- IN UINTN HandleCount,\r
- IN EFI_IFR_PACKET *Packet, OPTIONAL\r
- IN EFI_HANDLE CallbackHandle, OPTIONAL\r
- IN UINT8 *NvMapOverride, OPTIONAL\r
- IN EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL\r
- OUT BOOLEAN *ResetRequired OPTIONAL\r
- );\r
-\r
-/**\r
- Routine used to abstract a generic dialog interface and return the selected\r
- key or string.\r
-\r
- @param NumberOfLines The number of lines for the dialog box.\r
- @param HotKey Defines whether a single character is parsed (TRUE)\r
- and returned in KeyValue or if a string is returned in StringBuffer.\r
- @param MaximumStringSize The maximum size in bytes of a typed-in string.\r
- Because each character is a CHAR16, the minimum string returned is two bytes.\r
- @param StringBuffer The passed-in pointer to the buffer that will hold\r
- the typed in string if HotKey is FALSE.\r
- @param KeyValue The EFI_INPUT_KEY value returned if HotKey is TRUE.\r
- @param String The pointer to the first string in the list of strings\r
- that comprise the dialog box.\r
- @param ... A series of NumberOfLines text strings that will be used\r
- to construct the dialog box.\r
-\r
- @retval EFI_SUCCESS The dialog was displayed and user interaction was received.\r
- @retval EFI_DEVICE_ERROR The user typed in an ESC character to exit the routine.\r
- @retval EFI_INVALID_PARAMETER One of the parameters was invalid\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_CREATE_POP_UP) (\r
- IN UINTN NumberOfLines,\r
- IN BOOLEAN HotKey,\r
- IN UINTN MaximumStringSize,\r
- OUT CHAR16 *StringBuffer,\r
- OUT EFI_INPUT_KEY *KeyValue,\r
- IN CHAR16 *String,\r
- ...\r
- );\r
-\r
-/**\r
- @par Protocol Description:\r
- The EFI_FORM_BROWSER_PROTOCOL is the interface to call for drivers to\r
- leverage the EFI configuration driver interface.\r
-\r
- @param SendForm\r
- Provides direction to the configuration driver whether to use the HII\r
- database or to use a passed-in set of data. This functions also establishes\r
- a pointer to the calling driver's callback interface.\r
-\r
- @param CreatePopUp\r
- Routine used to abstract a generic dialog interface and return the\r
- selected key or string.\r
-\r
-**/\r
-struct _EFI_FORM_BROWSER_PROTOCOL {\r
- EFI_SEND_FORM SendForm;\r
- EFI_CREATE_POP_UP CreatePopUp;\r
-};\r
-\r
-extern EFI_GUID gEfiFormBrowserProtocolGuid;\r
-\r
-#endif\r
+++ /dev/null
-/** @file\r
- The EFI_FORM_CALLBACK_PROTOCOL is the defined interface for access to custom\r
- NV storage devices as well as communication of user selections in a more\r
- interactive environment. This protocol should be published by hardware\r
- specific drivers which want to export access to custom hardware storage or\r
- publish IFR which has a requirement to call back the original driver.\r
-\r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- Module Name: FormCallbackFramework.h\r
-\r
- @par Revision Reference:\r
- This protocol is defined in HII spec 0.92.\r
-\r
-**/\r
-\r
-#ifndef __FORM_CALLBACK_H__\r
-#define __FORM_CALLBACK_H__\r
-\r
-#include <PiDxe.h>\r
-\r
-#include <Protocol/HiiFramework.h>\r
-#include <Protocol/FormBrowserFramework.h>\r
-\r
-#define EFI_FORM_CALLBACK_PROTOCOL_GUID \\r
- { \\r
- 0xf3e4543d, 0xcf35, 0x6cef, {0x35, 0xc4, 0x4f, 0xe6, 0x34, 0x4d, 0xfc, 0x54 } \\r
- }\r
-\r
-//\r
-// Forward reference for pure ANSI compatability\r
-//\r
-typedef struct _EFI_FORM_CALLBACK_PROTOCOL EFI_FORM_CALLBACK_PROTOCOL;\r
-\r
-\r
-#define RESET_REQUIRED 1 // Flags setting to signify that the callback operation resulted in an eventual\r
-// reset to be done upon exit of the browser\r
-//\r
-#define EXIT_REQUIRED 2 // Flags setting to signify that after the processing of the callback results - exit the browser\r
-#define SAVE_REQUIRED 4 // Flags setting to signify that after the processing of the callback results - save the NV data\r
-#define NV_CHANGED 8 // Flags setting to signify that after the processing of the callback results - turn the NV flag on\r
-#define NV_NOT_CHANGED 16 // Flags setting to signify that after the processing of the callback results - turn the NV flag off\r
-#pragma pack(1)\r
-typedef struct {\r
- UINT8 OpCode; // Likely a string, numeric, or one-of\r
- UINT8 Length; // Length of the EFI_IFR_DATA_ENTRY packet\r
- UINT16 Flags; // Flags settings to determine what behavior is desired from the browser after the callback\r
- VOID *Data; // The data in the form based on the op-code type - this is not a pointer to the data, the data follows immediately\r
- // If the OpCode is a OneOf or Numeric type - Data is a UINT16 value\r
- // If the OpCode is a String type - Data is a CHAR16[x] type\r
- // If the OpCode is a Checkbox type - Data is a UINT8 value\r
- // If the OpCode is a NV Access type - Data is a EFI_IFR_NV_DATA structure\r
- //\r
-} EFI_IFR_DATA_ENTRY;\r
-\r
-typedef struct {\r
- VOID *NvRamMap; // If the flag of the op-code specified retrieval of a copy of the NVRAM map,\r
- // this is a pointer to a buffer copy\r
- //\r
- UINT32 EntryCount; // How many EFI_IFR_DATA_ENTRY entries\r
- //\r
- // EFI_IFR_DATA_ENTRY Data[1]; // The in-line Data entries.\r
- //\r
-} EFI_IFR_DATA_ARRAY;\r
-\r
-\r
-typedef union {\r
- EFI_IFR_DATA_ARRAY DataArray; // Primarily used by those who call back to their drivers and use HII as a repository\r
- EFI_IFR_PACKET DataPacket; // Primarily used by those which do not use HII as a repository\r
- CHAR16 *String; // If returning an error - fill the string with null-terminated contents\r
-} EFI_HII_CALLBACK_PACKET;\r
-\r
-typedef struct {\r
- EFI_IFR_OP_HEADER Header;\r
- UINT16 QuestionId; // Offset into the map\r
- UINT8 StorageWidth; // Width of the value\r
- //\r
- // CHAR8 Data[1]; // The Data itself\r
- //\r
-} EFI_IFR_NV_DATA;\r
-\r
-#pragma pack()\r
-//\r
-// The following types are currently defined:\r
-//\r
-/**\r
- Returns the value of a variable.\r
-\r
- @param This A pointer to the EFI_FORM_CALLBACK_PROTOCOL instance.\r
- @param VariableName A NULL-terminated Unicode string that is the\r
- name of the vendor's variable.\r
- @param VendorGuid A unique identifier for the vendor.\r
- @param Attributes If not NULL, a pointer to the memory location to\r
- return the attribute's bit-mask for the variable.\r
- @param DataSize The size in bytes of the Buffer. A size of zero causes\r
- the variable to be deleted.\r
- @param Buffer The buffer to return the contents of the variable.\r
-\r
- @retval EFI_SUCCESS The function completed successfully.\r
- @retval EFI_NOT_FOUND The variable was not found.\r
- @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result.\r
- DataSize has been updated with the size needed to complete the request.\r
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
- @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_NV_READ) (\r
- IN EFI_FORM_CALLBACK_PROTOCOL *This,\r
- IN CHAR16 *VariableName,\r
- IN EFI_GUID *VendorGuid,\r
- OUT UINT32 *Attributes OPTIONAL,\r
- IN OUT UINTN *DataSize,\r
- OUT VOID *Buffer\r
- );\r
-\r
-/**\r
- Sets the value of a variable.\r
-\r
- @param This A pointer to the EFI_FORM_CALLBACK_PROTOCOL instance.\r
- @param VariableName A NULL-terminated Unicode string that is the\r
- name of the vendor's variable. Each VariableName is unique for each VendorGuid.\r
- @param VendorGuid A unique identifier for the vendor.\r
- @param Attributes Attributes bit-mask to set for the variable.\r
- @param DataSize The size in bytes of the Buffer. A size of zero causes\r
- the variable to be deleted.\r
- @param Buffer The buffer containing the contents of the variable.\r
- @param ResetRequired Returns a value from the driver that abstracts\r
- this information and will enable a system to know if a system reset\r
- is required to achieve the configuration changes being enabled through\r
- this function.\r
-\r
- @retval EFI_SUCCESS The firmware has successfully stored the variable and\r
- its data as defined by the Attributes.\r
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold\r
- the variable and its data.\r
- @retval EFI_INVALID_PARAMETER An invalid combination of Attributes bits\r
- was supplied, or the DataSize exceeds the maximum allowed.\r
- @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_NV_WRITE) (\r
- IN EFI_FORM_CALLBACK_PROTOCOL *This,\r
- IN CHAR16 *VariableName,\r
- IN EFI_GUID *VendorGuid,\r
- IN UINT32 Attributes,\r
- IN UINTN DataSize,\r
- IN VOID *Buffer,\r
- OUT BOOLEAN *ResetRequired\r
- );\r
-\r
-/**\r
- This function is called to provide results data to the driver.\r
-\r
- @param This A pointer to the EFI_FORM_CALLBACK_PROTOCOL instance.\r
- @param KeyValue A unique value which is sent to the original exporting\r
- driver so that it can identify the type of data to expect. The format of\r
- the data tends to vary based on the opcode that generated the callback.\r
- @param Data A pointer to the data being sent to the original exporting driver.\r
- @param Packet A pointer to a packet of information which a driver passes\r
- back to the browser.\r
-\r
- @return Status Code\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_FORM_CALLBACK) (\r
- IN EFI_FORM_CALLBACK_PROTOCOL *This,\r
- IN UINT16 KeyValue,\r
- IN EFI_IFR_DATA_ARRAY *Data,\r
- OUT EFI_HII_CALLBACK_PACKET **Packet\r
- );\r
-\r
-/**\r
- @par Protocol Description:\r
- The EFI_FORM_CALLBACK_PROTOCOL is the defined interface for access to\r
- custom NVS devices as well as communication of user selections in a more\r
- interactive environment. This protocol should be published by hardware-specific\r
- drivers that want to export access to custom hardware storage or publish IFR\r
- that has a requirement to call back the original driver.\r
-\r
- @param NvRead\r
- The read operation to access the NV data serviced by a hardware-specific driver.\r
-\r
- @param NvWrite\r
- The write operation to access the NV data serviced by a hardware-specific driver.\r
-\r
- @param Callback\r
- The function that is called from the configuration browser to communicate key value pairs.\r
-\r
-**/\r
-struct _EFI_FORM_CALLBACK_PROTOCOL {\r
- EFI_NV_READ NvRead;\r
- EFI_NV_WRITE NvWrite;\r
- EFI_FORM_CALLBACK Callback;\r
-};\r
-\r
-extern EFI_GUID gEfiFormCallbackProtocolGuid;\r
-\r
-#endif\r
--- /dev/null
+/** @file\r
+ The EFI_FORM_BROWSER_PROTOCOL is the interface to the EFI\r
+ Configuration Driver. This will allow the caller to direct the\r
+ configuration driver to use either the HII database or use the passed\r
+ in packet of data. This will also allow the caller to post messages\r
+ into the configuration drivers internal mailbox.\r
+\r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ Module Name: FrameworkFormBrowser.h\r
+\r
+ @par Revision Reference:\r
+ This protocol is defined in HII spec 0.92.\r
+\r
+**/\r
+\r
+#ifndef __FRAMEWORK_FORM_BROWSER_H__\r
+#define __FRAMEWORK_FORM_BROWSER_H__\r
+\r
+#include <Protocol/FrameworkHii.h>\r
+\r
+\r
+#define EFI_FORM_BROWSER_PROTOCOL_GUID \\r
+ { \\r
+ 0xe5a1333e, 0xe1b4, 0x4d55, {0xce, 0xeb, 0x35, 0xc3, 0xef, 0x13, 0x34, 0x43 } \\r
+ }\r
+\r
+typedef struct _EFI_FORM_BROWSER_PROTOCOL EFI_FORM_BROWSER_PROTOCOL;\r
+\r
+typedef struct {\r
+ UINT32 Length;\r
+ UINT16 Type;\r
+ UINT8 Data[1];\r
+} EFI_HII_PACKET;\r
+\r
+typedef struct {\r
+ EFI_HII_IFR_PACK *IfrData;\r
+ EFI_HII_STRING_PACK *StringData;\r
+} EFI_IFR_PACKET;\r
+\r
+typedef struct {\r
+ UINTN LeftColumn;\r
+ UINTN RightColumn;\r
+ UINTN TopRow;\r
+ UINTN BottomRow;\r
+} EFI_SCREEN_DESCRIPTOR;\r
+\r
+/**\r
+ Provides direction to the configuration driver whether to use the HII\r
+ database or a passed-in set of data. This function also establishes a\r
+ pointer to the calling driver's callback interface.\r
+\r
+ @param This A pointer to the EFI_FORM_BROWSER_PROTOCOL instance.\r
+ @param UseDatabase Determines whether the HII database is to be\r
+ used to gather information. If the value is FALSE, the configuration\r
+ driver will get the information provided in the passed-in Packet parameters.\r
+ @param Handle A pointer to an array of HII handles to display. This value\r
+ should correspond to the value of the HII form package that is required to\r
+ be displayed.\r
+ @param HandleCount The number of handles in the array specified by Handle.\r
+ @param Packet A pointer to a set of data containing pointers to IFR\r
+ and/or string data.\r
+ @param CallbackHandle The handle to the driver's callback interface.\r
+ This parameter is used only when the UseDatabase parameter is FALSE\r
+ and an application wants to register a callback with the browser\r
+ @param NvMapOverride This buffer is used only when there is no NV variable\r
+ to define the current settings and the caller needs to provide to the browser\r
+ the current settings for the "fake" NV variable.\r
+ @param ScreenDimensions Allows the browser to be called so that it occupies\r
+ a portion of the physical screen instead of dynamically determining the\r
+ screen dimensions.\r
+ @param ResetRequired This BOOLEAN value will tell the caller if a reset\r
+ is required based on the data that might have been changed. The ResetRequired\r
+ parameter is primarily applicable for configuration applications, and is an\r
+ optional parameter.\r
+\r
+ @retval EFI_SUCCESS The function completed successfully\r
+ @retval EFI_NOT_FOUND The variable was not found.\r
+ @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result.\r
+ DataSize has been updated with the size needed to complete the request.\r
+ @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
+ @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SEND_FORM) (\r
+ IN EFI_FORM_BROWSER_PROTOCOL *This,\r
+ IN BOOLEAN UseDatabase,\r
+ IN EFI_HII_HANDLE *Handle,\r
+ IN UINTN HandleCount,\r
+ IN EFI_IFR_PACKET *Packet, OPTIONAL\r
+ IN EFI_HANDLE CallbackHandle, OPTIONAL\r
+ IN UINT8 *NvMapOverride, OPTIONAL\r
+ IN EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL\r
+ OUT BOOLEAN *ResetRequired OPTIONAL\r
+ );\r
+\r
+/**\r
+ Routine used to abstract a generic dialog interface and return the selected\r
+ key or string.\r
+\r
+ @param NumberOfLines The number of lines for the dialog box.\r
+ @param HotKey Defines whether a single character is parsed (TRUE)\r
+ and returned in KeyValue or if a string is returned in StringBuffer.\r
+ @param MaximumStringSize The maximum size in bytes of a typed-in string.\r
+ Because each character is a CHAR16, the minimum string returned is two bytes.\r
+ @param StringBuffer The passed-in pointer to the buffer that will hold\r
+ the typed in string if HotKey is FALSE.\r
+ @param KeyValue The EFI_INPUT_KEY value returned if HotKey is TRUE.\r
+ @param String The pointer to the first string in the list of strings\r
+ that comprise the dialog box.\r
+ @param ... A series of NumberOfLines text strings that will be used\r
+ to construct the dialog box.\r
+\r
+ @retval EFI_SUCCESS The dialog was displayed and user interaction was received.\r
+ @retval EFI_DEVICE_ERROR The user typed in an ESC character to exit the routine.\r
+ @retval EFI_INVALID_PARAMETER One of the parameters was invalid\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CREATE_POP_UP) (\r
+ IN UINTN NumberOfLines,\r
+ IN BOOLEAN HotKey,\r
+ IN UINTN MaximumStringSize,\r
+ OUT CHAR16 *StringBuffer,\r
+ OUT EFI_INPUT_KEY *KeyValue,\r
+ IN CHAR16 *String,\r
+ ...\r
+ );\r
+\r
+/**\r
+ @par Protocol Description:\r
+ The EFI_FORM_BROWSER_PROTOCOL is the interface to call for drivers to\r
+ leverage the EFI configuration driver interface.\r
+\r
+ @param SendForm\r
+ Provides direction to the configuration driver whether to use the HII\r
+ database or to use a passed-in set of data. This functions also establishes\r
+ a pointer to the calling driver's callback interface.\r
+\r
+ @param CreatePopUp\r
+ Routine used to abstract a generic dialog interface and return the\r
+ selected key or string.\r
+\r
+**/\r
+struct _EFI_FORM_BROWSER_PROTOCOL {\r
+ EFI_SEND_FORM SendForm;\r
+ EFI_CREATE_POP_UP CreatePopUp;\r
+};\r
+\r
+extern EFI_GUID gEfiFormBrowserProtocolGuid;\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ The EFI_FORM_CALLBACK_PROTOCOL is the defined interface for access to custom\r
+ NV storage devices as well as communication of user selections in a more\r
+ interactive environment. This protocol should be published by hardware\r
+ specific drivers which want to export access to custom hardware storage or\r
+ publish IFR which has a requirement to call back the original driver.\r
+\r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ Module Name: FrameworkFormCallback.h\r
+\r
+ @par Revision Reference:\r
+ This protocol is defined in HII spec 0.92.\r
+\r
+**/\r
+\r
+#ifndef __FORM_CALLBACK_H__\r
+#define __FORM_CALLBACK_H__\r
+\r
+#include <PiDxe.h>\r
+\r
+#include <Protocol/FrameworkHii.h>\r
+#include <Protocol/FrameworkFormBrowser.h>\r
+\r
+#define EFI_FORM_CALLBACK_PROTOCOL_GUID \\r
+ { \\r
+ 0xf3e4543d, 0xcf35, 0x6cef, {0x35, 0xc4, 0x4f, 0xe6, 0x34, 0x4d, 0xfc, 0x54 } \\r
+ }\r
+\r
+//\r
+// Forward reference for pure ANSI compatability\r
+//\r
+typedef struct _EFI_FORM_CALLBACK_PROTOCOL EFI_FORM_CALLBACK_PROTOCOL;\r
+\r
+\r
+#define RESET_REQUIRED 1 // Flags setting to signify that the callback operation resulted in an eventual\r
+// reset to be done upon exit of the browser\r
+//\r
+#define EXIT_REQUIRED 2 // Flags setting to signify that after the processing of the callback results - exit the browser\r
+#define SAVE_REQUIRED 4 // Flags setting to signify that after the processing of the callback results - save the NV data\r
+#define NV_CHANGED 8 // Flags setting to signify that after the processing of the callback results - turn the NV flag on\r
+#define NV_NOT_CHANGED 16 // Flags setting to signify that after the processing of the callback results - turn the NV flag off\r
+#pragma pack(1)\r
+typedef struct {\r
+ UINT8 OpCode; // Likely a string, numeric, or one-of\r
+ UINT8 Length; // Length of the EFI_IFR_DATA_ENTRY packet\r
+ UINT16 Flags; // Flags settings to determine what behavior is desired from the browser after the callback\r
+ VOID *Data; // The data in the form based on the op-code type - this is not a pointer to the data, the data follows immediately\r
+ // If the OpCode is a OneOf or Numeric type - Data is a UINT16 value\r
+ // If the OpCode is a String type - Data is a CHAR16[x] type\r
+ // If the OpCode is a Checkbox type - Data is a UINT8 value\r
+ // If the OpCode is a NV Access type - Data is a EFI_IFR_NV_DATA structure\r
+ //\r
+} EFI_IFR_DATA_ENTRY;\r
+\r
+typedef struct {\r
+ VOID *NvRamMap; // If the flag of the op-code specified retrieval of a copy of the NVRAM map,\r
+ // this is a pointer to a buffer copy\r
+ //\r
+ UINT32 EntryCount; // How many EFI_IFR_DATA_ENTRY entries\r
+ //\r
+ // EFI_IFR_DATA_ENTRY Data[1]; // The in-line Data entries.\r
+ //\r
+} EFI_IFR_DATA_ARRAY;\r
+\r
+\r
+typedef union {\r
+ EFI_IFR_DATA_ARRAY DataArray; // Primarily used by those who call back to their drivers and use HII as a repository\r
+ EFI_IFR_PACKET DataPacket; // Primarily used by those which do not use HII as a repository\r
+ CHAR16 *String; // If returning an error - fill the string with null-terminated contents\r
+} EFI_HII_CALLBACK_PACKET;\r
+\r
+typedef struct {\r
+ EFI_IFR_OP_HEADER Header;\r
+ UINT16 QuestionId; // Offset into the map\r
+ UINT8 StorageWidth; // Width of the value\r
+ //\r
+ // CHAR8 Data[1]; // The Data itself\r
+ //\r
+} EFI_IFR_NV_DATA;\r
+\r
+#pragma pack()\r
+//\r
+// The following types are currently defined:\r
+//\r
+/**\r
+ Returns the value of a variable.\r
+\r
+ @param This A pointer to the EFI_FORM_CALLBACK_PROTOCOL instance.\r
+ @param VariableName A NULL-terminated Unicode string that is the\r
+ name of the vendor's variable.\r
+ @param VendorGuid A unique identifier for the vendor.\r
+ @param Attributes If not NULL, a pointer to the memory location to\r
+ return the attribute's bit-mask for the variable.\r
+ @param DataSize The size in bytes of the Buffer. A size of zero causes\r
+ the variable to be deleted.\r
+ @param Buffer The buffer to return the contents of the variable.\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+ @retval EFI_NOT_FOUND The variable was not found.\r
+ @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result.\r
+ DataSize has been updated with the size needed to complete the request.\r
+ @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
+ @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_NV_READ) (\r
+ IN EFI_FORM_CALLBACK_PROTOCOL *This,\r
+ IN CHAR16 *VariableName,\r
+ IN EFI_GUID *VendorGuid,\r
+ OUT UINT32 *Attributes OPTIONAL,\r
+ IN OUT UINTN *DataSize,\r
+ OUT VOID *Buffer\r
+ );\r
+\r
+/**\r
+ Sets the value of a variable.\r
+\r
+ @param This A pointer to the EFI_FORM_CALLBACK_PROTOCOL instance.\r
+ @param VariableName A NULL-terminated Unicode string that is the\r
+ name of the vendor's variable. Each VariableName is unique for each VendorGuid.\r
+ @param VendorGuid A unique identifier for the vendor.\r
+ @param Attributes Attributes bit-mask to set for the variable.\r
+ @param DataSize The size in bytes of the Buffer. A size of zero causes\r
+ the variable to be deleted.\r
+ @param Buffer The buffer containing the contents of the variable.\r
+ @param ResetRequired Returns a value from the driver that abstracts\r
+ this information and will enable a system to know if a system reset\r
+ is required to achieve the configuration changes being enabled through\r
+ this function.\r
+\r
+ @retval EFI_SUCCESS The firmware has successfully stored the variable and\r
+ its data as defined by the Attributes.\r
+ @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold\r
+ the variable and its data.\r
+ @retval EFI_INVALID_PARAMETER An invalid combination of Attributes bits\r
+ was supplied, or the DataSize exceeds the maximum allowed.\r
+ @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_NV_WRITE) (\r
+ IN EFI_FORM_CALLBACK_PROTOCOL *This,\r
+ IN CHAR16 *VariableName,\r
+ IN EFI_GUID *VendorGuid,\r
+ IN UINT32 Attributes,\r
+ IN UINTN DataSize,\r
+ IN VOID *Buffer,\r
+ OUT BOOLEAN *ResetRequired\r
+ );\r
+\r
+/**\r
+ This function is called to provide results data to the driver.\r
+\r
+ @param This A pointer to the EFI_FORM_CALLBACK_PROTOCOL instance.\r
+ @param KeyValue A unique value which is sent to the original exporting\r
+ driver so that it can identify the type of data to expect. The format of\r
+ the data tends to vary based on the opcode that generated the callback.\r
+ @param Data A pointer to the data being sent to the original exporting driver.\r
+ @param Packet A pointer to a packet of information which a driver passes\r
+ back to the browser.\r
+\r
+ @return Status Code\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FORM_CALLBACK) (\r
+ IN EFI_FORM_CALLBACK_PROTOCOL *This,\r
+ IN UINT16 KeyValue,\r
+ IN EFI_IFR_DATA_ARRAY *Data,\r
+ OUT EFI_HII_CALLBACK_PACKET **Packet\r
+ );\r
+\r
+/**\r
+ @par Protocol Description:\r
+ The EFI_FORM_CALLBACK_PROTOCOL is the defined interface for access to\r
+ custom NVS devices as well as communication of user selections in a more\r
+ interactive environment. This protocol should be published by hardware-specific\r
+ drivers that want to export access to custom hardware storage or publish IFR\r
+ that has a requirement to call back the original driver.\r
+\r
+ @param NvRead\r
+ The read operation to access the NV data serviced by a hardware-specific driver.\r
+\r
+ @param NvWrite\r
+ The write operation to access the NV data serviced by a hardware-specific driver.\r
+\r
+ @param Callback\r
+ The function that is called from the configuration browser to communicate key value pairs.\r
+\r
+**/\r
+struct _EFI_FORM_CALLBACK_PROTOCOL {\r
+ EFI_NV_READ NvRead;\r
+ EFI_NV_WRITE NvWrite;\r
+ EFI_FORM_CALLBACK Callback;\r
+};\r
+\r
+extern EFI_GUID gEfiFormCallbackProtocolGuid;\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ This file defines the Human Interface Infrastructure protocol which will\r
+ be used by resources which want to publish IFR/Font/String data and have it\r
+ collected by the Configuration engine.\r
+\r
+ Copyright (c) 2007, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ Module Name: FrameworkHii.h\r
+\r
+ @par Revision Reference:\r
+ This protocol is defined in HII spec 0.92.\r
+\r
+**/\r
+\r
+#ifndef _FRAMEWORK_HII_H_\r
+#define _FRAMEWORK_HII_H_\r
+\r
+#include <PiDxe.h>\r
+\r
+//\r
+// To get EFI_GRAPHICS_OUTPUT_BLT_PIXEL,\r
+// is defined in MdePkg/Protocol/GraphicsOutput.h\r
+//\r
+#include <Protocol/GraphicsOutput.h>\r
+\r
+#define EFI_HII_PROTOCOL_GUID \\r
+ { \\r
+ 0xd7ad636e, 0xb997, 0x459b, {0xbf, 0x3f, 0x88, 0x46, 0x89, 0x79, 0x80, 0xe1} \\r
+ }\r
+\r
+// BugBug:\r
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
+// If UGA goes away we need to put this some place. I'm not sure where?\r
+//\r
+//typedef struct {\r
+// UINT8 Blue;\r
+// UINT8 Green;\r
+// UINT8 Red;\r
+// UINT8 Reserved;\r
+//} EFI_UGA_PIXEL;\r
+\r
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
+//\r
+\r
+typedef struct _EFI_HII_PROTOCOL EFI_HII_PROTOCOL;\r
+\r
+//\r
+// Global definition\r
+//\r
+#define NARROW_CHAR 0xFFF0\r
+#define WIDE_CHAR 0xFFF1\r
+#define NON_BREAKING_CHAR 0xFFF2\r
+#define GLYPH_WIDTH 8\r
+#define GLYPH_HEIGHT 19\r
+\r
+#define EFI_HII_FONT 1\r
+#define EFI_HII_STRING 2\r
+#define EFI_HII_IFR 3\r
+#define EFI_HII_KEYBOARD 4\r
+#define EFI_HII_HANDLES 5\r
+#define EFI_HII_VARIABLE 6\r
+#define EFI_HII_DEVICE_PATH 7\r
+\r
+\r
+// References to string tokens must use this macro to enable scanning for\r
+// token usages.\r
+//\r
+#define STRING_TOKEN(t) t\r
+\r
+//\r
+// The following types are currently defined:\r
+// EFI_FROM_ID has been defined in UEFI spec.\r
+//\r
+typedef UINT16 EFI_FORM_LABEL;\r
+\r
+#pragma pack(1)\r
+\r
+typedef struct {\r
+ UINT32 Length;\r
+ UINT16 Type;\r
+} EFI_HII_PACK_HEADER;\r
+\r
+//\r
+// A form list consists of a large variety of structure\r
+// possibilities so to represent the binary blob of data\r
+// associated with a package of forms, we will assume a\r
+// pointer to a self-describing data buffer.\r
+//\r
+typedef struct {\r
+ EFI_HII_PACK_HEADER Header;\r
+} EFI_HII_IFR_PACK;\r
+\r
+typedef struct {\r
+ EFI_HII_PACK_HEADER Header; // Must be filled in\r
+ EFI_HANDLE ImageHandle; // Must be filled in\r
+ EFI_HANDLE DeviceHandle; // Optional\r
+ EFI_HANDLE ControllerHandle; // Optional\r
+ EFI_HANDLE CallbackHandle; // Optional\r
+ EFI_HANDLE COBExportHandle; // Optional\r
+} EFI_HII_HANDLE_PACK;\r
+\r
+//\r
+// ********************************************************\r
+// EFI_VARIABLE_CONTENTS\r
+// ********************************************************\r
+//\r
+typedef struct {\r
+ EFI_HII_PACK_HEADER Header;\r
+ EFI_GUID VariableGuid;\r
+ UINT32 VariableNameLength;\r
+ UINT16 VariableId;\r
+ //\r
+ // CHAR16 VariableName[]; //Null-terminated\r
+ //\r
+} EFI_HII_VARIABLE_PACK;\r
+\r
+//\r
+// ********************************************************\r
+// EFI_DEVICE_PATH_PACK\r
+// ********************************************************\r
+//\r
+typedef struct {\r
+ EFI_HII_PACK_HEADER Header;\r
+ //\r
+ // EFI_DEVICE_PATH DevicePath[];\r
+ //\r
+} EFI_HII_DEVICE_PATH_PACK;\r
+\r
+//\r
+// ********************************************************\r
+// EFI_HII_DATA_TABLE\r
+// ********************************************************\r
+//\r
+typedef struct {\r
+ EFI_HII_HANDLE HiiHandle;\r
+ EFI_GUID PackageGuid;\r
+ UINT32 DataTableSize;\r
+ UINT32 IfrDataOffset;\r
+ UINT32 StringDataOffset;\r
+ UINT32 VariableDataOffset;\r
+ UINT32 DevicePathOffset;\r
+ UINT32 NumberOfVariableData;\r
+ UINT32 NumberOfLanguages;\r
+ //\r
+ // EFI_HII_DEVICE_PATH_PACK DevicePath[];\r
+ // EFI_HII_VARIABLE_PACK VariableData[];\r
+ // EFI_HII_IFR_PACK IfrData;\r
+ // EFI_HII_STRING_PACK StringData[];\r
+ //\r
+} EFI_HII_DATA_TABLE;\r
+\r
+//\r
+// ********************************************************\r
+// EFI_HII_EXPORT_TABLE\r
+// ********************************************************\r
+//\r
+typedef struct {\r
+ UINT32 NumberOfHiiDataTables;\r
+ EFI_GUID Revision;\r
+ //\r
+ // EFI_HII_DATA_TABLE HiiDataTable[];\r
+ //\r
+} EFI_HII_EXPORT_TABLE;\r
+\r
+typedef struct {\r
+ BOOLEAN FormSetUpdate; // If TRUE, next variable is significant\r
+ EFI_PHYSICAL_ADDRESS FormCallbackHandle; // If not 0, will update Formset with this info\r
+ BOOLEAN FormUpdate; // If TRUE, next variable is significant\r
+ UINT16 FormValue; // specify which form is to be updated if FormUpdate value is TRUE.\r
+ STRING_REF FormTitle; // If not 0, will update Form with this info\r
+ UINT16 DataCount; // The number of Data entries in this structure\r
+ UINT8 *Data; // An array of 1+ op-codes, specified by DataCount\r
+} EFI_HII_UPDATE_DATA;\r
+\r
+//\r
+// String attributes\r
+//\r
+#define LANG_RIGHT_TO_LEFT 0x00000001\r
+\r
+//\r
+// A string package is used to localize strings to a particular\r
+// language. The package is associated with a particular driver\r
+// or set of drivers. Tools are used to associate tokens with\r
+// string references in forms and in programs. These tokens are\r
+// language agnostic. When paired with a language pack (directly\r
+// or indirectly), the string token resolves into an actual\r
+// UNICODE string. The NumStringPointers determines how many\r
+// StringPointers (offset values) there are as well as the total\r
+// number of Strings that are defined.\r
+//\r
+typedef struct {\r
+ EFI_HII_PACK_HEADER Header;\r
+ RELOFST LanguageNameString;\r
+ RELOFST PrintableLanguageName;\r
+ UINT32 NumStringPointers;\r
+ UINT32 Attributes;\r
+ //\r
+ // RELOFST StringPointers[];\r
+ // EFI_STRING Strings[];\r
+ //\r
+} EFI_HII_STRING_PACK;\r
+\r
+//\r
+// Glyph Attributes\r
+//\r
+#define EFI_GLYPH_NON_SPACING 1\r
+#define EFI_GLYPH_WIDE 2\r
+\r
+typedef struct {\r
+ CHAR16 UnicodeWeight;\r
+ UINT8 Attributes;\r
+ UINT8 GlyphCol1[GLYPH_HEIGHT];\r
+} EFI_NARROW_GLYPH;\r
+\r
+typedef struct {\r
+ CHAR16 UnicodeWeight;\r
+ UINT8 Attributes;\r
+ UINT8 GlyphCol1[GLYPH_HEIGHT];\r
+ UINT8 GlyphCol2[GLYPH_HEIGHT];\r
+ UINT8 Pad[3];\r
+} EFI_WIDE_GLYPH;\r
+\r
+//\r
+// A font list consists of a font header followed by a series\r
+// of glyph structures. Note that fonts are not language specific.\r
+//\r
+typedef struct {\r
+ EFI_HII_PACK_HEADER Header;\r
+ UINT16 NumberOfNarrowGlyphs;\r
+ UINT16 NumberOfWideGlyphs;\r
+} EFI_HII_FONT_PACK;\r
+\r
+//\r
+// The IfrData in the EFI_HII_IFR_PACK structure definition\r
+// is variable length, and not really part of the header. To\r
+// simplify from code the size of the header, define an\r
+// identical structure that does not include the IfrData field.\r
+// Then use sizeof() this new structure to determine the\r
+// actual size of the header.\r
+//\r
+typedef struct {\r
+ EFI_HII_PACK_HEADER Header;\r
+} EFI_HII_IFR_PACK_HEADER;\r
+\r
+//\r
+// pedef EFI_HII_PACK_HEADER EFI_HII_IFR_PACK_HEADER;\r
+//\r
+typedef enum {\r
+ EfiKeyLCtrl,\r
+ EfiKeyA0,\r
+ EfiKeyLAlt,\r
+ EfiKeySpaceBar,\r
+ EfiKeyA2,\r
+ EfiKeyA3,\r
+ EfiKeyA4,\r
+ EfiKeyRCtrl,\r
+ EfiKeyLeftArrow,\r
+ EfiKeyDownArrow,\r
+ EfiKeyRightArrow,\r
+ EfiKeyZero,\r
+ EfiKeyPeriod,\r
+ EfiKeyEnter,\r
+ EfiKeyLShift,\r
+ EfiKeyB0,\r
+ EfiKeyB1,\r
+ EfiKeyB2,\r
+ EfiKeyB3,\r
+ EfiKeyB4,\r
+ EfiKeyB5,\r
+ EfiKeyB6,\r
+ EfiKeyB7,\r
+ EfiKeyB8,\r
+ EfiKeyB9,\r
+ EfiKeyB10,\r
+ EfiKeyRshift,\r
+ EfiKeyUpArrow,\r
+ EfiKeyOne,\r
+ EfiKeyTwo,\r
+ EfiKeyThree,\r
+ EfiKeyCapsLock,\r
+ EfiKeyC1,\r
+ EfiKeyC2,\r
+ EfiKeyC3,\r
+ EfiKeyC4,\r
+ EfiKeyC5,\r
+ EfiKeyC6,\r
+ EfiKeyC7,\r
+ EfiKeyC8,\r
+ EfiKeyC9,\r
+ EfiKeyC10,\r
+ EfiKeyC11,\r
+ EfiKeyC12,\r
+ EfiKeyFour,\r
+ EfiKeyFive,\r
+ EfiKeySix,\r
+ EfiKeyPlus,\r
+ EfiKeyTab,\r
+ EfiKeyD1,\r
+ EfiKeyD2,\r
+ EfiKeyD3,\r
+ EfiKeyD4,\r
+ EfiKeyD5,\r
+ EfiKeyD6,\r
+ EfiKeyD7,\r
+ EfiKeyD8,\r
+ EfiKeyD9,\r
+ EfiKeyD10,\r
+ EfiKeyD11,\r
+ EfiKeyD12,\r
+ EfiKeyD13,\r
+ EfiKeyDel,\r
+ EfiKeyEnd,\r
+ EfiKeyPgDn,\r
+ EfiKeySeven,\r
+ EfiKeyEight,\r
+ EfiKeyNine,\r
+ EfiKeyE0,\r
+ EfiKeyE1,\r
+ EfiKeyE2,\r
+ EfiKeyE3,\r
+ EfiKeyE4,\r
+ EfiKeyE5,\r
+ EfiKeyE6,\r
+ EfiKeyE7,\r
+ EfiKeyE8,\r
+ EfiKeyE9,\r
+ EfiKeyE10,\r
+ EfiKeyE11,\r
+ EfiKeyE12,\r
+ EfiKeyBackSpace,\r
+ EfiKeyIns,\r
+ EfiKeyHome,\r
+ EfiKeyPgUp,\r
+ EfiKeyNLck,\r
+ EfiKeySlash,\r
+ EfiKeyAsterisk,\r
+ EfiKeyMinus,\r
+ EfiKeyEsc,\r
+ EfiKeyF1,\r
+ EfiKeyF2,\r
+ EfiKeyF3,\r
+ EfiKeyF4,\r
+ EfiKeyF5,\r
+ EfiKeyF6,\r
+ EfiKeyF7,\r
+ EfiKeyF8,\r
+ EfiKeyF9,\r
+ EfiKeyF10,\r
+ EfiKeyF11,\r
+ EfiKeyF12,\r
+ EfiKeyPrint,\r
+ EfiKeySLck,\r
+ EfiKeyPause\r
+} EFI_KEY;\r
+\r
+typedef struct {\r
+ EFI_KEY Key;\r
+ CHAR16 Unicode;\r
+ CHAR16 ShiftedUnicode;\r
+ CHAR16 AltGrUnicode;\r
+ CHAR16 ShiftedAltGrUnicode;\r
+ UINT16 Modifier;\r
+} EFI_KEY_DESCRIPTOR;\r
+\r
+//\r
+// This structure allows a sparse set of keys to be redefined\r
+// or a complete redefinition of the keyboard layout. Most\r
+// keyboards have a lot of commonality in their layouts, therefore\r
+// only defining those keys that need to change from the default\r
+// minimizes the passed in information.\r
+//\r
+// Additionally, when an update occurs, the active keyboard layout\r
+// will be switched to the newly updated keyboard layout. This\r
+// allows for situations that when a keyboard layout driver is\r
+// loaded as part of system initialization, the system will default\r
+// the keyboard behavior to the new layout.\r
+//\r
+// Each call to update the keyboard mapping should contain the\r
+// complete set of key descriptors to be updated, since every\r
+// call to the HII which contains an EFI_HII_KEYBOARD_PACK will\r
+// wipe the previous set of overrides. A call to\r
+//\r
+typedef struct {\r
+ EFI_HII_PACK_HEADER Header;\r
+ EFI_KEY_DESCRIPTOR *Descriptor;\r
+ UINT8 DescriptorCount;\r
+} EFI_HII_KEYBOARD_PACK;\r
+\r
+//\r
+// The EFI_HII_PACKAGES can contain different types of packages just\r
+// after the structure as inline data.\r
+//\r
+typedef struct {\r
+ UINTN NumberOfPackages;\r
+ EFI_GUID *GuidId;\r
+ //\r
+ // EFI_HII_HANDLE_PACK *HandlePack; // Only one pack.\r
+ // EFI_HII_IFR_PACK *IfrPack; // Only one pack.\r
+ // EFI_HII_FONT_PACK *FontPack[]; // Multiple packs ok\r
+ // EFI_HII_STRING_PACK *StringPack[]; // Multiple packs ok\r
+ // EFI_HII_KEYBOARD_PACK *KeyboardPack[]; // Multiple packs ok\r
+ //\r
+} EFI_HII_PACKAGES;\r
+\r
+typedef struct _EFI_HII_VARIABLE_PACK_LIST {\r
+ struct _EFI_HII_VARIABLE_PACK_LIST *NextVariablePack;\r
+ EFI_HII_VARIABLE_PACK *VariablePack;\r
+} EFI_HII_VARIABLE_PACK_LIST;\r
+\r
+\r
+#pragma pack()\r
+\r
+/**\r
+ Registers the various packs that are passed in via the Packages parameter.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Packages A pointer to an EFI_HII_PACKAGES package instance.\r
+ @param Handle A pointer to the EFI_HII_HANDLE instance.\r
+\r
+ @retval EFI_SUCCESS Data was extracted from Packages, the database\r
+ was updated with the data, and Handle returned successfully.\r
+ @retval EFI_INVALID_PARAMETER The content of Packages was invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_NEW_PACK) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN EFI_HII_PACKAGES *Packages,\r
+ OUT EFI_HII_HANDLE *Handle\r
+ );\r
+\r
+/**\r
+ Removes a package from the HII database.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Handle The handle that was registered to the data that is requested\r
+ for removal.\r
+\r
+ @retval EFI_SUCCESS The data associated with the Handle was removed\r
+ from the HII database.\r
+ @retval EFI_INVALID_PARAMETER The Handle was not valid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_REMOVE_PACK) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN EFI_HII_HANDLE Handle\r
+ );\r
+\r
+/**\r
+ Determines the handles that are currently active in the database.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param HandleBufferLength On input, a pointer to the length of the handle\r
+ buffer. On output, the length of the handle buffer that is required\r
+ for the handles found.\r
+ @param Handle An array of EFI_HII_HANDLE instances returned.\r
+\r
+ @retval EFI_SUCCESS Handle was updated successfully.\r
+ @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter indicates\r
+ that Handle is too small to support the number of handles.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_FIND_HANDLES) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN OUT UINT16 *HandleBufferLength,\r
+ OUT EFI_HII_HANDLE *Handle\r
+ );\r
+\r
+/**\r
+ Exports the contents of the database into a buffer.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Handle An EFI_HII_HANDLE that corresponds to the desired\r
+ handle to export. If the value is 0, the entire database will be exported.\r
+ In either case, the data will be exported in a format described by the\r
+ structure definition of EFI_HII_EXPORT_TABLE.\r
+ @param BufferSize\r
+ On input, a pointer to the length of the buffer. On output, the length\r
+ of the buffer that is required for the export data.\r
+ @param Buffer A pointer to a buffer that will contain the results of the export function.\r
+\r
+ @retval EFI_SUCCESS The buffer was successfully filled with BufferSize amount of data.\r
+ @retval EFI_BUFFER_TOO_SMALL The value in BufferSize was too small to contain the export data.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_EXPORT) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN EFI_HII_HANDLE Handle,\r
+ IN OUT UINTN *BufferSize,\r
+ OUT VOID *Buffer\r
+ );\r
+\r
+/**\r
+ Remove any new strings that were added after the initial string export\r
+ for this handle.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Handle The handle on which the string resides.\r
+\r
+ @retval EFI_SUCCESS Remove strings from the handle successfully.\r
+ @retval EFI_INVALID_PARAMETER The Handle was unknown.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_RESET_STRINGS) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN EFI_HII_HANDLE Handle\r
+ );\r
+\r
+/**\r
+ Tests if all of the characters in a string have corresponding font characters.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param StringToTest A pointer to a Unicode string.\r
+ @param FirstMissing A pointer to an index into the string. On input,\r
+ the index of the first character in the StringToTest to examine. On exit,\r
+ the index of the first character encountered for which a glyph is unavailable.\r
+ If all glyphs in the string are available, the index is the index of the\r
+ terminator of the string.\r
+ @param GlyphBufferSize A pointer to a value. On output, if the function\r
+ returns EFI_SUCCESS, it contains the amount of memory that is required to\r
+ store the string's glyph equivalent.\r
+\r
+ @retval EFI_SUCCESS All glyphs are available. Note that an empty string\r
+ always returns this value.\r
+ @retval EFI_NOT_FOUND A glyph was not found for a character.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_TEST_STRING) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN CHAR16 *StringToTest,\r
+ IN OUT UINT32 *FirstMissing,\r
+ OUT UINT32 *GlyphBufferSize\r
+ );\r
+\r
+/**\r
+ Translates a Unicode character into the corresponding font glyph.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Source A pointer to a Unicode string.\r
+ @param Index On input, the offset into the string from which to fetch\r
+ the character.On successful completion, the index is updated to the first\r
+ character past the character(s) making up the just extracted glyph.\r
+ @param GlyphBuffer Pointer to an array where the glyphs corresponding\r
+ to the characters in the source may be stored. GlyphBuffer is assumed\r
+ to be wide enough to accept a wide glyph character.\r
+ @param BitWidth If EFI_SUCCESS was returned, the UINT16 pointed to by\r
+ this value is filled with the length of the glyph in pixels. It is unchanged\r
+ if the call was unsuccessful.\r
+ @param InternalStatus The cell pointed to by this parameter must be\r
+ initialized to zero prior to invoking the call the first time for any string.\r
+\r
+ @retval EFI_SUCCESS It worked.\r
+ @retval EFI_NOT_FOUND A glyph for a character was not found.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_GLYPH) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN CHAR16 *Source,\r
+ IN OUT UINT16 *Index,\r
+ OUT UINT8 **GlyphBuffer,\r
+ OUT UINT16 *BitWidth,\r
+ IN OUT UINT32 *InternalStatus\r
+ );\r
+\r
+/**\r
+ Translates a glyph into the format required for input to the Universal\r
+ Graphics Adapter (UGA) Block Transfer (BLT) routines.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param GlyphBuffer A pointer to the buffer that contains glyph data.\r
+ @param Foreground The foreground setting requested to be used for the\r
+ generated BltBuffer data.\r
+ @param Background The background setting requested to be used for the\r
+ generated BltBuffer data.\r
+ @param Count The entry in the BltBuffer upon which to act.\r
+ @param Width The width in bits of the glyph being converted.\r
+ @param Height The height in bits of the glyph being converted\r
+ @param BltBuffer A pointer to the buffer that contains the data that is\r
+ ready to be used by the UGA BLT routines.\r
+\r
+ @retval EFI_SUCCESS It worked.\r
+ @retval EFI_NOT_FOUND A glyph for a character was not found.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GLYPH_TO_BLT) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN UINT8 *GlyphBuffer,\r
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,\r
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,\r
+ IN UINTN Count,\r
+ IN UINTN Width,\r
+ IN UINTN Height,\r
+ IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer\r
+ );\r
+\r
+/**\r
+ Allows a new string to be added to an already existing string package.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Pointer to a NULL-terminated string containing a single ISO 639-2\r
+ language identifier, indicating the language in which the string is translated.\r
+ @param Handle The handle of the language pack to which the string is to be added.\r
+ @param Reference The identifier of the string to be added. If the reference\r
+ value is zero, then the string will be assigned a new identifier on that\r
+ handle for the language specified. Otherwise, the string will be updated\r
+ with the NewString Value.\r
+ @param NewString The string to be added.\r
+\r
+ @retval EFI_SUCCESS The string was effectively registered.\r
+ @retval EFI_INVALID_PARAMETER The Handle was unknown.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_NEW_STRING) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN CHAR16 *Language,\r
+ IN EFI_HII_HANDLE Handle,\r
+ IN OUT STRING_REF *Reference,\r
+ IN CHAR16 *NewString\r
+ );\r
+\r
+/**\r
+ Allows a program to determine the primary languages that are supported\r
+ on a given handle.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Handle The handle on which the strings reside.\r
+ @param LanguageString A string allocated by GetPrimaryLanguages() that\r
+ contains a list of all primary languages registered on the handle.\r
+\r
+ @retval EFI_SUCCESS LanguageString was correctly returned.\r
+ @retval EFI_INVALID_PARAMETER The Handle was unknown.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_PRI_LANGUAGES) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN EFI_HII_HANDLE Handle,\r
+ OUT EFI_STRING *LanguageString\r
+ );\r
+\r
+/**\r
+ Allows a program to determine which secondary languages are supported\r
+ on a given handle for a given primary language.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Handle The handle on which the strings reside.\r
+ @param PrimaryLanguage Pointer to a NULL-terminated string containing a single\r
+ ISO 639-2 language identifier, indicating the primary language.\r
+ @param LanguageString A string allocated by GetSecondaryLanguages()\r
+ containing a list of all secondary languages registered on the handle.\r
+\r
+ @retval EFI_SUCCESS LanguageString was correctly returned.\r
+ @retval EFI_INVALID_PARAMETER The Handle was unknown.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_SEC_LANGUAGES) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN EFI_HII_HANDLE Handle,\r
+ IN CHAR16 *PrimaryLanguage,\r
+ OUT EFI_STRING *LanguageString\r
+ );\r
+\r
+/**\r
+ Extracts a string from a package already registered with the EFI HII database.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Handle The handle on which the string resides.\r
+ @param Token The string token assigned to the string.\r
+ @param Raw If TRUE, the string is returned unedited in the internal\r
+ storage format described above. If false, the string returned is edited\r
+ by replacing <cr> with <space> and by removing special characters such\r
+ as the <wide> prefix.\r
+ @param LanguageString Pointer to a NULL-terminated string containing a\r
+ single ISO 639-2 language identifier, indicating the language to print.\r
+ If the LanguageString is empty (starts with a NULL), the default system\r
+ language will be used to determine the language.\r
+ @param BufferLength Length of the StringBuffer.\r
+ @param StringBuffer The buffer designed to receive the characters in the string.\r
+\r
+ @retval EFI_SUCCESS StringBuffer is filled with a NULL-terminated string.\r
+ @retval EFI_INVALID_PARAMETER The handle or string token is unknown.\r
+ @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough to\r
+ allow the entire string to be stored.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_STRING) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN EFI_HII_HANDLE Handle,\r
+ IN STRING_REF Token,\r
+ IN BOOLEAN Raw,\r
+ IN CHAR16 *LanguageString,\r
+ IN OUT UINTN *BufferLength,\r
+ OUT EFI_STRING StringBuffer\r
+ );\r
+\r
+/**\r
+ Allows a program to extract a part of a string of not more than a given width.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Handle The handle on which the string resides.\r
+ @param Token The string token assigned to the string.\r
+ @param Index On input, the offset into the string where the line is to start.\r
+ On output, the index is updated to point to beyond the last character returned\r
+ in the call.\r
+ @param LineWidth The maximum width of the line in units of narrow glyphs.\r
+ @param LanguageString Pointer to a NULL-terminated string containing a\r
+ single ISO 639-2 language identifier, indicating the language to print.\r
+ @param BufferLength Pointer to the length of the StringBuffer.\r
+ @param StringBuffer The buffer designed to receive the characters in the string.\r
+\r
+ @retval EFI_SUCCESS StringBuffer filled with characters that will fit on the line.\r
+ @retval EFI_NOT_FOUND The font glyph for at least one of the characters in\r
+ the string is not in the font database.\r
+ @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough\r
+ to allow the entire string to be stored.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_LINE) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN EFI_HII_HANDLE Handle,\r
+ IN STRING_REF Token,\r
+ IN OUT UINT16 *Index,\r
+ IN UINT16 LineWidth,\r
+ IN CHAR16 *LanguageString,\r
+ IN OUT UINT16 *BufferLength,\r
+ OUT EFI_STRING StringBuffer\r
+ );\r
+\r
+/**\r
+ Allows a program to extract a form or form package that has previously\r
+ been registered with the HII database.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Handle Handle on which the form resides.\r
+ @param FormId The ID of the form to return. If the ID is zero,\r
+ the entire form package is returned.\r
+ @param BufferLength On input, the length of the Buffer. On output,\r
+ the length of the returned buffer,\r
+ @param Buffer The buffer designed to receive the form(s).\r
+\r
+ @retval EFI_SUCCESS Buffer filled with the requested forms. BufferLength\r
+ was updated.\r
+ @retval EFI_INVALID_PARAMETER The handle is unknown.\r
+ @retval EFI_NOT_FOUND A form on the requested handle cannot be found with\r
+ the requested FormId.\r
+ @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough\r
+ to allow the form to be stored.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_FORMS) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN EFI_HII_HANDLE Handle,\r
+ IN EFI_FORM_ID FormId,\r
+ IN OUT UINTN *BufferLength,\r
+ OUT UINT8 *Buffer\r
+ );\r
+\r
+/**\r
+ Extracts the defaults that are associated with a given handle in the HII database.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Handle The HII handle from which will have default data retrieved.\r
+ @param DefaultMask The mask used to specify some type of default override when extracting\r
+ the default image data.\r
+ @param VariablePackList A indirect pointer to the first entry of a link list with\r
+ type EFI_HII_VARIABLE_PACK_LIST.\r
+\r
+ @retval EFI_SUCCESS The VariablePackList was populated with the appropriate\r
+ default setting data.\r
+ @retval EFI_NOT_FOUND The IFR does not have any explicit or default map(s).\r
+ @retval EFI_INVALID_PARAMETER The HII database entry associated with Handle\r
+ contain invalid data.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_DEFAULT_IMAGE) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN EFI_HII_HANDLE Handle,\r
+ IN UINTN DefaultMask,\r
+ OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList\r
+ );\r
+\r
+/**\r
+ Allows the caller to update a form or form package that has previously been\r
+ registered with the EFI HII database.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Handle Handle of the package where the form to be updated resides.\r
+ @param Label The label inside the form package where the update is to take place.\r
+ @param AddData If TRUE, adding data at a given Label; otherwise,\r
+ if FALSE, removing data at a given Label.\r
+ @param Data The buffer containing the new tags to insert after the Label\r
+\r
+ @retval EFI_SUCCESS The form was updated with the new tags.\r
+ @retval EFI_INVALID_PARAMETER The buffer for the buffer length does not\r
+ contain an integral number of tags.\r
+ @retval EFI_NOT_FOUND The Handle, Label, or FormId was not found.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_UPDATE_FORM) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN EFI_HII_HANDLE Handle,\r
+ IN EFI_FORM_LABEL Label,\r
+ IN BOOLEAN AddData,\r
+ IN EFI_HII_UPDATE_DATA *Data\r
+ );\r
+\r
+/**\r
+ Retrieves the current keyboard layout.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param DescriptorCount A pointer to the number of Descriptor entries being\r
+ described in the keyboard layout being retrieved.\r
+ @param Descriptor A pointer to a buffer containing an array of EFI_KEY_DESCRIPTOR\r
+ entries. Each entry will reflect the definition of a specific physical key.\r
+\r
+ @retval EFI_SUCCESS The keyboard layout was retrieved successfully.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT) (\r
+ IN EFI_HII_PROTOCOL *This,\r
+ OUT UINT16 *DescriptorCount,\r
+ OUT EFI_KEY_DESCRIPTOR *Descriptor\r
+ );\r
+\r
+/**\r
+ @par Protocol Description:\r
+ The HII Protocol manages the HII database, which is a repository for data\r
+ having to do with fonts, strings, forms, keyboards, and other future human\r
+ interface items.\r
+\r
+ @param NewPack\r
+ Extracts the various packs from a package list.\r
+\r
+ @param RemovePack\r
+ Removes a package from the HII database.\r
+\r
+ @param FindHandles\r
+ Determines the handles that are currently active in the database.\r
+\r
+ @param ExportDatabase\r
+ Export the entire contents of the database to a buffer.\r
+\r
+ @param TestString\r
+ Tests if all of the characters in a string have corresponding font characters.\r
+\r
+ @param GetGlyph\r
+ Translates a Unicode character into the corresponding font glyph.\r
+\r
+ @param GlyphToBlt\r
+ Converts a glyph value into a format that is ready for a UGA BLT command.\r
+\r
+ @param NewString\r
+ Allows a new string to be added to an already existing string package.\r
+\r
+ @param GetPrimaryLanguages\r
+ Allows a program to determine the primary languages that are supported\r
+ on a given handle.\r
+\r
+ @param GetSecondaryLanguages\r
+ Allows a program to determine which secondary languages are supported\r
+ on a given handle for a given primary language.\r
+\r
+ @param GetString\r
+ Extracts a string from a package that is already registered with the\r
+ EFI HII database.\r
+\r
+ @param ResetString\r
+ Remove any new strings that were added after the initial string export\r
+ for this handle.\r
+\r
+ @param GetLine\r
+ Allows a program to extract a part of a string of not more than a given width.\r
+\r
+ @param GetForms\r
+ Allows a program to extract a form or form package that has been previously registered.\r
+\r
+ @param GetDefaultImage\r
+ Allows a program to extract the nonvolatile image that represents the default storage image.\r
+\r
+ @param UpdateForm\r
+ Allows a program to update a previously registered form.\r
+\r
+ @param GetKeyboardLayout\r
+ Allows a program to extract the current keyboard layout.\r
+\r
+**/\r
+struct _EFI_HII_PROTOCOL {\r
+ EFI_HII_NEW_PACK NewPack;\r
+ EFI_HII_REMOVE_PACK RemovePack;\r
+ EFI_HII_FIND_HANDLES FindHandles;\r
+ EFI_HII_EXPORT ExportDatabase;\r
+\r
+ EFI_HII_TEST_STRING TestString;\r
+ EFI_HII_GET_GLYPH GetGlyph;\r
+ EFI_HII_GLYPH_TO_BLT GlyphToBlt;\r
+\r
+ EFI_HII_NEW_STRING NewString;\r
+ EFI_HII_GET_PRI_LANGUAGES GetPrimaryLanguages;\r
+ EFI_HII_GET_SEC_LANGUAGES GetSecondaryLanguages;\r
+ EFI_HII_GET_STRING GetString;\r
+ EFI_HII_RESET_STRINGS ResetStrings;\r
+ EFI_HII_GET_LINE GetLine;\r
+ EFI_HII_GET_FORMS GetForms;\r
+ EFI_HII_GET_DEFAULT_IMAGE GetDefaultImage;\r
+ EFI_HII_UPDATE_FORM UpdateForm;\r
+\r
+ EFI_HII_GET_KEYBOARD_LAYOUT GetKeyboardLayout;\r
+};\r
+\r
+extern EFI_GUID gEfiHiiProtocolGuid;\r
+\r
+#endif\r
+++ /dev/null
-/** @file\r
- This file defines the Human Interface Infrastructure protocol which will\r
- be used by resources which want to publish IFR/Font/String data and have it\r
- collected by the Configuration engine.\r
-\r
- Copyright (c) 2007, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- Module Name: HiiFramework.h\r
-\r
- @par Revision Reference:\r
- This protocol is defined in HII spec 0.92.\r
-\r
-**/\r
-\r
-#ifndef _FRAMEWORK_HII_H_\r
-#define _FRAMEWORK_HII_H_\r
-\r
-#include <PiDxe.h>\r
-\r
-//\r
-// To get EFI_GRAPHICS_OUTPUT_BLT_PIXEL,\r
-// is defined in MdePkg/Protocol/GraphicsOutput.h\r
-//\r
-#include <Protocol/GraphicsOutput.h>\r
-\r
-#define EFI_HII_PROTOCOL_GUID \\r
- { \\r
- 0xd7ad636e, 0xb997, 0x459b, {0xbf, 0x3f, 0x88, 0x46, 0x89, 0x79, 0x80, 0xe1} \\r
- }\r
-\r
-// BugBug:\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-// If UGA goes away we need to put this some place. I'm not sure where?\r
-//\r
-//typedef struct {\r
-// UINT8 Blue;\r
-// UINT8 Green;\r
-// UINT8 Red;\r
-// UINT8 Reserved;\r
-//} EFI_UGA_PIXEL;\r
-\r
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
-//\r
-\r
-typedef struct _EFI_HII_PROTOCOL EFI_HII_PROTOCOL;\r
-\r
-//\r
-// Global definition\r
-//\r
-#define NARROW_CHAR 0xFFF0\r
-#define WIDE_CHAR 0xFFF1\r
-#define NON_BREAKING_CHAR 0xFFF2\r
-#define GLYPH_WIDTH 8\r
-#define GLYPH_HEIGHT 19\r
-\r
-#define EFI_HII_FONT 1\r
-#define EFI_HII_STRING 2\r
-#define EFI_HII_IFR 3\r
-#define EFI_HII_KEYBOARD 4\r
-#define EFI_HII_HANDLES 5\r
-#define EFI_HII_VARIABLE 6\r
-#define EFI_HII_DEVICE_PATH 7\r
-\r
-\r
-// References to string tokens must use this macro to enable scanning for\r
-// token usages.\r
-//\r
-#define STRING_TOKEN(t) t\r
-\r
-//\r
-// The following types are currently defined:\r
-// EFI_FROM_ID has been defined in UEFI spec.\r
-//\r
-typedef UINT16 EFI_FORM_LABEL;\r
-\r
-#pragma pack(1)\r
-\r
-typedef struct {\r
- UINT32 Length;\r
- UINT16 Type;\r
-} EFI_HII_PACK_HEADER;\r
-\r
-//\r
-// A form list consists of a large variety of structure\r
-// possibilities so to represent the binary blob of data\r
-// associated with a package of forms, we will assume a\r
-// pointer to a self-describing data buffer.\r
-//\r
-typedef struct {\r
- EFI_HII_PACK_HEADER Header;\r
-} EFI_HII_IFR_PACK;\r
-\r
-typedef struct {\r
- EFI_HII_PACK_HEADER Header; // Must be filled in\r
- EFI_HANDLE ImageHandle; // Must be filled in\r
- EFI_HANDLE DeviceHandle; // Optional\r
- EFI_HANDLE ControllerHandle; // Optional\r
- EFI_HANDLE CallbackHandle; // Optional\r
- EFI_HANDLE COBExportHandle; // Optional\r
-} EFI_HII_HANDLE_PACK;\r
-\r
-//\r
-// ********************************************************\r
-// EFI_VARIABLE_CONTENTS\r
-// ********************************************************\r
-//\r
-typedef struct {\r
- EFI_HII_PACK_HEADER Header;\r
- EFI_GUID VariableGuid;\r
- UINT32 VariableNameLength;\r
- UINT16 VariableId;\r
- //\r
- // CHAR16 VariableName[]; //Null-terminated\r
- //\r
-} EFI_HII_VARIABLE_PACK;\r
-\r
-//\r
-// ********************************************************\r
-// EFI_DEVICE_PATH_PACK\r
-// ********************************************************\r
-//\r
-typedef struct {\r
- EFI_HII_PACK_HEADER Header;\r
- //\r
- // EFI_DEVICE_PATH DevicePath[];\r
- //\r
-} EFI_HII_DEVICE_PATH_PACK;\r
-\r
-//\r
-// ********************************************************\r
-// EFI_HII_DATA_TABLE\r
-// ********************************************************\r
-//\r
-typedef struct {\r
- EFI_HII_HANDLE HiiHandle;\r
- EFI_GUID PackageGuid;\r
- UINT32 DataTableSize;\r
- UINT32 IfrDataOffset;\r
- UINT32 StringDataOffset;\r
- UINT32 VariableDataOffset;\r
- UINT32 DevicePathOffset;\r
- UINT32 NumberOfVariableData;\r
- UINT32 NumberOfLanguages;\r
- //\r
- // EFI_HII_DEVICE_PATH_PACK DevicePath[];\r
- // EFI_HII_VARIABLE_PACK VariableData[];\r
- // EFI_HII_IFR_PACK IfrData;\r
- // EFI_HII_STRING_PACK StringData[];\r
- //\r
-} EFI_HII_DATA_TABLE;\r
-\r
-//\r
-// ********************************************************\r
-// EFI_HII_EXPORT_TABLE\r
-// ********************************************************\r
-//\r
-typedef struct {\r
- UINT32 NumberOfHiiDataTables;\r
- EFI_GUID Revision;\r
- //\r
- // EFI_HII_DATA_TABLE HiiDataTable[];\r
- //\r
-} EFI_HII_EXPORT_TABLE;\r
-\r
-typedef struct {\r
- BOOLEAN FormSetUpdate; // If TRUE, next variable is significant\r
- EFI_PHYSICAL_ADDRESS FormCallbackHandle; // If not 0, will update Formset with this info\r
- BOOLEAN FormUpdate; // If TRUE, next variable is significant\r
- UINT16 FormValue; // specify which form is to be updated if FormUpdate value is TRUE.\r
- STRING_REF FormTitle; // If not 0, will update Form with this info\r
- UINT16 DataCount; // The number of Data entries in this structure\r
- UINT8 *Data; // An array of 1+ op-codes, specified by DataCount\r
-} EFI_HII_UPDATE_DATA;\r
-\r
-//\r
-// String attributes\r
-//\r
-#define LANG_RIGHT_TO_LEFT 0x00000001\r
-\r
-//\r
-// A string package is used to localize strings to a particular\r
-// language. The package is associated with a particular driver\r
-// or set of drivers. Tools are used to associate tokens with\r
-// string references in forms and in programs. These tokens are\r
-// language agnostic. When paired with a language pack (directly\r
-// or indirectly), the string token resolves into an actual\r
-// UNICODE string. The NumStringPointers determines how many\r
-// StringPointers (offset values) there are as well as the total\r
-// number of Strings that are defined.\r
-//\r
-typedef struct {\r
- EFI_HII_PACK_HEADER Header;\r
- RELOFST LanguageNameString;\r
- RELOFST PrintableLanguageName;\r
- UINT32 NumStringPointers;\r
- UINT32 Attributes;\r
- //\r
- // RELOFST StringPointers[];\r
- // EFI_STRING Strings[];\r
- //\r
-} EFI_HII_STRING_PACK;\r
-\r
-//\r
-// Glyph Attributes\r
-//\r
-#define EFI_GLYPH_NON_SPACING 1\r
-#define EFI_GLYPH_WIDE 2\r
-\r
-typedef struct {\r
- CHAR16 UnicodeWeight;\r
- UINT8 Attributes;\r
- UINT8 GlyphCol1[GLYPH_HEIGHT];\r
-} EFI_NARROW_GLYPH;\r
-\r
-typedef struct {\r
- CHAR16 UnicodeWeight;\r
- UINT8 Attributes;\r
- UINT8 GlyphCol1[GLYPH_HEIGHT];\r
- UINT8 GlyphCol2[GLYPH_HEIGHT];\r
- UINT8 Pad[3];\r
-} EFI_WIDE_GLYPH;\r
-\r
-//\r
-// A font list consists of a font header followed by a series\r
-// of glyph structures. Note that fonts are not language specific.\r
-//\r
-typedef struct {\r
- EFI_HII_PACK_HEADER Header;\r
- UINT16 NumberOfNarrowGlyphs;\r
- UINT16 NumberOfWideGlyphs;\r
-} EFI_HII_FONT_PACK;\r
-\r
-//\r
-// The IfrData in the EFI_HII_IFR_PACK structure definition\r
-// is variable length, and not really part of the header. To\r
-// simplify from code the size of the header, define an\r
-// identical structure that does not include the IfrData field.\r
-// Then use sizeof() this new structure to determine the\r
-// actual size of the header.\r
-//\r
-typedef struct {\r
- EFI_HII_PACK_HEADER Header;\r
-} EFI_HII_IFR_PACK_HEADER;\r
-\r
-//\r
-// pedef EFI_HII_PACK_HEADER EFI_HII_IFR_PACK_HEADER;\r
-//\r
-typedef enum {\r
- EfiKeyLCtrl,\r
- EfiKeyA0,\r
- EfiKeyLAlt,\r
- EfiKeySpaceBar,\r
- EfiKeyA2,\r
- EfiKeyA3,\r
- EfiKeyA4,\r
- EfiKeyRCtrl,\r
- EfiKeyLeftArrow,\r
- EfiKeyDownArrow,\r
- EfiKeyRightArrow,\r
- EfiKeyZero,\r
- EfiKeyPeriod,\r
- EfiKeyEnter,\r
- EfiKeyLShift,\r
- EfiKeyB0,\r
- EfiKeyB1,\r
- EfiKeyB2,\r
- EfiKeyB3,\r
- EfiKeyB4,\r
- EfiKeyB5,\r
- EfiKeyB6,\r
- EfiKeyB7,\r
- EfiKeyB8,\r
- EfiKeyB9,\r
- EfiKeyB10,\r
- EfiKeyRshift,\r
- EfiKeyUpArrow,\r
- EfiKeyOne,\r
- EfiKeyTwo,\r
- EfiKeyThree,\r
- EfiKeyCapsLock,\r
- EfiKeyC1,\r
- EfiKeyC2,\r
- EfiKeyC3,\r
- EfiKeyC4,\r
- EfiKeyC5,\r
- EfiKeyC6,\r
- EfiKeyC7,\r
- EfiKeyC8,\r
- EfiKeyC9,\r
- EfiKeyC10,\r
- EfiKeyC11,\r
- EfiKeyC12,\r
- EfiKeyFour,\r
- EfiKeyFive,\r
- EfiKeySix,\r
- EfiKeyPlus,\r
- EfiKeyTab,\r
- EfiKeyD1,\r
- EfiKeyD2,\r
- EfiKeyD3,\r
- EfiKeyD4,\r
- EfiKeyD5,\r
- EfiKeyD6,\r
- EfiKeyD7,\r
- EfiKeyD8,\r
- EfiKeyD9,\r
- EfiKeyD10,\r
- EfiKeyD11,\r
- EfiKeyD12,\r
- EfiKeyD13,\r
- EfiKeyDel,\r
- EfiKeyEnd,\r
- EfiKeyPgDn,\r
- EfiKeySeven,\r
- EfiKeyEight,\r
- EfiKeyNine,\r
- EfiKeyE0,\r
- EfiKeyE1,\r
- EfiKeyE2,\r
- EfiKeyE3,\r
- EfiKeyE4,\r
- EfiKeyE5,\r
- EfiKeyE6,\r
- EfiKeyE7,\r
- EfiKeyE8,\r
- EfiKeyE9,\r
- EfiKeyE10,\r
- EfiKeyE11,\r
- EfiKeyE12,\r
- EfiKeyBackSpace,\r
- EfiKeyIns,\r
- EfiKeyHome,\r
- EfiKeyPgUp,\r
- EfiKeyNLck,\r
- EfiKeySlash,\r
- EfiKeyAsterisk,\r
- EfiKeyMinus,\r
- EfiKeyEsc,\r
- EfiKeyF1,\r
- EfiKeyF2,\r
- EfiKeyF3,\r
- EfiKeyF4,\r
- EfiKeyF5,\r
- EfiKeyF6,\r
- EfiKeyF7,\r
- EfiKeyF8,\r
- EfiKeyF9,\r
- EfiKeyF10,\r
- EfiKeyF11,\r
- EfiKeyF12,\r
- EfiKeyPrint,\r
- EfiKeySLck,\r
- EfiKeyPause\r
-} EFI_KEY;\r
-\r
-typedef struct {\r
- EFI_KEY Key;\r
- CHAR16 Unicode;\r
- CHAR16 ShiftedUnicode;\r
- CHAR16 AltGrUnicode;\r
- CHAR16 ShiftedAltGrUnicode;\r
- UINT16 Modifier;\r
-} EFI_KEY_DESCRIPTOR;\r
-\r
-//\r
-// This structure allows a sparse set of keys to be redefined\r
-// or a complete redefinition of the keyboard layout. Most\r
-// keyboards have a lot of commonality in their layouts, therefore\r
-// only defining those keys that need to change from the default\r
-// minimizes the passed in information.\r
-//\r
-// Additionally, when an update occurs, the active keyboard layout\r
-// will be switched to the newly updated keyboard layout. This\r
-// allows for situations that when a keyboard layout driver is\r
-// loaded as part of system initialization, the system will default\r
-// the keyboard behavior to the new layout.\r
-//\r
-// Each call to update the keyboard mapping should contain the\r
-// complete set of key descriptors to be updated, since every\r
-// call to the HII which contains an EFI_HII_KEYBOARD_PACK will\r
-// wipe the previous set of overrides. A call to\r
-//\r
-typedef struct {\r
- EFI_HII_PACK_HEADER Header;\r
- EFI_KEY_DESCRIPTOR *Descriptor;\r
- UINT8 DescriptorCount;\r
-} EFI_HII_KEYBOARD_PACK;\r
-\r
-//\r
-// The EFI_HII_PACKAGES can contain different types of packages just\r
-// after the structure as inline data.\r
-//\r
-typedef struct {\r
- UINTN NumberOfPackages;\r
- EFI_GUID *GuidId;\r
- //\r
- // EFI_HII_HANDLE_PACK *HandlePack; // Only one pack.\r
- // EFI_HII_IFR_PACK *IfrPack; // Only one pack.\r
- // EFI_HII_FONT_PACK *FontPack[]; // Multiple packs ok\r
- // EFI_HII_STRING_PACK *StringPack[]; // Multiple packs ok\r
- // EFI_HII_KEYBOARD_PACK *KeyboardPack[]; // Multiple packs ok\r
- //\r
-} EFI_HII_PACKAGES;\r
-\r
-typedef struct _EFI_HII_VARIABLE_PACK_LIST {\r
- struct _EFI_HII_VARIABLE_PACK_LIST *NextVariablePack;\r
- EFI_HII_VARIABLE_PACK *VariablePack;\r
-} EFI_HII_VARIABLE_PACK_LIST;\r
-\r
-\r
-#pragma pack()\r
-\r
-/**\r
- Registers the various packs that are passed in via the Packages parameter.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param Packages A pointer to an EFI_HII_PACKAGES package instance.\r
- @param Handle A pointer to the EFI_HII_HANDLE instance.\r
-\r
- @retval EFI_SUCCESS Data was extracted from Packages, the database\r
- was updated with the data, and Handle returned successfully.\r
- @retval EFI_INVALID_PARAMETER The content of Packages was invalid.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_NEW_PACK) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN EFI_HII_PACKAGES *Packages,\r
- OUT EFI_HII_HANDLE *Handle\r
- );\r
-\r
-/**\r
- Removes a package from the HII database.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param Handle The handle that was registered to the data that is requested\r
- for removal.\r
-\r
- @retval EFI_SUCCESS The data associated with the Handle was removed\r
- from the HII database.\r
- @retval EFI_INVALID_PARAMETER The Handle was not valid.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_REMOVE_PACK) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN EFI_HII_HANDLE Handle\r
- );\r
-\r
-/**\r
- Determines the handles that are currently active in the database.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param HandleBufferLength On input, a pointer to the length of the handle\r
- buffer. On output, the length of the handle buffer that is required\r
- for the handles found.\r
- @param Handle An array of EFI_HII_HANDLE instances returned.\r
-\r
- @retval EFI_SUCCESS Handle was updated successfully.\r
- @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter indicates\r
- that Handle is too small to support the number of handles.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_FIND_HANDLES) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN OUT UINT16 *HandleBufferLength,\r
- OUT EFI_HII_HANDLE *Handle\r
- );\r
-\r
-/**\r
- Exports the contents of the database into a buffer.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param Handle An EFI_HII_HANDLE that corresponds to the desired\r
- handle to export. If the value is 0, the entire database will be exported.\r
- In either case, the data will be exported in a format described by the\r
- structure definition of EFI_HII_EXPORT_TABLE.\r
- @param BufferSize\r
- On input, a pointer to the length of the buffer. On output, the length\r
- of the buffer that is required for the export data.\r
- @param Buffer A pointer to a buffer that will contain the results of the export function.\r
-\r
- @retval EFI_SUCCESS The buffer was successfully filled with BufferSize amount of data.\r
- @retval EFI_BUFFER_TOO_SMALL The value in BufferSize was too small to contain the export data.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_EXPORT) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN EFI_HII_HANDLE Handle,\r
- IN OUT UINTN *BufferSize,\r
- OUT VOID *Buffer\r
- );\r
-\r
-/**\r
- Remove any new strings that were added after the initial string export\r
- for this handle.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param Handle The handle on which the string resides.\r
-\r
- @retval EFI_SUCCESS Remove strings from the handle successfully.\r
- @retval EFI_INVALID_PARAMETER The Handle was unknown.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_RESET_STRINGS) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN EFI_HII_HANDLE Handle\r
- );\r
-\r
-/**\r
- Tests if all of the characters in a string have corresponding font characters.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param StringToTest A pointer to a Unicode string.\r
- @param FirstMissing A pointer to an index into the string. On input,\r
- the index of the first character in the StringToTest to examine. On exit,\r
- the index of the first character encountered for which a glyph is unavailable.\r
- If all glyphs in the string are available, the index is the index of the\r
- terminator of the string.\r
- @param GlyphBufferSize A pointer to a value. On output, if the function\r
- returns EFI_SUCCESS, it contains the amount of memory that is required to\r
- store the string's glyph equivalent.\r
-\r
- @retval EFI_SUCCESS All glyphs are available. Note that an empty string\r
- always returns this value.\r
- @retval EFI_NOT_FOUND A glyph was not found for a character.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_TEST_STRING) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN CHAR16 *StringToTest,\r
- IN OUT UINT32 *FirstMissing,\r
- OUT UINT32 *GlyphBufferSize\r
- );\r
-\r
-/**\r
- Translates a Unicode character into the corresponding font glyph.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param Source A pointer to a Unicode string.\r
- @param Index On input, the offset into the string from which to fetch\r
- the character.On successful completion, the index is updated to the first\r
- character past the character(s) making up the just extracted glyph.\r
- @param GlyphBuffer Pointer to an array where the glyphs corresponding\r
- to the characters in the source may be stored. GlyphBuffer is assumed\r
- to be wide enough to accept a wide glyph character.\r
- @param BitWidth If EFI_SUCCESS was returned, the UINT16 pointed to by\r
- this value is filled with the length of the glyph in pixels. It is unchanged\r
- if the call was unsuccessful.\r
- @param InternalStatus The cell pointed to by this parameter must be\r
- initialized to zero prior to invoking the call the first time for any string.\r
-\r
- @retval EFI_SUCCESS It worked.\r
- @retval EFI_NOT_FOUND A glyph for a character was not found.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_GET_GLYPH) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN CHAR16 *Source,\r
- IN OUT UINT16 *Index,\r
- OUT UINT8 **GlyphBuffer,\r
- OUT UINT16 *BitWidth,\r
- IN OUT UINT32 *InternalStatus\r
- );\r
-\r
-/**\r
- Translates a glyph into the format required for input to the Universal\r
- Graphics Adapter (UGA) Block Transfer (BLT) routines.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param GlyphBuffer A pointer to the buffer that contains glyph data.\r
- @param Foreground The foreground setting requested to be used for the\r
- generated BltBuffer data.\r
- @param Background The background setting requested to be used for the\r
- generated BltBuffer data.\r
- @param Count The entry in the BltBuffer upon which to act.\r
- @param Width The width in bits of the glyph being converted.\r
- @param Height The height in bits of the glyph being converted\r
- @param BltBuffer A pointer to the buffer that contains the data that is\r
- ready to be used by the UGA BLT routines.\r
-\r
- @retval EFI_SUCCESS It worked.\r
- @retval EFI_NOT_FOUND A glyph for a character was not found.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_GLYPH_TO_BLT) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN UINT8 *GlyphBuffer,\r
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,\r
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,\r
- IN UINTN Count,\r
- IN UINTN Width,\r
- IN UINTN Height,\r
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer\r
- );\r
-\r
-/**\r
- Allows a new string to be added to an already existing string package.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param Pointer to a NULL-terminated string containing a single ISO 639-2\r
- language identifier, indicating the language in which the string is translated.\r
- @param Handle The handle of the language pack to which the string is to be added.\r
- @param Reference The identifier of the string to be added. If the reference\r
- value is zero, then the string will be assigned a new identifier on that\r
- handle for the language specified. Otherwise, the string will be updated\r
- with the NewString Value.\r
- @param NewString The string to be added.\r
-\r
- @retval EFI_SUCCESS The string was effectively registered.\r
- @retval EFI_INVALID_PARAMETER The Handle was unknown.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_NEW_STRING) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN CHAR16 *Language,\r
- IN EFI_HII_HANDLE Handle,\r
- IN OUT STRING_REF *Reference,\r
- IN CHAR16 *NewString\r
- );\r
-\r
-/**\r
- Allows a program to determine the primary languages that are supported\r
- on a given handle.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param Handle The handle on which the strings reside.\r
- @param LanguageString A string allocated by GetPrimaryLanguages() that\r
- contains a list of all primary languages registered on the handle.\r
-\r
- @retval EFI_SUCCESS LanguageString was correctly returned.\r
- @retval EFI_INVALID_PARAMETER The Handle was unknown.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_GET_PRI_LANGUAGES) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN EFI_HII_HANDLE Handle,\r
- OUT EFI_STRING *LanguageString\r
- );\r
-\r
-/**\r
- Allows a program to determine which secondary languages are supported\r
- on a given handle for a given primary language.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param Handle The handle on which the strings reside.\r
- @param PrimaryLanguage Pointer to a NULL-terminated string containing a single\r
- ISO 639-2 language identifier, indicating the primary language.\r
- @param LanguageString A string allocated by GetSecondaryLanguages()\r
- containing a list of all secondary languages registered on the handle.\r
-\r
- @retval EFI_SUCCESS LanguageString was correctly returned.\r
- @retval EFI_INVALID_PARAMETER The Handle was unknown.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_GET_SEC_LANGUAGES) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN EFI_HII_HANDLE Handle,\r
- IN CHAR16 *PrimaryLanguage,\r
- OUT EFI_STRING *LanguageString\r
- );\r
-\r
-/**\r
- Extracts a string from a package already registered with the EFI HII database.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param Handle The handle on which the string resides.\r
- @param Token The string token assigned to the string.\r
- @param Raw If TRUE, the string is returned unedited in the internal\r
- storage format described above. If false, the string returned is edited\r
- by replacing <cr> with <space> and by removing special characters such\r
- as the <wide> prefix.\r
- @param LanguageString Pointer to a NULL-terminated string containing a\r
- single ISO 639-2 language identifier, indicating the language to print.\r
- If the LanguageString is empty (starts with a NULL), the default system\r
- language will be used to determine the language.\r
- @param BufferLength Length of the StringBuffer.\r
- @param StringBuffer The buffer designed to receive the characters in the string.\r
-\r
- @retval EFI_SUCCESS StringBuffer is filled with a NULL-terminated string.\r
- @retval EFI_INVALID_PARAMETER The handle or string token is unknown.\r
- @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough to\r
- allow the entire string to be stored.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_GET_STRING) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN EFI_HII_HANDLE Handle,\r
- IN STRING_REF Token,\r
- IN BOOLEAN Raw,\r
- IN CHAR16 *LanguageString,\r
- IN OUT UINTN *BufferLength,\r
- OUT EFI_STRING StringBuffer\r
- );\r
-\r
-/**\r
- Allows a program to extract a part of a string of not more than a given width.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param Handle The handle on which the string resides.\r
- @param Token The string token assigned to the string.\r
- @param Index On input, the offset into the string where the line is to start.\r
- On output, the index is updated to point to beyond the last character returned\r
- in the call.\r
- @param LineWidth The maximum width of the line in units of narrow glyphs.\r
- @param LanguageString Pointer to a NULL-terminated string containing a\r
- single ISO 639-2 language identifier, indicating the language to print.\r
- @param BufferLength Pointer to the length of the StringBuffer.\r
- @param StringBuffer The buffer designed to receive the characters in the string.\r
-\r
- @retval EFI_SUCCESS StringBuffer filled with characters that will fit on the line.\r
- @retval EFI_NOT_FOUND The font glyph for at least one of the characters in\r
- the string is not in the font database.\r
- @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough\r
- to allow the entire string to be stored.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_GET_LINE) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN EFI_HII_HANDLE Handle,\r
- IN STRING_REF Token,\r
- IN OUT UINT16 *Index,\r
- IN UINT16 LineWidth,\r
- IN CHAR16 *LanguageString,\r
- IN OUT UINT16 *BufferLength,\r
- OUT EFI_STRING StringBuffer\r
- );\r
-\r
-/**\r
- Allows a program to extract a form or form package that has previously\r
- been registered with the HII database.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param Handle Handle on which the form resides.\r
- @param FormId The ID of the form to return. If the ID is zero,\r
- the entire form package is returned.\r
- @param BufferLength On input, the length of the Buffer. On output,\r
- the length of the returned buffer,\r
- @param Buffer The buffer designed to receive the form(s).\r
-\r
- @retval EFI_SUCCESS Buffer filled with the requested forms. BufferLength\r
- was updated.\r
- @retval EFI_INVALID_PARAMETER The handle is unknown.\r
- @retval EFI_NOT_FOUND A form on the requested handle cannot be found with\r
- the requested FormId.\r
- @retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough\r
- to allow the form to be stored.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_GET_FORMS) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN EFI_HII_HANDLE Handle,\r
- IN EFI_FORM_ID FormId,\r
- IN OUT UINTN *BufferLength,\r
- OUT UINT8 *Buffer\r
- );\r
-\r
-/**\r
- Extracts the defaults that are associated with a given handle in the HII database.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param Handle The HII handle from which will have default data retrieved.\r
- @param DefaultMask The mask used to specify some type of default override when extracting\r
- the default image data.\r
- @param VariablePackList A indirect pointer to the first entry of a link list with\r
- type EFI_HII_VARIABLE_PACK_LIST.\r
-\r
- @retval EFI_SUCCESS The VariablePackList was populated with the appropriate\r
- default setting data.\r
- @retval EFI_NOT_FOUND The IFR does not have any explicit or default map(s).\r
- @retval EFI_INVALID_PARAMETER The HII database entry associated with Handle\r
- contain invalid data.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_GET_DEFAULT_IMAGE) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN EFI_HII_HANDLE Handle,\r
- IN UINTN DefaultMask,\r
- OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList\r
- );\r
-\r
-/**\r
- Allows the caller to update a form or form package that has previously been\r
- registered with the EFI HII database.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param Handle Handle of the package where the form to be updated resides.\r
- @param Label The label inside the form package where the update is to take place.\r
- @param AddData If TRUE, adding data at a given Label; otherwise,\r
- if FALSE, removing data at a given Label.\r
- @param Data The buffer containing the new tags to insert after the Label\r
-\r
- @retval EFI_SUCCESS The form was updated with the new tags.\r
- @retval EFI_INVALID_PARAMETER The buffer for the buffer length does not\r
- contain an integral number of tags.\r
- @retval EFI_NOT_FOUND The Handle, Label, or FormId was not found.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_UPDATE_FORM) (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN EFI_HII_HANDLE Handle,\r
- IN EFI_FORM_LABEL Label,\r
- IN BOOLEAN AddData,\r
- IN EFI_HII_UPDATE_DATA *Data\r
- );\r
-\r
-/**\r
- Retrieves the current keyboard layout.\r
-\r
- @param This A pointer to the EFI_HII_PROTOCOL instance.\r
- @param DescriptorCount A pointer to the number of Descriptor entries being\r
- described in the keyboard layout being retrieved.\r
- @param Descriptor A pointer to a buffer containing an array of EFI_KEY_DESCRIPTOR\r
- entries. Each entry will reflect the definition of a specific physical key.\r
-\r
- @retval EFI_SUCCESS The keyboard layout was retrieved successfully.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT) (\r
- IN EFI_HII_PROTOCOL *This,\r
- OUT UINT16 *DescriptorCount,\r
- OUT EFI_KEY_DESCRIPTOR *Descriptor\r
- );\r
-\r
-/**\r
- @par Protocol Description:\r
- The HII Protocol manages the HII database, which is a repository for data\r
- having to do with fonts, strings, forms, keyboards, and other future human\r
- interface items.\r
-\r
- @param NewPack\r
- Extracts the various packs from a package list.\r
-\r
- @param RemovePack\r
- Removes a package from the HII database.\r
-\r
- @param FindHandles\r
- Determines the handles that are currently active in the database.\r
-\r
- @param ExportDatabase\r
- Export the entire contents of the database to a buffer.\r
-\r
- @param TestString\r
- Tests if all of the characters in a string have corresponding font characters.\r
-\r
- @param GetGlyph\r
- Translates a Unicode character into the corresponding font glyph.\r
-\r
- @param GlyphToBlt\r
- Converts a glyph value into a format that is ready for a UGA BLT command.\r
-\r
- @param NewString\r
- Allows a new string to be added to an already existing string package.\r
-\r
- @param GetPrimaryLanguages\r
- Allows a program to determine the primary languages that are supported\r
- on a given handle.\r
-\r
- @param GetSecondaryLanguages\r
- Allows a program to determine which secondary languages are supported\r
- on a given handle for a given primary language.\r
-\r
- @param GetString\r
- Extracts a string from a package that is already registered with the\r
- EFI HII database.\r
-\r
- @param ResetString\r
- Remove any new strings that were added after the initial string export\r
- for this handle.\r
-\r
- @param GetLine\r
- Allows a program to extract a part of a string of not more than a given width.\r
-\r
- @param GetForms\r
- Allows a program to extract a form or form package that has been previously registered.\r
-\r
- @param GetDefaultImage\r
- Allows a program to extract the nonvolatile image that represents the default storage image.\r
-\r
- @param UpdateForm\r
- Allows a program to update a previously registered form.\r
-\r
- @param GetKeyboardLayout\r
- Allows a program to extract the current keyboard layout.\r
-\r
-**/\r
-struct _EFI_HII_PROTOCOL {\r
- EFI_HII_NEW_PACK NewPack;\r
- EFI_HII_REMOVE_PACK RemovePack;\r
- EFI_HII_FIND_HANDLES FindHandles;\r
- EFI_HII_EXPORT ExportDatabase;\r
-\r
- EFI_HII_TEST_STRING TestString;\r
- EFI_HII_GET_GLYPH GetGlyph;\r
- EFI_HII_GLYPH_TO_BLT GlyphToBlt;\r
-\r
- EFI_HII_NEW_STRING NewString;\r
- EFI_HII_GET_PRI_LANGUAGES GetPrimaryLanguages;\r
- EFI_HII_GET_SEC_LANGUAGES GetSecondaryLanguages;\r
- EFI_HII_GET_STRING GetString;\r
- EFI_HII_RESET_STRINGS ResetStrings;\r
- EFI_HII_GET_LINE GetLine;\r
- EFI_HII_GET_FORMS GetForms;\r
- EFI_HII_GET_DEFAULT_IMAGE GetDefaultImage;\r
- EFI_HII_UPDATE_FORM UpdateForm;\r
-\r
- EFI_HII_GET_KEYBOARD_LAYOUT GetKeyboardLayout;\r
-};\r
-\r
-extern EFI_GUID gEfiHiiProtocolGuid;\r
-\r
-#endif\r
Include # Root include for the package\r
\r
[LibraryClasses.common]\r
- HiiLibFramework|Include/Library/HiiLibFramework.h\r
- IfrSupportLibFramework|Include/Library/IfrSupportLibFramework.h\r
+ FrameworkHiiLib|Include/Library/FrameworkHiiLib.h\r
+ FrameworkIfrSupportLib|Include/Library/FrameworkIfrSupportLib.h\r
SmmLib|Include/Library/SmmLib.h\r
\r
[Guids.common]\r
################################################################################\r
[Components.common]\r
IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.inf\r
- IntelFrameworkPkg/Library/UefiLibFramework/UefiLibFramework.inf\r
+ IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUefiLib.inf\r
IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DxeSmmDriverEntryPoint.inf\r
- IntelFrameworkPkg/Library/HiiLibFramework/HiiLib.inf\r
- IntelFrameworkPkg/Library/IfrSupportLibFramework/IfrSupportLib.inf\r
+ IntelFrameworkPkg/Library/FrameworkHiiLib/HiiLib.inf\r
+ IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrSupportLib.inf\r
IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/PeiSmbusLibSmbusPpi.inf\r
--- /dev/null
+/** @file\r
+ HII Library implementation that uses DXE protocols and services.\r
+\r
+ Copyright (c) 2006, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ Module Name: HiiLib.c\r
+\r
+**/\r
+\r
+\r
+#include <FrameworkDxe.h>\r
+\r
+\r
+#include <Library/FrameworkHiiLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+\r
+/**\r
+ This function allocates pool for an EFI_HII_PACKAGES structure\r
+ with enough space for the variable argument list of package pointers.\r
+ The allocated structure is initialized using NumberOfPackages, Guid,\r
+ and the variable length argument list of package pointers.\r
+\r
+ @param NumberOfPackages The number of HII packages to prepare.\r
+ @param Guid Package GUID.\r
+\r
+ @return The allocated and initialized packages.\r
+\r
+**/\r
+EFI_HII_PACKAGES *\r
+EFIAPI\r
+PreparePackages (\r
+ IN UINTN NumberOfPackages,\r
+ IN CONST EFI_GUID *Guid OPTIONAL,\r
+ ...\r
+ )\r
+{\r
+ VA_LIST Args;\r
+ EFI_HII_PACKAGES *HiiPackages;\r
+ VOID **Package;\r
+ UINTN Index;\r
+\r
+ ASSERT (NumberOfPackages > 0);\r
+\r
+ HiiPackages = AllocateZeroPool (sizeof (EFI_HII_PACKAGES) + NumberOfPackages * sizeof (VOID *));\r
+ ASSERT (HiiPackages != NULL);\r
+\r
+ HiiPackages->GuidId = (EFI_GUID *) Guid;\r
+ HiiPackages->NumberOfPackages = NumberOfPackages;\r
+ Package = (VOID **) (((UINT8 *) HiiPackages) + sizeof (EFI_HII_PACKAGES));\r
+\r
+ VA_START (Args, Guid);\r
+\r
+ for (Index = 0; Index < NumberOfPackages; Index++) {\r
+ *Package = VA_ARG (Args, VOID *);\r
+ Package++;\r
+ }\r
+\r
+ VA_END (Args);\r
+\r
+ return HiiPackages;\r
+\r
+}\r
--- /dev/null
+#/** @file\r
+# Library instance for HII common routines.\r
+#\r
+# This library instance implements the common HII routines.\r
+# Copyright (c) 2006, Intel Corporation\r
+#\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+#**/\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = FrameworkHiiLib\r
+ FILE_GUID = 1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c\r
+ MODULE_TYPE = DXE_DRIVER\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = FrameworkHiiLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER\r
+ EDK_RELEASE_VERSION = 0x00020000\r
+ EFI_SPECIFICATION_VERSION = 0x00020000\r
+\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources.common]\r
+ HiiLib.c\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ IntelFrameworkPkg/IntelFrameworkPkg.dec\r
+\r
+[LibraryClasses]\r
+ MemoryAllocationLib\r
+ DebugLib\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <MsaHeader>\r
+ <ModuleName>HiiLibFramework</ModuleName>\r
+ <ModuleType>DXE_DRIVER</ModuleType>\r
+ <GuidValue>1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Library instance for HII common routines.</Abstract>\r
+ <Description>This library instance implements the common HII routines.</Description>\r
+ <Copyright>Copyright (c) 2006, Intel Corporation</Copyright>\r
+ <License>All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>HiiLibFramework</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">\r
+ <Keyword>HiiLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>DebugLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>MemoryAllocationLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>HiiLib.c</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ </PackageDependencies>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
--- /dev/null
+/*++\r
+Copyright (c) 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+Module Name:\r
+ IfrCommon.c\r
+\r
+Abstract:\r
+\r
+ Common Library Routines to assist in IFR creation on-the-fly\r
+\r
+Revision History:\r
+\r
+--*/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "IfrSupportLibInternal.h"\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IfrLibConstruct (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+GetCurrentLanguage (\r
+ OUT CHAR16 *Lang\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Determine what is the current language setting\r
+\r
+Arguments:\r
+\r
+ Lang - Pointer of system language\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ UINTN Size;\r
+ UINTN Index;\r
+ CHAR8 Language[4];\r
+\r
+ //\r
+ // Getting the system language and placing it into our Global Data\r
+ //\r
+ Size = sizeof (Language);\r
+\r
+ Status = gRT->GetVariable (\r
+ (CHAR16 *) L"Lang",\r
+ &gEfiGlobalVariableGuid,\r
+ NULL,\r
+ &Size,\r
+ Language\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ AsciiStrCpy (Language, "eng");\r
+ }\r
+\r
+ for (Index = 0; Index < 3; Index++) {\r
+ //\r
+ // Bitwise AND ascii value with 0xDF yields an uppercase value.\r
+ // Sign extend into a unicode value\r
+ //\r
+ Lang[Index] = (CHAR16) (Language[Index] & 0xDF);\r
+ }\r
+\r
+ //\r
+ // Null-terminate the value\r
+ //\r
+ Lang[3] = (CHAR16) 0;\r
+\r
+ return Status;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+AddString (\r
+ IN VOID *StringBuffer,\r
+ IN CHAR16 *Language,\r
+ IN CHAR16 *String,\r
+ IN OUT STRING_REF *StringToken\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Add a string to the incoming buffer and return the token and offset data\r
+\r
+Arguments:\r
+\r
+ StringBuffer - The incoming buffer\r
+\r
+ Language - Currrent language\r
+\r
+ String - The string to be added\r
+\r
+ StringToken - The index where the string placed\r
+\r
+Returns:\r
+\r
+ EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
+\r
+ EFI_SUCCESS - String successfully added to the incoming buffer\r
+\r
+--*/\r
+{\r
+ EFI_HII_STRING_PACK *StringPack;\r
+ EFI_HII_STRING_PACK *StringPackBuffer;\r
+ VOID *NewBuffer;\r
+ RELOFST *PackSource;\r
+ RELOFST *PackDestination;\r
+ UINT8 *Source;\r
+ UINT8 *Destination;\r
+ UINTN Index;\r
+ BOOLEAN Finished;\r
+ UINTN SizeofLanguage;\r
+ UINTN SizeofString;\r
+\r
+ StringPack = (EFI_HII_STRING_PACK *) StringBuffer;\r
+ Finished = FALSE;\r
+\r
+ //\r
+ // Pre-allocate a buffer sufficient for us to work on.\r
+ // We will use it as a destination scratch pad to build data on\r
+ // and when complete shift the data back to the original buffer\r
+ //\r
+ NewBuffer = AllocateZeroPool (DEFAULT_STRING_BUFFER_SIZE);\r
+ if (NewBuffer == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ StringPackBuffer = (EFI_HII_STRING_PACK *) NewBuffer;\r
+\r
+ //\r
+ // StringPack is terminated with a length 0 entry\r
+ //\r
+ for (; StringPack->Header.Length != 0;) {\r
+ //\r
+ // If this stringpack's language is same as CurrentLanguage, use it\r
+ //\r
+ if (CompareMem ((VOID *) ((CHAR8 *) (StringPack) + StringPack->LanguageNameString), Language, 3) == 0) {\r
+ //\r
+ // We have some data in this string pack, copy the string package up to the string data\r
+ //\r
+ CopyMem (&StringPackBuffer->Header, &StringPack->Header, sizeof (StringPack));\r
+\r
+ //\r
+ // These are references in the structure to tokens, need to increase them by the space occupied by an additional StringPointer\r
+ //\r
+ StringPackBuffer->LanguageNameString = (UINT16) (StringPackBuffer->LanguageNameString + (UINT16) sizeof (RELOFST));\r
+ StringPackBuffer->PrintableLanguageName = (UINT16) (StringPackBuffer->PrintableLanguageName + (UINT16) sizeof (RELOFST));\r
+\r
+ PackSource = (RELOFST *) (StringPack + 1);\r
+ PackDestination = (RELOFST *) (StringPackBuffer + 1);\r
+ for (Index = 0; PackSource[Index] != 0x0000; Index++) {\r
+ //\r
+ // Copy the stringpointers from old to new buffer\r
+ // remember that we are adding a string, so the string offsets will all go up by sizeof (RELOFST)\r
+ //\r
+ PackDestination[Index] = (UINT16) (PackDestination[Index] + sizeof (RELOFST));\r
+ }\r
+\r
+ //\r
+ // Add a new stringpointer in the new buffer since we are adding a string. Null terminate it\r
+ //\r
+ PackDestination[Index] = (UINT16)(PackDestination[Index-1] +\r
+ StrSize((CHAR16 *)((CHAR8 *)(StringPack) + PackSource[Index-1])));\r
+ PackDestination[Index + 1] = (UINT16) 0;\r
+\r
+ //\r
+ // Index is the token value for the new string\r
+ //\r
+ *StringToken = (UINT16) Index;\r
+\r
+ //\r
+ // Source now points to the beginning of the old buffer strings\r
+ // Destination now points to the beginning of the new buffer strings\r
+ //\r
+ Source = (UINT8 *) &PackSource[Index + 1];\r
+ Destination = (UINT8 *) &PackDestination[Index + 2];\r
+\r
+ //\r
+ // This should copy all the strings from the old buffer to the new buffer\r
+ //\r
+ for (; Index != 0; Index--) {\r
+ //\r
+ // Copy Source string to destination buffer\r
+ //\r
+ StrCpy ((CHAR16 *) Destination, (CHAR16 *) Source);\r
+\r
+ //\r
+ // Adjust the source/destination to the next string location\r
+ //\r
+ Destination = Destination + StrSize ((CHAR16 *) Source);\r
+ Source = Source + StrSize ((CHAR16 *) Source);\r
+ }\r
+\r
+ //\r
+ // This copies the new string to the destination buffer\r
+ //\r
+ StrCpy ((CHAR16 *) Destination, (CHAR16 *) String);\r
+\r
+ //\r
+ // Adjust the size of the changed string pack by adding the size of the new string\r
+ // along with the size of the additional offset entry for the new string\r
+ //\r
+ StringPackBuffer->Header.Length = (UINT32) ((UINTN) StringPackBuffer->Header.Length + StrSize (String) + sizeof (RELOFST));\r
+\r
+ //\r
+ // Advance the buffers to point to the next spots.\r
+ //\r
+ StringPackBuffer = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPackBuffer) + StringPackBuffer->Header.Length);\r
+ StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + StringPack->Header.Length);\r
+ Finished = TRUE;\r
+ continue;\r
+ }\r
+ //\r
+ // This isn't the language of the stringpack we were asked to add a string to\r
+ // so we need to copy it to the new buffer.\r
+ //\r
+ CopyMem (&StringPackBuffer->Header, &StringPack->Header, StringPack->Header.Length);\r
+\r
+ //\r
+ // Advance the buffers to point to the next spots.\r
+ //\r
+ StringPackBuffer = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPackBuffer) + StringPack->Header.Length);\r
+ StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + StringPack->Header.Length);\r
+ }\r
+\r
+ //\r
+ // If we didn't copy the new data to a stringpack yet\r
+ //\r
+ if (!Finished) {\r
+ PackDestination = (RELOFST *) (StringPackBuffer + 1);\r
+ //\r
+ // Pointing to a new string pack location\r
+ //\r
+ SizeofLanguage = StrSize (Language);\r
+ SizeofString = StrSize (String);\r
+ StringPackBuffer->Header.Length = (UINT32)\r
+ (\r
+ sizeof (EFI_HII_STRING_PACK) -\r
+ sizeof (EFI_STRING) +\r
+ sizeof (RELOFST) +\r
+ sizeof (RELOFST) +\r
+ SizeofLanguage +\r
+ SizeofString\r
+ );\r
+ StringPackBuffer->Header.Type = EFI_HII_STRING;\r
+ StringPackBuffer->LanguageNameString = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer);\r
+ StringPackBuffer->PrintableLanguageName = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer);\r
+ StringPackBuffer->Attributes = 0;\r
+ PackDestination[0] = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer);\r
+ PackDestination[1] = (UINT16) (PackDestination[0] + StrSize (Language));\r
+ PackDestination[2] = (UINT16) 0;\r
+\r
+ //\r
+ // The first string location will be set to destination. The minimum number of strings\r
+ // associated with a stringpack will always be token 0 stored as the languagename (e.g. ENG, SPA, etc)\r
+ // and token 1 as the new string being added and and null entry for the stringpointers\r
+ //\r
+ Destination = (UINT8 *) &PackDestination[3];\r
+\r
+ //\r
+ // Copy the language name string to the new buffer\r
+ //\r
+ StrCpy ((CHAR16 *) Destination, Language);\r
+\r
+ //\r
+ // Advance the destination to the new empty spot\r
+ //\r
+ Destination = Destination + StrSize (Language);\r
+\r
+ //\r
+ // Copy the string to the new buffer\r
+ //\r
+ StrCpy ((CHAR16 *) Destination, String);\r
+\r
+ //\r
+ // Since we are starting with a new string pack - we know the new string is token 1\r
+ //\r
+ *StringToken = (UINT16) 1;\r
+ }\r
+\r
+ //\r
+ // Zero out the original buffer and copy the updated data in the new buffer to the old buffer\r
+ //\r
+ ZeroMem (StringBuffer, DEFAULT_STRING_BUFFER_SIZE);\r
+ CopyMem (StringBuffer, NewBuffer, DEFAULT_STRING_BUFFER_SIZE);\r
+\r
+ //\r
+ // Free the newly created buffer since we don't need it anymore\r
+ //\r
+ gBS->FreePool (NewBuffer);\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+AddOpCode (\r
+ IN VOID *FormBuffer,\r
+ IN OUT VOID *OpCodeData\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Add op-code data to the FormBuffer\r
+\r
+Arguments:\r
+\r
+ FormBuffer - Form buffer to be inserted to\r
+\r
+ OpCodeData - Op-code data to be inserted\r
+\r
+Returns:\r
+\r
+ EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
+\r
+ EFI_SUCCESS - Op-code data successfully inserted\r
+\r
+--*/\r
+{\r
+ EFI_HII_PACK_HEADER *NewBuffer;\r
+ UINT8 *Source;\r
+ UINT8 *Destination;\r
+\r
+ //\r
+ // Pre-allocate a buffer sufficient for us to work on.\r
+ // We will use it as a destination scratch pad to build data on\r
+ // and when complete shift the data back to the original buffer\r
+ //\r
+ NewBuffer = AllocateZeroPool (DEFAULT_FORM_BUFFER_SIZE);\r
+ if (NewBuffer == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ Source = (UINT8 *) FormBuffer;\r
+ Destination = (UINT8 *) NewBuffer;\r
+\r
+ //\r
+ // Copy the IFR Package header to the new buffer\r
+ //\r
+ CopyMem (Destination, Source, sizeof (EFI_HII_PACK_HEADER));\r
+\r
+ //\r
+ // Advance Source and Destination to next op-code\r
+ //\r
+ Source = Source + sizeof (EFI_HII_PACK_HEADER);\r
+ Destination = Destination + sizeof (EFI_HII_PACK_HEADER);\r
+\r
+ //\r
+ // Copy data to the new buffer until we run into the end_form\r
+ //\r
+ for (; ((EFI_IFR_OP_HEADER *) Source)->OpCode != EFI_IFR_END_FORM_OP;) {\r
+ //\r
+ // If the this opcode is an end_form_set we better be creating and endform\r
+ // Nonetheless, we will add data before the end_form_set. This also provides\r
+ // for interesting behavior in the code we will run, but has no bad side-effects\r
+ // since we will possibly do a 0 byte copy in this particular end-case.\r
+ //\r
+ if (((EFI_IFR_OP_HEADER *) Source)->OpCode == EFI_IFR_END_FORM_SET_OP) {\r
+ break;\r
+ }\r
+\r
+ //\r
+ // Copy data to new buffer\r
+ //\r
+ CopyMem (Destination, Source, ((EFI_IFR_OP_HEADER *) Source)->Length);\r
+\r
+ //\r
+ // Adjust Source/Destination to next op-code location\r
+ //\r
+ Destination = Destination + (UINTN) ((EFI_IFR_OP_HEADER *) Source)->Length;\r
+ Source = Source + (UINTN) ((EFI_IFR_OP_HEADER *) Source)->Length;\r
+ }\r
+\r
+ //\r
+ // Prior to the end_form is where we insert the new op-code data\r
+ //\r
+ CopyMem (Destination, OpCodeData, ((EFI_IFR_OP_HEADER *) OpCodeData)->Length);\r
+ Destination = Destination + (UINTN) ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;\r
+\r
+ NewBuffer->Length = (UINT32) (NewBuffer->Length + (UINT32) (((EFI_IFR_OP_HEADER *) OpCodeData)->Length));\r
+\r
+ //\r
+ // Copy end-form data to new buffer\r
+ //\r
+ CopyMem (Destination, Source, ((EFI_IFR_OP_HEADER *) Source)->Length);\r
+\r
+ //\r
+ // Adjust Source/Destination to next op-code location\r
+ //\r
+ Destination = Destination + (UINTN) ((EFI_IFR_OP_HEADER *) Source)->Length;\r
+ Source = Source + (UINTN) ((EFI_IFR_OP_HEADER *) Source)->Length;\r
+\r
+ //\r
+ // Copy end-formset data to new buffer\r
+ //\r
+ CopyMem (Destination, Source, ((EFI_IFR_OP_HEADER *) Source)->Length);\r
+\r
+ //\r
+ // Zero out the original buffer and copy the updated data in the new buffer to the old buffer\r
+ //\r
+ ZeroMem (FormBuffer, DEFAULT_FORM_BUFFER_SIZE);\r
+ CopyMem (FormBuffer, NewBuffer, DEFAULT_FORM_BUFFER_SIZE);\r
+\r
+ //\r
+ // Free the newly created buffer since we don't need it anymore\r
+ //\r
+ gBS->FreePool (NewBuffer);\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+STATIC\r
+EFI_STATUS\r
+GetHiiInterface (\r
+ OUT EFI_HII_PROTOCOL **Hii\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Get the HII protocol interface\r
+\r
+Arguments:\r
+\r
+ Hii - HII protocol interface\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // There should only be one HII protocol\r
+ //\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiHiiProtocolGuid,\r
+ NULL,\r
+ (VOID **) Hii\r
+ );\r
+\r
+ return Status;;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+ExtractDataFromHiiHandle (\r
+ IN EFI_HII_HANDLE HiiHandle,\r
+ IN OUT UINT16 *ImageLength,\r
+ OUT UINT8 *DefaultImage,\r
+ OUT EFI_GUID *Guid\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Extract information pertaining to the HiiHandle\r
+\r
+Arguments:\r
+\r
+ HiiHandle - Hii handle\r
+\r
+ ImageLength - For input, length of DefaultImage;\r
+ For output, length of actually required\r
+\r
+ DefaultImage - Image buffer prepared by caller\r
+\r
+ Guid - Guid information about the form\r
+\r
+Returns:\r
+\r
+ EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
+\r
+ EFI_BUFFER_TOO_SMALL - DefualtImage has no enough ImageLength\r
+\r
+ EFI_SUCCESS - Successfully extract data from Hii database.\r
+\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_HII_PROTOCOL *Hii;\r
+ UINTN DataLength;\r
+ UINT8 *RawData;\r
+ UINT8 *OldData;\r
+ UINTN Index;\r
+ UINTN Temp;\r
+ UINTN SizeOfNvStore;\r
+ UINTN CachedStart;\r
+\r
+ DataLength = DEFAULT_FORM_BUFFER_SIZE;\r
+ SizeOfNvStore = 0;\r
+ CachedStart = 0;\r
+\r
+ Status = GetHiiInterface (&Hii);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ //\r
+ // Allocate space for retrieval of IFR data\r
+ //\r
+ RawData = AllocateZeroPool (DataLength);\r
+ if (RawData == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ //\r
+ // Get all the forms associated with this HiiHandle\r
+ //\r
+ Status = Hii->GetForms (Hii, HiiHandle, 0, &DataLength, RawData);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ gBS->FreePool (RawData);\r
+\r
+ //\r
+ // Allocate space for retrieval of IFR data\r
+ //\r
+ RawData = AllocateZeroPool (DataLength);\r
+ if (RawData == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ //\r
+ // Get all the forms associated with this HiiHandle\r
+ //\r
+ Status = Hii->GetForms (Hii, HiiHandle, 0, &DataLength, RawData);\r
+ }\r
+\r
+ OldData = RawData;\r
+\r
+ //\r
+ // Point RawData to the beginning of the form data\r
+ //\r
+ RawData = (UINT8 *) ((UINTN) RawData + sizeof (EFI_HII_PACK_HEADER));\r
+\r
+ for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {\r
+ switch (RawData[Index]) {\r
+ case EFI_IFR_FORM_SET_OP:\r
+ //\r
+ // Copy the GUID information from this handle\r
+ //\r
+ CopyMem (Guid, &((EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID));\r
+ break;\r
+\r
+ case EFI_IFR_ONE_OF_OP:\r
+ case EFI_IFR_CHECKBOX_OP:\r
+ case EFI_IFR_NUMERIC_OP:\r
+ case EFI_IFR_DATE_OP:\r
+ case EFI_IFR_TIME_OP:\r
+ case EFI_IFR_PASSWORD_OP:\r
+ case EFI_IFR_STRING_OP:\r
+ //\r
+ // Remember, multiple op-codes may reference the same item, so let's keep a running\r
+ // marker of what the highest QuestionId that wasn't zero length. This will accurately\r
+ // maintain the Size of the NvStore\r
+ //\r
+ if (((EFI_IFR_ONE_OF *) &RawData[Index])->Width != 0) {\r
+ Temp = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((EFI_IFR_ONE_OF *) &RawData[Index])->Width;\r
+ if (SizeOfNvStore < Temp) {\r
+ SizeOfNvStore = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((EFI_IFR_ONE_OF *) &RawData[Index])->Width;\r
+ }\r
+ }\r
+ }\r
+\r
+ Index = RawData[Index + 1] + Index;\r
+ }\r
+\r
+ //\r
+ // Return an error if buffer is too small\r
+ //\r
+ if (SizeOfNvStore > *ImageLength) {\r
+ gBS->FreePool (OldData);\r
+ *ImageLength = (UINT16) SizeOfNvStore;\r
+ return EFI_BUFFER_TOO_SMALL;\r
+ }\r
+\r
+ if (DefaultImage != NULL) {\r
+ ZeroMem (DefaultImage, SizeOfNvStore);\r
+ }\r
+\r
+ //\r
+ // Copy the default image information to the user's buffer\r
+ //\r
+ for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {\r
+ switch (RawData[Index]) {\r
+ case EFI_IFR_ONE_OF_OP:\r
+ CachedStart = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId;\r
+ break;\r
+\r
+ case EFI_IFR_ONE_OF_OPTION_OP:\r
+ if (((EFI_IFR_ONE_OF_OPTION *) &RawData[Index])->Flags & EFI_IFR_FLAG_DEFAULT) {\r
+ CopyMem (&DefaultImage[CachedStart], &((EFI_IFR_ONE_OF_OPTION *) &RawData[Index])->Value, 2);\r
+ }\r
+ break;\r
+\r
+ case EFI_IFR_CHECKBOX_OP:\r
+ DefaultImage[((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId] = ((EFI_IFR_CHECKBOX *) &RawData[Index])->Flags;\r
+ break;\r
+\r
+ case EFI_IFR_NUMERIC_OP:\r
+ CopyMem (\r
+ &DefaultImage[((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId],\r
+ &((EFI_IFR_NUMERIC *) &RawData[Index])->Default,\r
+ 2\r
+ );\r
+ break;\r
+\r
+ }\r
+\r
+ Index = RawData[Index + 1] + Index;\r
+ }\r
+\r
+ *ImageLength = (UINT16) SizeOfNvStore;\r
+\r
+ //\r
+ // Free our temporary repository of form data\r
+ //\r
+ gBS->FreePool (OldData);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+\r
+EFI_HII_HANDLE\r
+FindHiiHandle (\r
+ IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL\r
+ IN EFI_GUID *Guid\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Finds HII handle for given pack GUID previously registered with the HII.\r
+\r
+Arguments:\r
+ HiiProtocol - pointer to pointer to HII protocol interface.\r
+ If NULL, the interface will be found but not returned.\r
+ If it points to NULL, the interface will be found and\r
+ written back to the pointer that is pointed to.\r
+ Guid - The GUID of the pack that registered with the HII.\r
+\r
+Returns:\r
+ Handle to the HII pack previously registered by the memory driver.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ EFI_HII_HANDLE *HiiHandleBuffer;\r
+ EFI_HII_HANDLE HiiHandle;\r
+ UINT16 HiiHandleBufferLength;\r
+ UINT32 NumberOfHiiHandles;\r
+ EFI_GUID HiiGuid;\r
+ EFI_HII_PROTOCOL *HiiProt;\r
+ UINT32 Index;\r
+ UINT16 Length;\r
+\r
+ HiiHandle = 0;\r
+ if ((HiiProtocol != NULL) && (*HiiProtocol != NULL)) {\r
+ //\r
+ // The protocol has been passed in\r
+ //\r
+ HiiProt = *HiiProtocol;\r
+ } else {\r
+ gBS->LocateProtocol (\r
+ &gEfiHiiProtocolGuid,\r
+ NULL,\r
+ (VOID **) &HiiProt\r
+ );\r
+ if (HiiProt == NULL) {\r
+ return HiiHandle;\r
+ }\r
+\r
+ if (HiiProtocol != NULL) {\r
+ //\r
+ // Return back the HII protocol for the caller as promissed\r
+ //\r
+ *HiiProtocol = HiiProt;\r
+ }\r
+ }\r
+ //\r
+ // Allocate buffer\r
+ //\r
+ HiiHandleBufferLength = 10;\r
+ HiiHandleBuffer = AllocatePool (HiiHandleBufferLength);\r
+ ASSERT (HiiHandleBuffer != NULL);\r
+\r
+ //\r
+ // Get the Handles of the packages that were registered with Hii\r
+ //\r
+ Status = HiiProt->FindHandles (\r
+ HiiProt,\r
+ &HiiHandleBufferLength,\r
+ HiiHandleBuffer\r
+ );\r
+\r
+ //\r
+ // Get a bigger bugffer if this one is to small, and try again\r
+ //\r
+ if (Status == EFI_BUFFER_TOO_SMALL) {\r
+\r
+ gBS->FreePool (HiiHandleBuffer);\r
+\r
+ HiiHandleBuffer = AllocatePool (HiiHandleBufferLength);\r
+ ASSERT (HiiHandleBuffer != NULL);\r
+\r
+ Status = HiiProt->FindHandles (\r
+ HiiProt,\r
+ &HiiHandleBufferLength,\r
+ HiiHandleBuffer\r
+ );\r
+ }\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ goto lbl_exit;\r
+ }\r
+\r
+ NumberOfHiiHandles = HiiHandleBufferLength / sizeof (EFI_HII_HANDLE);\r
+\r
+ //\r
+ // Iterate Hii handles and look for the one that matches our Guid\r
+ //\r
+ for (Index = 0; Index < NumberOfHiiHandles; Index++) {\r
+\r
+ Length = 0;\r
+ ExtractDataFromHiiHandle (HiiHandleBuffer[Index], &Length, NULL, &HiiGuid);\r
+\r
+ if (CompareGuid (&HiiGuid, Guid)) {\r
+\r
+ HiiHandle = HiiHandleBuffer[Index];\r
+ break;\r
+ }\r
+ }\r
+\r
+lbl_exit:\r
+ gBS->FreePool (HiiHandleBuffer);\r
+ return HiiHandle;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+ValidateDataFromHiiHandle (\r
+ IN EFI_HII_HANDLE HiiHandle,\r
+ OUT BOOLEAN *Results\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Validate that the data associated with the HiiHandle in NVRAM is within\r
+ the reasonable parameters for that FormSet. Values for strings and passwords\r
+ are not verified due to their not having the equivalent of valid range settings.\r
+\r
+Arguments:\r
+\r
+ HiiHandle - Handle of the HII database entry to query\r
+\r
+ Results - If return Status is EFI_SUCCESS, Results provides valid data\r
+ TRUE = NVRAM Data is within parameters\r
+ FALSE = NVRAM Data is NOT within parameters\r
+\r
+Returns:\r
+\r
+ EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
+\r
+ EFI_SUCCESS - Data successfully validated\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_HII_PROTOCOL *Hii;\r
+ EFI_GUID Guid;\r
+ UINT8 *RawData;\r
+ UINT8 *OldData;\r
+ UINTN RawDataLength;\r
+ UINT8 *VariableData;\r
+ UINTN Index;\r
+ UINTN Temp;\r
+ UINTN SizeOfNvStore;\r
+ UINTN CachedStart;\r
+ BOOLEAN GotMatch;\r
+\r
+ RawDataLength = DEFAULT_FORM_BUFFER_SIZE;\r
+ SizeOfNvStore = 0;\r
+ CachedStart = 0;\r
+ GotMatch = FALSE;\r
+ *Results = TRUE;\r
+\r
+ Status = GetHiiInterface (&Hii);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ //\r
+ // Allocate space for retrieval of IFR data\r
+ //\r
+ RawData = AllocateZeroPool (RawDataLength);\r
+ if (RawData == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ //\r
+ // Get all the forms associated with this HiiHandle\r
+ //\r
+ Status = Hii->GetForms (Hii, HiiHandle, 0, &RawDataLength, RawData);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ gBS->FreePool (RawData);\r
+\r
+ //\r
+ // Allocate space for retrieval of IFR data\r
+ //\r
+ RawData = AllocateZeroPool (RawDataLength);\r
+ if (RawData == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ //\r
+ // Get all the forms associated with this HiiHandle\r
+ //\r
+ Status = Hii->GetForms (Hii, HiiHandle, 0, &RawDataLength, RawData);\r
+ }\r
+\r
+ OldData = RawData;\r
+\r
+ //\r
+ // Point RawData to the beginning of the form data\r
+ //\r
+ RawData = (UINT8 *) ((UINTN) RawData + sizeof (EFI_HII_PACK_HEADER));\r
+\r
+ for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {\r
+ if (RawData[Index] == EFI_IFR_FORM_SET_OP) {\r
+ CopyMem (&Guid, &((EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID));\r
+ break;\r
+ }\r
+\r
+ Index = RawData[Index + 1] + Index;\r
+ }\r
+\r
+ for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {\r
+ switch (RawData[Index]) {\r
+ case EFI_IFR_FORM_SET_OP:\r
+ break;\r
+\r
+ case EFI_IFR_ONE_OF_OP:\r
+ case EFI_IFR_CHECKBOX_OP:\r
+ case EFI_IFR_NUMERIC_OP:\r
+ case EFI_IFR_DATE_OP:\r
+ case EFI_IFR_TIME_OP:\r
+ case EFI_IFR_PASSWORD_OP:\r
+ case EFI_IFR_STRING_OP:\r
+ //\r
+ // Remember, multiple op-codes may reference the same item, so let's keep a running\r
+ // marker of what the highest QuestionId that wasn't zero length. This will accurately\r
+ // maintain the Size of the NvStore\r
+ //\r
+ if (((EFI_IFR_ONE_OF *) &RawData[Index])->Width != 0) {\r
+ Temp = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((EFI_IFR_ONE_OF *) &RawData[Index])->Width;\r
+ if (SizeOfNvStore < Temp) {\r
+ SizeOfNvStore = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((EFI_IFR_ONE_OF *) &RawData[Index])->Width;\r
+ }\r
+ }\r
+ }\r
+\r
+ Index = RawData[Index + 1] + Index;\r
+ }\r
+\r
+ //\r
+ // Allocate memory for our File Form Tags\r
+ //\r
+ VariableData = AllocateZeroPool (SizeOfNvStore);\r
+ if (VariableData == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ Status = gRT->GetVariable (\r
+ (CHAR16 *) L"Setup",\r
+ &Guid,\r
+ NULL,\r
+ &SizeOfNvStore,\r
+ (VOID *) VariableData\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+\r
+ //\r
+ // If there is a variable that exists already and it is larger than what we calculated the\r
+ // storage needs to be, we must assume the variable size from GetVariable is correct and not\r
+ // allow the truncation of the variable. It is very possible that the user who created the IFR\r
+ // we are cracking is not referring to a variable that was in a previous map, however we cannot\r
+ // allow it's truncation.\r
+ //\r
+ if (Status == EFI_BUFFER_TOO_SMALL) {\r
+ //\r
+ // Free the buffer that was allocated that was too small\r
+ //\r
+ gBS->FreePool (VariableData);\r
+\r
+ VariableData = AllocatePool (SizeOfNvStore);\r
+ if (VariableData == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ Status = gRT->GetVariable (\r
+ (CHAR16 *) L"Setup",\r
+ &Guid,\r
+ NULL,\r
+ &SizeOfNvStore,\r
+ (VOID *) VariableData\r
+ );\r
+ }\r
+ }\r
+\r
+ //\r
+ // Walk through the form and see that the variable data it refers to is ok.\r
+ // This allows for the possibility of stale (obsoleted) data in the variable\r
+ // can be overlooked without causing an error\r
+ //\r
+ for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {\r
+ switch (RawData[Index]) {\r
+ case EFI_IFR_ONE_OF_OP:\r
+ //\r
+ // A one_of has no data, its the option that does - cache the storage Id\r
+ //\r
+ CachedStart = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId;\r
+ break;\r
+\r
+ case EFI_IFR_ONE_OF_OPTION_OP:\r
+ //\r
+ // A one_of_option can be any value\r
+ //\r
+ if (VariableData[CachedStart] == ((EFI_IFR_ONE_OF_OPTION *) &RawData[Index])->Value) {\r
+ GotMatch = TRUE;\r
+ }\r
+ break;\r
+\r
+ case EFI_IFR_END_ONE_OF_OP:\r
+ //\r
+ // At this point lets make sure that the data value in the NVRAM matches one of the options\r
+ //\r
+ if (!GotMatch) {\r
+ *Results = FALSE;\r
+ return EFI_SUCCESS;\r
+ }\r
+ break;\r
+\r
+ case EFI_IFR_CHECKBOX_OP:\r
+ //\r
+ // A checkbox is a boolean, so 0 and 1 are valid\r
+ // Remember, QuestionId corresponds to the offset location of the data in the variable\r
+ //\r
+ if (VariableData[((EFI_IFR_CHECKBOX *) &RawData[Index])->QuestionId] > 1) {\r
+ *Results = FALSE;\r
+ return EFI_SUCCESS;\r
+ }\r
+ break;\r
+\r
+ case EFI_IFR_NUMERIC_OP:\r
+ if ((VariableData[((EFI_IFR_NUMERIC *)&RawData[Index])->QuestionId] < ((EFI_IFR_NUMERIC *)&RawData[Index])->Minimum) ||\r
+ (VariableData[((EFI_IFR_NUMERIC *)&RawData[Index])->QuestionId] > ((EFI_IFR_NUMERIC *)&RawData[Index])->Maximum)) {\r
+ *Results = FALSE;\r
+ return EFI_SUCCESS;\r
+ }\r
+ break;\r
+\r
+ }\r
+\r
+ Index = RawData[Index + 1] + Index;\r
+ }\r
+\r
+ //\r
+ // Free our temporary repository of form data\r
+ //\r
+ gBS->FreePool (OldData);\r
+ gBS->FreePool (VariableData);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
--- /dev/null
+/*++\r
+Copyright (c) 2006, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+Module Name:\r
+ IfrOnTheFly.c\r
+\r
+Abstract:\r
+\r
+ Library Routines to create IFR on-the-fly\r
+\r
+Revision History:\r
+\r
+--*/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "IfrSupportLibInternal.h"\r
+\r
+EFI_STATUS\r
+CreateFormSet (\r
+ IN CHAR16 *FormSetTitle,\r
+ IN EFI_GUID *Guid,\r
+ IN UINT8 Class,\r
+ IN UINT8 SubClass,\r
+ IN OUT VOID **FormBuffer,\r
+ IN OUT VOID **StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a formset\r
+ \r
+Arguments:\r
+ \r
+ FormSetTitle - Title of formset\r
+ \r
+ Guid - Guid of formset\r
+ \r
+ Class - Class of formset\r
+ \r
+ SubClass - Sub class of formset\r
+ \r
+ FormBuffer - Pointer of the formset created\r
+ \r
+ StringBuffer - Pointer of FormSetTitile string created\r
+ \r
+Returns: \r
+\r
+ EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
+ \r
+ EFI_SUCCESS - Formset successfully created\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_HII_IFR_PACK IfrPack;\r
+ EFI_IFR_FORM_SET FormSet;\r
+ EFI_IFR_END_FORM_SET EndFormSet;\r
+ UINT8 *Destination;\r
+ CHAR16 CurrentLanguage[4];\r
+ STRING_REF StringToken;\r
+\r
+ //\r
+ // Pre-allocate a buffer sufficient for us to work from.\r
+ //\r
+ FormBuffer = AllocateZeroPool (DEFAULT_FORM_BUFFER_SIZE);\r
+ if (FormBuffer == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ //\r
+ // Pre-allocate a buffer sufficient for us to work from.\r
+ //\r
+ StringBuffer = AllocateZeroPool (DEFAULT_STRING_BUFFER_SIZE);\r
+ if (StringBuffer == NULL) {\r
+ gBS->FreePool (FormBuffer);\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ //\r
+ // Obtain current language value\r
+ //\r
+ GetCurrentLanguage (CurrentLanguage);\r
+\r
+ //\r
+ // Add the FormSetTitle to the string buffer and get the StringToken\r
+ //\r
+ Status = AddString (*StringBuffer, CurrentLanguage, FormSetTitle, &StringToken);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ //\r
+ // Initialize the Ifr Package header data\r
+ //\r
+ IfrPack.Header.Length = sizeof (EFI_HII_PACK_HEADER) + sizeof (EFI_IFR_FORM_SET) + sizeof (EFI_IFR_END_FORM_SET);\r
+ IfrPack.Header.Type = EFI_HII_IFR;\r
+\r
+ //\r
+ // Initialize FormSet with the appropriate information\r
+ //\r
+ FormSet.Header.OpCode = EFI_IFR_FORM_SET_OP;\r
+ FormSet.Header.Length = sizeof (EFI_IFR_FORM_SET);\r
+ FormSet.FormSetTitle = StringToken;\r
+ FormSet.Class = Class;\r
+ FormSet.SubClass = SubClass;\r
+ CopyMem (&FormSet.Guid, Guid, sizeof (EFI_GUID));\r
+\r
+ //\r
+ // Initialize the end formset data\r
+ //\r
+ EndFormSet.Header.Length = sizeof (EFI_IFR_END_FORM_SET);\r
+ EndFormSet.Header.OpCode = EFI_IFR_END_FORM_SET_OP;\r
+\r
+ Destination = (UINT8 *) *FormBuffer;\r
+\r
+ //\r
+ // Copy the formset/endformset data to the form buffer\r
+ //\r
+ CopyMem (Destination, &IfrPack, sizeof (EFI_HII_PACK_HEADER));\r
+\r
+ Destination = Destination + sizeof (EFI_HII_PACK_HEADER);\r
+\r
+ CopyMem (Destination, &FormSet, sizeof (EFI_IFR_FORM_SET));\r
+\r
+ Destination = Destination + sizeof (EFI_IFR_FORM_SET);\r
+\r
+ CopyMem (Destination, &EndFormSet, sizeof (EFI_IFR_END_FORM_SET));\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+CreateForm (\r
+ IN CHAR16 *FormTitle,\r
+ IN UINT16 FormId,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a form\r
+ \r
+Arguments:\r
+ \r
+ FormTitle - Title of the form\r
+ \r
+ FormId - Id of the form\r
+ \r
+ FormBuffer - Pointer of the form created\r
+ \r
+ StringBuffer - Pointer of FormTitil string created\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Form successfully created\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_IFR_FORM Form;\r
+ EFI_IFR_END_FORM EndForm;\r
+ CHAR16 CurrentLanguage[4];\r
+ STRING_REF StringToken;\r
+\r
+ //\r
+ // Obtain current language value\r
+ //\r
+ GetCurrentLanguage (CurrentLanguage);\r
+\r
+ Status = AddString (StringBuffer, CurrentLanguage, FormTitle, &StringToken);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Form.Header.OpCode = EFI_IFR_FORM_OP;\r
+ Form.Header.Length = sizeof (EFI_IFR_FORM);\r
+ Form.FormId = FormId;\r
+ Form.FormTitle = StringToken;\r
+\r
+ Status = AddOpCode (FormBuffer, &Form);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ EndForm.Header.OpCode = EFI_IFR_END_FORM_OP;\r
+ EndForm.Header.Length = sizeof (EFI_IFR_END_FORM);\r
+\r
+ Status = AddOpCode (FormBuffer, &EndForm);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+CreateSubTitle (\r
+ IN CHAR16 *SubTitle,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a SubTitle\r
+ \r
+Arguments:\r
+ \r
+ SubTitle - Sub title to be created\r
+ \r
+ FormBuffer - Where this subtitle to add to\r
+ \r
+ StringBuffer - String buffer created for subtitle\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Subtitle successfully created\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_IFR_SUBTITLE Subtitle;\r
+ CHAR16 CurrentLanguage[4];\r
+ STRING_REF StringToken;\r
+\r
+ //\r
+ // Obtain current language value\r
+ //\r
+ GetCurrentLanguage (CurrentLanguage);\r
+\r
+ Status = AddString (StringBuffer, CurrentLanguage, SubTitle, &StringToken);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Subtitle.Header.OpCode = EFI_IFR_SUBTITLE_OP;\r
+ Subtitle.Header.Length = sizeof (EFI_IFR_SUBTITLE);\r
+ Subtitle.SubTitle = StringToken;\r
+\r
+ Status = AddOpCode (FormBuffer, &Subtitle);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+CreateText (\r
+ IN CHAR16 *String,\r
+ IN CHAR16 *String2,\r
+ IN CHAR16 *String3,\r
+ IN UINT8 Flags,\r
+ IN UINT16 Key,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a line of text\r
+ \r
+Arguments:\r
+ \r
+ String - First string of the text\r
+ \r
+ String2 - Second string of the text\r
+ \r
+ String3 - Help string of the text\r
+ \r
+ Flags - Flag of the text\r
+ \r
+ Key - Key of the text\r
+ \r
+ FormBuffer - The form where this text adds to\r
+ \r
+ StringBuffer - String buffer created for String, String2 and String3\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Text successfully created\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_IFR_TEXT Text;\r
+ CHAR16 CurrentLanguage[4];\r
+ STRING_REF StringToken;\r
+\r
+ //\r
+ // Obtain current language value\r
+ //\r
+ GetCurrentLanguage (CurrentLanguage);\r
+\r
+ //\r
+ // Add first string, get first string's token\r
+ //\r
+ Status = AddString (StringBuffer, CurrentLanguage, String, &StringToken);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Text.Header.OpCode = EFI_IFR_TEXT_OP;\r
+ Text.Header.Length = sizeof (EFI_IFR_TEXT);\r
+ Text.Text = StringToken;\r
+\r
+ //\r
+ // Add second string, get first string's token\r
+ //\r
+ Status = AddString (StringBuffer, CurrentLanguage, String2, &StringToken);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Text.TextTwo = StringToken;\r
+\r
+ Text.Flags = (UINT8) (Flags | EFI_IFR_FLAG_CREATED);\r
+ Text.Key = Key;\r
+\r
+ //\r
+ // Add second string, get first string's token\r
+ //\r
+ Status = AddString (StringBuffer, CurrentLanguage, String3, &StringToken);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Text.Help = StringToken;\r
+\r
+ Status = AddOpCode (FormBuffer, &Text);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+CreateGoto (\r
+ IN UINT16 FormId,\r
+ IN CHAR16 *Prompt,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a hyperlink\r
+ \r
+Arguments:\r
+ \r
+ FormId - Form ID of the hyperlink\r
+ \r
+ Prompt - Prompt of the hyperlink\r
+ \r
+ FormBuffer - The form where this hyperlink adds to\r
+ \r
+ StringBuffer - String buffer created for Prompt\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Hyperlink successfully created\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_IFR_REF Hyperlink;\r
+ CHAR16 CurrentLanguage[4];\r
+ STRING_REF StringToken;\r
+\r
+ //\r
+ // Obtain current language value\r
+ //\r
+ GetCurrentLanguage (CurrentLanguage);\r
+\r
+ Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Hyperlink.Header.OpCode = EFI_IFR_REF_OP;\r
+ Hyperlink.Header.Length = sizeof (EFI_IFR_REF);\r
+ Hyperlink.FormId = FormId;\r
+ Hyperlink.Prompt = StringToken;\r
+\r
+ Status = AddOpCode (FormBuffer, &Hyperlink);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+CreateOneOf (\r
+ IN UINT16 QuestionId,\r
+ IN UINT8 DataWidth,\r
+ IN CHAR16 *Prompt,\r
+ IN CHAR16 *Help,\r
+ IN IFR_OPTION *OptionsList,\r
+ IN UINTN OptionCount,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a one-of question with a set of options to choose from. The\r
+ OptionsList is a pointer to a null-terminated list of option descriptions.\r
+ \r
+Arguments:\r
+ \r
+ QuestionId - Question ID of the one-of box\r
+ \r
+ DataWidth - DataWidth of the one-of box\r
+ \r
+ Prompt - Prompt of the one-of box\r
+ \r
+ Help - Help of the one-of box\r
+ \r
+ OptionsList - Each string in it is an option of the one-of box\r
+ \r
+ OptionCount - Option string count\r
+ \r
+ FormBuffer - The form where this one-of box adds to\r
+ \r
+ StringBuffer - String buffer created for Prompt, Help and Option strings\r
+ \r
+Returns: \r
+\r
+ EFI_DEVICE_ERROR - DataWidth > 2\r
+\r
+ EFI_SUCCESS - One-Of box successfully created.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ UINTN Index;\r
+ EFI_IFR_ONE_OF OneOf;\r
+ EFI_IFR_ONE_OF_OPTION OneOfOption;\r
+ EFI_IFR_END_ONE_OF EndOneOf;\r
+ CHAR16 CurrentLanguage[4];\r
+ STRING_REF StringToken;\r
+\r
+ //\r
+ // We do not create op-code storage widths for one-of in excess of 16 bits for now\r
+ //\r
+ if (DataWidth > 2) {\r
+ return EFI_DEVICE_ERROR;\r
+ }\r
+\r
+ //\r
+ // Obtain current language value\r
+ //\r
+ GetCurrentLanguage (CurrentLanguage);\r
+\r
+ //\r
+ // Add first string, get first string's token\r
+ //\r
+ Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ OneOf.Header.OpCode = EFI_IFR_ONE_OF_OP;\r
+ OneOf.Header.Length = sizeof (EFI_IFR_ONE_OF);\r
+ OneOf.QuestionId = QuestionId;\r
+ OneOf.Width = DataWidth;\r
+ OneOf.Prompt = StringToken;\r
+\r
+ //\r
+ // Add second string, get first string's token\r
+ //\r
+ Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ OneOf.Help = StringToken;\r
+\r
+ Status = AddOpCode (FormBuffer, &OneOf);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ for (Index = 0; Index < OptionCount; Index++) {\r
+ OneOfOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;\r
+ OneOfOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);\r
+\r
+ //\r
+ // Add string and get token back\r
+ //\r
+ Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken);\r
+\r
+ OneOfOption.Option = StringToken;\r
+ OneOfOption.Value = OptionsList[Index].Value;\r
+ OneOfOption.Flags = (UINT8) (OptionsList[Index].Flags | EFI_IFR_FLAG_CREATED);\r
+ OneOfOption.Key = OptionsList[Index].Key;\r
+\r
+ Status = AddOpCode (FormBuffer, &OneOfOption);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ }\r
+\r
+ EndOneOf.Header.Length = sizeof (EFI_IFR_END_ONE_OF);\r
+ EndOneOf.Header.OpCode = EFI_IFR_END_ONE_OF_OP;\r
+\r
+ Status = AddOpCode (FormBuffer, &EndOneOf);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+CreateOrderedList (\r
+ IN UINT16 QuestionId,\r
+ IN UINT8 MaxEntries,\r
+ IN CHAR16 *Prompt,\r
+ IN CHAR16 *Help,\r
+ IN IFR_OPTION *OptionsList,\r
+ IN UINTN OptionCount,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a one-of question with a set of options to choose from. The\r
+ OptionsList is a pointer to a null-terminated list of option descriptions.\r
+ \r
+Arguments:\r
+ \r
+ QuestionId - Question ID of the ordered list\r
+ \r
+ MaxEntries - MaxEntries of the ordered list\r
+ \r
+ Prompt - Prompt of the ordered list\r
+ \r
+ Help - Help of the ordered list\r
+ \r
+ OptionsList - Each string in it is an option of the ordered list\r
+ \r
+ OptionCount - Option string count\r
+ \r
+ FormBuffer - The form where this ordered list adds to\r
+ \r
+ StringBuffer - String buffer created for Prompt, Help and Option strings\r
+ \r
+Returns: \r
+\r
+ EFI_SUCCESS - Ordered list successfully created.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ UINTN Index;\r
+ EFI_IFR_ORDERED_LIST OrderedList;\r
+ EFI_IFR_ONE_OF_OPTION OrderedListOption;\r
+ EFI_IFR_END_ONE_OF EndOrderedList;\r
+ CHAR16 CurrentLanguage[4];\r
+ STRING_REF StringToken;\r
+\r
+ //\r
+ // Obtain current language value\r
+ //\r
+ GetCurrentLanguage (CurrentLanguage);\r
+\r
+ //\r
+ // Add first string, get first string's token\r
+ //\r
+ Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ OrderedList.Header.OpCode = EFI_IFR_ORDERED_LIST_OP;\r
+ OrderedList.Header.Length = sizeof (EFI_IFR_ORDERED_LIST);\r
+ OrderedList.QuestionId = QuestionId;\r
+ OrderedList.MaxEntries = MaxEntries;\r
+ OrderedList.Prompt = StringToken;\r
+\r
+ //\r
+ // Add second string, get first string's token\r
+ //\r
+ Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ OrderedList.Help = StringToken;\r
+\r
+ Status = AddOpCode (FormBuffer, &OrderedList);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ for (Index = 0; Index < OptionCount; Index++) {\r
+ OrderedListOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;\r
+ OrderedListOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);\r
+\r
+ //\r
+ // Add string and get token back\r
+ //\r
+ Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken);\r
+\r
+ OrderedListOption.Option = StringToken;\r
+ OrderedListOption.Value = OptionsList[Index].Value;\r
+ OrderedListOption.Flags = (UINT8) (OptionsList[Index].Flags | EFI_IFR_FLAG_CREATED);\r
+ OrderedListOption.Key = OptionsList[Index].Key;\r
+\r
+ Status = AddOpCode (FormBuffer, &OrderedListOption);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ }\r
+\r
+ EndOrderedList.Header.Length = sizeof (EFI_IFR_END_ONE_OF);\r
+ EndOrderedList.Header.OpCode = EFI_IFR_END_ONE_OF_OP;\r
+\r
+ Status = AddOpCode (FormBuffer, &EndOrderedList);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+CreateCheckBox (\r
+ IN UINT16 QuestionId,\r
+ IN UINT8 DataWidth,\r
+ IN CHAR16 *Prompt,\r
+ IN CHAR16 *Help,\r
+ IN UINT8 Flags,\r
+ IN OUT VOID *FormBuffer,\r
+ IN OUT VOID *StringBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a checkbox\r
+ \r
+Arguments:\r
+ \r
+ QuestionId - Question ID of the check box\r
+ \r
+ DataWidth - DataWidth of the check box\r
+ \r
+ Prompt - Prompt of the check box\r
+ \r
+ Help - Help of the check box\r
+ \r
+ Flags - Flags of the check box\r
+ \r
+ FormBuffer - The form where this check box adds to\r
+ \r
+ StringBuffer - String buffer created for Prompt and Help.\r
+ \r
+Returns: \r
+\r
+ EFI_DEVICE_ERROR - DataWidth > 1\r
+\r
+ EFI_SUCCESS - Check box successfully created\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_IFR_CHECKBOX CheckBox;\r
+ CHAR16 CurrentLanguage[4];\r
+ STRING_REF StringToken;\r
+\r
+ //\r
+ // We do not create op-code storage widths for checkbox in excess of 8 bits for now\r
+ //\r
+ if (DataWidth > 1) {\r
+ return EFI_DEVICE_ERROR;\r
+ }\r
+\r
+ //\r
+ // Obtain current language value\r
+ //\r
+ GetCurrentLanguage (CurrentLanguage);\r
+\r
+ //\r
+ // Add first string, get first string's token\r
+ //\r
+ Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ CheckBox.Header.OpCode = EFI_IFR_CHECKBOX_OP;\r
+ CheckBox.Header.Length = sizeof (EFI_IFR_CHECKBOX);\r
+ CheckBox.QuestionId = QuestionId;\r
+ CheckBox.Width = DataWidth;\r
+ CheckBox.Prompt = StringToken;\r
+\r
+ //\r
+ // Add second string, get first string's token\r