]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/PeiPcdLib/PeiPcdLib.c
MdePkg: Add a set of PcdSetXXS APIs into PcdLib and remove the ASSERT in original...
[mirror_edk2.git] / MdePkg / Library / PeiPcdLib / PeiPcdLib.c
index 536e1d05d9e9c42bbcd9285abbaf1ebefdfd9859..3d7139682a00efaece47e9ba978c377d70ec764a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Implementation of PcdLib class library for PEI phase.\r
 \r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -485,14 +485,13 @@ LibPcdGetExSize (
 \r
 \r
 \r
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r
 /**\r
   This function provides a means by which to set a value for a given PCD token.\r
   \r
   Sets the 8-bit value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
 \r
-  If the set operation was not correctly performed, then ASSERT().\r
-\r
   @param[in]  TokenNumber   The PCD token number to set a current value for.\r
   @param[in]  Value         The 8-bit value to set.\r
 \r
@@ -506,11 +505,7 @@ LibPcdSet8 (
   IN UINT8             Value\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-\r
-  Status = (GetPcdPpiPointer ())->Set8 (TokenNumber, Value);\r
-\r
-  ASSERT_EFI_ERROR (Status);\r
+  (GetPcdPpiPointer ())->Set8 (TokenNumber, Value);\r
   \r
   return Value;\r
 }\r
@@ -523,8 +518,6 @@ LibPcdSet8 (
   Sets the 16-bit value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
 \r
-  If the set operation was not correctly performed, then ASSERT().\r
-\r
   @param[in]  TokenNumber   The PCD token number to set a current value for.\r
   @param[in]  Value         The 16-bit value to set.\r
 \r
@@ -538,11 +531,7 @@ LibPcdSet16 (
   IN UINT16            Value\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-\r
-  Status = (GetPcdPpiPointer ())->Set16 (TokenNumber, Value);\r
-\r
-  ASSERT_EFI_ERROR (Status);\r
+  (GetPcdPpiPointer ())->Set16 (TokenNumber, Value);\r
   \r
   return Value;\r
 }\r
@@ -555,8 +544,6 @@ LibPcdSet16 (
   Sets the 32-bit value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
 \r
-  If the set operation was not correctly performed, then ASSERT().\r
-\r
   @param[in]  TokenNumber   The PCD token number to set a current value for.\r
   @param[in]  Value         The 32-bit value to set.\r
 \r
@@ -570,11 +557,7 @@ LibPcdSet32 (
   IN UINT32            Value\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-\r
-  Status = (GetPcdPpiPointer ())->Set32 (TokenNumber, Value);\r
-\r
-  ASSERT_EFI_ERROR (Status);\r
+  (GetPcdPpiPointer ())->Set32 (TokenNumber, Value);\r
 \r
   return Value;\r
 }\r
@@ -587,8 +570,6 @@ LibPcdSet32 (
   Sets the 64-bit value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
 \r
-  If the set operation was not correctly performed, then ASSERT().\r
-\r
   @param[in]  TokenNumber   The PCD token number to set a current value for.\r
   @param[in]  Value         The 64-bit value to set.\r
 \r
@@ -602,11 +583,7 @@ LibPcdSet64 (
   IN UINT64            Value\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-\r
-  Status = (GetPcdPpiPointer ())->Set64 (TokenNumber, Value);\r
-\r
-  ASSERT_EFI_ERROR (Status);\r
+  (GetPcdPpiPointer ())->Set64 (TokenNumber, Value);\r
 \r
   return Value;\r
 }\r
@@ -620,8 +597,7 @@ LibPcdSet64 (
   specified by Buffer and SizeOfBuffer.  Buffer is returned.  \r
   If SizeOfBuffer is greater than the maximum size support by TokenNumber, \r
   then set SizeOfBuffer to the maximum size supported by TokenNumber and \r
-  return NULL to indicate that the set operation was not actually performed,\r
-  or ASSERT() if the set operation was not corretly performed.\r
+  return NULL to indicate that the set operation was not actually performed.\r
 \r
   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the \r
   maximum size supported by TokenName and NULL must be returned.\r
@@ -658,7 +634,6 @@ LibPcdSetPtr (
   if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {\r
     return NULL;\r
   }\r
-  ASSERT_EFI_ERROR (Status);\r
 \r
   return (VOID *) Buffer;\r
 }\r
@@ -671,8 +646,6 @@ LibPcdSetPtr (
   Sets the Boolean value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
 \r
-  If the set operation was not correctly performed, then ASSERT().\r
-\r
   @param[in]  TokenNumber   The PCD token number to set a current value for.\r
   @param[in]  Value         The boolean value to set.\r
 \r
@@ -686,11 +659,7 @@ LibPcdSetBool (
   IN BOOLEAN           Value\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-\r
-  Status = (GetPcdPpiPointer ())->SetBool (TokenNumber, Value);\r
-\r
-  ASSERT_EFI_ERROR (Status);\r
+  (GetPcdPpiPointer ())->SetBool (TokenNumber, Value);\r
 \r
   return Value;\r
 }\r
@@ -704,7 +673,6 @@ LibPcdSetBool (
   Guid to the value specified by Value. Value is returned.\r
 \r
   If Guid is NULL, then ASSERT().\r
-  If the set operation was not correctly performed, then ASSERT().\r
 \r
   @param[in]  Guid          The pointer to a 128-bit unique value that \r
                             designates which namespace to set a value from.\r
@@ -722,13 +690,9 @@ LibPcdSetEx8 (
   IN UINT8             Value\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-\r
   ASSERT (Guid != NULL);\r
 \r
-  Status = (GetPiPcdPpiPointer ())->Set8 (Guid, TokenNumber, Value);\r
-\r
-  ASSERT_EFI_ERROR (Status);\r
+  (GetPiPcdPpiPointer ())->Set8 (Guid, TokenNumber, Value);\r
 \r
   return Value;\r
 }\r
@@ -742,7 +706,6 @@ LibPcdSetEx8 (
   Guid to the value specified by Value. Value is returned.\r
 \r
   If Guid is NULL, then ASSERT().\r
-  If the set operation was not correctly performed, then ASSERT().\r
 \r
   @param[in]  Guid          The pointer to a 128-bit unique value that \r
                             designates which namespace to set a value from.\r
@@ -760,11 +723,9 @@ LibPcdSetEx16 (
   IN UINT16            Value\r
   )\r
 {\r
-  EFI_STATUS Status;\r
   ASSERT (Guid != NULL);\r
-  Status = (GetPiPcdPpiPointer ())->Set16 (Guid, TokenNumber, Value);\r
 \r
-  ASSERT_EFI_ERROR (Status);\r
+  (GetPiPcdPpiPointer ())->Set16 (Guid, TokenNumber, Value);\r
 \r
   return Value;\r
 }\r
@@ -778,7 +739,6 @@ LibPcdSetEx16 (
   Guid to the value specified by Value. Value is returned.\r
 \r
   If Guid is NULL, then ASSERT().\r
-  If the set operation was not correctly performed, then ASSERT().\r
 \r
   @param[in]  Guid          The pointer to a 128-bit unique value that \r
                             designates which namespace to set a value from.\r
@@ -796,13 +756,9 @@ LibPcdSetEx32 (
   IN UINT32            Value\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-\r
   ASSERT (Guid != NULL);\r
 \r
-  Status = (GetPiPcdPpiPointer ())->Set32 (Guid, TokenNumber, Value);\r
-\r
-  ASSERT_EFI_ERROR (Status);\r
+  (GetPiPcdPpiPointer ())->Set32 (Guid, TokenNumber, Value);\r
 \r
   return Value;\r
 }\r
@@ -816,7 +772,6 @@ LibPcdSetEx32 (
   Guid to the value specified by Value. Value is returned.\r
 \r
   If Guid is NULL, then ASSERT().\r
-  If the set operation was not correctly performed, then ASSERT().\r
 \r
   @param[in]  Guid          The pointer to a 128-bit unique value that \r
                             designates which namespace to set a value from.\r
@@ -834,12 +789,9 @@ LibPcdSetEx64 (
   IN UINT64            Value\r
   )\r
 {\r
-  EFI_STATUS Status;\r
   ASSERT (Guid != NULL);\r
 \r
-  Status = (GetPiPcdPpiPointer ())->Set64 (Guid, TokenNumber, Value);\r
-\r
-  ASSERT_EFI_ERROR (Status);\r
+  (GetPiPcdPpiPointer ())->Set64 (Guid, TokenNumber, Value);\r
 \r
   return Value;\r
 }\r
@@ -853,7 +805,7 @@ LibPcdSetEx64 (
   Buffer and SizeOfBuffer.  Buffer is returned.  If SizeOfBuffer is greater than \r
   the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size \r
   supported by TokenNumber and return NULL to indicate that the set operation \r
-  was not actually performed, or ASSERT() if the set operation was not corretly performed.\r
+  was not actually performed.\r
   \r
   If Guid is NULL, then ASSERT().\r
   If SizeOfBuffer is NULL, then ASSERT().\r
@@ -880,7 +832,6 @@ LibPcdSetExPtr (
   EFI_STATUS      Status;\r
   UINTN           InputSizeOfBuffer;\r
 \r
-\r
   ASSERT (SizeOfBuffer != NULL);\r
   if (*SizeOfBuffer > 0) {\r
     ASSERT (Buffer != NULL);\r
@@ -892,7 +843,6 @@ LibPcdSetExPtr (
   if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {\r
     return NULL;\r
   }\r
-  ASSERT_EFI_ERROR (Status);\r
 \r
   return Buffer;\r
 }\r
@@ -906,7 +856,6 @@ LibPcdSetExPtr (
   Guid to the value specified by Value. Value is returned.\r
 \r
   If Guid is NULL, then ASSERT().\r
-  If the set operation was not correctly performed, then ASSERT().\r
 \r
   @param[in]  Guid          The pointer to a 128-bit unique value that \r
                             designates which namespace to set a value from.\r
@@ -924,17 +873,349 @@ LibPcdSetExBool (
   IN BOOLEAN           Value\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-\r
   ASSERT (Guid != NULL);\r
-  Status = (GetPiPcdPpiPointer ())->SetBool (Guid, TokenNumber, Value);\r
 \r
-  ASSERT_EFI_ERROR (Status);\r
+  (GetPiPcdPpiPointer ())->SetBool (Guid, TokenNumber, Value);\r
 \r
   return Value;\r
 }\r
+#endif\r
+\r
+/**\r
+  This function provides a means by which to set a value for a given PCD token.\r
+\r
+  Sets the 8-bit value for the token specified by TokenNumber\r
+  to the value specified by Value.\r
+\r
+  @param[in] TokenNumber    The PCD token number to set a current value for.\r
+  @param[in] Value          The 8-bit value to set.\r
+\r
+  @return The status of the set operation.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LibPcdSet8S (\r
+  IN UINTN          TokenNumber,\r
+  IN UINT8          Value\r
+  )\r
+{\r
+  return (GetPcdPpiPointer ())->Set8 (TokenNumber, Value);\r
+}\r
+\r
+/**\r
+  This function provides a means by which to set a value for a given PCD token.\r
+\r
+  Sets the 16-bit value for the token specified by TokenNumber\r
+  to the value specified by Value.\r
+\r
+  @param[in] TokenNumber    The PCD token number to set a current value for.\r
+  @param[in] Value          The 16-bit value to set.\r
+\r
+  @return The status of the set operation.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LibPcdSet16S (\r
+  IN UINTN          TokenNumber,\r
+  IN UINT16         Value\r
+  )\r
+{\r
+  return (GetPcdPpiPointer ())->Set16 (TokenNumber, Value);\r
+}\r
+\r
+/**\r
+  This function provides a means by which to set a value for a given PCD token.\r
+\r
+  Sets the 32-bit value for the token specified by TokenNumber\r
+  to the value specified by Value.\r
+\r
+  @param[in] TokenNumber    The PCD token number to set a current value for.\r
+  @param[in] Value          The 32-bit value to set.\r
+\r
+  @return The status of the set operation.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LibPcdSet32S (\r
+  IN UINTN          TokenNumber,\r
+  IN UINT32         Value\r
+  )\r
+{\r
+  return (GetPcdPpiPointer ())->Set32 (TokenNumber, Value);\r
+}\r
+\r
+/**\r
+  This function provides a means by which to set a value for a given PCD token.\r
+\r
+  Sets the 64-bit value for the token specified by TokenNumber\r
+  to the value specified by Value.\r
+\r
+  @param[in] TokenNumber    The PCD token number to set a current value for.\r
+  @param[in] Value          The 64-bit value to set.\r
+\r
+  @return The status of the set operation.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LibPcdSet64S (\r
+  IN UINTN          TokenNumber,\r
+  IN UINT64         Value\r
+  )\r
+{\r
+  return (GetPcdPpiPointer ())->Set64 (TokenNumber, Value);\r
+}\r
+\r
+/**\r
+  This function provides a means by which to set a value for a given PCD token.\r
+\r
+  Sets a buffer for the token specified by TokenNumber to the value specified\r
+  by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size\r
+  support by TokenNumber, then set SizeOfBuffer to the maximum size supported by\r
+  TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation\r
+  was not actually performed.\r
+\r
+  If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the\r
+  maximum size supported by TokenName and EFI_INVALID_PARAMETER must be returned.\r
+\r
+  If SizeOfBuffer is NULL, then ASSERT().\r
+  If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
+\r
+  @param[in]      TokenNumber   The PCD token number to set a current value for.\r
+  @param[in, out] SizeOfBuffer  The size, in bytes, of Buffer.\r
+  @param[in]      Buffer        A pointer to the buffer to set.\r
+\r
+  @return The status of the set operation.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LibPcdSetPtrS (\r
+  IN       UINTN    TokenNumber,\r
+  IN OUT   UINTN    *SizeOfBuffer,\r
+  IN CONST VOID     *Buffer\r
+  )\r
+{\r
+  ASSERT (SizeOfBuffer != NULL);\r
+\r
+  if (*SizeOfBuffer > 0) {\r
+    ASSERT (Buffer != NULL);\r
+  }\r
+\r
+  return (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);\r
+}\r
+\r
+/**\r
+  This function provides a means by which to set a value for a given PCD token.\r
+\r
+  Sets the boolean value for the token specified by TokenNumber\r
+  to the value specified by Value.\r
+\r
+  @param[in] TokenNumber    The PCD token number to set a current value for.\r
+  @param[in] Value          The boolean value to set.\r
+\r
+  @return The status of the set operation.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LibPcdSetBoolS (\r
+  IN UINTN          TokenNumber,\r
+  IN BOOLEAN        Value\r
+  )\r
+{\r
+  return (GetPcdPpiPointer ())->SetBool (TokenNumber, Value);\r
+}\r
+\r
+/**\r
+  This function provides a means by which to set a value for a given PCD token.\r
+\r
+  Sets the 8-bit value for the token specified by TokenNumber\r
+  to the value specified by Value.\r
+\r
+  If Guid is NULL, then ASSERT().\r
+\r
+  @param[in] Guid           The pointer to a 128-bit unique value that\r
+                            designates which namespace to set a value from.\r
+  @param[in] TokenNumber    The PCD token number to set a current value for.\r
+  @param[in] Value          The 8-bit value to set.\r
+\r
+  @return The status of the set operation.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LibPcdSetEx8S (\r
+  IN CONST GUID     *Guid,\r
+  IN UINTN          TokenNumber,\r
+  IN UINT8          Value\r
+  )\r
+{\r
+  ASSERT (Guid != NULL);\r
+\r
+  return (GetPiPcdPpiPointer ())->Set8 (Guid, TokenNumber, Value);\r
+}\r
 \r
+/**\r
+  This function provides a means by which to set a value for a given PCD token.\r
 \r
+  Sets the 16-bit value for the token specified by TokenNumber\r
+  to the value specified by Value.\r
+\r
+  If Guid is NULL, then ASSERT().\r
+\r
+  @param[in] Guid           The pointer to a 128-bit unique value that\r
+                            designates which namespace to set a value from.\r
+  @param[in] TokenNumber    The PCD token number to set a current value for.\r
+  @param[in] Value          The 16-bit value to set.\r
+\r
+  @return The status of the set operation.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LibPcdSetEx16S (\r
+  IN CONST GUID     *Guid,\r
+  IN UINTN          TokenNumber,\r
+  IN UINT16         Value\r
+  )\r
+{\r
+  ASSERT (Guid != NULL);\r
+\r
+  return (GetPiPcdPpiPointer ())->Set16 (Guid, TokenNumber, Value);\r
+}\r
+\r
+/**\r
+  This function provides a means by which to set a value for a given PCD token.\r
+\r
+  Sets the 32-bit value for the token specified by TokenNumber\r
+  to the value specified by Value.\r
+\r
+  If Guid is NULL, then ASSERT().\r
+\r
+  @param[in] Guid           The pointer to a 128-bit unique value that\r
+                            designates which namespace to set a value from.\r
+  @param[in] TokenNumber    The PCD token number to set a current value for.\r
+  @param[in] Value          The 32-bit value to set.\r
+\r
+  @return The status of the set operation.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LibPcdSetEx32S (\r
+  IN CONST GUID     *Guid,\r
+  IN UINTN          TokenNumber,\r
+  IN UINT32         Value\r
+  )\r
+{\r
+  ASSERT (Guid != NULL);\r
+\r
+  return (GetPiPcdPpiPointer ())->Set32 (Guid, TokenNumber, Value);\r
+}\r
+\r
+/**\r
+  This function provides a means by which to set a value for a given PCD token.\r
+\r
+  Sets the 64-bit value for the token specified by TokenNumber\r
+  to the value specified by Value.\r
+\r
+  If Guid is NULL, then ASSERT().\r
+\r
+  @param[in] Guid           The pointer to a 128-bit unique value that\r
+                            designates which namespace to set a value from.\r
+  @param[in] TokenNumber    The PCD token number to set a current value for.\r
+  @param[in] Value          The 64-bit value to set.\r
+\r
+  @return The status of the set operation.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LibPcdSetEx64S (\r
+  IN CONST GUID     *Guid,\r
+  IN UINTN          TokenNumber,\r
+  IN UINT64         Value\r
+  )\r
+{\r
+  ASSERT (Guid != NULL);\r
+\r
+  return (GetPiPcdPpiPointer ())->Set64 (Guid, TokenNumber, Value);\r
+}\r
+\r
+/**\r
+  This function provides a means by which to set a value for a given PCD token.\r
+\r
+  Sets a buffer for the token specified by TokenNumber to the value specified by\r
+  Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size\r
+  support by TokenNumber, then set SizeOfBuffer to the maximum size supported by\r
+  TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation\r
+  was not actually performed.\r
+\r
+  If Guid is NULL, then ASSERT().\r
+  If SizeOfBuffer is NULL, then ASSERT().\r
+  If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
+\r
+  @param[in]      Guid          Pointer to a 128-bit unique value that\r
+                                designates which namespace to set a value from.\r
+  @param[in]      TokenNumber   The PCD token number to set a current value for.\r
+  @param[in, out] SizeOfBuffer  The size, in bytes, of Buffer.\r
+  @param[in]      Buffer        A pointer to the buffer to set.\r
+\r
+  @return The status of the set operation.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LibPcdSetExPtrS (\r
+  IN CONST GUID     *Guid,\r
+  IN       UINTN    TokenNumber,\r
+  IN OUT   UINTN    *SizeOfBuffer,\r
+  IN       VOID     *Buffer\r
+  )\r
+{\r
+  ASSERT (Guid != NULL);\r
+\r
+  ASSERT (SizeOfBuffer != NULL);\r
+\r
+  if (*SizeOfBuffer > 0) {\r
+    ASSERT (Buffer != NULL);\r
+  }\r
+\r
+  return (GetPiPcdPpiPointer ())->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer);\r
+}\r
+\r
+/**\r
+  This function provides a means by which to set a value for a given PCD token.\r
+\r
+  Sets the boolean value for the token specified by TokenNumber\r
+  to the value specified by Value.\r
+\r
+  If Guid is NULL, then ASSERT().\r
+\r
+  @param[in] Guid           The pointer to a 128-bit unique value that\r
+                            designates which namespace to set a value from.\r
+  @param[in] TokenNumber    The PCD token number to set a current value for.\r
+  @param[in] Value          The boolean value to set.\r
+\r
+  @return The status of the set operation.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LibPcdSetExBoolS (\r
+  IN CONST GUID     *Guid,\r
+  IN UINTN          TokenNumber,\r
+  IN BOOLEAN        Value\r
+  )\r
+{\r
+  ASSERT (Guid != NULL);\r
+\r
+  return (GetPiPcdPpiPointer ())->SetBool (Guid, TokenNumber, Value);\r
+}\r
 \r
 /**\r
   Set up a notification function that is called when a specified token is set.\r
@@ -1118,6 +1399,56 @@ LibPatchPcdSetPtr (
   return (VOID *) Buffer;\r
 }\r
 \r
+/**\r
+  Sets a value of a patchable PCD entry that is type pointer.\r
+\r
+  Sets the PCD entry specified by PatchVariable to the value specified\r
+  by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,\r
+  then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER\r
+  to indicate that the set operation was not actually performed.\r
+  If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to\r
+  MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.\r
+\r
+  If PatchVariable is NULL, then ASSERT().\r
+  If SizeOfBuffer is NULL, then ASSERT().\r
+  If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
+\r
+  @param[in] PatchVariable      A pointer to the global variable in a module that is\r
+                                the target of the set operation.\r
+  @param[in] MaximumDatumSize   The maximum size allowed for the PCD entry specified by PatchVariable.\r
+  @param[in, out] SizeOfBuffer  A pointer to the size, in bytes, of Buffer.\r
+  @param[in] Buffer             A pointer to the buffer to used to set the target variable.\r
+  \r
+  @return The status of the set operation.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LibPatchPcdSetPtrS (\r
+  IN       VOID     *PatchVariable,\r
+  IN       UINTN    MaximumDatumSize,\r
+  IN OUT   UINTN    *SizeOfBuffer,\r
+  IN CONST VOID     *Buffer\r
+  )\r
+{\r
+  ASSERT (PatchVariable != NULL);\r
+  ASSERT (SizeOfBuffer  != NULL);\r
+  \r
+  if (*SizeOfBuffer > 0) {\r
+    ASSERT (Buffer != NULL);\r
+  }\r
+\r
+  if ((*SizeOfBuffer > MaximumDatumSize) ||\r
+      (*SizeOfBuffer == MAX_ADDRESS)) {\r
+    *SizeOfBuffer = MaximumDatumSize;\r
+    return RETURN_INVALID_PARAMETER;\r
+  }\r
+\r
+  CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r
+\r
+  return RETURN_SUCCESS;\r
+}\r
+\r
 /**\r
   Retrieve additional information associated with a PCD token.\r
 \r