summaryrefslogtreecommitdiffstats
path: root/EmulatorPkg/CpuRuntimeDxe
diff options
context:
space:
mode:
Diffstat (limited to 'EmulatorPkg/CpuRuntimeDxe')
-rw-r--r--EmulatorPkg/CpuRuntimeDxe/Cpu.c108
-rw-r--r--EmulatorPkg/CpuRuntimeDxe/CpuDriver.h119
-rw-r--r--EmulatorPkg/CpuRuntimeDxe/CpuIo.c77
-rw-r--r--EmulatorPkg/CpuRuntimeDxe/MpService.c280
4 files changed, 278 insertions, 306 deletions
diff --git a/EmulatorPkg/CpuRuntimeDxe/Cpu.c b/EmulatorPkg/CpuRuntimeDxe/Cpu.c
index 00e93016af..e00f6cf35f 100644
--- a/EmulatorPkg/CpuRuntimeDxe/Cpu.c
+++ b/EmulatorPkg/CpuRuntimeDxe/Cpu.c
@@ -11,7 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
UINT64 mTimerPeriod;
-CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
+CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
CPU_ARCH_PROT_PRIVATE_SIGNATURE,
NULL,
{
@@ -39,16 +39,16 @@ CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
TRUE
};
-#define EFI_CPU_DATA_MAXIMUM_LENGTH 0x100
+#define EFI_CPU_DATA_MAXIMUM_LENGTH 0x100
-SMBIOS_TABLE_TYPE4 mCpuSmbiosType4 = {
- { EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE4), 0},
+SMBIOS_TABLE_TYPE4 mCpuSmbiosType4 = {
+ { EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE4), 0 },
1, // Socket String
ProcessorOther, // ProcessorType; ///< The enumeration value from PROCESSOR_TYPE_DATA.
ProcessorFamilyOther, // ProcessorFamily; ///< The enumeration value from PROCESSOR_FAMILY_DATA.
2, // ProcessorManufacture String;
{ // ProcessorId;
- { // PROCESSOR_SIGNATURE
+ { // PROCESSOR_SIGNATURE
0, // ProcessorSteppingId:4;
0, // ProcessorModel: 4;
0, // ProcessorFamily: 4;
@@ -58,7 +58,7 @@ SMBIOS_TABLE_TYPE4 mCpuSmbiosType4 = {
0, // ProcessorXFamily: 8;
0, // ProcessorReserved2: 4;
},
- { // PROCESSOR_FEATURE_FLAGS
+ { // PROCESSOR_FEATURE_FLAGS
0, // ProcessorFpu :1;
0, // ProcessorVme :1;
0, // ProcessorDe :1;
@@ -93,7 +93,7 @@ SMBIOS_TABLE_TYPE4 mCpuSmbiosType4 = {
}
},
3, // ProcessorVersion String;
- { // Voltage;
+ { // Voltage;
1, // ProcessorVoltageCapability5V :1;
1, // ProcessorVoltageCapability3_3V :1;
1, // ProcessorVoltageCapability2_9V :1;
@@ -119,7 +119,7 @@ SMBIOS_TABLE_TYPE4 mCpuSmbiosType4 = {
0, // ProcessorFamily2;
};
-CHAR8 *mCpuSmbiosType4Strings[] = {
+CHAR8 *mCpuSmbiosType4Strings[] = {
"Socket",
"http://www.tianocore.org/edk2/",
"Emulated Processor",
@@ -129,7 +129,6 @@ CHAR8 *mCpuSmbiosType4Strings[] = {
NULL
};
-
/**
Create SMBIOS record.
@@ -159,18 +158,18 @@ CHAR8 *mCpuSmbiosType4Strings[] = {
**/
EFI_STATUS
LogSmbiosData (
- IN EFI_SMBIOS_TABLE_HEADER *Template,
- IN CHAR8 **StringPack
+ IN EFI_SMBIOS_TABLE_HEADER *Template,
+ IN CHAR8 **StringPack
)
{
- EFI_STATUS Status;
- EFI_SMBIOS_PROTOCOL *Smbios;
- EFI_SMBIOS_HANDLE SmbiosHandle;
- EFI_SMBIOS_TABLE_HEADER *Record;
- UINTN Index;
- UINTN StringSize;
- UINTN Size;
- CHAR8 *Str;
+ EFI_STATUS Status;
+ EFI_SMBIOS_PROTOCOL *Smbios;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ EFI_SMBIOS_TABLE_HEADER *Record;
+ UINTN Index;
+ UINTN StringSize;
+ UINTN Size;
+ CHAR8 *Str;
//
// Locate Smbios protocol.
@@ -188,12 +187,14 @@ LogSmbiosData (
} else {
for (Index = 0; StringPack[Index] != NULL; Index++) {
StringSize = AsciiStrSize (StringPack[Index]);
- Size += StringSize;
+ Size += StringSize;
}
+
if (StringPack[0] == NULL) {
// At least a double null is required
Size += 1;
}
+
// Don't forget the terminating double null
Size += 1;
}
@@ -203,6 +204,7 @@ LogSmbiosData (
if (Record == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
CopyMem (Record, Template, Template->Length);
// Append string pack
@@ -212,32 +214,30 @@ LogSmbiosData (
CopyMem (Str, StringPack[Index], StringSize);
Str += StringSize;
}
+
*Str = 0;
SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
- Status = Smbios->Add (
- Smbios,
- gImageHandle,
- &SmbiosHandle,
- Record
- );
+ Status = Smbios->Add (
+ Smbios,
+ gImageHandle,
+ &SmbiosHandle,
+ Record
+ );
ASSERT_EFI_ERROR (Status);
FreePool (Record);
return Status;
}
-
-
-
VOID
CpuUpdateSmbios (
IN UINTN MaxCpus
)
{
- mCpuSmbiosType4.CoreCount = (UINT8) MaxCpus;
- mCpuSmbiosType4.EnabledCoreCount = (UINT8) MaxCpus;
- mCpuSmbiosType4.ThreadCount = (UINT8) MaxCpus;
+ mCpuSmbiosType4.CoreCount = (UINT8)MaxCpus;
+ mCpuSmbiosType4.EnabledCoreCount = (UINT8)MaxCpus;
+ mCpuSmbiosType4.ThreadCount = (UINT8)MaxCpus;
//
// The value of 1234 is fake value for CPU frequency
//
@@ -245,7 +245,6 @@ CpuUpdateSmbios (
LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mCpuSmbiosType4, mCpuSmbiosType4Strings);
}
-
//
// Service routines for the driver
//
@@ -265,6 +264,7 @@ EmuFlushCpuDataCache (
//
return EFI_SUCCESS;
}
+
//
// Other flush types are not supported by Emu emulator
//
@@ -277,7 +277,7 @@ EmuEnableInterrupt (
IN EFI_CPU_ARCH_PROTOCOL *This
)
{
- CPU_ARCH_PROTOCOL_PRIVATE *Private;
+ CPU_ARCH_PROTOCOL_PRIVATE *Private;
Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
Private->InterruptState = TRUE;
@@ -291,7 +291,7 @@ EmuDisableInterrupt (
IN EFI_CPU_ARCH_PROTOCOL *This
)
{
- CPU_ARCH_PROTOCOL_PRIVATE *Private;
+ CPU_ARCH_PROTOCOL_PRIVATE *Private;
Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);
Private->InterruptState = FALSE;
@@ -306,7 +306,7 @@ EmuGetInterruptState (
OUT BOOLEAN *State
)
{
- CPU_ARCH_PROTOCOL_PRIVATE *Private;
+ CPU_ARCH_PROTOCOL_PRIVATE *Private;
if (State == NULL) {
return EFI_INVALID_PARAMETER;
@@ -338,9 +338,10 @@ EmuRegisterInterruptHandler (
//
// Do parameter checking for EFI spec conformance
//
- if (InterruptType < 0 || InterruptType > 0xff) {
+ if ((InterruptType < 0) || (InterruptType > 0xff)) {
return EFI_UNSUPPORTED;
}
+
//
// Do nothing for Emu emulation
//
@@ -350,10 +351,10 @@ EmuRegisterInterruptHandler (
EFI_STATUS
EFIAPI
EmuGetTimerValue (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN UINT32 TimerIndex,
- OUT UINT64 *TimerValue,
- OUT UINT64 *TimerPeriod OPTIONAL
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN UINT32 TimerIndex,
+ OUT UINT64 *TimerValue,
+ OUT UINT64 *TimerPeriod OPTIONAL
)
{
if (TimerValue == NULL) {
@@ -373,7 +374,6 @@ EmuGetTimerValue (
return EFI_SUCCESS;
}
-
EFI_STATUS
EFIAPI
EmuSetMemoryAttributes (
@@ -396,9 +396,6 @@ EmuSetMemoryAttributes (
return EFI_UNSUPPORTED;
}
-
-
-
/**
Callback function for idle events.
@@ -410,14 +407,13 @@ EmuSetMemoryAttributes (
VOID
EFIAPI
IdleLoopEventCallback (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
gEmuThunk->CpuSleep ();
}
-
EFI_STATUS
EFIAPI
InitializeCpu (
@@ -425,10 +421,10 @@ InitializeCpu (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- UINT64 Frequency;
- EFI_EVENT IdleLoopEvent;
- UINTN MaxCpu;
+ EFI_STATUS Status;
+ UINT64 Frequency;
+ EFI_EVENT IdleLoopEvent;
+ UINTN MaxCpu;
//
// Retrieve the frequency of the performance counter in Hz.
@@ -444,7 +440,6 @@ InitializeCpu (
CpuUpdateSmbios (MaxCpu);
-
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
@@ -455,11 +450,12 @@ InitializeCpu (
);
ASSERT_EFI_ERROR (Status);
-
Status = gBS->InstallMultipleProtocolInterfaces (
&mCpuTemplate.Handle,
- &gEfiCpuArchProtocolGuid, &mCpuTemplate.Cpu,
- &gEfiCpuIo2ProtocolGuid, &mCpuTemplate.CpuIo,
+ &gEfiCpuArchProtocolGuid,
+ &mCpuTemplate.Cpu,
+ &gEfiCpuIo2ProtocolGuid,
+ &mCpuTemplate.CpuIo,
NULL
);
ASSERT_EFI_ERROR (Status);
diff --git a/EmulatorPkg/CpuRuntimeDxe/CpuDriver.h b/EmulatorPkg/CpuRuntimeDxe/CpuDriver.h
index b191cbd048..cec82a1b6f 100644
--- a/EmulatorPkg/CpuRuntimeDxe/CpuDriver.h
+++ b/EmulatorPkg/CpuRuntimeDxe/CpuDriver.h
@@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
#define _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_
-
#include <PiDxe.h>
#include <IndustryStandard/SmBios.h>
@@ -32,25 +31,22 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/UefiLib.h>
#include <Library/PcdLib.h>
-
-
//
// Internal Data Structures
//
-#define CPU_ARCH_PROT_PRIVATE_SIGNATURE SIGNATURE_32 ('c', 'a', 'p', 'd')
+#define CPU_ARCH_PROT_PRIVATE_SIGNATURE SIGNATURE_32 ('c', 'a', 'p', 'd')
typedef struct {
- UINTN Signature;
- EFI_HANDLE Handle;
+ UINTN Signature;
+ EFI_HANDLE Handle;
- EFI_CPU_ARCH_PROTOCOL Cpu;
- EFI_CPU_IO2_PROTOCOL CpuIo;
+ EFI_CPU_ARCH_PROTOCOL Cpu;
+ EFI_CPU_IO2_PROTOCOL CpuIo;
//
// Local Data for CPU interface goes here
//
- BOOLEAN InterruptState;
-
+ BOOLEAN InterruptState;
} CPU_ARCH_PROTOCOL_PRIVATE;
#define CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS(a) \
@@ -60,8 +56,6 @@ typedef struct {
CPU_ARCH_PROT_PRIVATE_SIGNATURE \
)
-
-
typedef enum {
CPU_STATE_IDLE,
CPU_STATE_BLOCKED,
@@ -70,84 +64,78 @@ typedef enum {
CPU_STATE_FINISHED
} PROCESSOR_STATE;
-
//
// Define Individual Processor Data block.
//
typedef struct {
- EFI_PROCESSOR_INFORMATION Info;
- EFI_AP_PROCEDURE Procedure;
- VOID *Parameter;
- VOID *StateLock;
- VOID *ProcedureLock;
- PROCESSOR_STATE State;
- EFI_EVENT CheckThisAPEvent;
+ EFI_PROCESSOR_INFORMATION Info;
+ EFI_AP_PROCEDURE Procedure;
+ VOID *Parameter;
+ VOID *StateLock;
+ VOID *ProcedureLock;
+ PROCESSOR_STATE State;
+ EFI_EVENT CheckThisAPEvent;
} PROCESSOR_DATA_BLOCK;
-
//
// Define MP data block which consumes individual processor block.
//
typedef struct {
- UINTN NumberOfProcessors;
- UINTN NumberOfEnabledProcessors;
- EFI_EVENT CheckAllAPsEvent;
- EFI_EVENT WaitEvent;
- UINTN FinishCount;
- UINTN StartCount;
- EFI_AP_PROCEDURE Procedure;
- VOID *ProcedureArgument;
- BOOLEAN SingleThread;
- UINTN StartedNumber;
- PROCESSOR_DATA_BLOCK *ProcessorData;
- UINTN Timeout;
- UINTN *FailedList;
- UINTN FailedListIndex;
- BOOLEAN TimeoutActive;
+ UINTN NumberOfProcessors;
+ UINTN NumberOfEnabledProcessors;
+ EFI_EVENT CheckAllAPsEvent;
+ EFI_EVENT WaitEvent;
+ UINTN FinishCount;
+ UINTN StartCount;
+ EFI_AP_PROCEDURE Procedure;
+ VOID *ProcedureArgument;
+ BOOLEAN SingleThread;
+ UINTN StartedNumber;
+ PROCESSOR_DATA_BLOCK *ProcessorData;
+ UINTN Timeout;
+ UINTN *FailedList;
+ UINTN FailedListIndex;
+ BOOLEAN TimeoutActive;
} MP_SYSTEM_DATA;
-
-
-
-
EFI_STATUS
EFIAPI
CpuMemoryServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
+ IN EFI_CPU_IO2_PROTOCOL *This,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
);
EFI_STATUS
EFIAPI
CpuMemoryServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
+ IN EFI_CPU_IO2_PROTOCOL *This,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
);
EFI_STATUS
EFIAPI
CpuIoServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 UserAddress,
- IN UINTN Count,
- IN OUT VOID *UserBuffer
+ IN EFI_CPU_IO2_PROTOCOL *This,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 UserAddress,
+ IN UINTN Count,
+ IN OUT VOID *UserBuffer
);
EFI_STATUS
EFIAPI
CpuIoServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 UserAddress,
- IN UINTN Count,
- IN OUT VOID *UserBuffer
+ IN EFI_CPU_IO2_PROTOCOL *This,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 UserAddress,
+ IN UINTN Count,
+ IN OUT VOID *UserBuffer
);
EFI_STATUS
@@ -203,10 +191,10 @@ EmuRegisterInterruptHandler (
EFI_STATUS
EFIAPI
EmuGetTimerValue (
- IN EFI_CPU_ARCH_PROTOCOL *This,
- IN UINT32 TimerIndex,
- OUT UINT64 *TimerValue,
- OUT UINT64 *TimerPeriod OPTIONAL
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN UINT32 TimerIndex,
+ OUT UINT64 *TimerValue,
+ OUT UINT64 *TimerPeriod OPTIONAL
);
EFI_STATUS
@@ -220,7 +208,7 @@ EmuSetMemoryAttributes (
EFI_STATUS
CpuMpServicesInit (
- OUT UINTN *MaxCores
+ OUT UINTN *MaxCores
);
EFI_STATUS
@@ -232,5 +220,4 @@ CpuMpServicesWhoAmI (
extern EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate;
-
#endif
diff --git a/EmulatorPkg/CpuRuntimeDxe/CpuIo.c b/EmulatorPkg/CpuRuntimeDxe/CpuIo.c
index 152c260451..417b225b7e 100644
--- a/EmulatorPkg/CpuRuntimeDxe/CpuIo.c
+++ b/EmulatorPkg/CpuRuntimeDxe/CpuIo.c
@@ -31,22 +31,23 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_STATUS
CpuIoCheckAddressRange (
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN VOID *Buffer,
- IN UINT64 Limit
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN VOID *Buffer,
+ IN UINT64 Limit
);
EFI_STATUS
EFIAPI
CpuMemoryServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
+ IN EFI_CPU_IO2_PROTOCOL *This,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
)
+
/*++
Routine Description:
@@ -95,12 +96,13 @@ Returns:
EFI_STATUS
EFIAPI
CpuMemoryServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
+ IN EFI_CPU_IO2_PROTOCOL *This,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
)
+
/*++
Routine Description:
@@ -148,12 +150,13 @@ Returns:
EFI_STATUS
EFIAPI
CpuIoServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 UserAddress,
- IN UINTN Count,
- IN OUT VOID *UserBuffer
+ IN EFI_CPU_IO2_PROTOCOL *This,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 UserAddress,
+ IN UINTN Count,
+ IN OUT VOID *UserBuffer
)
+
/*++
Routine Description:
@@ -186,7 +189,7 @@ Returns:
return EFI_INVALID_PARAMETER;
}
- Address = (UINTN) UserAddress;
+ Address = (UINTN)UserAddress;
if (Width >= EfiCpuIoWidthMaximum) {
return EFI_INVALID_PARAMETER;
@@ -206,12 +209,13 @@ Returns:
EFI_STATUS
EFIAPI
CpuIoServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 UserAddress,
- IN UINTN Count,
- IN OUT VOID *UserBuffer
+ IN EFI_CPU_IO2_PROTOCOL *This,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 UserAddress,
+ IN UINTN Count,
+ IN OUT VOID *UserBuffer
)
+
/*++
Routine Description:
@@ -248,7 +252,7 @@ Returns:
return EFI_INVALID_PARAMETER;
}
- Address = (UINTN) UserAddress;
+ Address = (UINTN)UserAddress;
if (Width >= EfiCpuIoWidthMaximum) {
return EFI_INVALID_PARAMETER;
@@ -265,7 +269,6 @@ Returns:
return EFI_SUCCESS;
}
-
/*++
Routine Description:
@@ -288,14 +291,14 @@ Returns:
**/
EFI_STATUS
CpuIoCheckAddressRange (
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN VOID *Buffer,
- IN UINT64 Limit
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN VOID *Buffer,
+ IN UINT64 Limit
)
{
- UINTN AlignMask;
+ UINTN AlignMask;
if (Address > Limit) {
return EFI_UNSUPPORTED;
@@ -304,7 +307,7 @@ CpuIoCheckAddressRange (
//
// For FiFo type, the target address won't increase during the access, so treat count as 1
//
- if (Width >= EfiCpuIoWidthFifoUint8 && Width <= EfiCpuIoWidthFifoUint64) {
+ if ((Width >= EfiCpuIoWidthFifoUint8) && (Width <= EfiCpuIoWidthFifoUint64)) {
Count = 1;
}
@@ -314,11 +317,9 @@ CpuIoCheckAddressRange (
}
AlignMask = (1 << Width) - 1;
- if ((UINTN) Buffer & AlignMask) {
+ if ((UINTN)Buffer & AlignMask) {
return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;
}
-
-
diff --git a/EmulatorPkg/CpuRuntimeDxe/MpService.c b/EmulatorPkg/CpuRuntimeDxe/MpService.c
index 42f94ada27..122019f04e 100644
--- a/EmulatorPkg/CpuRuntimeDxe/MpService.c
+++ b/EmulatorPkg/CpuRuntimeDxe/MpService.c
@@ -37,13 +37,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "CpuDriver.h"
-
-MP_SYSTEM_DATA gMPSystem;
-EMU_THREAD_THUNK_PROTOCOL *gThread = NULL;
-EFI_EVENT gReadToBootEvent;
-BOOLEAN gReadToBoot = FALSE;
-UINTN gPollInterval;
-
+MP_SYSTEM_DATA gMPSystem;
+EMU_THREAD_THUNK_PROTOCOL *gThread = NULL;
+EFI_EVENT gReadToBootEvent;
+BOOLEAN gReadToBoot = FALSE;
+UINTN gPollInterval;
BOOLEAN
IsBSP (
@@ -61,7 +59,6 @@ IsBSP (
return (gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) != 0;
}
-
VOID
SetApProcedure (
IN PROCESSOR_DATA_BLOCK *Processor,
@@ -70,15 +67,14 @@ SetApProcedure (
)
{
gThread->MutexLock (Processor->ProcedureLock);
- Processor->Parameter = ProcedureArgument;
- Processor->Procedure = Procedure;
+ Processor->Parameter = ProcedureArgument;
+ Processor->Procedure = Procedure;
gThread->MutexUnlock (Processor->ProcedureLock);
}
-
EFI_STATUS
GetNextBlockedNumber (
- OUT UINTN *NextNumber
+ OUT UINTN *NextNumber
)
{
UINTN Number;
@@ -116,16 +112,17 @@ GetNextBlockedNumber (
**/
UINTN
CalculateAndStallInterval (
- IN UINTN Timeout
+ IN UINTN Timeout
)
{
- UINTN StallTime;
+ UINTN StallTime;
- if (Timeout < gPollInterval && Timeout != 0) {
+ if ((Timeout < gPollInterval) && (Timeout != 0)) {
StallTime = Timeout;
} else {
StallTime = gPollInterval;
}
+
gBS->Stall (StallTime);
return StallTime;
@@ -188,8 +185,6 @@ CpuMpServicesGetNumberOfProcessors (
return EFI_SUCCESS;
}
-
-
/**
Gets detailed MP-related information on the requested processor at the
instant this call is made. This service may only be called from the BSP.
@@ -240,7 +235,6 @@ CpuMpServicesGetProcessorInfo (
return EFI_SUCCESS;
}
-
/**
This service executes a caller provided function on all enabled APs. APs can
run either simultaneously or one at a time in sequence. This service supports
@@ -397,7 +391,6 @@ CpuMpServicesStartupAllAps (
PROCESSOR_STATE ProcessorState;
UINTN Timeout;
-
if (!IsBSP ()) {
return EFI_DEVICE_ERROR;
}
@@ -425,12 +418,14 @@ CpuMpServicesStartupAllAps (
// Skip Disabled processors
continue;
}
- gThread->MutexLock(ProcessorData->StateLock);
+
+ gThread->MutexLock (ProcessorData->StateLock);
if (ProcessorData->State != CPU_STATE_IDLE) {
gThread->MutexUnlock (ProcessorData->StateLock);
return EFI_NOT_READY;
}
- gThread->MutexUnlock(ProcessorData->StateLock);
+
+ gThread->MutexUnlock (ProcessorData->StateLock);
}
if (FailedCpuList != NULL) {
@@ -438,19 +433,20 @@ CpuMpServicesStartupAllAps (
if (gMPSystem.FailedList == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
SetMemN (gMPSystem.FailedList, (gMPSystem.NumberOfProcessors + 1) * sizeof (UINTN), END_OF_CPU_LIST);
gMPSystem.FailedListIndex = 0;
- *FailedCpuList = gMPSystem.FailedList;
+ *FailedCpuList = gMPSystem.FailedList;
}
Timeout = TimeoutInMicroseconds;
- ProcessorData = NULL;
+ ProcessorData = NULL;
- gMPSystem.FinishCount = 0;
- gMPSystem.StartCount = 0;
- gMPSystem.SingleThread = SingleThread;
- APInitialState = CPU_STATE_READY;
+ gMPSystem.FinishCount = 0;
+ gMPSystem.StartCount = 0;
+ gMPSystem.SingleThread = SingleThread;
+ APInitialState = CPU_STATE_READY;
for (Number = 0; Number < gMPSystem.NumberOfProcessors; Number++) {
ProcessorData = &gMPSystem.ProcessorData[Number];
@@ -472,7 +468,7 @@ CpuMpServicesStartupAllAps (
// state 1 by 1, until the previous 1 finished its task
// if not "SingleThread", all APs are put to ready state from the beginning
//
- gThread->MutexLock(ProcessorData->StateLock);
+ gThread->MutexLock (ProcessorData->StateLock);
ASSERT (ProcessorData->State == CPU_STATE_IDLE);
ProcessorData->State = APInitialState;
gThread->MutexUnlock (ProcessorData->StateLock);
@@ -487,7 +483,7 @@ CpuMpServicesStartupAllAps (
for (Number = 0; Number < gMPSystem.NumberOfProcessors; Number++) {
ProcessorData = &gMPSystem.ProcessorData[Number];
if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
- // Skip BSP
+ // Skip BSP
continue;
}
@@ -513,20 +509,19 @@ CpuMpServicesStartupAllAps (
gMPSystem.WaitEvent = WaitEvent;
gMPSystem.Timeout = TimeoutInMicroseconds;
gMPSystem.TimeoutActive = (BOOLEAN)(TimeoutInMicroseconds != 0);
- Status = gBS->SetTimer (
- gMPSystem.CheckAllAPsEvent,
- TimerPeriodic,
- gPollInterval
- );
+ Status = gBS->SetTimer (
+ gMPSystem.CheckAllAPsEvent,
+ TimerPeriodic,
+ gPollInterval
+ );
return Status;
-
}
while (TRUE) {
for (Number = 0; Number < gMPSystem.NumberOfProcessors; Number++) {
ProcessorData = &gMPSystem.ProcessorData[Number];
if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
- // Skip BSP
+ // Skip BSP
continue;
}
@@ -540,29 +535,29 @@ CpuMpServicesStartupAllAps (
gThread->MutexUnlock (ProcessorData->StateLock);
switch (ProcessorState) {
- case CPU_STATE_READY:
- SetApProcedure (ProcessorData, Procedure, ProcedureArgument);
- break;
-
- case CPU_STATE_FINISHED:
- gMPSystem.FinishCount++;
- if (SingleThread) {
- Status = GetNextBlockedNumber (&NextNumber);
- if (!EFI_ERROR (Status)) {
- gThread->MutexLock (gMPSystem.ProcessorData[NextNumber].StateLock);
- gMPSystem.ProcessorData[NextNumber].State = CPU_STATE_READY;
- gThread->MutexUnlock (gMPSystem.ProcessorData[NextNumber].StateLock);
+ case CPU_STATE_READY:
+ SetApProcedure (ProcessorData, Procedure, ProcedureArgument);
+ break;
+
+ case CPU_STATE_FINISHED:
+ gMPSystem.FinishCount++;
+ if (SingleThread) {
+ Status = GetNextBlockedNumber (&NextNumber);
+ if (!EFI_ERROR (Status)) {
+ gThread->MutexLock (gMPSystem.ProcessorData[NextNumber].StateLock);
+ gMPSystem.ProcessorData[NextNumber].State = CPU_STATE_READY;
+ gThread->MutexUnlock (gMPSystem.ProcessorData[NextNumber].StateLock);
+ }
}
- }
- gThread->MutexLock (ProcessorData->StateLock);
- ProcessorData->State = CPU_STATE_IDLE;
- gThread->MutexUnlock (ProcessorData->StateLock);
+ gThread->MutexLock (ProcessorData->StateLock);
+ ProcessorData->State = CPU_STATE_IDLE;
+ gThread->MutexUnlock (ProcessorData->StateLock);
- break;
+ break;
- default:
- break;
+ default:
+ break;
}
}
@@ -590,7 +585,6 @@ Done:
return EFI_SUCCESS;
}
-
/**
This service lets the caller get one enabled AP to execute a caller-provided
function. The caller can request the BSP to either wait for the completion
@@ -689,7 +683,7 @@ CpuMpServicesStartupThisAP (
OUT BOOLEAN *Finished OPTIONAL
)
{
- UINTN Timeout;
+ UINTN Timeout;
if (!IsBSP ()) {
return EFI_DEVICE_ERROR;
@@ -711,12 +705,13 @@ CpuMpServicesStartupThisAP (
return EFI_INVALID_PARAMETER;
}
- gThread->MutexLock(gMPSystem.ProcessorData[ProcessorNumber].StateLock);
+ gThread->MutexLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
if (gMPSystem.ProcessorData[ProcessorNumber].State != CPU_STATE_IDLE) {
- gThread->MutexUnlock(gMPSystem.ProcessorData[ProcessorNumber].StateLock);
+ gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
return EFI_NOT_READY;
}
- gThread->MutexUnlock(gMPSystem.ProcessorData[ProcessorNumber].StateLock);
+
+ gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
if ((WaitEvent != NULL) && gReadToBoot) {
return EFI_UNSUPPORTED;
@@ -724,8 +719,8 @@ CpuMpServicesStartupThisAP (
Timeout = TimeoutInMicroseconds;
- gMPSystem.StartCount = 1;
- gMPSystem.FinishCount = 0;
+ gMPSystem.StartCount = 1;
+ gMPSystem.FinishCount = 0;
SetApProcedure (&gMPSystem.ProcessorData[ProcessorNumber], Procedure, ProcedureArgument);
@@ -759,10 +754,8 @@ CpuMpServicesStartupThisAP (
}
return EFI_SUCCESS;
-
}
-
/**
This service switches the requested AP to be the BSP from that point onward.
This service changes the BSP for all purposes. This call can only be performed
@@ -806,7 +799,7 @@ CpuMpServicesSwitchBSP (
IN BOOLEAN EnableOldBSP
)
{
- UINTN Index;
+ UINTN Index;
if (!IsBSP ()) {
return EFI_DEVICE_ERROR;
@@ -829,6 +822,7 @@ CpuMpServicesSwitchBSP (
break;
}
}
+
ASSERT (Index != gMPSystem.NumberOfProcessors);
gThread->MutexLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
@@ -836,6 +830,7 @@ CpuMpServicesSwitchBSP (
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
return EFI_NOT_READY;
}
+
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
// Skip for now as we need switch a bunch of stack stuff around and it's complex
@@ -843,7 +838,6 @@ CpuMpServicesSwitchBSP (
return EFI_NOT_READY;
}
-
/**
This service lets the caller enable or disable an AP from this point onward.
This service may only be called from the BSP.
@@ -911,17 +905,20 @@ CpuMpServicesEnableDisableAP (
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
return EFI_UNSUPPORTED;
}
+
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
if (EnableAP) {
if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0 ) {
gMPSystem.NumberOfEnabledProcessors++;
}
+
gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag |= PROCESSOR_ENABLED_BIT;
} else {
if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == PROCESSOR_ENABLED_BIT ) {
gMPSystem.NumberOfEnabledProcessors--;
}
+
gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag &= ~PROCESSOR_ENABLED_BIT;
}
@@ -933,7 +930,6 @@ CpuMpServicesEnableDisableAP (
return EFI_SUCCESS;
}
-
/**
This return the handle number for the calling processor. This service may be
called from the BSP and APs.
@@ -983,8 +979,6 @@ CpuMpServicesWhoAmI (
return EFI_SUCCESS;
}
-
-
EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate = {
CpuMpServicesGetNumberOfProcessors,
CpuMpServicesGetProcessorInfo,
@@ -995,8 +989,6 @@ EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate = {
CpuMpServicesWhoAmI
};
-
-
/*++
If timeout occurs in StartupAllAps(), a timer is set, which invokes this
procedure periodically to check whether all APs have finished.
@@ -1006,8 +998,8 @@ EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate = {
VOID
EFIAPI
CpuCheckAllAPsStatus (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
UINTN ProcessorNumber;
@@ -1026,7 +1018,7 @@ CpuCheckAllAPsStatus (
for (ProcessorNumber = 0; ProcessorNumber < gMPSystem.NumberOfProcessors; ProcessorNumber++) {
ProcessorData = &gMPSystem.ProcessorData[ProcessorNumber];
if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
- // Skip BSP
+ // Skip BSP
continue;
}
@@ -1041,39 +1033,40 @@ CpuCheckAllAPsStatus (
// So, try lock it. If we can get it, cool, do our thing.
// otherwise, just dump out & try again on the next iteration.
Status = gThread->MutexTryLock (ProcessorData->StateLock);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return;
}
+
ProcessorState = ProcessorData->State;
gThread->MutexUnlock (ProcessorData->StateLock);
switch (ProcessorState) {
- case CPU_STATE_FINISHED:
- if (gMPSystem.SingleThread) {
- Status = GetNextBlockedNumber (&NextNumber);
- if (!EFI_ERROR (Status)) {
- NextData = &gMPSystem.ProcessorData[NextNumber];
+ case CPU_STATE_FINISHED:
+ if (gMPSystem.SingleThread) {
+ Status = GetNextBlockedNumber (&NextNumber);
+ if (!EFI_ERROR (Status)) {
+ NextData = &gMPSystem.ProcessorData[NextNumber];
- gThread->MutexLock (NextData->StateLock);
- NextData->State = CPU_STATE_READY;
- gThread->MutexUnlock (NextData->StateLock);
+ gThread->MutexLock (NextData->StateLock);
+ NextData->State = CPU_STATE_READY;
+ gThread->MutexUnlock (NextData->StateLock);
- SetApProcedure (NextData, gMPSystem.Procedure, gMPSystem.ProcedureArgument);
+ SetApProcedure (NextData, gMPSystem.Procedure, gMPSystem.ProcedureArgument);
+ }
}
- }
- gThread->MutexLock (ProcessorData->StateLock);
- ProcessorData->State = CPU_STATE_IDLE;
- gThread->MutexUnlock (ProcessorData->StateLock);
- gMPSystem.FinishCount++;
- break;
+ gThread->MutexLock (ProcessorData->StateLock);
+ ProcessorData->State = CPU_STATE_IDLE;
+ gThread->MutexUnlock (ProcessorData->StateLock);
+ gMPSystem.FinishCount++;
+ break;
- default:
- break;
+ default:
+ break;
}
}
- if (gMPSystem.TimeoutActive && gMPSystem.Timeout == 0) {
+ if (gMPSystem.TimeoutActive && (gMPSystem.Timeout == 0)) {
//
// Timeout
//
@@ -1081,7 +1074,7 @@ CpuCheckAllAPsStatus (
for (ProcessorNumber = 0; ProcessorNumber < gMPSystem.NumberOfProcessors; ProcessorNumber++) {
ProcessorData = &gMPSystem.ProcessorData[ProcessorNumber];
if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
- // Skip BSP
+ // Skip BSP
continue;
}
@@ -1092,9 +1085,10 @@ CpuCheckAllAPsStatus (
// Mark the
Status = gThread->MutexTryLock (ProcessorData->StateLock);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return;
}
+
ProcessorState = ProcessorData->State;
gThread->MutexUnlock (ProcessorData->StateLock);
@@ -1104,17 +1098,20 @@ CpuCheckAllAPsStatus (
if (gMPSystem.FailedList[Cpu] == END_OF_CPU_LIST) {
break;
}
+
if (gMPSystem.FailedList[ProcessorNumber] == Cpu) {
Found = TRUE;
break;
}
}
+
if (!Found) {
gMPSystem.FailedList[gMPSystem.FailedListIndex++] = Cpu;
}
}
}
}
+
// Force terminal exit
gMPSystem.FinishCount = gMPSystem.StartCount;
}
@@ -1138,21 +1135,21 @@ CpuCheckAllAPsStatus (
Status = gBS->SignalEvent (gMPSystem.WaitEvent);
- return ;
+ return;
}
VOID
EFIAPI
CpuCheckThisAPStatus (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
EFI_STATUS Status;
PROCESSOR_DATA_BLOCK *ProcessorData;
PROCESSOR_STATE ProcessorState;
- ProcessorData = (PROCESSOR_DATA_BLOCK *) Context;
+ ProcessorData = (PROCESSOR_DATA_BLOCK *)Context;
//
// This is an Interrupt Service routine.
@@ -1162,9 +1159,10 @@ CpuCheckThisAPStatus (
// otherwise, just dump out & try again on the next iteration.
//
Status = gThread->MutexTryLock (ProcessorData->StateLock);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return;
}
+
ProcessorState = ProcessorData->State;
gThread->MutexUnlock (ProcessorData->StateLock);
@@ -1180,10 +1178,9 @@ CpuCheckThisAPStatus (
gThread->MutexUnlock (ProcessorData->StateLock);
}
- return ;
+ return;
}
-
/*++
This function is called by all processors (both BSP and AP) once and collects MP related data
@@ -1195,25 +1192,25 @@ CpuCheckThisAPStatus (
--*/
EFI_STATUS
FillInProcessorInformation (
- IN BOOLEAN BSP,
- IN UINTN ProcessorNumber
+ IN BOOLEAN BSP,
+ IN UINTN ProcessorNumber
)
{
- gMPSystem.ProcessorData[ProcessorNumber].Info.ProcessorId = gThread->Self ();
- gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag = PROCESSOR_ENABLED_BIT | PROCESSOR_HEALTH_STATUS_BIT;
+ gMPSystem.ProcessorData[ProcessorNumber].Info.ProcessorId = gThread->Self ();
+ gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag = PROCESSOR_ENABLED_BIT | PROCESSOR_HEALTH_STATUS_BIT;
if (BSP) {
gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag |= PROCESSOR_AS_BSP_BIT;
}
- gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Package = (UINT32) ProcessorNumber;
+ gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Package = (UINT32)ProcessorNumber;
gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Core = 0;
gMPSystem.ProcessorData[ProcessorNumber].Info.Location.Thread = 0;
- gMPSystem.ProcessorData[ProcessorNumber].State = BSP ? CPU_STATE_BUSY : CPU_STATE_IDLE;
+ gMPSystem.ProcessorData[ProcessorNumber].State = BSP ? CPU_STATE_BUSY : CPU_STATE_IDLE;
- gMPSystem.ProcessorData[ProcessorNumber].Procedure = NULL;
- gMPSystem.ProcessorData[ProcessorNumber].Parameter = NULL;
- gMPSystem.ProcessorData[ProcessorNumber].StateLock = gThread->MutexInit ();
- gMPSystem.ProcessorData[ProcessorNumber].ProcedureLock = gThread->MutexInit ();
+ gMPSystem.ProcessorData[ProcessorNumber].Procedure = NULL;
+ gMPSystem.ProcessorData[ProcessorNumber].Parameter = NULL;
+ gMPSystem.ProcessorData[ProcessorNumber].StateLock = gThread->MutexInit ();
+ gMPSystem.ProcessorData[ProcessorNumber].ProcedureLock = gThread->MutexInit ();
return EFI_SUCCESS;
}
@@ -1230,7 +1227,7 @@ CpuDriverApIdolLoop (
PROCESSOR_DATA_BLOCK *ProcessorData;
ProcessorNumber = (UINTN)Context;
- ProcessorData = &gMPSystem.ProcessorData[ProcessorNumber];
+ ProcessorData = &gMPSystem.ProcessorData[ProcessorNumber];
ProcessorData->Info.ProcessorId = gThread->Self ();
@@ -1267,15 +1264,13 @@ CpuDriverApIdolLoop (
return 0;
}
-
EFI_STATUS
InitializeMpSystemData (
- IN UINTN NumberOfProcessors
+ IN UINTN NumberOfProcessors
)
{
- EFI_STATUS Status;
- UINTN Index;
-
+ EFI_STATUS Status;
+ UINTN Index;
//
// Clear the data structure area first.
@@ -1285,8 +1280,8 @@ InitializeMpSystemData (
//
// First BSP fills and inits all known values, including it's own records.
//
- gMPSystem.NumberOfProcessors = NumberOfProcessors;
- gMPSystem.NumberOfEnabledProcessors = NumberOfProcessors;
+ gMPSystem.NumberOfProcessors = NumberOfProcessors;
+ gMPSystem.NumberOfEnabledProcessors = NumberOfProcessors;
gMPSystem.ProcessorData = AllocateZeroPool (gMPSystem.NumberOfProcessors * sizeof (PROCESSOR_DATA_BLOCK));
ASSERT (gMPSystem.ProcessorData != NULL);
@@ -1302,10 +1297,9 @@ InitializeMpSystemData (
);
ASSERT_EFI_ERROR (Status);
-
for (Index = 0; Index < gMPSystem.NumberOfProcessors; Index++) {
if ((gMPSystem.ProcessorData[Index].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
- // Skip BSP
+ // Skip BSP
continue;
}
@@ -1318,21 +1312,18 @@ InitializeMpSystemData (
(VOID *)Index
);
-
Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- CpuCheckThisAPStatus,
- (VOID *) &gMPSystem.ProcessorData[Index],
- &gMPSystem.ProcessorData[Index].CheckThisAPEvent
- );
+ EVT_TIMER | EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ CpuCheckThisAPStatus,
+ (VOID *)&gMPSystem.ProcessorData[Index],
+ &gMPSystem.ProcessorData[Index].CheckThisAPEvent
+ );
}
return EFI_SUCCESS;
}
-
-
/**
Invoke a notification event
@@ -1344,32 +1335,30 @@ InitializeMpSystemData (
VOID
EFIAPI
CpuReadToBootFunction (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
gReadToBoot = TRUE;
}
-
-
EFI_STATUS
CpuMpServicesInit (
- OUT UINTN *MaxCpus
+ OUT UINTN *MaxCpus
)
{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- EMU_IO_THUNK_PROTOCOL *IoThunk;
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+ EMU_IO_THUNK_PROTOCOL *IoThunk;
*MaxCpus = 1; // BSP
- IoThunk = GetIoThunkInstance (&gEmuThreadThunkProtocolGuid, 0);
+ IoThunk = GetIoThunkInstance (&gEmuThreadThunkProtocolGuid, 0);
if (IoThunk != NULL) {
Status = IoThunk->Open (IoThunk);
if (!EFI_ERROR (Status)) {
if (IoThunk->ConfigString != NULL) {
*MaxCpus += StrDecimalToUintn (IoThunk->ConfigString);
- gThread = IoThunk->Interface;
+ gThread = IoThunk->Interface;
}
}
}
@@ -1379,9 +1368,9 @@ CpuMpServicesInit (
return EFI_SUCCESS;
}
- gPollInterval = (UINTN) PcdGet64 (PcdEmuMpServicesPollingInterval);
+ gPollInterval = (UINTN)PcdGet64 (PcdEmuMpServicesPollingInterval);
- Status = InitializeMpSystemData (*MaxCpus);
+ Status = InitializeMpSystemData (*MaxCpus);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1395,10 +1384,9 @@ CpuMpServicesInit (
Handle = NULL;
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
- &gEfiMpServiceProtocolGuid, &mMpServicesTemplate,
+ &gEfiMpServiceProtocolGuid,
+ &mMpServicesTemplate,
NULL
);
return Status;
}
-
-