Message ID | 76c2fcb7375a3b75f2b46fb24f4902d77df2600a.1345549695.git.julien.grall@citrix.com |
---|---|
State | New |
Headers | show |
Am 22.08.2012 14:27, schrieb Julien Grall: > This function permits to retrieve ISA IO address space. > It will be usefull when we need to pass IO address space as argument. > > Signed-off-by: Julien Grall <julien.grall@citrix.com> > --- > hw/isa-bus.c | 5 +++++ > hw/isa.h | 1 + > 2 files changed, 6 insertions(+), 0 deletions(-) > > diff --git a/hw/isa-bus.c b/hw/isa-bus.c > index f9b2373..662c86b 100644 > --- a/hw/isa-bus.c > +++ b/hw/isa-bus.c > @@ -244,4 +244,9 @@ MemoryRegion *isa_address_space(ISADevice *dev) > return get_system_memory(); > } > > +MemoryRegion *isa_address_space_io(ISADevice *dev) > +{ > + return get_system_io(); > +} Unlike the address_space above, there's an address_space_io field in ISABus, so I guess the implementation of this function should rather obtain the device's BusState via isa_bus_from_device(dev) and return its field rather than hardcoding get_system_io() here. For x86 it shouldn't make a difference but I think on PReP there's two different runtime-switchable I/O space configurations or so... Regards, Andreas > + > type_init(isabus_register_types) > diff --git a/hw/isa.h b/hw/isa.h > index dc97052..3891c1f 100644 > --- a/hw/isa.h > +++ b/hw/isa.h > @@ -43,6 +43,7 @@ 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); > MemoryRegion *isa_address_space(ISADevice *dev); > +MemoryRegion *isa_address_space_io(ISADevice *dev); > ISADevice *isa_create(ISABus *bus, const char *name); > ISADevice *isa_try_create(ISABus *bus, const char *name); > ISADevice *isa_create_simple(ISABus *bus, const char *name);
On 08/24/2012 05:10 PM, Andreas Färber wrote: > Am 22.08.2012 14:27, schrieb Julien Grall: > >> This function permits to retrieve ISA IO address space. >> It will be usefull when we need to pass IO address space as argument. >> >> Signed-off-by: Julien Grall<julien.grall@citrix.com> >> --- >> hw/isa-bus.c | 5 +++++ >> hw/isa.h | 1 + >> 2 files changed, 6 insertions(+), 0 deletions(-) >> >> diff --git a/hw/isa-bus.c b/hw/isa-bus.c >> index f9b2373..662c86b 100644 >> --- a/hw/isa-bus.c >> +++ b/hw/isa-bus.c >> @@ -244,4 +244,9 @@ MemoryRegion *isa_address_space(ISADevice *dev) >> return get_system_memory(); >> } >> >> +MemoryRegion *isa_address_space_io(ISADevice *dev) >> +{ >> + return get_system_io(); >> +} >> > Unlike the address_space above, there's an address_space_io field in > ISABus, so I guess the implementation of this function should rather > obtain the device's BusState via isa_bus_from_device(dev) and return its > field rather than hardcoding get_system_io() here. > I use this function in hw/dma.c. For the moment, the code doesn't use ISA device, so I pass NULL to isa_address_space_io (See patch 6). Instead of using isa_bus_from_device, can I just return "isabus->address_space_io" as in isa_register_portio_list ?
On 2012-08-28 17:42, Julien Grall wrote: > On 08/24/2012 05:10 PM, Andreas Färber wrote: >> Am 22.08.2012 14:27, schrieb Julien Grall: >> >>> This function permits to retrieve ISA IO address space. >>> It will be usefull when we need to pass IO address space as argument. >>> >>> Signed-off-by: Julien Grall<julien.grall@citrix.com> >>> --- >>> hw/isa-bus.c | 5 +++++ >>> hw/isa.h | 1 + >>> 2 files changed, 6 insertions(+), 0 deletions(-) >>> >>> diff --git a/hw/isa-bus.c b/hw/isa-bus.c >>> index f9b2373..662c86b 100644 >>> --- a/hw/isa-bus.c >>> +++ b/hw/isa-bus.c >>> @@ -244,4 +244,9 @@ MemoryRegion *isa_address_space(ISADevice *dev) >>> return get_system_memory(); >>> } >>> >>> +MemoryRegion *isa_address_space_io(ISADevice *dev) >>> +{ >>> + return get_system_io(); >>> +} >>> >> Unlike the address_space above, there's an address_space_io field in >> ISABus, so I guess the implementation of this function should rather >> obtain the device's BusState via isa_bus_from_device(dev) and return its >> field rather than hardcoding get_system_io() here. >> > I use this function in hw/dma.c. For the moment, the code doesn't > use ISA device, so I pass NULL to isa_address_space_io > (See patch 6). Yes, there are some old drivers in QEMU that doesn't follow QOM or even qdev patterns. They may not work on systems Andreas is thinking of anyway. But this is a generic service, so it should try harder: If a device is given, use the io space of its bus. If not, fall back to isabus. Jan
diff --git a/hw/isa-bus.c b/hw/isa-bus.c index f9b2373..662c86b 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -244,4 +244,9 @@ MemoryRegion *isa_address_space(ISADevice *dev) return get_system_memory(); } +MemoryRegion *isa_address_space_io(ISADevice *dev) +{ + return get_system_io(); +} + type_init(isabus_register_types) diff --git a/hw/isa.h b/hw/isa.h index dc97052..3891c1f 100644 --- a/hw/isa.h +++ b/hw/isa.h @@ -43,6 +43,7 @@ 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); MemoryRegion *isa_address_space(ISADevice *dev); +MemoryRegion *isa_address_space_io(ISADevice *dev); ISADevice *isa_create(ISABus *bus, const char *name); ISADevice *isa_try_create(ISABus *bus, const char *name); ISADevice *isa_create_simple(ISABus *bus, const char *name);
This function permits to retrieve ISA IO address space. It will be usefull when we need to pass IO address space as argument. Signed-off-by: Julien Grall <julien.grall@citrix.com> --- hw/isa-bus.c | 5 +++++ hw/isa.h | 1 + 2 files changed, 6 insertions(+), 0 deletions(-)