]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/PeiPcdLib/PeiPcdLib.c
MdePkg BaseStackCheckLib: Correct style of file header
[mirror_edk2.git] / MdePkg / Library / PeiPcdLib / PeiPcdLib.c
index a57751f412990038820a3ac2a84d7696570be38e..2496701862fdb789ad25408547b2b1b63f1ce09f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Implementation of PcdLib class library for PEI phase.\r
 \r
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2016, 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
@@ -124,7 +124,6 @@ GetPiPcdInfoPpiPointer (
   This function provides a means by which SKU support can be established in the PCD infrastructure.\r
 \r
   Sets the current SKU in the PCD database to the value specified by SkuId.  SkuId is returned.\r
-  If SkuId >= PCD_MAX_SKU_ID, then ASSERT(). \r
 \r
   @param  SkuId   The SKU value that will be used when the PCD service retrieves \r
                   and sets values associated with a PCD token.\r
@@ -138,9 +137,6 @@ LibPcdSetSku (
   IN UINTN   SkuId\r
   )\r
 {\r
-\r
-  ASSERT (SkuId < PCD_MAX_SKU_ID);\r
-\r
   GetPiPcdPpiPointer()->SetSku (SkuId);\r
   \r
   return SkuId;\r
@@ -485,12 +481,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
+\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
@@ -504,11 +501,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
@@ -520,7 +513,7 @@ LibPcdSet8 (
   \r
   Sets the 16-bit value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
-  \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
@@ -534,11 +527,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
@@ -550,7 +539,7 @@ LibPcdSet16 (
   \r
   Sets the 32-bit value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
-  \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
@@ -564,11 +553,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
@@ -580,7 +565,7 @@ LibPcdSet32 (
   \r
   Sets the 64-bit value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
-  \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
@@ -594,11 +579,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
@@ -612,7 +593,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
+  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
@@ -636,16 +617,17 @@ LibPcdSetPtr (
   )\r
 {\r
   EFI_STATUS Status;\r
+  UINTN      InputSizeOfBuffer;\r
 \r
   ASSERT (SizeOfBuffer != NULL);\r
 \r
   if (*SizeOfBuffer > 0) {\r
     ASSERT (Buffer != NULL);\r
   }\r
-  \r
-  Status = (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);\r
 \r
-  if (EFI_ERROR (Status)) {\r
+  InputSizeOfBuffer = *SizeOfBuffer;\r
+  Status = (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);\r
+  if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {\r
     return NULL;\r
   }\r
 \r
@@ -659,7 +641,7 @@ LibPcdSetPtr (
   \r
   Sets the Boolean value for the token specified by TokenNumber \r
   to the value specified by Value.  Value is returned.\r
-  \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
@@ -673,11 +655,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
@@ -689,9 +667,9 @@ LibPcdSetBool (
   \r
   Sets the 8-bit value for the token specified by TokenNumber and \r
   Guid to the value specified by Value. Value is returned.\r
-  \r
+\r
   If Guid is NULL, then ASSERT().\r
-  \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
@@ -708,13 +686,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
@@ -726,9 +700,9 @@ LibPcdSetEx8 (
   \r
   Sets the 16-bit value for the token specified by TokenNumber and \r
   Guid to the value specified by Value. Value is returned.\r
-  \r
+\r
   If Guid is NULL, then ASSERT().\r
-  \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
@@ -745,11 +719,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
@@ -761,9 +733,9 @@ LibPcdSetEx16 (
   \r
   Sets the 32-bit value for the token specified by TokenNumber and \r
   Guid to the value specified by Value. Value is returned.\r
-  \r
+\r
   If Guid is NULL, then ASSERT().\r
-  \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
@@ -780,13 +752,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
@@ -798,8 +766,9 @@ LibPcdSetEx32 (
   \r
   Sets the 64-bit value for the token specified by TokenNumber and \r
   Guid to the value specified by Value. Value is returned.\r
+\r
   If Guid is NULL, then ASSERT().\r
-  \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
@@ -816,12 +785,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
@@ -835,7 +801,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. \r
+  was not actually performed.\r
   \r
   If Guid is NULL, then ASSERT().\r
   If SizeOfBuffer is NULL, then ASSERT().\r
@@ -860,15 +826,17 @@ LibPcdSetExPtr (
   )\r
 {\r
   EFI_STATUS      Status;\r
+  UINTN           InputSizeOfBuffer;\r
+\r
   ASSERT (SizeOfBuffer != NULL);\r
   if (*SizeOfBuffer > 0) {\r
     ASSERT (Buffer != NULL);\r
   }\r
   ASSERT (Guid != NULL);\r
 \r
+  InputSizeOfBuffer = *SizeOfBuffer;\r
   Status = (GetPiPcdPpiPointer ())->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer);\r
-\r
-  if (EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {\r
     return NULL;\r
   }\r
 \r
@@ -882,9 +850,9 @@ LibPcdSetExPtr (
   \r
   Sets the Boolean value for the token specified by TokenNumber and \r
   Guid to the value specified by Value. Value is returned.\r
-  \r
+\r
   If Guid is NULL, then ASSERT().\r
-  \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
@@ -901,17 +869,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
@@ -1010,7 +1310,10 @@ LibPcdGetNextToken (
   IN UINTN                    TokenNumber\r
   )\r
 {\r
-  (GetPiPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber);\r
+  EFI_STATUS    Status;\r
+\r
+  Status = (GetPiPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber);\r
+  ASSERT (!EFI_ERROR (Status) || TokenNumber == 0);\r
 \r
   return TokenNumber;\r
 }\r
@@ -1056,7 +1359,7 @@ LibPcdGetNextTokenSpace (
   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
+  @param[out] 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
@@ -1068,7 +1371,7 @@ LibPcdGetNextTokenSpace (
 VOID *\r
 EFIAPI\r
 LibPatchPcdSetPtr (\r
-  IN        VOID        *PatchVariable,\r
+  OUT       VOID        *PatchVariable,\r
   IN        UINTN       MaximumDatumSize,\r
   IN OUT    UINTN       *SizeOfBuffer,\r
   IN CONST  VOID        *Buffer\r
@@ -1092,6 +1395,167 @@ 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[out] 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
+  OUT      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
+/**\r
+  Sets a value and size of a patchable PCD entry that is type pointer.\r
+  \r
+  Sets the PCD entry specified by PatchVariable to the value specified by Buffer \r
+  and SizeOfBuffer.  Buffer is returned.  If SizeOfBuffer is greater than \r
+  MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return \r
+  NULL 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 NULL must be returned.\r
+  \r
+  If PatchVariable is NULL, then ASSERT().\r
+  If SizeOfPatchVariable is NULL, then ASSERT().\r
+  If SizeOfBuffer is NULL, then ASSERT().\r
+  If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
+\r
+  @param[out] PatchVariable     A pointer to the global variable in a module that is \r
+                                the target of the set operation.\r
+  @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.\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 Return the pointer to the buffer been set.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+LibPatchPcdSetPtrAndSize (\r
+  OUT       VOID        *PatchVariable,\r
+  OUT       UINTN       *SizeOfPatchVariable,\r
+  IN        UINTN       MaximumDatumSize,\r
+  IN OUT    UINTN       *SizeOfBuffer,\r
+  IN CONST  VOID        *Buffer\r
+  )\r
+{\r
+  ASSERT (PatchVariable != NULL);\r
+  ASSERT (SizeOfPatchVariable != 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 NULL;\r
+  }\r
+    \r
+  CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r
+  *SizeOfPatchVariable = *SizeOfBuffer;\r
+  \r
+  return (VOID *) Buffer;\r
+}\r
+\r
+/**\r
+  Sets a value and size 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 SizeOfPatchVariable is NULL, then ASSERT().\r
+  If SizeOfBuffer is NULL, then ASSERT().\r
+  If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
+\r
+  @param[out] PatchVariable     A pointer to the global variable in a module that is\r
+                                the target of the set operation.\r
+  @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.\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
+LibPatchPcdSetPtrAndSizeS (\r
+  OUT      VOID     *PatchVariable,\r
+  OUT      UINTN    *SizeOfPatchVariable,\r
+  IN       UINTN    MaximumDatumSize,\r
+  IN OUT   UINTN    *SizeOfBuffer,\r
+  IN CONST VOID     *Buffer\r
+  )\r
+{\r
+  ASSERT (PatchVariable != NULL);\r
+  ASSERT (SizeOfPatchVariable != 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
+  *SizeOfPatchVariable = *SizeOfBuffer;\r
+\r
+  return RETURN_SUCCESS;\r
+}\r
+\r
 /**\r
   Retrieve additional information associated with a PCD token.\r
 \r
@@ -1147,8 +1611,6 @@ LibPcdGetInfoEx (
 /**\r
   Retrieve the currently set SKU Id.\r
 \r
-  If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().\r
-\r
   @return   The currently set SKU Id. If the platform has not set at a SKU Id, then the\r
             default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU\r
             Id is returned.\r
@@ -1159,10 +1621,5 @@ LibPcdGetSku (
   VOID\r
   )\r
 {\r
-  UINTN SkuId;\r
-\r
-  SkuId = GetPiPcdInfoPpiPointer()->GetSku ();\r
-  ASSERT (SkuId < PCD_MAX_SKU_ID);\r
-\r
-  return SkuId;\r
+  return GetPiPcdInfoPpiPointer()->GetSku ();\r
 }\r