diff options
author | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-04-09 05:36:17 +0000 |
---|---|---|
committer | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-04-09 05:36:17 +0000 |
commit | 8dbae30dd739864e1bc86ffa6c038c7bd2de3f55 (patch) | |
tree | d6f1628da55902e731cade4e7de81001e7d367d2 /MdeModulePkg/Library/ExtendedIfrSupportLib | |
parent | 3b2dbece7cac30131999e904cdf9aa872fb3d8c1 (diff) | |
download | edk2-8dbae30dd739864e1bc86ffa6c038c7bd2de3f55.zip edk2-8dbae30dd739864e1bc86ffa6c038c7bd2de3f55.tar.gz edk2-8dbae30dd739864e1bc86ffa6c038c7bd2de3f55.tar.bz2 |
Update all files to follow doxygen style file header.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5018 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library/ExtendedIfrSupportLib')
7 files changed, 1033 insertions, 1069 deletions
diff --git a/MdeModulePkg/Library/ExtendedIfrSupportLib/Common.c b/MdeModulePkg/Library/ExtendedIfrSupportLib/Common.c index 36bfb0f..6f8926b 100644 --- a/MdeModulePkg/Library/ExtendedIfrSupportLib/Common.c +++ b/MdeModulePkg/Library/ExtendedIfrSupportLib/Common.c @@ -1,177 +1,169 @@ -/** @file - -Copyright (c) 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - UefiIfrCommon.c - -Abstract: - - Common Library Routines to assist handle HII elements. - - -**/ - -#include "LibraryInternal.h" - - -// -// Hii relative protocols -// - -EFI_HII_DATABASE_PROTOCOL *gIfrLibHiiDatabase; -EFI_HII_STRING_PROTOCOL *gIfrLibHiiString; - -EFI_STATUS -EFIAPI -ExtendedIfrSupportLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - - Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &gIfrLibHiiDatabase); - ASSERT_EFI_ERROR (Status); - - Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &gIfrLibHiiString); - ASSERT_EFI_ERROR (Status); - - return EFI_SUCCESS; -} - - - -STATIC EFI_GUID mIfrVendorGuid = EFI_IFR_TIANO_GUID; - -EFI_STATUS -EFIAPI -IfrLibExtractClassFromHiiHandle ( - IN EFI_HII_HANDLE Handle, - OUT UINT16 *Class, - OUT EFI_STRING_ID *FormSetTitle, - OUT EFI_STRING_ID *FormSetHelp - ) -/*++ - -Routine Description: - Extract formset class for given HII handle. - -Arguments: - HiiHandle - Hii handle - Class - Class of the formset - FormSetTitle - Formset title string - FormSetHelp - Formset help string - -Returns: - EFI_SUCCESS - Successfully extract Class for specified Hii handle. - ---*/ -{ - EFI_STATUS Status; - UINTN BufferSize; - EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList; - UINT8 *Package; - UINT8 *OpCodeData; - UINT32 Offset; - UINT32 Offset2; - UINT32 PackageListLength; - EFI_HII_PACKAGE_HEADER PackageHeader; - - ASSERT (Handle != NULL); - ASSERT (Class != NULL); - ASSERT (FormSetTitle != NULL); - ASSERT (FormSetHelp != NULL); - - *Class = EFI_NON_DEVICE_CLASS; - *FormSetTitle = 0; - *FormSetHelp = 0; - - // - // Get HII PackageList - // - BufferSize = 0; - HiiPackageList = NULL; - Status = gIfrLibHiiDatabase->ExportPackageLists (gIfrLibHiiDatabase, Handle, &BufferSize, HiiPackageList); - ASSERT (Status != EFI_NOT_FOUND); - - if (Status == EFI_BUFFER_TOO_SMALL) { - HiiPackageList = AllocatePool (BufferSize); - ASSERT (HiiPackageList != NULL); - - Status = gIfrLibHiiDatabase->ExportPackageLists (gIfrLibHiiDatabase, Handle, &BufferSize, HiiPackageList); - } - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Get Form package from this HII package List - // - Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER); - Offset2 = 0; - CopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32)); - - while (Offset < PackageListLength) { - Package = ((UINT8 *) HiiPackageList) + Offset; - CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER)); - - if (PackageHeader.Type == EFI_HII_PACKAGE_FORM) { - // - // Search Class Opcode in this Form Package - // - Offset2 = sizeof (EFI_HII_PACKAGE_HEADER); - while (Offset2 < PackageHeader.Length) { - OpCodeData = Package + Offset2; - - if (((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_FORM_SET_OP) { - // - // Find FormSet OpCode - // - CopyMem (FormSetTitle, &((EFI_IFR_FORM_SET *) OpCodeData)->FormSetTitle, sizeof (EFI_STRING_ID)); - CopyMem (FormSetHelp, &((EFI_IFR_FORM_SET *) OpCodeData)->Help, sizeof (EFI_STRING_ID)); - } - - if ((((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_GUID_OP) && - CompareGuid (&mIfrVendorGuid, (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER))) && - (((EFI_IFR_GUID_CLASS *) OpCodeData)->ExtendOpCode == EFI_IFR_EXTEND_OP_CLASS) - ) { - // - // Find GUIDed Class OpCode - // - CopyMem (Class, &((EFI_IFR_GUID_CLASS *) OpCodeData)->Class, sizeof (UINT16)); - - // - // Till now, we ought to have found the formset Opcode - // - break; - } - - Offset2 += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length; - } - - if (Offset2 < PackageHeader.Length) { - // - // Target formset found - // - break; - } - } - - Offset += PackageHeader.Length; - } - - gBS->FreePool (HiiPackageList); - - return EFI_SUCCESS; -} - - +/** @file
+ Common Library Routines to assist handle HII elements.
+
+Copyright (c) 2007 - 2008, Intel Corporation. <BR>
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "LibraryInternal.h"
+
+
+//
+// Hii relative protocols
+//
+
+EFI_HII_DATABASE_PROTOCOL *gIfrLibHiiDatabase;
+EFI_HII_STRING_PROTOCOL *gIfrLibHiiString;
+
+EFI_STATUS
+EFIAPI
+ExtendedIfrSupportLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &gIfrLibHiiDatabase);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &gIfrLibHiiString);
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+
+
+STATIC EFI_GUID mIfrVendorGuid = EFI_IFR_TIANO_GUID;
+
+EFI_STATUS
+EFIAPI
+IfrLibExtractClassFromHiiHandle (
+ IN EFI_HII_HANDLE Handle,
+ OUT UINT16 *Class,
+ OUT EFI_STRING_ID *FormSetTitle,
+ OUT EFI_STRING_ID *FormSetHelp
+ )
+/*++
+
+Routine Description:
+ Extract formset class for given HII handle.
+
+Arguments:
+ HiiHandle - Hii handle
+ Class - Class of the formset
+ FormSetTitle - Formset title string
+ FormSetHelp - Formset help string
+
+Returns:
+ EFI_SUCCESS - Successfully extract Class for specified Hii handle.
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN BufferSize;
+ EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
+ UINT8 *Package;
+ UINT8 *OpCodeData;
+ UINT32 Offset;
+ UINT32 Offset2;
+ UINT32 PackageListLength;
+ EFI_HII_PACKAGE_HEADER PackageHeader;
+
+ ASSERT (Handle != NULL);
+ ASSERT (Class != NULL);
+ ASSERT (FormSetTitle != NULL);
+ ASSERT (FormSetHelp != NULL);
+
+ *Class = EFI_NON_DEVICE_CLASS;
+ *FormSetTitle = 0;
+ *FormSetHelp = 0;
+
+ //
+ // Get HII PackageList
+ //
+ BufferSize = 0;
+ HiiPackageList = NULL;
+ Status = gIfrLibHiiDatabase->ExportPackageLists (gIfrLibHiiDatabase, Handle, &BufferSize, HiiPackageList);
+ ASSERT (Status != EFI_NOT_FOUND);
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ HiiPackageList = AllocatePool (BufferSize);
+ ASSERT (HiiPackageList != NULL);
+
+ Status = gIfrLibHiiDatabase->ExportPackageLists (gIfrLibHiiDatabase, Handle, &BufferSize, HiiPackageList);
+ }
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Get Form package from this HII package List
+ //
+ Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
+ Offset2 = 0;
+ CopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32));
+
+ while (Offset < PackageListLength) {
+ Package = ((UINT8 *) HiiPackageList) + Offset;
+ CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
+
+ if (PackageHeader.Type == EFI_HII_PACKAGE_FORM) {
+ //
+ // Search Class Opcode in this Form Package
+ //
+ Offset2 = sizeof (EFI_HII_PACKAGE_HEADER);
+ while (Offset2 < PackageHeader.Length) {
+ OpCodeData = Package + Offset2;
+
+ if (((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_FORM_SET_OP) {
+ //
+ // Find FormSet OpCode
+ //
+ CopyMem (FormSetTitle, &((EFI_IFR_FORM_SET *) OpCodeData)->FormSetTitle, sizeof (EFI_STRING_ID));
+ CopyMem (FormSetHelp, &((EFI_IFR_FORM_SET *) OpCodeData)->Help, sizeof (EFI_STRING_ID));
+ }
+
+ if ((((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_GUID_OP) &&
+ CompareGuid (&mIfrVendorGuid, (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER))) &&
+ (((EFI_IFR_GUID_CLASS *) OpCodeData)->ExtendOpCode == EFI_IFR_EXTEND_OP_CLASS)
+ ) {
+ //
+ // Find GUIDed Class OpCode
+ //
+ CopyMem (Class, &((EFI_IFR_GUID_CLASS *) OpCodeData)->Class, sizeof (UINT16));
+
+ //
+ // Till now, we ought to have found the formset Opcode
+ //
+ break;
+ }
+
+ Offset2 += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
+ }
+
+ if (Offset2 < PackageHeader.Length) {
+ //
+ // Target formset found
+ //
+ break;
+ }
+ }
+
+ Offset += PackageHeader.Length;
+ }
+
+ gBS->FreePool (HiiPackageList);
+
+ return EFI_SUCCESS;
+}
+
+
diff --git a/MdeModulePkg/Library/ExtendedIfrSupportLib/ExtendedIfrSupportLib.inf b/MdeModulePkg/Library/ExtendedIfrSupportLib/ExtendedIfrSupportLib.inf index ec157dd..08eb4de 100644 --- a/MdeModulePkg/Library/ExtendedIfrSupportLib/ExtendedIfrSupportLib.inf +++ b/MdeModulePkg/Library/ExtendedIfrSupportLib/ExtendedIfrSupportLib.inf @@ -1,18 +1,16 @@ #/** @file
-# Component name for module UefiEfiIfrSupportLib
-#
-# FIX ME!
-# Copyright (c) 2007, Intel Corporation. All rights reserved.
-#
+#
+# Component name for module UefiEfiIfrSupportLib
+#
+# Copyright (c) 2007 - 2008, Intel Corporation. <BR>
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
+# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
+#
#**/
[Defines]
diff --git a/MdeModulePkg/Library/ExtendedIfrSupportLib/Form.c b/MdeModulePkg/Library/ExtendedIfrSupportLib/Form.c index d3a0faa..a2891de 100644 --- a/MdeModulePkg/Library/ExtendedIfrSupportLib/Form.c +++ b/MdeModulePkg/Library/ExtendedIfrSupportLib/Form.c @@ -1,441 +1,433 @@ -/** @file - -Copyright (c) 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - UefiIfrForm.c - -Abstract: - - Common Library Routines to assist handle HII elements. - - -**/ - -#include "LibraryInternal.h" - -STATIC -EFI_STATUS -GetPackageDataFromPackageList ( - IN EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList, - IN UINT32 PackageIndex, - OUT UINT32 *BufferLen, - OUT EFI_HII_PACKAGE_HEADER **Buffer - ) -{ - UINT32 Index; - EFI_HII_PACKAGE_HEADER *Package; - UINT32 Offset; - UINT32 PackageListLength; - EFI_HII_PACKAGE_HEADER PackageHeader = {0, 0}; - - ASSERT(HiiPackageList != NULL); - - if ((BufferLen == NULL) || (Buffer == NULL)) { - return EFI_INVALID_PARAMETER; - } - - Package = NULL; - Index = 0; - Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER); - CopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32)); - while (Offset < PackageListLength) { - Package = (EFI_HII_PACKAGE_HEADER *) (((UINT8 *) HiiPackageList) + Offset); - CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER)); - if (Index == PackageIndex) { - break; - } - Offset += PackageHeader.Length; - Index++; - } - if (Offset >= PackageListLength) { - // - // no package found in this Package List - // - return EFI_NOT_FOUND; - } - - *BufferLen = PackageHeader.Length; - *Buffer = Package; - return EFI_SUCCESS; -} - -STATIC -EFI_STATUS -EFIAPI -UpdateFormPackageData ( - IN EFI_GUID *FormSetGuid, - IN EFI_FORM_ID FormId, - IN EFI_HII_PACKAGE_HEADER *Package, - IN UINT32 PackageLength, - IN UINT16 Label, - IN BOOLEAN Insert, - IN EFI_HII_UPDATE_DATA *Data, - OUT UINT8 **TempBuffer, - OUT UINT32 *TempBufferSize - ) -{ - UINTN AddSize; - UINT8 *BufferPos; - EFI_HII_PACKAGE_HEADER PackageHeader; - UINTN Offset; - EFI_IFR_OP_HEADER *IfrOpHdr; - BOOLEAN GetFormSet; - BOOLEAN GetForm; - UINT8 ExtendOpCode; - UINT16 LabelNumber; - BOOLEAN Updated; - EFI_IFR_OP_HEADER *AddOpCode; - - if ((TempBuffer == NULL) || (TempBufferSize == NULL)) { - return EFI_INVALID_PARAMETER; - } - - *TempBufferSize = PackageLength; - if (Data != NULL) { - *TempBufferSize += Data->Offset; - } - *TempBuffer = AllocateZeroPool (*TempBufferSize); - if (*TempBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - CopyMem (*TempBuffer, Package, sizeof (EFI_HII_PACKAGE_HEADER)); - *TempBufferSize = sizeof (EFI_HII_PACKAGE_HEADER); - BufferPos = *TempBuffer + sizeof (EFI_HII_PACKAGE_HEADER); - - CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER)); - IfrOpHdr = (EFI_IFR_OP_HEADER *)((UINT8 *) Package + sizeof (EFI_HII_PACKAGE_HEADER)); - Offset = sizeof (EFI_HII_PACKAGE_HEADER); - GetFormSet = (BOOLEAN) ((FormSetGuid == NULL) ? TRUE : FALSE); - GetForm = FALSE; - Updated = FALSE; - - while (Offset < PackageHeader.Length) { - CopyMem (BufferPos, IfrOpHdr, IfrOpHdr->Length); - BufferPos += IfrOpHdr->Length; - *TempBufferSize += IfrOpHdr->Length; - - switch (IfrOpHdr->OpCode) { - case EFI_IFR_FORM_SET_OP : - if (FormSetGuid != NULL) { - if (CompareMem (&((EFI_IFR_FORM_SET *) IfrOpHdr)->Guid, FormSetGuid, sizeof (EFI_GUID)) == 0) { - GetFormSet = TRUE; - } - } - break; - - case EFI_IFR_FORM_OP: - if (CompareMem (&((EFI_IFR_FORM *) IfrOpHdr)->FormId, &FormId, sizeof (EFI_FORM_ID)) == 0) { - GetForm = TRUE; - } - break; - - case EFI_IFR_GUID_OP : - if (!GetFormSet || !GetForm || Updated) { - // - // Go to the next Op-Code - // - Offset += IfrOpHdr->Length; - IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length); - continue; - } - - ExtendOpCode = ((EFI_IFR_GUID_LABEL *) IfrOpHdr)->ExtendOpCode; - CopyMem (&LabelNumber, &((EFI_IFR_GUID_LABEL *)IfrOpHdr)->Number, sizeof (UINT16)); - if ((ExtendOpCode != EFI_IFR_EXTEND_OP_LABEL) || (LabelNumber != Label)) { - // - // Go to the next Op-Code - // - Offset += IfrOpHdr->Length; - IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length); - continue; - } - - if (Insert && (Data != NULL)) { - // - // insert the DataCount amount of opcodes to TempBuffer if Data is NULL remove - // DataCount amount of opcodes unless runing into a label. - // - AddOpCode = (EFI_IFR_OP_HEADER *)Data->Data; - AddSize = 0; - while (AddSize < Data->Offset) { - CopyMem (BufferPos, AddOpCode, AddOpCode->Length); - BufferPos += AddOpCode->Length; - *TempBufferSize += AddOpCode->Length; - - AddSize += AddOpCode->Length; - AddOpCode = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (AddOpCode) + AddOpCode->Length); - } - } else { - // - // Search the next Label. - // - while (TRUE) { - Offset += IfrOpHdr->Length; - // - // Search the next label and Fail if not label found. - // - if (Offset >= PackageHeader.Length) { - goto Fail; - } - IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length); - if (IfrOpHdr->OpCode == EFI_IFR_GUID_OP) { - ExtendOpCode = ((EFI_IFR_GUID_LABEL *) IfrOpHdr)->ExtendOpCode; - if (ExtendOpCode == EFI_IFR_EXTEND_OP_LABEL) { - break; - } - } - } - - if (Data != NULL) { - AddOpCode = (EFI_IFR_OP_HEADER *)Data->Data; - AddSize = 0; - while (AddSize < Data->Offset) { - CopyMem (BufferPos, AddOpCode, AddOpCode->Length); - BufferPos += AddOpCode->Length; - *TempBufferSize += AddOpCode->Length; - - AddSize += AddOpCode->Length; - AddOpCode = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (AddOpCode) + AddOpCode->Length); - } - } - - // - // copy the next label - // - CopyMem (BufferPos, IfrOpHdr, IfrOpHdr->Length); - BufferPos += IfrOpHdr->Length; - *TempBufferSize += IfrOpHdr->Length; - } - - Updated = TRUE; - break; - default : - break; - } - - // - // Go to the next Op-Code - // - Offset += IfrOpHdr->Length; - IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length); - } - - // - // Update the package length. - // - PackageHeader.Length = *TempBufferSize; - CopyMem (*TempBuffer, &PackageHeader, sizeof (EFI_HII_PACKAGE_HEADER)); - -Fail: - if (!Updated) { - gBS->FreePool (*TempBuffer); - *TempBufferSize = 0; - return EFI_NOT_FOUND; - } - - return EFI_SUCCESS; -} - - -/** - This function allows the caller to update a form that has - previously been registered with the EFI HII database. - - @param Handle Hii Handle - @param FormSetGuid The formset should be updated. - @param FormId The form should be updated. - @param Label Update information starting immediately after this - label in the IFR - @param Insert If TRUE and Data is not NULL, insert data after - Label. If FALSE, replace opcodes between two - labels with Data - @param Data The adding data; If NULL, remove opcodes between - two Label. - - @retval EFI_SUCCESS Update success. - @retval Other Update fail. - -**/ -EFI_STATUS -EFIAPI -IfrLibUpdateForm ( - IN EFI_HII_HANDLE Handle, - IN EFI_GUID *FormSetGuid, OPTIONAL - IN EFI_FORM_ID FormId, - IN UINT16 Label, - IN BOOLEAN Insert, - IN EFI_HII_UPDATE_DATA *Data - ) -{ - EFI_STATUS Status; - EFI_HII_DATABASE_PROTOCOL *HiiDatabase; - EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList; - UINT32 Index; - EFI_HII_PACKAGE_LIST_HEADER *UpdateBuffer; - UINTN BufferSize; - UINT8 *UpdateBufferPos; - EFI_HII_PACKAGE_HEADER PackageHeader; - EFI_HII_PACKAGE_HEADER *Package; - UINT32 PackageLength; - EFI_HII_PACKAGE_HEADER *TempBuffer; - UINT32 TempBufferSize; - BOOLEAN Updated; - - if (Data == NULL) { - return EFI_INVALID_PARAMETER; - } - - HiiDatabase = gIfrLibHiiDatabase; - - // - // Get the orginal package list - // - BufferSize = 0; - HiiPackageList = NULL; - Status = HiiDatabase->ExportPackageLists (HiiDatabase, Handle, &BufferSize, HiiPackageList); - if (Status == EFI_BUFFER_TOO_SMALL) { - HiiPackageList = AllocatePool (BufferSize); - ASSERT (HiiPackageList != NULL); - - Status = HiiDatabase->ExportPackageLists (HiiDatabase, Handle, &BufferSize, HiiPackageList); - if (EFI_ERROR (Status)) { - gBS->FreePool (HiiPackageList); - return Status; - } - } - - // - // Calculate and allocate space for retrieval of IFR data - // - BufferSize += Data->Offset; - UpdateBuffer = AllocateZeroPool (BufferSize); - if (UpdateBuffer == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - UpdateBufferPos = (UINT8 *) UpdateBuffer; - - // - // copy the package list header - // - CopyMem (UpdateBufferPos, HiiPackageList, sizeof (EFI_HII_PACKAGE_LIST_HEADER)); - UpdateBufferPos += sizeof (EFI_HII_PACKAGE_LIST_HEADER); - - Updated = FALSE; - for (Index = 0; ; Index++) { - Status = GetPackageDataFromPackageList (HiiPackageList, Index, &PackageLength, &Package); - if (Status == EFI_SUCCESS) { - CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER)); - if ((PackageHeader.Type == EFI_HII_PACKAGE_FORM) && !Updated) { - Status = UpdateFormPackageData (FormSetGuid, FormId, Package, PackageLength, Label, Insert, Data, (UINT8 **)&TempBuffer, &TempBufferSize); - if (!EFI_ERROR(Status)) { - if (FormSetGuid == NULL) { - Updated = TRUE; - } - CopyMem (UpdateBufferPos, TempBuffer, TempBufferSize); - UpdateBufferPos += TempBufferSize; - gBS->FreePool (TempBuffer); - continue; - } - } - - CopyMem (UpdateBufferPos, Package, PackageLength); - UpdateBufferPos += PackageLength; - } else if (Status == EFI_NOT_FOUND) { - break; - } else { - gBS->FreePool (HiiPackageList); - return Status; - } - } - - // - // Update package list length - // - BufferSize = UpdateBufferPos - (UINT8 *) UpdateBuffer; - CopyMem (&UpdateBuffer->PackageLength, &BufferSize, sizeof (UINT32)); - - gBS->FreePool (HiiPackageList); - - return HiiDatabase->UpdatePackageList (HiiDatabase, Handle, UpdateBuffer); -} - - -/** - Configure the buffer accrording to ConfigBody strings. - - @param DefaultId the ID of default. - @param Buffer the start address of buffer. - @param BufferSize the size of buffer. - @param Number the number of the strings. - - @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 *); - CopyMem (&TotalLen, BufCfgArray, sizeof (UINT32)); - BufferPos = BufCfgArray + sizeof (UINT32); - - while ((UINT32)(BufferPos - BufCfgArray) < TotalLen) { - CopyMem (&Offset, BufferPos, sizeof (UINT16)); - BufferPos += sizeof (UINT16); - CopyMem (&Width, BufferPos, sizeof (UINT16)); - 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; -} - - +/** @file
+ Common Library Routines to assist handle HII elements.
+
+Copyright (c) 2007 - 2008, Intel Corporation. <BR>
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "LibraryInternal.h"
+
+STATIC
+EFI_STATUS
+GetPackageDataFromPackageList (
+ IN EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList,
+ IN UINT32 PackageIndex,
+ OUT UINT32 *BufferLen,
+ OUT EFI_HII_PACKAGE_HEADER **Buffer
+ )
+{
+ UINT32 Index;
+ EFI_HII_PACKAGE_HEADER *Package;
+ UINT32 Offset;
+ UINT32 PackageListLength;
+ EFI_HII_PACKAGE_HEADER PackageHeader = {0, 0};
+
+ ASSERT(HiiPackageList != NULL);
+
+ if ((BufferLen == NULL) || (Buffer == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Package = NULL;
+ Index = 0;
+ Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
+ CopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32));
+ while (Offset < PackageListLength) {
+ Package = (EFI_HII_PACKAGE_HEADER *) (((UINT8 *) HiiPackageList) + Offset);
+ CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
+ if (Index == PackageIndex) {
+ break;
+ }
+ Offset += PackageHeader.Length;
+ Index++;
+ }
+ if (Offset >= PackageListLength) {
+ //
+ // no package found in this Package List
+ //
+ return EFI_NOT_FOUND;
+ }
+
+ *BufferLen = PackageHeader.Length;
+ *Buffer = Package;
+ return EFI_SUCCESS;
+}
+
+STATIC
+EFI_STATUS
+EFIAPI
+UpdateFormPackageData (
+ IN EFI_GUID *FormSetGuid,
+ IN EFI_FORM_ID FormId,
+ IN EFI_HII_PACKAGE_HEADER *Package,
+ IN UINT32 PackageLength,
+ IN UINT16 Label,
+ IN BOOLEAN Insert,
+ IN EFI_HII_UPDATE_DATA *Data,
+ OUT UINT8 **TempBuffer,
+ OUT UINT32 *TempBufferSize
+ )
+{
+ UINTN AddSize;
+ UINT8 *BufferPos;
+ EFI_HII_PACKAGE_HEADER PackageHeader;
+ UINTN Offset;
+ EFI_IFR_OP_HEADER *IfrOpHdr;
+ BOOLEAN GetFormSet;
+ BOOLEAN GetForm;
+ UINT8 ExtendOpCode;
+ UINT16 LabelNumber;
+ BOOLEAN Updated;
+ EFI_IFR_OP_HEADER *AddOpCode;
+
+ if ((TempBuffer == NULL) || (TempBufferSize == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *TempBufferSize = PackageLength;
+ if (Data != NULL) {
+ *TempBufferSize += Data->Offset;
+ }
+ *TempBuffer = AllocateZeroPool (*TempBufferSize);
+ if (*TempBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (*TempBuffer, Package, sizeof (EFI_HII_PACKAGE_HEADER));
+ *TempBufferSize = sizeof (EFI_HII_PACKAGE_HEADER);
+ BufferPos = *TempBuffer + sizeof (EFI_HII_PACKAGE_HEADER);
+
+ CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
+ IfrOpHdr = (EFI_IFR_OP_HEADER *)((UINT8 *) Package + sizeof (EFI_HII_PACKAGE_HEADER));
+ Offset = sizeof (EFI_HII_PACKAGE_HEADER);
+ GetFormSet = (BOOLEAN) ((FormSetGuid == NULL) ? TRUE : FALSE);
+ GetForm = FALSE;
+ Updated = FALSE;
+
+ while (Offset < PackageHeader.Length) {
+ CopyMem (BufferPos, IfrOpHdr, IfrOpHdr->Length);
+ BufferPos += IfrOpHdr->Length;
+ *TempBufferSize += IfrOpHdr->Length;
+
+ switch (IfrOpHdr->OpCode) {
+ case EFI_IFR_FORM_SET_OP :
+ if (FormSetGuid != NULL) {
+ if (CompareMem (&((EFI_IFR_FORM_SET *) IfrOpHdr)->Guid, FormSetGuid, sizeof (EFI_GUID)) == 0) {
+ GetFormSet = TRUE;
+ }
+ }
+ break;
+
+ case EFI_IFR_FORM_OP:
+ if (CompareMem (&((EFI_IFR_FORM *) IfrOpHdr)->FormId, &FormId, sizeof (EFI_FORM_ID)) == 0) {
+ GetForm = TRUE;
+ }
+ break;
+
+ case EFI_IFR_GUID_OP :
+ if (!GetFormSet || !GetForm || Updated) {
+ //
+ // Go to the next Op-Code
+ //
+ Offset += IfrOpHdr->Length;
+ IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length);
+ continue;
+ }
+
+ ExtendOpCode = ((EFI_IFR_GUID_LABEL *) IfrOpHdr)->ExtendOpCode;
+ CopyMem (&LabelNumber, &((EFI_IFR_GUID_LABEL *)IfrOpHdr)->Number, sizeof (UINT16));
+ if ((ExtendOpCode != EFI_IFR_EXTEND_OP_LABEL) || (LabelNumber != Label)) {
+ //
+ // Go to the next Op-Code
+ //
+ Offset += IfrOpHdr->Length;
+ IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length);
+ continue;
+ }
+
+ if (Insert && (Data != NULL)) {
+ //
+ // insert the DataCount amount of opcodes to TempBuffer if Data is NULL remove
+ // DataCount amount of opcodes unless runing into a label.
+ //
+ AddOpCode = (EFI_IFR_OP_HEADER *)Data->Data;
+ AddSize = 0;
+ while (AddSize < Data->Offset) {
+ CopyMem (BufferPos, AddOpCode, AddOpCode->Length);
+ BufferPos += AddOpCode->Length;
+ *TempBufferSize += AddOpCode->Length;
+
+ AddSize += AddOpCode->Length;
+ AddOpCode = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (AddOpCode) + AddOpCode->Length);
+ }
+ } else {
+ //
+ // Search the next Label.
+ //
+ while (TRUE) {
+ Offset += IfrOpHdr->Length;
+ //
+ // Search the next label and Fail if not label found.
+ //
+ if (Offset >= PackageHeader.Length) {
+ goto Fail;
+ }
+ IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length);
+ if (IfrOpHdr->OpCode == EFI_IFR_GUID_OP) {
+ ExtendOpCode = ((EFI_IFR_GUID_LABEL *) IfrOpHdr)->ExtendOpCode;
+ if (ExtendOpCode == EFI_IFR_EXTEND_OP_LABEL) {
+ break;
+ }
+ }
+ }
+
+ if (Data != NULL) {
+ AddOpCode = (EFI_IFR_OP_HEADER *)Data->Data;
+ AddSize = 0;
+ while (AddSize < Data->Offset) {
+ CopyMem (BufferPos, AddOpCode, AddOpCode->Length);
+ BufferPos += AddOpCode->Length;
+ *TempBufferSize += AddOpCode->Length;
+
+ AddSize += AddOpCode->Length;
+ AddOpCode = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (AddOpCode) + AddOpCode->Length);
+ }
+ }
+
+ //
+ // copy the next label
+ //
+ CopyMem (BufferPos, IfrOpHdr, IfrOpHdr->Length);
+ BufferPos += IfrOpHdr->Length;
+ *TempBufferSize += IfrOpHdr->Length;
+ }
+
+ Updated = TRUE;
+ break;
+ default :
+ break;
+ }
+
+ //
+ // Go to the next Op-Code
+ //
+ Offset += IfrOpHdr->Length;
+ IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length);
+ }
+
+ //
+ // Update the package length.
+ //
+ PackageHeader.Length = *TempBufferSize;
+ CopyMem (*TempBuffer, &PackageHeader, sizeof (EFI_HII_PACKAGE_HEADER));
+
+Fail:
+ if (!Updated) {
+ gBS->FreePool (*TempBuffer);
+ *TempBufferSize = 0;
+ return EFI_NOT_FOUND;
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+/**
+ This function allows the caller to update a form that has
+ previously been registered with the EFI HII database.
+
+ @param Handle Hii Handle
+ @param FormSetGuid The formset should be updated.
+ @param FormId The form should be updated.
+ @param Label Update information starting immediately after this
+ label in the IFR
+ @param Insert If TRUE and Data is not NULL, insert data after
+ Label. If FALSE, replace opcodes between two
+ labels with Data
+ @param Data The adding data; If NULL, remove opcodes between
+ two Label.
+
+ @retval EFI_SUCCESS Update success.
+ @retval Other Update fail.
+
+**/
+EFI_STATUS
+EFIAPI
+IfrLibUpdateForm (
+ IN EFI_HII_HANDLE Handle,
+ IN EFI_GUID *FormSetGuid, OPTIONAL
+ IN EFI_FORM_ID FormId,
+ IN UINT16 Label,
+ IN BOOLEAN Insert,
+ IN EFI_HII_UPDATE_DATA *Data
+ )
+{
+ EFI_STATUS Status;
+ EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
+ EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
+ UINT32 Index;
+ EFI_HII_PACKAGE_LIST_HEADER *UpdateBuffer;
+ UINTN BufferSize;
+ UINT8 *UpdateBufferPos;
+ EFI_HII_PACKAGE_HEADER PackageHeader;
+ EFI_HII_PACKAGE_HEADER *Package;
+ UINT32 PackageLength;
+ EFI_HII_PACKAGE_HEADER *TempBuffer;
+ UINT32 TempBufferSize;
+ BOOLEAN Updated;
+
+ if (Data == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ HiiDatabase = gIfrLibHiiDatabase;
+
+ //
+ // Get the orginal package list
+ //
+ BufferSize = 0;
+ HiiPackageList = NULL;
+ Status = HiiDatabase->ExportPackageLists (HiiDatabase, Handle, &BufferSize, HiiPackageList);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ HiiPackageList = AllocatePool (BufferSize);
+ ASSERT (HiiPackageList != NULL);
+
+ Status = HiiDatabase->ExportPackageLists (HiiDatabase, Handle, &BufferSize, HiiPackageList);
+ if (EFI_ERROR (Status)) {
+ gBS->FreePool (HiiPackageList);
+ return Status;
+ }
+ }
+
+ //
+ // Calculate and allocate space for retrieval of IFR data
+ //
+ BufferSize += Data->Offset;
+ UpdateBuffer = AllocateZeroPool (BufferSize);
+ if (UpdateBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ UpdateBufferPos = (UINT8 *) UpdateBuffer;
+
+ //
+ // copy the package list header
+ //
+ CopyMem (UpdateBufferPos, HiiPackageList, sizeof (EFI_HII_PACKAGE_LIST_HEADER));
+ UpdateBufferPos += sizeof (EFI_HII_PACKAGE_LIST_HEADER);
+
+ Updated = FALSE;
+ for (Index = 0; ; Index++) {
+ Status = GetPackageDataFromPackageList (HiiPackageList, Index, &PackageLength, &Package);
+ if (Status == EFI_SUCCESS) {
+ CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
+ if ((PackageHeader.Type == EFI_HII_PACKAGE_FORM) && !Updated) {
+ Status = UpdateFormPackageData (FormSetGuid, FormId, Package, PackageLength, Label, Insert, Data, (UINT8 **)&TempBuffer, &TempBufferSize);
+ if (!EFI_ERROR(Status)) {
+ if (FormSetGuid == NULL) {
+ Updated = TRUE;
+ }
+ CopyMem (UpdateBufferPos, TempBuffer, TempBufferSize);
+ UpdateBufferPos += TempBufferSize;
+ gBS->FreePool (TempBuffer);
+ continue;
+ }
+ }
+
+ CopyMem (UpdateBufferPos, Package, PackageLength);
+ UpdateBufferPos += PackageLength;
+ } else if (Status == EFI_NOT_FOUND) {
+ break;
+ } else {
+ gBS->FreePool (HiiPackageList);
+ return Status;
+ }
+ }
+
+ //
+ // Update package list length
+ //
+ BufferSize = UpdateBufferPos - (UINT8 *) UpdateBuffer;
+ CopyMem (&UpdateBuffer->PackageLength, &BufferSize, sizeof (UINT32));
+
+ gBS->FreePool (HiiPackageList);
+
+ return HiiDatabase->UpdatePackageList (HiiDatabase, Handle, UpdateBuffer);
+}
+
+
+/**
+ Configure the buffer accrording to ConfigBody strings.
+
+ @param DefaultId the ID of default.
+ @param Buffer the start address of buffer.
+ @param BufferSize the size of buffer.
+ @param Number the number of the strings.
+
+ @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 *);
+ CopyMem (&TotalLen, BufCfgArray, sizeof (UINT32));
+ BufferPos = BufCfgArray + sizeof (UINT32);
+
+ while ((UINT32)(BufferPos - BufCfgArray) < TotalLen) {
+ CopyMem (&Offset, BufferPos, sizeof (UINT16));
+ BufferPos += sizeof (UINT16);
+ CopyMem (&Width, BufferPos, sizeof (UINT16));
+ 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;
+}
+
+
diff --git a/MdeModulePkg/Library/ExtendedIfrSupportLib/IfrOpCodeCreation.c b/MdeModulePkg/Library/ExtendedIfrSupportLib/IfrOpCodeCreation.c index 5a2995c..686765b 100644 --- a/MdeModulePkg/Library/ExtendedIfrSupportLib/IfrOpCodeCreation.c +++ b/MdeModulePkg/Library/ExtendedIfrSupportLib/IfrOpCodeCreation.c @@ -1,63 +1,53 @@ -/** @file - -Copyright (c) 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - UefiIfrOpCodeCreation.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: - - -**/ - -#include "LibraryInternal.h" - -STATIC EFI_GUID mIfrVendorGuid = EFI_IFR_TIANO_GUID; - -EFI_STATUS -EFIAPI -CreateBannerOpCode ( - IN EFI_STRING_ID Title, - IN UINT16 LineNumber, - IN UINT8 Alignment, - IN OUT EFI_HII_UPDATE_DATA *Data - ) -{ - EFI_IFR_GUID_BANNER Banner; - UINT8 *LocalBuffer; - - ASSERT (Data != NULL && Data->Data != NULL); - - if (Data->Offset + sizeof (EFI_IFR_GUID_BANNER) > Data->BufferSize) { - return EFI_BUFFER_TOO_SMALL; - } - - Banner.Header.OpCode = EFI_IFR_GUID_OP; - Banner.Header.Length = sizeof (EFI_IFR_GUID_BANNER); - Banner.Header.Scope = 0; - CopyMem (&Banner.Guid, &mIfrVendorGuid, sizeof (EFI_IFR_GUID)); - Banner.ExtendOpCode = EFI_IFR_EXTEND_OP_BANNER; - Banner.Title = Title; - Banner.LineNumber = LineNumber; - Banner.Alignment = Alignment; - - LocalBuffer = (UINT8 *) Data->Data + Data->Offset; - CopyMem (LocalBuffer, &Banner, sizeof (EFI_IFR_GUID_BANNER)); - Data->Offset += sizeof (EFI_IFR_GUID_BANNER); - - return EFI_SUCCESS; -} - +/** @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) 2007 - 2008, Intel Corporation. <BR>
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "LibraryInternal.h"
+
+STATIC EFI_GUID mIfrVendorGuid = EFI_IFR_TIANO_GUID;
+
+EFI_STATUS
+EFIAPI
+CreateBannerOpCode (
+ IN EFI_STRING_ID Title,
+ IN UINT16 LineNumber,
+ IN UINT8 Alignment,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+{
+ EFI_IFR_GUID_BANNER Banner;
+ UINT8 *LocalBuffer;
+
+ ASSERT (Data != NULL && Data->Data != NULL);
+
+ if (Data->Offset + sizeof (EFI_IFR_GUID_BANNER) > Data->BufferSize) {
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ Banner.Header.OpCode = EFI_IFR_GUID_OP;
+ Banner.Header.Length = sizeof (EFI_IFR_GUID_BANNER);
+ Banner.Header.Scope = 0;
+ CopyMem (&Banner.Guid, &mIfrVendorGuid, sizeof (EFI_IFR_GUID));
+ Banner.ExtendOpCode = EFI_IFR_EXTEND_OP_BANNER;
+ Banner.Title = Title;
+ Banner.LineNumber = LineNumber;
+ Banner.Alignment = Alignment;
+
+ LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
+ CopyMem (LocalBuffer, &Banner, sizeof (EFI_IFR_GUID_BANNER));
+ Data->Offset += sizeof (EFI_IFR_GUID_BANNER);
+
+ return EFI_SUCCESS;
+}
+
diff --git a/MdeModulePkg/Library/ExtendedIfrSupportLib/LibraryInternal.h b/MdeModulePkg/Library/ExtendedIfrSupportLib/LibraryInternal.h index 12a3118..d526fb2 100644 --- a/MdeModulePkg/Library/ExtendedIfrSupportLib/LibraryInternal.h +++ b/MdeModulePkg/Library/ExtendedIfrSupportLib/LibraryInternal.h @@ -1,46 +1,38 @@ -/** @file - -Copyright (c) 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - UefiIfrLibraryInternal - -Abstract: - - The file contain all library function for Ifr Operations. - - -**/ - -#ifndef _IFRLIBRARY_INTERNAL_H -#define _IFRLIBRARY_INTERNAL_H - - -#include <PiDxe.h> - -#include <Guid/GlobalVariable.h> -#include <Protocol/DevicePath.h> - -#include <Library/DebugLib.h> -#include <Library/BaseMemoryLib.h> -#include <Library/UefiRuntimeServicesTableLib.h> -#include <Library/UefiBootServicesTableLib.h> -#include <Library/BaseLib.h> -#include <Library/DevicePathLib.h> -#include <Library/MemoryAllocationLib.h> -#include <Library/IfrSupportLib.h> -#include <Library/PcdLib.h> - -#include <MdeModuleHii.h> - -#include "R8Lib.h" - -#endif +/** @file
+ The file contain all library function for Ifr Operations.
+
+Copyright (c) 2007 - 2008, Intel Corporation. <BR>
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _IFRLIBRARY_INTERNAL_H
+#define _IFRLIBRARY_INTERNAL_H
+
+
+#include <PiDxe.h>
+
+#include <Guid/GlobalVariable.h>
+#include <Protocol/DevicePath.h>
+
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/BaseLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/IfrSupportLib.h>
+#include <Library/PcdLib.h>
+
+#include <MdeModuleHii.h>
+
+#include "R8Lib.h"
+
+#endif
diff --git a/MdeModulePkg/Library/ExtendedIfrSupportLib/R8Lib.c b/MdeModulePkg/Library/ExtendedIfrSupportLib/R8Lib.c index c7e82a2..4cd0320 100644 --- a/MdeModulePkg/Library/ExtendedIfrSupportLib/R8Lib.c +++ b/MdeModulePkg/Library/ExtendedIfrSupportLib/R8Lib.c @@ -1,241 +1,241 @@ -/**@file - Copyright (c) 2007, Intel Corporation - - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - -**/ - -#include "LibraryInternal.h" - - -CHAR16 -InternalNibbleToHexChar ( - IN UINT8 Nibble - ) -/*++ - - Routine Description: - Converts the low nibble of a byte to hex unicode character. - - Arguments: - Nibble - lower nibble of a byte. - - Returns: - Hex unicode character. - ---*/ -{ - Nibble &= 0x0F; - if (Nibble <= 0x9) { - return (CHAR16)(Nibble + L'0'); - } - - return (CHAR16)(Nibble - 0xA + L'A'); -} - - -/** - Converts binary buffer to Unicode string. - At a minimum, any blob of data could be represented as a hex string. - - @param Str Pointer to the string. - @param HexStringBufferLength Length in bytes of buffer to hold the hex string. - Includes tailing '\0' character. If routine return - with EFI_SUCCESS, containing length of hex string - buffer. If routine return with - EFI_BUFFER_TOO_SMALL, containg length of hex - string buffer desired. - @param Buf Buffer to be converted from. - @param Len Length in bytes of the buffer to be converted. - - @retval EFI_SUCCESS Routine success. - @retval EFI_BUFFER_TOO_SMALL The hex string buffer is too small. - -**/ -EFI_STATUS -R8_BufToHexString ( - IN OUT CHAR16 *Str, - IN OUT UINTN *HexStringBufferLength, - IN UINT8 *Buf, - IN UINTN Len - ) -{ - // - // Porting Guide: - // This library interface is simply obsolete. - // Include the source code to user code. - // - UINTN Idx; - UINT8 Byte; - UINTN StrLen; - - // - // Make sure string is either passed or allocate enough. - // It takes 2 Unicode characters (4 bytes) to represent 1 byte of the binary buffer. - // Plus the Unicode termination character. - // - StrLen = Len * 2; - if (StrLen > ((*HexStringBufferLength) - 1)) { - *HexStringBufferLength = StrLen + 1; - return EFI_BUFFER_TOO_SMALL; - } - - *HexStringBufferLength = StrLen + 1; - // - // Ends the string. - // - Str[StrLen] = L'\0'; - - for (Idx = 0; Idx < Len; Idx++) { - - Byte = Buf[Idx]; - Str[StrLen - 1 - Idx * 2] = InternalNibbleToHexChar (Byte); - Str[StrLen - 2 - Idx * 2] = InternalNibbleToHexChar ((UINT8)(Byte >> 4)); - } - - return EFI_SUCCESS; -} - - - - -/** - Converts Unicode string to binary buffer. - The conversion may be partial. - The first character in the string that is not hex digit stops the conversion. - At a minimum, any blob of data could be represented as a hex string. - - @param Buf Pointer to buffer that receives the data. - @param Len Length in bytes of the buffer to hold converted - data. If routine return with EFI_SUCCESS, - containing length of converted data. If routine - return with EFI_BUFFER_TOO_SMALL, containg length - of buffer desired. - @param Str String to be converted from. - @param ConvertedStrLen Length of the Hex String consumed. - - @retval EFI_SUCCESS Routine Success. - @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold converted data. - -**/ -EFI_STATUS -R8_HexStringToBuf ( - IN OUT UINT8 *Buf, - IN OUT UINTN *Len, - IN CHAR16 *Str, - OUT UINTN *ConvertedStrLen OPTIONAL - ) -{ - // - // Porting Guide: - // This library interface is simply obsolete. - // Include the source code to user code. - // - - UINTN HexCnt; - UINTN Idx; - UINTN BufferLength; - UINT8 Digit; - UINT8 Byte; - - // - // Find out how many hex characters the string has. - // - for (Idx = 0, HexCnt = 0; R8_IsHexDigit (&Digit, Str[Idx]); Idx++, HexCnt++); - - if (HexCnt == 0) { - *Len = 0; - return EFI_SUCCESS; - } - // - // Two Unicode characters make up 1 buffer byte. Round up. - // - BufferLength = (HexCnt + 1) / 2; - - // - // Test if buffer is passed enough. - // - if (BufferLength > (*Len)) { - *Len = BufferLength; - return EFI_BUFFER_TOO_SMALL; - } - - *Len = BufferLength; - - for (Idx = 0; Idx < HexCnt; Idx++) { - - R8_IsHexDigit (&Digit, Str[HexCnt - 1 - Idx]); - - // - // For odd charaters, write the lower nibble for each buffer byte, - // and for even characters, the upper nibble. - // - if ((Idx & 1) == 0) { - Byte = Digit; - } else { - Byte = Buf[Idx / 2]; - Byte &= 0x0F; - Byte = (UINT8) (Byte | Digit << 4); - } - - Buf[Idx / 2] = Byte; - } - - if (ConvertedStrLen != NULL) { - *ConvertedStrLen = HexCnt; - } - - return EFI_SUCCESS; -} - - -/** - Determines if a Unicode character is a hexadecimal digit. - The test is case insensitive. - - @param Digit Pointer to byte that receives the value of the hex - character. - @param Char Unicode character to test. - - @retval TRUE If the character is a hexadecimal digit. - @retval FALSE Otherwise. - -**/ -BOOLEAN -R8_IsHexDigit ( - OUT UINT8 *Digit, - IN CHAR16 Char - ) -{ - // - // Porting Guide: - // This library interface is simply obsolete. - // Include the source code to user code. - // - - if ((Char >= L'0') && (Char <= L'9')) { - *Digit = (UINT8) (Char - L'0'); - return TRUE; - } - - if ((Char >= L'A') && (Char <= L'F')) { - *Digit = (UINT8) (Char - L'A' + 0x0A); - return TRUE; - } - - if ((Char >= L'a') && (Char <= L'f')) { - *Digit = (UINT8) (Char - L'a' + 0x0A); - return TRUE; - } - - return FALSE; -} - - +/** @file
+ <Todo: Add file description>
+
+Copyright (c) 2007 - 2008, Intel Corporation. <BR>
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "LibraryInternal.h"
+
+
+CHAR16
+InternalNibbleToHexChar (
+ IN UINT8 Nibble
+ )
+/*++
+
+ Routine Description:
+ Converts the low nibble of a byte to hex unicode character.
+
+ Arguments:
+ Nibble - lower nibble of a byte.
+
+ Returns:
+ Hex unicode character.
+
+--*/
+{
+ Nibble &= 0x0F;
+ if (Nibble <= 0x9) {
+ return (CHAR16)(Nibble + L'0');
+ }
+
+ return (CHAR16)(Nibble - 0xA + L'A');
+}
+
+
+/**
+ Converts binary buffer to Unicode string.
+ At a minimum, any blob of data could be represented as a hex string.
+
+ @param Str Pointer to the string.
+ @param HexStringBufferLength Length in bytes of buffer to hold the hex string.
+ Includes tailing '\0' character. If routine return
+ with EFI_SUCCESS, containing length of hex string
+ buffer. If routine return with
+ EFI_BUFFER_TOO_SMALL, containg length of hex
+ string buffer desired.
+ @param Buf Buffer to be converted from.
+ @param Len Length in bytes of the buffer to be converted.
+
+ @retval EFI_SUCCESS Routine success.
+ @retval EFI_BUFFER_TOO_SMALL The hex string buffer is too small.
+
+**/
+EFI_STATUS
+R8_BufToHexString (
+ IN OUT CHAR16 *Str,
+ IN OUT UINTN *HexStringBufferLength,
+ IN UINT8 *Buf,
+ IN UINTN Len
+ )
+{
+ //
+ // Porting Guide:
+ // This library interface is simply obsolete.
+ // Include the source code to user code.
+ //
+ UINTN Idx;
+ UINT8 Byte;
+ UINTN StrLen;
+
+ //
+ // Make sure string is either passed or allocate enough.
+ // It takes 2 Unicode characters (4 bytes) to represent 1 byte of the binary buffer.
+ // Plus the Unicode termination character.
+ //
+ StrLen = Len * 2;
+ if (StrLen > ((*HexStringBufferLength) - 1)) {
+ *HexStringBufferLength = StrLen + 1;
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ *HexStringBufferLength = StrLen + 1;
+ //
+ // Ends the string.
+ //
+ Str[StrLen] = L'\0';
+
+ for (Idx = 0; Idx < Len; Idx++) {
+
+ Byte = Buf[Idx];
+ Str[StrLen - 1 - Idx * 2] = InternalNibbleToHexChar (Byte);
+ Str[StrLen - 2 - Idx * 2] = InternalNibbleToHexChar ((UINT8)(Byte >> 4));
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+
+
+/**
+ Converts Unicode string to binary buffer.
+ The conversion may be partial.
+ The first character in the string that is not hex digit stops the conversion.
+ At a minimum, any blob of data could be represented as a hex string.
+
+ @param Buf Pointer to buffer that receives the data.
+ @param Len Length in bytes of the buffer to hold converted
+ data. If routine return with EFI_SUCCESS,
+ containing length of converted data. If routine
+ return with EFI_BUFFER_TOO_SMALL, containg length
+ of buffer desired.
+ @param Str String to be converted from.
+ @param ConvertedStrLen Length of the Hex String consumed.
+
+ @retval EFI_SUCCESS Routine Success.
+ @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold converted data.
+
+**/
+EFI_STATUS
+R8_HexStringToBuf (
+ IN OUT UINT8 *Buf,
+ IN OUT UINTN *Len,
+ IN CHAR16 *Str,
+ OUT UINTN *ConvertedStrLen OPTIONAL
+ )
+{
+ //
+ // Porting Guide:
+ // This library interface is simply obsolete.
+ // Include the source code to user code.
+ //
+
+ UINTN HexCnt;
+ UINTN Idx;
+ UINTN BufferLength;
+ UINT8 Digit;
+ UINT8 Byte;
+
+ //
+ // Find out how many hex characters the string has.
+ //
+ for (Idx = 0, HexCnt = 0; R8_IsHexDigit (&Digit, Str[Idx]); Idx++, HexCnt++);
+
+ if (HexCnt == 0) {
+ *Len = 0;
+ return EFI_SUCCESS;
+ }
+ //
+ // Two Unicode characters make up 1 buffer byte. Round up.
+ //
+ BufferLength = (HexCnt + 1) / 2;
+
+ //
+ // Test if buffer is passed enough.
+ //
+ if (BufferLength > (*Len)) {
+ *Len = BufferLength;
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ *Len = BufferLength;
+
+ for (Idx = 0; Idx < HexCnt; Idx++) {
+
+ R8_IsHexDigit (&Digit, Str[HexCnt - 1 - Idx]);
+
+ //
+ // For odd charaters, write the lower nibble for each buffer byte,
+ // and for even characters, the upper nibble.
+ //
+ if ((Idx & 1) == 0) {
+ Byte = Digit;
+ } else {
+ Byte = Buf[Idx / 2];
+ Byte &= 0x0F;
+ Byte = (UINT8) (Byte | Digit << 4);
+ }
+
+ Buf[Idx / 2] = Byte;
+ }
+
+ if (ConvertedStrLen != NULL) {
+ *ConvertedStrLen = HexCnt;
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Determines if a Unicode character is a hexadecimal digit.
+ The test is case insensitive.
+
+ @param Digit Pointer to byte that receives the value of the hex
+ character.
+ @param Char Unicode character to test.
+
+ @retval TRUE If the character is a hexadecimal digit.
+ @retval FALSE Otherwise.
+
+**/
+BOOLEAN
+R8_IsHexDigit (
+ OUT UINT8 *Digit,
+ IN CHAR16 Char
+ )
+{
+ //
+ // Porting Guide:
+ // This library interface is simply obsolete.
+ // Include the source code to user code.
+ //
+
+ if ((Char >= L'0') && (Char <= L'9')) {
+ *Digit = (UINT8) (Char - L'0');
+ return TRUE;
+ }
+
+ if ((Char >= L'A') && (Char <= L'F')) {
+ *Digit = (UINT8) (Char - L'A' + 0x0A);
+ return TRUE;
+ }
+
+ if ((Char >= L'a') && (Char <= L'f')) {
+ *Digit = (UINT8) (Char - L'a' + 0x0A);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
diff --git a/MdeModulePkg/Library/ExtendedIfrSupportLib/R8Lib.h b/MdeModulePkg/Library/ExtendedIfrSupportLib/R8Lib.h index ca9b939..0e1ab4d 100644 --- a/MdeModulePkg/Library/ExtendedIfrSupportLib/R8Lib.h +++ b/MdeModulePkg/Library/ExtendedIfrSupportLib/R8Lib.h @@ -1,93 +1,93 @@ -/**@file - Copyright (c) 2007, Intel Corporation - - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - -**/ - - - -/** - Converts binary buffer to Unicode string. - At a minimum, any blob of data could be represented as a hex string. - - @param Str Pointer to the string. - @param HexStringBufferLength Length in bytes of buffer to hold the hex string. - Includes tailing '\0' character. If routine return - with EFI_SUCCESS, containing length of hex string - buffer. If routine return with - EFI_BUFFER_TOO_SMALL, containg length of hex - string buffer desired. - @param Buf Buffer to be converted from. - @param Len Length in bytes of the buffer to be converted. - - @retval EFI_SUCCESS Routine success. - @retval EFI_BUFFER_TOO_SMALL The hex string buffer is too small. - -**/ -EFI_STATUS -R8_BufToHexString ( - IN OUT CHAR16 *Str, - IN OUT UINTN *HexStringBufferLength, - IN UINT8 *Buf, - IN UINTN Len - ) -; - - - - -/** - Converts Unicode string to binary buffer. - The conversion may be partial. - The first character in the string that is not hex digit stops the conversion. - At a minimum, any blob of data could be represented as a hex string. - - @param Buf Pointer to buffer that receives the data. - @param Len Length in bytes of the buffer to hold converted - data. If routine return with EFI_SUCCESS, - containing length of converted data. If routine - return with EFI_BUFFER_TOO_SMALL, containg length - of buffer desired. - @param Str String to be converted from. - @param ConvertedStrLen Length of the Hex String consumed. - - @retval EFI_SUCCESS Routine Success. - @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold converted data. - -**/ -EFI_STATUS -R8_HexStringToBuf ( - IN OUT UINT8 *Buf, - IN OUT UINTN *Len, - IN CHAR16 *Str, - OUT UINTN *ConvertedStrLen OPTIONAL - ) -; - -/** - Determines if a Unicode character is a hexadecimal digit. - The test is case insensitive. - - @param Digit Pointer to byte that receives the value of the hex - character. - @param Char Unicode character to test. - - @retval TRUE If the character is a hexadecimal digit. - @retval FALSE Otherwise. - -**/ -BOOLEAN -R8_IsHexDigit ( - OUT UINT8 *Digit, - IN CHAR16 Char - ) -; - +/** @file
+ <Todo: Add file description>
+
+Copyright (c) 2007 - 2008, Intel Corporation. <BR>
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+
+
+/**
+ Converts binary buffer to Unicode string.
+ At a minimum, any blob of data could be represented as a hex string.
+
+ @param Str Pointer to the string.
+ @param HexStringBufferLength Length in bytes of buffer to hold the hex string.
+ Includes tailing '\0' character. If routine return
+ with EFI_SUCCESS, containing length of hex string
+ buffer. If routine return with
+ EFI_BUFFER_TOO_SMALL, containg length of hex
+ string buffer desired.
+ @param Buf Buffer to be converted from.
+ @param Len Length in bytes of the buffer to be converted.
+
+ @retval EFI_SUCCESS Routine success.
+ @retval EFI_BUFFER_TOO_SMALL The hex string buffer is too small.
+
+**/
+EFI_STATUS
+R8_BufToHexString (
+ IN OUT CHAR16 *Str,
+ IN OUT UINTN *HexStringBufferLength,
+ IN UINT8 *Buf,
+ IN UINTN Len
+ )
+;
+
+
+
+
+/**
+ Converts Unicode string to binary buffer.
+ The conversion may be partial.
+ The first character in the string that is not hex digit stops the conversion.
+ At a minimum, any blob of data could be represented as a hex string.
+
+ @param Buf Pointer to buffer that receives the data.
+ @param Len Length in bytes of the buffer to hold converted
+ data. If routine return with EFI_SUCCESS,
+ containing length of converted data. If routine
+ return with EFI_BUFFER_TOO_SMALL, containg length
+ of buffer desired.
+ @param Str String to be converted from.
+ @param ConvertedStrLen Length of the Hex String consumed.
+
+ @retval EFI_SUCCESS Routine Success.
+ @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold converted data.
+
+**/
+EFI_STATUS
+R8_HexStringToBuf (
+ IN OUT UINT8 *Buf,
+ IN OUT UINTN *Len,
+ IN CHAR16 *Str,
+ OUT UINTN *ConvertedStrLen OPTIONAL
+ )
+;
+
+/**
+ Determines if a Unicode character is a hexadecimal digit.
+ The test is case insensitive.
+
+ @param Digit Pointer to byte that receives the value of the hex
+ character.
+ @param Char Unicode character to test.
+
+ @retval TRUE If the character is a hexadecimal digit.
+ @retval FALSE Otherwise.
+
+**/
+BOOLEAN
+R8_IsHexDigit (
+ OUT UINT8 *Digit,
+ IN CHAR16 Char
+ )
+;
+
|