Fixed the problem where the floppy has incorrectly failed probing

when the drive had been left on a cylinder > 67 after kernel boot. The
most common case for this is booting a kernel that is located on
the inner cylinders of a floppy.

Also removed all occurences of spinwait(), replaced by DELAY.
Nuked a return line saying nothing, this might make Bruce happy 8^)

Submitted by:	partially by Bruce Evans
This commit is contained in:
Joerg Wunsch 1994-09-17 18:08:36 +00:00
parent f38ec702f9
commit 6b7bd95b6d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2841
3 changed files with 102 additions and 51 deletions

View file

@ -40,7 +40,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.29 1994/08/29 21:32:31 ache Exp $
* $Id: fd.c,v 1.30 1994/09/17 16:56:06 davidg Exp $
*
*/
@ -293,7 +293,7 @@ fdattach(dev)
fdcu_t fdcu = dev->id_unit;
fdc_p fdc = fdc_data + fdcu;
fd_p fd;
int fdsu, st0;
int fdsu, st0, i;
struct isa_device *fdup;
fdc->fdcu = fdcu;
@ -343,22 +343,40 @@ fdattach(dev)
/* select it */
set_motor(fdcu, fdsu, TURNON);
spinwait(1000); /* 1 sec */
out_fdc(fdcu, NE7CMD_SEEK); /* seek some steps... */
DELAY(1000000); /* 1 sec */
out_fdc(fdcu, NE7CMD_SENSED);
out_fdc(fdcu, fdsu);
out_fdc(fdcu, 10);
spinwait(300); /* ...wait a moment... */
out_fdc(fdcu, NE7CMD_SENSEI); /* make controller happy */
(void)in_fdc(fdcu);
(void)in_fdc(fdcu);
out_fdc(fdcu, NE7CMD_RECAL); /* ...and go back to 0 */
out_fdc(fdcu, fdsu);
spinwait(1000); /* a second be enough for full stroke seek */
if(in_fdc(fdcu) & NE7_ST3_T0) {
/* if at track 0, first seek inwards */
out_fdc(fdcu, NE7CMD_SEEK); /* seek some steps... */
out_fdc(fdcu, fdsu);
out_fdc(fdcu, 10);
DELAY(300000); /* ...wait a moment... */
out_fdc(fdcu, NE7CMD_SENSEI); /* make ctrlr happy */
(void)in_fdc(fdcu);
(void)in_fdc(fdcu);
}
for(i = 0; i < 2; i++) {
/*
* we must recalibrate twice, just in case the
* heads have been beyond cylinder 76, since most
* FDCs still barf when attempting to recalibrate
* more than 77 steps
*/
out_fdc(fdcu, NE7CMD_RECAL); /* go back to 0 */
out_fdc(fdcu, fdsu);
/* a second being enough for full stroke seek */
DELAY(i == 0? 1000000: 300000);
/* anything responding */
out_fdc(fdcu, NE7CMD_SENSEI);
st0 = in_fdc(fdcu);
(void)in_fdc(fdcu);
/* anything responding? */
out_fdc(fdcu, NE7CMD_SENSEI);
st0 = in_fdc(fdcu);
(void)in_fdc(fdcu);
if ((st0 & NE7_ST0_EC) == 0)
break; /* already probed succesfully */
}
set_motor(fdcu, fdsu, TURNOFF);
if (st0 & NE7_ST0_EC) /* no track 0 -> no drive present */
@ -734,7 +752,6 @@ fdstrategy(struct buf *bp)
bad:
biodone(bp);
return;
}
/***************************************************************\

View file

@ -40,7 +40,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.29 1994/08/29 21:32:31 ache Exp $
* $Id: fd.c,v 1.30 1994/09/17 16:56:06 davidg Exp $
*
*/
@ -293,7 +293,7 @@ fdattach(dev)
fdcu_t fdcu = dev->id_unit;
fdc_p fdc = fdc_data + fdcu;
fd_p fd;
int fdsu, st0;
int fdsu, st0, i;
struct isa_device *fdup;
fdc->fdcu = fdcu;
@ -343,22 +343,40 @@ fdattach(dev)
/* select it */
set_motor(fdcu, fdsu, TURNON);
spinwait(1000); /* 1 sec */
out_fdc(fdcu, NE7CMD_SEEK); /* seek some steps... */
DELAY(1000000); /* 1 sec */
out_fdc(fdcu, NE7CMD_SENSED);
out_fdc(fdcu, fdsu);
out_fdc(fdcu, 10);
spinwait(300); /* ...wait a moment... */
out_fdc(fdcu, NE7CMD_SENSEI); /* make controller happy */
(void)in_fdc(fdcu);
(void)in_fdc(fdcu);
out_fdc(fdcu, NE7CMD_RECAL); /* ...and go back to 0 */
out_fdc(fdcu, fdsu);
spinwait(1000); /* a second be enough for full stroke seek */
if(in_fdc(fdcu) & NE7_ST3_T0) {
/* if at track 0, first seek inwards */
out_fdc(fdcu, NE7CMD_SEEK); /* seek some steps... */
out_fdc(fdcu, fdsu);
out_fdc(fdcu, 10);
DELAY(300000); /* ...wait a moment... */
out_fdc(fdcu, NE7CMD_SENSEI); /* make ctrlr happy */
(void)in_fdc(fdcu);
(void)in_fdc(fdcu);
}
for(i = 0; i < 2; i++) {
/*
* we must recalibrate twice, just in case the
* heads have been beyond cylinder 76, since most
* FDCs still barf when attempting to recalibrate
* more than 77 steps
*/
out_fdc(fdcu, NE7CMD_RECAL); /* go back to 0 */
out_fdc(fdcu, fdsu);
/* a second being enough for full stroke seek */
DELAY(i == 0? 1000000: 300000);
/* anything responding */
out_fdc(fdcu, NE7CMD_SENSEI);
st0 = in_fdc(fdcu);
(void)in_fdc(fdcu);
/* anything responding? */
out_fdc(fdcu, NE7CMD_SENSEI);
st0 = in_fdc(fdcu);
(void)in_fdc(fdcu);
if ((st0 & NE7_ST0_EC) == 0)
break; /* already probed succesfully */
}
set_motor(fdcu, fdsu, TURNOFF);
if (st0 & NE7_ST0_EC) /* no track 0 -> no drive present */
@ -734,7 +752,6 @@ fdstrategy(struct buf *bp)
bad:
biodone(bp);
return;
}
/***************************************************************\

View file

@ -40,7 +40,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.29 1994/08/29 21:32:31 ache Exp $
* $Id: fd.c,v 1.30 1994/09/17 16:56:06 davidg Exp $
*
*/
@ -293,7 +293,7 @@ fdattach(dev)
fdcu_t fdcu = dev->id_unit;
fdc_p fdc = fdc_data + fdcu;
fd_p fd;
int fdsu, st0;
int fdsu, st0, i;
struct isa_device *fdup;
fdc->fdcu = fdcu;
@ -343,22 +343,40 @@ fdattach(dev)
/* select it */
set_motor(fdcu, fdsu, TURNON);
spinwait(1000); /* 1 sec */
out_fdc(fdcu, NE7CMD_SEEK); /* seek some steps... */
DELAY(1000000); /* 1 sec */
out_fdc(fdcu, NE7CMD_SENSED);
out_fdc(fdcu, fdsu);
out_fdc(fdcu, 10);
spinwait(300); /* ...wait a moment... */
out_fdc(fdcu, NE7CMD_SENSEI); /* make controller happy */
(void)in_fdc(fdcu);
(void)in_fdc(fdcu);
out_fdc(fdcu, NE7CMD_RECAL); /* ...and go back to 0 */
out_fdc(fdcu, fdsu);
spinwait(1000); /* a second be enough for full stroke seek */
if(in_fdc(fdcu) & NE7_ST3_T0) {
/* if at track 0, first seek inwards */
out_fdc(fdcu, NE7CMD_SEEK); /* seek some steps... */
out_fdc(fdcu, fdsu);
out_fdc(fdcu, 10);
DELAY(300000); /* ...wait a moment... */
out_fdc(fdcu, NE7CMD_SENSEI); /* make ctrlr happy */
(void)in_fdc(fdcu);
(void)in_fdc(fdcu);
}
for(i = 0; i < 2; i++) {
/*
* we must recalibrate twice, just in case the
* heads have been beyond cylinder 76, since most
* FDCs still barf when attempting to recalibrate
* more than 77 steps
*/
out_fdc(fdcu, NE7CMD_RECAL); /* go back to 0 */
out_fdc(fdcu, fdsu);
/* a second being enough for full stroke seek */
DELAY(i == 0? 1000000: 300000);
/* anything responding */
out_fdc(fdcu, NE7CMD_SENSEI);
st0 = in_fdc(fdcu);
(void)in_fdc(fdcu);
/* anything responding? */
out_fdc(fdcu, NE7CMD_SENSEI);
st0 = in_fdc(fdcu);
(void)in_fdc(fdcu);
if ((st0 & NE7_ST0_EC) == 0)
break; /* already probed succesfully */
}
set_motor(fdcu, fdsu, TURNOFF);
if (st0 & NE7_ST0_EC) /* no track 0 -> no drive present */
@ -734,7 +752,6 @@ fdstrategy(struct buf *bp)
bad:
biodone(bp);
return;
}
/***************************************************************\