diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-26 17:13:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-26 17:13:54 -0400 |
commit | 9c88b702186d4bb1b28c9bdd5f224f3f8ce2ea51 (patch) | |
tree | b493103681c99e948791f2223d34cd0596faa343 | |
parent | 291bc047e125ff02c9affe06a7df28bed57b054d (diff) | |
parent | 513daadd152ddbf32cb6d0447ddba3427ce5b8e8 (diff) |
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
-rw-r--r-- | drivers/ide/Kconfig | 6 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 32 | ||||
-rw-r--r-- | drivers/ide/ide-iops.c | 11 | ||||
-rw-r--r-- | drivers/ide/ide.c | 37 | ||||
-rw-r--r-- | drivers/ide/pci/pdc202xx_new.c | 3 | ||||
-rw-r--r-- | include/linux/ide.h | 1 |
6 files changed, 67 insertions, 23 deletions
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 8f1fd017679b..ca2e4f830c39 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -103,8 +103,10 @@ config BLK_DEV_IDE_SATA | |||
103 | ---help--- | 103 | ---help--- |
104 | There are two drivers for Serial ATA controllers. | 104 | There are two drivers for Serial ATA controllers. |
105 | 105 | ||
106 | The main driver, "libata", exists inside the SCSI subsystem | 106 | The main driver, "libata", uses the SCSI subsystem |
107 | and supports most modern SATA controllers. | 107 | and supports most modern SATA controllers. In order to use it |
108 | you may take a look at "Serial ATA (prod) and Parallel ATA | ||
109 | (experimental) drivers". | ||
108 | 110 | ||
109 | The IDE driver (which you are currently configuring) supports | 111 | The IDE driver (which you are currently configuring) supports |
110 | a few first-generation SATA controllers. | 112 | a few first-generation SATA controllers. |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index c193553f6fe7..0e0280076fcd 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -519,21 +519,24 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 | |||
519 | if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0) | 519 | if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0) |
520 | try_to_flush_leftover_data(drive); | 520 | try_to_flush_leftover_data(drive); |
521 | 521 | ||
522 | if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) { | ||
523 | ide_kill_rq(drive, rq); | ||
524 | return ide_stopped; | ||
525 | } | ||
526 | |||
522 | if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) | 527 | if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) |
523 | /* force an abort */ | 528 | rq->errors |= ERROR_RESET; |
524 | hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG); | ||
525 | 529 | ||
526 | if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) | 530 | if ((rq->errors & ERROR_RESET) == ERROR_RESET) { |
527 | ide_kill_rq(drive, rq); | ||
528 | else { | ||
529 | if ((rq->errors & ERROR_RESET) == ERROR_RESET) { | ||
530 | ++rq->errors; | ||
531 | return ide_do_reset(drive); | ||
532 | } | ||
533 | if ((rq->errors & ERROR_RECAL) == ERROR_RECAL) | ||
534 | drive->special.b.recalibrate = 1; | ||
535 | ++rq->errors; | 531 | ++rq->errors; |
532 | return ide_do_reset(drive); | ||
536 | } | 533 | } |
534 | |||
535 | if ((rq->errors & ERROR_RECAL) == ERROR_RECAL) | ||
536 | drive->special.b.recalibrate = 1; | ||
537 | |||
538 | ++rq->errors; | ||
539 | |||
537 | return ide_stopped; | 540 | return ide_stopped; |
538 | } | 541 | } |
539 | 542 | ||
@@ -1025,6 +1028,13 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq) | |||
1025 | if (!drive->special.all) { | 1028 | if (!drive->special.all) { |
1026 | ide_driver_t *drv; | 1029 | ide_driver_t *drv; |
1027 | 1030 | ||
1031 | /* | ||
1032 | * We reset the drive so we need to issue a SETFEATURES. | ||
1033 | * Do it _after_ do_special() restored device parameters. | ||
1034 | */ | ||
1035 | if (drive->current_speed == 0xff) | ||
1036 | ide_config_drive_speed(drive, drive->desired_speed); | ||
1037 | |||
1028 | if (rq->cmd_type == REQ_TYPE_ATA_CMD || | 1038 | if (rq->cmd_type == REQ_TYPE_ATA_CMD || |
1029 | rq->cmd_type == REQ_TYPE_ATA_TASK || | 1039 | rq->cmd_type == REQ_TYPE_ATA_TASK || |
1030 | rq->cmd_type == REQ_TYPE_ATA_TASKFILE) | 1040 | rq->cmd_type == REQ_TYPE_ATA_TASKFILE) |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index bd513f5a2323..1ee53a551c3a 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -583,8 +583,12 @@ u8 eighty_ninty_three (ide_drive_t *drive) | |||
583 | if(!(drive->id->hw_config & 0x4000)) | 583 | if(!(drive->id->hw_config & 0x4000)) |
584 | return 0; | 584 | return 0; |
585 | #endif /* CONFIG_IDEDMA_IVB */ | 585 | #endif /* CONFIG_IDEDMA_IVB */ |
586 | if (!(drive->id->hw_config & 0x2000)) | 586 | /* |
587 | return 0; | 587 | * FIXME: |
588 | * - change master/slave IDENTIFY order | ||
589 | * - force bit13 (80c cable present) check | ||
590 | * (unless the slave device is pre-ATA3) | ||
591 | */ | ||
588 | return 1; | 592 | return 1; |
589 | } | 593 | } |
590 | 594 | ||
@@ -1090,6 +1094,9 @@ static void pre_reset(ide_drive_t *drive) | |||
1090 | if (HWIF(drive)->pre_reset != NULL) | 1094 | if (HWIF(drive)->pre_reset != NULL) |
1091 | HWIF(drive)->pre_reset(drive); | 1095 | HWIF(drive)->pre_reset(drive); |
1092 | 1096 | ||
1097 | if (drive->current_speed != 0xff) | ||
1098 | drive->desired_speed = drive->current_speed; | ||
1099 | drive->current_speed = 0xff; | ||
1093 | } | 1100 | } |
1094 | 1101 | ||
1095 | /* | 1102 | /* |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 695610f0e3e4..a6f098fda884 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -1124,17 +1124,40 @@ static int set_io_32bit(ide_drive_t *drive, int arg) | |||
1124 | static int set_using_dma (ide_drive_t *drive, int arg) | 1124 | static int set_using_dma (ide_drive_t *drive, int arg) |
1125 | { | 1125 | { |
1126 | #ifdef CONFIG_BLK_DEV_IDEDMA | 1126 | #ifdef CONFIG_BLK_DEV_IDEDMA |
1127 | ide_hwif_t *hwif = drive->hwif; | ||
1128 | int err = -EPERM; | ||
1129 | |||
1127 | if (!drive->id || !(drive->id->capability & 1)) | 1130 | if (!drive->id || !(drive->id->capability & 1)) |
1128 | return -EPERM; | 1131 | goto out; |
1129 | if (HWIF(drive)->ide_dma_check == NULL) | 1132 | |
1130 | return -EPERM; | 1133 | if (hwif->ide_dma_check == NULL) |
1134 | goto out; | ||
1135 | |||
1136 | err = -EBUSY; | ||
1137 | if (ide_spin_wait_hwgroup(drive)) | ||
1138 | goto out; | ||
1139 | /* | ||
1140 | * set ->busy flag, unlock and let it ride | ||
1141 | */ | ||
1142 | hwif->hwgroup->busy = 1; | ||
1143 | spin_unlock_irq(&ide_lock); | ||
1144 | |||
1145 | err = 0; | ||
1146 | |||
1131 | if (arg) { | 1147 | if (arg) { |
1132 | if (ide_set_dma(drive)) | 1148 | if (ide_set_dma(drive) || hwif->ide_dma_on(drive)) |
1133 | return -EIO; | 1149 | err = -EIO; |
1134 | if (HWIF(drive)->ide_dma_on(drive)) return -EIO; | ||
1135 | } else | 1150 | } else |
1136 | ide_dma_off(drive); | 1151 | ide_dma_off(drive); |
1137 | return 0; | 1152 | |
1153 | /* | ||
1154 | * lock, clear ->busy flag and unlock before leaving | ||
1155 | */ | ||
1156 | spin_lock_irq(&ide_lock); | ||
1157 | hwif->hwgroup->busy = 0; | ||
1158 | spin_unlock_irq(&ide_lock); | ||
1159 | out: | ||
1160 | return err; | ||
1138 | #else | 1161 | #else |
1139 | return -EPERM; | 1162 | return -EPERM; |
1140 | #endif | 1163 | #endif |
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index 6ceb25bc5a7b..ace98929cc3d 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c | |||
@@ -255,7 +255,7 @@ static int config_chipset_for_dma(ide_drive_t *drive) | |||
255 | printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name); | 255 | printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name); |
256 | } | 256 | } |
257 | 257 | ||
258 | if (drive->media != ide_disk) | 258 | if (drive->media != ide_disk && drive->media != ide_cdrom) |
259 | return 0; | 259 | return 0; |
260 | 260 | ||
261 | if (id->capability & 4) { | 261 | if (id->capability & 4) { |
@@ -545,6 +545,7 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif) | |||
545 | 545 | ||
546 | hwif->drives[0].autotune = hwif->drives[1].autotune = 1; | 546 | hwif->drives[0].autotune = hwif->drives[1].autotune = 1; |
547 | 547 | ||
548 | hwif->atapi_dma = 1; | ||
548 | hwif->ultra_mask = 0x7f; | 549 | hwif->ultra_mask = 0x7f; |
549 | hwif->mwdma_mask = 0x07; | 550 | hwif->mwdma_mask = 0x07; |
550 | 551 | ||
diff --git a/include/linux/ide.h b/include/linux/ide.h index 34f2676b3c62..58564a199862 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -615,6 +615,7 @@ typedef struct ide_drive_s { | |||
615 | u8 init_speed; /* transfer rate set at boot */ | 615 | u8 init_speed; /* transfer rate set at boot */ |
616 | u8 pio_speed; /* unused by core, used by some drivers for fallback from DMA */ | 616 | u8 pio_speed; /* unused by core, used by some drivers for fallback from DMA */ |
617 | u8 current_speed; /* current transfer rate set */ | 617 | u8 current_speed; /* current transfer rate set */ |
618 | u8 desired_speed; /* desired transfer rate set */ | ||
618 | u8 dn; /* now wide spread use */ | 619 | u8 dn; /* now wide spread use */ |
619 | u8 wcache; /* status of write cache */ | 620 | u8 wcache; /* status of write cache */ |
620 | u8 acoustic; /* acoustic management */ | 621 | u8 acoustic; /* acoustic management */ |