From ec735bb2054bf0d1ec093e821caa93556ef246e0 Mon Sep 17 00:00:00 2001 From: klu2 Date: Tue, 24 Nov 2009 03:29:57 +0000 Subject: 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 --- MdePkg/Library/PeiPcdLib/PeiPcdLib.c | 64 +++++++++++++++++++++++----------- MdePkg/Library/PeiPcdLib/PeiPcdLib.inf | 20 +++++++++-- 2 files changed, 61 insertions(+), 23 deletions(-) (limited to 'MdePkg/Library/PeiPcdLib') 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
+Copyright (c) 2006 - 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 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 @@ -48,6 +49,29 @@ GetPcdPpiPointer ( return PcdPpi; } +/** + 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. @@ -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 -- cgit v1.2.3