Index: fd.c =================================================================== RCS file: /cvsroot/src/sys/arch/x68k/dev/fd.c,v retrieving revision 1.93 diff -u -p -r1.93 fd.c --- fd.c 6 Jun 2010 04:52:01 -0000 1.93 +++ fd.c 9 Apr 2011 19:59:23 -0000 @@ -212,7 +212,6 @@ struct fd_softc { struct fd_type *sc_deftype; /* default type descriptor */ struct fd_type *sc_type; /* current type descriptor */ - struct callout sc_motoron_ch; struct callout sc_motoroff_ch; daddr_t sc_blkno; /* starting block number */ @@ -278,7 +277,6 @@ struct dkdriver fddkdriver = { fdstrateg void fd_set_motor(struct fdc_softc *, int); void fd_motor_off(void *); -void fd_motor_on(void *); int fdcresult(struct fdc_softc *); int out_fdc(bus_space_tag_t, bus_space_handle_t, u_char); void fdcstart(struct fdc_softc *); @@ -564,7 +562,6 @@ fdattach(device_t parent, device_t self, struct fd_type *type = &fd_types[0]; /* XXX 1.2MB */ int drive = fa->fa_drive; - callout_init(&fd->sc_motoron_ch, 0); callout_init(&fd->sc_motoroff_ch, 0); fd->sc_dev = self; @@ -788,22 +785,6 @@ fd_motor_off(void *arg) splx(s); } -void -fd_motor_on(void *arg) -{ - struct fd_softc *fd = arg; - struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev)); - int s; - - DPRINTF(("fd_motor_on:\n")); - - s = splbio(); - fd->sc_flags &= ~FD_MOTOR_WAIT; - if ((TAILQ_FIRST(&fdc->sc_drives) == fd) && (fdc->sc_state == MOTORWAIT)) - (void) fdcintr(fdc); - splx(s); -} - int fdcresult(struct fdc_softc *fdc) { @@ -1082,9 +1063,6 @@ loop: fd->sc_flags |= FD_MOTOR | FD_MOTOR_WAIT; fd_set_motor(fdc, 0); fdc->sc_state = MOTORWAIT; - /* allow .5s for motor to stabilize */ - callout_reset(&fd->sc_motoron_ch, hz / 2, - fd_motor_on, fd); return 1; } /* Make sure the right drive is selected. */ @@ -1437,8 +1415,17 @@ loop: goto doseek; case MOTORWAIT: - if (fd->sc_flags & FD_MOTOR_WAIT) - return 1; /* time's not up yet */ + /* check drive ready by state change interrupt */ + KASSERT(fd->sc_flags & FD_MOTOR_WAIT); + out_fdc(iot, ioh, NE7CMD_SENSEI); + tmp = fdcresult(fdc); + if (tmp != 2 || (st0 & 0xc0) != 0xc0 /* ready changed */) { + printf("%s: unexpected interrupt during MOTORWAIT", + device_xname(fd->sc_dev)); + fdcpstatus(7, fdc); + return 1; + } + fd->sc_flags &= ~FD_MOTOR_WAIT; goto doseek; default: