mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/CpuDxe: Get CPU BIST information from Guided HOB
Get CPU BIST information from gEfiSecPlatformInformation2PpiGuid or gEfiSecPlatformInformationPpiGuid Guided HOB and update the CPU healthy status for CPU MP Service. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17641 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
8c5f799b4f
commit
db61e16308
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# Simple CPU driver installs CPU Architecture Protocol.
|
# Simple CPU driver installs CPU Architecture Protocol.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -43,6 +43,8 @@
|
||||||
CpuExceptionHandlerLib
|
CpuExceptionHandlerLib
|
||||||
TimerLib
|
TimerLib
|
||||||
SynchronizationLib
|
SynchronizationLib
|
||||||
|
HobLib
|
||||||
|
ReportStatusCodeLib
|
||||||
|
|
||||||
[Sources]
|
[Sources]
|
||||||
ApStartup.c
|
ApStartup.c
|
||||||
|
@ -77,6 +79,10 @@
|
||||||
gIdleLoopEventGuid ## CONSUMES ## Event
|
gIdleLoopEventGuid ## CONSUMES ## Event
|
||||||
gEfiVectorHandoffTableGuid ## SOMETIMES_CONSUMES ## SystemTable
|
gEfiVectorHandoffTableGuid ## SOMETIMES_CONSUMES ## SystemTable
|
||||||
|
|
||||||
|
[Ppis]
|
||||||
|
gEfiSecPlatformInformation2PpiGuid ## UNDEFINED # HOB
|
||||||
|
gEfiSecPlatformInformationPpiGuid ## UNDEFINED # HOB
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## CONSUMES
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## CONSUMES
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize ## CONSUMES
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize ## CONSUMES
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
CPU DXE Module.
|
CPU DXE Module.
|
||||||
|
|
||||||
Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -1520,6 +1520,89 @@ InitMpSystemData (
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Collects BIST data from HOB.
|
||||||
|
|
||||||
|
This function collects BIST data from HOB built from Sec Platform Information
|
||||||
|
PPI or SEC Platform Information2 PPI.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
CollectBistDataFromHob (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_HOB_GUID_TYPE *GuidHob;
|
||||||
|
EFI_SEC_PLATFORM_INFORMATION_RECORD2 *SecPlatformInformation2;
|
||||||
|
EFI_SEC_PLATFORM_INFORMATION_RECORD *SecPlatformInformation;
|
||||||
|
UINTN NumberOfData;
|
||||||
|
EFI_SEC_PLATFORM_INFORMATION_CPU *CpuInstance;
|
||||||
|
EFI_SEC_PLATFORM_INFORMATION_CPU BspCpuInstance;
|
||||||
|
UINTN ProcessorNumber;
|
||||||
|
UINT32 InitialLocalApicId;
|
||||||
|
CPU_DATA_BLOCK *CpuData;
|
||||||
|
|
||||||
|
SecPlatformInformation2 = NULL;
|
||||||
|
SecPlatformInformation = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get gEfiSecPlatformInformation2PpiGuid Guided HOB firstly
|
||||||
|
//
|
||||||
|
GuidHob = GetFirstGuidHob (&gEfiSecPlatformInformation2PpiGuid);
|
||||||
|
if (GuidHob != NULL) {
|
||||||
|
//
|
||||||
|
// Sec Platform Information2 PPI includes BSP/APs' BIST information
|
||||||
|
//
|
||||||
|
SecPlatformInformation2 = GET_GUID_HOB_DATA (GuidHob);
|
||||||
|
NumberOfData = SecPlatformInformation2->NumberOfCpus;
|
||||||
|
CpuInstance = SecPlatformInformation2->CpuInstance;
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Otherwise, get gEfiSecPlatformInformationPpiGuid Guided HOB
|
||||||
|
//
|
||||||
|
GuidHob = GetFirstGuidHob (&gEfiSecPlatformInformationPpiGuid);
|
||||||
|
if (GuidHob != NULL) {
|
||||||
|
SecPlatformInformation = GET_GUID_HOB_DATA (GuidHob);
|
||||||
|
NumberOfData = 1;
|
||||||
|
//
|
||||||
|
// SEC Platform Information only includes BSP's BIST information
|
||||||
|
// does not have BSP's APIC ID
|
||||||
|
//
|
||||||
|
BspCpuInstance.CpuLocation = GetApicId ();
|
||||||
|
BspCpuInstance.InfoRecord.IA32HealthFlags.Uint32 = SecPlatformInformation->IA32HealthFlags.Uint32;
|
||||||
|
CpuInstance = &BspCpuInstance;
|
||||||
|
} else {
|
||||||
|
DEBUG ((EFI_D_INFO, "Does not find any HOB stored CPU BIST information!\n"));
|
||||||
|
//
|
||||||
|
// Does not find any HOB stored BIST information
|
||||||
|
//
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (NumberOfData--) {
|
||||||
|
for (ProcessorNumber = 0; ProcessorNumber < mMpSystemData.NumberOfProcessors; ProcessorNumber++) {
|
||||||
|
CpuData = &mMpSystemData.CpuDatas[ProcessorNumber];
|
||||||
|
InitialLocalApicId = (UINT32) CpuData->Info.ProcessorId;
|
||||||
|
if (InitialLocalApicId == CpuInstance[NumberOfData].CpuLocation) {
|
||||||
|
//
|
||||||
|
// Update CPU health status for MP Services Protocol according to BIST data.
|
||||||
|
//
|
||||||
|
if (CpuInstance[NumberOfData].InfoRecord.IA32HealthFlags.Uint32 != 0) {
|
||||||
|
CpuData->Info.StatusFlag &= ~PROCESSOR_HEALTH_STATUS_BIT;
|
||||||
|
//
|
||||||
|
// Report Status Code that self test is failed
|
||||||
|
//
|
||||||
|
REPORT_STATUS_CODE (
|
||||||
|
EFI_ERROR_CODE | EFI_ERROR_MAJOR,
|
||||||
|
(EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Callback function for ExitBootServices.
|
Callback function for ExitBootServices.
|
||||||
|
|
||||||
|
@ -1597,6 +1680,11 @@ InitializeMpSupport (
|
||||||
|
|
||||||
mAPsAlreadyInitFinished = TRUE;
|
mAPsAlreadyInitFinished = TRUE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update CPU healthy information from Guided HOB
|
||||||
|
//
|
||||||
|
CollectBistDataFromHob ();
|
||||||
|
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&mMpServiceHandle,
|
&mMpServiceHandle,
|
||||||
&gEfiMpServiceProtocolGuid, &mMpServicesTemplate,
|
&gEfiMpServiceProtocolGuid, &mMpServicesTemplate,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
CPU DXE MP support
|
CPU DXE MP support
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -15,8 +15,12 @@
|
||||||
#ifndef _CPU_MP_H_
|
#ifndef _CPU_MP_H_
|
||||||
#define _CPU_MP_H_
|
#define _CPU_MP_H_
|
||||||
|
|
||||||
|
#include <Ppi/SecPlatformInformation.h>
|
||||||
|
#include <Ppi/SecPlatformInformation2.h>
|
||||||
#include <Protocol/MpService.h>
|
#include <Protocol/MpService.h>
|
||||||
#include <Library/SynchronizationLib.h>
|
#include <Library/SynchronizationLib.h>
|
||||||
|
#include <Library/HobLib.h>
|
||||||
|
#include <Library/ReportStatusCodeLib.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize Multi-processor support.
|
Initialize Multi-processor support.
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
## @file
|
## @file
|
||||||
# UefiCpuPkg Package
|
# UefiCpuPkg Package
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
|
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
|
||||||
LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
|
LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
|
||||||
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
|
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
|
||||||
CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
|
CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
|
||||||
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
|
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
|
||||||
|
|
||||||
[LibraryClasses.common.PEIM]
|
[LibraryClasses.common.PEIM]
|
||||||
|
@ -64,14 +64,15 @@
|
||||||
|
|
||||||
[LibraryClasses.IPF.PEIM]
|
[LibraryClasses.IPF.PEIM]
|
||||||
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointerLibKr7.inf
|
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointerLibKr7.inf
|
||||||
|
|
||||||
[LibraryClasses.common.DXE_DRIVER]
|
[LibraryClasses.common.DXE_DRIVER]
|
||||||
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
|
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
|
||||||
|
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
||||||
|
|
||||||
[LibraryClasses.common.DXE_SMM_DRIVER]
|
[LibraryClasses.common.DXE_SMM_DRIVER]
|
||||||
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
|
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
|
||||||
MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
|
MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
|
||||||
|
|
||||||
#
|
#
|
||||||
# Drivers/Libraries within this package
|
# Drivers/Libraries within this package
|
||||||
#
|
#
|
||||||
|
@ -90,6 +91,6 @@
|
||||||
UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
|
UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
|
||||||
UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
|
UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
|
||||||
UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
|
UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
|
||||||
UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
|
UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
|
||||||
UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
|
UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue