• Home
  • Raw
  • Download

Lines Matching refs:drive

125 #define SELMASK(drive)  (1 << (3 + (drive & 3)))  argument
239 static inline int try_fdc(int drive) in try_fdc() argument
241 drive &= 3; in try_fdc()
242 return ((fdc_busy < 0) || (fdc_busy == drive)); in try_fdc()
245 static void get_fdc(int drive) in get_fdc() argument
249 drive &= 3; in get_fdc()
251 printk("get_fdc: drive %d fdc_busy %d fdc_nested %d\n",drive,fdc_busy,fdc_nested); in get_fdc()
254 wait_event(fdc_wait, try_fdc(drive)); in get_fdc()
255 fdc_busy = drive; in get_fdc()
274 static void fd_select (int drive) in fd_select() argument
278 drive&=3; in fd_select()
280 printk("selecting %d\n",drive); in fd_select()
282 if (drive == selected) in fd_select()
284 get_fdc(drive); in fd_select()
285 selected = drive; in fd_select()
287 if (unit[drive].track % 2 != 0) in fd_select()
289 if (unit[drive].motor == 1) in fd_select()
293 prb &= ~SELMASK(drive); in fd_select()
298 static void fd_deselect (int drive) in fd_deselect() argument
303 drive&=3; in fd_deselect()
305 printk("deselecting %d\n",drive); in fd_deselect()
307 if (drive != selected) { in fd_deselect()
308 printk(KERN_WARNING "Deselecting drive %d while %d was selected!\n",drive,selected); in fd_deselect()
312 get_fdc(drive); in fd_deselect()
369 static void fd_motor_off(unsigned long drive) in fd_motor_off() argument
375 decusecount = drive & 0x40000000; in fd_motor_off()
377 calledfromint = drive & 0x80000000; in fd_motor_off()
378 drive&=3; in fd_motor_off()
379 if (calledfromint && !try_fdc(drive)) { in fd_motor_off()
381 motor_off_timer[drive].expires = jiffies + 1; in fd_motor_off()
382 add_timer(motor_off_timer + drive); in fd_motor_off()
385 unit[drive].motor = 0; in fd_motor_off()
386 fd_select(drive); in fd_motor_off()
388 fd_deselect(drive); in fd_motor_off()
393 int drive; in floppy_off() local
395 drive = nr & 3; in floppy_off()
397 motor_off_timer[drive].data = nr | 0x80000000; in floppy_off()
398 mod_timer(motor_off_timer + drive, jiffies + 3*HZ); in floppy_off()
401 static int fd_calibrate(int drive) in fd_calibrate() argument
406 drive &= 3; in fd_calibrate()
407 get_fdc(drive); in fd_calibrate()
408 if (!fd_motor_on (drive)) in fd_calibrate()
410 fd_select (drive); in fd_calibrate()
415 for (n = unit[drive].type->tracks/2; n != 0; --n) { in fd_calibrate()
423 ms_delay(unit[drive].type->step_delay); in fd_calibrate()
425 ms_delay (unit[drive].type->settle_time); in fd_calibrate()
427 n = unit[drive].type->tracks + 20; in fd_calibrate()
434 ms_delay(unit[drive].type->step_delay + 1); in fd_calibrate()
438 printk (KERN_ERR "fd%d: calibrate failed, turning motor off\n", drive); in fd_calibrate()
439 fd_motor_off (drive); in fd_calibrate()
440 unit[drive].track = -1; in fd_calibrate()
445 unit[drive].track = 0; in fd_calibrate()
446 ms_delay(unit[drive].type->settle_time); in fd_calibrate()
449 fd_deselect(drive); in fd_calibrate()
453 static int fd_seek(int drive, int track) in fd_seek() argument
459 printk("seeking drive %d to track %d\n",drive,track); in fd_seek()
461 drive &= 3; in fd_seek()
462 get_fdc(drive); in fd_seek()
463 if (unit[drive].track == track) { in fd_seek()
467 if (!fd_motor_on(drive)) { in fd_seek()
471 if (unit[drive].track < 0 && !fd_calibrate(drive)) { in fd_seek()
476 fd_select (drive); in fd_seek()
477 cnt = unit[drive].track/2 - track/2; in fd_seek()
487 if (track % 2 != unit[drive].track % 2) in fd_seek()
488 ms_delay (unit[drive].type->side_time); in fd_seek()
489 unit[drive].track = track; in fd_seek()
492 fd_deselect(drive); in fd_seek()
501 ms_delay (unit[drive].type->step_delay); in fd_seek()
503 ms_delay (unit[drive].type->settle_time); in fd_seek()
506 fd_deselect(drive); in fd_seek()
510 static unsigned long fd_get_drive_id(int drive) in fd_get_drive_id() argument
515 drive&=3; in fd_get_drive_id()
516 get_fdc(drive); in fd_get_drive_id()
520 SELECT(SELMASK(drive)); in fd_get_drive_id()
522 DESELECT(SELMASK(drive)); in fd_get_drive_id()
526 SELECT(SELMASK(drive)); in fd_get_drive_id()
528 DESELECT(SELMASK(drive)); in fd_get_drive_id()
533 SELECT(SELMASK(drive)); in fd_get_drive_id()
540 DESELECT(SELMASK(drive)); in fd_get_drive_id()
551 if(drive == 0 && id == FD_NODRIVE) in fd_get_drive_id()
578 static void raw_read(int drive) in raw_read() argument
580 drive&=3; in raw_read()
581 get_fdc(drive); in raw_read()
583 fd_select(drive); in raw_read()
592 custom.dsklen = unit[drive].type->read_size/sizeof(short) | DSKLEN_DMAEN; in raw_read()
593 custom.dsklen = unit[drive].type->read_size/sizeof(short) | DSKLEN_DMAEN; in raw_read()
600 fd_deselect(drive); in raw_read()
604 static int raw_write(int drive) in raw_write() argument
608 drive&=3; in raw_write()
609 get_fdc(drive); /* corresponds to rel_fdc() in post_write() */ in raw_write()
615 fd_select(drive); in raw_write()
620 if ((ulong)unit[drive].track >= unit[drive].type->precomp2) in raw_write()
622 else if ((ulong)unit[drive].track >= unit[drive].type->precomp1) in raw_write()
628 custom.dsklen = unit[drive].type->write_size/sizeof(short) | DSKLEN_DMAEN|DSKLEN_WRITE; in raw_write()
629 custom.dsklen = unit[drive].type->write_size/sizeof(short) | DSKLEN_DMAEN|DSKLEN_WRITE; in raw_write()
639 static void post_write (unsigned long drive) in post_write() argument
642 printk("post_write for drive %ld\n",drive); in post_write()
644 drive &= 3; in post_write()
649 unit[drive].dirty = 0; in post_write()
651 fd_deselect(drive); in post_write()
718 static int amiga_read(int drive) in amiga_read() argument
726 drive&=3; in amiga_read()
728 end = raw + unit[drive].type->read_size; in amiga_read()
730 for (scnt = 0;scnt < unit[drive].dtype->sects * unit[drive].type->sect_mult; scnt++) { in amiga_read()
757 if (hdr.track != unit[drive].track) { in amiga_read()
758 printk(KERN_INFO "MFM_TRACK: %d, %d\n", hdr.track, unit[drive].track); in amiga_read()
762 raw = decode ((ulong *)(unit[drive].trackbuf + hdr.sect*512), in amiga_read()
764 csum = checksum((ulong *)(unit[drive].trackbuf + hdr.sect*512), 512); in amiga_read()
771 ((ulong *)(unit[drive].trackbuf+hdr.sect*512))[0], in amiga_read()
772 ((ulong *)(unit[drive].trackbuf+hdr.sect*512))[1], in amiga_read()
773 ((ulong *)(unit[drive].trackbuf+hdr.sect*512))[2], in amiga_read()
774 ((ulong *)(unit[drive].trackbuf+hdr.sect*512))[3]); in amiga_read()
1033 static int dos_read(int drive) in dos_read() argument
1041 drive&=3; in dos_read()
1043 end = raw + unit[drive].type->read_size; in dos_read()
1045 for (scnt=0; scnt < unit[drive].dtype->sects * unit[drive].type->sect_mult; scnt++) { in dos_read()
1050 unit[drive].track,drive,scnt); in dos_read()
1071 if (hdr.track != unit[drive].track/unit[drive].type->heads) { in dos_read()
1074 unit[drive].track/unit[drive].type->heads); in dos_read()
1078 if (hdr.side != unit[drive].track%unit[drive].type->heads) { in dos_read()
1081 unit[drive].track%unit[drive].type->heads); in dos_read()
1096 unit[drive].track, drive, scnt, hdr.sec); in dos_read()
1111 …raw = dos_decode((unsigned char *)(unit[drive].trackbuf + (hdr.sec - 1) * 512), (ushort *) raw, 51… in dos_read()
1113 crc = dos_data_crc(unit[drive].trackbuf + (hdr.sec - 1) * 512); in dos_read()
1120 ((ulong *)(unit[drive].trackbuf+(hdr.sec-1)*512))[0], in dos_read()
1121 ((ulong *)(unit[drive].trackbuf+(hdr.sec-1)*512))[1], in dos_read()
1122 ((ulong *)(unit[drive].trackbuf+(hdr.sec-1)*512))[2], in dos_read()
1123 ((ulong *)(unit[drive].trackbuf+(hdr.sec-1)*512))[3]); in dos_read()
1154 static unsigned long *ms_putsec(int drive, unsigned long *raw, int cnt) in ms_putsec() argument
1161 drive&=3; in ms_putsec()
1171 hdr.track=unit[drive].track/unit[drive].type->heads; in ms_putsec()
1172 hdr.side=unit[drive].track%unit[drive].type->heads; in ms_putsec()
1190 (unsigned char *)unit[drive].trackbuf+cnt*512,512); in ms_putsec()
1194 crc[0]=dos_data_crc(unit[drive].trackbuf+cnt*512); in ms_putsec()
1302 static int get_track(int drive, int track) in get_track() argument
1306 drive&=3; in get_track()
1307 if (unit[drive].track == track) in get_track()
1309 get_fdc(drive); in get_track()
1310 if (!fd_motor_on(drive)) { in get_track()
1315 if (unit[drive].dirty == 1) { in get_track()
1316 del_timer (flush_track_timer + drive); in get_track()
1317 non_int_flush_track (drive); in get_track()
1321 if (!fd_seek(drive, track)) in get_track()
1323 raw_read(drive); in get_track()
1324 error = (*unit[drive].dtype->read_fkt)(drive); in get_track()
1330 unit[drive].track = -1; in get_track()
1377 int drive; in redo_fd_request() local
1391 drive = floppy - unit; in redo_fd_request()
1415 if (get_track(drive, track) == -1) { in redo_fd_request()
1426 if (!fd_motor_on(drive)) { in redo_fd_request()
1438 mod_timer (flush_track_timer + drive, jiffies + 1); in redo_fd_request()
1455 int drive = MINOR(bdev->bd_dev) & 3; in fd_getgeo() local
1457 geo->heads = unit[drive].type->heads; in fd_getgeo()
1458 geo->sectors = unit[drive].dtype->sects * unit[drive].type->sect_mult; in fd_getgeo()
1459 geo->cylinders = unit[drive].type->tracks; in fd_getgeo()
1467 int drive = p - unit; in fd_locked_ioctl() local
1473 get_fdc(drive); in fd_locked_ioctl()
1474 if (fd_ref[drive] > 1) { in fd_locked_ioctl()
1479 if (fd_motor_on(drive) == 0) { in fd_locked_ioctl()
1483 if (fd_calibrate(drive) == 0) { in fd_locked_ioctl()
1487 floppy_off(drive); in fd_locked_ioctl()
1493 get_fdc(drive); in fd_locked_ioctl()
1494 if (fd_seek(drive,param) != 0){ in fd_locked_ioctl()
1497 non_int_flush_track(drive); in fd_locked_ioctl()
1499 floppy_off(drive); in fd_locked_ioctl()
1506 floppy_off(drive); in fd_locked_ioctl()
1522 del_timer (flush_track_timer + drive); in fd_locked_ioctl()
1523 non_int_flush_track(drive); in fd_locked_ioctl()
1534 cmd, drive); in fd_locked_ioctl()
1556 int drive; in fd_probe() local
1558 drive = dev & 3; in fd_probe()
1559 code = fd_get_drive_id(drive); in fd_probe()
1569 unit[drive].type = &drive_types[num_dr_types-1]; /* FD_NODRIVE */ in fd_probe()
1573 unit[drive].type = drive_types + type; in fd_probe()
1574 unit[drive].track = -1; in fd_probe()
1576 unit[drive].disk = -1; in fd_probe()
1577 unit[drive].motor = 0; in fd_probe()
1578 unit[drive].busy = 0; in fd_probe()
1579 unit[drive].status = -1; in fd_probe()
1589 int drive = MINOR(bdev->bd_dev) & 3; in floppy_open() local
1595 old_dev = fd_device[drive]; in floppy_open()
1597 if (fd_ref[drive] && old_dev != system) { in floppy_open()
1607 get_fdc(drive); in floppy_open()
1608 fd_select (drive); in floppy_open()
1610 fd_deselect (drive); in floppy_open()
1621 fd_ref[drive]++; in floppy_open()
1622 fd_device[drive] = system; in floppy_open()
1625 unit[drive].dtype=&data_types[system]; in floppy_open()
1626 unit[drive].blocks=unit[drive].type->heads*unit[drive].type->tracks* in floppy_open()
1627 data_types[system].sects*unit[drive].type->sect_mult; in floppy_open()
1628 set_capacity(unit[drive].gendisk, unit[drive].blocks); in floppy_open()
1630 printk(KERN_INFO "fd%d: accessing %s-disk with %s-layout\n",drive, in floppy_open()
1631 unit[drive].type->name, data_types[system].name); in floppy_open()
1640 int drive = p - unit; in floppy_release() local
1643 if (unit[drive].dirty == 1) { in floppy_release()
1644 del_timer (flush_track_timer + drive); in floppy_release()
1645 non_int_flush_track (drive); in floppy_release()
1648 if (!fd_ref[drive]--) { in floppy_release()
1650 fd_ref[drive] = 0; in floppy_release()
1654 floppy_off (drive | 0x40000000); in floppy_release()
1668 int drive = p - unit; in amiga_check_events() local
1675 get_fdc(drive); in amiga_check_events()
1676 fd_select (drive); in amiga_check_events()
1678 fd_deselect (drive); in amiga_check_events()
1683 fd_probe(drive); in amiga_check_events()
1704 int drive,drives,nomem; in fd_probe_drives() local
1709 for(drive=0;drive<FD_MAX_UNITS;drive++) { in fd_probe_drives()
1711 fd_probe(drive); in fd_probe_drives()
1712 if (unit[drive].type->code == FD_NODRIVE) in fd_probe_drives()
1716 unit[drive].type->code = FD_NODRIVE; in fd_probe_drives()
1719 unit[drive].gendisk = disk; in fd_probe_drives()
1723 unit[drive].type->code = FD_NODRIVE; in fd_probe_drives()
1728 if ((unit[drive].trackbuf = kmalloc(FLOPPY_MAX_SECTORS * 512, GFP_KERNEL)) == NULL) { in fd_probe_drives()
1730 unit[drive].type = &drive_types[num_dr_types - 1]; /* FD_NODRIVE */ in fd_probe_drives()
1734 printk("fd%d ",drive); in fd_probe_drives()
1736 disk->first_minor = drive; in fd_probe_drives()
1738 sprintf(disk->disk_name, "fd%d", drive); in fd_probe_drives()
1739 disk->private_data = &unit[drive]; in fd_probe_drives()
1755 int drive = *part & 3; in floppy_find() local
1756 if (unit[drive].type->code == FD_NODRIVE) in floppy_find()
1759 return get_disk(unit[drive].gendisk); in floppy_find()