[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/21] hw/i386/acpi: Add object_resolve_type_unambigu
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 10/21] hw/i386/acpi: Add object_resolve_type_unambiguous to improve modularity |
Date: |
Wed, 15 May 2019 22:50:22 +0200 |
From: Philippe Mathieu-Daudé <address@hidden>
When building with CONFIG_Q35=n, we get:
LINK x86_64-softmmu/qemu-system-x86_64
/usr/bin/ld: hw/i386/acpi-build.o: in function `acpi_get_misc_info':
/source/qemu/hw/i386/acpi-build.c:243: undefined reference to `ich9_lpc_find'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:204: qemu-system-x86_64] Error 1
This is due to a dependency in acpi-build.c on the ICH9_LPC
(via ich9_lpc_find) and PIIX4_PM (via piix4_pm_find) devices.
To allow better modularity (compile acpi-build.c with only
Q35/ICH9 or ISAPC/PIIX4), refactor the similar helper as
object_resolve_type_unambiguous(). This way we relax the
linker dependencies and can build the x86 targets with a
selection of machines (instead of all of them).
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/acpi/piix4.c | 11 -----------
hw/i386/acpi-build.c | 20 ++++++++++++++++----
hw/isa/lpc_ich9.c | 11 -----------
include/hw/acpi/piix4.h | 2 --
include/hw/i386/ich9.h | 2 --
5 files changed, 16 insertions(+), 30 deletions(-)
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 160e730..c903e65 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -552,17 +552,6 @@ static void piix4_pm_realize(PCIDevice *dev, Error **errp)
piix4_pm_add_propeties(s);
}
-Object *piix4_pm_find(void)
-{
- bool ambig;
- Object *o = object_resolve_path_type("", TYPE_PIIX4_PM, &ambig);
-
- if (ambig || !o) {
- return NULL;
- }
- return o;
-}
-
I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
qemu_irq sci_irq, qemu_irq smi_irq,
int smm_enabled, DeviceState **piix4_pm)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 416da31..123ff2b 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -35,6 +35,7 @@
#include "hw/acpi/acpi-defs.h"
#include "hw/acpi/acpi.h"
#include "hw/acpi/cpu.h"
+#include "hw/acpi/piix4.h"
#include "hw/nvram/fw_cfg.h"
#include "hw/acpi/bios-linker-loader.h"
#include "hw/loader.h"
@@ -164,10 +165,21 @@ static void init_common_fadt_data(Object *o, AcpiFadtData
*data)
*data = fadt;
}
+static Object *object_resolve_type_unambiguous(const char *typename)
+{
+ bool ambig;
+ Object *o = object_resolve_path_type("", typename, &ambig);
+
+ if (ambig || !o) {
+ return NULL;
+ }
+ return o;
+}
+
static void acpi_get_pm_info(AcpiPmInfo *pm)
{
- Object *piix = piix4_pm_find();
- Object *lpc = ich9_lpc_find();
+ Object *piix = object_resolve_type_unambiguous(TYPE_PIIX4_PM);
+ Object *lpc = object_resolve_type_unambiguous(TYPE_ICH9_LPC_DEVICE);
Object *obj = piix ? piix : lpc;
QObject *o;
pm->cpu_hp_io_base = 0;
@@ -228,8 +240,8 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)
static void acpi_get_misc_info(AcpiMiscInfo *info)
{
- Object *piix = piix4_pm_find();
- Object *lpc = ich9_lpc_find();
+ Object *piix = object_resolve_type_unambiguous(TYPE_PIIX4_PM);
+ Object *lpc = object_resolve_type_unambiguous(TYPE_ICH9_LPC_DEVICE);
assert(!!piix != !!lpc);
if (piix) {
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index ac44aa5..031ee9c 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -624,17 +624,6 @@ static const MemoryRegionOps ich9_rst_cnt_ops = {
.endianness = DEVICE_LITTLE_ENDIAN
};
-Object *ich9_lpc_find(void)
-{
- bool ambig;
- Object *o = object_resolve_path_type("", TYPE_ICH9_LPC_DEVICE, &ambig);
-
- if (ambig) {
- return NULL;
- }
- return o;
-}
-
static void ich9_lpc_get_sci_int(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
diff --git a/include/hw/acpi/piix4.h b/include/hw/acpi/piix4.h
index 57d7e1c..028bb53 100644
--- a/include/hw/acpi/piix4.h
+++ b/include/hw/acpi/piix4.h
@@ -3,6 +3,4 @@
#define TYPE_PIIX4_PM "PIIX4_PM"
-Object *piix4_pm_find(void);
-
#endif
diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index 673d13d..046bcf3 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -81,8 +81,6 @@ typedef struct ICH9LPCState {
qemu_irq gsi[GSI_NUM_PINS];
} ICH9LPCState;
-Object *ich9_lpc_find(void);
-
#define Q35_MASK(bit, ms_bit, ls_bit) \
((uint##bit##_t)(((1ULL << ((ms_bit) + 1)) - 1) & ~((1ULL << ls_bit) - 1)))
--
1.8.3.1
- [Qemu-devel] [PULL 00/21] Misc patches for 2019-05-15, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 01/21] hw/input: Add a CONFIG_PS2 switch for the ps2.c file, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 02/21] roms: assert if max rom size is less than the used size, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 03/21] Declare -realtime as deprecated, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 04/21] vl: Add missing descriptions to the VGA adapters list, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 05/21] megasas: fix mapped frame size, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 06/21] hvf: Add missing break statement, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 08/21] memory: correct the comment to DIRTY_MEMORY_MIGRATION, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 07/21] vl: fix -sandbox parsing crash when seccomp support is disabled, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 09/21] hw/acpi/piix4: Move TYPE_PIIX4_PM to a public header, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 10/21] hw/i386/acpi: Add object_resolve_type_unambiguous to improve modularity,
Paolo Bonzini <=
- [Qemu-devel] [PULL 11/21] hw/i386/acpi: Assert a pointer is not null BEFORE using it, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 12/21] mips-fulong2e: obey -vga none, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 13/21] sun4m: obey -vga none, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 14/21] trace: only include trace-event-subdirs when they are needed, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 20/21] hw/char: Move multi-serial devices into separate file, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 19/21] ioapic: allow buggy guests mishandling level-triggered interrupts to make progress, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 17/21] build: chardev is only needed for softmmu targets, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 15/21] build: replace GENERATED_FILES by generated-files-y, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 16/21] configure: qemu-ga is only needed with softmmu targets, Paolo Bonzini, 2019/05/15
- [Qemu-devel] [PULL 18/21] build: don't build hardware objects with linux-user, Paolo Bonzini, 2019/05/15