1*5e1b5d93SIgor Mammedov /* 2*5e1b5d93SIgor Mammedov * QEMU ACPI hotplug utilities 3*5e1b5d93SIgor Mammedov * 4*5e1b5d93SIgor Mammedov * Copyright (C) 2016 Red Hat Inc 5*5e1b5d93SIgor Mammedov * 6*5e1b5d93SIgor Mammedov * Authors: 7*5e1b5d93SIgor Mammedov * Igor Mammedov <imammedo@redhat.com> 8*5e1b5d93SIgor Mammedov * 9*5e1b5d93SIgor Mammedov * This work is licensed under the terms of the GNU GPL, version 2 or later. 10*5e1b5d93SIgor Mammedov * See the COPYING file in the top-level directory. 11*5e1b5d93SIgor Mammedov */ 12*5e1b5d93SIgor Mammedov #ifndef ACPI_CPU_H 13*5e1b5d93SIgor Mammedov #define ACPI_CPU_H 14*5e1b5d93SIgor Mammedov 15*5e1b5d93SIgor Mammedov #include "hw/qdev-core.h" 16*5e1b5d93SIgor Mammedov #include "hw/acpi/acpi.h" 17*5e1b5d93SIgor Mammedov #include "hw/acpi/aml-build.h" 18*5e1b5d93SIgor Mammedov #include "hw/hotplug.h" 19*5e1b5d93SIgor Mammedov 20*5e1b5d93SIgor Mammedov typedef struct AcpiCpuStatus { 21*5e1b5d93SIgor Mammedov struct CPUState *cpu; 22*5e1b5d93SIgor Mammedov uint64_t arch_id; 23*5e1b5d93SIgor Mammedov } AcpiCpuStatus; 24*5e1b5d93SIgor Mammedov 25*5e1b5d93SIgor Mammedov typedef struct CPUHotplugState { 26*5e1b5d93SIgor Mammedov MemoryRegion ctrl_reg; 27*5e1b5d93SIgor Mammedov uint32_t selector; 28*5e1b5d93SIgor Mammedov uint32_t dev_count; 29*5e1b5d93SIgor Mammedov AcpiCpuStatus *devs; 30*5e1b5d93SIgor Mammedov } CPUHotplugState; 31*5e1b5d93SIgor Mammedov 32*5e1b5d93SIgor Mammedov void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev, 33*5e1b5d93SIgor Mammedov CPUHotplugState *cpu_st, DeviceState *dev, Error **errp); 34*5e1b5d93SIgor Mammedov 35*5e1b5d93SIgor Mammedov void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner, 36*5e1b5d93SIgor Mammedov CPUHotplugState *state, hwaddr base_addr); 37*5e1b5d93SIgor Mammedov 38*5e1b5d93SIgor Mammedov typedef struct CPUHotplugFeatures { 39*5e1b5d93SIgor Mammedov bool apci_1_compatible; 40*5e1b5d93SIgor Mammedov } CPUHotplugFeatures; 41*5e1b5d93SIgor Mammedov 42*5e1b5d93SIgor Mammedov void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, 43*5e1b5d93SIgor Mammedov hwaddr io_base, 44*5e1b5d93SIgor Mammedov const char *res_root); 45*5e1b5d93SIgor Mammedov 46*5e1b5d93SIgor Mammedov extern const VMStateDescription vmstate_cpu_hotplug; 47*5e1b5d93SIgor Mammedov #define VMSTATE_CPU_HOTPLUG(cpuhp, state) \ 48*5e1b5d93SIgor Mammedov VMSTATE_STRUCT(cpuhp, state, 1, \ 49*5e1b5d93SIgor Mammedov vmstate_cpu_hotplug, CPUHotplugState) 50*5e1b5d93SIgor Mammedov 51*5e1b5d93SIgor Mammedov #endif 52