]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/i386/fw_cfg: Check ACPI availability with acpi_builtin()
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Fri, 7 Mar 2025 15:01:59 +0000 (16:01 +0100)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 11 Mar 2025 19:03:26 +0000 (20:03 +0100)
Define acpi_tables / acpi_tables_len stubs, then replace the
compile-time CONFIG_ACPI check in fw_cfg.c by a runtime one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ani Sinha <anisinha@redhat.com>
Message-Id: <20250307223949.54040-4-philmd@linaro.org>

hw/acpi/acpi-stub.c
hw/i386/fw_cfg.c

index 790bf509e5d86bc73550cc3bff80ba3691fb80f0..fd0b62fad9e42cb8513cbaae84d605a55a3728dc 100644 (file)
@@ -21,6 +21,9 @@
 #include "qemu/osdep.h"
 #include "hw/acpi/acpi.h"
 
+char unsigned *acpi_tables;
+size_t acpi_tables_len;
+
 void acpi_table_add(const QemuOpts *opts, Error **errp)
 {
     g_assert_not_reached();
index d08aefa029153ef5740f90b8cfc598e02be5319f..a7f1b60b98c0e595996e0449a7cb13424768a691 100644 (file)
@@ -145,10 +145,10 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms,
      */
     fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, apic_id_limit);
     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, ms->ram_size);
-#ifdef CONFIG_ACPI
-    fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES,
-                     acpi_tables, acpi_tables_len);
-#endif
+    if (acpi_builtin()) {
+        fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES,
+                         acpi_tables, acpi_tables_len);
+    }
     fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, 1);
 
     fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, &hpet_fw_cfg, sizeof(hpet_fw_cfg));