block/amend: Check whether the node exists
[qemu.git] / include / hw / acpi / cpu.h
blob62f0278ba2586fbe2fdaf553691e4a20c5cccf5d
1 /*
2 * QEMU ACPI hotplug utilities
4 * Copyright (C) 2016 Red Hat Inc
6 * Authors:
7 * Igor Mammedov <imammedo@redhat.com>
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.
12 #ifndef ACPI_CPU_H
13 #define ACPI_CPU_H
15 #include "hw/qdev-core.h"
16 #include "hw/acpi/acpi.h"
17 #include "hw/acpi/aml-build.h"
18 #include "hw/hotplug.h"
20 typedef 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;
29 typedef struct CPUHotplugState {
30 MemoryRegion ctrl_reg;
31 uint32_t selector;
32 uint8_t command;
33 uint32_t dev_count;
34 AcpiCpuStatus *devs;
35 } CPUHotplugState;
37 void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
38 CPUHotplugState *cpu_st, DeviceState *dev, Error **errp);
40 void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
41 CPUHotplugState *cpu_st,
42 DeviceState *dev, Error **errp);
44 void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st,
45 DeviceState *dev, Error **errp);
47 void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
48 CPUHotplugState *state, hwaddr base_addr);
50 typedef struct CPUHotplugFeatures {
51 bool acpi_1_compatible;
52 bool has_legacy_cphp;
53 } CPUHotplugFeatures;
55 void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
56 hwaddr io_base,
57 const char *res_root,
58 const char *event_handler_method);
60 void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list);
62 extern const VMStateDescription vmstate_cpu_hotplug;
63 #define VMSTATE_CPU_HOTPLUG(cpuhp, state) \
64 VMSTATE_STRUCT(cpuhp, state, 1, \
65 vmstate_cpu_hotplug, CPUHotplugState)
67 #endif