1
2
3
4
5
6
7
8
9
10
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
20typedef struct AcpiCpuStatus {
21 struct CPUState *cpu;
22 uint64_t arch_id;
23 bool is_inserting;
24 bool is_removing;
25 uint32_t ost_event;
26 uint32_t ost_status;
27} AcpiCpuStatus;
28
29typedef struct CPUHotplugState {
30 MemoryRegion ctrl_reg;
31 uint32_t selector;
32 uint8_t command;
33 uint32_t dev_count;
34 AcpiCpuStatus *devs;
35} CPUHotplugState;
36
37void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
38 CPUHotplugState *cpu_st, DeviceState *dev, Error **errp);
39
40void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
41 CPUHotplugState *cpu_st,
42 DeviceState *dev, Error **errp);
43
44void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st,
45 DeviceState *dev, Error **errp);
46
47void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
48 CPUHotplugState *state, hwaddr base_addr);
49
50typedef struct CPUHotplugFeatures {
51 bool apci_1_compatible;
52 bool has_legacy_cphp;
53} CPUHotplugFeatures;
54
55void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
56 hwaddr io_base,
57 const char *res_root,
58 const char *event_handler_method);
59
60void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list);
61
62extern const VMStateDescription vmstate_cpu_hotplug;
63#define VMSTATE_CPU_HOTPLUG(cpuhp, state) \
64 VMSTATE_STRUCT(cpuhp, state, 1, \
65 vmstate_cpu_hotplug, CPUHotplugState)
66
67#endif
68