diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-30 01:58:18 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-30 01:58:18 -0500 |
commit | f0612bbc41f65f5a684f69d714a1a17a6f0f40c5 (patch) | |
tree | 8c070070bb355843cfa4635643e9da7c2c4cd44a /drivers/scsi/libata-core.c | |
parent | b0c4e148bd591629749d02a8fbc8d81c26d548cf (diff) | |
parent | 81cfb8864c73230eb1c37753aba517db15cf4d8f (diff) |
Merge branch 'upstream'
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 46 |
1 files changed, 11 insertions, 35 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 3171e386f706..0d58f4d3e5ce 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/suspend.h> | 49 | #include <linux/suspend.h> |
50 | #include <linux/workqueue.h> | 50 | #include <linux/workqueue.h> |
51 | #include <linux/jiffies.h> | 51 | #include <linux/jiffies.h> |
52 | #include <linux/scatterlist.h> | ||
52 | #include <scsi/scsi.h> | 53 | #include <scsi/scsi.h> |
53 | #include "scsi.h" | 54 | #include "scsi.h" |
54 | #include "scsi_priv.h" | 55 | #include "scsi_priv.h" |
@@ -371,7 +372,7 @@ static void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf) | |||
371 | struct ata_ioports *ioaddr = &ap->ioaddr; | 372 | struct ata_ioports *ioaddr = &ap->ioaddr; |
372 | 373 | ||
373 | tf->command = ata_check_status(ap); | 374 | tf->command = ata_check_status(ap); |
374 | tf->feature = ata_chk_err(ap); | 375 | tf->feature = inb(ioaddr->error_addr); |
375 | tf->nsect = inb(ioaddr->nsect_addr); | 376 | tf->nsect = inb(ioaddr->nsect_addr); |
376 | tf->lbal = inb(ioaddr->lbal_addr); | 377 | tf->lbal = inb(ioaddr->lbal_addr); |
377 | tf->lbam = inb(ioaddr->lbam_addr); | 378 | tf->lbam = inb(ioaddr->lbam_addr); |
@@ -405,7 +406,7 @@ static void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf) | |||
405 | struct ata_ioports *ioaddr = &ap->ioaddr; | 406 | struct ata_ioports *ioaddr = &ap->ioaddr; |
406 | 407 | ||
407 | tf->command = ata_check_status(ap); | 408 | tf->command = ata_check_status(ap); |
408 | tf->feature = ata_chk_err(ap); | 409 | tf->feature = readb((void __iomem *)ioaddr->error_addr); |
409 | tf->nsect = readb((void __iomem *)ioaddr->nsect_addr); | 410 | tf->nsect = readb((void __iomem *)ioaddr->nsect_addr); |
410 | tf->lbal = readb((void __iomem *)ioaddr->lbal_addr); | 411 | tf->lbal = readb((void __iomem *)ioaddr->lbal_addr); |
411 | tf->lbam = readb((void __iomem *)ioaddr->lbam_addr); | 412 | tf->lbam = readb((void __iomem *)ioaddr->lbam_addr); |
@@ -526,30 +527,6 @@ u8 ata_altstatus(struct ata_port *ap) | |||
526 | 527 | ||
527 | 528 | ||
528 | /** | 529 | /** |
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 | 530 | * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure |
554 | * @tf: Taskfile to convert | 531 | * @tf: Taskfile to convert |
555 | * @fis: Buffer into which data will output | 532 | * @fis: Buffer into which data will output |
@@ -901,8 +878,8 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device) | |||
901 | 878 | ||
902 | memset(&tf, 0, sizeof(tf)); | 879 | memset(&tf, 0, sizeof(tf)); |
903 | 880 | ||
904 | err = ata_chk_err(ap); | ||
905 | ap->ops->tf_read(ap, &tf); | 881 | ap->ops->tf_read(ap, &tf); |
882 | err = tf.feature; | ||
906 | 883 | ||
907 | dev->class = ATA_DEV_NONE; | 884 | dev->class = ATA_DEV_NONE; |
908 | 885 | ||
@@ -1139,7 +1116,6 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device) | |||
1139 | unsigned int major_version; | 1116 | unsigned int major_version; |
1140 | u16 tmp; | 1117 | u16 tmp; |
1141 | unsigned long xfer_modes; | 1118 | unsigned long xfer_modes; |
1142 | u8 status; | ||
1143 | unsigned int using_edd; | 1119 | unsigned int using_edd; |
1144 | DECLARE_COMPLETION(wait); | 1120 | DECLARE_COMPLETION(wait); |
1145 | struct ata_queued_cmd *qc; | 1121 | struct ata_queued_cmd *qc; |
@@ -1193,8 +1169,11 @@ retry: | |||
1193 | else | 1169 | else |
1194 | wait_for_completion(&wait); | 1170 | wait_for_completion(&wait); |
1195 | 1171 | ||
1196 | status = ata_chk_status(ap); | 1172 | spin_lock_irqsave(&ap->host_set->lock, flags); |
1197 | if (status & ATA_ERR) { | 1173 | ap->ops->tf_read(ap, &qc->tf); |
1174 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
1175 | |||
1176 | if (qc->tf.command & ATA_ERR) { | ||
1198 | /* | 1177 | /* |
1199 | * arg! EDD works for all test cases, but seems to return | 1178 | * arg! EDD works for all test cases, but seems to return |
1200 | * the ATA signature for some ATAPI devices. Until the | 1179 | * the ATA signature for some ATAPI devices. Until the |
@@ -1207,7 +1186,7 @@ retry: | |||
1207 | * to have this problem. | 1186 | * to have this problem. |
1208 | */ | 1187 | */ |
1209 | if ((using_edd) && (qc->tf.command == ATA_CMD_ID_ATA)) { | 1188 | if ((using_edd) && (qc->tf.command == ATA_CMD_ID_ATA)) { |
1210 | u8 err = ata_chk_err(ap); | 1189 | u8 err = qc->tf.feature; |
1211 | if (err & ATA_ABORTED) { | 1190 | if (err & ATA_ABORTED) { |
1212 | dev->class = ATA_DEV_ATAPI; | 1191 | dev->class = ATA_DEV_ATAPI; |
1213 | qc->cursg = 0; | 1192 | qc->cursg = 0; |
@@ -2609,9 +2588,7 @@ void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen) | |||
2609 | qc->buf_virt = buf; | 2588 | qc->buf_virt = buf; |
2610 | 2589 | ||
2611 | sg = qc->__sg; | 2590 | sg = qc->__sg; |
2612 | sg->page = virt_to_page(buf); | 2591 | sg_init_one(sg, buf, buflen); |
2613 | sg->offset = (unsigned long) buf & ~PAGE_MASK; | ||
2614 | sg->length = buflen; | ||
2615 | } | 2592 | } |
2616 | 2593 | ||
2617 | /** | 2594 | /** |
@@ -4962,7 +4939,6 @@ EXPORT_SYMBOL_GPL(ata_tf_to_fis); | |||
4962 | EXPORT_SYMBOL_GPL(ata_tf_from_fis); | 4939 | EXPORT_SYMBOL_GPL(ata_tf_from_fis); |
4963 | EXPORT_SYMBOL_GPL(ata_check_status); | 4940 | EXPORT_SYMBOL_GPL(ata_check_status); |
4964 | EXPORT_SYMBOL_GPL(ata_altstatus); | 4941 | EXPORT_SYMBOL_GPL(ata_altstatus); |
4965 | EXPORT_SYMBOL_GPL(ata_chk_err); | ||
4966 | EXPORT_SYMBOL_GPL(ata_exec_command); | 4942 | EXPORT_SYMBOL_GPL(ata_exec_command); |
4967 | EXPORT_SYMBOL_GPL(ata_port_start); | 4943 | EXPORT_SYMBOL_GPL(ata_port_start); |
4968 | EXPORT_SYMBOL_GPL(ata_port_stop); | 4944 | EXPORT_SYMBOL_GPL(ata_port_stop); |