Update UefiHiiLib to support new defined IFR related HII APIs.

Apply new defined IFR related HII APIs in PlatOverMngr, DriverSample, IScsiDxe and Setup drivers.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8066 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4
2009-04-13 06:05:15 +00:00
parent 3f07728f2a
commit 7e3bcccb0e
25 changed files with 3837 additions and 461 deletions

View File

@@ -794,7 +794,7 @@ InternalHiiLowerConfigString (
EFI_STRING String;
BOOLEAN Lower;
ASSERT (String != NULL);
ASSERT (ConfigString != NULL);
//
// Convert all hex digits in range [A-F] in the configuration header to [a-f]
@@ -2938,3 +2938,77 @@ Finish:
return Status;
}
/**
Configure the buffer accrording to ConfigBody strings in the format of
<Length:4 bytes>, <Offset: 2 bytes>, <Width:2 bytes>, <Data:n bytes>.
This ConfigBody strings is generated by UEFI VfrCompiler for the default
values in a Form Set. The name of the ConfigBody strings is VfrMyIfrNVDataDefault0000
constructed following this rule:
"Vfr" + varstore.name + "Default" + defaultstore.attributes.
Check the generated C file in Output for details.
@param Buffer The start address of buffer.
@param BufferSize The size of buffer.
@param Number The number of the strings.
@param ... Variable argument list for default value in <AltResp> format
generated by the tool.
@retval EFI_BUFFER_TOO_SMALL the BufferSize is too small to operate.
@retval EFI_INVALID_PARAMETER Buffer is NULL or BufferSize is 0.
@retval EFI_SUCCESS Operation successful.
**/
EFI_STATUS
EFIAPI
IfrLibExtractDefault(
IN VOID *Buffer,
IN UINTN *BufferSize,
UINTN Number,
...
)
{
VA_LIST Args;
UINTN Index;
UINT32 TotalLen;
UINT8 *BufCfgArray;
UINT8 *BufferPos;
UINT16 Offset;
UINT16 Width;
UINT8 *Value;
if ((Buffer == NULL) || (BufferSize == NULL)) {
return EFI_INVALID_PARAMETER;
}
Offset = 0;
Width = 0;
Value = NULL;
VA_START (Args, Number);
for (Index = 0; Index < Number; Index++) {
BufCfgArray = (UINT8 *) VA_ARG (Args, VOID *);
TotalLen = ReadUnaligned32 ((UINT32 *)BufCfgArray);
BufferPos = BufCfgArray + sizeof (UINT32);
while ((UINT32)(BufferPos - BufCfgArray) < TotalLen) {
Offset = ReadUnaligned16 ((UINT16 *)BufferPos);
BufferPos += sizeof (UINT16);
Width = ReadUnaligned16 ((UINT16 *)BufferPos);
BufferPos += sizeof (UINT16);
Value = BufferPos;
BufferPos += Width;
if ((UINTN)(Offset + Width) > *BufferSize) {
return EFI_BUFFER_TOO_SMALL;
}
CopyMem ((UINT8 *)Buffer + Offset, Value, Width);
}
}
VA_END (Args);
*BufferSize = (UINTN)Offset;
return EFI_SUCCESS;
}