From 8dbae30dd739864e1bc86ffa6c038c7bd2de3f55 Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Wed, 9 Apr 2008 05:36:17 +0000 Subject: [PATCH] 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 --- .../DxeCorePerformanceLib.c | 15 +- .../DxeCorePerformanceLib.inf | 17 +- .../DxePerformanceLib/DxePerformanceLib.c | 17 +- .../DxePerformanceLib/DxePerformanceLib.inf | 17 +- .../Library/ExtendedHiiLib/ExtendedHiiLib.c | 16 +- .../Library/ExtendedHiiLib/ExtendedHiiLib.inf | 17 +- .../Library/ExtendedIfrSupportLib/Common.c | 346 ++++--- .../ExtendedIfrSupportLib.inf | 14 +- .../Library/ExtendedIfrSupportLib/Form.c | 874 +++++++++--------- .../ExtendedIfrSupportLib/IfrOpCodeCreation.c | 116 ++- .../ExtendedIfrSupportLib/LibraryInternal.h | 84 +- .../Library/ExtendedIfrSupportLib/R8Lib.c | 482 +++++----- .../Library/ExtendedIfrSupportLib/R8Lib.h | 186 ++-- .../PeiPerformanceLib/PeiPerformanceLib.c | 15 +- .../PeiPerformanceLib/PeiPerformanceLib.inf | 17 +- .../PeiRecoveryLibNull/PeiRecoveryLibNull.c | 4 +- .../PeiRecoveryLibNull/PeiRecoveryLibNull.inf | 14 +- .../Library/PeiS3LibNull/PeiS3LibNull.c | 4 +- .../Library/PeiS3LibNull/PeiS3LibNull.inf | 17 +- .../Library/PlatformBdsLibNull/BdsPlatform.c | 29 +- .../Library/PlatformBdsLibNull/BdsPlatform.h | 27 +- .../PlatformBdsLibNull/PlatformBdsLibNull.inf | 22 +- .../Library/PlatformBdsLibNull/PlatformData.c | 29 +- 23 files changed, 1152 insertions(+), 1227 deletions(-) diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index 656949300e..9772f97325 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -1,6 +1,7 @@ -/*++ +/** @file + Support for measurement of DXE performance -Copyright (c) 2006, Intel Corporation +Copyright (c) 2006 - 2008, 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 @@ -9,15 +10,7 @@ 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: - - DxeCorePerformance.c - -Abstract: - - Support for measurement of DXE performance - ---*/ +**/ #include diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf index de8aabd77e..bbd9f31bd0 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf @@ -1,17 +1,18 @@ #/** @file -# Component description file for DxeCore Performance Library -# -# This library provides intrastructure for DxeCore to log performance. -# Copyright (c) 2006, Intel Corporation. -# +# +# Component description file for DxeCore Performance Library +# +# This library provides intrastructure for DxeCore to log performance. +# +# Copyright (c) 2006 - 2008, 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 +# 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/DxePerformanceLib/DxePerformanceLib.c b/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c index ac2ce4e12d..8424151537 100644 --- a/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c +++ b/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c @@ -1,23 +1,16 @@ -/*++ +/** @file + Performance Library -Copyright (c) 2006, Intel Corporation +Copyright (c) 2006 - 2008, 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: - - DxePerformanceLib.c - -Abstract: +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - Performance Library - ---*/ +**/ #include diff --git a/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf b/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf index 57d125b51b..d6457d4ce6 100644 --- a/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf +++ b/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf @@ -1,17 +1,18 @@ #/** @file -# Component description file for Dxe Performance Library -# -# This library provides intrastructure for Dxe driver to log performance. -# Copyright (c) 2006 - 2007, Intel Corporation -# +# +# Component description file for Dxe Performance Library +# +# This library provides intrastructure for Dxe driver to log performance. +# +# Copyright (c) 2006 - 2008, 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 +# 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/ExtendedHiiLib/ExtendedHiiLib.c b/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.c index 22b9763fad..1b13da7937 100644 --- a/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.c +++ b/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.c @@ -1,14 +1,14 @@ /** @file HII Library implementation that uses DXE protocols and services. - Copyright (c) 2006, 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. +Copyright (c) 2006 - 2008, 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. **/ diff --git a/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.inf b/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.inf index f7b8e340ae..65c71baf34 100644 --- a/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.inf +++ b/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.inf @@ -1,17 +1,18 @@ #/** @file -# Library instance for HII common routines. -# -# This library instance implements the common HII routines. -# Copyright (c) 2006, Intel Corporation -# +# +# Library instance for HII common routines. +# +# This library instance implements the common HII routines. +# +# Copyright (c) 2006 - 2008, 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 +# 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/Common.c b/MdeModulePkg/Library/ExtendedIfrSupportLib/Common.c index 36bfb0f43d..6f8926b42c 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.
+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 ec157dd4ec..08eb4de130 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.
# 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 d3a0faa248..a2891de649 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.
+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 5a2995c929..686765b909 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.
+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 12a3118ae1..d526fb21b1 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 - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "R8Lib.h" - -#endif +/** @file + The file contain all library function for Ifr Operations. + +Copyright (c) 2007 - 2008, 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. + +**/ + +#ifndef _IFRLIBRARY_INTERNAL_H +#define _IFRLIBRARY_INTERNAL_H + + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "R8Lib.h" + +#endif diff --git a/MdeModulePkg/Library/ExtendedIfrSupportLib/R8Lib.c b/MdeModulePkg/Library/ExtendedIfrSupportLib/R8Lib.c index c7e82a28f9..4cd0320e2d 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 + + +Copyright (c) 2007 - 2008, 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; +} + + diff --git a/MdeModulePkg/Library/ExtendedIfrSupportLib/R8Lib.h b/MdeModulePkg/Library/ExtendedIfrSupportLib/R8Lib.h index ca9b93989e..0e1ab4daee 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 + + +Copyright (c) 2007 - 2008, 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 + ) +; + diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c index 3bfd48614e..a6666a9c1c 100644 --- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c +++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c @@ -1,6 +1,7 @@ -/*++ +/** @file + Performance Library -Copyright (c) 2006, Intel Corporation +Copyright (c) 2006 - 2008, 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 @@ -9,15 +10,7 @@ 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: - - PeiPerformanceLib.c - -Abstract: - - Performance Library - ---*/ +**/ #include diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf index dccf0aba5f..d7e0c8d666 100644 --- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf +++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf @@ -1,17 +1,18 @@ #/** @file -# Memory-only library functions with no library constructor/destructor -# -# This module provides the performance measurement interfaces in PEI phase, it is one instance of Performance Libarary. -# Copyright (c) 2006, Intel Corporation -# +# +# Memory-only library functions with no library constructor/destructor +# +# This module provides the performance measurement interfaces in PEI phase, it is one instance of Performance Libarary. +# +# Copyright (c) 2006 - 2008, 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 +# 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/PeiRecoveryLibNull/PeiRecoveryLibNull.c b/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c index 00dbc85eaa..5e63e1ede9 100644 --- a/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c +++ b/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c @@ -1,7 +1,7 @@ -/**@file +/** @file Recovery Library. This library class defines a set of methods related do recovery. -Copyright (c) 2006 - 2007 Intel Corporation +Copyright (c) 2006 - 2008, 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 diff --git a/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf b/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf index 51a7e20112..404eadd676 100644 --- a/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf +++ b/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf @@ -1,16 +1,16 @@ #/** @file -# Recovery for PEIM -# -# Copyright (c) 2006 - 2007, Intel Corporation. -# +# +# Recovery for PEIM +# +# Copyright (c) 2006 - 2008, 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 +# 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/PeiS3LibNull/PeiS3LibNull.c b/MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.c index b8ea626322..6cceceab08 100644 --- a/MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.c +++ b/MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.c @@ -1,7 +1,7 @@ -/**@file +/** @file S3 Library. This library class defines a set of methods related do S3 mode -Copyright (c) 2006 - 2007 Intel Corporation +Copyright (c) 2006 - 2008, 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 diff --git a/MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.inf b/MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.inf index 9b7166f396..3dfb63b1d8 100644 --- a/MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.inf +++ b/MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.inf @@ -1,17 +1,18 @@ #/** @file -# Graphics Library for UEFI drivers -# -# This library provides supports for basic graphic functions. -# Copyright (c) 2006 - 2007, Intel Corporation. -# +# +# Graphics Library for UEFI drivers +# +# This library provides supports for basic graphic functions. +# +# Copyright (c) 2006 - 2008, 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 +# 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/PlatformBdsLibNull/BdsPlatform.c b/MdeModulePkg/Library/PlatformBdsLibNull/BdsPlatform.c index 85633a9dc9..5aaa72ab4d 100644 --- a/MdeModulePkg/Library/PlatformBdsLibNull/BdsPlatform.c +++ b/MdeModulePkg/Library/PlatformBdsLibNull/BdsPlatform.c @@ -1,24 +1,17 @@ -/*++ - -Copyright (c) 2004 - 2006, 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: - - BdsPlatform.c - -Abstract: - +/** @file This file include all platform action which can be customized by IBV/OEM. ---*/ +Copyright (c) 2004 - 2008, 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 "BdsPlatform.h" diff --git a/MdeModulePkg/Library/PlatformBdsLibNull/BdsPlatform.h b/MdeModulePkg/Library/PlatformBdsLibNull/BdsPlatform.h index 8332f6cc90..cc90974ee8 100644 --- a/MdeModulePkg/Library/PlatformBdsLibNull/BdsPlatform.h +++ b/MdeModulePkg/Library/PlatformBdsLibNull/BdsPlatform.h @@ -1,23 +1,16 @@ -/*++ - -Copyright (c) 2004 - 2006, 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: - - BdsPlatform.h +/** @file + Head file for BDS Platform specific code -Abstract: +Copyright (c) 2004 - 2008, 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 - Head file for BDS Platform specific code +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 _BDS_PLATFORM_H #define _BDS_PLATFORM_H diff --git a/MdeModulePkg/Library/PlatformBdsLibNull/PlatformBdsLibNull.inf b/MdeModulePkg/Library/PlatformBdsLibNull/PlatformBdsLibNull.inf index cca4a32647..86bc532296 100644 --- a/MdeModulePkg/Library/PlatformBdsLibNull/PlatformBdsLibNull.inf +++ b/MdeModulePkg/Library/PlatformBdsLibNull/PlatformBdsLibNull.inf @@ -1,18 +1,16 @@ #/** @file -# Component name for module GenericBdsLib -# -# FIX ME! -# Copyright (c) 2007, Intel Corporation. All rights reserved. -# -# 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, +# Component name for module GenericBdsLib +# +# Copyright (c) 2007 - 2008, 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. -# -# +# #**/ [Defines] diff --git a/MdeModulePkg/Library/PlatformBdsLibNull/PlatformData.c b/MdeModulePkg/Library/PlatformBdsLibNull/PlatformData.c index 0b19277046..7e4adc0007 100644 --- a/MdeModulePkg/Library/PlatformBdsLibNull/PlatformData.c +++ b/MdeModulePkg/Library/PlatformBdsLibNull/PlatformData.c @@ -1,24 +1,17 @@ -/*++ - -Copyright (c) 2004 - 2006, 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: - - PlatformData.c - -Abstract: - +/** @file Defined the platform specific device path which will be used by platform Bbd to perform the platform policy connect. ---*/ +Copyright (c) 2004 - 2008, 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 "BdsPlatform.h" -- 2.39.2