summaryrefslogtreecommitdiff
path: root/MdePkg/Library
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2013-11-20 00:44:25 +0000
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2013-11-20 00:44:25 +0000
commit96d6d004aaf9da42c5fd9cd07035886937d42a69 (patch)
treed37234172371bb439a6f2553e42e4af5e62e4ec1 /MdePkg/Library
parent14b5e3fd787fb1ae0c354ea5169025a724f9cbb1 (diff)
downloadedk2-platforms-96d6d004aaf9da42c5fd9cd07035886937d42a69.tar.xz
MdePkg and MdeModulePkg Pcd: Add the new EFI_GET_PCD_INFO_PROTOCOL and EFI_GET_PCD_INFO_PPI support for PI 1.2.1 compliance.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14866 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library')
-rw-r--r--MdePkg/Library/BasePcdLibNull/PcdLib.c66
-rw-r--r--MdePkg/Library/DxePcdLib/DxePcdLib.c124
-rw-r--r--MdePkg/Library/DxePcdLib/DxePcdLib.inf6
-rw-r--r--MdePkg/Library/PeiPcdLib/PeiPcdLib.c121
-rw-r--r--MdePkg/Library/PeiPcdLib/PeiPcdLib.inf8
5 files changed, 318 insertions, 7 deletions
diff --git a/MdePkg/Library/BasePcdLibNull/PcdLib.c b/MdePkg/Library/BasePcdLibNull/PcdLib.c
index 4823f5ad67..8333aaa3f9 100644
--- a/MdePkg/Library/BasePcdLibNull/PcdLib.c
+++ b/MdePkg/Library/BasePcdLibNull/PcdLib.c
@@ -919,3 +919,69 @@ LibPatchPcdSetPtr (
return (VOID *) Buffer;
}
+/**
+ Retrieve additional information associated with a PCD token.
+
+ This includes information such as the type of value the TokenNumber is associated with as well as possible
+ human readable name that is associated with the token.
+
+ If TokenNumber is not in the default token space specified, then ASSERT().
+
+ @param[in] TokenNumber The PCD token number.
+ @param[out] PcdInfo The returned information associated with the requested TokenNumber.
+ The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfo (
+ IN UINTN TokenNumber,
+ OUT PCD_INFO *PcdInfo
+ )
+{
+ ASSERT (FALSE);
+}
+
+/**
+ Retrieve additional information associated with a PCD token.
+
+ This includes information such as the type of value the TokenNumber is associated with as well as possible
+ human readable name that is associated with the token.
+
+ If TokenNumber is not in the token space specified by Guid, then ASSERT().
+
+ @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
+ @param[in] TokenNumber The PCD token number.
+ @param[out] PcdInfo The returned information associated with the requested TokenNumber.
+ The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfoEx (
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ OUT PCD_INFO *PcdInfo
+ )
+{
+ ASSERT (FALSE);
+}
+
+/**
+ Retrieve the currently set SKU Id.
+
+ If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().
+
+ @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
+ default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
+ Id is returned.
+**/
+UINTN
+EFIAPI
+LibPcdGetSku (
+ VOID
+ )
+{
+ ASSERT (FALSE);
+
+ return 0;
+}
+
diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.c b/MdePkg/Library/DxePcdLib/DxePcdLib.c
index cd8212824f..bc87c4e6a1 100644
--- a/MdePkg/Library/DxePcdLib/DxePcdLib.c
+++ b/MdePkg/Library/DxePcdLib/DxePcdLib.c
@@ -18,17 +18,23 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/Pcd.h>
#include <Protocol/PiPcd.h>
+#include <Protocol/PcdInfo.h>
+#include <Protocol/PiPcdInfo.h>
#include <Library/PcdLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseMemoryLib.h>
-PCD_PROTOCOL *mPcd = NULL;
-EFI_PCD_PROTOCOL *mPiPcd = NULL;
+PCD_PROTOCOL *mPcd = NULL;
+EFI_PCD_PROTOCOL *mPiPcd = NULL;
+GET_PCD_INFO_PROTOCOL *mPcdInfo = NULL;
+EFI_GET_PCD_INFO_PROTOCOL *mPiPcdInfo = NULL;
/**
Retrieves the PI PCD protocol from the handle database.
+
+ @retval EFI_PCD_PROTOCOL * The pointer to the EFI_PCD_PROTOCOL.
**/
EFI_PCD_PROTOCOL *
EFIAPI
@@ -52,6 +58,8 @@ GetPiPcdProtocol (
/**
Retrieves the PCD protocol from the handle database.
+
+ @retval PCD_PROTOCOL * The pointer to the PCD_PROTOCOL.
**/
PCD_PROTOCOL *
EFIAPI
@@ -73,6 +81,45 @@ GetPcdProtocol (
return mPcd;
}
+/**
+ Retrieves the PI PCD info protocol from the handle database.
+
+ @retval EFI_GET_PCD_INFO_PROTOCOL * The pointer to the EFI_GET_PCD_INFO_PROTOCOL defined in PI 1.2.1 Vol 3.
+**/
+EFI_GET_PCD_INFO_PROTOCOL *
+GetPiPcdInfoProtocolPointer (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mPiPcdInfo == NULL) {
+ Status = gBS->LocateProtocol (&gEfiGetPcdInfoProtocolGuid, NULL, (VOID **)&mPiPcdInfo);
+ ASSERT_EFI_ERROR (Status);
+ ASSERT (mPiPcdInfo != NULL);
+ }
+ return mPiPcdInfo;
+}
+
+/**
+ Retrieves the PCD info protocol from the handle database.
+
+ @retval GET_PCD_INFO_PROTOCOL * The pointer to the GET_PCD_INFO_PROTOCOL.
+**/
+GET_PCD_INFO_PROTOCOL *
+GetPcdInfoProtocolPointer (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mPcdInfo == NULL) {
+ Status = gBS->LocateProtocol (&gGetPcdInfoProtocolGuid, NULL, (VOID **)&mPcdInfo);
+ ASSERT_EFI_ERROR (Status);
+ ASSERT (mPcdInfo != NULL);
+ }
+ return mPcdInfo;
+}
/**
This function provides a means by which SKU support can be established in the PCD infrastructure.
@@ -1037,5 +1084,78 @@ LibPatchPcdSetPtr (
return (VOID *) Buffer;
}
+/**
+ Retrieve additional information associated with a PCD token.
+
+ This includes information such as the type of value the TokenNumber is associated with as well as possible
+ human readable name that is associated with the token.
+
+ If TokenNumber is not in the default token space specified, then ASSERT().
+ @param[in] TokenNumber The PCD token number.
+ @param[out] PcdInfo The returned information associated with the requested TokenNumber.
+ The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfo (
+ IN UINTN TokenNumber,
+ OUT PCD_INFO *PcdInfo
+ )
+{
+ EFI_STATUS Status;
+
+ Status = GetPcdInfoProtocolPointer()->GetInfo (TokenNumber, (EFI_PCD_INFO *) PcdInfo);
+ ASSERT_EFI_ERROR (Status);
+}
+
+/**
+ Retrieve additional information associated with a PCD token.
+
+ This includes information such as the type of value the TokenNumber is associated with as well as possible
+ human readable name that is associated with the token.
+
+ If TokenNumber is not in the token space specified by Guid, then ASSERT().
+
+ @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
+ @param[in] TokenNumber The PCD token number.
+ @param[out] PcdInfo The returned information associated with the requested TokenNumber.
+ The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfoEx (
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ OUT PCD_INFO *PcdInfo
+ )
+{
+ EFI_STATUS Status;
+
+ Status = GetPiPcdInfoProtocolPointer()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *) PcdInfo);
+ ASSERT_EFI_ERROR (Status);
+}
+
+/**
+ Retrieve the currently set SKU Id.
+
+ If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().
+
+ @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
+ default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
+ Id is returned.
+**/
+UINTN
+EFIAPI
+LibPcdGetSku (
+ VOID
+ )
+{
+ UINTN SkuId;
+
+ SkuId = GetPiPcdInfoProtocolPointer()->GetSku ();
+ ASSERT (SkuId < PCD_MAX_SKU_ID);
+
+ return SkuId;
+}
diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.inf b/MdePkg/Library/DxePcdLib/DxePcdLib.inf
index db06967c9a..a520f069bd 100644
--- a/MdePkg/Library/DxePcdLib/DxePcdLib.inf
+++ b/MdePkg/Library/DxePcdLib/DxePcdLib.inf
@@ -1,7 +1,7 @@
## @file
# Instance of PCD Library using PCD Protocol.
#
-# There are two PCD PPIs as follows:
+# There are two PCD PROTOCOLs as follows:
# 1) PCD_PROTOCOL
# It is EDKII implementation which support Dynamic/DynamicEx Pcds.
# 2) EFI_PCD_PROTOCOL
@@ -13,7 +13,7 @@
# 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 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -54,6 +54,8 @@
[Protocols]
gPcdProtocolGuid ## CONSUMES
gEfiPcdProtocolGuid ## CONSUMES
+ gGetPcdInfoProtocolGuid ## SOMETIMES_CONSUMES
+ gEfiGetPcdInfoProtocolGuid ## SOMETIMES_CONSUMES
[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER]
gEfiPcdProtocolGuid
diff --git a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
index 0a7efdb44e..a57751f412 100644
--- a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
+++ b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
@@ -20,6 +20,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Ppi/Pcd.h>
#include <Ppi/PiPcd.h>
+#include <Ppi/PcdInfo.h>
+#include <Ppi/PiPcdInfo.h>
#include <Library/PeiServicesLib.h>
#include <Library/PcdLib.h>
@@ -71,7 +73,53 @@ GetPiPcdPpiPointer (
return PiPcdPpi;
}
+
+/**
+ Retrieve the GET_PCD_INFO_PPI pointer.
+
+ This function is to locate GET_PCD_INFO_PPI PPI via PeiService.
+ If fail to locate GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().
+
+ @retval GET_PCD_INFO_PPI * The pointer to the GET_PCD_INFO_PPI.
+
+**/
+GET_PCD_INFO_PPI *
+GetPcdInfoPpiPointer (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ GET_PCD_INFO_PPI *PcdInfoPpi;
+
+ Status = PeiServicesLocatePpi (&gGetPcdInfoPpiGuid, 0, NULL, (VOID **)&PcdInfoPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ return PcdInfoPpi;
+}
+
+/**
+ Retrieve the pointer of EFI_GET_PCD_INFO_PPI defined in PI 1.2.1 Vol 3.
+
+ This function is to locate EFI_GET_PCD_INFO_PPI PPI via PeiService.
+ If fail to locate EFI_GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().
+
+ @retval EFI_GET_PCD_INFO_PPI * The pointer to the EFI_GET_PCD_INFO_PPI.
+
+**/
+EFI_GET_PCD_INFO_PPI *
+GetPiPcdInfoPpiPointer (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_GET_PCD_INFO_PPI *PiPcdInfoPpi;
+ Status = PeiServicesLocatePpi (&gEfiGetPcdInfoPpiGuid, 0, NULL, (VOID **)&PiPcdInfoPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ return PiPcdInfoPpi;
+}
+
/**
This function provides a means by which SKU support can be established in the PCD infrastructure.
@@ -1044,4 +1092,77 @@ LibPatchPcdSetPtr (
return (VOID *) Buffer;
}
+/**
+ Retrieve additional information associated with a PCD token.
+
+ This includes information such as the type of value the TokenNumber is associated with as well as possible
+ human readable name that is associated with the token.
+ If TokenNumber is not in the default token space specified, then ASSERT().
+
+ @param[in] TokenNumber The PCD token number.
+ @param[out] PcdInfo The returned information associated with the requested TokenNumber.
+ The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfo (
+ IN UINTN TokenNumber,
+ OUT PCD_INFO *PcdInfo
+ )
+{
+ EFI_STATUS Status;
+
+ Status = GetPcdInfoPpiPointer()->GetInfo (TokenNumber, (EFI_PCD_INFO *) PcdInfo);
+ ASSERT_EFI_ERROR (Status);
+}
+
+/**
+ Retrieve additional information associated with a PCD token.
+
+ This includes information such as the type of value the TokenNumber is associated with as well as possible
+ human readable name that is associated with the token.
+
+ If TokenNumber is not in the token space specified by Guid, then ASSERT().
+
+ @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
+ @param[in] TokenNumber The PCD token number.
+ @param[out] PcdInfo The returned information associated with the requested TokenNumber.
+ The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfoEx (
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ OUT PCD_INFO *PcdInfo
+ )
+{
+ EFI_STATUS Status;
+
+ Status = GetPiPcdInfoPpiPointer()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *) PcdInfo);
+ ASSERT_EFI_ERROR (Status);
+}
+
+/**
+ Retrieve the currently set SKU Id.
+
+ If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().
+
+ @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
+ default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
+ Id is returned.
+**/
+UINTN
+EFIAPI
+LibPcdGetSku (
+ VOID
+ )
+{
+ UINTN SkuId;
+
+ SkuId = GetPiPcdInfoPpiPointer()->GetSku ();
+ ASSERT (SkuId < PCD_MAX_SKU_ID);
+
+ return SkuId;
+}
diff --git a/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf b/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
index 814c8f6a9b..b9d88eff82 100644
--- a/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+++ b/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
@@ -15,7 +15,7 @@
#
# PCD Library that uses the PCD PPI to access Dynamic and DynamicEx PCD entries
#
-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -57,7 +57,9 @@
[Ppis]
gPcdPpiGuid ## CONSUMES
gEfiPeiPcdPpiGuid ## CONSUMES
-
+ gGetPcdInfoPpiGuid ## SOMETIMES_CONSUMES
+ gEfiGetPcdInfoPpiGuid ## SOMETIMES_CONSUMES
+
[Depex.common.PEIM]
gEfiPeiPcdPpiGuid
- \ No newline at end of file
+