Igor Mammedov | 5e1b5d9 | 2016-06-14 16:02:06 +0200 | [diff] [blame] | 1 | /* |
| 2 | * QEMU ACPI hotplug utilities |
| 3 | * |
| 4 | * Copyright (C) 2016 Red Hat Inc |
| 5 | * |
| 6 | * Authors: |
| 7 | * Igor Mammedov <imammedo@redhat.com> |
| 8 | * |
| 9 | * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| 10 | * See the COPYING file in the top-level directory. |
| 11 | */ |
| 12 | #ifndef ACPI_CPU_H |
| 13 | #define ACPI_CPU_H |
| 14 | |
| 15 | #include "hw/qdev-core.h" |
| 16 | #include "hw/acpi/acpi.h" |
| 17 | #include "hw/acpi/aml-build.h" |
| 18 | #include "hw/hotplug.h" |
| 19 | |
| 20 | typedef struct AcpiCpuStatus { |
| 21 | struct CPUState *cpu; |
| 22 | uint64_t arch_id; |
Igor Mammedov | d2238cb | 2016-06-14 16:13:32 +0200 | [diff] [blame] | 23 | bool is_inserting; |
Igor Mammedov | 8872c25 | 2016-06-14 16:14:02 +0200 | [diff] [blame] | 24 | bool is_removing; |
Igor Mammedov | 1e6107d | 2020-12-07 09:07:33 -0500 | [diff] [blame] | 25 | bool fw_remove; |
Igor Mammedov | 76623d0 | 2016-04-22 19:06:36 +0200 | [diff] [blame] | 26 | uint32_t ost_event; |
| 27 | uint32_t ost_status; |
Igor Mammedov | 5e1b5d9 | 2016-06-14 16:02:06 +0200 | [diff] [blame] | 28 | } AcpiCpuStatus; |
| 29 | |
| 30 | typedef struct CPUHotplugState { |
| 31 | MemoryRegion ctrl_reg; |
| 32 | uint32_t selector; |
Igor Mammedov | d2238cb | 2016-06-14 16:13:32 +0200 | [diff] [blame] | 33 | uint8_t command; |
Igor Mammedov | 5e1b5d9 | 2016-06-14 16:02:06 +0200 | [diff] [blame] | 34 | uint32_t dev_count; |
| 35 | AcpiCpuStatus *devs; |
| 36 | } CPUHotplugState; |
| 37 | |
| 38 | void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev, |
| 39 | CPUHotplugState *cpu_st, DeviceState *dev, Error **errp); |
| 40 | |
Igor Mammedov | 8872c25 | 2016-06-14 16:14:02 +0200 | [diff] [blame] | 41 | void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev, |
| 42 | CPUHotplugState *cpu_st, |
| 43 | DeviceState *dev, Error **errp); |
| 44 | |
| 45 | void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st, |
| 46 | DeviceState *dev, Error **errp); |
| 47 | |
Igor Mammedov | 5e1b5d9 | 2016-06-14 16:02:06 +0200 | [diff] [blame] | 48 | void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner, |
| 49 | CPUHotplugState *state, hwaddr base_addr); |
| 50 | |
| 51 | typedef struct CPUHotplugFeatures { |
Dr. David Alan Gilbert | 89cb0c0 | 2019-01-25 09:40:46 +0000 | [diff] [blame] | 52 | bool acpi_1_compatible; |
Igor Mammedov | 679dd1a | 2016-06-15 11:25:23 +0200 | [diff] [blame] | 53 | bool has_legacy_cphp; |
Igor Mammedov | 69dea9d | 2020-12-07 09:07:36 -0500 | [diff] [blame] | 54 | bool fw_unplugs_cpu; |
Igor Mammedov | 998ba95 | 2020-09-23 05:46:47 -0400 | [diff] [blame] | 55 | const char *smi_path; |
Igor Mammedov | 5e1b5d9 | 2016-06-14 16:02:06 +0200 | [diff] [blame] | 56 | } CPUHotplugFeatures; |
| 57 | |
| 58 | void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, |
| 59 | hwaddr io_base, |
Igor Mammedov | d2238cb | 2016-06-14 16:13:32 +0200 | [diff] [blame] | 60 | const char *res_root, |
| 61 | const char *event_handler_method); |
Igor Mammedov | 5e1b5d9 | 2016-06-14 16:02:06 +0200 | [diff] [blame] | 62 | |
Igor Mammedov | 76623d0 | 2016-04-22 19:06:36 +0200 | [diff] [blame] | 63 | void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list); |
| 64 | |
Igor Mammedov | 5e1b5d9 | 2016-06-14 16:02:06 +0200 | [diff] [blame] | 65 | extern const VMStateDescription vmstate_cpu_hotplug; |
| 66 | #define VMSTATE_CPU_HOTPLUG(cpuhp, state) \ |
| 67 | VMSTATE_STRUCT(cpuhp, state, 1, \ |
| 68 | vmstate_cpu_hotplug, CPUHotplugState) |
| 69 | |
| 70 | #endif |