From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LRUvA-00023l-W5 for qemu-devel@nongnu.org; Mon, 26 Jan 2009 12:06:49 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LRUv6-0001xy-5h for qemu-devel@nongnu.org; Mon, 26 Jan 2009 12:06:47 -0500 Received: from [199.232.76.173] (port=54783 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRUv5-0001xZ-Tr for qemu-devel@nongnu.org; Mon, 26 Jan 2009 12:06:43 -0500 Received: from e4.ny.us.ibm.com ([32.97.182.144]:34152) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LRUv2-0003TL-Kf for qemu-devel@nongnu.org; Mon, 26 Jan 2009 12:06:41 -0500 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e4.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id n0QH45FR005035 for ; Mon, 26 Jan 2009 12:04:05 -0500 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id n0QH5kRm178836 for ; Mon, 26 Jan 2009 12:05:46 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n0QH5kYZ012992 for ; Mon, 26 Jan 2009 12:05:46 -0500 Message-ID: <497DED59.50809@us.ibm.com> Date: Mon, 26 Jan 2009 11:05:29 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH][Resend] Floppy: Properly handle Sense Interrupt Status after FDC Reset References: <388245.94194.qm@web51101.mail.re2.yahoo.com> In-Reply-To: <388245.94194.qm@web51101.mail.re2.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: theburner1@yahoo.com, qemu-devel@nongnu.org Justin Chevrier wrote: > Original text below. > > Attached is a patch that changes how the emulated floppy controller rep= lies to Sense Interrupt Status commands immediately after a controller re= set. The specs state that after a Reset the 82078 goes into polling mode = which needs four Sense Interrupt Status commands to be issued afterwards = to clear the status of each drive. Currently we always respond to Sense I= nterrupt Status with a SEEK END instead of POLLING. This causes a problem= with the SCO Openserver installer which is expects a POLLING state after= reset. This patch returns a POLLING status for four Sense Interrupt Stat= us requests immediately after a controller reset. This approach mirrors t= he way Bochs handles this situation. With the attached patch applied Open= server gets further when trying to load storage drivers from the floppy d= isk (blocked by another issue, patch on its way). I have successfully tes= ted the floppy drive on the following OSs after applying this patch: Wind= ows 98, Windows XP > SP2, Linux x86 (SysRescCD 1.1.3 and Ubuntu 8.10). > > Justin > > Changelog: > > Properly handle Sense Interrupt Status after FDC Reset > > Signed-off-by: Justin Chevrier > =20 The patch is whitespace damaged. > Index: hw/fdc.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- hw/fdc.c (revision 6193) > +++ hw/fdc.c (working copy) > @@ -53,8 +53,9 @@ > #define SET_CUR_DRV(fdctrl, drive) ((fdctrl)->cur_drv =3D (drive)) > =20 The leading space seems to have gotten stripped. A tool like git-email=20 or attaching if your mailer uses text/plain would ensure this doesn't=20 happen. Regards, Anthony Liguori > /* Will always be a fixed parameter for us */ > -#define FD_SECTOR_LEN 512 > -#define FD_SECTOR_SC 2 /* Sector size code */ > +#define FD_SECTOR_LEN 512 > +#define FD_SECTOR_SC 2 /* Sector size code */ > +#define FD_RESET_SENSEI_COUNT 4 /* Number of sense interrupts on RE= SET */ > > /* Floppy disk drive emulation */ > typedef enum fdisk_type_t { > @@ -506,6 +507,7 @@ > int sun4m; > /* Floppy drives */ > fdrive_t drives[MAX_FD]; > + int reset_sensei; > }; > > static uint32_t fdctrl_read (void *opaque, uint32_t reg) > @@ -763,6 +765,7 @@ > qemu_set_irq(fdctrl->irq, 1); > fdctrl->sra |=3D FD_SRA_INTPEND; > } > + fdctrl->reset_sensei =3D 0; > fdctrl->status0 =3D status0; > FLOPPY_DPRINTF("Set interrupt status to 0x%02x\n", fdctrl->status0= ); > } > @@ -793,6 +796,7 @@ > fdctrl_reset_fifo(fdctrl); > if (do_irq) { > fdctrl_raise_irq(fdctrl, FD_SR0_RDYCHG); > + fdctrl->reset_sensei =3D FD_RESET_SENSEI_COUNT; > } > } > > @@ -1601,16 +1605,18 @@ > { > fdrive_t *cur_drv =3D get_cur_drv(fdctrl); > > -#if 0 > - fdctrl->fifo[0] =3D > - fdctrl->status0 | (cur_drv->head << 2) | GET_CUR_DRV(fdctrl); > -#else > - /* XXX: status0 handling is broken for read/write > - commands, so we do this hack. It should be suppressed > - ASAP */ > - fdctrl->fifo[0] =3D > - FD_SR0_SEEK | (cur_drv->head << 2) | GET_CUR_DRV(fdctrl); > -#endif > + if(fdctrl->reset_sensei > 0) { > + fdctrl->fifo[0] =3D > + FD_SR0_RDYCHG + FD_RESET_SENSEI_COUNT - fdctrl->reset_sens= ei; > + fdctrl->reset_sensei--; > + } else { > + /* XXX: status0 handling is broken for read/write > + commands, so we do this hack. It should be suppressed > + ASAP */ > + fdctrl->fifo[0] =3D > + FD_SR0_SEEK | (cur_drv->head << 2) | GET_CUR_DRV(fdctrl); > + } > + > fdctrl->fifo[1] =3D cur_drv->track; > fdctrl_set_fifo(fdctrl, 2, 0); > fdctrl_reset_irq(fdctrl); > > > =20 > > > > =20