mirror of https://github.com/acidanthera/audk.git
Add [depex] on gEfiMpServiceProtocolGuid so the number of CPUs is known
Add [depex] on gEfiSmmCpuIo2Protocol so we know that the SMM CPU I/O 2 Protocol in the PI SMST is valid git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10037 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
f5501a6512
commit
e906eae4a5
|
@ -30,6 +30,7 @@
|
||||||
#include <Protocol/SmmCpu.h>
|
#include <Protocol/SmmCpu.h>
|
||||||
#include <Protocol/LoadedImage.h>
|
#include <Protocol/LoadedImage.h>
|
||||||
#include <Protocol/SmmCpuSaveState.h>
|
#include <Protocol/SmmCpuSaveState.h>
|
||||||
|
#include <Protocol/MpService.h>
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Structure for tracking paired information of registered Framework SMI handler
|
/// Structure for tracking paired information of registered Framework SMI handler
|
||||||
|
@ -61,6 +62,7 @@ EFI_SMM_CPU_PROTOCOL *mSmmCpu;
|
||||||
EFI_GUID mEfiSmmCpuIoGuid = EFI_SMM_CPU_IO_GUID;
|
EFI_GUID mEfiSmmCpuIoGuid = EFI_SMM_CPU_IO_GUID;
|
||||||
EFI_SMM_BASE_HELPER_READY_PROTOCOL *mSmmBaseHelperReady;
|
EFI_SMM_BASE_HELPER_READY_PROTOCOL *mSmmBaseHelperReady;
|
||||||
EFI_SMM_SYSTEM_TABLE *mFrameworkSmst;
|
EFI_SMM_SYSTEM_TABLE *mFrameworkSmst;
|
||||||
|
UINTN mNumberOfProcessors;
|
||||||
|
|
||||||
LIST_ENTRY mCallbackInfoListHead = INITIALIZE_LIST_HEAD_VARIABLE (mCallbackInfoListHead);
|
LIST_ENTRY mCallbackInfoListHead = INITIALIZE_LIST_HEAD_VARIABLE (mCallbackInfoListHead);
|
||||||
|
|
||||||
|
@ -156,7 +158,7 @@ ConstructFrameworkSmst (
|
||||||
FrameworkSmst->Hdr.Revision = EFI_SMM_SYSTEM_TABLE_REVISION;
|
FrameworkSmst->Hdr.Revision = EFI_SMM_SYSTEM_TABLE_REVISION;
|
||||||
CopyGuid (&FrameworkSmst->EfiSmmCpuIoGuid, &mEfiSmmCpuIoGuid);
|
CopyGuid (&FrameworkSmst->EfiSmmCpuIoGuid, &mEfiSmmCpuIoGuid);
|
||||||
|
|
||||||
FrameworkSmst->CpuSaveState = (EFI_SMM_CPU_SAVE_STATE *)AllocateZeroPool (gSmst->NumberOfCpus * sizeof (EFI_SMM_CPU_SAVE_STATE));
|
FrameworkSmst->CpuSaveState = (EFI_SMM_CPU_SAVE_STATE *)AllocateZeroPool (mNumberOfProcessors * sizeof (EFI_SMM_CPU_SAVE_STATE));
|
||||||
ASSERT (FrameworkSmst->CpuSaveState != NULL);
|
ASSERT (FrameworkSmst->CpuSaveState != NULL);
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -437,7 +439,7 @@ CallbackThunk (
|
||||||
/// and MP states in the Framework SMST.
|
/// and MP states in the Framework SMST.
|
||||||
///
|
///
|
||||||
|
|
||||||
for (CpuIndex = 0; CpuIndex < gSmst->NumberOfCpus; CpuIndex++) {
|
for (CpuIndex = 0; CpuIndex < mNumberOfProcessors; CpuIndex++) {
|
||||||
State = (EFI_SMM_CPU_STATE *)gSmst->CpuSaveState[CpuIndex];
|
State = (EFI_SMM_CPU_STATE *)gSmst->CpuSaveState[CpuIndex];
|
||||||
SaveState = &mFrameworkSmst->CpuSaveState[CpuIndex].Ia32SaveState;
|
SaveState = &mFrameworkSmst->CpuSaveState[CpuIndex].Ia32SaveState;
|
||||||
|
|
||||||
|
@ -487,7 +489,7 @@ CallbackThunk (
|
||||||
///
|
///
|
||||||
/// Save CPU Save States in case any of them was modified
|
/// Save CPU Save States in case any of them was modified
|
||||||
///
|
///
|
||||||
for (CpuIndex = 0; CpuIndex < gSmst->NumberOfCpus; CpuIndex++) {
|
for (CpuIndex = 0; CpuIndex < mNumberOfProcessors; CpuIndex++) {
|
||||||
for (Index = 0; Index < sizeof (mCpuSaveStateConvTable) / sizeof (CPU_SAVE_STATE_CONVERSION); Index++) {
|
for (Index = 0; Index < sizeof (mCpuSaveStateConvTable) / sizeof (CPU_SAVE_STATE_CONVERSION); Index++) {
|
||||||
Status = mSmmCpu->WriteSaveState (
|
Status = mSmmCpu->WriteSaveState (
|
||||||
mSmmCpu,
|
mSmmCpu,
|
||||||
|
@ -676,7 +678,9 @@ SmmBaseHelperMain (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
EFI_MP_SERVICES_PROTOCOL *MpServices;
|
||||||
EFI_HANDLE Handle = NULL;
|
EFI_HANDLE Handle = NULL;
|
||||||
|
UINTN NumberOfEnabledProcessors;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Locate SMM CPU Protocol which is used later to retrieve/update CPU Save States
|
/// Locate SMM CPU Protocol which is used later to retrieve/update CPU Save States
|
||||||
|
@ -684,6 +688,18 @@ SmmBaseHelperMain (
|
||||||
Status = gSmst->SmmLocateProtocol (&gEfiSmmCpuProtocolGuid, NULL, (VOID **) &mSmmCpu);
|
Status = gSmst->SmmLocateProtocol (&gEfiSmmCpuProtocolGuid, NULL, (VOID **) &mSmmCpu);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get MP Services Protocol
|
||||||
|
//
|
||||||
|
Status = SystemTable->BootServices->LocateProtocol (&gEfiMpServiceProtocolGuid, NULL, (VOID **)&MpServices);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Use MP Services Protocol to retrieve the number of processors and number of enabled processors
|
||||||
|
//
|
||||||
|
Status = MpServices->GetNumberOfProcessors (MpServices, &mNumberOfProcessors, &NumberOfEnabledProcessors);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Interface structure of SMM BASE Helper Ready Protocol is allocated from UEFI pool
|
/// Interface structure of SMM BASE Helper Ready Protocol is allocated from UEFI pool
|
||||||
/// instead of SMM pool so that SMM Base Thunk driver can access it in Non-SMM mode.
|
/// instead of SMM pool so that SMM Base Thunk driver can access it in Non-SMM mode.
|
||||||
|
|
|
@ -55,6 +55,8 @@
|
||||||
gEfiLoadedImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiLoadedImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
gEfiLoadedImageDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiLoadedImageDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
gEfiSmmCpuSaveStateProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiSmmCpuSaveStateProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiMpServiceProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiSmmCpuIo2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
gEfiSmmCpuProtocolGuid
|
gEfiSmmCpuProtocolGuid AND gEfiMpServiceProtocolGuid AND gEfiSmmCpuIo2ProtocolGuid
|
||||||
|
|
Loading…
Reference in New Issue