diff --git a/IntelFrameworkPkg/Include/Library/FrameworkIfrSupportLib.h b/IntelFrameworkPkg/Include/Library/FrameworkIfrSupportLib.h deleted file mode 100644 index 6eab8f61bf..0000000000 --- a/IntelFrameworkPkg/Include/Library/FrameworkIfrSupportLib.h +++ /dev/null @@ -1,888 +0,0 @@ -/** @file - Library class name: FrameworkIfrSupportLib - - FrameworkIfrSupportLib is designed for produce IFR operation interface . - The IFR format follows framework specification. - -Copyright (c) 2006, Intel Corporation -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. - -**/ - -#ifndef _IFRSUPPORTLIBRARY_H_ -#define _IFRSUPPORTLIBRARY_H_ - -#define DEFAULT_FORM_BUFFER_SIZE 0xFFFF -#define DEFAULT_STRING_BUFFER_SIZE 0xFFFF - -#pragma pack(1) -typedef struct { - CHAR16 *OptionString; // Passed in string to generate a token for in a truly dynamic form creation - STRING_REF StringToken; // This is used when creating a single op-code without generating a StringToken (have one already) - UINT16 Value; - UINT8 Flags; - UINT16 Key; -} IFR_OPTION; -#pragma pack() - -/** - Determine what is the current language setting. - - The setting is stored in language variable in flash. This routine - will get setting by accesssing that variable. If failed to access - language variable, then use default setting that 'eng' as current - language setting. - - @param Lang Pointer of system language - - @return whether success to get setting from variable -**/ -EFI_STATUS -EFIAPI -GetCurrentLanguage ( - OUT CHAR16 *Lang - ); - -/** - Add a string to the incoming buffer and return the token and offset data. - - @param StringBuffer The incoming buffer - @param Language Currrent language - @param String The string to be added - @param StringToken The index where the string placed - - @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate - @retval EFI_SUCCESS String successfully added to the incoming buffer -**/ -EFI_STATUS -EFIAPI -AddString ( - IN VOID *StringBuffer, - IN CHAR16 *Language, - IN CHAR16 *String, - IN OUT STRING_REF *StringToken - ); - -/** - Add op-code data to the FormBuffer. - - @param FormBuffer Form buffer to be inserted to - @param OpCodeData Op-code data to be inserted - - @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate - @retval EFI_SUCCESS Op-code data successfully inserted -**/ -EFI_STATUS -EFIAPI -AddOpCode ( - IN VOID *FormBuffer, - IN OUT VOID *OpCodeData - ); - -/** - Create a formset - - The form package is a collection of forms that are intended to describe the pages that will be - displayed to the user. - - @param FormSetTitle Title of formset - @param Guid Guid of formset - @param Class Class of formset - @param SubClass Sub class of formset - @param FormBuffer Pointer of the formset created - @param StringBuffer Pointer of FormSetTitile string created - - @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate - @retval EFI_SUCCESS Formset successfully created -**/ -EFI_STATUS -EFIAPI -CreateFormSet ( - IN CHAR16 *FormSetTitle, - IN EFI_GUID *Guid, - IN UINT8 Class, - IN UINT8 SubClass, - IN OUT VOID **FormBuffer, - IN OUT VOID **StringBuffer - ); - -/** - Create a form. - A form is the encapsulation of what amounts to a browser page. The header defines a FormId, - which is referenced by the form package, among others. It also defines a FormTitle, which is a - string to be used as the title for the form - - @param FormTitle Title of the form - @param FormId Id of the form - @param FormBuffer Pointer of the form created - @param StringBuffer Pointer of FormTitil string created - - @retval EFI_SUCCESS Form successfully created -**/ -EFI_STATUS -EFIAPI -CreateForm ( - IN CHAR16 *FormTitle, - IN UINT16 FormId, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ); - -/** - Create a SubTitle - - Subtitle strings are intended to be used by authors to separate sections of questions into semantic - groups. - - @param SubTitle Sub title to be created - @param FormBuffer Where this subtitle to add to - @param StringBuffer String buffer created for subtitle - - @retval EFI_SUCCESS Subtitle successfully created -**/ -EFI_STATUS -EFIAPI -CreateSubTitle ( - IN CHAR16 *SubTitle, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ); - -/** - Create a line of text - Unlike HTML, text is simply another tag. - This tag type enables IFR to be more easily localized. - - @param String First string of the text - @param String2 Second string of the text - @param String3 Help string of the text - @param Flags Flag of the text - @param Key Key of the text - @param FormBuffer The form where this text adds to - @param StringBuffer String buffer created for String, String2 and String3 - - @retval EFI_SUCCESS Text successfully created -**/ -EFI_STATUS -EFIAPI -CreateText ( - IN CHAR16 *String, - IN CHAR16 *String2, - IN CHAR16 *String3, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ); - -/** - Create a hyperlink. - - @param FormId Form ID of the hyperlink - @param Prompt Prompt of the hyperlink - @param FormBuffer The form where this hyperlink adds to - @param StringBuffer String buffer created for Prompt - - @retval EFI_SUCCESS Hyperlink successfully created -**/ -EFI_STATUS -EFIAPI -CreateGoto ( - IN UINT16 FormId, - IN CHAR16 *Prompt, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ); - -/** - Create a one-of question with a set of options to choose from. The - OptionsList is a pointer to a null-terminated list of option descriptions. - - @param QuestionId Question ID of the one-of box - @param DataWidth DataWidth of the one-of box - @param Prompt Prompt of the one-of box - @param Help Help of the one-of box - @param OptionsList Each string in it is an option of the one-of box - @param OptionCount Option string count - @param FormBuffer The form where this one-of box adds to - @param StringBuffer String buffer created for Prompt, Help and Option strings - - @retval EFI_DEVICE_ERROR DataWidth > 2 - @retval EFI_SUCCESS One-Of box successfully created. -**/ -EFI_STATUS -EFIAPI -CreateOneOf ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN CHAR16 *Prompt, - IN CHAR16 *Help, - IN IFR_OPTION *OptionsList, - IN UINTN OptionCount, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ); - -/** - Create a one-of question with a set of options to choose from. The - OptionsList is a pointer to a null-terminated list of option descriptions. - - @param QuestionId Question ID of the ordered list - @param MaxEntries MaxEntries of the ordered list - @param Prompt Prompt of the ordered list - @param Help Help of the ordered list - @param OptionsList Each string in it is an option of the ordered list - @param OptionCount Option string count - @param FormBuffer The form where this ordered list adds to - @param StringBuffer String buffer created for Prompt, Help and Option strings - - @retval EFI_SUCCESS Ordered list successfully created. -**/ -EFI_STATUS -EFIAPI -CreateOrderedList ( - IN UINT16 QuestionId, - IN UINT8 MaxEntries, - IN CHAR16 *Prompt, - IN CHAR16 *Help, - IN IFR_OPTION *OptionsList, - IN UINTN OptionCount, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ); - -/** - Create a checkbox - - @param QuestionId Question ID of the check box - @param DataWidth DataWidth of the check box - @param Prompt Prompt of the check box - @param Help Help of the check box - @param Flags Flags of the check box - @param FormBuffer The form where this check box adds to - @param StringBuffer String buffer created for Prompt and Help. - - @retval EFI_DEVICE_ERROR DataWidth > 1 - @retval EFI_SUCCESS Check box successfully created -**/ -EFI_STATUS -EFIAPI -CreateCheckBox ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN CHAR16 *Prompt, - IN CHAR16 *Help, - IN UINT8 Flags, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ); - -/** - Create a numeric - - @param QuestionId Question ID of the numeric - @param DataWidth DataWidth of the numeric - @param Prompt Prompt of the numeric - @param Help Help of the numeric - @param Minimum Minumun boundary of the numeric - @param Maximum Maximum boundary of the numeric - @param Step Step of the numeric - @param Default Default value - @param Flags Flags of the numeric - @param Key Key of the numeric - @param FormBuffer The form where this numeric adds to - @param StringBuffer String buffer created for Prompt and Help. - - @retval EFI_DEVICE_ERROR DataWidth > 2 - @retval EFI_SUCCESS Numeric is successfully created -**/ -EFI_STATUS -EFIAPI -CreateNumeric ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN CHAR16 *Prompt, - IN CHAR16 *Help, - IN UINT16 Minimum, - IN UINT16 Maximum, - IN UINT16 Step, - IN UINT16 Default, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ); - -/** - Create a string. - - @param QuestionId Question ID of the string - @param DataWidth DataWidth of the string - @param Prompt Prompt of the string - @param Help Help of the string - @param MinSize Min size boundary of the string - @param MaxSize Max size boundary of the string - @param Flags Flags of the string - @param Key Key of the string - @param FormBuffer The form where this string adds to - @param StringBuffer String buffer created for Prompt and Help. - @retval EFI_SUCCESS String successfully created. -**/ -EFI_STATUS -EFIAPI -CreateString ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN CHAR16 *Prompt, - IN CHAR16 *Help, - IN UINT8 MinSize, - IN UINT8 MaxSize, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ); - -/** - Extract information pertaining to the HiiHandle. - - @param HiiHandle Hii handle - @param ImageLength For input, length of DefaultImage; - For output, length of actually required - @param DefaultImage Image buffer prepared by caller - @param Guid Guid information about the form - - @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate - @retval EFI_BUFFER_TOO_SMALL DefualtImage has no enough ImageLength - @retval EFI_SUCCESS Successfully extract data from Hii database. -**/ -EFI_STATUS -EFIAPI -ExtractDataFromHiiHandle ( - IN FRAMEWORK_EFI_HII_HANDLE HiiHandle, - IN OUT UINT16 *ImageLength, - OUT UINT8 *DefaultImage, - OUT EFI_GUID *Guid - ); - -/** - Finds HII handle for given pack GUID previously registered with the HII. - - @param HiiProtocol pointer to pointer to HII protocol interface. - If NULL, the interface will be found but not returned. - If it points to NULL, the interface will be found and - written back to the pointer that is pointed to. - @param Guid The GUID of the pack that registered with the HII. - - @return Handle to the HII pack previously registered by the memory driver. -**/ -FRAMEWORK_EFI_HII_HANDLE -EFIAPI -FindHiiHandle ( - IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL - IN EFI_GUID *Guid - ); - -/** - Create a SubTitle opcode independent of string creation - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - @param StringToken StringToken of the subtitle - @param FormBuffer Output of subtitle as a form - - @retval EFI_SUCCESS Subtitle created to be a form -**/ -EFI_STATUS -EFIAPI -CreateSubTitleOpCode ( - IN STRING_REF StringToken, - IN OUT VOID *FormBuffer - ); - -/** - Create a Text opcode independent of string creation. - - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - @param StringToken First string token of the text - @param StringTokenTwo Second string token of the text - @param StringTokenThree Help string token of the text - @param Flags Flag of the text - @param Key Key of the text - @param FormBuffer Output of text as a form - - @retval EFI_SUCCESS Text created to be a form -**/ -EFI_STATUS -EFIAPI -CreateTextOpCode ( - IN STRING_REF StringToken, - IN STRING_REF StringTokenTwo, - IN STRING_REF StringTokenThree, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer - ); - -/** - Create a hyperlink opcode independent of string creation. - - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - - @param FormId Form ID of the hyperlink - @param StringToken Prompt string token of the hyperlink - @param StringTokenTwo Help string token of the hyperlink - @param Flags Flags of the hyperlink - @param Key Key of the hyperlink - @param FormBuffer Output of hyperlink as a form - @retval EFI_SUCCESS Hyperlink created to be a form -**/ -EFI_STATUS -EFIAPI -CreateGotoOpCode ( - IN UINT16 FormId, - IN STRING_REF StringToken, - IN STRING_REF StringTokenTwo, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer - ); - -/** - Create a one-of opcode with a set of option op-codes to choose from independent of string creation. - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken - has been filled in since this routine will not generate StringToken values. - - @param QuestionId Question ID of the one-of box - @param DataWidth DataWidth of the one-of box - @param PromptToken Prompt string token of the one-of box - @param HelpToken Help string token of the one-of box - @param OptionsList Each string in it is an option of the one-of box - @param OptionCount Option string count - @param FormBuffer Output of One-Of box as a form - - - @retval EFI_SUCCESS One-Of box created to be a form - @retval EFI_DEVICE_ERROR DataWidth > 2 -**/ -EFI_STATUS -EFIAPI -CreateOneOfOpCode ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN STRING_REF PromptToken, - IN STRING_REF HelpToken, - IN IFR_OPTION *OptionsList, - IN UINTN OptionCount, - IN OUT VOID *FormBuffer - ); - -/** - Create a ordered list opcode with a set of option op-codes to choose from independent of string creation. - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken - has been filled in since this routine will not generate StringToken values. - - @param QuestionId Question ID of the ordered list - @param MaxEntries MaxEntries of the ordered list - @param PromptToken Prompt string token of the ordered list - @param HelpToken Help string token of the ordered list - @param OptionsList Each string in it is an option of the ordered list - @param OptionCount Option string count - @param FormBuffer Output of ordered list as a form - - @retval EFI_SUCCESS Ordered list created to be a form -**/ -EFI_STATUS -EFIAPI -CreateOrderedListOpCode ( - IN UINT16 QuestionId, - IN UINT8 MaxEntries, - IN STRING_REF PromptToken, - IN STRING_REF HelpToken, - IN IFR_OPTION *OptionsList, - IN UINTN OptionCount, - IN OUT VOID *FormBuffer - ); - -/** - Create a checkbox opcode independent of string creation - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - @param QuestionId Question ID of the check box - @param DataWidth DataWidth of the check box - @param PromptToken Prompt string token of the check box - @param HelpToken Help string token of the check box - @param Flags Flags of the check box - @param Key Key of the check box - @param FormBuffer Output of the check box as a form - - @retval EFI_SUCCESS Checkbox created to be a form - @retval EFI_DEVICE_ERROR DataWidth > 1 -**/ -EFI_STATUS -EFIAPI -CreateCheckBoxOpCode ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN STRING_REF PromptToken, - IN STRING_REF HelpToken, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer - ); - -/** - Create a numeric opcode independent of string creation. - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - @param QuestionId Question ID of the numeric - @param DataWidth DataWidth of the numeric - @param PromptToken Prompt string token of the numeric - @param HelpToken Help string token of the numeric - @param Minimum Minumun boundary of the numeric - @param Maximum Maximum boundary of the numeric - @param Step Step of the numeric - @param Default Default value of the numeric - @param Flags Flags of the numeric - @param Key Key of the numeric - @param FormBuffer Output of the numeric as a form - - - @retval EFI_SUCCESS The numeric created to be a form. - @retval EFI_DEVICE_ERROR DataWidth > 2 -**/ -EFI_STATUS -EFIAPI -CreateNumericOpCode ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN STRING_REF PromptToken, - IN STRING_REF HelpToken, - IN UINT16 Minimum, - IN UINT16 Maximum, - IN UINT16 Step, - IN UINT16 Default, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer - ); - -/** - Create a numeric opcode independent of string creation - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - @param QuestionId Question ID of the string - @param DataWidth DataWidth of the string - @param PromptToken Prompt token of the string - @param HelpToken Help token of the string - @param MinSize Min size boundary of the string - @param MaxSize Max size boundary of the string - @param Flags Flags of the string - @param Key Key of the string - @param FormBuffer Output of the string as a form - - @retval EFI_SUCCESS String created to be a form. -**/ -EFI_STATUS -EFIAPI -CreateStringOpCode ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN STRING_REF PromptToken, - IN STRING_REF HelpToken, - IN UINT8 MinSize, - IN UINT8 MaxSize, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer - ); - -/** - Validate that the data associated with the HiiHandle in NVRAM is within - the reasonable parameters for that FormSet. Values for strings and passwords - are not verified due to their not having the equivalent of valid range settings. - - @param HiiHandle Handle of the HII database entry to query - - @param Results If return Status is EFI_SUCCESS, Results provides valid data - TRUE = NVRAM Data is within parameters - FALSE = NVRAM Data is NOT within parameters - @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate - @retval EFI_SUCCESS Data successfully validated -**/ -EFI_STATUS -EFIAPI -ValidateDataFromHiiHandle ( - IN FRAMEWORK_EFI_HII_HANDLE HiiHandle, - OUT BOOLEAN *Results - ); - -/** - Create a banner opcode. This is primarily used by the FrontPage implementation from BDS. - - @param Title Title of the banner - @param LineNumber LineNumber of the banner - @param Alignment Alignment of the banner - @param FormBuffer Output of banner as a form - - @retval EFI_SUCCESS Banner created to be a form. -**/ -EFI_STATUS -EFIAPI -CreateBannerOpCode ( - IN UINT16 Title, - IN UINT16 LineNumber, - IN UINT8 Alignment, - IN OUT VOID *FormBuffer - ); - -/** - Extracts a variable form a Pack. - - @param Pack List of variables - @param Name Name of the variable/map - @param Guid GUID of the variable/map - @param Id The index of the variable/map to retrieve - @param Var Pointer to the variable/map - @param Size Size of the variable/map in bytes -**/ -VOID -EFIAPI -EfiLibHiiVariablePackGetMap ( - IN EFI_HII_VARIABLE_PACK *Pack, - OUT CHAR16 **Name, OPTIONAL - OUT EFI_GUID **Guid, OPTIONAL - OUT UINT16 *Id, OPTIONAL - OUT VOID **Var, OPTIONAL - OUT UINTN *Size OPTIONAL - ); - -/** - Finds a count of the variables/maps in the List. - - @param List List of variables - - @return The number of map count. -**/ -UINTN -EFIAPI -EfiLibHiiVariablePackListGetMapCnt ( - IN EFI_HII_VARIABLE_PACK_LIST *List - ); - -/** - type definition for the callback to be - used with EfiLibHiiVariablePackListForEachVar(). - - @param Id Variable/Map ID - @param Name Name of the variable/map - @param Guid GUID of the variable/map - @param Var Pointer to the variable/map - @param Size Size of the variable/map in bytes -**/ -typedef VOID (EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK) ( - IN CHAR16 *Name, - IN EFI_GUID *Guid, - IN UINT16 Id, - IN VOID *Var, - IN UINTN Size - ); - -/** - Will iterate all variable/maps as appearing - in List and for each, it will call the Callback. - - @param List List of variables - @param Callback Routine to be called for each iterated variable. -**/ -VOID -EFIAPI -EfiLibHiiVariablePackListForEachVar ( - IN EFI_HII_VARIABLE_PACK_LIST *List, - IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback - ); - -/** - Finds a variable form List given - the order number as appears in the List. - - @param Idx The index of the variable/map to retrieve - @param List List of variables - @param Name Name of the variable/map - @param Guid GUID of the variable/map - @param Id Id of the variable/map - @param Var Pointer to the variable/map - @param Size Size of the variable/map in bytes - - @return EFI_SUCCESS Variable is found, OUT parameters are valid - @return EFI_NOT_FOUND Variable is not found, OUT parameters are not valid -**/ -EFI_STATUS -EFIAPI -EfiLibHiiVariablePackListGetMapByIdx ( - IN UINTN Idx, - IN EFI_HII_VARIABLE_PACK_LIST *List, - OUT CHAR16 **Name, OPTIONAL - OUT EFI_GUID **Guid, OPTIONAL - OUT UINT16 *Id, OPTIONAL - OUT VOID **Var, - OUT UINTN *Size - ); - -/** - Finds a variable form List given the - order number as appears in the List. - - @param Id The ID of the variable/map to retrieve - @param List List of variables - @param Name Name of the variable/map - @param Guid GUID of the variable/map - @param Var Pointer to the variable/map - @param Size Size of the variable/map in bytes - - @retval EFI_SUCCESS Variable is found, OUT parameters are valid - @retval EFI_NOT_FOUND Variable is not found, OUT parameters are not valid -**/ -EFI_STATUS -EFIAPI -EfiLibHiiVariablePackListGetMapById ( - IN UINT16 Id, - IN EFI_HII_VARIABLE_PACK_LIST *List, - OUT CHAR16 **Name, OPTIONAL - OUT EFI_GUID **Guid, OPTIONAL - OUT VOID **Var, - OUT UINTN *Size - ); - -/** - Finds a variable form EFI_HII_VARIABLE_PACK_LIST given name and GUID. - - @param List List of variables - @param Name Name of the variable/map to be found - @param Guid GUID of the variable/map to be found - @param Id Id of the variable/map to be found - @param Var Pointer to the variable/map found - @param Size Size of the variable/map in bytes found - - @retval EFI_SUCCESS variable is found, OUT parameters are valid - @retval EFI_NOT_FOUND variable is not found, OUT parameters are not valid -**/ -EFI_STATUS -EFIAPI -EfiLibHiiVariablePackListGetMap ( - IN EFI_HII_VARIABLE_PACK_LIST *List, - IN CHAR16 *Name, - IN EFI_GUID *Guid, - OUT UINT16 *Id, - OUT VOID **Var, - OUT UINTN *Size - ); - -/** - Finds out if a variable of specific Name/Guid/Size exists in NV. - If it does, it will retrieve it into the Var. - - @param Name Parameters of the variable to retrieve. Must match exactly. - @param Guid Parameters of the variable to retrieve. Must match exactly. - @param Size Parameters of the variable to retrieve. Must match exactly. - @param Var Variable will be retrieved into buffer pointed by this pointer. - If pointing to NULL, the buffer will be allocated. Caller is responsible for releasing the buffer. - - @retval EFI_SUCCESS The variable of exact Name/Guid/Size parameters was retrieved and written to Var. - @retval EFI_NOT_FOUND The variable of this Name/Guid was not found in the NV. - @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error. -**/ -EFI_STATUS -EFIAPI -EfiLibHiiVariableRetrieveFromNv ( - IN CHAR16 *Name, - IN EFI_GUID *Guid, - IN UINTN Size, - OUT VOID **Var - ); - -/** - Overrrides the variable with NV data if found. - But it only does it if the Name ends with specified Suffix. - For example, if Suffix="MyOverride" and the Name="XyzSetupMyOverride", - the Suffix matches the end of Name, so the variable will be loaded from NV - provided the variable exists and the GUID and Size matches. - - @param Suffix Suffix the Name should end with. - @param Name Name of the variable to retrieve. - @param Guid Guid of the variable to retrieve. - @param Size Parameters of the variable to retrieve. - @param Var Variable will be retrieved into this buffer. - Caller is responsible for providing storage of exactly Size size in bytes. - - @retval EFI_SUCCESS The variable was overriden with NV variable of same Name/Guid/Size. - @retval EFI_INVALID_PARAMETER The name of the variable does not end with . - @retval EFI_NOT_FOUND The variable of this Name/Guid was not found in the NV. - @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error. -**/ -EFI_STATUS -EFIAPI -EfiLibHiiVariableOverrideIfSuffix ( - IN CHAR16 *Suffix, - IN CHAR16 *Name, - IN EFI_GUID *Guid, - IN UINTN Size, - OUT VOID *Var - ); - -/** - Overrrides the variable with NV data if found. - But it only does it if the NV contains the same variable with Name is appended with Suffix. - For example, if Suffix="MyOverride" and the Name="XyzSetup", - the Suffix will be appended to the end of Name, and the variable with Name="XyzSetupMyOverride" - will be loaded from NV provided the variable exists and the GUID and Size matches. - - @param Suffix Suffix the variable will be appended with. - @param Name Parameters of the Name variable to retrieve. - @param Guid Parameters of the Guid variable to retrieve. - @param Size Parameters of the Size variable to retrieve. - @param Var Variable will be retrieved into this buffer. - Caller is responsible for providing storage of exactly Size size in bytes. - - @retval EFI_SUCCESS The variable was overriden with NV variable of same Name/Guid/Size. - @retval EFI_NOT_FOUND The variable of this Name/Guid was not found in the NV. - @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error. -**/ -EFI_STATUS -EFIAPI -EfiLibHiiVariableOverrideBySuffix ( - IN CHAR16 *Suffix, - IN CHAR16 *Name, - IN EFI_GUID *Guid, - IN UINTN Size, - OUT VOID *Var - ); - -#endif diff --git a/IntelFrameworkPkg/IntelFrameworkPkg.dec b/IntelFrameworkPkg/IntelFrameworkPkg.dec index 81af5e8ec8..6e6da728c8 100644 --- a/IntelFrameworkPkg/IntelFrameworkPkg.dec +++ b/IntelFrameworkPkg/IntelFrameworkPkg.dec @@ -24,7 +24,6 @@ Include # Root include for the package [LibraryClasses.common] - FrameworkIfrSupportLib|Include/Library/FrameworkIfrSupportLib.h SmmLib|Include/Library/SmmLib.h [Guids.common] diff --git a/IntelFrameworkPkg/IntelFrameworkPkg.dsc b/IntelFrameworkPkg/IntelFrameworkPkg.dsc index 8407938d81..e96d666f9c 100644 --- a/IntelFrameworkPkg/IntelFrameworkPkg.dsc +++ b/IntelFrameworkPkg/IntelFrameworkPkg.dsc @@ -73,8 +73,6 @@ IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.inf IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUefiLib.inf IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DxeSmmDriverEntryPoint.inf - IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrSupportLib.inf IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/PeiSmbusLibSmbusPpi.inf - IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.inf IntelFrameworkPkg/Library/PeiHobLibFramework/PeiHobLibFramework.inf diff --git a/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrCommon.c b/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrCommon.c deleted file mode 100644 index a13a3525f1..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrCommon.c +++ /dev/null @@ -1,922 +0,0 @@ -/** @file - Common Library Routines to assist in IFR creation on-the-fly - -Copyright (c) 2006, Intel Corporation -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. - -**/ - -#include "IfrSupportLibInternal.h" - -/** - Determine what is the current language setting - The setting is stored in language variable in flash. This routine - will get setting by accesssing that variable. If failed to access - language variable, then use default setting that 'eng' as current - language setting. - - @param Lang Pointer of system language - - @return whether sucess to get setting from variable -**/ -EFI_STATUS -EFIAPI -GetCurrentLanguage ( - OUT CHAR16 *Lang - ) -{ - EFI_STATUS Status; - UINTN Size; - UINTN Index; - CHAR8 Language[4]; - - // - // Getting the system language and placing it into our Global Data - // - Size = sizeof (Language); - Status = gRT->GetVariable ( - (CHAR16 *) L"Lang", - &gEfiGlobalVariableGuid, - NULL, - &Size, - Language - ); - if (EFI_ERROR (Status)) { - AsciiStrCpy (Language, "eng"); - } - - for (Index = 0; Index < 3; Index++) { - // - // Bitwise AND ascii value with 0xDF yields an uppercase value. - // Sign extend into a unicode value - // - Lang[Index] = (CHAR16) (Language[Index] & 0xDF); - } - - // - // Null-terminate the value - // - Lang[3] = (CHAR16) 0; - - return Status; -} - -/** - Add a string to the incoming buffer and return the token and offset data. - - @param StringBuffer The incoming buffer - @param Language Currrent language - @param String The string to be added - @param StringToken The index where the string placed - - @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate - @retval EFI_SUCCESS String successfully added to the incoming buffer -**/ -EFI_STATUS -EFIAPI -AddString ( - IN VOID *StringBuffer, - IN CHAR16 *Language, - IN CHAR16 *String, - IN OUT STRING_REF *StringToken - ) -{ - EFI_HII_STRING_PACK *StringPack; - EFI_HII_STRING_PACK *StringPackBuffer; - VOID *NewBuffer; - RELOFST *PackSource; - RELOFST *PackDestination; - UINT8 *Source; - UINT8 *Destination; - UINTN Index; - BOOLEAN Finished; - UINTN SizeofLanguage; - UINTN SizeofString; - - StringPack = (EFI_HII_STRING_PACK *) StringBuffer; - Finished = FALSE; - - // - // Pre-allocate a buffer sufficient for us to work on. - // We will use it as a destination scratch pad to build data on - // and when complete shift the data back to the original buffer - // - NewBuffer = AllocateZeroPool (DEFAULT_STRING_BUFFER_SIZE); - if (NewBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - StringPackBuffer = (EFI_HII_STRING_PACK *) NewBuffer; - - // - // StringPack is terminated with a length 0 entry - // - for (; StringPack->Header.Length != 0;) { - // - // If this stringpack's language is same as CurrentLanguage, use it - // - if (CompareMem ((VOID *) ((CHAR8 *) (StringPack) + StringPack->LanguageNameString), Language, 3) == 0) { - // - // We have some data in this string pack, copy the string package up to the string data - // - CopyMem (&StringPackBuffer->Header, &StringPack->Header, sizeof (StringPack)); - - // - // These are references in the structure to tokens, need to increase them by the space occupied by an additional StringPointer - // - StringPackBuffer->LanguageNameString = (UINT16) (StringPackBuffer->LanguageNameString + (UINT16) sizeof (RELOFST)); - StringPackBuffer->PrintableLanguageName = (UINT16) (StringPackBuffer->PrintableLanguageName + (UINT16) sizeof (RELOFST)); - - PackSource = (RELOFST *) (StringPack + 1); - PackDestination = (RELOFST *) (StringPackBuffer + 1); - for (Index = 0; PackSource[Index] != 0x0000; Index++) { - // - // Copy the stringpointers from old to new buffer - // remember that we are adding a string, so the string offsets will all go up by sizeof (RELOFST) - // - PackDestination[Index] = (UINT16) (PackDestination[Index] + sizeof (RELOFST)); - } - - // - // Add a new stringpointer in the new buffer since we are adding a string. Null terminate it - // - PackDestination[Index] = (UINT16)(PackDestination[Index - 1] + - StrSize((CHAR16 *)((CHAR8 *)(StringPack) + PackSource[Index - 1]))); - PackDestination[Index + 1] = (UINT16) 0; - - // - // Index is the token value for the new string - // - *StringToken = (UINT16) Index; - - // - // Source now points to the beginning of the old buffer strings - // Destination now points to the beginning of the new buffer strings - // - Source = (UINT8 *) &PackSource[Index + 1]; - Destination = (UINT8 *) &PackDestination[Index + 2]; - - // - // This should copy all the strings from the old buffer to the new buffer - // - for (; Index != 0; Index--) { - // - // Copy Source string to destination buffer - // - StrCpy ((CHAR16 *) Destination, (CHAR16 *) Source); - - // - // Adjust the source/destination to the next string location - // - Destination = Destination + StrSize ((CHAR16 *) Source); - Source = Source + StrSize ((CHAR16 *) Source); - } - - // - // This copies the new string to the destination buffer - // - StrCpy ((CHAR16 *) Destination, (CHAR16 *) String); - - // - // Adjust the size of the changed string pack by adding the size of the new string - // along with the size of the additional offset entry for the new string - // - StringPackBuffer->Header.Length = (UINT32) ((UINTN) StringPackBuffer->Header.Length + StrSize (String) + sizeof (RELOFST)); - - // - // Advance the buffers to point to the next spots. - // - StringPackBuffer = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPackBuffer) + StringPackBuffer->Header.Length); - StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + StringPack->Header.Length); - Finished = TRUE; - continue; - } - // - // This isn't the language of the stringpack we were asked to add a string to - // so we need to copy it to the new buffer. - // - CopyMem (&StringPackBuffer->Header, &StringPack->Header, StringPack->Header.Length); - - // - // Advance the buffers to point to the next spots. - // - StringPackBuffer = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPackBuffer) + StringPack->Header.Length); - StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + StringPack->Header.Length); - } - - // - // If we didn't copy the new data to a stringpack yet - // - if (!Finished) { - PackDestination = (RELOFST *) (StringPackBuffer + 1); - // - // Pointing to a new string pack location - // - SizeofLanguage = StrSize (Language); - SizeofString = StrSize (String); - StringPackBuffer->Header.Length = (UINT32) - ( - sizeof (EFI_HII_STRING_PACK) - - sizeof (EFI_STRING) + - sizeof (RELOFST) + - sizeof (RELOFST) + - SizeofLanguage + - SizeofString - ); - StringPackBuffer->Header.Type = EFI_HII_STRING; - StringPackBuffer->LanguageNameString = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer); - StringPackBuffer->PrintableLanguageName = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer); - StringPackBuffer->Attributes = 0; - PackDestination[0] = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer); - PackDestination[1] = (UINT16) (PackDestination[0] + StrSize (Language)); - PackDestination[2] = (UINT16) 0; - - // - // The first string location will be set to destination. The minimum number of strings - // associated with a stringpack will always be token 0 stored as the languagename (e.g. ENG, SPA, etc) - // and token 1 as the new string being added and and null entry for the stringpointers - // - Destination = (UINT8 *) &PackDestination[3]; - - // - // Copy the language name string to the new buffer - // - StrCpy ((CHAR16 *) Destination, Language); - - // - // Advance the destination to the new empty spot - // - Destination = Destination + StrSize (Language); - - // - // Copy the string to the new buffer - // - StrCpy ((CHAR16 *) Destination, String); - - // - // Since we are starting with a new string pack - we know the new string is token 1 - // - *StringToken = (UINT16) 1; - } - - // - // Zero out the original buffer and copy the updated data in the new buffer to the old buffer - // - ZeroMem (StringBuffer, DEFAULT_STRING_BUFFER_SIZE); - CopyMem (StringBuffer, NewBuffer, DEFAULT_STRING_BUFFER_SIZE); - - // - // Free the newly created buffer since we don't need it anymore - // - FreePool (NewBuffer); - return EFI_SUCCESS; -} - -/** - Add op-code data to the FormBuffer. - - @param FormBuffer Form buffer to be inserted to - @param OpCodeData Op-code data to be inserted - - @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate - @retval EFI_SUCCESS Op-code data successfully inserted -**/ -EFI_STATUS -EFIAPI -AddOpCode ( - IN VOID *FormBuffer, - IN OUT VOID *OpCodeData - ) -{ - EFI_HII_PACK_HEADER *NewBuffer; - UINT8 *Source; - UINT8 *Destination; - - // - // Pre-allocate a buffer sufficient for us to work on. - // We will use it as a destination scratch pad to build data on - // and when complete shift the data back to the original buffer - // - NewBuffer = AllocateZeroPool (DEFAULT_FORM_BUFFER_SIZE); - if (NewBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Copy the IFR Package header to the new buffer - // - Source = (UINT8 *) FormBuffer; - Destination = (UINT8 *) NewBuffer; - CopyMem (Destination, Source, sizeof (EFI_HII_PACK_HEADER)); - - // - // Advance Source and Destination to next op-code - // - Source = Source + sizeof (EFI_HII_PACK_HEADER); - Destination = Destination + sizeof (EFI_HII_PACK_HEADER); - - // - // Copy data to the new buffer until we run into the end_form - // - for (; ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->OpCode != FRAMEWORK_EFI_IFR_END_FORM_OP;) { - // - // If the opcode is an end_form_set we better be creating and endform - // Nonetheless, we will add data before the end_form_set. This also provides - // for interesting behavior in the code we will run, but has no bad side-effects - // since we will possibly do a 0 byte copy in this particular end-case. - // - if (((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->OpCode == FRAMEWORK_EFI_IFR_END_FORM_SET_OP) { - break; - } - - // - // Copy data to new buffer - // - CopyMem (Destination, Source, ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length); - - // - // Adjust Source/Destination to next op-code location - // - Destination = Destination + (UINTN) ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length; - Source = Source + (UINTN) ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length; - } - - // - // Prior to the end_form is where we insert the new op-code data - // - CopyMem (Destination, OpCodeData, ((FRAMEWORK_EFI_IFR_OP_HEADER *) OpCodeData)->Length); - - Destination = Destination + (UINTN) ((FRAMEWORK_EFI_IFR_OP_HEADER *) OpCodeData)->Length; - NewBuffer->Length = (UINT32) (NewBuffer->Length + (UINT32) (((FRAMEWORK_EFI_IFR_OP_HEADER *) OpCodeData)->Length)); - - // - // Copy end-form data to new buffer - // - CopyMem (Destination, Source, ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length); - - // - // Copy end-formset data to new buffer - // - Destination = Destination + (UINTN) ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length; - Source = Source + (UINTN) ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length; - CopyMem (Destination, Source, ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length); - - // - // Zero out the original buffer and copy the updated data in the new buffer to the old buffer - // - ZeroMem (FormBuffer, DEFAULT_FORM_BUFFER_SIZE); - CopyMem (FormBuffer, NewBuffer, DEFAULT_FORM_BUFFER_SIZE); - - // - // Free the newly created buffer since we don't need it anymore - // - FreePool (NewBuffer); - return EFI_SUCCESS; -} - -/** - Get the HII protocol interface. - - @param Hii HII protocol interface - - @return the statue of locating HII protocol -**/ -EFI_STATUS -EFIAPI -GetHiiInterface ( - OUT EFI_HII_PROTOCOL **Hii - ) -{ - EFI_STATUS Status; - - // - // There should only be one HII protocol - // - Status = gBS->LocateProtocol ( - &gEfiHiiProtocolGuid, - NULL, - (VOID **) Hii - ); - - return Status;; -} - -/** - Extract information pertaining to the HiiHandle. - - @param HiiHandle Hii handle - @param ImageLength For input, length of DefaultImage; - For output, length of actually required - @param DefaultImage Image buffer prepared by caller - @param Guid Guid information about the form - - @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate - @retval EFI_BUFFER_TOO_SMALL DefualtImage has no enough ImageLength - @retval EFI_SUCCESS Successfully extract data from Hii database. -**/ -EFI_STATUS -EFIAPI -ExtractDataFromHiiHandle ( - IN FRAMEWORK_EFI_HII_HANDLE HiiHandle, - IN OUT UINT16 *ImageLength, - OUT UINT8 *DefaultImage, - OUT EFI_GUID *Guid - ) -{ - EFI_STATUS Status; - EFI_HII_PROTOCOL *Hii; - UINTN DataLength; - UINT8 *RawData; - UINT8 *OldData; - UINTN Index; - UINTN Temp; - UINTN SizeOfNvStore; - UINTN CachedStart; - - DataLength = DEFAULT_FORM_BUFFER_SIZE; - SizeOfNvStore = 0; - CachedStart = 0; - - if (DefaultImage == NULL || Guid == NULL) { - return EFI_INVALID_PARAMETER; - } - - Status = GetHiiInterface (&Hii); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Allocate space for retrieval of IFR data - // - RawData = AllocateZeroPool (DataLength); - if (RawData == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Get all the forms associated with this HiiHandle - // - Status = Hii->GetForms (Hii, HiiHandle, 0, &DataLength, RawData); - if (EFI_ERROR (Status)) { - FreePool (RawData); - - // - // Allocate space for retrieval of IFR data - // - RawData = AllocateZeroPool (DataLength); - if (RawData == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Get all the forms associated with this HiiHandle - // - Status = Hii->GetForms (Hii, HiiHandle, 0, &DataLength, RawData); - } - - OldData = RawData; - - // - // Point RawData to the beginning of the form data - // - RawData = (UINT8 *) ((UINTN) RawData + sizeof (EFI_HII_PACK_HEADER)); - - for (Index = 0; RawData[Index] != FRAMEWORK_EFI_IFR_END_FORM_SET_OP;) { - switch (RawData[Index]) { - - case FRAMEWORK_EFI_IFR_FORM_SET_OP: - // - // Copy the GUID information from this handle - // - CopyGuid (Guid, (GUID *)(VOID *)&((FRAMEWORK_EFI_IFR_FORM_SET *) &RawData[Index])->Guid); - break; - - case FRAMEWORK_EFI_IFR_ONE_OF_OP: - case FRAMEWORK_EFI_IFR_CHECKBOX_OP: - case FRAMEWORK_EFI_IFR_NUMERIC_OP: - case FRAMEWORK_EFI_IFR_DATE_OP: - case FRAMEWORK_EFI_IFR_TIME_OP: - case FRAMEWORK_EFI_IFR_PASSWORD_OP: - case FRAMEWORK_EFI_IFR_STRING_OP: - // - // Remember, multiple op-codes may reference the same item, so let's keep a running - // marker of what the highest QuestionId that wasn't zero length. This will accurately - // maintain the Size of the NvStore - // - if (((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->Width != 0) { - Temp = ((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->Width; - if (SizeOfNvStore < Temp) { - SizeOfNvStore = ((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->Width; - } - } - } - - Index = RawData[Index + 1] + Index; - } - - // - // Return an error if buffer is too small - // - if (SizeOfNvStore > *ImageLength) { - FreePool (OldData); - *ImageLength = (UINT16) SizeOfNvStore; - return EFI_BUFFER_TOO_SMALL; - } - - if (DefaultImage != NULL) { - ZeroMem (DefaultImage, SizeOfNvStore); - } - - // - // Copy the default image information to the user's buffer - // - for (Index = 0; RawData[Index] != FRAMEWORK_EFI_IFR_END_FORM_SET_OP;) { - switch (RawData[Index]) { - - case FRAMEWORK_EFI_IFR_ONE_OF_OP: - CachedStart = ((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId; - break; - - case FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP: - if (((FRAMEWORK_EFI_IFR_ONE_OF_OPTION *) &RawData[Index])->Flags & FRAMEWORK_EFI_IFR_FLAG_DEFAULT) { - CopyMem (&DefaultImage[CachedStart], &((FRAMEWORK_EFI_IFR_ONE_OF_OPTION *) &RawData[Index])->Value, 2); - } - break; - - case FRAMEWORK_EFI_IFR_CHECKBOX_OP: - DefaultImage[((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId] = ((FRAMEWORK_EFI_IFR_CHECKBOX *) &RawData[Index])->Flags; - break; - - case FRAMEWORK_EFI_IFR_NUMERIC_OP: - CopyMem ( - &DefaultImage[((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId], - &((FRAMEWORK_EFI_IFR_NUMERIC *) &RawData[Index])->Default, - 2 - ); - break; - - } - - Index = RawData[Index + 1] + Index; - } - - *ImageLength = (UINT16) SizeOfNvStore; - - // - // Free our temporary repository of form data - // - FreePool (OldData); - - return EFI_SUCCESS; -} - -/** - Finds HII handle for given pack GUID previously registered with the HII. - - @param HiiProtocol pointer to pointer to HII protocol interface. - If NULL, the interface will be found but not returned. - If it points to NULL, the interface will be found and - written back to the pointer that is pointed to. - @param Guid The GUID of the pack that registered with the HII. - - @return Handle to the HII pack previously registered by the memory driver. -**/ -FRAMEWORK_EFI_HII_HANDLE -EFIAPI -FindHiiHandle ( - IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL - IN EFI_GUID *Guid - ) -{ - EFI_STATUS Status; - FRAMEWORK_EFI_HII_HANDLE *HiiHandleBuffer; - FRAMEWORK_EFI_HII_HANDLE HiiHandle; - UINT16 HiiHandleBufferLength; - UINT32 NumberOfHiiHandles; - EFI_GUID HiiGuid; - EFI_HII_PROTOCOL *HiiProt; - UINT32 Index; - UINT16 Length; - - HiiHandle = 0; - if ((HiiProtocol != NULL) && (*HiiProtocol != NULL)) { - // - // The protocol has been passed in - // - HiiProt = *HiiProtocol; - } else { - gBS->LocateProtocol ( - &gEfiHiiProtocolGuid, - NULL, - (VOID **) &HiiProt - ); - if (HiiProt == NULL) { - return HiiHandle; - } - - if (HiiProtocol != NULL) { - // - // Return back the HII protocol for the caller as promissed - // - *HiiProtocol = HiiProt; - } - } - // - // Allocate buffer - // - HiiHandleBufferLength = 10; - HiiHandleBuffer = AllocatePool (HiiHandleBufferLength); - ASSERT (HiiHandleBuffer != NULL); - - // - // Get the Handles of the packages that were registered with Hii - // - Status = HiiProt->FindHandles ( - HiiProt, - &HiiHandleBufferLength, - HiiHandleBuffer - ); - - // - // Get a bigger bugffer if this one is to small, and try again - // - if (Status == EFI_BUFFER_TOO_SMALL) { - - FreePool (HiiHandleBuffer); - - HiiHandleBuffer = AllocatePool (HiiHandleBufferLength); - ASSERT (HiiHandleBuffer != NULL); - - Status = HiiProt->FindHandles ( - HiiProt, - &HiiHandleBufferLength, - HiiHandleBuffer - ); - } - - if (EFI_ERROR (Status)) { - goto lbl_exit; - } - - NumberOfHiiHandles = HiiHandleBufferLength / sizeof (FRAMEWORK_EFI_HII_HANDLE ); - - // - // Iterate Hii handles and look for the one that matches our Guid - // - for (Index = 0; Index < NumberOfHiiHandles; Index++) { - - Length = 0; - ExtractDataFromHiiHandle (HiiHandleBuffer[Index], &Length, NULL, &HiiGuid); - - if (CompareGuid (&HiiGuid, Guid)) { - HiiHandle = HiiHandleBuffer[Index]; - break; - } - } - -lbl_exit: - FreePool (HiiHandleBuffer); - return HiiHandle; -} - -/** - Validate that the data associated with the HiiHandle in NVRAM is within - the reasonable parameters for that FormSet. Values for strings and passwords - are not verified due to their not having the equivalent of valid range settings. - - @param HiiHandle Handle of the HII database entry to query - @param Results If return Status is EFI_SUCCESS, Results provides valid data - TRUE = NVRAM Data is within parameters - FALSE = NVRAM Data is NOT within parameters - - @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate - @retval EFI_SUCCESS Data successfully validated -**/ -EFI_STATUS -EFIAPI -ValidateDataFromHiiHandle ( - IN FRAMEWORK_EFI_HII_HANDLE HiiHandle, - OUT BOOLEAN *Results - ) -{ - EFI_STATUS Status; - EFI_HII_PROTOCOL *Hii; - EFI_GUID Guid; - UINT8 *RawData; - UINT8 *OldData; - UINTN RawDataLength; - UINT8 *VariableData; - UINTN Index; - UINTN Temp; - UINTN SizeOfNvStore; - UINTN CachedStart; - BOOLEAN GotMatch; - - RawDataLength = DEFAULT_FORM_BUFFER_SIZE; - SizeOfNvStore = 0; - CachedStart = 0; - GotMatch = FALSE; - *Results = TRUE; - - Status = GetHiiInterface (&Hii); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Allocate space for retrieval of IFR data - // - RawData = AllocateZeroPool (RawDataLength); - if (RawData == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Get all the forms associated with this HiiHandle - // - Status = Hii->GetForms (Hii, HiiHandle, 0, &RawDataLength, RawData); - if (EFI_ERROR (Status)) { - FreePool (RawData); - - // - // Allocate space for retrieval of IFR data - // - RawData = AllocateZeroPool (RawDataLength); - if (RawData == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Get all the forms associated with this HiiHandle - // - Status = Hii->GetForms (Hii, HiiHandle, 0, &RawDataLength, RawData); - } - - OldData = RawData; - - // - // Point RawData to the beginning of the form data - // - RawData = (UINT8 *) ((UINTN) RawData + sizeof (EFI_HII_PACK_HEADER)); - - for (Index = 0; RawData[Index] != FRAMEWORK_EFI_IFR_END_FORM_SET_OP;) { - if (RawData[Index] == FRAMEWORK_EFI_IFR_FORM_SET_OP) { - CopyGuid (&Guid, (GUID *)(VOID *)&((FRAMEWORK_EFI_IFR_FORM_SET *) &RawData[Index])->Guid); - break; - } - Index = RawData[Index + 1] + Index; - } - - for (Index = 0; RawData[Index] != FRAMEWORK_EFI_IFR_END_FORM_SET_OP;) { - switch (RawData[Index]) { - - case FRAMEWORK_EFI_IFR_FORM_SET_OP: - break; - - case FRAMEWORK_EFI_IFR_ONE_OF_OP: - case FRAMEWORK_EFI_IFR_CHECKBOX_OP: - case FRAMEWORK_EFI_IFR_NUMERIC_OP: - case FRAMEWORK_EFI_IFR_DATE_OP: - case FRAMEWORK_EFI_IFR_TIME_OP: - case FRAMEWORK_EFI_IFR_PASSWORD_OP: - case FRAMEWORK_EFI_IFR_STRING_OP: - // - // Remember, multiple op-codes may reference the same item, so let's keep a running - // marker of what the highest QuestionId that wasn't zero length. This will accurately - // maintain the Size of the NvStore - // - if (((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->Width != 0) { - Temp = ((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->Width; - if (SizeOfNvStore < Temp) { - SizeOfNvStore = ((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->Width; - } - } - } - - Index = RawData[Index + 1] + Index; - } - - // - // Allocate memory for our File Form Tags - // - VariableData = AllocateZeroPool (SizeOfNvStore); - if (VariableData == NULL) { - FreePool (OldData); - return EFI_OUT_OF_RESOURCES; - } - - Status = gRT->GetVariable ( - (CHAR16 *) L"Setup", - &Guid, - NULL, - &SizeOfNvStore, - (VOID *) VariableData - ); - - if (EFI_ERROR (Status)) { - - // - // If there is a variable that exists already and it is larger than what we calculated the - // storage needs to be, we must assume the variable size from GetVariable is correct and not - // allow the truncation of the variable. It is very possible that the user who created the IFR - // we are cracking is not referring to a variable that was in a previous map, however we cannot - // allow it's truncation. - // - if (Status == EFI_BUFFER_TOO_SMALL) { - // - // Free the buffer that was allocated that was too small - // - FreePool (VariableData); - - VariableData = AllocatePool (SizeOfNvStore); - if (VariableData == NULL) { - FreePool (OldData); - return EFI_OUT_OF_RESOURCES; - } - - Status = gRT->GetVariable ( - (CHAR16 *) L"Setup", - &Guid, - NULL, - &SizeOfNvStore, - (VOID *) VariableData - ); - } - } - - // - // Walk through the form and see that the variable data it refers to is ok. - // This allows for the possibility of stale (obsoleted) data in the variable - // can be overlooked without causing an error - // - for (Index = 0; RawData[Index] != FRAMEWORK_EFI_IFR_END_FORM_SET_OP;) { - switch (RawData[Index]) { - - case FRAMEWORK_EFI_IFR_ONE_OF_OP: - // - // A one_of has no data, its the option that does - cache the storage Id - // - CachedStart = ((FRAMEWORK_EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId; - break; - - case FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP: - // - // A one_of_option can be any value - // - if (VariableData[CachedStart] == ((FRAMEWORK_EFI_IFR_ONE_OF_OPTION *) &RawData[Index])->Value) { - GotMatch = TRUE; - } - break; - - case FRAMEWORK_EFI_IFR_END_ONE_OF_OP: - // - // At this point lets make sure that the data value in the NVRAM matches one of the options - // - if (!GotMatch) { - *Results = FALSE; - goto EXIT; - } - break; - - case FRAMEWORK_EFI_IFR_CHECKBOX_OP: - // - // A checkbox is a boolean, so 0 and 1 are valid - // Remember, QuestionId corresponds to the offset location of the data in the variable - // - if (VariableData[((FRAMEWORK_EFI_IFR_CHECKBOX *) &RawData[Index])->QuestionId] > 1) { - *Results = FALSE; - goto EXIT; - } - break; - - case FRAMEWORK_EFI_IFR_NUMERIC_OP: - if ((VariableData[((FRAMEWORK_EFI_IFR_NUMERIC *)&RawData[Index])->QuestionId] < ((FRAMEWORK_EFI_IFR_NUMERIC *)&RawData[Index])->Minimum) || - (VariableData[((FRAMEWORK_EFI_IFR_NUMERIC *)&RawData[Index])->QuestionId] > ((FRAMEWORK_EFI_IFR_NUMERIC *)&RawData[Index])->Maximum)) { - *Results = FALSE; - goto EXIT; - } - break; - - } - - Index = RawData[Index + 1] + Index; - } - -EXIT: - // - // Free our temporary repository of form data - // - FreePool (OldData); - FreePool (VariableData); - - return EFI_SUCCESS; -} - - diff --git a/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrOnTheFly.c b/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrOnTheFly.c deleted file mode 100644 index 99386adac0..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrOnTheFly.c +++ /dev/null @@ -1,751 +0,0 @@ -/** @file - Library Routines to create IFR on-the-fly - -Copyright (c) 2006, Intel Corporation -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. - -**/ - -#include "IfrSupportLibInternal.h" - -/** - Create a formset. - - The form package is a collection of forms that are intended to describe the pages that will be - displayed to the user. - - @param FormSetTitle Title of formset - @param Guid Guid of formset - @param Class Class of formset - @param SubClass Sub class of formset - @param FormBuffer Pointer of the formset created - @param StringBuffer Pointer of FormSetTitile string created - - @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate - @retval EFI_SUCCESS Formset successfully created -**/ -EFI_STATUS -EFIAPI -CreateFormSet ( - IN CHAR16 *FormSetTitle, - IN EFI_GUID *Guid, - IN UINT8 Class, - IN UINT8 SubClass, - IN OUT VOID **FormBuffer, - IN OUT VOID **StringBuffer - ) -{ - EFI_STATUS Status; - EFI_HII_IFR_PACK IfrPack; - FRAMEWORK_EFI_IFR_FORM_SET FormSet; - FRAMEWORK_EFI_IFR_END_FORM_SET EndFormSet; - UINT8 *Destination; - CHAR16 CurrentLanguage[4]; - STRING_REF StringToken; - - // - // Pre-allocate a buffer sufficient for us to work from. - // - FormBuffer = AllocateZeroPool (DEFAULT_FORM_BUFFER_SIZE); - if (FormBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Pre-allocate a buffer sufficient for us to work from. - // - StringBuffer = AllocateZeroPool (DEFAULT_STRING_BUFFER_SIZE); - if (StringBuffer == NULL) { - FreePool (FormBuffer); - return EFI_OUT_OF_RESOURCES; - } - - // - // Add FormSetTitle to the StringBuffer, get FormSetTitle's token - // - GetCurrentLanguage (CurrentLanguage); - Status = AddString (*StringBuffer, CurrentLanguage, FormSetTitle, &StringToken); - if (EFI_ERROR (Status)) { - FreePool (FormBuffer); - FreePool (StringBuffer); - return Status; - } - - // - // Initialize the Ifr Package header data - // - IfrPack.Header.Length = sizeof (EFI_HII_PACK_HEADER) + sizeof (FRAMEWORK_EFI_IFR_FORM_SET) + sizeof (FRAMEWORK_EFI_IFR_END_FORM_SET); - IfrPack.Header.Type = EFI_HII_IFR; - - // - // Initialize FormSet with the appropriate information - // - FormSet.Header.OpCode = FRAMEWORK_EFI_IFR_FORM_SET_OP; - FormSet.Header.Length = sizeof (FRAMEWORK_EFI_IFR_FORM_SET); - FormSet.FormSetTitle = StringToken; - FormSet.Class = Class; - FormSet.SubClass = SubClass; - CopyGuid ((GUID *)(VOID *)&FormSet.Guid, Guid); - - // - // Initialize the end formset data - // - EndFormSet.Header.Length = sizeof (FRAMEWORK_EFI_IFR_END_FORM_SET); - EndFormSet.Header.OpCode = FRAMEWORK_EFI_IFR_END_FORM_SET_OP; - - // - // Copy the formset/endformset data to the form buffer - // - Destination = (UINT8 *) *FormBuffer; - CopyMem (Destination, &IfrPack, sizeof (EFI_HII_PACK_HEADER)); - - Destination = Destination + sizeof (EFI_HII_PACK_HEADER); - CopyMem (Destination, &FormSet, sizeof (FRAMEWORK_EFI_IFR_FORM_SET)); - - Destination = Destination + sizeof (FRAMEWORK_EFI_IFR_FORM_SET); - CopyMem (Destination, &EndFormSet, sizeof (FRAMEWORK_EFI_IFR_END_FORM_SET)); - - return EFI_SUCCESS; -} - -/** - Create a form. - A form is the encapsulation of what amounts to a browser page. The header defines a FormId, - which is referenced by the form package, among others. It also defines a FormTitle, which is a - string to be used as the title for the form - - @param FormTitle Title of the form - @param FormId Id of the form - @param FormBuffer Pointer of the form created - @param StringBuffer Pointer of FormTitil string created - - @retval EFI_SUCCESS Form successfully created -**/ -EFI_STATUS -EFIAPI -CreateForm ( - IN CHAR16 *FormTitle, - IN UINT16 FormId, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ) -{ - EFI_STATUS Status; - FRAMEWORK_EFI_IFR_FORM Form; - FRAMEWORK_EFI_IFR_END_FORM EndForm; - CHAR16 CurrentLanguage[4]; - STRING_REF StringToken; - - // - // Add FormTitle to the StringBuffer, get FormTitle's token - // - GetCurrentLanguage (CurrentLanguage); - Status = AddString (StringBuffer, CurrentLanguage, FormTitle, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - Form.Header.OpCode = FRAMEWORK_EFI_IFR_FORM_OP; - Form.Header.Length = sizeof (FRAMEWORK_EFI_IFR_FORM); - Form.FormId = FormId; - Form.FormTitle = StringToken; - - Status = AddOpCode (FormBuffer, &Form); - if (EFI_ERROR (Status)) { - return Status; - } - - EndForm.Header.OpCode = FRAMEWORK_EFI_IFR_END_FORM_OP; - EndForm.Header.Length = sizeof (FRAMEWORK_EFI_IFR_END_FORM); - - Status = AddOpCode (FormBuffer, &EndForm); - - return Status; -} - -/** - Create a SubTitle. - - Subtitle strings are intended to be used by authors to separate sections of questions into semantic - groups. - - @param SubTitle Sub title to be created - @param FormBuffer Where this subtitle to add to - @param StringBuffer String buffer created for subtitle - - @retval EFI_SUCCESS Subtitle successfully created -**/ -EFI_STATUS -EFIAPI -CreateSubTitle ( - IN CHAR16 *SubTitle, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ) -{ - EFI_STATUS Status; - FRAMEWORK_EFI_IFR_SUBTITLE Subtitle; - CHAR16 CurrentLanguage[4]; - STRING_REF StringToken; - - // - // Add SubTitle to the StringBuffer, get SubTitle's token - // - GetCurrentLanguage (CurrentLanguage); - Status = AddString (StringBuffer, CurrentLanguage, SubTitle, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - Subtitle.Header.OpCode = FRAMEWORK_EFI_IFR_SUBTITLE_OP; - Subtitle.Header.Length = sizeof (FRAMEWORK_EFI_IFR_SUBTITLE); - Subtitle.SubTitle = StringToken; - - Status = AddOpCode (FormBuffer, &Subtitle); - - return Status; -} - -/** - Create a line of text. - Unlike HTML, text is simply another tag. - This tag type enables IFR to be more easily localized. - - @param String First string of the text - @param String2 Second string of the text - @param String3 Help string of the text - @param Flags Flag of the text - @param Key Key of the text - @param FormBuffer The form where this text adds to - @param StringBuffer String buffer created for String, String2 and String3 - - @retval EFI_SUCCESS Text successfully created -**/ -EFI_STATUS -EFIAPI -CreateText ( - IN CHAR16 *String, - IN CHAR16 *String2, - IN CHAR16 *String3, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ) -{ - EFI_STATUS Status; - FRAMEWORK_EFI_IFR_TEXT Text; - CHAR16 CurrentLanguage[4]; - STRING_REF StringToken; - - // - // Add first string to the StringBuffer, get first string's token - // - GetCurrentLanguage (CurrentLanguage); - Status = AddString (StringBuffer, CurrentLanguage, String, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - Text.Header.OpCode = FRAMEWORK_EFI_IFR_TEXT_OP; - Text.Header.Length = sizeof (FRAMEWORK_EFI_IFR_TEXT); - Text.Text = StringToken; - - // - // Add second string, get first string's token - // - Status = AddString (StringBuffer, CurrentLanguage, String2, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - Text.TextTwo = StringToken; - Text.Flags = (UINT8) (Flags | FRAMEWORK_EFI_IFR_FLAG_CREATED); - Text.Key = Key; - - // - // Add second string, get first string's token - // - Status = AddString (StringBuffer, CurrentLanguage, String3, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - Text.Help = StringToken; - - Status = AddOpCode (FormBuffer, &Text); - - return Status; -} - -/** - Create a hyperlink. - - @param FormId Form ID of the hyperlink - @param Prompt Prompt of the hyperlink - @param FormBuffer The form where this hyperlink adds to - @param StringBuffer String buffer created for Prompt - - @retval EFI_SUCCESS Hyperlink successfully created -**/ -EFI_STATUS -EFIAPI -CreateGoto ( - IN UINT16 FormId, - IN CHAR16 *Prompt, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ) -{ - EFI_STATUS Status; - FRAMEWORK_EFI_IFR_REF Hyperlink; - CHAR16 CurrentLanguage[4]; - STRING_REF StringToken; - - // - // Add Prompt string to the StringBuffer, get Prompt string's token - // - GetCurrentLanguage (CurrentLanguage); - Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - Hyperlink.Header.OpCode = FRAMEWORK_EFI_IFR_REF_OP; - Hyperlink.Header.Length = sizeof (FRAMEWORK_EFI_IFR_REF); - Hyperlink.FormId = FormId; - Hyperlink.Prompt = StringToken; - - Status = AddOpCode (FormBuffer, &Hyperlink); - - return Status; -} - -/** - Create a one-of question with a set of options to choose from. The - OptionsList is a pointer to a null-terminated list of option descriptions. - - @param QuestionId Question ID of the one-of box - @param DataWidth DataWidth of the one-of box - @param Prompt Prompt of the one-of box - @param Help Help of the one-of box - @param OptionsList Each string in it is an option of the one-of box - @param OptionCount Option string count - @param FormBuffer The form where this one-of box adds to - @param StringBuffer String buffer created for Prompt, Help and Option strings - - @retval EFI_DEVICE_ERROR DataWidth > 2 - @retval EFI_SUCCESS One-Of box successfully created. -**/ -EFI_STATUS -EFIAPI -CreateOneOf ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN CHAR16 *Prompt, - IN CHAR16 *Help, - IN IFR_OPTION *OptionsList, - IN UINTN OptionCount, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ) -{ - EFI_STATUS Status; - UINTN Index; - FRAMEWORK_EFI_IFR_ONE_OF OneOf; - FRAMEWORK_EFI_IFR_ONE_OF_OPTION OneOfOption; - FRAMEWORK_EFI_IFR_END_ONE_OF EndOneOf; - CHAR16 CurrentLanguage[4]; - STRING_REF StringToken; - - // - // We do not create op-code storage widths for one-of in excess of 16 bits for now - // - if (DataWidth > 2) { - return EFI_DEVICE_ERROR; - } - - // - // Add Prompt string to the StringBuffer, get Prompt string's token - // - GetCurrentLanguage (CurrentLanguage); - Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - OneOf.Header.OpCode = FRAMEWORK_EFI_IFR_ONE_OF_OP; - OneOf.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ONE_OF); - OneOf.QuestionId = QuestionId; - OneOf.Width = DataWidth; - OneOf.Prompt = StringToken; - - // - // Add Help string to the StringBuffer, get Help string's token - // - Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - OneOf.Help = StringToken; - - Status = AddOpCode (FormBuffer, &OneOf); - if (EFI_ERROR (Status)) { - return Status; - } - - for (Index = 0; Index < OptionCount; Index++) { - OneOfOption.Header.OpCode = FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP; - OneOfOption.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION); - - // - // Add OptionString string to the StringBuffer, get OptionString string's token - // - Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken); - - OneOfOption.Option = StringToken; - OneOfOption.Value = OptionsList[Index].Value; - OneOfOption.Flags = (UINT8) (OptionsList[Index].Flags | FRAMEWORK_EFI_IFR_FLAG_CREATED); - OneOfOption.Key = OptionsList[Index].Key; - - Status = AddOpCode (FormBuffer, &OneOfOption); - if (EFI_ERROR (Status)) { - return Status; - } - } - - EndOneOf.Header.Length = sizeof (FRAMEWORK_EFI_IFR_END_ONE_OF); - EndOneOf.Header.OpCode = FRAMEWORK_EFI_IFR_END_ONE_OF_OP; - - Status = AddOpCode (FormBuffer, &EndOneOf); - if (EFI_ERROR (Status)) { - return Status; - } - - return EFI_SUCCESS; -} - -/** - Create a one-of question with a set of options to choose from. The - OptionsList is a pointer to a null-terminated list of option descriptions. - - @param QuestionId Question ID of the ordered list - @param MaxEntries MaxEntries of the ordered list - @param Prompt Prompt of the ordered list - @param Help Help of the ordered list - @param OptionsList Each string in it is an option of the ordered list - @param OptionCount Option string count - @param FormBuffer The form where this ordered list adds to - @param StringBuffer String buffer created for Prompt, Help and Option strings - - @retval EFI_SUCCESS Ordered list successfully created. -**/ -EFI_STATUS -EFIAPI -CreateOrderedList ( - IN UINT16 QuestionId, - IN UINT8 MaxEntries, - IN CHAR16 *Prompt, - IN CHAR16 *Help, - IN IFR_OPTION *OptionsList, - IN UINTN OptionCount, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ) -{ - EFI_STATUS Status; - UINTN Index; - FRAMEWORK_EFI_IFR_ORDERED_LIST OrderedList; - FRAMEWORK_EFI_IFR_ONE_OF_OPTION OrderedListOption; - FRAMEWORK_EFI_IFR_END_ONE_OF EndOrderedList; - CHAR16 CurrentLanguage[4]; - STRING_REF StringToken; - - // - // Add Prompt string to the StringBuffer, get Prompt string's token - // - GetCurrentLanguage (CurrentLanguage); - Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - OrderedList.Header.OpCode = FRAMEWORK_EFI_IFR_ORDERED_LIST_OP; - OrderedList.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ORDERED_LIST); - OrderedList.QuestionId = QuestionId; - OrderedList.MaxEntries = MaxEntries; - OrderedList.Prompt = StringToken; - - // - // Add Help string to the StringBuffer, get Help string's token - // - Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - OrderedList.Help = StringToken; - - Status = AddOpCode (FormBuffer, &OrderedList); - if (EFI_ERROR (Status)) { - return Status; - } - - for (Index = 0; Index < OptionCount; Index++) { - OrderedListOption.Header.OpCode = FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP; - OrderedListOption.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION); - - // - // Add OptionString string to the StringBuffer, get OptionString string's token - // - Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken); - - OrderedListOption.Option = StringToken; - OrderedListOption.Value = OptionsList[Index].Value; - OrderedListOption.Flags = (UINT8) (OptionsList[Index].Flags | FRAMEWORK_EFI_IFR_FLAG_CREATED); - OrderedListOption.Key = OptionsList[Index].Key; - - Status = AddOpCode (FormBuffer, &OrderedListOption); - if (EFI_ERROR (Status)) { - return Status; - } - } - - EndOrderedList.Header.Length = sizeof (FRAMEWORK_EFI_IFR_END_ONE_OF); - EndOrderedList.Header.OpCode = FRAMEWORK_EFI_IFR_END_ONE_OF_OP; - - Status = AddOpCode (FormBuffer, &EndOrderedList); - - return Status; -} - -/** - Create a checkbox. - - @param QuestionId Question ID of the check box - @param DataWidth DataWidth of the check box - @param Prompt Prompt of the check box - @param Help Help of the check box - @param Flags Flags of the check box - @param FormBuffer The form where this check box adds to - @param StringBuffer String buffer created for Prompt and Help. - - @retval EFI_DEVICE_ERROR DataWidth > 1 - @retval EFI_SUCCESS Check box successfully created -**/ -EFI_STATUS -EFIAPI -CreateCheckBox ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN CHAR16 *Prompt, - IN CHAR16 *Help, - IN UINT8 Flags, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ) -{ - EFI_STATUS Status; - FRAMEWORK_EFI_IFR_CHECKBOX CheckBox; - CHAR16 CurrentLanguage[4]; - STRING_REF StringToken; - - // - // We do not create op-code storage widths for checkbox in excess of 8 bits for now - // - if (DataWidth > 1) { - return EFI_DEVICE_ERROR; - } - - // - // Add Prompt string to the StringBuffer, get Prompt string's token - // - GetCurrentLanguage (CurrentLanguage); - Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - CheckBox.Header.OpCode = FRAMEWORK_EFI_IFR_CHECKBOX_OP; - CheckBox.Header.Length = sizeof (FRAMEWORK_EFI_IFR_CHECKBOX); - CheckBox.QuestionId = QuestionId; - CheckBox.Width = DataWidth; - CheckBox.Prompt = StringToken; - - // - // Add Help string to the StringBuffer, get Help string's token - // - Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - CheckBox.Help = StringToken; - CheckBox.Flags = (UINT8) (Flags | FRAMEWORK_EFI_IFR_FLAG_CREATED); - - Status = AddOpCode (FormBuffer, &CheckBox); - - return Status; -} - -/** - Create a numeric. - - @param QuestionId Question ID of the numeric - @param DataWidth DataWidth of the numeric - @param Prompt Prompt of the numeric - @param Help Help of the numeric - @param Minimum Minumun boundary of the numeric - @param Maximum Maximum boundary of the numeric - @param Step Step of the numeric - @param Default Default value - @param Flags Flags of the numeric - @param Key Key of the numeric - @param FormBuffer The form where this numeric adds to - @param StringBuffer String buffer created for Prompt and Help. - - @retval EFI_DEVICE_ERROR DataWidth > 2 - @retval EFI_SUCCESS Numeric is successfully created -**/ -EFI_STATUS -EFIAPI -CreateNumeric ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN CHAR16 *Prompt, - IN CHAR16 *Help, - IN UINT16 Minimum, - IN UINT16 Maximum, - IN UINT16 Step, - IN UINT16 Default, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ) -{ - EFI_STATUS Status; - FRAMEWORK_EFI_IFR_NUMERIC Numeric; - CHAR16 CurrentLanguage[4]; - STRING_REF StringToken; - - // - // We do not create op-code storage widths for numerics in excess of 16 bits for now - // - if (DataWidth > 2) { - return EFI_DEVICE_ERROR; - } - - // - // Add Prompt string to the StringBuffer, get Prompt string's token - // - GetCurrentLanguage (CurrentLanguage); - Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - Numeric.Header.OpCode = FRAMEWORK_EFI_IFR_NUMERIC_OP; - Numeric.Header.Length = sizeof (FRAMEWORK_EFI_IFR_NUMERIC); - Numeric.QuestionId = QuestionId; - Numeric.Width = DataWidth; - Numeric.Prompt = StringToken; - - // - // Add Help string to the StringBuffer, get Help string's token - // - Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - Numeric.Help = StringToken; - Numeric.Minimum = Minimum; - Numeric.Maximum = Maximum; - Numeric.Step = Step; - Numeric.Default = Default; - Numeric.Flags = (UINT8) (Flags | FRAMEWORK_EFI_IFR_FLAG_CREATED); - Numeric.Key = Key; - - Status = AddOpCode (FormBuffer, &Numeric); - - return Status; -} - -/** - Create a string. - - @param QuestionId Question ID of the string - @param DataWidth DataWidth of the string - @param Prompt Prompt of the string - @param Help Help of the string - @param MinSize Min size boundary of the string - @param MaxSize Max size boundary of the string - @param Flags Flags of the string - @param Key Key of the string - @param FormBuffer The form where this string adds to - @param StringBuffer String buffer created for Prompt and Help. - - @retval EFI_SUCCESS String successfully created. -**/ -EFI_STATUS -EFIAPI -CreateString ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN CHAR16 *Prompt, - IN CHAR16 *Help, - IN UINT8 MinSize, - IN UINT8 MaxSize, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer, - IN OUT VOID *StringBuffer - ) -{ - EFI_STATUS Status; - FRAMEWORK_EFI_IFR_STRING String; - CHAR16 CurrentLanguage[4]; - STRING_REF StringToken; - - // - // Add Prompt string to the StringBuffer, get Prompt string's token - // - GetCurrentLanguage (CurrentLanguage); - Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - String.Header.OpCode = FRAMEWORK_EFI_IFR_STRING_OP; - String.Header.Length = sizeof (FRAMEWORK_EFI_IFR_STRING); - String.QuestionId = QuestionId; - String.Width = DataWidth; - String.Prompt = StringToken; - - // - // Add Help string to the StringBuffer, get Help string's token - // - Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken); - if (EFI_ERROR (Status)) { - return Status; - } - - String.Help = StringToken; - String.MinSize = MinSize; - String.MaxSize = MaxSize; - String.Flags = (UINT8) (Flags | FRAMEWORK_EFI_IFR_FLAG_CREATED); - String.Key = Key; - - Status = AddOpCode (FormBuffer, &String); - - return Status; -} - diff --git a/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrOpCodeCreation.c b/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrOpCodeCreation.c deleted file mode 100644 index 0ab63e9126..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrOpCodeCreation.c +++ /dev/null @@ -1,486 +0,0 @@ -/** @file - Library Routines to create IFR independent of string data - assume tokens already exist - Primarily to be used for exporting op-codes at a label in pre-defined forms. - -Copyright (c) 2006, Intel Corporation -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. - -**/ - -#include "IfrSupportLibInternal.h" - -/** - Create a SubTitle opcode independent of string creation. - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - @param StringToken StringToken of the subtitle - @param FormBuffer Output of subtitle as a form - - @retval EFI_SUCCESS Subtitle created to be a form -**/ -EFI_STATUS -EFIAPI -CreateSubTitleOpCode ( - IN STRING_REF StringToken, - IN OUT VOID *FormBuffer - ) -{ - FRAMEWORK_EFI_IFR_SUBTITLE Subtitle; - - Subtitle.Header.OpCode = FRAMEWORK_EFI_IFR_SUBTITLE_OP; - Subtitle.Header.Length = sizeof (FRAMEWORK_EFI_IFR_SUBTITLE); - Subtitle.SubTitle = StringToken; - - CopyMem (FormBuffer, &Subtitle, sizeof (FRAMEWORK_EFI_IFR_SUBTITLE)); - - return EFI_SUCCESS; -} - -/** - Create a Text opcode independent of string creation. - - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - @param StringToken First string token of the text - @param StringTokenTwo Second string token of the text - @param StringTokenThree Help string token of the text - @param Flags Flag of the text - @param Key Key of the text - @param FormBuffer Output of text as a form - - @retval EFI_SUCCESS Text created to be a form -**/ -EFI_STATUS -EFIAPI -CreateTextOpCode ( - IN STRING_REF StringToken, - IN STRING_REF StringTokenTwo, - IN STRING_REF StringTokenThree, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer - ) -{ - FRAMEWORK_EFI_IFR_TEXT Text; - - Text.Header.OpCode = FRAMEWORK_EFI_IFR_TEXT_OP; - Text.Header.Length = sizeof (FRAMEWORK_EFI_IFR_TEXT); - Text.Text = StringToken; - - Text.TextTwo = StringTokenTwo; - Text.Help = StringTokenThree; - Text.Flags = Flags; - Text.Key = Key; - - CopyMem (FormBuffer, &Text, sizeof (FRAMEWORK_EFI_IFR_TEXT)); - - return EFI_SUCCESS; -} - -/** - Create a hyperlink opcode independent of string creation. - - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - @param FormId Form ID of the hyperlink - @param StringToken Prompt string token of the hyperlink - @param StringTokenTwo Help string token of the hyperlink - @param Flags Flags of the hyperlink - @param Key Key of the hyperlink - @param FormBuffer Output of hyperlink as a form - - @retval EFI_SUCCESS Hyperlink created to be a form -**/ -EFI_STATUS -EFIAPI -CreateGotoOpCode ( - IN UINT16 FormId, - IN STRING_REF StringToken, - IN STRING_REF StringTokenTwo, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer - ) -{ - FRAMEWORK_EFI_IFR_REF Hyperlink; - - Hyperlink.Header.OpCode = FRAMEWORK_EFI_IFR_REF_OP; - Hyperlink.Header.Length = sizeof (FRAMEWORK_EFI_IFR_REF); - Hyperlink.FormId = FormId; - Hyperlink.Prompt = StringToken; - Hyperlink.Help = StringTokenTwo; - Hyperlink.Key = Key; - Hyperlink.Flags = Flags; - - CopyMem (FormBuffer, &Hyperlink, sizeof (FRAMEWORK_EFI_IFR_REF)); - - return EFI_SUCCESS; -} - -/** - Create a one-of opcode with a set of option op-codes to choose from independent of string creation. - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken - has been filled in since this routine will not generate StringToken values. - - @param QuestionId Question ID of the one-of box - @param DataWidth DataWidth of the one-of box - @param PromptToken Prompt string token of the one-of box - @param HelpToken Help string token of the one-of box - @param OptionsList Each string in it is an option of the one-of box - @param OptionCount Option string count - @param FormBuffer Output of One-Of box as a form - - - @retval EFI_SUCCESS One-Of box created to be a form - @retval EFI_DEVICE_ERROR DataWidth > 2 -**/ -EFI_STATUS -EFIAPI -CreateOneOfOpCode ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN STRING_REF PromptToken, - IN STRING_REF HelpToken, - IN IFR_OPTION *OptionsList, - IN UINTN OptionCount, - IN OUT VOID *FormBuffer - ) -{ - UINTN Index; - FRAMEWORK_EFI_IFR_ONE_OF OneOf; - FRAMEWORK_EFI_IFR_ONE_OF_OPTION OneOfOption; - FRAMEWORK_EFI_IFR_END_ONE_OF EndOneOf; - UINT8 *LocalBuffer; - - // - // We do not create op-code storage widths for one-of in excess of 16 bits for now - // - if (DataWidth > 2) { - return EFI_DEVICE_ERROR; - } - - OneOf.Header.OpCode = FRAMEWORK_EFI_IFR_ONE_OF_OP; - OneOf.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ONE_OF); - OneOf.QuestionId = QuestionId; - OneOf.Width = DataWidth; - OneOf.Prompt = PromptToken; - OneOf.Help = HelpToken; - LocalBuffer = (UINT8 *) FormBuffer; - - CopyMem (LocalBuffer, &OneOf, sizeof (FRAMEWORK_EFI_IFR_ONE_OF)); - - LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (FRAMEWORK_EFI_IFR_ONE_OF)); - - for (Index = 0; Index < OptionCount; Index++) { - OneOfOption.Header.OpCode = FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP; - OneOfOption.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION); - - OneOfOption.Option = OptionsList[Index].StringToken; - OneOfOption.Value = OptionsList[Index].Value; - OneOfOption.Flags = OptionsList[Index].Flags; - OneOfOption.Key = OptionsList[Index].Key; - - CopyMem (LocalBuffer, &OneOfOption, sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION)); - - LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION)); - } - - EndOneOf.Header.Length = sizeof (FRAMEWORK_EFI_IFR_END_ONE_OF); - EndOneOf.Header.OpCode = FRAMEWORK_EFI_IFR_END_ONE_OF_OP; - - CopyMem (LocalBuffer, &EndOneOf, sizeof (FRAMEWORK_EFI_IFR_END_ONE_OF)); - - LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (FRAMEWORK_EFI_IFR_END_ONE_OF)); - - return EFI_SUCCESS; -} - -/** - Create a ordered list opcode with a set of option op-codes to choose from independent of string creation. - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken - has been filled in since this routine will not generate StringToken values. - - @param QuestionId Question ID of the ordered list - @param MaxEntries MaxEntries of the ordered list - @param PromptToken Prompt string token of the ordered list - @param HelpToken Help string token of the ordered list - @param OptionsList Each string in it is an option of the ordered list - @param OptionCount Option string count - @param FormBuffer Output of ordered list as a form - - @retval EFI_SUCCESS Ordered list created to be a form -**/ -EFI_STATUS -EFIAPI -CreateOrderedListOpCode ( - IN UINT16 QuestionId, - IN UINT8 MaxEntries, - IN STRING_REF PromptToken, - IN STRING_REF HelpToken, - IN IFR_OPTION *OptionsList, - IN UINTN OptionCount, - IN OUT VOID *FormBuffer - ) -{ - UINTN Index; - FRAMEWORK_EFI_IFR_ORDERED_LIST OrderedList; - FRAMEWORK_EFI_IFR_ONE_OF_OPTION OrderedListOption; - FRAMEWORK_EFI_IFR_END_ONE_OF EndOrderedList; - UINT8 *LocalBuffer; - - OrderedList.Header.OpCode = FRAMEWORK_EFI_IFR_ORDERED_LIST_OP; - OrderedList.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ORDERED_LIST); - OrderedList.QuestionId = QuestionId; - OrderedList.MaxEntries = MaxEntries; - OrderedList.Prompt = PromptToken; - OrderedList.Help = HelpToken; - LocalBuffer = (UINT8 *) FormBuffer; - - CopyMem (LocalBuffer, &OrderedList, sizeof (FRAMEWORK_EFI_IFR_ORDERED_LIST)); - - LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (FRAMEWORK_EFI_IFR_ORDERED_LIST)); - - for (Index = 0; Index < OptionCount; Index++) { - OrderedListOption.Header.OpCode = FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP; - OrderedListOption.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION); - - OrderedListOption.Option = OptionsList[Index].StringToken; - OrderedListOption.Value = OptionsList[Index].Value; - OrderedListOption.Flags = OptionsList[Index].Flags; - OrderedListOption.Key = OptionsList[Index].Key; - - CopyMem (LocalBuffer, &OrderedListOption, sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION)); - - LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION)); - } - - EndOrderedList.Header.Length = sizeof (FRAMEWORK_EFI_IFR_END_ONE_OF); - EndOrderedList.Header.OpCode = FRAMEWORK_EFI_IFR_END_ONE_OF_OP; - - CopyMem (LocalBuffer, &EndOrderedList, sizeof (FRAMEWORK_EFI_IFR_END_ONE_OF)); - - LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (FRAMEWORK_EFI_IFR_END_ONE_OF)); - - return EFI_SUCCESS; -} - -/** - Create a checkbox opcode independent of string creation. - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - @param QuestionId Question ID of the check box - @param DataWidth DataWidth of the check box - @param PromptToken Prompt string token of the check box - @param HelpToken Help string token of the check box - @param Flags Flags of the check box - @param Key Key of the check box - @param FormBuffer Output of the check box as a form - - @retval EFI_SUCCESS Checkbox created to be a form - @retval EFI_DEVICE_ERROR DataWidth > 1 -**/ -EFI_STATUS -EFIAPI -CreateCheckBoxOpCode ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN STRING_REF PromptToken, - IN STRING_REF HelpToken, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer - ) -{ - FRAMEWORK_EFI_IFR_CHECKBOX CheckBox; - - // - // We do not create op-code storage widths for checkbox in excess of 8 bits for now - // - if (DataWidth > 1) { - return EFI_DEVICE_ERROR; - } - - CheckBox.Header.OpCode = FRAMEWORK_EFI_IFR_CHECKBOX_OP; - CheckBox.Header.Length = sizeof (FRAMEWORK_EFI_IFR_CHECKBOX); - CheckBox.QuestionId = QuestionId; - CheckBox.Width = DataWidth; - CheckBox.Prompt = PromptToken; - CheckBox.Help = HelpToken; - CheckBox.Flags = Flags; - CheckBox.Key = Key; - - CopyMem (FormBuffer, &CheckBox, sizeof (FRAMEWORK_EFI_IFR_CHECKBOX)); - - return EFI_SUCCESS; -} - -/** - Create a numeric opcode independent of string creation. - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - @param QuestionId Question ID of the numeric - @param DataWidth DataWidth of the numeric - @param PromptToken Prompt string token of the numeric - @param HelpToken Help string token of the numeric - @param Minimum Minumun boundary of the numeric - @param Maximum Maximum boundary of the numeric - @param Step Step of the numeric - @param Default Default value of the numeric - @param Flags Flags of the numeric - @param Key Key of the numeric - @param FormBuffer Output of the numeric as a form - - - @retval EFI_SUCCESS The numeric created to be a form. - @retval EFI_DEVICE_ERROR DataWidth > 2 -**/ -EFI_STATUS -EFIAPI -CreateNumericOpCode ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN STRING_REF PromptToken, - IN STRING_REF HelpToken, - IN UINT16 Minimum, - IN UINT16 Maximum, - IN UINT16 Step, - IN UINT16 Default, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer - ) -{ - FRAMEWORK_EFI_IFR_NUMERIC Numeric; - - // - // We do not create op-code storage widths for numerics in excess of 16 bits for now - // - if (DataWidth > 2) { - return EFI_DEVICE_ERROR; - } - - Numeric.Header.OpCode = FRAMEWORK_EFI_IFR_NUMERIC_OP; - Numeric.Header.Length = sizeof (FRAMEWORK_EFI_IFR_NUMERIC); - Numeric.QuestionId = QuestionId; - Numeric.Width = DataWidth; - Numeric.Prompt = PromptToken; - Numeric.Help = HelpToken; - Numeric.Minimum = Minimum; - Numeric.Maximum = Maximum; - Numeric.Step = Step; - Numeric.Default = Default; - Numeric.Flags = Flags; - Numeric.Key = Key; - - CopyMem (FormBuffer, &Numeric, sizeof (FRAMEWORK_EFI_IFR_NUMERIC)); - - return EFI_SUCCESS; -} - -/** - Create a numeric opcode independent of string creation. - This is used primarily by users who need to create just one particular valid op-code and the string - data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label - location to pre-defined forms in HII) - - @param QuestionId Question ID of the string - @param DataWidth DataWidth of the string - @param PromptToken Prompt token of the string - @param HelpToken Help token of the string - @param MinSize Min size boundary of the string - @param MaxSize Max size boundary of the string - @param Flags Flags of the string - @param Key Key of the string - @param FormBuffer Output of the string as a form - - @retval EFI_SUCCESS String created to be a form. -**/ -EFI_STATUS -EFIAPI -CreateStringOpCode ( - IN UINT16 QuestionId, - IN UINT8 DataWidth, - IN STRING_REF PromptToken, - IN STRING_REF HelpToken, - IN UINT8 MinSize, - IN UINT8 MaxSize, - IN UINT8 Flags, - IN UINT16 Key, - IN OUT VOID *FormBuffer - ) -{ - FRAMEWORK_EFI_IFR_STRING String; - - String.Header.OpCode = FRAMEWORK_EFI_IFR_STRING_OP; - String.Header.Length = sizeof (FRAMEWORK_EFI_IFR_STRING); - String.QuestionId = QuestionId; - String.Width = DataWidth; - String.Prompt = PromptToken; - String.Help = HelpToken; - String.MinSize = MinSize; - String.MaxSize = MaxSize; - String.Flags = Flags; - String.Key = Key; - - CopyMem (FormBuffer, &String, sizeof (FRAMEWORK_EFI_IFR_STRING)); - - return EFI_SUCCESS; -} - -/** - Create a banner opcode. This is primarily used by the FrontPage implementation from BDS. - - @param Title Title of the banner - @param LineNumber LineNumber of the banner - @param Alignment Alignment of the banner - @param FormBuffer Output of banner as a form - - @retval EFI_SUCCESS Banner created to be a form. -**/ -EFI_STATUS -EFIAPI -CreateBannerOpCode ( - IN UINT16 Title, - IN UINT16 LineNumber, - IN UINT8 Alignment, - IN OUT VOID *FormBuffer - ) -{ - FRAMEWORK_EFI_IFR_BANNER Banner; - - Banner.Header.OpCode = FRAMEWORK_EFI_IFR_BANNER_OP; - Banner.Header.Length = sizeof (FRAMEWORK_EFI_IFR_BANNER); - CopyMem (&Banner.Title, &Title, sizeof (UINT16)); - CopyMem (&Banner.LineNumber, &LineNumber, sizeof (UINT16)); - Banner.Alignment = Alignment; - - CopyMem (FormBuffer, &Banner, sizeof (FRAMEWORK_EFI_IFR_BANNER)); - - return EFI_SUCCESS; -} - - diff --git a/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrSupportLib.inf b/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrSupportLib.inf deleted file mode 100644 index d2cbdfaa1c..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrSupportLib.inf +++ /dev/null @@ -1,59 +0,0 @@ -#/** @file -# EDK Internal Form Refresentation Support Library Instance. -# -# The library instance provides common library routines help in IFR creation on-the-fly, -# HII variable access, HII database access, multi language supports. -# -# Copyright (c) 2006 - 2007, Intel Corporation. -# -# 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. -# -# -#**/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = FrameworkIfrSupportLib - FILE_GUID = ea55bada-d488-427b-9d2d-227e0aaa3707 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = FrameworkIfrSupportLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - PI_SPECIFICATION_VERSION = 0x00000009 - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# -# Variable Guid C Name: gLanGuid Variable Name: L"Lan" -# - -[Sources.common] - IfrVariable.c - IfrOpCodeCreation.c - IfrOnTheFly.c - IfrCommon.c - IfrSupportLibInternal.h - -[Packages] - MdePkg/MdePkg.dec - IntelFrameworkPkg/IntelFrameworkPkg.dec - -[LibraryClasses] - UefiRuntimeServicesTableLib - UefiBootServicesTableLib - MemoryAllocationLib - BaseMemoryLib - BaseLib - DebugLib - -[Guids] - gEfiGlobalVariableGuid # CONSUMED, Variable Name: L"Lan" - -[Protocols] - gEfiHiiProtocolGuid # PROTOCOL ALWAYS_CONSUMED diff --git a/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrSupportLibInternal.h b/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrSupportLibInternal.h deleted file mode 100644 index 9c8988c457..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrSupportLibInternal.h +++ /dev/null @@ -1,32 +0,0 @@ -/** @file - Common header file shared by all source files. - - This file includes package header files, library classes and protocol, PPI & GUID definitions. - - Copyright (c) 2006 - 2007, Intel Corporation. - 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. - -**/ - -#ifndef __IFRSUPPORT_LIB_INTERNAL_H_ -#define __IFRSUPPORT_LIB_INTERNAL_H_ - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrVariable.c b/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrVariable.c deleted file mode 100644 index 44b53571d4..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrVariable.c +++ /dev/null @@ -1,428 +0,0 @@ -/** @file - Variable/Map manipulations routines - -Copyright (c) 2006, Intel Corporation -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. - -**/ - -#include "IfrSupportLibInternal.h" - -/** - Extracts a variable form a Pack. - - @param Pack List of variables - @param Name Name of the variable/map - @param Guid GUID of the variable/map - @param Id The index of the variable/map to retrieve - @param Var Pointer to the variable/map - @param Size Size of the variable/map in bytes -**/ -VOID -EFIAPI -EfiLibHiiVariablePackGetMap ( - IN EFI_HII_VARIABLE_PACK *Pack, - OUT CHAR16 **Name, OPTIONAL - OUT EFI_GUID **Guid, OPTIONAL - OUT UINT16 *Id, OPTIONAL - OUT VOID **Var, OPTIONAL - OUT UINTN *Size OPTIONAL - ) -{ - if (NULL != Name) { - *Name = (VOID *) (Pack + 1); - } - - if (NULL != Guid) { - *Guid = (EFI_GUID *)(UINTN)&Pack->VariableGuid; - } - - - if (NULL != Id) { - *Id = Pack->VariableId; - } - - if (NULL != Var) { - *Var = (VOID *) ((CHAR8 *) (Pack + 1) + Pack->VariableNameLength); - } - - if (NULL != Size) { - *Size = Pack->Header.Length - sizeof (*Pack) - Pack->VariableNameLength; - } -} - -/** - Finds a count of the variables/maps in the List. - - @param List List of variables - - @return The number of map count. -**/ -UINTN -EFIAPI -EfiLibHiiVariablePackListGetMapCnt ( - IN EFI_HII_VARIABLE_PACK_LIST *List - ) -{ - UINTN Cnt; - - Cnt = 0; - while (NULL != List) { - Cnt++; - List = List->NextVariablePack; - } - return Cnt; -} - -/** - Will iterate all variable/maps as appearing - in List and for each, it will call the Callback. - - @param List List of variables - @param Callback Routine to be called for each iterated variable. -**/ -VOID -EFIAPI -EfiLibHiiVariablePackListForEachVar ( - IN EFI_HII_VARIABLE_PACK_LIST *List, - IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback - ) -{ - CHAR16 *MapName; - EFI_GUID *MapGuid; - UINT16 MapId; - VOID *Map; - UINTN MapSize; - - while (NULL != List) { - EfiLibHiiVariablePackGetMap (List->VariablePack, &MapName, &MapGuid, &MapId, &Map, &MapSize); - // - // call the callback - // - Callback (MapName, MapGuid, MapId, Map, MapSize); - List = List->NextVariablePack; - } -} - -/** - Finds a variable form List given - the order number as appears in the List. - - @param Idx The index of the variable/map to retrieve - @param List List of variables - @param Name Name of the variable/map - @param Guid GUID of the variable/map - @param Id Id of the variable/map - @param Var Pointer to the variable/map - @param Size Size of the variable/map in bytes - - @return EFI_SUCCESS Variable is found, OUT parameters are valid - @return EFI_NOT_FOUND Variable is not found, OUT parameters are not valid -**/ -EFI_STATUS -EFIAPI -EfiLibHiiVariablePackListGetMapByIdx ( - IN UINTN Idx, - IN EFI_HII_VARIABLE_PACK_LIST *List, - OUT CHAR16 **Name, OPTIONAL - OUT EFI_GUID **Guid, OPTIONAL - OUT UINT16 *Id, OPTIONAL - OUT VOID **Var, - OUT UINTN *Size - ) -{ - CHAR16 *MapName; - EFI_GUID *MapGuid; - UINT16 MapId; - VOID *Map; - UINTN MapSize; - - while (NULL != List) { - EfiLibHiiVariablePackGetMap (List->VariablePack, &MapName, &MapGuid, &MapId, &Map, &MapSize); - if (0 == Idx--) { - *Var = Map; - *Size = MapSize; - - if (NULL != Name) { - *Name = MapName; - } - - if (NULL != Guid) { - *Guid = MapGuid; - } - - if (NULL != Id) { - *Id = MapId; - } - // - // Map found - // - return EFI_SUCCESS; - } - List = List->NextVariablePack; - } - // - // If here, the map is not found - // - return EFI_NOT_FOUND; -} - -/** - Finds a variable form List given the - order number as appears in the List. - - @param Id The ID of the variable/map to retrieve - @param List List of variables - @param Name Name of the variable/map - @param Guid GUID of the variable/map - @param Var Pointer to the variable/map - @param Size Size of the variable/map in bytes - - @retval EFI_SUCCESS Variable is found, OUT parameters are valid - @retval EFI_NOT_FOUND Variable is not found, OUT parameters are not valid -**/ -EFI_STATUS -EFIAPI -EfiLibHiiVariablePackListGetMapById ( - IN UINT16 Id, - IN EFI_HII_VARIABLE_PACK_LIST *List, - OUT CHAR16 **Name, OPTIONAL - OUT EFI_GUID **Guid, OPTIONAL - OUT VOID **Var, - OUT UINTN *Size - ) -{ - CHAR16 *MapName; - EFI_GUID *MapGuid; - UINT16 MapId; - VOID *Map; - UINTN MapSize; - - while (NULL != List) { - EfiLibHiiVariablePackGetMap (List->VariablePack, &MapName, &MapGuid, &MapId, &Map, &MapSize); - if (MapId == Id) { - *Var = Map; - *Size = MapSize; - if (NULL != Name) { - *Name = MapName; - } - if (NULL != Guid) { - *Guid = MapGuid; - } - // - // Map found - // - return EFI_SUCCESS; - } - List = List->NextVariablePack; - } - // - // If here, the map is not found - // - return EFI_NOT_FOUND; -} - -/** - Finds a variable form EFI_HII_VARIABLE_PACK_LIST given name and GUID. - - @param List List of variables - @param Name Name of the variable/map to be found - @param Guid GUID of the variable/map to be found - @param Id Id of the variable/map to be found - @param Var Pointer to the variable/map found - @param Size Size of the variable/map in bytes found - - @retval EFI_SUCCESS variable is found, OUT parameters are valid - @retval EFI_NOT_FOUND variable is not found, OUT parameters are not valid -**/ -EFI_STATUS -EFIAPI -EfiLibHiiVariablePackListGetMap ( - IN EFI_HII_VARIABLE_PACK_LIST *List, - IN CHAR16 *Name, - IN EFI_GUID *Guid, - OUT UINT16 *Id, - OUT VOID **Var, - OUT UINTN *Size - ) -{ - VOID *Map; - UINTN MapSize; - UINT16 MapId; - CHAR16 *MapName; - EFI_GUID *MapGuid; - - while (NULL != List) { - EfiLibHiiVariablePackGetMap (List->VariablePack, &MapName, &MapGuid, &MapId, &Map, &MapSize); - if ((0 == StrCmp (Name, MapName)) && CompareGuid (Guid, MapGuid)) { - *Id = MapId; - *Var = Map; - *Size = MapSize; - return EFI_SUCCESS; - } - List = List->NextVariablePack; - } - // - // If here, the map is not found - // - return EFI_NOT_FOUND; -} - -/** - Finds out if a variable of specific Name/Guid/Size exists in NV. - If it does, it will retrieve it into the Var. - - @param Name Parameters of the variable to retrieve. Must match exactly. - @param Guid Parameters of the variable to retrieve. Must match exactly. - @param Size Parameters of the variable to retrieve. Must match exactly. - @param Var Variable will be retrieved into buffer pointed by this pointer. - If pointing to NULL, the buffer will be allocated. - Caller is responsible for releasing the buffer. - - @retval EFI_SUCCESS The variable of exact Name/Guid/Size parameters was retrieved and written to Var. - @retval EFI_NOT_FOUND The variable of this Name/Guid was not found in the NV. - @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error. -**/ -EFI_STATUS -EFIAPI -EfiLibHiiVariableRetrieveFromNv ( - IN CHAR16 *Name, - IN EFI_GUID *Guid, - IN UINTN Size, - OUT VOID **Var - ) -{ - EFI_STATUS Status; - UINTN SizeNv; - - // - // Test for existence of the variable. - // - SizeNv = 0; - Status = gRT->GetVariable (Name, Guid, NULL, &SizeNv, NULL); - if (EFI_BUFFER_TOO_SMALL != Status) { - ASSERT (EFI_SUCCESS != Status); - return EFI_NOT_FOUND; - } - if (SizeNv != Size) { - // - // The variable is considered corrupt, as it has different size from expected. - // - return EFI_LOAD_ERROR; - } - - if (NULL == *Var) { - *Var = AllocatePool (Size); - ASSERT (NULL != *Var); - } - SizeNv = Size; - // - // Final read into the Var - // - Status = gRT->GetVariable (Name, Guid, NULL, &SizeNv, *Var); - // - // No tolerance for random failures. Such behavior is undetermined and not validated. - // - ASSERT_EFI_ERROR (Status); - ASSERT (SizeNv == Size); - return EFI_SUCCESS; -} - -/** - Overrrides the variable with NV data if found. - But it only does it if the Name ends with specified Suffix. - For example, if Suffix="MyOverride" and the Name="XyzSetupMyOverride", - the Suffix matches the end of Name, so the variable will be loaded from NV - provided the variable exists and the GUID and Size matches. - - @param Suffix Suffix the Name should end with. - @param Name Name of the variable to retrieve. - @param Guid Guid of the variable to retrieve. - @param Size Parameters of the variable to retrieve. - @param Var Variable will be retrieved into this buffer. - Caller is responsible for providing storage of exactly Size size in bytes. - - @retval EFI_SUCCESS The variable was overriden with NV variable of same Name/Guid/Size. - @retval EFI_INVALID_PARAMETER The name of the variable does not end with . - @retval EFI_NOT_FOUND The variable of this Name/Guid was not found in the NV. - @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error. -**/ -EFI_STATUS -EFIAPI -EfiLibHiiVariableOverrideIfSuffix ( - IN CHAR16 *Suffix, - IN CHAR16 *Name, - IN EFI_GUID *Guid, - IN UINTN Size, - OUT VOID *Var - ) -{ - UINTN StrLength; - UINTN StrLenSuffix; - - StrLength = StrLen (Name); - StrLenSuffix = StrLen (Suffix); - if ((StrLength <= StrLenSuffix) || (0 != StrCmp (Suffix, &Name[StrLength - StrLenSuffix]))) { - // - // Not ending with . - // - return EFI_INVALID_PARAMETER; - } - return EfiLibHiiVariableRetrieveFromNv (Name, Guid, Size, &Var); -} - -/** - Overrrides the variable with NV data if found. - But it only does it if the NV contains the same variable with Name is appended with Suffix. - For example, if Suffix="MyOverride" and the Name="XyzSetup", - the Suffix will be appended to the end of Name, and the variable with Name="XyzSetupMyOverride" - will be loaded from NV provided the variable exists and the GUID and Size matches. - - @param Suffix Suffix the variable will be appended with. - @param Name Parameters of the Name variable to retrieve. - @param Guid Parameters of the Guid variable to retrieve. - @param Size Parameters of the Size variable to retrieve. - @param Var Variable will be retrieved into this buffer. - Caller is responsible for providing storage of exactly Size size in bytes. - - @retval EFI_SUCCESS The variable was overriden with NV variable of same Name/Guid/Size. - @retval EFI_NOT_FOUND The variable of this Name/Guid was not found in the NV. - @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error. -**/ -EFI_STATUS -EFIAPI -EfiLibHiiVariableOverrideBySuffix ( - IN CHAR16 *Suffix, - IN CHAR16 *Name, - IN EFI_GUID *Guid, - IN UINTN Size, - OUT VOID *Var - ) -{ - EFI_STATUS Status; - CHAR16 *NameSuffixed; - UINTN NameLength; - UINTN SuffixLength; - - // - // enough to concatenate both strings. - // - NameLength = StrLen (Name); - SuffixLength = StrLen (Suffix); - NameSuffixed = AllocateZeroPool ((NameLength + SuffixLength + 1) * sizeof (CHAR16)); - - StrCpy (NameSuffixed, Name); - StrCat (NameSuffixed, Suffix); - - Status = EfiLibHiiVariableRetrieveFromNv (NameSuffixed, Guid, Size, &Var); - FreePool (NameSuffixed); - - return Status; -} - diff --git a/IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.c b/IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.c deleted file mode 100644 index a72bf9c239..0000000000 --- a/IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.c +++ /dev/null @@ -1,98 +0,0 @@ -/** @file - HII Library implementation that uses DXE protocols and services. - - Copyright (c) 2006, Intel Corporation
- 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. - -**/ - - -#include - -#include - -#include -#include -#include - -EFI_HII_PROTOCOL *gHiiProtocol = NULL; - -/** - The constructor function for HiiLibFramework library instance - - The constructor function locates Hii protocol from protocol database. - It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -HiiLibFrameworkConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - Status = gBS->LocateProtocol ( - &gEfiHiiProtocolGuid, - NULL, - (VOID **) &gHiiProtocol - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -/** - This function allocates pool for an EFI_HII_PACKAGES structure - with enough space for the variable argument list of package pointers. - The allocated structure is initialized using NumberOfPackages, Guid, - and the variable length argument list of package pointers. - - @param NumberOfPackages The number of HII packages to prepare. - @param Guid Package GUID. - @param Args Package contents - - @return The allocated and initialized packages. - -**/ -EFI_HII_PACKAGES * -InternalPreparePackages ( - IN UINTN NumberOfPackages, - IN CONST EFI_GUID *Guid OPTIONAL, - IN VA_LIST Args - ) -{ - EFI_HII_PACKAGES *HiiPackages; - VOID **Package; - UINTN Index; - - ASSERT (NumberOfPackages > 0); - - HiiPackages = AllocateZeroPool (sizeof (EFI_HII_PACKAGES) + NumberOfPackages * sizeof (VOID *)); - ASSERT (HiiPackages != NULL); - - HiiPackages->GuidId = (EFI_GUID *) Guid; - HiiPackages->NumberOfPackages = NumberOfPackages; - Package = (VOID **) (((UINT8 *) HiiPackages) + sizeof (EFI_HII_PACKAGES)); - - for (Index = 0; Index < NumberOfPackages; Index++) { - *Package = VA_ARG (Args, VOID *); - Package++; - } - - return HiiPackages; -} - - diff --git a/IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.inf b/IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.inf deleted file mode 100644 index 361342f9eb..0000000000 --- a/IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.inf +++ /dev/null @@ -1,51 +0,0 @@ -#/** @file -# Library instance for HII common routines. -# -# This library instance implements the common HII routines. -# -# Copyright (c) 2006, Intel Corporation -# -# 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. -# -# -#**/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = HiiLibFramework - FILE_GUID = BD4BB0E3-1AFF-4304-AD0B-32A80B20FCAD - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = HiiLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER - PI_SPECIFICATION_VERSION = 0x00000009 - - CONSTRUCTOR = HiiLibFrameworkConstructor - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources.common] - HiiLibFramework.c - -[Packages] - MdePkg/MdePkg.dec - IntelFrameworkPkg/IntelFrameworkPkg.dec - -[LibraryClasses] - MemoryAllocationLib - UefiBootServicesTableLib - DebugLib - -[Protocols] - gEfiHiiProtocolGuid # PROTOCOL ALWAYS_CONSUMED - -[Depex] - gEfiHiiProtocolGuid