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"
6#include "hw/acpi/aml-build.h"
7
8
9
10
11
12
13
14typedef struct MemStatus {
15 DeviceState *dimm;
16 bool is_enabled;
17 bool is_inserting;
18 bool is_removing;
19 uint32_t ost_event;
20 uint32_t ost_status;
21} MemStatus;
22
23typedef struct MemHotplugState {
24 bool is_enabled;
25 MemoryRegion io;
26 uint32_t selector;
27 uint32_t dev_count;
28 MemStatus *devs;
29} MemHotplugState;
30
31void acpi_memory_hotplug_init(MemoryRegion *as, Object *owner,
32 MemHotplugState *state, uint16_t io_base);
33
34void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,
35 DeviceState *dev, Error **errp);
36void acpi_memory_unplug_request_cb(HotplugHandler *hotplug_dev,
37 MemHotplugState *mem_st,
38 DeviceState *dev, Error **errp);
39void acpi_memory_unplug_cb(MemHotplugState *mem_st,
40 DeviceState *dev, Error **errp);
41
42extern const VMStateDescription vmstate_memory_hotplug;
43#define VMSTATE_MEMORY_HOTPLUG(memhp, state) \
44 VMSTATE_STRUCT(memhp, state, 1, \
45 vmstate_memory_hotplug, MemHotplugState)
46
47void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list);
48
49void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
50 const char *res_root,
51 const char *event_handler_method);
52#endif
53