From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRa5a-0001ZL-R8 for qemu-devel@nongnu.org; Tue, 18 Aug 2015 02:09:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZRa5U-0004WX-S4 for qemu-devel@nongnu.org; Tue, 18 Aug 2015 02:09:38 -0400 Received: from mx2.suse.de ([195.135.220.15]:45304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRa5U-0004WP-HK for qemu-devel@nongnu.org; Tue, 18 Aug 2015 02:09:32 -0400 Message-ID: <55D2CC1B.3080207@suse.de> Date: Tue, 18 Aug 2015 08:09:31 +0200 From: Hannes Reinecke MIME-Version: 1.0 References: <1439854945-5597-1-git-send-email-abezzubikov@ispras.ru> <1439854945-5597-4-git-send-email-abezzubikov@ispras.ru> In-Reply-To: <1439854945-5597-4-git-send-email-abezzubikov@ispras.ru> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH RFC 03/11] ide: necessary checks corrected to treat ATAPI-SCSI bridge as CDROM 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/core.c | 24 ++++++++++++++---------- > hw/ide/qdev.c | 2 +- > 2 files changed, 15 insertions(+), 11 deletions(-) >=20 > diff --git a/hw/ide/core.c b/hw/ide/core.c > index 50449ca..d017d4e 100644 > --- a/hw/ide/core.c > +++ b/hw/ide/core.c > @@ -348,7 +348,7 @@ static void ide_set_signature(IDEState *s) > /* put signature */ > s->nsector =3D 1; > s->sector =3D 1; > - if (s->drive_kind =3D=3D IDE_CD) { > + if (s->drive_kind =3D=3D IDE_CD || s->drive_kind =3D=3D IDE_BRIDGE= ) { > s->lcyl =3D 0x14; > s->hcyl =3D 0xeb; > } else if (s->blk) { > @@ -1144,7 +1144,7 @@ static bool cmd_data_set_management(IDEState *s, = uint8_t cmd) > =20 > static bool cmd_identify(IDEState *s, uint8_t cmd) > { > - if (s->blk && s->drive_kind !=3D IDE_CD) { > + if (s->blk && s->drive_kind !=3D IDE_CD && s->drive_kind !=3D IDE_= BRIDGE) { > if (s->drive_kind !=3D IDE_CFATA) { > ide_identify(s); > } else { > @@ -1155,7 +1155,7 @@ static bool cmd_identify(IDEState *s, uint8_t cmd= ) > ide_set_irq(s->bus); > return false; > } else { > - if (s->drive_kind =3D=3D IDE_CD) { > + if (s->drive_kind =3D=3D IDE_CD || s->drive_kind =3D=3D IDE_BR= IDGE) { > ide_set_signature(s); > } > ide_abort_command(s); > @@ -1232,7 +1232,7 @@ static bool cmd_read_pio(IDEState *s, uint8_t cmd= ) > { > bool lba48 =3D (cmd =3D=3D WIN_READ_EXT); > =20 > - if (s->drive_kind =3D=3D IDE_CD) { > + if (s->drive_kind =3D=3D IDE_CD || s->drive_kind =3D=3D IDE_BRIDGE= ) { > ide_set_signature(s); /* odd, but ATA4 8.27.5.2 requires it */ > ide_abort_command(s); > return true; > @@ -1426,7 +1426,7 @@ static bool cmd_exec_dev_diagnostic(IDEState *s, = uint8_t cmd) > { > ide_set_signature(s); > =20 > - if (s->drive_kind =3D=3D IDE_CD) { > + if (s->drive_kind =3D=3D IDE_CD || s->drive_kind =3D=3D IDE_BRIDGE= ) { > s->status =3D 0; /* ATAPI spec (v6) section 9.10 defines packe= t > * devices to return a clear status register > * with READY_STAT *not* set. */ > @@ -1731,7 +1731,7 @@ abort_cmd: > } > =20 > #define HD_OK (1u << IDE_HD) > -#define CD_OK (1u << IDE_CD) > +#define CD_OK ((1u << IDE_CD) | (1u << IDE_BRIDGE)) > #define CFA_OK (1u << IDE_CFATA) > #define HD_CFA_OK (HD_OK | CFA_OK) > #define ALL_OK (HD_OK | CD_OK | CFA_OK) > @@ -1978,10 +1978,11 @@ void ide_cmd_write(void *opaque, uint32_t addr,= uint32_t val) > /* high to low */ > for(i =3D 0;i < 2; i++) { > s =3D &bus->ifs[i]; > - if (s->drive_kind =3D=3D IDE_CD) > + if (s->drive_kind =3D=3D IDE_CD || s->drive_kind =3D=3D ID= E_BRIDGE) { > s->status =3D 0x00; /* NOTE: READY is _not_ set */ > - else > + } else { > s->status =3D READY_STAT | SEEK_STAT; > + } > ide_set_signature(s); > } > } > @@ -2234,7 +2235,7 @@ static void ide_resize_cb(void *opaque) > ide_cfata_identify_size(s); > } else { > /* IDE_CD uses a different set of callbacks entirely. */ > - assert(s->drive_kind !=3D IDE_CD); > + assert(s->drive_kind !=3D IDE_CD && s->drive_kind !=3D IDE_BRI= DGE); > ide_identify_size(s); > } > } > @@ -2274,7 +2275,7 @@ int ide_init_drive(IDEState *s, BlockBackend *blk= , IDEDriveKind kind, > s->smart_autosave =3D 1; > s->smart_errors =3D 0; > s->smart_selftest_count =3D 0; > - if (kind =3D=3D IDE_CD) { > + if (kind =3D=3D IDE_CD || kind =3D=3D IDE_BRIDGE) { > blk_set_dev_ops(blk, &ide_cd_block_ops, s); > blk_set_guest_block_size(blk, 2048); > } else { > @@ -2304,6 +2305,9 @@ int ide_init_drive(IDEState *s, BlockBackend *blk= , IDEDriveKind kind, > case IDE_CFATA: > strcpy(s->drive_model_str, "QEMU MICRODRIVE"); > break; > + case IDE_BRIDGE: > + strcpy(s->drive_model_str, "QEMU VIRTUAL ATAPI-SCSI BRIDGE= "); > + break; > default: > strcpy(s->drive_model_str, "QEMU HARDDISK"); > break; > diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c > index e96a6e9..63090cc 100644 > --- a/hw/ide/qdev.c > +++ b/hw/ide/qdev.c > @@ -182,7 +182,7 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveK= ind kind) > } > =20 > blkconf_serial(&dev->conf, &dev->serial); > - if (kind !=3D IDE_CD) { > + if (kind !=3D IDE_CD && kind !=3D IDE_BRIDGE) { > blkconf_geometry(&dev->conf, &dev->chs_trans, 65536, 16, 255, = &err); > if (err) { > error_report_err(err); >=20 Looks okay. Acked-by: Hannes Reinecke 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)