X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FInclude%2FLibrary%2FPcdLib.h;h=038443b993c9dcbe0a30a92449fc2c80edc2c1ef;hb=d2f9b39f43b4bc4890a77f44c72cc6ffc1ee48a0;hp=2f797640a047e363060df8a2a4c4ec8452cfce17;hpb=57a38e69b066ab5d642d91edbd07951e7cf89d0c;p=mirror_edk2.git diff --git a/MdePkg/Include/Library/PcdLib.h b/MdePkg/Include/Library/PcdLib.h index 2f797640a0..038443b993 100644 --- a/MdePkg/Include/Library/PcdLib.h +++ b/MdePkg/Include/Library/PcdLib.h @@ -26,7 +26,7 @@ Module Name: PcdLib.h // // Feature Flag is in the form of a global constant // -#define FeaturePcdGet(TokenName) _PCD_VALUE_##TokenName +#define FeaturePcdGet(TokenName) _PCD_GET_MODE_BOOL_##TokenName // @@ -39,9 +39,6 @@ Module Name: PcdLib.h #define FixedPcdGetBool(TokenName) _PCD_VALUE_##TokenName -// -// BugBug: This works for strings, but not constants. -// #define FixedPcdGetPtr(TokenName) ((VOID *)_PCD_VALUE_##TokenName) @@ -61,7 +58,12 @@ Module Name: PcdLib.h #define PatchPcdSet64(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value)) #define PatchPcdSetBool(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value)) #define PatchPcdSetPtr(TokenName, Size, Buffer) \ - CopyMem (_gPcd_BinaryPatch_##TokenName, (Buffer), (Size)) + LibPatchPcdSetPtr ( \ + _gPcd_BinaryPatch_##TokenName, \ + (UINTN)_PCD_PATCHABLE_##TokenName##_SIZE, \ + (Size), \ + (Buffer) \ + ) // // Dynamic is via the protocol with only the TokenNumber as argument @@ -435,11 +437,20 @@ LibPcdSet64 ( /** - Sets a buffer for the token specified by TokenNumber to - the value specified by Value. Value is returned. - If Value is NULL, then ASSERT(). + Sets a buffer for the token specified by TokenNumber to the value + specified by Buffer and SizeOfValue. Buffer is returned. + If SizeOfValue is greater than the maximum size support by TokenNumber, + then set SizeOfValue to the maximum size supported by TokenNumber and + return NULL to indicate that the set operation was not actually performed. + + If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to the + maximum size supported by TokenName and NULL must be returned. + + If SizeOfValue is NULL, then ASSERT(). + If SizeOfValue > 0 and Buffer is NULL, then ASSERT(). @param[in] TokenNumber The PCD token number to set a current value for. + @param[in,out] SizeOfBuffer The size, in bytes, of Buffer. @param[in] Value A pointer to the buffer to set. @retval VOID* Return the pointer for the buffer been set. @@ -448,9 +459,9 @@ LibPcdSet64 ( VOID* EFIAPI LibPcdSetPtr ( - IN UINTN TokenNumber, - IN UINTN SizeOfBuffer, - IN VOID *Value + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN VOID *Value ); @@ -561,26 +572,32 @@ LibPcdSetEx64 ( /** - Sets a buffer for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. + Sets a buffer for the token specified by TokenNumber to the value specified by + Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than + the maximum size support by TokenNumber, then set SizeOfValue to the maximum size + supported by TokenNumber and return NULL to indicate that the set operation + was not actually performed. + If Guid is NULL, then ASSERT(). - If Value is NULL, then ASSERT(). + If SizeOfValue is NULL, then ASSERT(). + If SizeOfValue > 0 and Buffer is NULL, then ASSERT(). @param[in] Guid Pointer to a 128-bit unique value that designates which namespace to set a value from. @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. + @param[in, out] SizeOfBuffer The size, in bytes, of Buffer. + @param[in] Buffer A pointer to the buffer to set. - @retval VOID * Return the value been set. + @retval VOID * Return the pinter to the buffer been set. **/ VOID * EFIAPI LibPcdSetExPtr ( - IN CONST GUID *Guid, - IN UINTN TokenNumber, - IN UINTN SizeOfBuffer, - IN VOID *Value + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN VOID *Buffer ); @@ -612,9 +629,17 @@ LibPcdSetExBool ( If Guid is NULL, then the default token space is used. If NotificationFunction is NULL, then ASSERT(). + This notification function serves two purposes. Firstly, it notifies the module which + did the registration that the value of this PCD token has been set. Secondly, + it provides a mechanism for the module which did the registration to intercept + the set operation and override the value been set if necessary. After the invocation + of the callback function, TokenData will be used by PCD service PEIM or driver to + modify the internal data in PCD database. + + @param[in] CallBackGuid The PCD token GUID being set. @param[in] CallBackToken The PCD token number being set. - @param[in] TokenData A pointer to the token data being set. + @param[in, out] TokenData A pointer to the token data being set. @param[in] TokenDataSize The size, in bytes, of the data being set. @retval VOID @@ -697,4 +722,58 @@ LibPcdGetNextToken ( IN UINTN TokenNumber ); + + +/** + Retrieves the next PCD token space from a token space specified by Guid. + Guid of NULL is reserved to mark the default local token namespace on the current + platform. If Guid is NULL, then the GUID of the first non-local token space of the + current platform is returned. If Guid is the last non-local token space, + then NULL is returned. + + If Guid is not NULL and is not a valid token space in the current platform, then ASSERT(). + + + + @param[in] Guid Pointer to a 128-bit unique value that designates from which namespace + to start the search. + + @retval CONST GUID * The next valid token namespace. + +**/ +GUID * +EFIAPI +LibPcdGetNextTokenSpace ( + IN CONST GUID *Guid + ); + + +/** + Sets the PCD entry specified by PatchVariable to the value specified by Buffer + and SizeOfValue. Buffer is returned. If SizeOfValue is greater than + MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return + NULL to indicate that the set operation was not actually performed. + If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to + MaximumDatumSize and NULL must be returned. + + If PatchVariable is NULL, then ASSERT(). + If SizeOfValue is NULL, then ASSERT(). + If SizeOfValue > 0 and Buffer is NULL, then ASSERT(). + + @param[in] 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. + @param[in] Buffer A pointer to the buffer to used to set the target variable. + +**/ +VOID * +EFIAPI +LibPatchPcdSetPtr ( + IN VOID *PatchVariable, + IN UINTN MaximumDatumSize, + IN OUT UINTN *SizeOfBuffer, + IN CONST VOID *Buffer + ); + #endif