memory_hotplug.h 1.9 KB

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