\r
#include <Ppi/Pcd.h>\r
#include <Ppi/PiPcd.h>\r
+#include <Ppi/PcdInfo.h>\r
+#include <Ppi/PiPcdInfo.h>\r
\r
#include <Library/PeiServicesLib.h>\r
#include <Library/PcdLib.h>\r
\r
return PiPcdPpi;\r
} \r
+\r
+/**\r
+ Retrieve the GET_PCD_INFO_PPI pointer.\r
+\r
+ This function is to locate GET_PCD_INFO_PPI PPI via PeiService. \r
+ If fail to locate GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().\r
+\r
+ @retval GET_PCD_INFO_PPI * The pointer to the GET_PCD_INFO_PPI.\r
+\r
+**/\r
+GET_PCD_INFO_PPI *\r
+GetPcdInfoPpiPointer (\r
+ VOID\r
+ ) \r
+{\r
+ EFI_STATUS Status;\r
+ GET_PCD_INFO_PPI *PcdInfoPpi;\r
+ \r
+ Status = PeiServicesLocatePpi (&gGetPcdInfoPpiGuid, 0, NULL, (VOID **)&PcdInfoPpi);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return PcdInfoPpi;\r
+}\r
+\r
+/**\r
+ Retrieve the pointer of EFI_GET_PCD_INFO_PPI defined in PI 1.2.1 Vol 3.\r
+\r
+ This function is to locate EFI_GET_PCD_INFO_PPI PPI via PeiService. \r
+ If fail to locate EFI_GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().\r
+\r
+ @retval EFI_GET_PCD_INFO_PPI * The pointer to the EFI_GET_PCD_INFO_PPI.\r
+\r
+**/\r
+EFI_GET_PCD_INFO_PPI *\r
+GetPiPcdInfoPpiPointer (\r
+ VOID\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_GET_PCD_INFO_PPI *PiPcdInfoPpi;\r
\r
+ Status = PeiServicesLocatePpi (&gEfiGetPcdInfoPpiGuid, 0, NULL, (VOID **)&PiPcdInfoPpi);\r
+ ASSERT_EFI_ERROR (Status);\r
+ \r
+ return PiPcdInfoPpi;\r
+} \r
+\r
/**\r
This function provides a means by which SKU support can be established in the PCD infrastructure.\r
\r
return (VOID *) Buffer;\r
}\r
\r
+/**\r
+ Retrieve additional information associated with a PCD token.\r
+\r
+ This includes information such as the type of value the TokenNumber is associated with as well as possible\r
+ human readable name that is associated with the token.\r
\r
+ If TokenNumber is not in the default token space specified, then ASSERT().\r
+\r
+ @param[in] TokenNumber The PCD token number.\r
+ @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r
+ The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r
+**/\r
+VOID\r
+EFIAPI\r
+LibPcdGetInfo (\r
+ IN UINTN TokenNumber,\r
+ OUT PCD_INFO *PcdInfo\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = GetPcdInfoPpiPointer()->GetInfo (TokenNumber, (EFI_PCD_INFO *) PcdInfo);\r
+ ASSERT_EFI_ERROR (Status);\r
+}\r
+\r
+/**\r
+ Retrieve additional information associated with a PCD token.\r
+\r
+ This includes information such as the type of value the TokenNumber is associated with as well as possible\r
+ human readable name that is associated with the token.\r
+\r
+ If TokenNumber is not in the token space specified by Guid, then ASSERT().\r
+\r
+ @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
+ @param[in] TokenNumber The PCD token number.\r
+ @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r
+ The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r
+**/\r
+VOID\r
+EFIAPI\r
+LibPcdGetInfoEx (\r
+ IN CONST GUID *Guid,\r
+ IN UINTN TokenNumber,\r
+ OUT PCD_INFO *PcdInfo\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = GetPiPcdInfoPpiPointer()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *) PcdInfo);\r
+ ASSERT_EFI_ERROR (Status);\r
+}\r
+\r
+/**\r
+ Retrieve the currently set SKU Id.\r
+\r
+ If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().\r
+\r
+ @return The currently set SKU Id. If the platform has not set at a SKU Id, then the\r
+ default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU\r
+ Id is returned.\r
+**/\r
+UINTN\r
+EFIAPI\r
+LibPcdGetSku (\r
+ VOID\r
+ )\r
+{\r
+ UINTN SkuId;\r
+\r
+ SkuId = GetPiPcdInfoPpiPointer()->GetSku ();\r
+ ASSERT (SkuId < PCD_MAX_SKU_ID);\r
+\r
+ return SkuId;\r
+}\r