Add a function that collects the APIC IDs of CPUs that have just been hot-plugged, or are about to be hot-unplugged. Pending events are only located and never cleared; QEMU's AML needs the firmware to leave the status bits intact in the hotplug register block. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Igor Mammedov <imammedo@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1512 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20200226221156.29589-10-lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
62 lines
1.6 KiB
C
62 lines
1.6 KiB
C
/** @file
|
|
Simple wrapper functions and utility functions that access QEMU's modern CPU
|
|
hotplug register block.
|
|
|
|
These functions manipulate some of the registers described in
|
|
"docs/specs/acpi_cpu_hotplug.txt" in the QEMU source. IO Ports are accessed
|
|
via EFI_MM_CPU_IO_PROTOCOL. If a protocol call fails, these functions don't
|
|
return.
|
|
|
|
Copyright (c) 2020, Red Hat, Inc.
|
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
**/
|
|
|
|
#ifndef QEMU_CPUHP_H_
|
|
#define QEMU_CPUHP_H_
|
|
|
|
#include <Protocol/MmCpuIo.h> // EFI_MM_CPU_IO_PROTOCOL
|
|
#include <Uefi/UefiBaseType.h> // EFI_STATUS
|
|
|
|
#include "ApicId.h" // APIC_ID
|
|
|
|
UINT32
|
|
QemuCpuhpReadCommandData2 (
|
|
IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo
|
|
);
|
|
|
|
UINT8
|
|
QemuCpuhpReadCpuStatus (
|
|
IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo
|
|
);
|
|
|
|
UINT32
|
|
QemuCpuhpReadCommandData (
|
|
IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo
|
|
);
|
|
|
|
VOID
|
|
QemuCpuhpWriteCpuSelector (
|
|
IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,
|
|
IN UINT32 Selector
|
|
);
|
|
|
|
VOID
|
|
QemuCpuhpWriteCommand (
|
|
IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,
|
|
IN UINT8 Command
|
|
);
|
|
|
|
EFI_STATUS
|
|
QemuCpuhpCollectApicIds (
|
|
IN CONST EFI_MM_CPU_IO_PROTOCOL *MmCpuIo,
|
|
IN UINT32 PossibleCpuCount,
|
|
IN UINT32 ApicIdCount,
|
|
OUT APIC_ID *PluggedApicIds,
|
|
OUT UINT32 *PluggedCount,
|
|
OUT APIC_ID *ToUnplugApicIds,
|
|
OUT UINT32 *ToUnplugCount
|
|
);
|
|
|
|
#endif // QEMU_CPUHP_H_
|