Seach for virtio-mmio devices in the DSDT table, register the devices found.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- src/hw/virtio-mmio.h | 1 + src/fw/paravirt.c | 2 ++ src/hw/virtio-mmio.c | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+)
diff --git a/src/hw/virtio-mmio.h b/src/hw/virtio-mmio.h index 9e0dae421009..69fbd23c3101 100644 --- a/src/hw/virtio-mmio.h +++ b/src/hw/virtio-mmio.h @@ -70,6 +70,7 @@ typedef struct virtio_mmio_cfg { u32 config_generation; } virtio_mmio_cfg;
+void virtio_mmio_setup_acpi(void); void virtio_mmio_setup_one(u64 mmio); void vp_init_mmio(struct vp_device *vp, void *mmio);
diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c index 9247288a28c3..e446569345c1 100644 --- a/src/fw/paravirt.c +++ b/src/fw/paravirt.c @@ -16,6 +16,7 @@ #include "hw/pci_regs.h" // PCI_DEVICE_ID #include "hw/serialio.h" // PORT_SERIAL1 #include "hw/rtc.h" // CMOS_* +#include "hw/virtio-mmio.h" // virtio_mmio_acpi #include "malloc.h" // malloc_tmp #include "output.h" // dprintf #include "paravirt.h" // qemu_cfg_preinit @@ -235,6 +236,7 @@ qemu_platform_setup(void)
if (RsdpAddr) { acpi_dsdt_parse(); + virtio_mmio_setup_acpi(); return; } /* If present, loader should have installed an RSDP. diff --git a/src/hw/virtio-mmio.c b/src/hw/virtio-mmio.c index dabef7b7e53a..44344a4993f4 100644 --- a/src/hw/virtio-mmio.c +++ b/src/hw/virtio-mmio.c @@ -3,12 +3,32 @@ #include "output.h" // dprintf #include "stacks.h" // run_thread #include "string.h" // memset +#include "util.h" // acpi_dsdt_* #include "virtio-pci.h" #include "virtio-blk.h" #include "virtio-scsi.h" #include "virtio-ring.h" #include "virtio-mmio.h"
+void virtio_mmio_setup_acpi(void) +{ + static const char *virtio_hid = "LNRO0005"; + struct acpi_device *dev; + u64 mem, irq, unused; + + for (dev = acpi_dsdt_find_string(NULL, virtio_hid); + dev != NULL; + dev = acpi_dsdt_find_string(dev, virtio_hid)) { + if (acpi_dsdt_find_mem(dev, &mem, &unused) < 0) + continue; + if (acpi_dsdt_find_irq(dev, &irq) < 0) + continue; + dprintf(1, "ACPI: virtio-mmio device %s at 0x%llx, irq %lld\n", + acpi_dsdt_name(dev), mem, irq); + virtio_mmio_setup_one(mem); + } +} + void virtio_mmio_setup_one(u64 addr) { static const char *names[] = {