PeiPcdGetNextTokenSpace\r
};\r
\r
+///\r
+/// Instance of GET_PCD_INFO_PPI protocol is EDKII native implementation.\r
+/// This protocol instance support dynamic and dynamicEx type PCDs.\r
+///\r
+GET_PCD_INFO_PPI mGetPcdInfoInstance = {\r
+ PeiGetPcdInfoGetInfo,\r
+ PeiGetPcdInfoGetInfoEx,\r
+ PeiGetPcdInfoGetSku\r
+};\r
+\r
+///\r
+/// Instance of EFI_GET_PCD_INFO_PPI which is defined in PI 1.2.1 Vol 3.\r
+/// This PPI instance only support dyanmicEx type PCD.\r
+///\r
+EFI_GET_PCD_INFO_PPI mEfiGetPcdInfoInstance = {\r
+ PeiGetPcdInfoGetInfoEx,\r
+ PeiGetPcdInfoGetSku\r
+};\r
+\r
EFI_PEI_PPI_DESCRIPTOR mPpiList[] = {\r
{\r
EFI_PEI_PPI_DESCRIPTOR_PPI,\r
}\r
};\r
\r
+EFI_PEI_PPI_DESCRIPTOR mPpiList2[] = {\r
+ {\r
+ EFI_PEI_PPI_DESCRIPTOR_PPI,\r
+ &gGetPcdInfoPpiGuid,\r
+ &mGetPcdInfoInstance\r
+ },\r
+ {\r
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
+ &gEfiGetPcdInfoPpiGuid,\r
+ &mEfiGetPcdInfoInstance\r
+ }\r
+};\r
+\r
/**\r
Main entry for PCD PEIM driver.\r
\r
IN CONST EFI_PEI_SERVICES **PeiServices\r
)\r
{\r
- EFI_STATUS Status;\r
- \r
- BuildPcdDatabase (FileHandle);\r
+ EFI_STATUS Status;\r
+ PEI_PCD_DATABASE *DataBase;\r
+\r
+ DataBase = BuildPcdDatabase (FileHandle);\r
\r
//\r
// Install PCD_PPI and EFI_PEI_PCD_PPI.\r
//\r
Status = PeiServicesInstallPpi (&mPpiList[0]);\r
ASSERT_EFI_ERROR (Status);\r
- \r
+\r
+ //\r
+ // Only install PcdInfo PPI when the feature is enabled and PCD info content is present. \r
+ //\r
+ if (FeaturePcdGet (PcdPcdInfoGeneration) && (DataBase->PcdNameTableOffset != 0)) {\r
+ //\r
+ // Install GET_PCD_INFO_PPI and EFI_GET_PCD_INFO_PPI.\r
+ //\r
+ Status = PeiServicesInstallPpi (&mPpiList2[0]);\r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
+\r
return Status;\r
}\r
\r
+/**\r
+ Retrieve additional information associated with a PCD token in the default token space.\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
+ @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
+ @retval EFI_SUCCESS The PCD information was returned successfully.\r
+ @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiGetPcdInfoGetInfo (\r
+ IN UINTN TokenNumber,\r
+ OUT EFI_PCD_INFO *PcdInfo\r
+ )\r
+{\r
+ return PeiGetPcdInfo (NULL, TokenNumber, PcdInfo);\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
+ @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
+ @retval EFI_SUCCESS The PCD information was returned successfully.\r
+ @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiGetPcdInfoGetInfoEx (\r
+ IN CONST EFI_GUID *Guid,\r
+ IN UINTN TokenNumber,\r
+ OUT EFI_PCD_INFO *PcdInfo\r
+ )\r
+{\r
+ return PeiGetPcdInfo (Guid, TokenNumber, PcdInfo);\r
+}\r
+\r
+/**\r
+ Retrieve the currently set SKU Id.\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
+PeiGetPcdInfoGetSku (\r
+ VOID\r
+ )\r
+{\r
+ if (!FeaturePcdGet (PcdPcdInfoGeneration)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ return GetPcdDatabase()->SystemSkuId;\r
+}\r
+\r
/**\r
Sets the SKU value for subsequent calls to set or get PCD token values.\r
\r