summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorrgrimes <rgrimes@FreeBSD.org>1993-08-12 09:21:20 +0000
committerrgrimes <rgrimes@FreeBSD.org>1993-08-12 09:21:20 +0000
commite22df49c233490160db921e61eb7f627dea7c2f6 (patch)
treec89ed89edb00704ef59231ff8a8c5567957661e3 /sys/dev
parent8faa826740eee0be6bbec278b22c53ef764ba03e (diff)
downloadFreeBSD-src-e22df49c233490160db921e61eb7f627dea7c2f6.zip
FreeBSD-src-e22df49c233490160db921e61eb7f627dea7c2f6.tar.gz
Fixed poor timeout code in out_fdc. The timeout counter was not being
reinitialized between while loops. Added comments about what was going on in the out_fdc routine. out_fdc now returns if the direction bit is not set in time instead of trying to wait for MRQ to get cleared.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/fdc/fdc.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index ca92b16..d4eda5a 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -46,12 +46,19 @@
* Largely rewritten to handle multiple controllers and drives
* By Julian Elischer, Sun Apr 4 16:34:33 WST 1993
*/
-char rev[] = "$Revision: 1.1.1.1 $";
+char rev[] = "$Revision: 1.2 $";
/*
- * $Header: /a/cvs/386BSD/src/sys.386bsd/i386/isa/fd.c,v 1.1.1.1 1993/06/12 14:58:02 rgrimes Exp $
+ * $Header: /freefall/a/cvs/386BSD/src/sys/i386/isa/fd.c,v 1.2 1993/07/15 17:53:04 davidg Exp $
*/
/*
* $Log: fd.c,v $
+ * Revision 1.2 1993/07/15 17:53:04 davidg
+ * Modified attach printf's so that the output is compatible with the "new"
+ * way of doing things. There still remain several drivers that need to
+ * be updated. Also added a compile-time option to pccons to switch the
+ * control and caps-lock keys (REVERSE_CAPS_CTRL) - added for my personal
+ * sanity.
+ *
* Revision 1.1.1.1 1993/06/12 14:58:02 rgrimes
* Initial import, 0.1 + pk 0.2.4-B1
*
@@ -483,11 +490,19 @@ in_fdc(fdcu_t fdcu)
out_fdc(fdcu_t fdcu,int x)
{
int baseport = fdc_data[fdcu].baseport;
- int i = 100000;
+ int i;
+ /* Check that the direction bit is set */
+ i = 100000;
while ((inb(baseport+fdsts) & NE7_DIO) && i-- > 0);
+ if (i <= 0) return (-1); /* Floppy timed out */
+
+ /* Check that the floppy controller is ready for a command */
+ i = 100000;
while ((inb(baseport+fdsts) & NE7_RQM) == 0 && i-- > 0);
- if (i <= 0) return (-1);
+ if (i <= 0) return (-1); /* Floppy timed out */
+
+ /* Send the command and return */
outb(baseport+fddata,x);
TRACE1("[0x%x->fddata]",x);
return (0);
OpenPOWER on IntegriCloud