From: Star Zeng Date: Fri, 10 Apr 2015 10:05:11 +0000 (+0000) Subject: MdePkg: Add a set of PcdSetXXS APIs into PcdLib and remove the ASSERT in original... X-Git-Tag: edk2-stable201903~10051 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=9a3558419509bcd889e93986985d81710cac11e9 MdePkg: Add a set of PcdSetXXS APIs into PcdLib and remove the ASSERT in original PcdSetXX APIs. And also use DISABLE_NEW_DEPRECATED_INTERFACES macro to include the old PcdSetXX APIs. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng Reviewed-by: Liming Gao Reviewed-by: Jiewen Yao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17162 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdePkg/Include/Library/PcdLib.h b/MdePkg/Include/Library/PcdLib.h index ea39bb53bf..a7e1e626da 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 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2015, 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 @@ -433,14 +433,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define PcdGetBool(TokenName) _PCD_GET_MODE_BOOL_##TokenName +#ifndef DISABLE_NEW_DEPRECATED_INTERFACES /** Sets an 8-bit PCD token value based on a token name. 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. @@ -456,8 +455,6 @@ 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. @@ -473,8 +470,6 @@ 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. @@ -507,7 +502,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, or ASSERT() if the set operation was not corretly performed. + by TokenName and NULL must be returned. If TokenName is not a valid token in the token space, then the module will not build. If SizeOfBuffer is NULL, then ASSERT(). @@ -529,8 +524,6 @@ 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. @@ -538,7 +531,103 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #define PcdSetBool(TokenName, Value) _PCD_SET_MODE_BOOL_##TokenName ((Value)) +#endif + +/** + Sets a 8-bit PCD token value based on a token name. + + Sets the 8-bit value for the token specified by TokenName. + If TokenName is not a valid token in the token space, then the module will not build. + + @param TokenName The name of the PCD token to retrieve a current value for. + @param Value The 8-bit value to set. + + @return The status of the set operation. + +**/ +#define PcdSet8S(TokenName, Value) _PCD_SET_MODE_8_S_##TokenName ((Value)) + +/** + Sets a 16-bit PCD token value based on a token name. + + Sets the 16-bit value for the token specified by TokenName. + If TokenName is not a valid token in the token space, then the module will not build. + + @param TokenName The name of the PCD token to retrieve a current value for. + @param Value The 16-bit value to set. + @return The status of the set operation. + +**/ +#define PcdSet16S(TokenName, Value) _PCD_SET_MODE_16_S_##TokenName ((Value)) + +/** + Sets a 32-bit PCD token value based on a token name. + + Sets the 32-bit value for the token specified by TokenName. + If TokenName is not a valid token in the token space, then the module will not build. + + @param TokenName The name of the PCD token to retrieve a current value for. + @param Value The 32-bit value to set. + + @return The status of the set operation. + +**/ +#define PcdSet32S(TokenName, Value) _PCD_SET_MODE_32_S_##TokenName ((Value)) + +/** + Sets a 64-bit PCD token value based on a token name. + + Sets the 64-bit value for the token specified by TokenName. + If TokenName is not a valid token in the token space, then the module will not build. + + @param TokenName The name of the PCD token to retrieve a current value for. + @param Value The 64-bit value to set. + + @return The status of the set operation. + +**/ +#define PcdSet64S(TokenName, Value) _PCD_SET_MODE_64_S_##TokenName ((Value)) + +/** + Sets a pointer to a PCD token buffer based on a token name. + + Sets the buffer for the token specified by TokenName. + If SizeOfBuffer is greater than the maximum size supported by TokenName, + then set SizeOfBuffer to the maximum size supported by TokenName and return + RETURN_INVALID_PARAMETER 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 RETURN_INVALID_PARAMETER must be returned. + 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 > 0 and Buffer is NULL, then ASSERT(). + + @param TokenName The name of the PCD token to set the current value for. + @param SizeOfBuffer A pointer to the size, in bytes, of Buffer. + @param Buffer A pointer to the buffer to set. + + @return The status of the set operation. + +**/ +#define PcdSetPtrS(TokenName, SizeOfBuffer, Buffer) \ + _PCD_SET_MODE_PTR_S_##TokenName ((SizeOfBuffer), (Buffer)) + + + +/** + Sets a boolean PCD token value based on a token name. + + Sets the boolean value for the token specified by TokenName. + If TokenName is not a valid token in the token space, then the module will not build. + + @param TokenName The name of the PCD token to retrieve a current value for. + @param Value The boolean value to set. + + @return The status of the set operation. + +**/ +#define PcdSetBoolS(TokenName, Value) _PCD_SET_MODE_BOOL_S_##TokenName ((Value)) /** Retrieves a token number based on a GUID and a token name. @@ -667,6 +756,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define PcdGetExBool(Guid, TokenName) LibPcdGetExBool ((Guid), PcdTokenEx(Guid,TokenName)) + +#ifndef DISABLE_NEW_DEPRECATED_INTERFACES /** Sets an 8-bit PCD token value based on a GUID and a token name. @@ -675,7 +766,6 @@ 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. @@ -696,7 +786,6 @@ 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. @@ -717,7 +806,6 @@ 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. @@ -738,7 +826,6 @@ 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. @@ -759,7 +846,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, or ASSERT() if the set operation was not corretly performed. + Guid and TokenName and NULL must be returned. If TokenName is not a valid token in the token space specified by Guid, then the module will not build. @@ -788,7 +875,6 @@ 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. @@ -800,7 +886,132 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #define PcdSetExBool(Guid, TokenName, Value) \ LibPcdSetExBool((Guid), PcdTokenEx(Guid,TokenName), (Value)) +#endif + +/** + Sets an 8-bit PCD token value based on a GUID and a token name. + + Sets the 8-bit value for the token specified by Guid and TokenName. + If TokenName is not a valid token in the token space specified by Guid, + then the module will not build. + + If Guid is NULL, then ASSERT(). + + @param Guid Pointer to a 128-bit unique value that designates + which namespace to retrieve a value from. + @param TokenName The name of the PCD token to set the current value for. + @param Value The 8-bit value to set. + + @return The status of the set operation. + +**/ +#define PcdSetEx8S(Guid, TokenName, Value) LibPcdSetEx8S ((Guid), PcdTokenEx(Guid,TokenName), (Value)) + +/** + Sets an 16-bit PCD token value based on a GUID and a token name. + + Sets the 16-bit value for the token specified by Guid and TokenName. + If TokenName is not a valid token in the token space specified by Guid, + then the module will not build. + + If Guid is NULL, then ASSERT(). + + @param Guid Pointer to a 128-bit unique value that designates + which namespace to retrieve a value from. + @param TokenName The name of the PCD token to set the current value for. + @param Value The 16-bit value to set. + + @return The status of the set operation. + +**/ +#define PcdSetEx16S(Guid, TokenName, Value) LibPcdSetEx16S ((Guid), PcdTokenEx(Guid,TokenName), (Value)) + +/** + Sets an 32-bit PCD token value based on a GUID and a token name. + + Sets the 32-bit value for the token specified by Guid and TokenName. + If TokenName is not a valid token in the token space specified by Guid, + then the module will not build. + + If Guid is NULL, then ASSERT(). + + @param Guid Pointer to a 128-bit unique value that designates + which namespace to retrieve a value from. + @param TokenName The name of the PCD token to set the current value for. + @param Value The 32-bit value to set. + + @return The status of the set operation. + +**/ +#define PcdSetEx32S(Guid, TokenName, Value) LibPcdSetEx32S ((Guid), PcdTokenEx(Guid,TokenName), (Value)) +/** + Sets an 64-bit PCD token value based on a GUID and a token name. + + Sets the 64-bit value for the token specified by Guid and TokenName. + If TokenName is not a valid token in the token space specified by Guid, + then the module will not build. + + If Guid is NULL, then ASSERT(). + + @param Guid Pointer to a 128-bit unique value that designates + which namespace to retrieve a value from. + @param TokenName The name of the PCD token to set the current value for. + @param Value The 64-bit value to set. + + @return The status of the set operation. + +**/ +#define PcdSetEx64S(Guid, TokenName, Value) LibPcdSetEx64S ((Guid), PcdTokenEx(Guid,TokenName), (Value)) + +/** + Sets a pointer to a PCD token buffer based on a GUID and a token name. + + Sets the buffer for the token specified by Guid and TokenName. + If SizeOfBuffer is greater than the maximum size supported by Guid and TokenName, + then set SizeOfBuffer to the maximum size supported by Guid and TokenName and return + RETURN_INVALID_PARAMETER 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 RETURN_INVALID_PARAMETER must be returned. + If TokenName is not a valid token in the token space specified by Guid, + then the module will not build. + + If Guid is NULL, then ASSERT(). + If SizeOfBuffer is NULL, then ASSERT(). + If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). + + @param Guid Pointer to a 128-bit unique value that designates + which namespace to retrieve a value from. + @param TokenName The name of the PCD token to set the current value for. + @param SizeOfBuffer A pointer to the size, in bytes, of Buffer. + @param Buffer Pointer to the buffer to set. + + @return The status of the set operation. + +**/ +#define PcdSetExPtrS(Guid, TokenName, SizeOfBuffer, Buffer) \ + LibPcdSetExPtrS ((Guid), PcdTokenEx(Guid,TokenName), (SizeOfBuffer), (Buffer)) + + +/** + Sets an boolean PCD token value based on a GUID and a token name. + + Sets the boolean value for the token specified by Guid and TokenName. + If TokenName is not a valid token in the token space specified by Guid, + then the module will not build. + + If Guid is NULL, then ASSERT(). + + @param Guid Pointer to a 128-bit unique value that designates + which namespace to retrieve a value from. + @param TokenName The name of the PCD token to set the current value for. + @param Value The boolean value to set. + + @return The status of the set operation. + +**/ +#define PcdSetExBoolS(Guid, TokenName, Value) \ + LibPcdSetExBoolS ((Guid), PcdTokenEx(Guid,TokenName), (Value)) /** This function provides a means by which SKU support can be established in the PCD infrastructure. @@ -1089,14 +1300,13 @@ LibPcdGetExSize ( ); +#ifndef DISABLE_NEW_DEPRECATED_INTERFACES /** This function provides a means by which to set a value for a given PCD token. 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. @@ -1117,8 +1327,6 @@ 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. @@ -1139,8 +1347,6 @@ 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. @@ -1161,8 +1367,6 @@ 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. @@ -1184,8 +1388,7 @@ 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, - or ASSERT() if the set operation was not corretly performed. + 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. @@ -1215,8 +1418,6 @@ 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. @@ -1238,7 +1439,6 @@ LibPcdSetBool ( 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. @@ -1264,7 +1464,6 @@ LibPcdSetEx8 ( 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. @@ -1290,7 +1489,6 @@ LibPcdSetEx16 ( 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. @@ -1316,7 +1514,6 @@ LibPcdSetEx32 ( 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. @@ -1342,7 +1539,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, or ASSERT() if the set operation was not corretly performed. + was not actually performed. If Guid is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT(). @@ -1374,7 +1571,6 @@ LibPcdSetExPtr ( 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. @@ -1391,7 +1587,283 @@ LibPcdSetExBool ( IN UINTN TokenNumber, IN BOOLEAN Value ); +#endif + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 8-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 8-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet8S ( + IN UINTN TokenNumber, + IN UINT8 Value + ); + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 16-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 16-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet16S ( + IN UINTN TokenNumber, + IN UINT16 Value + ); + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 32-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 32-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet32S ( + IN UINTN TokenNumber, + IN UINT32 Value + ); + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 64-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 64-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet64S ( + IN UINTN TokenNumber, + IN UINT64 Value + ); + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets a buffer for the token specified by TokenNumber to the value specified + by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size + support by TokenNumber, then set SizeOfBuffer to the maximum size supported by + TokenNumber and return RETURN_INVALID_PARAMETER 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 RETURN_INVALID_PARAMETER must be returned. + + If SizeOfBuffer is NULL, then ASSERT(). + If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. + @param[in] Buffer A pointer to the buffer to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetPtrS ( + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN CONST VOID *Buffer + ); + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the boolean value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The boolean value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetBoolS ( + IN UINTN TokenNumber, + IN BOOLEAN Value + ); + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 8-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 8-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx8S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT8 Value + ); + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 16-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 16-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx16S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT16 Value + ); + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 32-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 32-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx32S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT32 Value + ); + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 64-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 64-bit value to set. + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx64S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT64 Value + ); + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets a buffer for the token specified by TokenNumber to the value specified by + Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size + support by TokenNumber, then set SizeOfBuffer to the maximum size supported by + TokenNumber and return RETURN_INVALID_PARAMETER to indicate that the set operation + was not actually performed. + + If Guid is NULL, then ASSERT(). + If SizeOfBuffer is NULL, then ASSERT(). + If SizeOfBuffer > 0 and Buffer is NULL, 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. + @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. + @param[in] Buffer A pointer to the buffer to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetExPtrS ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN VOID *Buffer + ); + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the boolean value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The boolean value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetExBoolS ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN BOOLEAN Value + ); /** This notification function serves two purposes. @@ -1546,6 +2018,38 @@ LibPatchPcdSetPtr ( IN CONST VOID *Buffer ); +/** + Sets a value of a patchable PCD entry that is type pointer. + + Sets the PCD entry specified by PatchVariable to the value specified + by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize, + then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER + to indicate that the set operation was not actually performed. + If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to + MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned. + + If PatchVariable is NULL, then ASSERT(). + If SizeOfBuffer is NULL, then ASSERT(). + If SizeOfBuffer > 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. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPatchPcdSetPtrS ( + IN VOID *PatchVariable, + IN UINTN MaximumDatumSize, + IN OUT UINTN *SizeOfBuffer, + IN CONST VOID *Buffer + ); + typedef enum { PCD_TYPE_8, PCD_TYPE_16, diff --git a/MdePkg/Library/BasePcdLibNull/PcdLib.c b/MdePkg/Library/BasePcdLibNull/PcdLib.c index e03c01da5f..e5d1627fed 100644 --- a/MdePkg/Library/BasePcdLibNull/PcdLib.c +++ b/MdePkg/Library/BasePcdLibNull/PcdLib.c @@ -395,14 +395,13 @@ LibPcdGetExSize ( +#ifndef DISABLE_NEW_DEPRECATED_INTERFACES /** This function provides a means by which to set a value for a given PCD token. 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. @@ -429,8 +428,6 @@ 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. @@ -457,8 +454,6 @@ 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. @@ -485,8 +480,6 @@ 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. @@ -514,8 +507,7 @@ 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, - or ASSERT() if the set operation was not corretly performed. + 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. @@ -551,8 +543,6 @@ 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. @@ -580,7 +570,6 @@ LibPcdSetBool ( 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. @@ -612,7 +601,6 @@ LibPcdSetEx8 ( 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. @@ -644,7 +632,6 @@ LibPcdSetEx16 ( 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. @@ -676,7 +663,6 @@ LibPcdSetEx32 ( 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. @@ -708,7 +694,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, or ASSERT() if the set operation was not corretly performed. + was not actually performed. If Guid is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT(). @@ -746,7 +732,6 @@ LibPcdSetExPtr ( 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. @@ -768,8 +753,343 @@ LibPcdSetExBool ( return FALSE; } +#endif + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 8-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 8-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet8S ( + IN UINTN TokenNumber, + IN UINT8 Value + ) +{ + ASSERT (FALSE); + + return RETURN_INVALID_PARAMETER; +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 16-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 16-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet16S ( + IN UINTN TokenNumber, + IN UINT16 Value + ) +{ + ASSERT (FALSE); + + return RETURN_INVALID_PARAMETER; +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 32-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 32-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet32S ( + IN UINTN TokenNumber, + IN UINT32 Value + ) +{ + ASSERT (FALSE); + + return RETURN_INVALID_PARAMETER; +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 64-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 64-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet64S ( + IN UINTN TokenNumber, + IN UINT64 Value + ) +{ + ASSERT (FALSE); + + return RETURN_INVALID_PARAMETER; +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets a buffer for the token specified by TokenNumber to the value specified + by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size + support by TokenNumber, then set SizeOfBuffer to the maximum size supported by + TokenNumber and return EFI_INVALID_PARAMETER 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 EFI_INVALID_PARAMETER must be returned. + + If SizeOfBuffer is NULL, then ASSERT(). + If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. + @param[in] Buffer A pointer to the buffer to set. + + @return The status of the set operation. +**/ +RETURN_STATUS +EFIAPI +LibPcdSetPtrS ( + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN CONST VOID *Buffer + ) +{ + ASSERT (FALSE); + return RETURN_INVALID_PARAMETER; +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the boolean value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The boolean value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetBoolS ( + IN UINTN TokenNumber, + IN BOOLEAN Value + ) +{ + ASSERT (FALSE); + + return RETURN_INVALID_PARAMETER; +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 8-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 8-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx8S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT8 Value + ) +{ + ASSERT (FALSE); + + return RETURN_INVALID_PARAMETER; +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 16-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 16-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx16S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT16 Value + ) +{ + ASSERT (FALSE); + + return RETURN_INVALID_PARAMETER; +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 32-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 32-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx32S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT32 Value + ) +{ + ASSERT (FALSE); + + return RETURN_INVALID_PARAMETER; +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 64-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 64-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx64S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT64 Value + ) +{ + ASSERT (FALSE); + + return RETURN_INVALID_PARAMETER; +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets a buffer for the token specified by TokenNumber to the value specified by + Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size + support by TokenNumber, then set SizeOfBuffer to the maximum size supported by + TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation + was not actually performed. + + If Guid is NULL, then ASSERT(). + If SizeOfBuffer is NULL, then ASSERT(). + If SizeOfBuffer > 0 and Buffer is NULL, 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. + @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. + @param[in] Buffer A pointer to the buffer to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetExPtrS ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN VOID *Buffer + ) +{ + ASSERT (FALSE); + + return RETURN_INVALID_PARAMETER; +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the boolean value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The boolean value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetExBoolS ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN BOOLEAN Value + ) +{ + ASSERT (FALSE); + + return RETURN_INVALID_PARAMETER; +} /** Set up a notification function that is called when a specified token is set. @@ -936,6 +1256,56 @@ LibPatchPcdSetPtr ( return (VOID *) Buffer; } +/** + Sets a value of a patchable PCD entry that is type pointer. + + Sets the PCD entry specified by PatchVariable to the value specified + by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize, + then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER + to indicate that the set operation was not actually performed. + If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to + MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned. + + If PatchVariable is NULL, then ASSERT(). + If SizeOfBuffer is NULL, then ASSERT(). + If SizeOfBuffer > 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. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPatchPcdSetPtrS ( + 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 RETURN_INVALID_PARAMETER; + } + + CopyMem (PatchVariable, Buffer, *SizeOfBuffer); + + return RETURN_SUCCESS; +} + /** Retrieve additional information associated with a PCD token. diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.c b/MdePkg/Library/DxePcdLib/DxePcdLib.c index 6f3a1b2861..431ee7206a 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 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2015, 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 @@ -484,14 +484,13 @@ LibPcdGetExSize ( +#ifndef DISABLE_NEW_DEPRECATED_INTERFACES /** This function provides a means by which to set a value for a given PCD token. 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. @@ -505,10 +504,7 @@ LibPcdSet8 ( IN UINT8 Value ) { - EFI_STATUS Status; - - Status = GetPcdProtocol()->Set8 (TokenNumber, Value); - ASSERT_EFI_ERROR (Status); + GetPcdProtocol()->Set8 (TokenNumber, Value); return Value; } @@ -521,8 +517,6 @@ 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. @@ -536,10 +530,7 @@ LibPcdSet16 ( IN UINT16 Value ) { - EFI_STATUS Status; - - Status = GetPcdProtocol()->Set16 (TokenNumber, Value); - ASSERT_EFI_ERROR (Status); + GetPcdProtocol()->Set16 (TokenNumber, Value); return Value; } @@ -552,8 +543,6 @@ 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. @@ -567,10 +556,7 @@ LibPcdSet32 ( IN UINT32 Value ) { - EFI_STATUS Status; - - Status = GetPcdProtocol()->Set32 (TokenNumber, Value); - ASSERT_EFI_ERROR (Status); + GetPcdProtocol()->Set32 (TokenNumber, Value); return Value; } @@ -582,8 +568,6 @@ 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. @@ -598,10 +582,7 @@ LibPcdSet64 ( IN UINT64 Value ) { - EFI_STATUS Status; - - Status = GetPcdProtocol()->Set64 (TokenNumber, Value); - ASSERT_EFI_ERROR (Status); + GetPcdProtocol()->Set64 (TokenNumber, Value); return Value; } @@ -615,8 +596,7 @@ 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, - or ASSERT() if the set operation was not correctly performed. + 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. @@ -653,7 +633,6 @@ LibPcdSetPtr ( if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) { return NULL; } - ASSERT_EFI_ERROR (Status); return (VOID *)Buffer; } @@ -666,8 +645,6 @@ 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. @@ -681,10 +658,7 @@ LibPcdSetBool ( IN BOOLEAN Value ) { - EFI_STATUS Status; - - Status = GetPcdProtocol()->SetBool (TokenNumber, Value); - ASSERT_EFI_ERROR (Status); + GetPcdProtocol()->SetBool (TokenNumber, Value); return Value; } @@ -698,7 +672,6 @@ LibPcdSetBool ( 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. @@ -716,12 +689,9 @@ LibPcdSetEx8 ( IN UINT8 Value ) { - EFI_STATUS Status; - ASSERT (Guid != NULL); - Status = GetPiPcdProtocol()->Set8 (Guid, TokenNumber, Value); - ASSERT_EFI_ERROR (Status); + GetPiPcdProtocol()->Set8 (Guid, TokenNumber, Value); return Value; } @@ -735,7 +705,6 @@ LibPcdSetEx8 ( 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. @@ -753,12 +722,9 @@ LibPcdSetEx16 ( IN UINT16 Value ) { - EFI_STATUS Status; - ASSERT (Guid != NULL); - Status = GetPiPcdProtocol()->Set16 (Guid, TokenNumber, Value); - ASSERT_EFI_ERROR (Status); + GetPiPcdProtocol()->Set16 (Guid, TokenNumber, Value); return Value; } @@ -772,7 +738,6 @@ LibPcdSetEx16 ( 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. @@ -790,12 +755,9 @@ LibPcdSetEx32 ( IN UINT32 Value ) { - EFI_STATUS Status; - ASSERT (Guid != NULL); - Status = GetPiPcdProtocol()->Set32 (Guid, TokenNumber, Value); - ASSERT_EFI_ERROR (Status); + GetPiPcdProtocol()->Set32 (Guid, TokenNumber, Value); return Value; } @@ -809,7 +771,6 @@ LibPcdSetEx32 ( 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. @@ -827,12 +788,9 @@ LibPcdSetEx64 ( IN UINT64 Value ) { - EFI_STATUS Status; - ASSERT (Guid != NULL); - Status = GetPiPcdProtocol()->Set64 (Guid, TokenNumber, Value); - ASSERT_EFI_ERROR (Status); + GetPiPcdProtocol()->Set64 (Guid, TokenNumber, Value); return Value; } @@ -846,7 +804,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, or ASSERT() if the set operation was not corretly performed. + was not actually performed. If Guid is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT(). @@ -886,7 +844,6 @@ LibPcdSetExPtr ( if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) { return NULL; } - ASSERT_EFI_ERROR (Status); return Buffer; } @@ -900,7 +857,6 @@ LibPcdSetExPtr ( 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. @@ -918,17 +874,349 @@ LibPcdSetExBool ( IN BOOLEAN Value ) { - EFI_STATUS Status; - ASSERT (Guid != NULL); - Status = GetPiPcdProtocol()->SetBool (Guid, TokenNumber, Value); - ASSERT_EFI_ERROR (Status); + GetPiPcdProtocol()->SetBool (Guid, TokenNumber, Value); return Value; } +#endif + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 8-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 8-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet8S ( + IN UINTN TokenNumber, + IN UINT8 Value + ) +{ + return GetPcdProtocol()->Set8 (TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 16-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 16-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet16S ( + IN UINTN TokenNumber, + IN UINT16 Value + ) +{ + return GetPcdProtocol()->Set16 (TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 32-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 32-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet32S ( + IN UINTN TokenNumber, + IN UINT32 Value + ) +{ + return GetPcdProtocol()->Set32 (TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + Sets the 64-bit value for the token specified by TokenNumber + to the value specified by Value. + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 64-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet64S ( + IN UINTN TokenNumber, + IN UINT64 Value + ) +{ + return GetPcdProtocol()->Set64 (TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets a buffer for the token specified by TokenNumber to the value specified + by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size + support by TokenNumber, then set SizeOfBuffer to the maximum size supported by + TokenNumber and return EFI_INVALID_PARAMETER 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 EFI_INVALID_PARAMETER must be returned. + + If SizeOfBuffer is NULL, then ASSERT(). + If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. + @param[in] Buffer A pointer to the buffer to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetPtrS ( + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN CONST VOID *Buffer + ) +{ + ASSERT (SizeOfBuffer != NULL); + + if (*SizeOfBuffer > 0) { + ASSERT (Buffer != NULL); + } + + return GetPcdProtocol()->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the boolean value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The boolean value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetBoolS ( + IN UINTN TokenNumber, + IN BOOLEAN Value + ) +{ + return GetPcdProtocol()->SetBool (TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 8-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 8-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx8S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT8 Value + ) +{ + ASSERT (Guid != NULL); + + return GetPiPcdProtocol()->Set8 (Guid, TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 16-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 16-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx16S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT16 Value + ) +{ + ASSERT (Guid != NULL); + + return GetPiPcdProtocol()->Set16 (Guid, TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 32-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 32-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx32S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT32 Value + ) +{ + ASSERT (Guid != NULL); + + return GetPiPcdProtocol()->Set32 (Guid, TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 64-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 64-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx64S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT64 Value + ) +{ + ASSERT (Guid != NULL); + + return GetPiPcdProtocol()->Set64 (Guid, TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets a buffer for the token specified by TokenNumber to the value specified by + Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size + support by TokenNumber, then set SizeOfBuffer to the maximum size supported by + TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation + was not actually performed. + + If Guid is NULL, then ASSERT(). + If SizeOfBuffer is NULL, then ASSERT(). + If SizeOfBuffer > 0 and Buffer is NULL, 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. + @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. + @param[in] Buffer A pointer to the buffer to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetExPtrS ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN VOID *Buffer + ) +{ + ASSERT (Guid != NULL); + + ASSERT (SizeOfBuffer != NULL); + + if (*SizeOfBuffer > 0) { + ASSERT (Buffer != NULL); + } + + return GetPiPcdProtocol()->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the boolean value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The boolean value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetExBoolS ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN BOOLEAN Value + ) +{ + ASSERT (Guid != NULL); + + return GetPiPcdProtocol()->SetBool (Guid, TokenNumber, Value); +} /** Set up a notification function that is called when a specified token is set. @@ -1110,6 +1398,56 @@ LibPatchPcdSetPtr ( return (VOID *) Buffer; } +/** + Sets a value of a patchable PCD entry that is type pointer. + + Sets the PCD entry specified by PatchVariable to the value specified + by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize, + then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER + to indicate that the set operation was not actually performed. + If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to + MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned. + + If PatchVariable is NULL, then ASSERT(). + If SizeOfBuffer is NULL, then ASSERT(). + If SizeOfBuffer > 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. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPatchPcdSetPtrS ( + 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 RETURN_INVALID_PARAMETER; + } + + CopyMem (PatchVariable, Buffer, *SizeOfBuffer); + + return RETURN_SUCCESS; +} + /** Retrieve additional information associated with a PCD token. diff --git a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c index 536e1d05d9..3d7139682a 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 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2015, 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 @@ -485,14 +485,13 @@ LibPcdGetExSize ( +#ifndef DISABLE_NEW_DEPRECATED_INTERFACES /** This function provides a means by which to set a value for a given PCD token. 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. @@ -506,11 +505,7 @@ LibPcdSet8 ( IN UINT8 Value ) { - EFI_STATUS Status; - - Status = (GetPcdPpiPointer ())->Set8 (TokenNumber, Value); - - ASSERT_EFI_ERROR (Status); + (GetPcdPpiPointer ())->Set8 (TokenNumber, Value); return Value; } @@ -523,8 +518,6 @@ 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. @@ -538,11 +531,7 @@ LibPcdSet16 ( IN UINT16 Value ) { - EFI_STATUS Status; - - Status = (GetPcdPpiPointer ())->Set16 (TokenNumber, Value); - - ASSERT_EFI_ERROR (Status); + (GetPcdPpiPointer ())->Set16 (TokenNumber, Value); return Value; } @@ -555,8 +544,6 @@ 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. @@ -570,11 +557,7 @@ LibPcdSet32 ( IN UINT32 Value ) { - EFI_STATUS Status; - - Status = (GetPcdPpiPointer ())->Set32 (TokenNumber, Value); - - ASSERT_EFI_ERROR (Status); + (GetPcdPpiPointer ())->Set32 (TokenNumber, Value); return Value; } @@ -587,8 +570,6 @@ 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. @@ -602,11 +583,7 @@ LibPcdSet64 ( IN UINT64 Value ) { - EFI_STATUS Status; - - Status = (GetPcdPpiPointer ())->Set64 (TokenNumber, Value); - - ASSERT_EFI_ERROR (Status); + (GetPcdPpiPointer ())->Set64 (TokenNumber, Value); return Value; } @@ -620,8 +597,7 @@ 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, - or ASSERT() if the set operation was not corretly performed. + 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. @@ -658,7 +634,6 @@ LibPcdSetPtr ( if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) { return NULL; } - ASSERT_EFI_ERROR (Status); return (VOID *) Buffer; } @@ -671,8 +646,6 @@ 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. @@ -686,11 +659,7 @@ LibPcdSetBool ( IN BOOLEAN Value ) { - EFI_STATUS Status; - - Status = (GetPcdPpiPointer ())->SetBool (TokenNumber, Value); - - ASSERT_EFI_ERROR (Status); + (GetPcdPpiPointer ())->SetBool (TokenNumber, Value); return Value; } @@ -704,7 +673,6 @@ LibPcdSetBool ( 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. @@ -722,13 +690,9 @@ LibPcdSetEx8 ( IN UINT8 Value ) { - EFI_STATUS Status; - ASSERT (Guid != NULL); - Status = (GetPiPcdPpiPointer ())->Set8 (Guid, TokenNumber, Value); - - ASSERT_EFI_ERROR (Status); + (GetPiPcdPpiPointer ())->Set8 (Guid, TokenNumber, Value); return Value; } @@ -742,7 +706,6 @@ LibPcdSetEx8 ( 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. @@ -760,11 +723,9 @@ LibPcdSetEx16 ( IN UINT16 Value ) { - EFI_STATUS Status; ASSERT (Guid != NULL); - Status = (GetPiPcdPpiPointer ())->Set16 (Guid, TokenNumber, Value); - ASSERT_EFI_ERROR (Status); + (GetPiPcdPpiPointer ())->Set16 (Guid, TokenNumber, Value); return Value; } @@ -778,7 +739,6 @@ LibPcdSetEx16 ( 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. @@ -796,13 +756,9 @@ LibPcdSetEx32 ( IN UINT32 Value ) { - EFI_STATUS Status; - ASSERT (Guid != NULL); - Status = (GetPiPcdPpiPointer ())->Set32 (Guid, TokenNumber, Value); - - ASSERT_EFI_ERROR (Status); + (GetPiPcdPpiPointer ())->Set32 (Guid, TokenNumber, Value); return Value; } @@ -816,7 +772,6 @@ LibPcdSetEx32 ( 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. @@ -834,12 +789,9 @@ LibPcdSetEx64 ( IN UINT64 Value ) { - EFI_STATUS Status; ASSERT (Guid != NULL); - Status = (GetPiPcdPpiPointer ())->Set64 (Guid, TokenNumber, Value); - - ASSERT_EFI_ERROR (Status); + (GetPiPcdPpiPointer ())->Set64 (Guid, TokenNumber, Value); return Value; } @@ -853,7 +805,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, or ASSERT() if the set operation was not corretly performed. + was not actually performed. If Guid is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT(). @@ -880,7 +832,6 @@ LibPcdSetExPtr ( EFI_STATUS Status; UINTN InputSizeOfBuffer; - ASSERT (SizeOfBuffer != NULL); if (*SizeOfBuffer > 0) { ASSERT (Buffer != NULL); @@ -892,7 +843,6 @@ LibPcdSetExPtr ( if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) { return NULL; } - ASSERT_EFI_ERROR (Status); return Buffer; } @@ -906,7 +856,6 @@ LibPcdSetExPtr ( 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. @@ -924,17 +873,349 @@ LibPcdSetExBool ( IN BOOLEAN Value ) { - EFI_STATUS Status; - ASSERT (Guid != NULL); - Status = (GetPiPcdPpiPointer ())->SetBool (Guid, TokenNumber, Value); - ASSERT_EFI_ERROR (Status); + (GetPiPcdPpiPointer ())->SetBool (Guid, TokenNumber, Value); return Value; } +#endif + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 8-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 8-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet8S ( + IN UINTN TokenNumber, + IN UINT8 Value + ) +{ + return (GetPcdPpiPointer ())->Set8 (TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 16-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 16-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet16S ( + IN UINTN TokenNumber, + IN UINT16 Value + ) +{ + return (GetPcdPpiPointer ())->Set16 (TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 32-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 32-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet32S ( + IN UINTN TokenNumber, + IN UINT32 Value + ) +{ + return (GetPcdPpiPointer ())->Set32 (TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 64-bit value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 64-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSet64S ( + IN UINTN TokenNumber, + IN UINT64 Value + ) +{ + return (GetPcdPpiPointer ())->Set64 (TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets a buffer for the token specified by TokenNumber to the value specified + by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size + support by TokenNumber, then set SizeOfBuffer to the maximum size supported by + TokenNumber and return EFI_INVALID_PARAMETER 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 EFI_INVALID_PARAMETER must be returned. + + If SizeOfBuffer is NULL, then ASSERT(). + If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. + @param[in] Buffer A pointer to the buffer to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetPtrS ( + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN CONST VOID *Buffer + ) +{ + ASSERT (SizeOfBuffer != NULL); + + if (*SizeOfBuffer > 0) { + ASSERT (Buffer != NULL); + } + + return (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the boolean value for the token specified by TokenNumber + to the value specified by Value. + + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The boolean value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetBoolS ( + IN UINTN TokenNumber, + IN BOOLEAN Value + ) +{ + return (GetPcdPpiPointer ())->SetBool (TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 8-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 8-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx8S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT8 Value + ) +{ + ASSERT (Guid != NULL); + + return (GetPiPcdPpiPointer ())->Set8 (Guid, TokenNumber, Value); +} +/** + This function provides a means by which to set a value for a given PCD token. + Sets the 16-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 16-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx16S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT16 Value + ) +{ + ASSERT (Guid != NULL); + + return (GetPiPcdPpiPointer ())->Set16 (Guid, TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 32-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 32-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx32S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT32 Value + ) +{ + ASSERT (Guid != NULL); + + return (GetPiPcdPpiPointer ())->Set32 (Guid, TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the 64-bit value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The 64-bit value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetEx64S ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN UINT64 Value + ) +{ + ASSERT (Guid != NULL); + + return (GetPiPcdPpiPointer ())->Set64 (Guid, TokenNumber, Value); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets a buffer for the token specified by TokenNumber to the value specified by + Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size + support by TokenNumber, then set SizeOfBuffer to the maximum size supported by + TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation + was not actually performed. + + If Guid is NULL, then ASSERT(). + If SizeOfBuffer is NULL, then ASSERT(). + If SizeOfBuffer > 0 and Buffer is NULL, 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. + @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. + @param[in] Buffer A pointer to the buffer to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetExPtrS ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN VOID *Buffer + ) +{ + ASSERT (Guid != NULL); + + ASSERT (SizeOfBuffer != NULL); + + if (*SizeOfBuffer > 0) { + ASSERT (Buffer != NULL); + } + + return (GetPiPcdPpiPointer ())->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer); +} + +/** + This function provides a means by which to set a value for a given PCD token. + + Sets the boolean value for the token specified by TokenNumber + to the value specified by Value. + + If Guid is NULL, 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. + @param[in] Value The boolean value to set. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPcdSetExBoolS ( + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN BOOLEAN Value + ) +{ + ASSERT (Guid != NULL); + + return (GetPiPcdPpiPointer ())->SetBool (Guid, TokenNumber, Value); +} /** Set up a notification function that is called when a specified token is set. @@ -1118,6 +1399,56 @@ LibPatchPcdSetPtr ( return (VOID *) Buffer; } +/** + Sets a value of a patchable PCD entry that is type pointer. + + Sets the PCD entry specified by PatchVariable to the value specified + by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize, + then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER + to indicate that the set operation was not actually performed. + If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to + MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned. + + If PatchVariable is NULL, then ASSERT(). + If SizeOfBuffer is NULL, then ASSERT(). + If SizeOfBuffer > 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. + + @return The status of the set operation. + +**/ +RETURN_STATUS +EFIAPI +LibPatchPcdSetPtrS ( + 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 RETURN_INVALID_PARAMETER; + } + + CopyMem (PatchVariable, Buffer, *SizeOfBuffer); + + return RETURN_SUCCESS; +} + /** Retrieve additional information associated with a PCD token.