Revision: 18269
http://sourceforge.net/p/edk2/code/18269
Author: lgao4
Date: 2015-08-24 05:01:11 +0000 (Mon, 24 Aug 2015)
Log Message:
-----------
MdePkg: Add two PcdApi for Patch VOID* PCD set operation.
Two new APIs LibPatchPcdSetPtrAndSize() and LibPatchPcdSetPtrAndSizeS()
are added to catch the size of the updated VOID* PCD value buffer, then
PcdGetSize() API can return the actual size.
Update three PcdLib instances to implement these two APIs.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdePkg/Include/Library/PcdLib.h
trunk/edk2/MdePkg/Library/BasePcdLibNull/PcdLib.c
trunk/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.c
trunk/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
Modified: trunk/edk2/MdePkg/Include/Library/PcdLib.h
===================================================================
--- trunk/edk2/MdePkg/Include/Library/PcdLib.h 2015-08-24 05:00:32 UTC (rev
18268)
+++ trunk/edk2/MdePkg/Include/Library/PcdLib.h 2015-08-24 05:01:11 UTC (rev
18269)
@@ -342,8 +342,9 @@
**/
#define PatchPcdSetPtr(TokenName, Size, Buffer) \
- LibPatchPcdSetPtr (
\
- _gPcd_BinaryPatch_##TokenName,
\
+ LibPatchPcdSetPtrAndSize (
\
+ (VOID
*)_gPcd_BinaryPatch_##TokenName, \
+
&_gPcd_BinaryPatch_Size_##TokenName, \
(UINTN)_PCD_PATCHABLE_##TokenName##_SIZE, \
(Size),
\
(Buffer)
\
@@ -2056,7 +2057,7 @@
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
+ @param[out] 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.
@@ -2068,7 +2069,7 @@
VOID *
EFIAPI
LibPatchPcdSetPtr (
- IN VOID *PatchVariable,
+ OUT VOID *PatchVariable,
IN UINTN MaximumDatumSize,
IN OUT UINTN *SizeOfBuffer,
IN CONST VOID *Buffer
@@ -2088,7 +2089,7 @@
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
+ @param[out] 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.
@@ -2100,12 +2101,82 @@
RETURN_STATUS
EFIAPI
LibPatchPcdSetPtrS (
- IN VOID *PatchVariable,
+ OUT VOID *PatchVariable,
IN UINTN MaximumDatumSize,
IN OUT UINTN *SizeOfBuffer,
IN CONST VOID *Buffer
);
+/**
+ Sets a value and size of a patchable PCD entry that is type pointer.
+
+ Sets the PCD entry specified by PatchVariable to the value specified by
Buffer
+ and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
+ MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize 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
+ MaximumDatumSize and NULL must be returned.
+
+ If PatchVariable is NULL, then ASSERT().
+ If SizeOfPatchVariable is NULL, then ASSERT().
+ If SizeOfBuffer is NULL, then ASSERT().
+ If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
+
+ @param[out] PatchVariable A pointer to the global variable in a module
that is
+ the target of the set operation.
+ @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of
PatchVariable.
+ @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 Return the pointer to the Buffer that was set.
+
+**/
+VOID *
+EFIAPI
+LibPatchPcdSetPtrAndSize (
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
+ );
+
+/**
+ Sets a value and size 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 SizeOfPatchVariable is NULL, then ASSERT().
+ If SizeOfBuffer is NULL, then ASSERT().
+ If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
+
+ @param[out] PatchVariable A pointer to the global variable in a module
that is
+ the target of the set operation.
+ @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of
PatchVariable.
+ @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
+LibPatchPcdSetPtrAndSizeS (
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
+ );
+
typedef enum {
PCD_TYPE_8,
PCD_TYPE_16,
Modified: trunk/edk2/MdePkg/Library/BasePcdLibNull/PcdLib.c
===================================================================
--- trunk/edk2/MdePkg/Library/BasePcdLibNull/PcdLib.c 2015-08-24 05:00:32 UTC
(rev 18268)
+++ trunk/edk2/MdePkg/Library/BasePcdLibNull/PcdLib.c 2015-08-24 05:01:11 UTC
(rev 18269)
@@ -1,7 +1,7 @@
/** @file
A emptry template implementation of PCD Library.
- Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
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
@@ -1220,7 +1220,7 @@
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
+ @param[out] 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.
@@ -1232,7 +1232,7 @@
VOID *
EFIAPI
LibPatchPcdSetPtr (
- IN VOID *PatchVariable,
+ OUT VOID *PatchVariable,
IN UINTN MaximumDatumSize,
IN OUT UINTN *SizeOfBuffer,
IN CONST VOID *Buffer
@@ -1270,7 +1270,7 @@
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
+ @param[out] 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.
@@ -1282,7 +1282,7 @@
RETURN_STATUS
EFIAPI
LibPatchPcdSetPtrS (
- IN VOID *PatchVariable,
+ OUT VOID *PatchVariable,
IN UINTN MaximumDatumSize,
IN OUT UINTN *SizeOfBuffer,
IN CONST VOID *Buffer
@@ -1307,6 +1307,116 @@
}
/**
+ Sets a value and size of a patchable PCD entry that is type pointer.
+
+ Sets the PCD entry specified by PatchVariable to the value specified by
Buffer
+ and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
+ MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize 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
+ MaximumDatumSize and NULL must be returned.
+
+ If PatchVariable is NULL, then ASSERT().
+ If SizeOfPatchVariable is NULL, then ASSERT().
+ If SizeOfBuffer is NULL, then ASSERT().
+ If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
+
+ @param[out] PatchVariable A pointer to the global variable in a module
that is
+ the target of the set operation.
+ @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of
PatchVariable.
+ @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 Return the pointer to the buffer been set.
+
+**/
+VOID *
+EFIAPI
+LibPatchPcdSetPtrAndSize (
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
+ )
+{
+ ASSERT (PatchVariable != NULL);
+ ASSERT (SizeOfPatchVariable != NULL);
+ ASSERT (SizeOfBuffer != NULL);
+
+ if (*SizeOfBuffer > 0) {
+ ASSERT (Buffer != NULL);
+ }
+
+ if ((*SizeOfBuffer > MaximumDatumSize) ||
+ (*SizeOfBuffer == MAX_ADDRESS)) {
+ *SizeOfBuffer = MaximumDatumSize;
+ return NULL;
+ }
+
+ CopyMem (PatchVariable, Buffer, *SizeOfBuffer);
+ *SizeOfPatchVariable = *SizeOfBuffer;
+
+ return (VOID *) Buffer;
+}
+
+/**
+ Sets a value and size 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 SizeOfPatchVariable is NULL, then ASSERT().
+ If SizeOfBuffer is NULL, then ASSERT().
+ If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
+
+ @param[out] PatchVariable A pointer to the global variable in a module
that is
+ the target of the set operation.
+ @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of
PatchVariable.
+ @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
+LibPatchPcdSetPtrAndSizeS (
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
+ )
+{
+ ASSERT (PatchVariable != NULL);
+ ASSERT (SizeOfPatchVariable != 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);
+ *SizeOfPatchVariable = *SizeOfBuffer;
+
+ return RETURN_SUCCESS;
+}
+
+/**
Retrieve additional information associated with a PCD token.
This includes information such as the type of value the TokenNumber is
associated with as well as possible
Modified: trunk/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.c
===================================================================
--- trunk/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.c 2015-08-24 05:00:32 UTC
(rev 18268)
+++ trunk/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.c 2015-08-24 05:01:11 UTC
(rev 18269)
@@ -1362,7 +1362,7 @@
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
+ @param[out] 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.
@@ -1374,7 +1374,7 @@
VOID *
EFIAPI
LibPatchPcdSetPtr (
- IN VOID *PatchVariable,
+ OUT VOID *PatchVariable,
IN UINTN MaximumDatumSize,
IN OUT UINTN *SizeOfBuffer,
IN CONST VOID *Buffer
@@ -1412,7 +1412,7 @@
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
+ @param[out] 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.
@@ -1424,7 +1424,7 @@
RETURN_STATUS
EFIAPI
LibPatchPcdSetPtrS (
- IN VOID *PatchVariable,
+ OUT VOID *PatchVariable,
IN UINTN MaximumDatumSize,
IN OUT UINTN *SizeOfBuffer,
IN CONST VOID *Buffer
@@ -1448,7 +1448,118 @@
return RETURN_SUCCESS;
}
+
/**
+ Sets a value and size of a patchable PCD entry that is type pointer.
+
+ Sets the PCD entry specified by PatchVariable to the value specified by
Buffer
+ and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
+ MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize 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
+ MaximumDatumSize and NULL must be returned.
+
+ If PatchVariable is NULL, then ASSERT().
+ If SizeOfPatchVariable is NULL, then ASSERT().
+ If SizeOfBuffer is NULL, then ASSERT().
+ If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
+
+ @param[out] PatchVariable A pointer to the global variable in a module
that is
+ the target of the set operation.
+ @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of
PatchVariable.
+ @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 Return the pointer to the buffer been set.
+
+**/
+VOID *
+EFIAPI
+LibPatchPcdSetPtrAndSize (
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
+ )
+{
+ ASSERT (PatchVariable != NULL);
+ ASSERT (SizeOfPatchVariable != NULL);
+ ASSERT (SizeOfBuffer != NULL);
+
+ if (*SizeOfBuffer > 0) {
+ ASSERT (Buffer != NULL);
+ }
+
+ if ((*SizeOfBuffer > MaximumDatumSize) ||
+ (*SizeOfBuffer == MAX_ADDRESS)) {
+ *SizeOfBuffer = MaximumDatumSize;
+ return NULL;
+ }
+
+ CopyMem (PatchVariable, Buffer, *SizeOfBuffer);
+ *SizeOfPatchVariable = *SizeOfBuffer;
+
+ return (VOID *) Buffer;
+}
+
+/**
+ Sets a value and size 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 SizeOfPatchVariable is NULL, then ASSERT().
+ If SizeOfBuffer is NULL, then ASSERT().
+ If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
+
+ @param[out] PatchVariable A pointer to the global variable in a module
that is
+ the target of the set operation.
+ @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of
PatchVariable.
+ @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
+LibPatchPcdSetPtrAndSizeS (
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
+ )
+{
+ ASSERT (PatchVariable != NULL);
+ ASSERT (SizeOfPatchVariable != 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);
+ *SizeOfPatchVariable = *SizeOfBuffer;
+
+ return RETURN_SUCCESS;
+}
+
+/**
Retrieve additional information associated with a PCD token.
This includes information such as the type of value the TokenNumber is
associated with as well as possible
Modified: trunk/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
===================================================================
--- trunk/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.c 2015-08-24 05:00:32 UTC
(rev 18268)
+++ trunk/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.c 2015-08-24 05:01:11 UTC
(rev 18269)
@@ -1363,7 +1363,7 @@
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
+ @param[out] 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.
@@ -1375,7 +1375,7 @@
VOID *
EFIAPI
LibPatchPcdSetPtr (
- IN VOID *PatchVariable,
+ OUT VOID *PatchVariable,
IN UINTN MaximumDatumSize,
IN OUT UINTN *SizeOfBuffer,
IN CONST VOID *Buffer
@@ -1413,7 +1413,7 @@
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
+ @param[out] 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.
@@ -1425,7 +1425,7 @@
RETURN_STATUS
EFIAPI
LibPatchPcdSetPtrS (
- IN VOID *PatchVariable,
+ OUT VOID *PatchVariable,
IN UINTN MaximumDatumSize,
IN OUT UINTN *SizeOfBuffer,
IN CONST VOID *Buffer
@@ -1449,7 +1449,118 @@
return RETURN_SUCCESS;
}
+
/**
+ Sets a value and size of a patchable PCD entry that is type pointer.
+
+ Sets the PCD entry specified by PatchVariable to the value specified by
Buffer
+ and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
+ MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize 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
+ MaximumDatumSize and NULL must be returned.
+
+ If PatchVariable is NULL, then ASSERT().
+ If SizeOfPatchVariable is NULL, then ASSERT().
+ If SizeOfBuffer is NULL, then ASSERT().
+ If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
+
+ @param[out] PatchVariable A pointer to the global variable in a module
that is
+ the target of the set operation.
+ @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of
PatchVariable.
+ @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 Return the pointer to the buffer been set.
+
+**/
+VOID *
+EFIAPI
+LibPatchPcdSetPtrAndSize (
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
+ )
+{
+ ASSERT (PatchVariable != NULL);
+ ASSERT (SizeOfPatchVariable != NULL);
+ ASSERT (SizeOfBuffer != NULL);
+
+ if (*SizeOfBuffer > 0) {
+ ASSERT (Buffer != NULL);
+ }
+
+ if ((*SizeOfBuffer > MaximumDatumSize) ||
+ (*SizeOfBuffer == MAX_ADDRESS)) {
+ *SizeOfBuffer = MaximumDatumSize;
+ return NULL;
+ }
+
+ CopyMem (PatchVariable, Buffer, *SizeOfBuffer);
+ *SizeOfPatchVariable = *SizeOfBuffer;
+
+ return (VOID *) Buffer;
+}
+
+/**
+ Sets a value and size 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 SizeOfPatchVariable is NULL, then ASSERT().
+ If SizeOfBuffer is NULL, then ASSERT().
+ If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
+
+ @param[out] PatchVariable A pointer to the global variable in a module
that is
+ the target of the set operation.
+ @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of
PatchVariable.
+ @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
+LibPatchPcdSetPtrAndSizeS (
+ OUT VOID *PatchVariable,
+ OUT UINTN *SizeOfPatchVariable,
+ IN UINTN MaximumDatumSize,
+ IN OUT UINTN *SizeOfBuffer,
+ IN CONST VOID *Buffer
+ )
+{
+ ASSERT (PatchVariable != NULL);
+ ASSERT (SizeOfPatchVariable != 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);
+ *SizeOfPatchVariable = *SizeOfBuffer;
+
+ return RETURN_SUCCESS;
+}
+
+/**
Retrieve additional information associated with a PCD token.
This includes information such as the type of value the TokenNumber is
associated with as well as possible
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits