Browse Source

hw/acpi: Introduce acpi_builtin() helper

acpi_builtin() can be used to check at runtime whether
the ACPI subsystem is built in a qemu-system binary.

Reviewed-by: Ani Sinha <anisinha@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250307223949.54040-3-philmd@linaro.org>
Philippe Mathieu-Daudé 5 months ago
parent
commit
e6ffea40e2
3 changed files with 13 additions and 0 deletions
  1. 5 0
      hw/acpi/acpi-stub.c
  2. 5 0
      hw/acpi/core.c
  3. 3 0
      include/hw/acpi/acpi.h

+ 5 - 0
hw/acpi/acpi-stub.c

@@ -25,3 +25,8 @@ void acpi_table_add(const QemuOpts *opts, Error **errp)
 {
     g_assert_not_reached();
 }
+
+bool acpi_builtin(void)
+{
+    return false;
+}

+ 5 - 0
hw/acpi/core.c

@@ -78,6 +78,11 @@ static void acpi_register_config(void)
 
 opts_init(acpi_register_config);
 
+bool acpi_builtin(void)
+{
+    return true;
+}
+
 static int acpi_checksum(const uint8_t *data, int len)
 {
     int sum, i;

+ 3 - 0
include/hw/acpi/acpi.h

@@ -150,6 +150,9 @@ struct ACPIREGS {
     Notifier wakeup;
 };
 
+/* Return whether ACPI subsystem is built in */
+bool acpi_builtin(void);
+
 /* PM_TMR */
 void acpi_pm_tmr_update(ACPIREGS *ar, bool enable);
 void acpi_pm_tmr_calc_overflow_time(ACPIREGS *ar);