提交 bb2ed009 编写于 作者: H Hervé Poussineau 提交者: Leon Alrae

isa: add memory space parameter to isa_bus_new

Currently, keep current behaviour by always using get_system_memory().

Also use QOM casts when possible.
Signed-off-by: NHervé Poussineau <hpoussin@reactos.org>
Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NLeon Alrae <leon.alrae@imgtec.com>
上级 cd2d5541
......@@ -920,7 +920,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,
{
qemu_irq isa_pci_irq, *isa_irqs;
*isa_bus = isa_bus_new(NULL, &s->pchip.reg_io);
*isa_bus = isa_bus_new(NULL, get_system_memory(), &s->pchip.reg_io);
isa_pci_irq = *qemu_allocate_irqs(typhoon_set_isa_irq, s, 1);
isa_irqs = i8259_init(*isa_bus, isa_pci_irq);
isa_bus_irqs(*isa_bus, isa_irqs);
......
......@@ -208,7 +208,7 @@ static void pc_init1(MachineState *machine,
} else {
pci_bus = NULL;
i440fx_state = NULL;
isa_bus = isa_bus_new(NULL, system_io);
isa_bus = isa_bus_new(NULL, get_system_memory(), system_io);
no_hpet = 1;
}
isa_bus_irqs(isa_bus, gsi);
......
......@@ -75,7 +75,8 @@ static int i82378_initfn(PCIDevice *pci)
pci_config_set_interrupt_pin(pci_conf, 1); /* interrupt pin 0 */
isabus = isa_bus_new(dev, pci_address_space_io(pci));
isabus = isa_bus_new(dev, get_system_memory(),
pci_address_space_io(pci));
/* This device has:
2 82C59 (irq)
......
......@@ -21,7 +21,6 @@
#include "hw/sysbus.h"
#include "sysemu/sysemu.h"
#include "hw/isa/isa.h"
#include "exec/address-spaces.h"
static ISABus *isabus;
hwaddr isa_mem_base = 0;
......@@ -44,7 +43,8 @@ static const TypeInfo isa_bus_info = {
.class_init = isa_bus_class_init,
};
ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io)
ISABus *isa_bus_new(DeviceState *dev, MemoryRegion* address_space,
MemoryRegion *address_space_io)
{
if (isabus) {
fprintf(stderr, "Can't create a second ISA bus\n");
......@@ -56,6 +56,7 @@ ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io)
}
isabus = ISA_BUS(qbus_create(TYPE_ISA_BUS, dev, NULL));
isabus->address_space = address_space;
isabus->address_space_io = address_space_io;
return isabus;
}
......@@ -250,7 +251,11 @@ static char *isabus_get_fw_dev_path(DeviceState *dev)
MemoryRegion *isa_address_space(ISADevice *dev)
{
return get_system_memory();
if (dev) {
return isa_bus_from_device(dev)->address_space;
}
return isabus->address_space;
}
MemoryRegion *isa_address_space_io(ISADevice *dev)
......
......@@ -575,7 +575,7 @@ static int ich9_lpc_init(PCIDevice *d)
ICH9LPCState *lpc = ICH9_LPC_DEVICE(d);
ISABus *isa_bus;
isa_bus = isa_bus_new(&d->qdev, get_system_io());
isa_bus = isa_bus_new(DEVICE(d), get_system_memory(), get_system_io());
pci_set_long(d->wmask + ICH9_LPC_PMBASE,
ICH9_LPC_PMBASE_BASE_ADDRESS_MASK);
......
......@@ -86,7 +86,8 @@ static int piix4_initfn(PCIDevice *dev)
{
PIIX4State *d = DO_UPCAST(PIIX4State, dev, dev);
isa_bus_new(&d->dev.qdev, pci_address_space_io(dev));
isa_bus_new(DEVICE(d), get_system_memory(),
pci_address_space_io(dev));
piix4_dev = &d->dev;
qemu_register_reset(piix4_reset, d);
return 0;
......
......@@ -429,7 +429,8 @@ static int vt82c686b_initfn(PCIDevice *d)
uint8_t *wmask;
int i;
isa_bus = isa_bus_new(&d->qdev, pci_address_space_io(d));
isa_bus = isa_bus_new(DEVICE(d), get_system_memory(),
pci_address_space_io(d));
pci_conf = d->config;
pci_config_set_prog_interface(pci_conf, 0x0);
......
......@@ -219,7 +219,7 @@ static void mips_jazz_init(MemoryRegion *address_space,
memory_region_add_subregion(address_space, 0x8000d000, dma_dummy);
/* ISA devices */
isa_bus = isa_bus_new(NULL, address_space_io);
isa_bus = isa_bus_new(NULL, get_system_memory(), address_space_io);
i8259 = i8259_init(isa_bus, env->irq[4]);
isa_bus_irqs(isa_bus, i8259);
cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);
......
......@@ -268,7 +268,7 @@ void mips_r4k_init(MachineState *machine)
cpu_mips_clock_init(env);
/* The PIC is attached to the MIPS CPU INT0 pin */
isa_bus = isa_bus_new(NULL, get_system_io());
isa_bus = isa_bus_new(NULL, get_system_memory(), get_system_io());
i8259 = i8259_init(isa_bus, env->irq[2]);
isa_bus_irqs(isa_bus, i8259);
......
......@@ -635,7 +635,8 @@ static int piix3_initfn(PCIDevice *dev)
{
PIIX3State *d = DO_UPCAST(PIIX3State, dev, dev);
isa_bus_new(DEVICE(d), pci_address_space_io(dev));
isa_bus_new(DEVICE(d), get_system_memory(),
pci_address_space_io(dev));
memory_region_init_io(&d->rcr_mem, OBJECT(dev), &rcr_ops, d,
"piix3-reset-control", 1);
......
......@@ -596,7 +596,8 @@ pci_ebus_init1(PCIDevice *pci_dev)
{
EbusState *s = DO_UPCAST(EbusState, pci_dev, pci_dev);
isa_bus_new(&pci_dev->qdev, pci_address_space_io(pci_dev));
isa_bus_new(DEVICE(pci_dev), get_system_memory(),
pci_address_space_io(pci_dev));
pci_dev->config[0x04] = 0x06; // command = bus master, pci mem
pci_dev->config[0x05] = 0x00;
......
......@@ -36,6 +36,7 @@ struct ISABus {
BusState parent_obj;
/*< public >*/
MemoryRegion *address_space;
MemoryRegion *address_space_io;
qemu_irq *irqs;
};
......@@ -50,7 +51,8 @@ struct ISADevice {
int ioport_id;
};
ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io);
ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space,
MemoryRegion *address_space_io);
void isa_bus_irqs(ISABus *bus, qemu_irq *irqs);
qemu_irq isa_get_irq(ISADevice *dev, int isairq);
void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册