• Home
  • Raw
  • Download

Lines Matching full:drive

58  * The following delay solves a problem with ATAPI Zip 100 drive where BSY bit
63 static int ide_floppy_callback(ide_drive_t *drive, int dsc) in ide_floppy_callback() argument
65 struct ide_disk_obj *floppy = drive->driver_data; in ide_floppy_callback()
66 struct ide_atapi_pc *pc = drive->pc; in ide_floppy_callback()
72 if (drive->failed_pc == pc) in ide_floppy_callback()
73 drive->failed_pc = NULL; in ide_floppy_callback()
89 if (drive->failed_pc) in ide_floppy_callback()
91 drive->failed_pc->c[0]); in ide_floppy_callback()
118 floppy->drive->name, pc->c[0], floppy->sense_key, in ide_floppy_report_error()
123 static ide_startstop_t ide_floppy_issue_pc(ide_drive_t *drive, in ide_floppy_issue_pc() argument
127 struct ide_disk_obj *floppy = drive->driver_data; in ide_floppy_issue_pc()
129 if (drive->failed_pc == NULL && in ide_floppy_issue_pc()
131 drive->failed_pc = pc; in ide_floppy_issue_pc()
134 drive->pc = pc; in ide_floppy_issue_pc()
137 unsigned int done = blk_rq_bytes(drive->hwif->rq); in ide_floppy_issue_pc()
145 drive->failed_pc = NULL; in ide_floppy_issue_pc()
146 drive->pc_callback(drive, 0); in ide_floppy_issue_pc()
147 ide_complete_rq(drive, BLK_STS_IOERR, done); in ide_floppy_issue_pc()
155 return ide_issue_pc(drive, cmd); in ide_floppy_issue_pc()
191 static void idefloppy_create_rw_cmd(ide_drive_t *drive, in idefloppy_create_rw_cmd() argument
195 struct ide_disk_obj *floppy = drive->driver_data; in idefloppy_create_rw_cmd()
229 static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, in ide_floppy_do_request() argument
232 struct ide_disk_obj *floppy = drive->driver_data; in ide_floppy_do_request()
238 if (drive->debug_mask & IDE_DBG_RQ) in ide_floppy_do_request()
244 if (drive->failed_pc) { in ide_floppy_do_request()
245 ide_floppy_report_error(floppy, drive->failed_pc); in ide_floppy_do_request()
246 drive->failed_pc = NULL; in ide_floppy_do_request()
248 printk(KERN_ERR PFX "%s: I/O error\n", drive->name); in ide_floppy_do_request()
252 ide_complete_rq(drive, BLK_STS_OK, blk_rq_bytes(rq)); in ide_floppy_do_request()
263 drive->name); in ide_floppy_do_request()
267 idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block); in ide_floppy_do_request()
286 ide_prep_sense(drive, rq); in ide_floppy_do_request()
297 ide_map_sg(drive, &cmd); in ide_floppy_do_request()
302 return ide_floppy_issue_pc(drive, &cmd, pc); in ide_floppy_do_request()
304 drive->failed_pc = NULL; in ide_floppy_do_request()
307 ide_complete_rq(drive, BLK_STS_IOERR, blk_rq_bytes(rq)); in ide_floppy_do_request()
315 static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive, in ide_floppy_get_flexible_disk_page() argument
318 struct ide_disk_obj *floppy = drive->driver_data; in ide_floppy_get_flexible_disk_page()
327 if (ide_queue_pc_tail(drive, disk, pc, buf, pc->req_xfer)) { in ide_floppy_get_flexible_disk_page()
333 drive->dev_flags |= IDE_DFLAG_WP; in ide_floppy_get_flexible_disk_page()
335 drive->dev_flags &= ~IDE_DFLAG_WP; in ide_floppy_get_flexible_disk_page()
337 set_disk_ro(disk, !!(drive->dev_flags & IDE_DFLAG_WP)); in ide_floppy_get_flexible_disk_page()
353 drive->name, capacity / 1024, cyls, heads, in ide_floppy_get_flexible_disk_page()
357 drive->bios_cyl = cyls; in ide_floppy_get_flexible_disk_page()
358 drive->bios_head = heads; in ide_floppy_get_flexible_disk_page()
359 drive->bios_sect = sectors; in ide_floppy_get_flexible_disk_page()
364 "bytes, but the drive only handles %d\n", in ide_floppy_get_flexible_disk_page()
365 drive->name, lba_capacity, capacity); in ide_floppy_get_flexible_disk_page()
368 drive->capacity64 = floppy->blocks * floppy->bs_factor; in ide_floppy_get_flexible_disk_page()
375 * Determine if a media is present in the floppy drive, and if so, its LBA
378 static int ide_floppy_get_capacity(ide_drive_t *drive) in ide_floppy_get_capacity() argument
380 struct ide_disk_obj *floppy = drive->driver_data; in ide_floppy_get_capacity()
389 drive->bios_cyl = 0; in ide_floppy_get_capacity()
390 drive->bios_head = drive->bios_sect = 0; in ide_floppy_get_capacity()
393 drive->capacity64 = 0; in ide_floppy_get_capacity()
396 if (ide_queue_pc_tail(drive, disk, &pc, pc_buf, pc.req_xfer)) { in ide_floppy_get_capacity()
422 /* Clik! drive returns this instead of CAPACITY_CURRENT */ in ide_floppy_get_capacity()
424 if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE)) in ide_floppy_get_capacity()
426 * If it is not a clik drive, break out in ide_floppy_get_capacity()
436 drive->name, blocks * length / 1024, in ide_floppy_get_capacity()
442 " not supported\n", drive->name, length); in ide_floppy_get_capacity()
451 drive->name); in ide_floppy_get_capacity()
452 drive->capacity64 = in ide_floppy_get_capacity()
462 printk(KERN_ERR PFX "%s: No disk in drive\n", in ide_floppy_get_capacity()
463 drive->name); in ide_floppy_get_capacity()
467 "in drive\n", drive->name); in ide_floppy_get_capacity()
475 if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE)) in ide_floppy_get_capacity()
476 (void) ide_floppy_get_flexible_disk_page(drive, &pc); in ide_floppy_get_capacity()
481 static void ide_floppy_setup(ide_drive_t *drive) in ide_floppy_setup() argument
483 struct ide_disk_obj *floppy = drive->driver_data; in ide_floppy_setup()
484 u16 *id = drive->id; in ide_floppy_setup()
486 drive->pc_callback = ide_floppy_callback; in ide_floppy_setup()
498 drive->atapi_flags |= IDE_AFLAG_ZIP_DRIVE; in ide_floppy_setup()
500 drive->pc_delay = IDEFLOPPY_PC_DELAY; in ide_floppy_setup()
501 blk_queue_max_hw_sectors(drive->queue, 64); in ide_floppy_setup()
505 * Guess what? The IOMEGA Clik! drive also needs the above fix. It makes in ide_floppy_setup()
509 blk_queue_max_hw_sectors(drive->queue, 64); in ide_floppy_setup()
510 drive->atapi_flags |= IDE_AFLAG_CLIK_DRIVE; in ide_floppy_setup()
512 drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING; in ide_floppy_setup()
515 (void) ide_floppy_get_capacity(drive); in ide_floppy_setup()
517 ide_proc_register_driver(drive, floppy->driver); in ide_floppy_setup()
519 drive->dev_flags |= IDE_DFLAG_ATTACH; in ide_floppy_setup()
522 static void ide_floppy_flush(ide_drive_t *drive) in ide_floppy_flush() argument
526 static int ide_floppy_init_media(ide_drive_t *drive, struct gendisk *disk) in ide_floppy_init_media() argument
530 if (ide_do_test_unit_ready(drive, disk)) in ide_floppy_init_media()
531 ide_do_start_stop(drive, disk, 1); in ide_floppy_init_media()
533 ret = ide_floppy_get_capacity(drive); in ide_floppy_init_media()
535 set_capacity(disk, ide_gd_capacity(drive)); in ide_floppy_init_media()