Date: Thu, 18 Apr 2002 18:02:04 -0400 From: Jung-uk Kim <jkim@niksun.com> To: freebsd-hackers@freebsd.org Cc: Jung-uk Kim <jkim@niksun.com> Subject: Re: Floppy device driver problem (with patch) Message-ID: <3CBF425C.7060700@niksun.com> References: <3CBF2008.6090009@niksun.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Here is the patch against 5.0-CURRENT. Please note that it wasn't
tested. ;-)
Thanks,
JK
[-- Attachment #2 --]
--- sys/isa/fd.c.old Tue Apr 2 13:29:43 2002
+++ sys/isa/fd.c Thu Apr 18 17:42:03 2002
@@ -563,13 +563,15 @@
return fdc_err(fdc, "Enable FIFO failed\n");
/* If command is invalid, return */
- j = 100000;
+ j = FDSTS_TIMEOUT;
while ((i = fdsts_rd(fdc) & (NE7_DIO | NE7_RQM))
- != NE7_RQM && j-- > 0)
+ != NE7_RQM && j-- > 0) {
if (i == (NE7_DIO | NE7_RQM)) {
fdc_reset(fdc);
return FD_FAILED;
}
+ DELAY(1);
+ }
if (j<0 ||
fd_cmd(fdc, 3,
0, (fifo_threshold - 1) & 0xf, 0, 0) < 0) {
@@ -1473,11 +1475,13 @@
static int
fd_in(struct fdc_data *fdc, int *ptr)
{
- int i, j = 100000;
+ int i, j = FDSTS_TIMEOUT;
while ((i = fdsts_rd(fdc) & (NE7_DIO|NE7_RQM))
- != (NE7_DIO|NE7_RQM) && j-- > 0)
+ != (NE7_DIO|NE7_RQM) && j-- > 0) {
if (i == NE7_RQM)
return fdc_err(fdc, "ready for output in input\n");
+ DELAY(1);
+ }
if (j <= 0)
return fdc_err(fdc, bootverbose? "input ready timeout\n": 0);
#ifdef FDC_DEBUG
@@ -1499,13 +1503,15 @@
int i;
/* Check that the direction bit is set */
- i = 100000;
- while ((fdsts_rd(fdc) & NE7_DIO) && i-- > 0);
+ i = FDSTS_TIMEOUT;
+ while ((fdsts_rd(fdc) & NE7_DIO) && i-- > 0)
+ DELAY(1);
if (i <= 0) return fdc_err(fdc, "direction bit not set\n");
/* Check that the floppy controller is ready for a command */
- i = 100000;
- while ((fdsts_rd(fdc) & NE7_RQM) == 0 && i-- > 0);
+ i = FDSTS_TIMEOUT;
+ while ((fdsts_rd(fdc) & NE7_RQM) == 0 && i-- > 0)
+ DELAY(1);
if (i <= 0)
return fdc_err(fdc, bootverbose? "output ready timeout\n": 0);
--- sys/isa/fdreg.h.old Sat Dec 15 14:07:58 2001
+++ sys/isa/fdreg.h Thu Apr 18 17:42:42 2002
@@ -69,3 +69,4 @@
#define FDI_DCHG 0x80 /* diskette has been changed */
/* requires drive and motor being selected */
/* is cleared by any step pulse to drive */
+#define FDSTS_TIMEOUT 200 /* fdsts_rd() timeout */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CBF425C.7060700>
