Signed-off-by: Hervé Poussineau <hpous...@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