Lines Matching refs:drive

59  * The following delay solves a problem with ATAPI Zip 100 drive where BSY bit
64 static int ide_floppy_callback(ide_drive_t *drive, int dsc)
66 struct ide_disk_obj *floppy = drive->driver_data;
67 struct ide_atapi_pc *pc = drive->pc;
73 if (drive->failed_pc == pc)
74 drive->failed_pc = NULL;
90 if (drive->failed_pc)
92 drive->failed_pc->c[0]);
119 floppy->drive->name, pc->c[0], floppy->sense_key,
124 static ide_startstop_t ide_floppy_issue_pc(ide_drive_t *drive,
128 struct ide_disk_obj *floppy = drive->driver_data;
130 if (drive->failed_pc == NULL &&
132 drive->failed_pc = pc;
135 drive->pc = pc;
138 unsigned int done = blk_rq_bytes(drive->hwif->rq);
146 drive->failed_pc = NULL;
147 drive->pc_callback(drive, 0);
148 ide_complete_rq(drive, BLK_STS_IOERR, done);
156 return ide_issue_pc(drive, cmd);
192 static void idefloppy_create_rw_cmd(ide_drive_t *drive,
196 struct ide_disk_obj *floppy = drive->driver_data;
230 static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
233 struct ide_disk_obj *floppy = drive->driver_data;
239 if (drive->debug_mask & IDE_DBG_RQ)
245 if (drive->failed_pc) {
246 ide_floppy_report_error(floppy, drive->failed_pc);
247 drive->failed_pc = NULL;
249 printk(KERN_ERR PFX "%s: I/O error\n", drive->name);
253 ide_complete_rq(drive, BLK_STS_OK, blk_rq_bytes(rq));
264 drive->name);
268 idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block);
287 ide_prep_sense(drive, rq);
298 ide_map_sg(drive, &cmd);
303 return ide_floppy_issue_pc(drive, &cmd, pc);
305 drive->failed_pc = NULL;
308 ide_complete_rq(drive, BLK_STS_IOERR, blk_rq_bytes(rq));
316 static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive,
319 struct ide_disk_obj *floppy = drive->driver_data;
328 if (ide_queue_pc_tail(drive, disk, pc, buf, pc->req_xfer)) {
334 drive->dev_flags |= IDE_DFLAG_WP;
336 drive->dev_flags &= ~IDE_DFLAG_WP;
338 set_disk_ro(disk, !!(drive->dev_flags & IDE_DFLAG_WP));
354 drive->name, capacity / 1024, cyls, heads,
358 drive->bios_cyl = cyls;
359 drive->bios_head = heads;
360 drive->bios_sect = sectors;
365 "bytes, but the drive only handles %d\n",
366 drive->name, lba_capacity, capacity);
369 drive->capacity64 = floppy->blocks * floppy->bs_factor;
376 * Determine if a media is present in the floppy drive, and if so, its LBA
379 static int ide_floppy_get_capacity(ide_drive_t *drive)
381 struct ide_disk_obj *floppy = drive->driver_data;
390 drive->bios_cyl = 0;
391 drive->bios_head = drive->bios_sect = 0;
394 drive->capacity64 = 0;
397 if (ide_queue_pc_tail(drive, disk, &pc, pc_buf, pc.req_xfer)) {
423 /* Clik! drive returns this instead of CAPACITY_CURRENT */
425 if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE))
427 * If it is not a clik drive, break out
437 drive->name, blocks * length / 1024,
443 " not supported\n", drive->name, length);
452 drive->name);
453 drive->capacity64 =
463 printk(KERN_ERR PFX "%s: No disk in drive\n",
464 drive->name);
468 "in drive\n", drive->name);
476 if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE))
477 (void) ide_floppy_get_flexible_disk_page(drive, &pc);
482 static void ide_floppy_setup(ide_drive_t *drive)
484 struct ide_disk_obj *floppy = drive->driver_data;
485 u16 *id = drive->id;
487 drive->pc_callback = ide_floppy_callback;
499 drive->atapi_flags |= IDE_AFLAG_ZIP_DRIVE;
501 drive->pc_delay = IDEFLOPPY_PC_DELAY;
502 blk_queue_max_hw_sectors(drive->queue, 64);
506 * Guess what? The IOMEGA Clik! drive also needs the above fix. It makes
510 blk_queue_max_hw_sectors(drive->queue, 64);
511 drive->atapi_flags |= IDE_AFLAG_CLIK_DRIVE;
513 drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING;
516 (void) ide_floppy_get_capacity(drive);
518 ide_proc_register_driver(drive, floppy->driver);
521 static void ide_floppy_flush(ide_drive_t *drive)
525 static int ide_floppy_init_media(ide_drive_t *drive, struct gendisk *disk)
529 if (ide_do_test_unit_ready(drive, disk))
530 ide_do_start_stop(drive, disk, 1);
532 ret = ide_floppy_get_capacity(drive);
534 set_capacity(disk, ide_gd_capacity(drive));