summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8dc56dd)
Build gEfiSecPlatformInformation2PpiGuid GUIDed-HOB to store all CPU BIST data
that could be used not only by SecPlatformInformation2(), but also by CPU MP Dxe
driver to get CPU BIST data.
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>
OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2\r
)\r
{\r
OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2\r
)\r
{\r
- UINTN BistInformationSize;\r
- UINTN CpuIndex;\r
- EFI_SEC_PLATFORM_INFORMATION_CPU *CpuInstance;\r
- EFI_PROCESSOR_INFORMATION ProcessorInfo;\r
- EFI_HEALTH_FLAGS BistData;\r
- UINTN NumberOfProcessors;\r
- UINTN NumberOfEnabledProcessors;\r
+ EFI_HOB_GUID_TYPE *GuidHob;\r
+ VOID *DataInHob;\r
+ UINTN DataSize;\r
- MpInitLibGetNumberOfProcessors(&NumberOfProcessors, &NumberOfEnabledProcessors);\r
+ GuidHob = GetFirstGuidHob (&gEfiSecPlatformInformation2PpiGuid);\r
+ if (GuidHob == NULL) {\r
+ *StructureSize = 0;\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ DataInHob = GET_GUID_HOB_DATA (GuidHob);\r
+ DataSize = GET_GUID_HOB_DATA_SIZE (GuidHob);\r
- BistInformationSize = sizeof (EFI_SEC_PLATFORM_INFORMATION_RECORD2) +\r
- sizeof (EFI_SEC_PLATFORM_INFORMATION_CPU) * NumberOfProcessors;\r
- // return the information size if input buffer size is too small\r
+ // return the information from BistHob\r
- if ((*StructureSize) < (UINT64) BistInformationSize) {\r
- *StructureSize = (UINT64) BistInformationSize;\r
+ if ((*StructureSize) < (UINT64) DataSize) {\r
+ *StructureSize = (UINT64) DataSize;\r
return EFI_BUFFER_TOO_SMALL;\r
}\r
\r
return EFI_BUFFER_TOO_SMALL;\r
}\r
\r
- PlatformInformationRecord2->NumberOfCpus = (UINT32)NumberOfProcessors;\r
- CpuInstance = PlatformInformationRecord2->CpuInstance;\r
- for (CpuIndex = 0; CpuIndex < NumberOfProcessors; CpuIndex ++) {\r
- MpInitLibGetProcessorInfo (CpuIndex, &ProcessorInfo, &BistData);\r
- CpuInstance[CpuIndex].CpuLocation = (UINT32) ProcessorInfo.ProcessorId;\r
- CpuInstance[CpuIndex].InfoRecord.IA32HealthFlags = BistData;\r
- }\r
-\r
+ *StructureSize = (UINT64) DataSize;\r
+ CopyMem (PlatformInformationRecord2, DataInHob, DataSize);\r
return EFI_SUCCESS;\r
}\r
\r
return EFI_SUCCESS;\r
}\r
\r
EFI_HEALTH_FLAGS BistData;\r
UINTN NumberOfProcessors;\r
UINTN NumberOfEnabledProcessors;\r
EFI_HEALTH_FLAGS BistData;\r
UINTN NumberOfProcessors;\r
UINTN NumberOfEnabledProcessors;\r
+ UINTN BistInformationSize;\r
+ EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2;\r
+ EFI_SEC_PLATFORM_INFORMATION_CPU *CpuInstanceInHob;\r
+ \r
\r
MpInitLibGetNumberOfProcessors(&NumberOfProcessors, &NumberOfEnabledProcessors);\r
\r
\r
MpInitLibGetNumberOfProcessors(&NumberOfProcessors, &NumberOfEnabledProcessors);\r
\r
+ BistInformationSize = sizeof (EFI_SEC_PLATFORM_INFORMATION_RECORD2) +\r
+ sizeof (EFI_SEC_PLATFORM_INFORMATION_CPU) * NumberOfProcessors;\r
+ Status = PeiServicesAllocatePool (\r
+ (UINTN) BistInformationSize,\r
+ (VOID **) &PlatformInformationRecord2\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+ PlatformInformationRecord2->NumberOfCpus = (UINT32)NumberOfProcessors;\r
+\r
SecPlatformInformation2 = NULL;\r
SecPlatformInformation = NULL;\r
NumberOfData = 0;\r
CpuInstance = NULL;\r
SecPlatformInformation2 = NULL;\r
SecPlatformInformation = NULL;\r
NumberOfData = 0;\r
CpuInstance = NULL;\r
//\r
// Get BIST information from Sec Platform Information2 Ppi firstly\r
//\r
//\r
// Get BIST information from Sec Platform Information2 Ppi firstly\r
//\r
(UINT32) ProcessorInfo.ProcessorId,\r
BistData\r
));\r
(UINT32) ProcessorInfo.ProcessorId,\r
BistData\r
));\r
+ CpuInstanceInHob = PlatformInformationRecord2->CpuInstance;\r
+ CpuInstanceInHob[ProcessorNumber].CpuLocation = (UINT32) ProcessorInfo.ProcessorId;\r
+ CpuInstanceInHob[ProcessorNumber].InfoRecord.IA32HealthFlags = BistData;\r
+ \r
+ //\r
+ // Build SecPlatformInformation2 PPI GUIDed HOB that also could be consumed\r
+ // by CPU MP driver to get CPU BIST data\r
+ //\r
+ BuildGuidDataHob (\r
+ &gEfiSecPlatformInformation2PpiGuid,\r
+ PlatformInformationRecord2,\r
+ (UINTN) BistInformationSize\r
+ );\r
\r
if (SecPlatformInformation2 != NULL && NumberOfData < NumberOfProcessors) {\r
//\r
\r
if (SecPlatformInformation2 != NULL && NumberOfData < NumberOfProcessors) {\r
//\r
#include <Library/ReportStatusCodeLib.h>\r
#include <Library/CpuExceptionHandlerLib.h>\r
#include <Library/MpInitLib.h>\r
#include <Library/ReportStatusCodeLib.h>\r
#include <Library/CpuExceptionHandlerLib.h>\r
#include <Library/MpInitLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
\r
extern EFI_PEI_PPI_DESCRIPTOR mPeiCpuMpPpiDesc;\r
\r
\r
extern EFI_PEI_PPI_DESCRIPTOR mPeiCpuMpPpiDesc;\r
\r
ReportStatusCodeLib\r
CpuExceptionHandlerLib\r
MpInitLib\r
ReportStatusCodeLib\r
CpuExceptionHandlerLib\r
MpInitLib\r
\r
[Ppis]\r
gEfiPeiMpServicesPpiGuid ## PRODUCES\r
gEfiSecPlatformInformationPpiGuid ## SOMETIMES_CONSUMES\r
## SOMETIMES_CONSUMES\r
\r
[Ppis]\r
gEfiPeiMpServicesPpiGuid ## PRODUCES\r
gEfiSecPlatformInformationPpiGuid ## SOMETIMES_CONSUMES\r
## SOMETIMES_CONSUMES\r
- ## SOMETIMES_PRODUCES\r
+ ## PRODUCES\r
+ ## UNDEFINED # HOB\r
gEfiSecPlatformInformation2PpiGuid\r
gEfiVectorHandoffInfoPpiGuid ## SOMETIMES_CONSUMES\r
\r
gEfiSecPlatformInformation2PpiGuid\r
gEfiVectorHandoffInfoPpiGuid ## SOMETIMES_CONSUMES\r
\r