diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-04-13 06:05:15 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-04-13 06:05:15 +0000 |
commit | 7e3bcccb0eed449e95c18b01ae8cbace1a759d01 (patch) | |
tree | 1370553214b662d7cf0a96b0cfd3bd592bd86132 /MdeModulePkg/Library/NewHiiLib/HiiLib.c | |
parent | 3f07728f2a047dc3e16ea622aec8e1a62b8c8411 (diff) | |
download | edk2-platforms-7e3bcccb0eed449e95c18b01ae8cbace1a759d01.tar.xz |
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
Diffstat (limited to 'MdeModulePkg/Library/NewHiiLib/HiiLib.c')
-rw-r--r-- | MdeModulePkg/Library/NewHiiLib/HiiLib.c | 76 |
1 files changed, 75 insertions, 1 deletions
diff --git a/MdeModulePkg/Library/NewHiiLib/HiiLib.c b/MdeModulePkg/Library/NewHiiLib/HiiLib.c index 099ef54412..06d51fa29d 100644 --- a/MdeModulePkg/Library/NewHiiLib/HiiLib.c +++ b/MdeModulePkg/Library/NewHiiLib/HiiLib.c @@ -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;
+}
|