From 1eb73ab57aa6d49cd82eb2b3305ec39bba591d1f Mon Sep 17 00:00:00 2001 From: qwang12 Date: Tue, 4 Jul 2006 12:43:59 +0000 Subject: Added LibPatchPcdSetPtr. Cleaup Pcd Database code generation routine. Fixed a few bugs. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@745 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/DxePcdLib/DxePcdLib.c | 49 ++++++++++++++++++++++++++++++++++ MdePkg/Library/DxePcdLib/DxePcdLib.msa | 15 ++++++----- 2 files changed, 58 insertions(+), 6 deletions(-) (limited to 'MdePkg/Library/DxePcdLib') diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.c b/MdePkg/Library/DxePcdLib/DxePcdLib.c index b746614d5b..f0b0cbd8f6 100644 --- a/MdePkg/Library/DxePcdLib/DxePcdLib.c +++ b/MdePkg/Library/DxePcdLib/DxePcdLib.c @@ -923,3 +923,52 @@ LibPcdGetNextTokenSpace ( return (GUID *) Guid; } + +/** + Sets the PCD entry specified by PatchVariable to the value specified by Buffer + and SizeOfValue. Buffer is returned. If SizeOfValue is greater than + MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return + NULL to indicate that the set operation was not actually performed. + If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to + MaximumDatumSize and NULL must be returned. + + If PatchVariable is NULL, then ASSERT(). + If SizeOfValue is NULL, then ASSERT(). + If SizeOfValue > 0 and Buffer is NULL, then ASSERT(). + + @param[in] PatchVariable A pointer to the global variable in a module that is + the target of the set operation. + @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable. + @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer. + @param[in] Buffer A pointer to the buffer to used to set the target variable. + +**/ +VOID * +EFIAPI +LibPatchPcdSetPtr ( + IN VOID *PatchVariable, + IN UINTN MaximumDatumSize, + IN OUT UINTN *SizeOfBuffer, + IN CONST VOID *Buffer + ) +{ + ASSERT (PatchVariable != NULL); + ASSERT (SizeOfBuffer != NULL); + + if (*SizeOfBuffer > 0) { + ASSERT (Buffer != NULL); + } + + if ((*SizeOfBuffer > MaximumDatumSize) || + (*SizeOfBuffer == MAX_ADDRESS)) { + *SizeOfBuffer = MaximumDatumSize; + return NULL; + } + + CopyMem (PatchVariable, Buffer, *SizeOfBuffer); + + return (VOID *) Buffer; +} + + + diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.msa b/MdePkg/Library/DxePcdLib/DxePcdLib.msa index c250fbeb3a..c50ac45220 100644 --- a/MdePkg/Library/DxePcdLib/DxePcdLib.msa +++ b/MdePkg/Library/DxePcdLib/DxePcdLib.msa @@ -8,11 +8,11 @@ IO Library implemented with Framework CPU IO Protocol FIX ME! 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, + 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. FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052 @@ -31,6 +31,9 @@ UefiBootServicesTableLib + + BaseMemoryLib + DxePcdLib.c @@ -50,4 +53,4 @@ PcdLibConstructor - \ No newline at end of file + -- cgit v1.2.3