Replace some CopyMem() for GUID copy with CopyGuid().

Replace some gBS->FreePool() with FreePool().
Add EFIAPI modifier.
Removed inconsistent OPTIONAL modifier.
Coding style issue fix.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7176 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
gdong1
2009-01-04 08:06:07 +00:00
parent 3a306c1006
commit 409f118c84
11 changed files with 244 additions and 252 deletions

View File

@ -36,7 +36,7 @@
@param NumberOfPackages The number of HII packages to prepare. @param NumberOfPackages The number of HII packages to prepare.
@param Guid Package GUID. @param Guid Package GUID.
@Param ... The variable argument list of package pointers. @param ... The variable argument list of package pointers.
@return The allocated and initialized packages. @return The allocated and initialized packages.
**/ **/

View File

@ -41,9 +41,10 @@ typedef struct {
@param Lang Pointer of system language @param Lang Pointer of system language
@return whether sucess to get setting from variable @return whether success to get setting from variable
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
GetCurrentLanguage ( GetCurrentLanguage (
OUT CHAR16 *Lang OUT CHAR16 *Lang
); );
@ -60,6 +61,7 @@ GetCurrentLanguage (
@retval EFI_SUCCESS String successfully added to the incoming buffer @retval EFI_SUCCESS String successfully added to the incoming buffer
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
AddString ( AddString (
IN VOID *StringBuffer, IN VOID *StringBuffer,
IN CHAR16 *Language, IN CHAR16 *Language,
@ -77,6 +79,7 @@ AddString (
@retval EFI_SUCCESS Op-code data successfully inserted @retval EFI_SUCCESS Op-code data successfully inserted
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
AddOpCode ( AddOpCode (
IN VOID *FormBuffer, IN VOID *FormBuffer,
IN OUT VOID *OpCodeData IN OUT VOID *OpCodeData
@ -99,6 +102,7 @@ AddOpCode (
@retval EFI_SUCCESS Formset successfully created @retval EFI_SUCCESS Formset successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateFormSet ( CreateFormSet (
IN CHAR16 *FormSetTitle, IN CHAR16 *FormSetTitle,
IN EFI_GUID *Guid, IN EFI_GUID *Guid,
@ -122,6 +126,7 @@ CreateFormSet (
@retval EFI_SUCCESS Form successfully created @retval EFI_SUCCESS Form successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateForm ( CreateForm (
IN CHAR16 *FormTitle, IN CHAR16 *FormTitle,
IN UINT16 FormId, IN UINT16 FormId,
@ -142,6 +147,7 @@ CreateForm (
@retval EFI_SUCCESS Subtitle successfully created @retval EFI_SUCCESS Subtitle successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateSubTitle ( CreateSubTitle (
IN CHAR16 *SubTitle, IN CHAR16 *SubTitle,
IN OUT VOID *FormBuffer, IN OUT VOID *FormBuffer,
@ -164,6 +170,7 @@ CreateSubTitle (
@retval EFI_SUCCESS Text successfully created @retval EFI_SUCCESS Text successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateText ( CreateText (
IN CHAR16 *String, IN CHAR16 *String,
IN CHAR16 *String2, IN CHAR16 *String2,
@ -185,6 +192,7 @@ CreateText (
@retval EFI_SUCCESS Hyperlink successfully created @retval EFI_SUCCESS Hyperlink successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateGoto ( CreateGoto (
IN UINT16 FormId, IN UINT16 FormId,
IN CHAR16 *Prompt, IN CHAR16 *Prompt,
@ -209,6 +217,7 @@ CreateGoto (
@retval EFI_SUCCESS One-Of box successfully created. @retval EFI_SUCCESS One-Of box successfully created.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateOneOf ( CreateOneOf (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -236,6 +245,7 @@ CreateOneOf (
@retval EFI_SUCCESS Ordered list successfully created. @retval EFI_SUCCESS Ordered list successfully created.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateOrderedList ( CreateOrderedList (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 MaxEntries, IN UINT8 MaxEntries,
@ -262,6 +272,7 @@ CreateOrderedList (
@retval EFI_SUCCESS Check box successfully created @retval EFI_SUCCESS Check box successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateCheckBox ( CreateCheckBox (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -292,6 +303,7 @@ CreateCheckBox (
@retval EFI_SUCCESS Numeric is successfully created @retval EFI_SUCCESS Numeric is successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateNumeric ( CreateNumeric (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -323,6 +335,7 @@ CreateNumeric (
@retval EFI_SUCCESS String successfully created. @retval EFI_SUCCESS String successfully created.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateString ( CreateString (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -350,6 +363,7 @@ CreateString (
@retval EFI_SUCCESS Successfully extract data from Hii database. @retval EFI_SUCCESS Successfully extract data from Hii database.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
ExtractDataFromHiiHandle ( ExtractDataFromHiiHandle (
IN FRAMEWORK_EFI_HII_HANDLE HiiHandle, IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,
IN OUT UINT16 *ImageLength, IN OUT UINT16 *ImageLength,
@ -369,6 +383,7 @@ ExtractDataFromHiiHandle (
@return Handle to the HII pack previously registered by the memory driver. @return Handle to the HII pack previously registered by the memory driver.
**/ **/
FRAMEWORK_EFI_HII_HANDLE FRAMEWORK_EFI_HII_HANDLE
EFIAPI
FindHiiHandle ( FindHiiHandle (
IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL
IN EFI_GUID *Guid IN EFI_GUID *Guid
@ -386,6 +401,7 @@ FindHiiHandle (
@retval EFI_SUCCESS Subtitle created to be a form @retval EFI_SUCCESS Subtitle created to be a form
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateSubTitleOpCode ( CreateSubTitleOpCode (
IN STRING_REF StringToken, IN STRING_REF StringToken,
IN OUT VOID *FormBuffer IN OUT VOID *FormBuffer
@ -408,6 +424,7 @@ CreateSubTitleOpCode (
@retval EFI_SUCCESS Text created to be a form @retval EFI_SUCCESS Text created to be a form
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateTextOpCode ( CreateTextOpCode (
IN STRING_REF StringToken, IN STRING_REF StringToken,
IN STRING_REF StringTokenTwo, IN STRING_REF StringTokenTwo,
@ -434,6 +451,7 @@ CreateTextOpCode (
@retval EFI_SUCCESS Hyperlink created to be a form @retval EFI_SUCCESS Hyperlink created to be a form
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateGotoOpCode ( CreateGotoOpCode (
IN UINT16 FormId, IN UINT16 FormId,
IN STRING_REF StringToken, IN STRING_REF StringToken,
@ -465,6 +483,7 @@ CreateGotoOpCode (
@retval EFI_DEVICE_ERROR DataWidth > 2 @retval EFI_DEVICE_ERROR DataWidth > 2
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateOneOfOpCode ( CreateOneOfOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -495,6 +514,7 @@ CreateOneOfOpCode (
@retval EFI_SUCCESS Ordered list created to be a form @retval EFI_SUCCESS Ordered list created to be a form
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateOrderedListOpCode ( CreateOrderedListOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 MaxEntries, IN UINT8 MaxEntries,
@ -523,6 +543,7 @@ CreateOrderedListOpCode (
@retval EFI_DEVICE_ERROR DataWidth > 1 @retval EFI_DEVICE_ERROR DataWidth > 1
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateCheckBoxOpCode ( CreateCheckBoxOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -556,6 +577,7 @@ CreateCheckBoxOpCode (
@retval EFI_DEVICE_ERROR DataWidth > 2 @retval EFI_DEVICE_ERROR DataWidth > 2
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateNumericOpCode ( CreateNumericOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -589,6 +611,7 @@ CreateNumericOpCode (
@retval EFI_SUCCESS String created to be a form. @retval EFI_SUCCESS String created to be a form.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateStringOpCode ( CreateStringOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -615,6 +638,7 @@ CreateStringOpCode (
@retval EFI_SUCCESS Data successfully validated @retval EFI_SUCCESS Data successfully validated
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
ValidateDataFromHiiHandle ( ValidateDataFromHiiHandle (
IN FRAMEWORK_EFI_HII_HANDLE HiiHandle, IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,
OUT BOOLEAN *Results OUT BOOLEAN *Results
@ -631,6 +655,7 @@ ValidateDataFromHiiHandle (
@retval EFI_SUCCESS Banner created to be a form. @retval EFI_SUCCESS Banner created to be a form.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateBannerOpCode ( CreateBannerOpCode (
IN UINT16 Title, IN UINT16 Title,
IN UINT16 LineNumber, IN UINT16 LineNumber,
@ -649,6 +674,7 @@ CreateBannerOpCode (
@param Size Size of the variable/map in bytes @param Size Size of the variable/map in bytes
**/ **/
VOID VOID
EFIAPI
EfiLibHiiVariablePackGetMap ( EfiLibHiiVariablePackGetMap (
IN EFI_HII_VARIABLE_PACK *Pack, IN EFI_HII_VARIABLE_PACK *Pack,
OUT CHAR16 **Name, OPTIONAL OUT CHAR16 **Name, OPTIONAL
@ -666,6 +692,7 @@ EfiLibHiiVariablePackGetMap (
@return The number of map count. @return The number of map count.
**/ **/
UINTN UINTN
EFIAPI
EfiLibHiiVariablePackListGetMapCnt ( EfiLibHiiVariablePackListGetMapCnt (
IN EFI_HII_VARIABLE_PACK_LIST *List IN EFI_HII_VARIABLE_PACK_LIST *List
); );
@ -696,6 +723,7 @@ typedef VOID (EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK) (
@param Callback Routine to be called for each iterated variable. @param Callback Routine to be called for each iterated variable.
**/ **/
VOID VOID
EFIAPI
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
@ -717,6 +745,7 @@ EfiLibHiiVariablePackListForEachVar (
@return EFI_NOT_FOUND Variable is not found, OUT parameters are not valid @return EFI_NOT_FOUND Variable is not found, OUT parameters are not valid
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
EfiLibHiiVariablePackListGetMapByIdx ( EfiLibHiiVariablePackListGetMapByIdx (
IN UINTN Idx, IN UINTN Idx,
IN EFI_HII_VARIABLE_PACK_LIST *List, IN EFI_HII_VARIABLE_PACK_LIST *List,
@ -742,6 +771,7 @@ EfiLibHiiVariablePackListGetMapByIdx (
@retval EFI_NOT_FOUND Variable is not found, OUT parameters are not valid @retval EFI_NOT_FOUND Variable is not found, OUT parameters are not valid
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
EfiLibHiiVariablePackListGetMapById ( EfiLibHiiVariablePackListGetMapById (
IN UINT16 Id, IN UINT16 Id,
IN EFI_HII_VARIABLE_PACK_LIST *List, IN EFI_HII_VARIABLE_PACK_LIST *List,
@ -765,6 +795,7 @@ EfiLibHiiVariablePackListGetMapById (
@retval EFI_NOT_FOUND variable is not found, OUT parameters are not valid @retval EFI_NOT_FOUND variable is not found, OUT parameters are not valid
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
EfiLibHiiVariablePackListGetMap ( EfiLibHiiVariablePackListGetMap (
IN EFI_HII_VARIABLE_PACK_LIST *List, IN EFI_HII_VARIABLE_PACK_LIST *List,
IN CHAR16 *Name, IN CHAR16 *Name,
@ -789,6 +820,7 @@ EfiLibHiiVariablePackListGetMap (
@retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error. @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
EfiLibHiiVariableRetrieveFromNv ( EfiLibHiiVariableRetrieveFromNv (
IN CHAR16 *Name, IN CHAR16 *Name,
IN EFI_GUID *Guid, IN EFI_GUID *Guid,
@ -805,8 +837,8 @@ EfiLibHiiVariableRetrieveFromNv (
@param Suffix Suffix the Name should end with. @param Suffix Suffix the Name should end with.
@param Name Name of the variable to retrieve. @param Name Name of the variable to retrieve.
@Param Guid Guid of the variable to retrieve. @param Guid Guid of the variable to retrieve.
@Param Size Parameters of the variable to retrieve. @param Size Parameters of the variable to retrieve.
@param Var Variable will be retrieved into this buffer. @param Var Variable will be retrieved into this buffer.
Caller is responsible for providing storage of exactly Size size in bytes. Caller is responsible for providing storage of exactly Size size in bytes.
@ -816,6 +848,7 @@ EfiLibHiiVariableRetrieveFromNv (
@retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error. @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
EfiLibHiiVariableOverrideIfSuffix ( EfiLibHiiVariableOverrideIfSuffix (
IN CHAR16 *Suffix, IN CHAR16 *Suffix,
IN CHAR16 *Name, IN CHAR16 *Name,
@ -843,6 +876,7 @@ EfiLibHiiVariableOverrideIfSuffix (
@retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error. @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
EfiLibHiiVariableOverrideBySuffix ( EfiLibHiiVariableOverrideBySuffix (
IN CHAR16 *Suffix, IN CHAR16 *Suffix,
IN CHAR16 *Name, IN CHAR16 *Name,

View File

@ -86,12 +86,15 @@ typedef UINT16 FRAMEWORK_EFI_HII_HANDLE;
// //
// The following types are currently defined: // The following types are currently defined:
// EFI_FROM_ID has been defined in UEFI spec. // EFI_FORM_ID has been defined in UEFI spec.
// //
typedef UINT16 EFI_FORM_LABEL; typedef UINT16 EFI_FORM_LABEL;
#pragma pack(1) #pragma pack(1)
//
// The header found at the start of each package.
//
typedef struct { typedef struct {
UINT32 Length; UINT32 Length;
UINT16 Type; UINT16 Type;

View File

@ -32,9 +32,9 @@ EFI_HII_PROTOCOL *mHii = NULL;
instance. instance.
If protocol of gEfiHiiProtocolGuid is not installed, then ASSERT(). If protocol of gEfiHiiProtocolGuid is not installed, then ASSERT().
@param ImageHandle The image handle of driver module who use this library @param ImageHandle The image handle of driver module who use this library instance.
instance.
@param SystemTable Pointer to the EFI System Table. @param SystemTable Pointer to the EFI System Table.
@retval EFI_SUCCESS library constuctor always success. @retval EFI_SUCCESS library constuctor always success.
**/ **/
EFI_STATUS EFI_STATUS
@ -95,7 +95,6 @@ InternalPreparePackages (
} }
return HiiPackages; return HiiPackages;
} }
/** /**
@ -106,7 +105,7 @@ InternalPreparePackages (
@param NumberOfPackages The number of HII packages to prepare. @param NumberOfPackages The number of HII packages to prepare.
@param Guid Package GUID. @param Guid Package GUID.
@Param ... The variable argument list of package pointers. @param ... The variable argument list of package pointers.
@return The allocated and initialized packages. @return The allocated and initialized packages.
**/ **/
@ -121,7 +120,6 @@ PreparePackages (
VA_LIST Args; VA_LIST Args;
VA_START (Args, Guid); VA_START (Args, Guid);
return InternalPreparePackages (NumberOfPackages, Guid, Args); return InternalPreparePackages (NumberOfPackages, Guid, Args);
} }
@ -141,8 +139,7 @@ PreparePackages (
@param HiiHandle The ID used to retrieve the Package List later. @param HiiHandle The ID used to retrieve the Package List later.
@param ... The variable argument list describing all HII Package. @param ... The variable argument list describing all HII Package.
@return @return The allocated and initialized packages.
The allocated and initialized packages.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
@ -150,7 +147,7 @@ HiiLibAddPackages (
IN UINTN NumberOfPackages, IN UINTN NumberOfPackages,
IN CONST EFI_GUID *GuidId, IN CONST EFI_GUID *GuidId,
IN EFI_HANDLE DriverHandle, OPTIONAL IN EFI_HANDLE DriverHandle, OPTIONAL
OUT EFI_HII_HANDLE *HiiHandle, OPTIONAL OUT EFI_HII_HANDLE *HiiHandle,
... ...
) )
{ {
@ -159,10 +156,9 @@ HiiLibAddPackages (
FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle; FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle;
EFI_STATUS Status; EFI_STATUS Status;
VA_START (Args, HiiHandle); VA_START (Args, HiiHandle);
FrameworkHiiPacages = InternalPreparePackages (NumberOfPackages, GuidId, Args);
FrameworkHiiPacages = InternalPreparePackages (NumberOfPackages, GuidId, Args);
Status = mHii->NewPack (mHii, FrameworkHiiPacages, &FrameworkHiiHandle); Status = mHii->NewPack (mHii, FrameworkHiiPacages, &FrameworkHiiHandle);
if (HiiHandle != NULL) { if (HiiHandle != NULL) {
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -184,7 +180,6 @@ HiiLibAddPackages (
If HiiHandle is not a valid EFI_HII_HANDLE in the default HII database, then ASSERT. If HiiHandle is not a valid EFI_HII_HANDLE in the default HII database, then ASSERT.
@param HiiHandle The handle that was previously registered to the data base that is requested for removal. @param HiiHandle The handle that was previously registered to the data base that is requested for removal.
List later.
@return VOID @return VOID
**/ **/
@ -200,7 +195,6 @@ HiiLibRemovePackages (
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
} }
/** /**
This function adds the string into String Package of each language. This function adds the string into String Package of each language.
@ -254,7 +248,6 @@ HiiLibNewString (
@retval EFI_SUCCESS Operation is successful. @retval EFI_SUCCESS Operation is successful.
@retval EFI_OUT_OF_RESOURCES There is not enought memory in the system. @retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
@ -302,8 +295,9 @@ HiiLibGetStringFromHandle (
The implement set DriverHandle to NULL simpliy to let The implement set DriverHandle to NULL simpliy to let
handle manager create a default new handle. handle manager create a default new handle.
@param[out] DriverHandle the pointer of driver handle @param DriverHandle The pointer of driver handle
@return always successful.
@return Always success.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI

View File

@ -26,6 +26,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@return whether sucess to get setting from variable @return whether sucess to get setting from variable
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
GetCurrentLanguage ( GetCurrentLanguage (
OUT CHAR16 *Lang OUT CHAR16 *Lang
) )
@ -39,7 +40,6 @@ GetCurrentLanguage (
// Getting the system language and placing it into our Global Data // Getting the system language and placing it into our Global Data
// //
Size = sizeof (Language); Size = sizeof (Language);
Status = gRT->GetVariable ( Status = gRT->GetVariable (
(CHAR16 *) L"Lang", (CHAR16 *) L"Lang",
&gEfiGlobalVariableGuid, &gEfiGlobalVariableGuid,
@ -47,7 +47,6 @@ GetCurrentLanguage (
&Size, &Size,
Language Language
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
AsciiStrCpy (Language, "eng"); AsciiStrCpy (Language, "eng");
} }
@ -80,6 +79,7 @@ GetCurrentLanguage (
@retval EFI_SUCCESS String successfully added to the incoming buffer @retval EFI_SUCCESS String successfully added to the incoming buffer
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
AddString ( AddString (
IN VOID *StringBuffer, IN VOID *StringBuffer,
IN CHAR16 *Language, IN CHAR16 *Language,
@ -146,8 +146,8 @@ AddString (
// //
// Add a new stringpointer in the new buffer since we are adding a string. Null terminate it // Add a new stringpointer in the new buffer since we are adding a string. Null terminate it
// //
PackDestination[Index] = (UINT16)(PackDestination[Index-1] + PackDestination[Index] = (UINT16)(PackDestination[Index - 1] +
StrSize((CHAR16 *)((CHAR8 *)(StringPack) + PackSource[Index-1]))); StrSize((CHAR16 *)((CHAR8 *)(StringPack) + PackSource[Index - 1])));
PackDestination[Index + 1] = (UINT16) 0; PackDestination[Index + 1] = (UINT16) 0;
// //
@ -274,7 +274,7 @@ AddString (
// //
// Free the newly created buffer since we don't need it anymore // Free the newly created buffer since we don't need it anymore
// //
gBS->FreePool (NewBuffer); FreePool (NewBuffer);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -288,6 +288,7 @@ AddString (
@retval EFI_SUCCESS Op-code data successfully inserted @retval EFI_SUCCESS Op-code data successfully inserted
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
AddOpCode ( AddOpCode (
IN VOID *FormBuffer, IN VOID *FormBuffer,
IN OUT VOID *OpCodeData IN OUT VOID *OpCodeData
@ -307,12 +308,11 @@ AddOpCode (
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
Source = (UINT8 *) FormBuffer;
Destination = (UINT8 *) NewBuffer;
// //
// Copy the IFR Package header to the new buffer // Copy the IFR Package header to the new buffer
// //
Source = (UINT8 *) FormBuffer;
Destination = (UINT8 *) NewBuffer;
CopyMem (Destination, Source, sizeof (EFI_HII_PACK_HEADER)); CopyMem (Destination, Source, sizeof (EFI_HII_PACK_HEADER));
// //
@ -326,7 +326,7 @@ AddOpCode (
// //
for (; ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->OpCode != FRAMEWORK_EFI_IFR_END_FORM_OP;) { for (; ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->OpCode != FRAMEWORK_EFI_IFR_END_FORM_OP;) {
// //
// If the this opcode is an end_form_set we better be creating and endform // 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 // 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 // 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. // since we will possibly do a 0 byte copy in this particular end-case.
@ -351,8 +351,8 @@ AddOpCode (
// Prior to the end_form is where we insert the new op-code data // Prior to the end_form is where we insert the new op-code data
// //
CopyMem (Destination, OpCodeData, ((FRAMEWORK_EFI_IFR_OP_HEADER *) OpCodeData)->Length); CopyMem (Destination, OpCodeData, ((FRAMEWORK_EFI_IFR_OP_HEADER *) OpCodeData)->Length);
Destination = Destination + (UINTN) ((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)); NewBuffer->Length = (UINT32) (NewBuffer->Length + (UINT32) (((FRAMEWORK_EFI_IFR_OP_HEADER *) OpCodeData)->Length));
// //
@ -361,14 +361,10 @@ AddOpCode (
CopyMem (Destination, Source, ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length); CopyMem (Destination, Source, ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length);
// //
// Adjust Source/Destination to next op-code location // Copy end-formset data to new buffer
// //
Destination = Destination + (UINTN) ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length; Destination = Destination + (UINTN) ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length;
Source = Source + (UINTN) ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length; Source = Source + (UINTN) ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length;
//
// Copy end-formset data to new buffer
//
CopyMem (Destination, Source, ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length); CopyMem (Destination, Source, ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length);
// //
@ -380,7 +376,7 @@ AddOpCode (
// //
// Free the newly created buffer since we don't need it anymore // Free the newly created buffer since we don't need it anymore
// //
gBS->FreePool (NewBuffer); FreePool (NewBuffer);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -392,6 +388,7 @@ AddOpCode (
@return the statue of locating HII protocol @return the statue of locating HII protocol
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
GetHiiInterface ( GetHiiInterface (
OUT EFI_HII_PROTOCOL **Hii OUT EFI_HII_PROTOCOL **Hii
) )
@ -424,6 +421,7 @@ GetHiiInterface (
@retval EFI_SUCCESS Successfully extract data from Hii database. @retval EFI_SUCCESS Successfully extract data from Hii database.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
ExtractDataFromHiiHandle ( ExtractDataFromHiiHandle (
IN FRAMEWORK_EFI_HII_HANDLE HiiHandle, IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,
IN OUT UINT16 *ImageLength, IN OUT UINT16 *ImageLength,
@ -463,7 +461,7 @@ ExtractDataFromHiiHandle (
// //
Status = Hii->GetForms (Hii, HiiHandle, 0, &DataLength, RawData); Status = Hii->GetForms (Hii, HiiHandle, 0, &DataLength, RawData);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (RawData); FreePool (RawData);
// //
// Allocate space for retrieval of IFR data // Allocate space for retrieval of IFR data
@ -493,7 +491,7 @@ ExtractDataFromHiiHandle (
// //
// Copy the GUID information from this handle // Copy the GUID information from this handle
// //
CopyMem (Guid, &((FRAMEWORK_EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID)); CopyGuid (Guid, &((FRAMEWORK_EFI_IFR_FORM_SET *) &RawData[Index])->Guid);
break; break;
case FRAMEWORK_EFI_IFR_ONE_OF_OP: case FRAMEWORK_EFI_IFR_ONE_OF_OP:
@ -523,7 +521,7 @@ ExtractDataFromHiiHandle (
// Return an error if buffer is too small // Return an error if buffer is too small
// //
if (SizeOfNvStore > *ImageLength) { if (SizeOfNvStore > *ImageLength) {
gBS->FreePool (OldData); FreePool (OldData);
*ImageLength = (UINT16) SizeOfNvStore; *ImageLength = (UINT16) SizeOfNvStore;
return EFI_BUFFER_TOO_SMALL; return EFI_BUFFER_TOO_SMALL;
} }
@ -570,7 +568,7 @@ ExtractDataFromHiiHandle (
// //
// Free our temporary repository of form data // Free our temporary repository of form data
// //
gBS->FreePool (OldData); FreePool (OldData);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -587,6 +585,7 @@ ExtractDataFromHiiHandle (
@return Handle to the HII pack previously registered by the memory driver. @return Handle to the HII pack previously registered by the memory driver.
**/ **/
FRAMEWORK_EFI_HII_HANDLE FRAMEWORK_EFI_HII_HANDLE
EFIAPI
FindHiiHandle ( FindHiiHandle (
IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL
IN EFI_GUID *Guid IN EFI_GUID *Guid
@ -646,7 +645,7 @@ FindHiiHandle (
// //
if (Status == EFI_BUFFER_TOO_SMALL) { if (Status == EFI_BUFFER_TOO_SMALL) {
gBS->FreePool (HiiHandleBuffer); FreePool (HiiHandleBuffer);
HiiHandleBuffer = AllocatePool (HiiHandleBufferLength); HiiHandleBuffer = AllocatePool (HiiHandleBufferLength);
ASSERT (HiiHandleBuffer != NULL); ASSERT (HiiHandleBuffer != NULL);
@ -679,7 +678,7 @@ FindHiiHandle (
} }
lbl_exit: lbl_exit:
gBS->FreePool (HiiHandleBuffer); FreePool (HiiHandleBuffer);
return HiiHandle; return HiiHandle;
} }
@ -697,6 +696,7 @@ lbl_exit:
@retval EFI_SUCCESS Data successfully validated @retval EFI_SUCCESS Data successfully validated
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
ValidateDataFromHiiHandle ( ValidateDataFromHiiHandle (
IN FRAMEWORK_EFI_HII_HANDLE HiiHandle, IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,
OUT BOOLEAN *Results OUT BOOLEAN *Results
@ -739,7 +739,7 @@ ValidateDataFromHiiHandle (
// //
Status = Hii->GetForms (Hii, HiiHandle, 0, &RawDataLength, RawData); Status = Hii->GetForms (Hii, HiiHandle, 0, &RawDataLength, RawData);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (RawData); FreePool (RawData);
// //
// Allocate space for retrieval of IFR data // Allocate space for retrieval of IFR data
@ -764,10 +764,9 @@ ValidateDataFromHiiHandle (
for (Index = 0; RawData[Index] != FRAMEWORK_EFI_IFR_END_FORM_SET_OP;) { for (Index = 0; RawData[Index] != FRAMEWORK_EFI_IFR_END_FORM_SET_OP;) {
if (RawData[Index] == FRAMEWORK_EFI_IFR_FORM_SET_OP) { if (RawData[Index] == FRAMEWORK_EFI_IFR_FORM_SET_OP) {
CopyMem (&Guid, &((FRAMEWORK_EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID)); CopyGuid (&Guid, &((FRAMEWORK_EFI_IFR_FORM_SET *) &RawData[Index])->Guid);
break; break;
} }
Index = RawData[Index + 1] + Index; Index = RawData[Index + 1] + Index;
} }
@ -829,7 +828,7 @@ ValidateDataFromHiiHandle (
// //
// Free the buffer that was allocated that was too small // Free the buffer that was allocated that was too small
// //
gBS->FreePool (VariableData); FreePool (VariableData);
VariableData = AllocatePool (SizeOfNvStore); VariableData = AllocatePool (SizeOfNvStore);
if (VariableData == NULL) { if (VariableData == NULL) {

View File

@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "IfrSupportLibInternal.h" #include "IfrSupportLibInternal.h"
/** /**
Create a formset Create a formset.
The form package is a collection of forms that are intended to describe the pages that will be The form package is a collection of forms that are intended to describe the pages that will be
displayed to the user. displayed to the user.
@ -31,6 +31,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@retval EFI_SUCCESS Formset successfully created @retval EFI_SUCCESS Formset successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateFormSet ( CreateFormSet (
IN CHAR16 *FormSetTitle, IN CHAR16 *FormSetTitle,
IN EFI_GUID *Guid, IN EFI_GUID *Guid,
@ -61,20 +62,15 @@ CreateFormSet (
// //
StringBuffer = AllocateZeroPool (DEFAULT_STRING_BUFFER_SIZE); StringBuffer = AllocateZeroPool (DEFAULT_STRING_BUFFER_SIZE);
if (StringBuffer == NULL) { if (StringBuffer == NULL) {
gBS->FreePool (FormBuffer); FreePool (FormBuffer);
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
// //
// Obtain current language value // Add FormSetTitle to the StringBuffer, get FormSetTitle's token
// //
GetCurrentLanguage (CurrentLanguage); GetCurrentLanguage (CurrentLanguage);
//
// Add the FormSetTitle to the string buffer and get the StringToken
//
Status = AddString (*StringBuffer, CurrentLanguage, FormSetTitle, &StringToken); Status = AddString (*StringBuffer, CurrentLanguage, FormSetTitle, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -93,7 +89,7 @@ CreateFormSet (
FormSet.FormSetTitle = StringToken; FormSet.FormSetTitle = StringToken;
FormSet.Class = Class; FormSet.Class = Class;
FormSet.SubClass = SubClass; FormSet.SubClass = SubClass;
CopyMem (&FormSet.Guid, Guid, sizeof (EFI_GUID)); CopyGuid (&FormSet.Guid, Guid);
// //
// Initialize the end formset data // Initialize the end formset data
@ -101,20 +97,18 @@ CreateFormSet (
EndFormSet.Header.Length = sizeof (FRAMEWORK_EFI_IFR_END_FORM_SET); EndFormSet.Header.Length = sizeof (FRAMEWORK_EFI_IFR_END_FORM_SET);
EndFormSet.Header.OpCode = FRAMEWORK_EFI_IFR_END_FORM_SET_OP; EndFormSet.Header.OpCode = FRAMEWORK_EFI_IFR_END_FORM_SET_OP;
Destination = (UINT8 *) *FormBuffer;
// //
// Copy the formset/endformset data to the form buffer // Copy the formset/endformset data to the form buffer
// //
Destination = (UINT8 *) *FormBuffer;
CopyMem (Destination, &IfrPack, sizeof (EFI_HII_PACK_HEADER)); CopyMem (Destination, &IfrPack, sizeof (EFI_HII_PACK_HEADER));
Destination = Destination + sizeof (EFI_HII_PACK_HEADER); Destination = Destination + sizeof (EFI_HII_PACK_HEADER);
CopyMem (Destination, &FormSet, sizeof (FRAMEWORK_EFI_IFR_FORM_SET)); CopyMem (Destination, &FormSet, sizeof (FRAMEWORK_EFI_IFR_FORM_SET));
Destination = Destination + sizeof (FRAMEWORK_EFI_IFR_FORM_SET); Destination = Destination + sizeof (FRAMEWORK_EFI_IFR_FORM_SET);
CopyMem (Destination, &EndFormSet, sizeof (FRAMEWORK_EFI_IFR_END_FORM_SET)); CopyMem (Destination, &EndFormSet, sizeof (FRAMEWORK_EFI_IFR_END_FORM_SET));
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -132,6 +126,7 @@ CreateFormSet (
@retval EFI_SUCCESS Form successfully created @retval EFI_SUCCESS Form successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateForm ( CreateForm (
IN CHAR16 *FormTitle, IN CHAR16 *FormTitle,
IN UINT16 FormId, IN UINT16 FormId,
@ -146,12 +141,10 @@ CreateForm (
STRING_REF StringToken; STRING_REF StringToken;
// //
// Obtain current language value // Add FormTitle to the StringBuffer, get FormTitle's token
// //
GetCurrentLanguage (CurrentLanguage); GetCurrentLanguage (CurrentLanguage);
Status = AddString (StringBuffer, CurrentLanguage, FormTitle, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, FormTitle, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -162,7 +155,6 @@ CreateForm (
Form.FormTitle = StringToken; Form.FormTitle = StringToken;
Status = AddOpCode (FormBuffer, &Form); Status = AddOpCode (FormBuffer, &Form);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -176,7 +168,7 @@ CreateForm (
} }
/** /**
Create a SubTitle Create a SubTitle.
Subtitle strings are intended to be used by authors to separate sections of questions into semantic Subtitle strings are intended to be used by authors to separate sections of questions into semantic
groups. groups.
@ -188,6 +180,7 @@ CreateForm (
@retval EFI_SUCCESS Subtitle successfully created @retval EFI_SUCCESS Subtitle successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateSubTitle ( CreateSubTitle (
IN CHAR16 *SubTitle, IN CHAR16 *SubTitle,
IN OUT VOID *FormBuffer, IN OUT VOID *FormBuffer,
@ -200,12 +193,10 @@ CreateSubTitle (
STRING_REF StringToken; STRING_REF StringToken;
// //
// Obtain current language value // Add SubTitle to the StringBuffer, get SubTitle's token
// //
GetCurrentLanguage (CurrentLanguage); GetCurrentLanguage (CurrentLanguage);
Status = AddString (StringBuffer, CurrentLanguage, SubTitle, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, SubTitle, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -220,7 +211,7 @@ CreateSubTitle (
} }
/** /**
Create a line of text Create a line of text.
Unlike HTML, text is simply another tag. Unlike HTML, text is simply another tag.
This tag type enables IFR to be more easily localized. This tag type enables IFR to be more easily localized.
@ -235,6 +226,7 @@ CreateSubTitle (
@retval EFI_SUCCESS Text successfully created @retval EFI_SUCCESS Text successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateText ( CreateText (
IN CHAR16 *String, IN CHAR16 *String,
IN CHAR16 *String2, IN CHAR16 *String2,
@ -251,15 +243,10 @@ CreateText (
STRING_REF StringToken; STRING_REF StringToken;
// //
// Obtain current language value // Add first string to the StringBuffer, get first string's token
// //
GetCurrentLanguage (CurrentLanguage); GetCurrentLanguage (CurrentLanguage);
//
// Add first string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, String, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, String, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -272,13 +259,11 @@ CreateText (
// Add second string, get first string's token // Add second string, get first string's token
// //
Status = AddString (StringBuffer, CurrentLanguage, String2, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, String2, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
Text.TextTwo = StringToken; Text.TextTwo = StringToken;
Text.Flags = (UINT8) (Flags | FRAMEWORK_EFI_IFR_FLAG_CREATED); Text.Flags = (UINT8) (Flags | FRAMEWORK_EFI_IFR_FLAG_CREATED);
Text.Key = Key; Text.Key = Key;
@ -286,7 +271,6 @@ CreateText (
// Add second string, get first string's token // Add second string, get first string's token
// //
Status = AddString (StringBuffer, CurrentLanguage, String3, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, String3, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -309,6 +293,7 @@ CreateText (
@retval EFI_SUCCESS Hyperlink successfully created @retval EFI_SUCCESS Hyperlink successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateGoto ( CreateGoto (
IN UINT16 FormId, IN UINT16 FormId,
IN CHAR16 *Prompt, IN CHAR16 *Prompt,
@ -322,12 +307,10 @@ CreateGoto (
STRING_REF StringToken; STRING_REF StringToken;
// //
// Obtain current language value // Add Prompt string to the StringBuffer, get Prompt string's token
// //
GetCurrentLanguage (CurrentLanguage); GetCurrentLanguage (CurrentLanguage);
Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -359,6 +342,7 @@ CreateGoto (
@retval EFI_SUCCESS One-Of box successfully created. @retval EFI_SUCCESS One-Of box successfully created.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateOneOf ( CreateOneOf (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -386,15 +370,10 @@ CreateOneOf (
} }
// //
// Obtain current language value // Add Prompt string to the StringBuffer, get Prompt string's token
// //
GetCurrentLanguage (CurrentLanguage); GetCurrentLanguage (CurrentLanguage);
//
// Add first string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -406,10 +385,9 @@ CreateOneOf (
OneOf.Prompt = StringToken; OneOf.Prompt = StringToken;
// //
// Add second string, get first string's token // Add Help string to the StringBuffer, get Help string's token
// //
Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -417,7 +395,6 @@ CreateOneOf (
OneOf.Help = StringToken; OneOf.Help = StringToken;
Status = AddOpCode (FormBuffer, &OneOf); Status = AddOpCode (FormBuffer, &OneOf);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -427,7 +404,7 @@ CreateOneOf (
OneOfOption.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION); OneOfOption.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION);
// //
// Add string and get token back // Add OptionString string to the StringBuffer, get OptionString string's token
// //
Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken);
@ -437,7 +414,6 @@ CreateOneOf (
OneOfOption.Key = OptionsList[Index].Key; OneOfOption.Key = OptionsList[Index].Key;
Status = AddOpCode (FormBuffer, &OneOfOption); Status = AddOpCode (FormBuffer, &OneOfOption);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -447,7 +423,6 @@ CreateOneOf (
EndOneOf.Header.OpCode = FRAMEWORK_EFI_IFR_END_ONE_OF_OP; EndOneOf.Header.OpCode = FRAMEWORK_EFI_IFR_END_ONE_OF_OP;
Status = AddOpCode (FormBuffer, &EndOneOf); Status = AddOpCode (FormBuffer, &EndOneOf);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -471,6 +446,7 @@ CreateOneOf (
@retval EFI_SUCCESS Ordered list successfully created. @retval EFI_SUCCESS Ordered list successfully created.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateOrderedList ( CreateOrderedList (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 MaxEntries, IN UINT8 MaxEntries,
@ -491,15 +467,10 @@ CreateOrderedList (
STRING_REF StringToken; STRING_REF StringToken;
// //
// Obtain current language value // Add Prompt string to the StringBuffer, get Prompt string's token
// //
GetCurrentLanguage (CurrentLanguage); GetCurrentLanguage (CurrentLanguage);
//
// Add first string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -511,10 +482,9 @@ CreateOrderedList (
OrderedList.Prompt = StringToken; OrderedList.Prompt = StringToken;
// //
// Add second string, get first string's token // Add Help string to the StringBuffer, get Help string's token
// //
Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -522,7 +492,6 @@ CreateOrderedList (
OrderedList.Help = StringToken; OrderedList.Help = StringToken;
Status = AddOpCode (FormBuffer, &OrderedList); Status = AddOpCode (FormBuffer, &OrderedList);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -532,7 +501,7 @@ CreateOrderedList (
OrderedListOption.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION); OrderedListOption.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION);
// //
// Add string and get token back // Add OptionString string to the StringBuffer, get OptionString string's token
// //
Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken);
@ -542,7 +511,6 @@ CreateOrderedList (
OrderedListOption.Key = OptionsList[Index].Key; OrderedListOption.Key = OptionsList[Index].Key;
Status = AddOpCode (FormBuffer, &OrderedListOption); Status = AddOpCode (FormBuffer, &OrderedListOption);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -571,6 +539,7 @@ CreateOrderedList (
@retval EFI_SUCCESS Check box successfully created @retval EFI_SUCCESS Check box successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateCheckBox ( CreateCheckBox (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -594,15 +563,10 @@ CreateCheckBox (
} }
// //
// Obtain current language value // Add Prompt string to the StringBuffer, get Prompt string's token
// //
GetCurrentLanguage (CurrentLanguage); GetCurrentLanguage (CurrentLanguage);
//
// Add first string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -614,10 +578,9 @@ CreateCheckBox (
CheckBox.Prompt = StringToken; CheckBox.Prompt = StringToken;
// //
// Add second string, get first string's token // Add Help string to the StringBuffer, get Help string's token
// //
Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -631,7 +594,7 @@ CreateCheckBox (
} }
/** /**
Create a numeric Create a numeric.
@param QuestionId Question ID of the numeric @param QuestionId Question ID of the numeric
@param DataWidth DataWidth of the numeric @param DataWidth DataWidth of the numeric
@ -650,6 +613,7 @@ CreateCheckBox (
@retval EFI_SUCCESS Numeric is successfully created @retval EFI_SUCCESS Numeric is successfully created
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateNumeric ( CreateNumeric (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -678,15 +642,10 @@ CreateNumeric (
} }
// //
// Obtain current language value // Add Prompt string to the StringBuffer, get Prompt string's token
// //
GetCurrentLanguage (CurrentLanguage); GetCurrentLanguage (CurrentLanguage);
//
// Add first string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -698,10 +657,9 @@ CreateNumeric (
Numeric.Prompt = StringToken; Numeric.Prompt = StringToken;
// //
// Add second string, get first string's token // Add Help string to the StringBuffer, get Help string's token
// //
Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -736,6 +694,7 @@ CreateNumeric (
@retval EFI_SUCCESS String successfully created. @retval EFI_SUCCESS String successfully created.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateString ( CreateString (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -755,15 +714,10 @@ CreateString (
STRING_REF StringToken; STRING_REF StringToken;
// //
// Obtain current language value // Add Prompt string to the StringBuffer, get Prompt string's token
// //
GetCurrentLanguage (CurrentLanguage); GetCurrentLanguage (CurrentLanguage);
//
// Add first string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -775,10 +729,9 @@ CreateString (
String.Prompt = StringToken; String.Prompt = StringToken;
// //
// Add second string, get first string's token // Add Help string to the StringBuffer, get Help string's token
// //
Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken); Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }

View File

@ -27,6 +27,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@retval EFI_SUCCESS Subtitle created to be a form @retval EFI_SUCCESS Subtitle created to be a form
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateSubTitleOpCode ( CreateSubTitleOpCode (
IN STRING_REF StringToken, IN STRING_REF StringToken,
IN OUT VOID *FormBuffer IN OUT VOID *FormBuffer
@ -39,6 +40,7 @@ CreateSubTitleOpCode (
Subtitle.SubTitle = StringToken; Subtitle.SubTitle = StringToken;
CopyMem (FormBuffer, &Subtitle, sizeof (FRAMEWORK_EFI_IFR_SUBTITLE)); CopyMem (FormBuffer, &Subtitle, sizeof (FRAMEWORK_EFI_IFR_SUBTITLE));
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -59,6 +61,7 @@ CreateSubTitleOpCode (
@retval EFI_SUCCESS Text created to be a form @retval EFI_SUCCESS Text created to be a form
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateTextOpCode ( CreateTextOpCode (
IN STRING_REF StringToken, IN STRING_REF StringToken,
IN STRING_REF StringTokenTwo, IN STRING_REF StringTokenTwo,
@ -101,6 +104,7 @@ CreateTextOpCode (
@retval EFI_SUCCESS Hyperlink created to be a form @retval EFI_SUCCESS Hyperlink created to be a form
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateGotoOpCode ( CreateGotoOpCode (
IN UINT16 FormId, IN UINT16 FormId,
IN STRING_REF StringToken, IN STRING_REF StringToken,
@ -147,6 +151,7 @@ CreateGotoOpCode (
@retval EFI_DEVICE_ERROR DataWidth > 2 @retval EFI_DEVICE_ERROR DataWidth > 2
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateOneOfOpCode ( CreateOneOfOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -226,6 +231,7 @@ CreateOneOfOpCode (
@retval EFI_SUCCESS Ordered list created to be a form @retval EFI_SUCCESS Ordered list created to be a form
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateOrderedListOpCode ( CreateOrderedListOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 MaxEntries, IN UINT8 MaxEntries,
@ -296,6 +302,7 @@ CreateOrderedListOpCode (
@retval EFI_DEVICE_ERROR DataWidth > 1 @retval EFI_DEVICE_ERROR DataWidth > 1
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateCheckBoxOpCode ( CreateCheckBoxOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -352,6 +359,7 @@ CreateCheckBoxOpCode (
@retval EFI_DEVICE_ERROR DataWidth > 2 @retval EFI_DEVICE_ERROR DataWidth > 2
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateNumericOpCode ( CreateNumericOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -412,6 +420,7 @@ CreateNumericOpCode (
@retval EFI_SUCCESS String created to be a form. @retval EFI_SUCCESS String created to be a form.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateStringOpCode ( CreateStringOpCode (
IN UINT16 QuestionId, IN UINT16 QuestionId,
IN UINT8 DataWidth, IN UINT8 DataWidth,
@ -453,6 +462,7 @@ CreateStringOpCode (
@retval EFI_SUCCESS Banner created to be a form. @retval EFI_SUCCESS Banner created to be a form.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
CreateBannerOpCode ( CreateBannerOpCode (
IN UINT16 Title, IN UINT16 Title,
IN UINT16 LineNumber, IN UINT16 LineNumber,

View File

@ -25,6 +25,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@param Size Size of the variable/map in bytes @param Size Size of the variable/map in bytes
**/ **/
VOID VOID
EFIAPI
EfiLibHiiVariablePackGetMap ( EfiLibHiiVariablePackGetMap (
IN EFI_HII_VARIABLE_PACK *Pack, IN EFI_HII_VARIABLE_PACK *Pack,
OUT CHAR16 **Name, OPTIONAL OUT CHAR16 **Name, OPTIONAL
@ -64,6 +65,7 @@ EfiLibHiiVariablePackGetMap (
@return The number of map count. @return The number of map count.
**/ **/
UINTN UINTN
EFIAPI
EfiLibHiiVariablePackListGetMapCnt ( EfiLibHiiVariablePackListGetMapCnt (
IN EFI_HII_VARIABLE_PACK_LIST *List IN EFI_HII_VARIABLE_PACK_LIST *List
) )
@ -86,6 +88,7 @@ EfiLibHiiVariablePackListGetMapCnt (
@param Callback Routine to be called for each iterated variable. @param Callback Routine to be called for each iterated variable.
**/ **/
VOID VOID
EFIAPI
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
@ -123,6 +126,7 @@ EfiLibHiiVariablePackListForEachVar (
@return EFI_NOT_FOUND Variable is not found, OUT parameters are not valid @return EFI_NOT_FOUND Variable is not found, OUT parameters are not valid
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
EfiLibHiiVariablePackListGetMapByIdx ( EfiLibHiiVariablePackListGetMapByIdx (
IN UINTN Idx, IN UINTN Idx,
IN EFI_HII_VARIABLE_PACK_LIST *List, IN EFI_HII_VARIABLE_PACK_LIST *List,
@ -156,8 +160,10 @@ EfiLibHiiVariablePackListGetMapByIdx (
if (NULL != Id) { if (NULL != Id) {
*Id = MapId; *Id = MapId;
} }
//
return EFI_SUCCESS; // Map found // Map found
//
return EFI_SUCCESS;
} }
List = List->NextVariablePack; List = List->NextVariablePack;
} }
@ -182,6 +188,7 @@ EfiLibHiiVariablePackListGetMapByIdx (
@retval EFI_NOT_FOUND Variable is not found, OUT parameters are not valid @retval EFI_NOT_FOUND Variable is not found, OUT parameters are not valid
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
EfiLibHiiVariablePackListGetMapById ( EfiLibHiiVariablePackListGetMapById (
IN UINT16 Id, IN UINT16 Id,
IN EFI_HII_VARIABLE_PACK_LIST *List, IN EFI_HII_VARIABLE_PACK_LIST *List,
@ -235,6 +242,7 @@ EfiLibHiiVariablePackListGetMapById (
@retval EFI_NOT_FOUND variable is not found, OUT parameters are not valid @retval EFI_NOT_FOUND variable is not found, OUT parameters are not valid
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
EfiLibHiiVariablePackListGetMap ( EfiLibHiiVariablePackListGetMap (
IN EFI_HII_VARIABLE_PACK_LIST *List, IN EFI_HII_VARIABLE_PACK_LIST *List,
IN CHAR16 *Name, IN CHAR16 *Name,
@ -282,6 +290,7 @@ EfiLibHiiVariablePackListGetMap (
@retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error. @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
EfiLibHiiVariableRetrieveFromNv ( EfiLibHiiVariableRetrieveFromNv (
IN CHAR16 *Name, IN CHAR16 *Name,
IN EFI_GUID *Guid, IN EFI_GUID *Guid,
@ -334,8 +343,8 @@ EfiLibHiiVariableRetrieveFromNv (
@param Suffix Suffix the Name should end with. @param Suffix Suffix the Name should end with.
@param Name Name of the variable to retrieve. @param Name Name of the variable to retrieve.
@Param Guid Guid of the variable to retrieve. @param Guid Guid of the variable to retrieve.
@Param Size Parameters of the variable to retrieve. @param Size Parameters of the variable to retrieve.
@param Var Variable will be retrieved into this buffer. @param Var Variable will be retrieved into this buffer.
Caller is responsible for providing storage of exactly Size size in bytes. Caller is responsible for providing storage of exactly Size size in bytes.
@ -345,6 +354,7 @@ EfiLibHiiVariableRetrieveFromNv (
@retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error. @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
EfiLibHiiVariableOverrideIfSuffix ( EfiLibHiiVariableOverrideIfSuffix (
IN CHAR16 *Suffix, IN CHAR16 *Suffix,
IN CHAR16 *Name, IN CHAR16 *Name,
@ -386,6 +396,7 @@ EfiLibHiiVariableOverrideIfSuffix (
@retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error. @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI
EfiLibHiiVariableOverrideBySuffix ( EfiLibHiiVariableOverrideBySuffix (
IN CHAR16 *Suffix, IN CHAR16 *Suffix,
IN CHAR16 *Name, IN CHAR16 *Name,
@ -410,7 +421,7 @@ EfiLibHiiVariableOverrideBySuffix (
StrCat (NameSuffixed, Suffix); StrCat (NameSuffixed, Suffix);
Status = EfiLibHiiVariableRetrieveFromNv (NameSuffixed, Guid, Size, &Var); Status = EfiLibHiiVariableRetrieveFromNv (NameSuffixed, Guid, Size, &Var);
gBS->FreePool (NameSuffixed); FreePool (NameSuffixed);
return Status; return Status;
} }

View File

@ -12,9 +12,6 @@
**/ **/
#include "UefiLibInternal.h" #include "UefiLibInternal.h"
typedef struct { typedef struct {
@ -199,7 +196,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
@retval 0 The width if UnicodeChar could not be determined. @retval 0 The width if UnicodeChar could not be determined.
@retval 1 UnicodeChar is a narrow glyph. @retval 1 UnicodeChar is a narrow glyph.
@retval 2 UnicodeChar is a wide glyph. @retval 2 UnicodeChar is a wide glyph.
**/ **/
UINTN UINTN
EFIAPI EFIAPI
@ -215,6 +211,7 @@ GetGlyphWidth (
Item = NULL; Item = NULL;
Low = 0; Low = 0;
High = (sizeof (mUnicodeWidthTable)) / (sizeof (UNICODE_WIDTH_ENTRY)) - 1; High = (sizeof (mUnicodeWidthTable)) / (sizeof (UNICODE_WIDTH_ENTRY)) - 1;
while (Low <= High) { while (Low <= High) {
Index = (Low + High) >> 1; Index = (Low + High) >> 1;
Item = &(mUnicodeWidthTable[Index]); Item = &(mUnicodeWidthTable[Index]);
@ -222,7 +219,6 @@ GetGlyphWidth (
if (UnicodeChar <= Item->WChar) { if (UnicodeChar <= Item->WChar) {
break; break;
} }
return 0; return 0;
} }
@ -259,7 +255,6 @@ GetGlyphWidth (
@param String A pointer to a Null-terminated Unicode string. @param String A pointer to a Null-terminated Unicode string.
@return The display length of the Null-terminated Unicode string specified by String. @return The display length of the Null-terminated Unicode string specified by String.
**/ **/
UINTN UINTN
EFIAPI EFIAPI

View File

@ -13,7 +13,6 @@
**/ **/
#include "UefiLibInternal.h" #include "UefiLibInternal.h"
/** /**
@ -36,7 +35,6 @@
@retval EFI_SUCCESS The protocol installation is completed successfully. @retval EFI_SUCCESS The protocol installation is completed successfully.
@retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol. @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol.
@retval Others Status from gBS->InstallMultipleProtocolInterfaces(). @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
@ -56,9 +54,6 @@ EfiLibInstallDriverBinding (
&gEfiDriverBindingProtocolGuid, DriverBinding, &gEfiDriverBindingProtocolGuid, DriverBinding,
NULL NULL
); );
//
// ASSERT if the call to InstallMultipleProtocolInterfaces() failed
//
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
// //
@ -70,7 +65,6 @@ EfiLibInstallDriverBinding (
return Status; return Status;
} }
/** /**
Installs and completes the initialization of a Driver Binding Protocol instance and Installs and completes the initialization of a Driver Binding Protocol instance and
optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols. optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.
@ -111,7 +105,9 @@ EfiLibInstallAllDriverProtocols (
{ {
EFI_STATUS Status; EFI_STATUS Status;
ASSERT (DriverBinding != NULL); if (DriverBinding == NULL) {
return EFI_INVALID_PARAMETER;
}
if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) { if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
if (DriverConfiguration == NULL) { if (DriverConfiguration == NULL) {

View File

@ -15,7 +15,6 @@
#include <FrameworkDxe.h> #include <FrameworkDxe.h>
#include <Protocol/FrameworkHii.h> #include <Protocol/FrameworkHii.h>
#include <Library/HiiLib.h> #include <Library/HiiLib.h>
@ -54,7 +53,6 @@ HiiLibFrameworkConstructor (
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
return Status; return Status;
} }
/** /**
@ -96,7 +94,6 @@ InternalPreparePackages (
} }
return HiiPackages; return HiiPackages;
} }