summaryrefslogtreecommitdiff
path: root/UefiCpuPkg/SecCore/SecBist.c
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2016-09-09 15:14:32 +0800
committerJeff Fan <jeff.fan@intel.com>2016-09-14 08:54:46 +0800
commit8a5b8cef678711060cc9014e0fac1886839de943 (patch)
tree803a1e0cf52f78457e1f70c99184bc9f3714a814 /UefiCpuPkg/SecCore/SecBist.c
parentd157de8b5603fb24feed6ec7b46be8677083c25a (diff)
downloadedk2-8a5b8cef678711060cc9014e0fac1886839de943.zip
edk2-8a5b8cef678711060cc9014e0fac1886839de943.tar.gz
edk2-8a5b8cef678711060cc9014e0fac1886839de943.tar.bz2
UefiCpuPkg/SecCore: Re-install SEC platform information(2) PPI
In SecTemporaryRamDone(), we will build one privated GUIDed-HOB to save CPU BIST Data and re-install SEC platform information(2) PPI. Then other PEI drivers could get CPU BIST data from the private GUIDed-HOB by new installed PPI. Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Feng Tian <feng.tian@Intel.com>
Diffstat (limited to 'UefiCpuPkg/SecCore/SecBist.c')
-rw-r--r--UefiCpuPkg/SecCore/SecBist.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/UefiCpuPkg/SecCore/SecBist.c b/UefiCpuPkg/SecCore/SecBist.c
index 10bebbc..dd5c5e5 100644
--- a/UefiCpuPkg/SecCore/SecBist.c
+++ b/UefiCpuPkg/SecCore/SecBist.c
@@ -14,6 +14,26 @@
#include "SecMain.h"
+EFI_SEC_PLATFORM_INFORMATION_PPI mSecPlatformInformation = {
+ SecPlatformInformationBist
+};
+
+EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformInformation = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiSecPlatformInformationPpiGuid,
+ &mSecPlatformInformation
+};
+
+EFI_SEC_PLATFORM_INFORMATION2_PPI mSecPlatformInformation2 = {
+ SecPlatformInformation2Bist
+};
+
+EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformInformation2 = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiSecPlatformInformation2PpiGuid,
+ &mSecPlatformInformation2
+};
+
/**
Worker function to parse CPU BIST information from Guided HOB.
@@ -179,3 +199,70 @@ GetBistInfoFromPpi (
return EFI_DEVICE_ERROR;
}
+
+/**
+ Get CPUs' BIST by calling SecPlatformInformationPpi/SecPlatformInformation2Ppi.
+
+**/
+VOID
+RepublishSecPlatformInformationPpi (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ UINT64 BistInformationSize;
+ VOID *BistInformationData;
+ EFI_PEI_PPI_DESCRIPTOR *SecInformationDescriptor;
+
+ PeiServices = GetPeiServicesTablePointer ();
+ Status = GetBistInfoFromPpi (
+ PeiServices,
+ &gEfiSecPlatformInformation2PpiGuid,
+ &SecInformationDescriptor,
+ &BistInformationData,
+ &BistInformationSize
+ );
+ if (Status == EFI_SUCCESS) {
+ BuildGuidDataHob (
+ &gEfiCallerIdGuid,
+ BistInformationData,
+ (UINTN) BistInformationSize
+ );
+ //
+ // The old SecPlatformInformation data is on CAR.
+ // After memory discovered, we should never get it from CAR, or the data will be crashed.
+ // So, we reinstall SecPlatformInformation PPI here.
+ //
+ Status = PeiServicesReInstallPpi (
+ SecInformationDescriptor,
+ &mPeiSecPlatformInformation2
+ );
+ } if (Status == EFI_NOT_FOUND) {
+ Status = GetBistInfoFromPpi (
+ PeiServices,
+ &gEfiSecPlatformInformationPpiGuid,
+ &SecInformationDescriptor,
+ &BistInformationData,
+ &BistInformationSize
+ );
+ if (Status == EFI_SUCCESS) {
+ BuildGuidDataHob (
+ &gEfiCallerIdGuid,
+ BistInformationData,
+ (UINTN) BistInformationSize
+ );
+ //
+ // The old SecPlatformInformation2 data is on CAR.
+ // After memory discovered, we should never get it from CAR, or the data will be crashed.
+ // So, we reinstall SecPlatformInformation2 PPI here.
+ //
+ Status = PeiServicesReInstallPpi (
+ SecInformationDescriptor,
+ &mPeiSecPlatformInformation
+ );
+ }
+ }
+
+ ASSERT_EFI_ERROR(Status);
+}