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