diff options
| author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-29 21:25:10 -0400 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-29 21:25:10 -0400 |
| commit | 0169e284f6b6b263cc7c2ed25986b96cd6fda610 (patch) | |
| tree | 266623b0131e310de6e77a2c87c42b4092902fa4 | |
| parent | be15cd72d256e5eb3261a781b8507fac83ab33f6 (diff) | |
[libata] remove ata_chk_err(), ->check_err() hook.
We now depend on ->tf_read() to provide us with the contents
of the Error shadow register.
| -rw-r--r-- | drivers/scsi/ahci.c | 9 | ||||
| -rw-r--r-- | drivers/scsi/libata-core.c | 41 | ||||
| -rw-r--r-- | drivers/scsi/sata_mv.c | 18 | ||||
| -rw-r--r-- | drivers/scsi/sata_sil24.c | 8 | ||||
| -rw-r--r-- | include/linux/libata.h | 2 |
5 files changed, 9 insertions, 69 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index fe8187d6f58b..03829aedfd39 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
| @@ -192,7 +192,6 @@ static void ahci_port_stop(struct ata_port *ap); | |||
| 192 | static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | 192 | static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf); |
| 193 | static void ahci_qc_prep(struct ata_queued_cmd *qc); | 193 | static void ahci_qc_prep(struct ata_queued_cmd *qc); |
| 194 | static u8 ahci_check_status(struct ata_port *ap); | 194 | static u8 ahci_check_status(struct ata_port *ap); |
| 195 | static u8 ahci_check_err(struct ata_port *ap); | ||
| 196 | static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); | 195 | static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); |
| 197 | static void ahci_remove_one (struct pci_dev *pdev); | 196 | static void ahci_remove_one (struct pci_dev *pdev); |
| 198 | 197 | ||
| @@ -221,7 +220,6 @@ static const struct ata_port_operations ahci_ops = { | |||
| 221 | 220 | ||
| 222 | .check_status = ahci_check_status, | 221 | .check_status = ahci_check_status, |
| 223 | .check_altstatus = ahci_check_status, | 222 | .check_altstatus = ahci_check_status, |
| 224 | .check_err = ahci_check_err, | ||
| 225 | .dev_select = ata_noop_dev_select, | 223 | .dev_select = ata_noop_dev_select, |
| 226 | 224 | ||
| 227 | .tf_read = ahci_tf_read, | 225 | .tf_read = ahci_tf_read, |
| @@ -458,13 +456,6 @@ static u8 ahci_check_status(struct ata_port *ap) | |||
| 458 | return readl(mmio + PORT_TFDATA) & 0xFF; | 456 | return readl(mmio + PORT_TFDATA) & 0xFF; |
| 459 | } | 457 | } |
| 460 | 458 | ||
| 461 | static u8 ahci_check_err(struct ata_port *ap) | ||
| 462 | { | ||
| 463 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr; | ||
| 464 | |||
| 465 | return (readl(mmio + PORT_TFDATA) >> 8) & 0xFF; | ||
| 466 | } | ||
| 467 | |||
| 468 | static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | 459 | static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf) |
| 469 | { | 460 | { |
| 470 | struct ahci_port_priv *pp = ap->private_data; | 461 | struct ahci_port_priv *pp = ap->private_data; |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index b1b1c6f01419..d2f71a2331bb 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
| @@ -371,7 +371,7 @@ static void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf) | |||
| 371 | struct ata_ioports *ioaddr = &ap->ioaddr; | 371 | struct ata_ioports *ioaddr = &ap->ioaddr; |
| 372 | 372 | ||
| 373 | tf->command = ata_check_status(ap); | 373 | tf->command = ata_check_status(ap); |
| 374 | tf->feature = ata_chk_err(ap); | 374 | tf->feature = inb(ioaddr->error_addr); |
| 375 | tf->nsect = inb(ioaddr->nsect_addr); | 375 | tf->nsect = inb(ioaddr->nsect_addr); |
| 376 | tf->lbal = inb(ioaddr->lbal_addr); | 376 | tf->lbal = inb(ioaddr->lbal_addr); |
| 377 | tf->lbam = inb(ioaddr->lbam_addr); | 377 | tf->lbam = inb(ioaddr->lbam_addr); |
| @@ -405,7 +405,7 @@ static void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf) | |||
| 405 | struct ata_ioports *ioaddr = &ap->ioaddr; | 405 | struct ata_ioports *ioaddr = &ap->ioaddr; |
| 406 | 406 | ||
| 407 | tf->command = ata_check_status(ap); | 407 | tf->command = ata_check_status(ap); |
| 408 | tf->feature = ata_chk_err(ap); | 408 | tf->feature = readb((void __iomem *)ioaddr->error_addr); |
| 409 | tf->nsect = readb((void __iomem *)ioaddr->nsect_addr); | 409 | tf->nsect = readb((void __iomem *)ioaddr->nsect_addr); |
| 410 | tf->lbal = readb((void __iomem *)ioaddr->lbal_addr); | 410 | tf->lbal = readb((void __iomem *)ioaddr->lbal_addr); |
| 411 | tf->lbam = readb((void __iomem *)ioaddr->lbam_addr); | 411 | tf->lbam = readb((void __iomem *)ioaddr->lbam_addr); |
| @@ -526,30 +526,6 @@ u8 ata_altstatus(struct ata_port *ap) | |||
| 526 | 526 | ||
| 527 | 527 | ||
| 528 | /** | 528 | /** |
| 529 | * ata_chk_err - Read device error reg | ||
| 530 | * @ap: port where the device is | ||
| 531 | * | ||
| 532 | * Reads ATA taskfile error register for | ||
| 533 | * currently-selected device and return its value. | ||
| 534 | * | ||
| 535 | * Note: may NOT be used as the check_err() entry in | ||
| 536 | * ata_port_operations. | ||
| 537 | * | ||
| 538 | * LOCKING: | ||
| 539 | * Inherited from caller. | ||
| 540 | */ | ||
| 541 | u8 ata_chk_err(struct ata_port *ap) | ||
| 542 | { | ||
| 543 | if (ap->ops->check_err) | ||
| 544 | return ap->ops->check_err(ap); | ||
| 545 | |||
| 546 | if (ap->flags & ATA_FLAG_MMIO) { | ||
| 547 | return readb((void __iomem *) ap->ioaddr.error_addr); | ||
| 548 | } | ||
| 549 | return inb(ap->ioaddr.error_addr); | ||
| 550 | } | ||
| 551 | |||
| 552 | /** | ||
| 553 | * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure | 529 | * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure |
| 554 | * @tf: Taskfile to convert | 530 | * @tf: Taskfile to convert |
| 555 | * @fis: Buffer into which data will output | 531 | * @fis: Buffer into which data will output |
| @@ -901,8 +877,8 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device) | |||
| 901 | 877 | ||
| 902 | memset(&tf, 0, sizeof(tf)); | 878 | memset(&tf, 0, sizeof(tf)); |
| 903 | 879 | ||
| 904 | err = ata_chk_err(ap); | ||
| 905 | ap->ops->tf_read(ap, &tf); | 880 | ap->ops->tf_read(ap, &tf); |
| 881 | err = tf.feature; | ||
| 906 | 882 | ||
| 907 | dev->class = ATA_DEV_NONE; | 883 | dev->class = ATA_DEV_NONE; |
| 908 | 884 | ||
| @@ -1139,7 +1115,6 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device) | |||
| 1139 | unsigned int major_version; | 1115 | unsigned int major_version; |
| 1140 | u16 tmp; | 1116 | u16 tmp; |
| 1141 | unsigned long xfer_modes; | 1117 | unsigned long xfer_modes; |
| 1142 | u8 status; | ||
| 1143 | unsigned int using_edd; | 1118 | unsigned int using_edd; |
| 1144 | DECLARE_COMPLETION(wait); | 1119 | DECLARE_COMPLETION(wait); |
| 1145 | struct ata_queued_cmd *qc; | 1120 | struct ata_queued_cmd *qc; |
| @@ -1193,8 +1168,11 @@ retry: | |||
| 1193 | else | 1168 | else |
| 1194 | wait_for_completion(&wait); | 1169 | wait_for_completion(&wait); |
| 1195 | 1170 | ||
| 1196 | status = ata_chk_status(ap); | 1171 | spin_lock_irqsave(&ap->host_set->lock, flags); |
| 1197 | if (status & ATA_ERR) { | 1172 | ap->ops->tf_read(ap, &qc->tf); |
| 1173 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
| 1174 | |||
| 1175 | if (qc->tf.command & ATA_ERR) { | ||
| 1198 | /* | 1176 | /* |
| 1199 | * arg! EDD works for all test cases, but seems to return | 1177 | * arg! EDD works for all test cases, but seems to return |
| 1200 | * the ATA signature for some ATAPI devices. Until the | 1178 | * the ATA signature for some ATAPI devices. Until the |
| @@ -1207,7 +1185,7 @@ retry: | |||
| 1207 | * to have this problem. | 1185 | * to have this problem. |
| 1208 | */ | 1186 | */ |
| 1209 | if ((using_edd) && (qc->tf.command == ATA_CMD_ID_ATA)) { | 1187 | if ((using_edd) && (qc->tf.command == ATA_CMD_ID_ATA)) { |
| 1210 | u8 err = ata_chk_err(ap); | 1188 | u8 err = qc->tf.feature; |
| 1211 | if (err & ATA_ABORTED) { | 1189 | if (err & ATA_ABORTED) { |
| 1212 | dev->class = ATA_DEV_ATAPI; | 1190 | dev->class = ATA_DEV_ATAPI; |
| 1213 | qc->cursg = 0; | 1191 | qc->cursg = 0; |
| @@ -4873,7 +4851,6 @@ EXPORT_SYMBOL_GPL(ata_tf_to_fis); | |||
| 4873 | EXPORT_SYMBOL_GPL(ata_tf_from_fis); | 4851 | EXPORT_SYMBOL_GPL(ata_tf_from_fis); |
| 4874 | EXPORT_SYMBOL_GPL(ata_check_status); | 4852 | EXPORT_SYMBOL_GPL(ata_check_status); |
| 4875 | EXPORT_SYMBOL_GPL(ata_altstatus); | 4853 | EXPORT_SYMBOL_GPL(ata_altstatus); |
| 4876 | EXPORT_SYMBOL_GPL(ata_chk_err); | ||
| 4877 | EXPORT_SYMBOL_GPL(ata_exec_command); | 4854 | EXPORT_SYMBOL_GPL(ata_exec_command); |
| 4878 | EXPORT_SYMBOL_GPL(ata_port_start); | 4855 | EXPORT_SYMBOL_GPL(ata_port_start); |
| 4879 | EXPORT_SYMBOL_GPL(ata_port_stop); | 4856 | EXPORT_SYMBOL_GPL(ata_port_stop); |
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 422e0b6f603a..dcef5fe8600b 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
| @@ -258,7 +258,6 @@ struct mv_host_priv { | |||
| 258 | static void mv_irq_clear(struct ata_port *ap); | 258 | static void mv_irq_clear(struct ata_port *ap); |
| 259 | static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in); | 259 | static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in); |
| 260 | static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); | 260 | static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); |
| 261 | static u8 mv_check_err(struct ata_port *ap); | ||
| 262 | static void mv_phy_reset(struct ata_port *ap); | 261 | static void mv_phy_reset(struct ata_port *ap); |
| 263 | static void mv_host_stop(struct ata_host_set *host_set); | 262 | static void mv_host_stop(struct ata_host_set *host_set); |
| 264 | static int mv_port_start(struct ata_port *ap); | 263 | static int mv_port_start(struct ata_port *ap); |
| @@ -296,7 +295,6 @@ static const struct ata_port_operations mv_ops = { | |||
| 296 | .tf_load = ata_tf_load, | 295 | .tf_load = ata_tf_load, |
| 297 | .tf_read = ata_tf_read, | 296 | .tf_read = ata_tf_read, |
| 298 | .check_status = ata_check_status, | 297 | .check_status = ata_check_status, |
| 299 | .check_err = mv_check_err, | ||
| 300 | .exec_command = ata_exec_command, | 298 | .exec_command = ata_exec_command, |
| 301 | .dev_select = ata_std_dev_select, | 299 | .dev_select = ata_std_dev_select, |
| 302 | 300 | ||
| @@ -1185,22 +1183,6 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, | |||
| 1185 | } | 1183 | } |
| 1186 | 1184 | ||
| 1187 | /** | 1185 | /** |
| 1188 | * mv_check_err - Return the error shadow register to caller. | ||
| 1189 | * @ap: ATA channel to manipulate | ||
| 1190 | * | ||
| 1191 | * Marvell requires DMA to be stopped before accessing shadow | ||
| 1192 | * registers. So we do that, then return the needed register. | ||
| 1193 | * | ||
| 1194 | * LOCKING: | ||
| 1195 | * Inherited from caller. FIXME: protect mv_stop_dma with lock? | ||
| 1196 | */ | ||
| 1197 | static u8 mv_check_err(struct ata_port *ap) | ||
| 1198 | { | ||
| 1199 | mv_stop_dma(ap); /* can't read shadow regs if DMA on */ | ||
| 1200 | return readb((void __iomem *) ap->ioaddr.error_addr); | ||
| 1201 | } | ||
| 1202 | |||
| 1203 | /** | ||
| 1204 | * mv_phy_reset - Perform eDMA reset followed by COMRESET | 1186 | * mv_phy_reset - Perform eDMA reset followed by COMRESET |
| 1205 | * @ap: ATA channel to manipulate | 1187 | * @ap: ATA channel to manipulate |
| 1206 | * | 1188 | * |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index 51855d3bac64..e18a1e2bb65e 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
| @@ -225,7 +225,6 @@ struct sil24_host_priv { | |||
| 225 | }; | 225 | }; |
| 226 | 226 | ||
| 227 | static u8 sil24_check_status(struct ata_port *ap); | 227 | static u8 sil24_check_status(struct ata_port *ap); |
| 228 | static u8 sil24_check_err(struct ata_port *ap); | ||
| 229 | static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg); | 228 | static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg); |
| 230 | static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); | 229 | static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); |
| 231 | static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | 230 | static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf); |
| @@ -280,7 +279,6 @@ static const struct ata_port_operations sil24_ops = { | |||
| 280 | 279 | ||
| 281 | .check_status = sil24_check_status, | 280 | .check_status = sil24_check_status, |
| 282 | .check_altstatus = sil24_check_status, | 281 | .check_altstatus = sil24_check_status, |
| 283 | .check_err = sil24_check_err, | ||
| 284 | .dev_select = ata_noop_dev_select, | 282 | .dev_select = ata_noop_dev_select, |
| 285 | 283 | ||
| 286 | .tf_read = sil24_tf_read, | 284 | .tf_read = sil24_tf_read, |
| @@ -363,12 +361,6 @@ static u8 sil24_check_status(struct ata_port *ap) | |||
| 363 | return pp->tf.command; | 361 | return pp->tf.command; |
| 364 | } | 362 | } |
| 365 | 363 | ||
| 366 | static u8 sil24_check_err(struct ata_port *ap) | ||
| 367 | { | ||
| 368 | struct sil24_port_priv *pp = ap->private_data; | ||
| 369 | return pp->tf.feature; | ||
| 370 | } | ||
| 371 | |||
| 372 | static int sil24_scr_map[] = { | 364 | static int sil24_scr_map[] = { |
| 373 | [SCR_CONTROL] = 0, | 365 | [SCR_CONTROL] = 0, |
| 374 | [SCR_STATUS] = 1, | 366 | [SCR_STATUS] = 1, |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 00a8a5738858..a4cce9936a80 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -347,7 +347,6 @@ struct ata_port_operations { | |||
| 347 | void (*exec_command)(struct ata_port *ap, const struct ata_taskfile *tf); | 347 | void (*exec_command)(struct ata_port *ap, const struct ata_taskfile *tf); |
| 348 | u8 (*check_status)(struct ata_port *ap); | 348 | u8 (*check_status)(struct ata_port *ap); |
| 349 | u8 (*check_altstatus)(struct ata_port *ap); | 349 | u8 (*check_altstatus)(struct ata_port *ap); |
| 350 | u8 (*check_err)(struct ata_port *ap); | ||
| 351 | void (*dev_select)(struct ata_port *ap, unsigned int device); | 350 | void (*dev_select)(struct ata_port *ap, unsigned int device); |
| 352 | 351 | ||
| 353 | void (*phy_reset) (struct ata_port *ap); | 352 | void (*phy_reset) (struct ata_port *ap); |
| @@ -434,7 +433,6 @@ extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device); | |||
| 434 | extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); | 433 | extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); |
| 435 | extern u8 ata_check_status(struct ata_port *ap); | 434 | extern u8 ata_check_status(struct ata_port *ap); |
| 436 | extern u8 ata_altstatus(struct ata_port *ap); | 435 | extern u8 ata_altstatus(struct ata_port *ap); |
| 437 | extern u8 ata_chk_err(struct ata_port *ap); | ||
| 438 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); | 436 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); |
| 439 | extern int ata_port_start (struct ata_port *ap); | 437 | extern int ata_port_start (struct ata_port *ap); |
| 440 | extern void ata_port_stop (struct ata_port *ap); | 438 | extern void ata_port_stop (struct ata_port *ap); |
