On 10/09/2012 06:57 PM, Bhushan Bharat-R65777 wrote: > > >> -----Original Message----- >> From: Avi Kivity [mailto:a...@redhat.com] >> Sent: Tuesday, October 09, 2012 10:24 PM >> To: Bhushan Bharat-R65777 >> Cc: Andreas Färber; ag...@suse.de; qemu-...@nongnu.org; qemu-devel@nongnu.org >> Subject: Re: [PATCH 2/3] e500: Adding CCSR memory region >> >> On 10/09/2012 06:45 PM, Bhushan Bharat-R65777 wrote: >> > >> > What about adding a API: >> > void sysbus_mmio_map_to_mr(SysBusDevice *dev, int n, target_phys_addr_t >> > addr, >> > MemoryRegion *mr) { >> > assert(n >= 0 && n < dev->num_mmio); >> > >> > if (dev->mmio[n].addr == addr) { >> > /* ??? region already mapped here. */ >> > return; >> > } >> > if (dev->mmio[n].addr != (target_phys_addr_t)-1) { >> > /* Unregister previous mapping. */ >> > memory_region_del_subregion(mr, dev->mmio[n].memory); >> > } >> > dev->mmio[n].addr = addr; >> > memory_region_add_subregion(mr, addr, dev->mmio[n].memory); } >> > >> >> I think you can just use sysbus_mmio_get_region(). There are plenty of other >> users, so there's precedent. > > You mean something like this : memory_region_add_subregion(mr, addr, > sysbus_mmio_get_region(dev, 0); > > Ok, but this will still not resolve the issue of not setting the > "dev->mmio[n].addr", no ?
Correct. But there are 20 uses already, so it can't matter much. If someone wants to fix them, they can write a new API and do a sweep. But really, sysbus just needs to go away. It's pointless to give it more and more features. -- error compiling committee.c: too many arguments to function