X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FLibrary%2FPeiPcdLib%2FPeiPcdLib.c;h=16d68533e716f63bf592db025bb28199283b6178;hb=9dbad162da3c898f06a93a45c3ae6428819c0a89;hp=ac5bbcf0581d6b21246d4510401147f8d6c8a6e8;hpb=b52f6a1ad8029588a8b1e3b8cfd4855ee6d5a727;p=mirror_edk2.git diff --git a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c index ac5bbcf058..16d68533e7 100644 --- a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c +++ b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c @@ -1,7 +1,7 @@ /** @file Implementation of PcdLib class library for PEI phase. -Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2010, Intel Corporation
All rights reserved. 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 @@ -19,6 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include +#include #include #include @@ -49,32 +50,59 @@ GetPcdPpiPointer ( } /** - Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned. - If SkuId not less than PCD_MAX_SKU_ID, then ASSERT(). + Retrieve the pointer of EFI_PEI_PCD_PPI defined in PI 1.2 Vol 3. + + This function is to locate EFI_PEI_PCD_PPI PPI via PeiService. + If fail to locate EFI_PEI_PCD_PPI, then ASSERT_EFI_ERROR(). - @param[in] SkuId System sku id. The SKU value that will be used when the PCD service will retrieve and - set values. + @retval EFI_PEI_PCD_PPI * The pointer to the EFI_PEI_PCD_PPI. - @return Return the SKU ID that just be set. +**/ +EFI_PEI_PCD_PPI * +GetPiPcdPpiPointer ( + VOID + ) +{ + EFI_STATUS Status; + EFI_PEI_PCD_PPI *PiPcdPpi; + + Status = PeiServicesLocatePpi (&gEfiPeiPcdPpiGuid, 0, NULL, (VOID **)&PiPcdPpi); + ASSERT_EFI_ERROR (Status); + + return PiPcdPpi; +} + +/** + This function provides a means by which SKU support can be established in the PCD infrastructure. + + Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned. + If SkuId >= PCD_MAX_SKU_ID, then ASSERT(). + + @param SkuId The SKU value that will be used when the PCD service retrieves and sets values + associated with a PCD token. + + @return Return the SKU ID that just be set. **/ UINTN EFIAPI LibPcdSetSku ( - IN UINTN SkuId + IN UINTN SkuId ) { ASSERT (SkuId < PCD_MAX_SKU_ID); - GetPcdPpiPointer()->SetSku (SkuId); - + GetPiPcdPpiPointer()->SetSku (SkuId); + return SkuId; } /** + This function provides a means by which to retrieve a value for a given PCD token. + Returns the 8-bit value for the token specified by TokenNumber. @param[in] TokenNumber The PCD token number to retrieve a current value for. @@ -85,7 +113,7 @@ LibPcdSetSku ( UINT8 EFIAPI LibPcdGet8 ( - IN UINTN TokenNumber + IN UINTN TokenNumber ) { return (GetPcdPpiPointer ())->Get8 (TokenNumber); @@ -94,9 +122,11 @@ LibPcdGet8 ( /** + This function provides a means by which to retrieve a value for a given PCD token. + Returns the 16-bit value for the token specified by TokenNumber. - @param[in] TokenNumber The PCD token number to retrieve a current value for. + @param[in] TokenNumber The PCD token number to retrieve a current value for. @return Returns the 16-bit value for the token specified by TokenNumber. @@ -104,7 +134,7 @@ LibPcdGet8 ( UINT16 EFIAPI LibPcdGet16 ( - IN UINTN TokenNumber + IN UINTN TokenNumber ) { return (GetPcdPpiPointer ())->Get16 (TokenNumber); @@ -113,6 +143,8 @@ LibPcdGet16 ( /** + This function provides a means by which to retrieve a value for a given PCD token. + Returns the 32-bit value for the token specified by TokenNumber. @param[in] TokenNumber The PCD token number to retrieve a current value for. @@ -123,7 +155,7 @@ LibPcdGet16 ( UINT32 EFIAPI LibPcdGet32 ( - IN UINTN TokenNumber + IN UINTN TokenNumber ) { return (GetPcdPpiPointer ())->Get32 (TokenNumber); @@ -132,6 +164,8 @@ LibPcdGet32 ( /** + This function provides a means by which to retrieve a value for a given PCD token. + Returns the 64-bit value for the token specified by TokenNumber. @param[in] TokenNumber The PCD token number to retrieve a current value for. @@ -142,7 +176,7 @@ LibPcdGet32 ( UINT64 EFIAPI LibPcdGet64 ( - IN UINTN TokenNumber + IN UINTN TokenNumber ) { return (GetPcdPpiPointer ())->Get64 (TokenNumber); @@ -151,6 +185,8 @@ LibPcdGet64 ( /** + This function provides a means by which to retrieve a value for a given PCD token. + Returns the pointer to the buffer of the token specified by TokenNumber. @param[in] TokenNumber The PCD token number to retrieve a current value for. @@ -161,7 +197,7 @@ LibPcdGet64 ( VOID * EFIAPI LibPcdGetPtr ( - IN UINTN TokenNumber + IN UINTN TokenNumber ) { return (GetPcdPpiPointer ())->GetPtr (TokenNumber); @@ -170,6 +206,8 @@ LibPcdGetPtr ( /** + This function provides a means by which to retrieve a value for a given PCD token. + Returns the Boolean value of the token specified by TokenNumber. @param[in] TokenNumber The PCD token number to retrieve a current value for. @@ -180,7 +218,7 @@ LibPcdGetPtr ( BOOLEAN EFIAPI LibPcdGetBool ( - IN UINTN TokenNumber + IN UINTN TokenNumber ) { return (GetPcdPpiPointer ())->GetBool (TokenNumber); @@ -189,7 +227,7 @@ LibPcdGetBool ( /** - Returns the size of the token specified by TokenNumber. + This function provides a means by which to retrieve the size of a given PCD token. @param[in] TokenNumber The PCD token number to retrieve a current value for. @@ -199,7 +237,7 @@ LibPcdGetBool ( UINTN EFIAPI LibPcdGetSize ( - IN UINTN TokenNumber + IN UINTN TokenNumber ) { return (GetPcdPpiPointer ())->GetSize (TokenNumber); @@ -208,12 +246,15 @@ LibPcdGetSize ( /** + This function provides a means by which to retrieve a value for a given PCD token. + Returns the 8-bit value for the token specified by TokenNumber and Guid. + If Guid is NULL, then ASSERT(). - @param[in] Guid Pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. + @param[in] Guid Pointer to a 128-bit unique value that designates + which namespace to retrieve a value from. + @param[in] TokenNumber The PCD token number to retrieve a current value for. @return Return the UINT8. @@ -227,18 +268,21 @@ LibPcdGetEx8 ( { ASSERT (Guid != NULL); - return (GetPcdPpiPointer ())->Get8Ex (Guid, TokenNumber); + return (GetPiPcdPpiPointer ())->Get8 (Guid, TokenNumber); } /** + This function provides a means by which to retrieve a value for a given PCD token. + Returns the 16-bit value for the token specified by TokenNumber and Guid. + If Guid is NULL, then ASSERT(). - @param[in] Guid Pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. + @param[in] Guid Pointer to a 128-bit unique value that designates + which namespace to retrieve a value from. + @param[in] TokenNumber The PCD token number to retrieve a current value for. @return Return the UINT16. @@ -253,7 +297,7 @@ LibPcdGetEx16 ( ASSERT (Guid != NULL); - return (GetPcdPpiPointer ())->Get16Ex (Guid, TokenNumber); + return (GetPiPcdPpiPointer ())->Get16 (Guid, TokenNumber); } @@ -262,9 +306,9 @@ LibPcdGetEx16 ( Returns the 32-bit value for the token specified by TokenNumber and Guid. If Guid is NULL, then ASSERT(). - @param[in] Guid Pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. + @param[in] Guid Pointer to a 128-bit unique value that designates + which namespace to retrieve a value from. + @param[in] TokenNumber The PCD token number to retrieve a current value for. @return Return the UINT32. @@ -278,19 +322,22 @@ LibPcdGetEx32 ( { ASSERT (Guid != NULL); - return (GetPcdPpiPointer ())->Get32Ex (Guid, TokenNumber); + return (GetPiPcdPpiPointer ())->Get32 (Guid, TokenNumber); } /** + This function provides a means by which to retrieve a value for a given PCD token. + Returns the 64-bit value for the token specified by TokenNumber and Guid. + If Guid is NULL, then ASSERT(). - @param[in] Guid Pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. + @param[in] Guid Pointer to a 128-bit unique value that designates + which namespace to retrieve a value from. + @param[in] TokenNumber The PCD token number to retrieve a current value for. @return Return the UINT64. @@ -303,18 +350,21 @@ LibPcdGetEx64 ( ) { ASSERT (Guid != NULL); - return (GetPcdPpiPointer ())->Get64Ex (Guid, TokenNumber); + return (GetPiPcdPpiPointer ())->Get64 (Guid, TokenNumber); } /** - Returns the pointer to the token specified by TokenNumber and Guid. + This function provides a means by which to retrieve a value for a given PCD token. + + Returns the pointer to the buffer of token specified by TokenNumber and Guid. + If Guid is NULL, then ASSERT(). - @param[in] Guid Pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. + @param[in] Guid Pointer to a 128-bit unique value that designates + which namespace to retrieve a value from. + @param[in] TokenNumber The PCD token number to retrieve a current value for. @return Return the VOID* pointer. @@ -328,18 +378,21 @@ LibPcdGetExPtr ( { ASSERT (Guid != NULL); - return (GetPcdPpiPointer ())->GetPtrEx (Guid, TokenNumber); + return (GetPiPcdPpiPointer ())->GetPtr (Guid, TokenNumber); } /** + This function provides a means by which to retrieve a value for a given PCD token. + Returns the Boolean value of the token specified by TokenNumber and Guid. + If Guid is NULL, then ASSERT(). - @param[in] Guid Pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. + @param[in] Guid Pointer to a 128-bit unique value that designates + which namespace to retrieve a value from. + @param[in] TokenNumber The PCD token number to retrieve a current value for. @return Return the BOOLEAN. @@ -352,18 +405,21 @@ LibPcdGetExBool ( ) { ASSERT (Guid != NULL); - return (GetPcdPpiPointer ())->GetBoolEx (Guid, TokenNumber); + return (GetPiPcdPpiPointer ())->GetBool (Guid, TokenNumber); } /** + This function provides a means by which to retrieve the size of a given PCD token. + Returns the size of the token specified by TokenNumber and Guid. + If Guid is NULL, then ASSERT(). - @param[in] Guid Pointer to a 128-bit unique value that designates - which namespace to retrieve a value from. - @param[in] TokenNumber The PCD token number to retrieve a current value for. + @param[in] Guid Pointer to a 128-bit unique value that designates + which namespace to retrieve a value from. + @param[in] TokenNumber The PCD token number to retrieve a current value for. @return Return the size. @@ -376,18 +432,19 @@ LibPcdGetExSize ( ) { ASSERT (Guid != NULL); - return (GetPcdPpiPointer ())->GetSizeEx (Guid, TokenNumber); + return (GetPiPcdPpiPointer ())->GetSize (Guid, TokenNumber); } /** + This function provides a means by which to set a value for a given PCD token. + Sets the 8-bit value for the token specified by TokenNumber to the value specified by Value. Value is returned. - If fail to set pcd value, then ASSERT_EFI_ERROR(). - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 8-bit value to set. + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 8-bit value to set. @return Return the value been set. @@ -411,12 +468,13 @@ LibPcdSet8 ( /** + This function provides a means by which to set a value for a given PCD token. + Sets the 16-bit value for the token specified by TokenNumber to the value specified by Value. Value is returned. - If fail to set pcd value, then ASSERT_EFI_ERROR(). - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 16-bit value to set. + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 16-bit value to set. @return Return the value been set. @@ -440,12 +498,13 @@ LibPcdSet16 ( /** + This function provides a means by which to set a value for a given PCD token. + Sets the 32-bit value for the token specified by TokenNumber to the value specified by Value. Value is returned. - If fail to set pcd value, then ASSERT_EFI_ERROR(). - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 32-bit value to set. + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 32-bit value to set. @return Return the value been set. @@ -454,7 +513,7 @@ UINT32 EFIAPI LibPcdSet32 ( IN UINTN TokenNumber, - IN UINT32 Value + IN UINT32 Value ) { EFI_STATUS Status; @@ -469,12 +528,13 @@ LibPcdSet32 ( /** + This function provides a means by which to set a value for a given PCD token. + Sets the 64-bit value for the token specified by TokenNumber to the value specified by Value. Value is returned. - If fail to set pcd value, then ASSERT_EFI_ERROR(). - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The 64-bit value to set. + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The 64-bit value to set. @return Return the value been set. @@ -483,7 +543,7 @@ UINT64 EFIAPI LibPcdSet64 ( IN UINTN TokenNumber, - IN UINT64 Value + IN UINT64 Value ) { EFI_STATUS Status; @@ -498,23 +558,23 @@ LibPcdSet64 ( /** - Sets a buffer for the token specified by TokenNumber to - the value specified by Buffer and SizeOfBuffer. Buffer to - be set is returned. The content of the buffer could be - overwritten if a Callback on SET is registered with this - TokenNumber. + This function provides a means by which to set a value for a given PCD token. - If SizeOfBuffer is greater than the maximum - size support by TokenNumber, then set SizeOfBuffer 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 SizeOfBuffer. Buffer is returned. + If SizeOfBuffer is greater than the maximum size support by TokenNumber, + then set SizeOfBuffer to the maximum size supported by TokenNumber 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 the + maximum size supported by TokenName and NULL must be returned. + If SizeOfBuffer is NULL, then ASSERT(). If SizeOfBuffer > 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. - In out, returns actual size of buffer is set. - @param[in] Buffer A pointer to the buffer to set. + @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] Buffer A pointer to the buffer to set. @return Return the pointer for the buffer been set. @@ -522,9 +582,9 @@ LibPcdSet64 ( VOID * EFIAPI LibPcdSetPtr ( - IN UINTN TokenNumber, - IN OUT UINTN *SizeOfBuffer, - IN CONST VOID *Buffer + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN CONST VOID *Buffer ) { EFI_STATUS Status; @@ -547,12 +607,13 @@ LibPcdSetPtr ( /** + This function provides a means by which to set a value for a given PCD token. + Sets the Boolean value for the token specified by TokenNumber to the value specified by Value. Value is returned. - If fail to set pcd value, then ASSERT_EFI_ERROR(). - @param[in] TokenNumber The PCD token number to set a current value for. - @param[in] Value The boolean value to set. + @param[in] TokenNumber The PCD token number to set a current value for. + @param[in] Value The boolean value to set. @return Return the value been set. @@ -576,15 +637,17 @@ LibPcdSetBool ( /** + This function provides a means by which to set a value for a given PCD token. + Sets the 8-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. + If Guid is NULL, then ASSERT(). - If fail to set pcd value, then ASSERT_EFI_ERROR(). - @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] 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. @return Return the value been set. @@ -601,7 +664,7 @@ LibPcdSetEx8 ( ASSERT (Guid != NULL); - Status = (GetPcdPpiPointer ())->Set8Ex (Guid, TokenNumber, Value); + Status = (GetPiPcdPpiPointer ())->Set8 (Guid, TokenNumber, Value); ASSERT_EFI_ERROR (Status); @@ -611,15 +674,17 @@ LibPcdSetEx8 ( /** + This function provides a means by which to set a value for a given PCD token. + Sets the 16-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. + If Guid is NULL, then ASSERT(). - If fail to set pcd value, then ASSERT_EFI_ERROR(). - @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 16-bit value to set. + @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 16-bit value to set. @return Return the value been set. @@ -634,7 +699,7 @@ LibPcdSetEx16 ( { EFI_STATUS Status; ASSERT (Guid != NULL); - Status = (GetPcdPpiPointer ())->Set16Ex (Guid, TokenNumber, Value); + Status = (GetPiPcdPpiPointer ())->Set16 (Guid, TokenNumber, Value); ASSERT_EFI_ERROR (Status); @@ -644,15 +709,17 @@ LibPcdSetEx16 ( /** + This function provides a means by which to set a value for a given PCD token. + Sets the 32-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. + If Guid is NULL, then ASSERT(). - If fail to set pcd value, then ASSERT_EFI_ERROR(). - @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 32-bit value to set. + @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 32-bit value to set. @return Return the value been set. @@ -662,14 +729,14 @@ EFIAPI LibPcdSetEx32 ( IN CONST GUID *Guid, IN UINTN TokenNumber, - IN UINT32 Value + IN UINT32 Value ) { EFI_STATUS Status; ASSERT (Guid != NULL); - Status = (GetPcdPpiPointer ())->Set32Ex (Guid, TokenNumber, Value); + Status = (GetPiPcdPpiPointer ())->Set32 (Guid, TokenNumber, Value); ASSERT_EFI_ERROR (Status); @@ -679,15 +746,16 @@ LibPcdSetEx32 ( /** + This function provides a means by which to set a value for a given PCD token. + Sets the 64-bit value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. If Guid is NULL, then ASSERT(). - If fail to set pcd value, then ASSERT_EFI_ERROR(). - @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 64-bit value to set. + @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 64-bit value to set. @return Return the value been set. @@ -703,7 +771,7 @@ LibPcdSetEx64 ( EFI_STATUS Status; ASSERT (Guid != NULL); - Status = (GetPcdPpiPointer ())->Set64Ex (Guid, TokenNumber, Value); + Status = (GetPiPcdPpiPointer ())->Set64 (Guid, TokenNumber, Value); ASSERT_EFI_ERROR (Status); @@ -713,20 +781,23 @@ LibPcdSetEx64 ( /** + This function provides a means by which to set a value for a given PCD token. + Sets a buffer for the token specified by TokenNumber to the value specified by Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than the maximum size support by TokenNumber, then set SizeOfBuffer 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 SizeOfBuffer is NULL, then ASSERT(). If SizeOfBuffer > 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, out] SizeOfBuffer The size, in bytes, of Buffer. - In out, returns actual size of buffer is set. - @param[in] Buffer A pointer to the buffer to set. + @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, out] SizeOfBuffer The size, in bytes, of Buffer. + @param[in] Buffer A pointer to the buffer to set. @return Return the pinter to the buffer been set. @@ -747,7 +818,7 @@ LibPcdSetExPtr ( } ASSERT (Guid != NULL); - Status = (GetPcdPpiPointer ())->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer); + Status = (GetPiPcdPpiPointer ())->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer); if (EFI_ERROR (Status)) { return NULL; @@ -759,15 +830,17 @@ LibPcdSetExPtr ( /** + This function provides a means by which to set a value for a given PCD token. + Sets the Boolean value for the token specified by TokenNumber and Guid to the value specified by Value. Value is returned. + If Guid is NULL, then ASSERT(). - If fail to set pcd value, then ASSERT_EFI_ERROR(). - @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 Boolean value to set. + @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 Boolean value to set. @return Return the value been set. @@ -783,7 +856,7 @@ LibPcdSetExBool ( EFI_STATUS Status; ASSERT (Guid != NULL); - Status = (GetPcdPpiPointer ())->SetBoolEx (Guid, TokenNumber, Value); + Status = (GetPiPcdPpiPointer ())->SetBool (Guid, TokenNumber, Value); ASSERT_EFI_ERROR (Status); @@ -793,17 +866,19 @@ LibPcdSetExBool ( /** + Set up a notification function that is called when a specified token is set. + When the token specified by TokenNumber and Guid is set, then notification function specified by NotificationFunction is called. - If Guid is NULL, then the default token space is used. + If Guid is NULL, then the default token space is used. If NotificationFunction is NULL, then ASSERT(). - If fail to set callback, then ASSERT_EFI_ERROR(). - @param[in] Guid Pointer to a 128-bit unique value that designates which - namespace to set a value from. If NULL, then the default - token space is used. - @param[in] TokenNumber The PCD token number to monitor. - @param[in] NotificationFunction The function to call when the token - specified by Guid and TokenNumber is set. + + @param[in] Guid Pointer to a 128-bit unique value that designates which + namespace to set a value from. If NULL, then the default + token space is used. + @param[in] TokenNumber The PCD token number to monitor. + @param[in] NotificationFunction The function to call when the token + specified by Guid and TokenNumber is set. **/ VOID @@ -816,7 +891,9 @@ LibPcdCallbackOnSet ( { EFI_STATUS Status; - Status = (GetPcdPpiPointer ())->CallbackOnSet (Guid, TokenNumber, NotificationFunction); + ASSERT (NotificationFunction != NULL); + + Status = (GetPiPcdPpiPointer ())->CallbackOnSet (Guid, TokenNumber, (EFI_PEI_PCD_PPI_CALLBACK) NotificationFunction); ASSERT_EFI_ERROR (Status); @@ -827,11 +904,14 @@ LibPcdCallbackOnSet ( /** Disable a notification function that was established with LibPcdCallbackonSet(). + + Disable a notification function that was previously established with LibPcdCallbackOnSet(). If NotificationFunction is NULL, then ASSERT(). - If fail to cancel callback, then ASSERT_EFI_ERROR(). + If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber, + and NotificationFunction, then ASSERT(). - @param[in] Guid Specify the GUID token space. - @param[in] TokenNumber Specify the token number. + @param[in] Guid Specify the GUID token space. + @param[in] TokenNumber Specify the token number. @param[in] NotificationFunction The callback function to be unregistered. **/ @@ -845,7 +925,9 @@ LibPcdCancelCallback ( { EFI_STATUS Status; - Status = (GetPcdPpiPointer ())->CancelCallback (Guid, TokenNumber, NotificationFunction); + ASSERT (NotificationFunction != NULL); + + Status = (GetPiPcdPpiPointer ())->CancelCallback (Guid, TokenNumber, (EFI_PEI_PCD_PPI_CALLBACK) NotificationFunction); ASSERT_EFI_ERROR (Status); @@ -855,32 +937,34 @@ LibPcdCancelCallback ( /** + Retrieves the next token in a token space. + Retrieves the next PCD token number from the token space specified by Guid. If Guid is NULL, then the default token space is used. If TokenNumber is 0, then the first token number is returned. Otherwise, the token number that follows TokenNumber in the token space is returned. If TokenNumber is the last - token number in the token space, then 0 is returned. If TokenNumber is not 0 and - is not in the token space specified by Guid, then ASSERT(). - If fail to get token in given token space, then ASSERT_EFI_ERROR(). + token number in the token space, then 0 is returned. - @param[in] Guid Pointer to a 128-bit unique value that designates which namespace - to set a value from. If NULL, then the default token space is used. - @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD - token number. + If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT(). + + @param[in] Guid Pointer to a 128-bit unique value that designates which namespace + to set a value from. If NULL, then the default token space is used. + @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD + token number. @return The next valid token number. **/ -UINTN +UINTN EFIAPI LibPcdGetNextToken ( - IN CONST GUID *Guid, OPTIONAL - IN UINTN TokenNumber + IN CONST GUID *Guid, OPTIONAL + IN UINTN TokenNumber ) { EFI_STATUS Status; - Status = (GetPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber); + Status = (GetPiPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber); ASSERT_EFI_ERROR (Status); @@ -891,24 +975,17 @@ LibPcdGetNextToken ( /** Used to retrieve the list of available PCD token space GUIDs. - 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 fail to get next token space, then ASSERT_EFI_ERROR(). - - If Guid is not NULL and is not a valid token space in the current platform, then ASSERT(). - - + Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces + in the platform. + If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned. + If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned. - @param[in] Guid Pointer to a 128-bit unique value that designates from which namespace - to start the search. + @param TokenSpaceGuid Pointer to the a PCD token space GUID @return The next valid token namespace. **/ -GUID * +GUID * EFIAPI LibPcdGetNextTokenSpace ( IN CONST GUID *TokenSpaceGuid @@ -916,7 +993,7 @@ LibPcdGetNextTokenSpace ( { EFI_STATUS Status; - Status = (GetPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid); + Status = (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid); ASSERT_EFI_ERROR (Status);