From 0befb08d23593e0c6fcb0b7fc45bce74b822cced Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Tue, 7 Jan 2014 09:28:33 +0000 Subject: [PATCH] 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 Reviewed by: Liming Gao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15056 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Include/Library/PcdLib.h | 68 +++++++++++++++++++------- MdePkg/Library/BasePcdLibNull/PcdLib.c | 51 ++++++++++++------- MdePkg/Library/DxePcdLib/DxePcdLib.c | 59 +++++++++++++++------- MdePkg/Library/PeiPcdLib/PeiPcdLib.c | 67 ++++++++++++++++--------- 4 files changed, 169 insertions(+), 76 deletions(-) diff --git a/MdePkg/Include/Library/PcdLib.h b/MdePkg/Include/Library/PcdLib.h index 1ea4ac7cec..ea39bb53bf 100644 --- a/MdePkg/Include/Library/PcdLib.h +++ b/MdePkg/Include/Library/PcdLib.h @@ -14,7 +14,7 @@ There are no restrictions on the use of FeaturePcd(), FixedPcdGetXX(), PatchPcdGetXX(), and PatchPcdSetXX(). -Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2014, 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 @@ -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. 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 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. 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 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. 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 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 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 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 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. 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 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. 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 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. 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 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. 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 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. 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 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 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 - 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, 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. 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 which namespace to retrieve a value from. @@ -1081,7 +1094,9 @@ LibPcdGetExSize ( Sets the 8-bit value for the token specified by TokenNumber 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] Value The 8-bit value to set. @@ -1101,7 +1116,9 @@ LibPcdSet8 ( Sets the 16-bit value for the token specified by TokenNumber 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] Value The 16-bit value to set. @@ -1121,7 +1138,9 @@ LibPcdSet16 ( Sets the 32-bit value for the token specified by TokenNumber 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] Value The 32-bit value to set. @@ -1141,7 +1160,9 @@ LibPcdSet32 ( Sets the 64-bit value for the token specified by TokenNumber 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] Value The 64-bit value to set. @@ -1163,7 +1184,8 @@ LibPcdSet64 ( specified by Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than 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 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 maximum size supported by TokenName and NULL must be returned. @@ -1192,7 +1214,9 @@ LibPcdSetPtr ( Sets the Boolean value for the token specified by TokenNumber 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] Value The boolean value to set. @@ -1212,9 +1236,10 @@ LibPcdSetBool ( Sets the 8-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -1237,9 +1262,10 @@ LibPcdSetEx8 ( Sets the 16-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -1262,9 +1288,10 @@ LibPcdSetEx16 ( Sets the 32-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -1287,8 +1314,10 @@ LibPcdSetEx32 ( Sets the 64-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -1313,7 +1342,7 @@ LibPcdSetEx64 ( Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than 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 - 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 SizeOfBuffer is NULL, then ASSERT(). @@ -1343,9 +1372,10 @@ LibPcdSetExPtr ( Sets the Boolean value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. diff --git a/MdePkg/Library/BasePcdLibNull/PcdLib.c b/MdePkg/Library/BasePcdLibNull/PcdLib.c index 8333aaa3f9..e03c01da5f 100644 --- a/MdePkg/Library/BasePcdLibNull/PcdLib.c +++ b/MdePkg/Library/BasePcdLibNull/PcdLib.c @@ -1,7 +1,7 @@ /** @file A emptry template implementation of PCD Library. - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2014, 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 @@ -400,7 +400,9 @@ LibPcdGetExSize ( Sets the 8-bit value for the token specified by TokenNumber 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] Value The 8-bit value to set. @@ -426,7 +428,9 @@ LibPcdSet8 ( Sets the 16-bit value for the token specified by TokenNumber 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] Value The 16-bit value to set. @@ -452,7 +456,9 @@ LibPcdSet16 ( Sets the 32-bit value for the token specified by TokenNumber 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] Value The 32-bit value to set. @@ -478,7 +484,9 @@ LibPcdSet32 ( Sets the 64-bit value for the token specified by TokenNumber 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] Value The 64-bit value to set. @@ -506,7 +514,8 @@ LibPcdSet64 ( specified by Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than 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 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 maximum size supported by TokenName and NULL must be returned. @@ -541,7 +550,9 @@ LibPcdSetPtr ( Sets the Boolean value for the token specified by TokenNumber 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] Value The boolean value to set. @@ -567,9 +578,10 @@ LibPcdSetBool ( Sets the 8-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -598,9 +610,10 @@ LibPcdSetEx8 ( Sets the 16-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -629,9 +642,10 @@ LibPcdSetEx16 ( Sets the 32-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -660,8 +674,10 @@ LibPcdSetEx32 ( Sets the 64-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -692,7 +708,7 @@ LibPcdSetEx64 ( Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than 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 - 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 SizeOfBuffer is NULL, then ASSERT(). @@ -728,9 +744,10 @@ LibPcdSetExPtr ( Sets the Boolean value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.c b/MdePkg/Library/DxePcdLib/DxePcdLib.c index f14a746529..6f3a1b2861 100644 --- a/MdePkg/Library/DxePcdLib/DxePcdLib.c +++ b/MdePkg/Library/DxePcdLib/DxePcdLib.c @@ -1,7 +1,7 @@ /** @file Implementation of PcdLib class library for DXE phase. -Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2014, 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 @@ -489,7 +489,9 @@ LibPcdGetExSize ( Sets the 8-bit value for the token specified by TokenNumber 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] Value The 8-bit value to set. @@ -518,7 +520,9 @@ LibPcdSet8 ( Sets the 16-bit value for the token specified by TokenNumber 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] Value The 16-bit value to set. @@ -547,7 +551,9 @@ LibPcdSet16 ( Sets the 32-bit value for the token specified by TokenNumber 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] Value The 32-bit value to set. @@ -576,6 +582,8 @@ LibPcdSet32 ( Sets the 64-bit value for the token specified by TokenNumber 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] Value The 64-bit value to set. @@ -607,7 +615,8 @@ LibPcdSet64 ( specified by Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than 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 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 maximum size supported by TokenName and NULL must be returned. @@ -631,6 +640,7 @@ LibPcdSetPtr ( ) { EFI_STATUS Status; + UINTN InputSizeOfBuffer; ASSERT (SizeOfBuffer != NULL); @@ -638,10 +648,12 @@ LibPcdSetPtr ( ASSERT (Buffer != NULL); } + InputSizeOfBuffer = *SizeOfBuffer; Status = GetPcdProtocol()->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) { return NULL; } + ASSERT_EFI_ERROR (Status); return (VOID *)Buffer; } @@ -653,7 +665,9 @@ LibPcdSetPtr ( Sets the Boolean value for the token specified by TokenNumber 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] Value The boolean value to set. @@ -682,9 +696,10 @@ LibPcdSetBool ( Sets the 8-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -718,9 +733,10 @@ LibPcdSetEx8 ( Sets the 16-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -754,9 +770,10 @@ LibPcdSetEx16 ( Sets the 32-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -790,8 +807,10 @@ LibPcdSetEx32 ( Sets the 64-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -827,7 +846,7 @@ LibPcdSetEx64 ( Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than 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 - 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 SizeOfBuffer is NULL, then ASSERT(). @@ -852,6 +871,7 @@ LibPcdSetExPtr ( ) { EFI_STATUS Status; + UINTN InputSizeOfBuffer; ASSERT (Guid != NULL); @@ -861,10 +881,12 @@ LibPcdSetExPtr ( ASSERT (Buffer != NULL); } + InputSizeOfBuffer = *SizeOfBuffer; Status = GetPiPcdProtocol()->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) { return NULL; } + ASSERT_EFI_ERROR (Status); return Buffer; } @@ -876,9 +898,10 @@ LibPcdSetExPtr ( Sets the Boolean value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. diff --git a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c index 31ff457fc8..536e1d05d9 100644 --- a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c +++ b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c @@ -1,7 +1,7 @@ /** @file Implementation of PcdLib class library for PEI phase. -Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2014, 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 @@ -490,7 +490,9 @@ LibPcdGetExSize ( Sets the 8-bit value for the token specified by TokenNumber 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] Value The 8-bit value to set. @@ -520,7 +522,9 @@ LibPcdSet8 ( Sets the 16-bit value for the token specified by TokenNumber 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] Value The 16-bit value to set. @@ -550,7 +554,9 @@ LibPcdSet16 ( Sets the 32-bit value for the token specified by TokenNumber 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] Value The 32-bit value to set. @@ -580,7 +586,9 @@ LibPcdSet32 ( Sets the 64-bit value for the token specified by TokenNumber 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] Value The 64-bit value to set. @@ -612,7 +620,8 @@ LibPcdSet64 ( specified by Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than 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 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 maximum size supported by TokenName and NULL must be returned. @@ -636,18 +645,20 @@ LibPcdSetPtr ( ) { EFI_STATUS Status; + UINTN InputSizeOfBuffer; ASSERT (SizeOfBuffer != NULL); if (*SizeOfBuffer > 0) { ASSERT (Buffer != NULL); } - - Status = (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer); - if (EFI_ERROR (Status)) { + InputSizeOfBuffer = *SizeOfBuffer; + Status = (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer); + if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) { return NULL; } + ASSERT_EFI_ERROR (Status); return (VOID *) Buffer; } @@ -659,7 +670,9 @@ LibPcdSetPtr ( Sets the Boolean value for the token specified by TokenNumber 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] Value The boolean value to set. @@ -689,9 +702,10 @@ LibPcdSetBool ( Sets the 8-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -726,9 +740,10 @@ LibPcdSetEx8 ( Sets the 16-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -761,9 +776,10 @@ LibPcdSetEx16 ( Sets the 32-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -798,8 +814,10 @@ LibPcdSetEx32 ( Sets the 64-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. @@ -835,7 +853,7 @@ LibPcdSetEx64 ( Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than 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 - 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 SizeOfBuffer is NULL, then ASSERT(). @@ -860,17 +878,21 @@ LibPcdSetExPtr ( ) { EFI_STATUS Status; + UINTN InputSizeOfBuffer; + + ASSERT (SizeOfBuffer != NULL); if (*SizeOfBuffer > 0) { ASSERT (Buffer != NULL); } ASSERT (Guid != NULL); + InputSizeOfBuffer = *SizeOfBuffer; Status = (GetPiPcdPpiPointer ())->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer); - - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) { return NULL; } + ASSERT_EFI_ERROR (Status); return Buffer; } @@ -882,9 +904,10 @@ LibPcdSetExPtr ( Sets the Boolean value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. - + 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 designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. -- 2.39.2