mirror of https://github.com/acidanthera/audk.git
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 <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18269 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
bf8e99a4a0
commit
f8308f0ad1
|
@ -342,8 +342,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
**/
|
||||
#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 @@ LibPcdGetNextTokenSpace (
|
|||
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 @@ LibPcdGetNextTokenSpace (
|
|||
VOID *
|
||||
EFIAPI
|
||||
LibPatchPcdSetPtr (
|
||||
IN VOID *PatchVariable,
|
||||
OUT VOID *PatchVariable,
|
||||
IN UINTN MaximumDatumSize,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN CONST VOID *Buffer
|
||||
|
@ -2088,7 +2089,7 @@ LibPatchPcdSetPtr (
|
|||
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,7 +2101,77 @@ LibPatchPcdSetPtr (
|
|||
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
|
||||
|
|
|
@ -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 @@ LibPcdGetNextTokenSpace (
|
|||
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 @@ LibPcdGetNextTokenSpace (
|
|||
VOID *
|
||||
EFIAPI
|
||||
LibPatchPcdSetPtr (
|
||||
IN VOID *PatchVariable,
|
||||
OUT VOID *PatchVariable,
|
||||
IN UINTN MaximumDatumSize,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN CONST VOID *Buffer
|
||||
|
@ -1270,7 +1270,7 @@ LibPatchPcdSetPtr (
|
|||
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 @@ LibPatchPcdSetPtr (
|
|||
RETURN_STATUS
|
||||
EFIAPI
|
||||
LibPatchPcdSetPtrS (
|
||||
IN VOID *PatchVariable,
|
||||
OUT VOID *PatchVariable,
|
||||
IN UINTN MaximumDatumSize,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN CONST VOID *Buffer
|
||||
|
@ -1306,6 +1306,116 @@ LibPatchPcdSetPtrS (
|
|||
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.
|
||||
|
||||
|
|
|
@ -1362,7 +1362,7 @@ LibPcdGetNextTokenSpace (
|
|||
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 @@ LibPcdGetNextTokenSpace (
|
|||
VOID *
|
||||
EFIAPI
|
||||
LibPatchPcdSetPtr (
|
||||
IN VOID *PatchVariable,
|
||||
OUT VOID *PatchVariable,
|
||||
IN UINTN MaximumDatumSize,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN CONST VOID *Buffer
|
||||
|
@ -1412,7 +1412,7 @@ LibPatchPcdSetPtr (
|
|||
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 @@ LibPatchPcdSetPtr (
|
|||
RETURN_STATUS
|
||||
EFIAPI
|
||||
LibPatchPcdSetPtrS (
|
||||
IN VOID *PatchVariable,
|
||||
OUT VOID *PatchVariable,
|
||||
IN UINTN MaximumDatumSize,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN CONST VOID *Buffer
|
||||
|
@ -1448,6 +1448,117 @@ LibPatchPcdSetPtrS (
|
|||
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.
|
||||
|
||||
|
|
|
@ -1363,7 +1363,7 @@ LibPcdGetNextTokenSpace (
|
|||
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 @@ LibPcdGetNextTokenSpace (
|
|||
VOID *
|
||||
EFIAPI
|
||||
LibPatchPcdSetPtr (
|
||||
IN VOID *PatchVariable,
|
||||
OUT VOID *PatchVariable,
|
||||
IN UINTN MaximumDatumSize,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN CONST VOID *Buffer
|
||||
|
@ -1413,7 +1413,7 @@ LibPatchPcdSetPtr (
|
|||
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 @@ LibPatchPcdSetPtr (
|
|||
RETURN_STATUS
|
||||
EFIAPI
|
||||
LibPatchPcdSetPtrS (
|
||||
IN VOID *PatchVariable,
|
||||
OUT VOID *PatchVariable,
|
||||
IN UINTN MaximumDatumSize,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN CONST VOID *Buffer
|
||||
|
@ -1449,6 +1449,117 @@ LibPatchPcdSetPtrS (
|
|||
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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue