2014-06-02 17:25:16 +04:00
|
|
|
#ifndef QEMU_HW_ACPI_MEMORY_HOTPLUG_H
|
|
|
|
#define QEMU_HW_ACPI_MEMORY_HOTPLUG_H
|
|
|
|
|
2024-02-19 13:37:37 +03:00
|
|
|
#include "qapi/qapi-types-acpi.h"
|
2014-06-02 17:25:16 +04:00
|
|
|
#include "hw/qdev-core.h"
|
|
|
|
#include "hw/acpi/acpi.h"
|
2015-12-28 20:02:09 +03:00
|
|
|
#include "hw/acpi/aml-build.h"
|
2014-06-02 17:25:16 +04:00
|
|
|
|
2019-09-18 16:06:23 +03:00
|
|
|
#define MEMORY_SLOT_SCAN_METHOD "MSCN"
|
|
|
|
#define MEMORY_DEVICES_CONTAINER "\\_SB.MHPC"
|
|
|
|
#define MEMORY_HOTPLUG_IO_LEN 24
|
|
|
|
|
2015-04-27 11:47:17 +03:00
|
|
|
/**
|
|
|
|
* MemStatus:
|
|
|
|
* @is_removing: the memory device in slot has been requested to be ejected.
|
|
|
|
*
|
|
|
|
* This structure stores memory device's status.
|
|
|
|
*/
|
2014-06-02 17:25:16 +04:00
|
|
|
typedef struct MemStatus {
|
|
|
|
DeviceState *dimm;
|
|
|
|
bool is_enabled;
|
|
|
|
bool is_inserting;
|
2015-04-27 11:47:17 +03:00
|
|
|
bool is_removing;
|
2014-06-02 17:25:16 +04:00
|
|
|
uint32_t ost_event;
|
|
|
|
uint32_t ost_status;
|
|
|
|
} MemStatus;
|
|
|
|
|
|
|
|
typedef struct MemHotplugState {
|
2014-06-02 17:25:20 +04:00
|
|
|
bool is_enabled; /* true if memory hotplug is supported */
|
2014-06-02 17:25:16 +04:00
|
|
|
MemoryRegion io;
|
|
|
|
uint32_t selector;
|
|
|
|
uint32_t dev_count;
|
|
|
|
MemStatus *devs;
|
|
|
|
} MemHotplugState;
|
|
|
|
|
|
|
|
void acpi_memory_hotplug_init(MemoryRegion *as, Object *owner,
|
2019-09-18 16:06:23 +03:00
|
|
|
MemHotplugState *state, hwaddr io_base);
|
2014-06-02 17:25:16 +04:00
|
|
|
|
2016-05-31 13:01:17 +03:00
|
|
|
void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,
|
2014-06-02 17:25:16 +04:00
|
|
|
DeviceState *dev, Error **errp);
|
2016-05-31 13:01:17 +03:00
|
|
|
void acpi_memory_unplug_request_cb(HotplugHandler *hotplug_dev,
|
2015-04-27 11:47:17 +03:00
|
|
|
MemHotplugState *mem_st,
|
|
|
|
DeviceState *dev, Error **errp);
|
2015-04-27 11:47:18 +03:00
|
|
|
void acpi_memory_unplug_cb(MemHotplugState *mem_st,
|
|
|
|
DeviceState *dev, Error **errp);
|
2014-06-02 17:25:23 +04:00
|
|
|
|
|
|
|
extern const VMStateDescription vmstate_memory_hotplug;
|
|
|
|
#define VMSTATE_MEMORY_HOTPLUG(memhp, state) \
|
|
|
|
VMSTATE_STRUCT(memhp, state, 1, \
|
|
|
|
vmstate_memory_hotplug, MemHotplugState)
|
|
|
|
|
2014-06-16 21:12:27 +04:00
|
|
|
void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list);
|
2015-12-28 20:02:09 +03:00
|
|
|
|
2016-12-06 02:32:24 +03:00
|
|
|
void build_memory_hotplug_aml(Aml *table, uint32_t nr_mem,
|
2016-12-06 02:32:26 +03:00
|
|
|
const char *res_root,
|
2019-09-18 16:06:23 +03:00
|
|
|
const char *event_handler_method,
|
|
|
|
AmlRegionSpace rs, hwaddr memhp_io_base);
|
2014-06-02 17:25:16 +04:00
|
|
|
#endif
|