]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BasePcdLibNull/PcdLib.c
Added LibPatchPcdSetPtr.
[mirror_edk2.git] / MdePkg / Library / BasePcdLibNull / PcdLib.c
index de90c2f90edc0eab30f4167ef0b2066d7393c080..e58965cc686f3f643d10cb5c0c92b5a2f9306ee7 100644 (file)
@@ -31,6 +31,8 @@ LibPcdSetSku (
   IN UINTN  SkuId\r
   )\r
 {\r
+  ASSERT (SkuId < 0x100);\r
+\r
   return SkuId;\r
 }\r
 \r
@@ -633,6 +635,8 @@ LibPcdSetExPtr (
 {\r
   ASSERT (Guid != NULL);\r
 \r
+  ASSERT (SizeOfBuffer != NULL);\r
+  \r
   if (*SizeOfBuffer > 0) {\r
     ASSERT (Buffer != NULL);\r
   }\r
@@ -768,7 +772,7 @@ LibPcdGetNextToken (
   @retval CONST GUID *  The next valid token namespace.\r
 \r
 **/\r
-CONST GUID*           \r
+GUID *           \r
 EFIAPI\r
 LibPcdGetNextTokenSpace (\r
   IN CONST GUID  *Guid\r
@@ -776,3 +780,52 @@ LibPcdGetNextTokenSpace (
 {\r
   return NULL;\r
 }\r
+\r
+\r
+\r
+/**\r
+  Sets the PCD entry specified by PatchVariable to the value specified by Buffer \r
+  and SizeOfValue.  Buffer is returned.  If SizeOfValue is greater than \r
+  MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return \r
+  NULL to indicate that the set operation was not actually performed.  \r
+  If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to \r
+  MaximumDatumSize and NULL must be returned.\r
+  \r
+  If PatchVariable is NULL, then ASSERT().\r
+  If SizeOfValue is NULL, then ASSERT().\r
+  If SizeOfValue > 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
+**/\r
+VOID *\r
+EFIAPI\r
+LibPatchPcdSetPtr (\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 NULL;\r
+  }\r
+    \r
+  CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r
+  \r
+  return (VOID *) Buffer;\r
+}\r
+\r