X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FPeiPcdLib%2FPeiPcdLib.c;h=536e1d05d9e9c42bbcd9285abbaf1ebefdfd9859;hp=31ff457fc8f7823cfc3b4d103298b3b9054f7ed4;hb=0befb08d23593e0c6fcb0b7fc45bce74b822cced;hpb=f0c5095b274b2b35867d5245119aa1aba0acc87e 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.