• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asus-wl-520gu-7.0.1.45/src/linux/linux/drivers/ide/

Lines Matching defs:drive

21  * ALPHA patches to this driver on an EASYSTOR LS-120 ATAPI floppy drive.
42 * bit. My LS-120 drive barfs on
57 * If drive does not support format progress indication
62 * Ver 0.91 Dec 11 99 Added IOMEGA Clik! drive support by
66 * Ver 0.93 Oct 24 00 Fixed bugs for Clik! drive
77 * drive before the drive was actually ready.
273 ide_drive_t *drive;
309 #define IDEFLOPPY_CLIK_DRIVE 4 /* Avoid commands not supported in Clik drive */
313 * ATAPI floppy drive packet commands
496 unsigned drv :1; /* The responding drive will be drive 0 (0) or drive 1 (1) */
504 unsigned drv :1; /* The responding drive will be drive 0 (0) or drive 1 (1) */
665 * Too bad. The drive wants to send us data which we are not ready to accept.
668 static void idefloppy_discard_data (ide_drive_t *drive, unsigned int bcount)
675 static void idefloppy_write_zeros (ide_drive_t *drive, unsigned int bcount)
690 ide_drive_t *drive = hwgroup->drive;
691 idefloppy_floppy_t *floppy = drive->driver_data;
714 ide_end_drive_cmd (drive, 0, 0);
717 static void idefloppy_input_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, unsigned int bcount)
727 idefloppy_end_request (1, HWGROUP(drive));
732 printk (KERN_ERR "%s: bh == NULL in idefloppy_input_buffers, bcount == %d\n", drive->name, bcount);
733 idefloppy_discard_data (drive, bcount);
737 atapi_input_bytes (drive, bh->b_data + pc->b_count, count);
742 static void idefloppy_output_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, unsigned int bcount)
752 idefloppy_end_request (1, HWGROUP(drive));
759 printk (KERN_ERR "%s: bh == NULL in idefloppy_output_buffers, bcount == %d\n", drive->name, bcount);
760 idefloppy_write_zeros (drive, bcount);
764 atapi_output_bytes (drive, pc->b_data, count);
770 static void idefloppy_update_buffers (ide_drive_t *drive, idefloppy_pc_t *pc)
776 idefloppy_end_request (1, HWGROUP(drive));
785 static void idefloppy_queue_pc_head (ide_drive_t *drive,idefloppy_pc_t *pc,struct request *rq)
790 (void) ide_do_drive_cmd (drive, rq, ide_preempt);
793 static idefloppy_pc_t *idefloppy_next_pc_storage (ide_drive_t *drive)
795 idefloppy_floppy_t *floppy = drive->driver_data;
802 static struct request *idefloppy_next_rq_storage (ide_drive_t *drive)
804 idefloppy_floppy_t *floppy = drive->driver_data;
815 static void idefloppy_analyze_error (ide_drive_t *drive,idefloppy_request_sense_result_t *result)
817 idefloppy_floppy_t *floppy = drive->driver_data;
830 static void idefloppy_request_sense_callback (ide_drive_t *drive)
832 idefloppy_floppy_t *floppy = drive->driver_data;
838 idefloppy_analyze_error (drive,(idefloppy_request_sense_result_t *) floppy->pc->buffer);
839 idefloppy_end_request (1,HWGROUP (drive));
842 idefloppy_end_request (0,HWGROUP (drive));
849 static void idefloppy_pc_callback (ide_drive_t *drive)
851 idefloppy_floppy_t *floppy = drive->driver_data;
857 idefloppy_end_request (floppy->pc->error ? 0:1, HWGROUP(drive));
889 static void idefloppy_retry_pc (ide_drive_t *drive)
896 pc = idefloppy_next_pc_storage (drive);
897 rq = idefloppy_next_rq_storage (drive);
899 idefloppy_queue_pc_head (drive, pc, rq);
906 static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
908 idefloppy_floppy_t *floppy = drive->driver_data;
922 if (HWIF(drive)->dmaproc(ide_dma_end, drive)) {
926 idefloppy_update_buffers (drive, pc);
946 printk (KERN_INFO "ide-floppy: %s: I/O error\n",drive->name);
951 return ide_do_reset (drive);
953 idefloppy_retry_pc (drive); /* Retry operation */
959 pc->callback(drive); /* Command finished - Call the callback function */
965 (void) HWIF(drive)->dmaproc(ide_dma_off, drive);
966 return ide_do_reset (drive);
975 return ide_do_reset (drive);
980 return ide_do_reset (drive);
987 idefloppy_discard_data (drive,bcount.all);
988 ide_set_handler (drive,&idefloppy_pc_intr,IDEFLOPPY_WAIT_CMD, NULL);
998 atapi_output_bytes (drive,pc->current_position,bcount.all); /* Write the current buffer */
1000 idefloppy_output_buffers (drive, pc, bcount.all);
1003 atapi_input_bytes (drive,pc->current_position,bcount.all); /* Read the current buffer */
1005 idefloppy_input_buffers (drive, pc, bcount.all);
1010 ide_set_handler (drive,&idefloppy_pc_intr,IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */
1016 * It fails at high speeds on the Iomega ZIP drive, so there's a slower version
1017 * for that drive below. The algorithm is chosen based on drive type
1019 static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive)
1022 idefloppy_floppy_t *floppy = drive->driver_data;
1025 if (ide_wait_stat (&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) {
1032 return ide_do_reset (drive);
1034 ide_set_handler (drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* Set the interrupt routine */
1035 atapi_output_bytes (drive, floppy->pc->c, 12); /* Send the actual packet */
1052 static int idefloppy_transfer_pc2 (ide_drive_t *drive)
1054 idefloppy_floppy_t *floppy = drive->driver_data;
1056 atapi_output_bytes (drive, floppy->pc->c, 12); /* Send the actual packet */
1060 static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive)
1062 idefloppy_floppy_t *floppy = drive->driver_data;
1066 if (ide_wait_stat (&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) {
1073 return ide_do_reset (drive);
1082 ide_set_handler (drive,
1092 static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *pc)
1094 idefloppy_floppy_t *floppy = drive->driver_data;
1118 drive->name, pc->c[0], floppy->sense_key, floppy->asc, floppy->ascq);
1123 pc->callback(drive);
1137 (void) HWIF(drive)->dmaproc(ide_dma_off, drive);
1139 if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
1140 dma_ok=!HWIF(drive)->dmaproc(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive);
1144 OUT_BYTE (drive->ctl,IDE_CONTROL_REG);
1148 OUT_BYTE (drive->select.all,IDE_SELECT_REG);
1153 (void) (HWIF(drive)->dmaproc(ide_dma_begin, drive));
1165 ide_set_handler (drive, pkt_xfer_routine, IDEFLOPPY_WAIT_CMD, NULL);
1170 return (*pkt_xfer_routine) (drive);
1174 static void idefloppy_rw_callback (ide_drive_t *drive)
1180 idefloppy_end_request(1, HWGROUP(drive));
1297 static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request *rq, unsigned long block)
1299 idefloppy_floppy_t *floppy = drive->driver_data;
1310 drive->name, floppy->failed_pc->c[0], floppy->sense_key, floppy->asc, floppy->ascq);
1312 printk (KERN_ERR "ide-floppy: %s: I/O error\n", drive->name);
1313 idefloppy_end_request (0, HWGROUP(drive));
1320 printk ("%s: unsupported r/w request size\n", drive->name);
1321 idefloppy_end_request (0, HWGROUP(drive));
1324 pc = idefloppy_next_pc_storage (drive);
1332 idefloppy_end_request (0,HWGROUP (drive));
1336 return idefloppy_issue_pc (drive, pc);
1343 static int idefloppy_queue_pc_tail (ide_drive_t *drive,idefloppy_pc_t *pc)
1350 return ide_do_drive_cmd (drive, &rq, ide_wait);
1357 static int idefloppy_get_flexible_disk_page (ide_drive_t *drive)
1359 idefloppy_floppy_t *floppy = drive->driver_data;
1366 if (idefloppy_queue_pc_tail (drive,&pc)) {
1381 drive->name, capacity / 1024, page->cyls, page->heads, page->sectors,
1385 drive->bios_cyl = page->cyls;
1386 drive->bios_head = page->heads;
1387 drive->bios_sect = page->sectors;
1391 "but the drive only handles %d\n",
1392 drive->name, lba_capacity, capacity);
1398 static int idefloppy_get_capability_page(ide_drive_t *drive)
1400 idefloppy_floppy_t *floppy = drive->driver_data;
1410 if (idefloppy_queue_pc_tail (drive,&pc)) {
1421 * Determine if a media is present in the floppy drive, and if so,
1424 static int idefloppy_get_capacity (ide_drive_t *drive)
1426 idefloppy_floppy_t *floppy = drive->driver_data;
1432 drive->bios_cyl = 0;
1433 drive->bios_head = drive->bios_sect = 0;
1435 drive->part[0].nr_sects = 0;
1438 if (idefloppy_queue_pc_tail (drive, &pc)) {
1453 case CAPACITY_UNFORMATTED: /* Clik! drive returns this instead of CAPACITY_CURRENT */
1455 break; /* If it is not a clik drive, break out (maintains previous driver behaviour) */
1458 printk (KERN_INFO "%s: %dkB, %d blocks, %d sector size\n", drive->name, blocks * length / 1024, blocks, length);
1461 printk (KERN_NOTICE "%s: %d bytes block size not supported\n", drive->name, length);
1466 printk (KERN_NOTICE "%s: warning: non 512 bytes block size not fully supported\n", drive->name);
1472 printk (KERN_ERR "%s: No disk in drive\n", drive->name);
1475 printk (KERN_ERR "%s: Invalid capacity for disk in drive\n", drive->name);
1488 (void) idefloppy_get_flexible_disk_page (drive);
1491 drive->part[0].nr_sects = floppy->blocks * floppy->bs_factor;
1516 static int idefloppy_get_format_capacities (ide_drive_t *drive,
1536 if (idefloppy_queue_pc_tail (drive, &pc)) {
1581 ** Send ATAPI_FORMAT_UNIT to the drive.
1596 static int idefloppy_begin_format(ide_drive_t *drive,
1613 (void) idefloppy_get_capability_page (drive); /* Get the SFRP bit */
1615 if (idefloppy_queue_pc_tail (drive, &pc))
1628 ** If the drive does not support format progress indication, we just check
1632 static int idefloppy_get_format_progress(ide_drive_t *drive,
1637 idefloppy_floppy_t *floppy = drive->driver_data;
1644 if (idefloppy_queue_pc_tail (drive, &pc))
1680 static int idefloppy_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file,
1684 idefloppy_floppy_t *floppy = drive->driver_data;
1692 if (drive->usage > 1)
1698 (void) idefloppy_queue_pc_tail (drive, &pc);
1702 (void) idefloppy_queue_pc_tail (drive, &pc);
1708 return (idefloppy_get_format_capacities(drive, inode, file,
1716 idefloppy_floppy_t *floppy = drive->driver_data;
1718 if (drive->usage > 1)
1733 rc=idefloppy_begin_format(drive, inode,
1745 ** situation where the drive does not support
1751 return (idefloppy_get_format_progress(drive, inode, file,
1760 static int idefloppy_open (struct inode *inode, struct file *filp, ide_drive_t *drive)
1762 idefloppy_floppy_t *floppy = drive->driver_data;
1770 if (drive->usage == 1) {
1775 if (idefloppy_queue_pc_tail(drive, &pc)) {
1777 (void) idefloppy_queue_pc_tail (drive, &pc);
1780 if (idefloppy_get_capacity (drive)
1783 ** Allow O_NDELAY to open a drive without a disk, or with
1785 ** capacity of the drive or begin the format - Sam
1788 drive->usage--;
1794 drive->usage--;
1802 (void) idefloppy_queue_pc_tail (drive, &pc);
1808 drive->usage--;
1815 static void idefloppy_release (struct inode *inode, struct file *filp, ide_drive_t *drive)
1823 if (!drive->usage) {
1824 idefloppy_floppy_t *floppy = drive->driver_data;
1831 (void) idefloppy_queue_pc_tail (drive, &pc);
1842 static int idefloppy_media_change (ide_drive_t *drive)
1844 idefloppy_floppy_t *floppy = drive->driver_data;
1852 static void idefloppy_revalidate (ide_drive_t *drive)
1854 grok_partitions(HWIF(drive)->gd, drive->select.b.unit,
1856 current_capacity(drive));
1862 static unsigned long idefloppy_capacity (ide_drive_t *drive)
1864 idefloppy_floppy_t *floppy = drive->driver_data;
1871 * idefloppy_identify_device checks if we can support a drive,
1874 static int idefloppy_identify_device (ide_drive_t *drive,struct hd_driveid *id)
1986 static void idefloppy_add_settings(ide_drive_t *drive)
1988 int major = HWIF(drive)->major;
1989 int minor = drive->select.b.unit << PARTN_BITS;
1990 idefloppy_floppy_t *floppy = drive->driver_data;
1993 * drive setting name read/write ioctl ioctl data type min max mul_factor div_factor data pointer set function
1995 ide_add_setting(drive, "bios_cyl", SETTING_RW, -1, -1, TYPE_INT, 0, 1023, 1, 1, &drive->bios_cyl, NULL);
1996 ide_add_setting(drive, "bios_head", SETTING_RW, -1, -1, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL);
1997 ide_add_setting(drive, "bios_sect", SETTING_RW, -1, -1, TYPE_BYTE, 0, 63, 1, 1, &drive->bios_sect, NULL);
1998 ide_add_setting(drive, "breada_readahead", SETTING_RW, BLKRAGET, BLKRASET, TYPE_INT, 0, 255, 1, 2, &read_ahead[major], NULL);
1999 ide_add_setting(drive, "file_readahead", SETTING_RW, BLKFRAGET, BLKFRASET, TYPE_INTA, 0, INT_MAX, 1, 1024, &max_readahead[major][minor], NULL);
2000 ide_add_setting(drive, "max_kb_per_request", SETTING_RW, BLKSECTGET, BLKSECTSET, TYPE_INTA, 1, 255, 1, 2, &max_sectors[major][minor], NULL);
2001 ide_add_setting(drive, "ticks", SETTING_RW, -1, -1, TYPE_BYTE, 0, 255, 1, 1, &floppy->ticks, NULL);
2008 static void idefloppy_setup (ide_drive_t *drive, idefloppy_floppy_t *floppy)
2011 int major = HWIF(drive)->major, i;
2012 int minor = drive->select.b.unit << PARTN_BITS;
2014 *((unsigned short *) &gcw) = drive->id->config;
2015 drive->driver_data = floppy;
2016 drive->ready_stat = 0;
2018 floppy->drive = drive;
2023 if (strcmp(drive->id->model, "IOMEGA ZIP 100 ATAPI") == 0)
2033 * Guess what? The IOMEGA Clik! drive also needs the
2037 if (strncmp(drive->id->model, "IOMEGA Clik!", 11) == 0)
2045 (void) idefloppy_get_capacity (drive);
2046 idefloppy_add_settings(drive);
2048 ide_hwif_t *hwif = HWIF(drive);
2050 if (drive != &hwif->drives[i]) continue;
2051 hwif->gd->de_arr[i] = drive->de;
2052 if (drive->removable)
2058 static int idefloppy_cleanup (ide_drive_t *drive)
2060 idefloppy_floppy_t *floppy = drive->driver_data;
2062 if (ide_unregister_subdriver (drive))
2064 drive->driver_data = NULL;
2082 int idefloppy_reinit(ide_drive_t *drive);
2121 int idefloppy_reinit (ide_drive_t *drive)
2127 while ((drive = ide_scan_devices (ide_floppy, idefloppy_driver.name, NULL, failed++)) != NULL) {
2128 if (!idefloppy_identify_device (drive, drive->id)) {
2129 printk (KERN_ERR "ide-floppy: %s: not supported by this version of ide-floppy\n", drive->name);
2132 if (drive->scsi) {
2133 printk("ide-floppy: passing drive %s to ide-scsi emulation.\n", drive->name);
2137 printk (KERN_ERR "ide-floppy: %s: Can't allocate a floppy structure\n", drive->name);
2140 if (ide_register_subdriver (drive, &idefloppy_driver, IDE_SUBDRIVER_VERSION)) {
2141 printk (KERN_ERR "ide-floppy: %s: Failed to register the driver with ide.c\n", drive->name);
2145 DRIVER(drive)->busy++;
2146 idefloppy_setup (drive, floppy);
2147 DRIVER(drive)->busy--;
2159 ide_drive_t *drive;
2162 while ((drive = ide_scan_devices (ide_floppy, idefloppy_driver.name, &idefloppy_driver, failed)) != NULL) {
2163 if (idefloppy_cleanup (drive)) {
2164 printk ("%s: cleanup_module() called while still busy\n", drive->name);
2170 if (drive->proc)
2171 ide_remove_proc_entries(drive->proc, idefloppy_proc);
2182 ide_drive_t *drive;
2188 while ((drive = ide_scan_devices (ide_floppy, idefloppy_driver.name, NULL, failed++)) != NULL) {
2189 if (!idefloppy_identify_device (drive, drive->id)) {
2190 printk (KERN_ERR "ide-floppy: %s: not supported by this version of ide-floppy\n", drive->name);
2193 if (drive->scsi) {
2194 printk("ide-floppy: passing drive %s to ide-scsi emulation.\n", drive->name);
2198 printk (KERN_ERR "ide-floppy: %s: Can't allocate a floppy structure\n", drive->name);
2201 if (ide_register_subdriver (drive, &idefloppy_driver, IDE_SUBDRIVER_VERSION)) {
2202 printk (KERN_ERR "ide-floppy: %s: Failed to register the driver with ide.c\n", drive->name);
2206 DRIVER(drive)->busy++;
2207 idefloppy_setup (drive, floppy);
2208 DRIVER(drive)->busy--;