acpi-qmp-cmds.c 789 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * QMP commands related to ACPI
  3. *
  4. * This work is licensed under the terms of the GNU GPL, version 2 or
  5. * (at your option) any later version.
  6. */
  7. #include "qemu/osdep.h"
  8. #include "hw/acpi/acpi_dev_interface.h"
  9. #include "qapi/error.h"
  10. #include "qapi/qapi-commands-acpi.h"
  11. ACPIOSTInfoList *qmp_query_acpi_ospm_status(Error **errp)
  12. {
  13. bool ambig;
  14. ACPIOSTInfoList *head = NULL;
  15. ACPIOSTInfoList **prev = &head;
  16. Object *obj = object_resolve_path_type("", TYPE_ACPI_DEVICE_IF, &ambig);
  17. if (obj) {
  18. AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(obj);
  19. AcpiDeviceIf *adev = ACPI_DEVICE_IF(obj);
  20. adevc->ospm_status(adev, &prev);
  21. } else {
  22. error_setg(errp, "command is not supported, missing ACPI device");
  23. }
  24. return head;
  25. }