MdePkg PcdLib: Except for SizeOfBuffer is greater than the maximum size supported, align the behavior of LibPcdSetPtr with LibPcdSetN to handle error status returned.

Let the comments to be aligned with code behavior for LibPcdSetX APIs.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15056 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Star Zeng 2014-01-07 09:28:33 +00:00 committed by lzeng14
parent f0c5095b27
commit 0befb08d23
4 changed files with 169 additions and 76 deletions

View File

@ -14,7 +14,7 @@
There are no restrictions on the use of FeaturePcd(), FixedPcdGetXX(), There are no restrictions on the use of FeaturePcd(), FixedPcdGetXX(),
PatchPcdGetXX(), and PatchPcdSetXX(). PatchPcdGetXX(), and PatchPcdSetXX().
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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
@ -439,6 +439,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Sets the 8-bit value for the token specified by TokenName. Value is returned. Sets the 8-bit value for the token specified by TokenName. Value is returned.
If TokenName is not a valid token in the token space, then the module will not build. If TokenName is not a valid token in the token space, then the module will not build.
If the set operation was not correctly performed, then ASSERT().
@param TokenName The name of the PCD token to retrieve a current value for. @param TokenName The name of the PCD token to retrieve a current value for.
@param Value The 8-bit value to set. @param Value The 8-bit value to set.
@ -454,6 +456,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Sets the 16-bit value for the token specified by TokenName. Value is returned. Sets the 16-bit value for the token specified by TokenName. Value is returned.
If TokenName is not a valid token in the token space, then the module will not build. If TokenName is not a valid token in the token space, then the module will not build.
If the set operation was not correctly performed, then ASSERT().
@param TokenName The name of the PCD token to retrieve a current value for. @param TokenName The name of the PCD token to retrieve a current value for.
@param Value The 16-bit value to set. @param Value The 16-bit value to set.
@ -469,6 +473,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Sets the 32-bit value for the token specified by TokenName. Value is returned. Sets the 32-bit value for the token specified by TokenName. Value is returned.
If TokenName is not a valid token in the token space, then the module will not build. If TokenName is not a valid token in the token space, then the module will not build.
If the set operation was not correctly performed, then ASSERT().
@param TokenName The name of the PCD token to retrieve a current value for. @param TokenName The name of the PCD token to retrieve a current value for.
@param Value The 32-bit value to set. @param Value The 32-bit value to set.
@ -501,7 +507,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
then set SizeOfBuffer to the maximum size supported by TokenName and return NULL then set SizeOfBuffer to the maximum size supported by TokenName and return NULL
to indicate that the set operation was not actually performed. If SizeOfBuffer to indicate that the set operation was not actually performed. If SizeOfBuffer
is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size supported is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size supported
by TokenName and NULL must be returned. by TokenName and NULL must be returned, or ASSERT() if the set operation was not corretly performed.
If TokenName is not a valid token in the token space, then the module will not build. If TokenName is not a valid token in the token space, then the module will not build.
If SizeOfBuffer is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT().
@ -523,6 +529,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Sets the Boolean value for the token specified by TokenName. Value is returned. Sets the Boolean value for the token specified by TokenName. Value is returned.
If TokenName is not a valid token in the token space, then the module will not build. If TokenName is not a valid token in the token space, then the module will not build.
If the set operation was not correctly performed, then ASSERT().
@param TokenName The name of the PCD token to set the current value for. @param TokenName The name of the PCD token to set the current value for.
@param Buffer The Boolean value to set. @param Buffer The Boolean value to set.
@ -667,6 +675,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
then the module will not build. then the module will not build.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param Guid Pointer to a 128-bit unique value that designates @param Guid Pointer to a 128-bit unique value that designates
which namespace to retrieve a value from. which namespace to retrieve a value from.
@ -687,6 +696,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
then the module will not build. then the module will not build.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param Guid Pointer to a 128-bit unique value that designates @param Guid Pointer to a 128-bit unique value that designates
which namespace to retrieve a value from. which namespace to retrieve a value from.
@ -707,6 +717,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
then the module will not build. then the module will not build.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param Guid Pointer to a 128-bit unique value that designates @param Guid Pointer to a 128-bit unique value that designates
which namespace to retrieve a value from. which namespace to retrieve a value from.
@ -727,6 +738,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
then the module will not build. then the module will not build.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param Guid Pointer to a 128-bit unique value that designates @param Guid Pointer to a 128-bit unique value that designates
which namespace to retrieve a value from. which namespace to retrieve a value from.
@ -747,7 +759,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
then set SizeOfBuffer to the maximum size supported by Guid and TokenName and return then set SizeOfBuffer to the maximum size supported by Guid and TokenName and return
NULL to indicate that the set operation was not actually performed. If SizeOfBuffer NULL to indicate that the set operation was not actually performed. If SizeOfBuffer
is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size supported by is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size supported by
Guid and TokenName and NULL must be returned. Guid and TokenName and NULL must be returned, or ASSERT() if the set operation was not corretly performed.
If TokenName is not a valid token in the token space specified by Guid, If TokenName is not a valid token in the token space specified by Guid,
then the module will not build. then the module will not build.
@ -776,6 +788,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
then the module will not build. then the module will not build.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param Guid Pointer to a 128-bit unique value that designates @param Guid Pointer to a 128-bit unique value that designates
which namespace to retrieve a value from. which namespace to retrieve a value from.
@ -1082,6 +1095,8 @@ LibPcdGetExSize (
Sets the 8-bit value for the token specified by TokenNumber Sets the 8-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 8-bit value to set. @param[in] Value The 8-bit value to set.
@ -1102,6 +1117,8 @@ LibPcdSet8 (
Sets the 16-bit value for the token specified by TokenNumber Sets the 16-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 16-bit value to set. @param[in] Value The 16-bit value to set.
@ -1122,6 +1139,8 @@ LibPcdSet16 (
Sets the 32-bit value for the token specified by TokenNumber Sets the 32-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 32-bit value to set. @param[in] Value The 32-bit value to set.
@ -1142,6 +1161,8 @@ LibPcdSet32 (
Sets the 64-bit value for the token specified by TokenNumber Sets the 64-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 64-bit value to set. @param[in] Value The 64-bit value to set.
@ -1163,7 +1184,8 @@ LibPcdSet64 (
specified by Buffer and SizeOfBuffer. Buffer is returned. specified by Buffer and SizeOfBuffer. Buffer is returned.
If SizeOfBuffer is greater than the maximum size support by TokenNumber, If SizeOfBuffer is greater than the maximum size support by TokenNumber,
then set SizeOfBuffer to the maximum size supported by TokenNumber and then set SizeOfBuffer to the maximum size supported by TokenNumber and
return NULL to indicate that the set operation was not actually performed. return NULL to indicate that the set operation was not actually performed,
or ASSERT() if the set operation was not corretly performed.
If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
maximum size supported by TokenName and NULL must be returned. maximum size supported by TokenName and NULL must be returned.
@ -1193,6 +1215,8 @@ LibPcdSetPtr (
Sets the Boolean value for the token specified by TokenNumber Sets the Boolean value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The boolean value to set. @param[in] Value The boolean value to set.
@ -1214,6 +1238,7 @@ LibPcdSetBool (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid Pointer to a 128-bit unique value that @param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -1239,6 +1264,7 @@ LibPcdSetEx8 (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid Pointer to a 128-bit unique value that @param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -1264,6 +1290,7 @@ LibPcdSetEx16 (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid Pointer to a 128-bit unique value that @param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -1287,7 +1314,9 @@ LibPcdSetEx32 (
Sets the 64-bit value for the token specified by TokenNumber and Sets the 64-bit value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid Pointer to a 128-bit unique value that @param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -1313,7 +1342,7 @@ LibPcdSetEx64 (
Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size
supported by TokenNumber and return NULL to indicate that the set operation supported by TokenNumber and return NULL to indicate that the set operation
was not actually performed. was not actually performed, or ASSERT() if the set operation was not corretly performed.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If SizeOfBuffer is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT().
@ -1345,6 +1374,7 @@ LibPcdSetExPtr (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid Pointer to a 128-bit unique value that @param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.

View File

@ -1,7 +1,7 @@
/** @file /** @file
A emptry template implementation of PCD Library. A emptry template implementation of PCD Library.
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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
@ -401,6 +401,8 @@ LibPcdGetExSize (
Sets the 8-bit value for the token specified by TokenNumber Sets the 8-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 8-bit value to set. @param[in] Value The 8-bit value to set.
@ -427,6 +429,8 @@ LibPcdSet8 (
Sets the 16-bit value for the token specified by TokenNumber Sets the 16-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 16-bit value to set. @param[in] Value The 16-bit value to set.
@ -453,6 +457,8 @@ LibPcdSet16 (
Sets the 32-bit value for the token specified by TokenNumber Sets the 32-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 32-bit value to set. @param[in] Value The 32-bit value to set.
@ -479,6 +485,8 @@ LibPcdSet32 (
Sets the 64-bit value for the token specified by TokenNumber Sets the 64-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 64-bit value to set. @param[in] Value The 64-bit value to set.
@ -506,7 +514,8 @@ LibPcdSet64 (
specified by Buffer and SizeOfBuffer. Buffer is returned. specified by Buffer and SizeOfBuffer. Buffer is returned.
If SizeOfBuffer is greater than the maximum size support by TokenNumber, If SizeOfBuffer is greater than the maximum size support by TokenNumber,
then set SizeOfBuffer to the maximum size supported by TokenNumber and then set SizeOfBuffer to the maximum size supported by TokenNumber and
return NULL to indicate that the set operation was not actually performed. return NULL to indicate that the set operation was not actually performed,
or ASSERT() if the set operation was not corretly performed.
If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
maximum size supported by TokenName and NULL must be returned. maximum size supported by TokenName and NULL must be returned.
@ -542,6 +551,8 @@ LibPcdSetPtr (
Sets the Boolean value for the token specified by TokenNumber Sets the Boolean value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The boolean value to set. @param[in] Value The boolean value to set.
@ -569,6 +580,7 @@ LibPcdSetBool (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -600,6 +612,7 @@ LibPcdSetEx8 (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -631,6 +644,7 @@ LibPcdSetEx16 (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -660,7 +674,9 @@ LibPcdSetEx32 (
Sets the 64-bit value for the token specified by TokenNumber and Sets the 64-bit value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -692,7 +708,7 @@ LibPcdSetEx64 (
Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size
supported by TokenNumber and return NULL to indicate that the set operation supported by TokenNumber and return NULL to indicate that the set operation
was not actually performed. was not actually performed, or ASSERT() if the set operation was not corretly performed.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If SizeOfBuffer is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT().
@ -730,6 +746,7 @@ LibPcdSetExPtr (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.

View File

@ -1,7 +1,7 @@
/** @file /** @file
Implementation of PcdLib class library for DXE phase. Implementation of PcdLib class library for DXE phase.
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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
@ -490,6 +490,8 @@ LibPcdGetExSize (
Sets the 8-bit value for the token specified by TokenNumber Sets the 8-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 8-bit value to set. @param[in] Value The 8-bit value to set.
@ -519,6 +521,8 @@ LibPcdSet8 (
Sets the 16-bit value for the token specified by TokenNumber Sets the 16-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 16-bit value to set. @param[in] Value The 16-bit value to set.
@ -548,6 +552,8 @@ LibPcdSet16 (
Sets the 32-bit value for the token specified by TokenNumber Sets the 32-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 32-bit value to set. @param[in] Value The 32-bit value to set.
@ -577,6 +583,8 @@ LibPcdSet32 (
Sets the 64-bit value for the token specified by TokenNumber Sets the 64-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 64-bit value to set. @param[in] Value The 64-bit value to set.
@ -607,7 +615,8 @@ LibPcdSet64 (
specified by Buffer and SizeOfBuffer. Buffer is returned. specified by Buffer and SizeOfBuffer. Buffer is returned.
If SizeOfBuffer is greater than the maximum size support by TokenNumber, If SizeOfBuffer is greater than the maximum size support by TokenNumber,
then set SizeOfBuffer to the maximum size supported by TokenNumber and then set SizeOfBuffer to the maximum size supported by TokenNumber and
return NULL to indicate that the set operation was not actually performed. return NULL to indicate that the set operation was not actually performed,
or ASSERT() if the set operation was not correctly performed.
If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
maximum size supported by TokenName and NULL must be returned. maximum size supported by TokenName and NULL must be returned.
@ -631,6 +640,7 @@ LibPcdSetPtr (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN InputSizeOfBuffer;
ASSERT (SizeOfBuffer != NULL); ASSERT (SizeOfBuffer != NULL);
@ -638,10 +648,12 @@ LibPcdSetPtr (
ASSERT (Buffer != NULL); ASSERT (Buffer != NULL);
} }
InputSizeOfBuffer = *SizeOfBuffer;
Status = GetPcdProtocol()->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer); Status = GetPcdProtocol()->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {
return NULL; return NULL;
} }
ASSERT_EFI_ERROR (Status);
return (VOID *)Buffer; return (VOID *)Buffer;
} }
@ -654,6 +666,8 @@ LibPcdSetPtr (
Sets the Boolean value for the token specified by TokenNumber Sets the Boolean value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The boolean value to set. @param[in] Value The boolean value to set.
@ -684,6 +698,7 @@ LibPcdSetBool (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -720,6 +735,7 @@ LibPcdSetEx8 (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -756,6 +772,7 @@ LibPcdSetEx16 (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -790,7 +807,9 @@ LibPcdSetEx32 (
Sets the 64-bit value for the token specified by TokenNumber and Sets the 64-bit value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -827,7 +846,7 @@ LibPcdSetEx64 (
Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size
supported by TokenNumber and return NULL to indicate that the set operation supported by TokenNumber and return NULL to indicate that the set operation
was not actually performed. was not actually performed, or ASSERT() if the set operation was not corretly performed.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If SizeOfBuffer is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT().
@ -852,6 +871,7 @@ LibPcdSetExPtr (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN InputSizeOfBuffer;
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
@ -861,10 +881,12 @@ LibPcdSetExPtr (
ASSERT (Buffer != NULL); ASSERT (Buffer != NULL);
} }
InputSizeOfBuffer = *SizeOfBuffer;
Status = GetPiPcdProtocol()->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer); Status = GetPiPcdProtocol()->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {
return NULL; return NULL;
} }
ASSERT_EFI_ERROR (Status);
return Buffer; return Buffer;
} }
@ -878,6 +900,7 @@ LibPcdSetExPtr (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.

View File

@ -1,7 +1,7 @@
/** @file /** @file
Implementation of PcdLib class library for PEI phase. Implementation of PcdLib class library for PEI phase.
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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
@ -491,6 +491,8 @@ LibPcdGetExSize (
Sets the 8-bit value for the token specified by TokenNumber Sets the 8-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 8-bit value to set. @param[in] Value The 8-bit value to set.
@ -521,6 +523,8 @@ LibPcdSet8 (
Sets the 16-bit value for the token specified by TokenNumber Sets the 16-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 16-bit value to set. @param[in] Value The 16-bit value to set.
@ -551,6 +555,8 @@ LibPcdSet16 (
Sets the 32-bit value for the token specified by TokenNumber Sets the 32-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 32-bit value to set. @param[in] Value The 32-bit value to set.
@ -581,6 +587,8 @@ LibPcdSet32 (
Sets the 64-bit value for the token specified by TokenNumber Sets the 64-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 64-bit value to set. @param[in] Value The 64-bit value to set.
@ -612,7 +620,8 @@ LibPcdSet64 (
specified by Buffer and SizeOfBuffer. Buffer is returned. specified by Buffer and SizeOfBuffer. Buffer is returned.
If SizeOfBuffer is greater than the maximum size support by TokenNumber, If SizeOfBuffer is greater than the maximum size support by TokenNumber,
then set SizeOfBuffer to the maximum size supported by TokenNumber and then set SizeOfBuffer to the maximum size supported by TokenNumber and
return NULL to indicate that the set operation was not actually performed. return NULL to indicate that the set operation was not actually performed,
or ASSERT() if the set operation was not corretly performed.
If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
maximum size supported by TokenName and NULL must be returned. maximum size supported by TokenName and NULL must be returned.
@ -636,6 +645,7 @@ LibPcdSetPtr (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN InputSizeOfBuffer;
ASSERT (SizeOfBuffer != NULL); ASSERT (SizeOfBuffer != NULL);
@ -643,11 +653,12 @@ LibPcdSetPtr (
ASSERT (Buffer != NULL); ASSERT (Buffer != NULL);
} }
InputSizeOfBuffer = *SizeOfBuffer;
Status = (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer); Status = (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);
if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {
if (EFI_ERROR (Status)) {
return NULL; return NULL;
} }
ASSERT_EFI_ERROR (Status);
return (VOID *) Buffer; return (VOID *) Buffer;
} }
@ -660,6 +671,8 @@ LibPcdSetPtr (
Sets the Boolean value for the token specified by TokenNumber Sets the Boolean value for the token specified by TokenNumber
to the value specified by Value. Value is returned. to the value specified by Value. Value is returned.
If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The boolean value to set. @param[in] Value The boolean value to set.
@ -691,6 +704,7 @@ LibPcdSetBool (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -728,6 +742,7 @@ LibPcdSetEx8 (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -763,6 +778,7 @@ LibPcdSetEx16 (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -798,7 +814,9 @@ LibPcdSetEx32 (
Sets the 64-bit value for the token specified by TokenNumber and Sets the 64-bit value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -835,7 +853,7 @@ LibPcdSetEx64 (
Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size
supported by TokenNumber and return NULL to indicate that the set operation supported by TokenNumber and return NULL to indicate that the set operation
was not actually performed. was not actually performed, or ASSERT() if the set operation was not corretly performed.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If SizeOfBuffer is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT().
@ -860,17 +878,21 @@ LibPcdSetExPtr (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN InputSizeOfBuffer;
ASSERT (SizeOfBuffer != NULL); ASSERT (SizeOfBuffer != NULL);
if (*SizeOfBuffer > 0) { if (*SizeOfBuffer > 0) {
ASSERT (Buffer != NULL); ASSERT (Buffer != NULL);
} }
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
InputSizeOfBuffer = *SizeOfBuffer;
Status = (GetPiPcdPpiPointer ())->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer); Status = (GetPiPcdPpiPointer ())->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer);
if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {
if (EFI_ERROR (Status)) {
return NULL; return NULL;
} }
ASSERT_EFI_ERROR (Status);
return Buffer; return Buffer;
} }
@ -884,6 +906,7 @@ LibPcdSetExPtr (
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). If Guid is NULL, then ASSERT().
If the set operation was not correctly performed, then ASSERT().
@param[in] Guid The pointer to a 128-bit unique value that @param[in] Guid The pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.