From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sbw1u-0005xk-EH for qemu-devel@nongnu.org; Tue, 05 Jun 2012 11:50:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sbw1q-0003TV-1j for qemu-devel@nongnu.org; Tue, 05 Jun 2012 11:50:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58506) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sbw1p-0003T7-NH for qemu-devel@nongnu.org; Tue, 05 Jun 2012 11:50:41 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q55Fod7T000873 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 5 Jun 2012 11:50:40 -0400 Message-ID: <4FCE2AC8.9080306@redhat.com> Date: Tue, 05 Jun 2012 17:50:32 +0200 From: Pavel Hrdina MIME-Version: 1.0 References: <095b1f20091f8cf18565a3700372fa65736f0d0a.1338911144.git.phrdina@redhat.com> In-Reply-To: <095b1f20091f8cf18565a3700372fa65736f0d0a.1338911144.git.phrdina@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] fdc: fix media change detection for windows List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Hrdina Cc: kwolf@redhat.com, mtosatti@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com Sorry, I forget the qtest. I'll create it and send it again. Pavel On 06/05/2012 05:46 PM, Pavel Hrdina wrote: > The Windows uses 'READ' command at the start of an instalation > without checking the 'dir' register. We have to abort the transfer > with an abnormal termination if there is no media in the drive. > > We have to also check the 'media_change' bit in the 'fd_seek'. This > internal seek clears the 'media_change' bit, too, if there is > a media inserted. > > Signed-off-by: Pavel Hrdina > --- > hw/fdc.c | 7 ++++++- > 1 files changed, 6 insertions(+), 1 deletions(-) > > diff --git a/hw/fdc.c b/hw/fdc.c > index 30d34e3..2d6dd30 100644 > --- a/hw/fdc.c > +++ b/hw/fdc.c > @@ -127,8 +127,13 @@ static int fd_seek(FDrive *drv, uint8_t head, uint8_t track, uint8_t sect, > uint32_t sector; > int ret; > > + if (drv->bs != NULL&& bdrv_is_inserted(drv->bs)) { > + drv->media_changed = 0; > + } > + > if (track> drv->max_track || > - (head != 0&& (drv->flags& FDISK_DBL_SIDES) == 0)) { > + (head != 0&& (drv->flags& FDISK_DBL_SIDES) == 0) || > + drv->media_changed) { > FLOPPY_DPRINTF("try to read %d %02x %02x (max=%d %d %02x %02x)\n", > head, track, sect, 1, > (drv->flags& FDISK_DBL_SIDES) == 0 ? 0 : 1,