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; 251e6107d9SIgor Mammedov bool fw_remove; 2676623d00SIgor Mammedov uint32_t ost_event; 2776623d00SIgor Mammedov uint32_t ost_status; 285e1b5d93SIgor Mammedov } AcpiCpuStatus; 295e1b5d93SIgor Mammedov 305e1b5d93SIgor Mammedov typedef struct CPUHotplugState { 315e1b5d93SIgor Mammedov MemoryRegion ctrl_reg; 325e1b5d93SIgor Mammedov uint32_t selector; 33d2238cb6SIgor Mammedov uint8_t command; 345e1b5d93SIgor Mammedov uint32_t dev_count; 355e1b5d93SIgor Mammedov AcpiCpuStatus *devs; 365e1b5d93SIgor Mammedov } CPUHotplugState; 375e1b5d93SIgor Mammedov 385e1b5d93SIgor Mammedov void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev, 395e1b5d93SIgor Mammedov CPUHotplugState *cpu_st, DeviceState *dev, Error **errp); 405e1b5d93SIgor Mammedov 418872c25aSIgor Mammedov void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev, 428872c25aSIgor Mammedov CPUHotplugState *cpu_st, 438872c25aSIgor Mammedov DeviceState *dev, Error **errp); 448872c25aSIgor Mammedov 458872c25aSIgor Mammedov void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st, 468872c25aSIgor Mammedov DeviceState *dev, Error **errp); 478872c25aSIgor Mammedov 485e1b5d93SIgor Mammedov void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner, 495e1b5d93SIgor Mammedov CPUHotplugState *state, hwaddr base_addr); 505e1b5d93SIgor Mammedov 515e1b5d93SIgor Mammedov typedef struct CPUHotplugFeatures { 5289cb0c04SDr. David Alan Gilbert bool acpi_1_compatible; 53679dd1a9SIgor Mammedov bool has_legacy_cphp; 54*69dea9d6SIgor Mammedov bool fw_unplugs_cpu; 55998ba950SIgor Mammedov const char *smi_path; 565e1b5d93SIgor Mammedov } CPUHotplugFeatures; 575e1b5d93SIgor Mammedov 585e1b5d93SIgor Mammedov void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, 595e1b5d93SIgor Mammedov hwaddr io_base, 60d2238cb6SIgor Mammedov const char *res_root, 61d2238cb6SIgor Mammedov const char *event_handler_method); 625e1b5d93SIgor Mammedov 6376623d00SIgor Mammedov void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list); 6476623d00SIgor Mammedov 655e1b5d93SIgor Mammedov extern const VMStateDescription vmstate_cpu_hotplug; 665e1b5d93SIgor Mammedov #define VMSTATE_CPU_HOTPLUG(cpuhp, state) \ 675e1b5d93SIgor Mammedov VMSTATE_STRUCT(cpuhp, state, 1, \ 685e1b5d93SIgor Mammedov vmstate_cpu_hotplug, CPUHotplugState) 695e1b5d93SIgor Mammedov 705e1b5d93SIgor Mammedov #endif 71