X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FLibrary%2FBasePcdLibNull%2FPcdLib.c;h=ab6f711a00e44f891fad3e4f8ba221803f263bd1;hb=f14bb97fa11fe3e234564bf4690a974e6da5f4ae;hp=1dcb6fe0ba7b896588e3997a3eb1d14aa50f73e4;hpb=8a43e8dd550a3e92238b3c22bb6ea67d41097e86;p=mirror_edk2.git diff --git a/MdePkg/Library/BasePcdLibNull/PcdLib.c b/MdePkg/Library/BasePcdLibNull/PcdLib.c index 1dcb6fe0ba..ab6f711a00 100644 --- a/MdePkg/Library/BasePcdLibNull/PcdLib.c +++ b/MdePkg/Library/BasePcdLibNull/PcdLib.c @@ -31,6 +31,8 @@ LibPcdSetSku ( IN UINTN SkuId ) { + ASSERT (SkuId < 0x100); + return SkuId; } @@ -434,10 +436,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(). + 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. + + 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. @@ -446,12 +458,16 @@ LibPcdSet64 ( VOID * EFIAPI LibPcdSetPtr ( - IN UINTN TokenNumber, - IN UINTN SizeOfBuffer, - IN VOID *Buffer + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN VOID *Buffer ) { - ASSERT (Buffer != NULL); + ASSERT (SizeOfBuffer != NULL); + + if (*SizeOfBuffer > 0) { + ASSERT (Buffer != NULL); + } return Buffer; } @@ -593,30 +609,39 @@ LibPcdSetEx64 ( /** - Sets a buffer for the token specified by TokenNumber and - Guid to the value specified by Value. Value is returned. - If Guid is NULL, then ASSERT(). - 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 > 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 *Buffer + IN CONST GUID *Guid, + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN VOID *Buffer ) { ASSERT (Guid != NULL); - ASSERT (Buffer != NULL); + + ASSERT (SizeOfBuffer != NULL); + + if (*SizeOfBuffer > 0) { + ASSERT (Buffer != NULL); + } return Buffer; } @@ -729,3 +754,80 @@ LibPcdGetNextToken ( { return 0; } + + + +/** + 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] 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 + ) +{ + return NULL; +} + + + +/** + 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 + ) +{ + ASSERT (PatchVariable != NULL); + ASSERT (SizeOfBuffer != NULL); + + if (*SizeOfBuffer > 0) { + ASSERT (Buffer != NULL); + } + + if ((*SizeOfBuffer > MaximumDatumSize) || + (*SizeOfBuffer == MAX_ADDRESS)) { + *SizeOfBuffer = MaximumDatumSize; + return NULL; + } + + CopyMem (PatchVariable, Buffer, *SizeOfBuffer); + + return (VOID *) Buffer; +} +