X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FInclude%2FLibrary%2FPcdLib.h;h=038443b993c9dcbe0a30a92449fc2c80edc2c1ef;hb=d2f9b39f43b4bc4890a77f44c72cc6ffc1ee48a0;hp=5858cfc475bfead410f6cf1caf563bfe017fc143;hpb=4276d5dacfd4812abc1d7a1bd1da995d7002ee9e;p=mirror_edk2.git diff --git a/MdePkg/Include/Library/PcdLib.h b/MdePkg/Include/Library/PcdLib.h index 5858cfc475..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,17 +437,16 @@ LibPcdSet64 ( /** - Sets a buffer for the token specified by TokenNumber to - the value specified by Buffer and SizeOfValue. Buffer to - be set is returned. The content of the buffer could be - overwritten if a Callback on SET is registered with this - TokenNumber. - - 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. + 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. @@ -577,6 +578,8 @@ LibPcdSetEx64 ( supported by TokenNumber and return NULL to indicate that the set operation was not actually performed. + If Guid 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 @@ -626,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 @@ -724,17 +735,45 @@ LibPcdGetNextToken ( - @param[in] Pointer to a 128-bit unique value that designates from which namespace + @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. **/ - -CONST GUID* +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