From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRa3m-0008WB-P9 for qemu-devel@nongnu.org; Tue, 18 Aug 2015 02:07:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZRa3j-0003pt-I1 for qemu-devel@nongnu.org; Tue, 18 Aug 2015 02:07:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:45247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRa3j-0003m3-3p for qemu-devel@nongnu.org; Tue, 18 Aug 2015 02:07:43 -0400 Message-ID: <55D2CBAC.7000302@suse.de> Date: Tue, 18 Aug 2015 08:07:40 +0200 From: Hannes Reinecke MIME-Version: 1.0 References: <1439854945-5597-1-git-send-email-abezzubikov@ispras.ru> <1439854945-5597-2-git-send-email-abezzubikov@ispras.ru> In-Reply-To: <1439854945-5597-2-git-send-email-abezzubikov@ispras.ru> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH RFC 01/11] ide: ATAPI-SCSI bridge TypeInfo and init function created List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Bezzubikov , qemu-devel@nongnu.org Cc: jsnow@redhat.com, abezzubikov@ispras.ru On 08/18/2015 01:42 AM, Alexander Bezzubikov wrote: > Signed-off-by: Alexander Bezzubikov > --- > hw/ide/bridge.h | 9 +++++++++ > hw/ide/internal.h | 3 ++- > hw/ide/qdev.c | 40 ++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 51 insertions(+), 1 deletion(-) > create mode 100644 hw/ide/bridge.h >=20 > diff --git a/hw/ide/bridge.h b/hw/ide/bridge.h > new file mode 100644 > index 0000000..dca5d73 > --- /dev/null > +++ b/hw/ide/bridge.h > @@ -0,0 +1,9 @@ > +#ifndef HW_IDE_BRIDGE_H > +#define HW_IDE_BRIDGE_H > + > +#include "hw/ide/internal.h" > + > +void ide_bridge_start_transfer(SCSIRequest *req, uint32_t len); > +void ide_bridge_complete(SCSIRequest *req, uint32_t status, size_t res= id); > + > +#endif > diff --git a/hw/ide/internal.h b/hw/ide/internal.h > index 30fdcbc..f2999ce 100644 > --- a/hw/ide/internal.h > +++ b/hw/ide/internal.h > @@ -12,6 +12,7 @@ > #include "sysemu/sysemu.h" > #include "hw/block/block.h" > #include "block/scsi.h" > +#include "hw/scsi/scsi.h" > =20 > /* debug IDE devices */ > //#define DEBUG_IDE > @@ -317,7 +318,7 @@ typedef struct IDEDMAOps IDEDMAOps; > #define SMART_DISABLE 0xd9 > #define SMART_STATUS 0xda > =20 > -typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKind; > +typedef enum { IDE_HD, IDE_CD, IDE_CFATA, IDE_BRIDGE } IDEDriveKind; > =20 > typedef void EndTransferFunc(IDEState *); > =20 This change doesn't need the scsi.h include; please move it to the patch where the SCSI prototypes are used. > diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c > index 788b361..e96a6e9 100644 > --- a/hw/ide/qdev.c > +++ b/hw/ide/qdev.c > @@ -25,6 +25,7 @@ > #include "hw/block/block.h" > #include "sysemu/sysemu.h" > #include "qapi/visitor.h" > +#include "hw/ide/bridge.h" > =20 > /* --------------------------------- */ > =20 > @@ -143,6 +144,17 @@ int ide_get_bios_chs_trans(BusState *bus, int unit= ) > return DO_UPCAST(IDEBus, qbus, bus)->ifs[unit].chs_trans; > } > =20 > +/* BusInfo structure for ATAPI-SCSI bridge */ > +static const struct SCSIBusInfo atapi_scsi_info =3D { > + .tcq =3D true, > + .max_target =3D 0, > + .max_lun =3D 0, > + > + .transfer_data =3D NULL, > + .complete =3D NULL, > + .cancel =3D NULL > +}; > + > /* --------------------------------- */ > =20 > typedef struct IDEDrive { > @@ -184,6 +196,11 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDrive= Kind kind) > dev->chs_trans) < 0) { > return -1; > } > + if (kind =3D=3D IDE_BRIDGE) { > + scsi_bus_new(&dev->scsi_bus, sizeof(dev->scsi_bus), &dev->qdev= , > + &atapi_scsi_info, NULL); > + scsi_bus_legacy_handle_cmdline(&dev->scsi_bus, NULL); > + } > =20 > if (!dev->version) { > dev->version =3D g_strdup(s->version); > @@ -253,6 +270,11 @@ static int ide_cd_initfn(IDEDevice *dev) > return ide_dev_initfn(dev, IDE_CD); > } > =20 > +static int ide_bridge_initfn(IDEDevice *dev) > +{ > + return ide_dev_initfn(dev, IDE_BRIDGE); > +} > + > static int ide_drive_initfn(IDEDevice *dev) > { > DriveInfo *dinfo =3D blk_legacy_dinfo(dev->conf.blk); > @@ -314,6 +336,23 @@ static const TypeInfo ide_cd_info =3D { > .class_init =3D ide_cd_class_init, > }; > =20 > +static void ide_bridge_class_init(ObjectClass *klass, void *data) > +{ > + DeviceClass *dc =3D DEVICE_CLASS(klass); > + IDEDeviceClass *k =3D IDE_DEVICE_CLASS(klass); > + k->init =3D ide_bridge_initfn; > + dc->fw_name =3D "drive"; > + dc->desc =3D "virtual ATAPI-SCSI bridge"; > + dc->props =3D ide_cd_properties; > +} > + > +static const TypeInfo ide_bridge_info =3D { > + .name =3D "ide-bridge", > + .parent =3D TYPE_IDE_DEVICE, > + .instance_size =3D sizeof(IDEDrive), > + .class_init =3D ide_bridge_class_init, > +}; > + > static Property ide_drive_properties[] =3D { > DEFINE_IDE_DEV_PROPERTIES(), > DEFINE_PROP_END_OF_LIST(), > @@ -360,6 +399,7 @@ static void ide_register_types(void) > type_register_static(&ide_bus_info); > type_register_static(&ide_hd_info); > type_register_static(&ide_cd_info); > + type_register_static(&ide_bridge_info); > type_register_static(&ide_drive_info); > type_register_static(&ide_device_type_info); > } >=20 The rest is okay. Cheers, Hannes --=20 Dr. Hannes Reinecke zSeries & Storage hare@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg GF: J. Hawn, J. Guild, F. Imend=F6rffer, HRB 16746 (AG N=FCrnberg)