refine code.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5656 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2008-08-18 05:43:42 +00:00
parent c36659905b
commit a72bd1ec5f
2 changed files with 76 additions and 220 deletions

View File

@ -27,13 +27,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
/** /**
The constructor function retrieve the PCD_PPI pointer. Retrieve the PCD_PPI pointer.
This function is to locate PCD_PPI PPI via PeiService.
If fail to locate PCD_PPI, then ASSERT_EFI_ERROR().
@retval PCD_PPI * The pointer to the PCD_PPI. @retval PCD_PPI * The pointer to the PCD_PPI.
**/ **/
PCD_PPI * PCD_PPI *
GetPcdPpiPtr ( GetPcdPpiPointer (
VOID VOID
) )
{ {
@ -48,9 +51,10 @@ GetPcdPpiPtr (
/** /**
Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned. 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().
@param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
set values associated with a PCD token. @param[in] System sku id. The SKU value that will be used when the PCD service will retrieve and
set values.
@retval SKU_ID Return the SKU ID that just be set. @retval SKU_ID Return the SKU ID that just be set.
@ -62,9 +66,9 @@ LibPcdSetSku (
) )
{ {
ASSERT (SkuId < 0x100); ASSERT (SkuId < PCD_MAX_SKU_ID);
GetPcdPpiPtr()->SetSku (SkuId);; GetPcdPpiPointer()->SetSku (SkuId);
return SkuId; return SkuId;
} }
@ -85,11 +89,7 @@ LibPcdGet8 (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI * PcdPpi; return (GetPcdPpiPointer ())->Get8 (TokenNumber);
PcdPpi = GetPcdPpiPtr ();
return PcdPpi->Get8 (TokenNumber);
} }
@ -108,11 +108,7 @@ LibPcdGet16 (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI *PcdPpi; return (GetPcdPpiPointer ())->Get16 (TokenNumber);
PcdPpi = GetPcdPpiPtr ();
return PcdPpi->Get16 (TokenNumber);
} }
@ -131,11 +127,7 @@ LibPcdGet32 (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI * PcdPpi; return (GetPcdPpiPointer ())->Get32 (TokenNumber);
PcdPpi = GetPcdPpiPtr ();
return PcdPpi->Get32 (TokenNumber);
} }
@ -154,11 +146,7 @@ LibPcdGet64 (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI * PcdPpi; return (GetPcdPpiPointer ())->Get64 (TokenNumber);
PcdPpi = GetPcdPpiPtr ();
return PcdPpi->Get64 (TokenNumber);
} }
@ -177,11 +165,7 @@ LibPcdGetPtr (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI * PcdPpi; return (GetPcdPpiPointer ())->GetPtr (TokenNumber);
PcdPpi = GetPcdPpiPtr ();
return PcdPpi->GetPtr (TokenNumber);
} }
@ -200,11 +184,7 @@ LibPcdGetBool (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI * PcdPpi; return (GetPcdPpiPointer ())->GetBool (TokenNumber);
PcdPpi = GetPcdPpiPtr ();
return PcdPpi->GetBool (TokenNumber);
} }
@ -223,11 +203,7 @@ LibPcdGetSize (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI * PcdPpi; return (GetPcdPpiPointer ())->GetSize (TokenNumber);
PcdPpi = GetPcdPpiPtr ();
return PcdPpi->GetSize (TokenNumber);
} }
@ -250,13 +226,9 @@ LibPcdGetEx8 (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI * PcdPpi;
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
PcdPpi = GetPcdPpiPtr (); return (GetPcdPpiPointer ())->Get8Ex (Guid, TokenNumber);
return PcdPpi->Get8Ex (Guid, TokenNumber);
} }
@ -279,13 +251,10 @@ LibPcdGetEx16 (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI * PcdPpi;
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
PcdPpi = GetPcdPpiPtr (); return (GetPcdPpiPointer ())->Get16Ex (Guid, TokenNumber);
return PcdPpi->Get16Ex (Guid, TokenNumber);
} }
@ -308,13 +277,9 @@ LibPcdGetEx32 (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI * PcdPpi;
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
PcdPpi = GetPcdPpiPtr (); return (GetPcdPpiPointer ())->Get32Ex (Guid, TokenNumber);
return PcdPpi->Get32Ex (Guid, TokenNumber);
} }
@ -338,13 +303,8 @@ LibPcdGetEx64 (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI * PcdPpi;
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
return (GetPcdPpiPointer ())->Get64Ex (Guid, TokenNumber);
PcdPpi = GetPcdPpiPtr ();
return PcdPpi->Get64Ex (Guid, TokenNumber);
} }
@ -367,13 +327,9 @@ LibPcdGetExPtr (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI * PcdPpi;
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
PcdPpi = GetPcdPpiPtr (); return (GetPcdPpiPointer ())->GetPtrEx (Guid, TokenNumber);
return PcdPpi->GetPtrEx (Guid, TokenNumber);
} }
@ -396,13 +352,8 @@ LibPcdGetExBool (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI * PcdPpi;
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
return (GetPcdPpiPointer ())->GetBoolEx (Guid, TokenNumber);
PcdPpi = GetPcdPpiPtr ();
return PcdPpi->GetBoolEx (Guid, TokenNumber);
} }
@ -425,13 +376,8 @@ LibPcdGetExSize (
IN UINTN TokenNumber IN UINTN TokenNumber
) )
{ {
PCD_PPI * PcdPpi;
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
return (GetPcdPpiPointer ())->GetSizeEx (Guid, TokenNumber);
PcdPpi = GetPcdPpiPtr ();
return PcdPpi->GetSizeEx (Guid, TokenNumber);
} }
@ -439,6 +385,7 @@ LibPcdGetExSize (
/** /**
Sets the 8-bit value for the token specified by TokenNumber Sets the 8-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. 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] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 8-bit value to set. @param[in] Value The 8-bit value to set.
@ -454,11 +401,8 @@ LibPcdSet8 (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
PcdPpi = GetPcdPpiPtr (); Status = (GetPcdPpiPointer ())->Set8 (TokenNumber, Value);
Status = PcdPpi->Set8 (TokenNumber, Value);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -470,6 +414,7 @@ LibPcdSet8 (
/** /**
Sets the 16-bit value for the token specified by TokenNumber Sets the 16-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. 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] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 16-bit value to set. @param[in] Value The 16-bit value to set.
@ -485,11 +430,8 @@ LibPcdSet16 (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
PcdPpi = GetPcdPpiPtr (); Status = (GetPcdPpiPointer ())->Set16 (TokenNumber, Value);
Status = PcdPpi->Set16 (TokenNumber, Value);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -501,6 +443,7 @@ LibPcdSet16 (
/** /**
Sets the 32-bit value for the token specified by TokenNumber Sets the 32-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. 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] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 32-bit value to set. @param[in] Value The 32-bit value to set.
@ -516,11 +459,8 @@ LibPcdSet32 (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
PcdPpi = GetPcdPpiPtr (); Status = (GetPcdPpiPointer ())->Set32 (TokenNumber, Value);
Status = PcdPpi->Set32 (TokenNumber, Value);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -532,6 +472,7 @@ LibPcdSet32 (
/** /**
Sets the 64-bit value for the token specified by TokenNumber Sets the 64-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned. 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] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 64-bit value to set. @param[in] Value The 64-bit value to set.
@ -547,11 +488,8 @@ LibPcdSet64 (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
PcdPpi = GetPcdPpiPtr (); Status = (GetPcdPpiPointer ())->Set64 (TokenNumber, Value);
Status = PcdPpi->Set64 (TokenNumber, Value);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -562,20 +500,21 @@ LibPcdSet64 (
/** /**
Sets a buffer for the token specified by TokenNumber to Sets a buffer for the token specified by TokenNumber to
the value specified by Buffer and SizeOfValue. Buffer to the value specified by Buffer and SizeOfBuffer. Buffer to
be set is returned. The content of the buffer could be be set is returned. The content of the buffer could be
overwritten if a Callback on SET is registered with this overwritten if a Callback on SET is registered with this
TokenNumber. TokenNumber.
If SizeOfValue is greater than the maximum If SizeOfBuffer is greater than the maximum
size support by TokenNumber, then set SizeOfValue to the size support by TokenNumber, then set SizeOfBuffer to the
maximum size supported by TokenNumber and return NULL to maximum size supported by TokenNumber and return NULL to
indicate that the set operation was not actually performed. indicate that the set operation was not actually performed.
If SizeOfValue > 0 and Buffer 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] TokenNumber The PCD token number to set a current value for.
@param[in, out] SizeOfBuffer The size, in bytes, of Buffer. @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] Buffer A pointer to the buffer to set.
@retval VOID* Return the pointer for the buffer been set. @retval VOID* Return the pointer for the buffer been set.
@ -590,17 +529,14 @@ LibPcdSetPtr (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI *PcdPpi;
ASSERT (SizeOfBuffer != NULL); ASSERT (SizeOfBuffer != NULL);
if (*SizeOfBuffer > 0) { if (*SizeOfBuffer > 0) {
ASSERT (Buffer != NULL); ASSERT (Buffer != NULL);
} }
PcdPpi = GetPcdPpiPtr ();
Status = PcdPpi->SetPtr (TokenNumber, SizeOfBuffer, Buffer); Status = (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, Buffer);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return NULL; return NULL;
@ -614,6 +550,7 @@ LibPcdSetPtr (
/** /**
Sets the Boolean value for the token specified by TokenNumber Sets the Boolean value for the token specified by TokenNumber
to the value specified by Value. Value is returned. 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] TokenNumber The PCD token number to set a current value for.
@param[in] Value The boolean value to set. @param[in] Value The boolean value to set.
@ -629,11 +566,8 @@ LibPcdSetBool (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
PcdPpi = GetPcdPpiPtr (); Status = (GetPcdPpiPointer ())->SetBool (TokenNumber, Value);
Status = PcdPpi->SetBool (TokenNumber, Value);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -646,6 +580,7 @@ LibPcdSetBool (
Sets the 8-bit value for the token specified by TokenNumber and Sets the 8-bit value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). 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 @param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -664,13 +599,10 @@ LibPcdSetEx8 (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
PcdPpi = GetPcdPpiPtr ();
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
Status = PcdPpi->Set8Ex (Guid, TokenNumber, Value); Status = (GetPcdPpiPointer ())->Set8Ex (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -683,13 +615,14 @@ LibPcdSetEx8 (
Sets the 16-bit value for the token specified by TokenNumber and Sets the 16-bit value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). 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 @param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@param[in] TokenNumber The PCD token number to set a current value for. @param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 16-bit value to set. @param[in] Value The 16-bit value to set.
@retval UINT8 Return the value been set. @retval UINT16 Return the value been set.
**/ **/
UINT16 UINT16
@ -701,12 +634,8 @@ LibPcdSetEx16 (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
PcdPpi = GetPcdPpiPtr ();
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
Status = PcdPpi->Set16Ex (Guid, TokenNumber, Value); Status = (GetPcdPpiPointer ())->Set16Ex (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -719,6 +648,7 @@ LibPcdSetEx16 (
Sets the 32-bit value for the token specified by TokenNumber and Sets the 32-bit value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). 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 @param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -737,12 +667,10 @@ LibPcdSetEx32 (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
PcdPpi = GetPcdPpiPtr ();
Status = (GetPcdPpiPointer ())->Set32Ex (Guid, TokenNumber, Value);
Status = PcdPpi->Set32Ex (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -755,6 +683,7 @@ LibPcdSetEx32 (
Sets the 64-bit value for the token specified by TokenNumber and Sets the 64-bit value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). 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 @param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -773,12 +702,9 @@ LibPcdSetEx64 (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
PcdPpi = GetPcdPpiPtr ();
Status = (GetPcdPpiPointer ())->Set64Ex (Guid, TokenNumber, Value);
Status = PcdPpi->Set64Ex (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -789,17 +715,18 @@ LibPcdSetEx64 (
/** /**
Sets a buffer for the token specified by TokenNumber to the value specified by 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 Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
the maximum size support by TokenNumber, then set SizeOfValue to the maximum size 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 supported by TokenNumber and return NULL to indicate that the set operation
was not actually performed. was not actually performed.
If SizeOfValue > 0 and Buffer is NULL, then ASSERT(). If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
@param[in] Guid Pointer to a 128-bit unique value that @param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@param[in] TokenNumber The PCD token number to set a current value for. @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, 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] Buffer A pointer to the buffer to set.
@retval VOID * Return the pinter to the buffer been set. @retval VOID * Return the pinter to the buffer been set.
@ -815,15 +742,13 @@ LibPcdSetExPtr (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI *PcdPpi; ASSERT (SizeOfBuffer != NULL);
ASSERT (SizeOfBuffer != NULL);
if (*SizeOfBuffer > 0) { if (*SizeOfBuffer > 0) {
ASSERT (Buffer != NULL); ASSERT (Buffer != NULL);
} }
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
PcdPpi = GetPcdPpiPtr ();
Status = PcdPpi->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer); Status = (GetPcdPpiPointer ())->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return NULL; return NULL;
@ -838,6 +763,7 @@ LibPcdSetExPtr (
Sets the Boolean value for the token specified by TokenNumber and Sets the Boolean value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned. Guid to the value specified by Value. Value is returned.
If Guid is NULL, then ASSERT(). 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 @param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from. designates which namespace to set a value from.
@ -856,12 +782,9 @@ LibPcdSetExBool (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
PcdPpi = GetPcdPpiPtr ();
ASSERT (Guid != NULL); ASSERT (Guid != NULL);
Status = PcdPpi->SetBoolEx (Guid, TokenNumber, Value); Status = (GetPcdPpiPointer ())->SetBoolEx (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -875,7 +798,7 @@ LibPcdSetExBool (
then notification function specified by NotificationFunction is called. 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 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 @param[in] Guid Pointer to a 128-bit unique value that designates which
namespace to set a value from. If NULL, then the default namespace to set a value from. If NULL, then the default
token space is used. token space is used.
@ -895,12 +818,8 @@ LibPcdCallbackOnSet (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
PcdPpi = GetPcdPpiPtr (); Status = (GetPcdPpiPointer ())->CallbackOnSet (Guid, TokenNumber, NotificationFunction);
Status = PcdPpi->CallbackOnSet (Guid, TokenNumber, NotificationFunction);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -912,7 +831,8 @@ LibPcdCallbackOnSet (
/** /**
Disable a notification function that was established with LibPcdCallbackonSet(). Disable a notification function that was established with LibPcdCallbackonSet().
If NotificationFunction is NULL, then ASSERT(). If NotificationFunction is NULL, then ASSERT().
If fail to cancel callback, then ASSERT_EFI_ERROR().
@param[in] Guid Specify the GUID token space. @param[in] Guid Specify the GUID token space.
@param[in] TokenNumber Specify the token number. @param[in] TokenNumber Specify the token number.
@param[in] NotificationFunction The callback function to be unregistered. @param[in] NotificationFunction The callback function to be unregistered.
@ -929,12 +849,8 @@ LibPcdCancelCallback (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
PcdPpi = GetPcdPpiPtr (); Status = (GetPcdPpiPointer ())->CancelCallback (Guid, TokenNumber, NotificationFunction);
Status = PcdPpi->CancelCallback (Guid, TokenNumber, NotificationFunction);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -950,7 +866,8 @@ LibPcdCancelCallback (
follows TokenNumber in the token space is returned. If TokenNumber is the last 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 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(). is not in the token space specified by Guid, then ASSERT().
If fail to get token in given token space, then ASSERT_EFI_ERROR().
@param[in] Guid Pointer to a 128-bit unique value that designates which namespace @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. 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 @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD
@ -967,12 +884,8 @@ LibPcdGetNextToken (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
PcdPpi = GetPcdPpiPtr (); Status = (GetPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber);
Status = PcdPpi->GetNextToken (Guid, &TokenNumber);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -986,7 +899,8 @@ LibPcdGetNextToken (
platform. If Guid is NULL, then the GUID of the first non-local token space of the 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, current platform is returned. If Guid is the last non-local token space,
then NULL is returned. 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(). If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
@ -1004,12 +918,8 @@ LibPcdGetNextTokenSpace (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
PCD_PPI * PcdPpi;
PcdPpi = GetPcdPpiPtr (); Status = (GetPcdPpiPointer ())->GetNextTokenSpace (&Guid);
Status = PcdPpi->GetNextTokenSpace (&Guid);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -1020,20 +930,21 @@ LibPcdGetNextTokenSpace (
/** /**
Sets the PCD entry specified by PatchVariable to the value specified by Buffer Sets the PCD entry specified by PatchVariable to the value specified by Buffer
and SizeOfValue. Buffer is returned. If SizeOfValue is greater than and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
NULL to indicate that the set operation was not actually performed. NULL to indicate that the set operation was not actually performed.
If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
MaximumDatumSize and NULL must be returned. MaximumDatumSize and NULL must be returned.
If PatchVariable is NULL, then ASSERT(). If PatchVariable is NULL, then ASSERT().
If SizeOfValue is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT().
If SizeOfValue > 0 and Buffer 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[in] PatchVariable A pointer to the global variable in a module that is
the target of the set operation. the target of the set operation.
@param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by 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, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
In out, returns actual size of buffer is set.
@param[in] Buffer A pointer to the buffer to used to set the target variable. @param[in] Buffer A pointer to the buffer to used to set the target variable.
**/ **/

View File

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MsaHeader>
<ModuleName>PeiPcdLib</ModuleName>
<ModuleType>PEIM</ModuleType>
<GuidValue>9dbf6f25-0da2-4a1d-8e12-e78de6ab4d0e</GuidValue>
<Version>1.0</Version>
<Abstract>PCD Library instance implemented with PCD PPI.</Abstract>
<Description>This library instance implement the APIs listed
in PCD library class defined in MDE library specification.
It is used by module in PEI phase.</Description>
<Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
<License>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
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
</MsaHeader>
<ModuleDefinitions>
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
<BinaryModule>false</BinaryModule>
<OutputFileBasename>PeiPcdLib</OutputFileBasename>
</ModuleDefinitions>
<LibraryClassDefinitions>
<LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="PEIM PEI_CORE">
<Keyword>PcdLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DebugLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>PeiServicesTablePointerLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseMemoryLib</Keyword>
</LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>PeiPcdLib.c</Filename>
</SourceFiles>
<PackageDependencies>
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
</PackageDependencies>
<PPIs>
<Ppi Usage="ALWAYS_CONSUMED">
<PpiCName>gPcdPpiGuid</PpiCName>
</Ppi>
</PPIs>
<Externs>
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
</Externs>
</ModuleSurfaceArea>