mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/CpuMpPei: Build GUIDed-HOB to store all CPU BIST Data
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>
This commit is contained in:
parent
8dc56ddeca
commit
8643299420
|
@ -44,34 +44,29 @@ SecPlatformInformation2 (
|
||||||
OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2
|
OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN BistInformationSize;
|
EFI_HOB_GUID_TYPE *GuidHob;
|
||||||
UINTN CpuIndex;
|
VOID *DataInHob;
|
||||||
EFI_SEC_PLATFORM_INFORMATION_CPU *CpuInstance;
|
UINTN DataSize;
|
||||||
EFI_PROCESSOR_INFORMATION ProcessorInfo;
|
|
||||||
EFI_HEALTH_FLAGS BistData;
|
|
||||||
UINTN NumberOfProcessors;
|
|
||||||
UINTN NumberOfEnabledProcessors;
|
|
||||||
|
|
||||||
MpInitLibGetNumberOfProcessors(&NumberOfProcessors, &NumberOfEnabledProcessors);
|
GuidHob = GetFirstGuidHob (&gEfiSecPlatformInformation2PpiGuid);
|
||||||
|
if (GuidHob == NULL) {
|
||||||
|
*StructureSize = 0;
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataInHob = GET_GUID_HOB_DATA (GuidHob);
|
||||||
|
DataSize = GET_GUID_HOB_DATA_SIZE (GuidHob);
|
||||||
|
|
||||||
BistInformationSize = sizeof (EFI_SEC_PLATFORM_INFORMATION_RECORD2) +
|
|
||||||
sizeof (EFI_SEC_PLATFORM_INFORMATION_CPU) * NumberOfProcessors;
|
|
||||||
//
|
//
|
||||||
// return the information size if input buffer size is too small
|
// return the information from BistHob
|
||||||
//
|
//
|
||||||
if ((*StructureSize) < (UINT64) BistInformationSize) {
|
if ((*StructureSize) < (UINT64) DataSize) {
|
||||||
*StructureSize = (UINT64) BistInformationSize;
|
*StructureSize = (UINT64) DataSize;
|
||||||
return EFI_BUFFER_TOO_SMALL;
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlatformInformationRecord2->NumberOfCpus = (UINT32)NumberOfProcessors;
|
*StructureSize = (UINT64) DataSize;
|
||||||
CpuInstance = PlatformInformationRecord2->CpuInstance;
|
CopyMem (PlatformInformationRecord2, DataInHob, DataSize);
|
||||||
for (CpuIndex = 0; CpuIndex < NumberOfProcessors; CpuIndex ++) {
|
|
||||||
MpInitLibGetProcessorInfo (CpuIndex, &ProcessorInfo, &BistData);
|
|
||||||
CpuInstance[CpuIndex].CpuLocation = (UINT32) ProcessorInfo.ProcessorId;
|
|
||||||
CpuInstance[CpuIndex].InfoRecord.IA32HealthFlags = BistData;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,14 +176,26 @@ CollectBistDataFromPpi (
|
||||||
EFI_HEALTH_FLAGS BistData;
|
EFI_HEALTH_FLAGS BistData;
|
||||||
UINTN NumberOfProcessors;
|
UINTN NumberOfProcessors;
|
||||||
UINTN NumberOfEnabledProcessors;
|
UINTN NumberOfEnabledProcessors;
|
||||||
|
UINTN BistInformationSize;
|
||||||
|
EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2;
|
||||||
|
EFI_SEC_PLATFORM_INFORMATION_CPU *CpuInstanceInHob;
|
||||||
|
|
||||||
|
|
||||||
MpInitLibGetNumberOfProcessors(&NumberOfProcessors, &NumberOfEnabledProcessors);
|
MpInitLibGetNumberOfProcessors(&NumberOfProcessors, &NumberOfEnabledProcessors);
|
||||||
|
|
||||||
|
BistInformationSize = sizeof (EFI_SEC_PLATFORM_INFORMATION_RECORD2) +
|
||||||
|
sizeof (EFI_SEC_PLATFORM_INFORMATION_CPU) * NumberOfProcessors;
|
||||||
|
Status = PeiServicesAllocatePool (
|
||||||
|
(UINTN) BistInformationSize,
|
||||||
|
(VOID **) &PlatformInformationRecord2
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
PlatformInformationRecord2->NumberOfCpus = (UINT32)NumberOfProcessors;
|
||||||
|
|
||||||
SecPlatformInformation2 = NULL;
|
SecPlatformInformation2 = NULL;
|
||||||
SecPlatformInformation = NULL;
|
SecPlatformInformation = NULL;
|
||||||
NumberOfData = 0;
|
NumberOfData = 0;
|
||||||
CpuInstance = NULL;
|
CpuInstance = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get BIST information from Sec Platform Information2 Ppi firstly
|
// Get BIST information from Sec Platform Information2 Ppi firstly
|
||||||
//
|
//
|
||||||
|
@ -253,8 +260,21 @@ CollectBistDataFromPpi (
|
||||||
(UINT32) ProcessorInfo.ProcessorId,
|
(UINT32) ProcessorInfo.ProcessorId,
|
||||||
BistData
|
BistData
|
||||||
));
|
));
|
||||||
|
CpuInstanceInHob = PlatformInformationRecord2->CpuInstance;
|
||||||
|
CpuInstanceInHob[ProcessorNumber].CpuLocation = (UINT32) ProcessorInfo.ProcessorId;
|
||||||
|
CpuInstanceInHob[ProcessorNumber].InfoRecord.IA32HealthFlags = BistData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Build SecPlatformInformation2 PPI GUIDed HOB that also could be consumed
|
||||||
|
// by CPU MP driver to get CPU BIST data
|
||||||
|
//
|
||||||
|
BuildGuidDataHob (
|
||||||
|
&gEfiSecPlatformInformation2PpiGuid,
|
||||||
|
PlatformInformationRecord2,
|
||||||
|
(UINTN) BistInformationSize
|
||||||
|
);
|
||||||
|
|
||||||
if (SecPlatformInformation2 != NULL && NumberOfData < NumberOfProcessors) {
|
if (SecPlatformInformation2 != NULL && NumberOfData < NumberOfProcessors) {
|
||||||
//
|
//
|
||||||
// Reinstall SecPlatformInformation2 PPI to include new BIST information
|
// Reinstall SecPlatformInformation2 PPI to include new BIST information
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <Library/ReportStatusCodeLib.h>
|
#include <Library/ReportStatusCodeLib.h>
|
||||||
#include <Library/CpuExceptionHandlerLib.h>
|
#include <Library/CpuExceptionHandlerLib.h>
|
||||||
#include <Library/MpInitLib.h>
|
#include <Library/MpInitLib.h>
|
||||||
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
|
||||||
extern EFI_PEI_PPI_DESCRIPTOR mPeiCpuMpPpiDesc;
|
extern EFI_PEI_PPI_DESCRIPTOR mPeiCpuMpPpiDesc;
|
||||||
|
|
||||||
|
|
|
@ -47,12 +47,14 @@
|
||||||
ReportStatusCodeLib
|
ReportStatusCodeLib
|
||||||
CpuExceptionHandlerLib
|
CpuExceptionHandlerLib
|
||||||
MpInitLib
|
MpInitLib
|
||||||
|
BaseMemoryLib
|
||||||
|
|
||||||
[Ppis]
|
[Ppis]
|
||||||
gEfiPeiMpServicesPpiGuid ## PRODUCES
|
gEfiPeiMpServicesPpiGuid ## PRODUCES
|
||||||
gEfiSecPlatformInformationPpiGuid ## SOMETIMES_CONSUMES
|
gEfiSecPlatformInformationPpiGuid ## SOMETIMES_CONSUMES
|
||||||
## SOMETIMES_CONSUMES
|
## SOMETIMES_CONSUMES
|
||||||
## SOMETIMES_PRODUCES
|
## PRODUCES
|
||||||
|
## UNDEFINED # HOB
|
||||||
gEfiSecPlatformInformation2PpiGuid
|
gEfiSecPlatformInformation2PpiGuid
|
||||||
gEfiVectorHandoffInfoPpiGuid ## SOMETIMES_CONSUMES
|
gEfiVectorHandoffInfoPpiGuid ## SOMETIMES_CONSUMES
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue