xref: /qemu/include/hw/acpi/cpu.h (revision 679dd1a957df418453efdd3ed2914dba5cd73773)
15e1b5d93SIgor Mammedov /*
25e1b5d93SIgor Mammedov  * QEMU ACPI hotplug utilities
35e1b5d93SIgor Mammedov  *
45e1b5d93SIgor Mammedov  * Copyright (C) 2016 Red Hat Inc
55e1b5d93SIgor Mammedov  *
65e1b5d93SIgor Mammedov  * Authors:
75e1b5d93SIgor Mammedov  *   Igor Mammedov <imammedo@redhat.com>
85e1b5d93SIgor Mammedov  *
95e1b5d93SIgor Mammedov  * This work is licensed under the terms of the GNU GPL, version 2 or later.
105e1b5d93SIgor Mammedov  * See the COPYING file in the top-level directory.
115e1b5d93SIgor Mammedov  */
125e1b5d93SIgor Mammedov #ifndef ACPI_CPU_H
135e1b5d93SIgor Mammedov #define ACPI_CPU_H
145e1b5d93SIgor Mammedov 
155e1b5d93SIgor Mammedov #include "hw/qdev-core.h"
165e1b5d93SIgor Mammedov #include "hw/acpi/acpi.h"
175e1b5d93SIgor Mammedov #include "hw/acpi/aml-build.h"
185e1b5d93SIgor Mammedov #include "hw/hotplug.h"
195e1b5d93SIgor Mammedov 
205e1b5d93SIgor Mammedov typedef struct AcpiCpuStatus {
215e1b5d93SIgor Mammedov     struct CPUState *cpu;
225e1b5d93SIgor Mammedov     uint64_t arch_id;
23d2238cb6SIgor Mammedov     bool is_inserting;
248872c25aSIgor Mammedov     bool is_removing;
2576623d00SIgor Mammedov     uint32_t ost_event;
2676623d00SIgor Mammedov     uint32_t ost_status;
275e1b5d93SIgor Mammedov } AcpiCpuStatus;
285e1b5d93SIgor Mammedov 
295e1b5d93SIgor Mammedov typedef struct CPUHotplugState {
305e1b5d93SIgor Mammedov     MemoryRegion ctrl_reg;
315e1b5d93SIgor Mammedov     uint32_t selector;
32d2238cb6SIgor Mammedov     uint8_t command;
335e1b5d93SIgor Mammedov     uint32_t dev_count;
345e1b5d93SIgor Mammedov     AcpiCpuStatus *devs;
355e1b5d93SIgor Mammedov } CPUHotplugState;
365e1b5d93SIgor Mammedov 
375e1b5d93SIgor Mammedov void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
385e1b5d93SIgor Mammedov                       CPUHotplugState *cpu_st, DeviceState *dev, Error **errp);
395e1b5d93SIgor Mammedov 
408872c25aSIgor Mammedov void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
418872c25aSIgor Mammedov                                 CPUHotplugState *cpu_st,
428872c25aSIgor Mammedov                                 DeviceState *dev, Error **errp);
438872c25aSIgor Mammedov 
448872c25aSIgor Mammedov void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st,
458872c25aSIgor Mammedov                         DeviceState *dev, Error **errp);
468872c25aSIgor Mammedov 
475e1b5d93SIgor Mammedov void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
485e1b5d93SIgor Mammedov                          CPUHotplugState *state, hwaddr base_addr);
495e1b5d93SIgor Mammedov 
505e1b5d93SIgor Mammedov typedef struct CPUHotplugFeatures {
515e1b5d93SIgor Mammedov     bool apci_1_compatible;
52*679dd1a9SIgor Mammedov     bool has_legacy_cphp;
535e1b5d93SIgor Mammedov } CPUHotplugFeatures;
545e1b5d93SIgor Mammedov 
555e1b5d93SIgor Mammedov void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
565e1b5d93SIgor Mammedov                     hwaddr io_base,
57d2238cb6SIgor Mammedov                     const char *res_root,
58d2238cb6SIgor Mammedov                     const char *event_handler_method);
595e1b5d93SIgor Mammedov 
6076623d00SIgor Mammedov void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list);
6176623d00SIgor Mammedov 
625e1b5d93SIgor Mammedov extern const VMStateDescription vmstate_cpu_hotplug;
635e1b5d93SIgor Mammedov #define VMSTATE_CPU_HOTPLUG(cpuhp, state) \
645e1b5d93SIgor Mammedov     VMSTATE_STRUCT(cpuhp, state, 1, \
655e1b5d93SIgor Mammedov                    vmstate_cpu_hotplug, CPUHotplugState)
665e1b5d93SIgor Mammedov 
675e1b5d93SIgor Mammedov #endif
68