Home | History | Annotate | Download | only in dev

Lines Matching defs:fdc

209 CFATTACH_DECL_NEW(fdc, sizeof(struct fdc_softc),
348 if (strcmp("fdc", aux) || fdc_matched)
400 * the drive). If `fdc' is not NULL, the drive was found but was not
406 fdprint(void *aux, const char *fdc)
410 if (!fdc)
418 struct fdc_softc *fdc = device_private(self);
424 fdc->sc_dev = self;
425 fdc->sc_state = DEVIDLE;
426 TAILQ_INIT(&fdc->sc_drives);
435 (void)fdcresult(fdc);
444 callout_init(&fdc->sc_timo_ch, 0);
445 callout_init(&fdc->sc_intr_ch, 0);
459 MFP2->mf_aer |= 0x10; /* fdc int low->high */
474 struct fdc_softc *fdc = device_private(parent);
501 n = fdcresult(fdc);
508 printf(" %x", fdc->sc_status[i]);
512 intr_arg = (void*)fdc;
513 if (n != 2 || (fdc->sc_status[0] & 0xf8) != 0x20)
527 struct fdc_softc *fdc = device_private(parent);
549 fdc->sc_fd[drive] = fd;
658 struct fdc_softc *fdc;
660 fdc = device_private(device_parent(fd->sc_dev));
661 if (fdc->sc_state == DEVIDLE) {
663 fdcstart(fdc);
679 struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));
680 int active = fdc->sc_drives.tqh_first != 0;
684 TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
688 fdcstart(fdc);
694 struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));
705 TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
707 TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
717 fdc->sc_state = DEVIDLE;
735 fd_set_motor(struct fdc_softc *fdc, int reset)
741 if ((fd = fdc->sc_drives.tqh_first) != NULL)
748 if ((fd = fdc->sc_fd[n]) && (fd->sc_flags & FD_MOTOR))
757 struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));
762 fd_set_motor(fdc, 0);
770 struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));
775 if ((fdc->sc_drives.tqh_first == fd) && (fdc->sc_state == MOTORWAIT))
776 (void) fdcintr(fdc);
781 fdcresult(struct fdc_softc *fdc)
792 if (n >= sizeof(fdc->sc_status)) {
796 fdc->sc_status[n++] = rd_fdc_reg(fddata);
854 fdcstart(struct fdc_softc *fdc)
860 if (fdc->sc_state != DEVIDLE) {
865 (void) fdcintr(fdc);
869 fdcpstatus(struct fdc_softc *fdc)
873 snprintb(bits, sizeof(bits), NE7_ST0BITS, fdc->sc_status[0]);
875 snprintb(bits, sizeof(bits), NE7_ST1BITS, fdc->sc_status[1]);
877 snprintb(bits, sizeof(bits), NE7_ST2BITS, fdc->sc_status[2]);
880 fdc->sc_status[3], fdc->sc_status[4], fdc->sc_status[5]);
886 struct fdc_softc *fdc = device_private(device_parent(self));
891 (void) fdcresult(fdc);
902 snprintb(bits, sizeof(bits), NE7_ST0BITS, fdc->sc_status[0]);
903 printf(" (st0 %s cyl %d)\n", bits, fdc->sc_status[1]);
906 fdcpstatus(fdc);
919 struct fdc_softc *fdc = arg;
920 struct fd_softc *fd = fdc->sc_drives.tqh_first;
927 fdc->sc_state++;
929 fdc->sc_state = DEVIDLE;
931 (void) fdcintr(fdc);
949 struct fdc_softc *fdc = arg;
950 #define st0 fdc->sc_status[0]
951 #define st1 fdc->sc_status[1]
952 #define cyl fdc->sc_status[1]
962 fd = fdc->sc_drives.tqh_first;
964 fdc->sc_state = DEVIDLE;
972 TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
980 switch (fdc->sc_state) {
982 fdc->sc_errors = 0;
983 fdc->sc_overruns = 0;
989 fdc->sc_state = MOTORWAIT;
994 struct fd_softc *ofd = fdc->sc_fd[fd->sc_drive ^ 1];
1000 fd_set_motor(fdc, 0);
1001 fdc->sc_state = MOTORWAIT;
1008 fd_set_motor(fdc, 0);
1027 fdc->sc_state = SEEKWAIT;
1032 callout_reset(&fdc->sc_timo_ch, 4 * hz, fdctimeout, fdc);
1084 fdc->sc_errors = 4;
1085 fdcretry(fdc);
1107 fdc->sc_state = IOCOMPLETE;
1112 callout_reset(&fdc->sc_timo_ch, 2 * hz, fdctimeout, fdc);
1116 callout_stop(&fdc->sc_timo_ch);
1117 fdc->sc_state = SEEKCOMPLETE;
1119 callout_reset(&fdc->sc_intr_ch, hz / 50, fdcpseudointr, fdc);
1128 if (fdcresult(fdc) != 2 || (st0 & 0xf8) != 0x20 ||
1133 fdcretry(fdc);
1143 fdcretry(fdc);
1147 callout_stop(&fdc->sc_timo_ch);
1152 if (fdcresult(fdc) != 7 || (st1 & 0x37) != 0) {
1157 if ((st1 & 0x10) && (++fdc->sc_overruns < 4)) {
1158 fdc->sc_state = DOSEEK;
1167 fdcretry(fdc);
1170 if (fdc->sc_errors) {
1174 fdc->sc_errors = 0;
1176 fdc->sc_overruns = 0;
1189 fd_set_motor(fdc, 1);
1191 fd_set_motor(fdc, 0);
1192 fdc->sc_state = RESETCOMPLETE;
1193 callout_reset(&fdc->sc_timo_ch, hz / 2, fdctimeout, fdc);
1197 callout_stop(&fdc->sc_timo_ch);
1201 (void) fdcresult(fdc);
1210 fdc->sc_state = RECALWAIT;
1211 callout_reset(&fdc->sc_timo_ch, 5 * hz, fdctimeout, fdc);
1215 callout_stop(&fdc->sc_timo_ch);
1216 fdc->sc_state = RECALCOMPLETE;
1218 callout_reset(&fdc->sc_intr_ch, hz / 30, fdcpseudointr, fdc);
1223 if (fdcresult(fdc) != 2 || (st0 & 0xf8) != 0x20 || cyl != 0) {
1227 fdcretry(fdc);
1251 fdcretry(struct fdc_softc *fdc)
1256 fd = fdc->sc_drives.tqh_first;
1262 switch (fdc->sc_errors) {
1265 fdc->sc_state = DOSEEK;
1270 fdc->sc_state = DORECAL;
1275 fdc->sc_state = DORESET;
1284 fdcpstatus(fdc);
1289 fdc->sc_errors++;