diff options
author | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-11-24 03:29:57 +0000 |
---|---|---|
committer | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-11-24 03:29:57 +0000 |
commit | ec735bb2054bf0d1ec093e821caa93556ef246e0 (patch) | |
tree | 872b267b8dcc0d30d317eebf7075b4d258432a1f /MdePkg/Library | |
parent | 6c74c5383a77e023030c343fd83d5b625e5b01d1 (diff) | |
download | edk2-ec735bb2054bf0d1ec093e821caa93556ef246e0.tar.gz edk2-ec735bb2054bf0d1ec093e821caa93556ef246e0.tar.bz2 edk2-ec735bb2054bf0d1ec093e821caa93556ef246e0.zip |
1, PeiPcdLib use EFI_PEI_PCD_PPI defined in PI 1.2 to handle dynamicEx type PCD request.
2, DxePcdLib use EFI_PCD_PROTOCOL defined in PI 1.2 to handle dynamicEx type PCD request.
3, There is no change for dynamic type PCD.
4, Refine the INF's comments.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9473 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library')
-rw-r--r-- | MdePkg/Library/DxePcdLib/DxePcdLib.c | 71 | ||||
-rw-r--r-- | MdePkg/Library/DxePcdLib/DxePcdLib.inf | 19 | ||||
-rw-r--r-- | MdePkg/Library/PeiPcdLib/PeiPcdLib.c | 64 | ||||
-rw-r--r-- | MdePkg/Library/PeiPcdLib/PeiPcdLib.inf | 20 |
4 files changed, 123 insertions, 51 deletions
diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.c b/MdePkg/Library/DxePcdLib/DxePcdLib.c index 703dd428a0..33d2e023a8 100644 --- a/MdePkg/Library/DxePcdLib/DxePcdLib.c +++ b/MdePkg/Library/DxePcdLib/DxePcdLib.c @@ -1,7 +1,7 @@ /** @file
Implementation of PcdLib class library for DXE phase.
-Copyright (c) 2006 - 2008, Intel Corporation<BR>
+Copyright (c) 2006 - 2009, Intel Corporation<BR>
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
@@ -17,14 +17,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <PiDxe.h>
#include <Protocol/Pcd.h>
+#include <Protocol/PiPcd.h>
#include <Library/PcdLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseMemoryLib.h>
-PCD_PROTOCOL *mPcd = NULL;
-
+PCD_PROTOCOL *mPcd = NULL;
+EFI_PCD_PROTOCOL *mPiPcd = NULL;
/**
The constructor function caches the PCD_PROTOCOL pointer.
@@ -45,12 +46,19 @@ PcdLibConstructor ( EFI_STATUS Status;
//
- // PCD protocol has not been installed, but a module needs to access a
- // dynamic PCD entry.
+ // PCD protocol need to be installed before the module access Dynamic type PCD.
+ // But dynamic type PCD is not required in PI 1.2 specification.
//
- Status = gBS->LocateProtocol (&gPcdProtocolGuid, NULL, (VOID **)&mPcd);
+ gBS->LocateProtocol (&gPcdProtocolGuid, NULL, (VOID **)&mPcd);
+
+ //
+ // PI Pcd protocol defined in PI 1.2 vol3 should be installed before the module
+ // access DynamicEx type PCD.
+ //
+ Status = gBS->LocateProtocol (&gEfiPcdProtocolGuid, NULL, (VOID **) mPiPcd);
+
ASSERT_EFI_ERROR (Status);
- ASSERT (mPcd!= NULL);
+ ASSERT (mPiPcd!= NULL);
return Status;
}
@@ -74,6 +82,7 @@ LibPcdSetSku ( IN UINTN SkuId
)
{
+ ASSERT (mPcd != NULL);
ASSERT (SkuId < PCD_MAX_SKU_ID);
mPcd->SetSku (SkuId);
@@ -99,6 +108,7 @@ LibPcdGet8 ( IN UINTN TokenNumber
)
{
+ ASSERT (mPcd != NULL);
return mPcd->Get8 (TokenNumber);
}
@@ -120,6 +130,7 @@ LibPcdGet16 ( IN UINTN TokenNumber
)
{
+ ASSERT (mPcd != NULL);
return mPcd->Get16 (TokenNumber);
}
@@ -141,6 +152,7 @@ LibPcdGet32 ( IN UINTN TokenNumber
)
{
+ ASSERT (mPcd != NULL);
return mPcd->Get32 (TokenNumber);
}
@@ -162,6 +174,7 @@ LibPcdGet64 ( IN UINTN TokenNumber
)
{
+ ASSERT (mPcd != NULL);
return mPcd->Get64 (TokenNumber);
}
@@ -183,6 +196,7 @@ LibPcdGetPtr ( IN UINTN TokenNumber
)
{
+ ASSERT (mPcd != NULL);
return mPcd->GetPtr (TokenNumber);
}
@@ -204,6 +218,7 @@ LibPcdGetBool ( IN UINTN TokenNumber
)
{
+ ASSERT (mPcd != NULL);
return mPcd->GetBool (TokenNumber);
}
@@ -223,6 +238,7 @@ LibPcdGetSize ( IN UINTN TokenNumber
)
{
+ ASSERT (mPcd != NULL);
return mPcd->GetSize (TokenNumber);
}
@@ -251,7 +267,7 @@ LibPcdGetEx8 ( {
ASSERT (Guid != NULL);
- return mPcd->Get8Ex (Guid, TokenNumber);
+ return mPiPcd->Get8Ex (Guid, TokenNumber);
}
@@ -278,7 +294,7 @@ LibPcdGetEx16 ( {
ASSERT (Guid != NULL);
- return mPcd->Get16Ex (Guid, TokenNumber);
+ return mPiPcd->Get16Ex (Guid, TokenNumber);
}
@@ -302,7 +318,7 @@ LibPcdGetEx32 ( {
ASSERT (Guid != NULL);
- return mPcd->Get32Ex (Guid, TokenNumber);
+ return mPiPcd->Get32Ex (Guid, TokenNumber);
}
@@ -330,7 +346,7 @@ LibPcdGetEx64 ( {
ASSERT (Guid != NULL);
- return mPcd->Get64Ex (Guid, TokenNumber);
+ return mPiPcd->Get64Ex (Guid, TokenNumber);
}
@@ -358,7 +374,7 @@ LibPcdGetExPtr ( {
ASSERT (Guid != NULL);
- return mPcd->GetPtrEx (Guid, TokenNumber);
+ return mPiPcd->GetPtrEx (Guid, TokenNumber);
}
@@ -386,7 +402,7 @@ LibPcdGetExBool ( {
ASSERT (Guid != NULL);
- return mPcd->GetBoolEx (Guid, TokenNumber);
+ return mPiPcd->GetBoolEx (Guid, TokenNumber);
}
@@ -414,7 +430,7 @@ LibPcdGetExSize ( {
ASSERT (Guid != NULL);
- return mPcd->GetSizeEx (Guid, TokenNumber);
+ return mPiPcd->GetSizeEx (Guid, TokenNumber);
}
@@ -440,6 +456,7 @@ LibPcdSet8 ( {
EFI_STATUS Status;
+ ASSERT (mPcd != NULL);
Status = mPcd->Set8 (TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -470,6 +487,7 @@ LibPcdSet16 ( {
EFI_STATUS Status;
+ ASSERT (mPcd != NULL);
Status = mPcd->Set16 (TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -499,6 +517,8 @@ LibPcdSet32 ( )
{
EFI_STATUS Status;
+
+ ASSERT (mPcd != NULL);
Status = mPcd->Set32 (TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -529,6 +549,7 @@ LibPcdSet64 ( {
EFI_STATUS Status;
+ ASSERT (mPcd != NULL);
Status = mPcd->Set64 (TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -570,6 +591,7 @@ LibPcdSetPtr ( {
EFI_STATUS Status;
+ ASSERT (mPcd != NULL);
ASSERT (SizeOfBuffer != NULL);
if (*SizeOfBuffer > 0) {
@@ -608,6 +630,7 @@ LibPcdSetBool ( {
EFI_STATUS Status;
+ ASSERT (mPcd != NULL);
Status = mPcd->SetBool (TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -645,7 +668,7 @@ LibPcdSetEx8 ( ASSERT (Guid != NULL);
- Status = mPcd->Set8Ex (Guid, TokenNumber, Value);
+ Status = mPiPcd->Set8Ex (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -682,7 +705,7 @@ LibPcdSetEx16 ( ASSERT (Guid != NULL);
- Status = mPcd->Set16Ex (Guid, TokenNumber, Value);
+ Status = mPiPcd->Set16Ex (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -719,7 +742,7 @@ LibPcdSetEx32 ( ASSERT (Guid != NULL);
- Status = mPcd->Set32Ex (Guid, TokenNumber, Value);
+ Status = mPiPcd->Set32Ex (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -755,7 +778,7 @@ LibPcdSetEx64 ( ASSERT (Guid != NULL);
- Status = mPcd->Set64Ex (Guid, TokenNumber, Value);
+ Status = mPiPcd->Set64Ex (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -805,7 +828,7 @@ LibPcdSetExPtr ( ASSERT (Buffer != NULL);
}
- Status = mPcd->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);
+ Status = mPiPcd->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);
if (EFI_ERROR (Status)) {
return NULL;
@@ -844,7 +867,7 @@ LibPcdSetExBool ( ASSERT (Guid != NULL);
- Status = mPcd->SetBoolEx (Guid, TokenNumber, Value);
+ Status = mPiPcd->SetBoolEx (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -881,7 +904,7 @@ LibPcdCallbackOnSet ( ASSERT (NotificationFunction != NULL);
- Status = mPcd->CallbackOnSet (Guid, TokenNumber, NotificationFunction);
+ Status = mPiPcd->CallbackOnSet (Guid, TokenNumber, NotificationFunction);
ASSERT_EFI_ERROR (Status);
@@ -915,7 +938,7 @@ LibPcdCancelCallback ( ASSERT (NotificationFunction != NULL);
- Status = mPcd->CancelCallback (Guid, TokenNumber, NotificationFunction);
+ Status = mPiPcd->CancelCallback (Guid, TokenNumber, NotificationFunction);
ASSERT_EFI_ERROR (Status);
@@ -952,7 +975,7 @@ LibPcdGetNextToken ( {
EFI_STATUS Status;
- Status = mPcd->GetNextToken (Guid, &TokenNumber);
+ Status = mPiPcd->GetNextToken (Guid, &TokenNumber);
ASSERT_EFI_ERROR (Status);
@@ -982,7 +1005,7 @@ LibPcdGetNextTokenSpace ( {
EFI_STATUS Status;
- Status = mPcd->GetNextTokenSpace (&TokenSpaceGuid);
+ Status = mPiPcd->GetNextTokenSpace (&TokenSpaceGuid);
ASSERT_EFI_ERROR (Status);
diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.inf b/MdePkg/Library/DxePcdLib/DxePcdLib.inf index cd2a1c8e17..2958ed0a7c 100644 --- a/MdePkg/Library/DxePcdLib/DxePcdLib.inf +++ b/MdePkg/Library/DxePcdLib/DxePcdLib.inf @@ -1,9 +1,19 @@ #/** @file
# Instance of PCD Library using PCD Protocol.
#
-# PCD Library that uses the PCD Protocol to access Dynamic and DynamicEx PCD entries.
+# There are two PCD PPIs as follows:
+# 1) PCD_PROTOCOL
+# It is EDKII implementation which support Dynamic/DynamicEx Pcds.
+# 2) EFI_PCD_PROTOCOL
+# It is defined by PI specification 1.2, Vol 3 which only support dynamicEx
+# type Pcd.
#
-# Copyright (c) 2007 - 2008, Intel Corporation.
+# For dynamicEx type PCD, it is compatible between PCD_PROTOCOL and EFI_PCD_PROTOCOL.
+#
+# This library instance uses the PCD_PROTOCOL to handle dynamic PCD request and use
+# EFI_PCD_PROTOCOL to handle dynamicEx type PCD.
+#
+# Copyright (c) 2007 - 2009, 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
@@ -44,7 +54,8 @@ [Protocols]
gPcdProtocolGuid ## CONSUMES
-
+ gEfiPcdProtocolGuid ## CONSUMES
+
[Depex]
- gPcdProtocolGuid
+ gEfiPcdProtocolGuid
diff --git a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c index 2e2dbb6ac5..5dcb16ad43 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 - 2008, Intel Corporation<BR>
+Copyright (c) 2006 - 2009, Intel Corporation<BR>
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 <PiPei.h>
#include <Ppi/Pcd.h>
+#include <Ppi/PiPcd.h>
#include <Library/PeiServicesLib.h>
#include <Library/PcdLib.h>
@@ -49,6 +50,29 @@ GetPcdPpiPointer ( }
/**
+ 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().
+
+ @retval EFI_PEI_PCD_PPI * The pointer to the EFI_PEI_PCD_PPI.
+
+**/
+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.
@@ -69,8 +93,8 @@ LibPcdSetSku ( ASSERT (SkuId < PCD_MAX_SKU_ID);
- GetPcdPpiPointer()->SetSku (SkuId);
-
+ GetPiPcdPpiPointer()->SetSku (SkuId);
+
return SkuId;
}
@@ -244,7 +268,7 @@ LibPcdGetEx8 ( {
ASSERT (Guid != NULL);
- return (GetPcdPpiPointer ())->Get8Ex (Guid, TokenNumber);
+ return (GetPiPcdPpiPointer ())->GetEx8 (Guid, TokenNumber);
}
@@ -273,7 +297,7 @@ LibPcdGetEx16 ( ASSERT (Guid != NULL);
- return (GetPcdPpiPointer ())->Get16Ex (Guid, TokenNumber);
+ return (GetPiPcdPpiPointer ())->GetEx16 (Guid, TokenNumber);
}
@@ -298,7 +322,7 @@ LibPcdGetEx32 ( {
ASSERT (Guid != NULL);
- return (GetPcdPpiPointer ())->Get32Ex (Guid, TokenNumber);
+ return (GetPiPcdPpiPointer ())->GetEx32 (Guid, TokenNumber);
}
@@ -326,7 +350,7 @@ LibPcdGetEx64 ( )
{
ASSERT (Guid != NULL);
- return (GetPcdPpiPointer ())->Get64Ex (Guid, TokenNumber);
+ return (GetPiPcdPpiPointer ())->GetEx64 (Guid, TokenNumber);
}
@@ -354,7 +378,7 @@ LibPcdGetExPtr ( {
ASSERT (Guid != NULL);
- return (GetPcdPpiPointer ())->GetPtrEx (Guid, TokenNumber);
+ return (GetPiPcdPpiPointer ())->GetExPtr (Guid, TokenNumber);
}
@@ -381,7 +405,7 @@ LibPcdGetExBool ( )
{
ASSERT (Guid != NULL);
- return (GetPcdPpiPointer ())->GetBoolEx (Guid, TokenNumber);
+ return (GetPiPcdPpiPointer ())->GetExBool (Guid, TokenNumber);
}
@@ -408,7 +432,7 @@ LibPcdGetExSize ( )
{
ASSERT (Guid != NULL);
- return (GetPcdPpiPointer ())->GetSizeEx (Guid, TokenNumber);
+ return (GetPiPcdPpiPointer ())->GetExSize (Guid, TokenNumber);
}
@@ -640,7 +664,7 @@ LibPcdSetEx8 ( ASSERT (Guid != NULL);
- Status = (GetPcdPpiPointer ())->Set8Ex (Guid, TokenNumber, Value);
+ Status = (GetPiPcdPpiPointer ())->SetEx8 (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -675,7 +699,7 @@ LibPcdSetEx16 ( {
EFI_STATUS Status;
ASSERT (Guid != NULL);
- Status = (GetPcdPpiPointer ())->Set16Ex (Guid, TokenNumber, Value);
+ Status = (GetPiPcdPpiPointer ())->SetEx16 (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -712,7 +736,7 @@ LibPcdSetEx32 ( ASSERT (Guid != NULL);
- Status = (GetPcdPpiPointer ())->Set32Ex (Guid, TokenNumber, Value);
+ Status = (GetPiPcdPpiPointer ())->SetEx32 (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -747,7 +771,7 @@ LibPcdSetEx64 ( EFI_STATUS Status;
ASSERT (Guid != NULL);
- Status = (GetPcdPpiPointer ())->Set64Ex (Guid, TokenNumber, Value);
+ Status = (GetPiPcdPpiPointer ())->SetEx64 (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -794,7 +818,7 @@ LibPcdSetExPtr ( }
ASSERT (Guid != NULL);
- Status = (GetPcdPpiPointer ())->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);
+ Status = (GetPiPcdPpiPointer ())->SetExPtr (Guid, TokenNumber, SizeOfBuffer, Buffer);
if (EFI_ERROR (Status)) {
return NULL;
@@ -832,7 +856,7 @@ LibPcdSetExBool ( EFI_STATUS Status;
ASSERT (Guid != NULL);
- Status = (GetPcdPpiPointer ())->SetBoolEx (Guid, TokenNumber, Value);
+ Status = (GetPiPcdPpiPointer ())->SetExBool (Guid, TokenNumber, Value);
ASSERT_EFI_ERROR (Status);
@@ -869,7 +893,7 @@ LibPcdCallbackOnSet ( ASSERT (NotificationFunction != NULL);
- Status = (GetPcdPpiPointer ())->CallbackOnSet (Guid, TokenNumber, NotificationFunction);
+ Status = (GetPiPcdPpiPointer ())->CallbackOnSet (Guid, TokenNumber, NotificationFunction);
ASSERT_EFI_ERROR (Status);
@@ -903,7 +927,7 @@ LibPcdCancelCallback ( ASSERT (NotificationFunction != NULL);
- Status = (GetPcdPpiPointer ())->CancelCallback (Guid, TokenNumber, NotificationFunction);
+ Status = (GetPiPcdPpiPointer ())->CancelCallback (Guid, TokenNumber, NotificationFunction);
ASSERT_EFI_ERROR (Status);
@@ -940,7 +964,7 @@ LibPcdGetNextToken ( {
EFI_STATUS Status;
- Status = (GetPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber);
+ Status = (GetPiPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber);
ASSERT_EFI_ERROR (Status);
@@ -969,7 +993,7 @@ LibPcdGetNextTokenSpace ( {
EFI_STATUS Status;
- Status = (GetPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid);
+ Status = (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid);
ASSERT_EFI_ERROR (Status);
diff --git a/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf b/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf index 17363b1450..a714147c12 100644 --- a/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf +++ b/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf @@ -1,9 +1,21 @@ #/** @file
# Instance of PCD Library using PCD PPI.
#
+# There are two PCD PPIs as follows:
+# 1) PCD_PPI
+# It is EDKII implementation which support Dynamic/DynamicEx Pcds.
+# 2) EFI_PEI_PCD_PPI
+# It is defined by PI specification 1.2, Vol 3 which only support dynamicEx
+# type Pcd.
+# For dynamicEx type PCD, it is compatible between PCD_PPI and EFI_PEI_PCD_PPI.
+# This library instance uses the PCD_PPI to handle dynamic PCD request and use
+# EFI_PEI_PCD_PPI to handle dynamicEx type PCD.
+#
+# This library instance assume the PCD_PPI and EFI_PEI_PCD_PPI are both installed early.
+#
# PCD Library that uses the PCD PPI to access Dynamic and DynamicEx PCD entries
#
-# Copyright (c) 2007 - 2008, Intel Corporation
+# Copyright (c) 2007 - 2009, 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
@@ -44,6 +56,8 @@ [Ppis]
gPcdPpiGuid ## CONSUMES
-
+ gEfiPeiPcdPpiGuid ## CONSUMES
+
[depex]
- gPcdPpiGuid
+ gEfiPeiPcdPpiGuid
+
\ No newline at end of file |