#include <linux/slab.h>
#include <linux/cdrom.h>
#include <linux/ide.h>
+#include <linux/bitops.h>
#include <asm/byteorder.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/unaligned.h>
-#include <asm/bitops.h>
/*
* The following are used to debug the driver.
count = min(bvec->bv_len, bcount);
data = bvec_kmap_irq(bvec, &flags);
- atapi_input_bytes(drive, data, count);
+ drive->hwif->atapi_input_bytes(drive, data, count);
bvec_kunmap_irq(data, &flags);
bcount -= count;
count = min(bvec->bv_len, bcount);
data = bvec_kmap_irq(bvec, &flags);
- atapi_output_bytes(drive, data, count);
+ drive->hwif->atapi_output_bytes(drive, data, count);
bvec_kunmap_irq(data, &flags);
bcount -= count;
return ide_started;
}
+/**
+ * idefloppy_should_report_error()
+ *
+ * Supresses error messages resulting from Medium not present
+ */
+static inline int idefloppy_should_report_error(idefloppy_floppy_t *floppy)
+{
+ if (floppy->sense_key == 0x02 &&
+ floppy->asc == 0x3a &&
+ floppy->ascq == 0x00)
+ return 0;
+ return 1;
+}
+
/*
* Issue a packet command
*/
static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *pc)
{
idefloppy_floppy_t *floppy = drive->driver_data;
+ ide_hwif_t *hwif = drive->hwif;
atapi_feature_t feature;
atapi_bcount_t bcount;
ide_handler_t *pkt_xfer_routine;
*/
if (!test_bit(PC_ABORT, &pc->flags)) {
if (!test_bit(PC_SUPPRESS_ERROR, &pc->flags)) {
- printk(KERN_ERR "ide-floppy: %s: I/O error, "
- "pc = %2x, key = %2x, "
- "asc = %2x, ascq = %2x\n",
- drive->name, pc->c[0],
- floppy->sense_key,
- floppy->asc, floppy->ascq);
+ if (idefloppy_should_report_error(floppy))
+ printk(KERN_ERR "ide-floppy: %s: I/O error, "
+ "pc = %2x, key = %2x, "
+ "asc = %2x, ascq = %2x\n",
+ drive->name, pc->c[0],
+ floppy->sense_key,
+ floppy->asc, floppy->ascq);
}
/* Giving up */
pc->error = IDEFLOPPY_ERROR_GENERAL;
}
feature.all = 0;
- if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) {
- if (test_bit(PC_WRITING, &pc->flags)) {
- feature.b.dma = !HWIF(drive)->ide_dma_write(drive);
- } else {
- feature.b.dma = !HWIF(drive)->ide_dma_read(drive);
- }
- }
+ if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
+ feature.b.dma = !hwif->dma_setup(drive);
if (IDE_CONTROL_REG)
HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
if (feature.b.dma) { /* Begin DMA, if necessary */
set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
- (void) (HWIF(drive)->ide_dma_begin(drive));
+ hwif->dma_start(drive);
}
/* Can we transfer the packet when we get the interrupt or wait? */
rq->nr_sectors, rq->current_nr_sectors);
if (rq->errors >= ERROR_MAX) {
- if (floppy->failed_pc != NULL)
- printk(KERN_ERR "ide-floppy: %s: I/O error, pc = %2x,"
- " key = %2x, asc = %2x, ascq = %2x\n",
- drive->name, floppy->failed_pc->c[0],
- floppy->sense_key, floppy->asc, floppy->ascq);
+ if (floppy->failed_pc != NULL) {
+ if (idefloppy_should_report_error(floppy))
+ printk(KERN_ERR "ide-floppy: %s: I/O error, pc = %2x,"
+ " key = %2x, asc = %2x, ascq = %2x\n",
+ drive->name, floppy->failed_pc->c[0],
+ floppy->sense_key, floppy->asc, floppy->ascq);
+ }
else
printk(KERN_ERR "ide-floppy: %s: I/O error\n",
drive->name);
}
/*
- * Return the current floppy capacity to ide.c.
+ * Return the current floppy capacity.
*/
static sector_t idefloppy_capacity (ide_drive_t *drive)
{
static int idefloppy_revalidate_disk(struct gendisk *disk)
{
ide_drive_t *drive = disk->private_data;
- set_capacity(disk, current_capacity(drive));
+ set_capacity(disk, idefloppy_capacity(drive));
return 0;
}