OvmfPkg/CpuHotplugSmm: add Qemu Cpu Status helper

Add QemuCpuhpWriteCpuStatus() which will be used to update the QEMU
CPU status register. On error, it hangs in a similar fashion as
other helper functions.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Aaron Young <aaron.young@oracle.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132
Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210312062656.2477515-4-ankur.a.arora@oracle.com>
This commit is contained in:
Ankur Arora 2021-03-11 22:26:49 -08:00 committed by mergify[bot]
parent a752dd0746
commit 2d92e052c3
2 changed files with 28 additions and 0 deletions

View File

@ -113,6 +113,28 @@ QemuCpuhpWriteCpuSelector (
}
}
VOID
QemuCpuhpWriteCpuStatus (
IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,
IN UINT8 CpuStatus
)
{
EFI_STATUS Status;
Status = MmCpuIo->Io.Write (
MmCpuIo,
MM_IO_UINT8,
ICH9_CPU_HOTPLUG_BASE + QEMU_CPUHP_R_CPU_STAT,
1,
&CpuStatus
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));
ASSERT (FALSE);
CpuDeadLoop ();
}
}
VOID
QemuCpuhpWriteCommand (
IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,

View File

@ -41,6 +41,12 @@ QemuCpuhpWriteCpuSelector (
IN UINT32 Selector
);
VOID
QemuCpuhpWriteCpuStatus (
IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,
IN UINT8 CpuStatus
);
VOID
QemuCpuhpWriteCommand (
IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,