Deleted Added
full compact
fdc.c (499) fdc.c (798)
1/*#define DEBUG 1*/
2/*-
3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Don Ahn.
8 *

--- 21 unchanged lines hidden (view full) ---

30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: @(#)fd.c 7.4 (Berkeley) 5/25/91
1/*#define DEBUG 1*/
2/*-
3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Don Ahn.
8 *

--- 21 unchanged lines hidden (view full) ---

30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: @(#)fd.c 7.4 (Berkeley) 5/25/91
38 * $Id: fd.c,v 1.5 1993/09/15 23:27:45 rgrimes Exp $
38 * $Id: fd.c,v 1.6 1993/09/23 15:22:57 rgrimes Exp $
39 *
40 */
41
42#include "fd.h"
43#if NFD > 0
44
45#include "param.h"
46#include "dkbad.h"
47#include "systm.h"
39 *
40 */
41
42#include "fd.h"
43#if NFD > 0
44
45#include "param.h"
46#include "dkbad.h"
47#include "systm.h"
48#include "kernel.h"
48#include "conf.h"
49#include "file.h"
50#include "ioctl.h"
51#include "disklabel.h"
52#include "buf.h"
53#include "uio.h"
54#include "syslog.h"
55#include "i386/isa/isa.h"

--- 114 unchanged lines hidden (view full) ---

170"MOTORWAIT",
171"IOTIMEDOUT"
172};
173
174
175int fd_debug = 1;
176#define TRACE0(arg) if(fd_debug) printf(arg)
177#define TRACE1(arg1,arg2) if(fd_debug) printf(arg1,arg2)
49#include "conf.h"
50#include "file.h"
51#include "ioctl.h"
52#include "disklabel.h"
53#include "buf.h"
54#include "uio.h"
55#include "syslog.h"
56#include "i386/isa/isa.h"

--- 114 unchanged lines hidden (view full) ---

171"MOTORWAIT",
172"IOTIMEDOUT"
173};
174
175
176int fd_debug = 1;
177#define TRACE0(arg) if(fd_debug) printf(arg)
178#define TRACE1(arg1,arg2) if(fd_debug) printf(arg1,arg2)
178#else DEBUG
179#else /* DEBUG */
179#define TRACE0(arg)
180#define TRACE1(arg1,arg2)
180#define TRACE0(arg)
181#define TRACE1(arg1,arg2)
181#endif DEBUG
182#endif /* DEBUG */
182
183
183extern int hz;
184/* state needed for current transfer */
184static void fdstart(fdcu_t);
185void fdintr(fdcu_t);
186static void fd_turnoff(caddr_t, int);
185
186/****************************************************************************/
187/* autoconfiguration stuff */
188/****************************************************************************/
187
188/****************************************************************************/
189/* autoconfiguration stuff */
190/****************************************************************************/
189int fdprobe(), fdattach(), fd_turnoff();
191static int fdprobe(struct isa_device *);
192static int fdattach(struct isa_device *);
190
191struct isa_driver fddriver = {
192 fdprobe, fdattach, "fd",
193};
194
195/*
196 * probe for existance of controller
197 */
193
194struct isa_driver fddriver = {
195 fdprobe, fdattach, "fd",
196};
197
198/*
199 * probe for existance of controller
200 */
201int
198fdprobe(dev)
202fdprobe(dev)
199struct isa_device *dev;
203 struct isa_device *dev;
200{
201 fdcu_t fdcu = dev->id_unit;
202 if(fdc_data[fdcu].flags & FDC_ATTACHED)
203 {
204 printf("fdc: same unit (%d) used multiple times\n",fdcu);
205 return 0;
206 }
207

--- 7 unchanged lines hidden (view full) ---

215 out_fdc(fdcu,0xDF);
216 out_fdc(fdcu,2);
217 return (IO_FDCSIZE);
218}
219
220/*
221 * wire controller into system, look for floppy units
222 */
204{
205 fdcu_t fdcu = dev->id_unit;
206 if(fdc_data[fdcu].flags & FDC_ATTACHED)
207 {
208 printf("fdc: same unit (%d) used multiple times\n",fdcu);
209 return 0;
210 }
211

--- 7 unchanged lines hidden (view full) ---

219 out_fdc(fdcu,0xDF);
220 out_fdc(fdcu,2);
221 return (IO_FDCSIZE);
222}
223
224/*
225 * wire controller into system, look for floppy units
226 */
227int
223fdattach(dev)
228fdattach(dev)
224struct isa_device *dev;
229 struct isa_device *dev;
225{
226 unsigned fdt,st0, cyl;
227 int hdr;
228 fdu_t fdu;
229 fdcu_t fdcu = dev->id_unit;
230 fdc_p fdc = fdc_data + fdcu;
231 fd_p fd;
232 int fdsu;

--- 47 unchanged lines hidden (view full) ---

280 }
281 if ((fdt & 0xf0) == RTCFDT_144M) {
282 printf("1.44MB 3.5in\n");
283 fd_data[fdu].type = 0;
284 fd_data[fdu].ft = fd_types + 0;
285 }
286
287 fdt <<= 4;
230{
231 unsigned fdt,st0, cyl;
232 int hdr;
233 fdu_t fdu;
234 fdcu_t fdcu = dev->id_unit;
235 fdc_p fdc = fdc_data + fdcu;
236 fd_p fd;
237 int fdsu;

--- 47 unchanged lines hidden (view full) ---

285 }
286 if ((fdt & 0xf0) == RTCFDT_144M) {
287 printf("1.44MB 3.5in\n");
288 fd_data[fdu].type = 0;
289 fd_data[fdu].ft = fd_types + 0;
290 }
291
292 fdt <<= 4;
288 fd_turnoff(fdu);
293 fd_turnoff((caddr_t)fdu, 0);
289 hdr = 1;
290 }
291
292 /* Set transfer to 500kbps */
293 outb(fdc->baseport+fdctl,0); /*XXX*/
294 hdr = 1;
295 }
296
297 /* Set transfer to 500kbps */
298 outb(fdc->baseport+fdctl,0); /*XXX*/
299 return 1;
294}
295
296int
297fdsize(dev)
300}
301
302int
303fdsize(dev)
298dev_t dev;
304 dev_t dev;
299{
300 return(0);
301}
302
303/****************************************************************************/
304/* fdstrategy */
305/****************************************************************************/
305{
306 return(0);
307}
308
309/****************************************************************************/
310/* fdstrategy */
311/****************************************************************************/
306fdstrategy(bp)
307 register struct buf *bp; /* IO operation to perform */
312void fdstrategy(struct buf *bp)
308{
309 register struct buf *dp,*dp0,*dp1;
310 long nblocks,blknum;
311 int s;
312 fdcu_t fdcu;
313 fdu_t fdu;
314 fdc_p fdc;
315 fd_p fd;

--- 38 unchanged lines hidden (view full) ---

354bad:
355 biodone(bp);
356}
357
358/****************************************************************************/
359/* motor control stuff */
360/* remember to not deselect the drive we're working on */
361/****************************************************************************/
313{
314 register struct buf *dp,*dp0,*dp1;
315 long nblocks,blknum;
316 int s;
317 fdcu_t fdcu;
318 fdu_t fdu;
319 fdc_p fdc;
320 fd_p fd;

--- 38 unchanged lines hidden (view full) ---

359bad:
360 biodone(bp);
361}
362
363/****************************************************************************/
364/* motor control stuff */
365/* remember to not deselect the drive we're working on */
366/****************************************************************************/
367void
362set_motor(fdcu, fdu, reset)
363 fdcu_t fdcu;
364 fdu_t fdu;
365 int reset;
366{
367 int m0,m1;
368 int selunit;
369 fd_p fd;

--- 14 unchanged lines hidden (view full) ---

384 | (m1 ? FDO_MOEN1 : 0));
385 TRACE1("[0x%x->fdout]",(
386 selunit
387 | (reset ? 0 : (FDO_FRST|FDO_FDMAEN))
388 | (m0 ? FDO_MOEN0 : 0)
389 | (m1 ? FDO_MOEN1 : 0)));
390}
391
368set_motor(fdcu, fdu, reset)
369 fdcu_t fdcu;
370 fdu_t fdu;
371 int reset;
372{
373 int m0,m1;
374 int selunit;
375 fd_p fd;

--- 14 unchanged lines hidden (view full) ---

390 | (m1 ? FDO_MOEN1 : 0));
391 TRACE1("[0x%x->fdout]",(
392 selunit
393 | (reset ? 0 : (FDO_FRST|FDO_FDMAEN))
394 | (m0 ? FDO_MOEN0 : 0)
395 | (m1 ? FDO_MOEN1 : 0)));
396}
397
392fd_turnoff(fdu)
393 fdu_t fdu;
398static void
399fd_turnoff(caddr_t arg1, int arg2)
394{
400{
401 fdu_t fdu = (fdu_t)arg1;
395 int s;
396
397 fd_p fd = fd_data + fdu;
398 s = splbio();
399 fd->flags &= ~FD_MOTOR;
400 set_motor(fd->fdc->fdcu,fd->fdsu,0);
401 splx(s);
402}
403
402 int s;
403
404 fd_p fd = fd_data + fdu;
405 s = splbio();
406 fd->flags &= ~FD_MOTOR;
407 set_motor(fd->fdc->fdcu,fd->fdsu,0);
408 splx(s);
409}
410
404fd_motor_on(fdu)
405 fdu_t fdu;
411void
412fd_motor_on(caddr_t arg1, int arg2)
406{
413{
414 fdu_t fdu = (fdu_t)arg1;
407 int s;
408
409 fd_p fd = fd_data + fdu;
410 s = splbio();
411 fd->flags &= ~FD_MOTOR_WAIT;
412 if((fd->fdc->fd == fd) && (fd->fdc->state == MOTORWAIT))
413 {
414 fdintr(fd->fdc->fdcu);
415 }
416 splx(s);
417}
418
415 int s;
416
417 fd_p fd = fd_data + fdu;
418 s = splbio();
419 fd->flags &= ~FD_MOTOR_WAIT;
420 if((fd->fdc->fd == fd) && (fd->fdc->state == MOTORWAIT))
421 {
422 fdintr(fd->fdc->fdcu);
423 }
424 splx(s);
425}
426
427static void fd_turnon1(fdu_t);
428
429void
419fd_turnon(fdu)
420 fdu_t fdu;
421{
422 fd_p fd = fd_data + fdu;
423 if(!(fd->flags & FD_MOTOR))
424 {
425 fd_turnon1(fdu);
426 fd->flags |= FD_MOTOR_WAIT;
430fd_turnon(fdu)
431 fdu_t fdu;
432{
433 fd_p fd = fd_data + fdu;
434 if(!(fd->flags & FD_MOTOR))
435 {
436 fd_turnon1(fdu);
437 fd->flags |= FD_MOTOR_WAIT;
427 timeout(fd_motor_on,fdu,hz); /* in 1 sec its ok */
438 timeout(fd_motor_on, (caddr_t)fdu, hz); /* in 1 sec its ok */
428 }
429}
430
439 }
440}
441
431fd_turnon1(fdu)
432 fdu_t fdu;
442static void
443fd_turnon1(fdu_t fdu)
433{
434 fd_p fd = fd_data + fdu;
435 fd->flags |= FD_MOTOR;
436 set_motor(fd->fdc->fdcu,fd->fdsu,0);
437}
438
439/****************************************************************************/
440/* fdc in/out */

--- 13 unchanged lines hidden (view full) ---

454 i = inb(baseport+fddata);
455 TRACE1("[fddata->0x%x]",(unsigned char)i);
456 return(i);
457#else
458 return inb(baseport+fddata);
459#endif
460}
461
444{
445 fd_p fd = fd_data + fdu;
446 fd->flags |= FD_MOTOR;
447 set_motor(fd->fdc->fdcu,fd->fdsu,0);
448}
449
450/****************************************************************************/
451/* fdc in/out */

--- 13 unchanged lines hidden (view full) ---

465 i = inb(baseport+fddata);
466 TRACE1("[fddata->0x%x]",(unsigned char)i);
467 return(i);
468#else
469 return inb(baseport+fddata);
470#endif
471}
472
473int
462out_fdc(fdcu, x)
463 fdcu_t fdcu;
464 int x;
465{
466 int baseport = fdc_data[fdcu].baseport;
467 int i;
468
469 /* Check that the direction bit is set */

--- 10 unchanged lines hidden (view full) ---

480 outb(baseport+fddata,x);
481 TRACE1("[0x%x->fddata]",x);
482 return (0);
483}
484
485/****************************************************************************/
486/* fdopen/fdclose */
487/****************************************************************************/
474out_fdc(fdcu, x)
475 fdcu_t fdcu;
476 int x;
477{
478 int baseport = fdc_data[fdcu].baseport;
479 int i;
480
481 /* Check that the direction bit is set */

--- 10 unchanged lines hidden (view full) ---

492 outb(baseport+fddata,x);
493 TRACE1("[0x%x->fddata]",x);
494 return (0);
495}
496
497/****************************************************************************/
498/* fdopen/fdclose */
499/****************************************************************************/
500int
488Fdopen(dev, flags)
489 dev_t dev;
490 int flags;
491{
492 fdu_t fdu = FDUNIT(minor(dev));
493 /*int type = FDTYPE(minor(dev));*/
494 int s;
495
496 /* check bounds */
497 if (fdu >= NFD || fd_data[fdu].type == NO_TYPE) return(ENXIO);
498 /*if (type >= NUMTYPES) return(ENXIO);*/
499 fd_data[fdu].flags |= FD_OPEN;
500
501 return 0;
502}
503
501Fdopen(dev, flags)
502 dev_t dev;
503 int flags;
504{
505 fdu_t fdu = FDUNIT(minor(dev));
506 /*int type = FDTYPE(minor(dev));*/
507 int s;
508
509 /* check bounds */
510 if (fdu >= NFD || fd_data[fdu].type == NO_TYPE) return(ENXIO);
511 /*if (type >= NUMTYPES) return(ENXIO);*/
512 fd_data[fdu].flags |= FD_OPEN;
513
514 return 0;
515}
516
517int
504fdclose(dev, flags)
505 dev_t dev;
518fdclose(dev, flags)
519 dev_t dev;
520 int flags;
506{
507 fdu_t fdu = FDUNIT(minor(dev));
508 fd_data[fdu].flags &= ~FD_OPEN;
509 return(0);
510}
511
512
513/***************************************************************\
514* fdstart *
515* We have just queued something.. if the controller is not busy *
516* then simulate the case where it has just finished a command *
517* So that it (the interrupt routine) looks on the queue for more*
518* work to do and picks up what we just added. *
519* If the controller is already busy, we need do nothing, as it *
520* will pick up our work when the present work completes *
521\***************************************************************/
521{
522 fdu_t fdu = FDUNIT(minor(dev));
523 fd_data[fdu].flags &= ~FD_OPEN;
524 return(0);
525}
526
527
528/***************************************************************\
529* fdstart *
530* We have just queued something.. if the controller is not busy *
531* then simulate the case where it has just finished a command *
532* So that it (the interrupt routine) looks on the queue for more*
533* work to do and picks up what we just added. *
534* If the controller is already busy, we need do nothing, as it *
535* will pick up our work when the present work completes *
536\***************************************************************/
537static void
522fdstart(fdcu)
523 fdcu_t fdcu;
524{
525 register struct buf *dp,*bp;
526 int s;
527 fdu_t fdu;
528
529 s = splbio();
530 if(fdc_data[fdcu].state == DEVIDLE)
531 {
532 fdintr(fdcu);
533 }
534 splx(s);
535}
536
538fdstart(fdcu)
539 fdcu_t fdcu;
540{
541 register struct buf *dp,*bp;
542 int s;
543 fdu_t fdu;
544
545 s = splbio();
546 if(fdc_data[fdcu].state == DEVIDLE)
547 {
548 fdintr(fdcu);
549 }
550 splx(s);
551}
552
537fd_timeout(fdcu)
538 fdcu_t fdcu;
553static void
554fd_timeout(caddr_t arg1, int arg2)
539{
555{
556 fdcu_t fdcu = (fdcu_t)arg1;
540 fdu_t fdu = fdc_data[fdcu].fdu;
541 int st0, st3, cyl;
542 struct buf *dp,*bp;
543 int s;
544
545 dp = &fdc_data[fdcu].head;
546 s = splbio();
547 bp = dp->b_actf;

--- 27 unchanged lines hidden (view full) ---

575 fdc_data[fdcu].fdu = -1;
576 fdc_data[fdcu].state = DEVIDLE;
577 }
578 fdintr(fdcu);
579 splx(s);
580}
581
582/* just ensure it has the right spl */
557 fdu_t fdu = fdc_data[fdcu].fdu;
558 int st0, st3, cyl;
559 struct buf *dp,*bp;
560 int s;
561
562 dp = &fdc_data[fdcu].head;
563 s = splbio();
564 bp = dp->b_actf;

--- 27 unchanged lines hidden (view full) ---

592 fdc_data[fdcu].fdu = -1;
593 fdc_data[fdcu].state = DEVIDLE;
594 }
595 fdintr(fdcu);
596 splx(s);
597}
598
599/* just ensure it has the right spl */
583fd_pseudointr(fdcu)
584 fdcu_t fdcu;
600static void
601fd_pseudointr(caddr_t arg1, int arg2)
585{
602{
603 fdcu_t fdcu = (fdcu_t)arg1;
586 int s;
587 s = splbio();
588 fdintr(fdcu);
589 splx(s);
590}
591
592/***********************************************************************\
593* fdintr *
594* keep calling the state machine until it returns a 0 *
595* ALWAYS called at SPLBIO *
596\***********************************************************************/
604 int s;
605 s = splbio();
606 fdintr(fdcu);
607 splx(s);
608}
609
610/***********************************************************************\
611* fdintr *
612* keep calling the state machine until it returns a 0 *
613* ALWAYS called at SPLBIO *
614\***********************************************************************/
597fdintr(fdcu)
598 fdcu_t fdcu;
615void
616fdintr(fdcu_t fdcu)
599{
600 fdc_p fdc = fdc_data + fdcu;
617{
618 fdc_p fdc = fdc_data + fdcu;
601 while(fdstate(fdcu, fdc));
619 while(fdstate(fdcu, fdc))
620 ;
602}
603
604/***********************************************************************\
605* The controller state machine. *
606* if it returns a non zero value, it should be called again immediatly *
607\***********************************************************************/
621}
622
623/***********************************************************************\
624* The controller state machine. *
625* if it returns a non zero value, it should be called again immediatly *
626\***********************************************************************/
608int fdstate(fdcu, fdc)
627int
628fdstate(fdcu, fdc)
609 fdcu_t fdcu;
610 fdc_p fdc;
611{
629 fdcu_t fdcu;
630 fdc_p fdc;
631{
612 int read,head,trac,sec,i,s,sectrac,cyl,st0;
632 int read, head, trac, sec = 0, i = 0, s, sectrac, cyl, st0;
613 unsigned long blknum;
614 fdu_t fdu = fdc->fdu;
615 fd_p fd;
616 register struct buf *dp,*bp;
617
618 dp = &(fdc->head);
619 bp = dp->b_actf;
620 if(!bp)

--- 19 unchanged lines hidden (view full) ---

640 {
641 printf("confused fd pointers\n");
642 }
643 read = bp->b_flags & B_READ;
644 TRACE1("fd%d",fdu);
645 TRACE1("[%s]",fdstates[fdc->state]);
646 TRACE1("(0x%x)",fd->flags);
647 untimeout(fd_turnoff, fdu);
633 unsigned long blknum;
634 fdu_t fdu = fdc->fdu;
635 fd_p fd;
636 register struct buf *dp,*bp;
637
638 dp = &(fdc->head);
639 bp = dp->b_actf;
640 if(!bp)

--- 19 unchanged lines hidden (view full) ---

660 {
661 printf("confused fd pointers\n");
662 }
663 read = bp->b_flags & B_READ;
664 TRACE1("fd%d",fdu);
665 TRACE1("[%s]",fdstates[fdc->state]);
666 TRACE1("(0x%x)",fd->flags);
667 untimeout(fd_turnoff, fdu);
648 timeout(fd_turnoff,fdu,4 * hz);
668 timeout(fd_turnoff, (caddr_t)fdu, 4 * hz);
649 switch (fdc->state)
650 {
651 case DEVIDLE:
652 case FINDWORK: /* we have found new work */
653 fdc->retry = 0;
654 fd->skip = 0;
655 fdc->fd = fd;
656 fdc->fdu = fdu;

--- 27 unchanged lines hidden (view full) ---

684 fdc->state = SEEKCOMPLETE;
685 break;
686 }
687 out_fdc(fdcu,NE7CMD_SEEK); /* Seek function */
688 out_fdc(fdcu,fd->fdsu); /* Drive number */
689 out_fdc(fdcu,bp->b_cylin * fd->ft->steptrac);
690 fd->track = -2;
691 fdc->state = SEEKWAIT;
669 switch (fdc->state)
670 {
671 case DEVIDLE:
672 case FINDWORK: /* we have found new work */
673 fdc->retry = 0;
674 fd->skip = 0;
675 fdc->fd = fd;
676 fdc->fdu = fdu;

--- 27 unchanged lines hidden (view full) ---

704 fdc->state = SEEKCOMPLETE;
705 break;
706 }
707 out_fdc(fdcu,NE7CMD_SEEK); /* Seek function */
708 out_fdc(fdcu,fd->fdsu); /* Drive number */
709 out_fdc(fdcu,bp->b_cylin * fd->ft->steptrac);
710 fd->track = -2;
711 fdc->state = SEEKWAIT;
692 timeout(fd_timeout,fdcu,2 * hz);
712 timeout(fd_timeout, (caddr_t)fdcu, 2 * hz);
693 return(0); /* will return later */
694 case SEEKWAIT:
695 untimeout(fd_timeout,fdcu);
696 /* allow heads to settle */
713 return(0); /* will return later */
714 case SEEKWAIT:
715 untimeout(fd_timeout,fdcu);
716 /* allow heads to settle */
697 timeout(fd_pseudointr,fdcu,hz/50);
717 timeout(fd_pseudointr, (caddr_t)fdcu, hz / 50);
698 fdc->state = SEEKCOMPLETE;
699 return(0); /* will return later */
700 break;
701
702 case SEEKCOMPLETE : /* SEEK DONE, START DMA */
703 /* Make sure seek really happened*/
704 if(fd->track == -2)
705 {

--- 32 unchanged lines hidden (view full) ---

738 out_fdc(fdcu,fd->track); /* track */
739 out_fdc(fdcu,head);
740 out_fdc(fdcu,sec); /* sector XXX +1? */
741 out_fdc(fdcu,fd->ft->secsize); /* sector size */
742 out_fdc(fdcu,sectrac); /* sectors/track */
743 out_fdc(fdcu,fd->ft->gap); /* gap size */
744 out_fdc(fdcu,fd->ft->datalen); /* data length */
745 fdc->state = IOCOMPLETE;
718 fdc->state = SEEKCOMPLETE;
719 return(0); /* will return later */
720 break;
721
722 case SEEKCOMPLETE : /* SEEK DONE, START DMA */
723 /* Make sure seek really happened*/
724 if(fd->track == -2)
725 {

--- 32 unchanged lines hidden (view full) ---

758 out_fdc(fdcu,fd->track); /* track */
759 out_fdc(fdcu,head);
760 out_fdc(fdcu,sec); /* sector XXX +1? */
761 out_fdc(fdcu,fd->ft->secsize); /* sector size */
762 out_fdc(fdcu,sectrac); /* sectors/track */
763 out_fdc(fdcu,fd->ft->gap); /* gap size */
764 out_fdc(fdcu,fd->ft->datalen); /* data length */
765 fdc->state = IOCOMPLETE;
746 timeout(fd_timeout,fdcu,2 * hz);
766 timeout(fd_timeout, (caddr_t)fdcu, 2 * hz);
747 return(0); /* will return later */
748 case IOCOMPLETE: /* IO DONE, post-analyze */
749 untimeout(fd_timeout,fdcu);
750 for(i=0;i<7;i++)
751 {
752 fdc->status[i] = in_fdc(fdcu);
753 }
754 case IOTIMEDOUT: /*XXX*/

--- 40 unchanged lines hidden (view full) ---

795 out_fdc(fdcu,0xDF);
796 out_fdc(fdcu,2);
797 out_fdc(fdcu,NE7CMD_RECAL); /* Recalibrate Function */
798 out_fdc(fdcu,fdu);
799 fdc->state = RECALWAIT;
800 return(0); /* will return later */
801 case RECALWAIT:
802 /* allow heads to settle */
767 return(0); /* will return later */
768 case IOCOMPLETE: /* IO DONE, post-analyze */
769 untimeout(fd_timeout,fdcu);
770 for(i=0;i<7;i++)
771 {
772 fdc->status[i] = in_fdc(fdcu);
773 }
774 case IOTIMEDOUT: /*XXX*/

--- 40 unchanged lines hidden (view full) ---

815 out_fdc(fdcu,0xDF);
816 out_fdc(fdcu,2);
817 out_fdc(fdcu,NE7CMD_RECAL); /* Recalibrate Function */
818 out_fdc(fdcu,fdu);
819 fdc->state = RECALWAIT;
820 return(0); /* will return later */
821 case RECALWAIT:
822 /* allow heads to settle */
803 timeout(fd_pseudointr,fdcu,hz/30);
823 timeout(fd_pseudointr, (caddr_t)fdcu, hz / 30);
804 fdc->state = RECALCOMPLETE;
805 return(0); /* will return later */
806 case RECALCOMPLETE:
807 out_fdc(fdcu,NE7CMD_SENSEI);
808 st0 = in_fdc(fdcu);
809 cyl = in_fdc(fdcu);
810 if (cyl != 0)
811 {

--- 31 unchanged lines hidden (view full) ---

843 fdc->status[4],
844 fdc->status[5],
845 fdc->status[6] );
846 return(0);
847 }
848 return(1); /* Come back immediatly to new state */
849}
850
824 fdc->state = RECALCOMPLETE;
825 return(0); /* will return later */
826 case RECALCOMPLETE:
827 out_fdc(fdcu,NE7CMD_SENSEI);
828 st0 = in_fdc(fdcu);
829 cyl = in_fdc(fdcu);
830 if (cyl != 0)
831 {

--- 31 unchanged lines hidden (view full) ---

863 fdc->status[4],
864 fdc->status[5],
865 fdc->status[6] );
866 return(0);
867 }
868 return(1); /* Come back immediatly to new state */
869}
870
871int
851retrier(fdcu)
852 fdcu_t fdcu;
853{
854 fdc_p fdc = fdc_data + fdcu;
855 register struct buf *dp,*bp;
856
857 dp = &(fdc->head);
858 bp = dp->b_actf;

--- 119 unchanged lines hidden ---
872retrier(fdcu)
873 fdcu_t fdcu;
874{
875 fdc_p fdc = fdc_data + fdcu;
876 register struct buf *dp,*bp;
877
878 dp = &(fdc->head);
879 bp = dp->b_actf;

--- 119 unchanged lines hidden ---