Commit 9c88b702 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6:
  ide: use correct IDE error recovery
  pdc202xx_new: Enable ATAPI DMA
  ide: cosmetic adaption of drivers/ide/Kconfig concerning SATA
  ide: fix locking for manual DMA enable/disable ("hdparm -d")
  ide: revert "ide: fix drive side 80c cable check, take 2" for now
parents 291bc047 513daadd
...@@ -103,8 +103,10 @@ config BLK_DEV_IDE_SATA ...@@ -103,8 +103,10 @@ config BLK_DEV_IDE_SATA
---help--- ---help---
There are two drivers for Serial ATA controllers. There are two drivers for Serial ATA controllers.
The main driver, "libata", exists inside the SCSI subsystem The main driver, "libata", uses the SCSI subsystem
and supports most modern SATA controllers. and supports most modern SATA controllers. In order to use it
you may take a look at "Serial ATA (prod) and Parallel ATA
(experimental) drivers".
The IDE driver (which you are currently configuring) supports The IDE driver (which you are currently configuring) supports
a few first-generation SATA controllers. a few first-generation SATA controllers.
......
...@@ -519,21 +519,24 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 ...@@ -519,21 +519,24 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0) if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0)
try_to_flush_leftover_data(drive); try_to_flush_leftover_data(drive);
if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) {
ide_kill_rq(drive, rq);
return ide_stopped;
}
if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
/* force an abort */ rq->errors |= ERROR_RESET;
hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG);
if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
ide_kill_rq(drive, rq);
else {
if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
++rq->errors;
return ide_do_reset(drive);
}
if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
drive->special.b.recalibrate = 1;
++rq->errors; ++rq->errors;
return ide_do_reset(drive);
} }
if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
drive->special.b.recalibrate = 1;
++rq->errors;
return ide_stopped; return ide_stopped;
} }
...@@ -1025,6 +1028,13 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq) ...@@ -1025,6 +1028,13 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
if (!drive->special.all) { if (!drive->special.all) {
ide_driver_t *drv; ide_driver_t *drv;
/*
* We reset the drive so we need to issue a SETFEATURES.
* Do it _after_ do_special() restored device parameters.
*/
if (drive->current_speed == 0xff)
ide_config_drive_speed(drive, drive->desired_speed);
if (rq->cmd_type == REQ_TYPE_ATA_CMD || if (rq->cmd_type == REQ_TYPE_ATA_CMD ||
rq->cmd_type == REQ_TYPE_ATA_TASK || rq->cmd_type == REQ_TYPE_ATA_TASK ||
rq->cmd_type == REQ_TYPE_ATA_TASKFILE) rq->cmd_type == REQ_TYPE_ATA_TASKFILE)
......
...@@ -583,8 +583,12 @@ u8 eighty_ninty_three (ide_drive_t *drive) ...@@ -583,8 +583,12 @@ u8 eighty_ninty_three (ide_drive_t *drive)
if(!(drive->id->hw_config & 0x4000)) if(!(drive->id->hw_config & 0x4000))
return 0; return 0;
#endif /* CONFIG_IDEDMA_IVB */ #endif /* CONFIG_IDEDMA_IVB */
if (!(drive->id->hw_config & 0x2000)) /*
return 0; * FIXME:
* - change master/slave IDENTIFY order
* - force bit13 (80c cable present) check
* (unless the slave device is pre-ATA3)
*/
return 1; return 1;
} }
...@@ -1090,6 +1094,9 @@ static void pre_reset(ide_drive_t *drive) ...@@ -1090,6 +1094,9 @@ static void pre_reset(ide_drive_t *drive)
if (HWIF(drive)->pre_reset != NULL) if (HWIF(drive)->pre_reset != NULL)
HWIF(drive)->pre_reset(drive); HWIF(drive)->pre_reset(drive);
if (drive->current_speed != 0xff)
drive->desired_speed = drive->current_speed;
drive->current_speed = 0xff;
} }
/* /*
......
...@@ -1124,17 +1124,40 @@ static int set_io_32bit(ide_drive_t *drive, int arg) ...@@ -1124,17 +1124,40 @@ static int set_io_32bit(ide_drive_t *drive, int arg)
static int set_using_dma (ide_drive_t *drive, int arg) static int set_using_dma (ide_drive_t *drive, int arg)
{ {
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
ide_hwif_t *hwif = drive->hwif;
int err = -EPERM;
if (!drive->id || !(drive->id->capability & 1)) if (!drive->id || !(drive->id->capability & 1))
return -EPERM; goto out;
if (HWIF(drive)->ide_dma_check == NULL)
return -EPERM; if (hwif->ide_dma_check == NULL)
goto out;
err = -EBUSY;
if (ide_spin_wait_hwgroup(drive))
goto out;
/*
* set ->busy flag, unlock and let it ride
*/
hwif->hwgroup->busy = 1;
spin_unlock_irq(&ide_lock);
err = 0;
if (arg) { if (arg) {
if (ide_set_dma(drive)) if (ide_set_dma(drive) || hwif->ide_dma_on(drive))
return -EIO; err = -EIO;
if (HWIF(drive)->ide_dma_on(drive)) return -EIO;
} else } else
ide_dma_off(drive); ide_dma_off(drive);
return 0;
/*
* lock, clear ->busy flag and unlock before leaving
*/
spin_lock_irq(&ide_lock);
hwif->hwgroup->busy = 0;
spin_unlock_irq(&ide_lock);
out:
return err;
#else #else
return -EPERM; return -EPERM;
#endif #endif
......
...@@ -255,7 +255,7 @@ static int config_chipset_for_dma(ide_drive_t *drive) ...@@ -255,7 +255,7 @@ static int config_chipset_for_dma(ide_drive_t *drive)
printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name); printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name);
} }
if (drive->media != ide_disk) if (drive->media != ide_disk && drive->media != ide_cdrom)
return 0; return 0;
if (id->capability & 4) { if (id->capability & 4) {
...@@ -545,6 +545,7 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif) ...@@ -545,6 +545,7 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
hwif->drives[0].autotune = hwif->drives[1].autotune = 1; hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
hwif->atapi_dma = 1;
hwif->ultra_mask = 0x7f; hwif->ultra_mask = 0x7f;
hwif->mwdma_mask = 0x07; hwif->mwdma_mask = 0x07;
......
...@@ -615,6 +615,7 @@ typedef struct ide_drive_s { ...@@ -615,6 +615,7 @@ typedef struct ide_drive_s {
u8 init_speed; /* transfer rate set at boot */ u8 init_speed; /* transfer rate set at boot */
u8 pio_speed; /* unused by core, used by some drivers for fallback from DMA */ u8 pio_speed; /* unused by core, used by some drivers for fallback from DMA */
u8 current_speed; /* current transfer rate set */ u8 current_speed; /* current transfer rate set */
u8 desired_speed; /* desired transfer rate set */
u8 dn; /* now wide spread use */ u8 dn; /* now wide spread use */
u8 wcache; /* status of write cache */ u8 wcache; /* status of write cache */
u8 acoustic; /* acoustic management */ u8 acoustic; /* acoustic management */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment