2014-06-02 15:25:16 +02:00
|
|
|
#ifndef QEMU_HW_ACPI_MEMORY_HOTPLUG_H
|
|
|
|
#define QEMU_HW_ACPI_MEMORY_HOTPLUG_H
|
|
|
|
|
|
|
|
#include "hw/qdev-core.h"
|
|
|
|
#include "hw/acpi/acpi.h"
|
2014-06-02 15:25:23 +02:00
|
|
|
#include "migration/vmstate.h"
|
2015-12-28 18:02:09 +01:00
|
|
|
#include "hw/acpi/aml-build.h"
|
2014-06-02 15:25:16 +02:00
|
|
|
|
2015-04-27 10:47:17 +02: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 15:25:16 +02:00
|
|
|
typedef struct MemStatus {
|
|
|
|
DeviceState *dimm;
|
|
|
|
bool is_enabled;
|
|
|
|
bool is_inserting;
|
2015-04-27 10:47:17 +02:00
|
|
|
bool is_removing;
|
2014-06-02 15:25:16 +02:00
|
|
|
uint32_t ost_event;
|
|
|
|
uint32_t ost_status;
|
|
|
|
} MemStatus;
|
|
|
|
|
|
|
|
typedef struct MemHotplugState {
|
2014-06-02 15:25:20 +02:00
|
|
|
bool is_enabled; /* true if memory hotplug is supported */
|
2014-06-02 15:25:16 +02:00
|
|
|
MemoryRegion io;
|
|
|
|
uint32_t selector;
|
|
|
|
uint32_t dev_count;
|
|
|
|
MemStatus *devs;
|
|
|
|
} MemHotplugState;
|
|
|
|
|
|
|
|
void acpi_memory_hotplug_init(MemoryRegion *as, Object *owner,
|
|
|
|
MemHotplugState *state);
|
|
|
|
|
|
|
|
void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
|
|
|
|
DeviceState *dev, Error **errp);
|
2015-04-27 10:47:17 +02:00
|
|
|
void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq,
|
|
|
|
MemHotplugState *mem_st,
|
|
|
|
DeviceState *dev, Error **errp);
|
2015-04-27 10:47:18 +02:00
|
|
|
void acpi_memory_unplug_cb(MemHotplugState *mem_st,
|
|
|
|
DeviceState *dev, Error **errp);
|
2014-06-02 15:25:23 +02: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 19:12:27 +02:00
|
|
|
void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list);
|
2015-12-28 18:02:09 +01:00
|
|
|
|
2015-12-28 18:02:21 +01:00
|
|
|
#define MEMORY_HOTPLUG_DEVICE "MHPD"
|
|
|
|
#define MEMORY_SLOT_SCAN_METHOD "MSCN"
|
2015-12-28 18:02:20 +01:00
|
|
|
#define MEMORY_HOTPLUG_HANDLER_PATH "\\_SB.PCI0." \
|
2015-12-28 18:02:21 +01:00
|
|
|
MEMORY_HOTPLUG_DEVICE "." MEMORY_SLOT_SCAN_METHOD
|
2015-12-28 18:02:20 +01:00
|
|
|
|
2015-12-28 18:02:09 +01:00
|
|
|
void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
|
|
|
|
uint16_t io_base, uint16_t io_len);
|
2014-06-02 15:25:16 +02:00
|
|
|
#endif
|