From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ri5pj-0003yS-6Q for qemu-devel@nongnu.org; Tue, 03 Jan 2012 09:59:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ri5pe-0001Ua-UN for qemu-devel@nongnu.org; Tue, 03 Jan 2012 09:59:23 -0500 Received: from mout.web.de ([212.227.15.4]:64610) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ri5pe-0001U6-H0 for qemu-devel@nongnu.org; Tue, 03 Jan 2012 09:59:18 -0500 Message-ID: <4F031761.7080201@web.de> Date: Tue, 03 Jan 2012 15:57:37 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1325551939-24749-1-git-send-email-aliguori@us.ibm.com> <1325551939-24749-5-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1325551939-24749-5-git-send-email-aliguori@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 04/30] ppc_prep: convert host bridge to qdev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Paolo Bonzini , =?ISO-8859-15?Q?Herv=E9_Poussineau?= , qemu-devel@nongnu.org, Markus Armbruster Am 03.01.2012 01:51, schrieb Anthony Liguori: > Untested beyond compile. But it's a very simple conversion. > > Signed-off-by: Anthony Liguori Seems like we've crossed paths now. I have a more complete patch using different naming, but it's not yet working. I'll have to bisect. Andreas > --- > hw/prep_pci.c | 38 +++++++++++++++++++++++++++----------- > 1 files changed, 27 insertions(+), 11 deletions(-) > > diff --git a/hw/prep_pci.c b/hw/prep_pci.c > index ea9fb69..16c036f 100644 > --- a/hw/prep_pci.c > +++ b/hw/prep_pci.c > @@ -106,12 +106,37 @@ static void prep_set_irq(void *opaque, int irq_num, int level) > qemu_set_irq(pic[(irq_num & 1) ? 11 : 9] , level); > } > > +static int prep_hb_initfn(PCIDevice *d) > +{ > + d->config[0x0C] = 0x08; // cache_line_size > + d->config[0x0D] = 0x10; // latency_timer > + d->config[0x34] = 0x00; // capabilities_pointer > + > + return 0; > +} > + > +static PCIDeviceInfo prep_hb_info = { > + .qdev.name = "PREP Host Bridge - Motorola Raven", > + .qdev.size = sizeof(PCIDevice), > + .init = prep_hb_initfn, > + .vendor_id = PCI_VENDOR_ID_MOTOROLA, > + .device_id = PCI_DEVICE_ID_MOTOROLA_RAVEN, > + .revision = 0x00, > + .class_id = PCI_CLASS_BRIDGE_HOST, > +}; > + > +static void prep_register(void) > +{ > + pci_qdev_register(&prep_hb_info); > +} > + > +device_init(prep_register); > + > PCIBus *pci_prep_init(qemu_irq *pic, > MemoryRegion *address_space_mem, > MemoryRegion *address_space_io) > { > PREPPCIState *s; > - PCIDevice *d; > > s = g_malloc0(sizeof(PREPPCIState)); > s->bus = pci_register_bus(NULL, "pci", > @@ -133,16 +158,7 @@ PCIBus *pci_prep_init(qemu_irq *pic, > memory_region_init_io(&s->mmcfg, &PPC_PCIIO_ops, s, "pciio", 0x00400000); > memory_region_add_subregion(address_space_mem, 0x80800000, &s->mmcfg); > > - /* PCI host bridge */ > - d = pci_register_device(s->bus, "PREP Host Bridge - Motorola Raven", > - sizeof(PCIDevice), 0, NULL, NULL); > - pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_MOTOROLA); > - pci_config_set_device_id(d->config, PCI_DEVICE_ID_MOTOROLA_RAVEN); > - d->config[0x08] = 0x00; // revision > - pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST); > - d->config[0x0C] = 0x08; // cache_line_size > - d->config[0x0D] = 0x10; // latency_timer > - d->config[0x34] = 0x00; // capabilities_pointer > + pci_create_simple(s->bus, 0, "PREP Host Bridge - Motorola Raven"); > > return s->bus; > }