On 11/24/2011 03:43 PM, Peter Maydell wrote: > 2011/11/24 Benoît Canet <benoit.ca...@gmail.com>: > > @@ -690,17 +688,16 @@ static int bonito_pcihost_initfn(SysBusDevice *dev) > > static int bonito_initfn(PCIDevice *dev) > > { > > PCIBonitoState *s = DO_UPCAST(PCIBonitoState, dev, dev); > > + SysBusDevice *sysbus = &s->pcihost->busdev; > > > > /* Bonito North Bridge, built on FPGA, VENDOR_ID/DEVICE_ID are > > "undefined" */ > > pci_config_set_prog_interface(dev->config, 0x00); > > > > /* set the north bridge register mapping */ > > - s->bonito_reg_handle = cpu_register_io_memory(bonito_read, > > bonito_write, s, > > - DEVICE_NATIVE_ENDIAN); > > - s->bonito_reg_start = BONITO_INTERNAL_REG_BASE; > > - s->bonito_reg_length = BONITO_INTERNAL_REG_SIZE; > > - cpu_register_physical_memory(s->bonito_reg_start, s->bonito_reg_length, > > - s->bonito_reg_handle); > > + memory_region_init_io(&s->iomem, &bonito_ops, s, > > + "north-bridge-register", > > BONITO_INTERNAL_REG_SIZE); > > + sysbus_init_mmio_region(sysbus, &s->iomem); > > + sysbus_mmio_map(sysbus, 0, BONITO_INTERNAL_REG_BASE); > > > > /* set the north bridge pci configure mapping */ > > s->bonito_pciconf_handle = cpu_register_io_memory(bonito_pciconf_read, > > I guess this is the minimal-change conversion patch, but I'm still not > sure it makes any sense to be have one device's initfn be adding sysbus > mmio regions to a totally different device and then mapping them into > address space itself...
Oh, this isn't the clean thing to do, certainly. bonito_initfn() should only initialize the PCI interface to the PCI controller, not the PCI controller itself (which should be initialized by bonito_init() or bonito_pcihost_initfn()). But memory/master isn't the right place to do such cleanups; such patches should be directed at the right maintainer, if anyone feels the need to do them. -- error compiling committee.c: too many arguments to function