\r
UINT32\r
QemuCpuhpReadCommandData2 (\r
- IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo\r
+ IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo\r
)\r
{\r
- UINT32 CommandData2;\r
- EFI_STATUS Status;\r
+ UINT32 CommandData2;\r
+ EFI_STATUS Status;\r
\r
CommandData2 = 0;\r
- Status = MmCpuIo->Io.Read (\r
- MmCpuIo,\r
- MM_IO_UINT32,\r
- ICH9_CPU_HOTPLUG_BASE + QEMU_CPUHP_R_CMD_DATA2,\r
- 1,\r
- &CommandData2\r
- );\r
+ Status = MmCpuIo->Io.Read (\r
+ MmCpuIo,\r
+ MM_IO_UINT32,\r
+ ICH9_CPU_HOTPLUG_BASE + QEMU_CPUHP_R_CMD_DATA2,\r
+ 1,\r
+ &CommandData2\r
+ );\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));\r
ASSERT (FALSE);\r
CpuDeadLoop ();\r
}\r
+\r
return CommandData2;\r
}\r
\r
UINT8\r
QemuCpuhpReadCpuStatus (\r
- IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo\r
+ IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo\r
)\r
{\r
- UINT8 CpuStatus;\r
- EFI_STATUS Status;\r
+ UINT8 CpuStatus;\r
+ EFI_STATUS Status;\r
\r
CpuStatus = 0;\r
- Status = MmCpuIo->Io.Read (\r
- MmCpuIo,\r
- MM_IO_UINT8,\r
- ICH9_CPU_HOTPLUG_BASE + QEMU_CPUHP_R_CPU_STAT,\r
- 1,\r
- &CpuStatus\r
- );\r
+ Status = MmCpuIo->Io.Read (\r
+ MmCpuIo,\r
+ MM_IO_UINT8,\r
+ ICH9_CPU_HOTPLUG_BASE + QEMU_CPUHP_R_CPU_STAT,\r
+ 1,\r
+ &CpuStatus\r
+ );\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));\r
ASSERT (FALSE);\r
CpuDeadLoop ();\r
}\r
+\r
return CpuStatus;\r
}\r
\r
UINT32\r
QemuCpuhpReadCommandData (\r
- IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo\r
+ IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo\r
)\r
{\r
- UINT32 CommandData;\r
- EFI_STATUS Status;\r
+ UINT32 CommandData;\r
+ EFI_STATUS Status;\r
\r
CommandData = 0;\r
- Status = MmCpuIo->Io.Read (\r
- MmCpuIo,\r
- MM_IO_UINT32,\r
- ICH9_CPU_HOTPLUG_BASE + QEMU_CPUHP_RW_CMD_DATA,\r
- 1,\r
- &CommandData\r
- );\r
+ Status = MmCpuIo->Io.Read (\r
+ MmCpuIo,\r
+ MM_IO_UINT32,\r
+ ICH9_CPU_HOTPLUG_BASE + QEMU_CPUHP_RW_CMD_DATA,\r
+ 1,\r
+ &CommandData\r
+ );\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));\r
ASSERT (FALSE);\r
CpuDeadLoop ();\r
}\r
+\r
return CommandData;\r
}\r
\r
VOID\r
QemuCpuhpWriteCpuSelector (\r
- IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,\r
- IN UINT32 Selector\r
+ IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,\r
+ IN UINT32 Selector\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
Status = MmCpuIo->Io.Write (\r
MmCpuIo,\r
\r
VOID\r
QemuCpuhpWriteCpuStatus (\r
- IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,\r
- IN UINT8 CpuStatus\r
+ IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,\r
+ IN UINT8 CpuStatus\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
Status = MmCpuIo->Io.Write (\r
MmCpuIo,\r
\r
VOID\r
QemuCpuhpWriteCommand (\r
- IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,\r
- IN UINT8 Command\r
+ IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,\r
+ IN UINT8 Command\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
Status = MmCpuIo->Io.Write (\r
MmCpuIo,\r
**/\r
EFI_STATUS\r
QemuCpuhpCollectApicIds (\r
- IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,\r
- IN UINT32 PossibleCpuCount,\r
- IN UINT32 ApicIdCount,\r
- OUT APIC_ID *PluggedApicIds,\r
- OUT UINT32 *PluggedCount,\r
- OUT APIC_ID *ToUnplugApicIds,\r
- OUT UINT32 *ToUnplugSelectors,\r
- OUT UINT32 *ToUnplugCount\r
+ IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,\r
+ IN UINT32 PossibleCpuCount,\r
+ IN UINT32 ApicIdCount,\r
+ OUT APIC_ID *PluggedApicIds,\r
+ OUT UINT32 *PluggedCount,\r
+ OUT APIC_ID *ToUnplugApicIds,\r
+ OUT UINT32 *ToUnplugSelectors,\r
+ OUT UINT32 *ToUnplugCount\r
)\r
{\r
- UINT32 CurrentSelector;\r
+ UINT32 CurrentSelector;\r
\r
- if (PossibleCpuCount == 0 || ApicIdCount == 0) {\r
+ if ((PossibleCpuCount == 0) || (ApicIdCount == 0)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- *PluggedCount = 0;\r
+ *PluggedCount = 0;\r
*ToUnplugCount = 0;\r
\r
CurrentSelector = 0;\r
do {\r
- UINT32 PendingSelector;\r
- UINT8 CpuStatus;\r
- APIC_ID *ExtendIds;\r
- UINT32 *ExtendSels;\r
- UINT32 *ExtendCount;\r
- APIC_ID NewApicId;\r
+ UINT32 PendingSelector;\r
+ UINT8 CpuStatus;\r
+ APIC_ID *ExtendIds;\r
+ UINT32 *ExtendSels;\r
+ UINT32 *ExtendCount;\r
+ APIC_ID NewApicId;\r
\r
//\r
// Write CurrentSelector (which is valid) to the CPU selector register.\r
QemuCpuhpWriteCommand (MmCpuIo, QEMU_CPUHP_CMD_GET_PENDING);\r
PendingSelector = QemuCpuhpReadCommandData (MmCpuIo);\r
if (PendingSelector < CurrentSelector) {\r
- DEBUG ((DEBUG_VERBOSE, "%a: CurrentSelector=%u PendingSelector=%u: "\r
- "wrap-around\n", __FUNCTION__, CurrentSelector, PendingSelector));\r
+ DEBUG ((\r
+ DEBUG_VERBOSE,\r
+ "%a: CurrentSelector=%u PendingSelector=%u: "\r
+ "wrap-around\n",\r
+ __FUNCTION__,\r
+ CurrentSelector,\r
+ PendingSelector\r
+ ));\r
break;\r
}\r
+\r
CurrentSelector = PendingSelector;\r
\r
//\r
// The "insert" event guarantees the "enabled" status; plus it excludes\r
// the "fw_remove" event.\r
//\r
- if ((CpuStatus & QEMU_CPUHP_STAT_ENABLED) == 0 ||\r
- (CpuStatus & QEMU_CPUHP_STAT_FW_REMOVE) != 0) {\r
- DEBUG ((DEBUG_ERROR, "%a: CurrentSelector=%u CpuStatus=0x%x: "\r
- "inconsistent CPU status\n", __FUNCTION__, CurrentSelector,\r
- CpuStatus));\r
+ if (((CpuStatus & QEMU_CPUHP_STAT_ENABLED) == 0) ||\r
+ ((CpuStatus & QEMU_CPUHP_STAT_FW_REMOVE) != 0))\r
+ {\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: CurrentSelector=%u CpuStatus=0x%x: "\r
+ "inconsistent CPU status\n",\r
+ __FUNCTION__,\r
+ CurrentSelector,\r
+ CpuStatus\r
+ ));\r
return EFI_PROTOCOL_ERROR;\r
}\r
\r
- DEBUG ((DEBUG_VERBOSE, "%a: CurrentSelector=%u: insert\n", __FUNCTION__,\r
- CurrentSelector));\r
+ DEBUG ((\r
+ DEBUG_VERBOSE,\r
+ "%a: CurrentSelector=%u: insert\n",\r
+ __FUNCTION__,\r
+ CurrentSelector\r
+ ));\r
\r
ExtendIds = PluggedApicIds;\r
ExtendSels = NULL;\r
// "fw_remove" event guarantees "enabled".\r
//\r
if ((CpuStatus & QEMU_CPUHP_STAT_ENABLED) == 0) {\r
- DEBUG ((DEBUG_ERROR, "%a: CurrentSelector=%u CpuStatus=0x%x: "\r
- "inconsistent CPU status\n", __FUNCTION__, CurrentSelector,\r
- CpuStatus));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%a: CurrentSelector=%u CpuStatus=0x%x: "\r
+ "inconsistent CPU status\n",\r
+ __FUNCTION__,\r
+ CurrentSelector,\r
+ CpuStatus\r
+ ));\r
return EFI_PROTOCOL_ERROR;\r
}\r
\r
- DEBUG ((DEBUG_VERBOSE, "%a: CurrentSelector=%u: fw_remove\n",\r
- __FUNCTION__, CurrentSelector));\r
+ DEBUG ((\r
+ DEBUG_VERBOSE,\r
+ "%a: CurrentSelector=%u: fw_remove\n",\r
+ __FUNCTION__,\r
+ CurrentSelector\r
+ ));\r
\r
ExtendIds = ToUnplugApicIds;\r
ExtendSels = ToUnplugSelectors;\r
//\r
// Let the OSPM deal with the "remove" event.\r
//\r
- DEBUG ((DEBUG_VERBOSE, "%a: CurrentSelector=%u: remove (ignored)\n",\r
- __FUNCTION__, CurrentSelector));\r
+ DEBUG ((\r
+ DEBUG_VERBOSE,\r
+ "%a: CurrentSelector=%u: remove (ignored)\n",\r
+ __FUNCTION__,\r
+ CurrentSelector\r
+ ));\r
\r
ExtendIds = NULL;\r
ExtendSels = NULL;\r
ExtendCount = NULL;\r
} else {\r
- DEBUG ((DEBUG_VERBOSE, "%a: CurrentSelector=%u: no event\n",\r
- __FUNCTION__, CurrentSelector));\r
+ DEBUG ((\r
+ DEBUG_VERBOSE,\r
+ "%a: CurrentSelector=%u: no event\n",\r
+ __FUNCTION__,\r
+ CurrentSelector\r
+ ));\r
break;\r
}\r
\r
DEBUG ((DEBUG_ERROR, "%a: APIC ID array too small\n", __FUNCTION__));\r
return EFI_BUFFER_TOO_SMALL;\r
}\r
+\r
QemuCpuhpWriteCommand (MmCpuIo, QEMU_CPUHP_CMD_GET_ARCH_ID);\r
NewApicId = QemuCpuhpReadCommandData (MmCpuIo);\r
- DEBUG ((DEBUG_VERBOSE, "%a: ApicId=" FMT_APIC_ID "\n", __FUNCTION__,\r
- NewApicId));\r
+ DEBUG ((\r
+ DEBUG_VERBOSE,\r
+ "%a: ApicId=" FMT_APIC_ID "\n",\r
+ __FUNCTION__,\r
+ NewApicId\r
+ ));\r
if (ExtendSels != NULL) {\r
ExtendSels[(*ExtendCount)] = CurrentSelector;\r
}\r
+\r
ExtendIds[(*ExtendCount)++] = NewApicId;\r
}\r
+\r
//\r
// We've processed the CPU with (known) pending events, but we must never\r
// clear events. Therefore we need to advance past this CPU manually;\r
CurrentSelector++;\r
} while (CurrentSelector < PossibleCpuCount);\r
\r
- DEBUG ((DEBUG_VERBOSE, "%a: PluggedCount=%u ToUnplugCount=%u\n",\r
- __FUNCTION__, *PluggedCount, *ToUnplugCount));\r
+ DEBUG ((\r
+ DEBUG_VERBOSE,\r
+ "%a: PluggedCount=%u ToUnplugCount=%u\n",\r
+ __FUNCTION__,\r
+ *PluggedCount,\r
+ *ToUnplugCount\r
+ ));\r
return EFI_SUCCESS;\r
}\r