]>
Commit | Line | Data |
---|---|---|
3ef77aca IM |
1 | #ifndef QEMU_HW_ACPI_MEMORY_HOTPLUG_H |
2 | #define QEMU_HW_ACPI_MEMORY_HOTPLUG_H | |
3 | ||
4 | #include "hw/qdev-core.h" | |
5 | #include "hw/acpi/acpi.h" | |
30bd0cf4 | 6 | #include "hw/acpi/aml-build.h" |
3ef77aca | 7 | |
091c466e SK |
8 | #define MEMORY_SLOT_SCAN_METHOD "MSCN" |
9 | #define MEMORY_DEVICES_CONTAINER "\\_SB.MHPC" | |
10 | #define MEMORY_HOTPLUG_IO_LEN 24 | |
11 | ||
64fec58e TC |
12 | /** |
13 | * MemStatus: | |
14 | * @is_removing: the memory device in slot has been requested to be ejected. | |
15 | * | |
16 | * This structure stores memory device's status. | |
17 | */ | |
3ef77aca IM |
18 | typedef struct MemStatus { |
19 | DeviceState *dimm; | |
20 | bool is_enabled; | |
21 | bool is_inserting; | |
64fec58e | 22 | bool is_removing; |
3ef77aca IM |
23 | uint32_t ost_event; |
24 | uint32_t ost_status; | |
25 | } MemStatus; | |
26 | ||
27 | typedef struct MemHotplugState { | |
34774320 | 28 | bool is_enabled; /* true if memory hotplug is supported */ |
3ef77aca IM |
29 | MemoryRegion io; |
30 | uint32_t selector; | |
31 | uint32_t dev_count; | |
32 | MemStatus *devs; | |
33 | } MemHotplugState; | |
34 | ||
35 | void acpi_memory_hotplug_init(MemoryRegion *as, Object *owner, | |
091c466e | 36 | MemHotplugState *state, hwaddr io_base); |
3ef77aca | 37 | |
0058c082 | 38 | void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st, |
3ef77aca | 39 | DeviceState *dev, Error **errp); |
0058c082 | 40 | void acpi_memory_unplug_request_cb(HotplugHandler *hotplug_dev, |
64fec58e TC |
41 | MemHotplugState *mem_st, |
42 | DeviceState *dev, Error **errp); | |
f7d3e29d TC |
43 | void acpi_memory_unplug_cb(MemHotplugState *mem_st, |
44 | DeviceState *dev, Error **errp); | |
f816a62d IM |
45 | |
46 | extern const VMStateDescription vmstate_memory_hotplug; | |
47 | #define VMSTATE_MEMORY_HOTPLUG(memhp, state) \ | |
48 | VMSTATE_STRUCT(memhp, state, 1, \ | |
49 | vmstate_memory_hotplug, MemHotplugState) | |
50 | ||
43f50410 | 51 | void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list); |
30bd0cf4 | 52 | |
8dfba500 | 53 | void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem, |
d1957dac | 54 | const char *res_root, |
091c466e SK |
55 | const char *event_handler_method, |
56 | AmlRegionSpace rs, hwaddr memhp_io_base); | |
3ef77aca | 57 | #endif |