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 <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17162 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Star Zeng
2015-04-10 10:05:11 +00:00
committed by lzeng14
parent 23f3e119c7
commit 9a35584195
4 changed files with 1724 additions and 181 deletions

View File

@@ -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.