Lines Matching +full:i +full:- +full:drive
1 // SPDX-License-Identifier: GPL-2.0-only
9 * - now no bugs(?) any more for both HD & DD
10 * - added support for 40 Track 5.25" drives, 80-track hopefully behaves
11 * like 3.5" dd (no way to test - are there any 5.25" drives out there
13 * - wrote formatting routine (maybe dirty, but works)
15 * june/july 1995 added ms-dos support by Joerg Dorchain
17 * - currently only 9 and 18 sector disks
19 * - fixed a bug with the internal trackbuffer when using multiple
21 * - made formatting a bit safer
22 * - added command line and machine based default for "silent" df0
25 * - works but I think it's inefficient. (look in redo_fd_request)
29 * - usage ioctl(d, RAW_TRACK, ptr); the raw track buffer (MFM-encoded data
31 * done - 30K is currently sufficient). return the actual size of the
33 * - replaced udelays() by a timer (CIAA timer B) for the waits
37 * - both got broken the first time I tampered with the driver :-(
38 * - still not safe, but better than before
41 * - Minor changes to accept the kdev_t.
42 * - Replaced some more udelays with ms_delays. Udelay is just a loop,
44 * processor :-(
45 * - The driver could use a major cleanup because of the new
47 * the time being, but I can't guarantee that it will stay like
51 * - Fixed Bug accessing multiple disks
52 * - some code cleanup
53 * - added trackbuffer for each drive to speed things up
54 * - fixed some race conditions (who finds the next may send it to me ;-)
67 #include <linux/blk-mq.h>
102 #define DSKSEL3 (0x1<<6) /* select drive 3 when low */
103 #define DSKSEL2 (0x1<<5) /* select drive 2 when low */
104 #define DSKSEL1 (0x1<<4) /* select drive 1 when low */
105 #define DSKSEL0 (0x1<<3) /* select drive 0 when low */
118 /* bits 7-0 are data */
176 unsigned long code; /* code returned from drive */
177 char *name; /* description of drive */
193 int track; /* current track (-1 == unknown) */
199 int disk; /* disk in drive (-1 == unknown) */
201 int busy; /* true when drive is active */
212 #define FD_ERROR -1 /* general error (seek, read, write, etc) */
227 #define FD_DD_3 0xffffffff /* double-density 3.5" (880K) drive */
228 #define FD_HD_3 0x55555555 /* high-density 3.5" (1760K) drive */
229 #define FD_DD_5 0xaaaaaaaa /* double-density 5.25" (440K) drive */
245 #define SELMASK(drive) (1 << (3 + (drive & 3))) argument
253 { FD_NODRIVE, "No Drive", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
261 { "MS-Dos", 9, dos_read, dos_write}
276 static volatile int fdc_busy = -1;
282 static volatile int selected = -1; /* currently selected drive */
300 /* MS-Dos MFM Coding tables (should go quick and easy) */
313 * max X times - some types of errors increase the errorcount by 2 or
347 ticks = MS_TICKS*ms-1; in ms_delay()
350 ciaa.crb=0x19; /*count eclock, force load, one-shoot, start */ in ms_delay()
359 static inline int try_fdc(int drive) in try_fdc() argument
361 drive &= 3; in try_fdc()
362 return ((fdc_busy < 0) || (fdc_busy == drive)); in try_fdc()
365 static void get_fdc(int drive) in get_fdc() argument
369 drive &= 3; in get_fdc()
371 printk("get_fdc: drive %d fdc_busy %d fdc_nested %d\n",drive,fdc_busy,fdc_nested); in get_fdc()
374 wait_event(fdc_wait, try_fdc(drive)); in get_fdc()
375 fdc_busy = drive; in get_fdc()
387 fdc_nested--; in rel_fdc()
389 fdc_busy = -1; in rel_fdc()
394 static void fd_select (int drive) in fd_select() argument
398 drive&=3; in fd_select()
400 printk("selecting %d\n",drive); in fd_select()
402 if (drive == selected) in fd_select()
404 get_fdc(drive); in fd_select()
405 selected = drive; in fd_select()
407 if (unit[drive].track % 2 != 0) in fd_select()
409 if (unit[drive].motor == 1) in fd_select()
413 prb &= ~SELMASK(drive); in fd_select()
418 static void fd_deselect (int drive) in fd_deselect() argument
423 drive&=3; in fd_deselect()
425 printk("deselecting %d\n",drive); in fd_deselect()
427 if (drive != selected) { in fd_deselect()
428 printk(KERN_WARNING "Deselecting drive %d while %d was selected!\n",drive,selected); in fd_deselect()
432 get_fdc(drive); in fd_deselect()
435 selected = -1; in fd_deselect()
448 if (!(ciaa.pra & DSKRDY) || --on_attempts == 0) { in motor_on_callback()
475 on_attempts = -1; in fd_motor_on()
481 …printk (KERN_WARNING "DSKRDY not set after 1.5 seconds - assuming drive is spinning notwithstandin… in fd_motor_on()
490 unsigned long drive = ((unsigned long)timer - in fd_motor_off() local
494 drive&=3; in fd_motor_off()
495 if (!try_fdc(drive)) { in fd_motor_off()
497 timer->expires = jiffies + 1; in fd_motor_off()
501 unit[drive].motor = 0; in fd_motor_off()
502 fd_select(drive); in fd_motor_off()
504 fd_deselect(drive); in fd_motor_off()
509 int drive; in floppy_off() local
511 drive = nr & 3; in floppy_off()
512 mod_timer(motor_off_timer + drive, jiffies + 3*HZ); in floppy_off()
515 static int fd_calibrate(int drive) in fd_calibrate() argument
520 drive &= 3; in fd_calibrate()
521 get_fdc(drive); in fd_calibrate()
522 if (!fd_motor_on (drive)) in fd_calibrate()
524 fd_select (drive); in fd_calibrate()
529 for (n = unit[drive].type->tracks/2; n != 0; --n) { in fd_calibrate()
537 ms_delay(unit[drive].type->step_delay); in fd_calibrate()
539 ms_delay (unit[drive].type->settle_time); in fd_calibrate()
541 n = unit[drive].type->tracks + 20; in fd_calibrate()
548 ms_delay(unit[drive].type->step_delay + 1); in fd_calibrate()
551 if (--n == 0) { in fd_calibrate()
552 printk (KERN_ERR "fd%d: calibrate failed, turning motor off\n", drive); in fd_calibrate()
553 fd_motor_off (motor_off_timer + drive); in fd_calibrate()
554 unit[drive].track = -1; in fd_calibrate()
559 unit[drive].track = 0; in fd_calibrate()
560 ms_delay(unit[drive].type->settle_time); in fd_calibrate()
563 fd_deselect(drive); in fd_calibrate()
567 static int fd_seek(int drive, int track) in fd_seek() argument
573 printk("seeking drive %d to track %d\n",drive,track); in fd_seek()
575 drive &= 3; in fd_seek()
576 get_fdc(drive); in fd_seek()
577 if (unit[drive].track == track) { in fd_seek()
581 if (!fd_motor_on(drive)) { in fd_seek()
585 if (unit[drive].track < 0 && !fd_calibrate(drive)) { in fd_seek()
590 fd_select (drive); in fd_seek()
591 cnt = unit[drive].track/2 - track/2; in fd_seek()
597 cnt = - cnt; in fd_seek()
601 if (track % 2 != unit[drive].track % 2) in fd_seek()
602 ms_delay (unit[drive].type->side_time); in fd_seek()
603 unit[drive].track = track; in fd_seek()
606 fd_deselect(drive); in fd_seek()
615 ms_delay (unit[drive].type->step_delay); in fd_seek()
616 } while (--cnt != 0); in fd_seek()
617 ms_delay (unit[drive].type->settle_time); in fd_seek()
620 fd_deselect(drive); in fd_seek()
624 static unsigned long fd_get_drive_id(int drive) in fd_get_drive_id() argument
626 int i; in fd_get_drive_id() local
629 drive&=3; in fd_get_drive_id()
630 get_fdc(drive); in fd_get_drive_id()
634 SELECT(SELMASK(drive)); in fd_get_drive_id()
636 DESELECT(SELMASK(drive)); in fd_get_drive_id()
640 SELECT(SELMASK(drive)); in fd_get_drive_id()
642 DESELECT(SELMASK(drive)); in fd_get_drive_id()
646 for (i=0; i<32; i++) { in fd_get_drive_id()
647 SELECT(SELMASK(drive)); in fd_get_drive_id()
652 id |= (ciaa.pra & DSKRDY) ? 0 : 1; /* cia regs are low-active! */ in fd_get_drive_id()
654 DESELECT(SELMASK(drive)); in fd_get_drive_id()
661 * As every (real) Amiga has at least a 3.5" DD drive as df0: in fd_get_drive_id()
665 if(drive == 0 && id == FD_NODRIVE) in fd_get_drive_id()
668 … printk(KERN_NOTICE "fd: drive 0 didn't identify, setting default %08lx\n", (ulong)fd_def_df0); in fd_get_drive_id()
692 static void raw_read(int drive) in raw_read() argument
694 drive&=3; in raw_read()
695 get_fdc(drive); in raw_read()
697 fd_select(drive); in raw_read()
706 custom.dsklen = unit[drive].type->read_size/sizeof(short) | DSKLEN_DMAEN; in raw_read()
707 custom.dsklen = unit[drive].type->read_size/sizeof(short) | DSKLEN_DMAEN; in raw_read()
714 fd_deselect(drive); in raw_read()
718 static int raw_write(int drive) in raw_write() argument
722 drive&=3; in raw_write()
723 get_fdc(drive); /* corresponds to rel_fdc() in post_write() */ in raw_write()
729 fd_select(drive); in raw_write()
734 if ((ulong)unit[drive].track >= unit[drive].type->precomp2) in raw_write()
736 else if ((ulong)unit[drive].track >= unit[drive].type->precomp1) in raw_write()
742 custom.dsklen = unit[drive].type->write_size/sizeof(short) | DSKLEN_DMAEN|DSKLEN_WRITE; in raw_write()
743 custom.dsklen = unit[drive].type->write_size/sizeof(short) | DSKLEN_DMAEN|DSKLEN_WRITE; in raw_write()
753 static void post_write (unsigned long drive) in post_write() argument
756 printk("post_write for drive %ld\n",drive); in post_write()
758 drive &= 3; in post_write()
763 unit[drive].dirty = 0; in post_write()
765 fd_deselect(drive); in post_write()
777 * (Add other formats here ;-))
799 while (len-- > 0) in checksum()
821 } while (--len != 0); in decode()
836 static int amiga_read(int drive) in amiga_read() argument
844 drive&=3; in amiga_read()
846 end = raw + unit[drive].type->read_size; in amiga_read()
848 for (scnt = 0;scnt < unit[drive].dtype->sects * unit[drive].type->sect_mult; scnt++) { in amiga_read()
859 (char *)&hdr.hdrchk-(char *)&hdr); in amiga_read()
875 if (hdr.track != unit[drive].track) { in amiga_read()
876 printk(KERN_INFO "MFM_TRACK: %d, %d\n", hdr.track, unit[drive].track); in amiga_read()
880 raw = decode ((ulong *)(unit[drive].trackbuf + hdr.sect*512), in amiga_read()
882 csum = checksum((ulong *)(unit[drive].trackbuf + hdr.sect*512), 512); in amiga_read()
889 ((ulong *)(unit[drive].trackbuf+hdr.sect*512))[0], in amiga_read()
890 ((ulong *)(unit[drive].trackbuf+hdr.sect*512))[1], in amiga_read()
891 ((ulong *)(unit[drive].trackbuf+hdr.sect*512))[2], in amiga_read()
892 ((ulong *)(unit[drive].trackbuf+hdr.sect*512))[3]); in amiga_read()
908 if (*(dest - 1) & 0x00000001) in encode()
935 int i; in putsec() local
938 *raw = (raw[-1]&1) ? 0x2AAAAAAA : 0xAAAAAAAA; in putsec()
945 hdr.ord = unit[disk].dtype->sects * unit[disk].type->sect_mult - cnt; in putsec()
946 for (i = 0; i < 16; i++) in putsec()
947 hdr.labels[i] = 0; in putsec()
949 (char *)&hdr.hdrchk-(char *)&hdr); in putsec()
973 for (cnt = 0; cnt < 415 * unit[disk].type->sect_mult; cnt++) in amiga_write()
977 for (cnt = 0; cnt < unit[disk].dtype->sects * unit[disk].type->sect_mult; cnt++) in amiga_write()
979 *(ushort *)ptr = (ptr[-1]&1) ? 0x2AA8 : 0xAAA8; in amiga_write()
984 unsigned char track, /* 0-80 */
985 side, /* 0-1 */
986 sec, /* 0-...*/
992 unsigned char gap1[22]; /* for longword-alignedness (0x4e) */
995 /* crc routines are borrowed from the messydos-handler */
997 /* excerpt from the messydos-device
999 ; the SYNC mark (3 * $a1) and the 'ID/DATA - Address Mark' ($fe/$fb).
1007 ; polynomials. We calculate with these polynomials in modulo-2
1009 ; exclusive-or. Now, we modify our data (a very long polynomial) in
1010 ; such a way that it becomes divisible by the CCITT-standard 16-bit
1043 ; the data by $11021. I am afraid I need to study theory a bit more...
1090 /* look at the asm-code - what looks in C a bit strange is almost as good as handmade */ in dos_crc()
1091 register int i; in dos_crc() local
1099 for (i=data_d3; i>=0; i--) { in dos_crc()
1109 return dos_crc(&(hdr->track), 0xb2, 0x30, 3); /* precomputed magic */ in dos_hdr_crc()
1135 int i; in dos_decode() local
1137 for (i = 0; i < len; i++) in dos_decode()
1151 static int dos_read(int drive) in dos_read() argument
1159 drive&=3; in dos_read()
1161 end = raw + unit[drive].type->read_size; in dos_read()
1163 for (scnt=0; scnt < unit[drive].dtype->sects * unit[drive].type->sect_mult; scnt++) { in dos_read()
1164 do { /* search for the right sync of each sec-hdr */ in dos_read()
1168 unit[drive].track,drive,scnt); in dos_read()
1189 if (hdr.track != unit[drive].track/unit[drive].type->heads) { in dos_read()
1192 unit[drive].track/unit[drive].type->heads); in dos_read()
1196 if (hdr.side != unit[drive].track%unit[drive].type->heads) { in dos_read()
1199 unit[drive].track%unit[drive].type->heads); in dos_read()
1214 unit[drive].track, drive, scnt, hdr.sec); in dos_read()
1229 …raw = dos_decode((unsigned char *)(unit[drive].trackbuf + (hdr.sec - 1) * 512), (ushort *) raw, 51… in dos_read()
1231 crc = dos_data_crc(unit[drive].trackbuf + (hdr.sec - 1) * 512); in dos_read()
1238 ((ulong *)(unit[drive].trackbuf+(hdr.sec-1)*512))[0], in dos_read()
1239 ((ulong *)(unit[drive].trackbuf+(hdr.sec-1)*512))[1], in dos_read()
1240 ((ulong *)(unit[drive].trackbuf+(hdr.sec-1)*512))[2], in dos_read()
1241 ((ulong *)(unit[drive].trackbuf+(hdr.sec-1)*512))[3]); in dos_read()
1263 int i; in dos_encode_block() local
1265 for (i = 0; i < len; i++) { in dos_encode_block()
1267 *dest|=((dest[-1]&1)||(*dest&0x4000))? 0: 0x8000; in dos_encode_block()
1272 static unsigned long *ms_putsec(int drive, unsigned long *raw, int cnt) in ms_putsec() argument
1276 int i; in ms_putsec() local
1279 drive&=3; in ms_putsec()
1282 for(i=0;i<6;i++) in ms_putsec()
1289 hdr.track=unit[drive].track/unit[drive].type->heads; in ms_putsec()
1290 hdr.side=unit[drive].track%unit[drive].type->heads; in ms_putsec()
1299 for(i=0;i<6;i++) in ms_putsec()
1308 (unsigned char *)unit[drive].trackbuf+cnt*512,512); in ms_putsec()
1311 /*data crc + jd's special gap (long words :-/) */ in ms_putsec()
1312 crc[0]=dos_data_crc(unit[drive].trackbuf+cnt*512); in ms_putsec()
1317 for(i=0;i<38;i++) in ms_putsec()
1335 if (unit[disk].type->sect_mult==2) /* check for HD-Disks */ in dos_write()
1350 for(cnt = 0; cnt < unit[disk].dtype->sects * unit[disk].type->sect_mult; cnt++) in dos_write()
1357 * Here comes the high level stuff (i.e. the filesystem interface)
1363 /* FIXME: this assumes the drive is still spinning -
1368 unsigned long nr = ((unsigned long)timer - in flush_track_callback()
1381 (*unit[nr].dtype->write_fkt)(nr); in flush_track_callback()
1406 (*unit[nr].dtype->write_fkt)(nr); in non_int_flush_track()
1424 static int get_track(int drive, int track) in get_track() argument
1428 drive&=3; in get_track()
1429 if (unit[drive].track == track) in get_track()
1431 get_fdc(drive); in get_track()
1432 if (!fd_motor_on(drive)) { in get_track()
1434 return -1; in get_track()
1437 if (unit[drive].dirty == 1) { in get_track()
1438 del_timer (flush_track_timer + drive); in get_track()
1439 non_int_flush_track (drive); in get_track()
1443 if (!fd_seek(drive, track)) in get_track()
1444 return -1; in get_track()
1445 raw_read(drive); in get_track()
1446 error = (*unit[drive].dtype->read_fkt)(drive); in get_track()
1452 unit[drive].track = -1; in get_track()
1456 return -1; in get_track()
1462 int drive = floppy - unit; in amiflop_rw_cur_segment() local
1473 track = block / (floppy->dtype->sects * floppy->type->sect_mult); in amiflop_rw_cur_segment()
1474 sector = block % (floppy->dtype->sects * floppy->type->sect_mult); in amiflop_rw_cur_segment()
1475 data = bio_data(rq->bio) + 512 * cnt; in amiflop_rw_cur_segment()
1481 if (get_track(drive, track) == -1) in amiflop_rw_cur_segment()
1485 memcpy(data, floppy->trackbuf + sector * 512, 512); in amiflop_rw_cur_segment()
1487 memcpy(floppy->trackbuf + sector * 512, data, 512); in amiflop_rw_cur_segment()
1489 /* keep the drive spinning while writes are scheduled */ in amiflop_rw_cur_segment()
1490 if (!fd_motor_on(drive)) in amiflop_rw_cur_segment()
1496 floppy->dirty = 1; in amiflop_rw_cur_segment()
1498 mod_timer (flush_track_timer + drive, jiffies + 1); in amiflop_rw_cur_segment()
1508 struct request *rq = bd->rq; in amiflop_queue_rq()
1509 struct amiga_floppy_struct *floppy = rq->q->disk->private_data; in amiflop_queue_rq()
1528 int drive = MINOR(bdev->bd_dev) & 3; in fd_getgeo() local
1530 geo->heads = unit[drive].type->heads; in fd_getgeo()
1531 geo->sectors = unit[drive].dtype->sects * unit[drive].type->sect_mult; in fd_getgeo()
1532 geo->cylinders = unit[drive].type->tracks; in fd_getgeo()
1539 struct amiga_floppy_struct *p = bdev->bd_disk->private_data; in fd_locked_ioctl()
1540 int drive = p - unit; in fd_locked_ioctl() local
1546 get_fdc(drive); in fd_locked_ioctl()
1547 if (fd_ref[drive] > 1) { in fd_locked_ioctl()
1549 return -EBUSY; in fd_locked_ioctl()
1551 if (fd_motor_on(drive) == 0) { in fd_locked_ioctl()
1553 return -ENODEV; in fd_locked_ioctl()
1555 if (fd_calibrate(drive) == 0) { in fd_locked_ioctl()
1557 return -ENXIO; in fd_locked_ioctl()
1559 floppy_off(drive); in fd_locked_ioctl()
1563 if (param < p->type->tracks * p->type->heads) in fd_locked_ioctl()
1565 get_fdc(drive); in fd_locked_ioctl()
1566 if (fd_seek(drive,param) != 0){ in fd_locked_ioctl()
1567 memset(p->trackbuf, FD_FILL_BYTE, in fd_locked_ioctl()
1568 p->dtype->sects * p->type->sect_mult * 512); in fd_locked_ioctl()
1569 non_int_flush_track(drive); in fd_locked_ioctl()
1571 floppy_off(drive); in fd_locked_ioctl()
1575 return -EINVAL; in fd_locked_ioctl()
1578 floppy_off(drive); in fd_locked_ioctl()
1583 getprm.track=p->type->tracks; in fd_locked_ioctl()
1584 getprm.head=p->type->heads; in fd_locked_ioctl()
1585 getprm.sect=p->dtype->sects * p->type->sect_mult; in fd_locked_ioctl()
1586 getprm.size=p->blocks; in fd_locked_ioctl()
1588 return -EFAULT; in fd_locked_ioctl()
1592 return -EINVAL; in fd_locked_ioctl()
1594 del_timer (flush_track_timer + drive); in fd_locked_ioctl()
1595 non_int_flush_track(drive); in fd_locked_ioctl()
1599 if (copy_to_user(argp, raw_buf, p->type->read_size)) in fd_locked_ioctl()
1600 return -EFAULT; in fd_locked_ioctl()
1602 return p->type->read_size; in fd_locked_ioctl()
1605 return -ENOSYS; in fd_locked_ioctl()
1626 int drive; in fd_probe() local
1628 drive = dev & 3; in fd_probe()
1629 code = fd_get_drive_id(drive); in fd_probe()
1631 /* get drive type */ in fd_probe()
1637 printk(KERN_WARNING "fd_probe: unsupported drive type " in fd_probe()
1639 unit[drive].type = &drive_types[num_dr_types-1]; /* FD_NODRIVE */ in fd_probe()
1643 unit[drive].type = drive_types + type; in fd_probe()
1644 unit[drive].track = -1; in fd_probe()
1646 unit[drive].disk = -1; in fd_probe()
1647 unit[drive].motor = 0; in fd_probe()
1648 unit[drive].busy = 0; in fd_probe()
1649 unit[drive].status = -1; in fd_probe()
1655 * drive with different device numbers.
1659 int drive = disk->first_minor & 3; in floppy_open() local
1660 int system = (disk->first_minor & 4) >> 2; in floppy_open()
1665 old_dev = fd_device[drive]; in floppy_open()
1667 if (fd_ref[drive] && old_dev != system) { in floppy_open()
1669 return -EBUSY; in floppy_open()
1672 if (unit[drive].type->code == FD_NODRIVE) { in floppy_open()
1674 return -ENXIO; in floppy_open()
1681 get_fdc(drive); in floppy_open()
1682 fd_select (drive); in floppy_open()
1684 fd_deselect (drive); in floppy_open()
1689 return -EROFS; in floppy_open()
1694 fd_ref[drive]++; in floppy_open()
1695 fd_device[drive] = system; in floppy_open()
1698 unit[drive].dtype=&data_types[system]; in floppy_open()
1699 unit[drive].blocks=unit[drive].type->heads*unit[drive].type->tracks* in floppy_open()
1700 data_types[system].sects*unit[drive].type->sect_mult; in floppy_open()
1701 set_capacity(unit[drive].gendisk[system], unit[drive].blocks); in floppy_open()
1703 printk(KERN_INFO "fd%d: accessing %s-disk with %s-layout\n",drive, in floppy_open()
1704 unit[drive].type->name, data_types[system].name); in floppy_open()
1712 struct amiga_floppy_struct *p = disk->private_data; in floppy_release()
1713 int drive = p - unit; in floppy_release() local
1716 if (unit[drive].dirty == 1) { in floppy_release()
1717 del_timer (flush_track_timer + drive); in floppy_release()
1718 non_int_flush_track (drive); in floppy_release()
1721 if (!fd_ref[drive]--) { in floppy_release()
1723 fd_ref[drive] = 0; in floppy_release()
1726 floppy_off (drive); in floppy_release()
1733 * here, sleep etc. Note that floppy-on tries to set current_DOR to point
1734 * to the desired drive, but it will probably not survive the sleep if
1739 struct amiga_floppy_struct *p = disk->private_data; in amiga_check_events()
1740 int drive = p - unit; in amiga_check_events() local
1745 changed = first_time--; in amiga_check_events()
1747 get_fdc(drive); in amiga_check_events()
1748 fd_select (drive); in amiga_check_events()
1750 fd_deselect (drive); in amiga_check_events()
1755 fd_probe(drive); in amiga_check_events()
1756 p->track = -1; in amiga_check_events()
1757 p->dirty = 0; in amiga_check_events()
1778 static int fd_alloc_disk(int drive, int system) in fd_alloc_disk() argument
1786 disk = blk_mq_alloc_disk(&unit[drive].tag_set, &lim, NULL); in fd_alloc_disk()
1790 disk->major = FLOPPY_MAJOR; in fd_alloc_disk()
1791 disk->first_minor = drive + system; in fd_alloc_disk()
1792 disk->minors = 1; in fd_alloc_disk()
1793 disk->fops = &floppy_fops; in fd_alloc_disk()
1794 disk->flags |= GENHD_FL_NO_PART; in fd_alloc_disk()
1795 disk->events = DISK_EVENT_MEDIA_CHANGE; in fd_alloc_disk()
1797 sprintf(disk->disk_name, "fd%d_msdos", drive); in fd_alloc_disk()
1799 sprintf(disk->disk_name, "fd%d", drive); in fd_alloc_disk()
1800 disk->private_data = &unit[drive]; in fd_alloc_disk()
1803 unit[drive].gendisk[system] = disk; in fd_alloc_disk()
1810 static int fd_alloc_drive(int drive) in fd_alloc_drive() argument
1812 unit[drive].trackbuf = kmalloc(FLOPPY_MAX_SECTORS * 512, GFP_KERNEL); in fd_alloc_drive()
1813 if (!unit[drive].trackbuf) in fd_alloc_drive()
1816 memset(&unit[drive].tag_set, 0, sizeof(unit[drive].tag_set)); in fd_alloc_drive()
1817 unit[drive].tag_set.ops = &amiflop_mq_ops; in fd_alloc_drive()
1818 unit[drive].tag_set.nr_hw_queues = 1; in fd_alloc_drive()
1819 unit[drive].tag_set.nr_maps = 1; in fd_alloc_drive()
1820 unit[drive].tag_set.queue_depth = 2; in fd_alloc_drive()
1821 unit[drive].tag_set.numa_node = NUMA_NO_NODE; in fd_alloc_drive()
1822 unit[drive].tag_set.flags = BLK_MQ_F_SHOULD_MERGE; in fd_alloc_drive()
1823 if (blk_mq_alloc_tag_set(&unit[drive].tag_set)) in fd_alloc_drive()
1826 pr_cont(" fd%d", drive); in fd_alloc_drive()
1828 if (fd_alloc_disk(drive, 0) || fd_alloc_disk(drive, 1)) in fd_alloc_drive()
1833 blk_mq_free_tag_set(&unit[drive].tag_set); in fd_alloc_drive()
1835 kfree(unit[drive].trackbuf); in fd_alloc_drive()
1837 unit[drive].type->code = FD_NODRIVE; in fd_alloc_drive()
1838 return -ENOMEM; in fd_alloc_drive()
1843 int drive,drives,nomem; in fd_probe_drives() local
1848 for(drive=0;drive<FD_MAX_UNITS;drive++) { in fd_probe_drives()
1849 fd_probe(drive); in fd_probe_drives()
1850 if (unit[drive].type->code == FD_NODRIVE) in fd_probe_drives()
1853 if (fd_alloc_drive(drive) < 0) { in fd_probe_drives()
1854 pr_cont(" no mem for fd%d", drive); in fd_probe_drives()
1867 return -ENOMEM; in fd_probe_drives()
1872 int i, ret; in amiga_floppy_probe() local
1875 return -EBUSY; in amiga_floppy_probe()
1877 ret = -ENOMEM; in amiga_floppy_probe()
1884 ret = -EBUSY; in amiga_floppy_probe()
1895 ret = -ENODEV; in amiga_floppy_probe()
1902 for (i = 0; i < FD_MAX_UNITS; i++) { in amiga_floppy_probe()
1903 timer_setup(&motor_off_timer[i], fd_motor_off, 0); in amiga_floppy_probe()
1904 motor_off_timer[i].expires = 0; in amiga_floppy_probe()
1905 timer_setup(&flush_track_timer[i], flush_track_callback, 0); in amiga_floppy_probe()
1906 flush_track_timer[i].expires = 0; in amiga_floppy_probe()
1908 unit[i].track = -1; in amiga_floppy_probe()
1914 for (i = 0; i < 128; i++) in amiga_floppy_probe()
1915 mfmdecode[i]=255; in amiga_floppy_probe()
1916 for (i = 0; i < 16; i++) in amiga_floppy_probe()
1917 mfmdecode[mfmencode[i]]=i; in amiga_floppy_probe()
1923 ciaa.crb = 8; /* one-shot, stop */ in amiga_floppy_probe()
1939 .name = "amiga-floppy",
1966 MODULE_ALIAS("platform:amiga-floppy");