Fix coding style issue.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5029 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2008-04-09 07:15:51 +00:00
parent 504214c487
commit 2ec4d26975
4 changed files with 484 additions and 930 deletions

View File

@ -17,25 +17,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// //
#include "IfrSupportLibInternal.h" #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 EFI_STATUS
GetCurrentLanguage ( GetCurrentLanguage (
OUT CHAR16 *Lang OUT CHAR16 *Lang
) )
/*++
Routine Description:
Determine what is the current language setting
Arguments:
Lang - Pointer of system language
Returns:
Status code
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN Size; UINTN Size;
@ -75,7 +71,17 @@ Returns:
return Status; 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 EFI_STATUS
AddString ( AddString (
IN VOID *StringBuffer, IN VOID *StringBuffer,
@ -83,29 +89,6 @@ AddString (
IN CHAR16 *String, IN CHAR16 *String,
IN OUT STRING_REF *StringToken IN OUT STRING_REF *StringToken
) )
/*++
Routine Description:
Add a string to the incoming buffer and return the token and offset data
Arguments:
StringBuffer - The incoming buffer
Language - Currrent language
String - The string to be added
StringToken - The index where the string placed
Returns:
EFI_OUT_OF_RESOURCES - No enough buffer to allocate
EFI_SUCCESS - String successfully added to the incoming buffer
--*/
{ {
EFI_HII_STRING_PACK *StringPack; EFI_HII_STRING_PACK *StringPack;
EFI_HII_STRING_PACK *StringPackBuffer; EFI_HII_STRING_PACK *StringPackBuffer;
@ -298,31 +281,20 @@ Returns:
return EFI_SUCCESS; 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 EFI_STATUS
AddOpCode ( AddOpCode (
IN VOID *FormBuffer, IN VOID *FormBuffer,
IN OUT VOID *OpCodeData IN OUT VOID *OpCodeData
) )
/*++
Routine Description:
Add op-code data to the FormBuffer
Arguments:
FormBuffer - Form buffer to be inserted to
OpCodeData - Op-code data to be inserted
Returns:
EFI_OUT_OF_RESOURCES - No enough buffer to allocate
EFI_SUCCESS - Op-code data successfully inserted
--*/
{ {
EFI_HII_PACK_HEADER *NewBuffer; EFI_HII_PACK_HEADER *NewBuffer;
UINT8 *Source; UINT8 *Source;
@ -415,26 +387,18 @@ Returns:
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/**
Get the HII protocol interface
@param Hii HII protocol interface
@return the statue of locating HII protocol
**/
STATIC STATIC
EFI_STATUS EFI_STATUS
GetHiiInterface ( GetHiiInterface (
OUT EFI_HII_PROTOCOL **Hii OUT EFI_HII_PROTOCOL **Hii
) )
/*++
Routine Description:
Get the HII protocol interface
Arguments:
Hii - HII protocol interface
Returns:
Status code
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -450,7 +414,19 @@ Returns:
return Status;; 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 EFI_STATUS
ExtractDataFromHiiHandle ( ExtractDataFromHiiHandle (
IN FRAMEWORK_EFI_HII_HANDLE HiiHandle, IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,
@ -458,33 +434,6 @@ ExtractDataFromHiiHandle (
OUT UINT8 *DefaultImage, OUT UINT8 *DefaultImage,
OUT EFI_GUID *Guid OUT EFI_GUID *Guid
) )
/*++
Routine Description:
Extract information pertaining to the HiiHandle
Arguments:
HiiHandle - Hii handle
ImageLength - For input, length of DefaultImage;
For output, length of actually required
DefaultImage - Image buffer prepared by caller
Guid - Guid information about the form
Returns:
EFI_OUT_OF_RESOURCES - No enough buffer to allocate
EFI_BUFFER_TOO_SMALL - DefualtImage has no enough ImageLength
EFI_SUCCESS - Successfully extract data from Hii database.
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_HII_PROTOCOL *Hii; EFI_HII_PROTOCOL *Hii;
@ -630,28 +579,22 @@ Returns:
return EFI_SUCCESS; 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 FRAMEWORK_EFI_HII_HANDLE
FindHiiHandle ( FindHiiHandle (
IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL
IN EFI_GUID *Guid IN EFI_GUID *Guid
) )
/*++
Routine Description:
Finds HII handle for given pack GUID previously registered with the HII.
Arguments:
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.
Guid - The GUID of the pack that registered with the HII.
Returns:
Handle to the HII pack previously registered by the memory driver.
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
@ -746,34 +689,24 @@ lbl_exit:
return HiiHandle; 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 EFI_STATUS
ValidateDataFromHiiHandle ( ValidateDataFromHiiHandle (
IN FRAMEWORK_EFI_HII_HANDLE HiiHandle, IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,
OUT BOOLEAN *Results OUT BOOLEAN *Results
) )
/*++
Routine Description:
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.
Arguments:
HiiHandle - Handle of the HII database entry to query
Results - If return Status is EFI_SUCCESS, Results provides valid data
TRUE = NVRAM Data is within parameters
FALSE = NVRAM Data is NOT within parameters
Returns:
EFI_OUT_OF_RESOURCES - No enough buffer to allocate
EFI_SUCCESS - Data successfully validated
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_HII_PROTOCOL *Hii; EFI_HII_PROTOCOL *Hii;

View File

@ -1,4 +1,6 @@
/** @file /** @file
Library Routines to create IFR on-the-fly
Copyright (c) 2006, Intel Corporation Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -8,15 +10,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
IfrOnTheFly.c
Abstract:
Library Routines to create IFR on-the-fly
Revision History:
**/ **/
// //
@ -24,6 +17,22 @@ Revision History:
// //
#include "IfrSupportLibInternal.h" #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 EFI_STATUS
CreateFormSet ( CreateFormSet (
IN CHAR16 *FormSetTitle, IN CHAR16 *FormSetTitle,
@ -33,33 +42,6 @@ CreateFormSet (
IN OUT VOID **FormBuffer, IN OUT VOID **FormBuffer,
IN OUT VOID **StringBuffer IN OUT VOID **StringBuffer
) )
/*++
Routine Description:
Create a formset
Arguments:
FormSetTitle - Title of formset
Guid - Guid of formset
Class - Class of formset
SubClass - Sub class of formset
FormBuffer - Pointer of the formset created
StringBuffer - Pointer of FormSetTitile string created
Returns:
EFI_OUT_OF_RESOURCES - No enough buffer to allocate
EFI_SUCCESS - Formset successfully created
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_HII_IFR_PACK IfrPack; EFI_HII_IFR_PACK IfrPack;
@ -139,7 +121,19 @@ Returns:
return EFI_SUCCESS; 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 EFI_STATUS
CreateForm ( CreateForm (
IN CHAR16 *FormTitle, IN CHAR16 *FormTitle,
@ -147,27 +141,6 @@ CreateForm (
IN OUT VOID *FormBuffer, IN OUT VOID *FormBuffer,
IN OUT VOID *StringBuffer IN OUT VOID *StringBuffer
) )
/*++
Routine Description:
Create a form
Arguments:
FormTitle - Title of the form
FormId - Id of the form
FormBuffer - Pointer of the form created
StringBuffer - Pointer of FormTitil string created
Returns:
EFI_SUCCESS - Form successfully created
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
FRAMEWORK_EFI_IFR_FORM Form; FRAMEWORK_EFI_IFR_FORM Form;
@ -202,39 +175,27 @@ Returns:
Status = AddOpCode (FormBuffer, &EndForm); Status = AddOpCode (FormBuffer, &EndForm);
if (EFI_ERROR (Status)) {
return Status; return Status;
} }
return EFI_SUCCESS; /**
} 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 EFI_STATUS
CreateSubTitle ( CreateSubTitle (
IN CHAR16 *SubTitle, IN CHAR16 *SubTitle,
IN OUT VOID *FormBuffer, IN OUT VOID *FormBuffer,
IN OUT VOID *StringBuffer IN OUT VOID *StringBuffer
) )
/*++
Routine Description:
Create a SubTitle
Arguments:
SubTitle - Sub title to be created
FormBuffer - Where this subtitle to add to
StringBuffer - String buffer created for subtitle
Returns:
EFI_SUCCESS - Subtitle successfully created
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
FRAMEWORK_EFI_IFR_SUBTITLE Subtitle; FRAMEWORK_EFI_IFR_SUBTITLE Subtitle;
@ -258,14 +219,24 @@ Returns:
Status = AddOpCode (FormBuffer, &Subtitle); Status = AddOpCode (FormBuffer, &Subtitle);
if (EFI_ERROR (Status)) {
return Status; return Status;
} }
return EFI_SUCCESS; /**
} 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 EFI_STATUS
CreateText ( CreateText (
IN CHAR16 *String, IN CHAR16 *String,
@ -276,33 +247,6 @@ CreateText (
IN OUT VOID *FormBuffer, IN OUT VOID *FormBuffer,
IN OUT VOID *StringBuffer IN OUT VOID *StringBuffer
) )
/*++
Routine Description:
Create a line of text
Arguments:
String - First string of the text
String2 - Second string of the text
String3 - Help string of the text
Flags - Flag of the text
Key - Key of the text
FormBuffer - The form where this text adds to
StringBuffer - String buffer created for String, String2 and String3
Returns:
EFI_SUCCESS - Text successfully created
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
FRAMEWORK_EFI_IFR_TEXT Text; FRAMEWORK_EFI_IFR_TEXT Text;
@ -354,14 +298,19 @@ Returns:
Status = AddOpCode (FormBuffer, &Text); Status = AddOpCode (FormBuffer, &Text);
if (EFI_ERROR (Status)) {
return Status; return Status;
} }
return EFI_SUCCESS; /**
} 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 EFI_STATUS
CreateGoto ( CreateGoto (
IN UINT16 FormId, IN UINT16 FormId,
@ -369,27 +318,6 @@ CreateGoto (
IN OUT VOID *FormBuffer, IN OUT VOID *FormBuffer,
IN OUT VOID *StringBuffer IN OUT VOID *StringBuffer
) )
/*++
Routine Description:
Create a hyperlink
Arguments:
FormId - Form ID of the hyperlink
Prompt - Prompt of the hyperlink
FormBuffer - The form where this hyperlink adds to
StringBuffer - String buffer created for Prompt
Returns:
EFI_SUCCESS - Hyperlink successfully created
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
FRAMEWORK_EFI_IFR_REF Hyperlink; FRAMEWORK_EFI_IFR_REF Hyperlink;
@ -414,14 +342,25 @@ Returns:
Status = AddOpCode (FormBuffer, &Hyperlink); Status = AddOpCode (FormBuffer, &Hyperlink);
if (EFI_ERROR (Status)) {
return 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 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 EFI_STATUS
CreateOneOf ( CreateOneOf (
IN UINT16 QuestionId, IN UINT16 QuestionId,
@ -433,38 +372,6 @@ CreateOneOf (
IN OUT VOID *FormBuffer, IN OUT VOID *FormBuffer,
IN OUT VOID *StringBuffer IN OUT VOID *StringBuffer
) )
/*++
Routine Description:
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.
Arguments:
QuestionId - Question ID of the one-of box
DataWidth - DataWidth of the one-of box
Prompt - Prompt of the one-of box
Help - Help of the one-of box
OptionsList - Each string in it is an option of the one-of box
OptionCount - Option string count
FormBuffer - The form where this one-of box adds to
StringBuffer - String buffer created for Prompt, Help and Option strings
Returns:
EFI_DEVICE_ERROR - DataWidth > 2
EFI_SUCCESS - One-Of box successfully created.
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN Index; UINTN Index;
@ -551,6 +458,21 @@ Returns:
return EFI_SUCCESS; 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 EFI_STATUS
CreateOrderedList ( CreateOrderedList (
IN UINT16 QuestionId, IN UINT16 QuestionId,
@ -562,36 +484,6 @@ CreateOrderedList (
IN OUT VOID *FormBuffer, IN OUT VOID *FormBuffer,
IN OUT VOID *StringBuffer IN OUT VOID *StringBuffer
) )
/*++
Routine Description:
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.
Arguments:
QuestionId - Question ID of the ordered list
MaxEntries - MaxEntries of the ordered list
Prompt - Prompt of the ordered list
Help - Help of the ordered list
OptionsList - Each string in it is an option of the ordered list
OptionCount - Option string count
FormBuffer - The form where this ordered list adds to
StringBuffer - String buffer created for Prompt, Help and Option strings
Returns:
EFI_SUCCESS - Ordered list successfully created.
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN Index; UINTN Index;
@ -664,14 +556,23 @@ Returns:
Status = AddOpCode (FormBuffer, &EndOrderedList); Status = AddOpCode (FormBuffer, &EndOrderedList);
if (EFI_ERROR (Status)) {
return Status; return Status;
} }
return EFI_SUCCESS; /**
} 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 EFI_STATUS
CreateCheckBox ( CreateCheckBox (
IN UINT16 QuestionId, IN UINT16 QuestionId,
@ -682,35 +583,6 @@ CreateCheckBox (
IN OUT VOID *FormBuffer, IN OUT VOID *FormBuffer,
IN OUT VOID *StringBuffer IN OUT VOID *StringBuffer
) )
/*++
Routine Description:
Create a checkbox
Arguments:
QuestionId - Question ID of the check box
DataWidth - DataWidth of the check box
Prompt - Prompt of the check box
Help - Help of the check box
Flags - Flags of the check box
FormBuffer - The form where this check box adds to
StringBuffer - String buffer created for Prompt and Help.
Returns:
EFI_DEVICE_ERROR - DataWidth > 1
EFI_SUCCESS - Check box successfully created
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
FRAMEWORK_EFI_IFR_CHECKBOX CheckBox; FRAMEWORK_EFI_IFR_CHECKBOX CheckBox;
@ -758,14 +630,28 @@ Returns:
Status = AddOpCode (FormBuffer, &CheckBox); Status = AddOpCode (FormBuffer, &CheckBox);
if (EFI_ERROR (Status)) {
return Status; return Status;
} }
return EFI_SUCCESS; /**
} 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 EFI_STATUS
CreateNumeric ( CreateNumeric (
IN UINT16 QuestionId, IN UINT16 QuestionId,
@ -781,45 +667,6 @@ CreateNumeric (
IN OUT VOID *FormBuffer, IN OUT VOID *FormBuffer,
IN OUT VOID *StringBuffer IN OUT VOID *StringBuffer
) )
/*++
Routine Description:
Create a numeric
Arguments:
QuestionId - Question ID of the numeric
DataWidth - DataWidth of the numeric
Prompt - Prompt of the numeric
Help - Help of the numeric
Minimum - Minumun boundary of the numeric
Maximum - Maximum boundary of the numeric
Step - Step of the numeric
Default - Default value
Flags - Flags of the numeric
Key - Key of the numeric
FormBuffer - The form where this numeric adds to
StringBuffer - String buffer created for Prompt and Help.
Returns:
EFI_DEVICE_ERROR - DataWidth > 2
EFI_SUCCESS - Numeric is successfully created
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
FRAMEWORK_EFI_IFR_NUMERIC Numeric; FRAMEWORK_EFI_IFR_NUMERIC Numeric;
@ -872,14 +719,24 @@ Returns:
Status = AddOpCode (FormBuffer, &Numeric); Status = AddOpCode (FormBuffer, &Numeric);
if (EFI_ERROR (Status)) {
return Status; return Status;
} }
return EFI_SUCCESS; /**
} 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 EFI_STATUS
CreateString ( CreateString (
IN UINT16 QuestionId, IN UINT16 QuestionId,
@ -893,39 +750,6 @@ CreateString (
IN OUT VOID *FormBuffer, IN OUT VOID *FormBuffer,
IN OUT VOID *StringBuffer IN OUT VOID *StringBuffer
) )
/*++
Routine Description:
Create a string
Arguments:
QuestionId - Question ID of the string
DataWidth - DataWidth of the string
Prompt - Prompt of the string
Help - Help of the string
MinSize - Min size boundary of the string
MaxSize - Max size boundary of the string
Flags - Flags of the string
Key - Key of the string
FormBuffer - The form where this string adds to
StringBuffer - String buffer created for Prompt and Help.
Returns:
EFI_SUCCESS - String successfully created.
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
FRAMEWORK_EFI_IFR_STRING String; FRAMEWORK_EFI_IFR_STRING String;
@ -969,9 +793,6 @@ Returns:
Status = AddOpCode (FormBuffer, &String); Status = AddOpCode (FormBuffer, &String);
if (EFI_ERROR (Status)) {
return Status; return Status;
} }
return EFI_SUCCESS;
}

View File

@ -1,4 +1,7 @@
/** @file /** @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 Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -8,15 +11,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
IfrOpCodeCreation.c
Abstract:
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.
Revision History:
**/ **/
@ -25,31 +19,22 @@ Revision History:
// //
#include "IfrSupportLibInternal.h" #include "IfrSupportLibInternal.h"
EFI_STATUS /**
CreateSubTitleOpCode (
IN STRING_REF StringToken,
IN OUT VOID *FormBuffer
)
/*++
Routine Description:
Create a SubTitle opcode independent of string creation 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 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 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) location to pre-defined forms in HII)
Arguments: @param StringToken StringToken of the subtitle
@param FormBuffer Output of subtitle as a form
StringToken - StringToken of the subtitle @retval EFI_SUCCESS Subtitle created to be a form
**/
FormBuffer - Output of subtitle as a form EFI_STATUS
CreateSubTitleOpCode (
Returns: IN STRING_REF StringToken,
IN OUT VOID *FormBuffer
EFI_SUCCESS - Subtitle created to be a form )
--*/
{ {
FRAMEWORK_EFI_IFR_SUBTITLE Subtitle; FRAMEWORK_EFI_IFR_SUBTITLE Subtitle;
@ -61,7 +46,21 @@ Returns:
return EFI_SUCCESS; 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 EFI_STATUS
CreateTextOpCode ( CreateTextOpCode (
IN STRING_REF StringToken, IN STRING_REF StringToken,
@ -71,34 +70,6 @@ CreateTextOpCode (
IN UINT16 Key, IN UINT16 Key,
IN OUT VOID *FormBuffer IN OUT VOID *FormBuffer
) )
/*++
Routine Description:
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)
Arguments:
StringToken - First string token of the text
StringTokenTwo - Second string token of the text
StringTokenThree - Help string token of the text
Flags - Flag of the text
Key - Key of the text
FormBuffer - Output of text as a form
Returns:
EFI_SUCCESS - Text created to be a form
--*/
{ {
FRAMEWORK_EFI_IFR_TEXT Text; FRAMEWORK_EFI_IFR_TEXT Text;
@ -116,7 +87,21 @@ Returns:
return EFI_SUCCESS; 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 EFI_STATUS
CreateGotoOpCode ( CreateGotoOpCode (
IN UINT16 FormId, IN UINT16 FormId,
@ -126,34 +111,7 @@ CreateGotoOpCode (
IN UINT16 Key, IN UINT16 Key,
IN OUT VOID *FormBuffer IN OUT VOID *FormBuffer
) )
/*++
Routine Description:
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)
Arguments:
FormId - Form ID of the hyperlink
StringToken - Prompt string token of the hyperlink
StringTokenTwo - Help string token of the hyperlink
Flags - Flags of the hyperlink
Key - Key of the hyperlink
FormBuffer - Output of hyperlink as a form
Returns:
EFI_SUCCESS - Hyperlink created to be a form
--*/
{ {
FRAMEWORK_EFI_IFR_REF Hyperlink; FRAMEWORK_EFI_IFR_REF Hyperlink;
@ -170,7 +128,27 @@ Returns:
return EFI_SUCCESS; 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 EFI_STATUS
CreateOneOfOpCode ( CreateOneOfOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
@ -181,41 +159,6 @@ CreateOneOfOpCode (
IN UINTN OptionCount, IN UINTN OptionCount,
IN OUT VOID *FormBuffer IN OUT VOID *FormBuffer
) )
/*++
Routine Description:
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.
Arguments:
QuestionId - Question ID of the one-of box
DataWidth - DataWidth of the one-of box
PromptToken - Prompt string token of the one-of box
HelpToken - Help string token of the one-of box
OptionsList - Each string in it is an option of the one-of box
OptionCount - Option string count
FormBuffer - Output of One-Of box as a form
Returns:
EFI_SUCCESS - One-Of box created to be a form
EFI_DEVICE_ERROR - DataWidth > 2
--*/
{ {
UINTN Index; UINTN Index;
FRAMEWORK_EFI_IFR_ONE_OF OneOf; FRAMEWORK_EFI_IFR_ONE_OF OneOf;
@ -268,6 +211,25 @@ Returns:
return EFI_SUCCESS; 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 EFI_STATUS
CreateOrderedListOpCode ( CreateOrderedListOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
@ -278,39 +240,6 @@ CreateOrderedListOpCode (
IN UINTN OptionCount, IN UINTN OptionCount,
IN OUT VOID *FormBuffer IN OUT VOID *FormBuffer
) )
/*++
Routine Description:
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.
Arguments:
QuestionId - Question ID of the ordered list
MaxEntries - MaxEntries of the ordered list
PromptToken - Prompt string token of the ordered list
HelpToken - Help string token of the ordered list
OptionsList - Each string in it is an option of the ordered list
OptionCount - Option string count
FormBuffer - Output of ordered list as a form
Returns:
EFI_SUCCESS - Ordered list created to be a form
--*/
{ {
UINTN Index; UINTN Index;
FRAMEWORK_EFI_IFR_ORDERED_LIST OrderedList; FRAMEWORK_EFI_IFR_ORDERED_LIST OrderedList;
@ -356,6 +285,23 @@ Returns:
return EFI_SUCCESS; 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 EFI_STATUS
CreateCheckBoxOpCode ( CreateCheckBoxOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
@ -366,38 +312,7 @@ CreateCheckBoxOpCode (
IN UINT16 Key, IN UINT16 Key,
IN OUT VOID *FormBuffer IN OUT VOID *FormBuffer
) )
/*++
Routine Description:
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)
Arguments:
QuestionId - Question ID of the check box
DataWidth - DataWidth of the check box
PromptToken - Prompt string token of the check box
HelpToken - Help string token of the check box
Flags - Flags of the check box
Key - Key of the check box
FormBuffer - Output of the check box as a form
Returns:
EFI_SUCCESS - Checkbox created to be a form
EFI_DEVICE_ERROR - DataWidth > 1
--*/
{ {
FRAMEWORK_EFI_IFR_CHECKBOX CheckBox; FRAMEWORK_EFI_IFR_CHECKBOX CheckBox;
@ -423,7 +338,28 @@ Returns:
return EFI_SUCCESS; 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 EFI_STATUS
CreateNumericOpCode ( CreateNumericOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
@ -438,46 +374,7 @@ CreateNumericOpCode (
IN UINT16 Key, IN UINT16 Key,
IN OUT VOID *FormBuffer IN OUT VOID *FormBuffer
) )
/*++
Routine Description:
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)
Arguments:
QuestionId - Question ID of the numeric
DataWidth - DataWidth of the numeric
PromptToken - Prompt string token of the numeric
HelpToken - Help string token of the numeric
Minimum - Minumun boundary of the numeric
Maximum - Maximum boundary of the numeric
Step - Step of the numeric
Default - Default value of the numeric
Flags - Flags of the numeric
Key - Key of the numeric
FormBuffer - Output of the numeric as a form
Returns:
EFI_SUCCESS - The numeric created to be a form.
EFI_DEVICE_ERROR - DataWidth > 2
--*/
{ {
FRAMEWORK_EFI_IFR_NUMERIC Numeric; FRAMEWORK_EFI_IFR_NUMERIC Numeric;
@ -507,7 +404,24 @@ Returns:
return EFI_SUCCESS; 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 EFI_STATUS
CreateStringOpCode ( CreateStringOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
@ -520,40 +434,7 @@ CreateStringOpCode (
IN UINT16 Key, IN UINT16 Key,
IN OUT VOID *FormBuffer IN OUT VOID *FormBuffer
) )
/*++
Routine Description:
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)
Arguments:
QuestionId - Question ID of the string
DataWidth - DataWidth of the string
PromptToken - Prompt token of the string
HelpToken - Help token of the string
MinSize - Min size boundary of the string
MaxSize - Max size boundary of the string
Flags - Flags of the string
Key - Key of the string
FormBuffer - Output of the string as a form
Returns:
EFI_SUCCESS - String created to be a form.
--*/
{ {
FRAMEWORK_EFI_IFR_STRING String; FRAMEWORK_EFI_IFR_STRING String;
@ -574,7 +455,16 @@ Returns:
return EFI_SUCCESS; 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 EFI_STATUS
CreateBannerOpCode ( CreateBannerOpCode (
IN UINT16 Title, IN UINT16 Title,
@ -582,27 +472,7 @@ CreateBannerOpCode (
IN UINT8 Alignment, IN UINT8 Alignment,
IN OUT VOID *FormBuffer IN OUT VOID *FormBuffer
) )
/*++
Routine Description:
Create a banner opcode. This is primarily used by the FrontPage implementation from BDS.
Arguments:
Title - Title of the banner
LineNumber - LineNumber of the banner
Alignment - Alignment of the banner
FormBuffer - Output of banner as a form
Returns:
EFI_SUCCESS - Banner created to be a form.
--*/
{ {
FRAMEWORK_EFI_IFR_BANNER Banner; FRAMEWORK_EFI_IFR_BANNER Banner;
@ -616,3 +486,5 @@ Returns:
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -1,4 +1,5 @@
/** @file /** @file
Variable/Map manipulations routines
Copyright (c) 2006, Intel Corporation Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
@ -9,12 +10,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
IfrVariable.c
Abstract:
Variable/Map manipulations routines
**/ **/
// //
@ -22,6 +17,15 @@ Abstract:
// //
#include "IfrSupportLibInternal.h" #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 Var - Pointer to the variable/map
@param Size - Size of the variable/map in bytes
**/
VOID VOID
EfiLibHiiVariablePackGetMap ( EfiLibHiiVariablePackGetMap (
IN EFI_HII_VARIABLE_PACK *Pack, IN EFI_HII_VARIABLE_PACK *Pack,
@ -31,25 +35,7 @@ EfiLibHiiVariablePackGetMap (
OUT VOID **Var, OPTIONAL OUT VOID **Var, OPTIONAL
OUT UINTN *Size OPTIONAL OUT UINTN *Size OPTIONAL
) )
/*++
Routine Description:
Extracts a variable form a Pack.
Arguments:
Pack - List of variables
Name - Name of the variable/map
Guid - GUID of the variable/map
Var - Pointer to the variable/map
Size - Size of the variable/map in bytes
Returns:
VOID
--*/
{ {
if (NULL != Name) { if (NULL != Name) {
*Name = (VOID *) (Pack + 1); *Name = (VOID *) (Pack + 1);
@ -73,28 +59,17 @@ Returns:
} }
} }
/**
Finds a count of the variables/maps in the List.
@param List - List of variables
@return The number of map count.
**/
UINTN UINTN
EfiLibHiiVariablePackListGetMapCnt ( EfiLibHiiVariablePackListGetMapCnt (
IN EFI_HII_VARIABLE_PACK_LIST *List IN EFI_HII_VARIABLE_PACK_LIST *List
) )
/*++
Routine Description:
Finds a count of the variables/maps in the List.
Arguments:
List - List of variables
Returns:
UINTN - The number of map count.
--*/
{ {
UINTN Cnt = 0; UINTN Cnt = 0;
while (NULL != List) { while (NULL != List) {
@ -104,29 +79,20 @@ Returns:
return Cnt; 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 VOID
EfiLibHiiVariablePackListForEachVar ( EfiLibHiiVariablePackListForEachVar (
IN EFI_HII_VARIABLE_PACK_LIST *List, IN EFI_HII_VARIABLE_PACK_LIST *List,
IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback
) )
/*++
Routine Description:
Will iterate all variable/maps as appearing
in List and for each, it will call the Callback.
Arguments:
List - List of variables
Callback - Routine to be called for each iterated variable.
Returns:
VOID
--*/
{ {
CHAR16 *MapName; CHAR16 *MapName;
@ -145,7 +111,20 @@ Returns:
} }
} }
/**
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 Var - Pointer to the variable/map
@param Size - Size of the variable/map in bytes
@param EFI_SUCCESS - Variable is found, OUT parameters are valid
@param EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid
**/
EFI_STATUS EFI_STATUS
EfiLibHiiVariablePackListGetMapByIdx ( EfiLibHiiVariablePackListGetMapByIdx (
IN UINTN Idx, IN UINTN Idx,
@ -157,28 +136,7 @@ EfiLibHiiVariablePackListGetMapByIdx (
OUT UINTN *Size OUT UINTN *Size
) )
/*++
Routine Description:
Finds a variable form List given
the order number as appears in the List.
Arguments:
Idx - The index of the variable/map to retrieve
List - List of variables
Name - Name of the variable/map
Guid - GUID of the variable/map
Var - Pointer to the variable/map
Size - Size of the variable/map in bytes
Returns:
EFI_SUCCESS - Variable is found, OUT parameters are valid
EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid
--*/
{ {
CHAR16 *MapName; CHAR16 *MapName;
EFI_GUID *MapGuid; EFI_GUID *MapGuid;
@ -214,7 +172,21 @@ Returns:
return EFI_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 EFI_STATUS
EfiLibHiiVariablePackListGetMapById ( EfiLibHiiVariablePackListGetMapById (
IN UINT16 Id, IN UINT16 Id,
@ -224,30 +196,6 @@ EfiLibHiiVariablePackListGetMapById (
OUT VOID **Var, OUT VOID **Var,
OUT UINTN *Size OUT UINTN *Size
) )
/*++
Routine Description:
Finds a variable form List given the
order number as appears in the List.
Arguments:
Id - The ID of the variable/map to retrieve
List - List of variables
Name - Name of the variable/map
Guid - GUID of the variable/map
Var - Pointer to the variable/map
Size - Size of the variable/map in bytes
Returns:
EFI_SUCCESS - Variable is found, OUT parameters are valid
EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid
--*/
{ {
CHAR16 *MapName; CHAR16 *MapName;
EFI_GUID *MapGuid; EFI_GUID *MapGuid;
@ -279,7 +227,18 @@ Returns:
return EFI_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 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 EFI_STATUS
EfiLibHiiVariablePackListGetMap ( EfiLibHiiVariablePackListGetMap (
IN EFI_HII_VARIABLE_PACK_LIST *List, IN EFI_HII_VARIABLE_PACK_LIST *List,
@ -289,28 +248,6 @@ EfiLibHiiVariablePackListGetMap (
OUT VOID **Var, OUT VOID **Var,
OUT UINTN *Size OUT UINTN *Size
) )
/*++
Routine Description:
Finds a variable form EFI_HII_VARIABLE_PACK_LIST given name and GUID.
Arguments:
List - List of variables
Name - Name of the variable/map to be found
Guid - GUID of the variable/map to be found
Var - Pointer to the variable/map found
Size - Size of the variable/map in bytes found
Returns:
EFI_SUCCESS - variable is found, OUT parameters are valid
EFI_NOT_FOUND - variable is not found, OUT parameters are not valid
--*/
{ {
VOID *Map; VOID *Map;
UINTN MapSize; UINTN MapSize;
@ -334,6 +271,21 @@ Returns:
return EFI_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 EFI_STATUS
EfiLibHiiVariableRetrieveFromNv ( EfiLibHiiVariableRetrieveFromNv (
IN CHAR16 *Name, IN CHAR16 *Name,
@ -341,22 +293,7 @@ EfiLibHiiVariableRetrieveFromNv (
IN UINTN Size, IN UINTN Size,
OUT VOID **Var OUT VOID **Var
) )
/*++
Routine Description:
Finds out if a variable of specific Name/Guid/Size exists in NV.
If it does, it will retrieve it into the Var.
Arguments:
Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
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.
Returns:
EFI_SUCCESS - The variable of exact Name/Guid/Size parameters was retrieved and written to Var.
EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN SizeNv; UINTN SizeNv;
@ -394,8 +331,23 @@ Returns:
return EFI_SUCCESS; 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, Guid, Size Parameters of the variable to retrieve. Must match exactly.
@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 <Suffix>.
@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 EFI_STATUS
EfiLibHiiVariableOverrideIfSuffix ( EfiLibHiiVariableOverrideIfSuffix (
IN CHAR16 *Suffix, IN CHAR16 *Suffix,
@ -404,27 +356,6 @@ EfiLibHiiVariableOverrideIfSuffix (
IN UINTN Size, IN UINTN Size,
OUT VOID *Var OUT VOID *Var
) )
/*++
Routine Description:
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.
Arguments:
Suffix - Suffix the Name should end with.
Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
Var - Variable will be retrieved into this buffer.
Caller is responsible for providing storage of exactly Size size in bytes.
Returns:
EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.
EFI_INVALID_PARAMETER - The name of the variable does not end with <Suffix>.
EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
--*/
{ {
UINTN StrLength; UINTN StrLength;
UINTN StrLenSuffix; UINTN StrLenSuffix;
@ -440,6 +371,23 @@ Returns:
return EfiLibHiiVariableRetrieveFromNv (Name, Guid, Size, &Var); 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, Guid, Size Parameters of the variable to retrieve. Must match exactly.
@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 EFI_STATUS
EfiLibHiiVariableOverrideBySuffix ( EfiLibHiiVariableOverrideBySuffix (
IN CHAR16 *Suffix, IN CHAR16 *Suffix,
@ -448,27 +396,7 @@ EfiLibHiiVariableOverrideBySuffix (
IN UINTN Size, IN UINTN Size,
OUT VOID *Var OUT VOID *Var
) )
/*++
Routine Description:
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.
Arguments:
Suffix - Suffix the variable will be appended with.
Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
Var - Variable will be retrieved into this buffer.
Caller is responsible for providing storage of exactly Size size in bytes.
Returns:
EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.
EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
CHAR16 *NameSuffixed; CHAR16 *NameSuffixed;