From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Cc: "Hervé Poussineau" <hpoussin@reactos.org>
Subject: [Qemu-devel] [RFC 6/6] isa: improve bus implementation of ebus bridge
Date: Sat, 20 Aug 2011 16:56:35 +0200 [thread overview]
Message-ID: <1313852195-23081-7-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <1313852195-23081-1-git-send-email-hpoussin@reactos.org>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
hw/sun4u.c | 39 ++++++++++++++++++++++++++++++++-------
1 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 7e5a7e1..898541e 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -38,6 +38,7 @@
#include "loader.h"
#include "elf.h"
#include "blockdev.h"
+#include "exec-memory.h"
//#define DEBUG_IRQ
//#define DEBUG_EBUS
@@ -93,6 +94,9 @@ struct hwdef {
typedef struct EbusState {
PCIDevice pci_dev;
+ ISABus bus;
+ MemoryRegion isa_mem_space;
+ qemu_irq *isa_irq;
MemoryRegion bar0;
MemoryRegion bar1;
} EbusState;
@@ -532,19 +536,40 @@ static void dummy_isa_irq_handler(void *opaque, int n, int level)
static void
pci_ebus_init(PCIBus *bus, int devfn)
{
- qemu_irq *isa_irq;
-
pci_create_simple(bus, devfn, "ebus");
- isa_irq = qemu_allocate_irqs(dummy_isa_irq_handler, NULL, 16);
- isa_bus_irqs(isa_irq);
}
+static qemu_irq pci_ebus_get_irq(ISABus *bus, int isairq)
+{
+ EbusState *s = container_of(bus, EbusState, bus);
+ if (isairq < 0 || isairq >= 16) {
+ hw_error("isa irq %d invalid", isairq);
+ }
+ return s->isa_irq[isairq];
+}
+
+static MemoryRegion *pci_ebus_get_address_space(ISABus *bus)
+{
+ EbusState *s = container_of(bus, EbusState, bus);
+ return &s->isa_mem_space;
+}
+
+static ISABusOps pci_ebus_ops = {
+ .get_irq = pci_ebus_get_irq,
+ .get_address_space = pci_ebus_get_address_space,
+};
+
static int
pci_ebus_init1(PCIDevice *pci_dev)
{
EbusState *s = DO_UPCAST(EbusState, pci_dev, pci_dev);
- isa_bus_bridge_init(&pci_dev->qdev);
+ isa_bus_new(&s->bus, &pci_ebus_ops, &pci_dev->qdev);
+ memory_region_init(&s->isa_mem_space, "isa-memory", 0x00100000);
+ memory_region_add_subregion(get_system_memory(),
+ APB_PCI_IO_BASE,
+ &s->isa_mem_space);
+ s->isa_irq = qemu_allocate_irqs(dummy_isa_irq_handler, NULL, 16);
pci_dev->config[0x04] = 0x06; // command = bus master, pci mem
pci_dev->config[0x05] = 0x00;
@@ -759,12 +784,12 @@ static void sun4uv_init(ram_addr_t RAM_size,
irq = qemu_allocate_irqs(cpu_set_irq, env, MAX_PILS);
pci_bus = pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, irq, &pci_bus2,
&pci_bus3);
- isa_mem_base = APB_PCI_IO_BASE;
- pci_vga_init(pci_bus);
// XXX Should be pci_bus3
pci_ebus_init(pci_bus, -1);
+ pci_vga_init(pci_bus);
+
i = 0;
if (hwdef->console_serial_base) {
serial_mm_init(hwdef->console_serial_base, 0, NULL, 115200,
--
1.7.5.4
next prev parent reply other threads:[~2011-08-20 14:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-20 14:56 [Qemu-devel] [RFC 0/6] ISA bus improvements Hervé Poussineau
2011-08-20 14:56 ` [Qemu-devel] [RFC 1/6] isa: rename isa_bus_new to isa_bus_bridge_init Hervé Poussineau
2011-08-20 14:56 ` [Qemu-devel] [RFC 2/6] isa: rework ISA bus internals, and add ISA bus ops structure Hervé Poussineau
2011-08-20 14:56 ` [Qemu-devel] [RFC 3/6] isa: add isa_address_space() method Hervé Poussineau
2011-08-20 14:56 ` [Qemu-devel] [RFC 4/6] vga: use " Hervé Poussineau
2011-08-20 14:56 ` [Qemu-devel] [RFC 5/6] isa: improve bus implementation of PIIX3 bridge Hervé Poussineau
2011-08-20 14:56 ` Hervé Poussineau [this message]
2011-08-20 20:12 ` [Qemu-devel] [RFC 6/6] isa: improve bus implementation of ebus bridge Richard Henderson
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=1313852195-23081-7-git-send-email-hpoussin@reactos.org \
--to=hpoussin@reactos.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).