Lines Matching refs:drive

308 #define UDP	(&drive_params[drive])
309 #define UDRS (&drive_state[drive])
310 #define UDRWE (&write_errors[drive])
311 #define UFDCS (&fdc_state[FDC(drive)])
601 static inline bool drive_no_geom(int drive) in drive_no_geom() argument
603 return !current_type[drive] && !ITYPE(UDRS->fd_device); in drive_no_geom()
607 static inline int fd_eject(int drive) in fd_eject() argument
669 static void __reschedule_timeout(int drive, const char *message) in __reschedule_timeout() argument
673 if (drive == current_reqD) in __reschedule_timeout()
674 drive = current_drive; in __reschedule_timeout()
676 if (drive < 0 || drive >= N_DRIVE) { in __reschedule_timeout()
678 drive = 0; in __reschedule_timeout()
688 static void reschedule_timeout(int drive, const char *message) in reschedule_timeout() argument
693 __reschedule_timeout(drive, message); in reschedule_timeout()
733 static int disk_change(int drive) in disk_change() argument
735 int fdc = FDC(drive); in disk_change()
739 if (!(FDCS->dor & (0x10 << UNIT(drive))) || in disk_change()
740 (FDCS->dor & 3) != UNIT(drive) || fdc != FDC(drive)) { in disk_change()
742 DPRINT("drive=%d fdc=%d dor=%x\n", drive, FDC(drive), in disk_change()
747 "checking disk change line for drive %d\n", drive); in disk_change()
764 current_type[drive] != NULL) in disk_change()
766 current_type[drive] = NULL; in disk_change()
767 floppy_sizes[TOMINOR(drive)] = MAX_DISK_SIZE << 1; in disk_change()
792 unsigned char drive; in set_dor() local
804 drive = REVDRIVE(fdc, unit); in set_dor()
807 disk_change(drive); in set_dor()
814 drive = REVDRIVE(fdc, unit); in set_dor()
836 int drive; in reset_fdc_info() local
842 for (drive = 0; drive < N_DRIVE; drive++) in reset_fdc_info()
843 if (FDC(drive) == fdc && (mode || UDRS->track != NEED_1_RECAL)) in reset_fdc_info()
848 static void set_fdc(int drive) in set_fdc() argument
850 if (drive >= 0 && drive < N_DRIVE) { in set_fdc()
851 fdc = FDC(drive); in set_fdc()
852 current_drive = drive; in set_fdc()
869 static int lock_fdc(int drive, bool interruptible) in lock_fdc() argument
880 reschedule_timeout(drive, "lock fdc"); in lock_fdc()
881 set_fdc(drive); in lock_fdc()
909 static void floppy_off(unsigned int drive) in floppy_off() argument
912 int fdc = FDC(drive); in floppy_off()
914 if (!(FDCS->dor & (0x10 << UNIT(drive)))) in floppy_off()
917 del_timer(motor_off_timer + drive); in floppy_off()
925 motor_off_timer[drive].expires = in floppy_off()
928 add_timer(motor_off_timer + drive); in floppy_off()
939 int drive; in scandrives() local
947 drive = (saved_drive + i + 1) % N_DRIVE; in scandrives()
950 set_fdc(drive); in scandrives()
951 if (!(set_dor(fdc, ~3, UNIT(drive) | (0x10 << UNIT(drive))) & in scandrives()
952 (0x10 << UNIT(drive)))) in scandrives()
955 set_dor(fdc, ~(0x10 << UNIT(drive)), 0); in scandrives()
2058 static void set_floppy(int drive) in set_floppy() argument
2065 _floppy = current_type[drive]; in set_floppy()
2172 static int do_format(int drive, struct format_descr *tmp_format_req) in do_format() argument
2176 if (lock_fdc(drive, true)) in do_format()
2179 set_floppy(drive); in do_format()
2208 unsigned int drive = (unsigned long)req->rq_disk->private_data; in floppy_end_request() local
2217 floppy_off(drive); in floppy_end_request()
2818 int drive; in redo_fd_request() local
2838 drive = (long)current_req->rq_disk->private_data; in redo_fd_request()
2839 set_fdc(drive); in redo_fd_request()
2842 set_floppy(drive); in redo_fd_request()
2959 static int user_reset_fdc(int drive, int arg, bool interruptible) in user_reset_fdc() argument
2963 if (lock_fdc(drive, interruptible)) in user_reset_fdc()
2994 static const char *drive_name(int type, int drive) in drive_name() argument
3175 int drive; in raw_cmd_ioctl() local
3181 for (drive = 0; drive < N_DRIVE; drive++) { in raw_cmd_ioctl()
3182 if (FDC(drive) != fdc) in raw_cmd_ioctl()
3184 if (drive == current_drive) { in raw_cmd_ioctl()
3231 int drive, int type, struct block_device *bdev) in set_geometry() argument
3246 if (lock_fdc(drive, true)) { in set_geometry()
3266 if (lock_fdc(drive, true)) in set_geometry()
3275 user_params[drive] = *g; in set_geometry()
3276 if (buffer_drive == drive) in set_geometry()
3277 SUPBOUND(buffer_max, user_params[drive].sect); in set_geometry()
3278 current_type[drive] = &user_params[drive]; in set_geometry()
3279 floppy_sizes[drive] = user_params[drive].size; in set_geometry()
3289 if (DRS->maxblock > user_params[drive].sect || in set_geometry()
3291 ((user_params[drive].sect ^ oldStretch) & in set_geometry()
3347 static int get_floppy_geometry(int drive, int type, struct floppy_struct **g) in get_floppy_geometry() argument
3352 if (lock_fdc(drive, false)) in get_floppy_geometry()
3357 *g = current_type[drive]; in get_floppy_geometry()
3366 int drive = (long)bdev->bd_disk->private_data; in fd_getgeo() local
3367 int type = ITYPE(drive_state[drive].fd_device); in fd_getgeo()
3371 ret = get_floppy_geometry(drive, type, &g); in fd_getgeo()
3384 int drive = (long)bdev->bd_disk->private_data; in fd_locked_ioctl() local
3436 if (lock_fdc(drive, true)) in fd_locked_ioctl()
3441 ret = fd_eject(UNIT(drive)); in fd_locked_ioctl()
3448 if (lock_fdc(drive, true)) in fd_locked_ioctl()
3450 current_type[drive] = NULL; in fd_locked_ioctl()
3451 floppy_sizes[drive] = MAX_DISK_SIZE << 1; in fd_locked_ioctl()
3456 return set_geometry(cmd, &inparam.g, drive, type, bdev); in fd_locked_ioctl()
3458 ret = get_floppy_geometry(drive, type, in fd_locked_ioctl()
3470 if (lock_fdc(drive, true)) in fd_locked_ioctl()
3484 return do_format(drive, &inparam.f); in fd_locked_ioctl()
3487 if (lock_fdc(drive, true)) in fd_locked_ioctl()
3500 outparam = drive_name(type, drive); in fd_locked_ioctl()
3510 if (lock_fdc(drive, true)) in fd_locked_ioctl()
3520 return user_reset_fdc(drive, (int)param, true); in fd_locked_ioctl()
3533 if (lock_fdc(drive, true)) in fd_locked_ioctl()
3535 set_floppy(drive); in fd_locked_ioctl()
3542 if (lock_fdc(drive, true)) in fd_locked_ioctl()
3572 int drive; in config_types() local
3575 drive = 0; in config_types()
3578 drive = 1; in config_types()
3584 for (drive = 0; drive < N_DRIVE; drive++) { in config_types()
3594 allowed_drive_mask |= 1 << drive; in config_types()
3596 allowed_drive_mask &= ~(1 << drive); in config_types()
3612 pr_cont("%s fd%d is %s", prepend, drive, name); in config_types()
3623 int drive = (long)disk->private_data; in floppy_release() local
3632 opened_bdev[drive] = NULL; in floppy_release()
3644 int drive = (long)bdev->bd_disk->private_data; in floppy_open() local
3653 if (opened_bdev[drive] && opened_bdev[drive] != bdev) in floppy_open()
3663 opened_bdev[drive] = bdev; in floppy_open()
3699 set_capacity(disks[drive], floppy_sizes[new_dev]); in floppy_open()
3701 if (buffer_drive == drive) in floppy_open()
3730 opened_bdev[drive] = NULL; in floppy_open()
3743 int drive = (long)disk->private_data; in floppy_check_events() local
3750 lock_fdc(drive, false); in floppy_check_events()
3757 test_bit(drive, &fake_change) || in floppy_check_events()
3758 drive_no_geom(drive)) in floppy_check_events()
3770 int drive; member
3777 int drive = cbdata->drive; in floppy_rb0_cb() local
3786 static int __floppy_read_block_0(struct block_device *bdev, int drive) in __floppy_read_block_0() argument
3804 cbdata.drive = drive; in __floppy_read_block_0()
3836 int drive = (long)disk->private_data; in floppy_revalidate() local
3842 test_bit(drive, &fake_change) || in floppy_revalidate()
3843 drive_no_geom(drive)) { in floppy_revalidate()
3848 lock_fdc(drive, false); in floppy_revalidate()
3851 if (!(cf || test_bit(drive, &fake_change) || drive_no_geom(drive))) { in floppy_revalidate()
3857 if (buffer_drive == drive) in floppy_revalidate()
3859 clear_bit(drive, &fake_change); in floppy_revalidate()
3863 if (drive_no_geom(drive)) { in floppy_revalidate()
3865 res = __floppy_read_block_0(opened_bdev[drive], drive); in floppy_revalidate()
4107 int drive; in floppy_cmos_show() local
4109 drive = p->id; in floppy_cmos_show()
4151 static bool floppy_available(int drive) in floppy_available() argument
4153 if (!(allowed_drive_mask & (1 << drive))) in floppy_available()
4155 if (fdc_state[FDC(drive)].version == FDC_NONE) in floppy_available()
4162 int drive = (*part & 3) | ((*part & 0x80) >> 5); in floppy_find() local
4163 if (drive >= N_DRIVE || !floppy_available(drive)) in floppy_find()
4168 return get_disk(disks[drive]); in floppy_find()
4173 int i, unit, drive, err; in do_floppy_init() local
4189 for (drive = 0; drive < N_DRIVE; drive++) { in do_floppy_init()
4190 disks[drive] = alloc_disk(1); in do_floppy_init()
4191 if (!disks[drive]) { in do_floppy_init()
4196 disks[drive]->queue = blk_init_queue(do_fd_request, &floppy_lock); in do_floppy_init()
4197 if (!disks[drive]->queue) { in do_floppy_init()
4202 blk_queue_max_hw_sectors(disks[drive]->queue, 64); in do_floppy_init()
4203 disks[drive]->major = FLOPPY_MAJOR; in do_floppy_init()
4204 disks[drive]->first_minor = TOMINOR(drive); in do_floppy_init()
4205 disks[drive]->fops = &floppy_fops; in do_floppy_init()
4206 sprintf(disks[drive]->disk_name, "fd%d", drive); in do_floppy_init()
4208 init_timer(&motor_off_timer[drive]); in do_floppy_init()
4209 motor_off_timer[drive].data = drive; in do_floppy_init()
4210 motor_off_timer[drive].function = motor_off_callback; in do_floppy_init()
4267 for (drive = 0; drive < N_DRIVE; drive++) { in do_floppy_init()
4327 for (drive = 0; drive < N_DRIVE; drive++) { in do_floppy_init()
4328 if (!floppy_available(drive)) in do_floppy_init()
4331 floppy_device[drive].name = floppy_device_name; in do_floppy_init()
4332 floppy_device[drive].id = drive; in do_floppy_init()
4333 floppy_device[drive].dev.release = floppy_device_release; in do_floppy_init()
4334 floppy_device[drive].dev.groups = floppy_dev_groups; in do_floppy_init()
4336 err = platform_device_register(&floppy_device[drive]); in do_floppy_init()
4341 disks[drive]->private_data = (void *)(long)drive; in do_floppy_init()
4342 disks[drive]->flags |= GENHD_FL_REMOVABLE; in do_floppy_init()
4343 disks[drive]->driverfs_dev = &floppy_device[drive].dev; in do_floppy_init()
4344 add_disk(disks[drive]); in do_floppy_init()
4350 while (drive--) { in do_floppy_init()
4351 if (floppy_available(drive)) { in do_floppy_init()
4352 del_gendisk(disks[drive]); in do_floppy_init()
4353 platform_device_unregister(&floppy_device[drive]); in do_floppy_init()
4366 for (drive = 0; drive < N_DRIVE; drive++) { in do_floppy_init()
4367 if (!disks[drive]) in do_floppy_init()
4369 if (disks[drive]->queue) { in do_floppy_init()
4370 del_timer_sync(&motor_off_timer[drive]); in do_floppy_init()
4371 blk_cleanup_queue(disks[drive]->queue); in do_floppy_init()
4372 disks[drive]->queue = NULL; in do_floppy_init()
4374 put_disk(disks[drive]); in do_floppy_init()
4507 int drive; in floppy_release_irq_and_dma() local
4535 for (drive = 0; drive < N_FDC * 4; drive++) in floppy_release_irq_and_dma()
4536 if (timer_pending(motor_off_timer + drive)) in floppy_release_irq_and_dma()
4537 pr_info("motor off timer %d still active\n", drive); in floppy_release_irq_and_dma()
4584 int drive; in floppy_module_exit() local
4592 for (drive = 0; drive < N_DRIVE; drive++) { in floppy_module_exit()
4593 del_timer_sync(&motor_off_timer[drive]); in floppy_module_exit()
4595 if (floppy_available(drive)) { in floppy_module_exit()
4596 del_gendisk(disks[drive]); in floppy_module_exit()
4597 platform_device_unregister(&floppy_device[drive]); in floppy_module_exit()
4599 blk_cleanup_queue(disks[drive]->queue); in floppy_module_exit()
4605 if (!(allowed_drive_mask & (1 << drive)) || in floppy_module_exit()
4606 fdc_state[FDC(drive)].version == FDC_NONE) in floppy_module_exit()
4607 disks[drive]->queue = NULL; in floppy_module_exit()
4609 put_disk(disks[drive]); in floppy_module_exit()