@samitouri / QOSamiQemu / commits / 75e92ebbdf

hw/acpi: Move acpi_send_event() function out of acpi_interface.c

acpi_interface.c should only register QOM interfaces. Move the acpi_send_event() function to core.c with the other event handlers, and its declaration in 'hw/acpi/acpi.h'. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20260225035739.42848-3-philmd@linaro.org>

Philippe Mathieu-Daudé committed Feb 24, 2026 at 13:22 UTC 75e92ebbdf6452f21fc2fd14edaffaadf1857635
4 files changed +11 -11
hw/acpi/acpi_interface.c
-9
@@ -4,15 +4,6 @@
4 #include "qemu/module.h"
5 #include "qemu/queue.h"
6
7 -void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event)
8 -{
9 - AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(dev);
10 - if (adevc->send_event) {
11 - AcpiDeviceIf *adev = ACPI_DEVICE_IF(dev);
12 - adevc->send_event(adev, event);
13 - }
14 -}
15 -
7 void qbus_build_aml(BusState *bus, Aml *scope)
8 {
9 BusChild *kid;
hw/acpi/core.c
+10
@@ -22,6 +22,7 @@
22 #include "qemu/osdep.h"
23 #include "hw/core/irq.h"
24 #include "hw/acpi/acpi.h"
25 +#include "hw/acpi/acpi_dev_interface.h"
26 #include "hw/nvram/fw_cfg.h"
27 #include "qemu/config-file.h"
28 #include "qapi/error.h"
@@ -753,3 +754,12 @@ void acpi_update_sci(ACPIREGS *regs, qemu_irq irq)
754 (regs->pm1.evt.en & ACPI_BITMASK_TIMER_ENABLE) &&
755 !(pm1a_sts & ACPI_BITMASK_TIMER_STATUS));
756 }
757 +
758 +void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event)
759 +{
760 + AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(dev);
761 + if (adevc->send_event) {
762 + AcpiDeviceIf *adev = ACPI_DEVICE_IF(dev);
763 + adevc->send_event(adev, event);
764 + }
765 +}
include/hw/acpi/acpi.h
+1
@@ -182,6 +182,7 @@ void acpi_gpe_reset(ACPIREGS *ar);
182 void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val);
183 uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr);
184
185 +void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event);
186 void acpi_send_gpe_event(ACPIREGS *ar, qemu_irq irq,
187 AcpiEventStatusBits status);
188
include/hw/acpi/acpi_dev_interface.h
-2
@@ -27,8 +27,6 @@ DECLARE_CLASS_CHECKERS(AcpiDeviceIfClass, ACPI_DEVICE_IF,
27
28 typedef struct AcpiDeviceIf AcpiDeviceIf;
29
30 -void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event);
31 -
30 /**
31 * AcpiDeviceIfClass:
32 *