From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsZet-0007eQ-KW for qemu-devel@nongnu.org; Tue, 08 Jan 2013 08:56:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsZes-0004d0-1X for qemu-devel@nongnu.org; Tue, 08 Jan 2013 08:56:03 -0500 Received: from cantor2.suse.de ([195.135.220.15]:55806 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsZer-0004cu-P0 for qemu-devel@nongnu.org; Tue, 08 Jan 2013 08:56:01 -0500 Message-ID: <50EC256C.5060607@suse.de> Date: Tue, 08 Jan 2013 14:55:56 +0100 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <4773138dce3a8e61f90ebc20837ff4a283137eb3.1357607262.git.agarcia@igalia.com> In-Reply-To: <4773138dce3a8e61f90ebc20837ff4a283137eb3.1357607262.git.agarcia@igalia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 1/2] Add TEWS TPCI200 IndustryPack emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: Blue Swirl , Paolo Bonzini , Anthony Liguori , qemu-devel@nongnu.org Am 08.01.2013 02:10, schrieb Alberto Garcia: > The TPCI200 is a PCI board that supports up to 4 IndustryPack modules. >=20 > A new bus type called 'IndustryPack' has been created so any > compatible module can be attached to this board. >=20 > Signed-off-by: Alberto Garcia > --- > default-configs/pci.mak | 1 + > hw/Makefile.objs | 3 + > hw/ipack.c | 106 ++++++++ > hw/ipack.h | 75 ++++++ > hw/pci/pci_ids.h | 3 + > hw/tpci200.c | 667 +++++++++++++++++++++++++++++++++++++++= ++++++++ > 6 ficheiros modificados, 855 adi=C3=A7=C3=B5es(+) > create mode 100644 hw/ipack.c > create mode 100644 hw/ipack.h > create mode 100644 hw/tpci200.c >=20 > diff --git a/default-configs/pci.mak b/default-configs/pci.mak > index ae9d1eb..ee2d18d 100644 > --- a/default-configs/pci.mak > +++ b/default-configs/pci.mak > @@ -21,3 +21,4 @@ CONFIG_ESP=3Dy > CONFIG_ESP_PCI=3Dy > CONFIG_SERIAL=3Dy > CONFIG_SERIAL_PCI=3Dy > +CONFIG_IPACK=3Dy > diff --git a/hw/Makefile.objs b/hw/Makefile.objs > index b8bbed3..a42518e 100644 > --- a/hw/Makefile.objs > +++ b/hw/Makefile.objs > @@ -100,6 +100,9 @@ common-obj-$(CONFIG_XGMAC) +=3D xgmac.o > # PCI watchdog devices > common-obj-$(CONFIG_PCI) +=3D wdt_i6300esb.o > =20 > +# IndustryPack > +common-obj-$(CONFIG_IPACK) +=3D tpci200.o ipack.o > + > # PCI network cards > common-obj-$(CONFIG_NE2000_PCI) +=3D ne2000.o > common-obj-$(CONFIG_EEPRO100_PCI) +=3D eepro100.o > diff --git a/hw/ipack.c b/hw/ipack.c > new file mode 100644 > index 0000000..59e272b > --- /dev/null > +++ b/hw/ipack.c > @@ -0,0 +1,106 @@ > +/* > + * QEMU IndustryPack emulation > + * > + * Copyright (C) 2012 Igalia, S.L. > + * Author: Alberto Garcia > + * > + * This code is licensed under the GNU GPL v2 or (at your option) any > + * later version. > + */ > + > +#include "ipack.h" > + > +IPackDevice *ipack_device_find(IPackBus *bus, int32_t slot) > +{ > + BusChild *kid; > + > + QTAILQ_FOREACH(kid, &bus->qbus.children, sibling) { > + DeviceState *qdev =3D kid->child; > + IPackDevice *ip =3D DO_UPCAST(IPackDevice, qdev, qdev); IPACK_DEVICE(qdev) > + if (ip->slot =3D=3D slot) { > + return ip; > + } > + } > + return NULL; > +} > + > +static int ipack_device_dev_init(DeviceState *qdev) > +{ > + IPackBus *bus =3D DO_UPCAST(IPackBus, qbus, qdev->parent_bus); IPACK_BUS() > + IPackDevice *dev =3D DO_UPCAST(IPackDevice, qdev, qdev); [snip] IPACK_DEVICE() You have them defined in the header, please use them consistently. Also, please avoid accessing internals like &s->bus.qbus (BUS(s->bus)) or &s->dev.qdev (DEVICE(s->dev)). Another thing to check (could be a follow-up) is whether the initfn can be split into instance_init (e.g., pci_set_*?) and initfn. Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg