All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Cc: "Leon Alrae" <leon.alrae@imgtec.com>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [Qemu-devel] [PATCH 6/7] gt64xxx: remove isa_mem_base usage
Date: Mon, 19 Jan 2015 22:28:36 +0100	[thread overview]
Message-ID: <1421702918-27143-7-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <1421702918-27143-1-git-send-email-hpoussin@reactos.org>

Create a custom address space for PCI memory region and use it for the PCI bus.

However, continue to hardcode VGA window address at 0x10000000 instead of
calculating its address dynamically.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

---
I would be quite happy if someone knowing gt64xxx better than me can provide
a better patch.
---
 hw/mips/gt64xxx_pci.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index 1f2fe5f..eb323cb 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -240,6 +240,9 @@ typedef struct GT64120State {
     uint32_t regs[GT_REGS];
     PCI_MAPPING_ENTRY(PCI0IO);
     PCI_MAPPING_ENTRY(ISD);
+    MemoryRegion pci0_mem;
+    MemoryRegion vga_window;
+    AddressSpace pci0_mem_as;
 } GT64120State;
 
 /* Adjust range to avoid touching space which isn't mappable via PCI */
@@ -302,7 +305,6 @@ static void gt64120_pci_mapping(GT64120State *s)
       /* Map new IO address */
       s->PCI0IO_start = s->regs[GT_PCI0IOLD] << 21;
       s->PCI0IO_length = ((s->regs[GT_PCI0IOHD] + 1) - (s->regs[GT_PCI0IOLD] & 0x7f)) << 21;
-      isa_mem_base = s->PCI0IO_start;
       if (s->PCI0IO_length) {
           memory_region_init_alias(&s->PCI0IO_mem, OBJECT(s), "isa_mmio",
                                    get_system_io(), 0, s->PCI0IO_length);
@@ -1124,10 +1126,16 @@ PCIBus *gt64120_register(qemu_irq *pic)
     qdev_init_nofail(dev);
     d = GT64120_PCI_HOST_BRIDGE(dev);
     phb = PCI_HOST_BRIDGE(dev);
+    memory_region_init(&d->pci0_mem, OBJECT(dev), "pci0-mem", UINT32_MAX);
+    address_space_init(&d->pci0_mem_as, &d->pci0_mem, "pci0-mem");
+    memory_region_init_alias(&d->vga_window, OBJECT(dev), "vga",
+                             &d->pci0_mem, 0xa0000, QEMU_PCI_VGA_MEM_SIZE);
+    memory_region_add_subregion_overlap(get_system_memory(), 0x10000000,
+                                        &d->vga_window, 1);
     phb->bus = pci_register_bus(dev, "pci",
                                 gt64120_pci_set_irq, gt64120_pci_map_irq,
                                 pic,
-                                get_system_memory(),
+                                &d->pci0_mem,
                                 get_system_io(),
                                 PCI_DEVFN(18, 0), 4, TYPE_PCI_BUS);
     memory_region_init_io(&d->ISD_mem, OBJECT(dev), &isd_mem_ops, d, "isd-mem", 0x1000);
@@ -1142,11 +1150,6 @@ static int gt64120_init(SysBusDevice *dev)
 
     s = GT64120_PCI_HOST_BRIDGE(dev);
 
-    /* FIXME: This value is computed from registers during reset, but some
-       devices (e.g. VGA card) need to know it when they are registered.
-       This also mean that changing the register to change the mapping
-       does not fully work. */
-    isa_mem_base = 0x10000000;
     qemu_register_reset(gt64120_reset, s);
     return 0;
 }
-- 
1.7.10.4

  parent reply	other threads:[~2015-01-19 21:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-19 21:28 [Qemu-devel] [PATCH 0/7] isa: remove isa_mem_base variable Hervé Poussineau
2015-01-19 21:28 ` [Qemu-devel] [PATCH 1/7] isa: add memory space parameter to isa_bus_new Hervé Poussineau
2015-01-20 10:44   ` Paolo Bonzini
2015-01-19 21:28 ` [Qemu-devel] [PATCH 2/7] jazz: do not explode QEMUMachineInitArgs structure Hervé Poussineau
2015-01-19 21:28 ` [Qemu-devel] [PATCH 3/7] jazz: remove usage of isa_mem_base Hervé Poussineau
2015-01-19 21:28 ` [Qemu-devel] [PATCH 4/7] mips: remove isa_mem_base usage Hervé Poussineau
2015-01-19 21:28 ` [Qemu-devel] [PATCH 5/7] piix4: use PCI address space instead of system memory Hervé Poussineau
2015-01-19 21:28 ` Hervé Poussineau [this message]
2015-01-19 21:28 ` [Qemu-devel] [PATCH 7/7] isa: remove isa_mem_base variable Hervé Poussineau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421702918-27143-7-git-send-email-hpoussin@reactos.org \
    --to=hpoussin@reactos.org \
    --cc=aurelien@aurel32.net \
    --cc=leon.alrae@imgtec.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.