From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5V9L-0007Vg-4k for qemu-devel@nongnu.org; Fri, 11 Jul 2014 03:21:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X5V9E-0006Cn-CF for qemu-devel@nongnu.org; Fri, 11 Jul 2014 03:21:43 -0400 Received: from mail-we0-f171.google.com ([74.125.82.171]:63559) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5V9E-0006CJ-6N for qemu-devel@nongnu.org; Fri, 11 Jul 2014 03:21:36 -0400 Received: by mail-we0-f171.google.com with SMTP id q58so616763wes.2 for ; Fri, 11 Jul 2014 00:21:33 -0700 (PDT) From: Alvise Rigo Date: Fri, 11 Jul 2014 09:21:09 +0200 Message-Id: <1405063270-18902-8-git-send-email-a.rigo@virtualopensystems.com> In-Reply-To: <1405063270-18902-1-git-send-email-a.rigo@virtualopensystems.com> References: <1405063270-18902-1-git-send-email-a.rigo@virtualopensystems.com> Subject: [Qemu-devel] [RFC PATCH 7/8] generic_pci: realize device with machine data List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, rob.herring@linaro.org Cc: tech@virtualopensystems.com, Alvise Rigo Realize the device according to the offsets specified by the machine memory map. Signed-off-by: Alvise Rigo --- hw/pci-host/generic-pci.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/generic-pci.c b/hw/pci-host/generic-pci.c index 2068079..1bde69c 100644 --- a/hw/pci-host/generic-pci.c +++ b/hw/pci-host/generic-pci.c @@ -79,6 +79,7 @@ static void pci_generic_host_realize(DeviceState *dev, Error **errp) { PCIVPBState *s = PCI_GEN(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); + hwaddr *mapping_data; int i; for (i = 0; i < MAX_PCI_DEVICES; i++) { @@ -92,16 +93,19 @@ static void pci_generic_host_realize(DeviceState *dev, Error **errp) * 0 : PCI config window * 1 : PCI IO window * 2 : PCI memory windows + * The CPU addresses and size of each memory region have been set by the + * machine code inside s->dt_data. */ + mapping_data = s->dt_data.addr_mapping; memory_region_init_io(&s->mem_config, OBJECT(s), &pci_vpb_config_ops, s, - "pci-config", 0x1000000); + "pci-config", mapping_data[1]); sysbus_init_mmio(sbd, &s->mem_config); /* The window into I/O space is always into a fixed base address; * its size is the same for both realview and versatile. */ memory_region_init_alias(&s->pci_io_window, OBJECT(s), "pci-io-win", - &s->pci_io_space, 0, 0x10000); + &s->pci_io_space, mapping_data[2], mapping_data[3]); sysbus_init_mmio(sbd, &s->pci_io_space); /* Create the alias regions corresponding to our three windows onto @@ -109,7 +113,7 @@ static void pci_generic_host_realize(DeviceState *dev, Error **errp) * offsets are guest controllable via the IMAP registers. */ memory_region_init_alias(&s->pci_mem_window, OBJECT(s), "pci-mem-win", - &s->pci_mem_space, 0x12000000, 0x2e000000); + &s->pci_mem_space, mapping_data[4], mapping_data[5]); sysbus_init_mmio(sbd, &s->pci_mem_window); /* TODO Remove once realize propagates to child devices. */ -- 1.9.1