aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ahci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ahci.c')
-rw-r--r--drivers/scsi/ahci.c55
1 files changed, 23 insertions, 32 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index fe8187d6f58b..e2a5657d5fdb 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -41,6 +41,7 @@
41#include <linux/interrupt.h> 41#include <linux/interrupt.h>
42#include <linux/sched.h> 42#include <linux/sched.h>
43#include <linux/dma-mapping.h> 43#include <linux/dma-mapping.h>
44#include <linux/device.h>
44#include "scsi.h" 45#include "scsi.h"
45#include <scsi/scsi_host.h> 46#include <scsi/scsi_host.h>
46#include <linux/libata.h> 47#include <linux/libata.h>
@@ -192,7 +193,6 @@ static void ahci_port_stop(struct ata_port *ap);
192static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf); 193static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
193static void ahci_qc_prep(struct ata_queued_cmd *qc); 194static void ahci_qc_prep(struct ata_queued_cmd *qc);
194static u8 ahci_check_status(struct ata_port *ap); 195static u8 ahci_check_status(struct ata_port *ap);
195static u8 ahci_check_err(struct ata_port *ap);
196static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 196static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
197static void ahci_remove_one (struct pci_dev *pdev); 197static void ahci_remove_one (struct pci_dev *pdev);
198 198
@@ -221,7 +221,6 @@ static const struct ata_port_operations ahci_ops = {
221 221
222 .check_status = ahci_check_status, 222 .check_status = ahci_check_status,
223 .check_altstatus = ahci_check_status, 223 .check_altstatus = ahci_check_status,
224 .check_err = ahci_check_err,
225 .dev_select = ata_noop_dev_select, 224 .dev_select = ata_noop_dev_select,
226 225
227 .tf_read = ahci_tf_read, 226 .tf_read = ahci_tf_read,
@@ -458,13 +457,6 @@ static u8 ahci_check_status(struct ata_port *ap)
458 return readl(mmio + PORT_TFDATA) & 0xFF; 457 return readl(mmio + PORT_TFDATA) & 0xFF;
459} 458}
460 459
461static 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
468static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf) 460static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
469{ 461{
470 struct ahci_port_priv *pp = ap->private_data; 462 struct ahci_port_priv *pp = ap->private_data;
@@ -609,7 +601,7 @@ static void ahci_eng_timeout(struct ata_port *ap)
609 * not being called from the SCSI EH. 601 * not being called from the SCSI EH.
610 */ 602 */
611 qc->scsidone = scsi_finish_command; 603 qc->scsidone = scsi_finish_command;
612 ata_qc_complete(qc, ATA_ERR); 604 ata_qc_complete(qc, AC_ERR_OTHER);
613 } 605 }
614 606
615 spin_unlock_irqrestore(&host_set->lock, flags); 607 spin_unlock_irqrestore(&host_set->lock, flags);
@@ -638,7 +630,7 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
638 if (status & PORT_IRQ_FATAL) { 630 if (status & PORT_IRQ_FATAL) {
639 ahci_intr_error(ap, status); 631 ahci_intr_error(ap, status);
640 if (qc) 632 if (qc)
641 ata_qc_complete(qc, ATA_ERR); 633 ata_qc_complete(qc, AC_ERR_OTHER);
642 } 634 }
643 635
644 return 1; 636 return 1;
@@ -683,10 +675,10 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *
683 if (!ahci_host_intr(ap, qc)) 675 if (!ahci_host_intr(ap, qc))
684 if (ata_ratelimit()) { 676 if (ata_ratelimit()) {
685 struct pci_dev *pdev = 677 struct pci_dev *pdev =
686 to_pci_dev(ap->host_set->dev); 678 to_pci_dev(ap->host_set->dev);
687 printk(KERN_WARNING 679 dev_printk(KERN_WARNING, &pdev->dev,
688 "ahci(%s): unhandled interrupt on port %u\n", 680 "unhandled interrupt on port %u\n",
689 pci_name(pdev), i); 681 i);
690 } 682 }
691 683
692 VPRINTK("port %u\n", i); 684 VPRINTK("port %u\n", i);
@@ -694,10 +686,9 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *
694 VPRINTK("port %u (no irq)\n", i); 686 VPRINTK("port %u (no irq)\n", i);
695 if (ata_ratelimit()) { 687 if (ata_ratelimit()) {
696 struct pci_dev *pdev = 688 struct pci_dev *pdev =
697 to_pci_dev(ap->host_set->dev); 689 to_pci_dev(ap->host_set->dev);
698 printk(KERN_WARNING 690 dev_printk(KERN_WARNING, &pdev->dev,
699 "ahci(%s): interrupt on disabled port %u\n", 691 "interrupt on disabled port %u\n", i);
700 pci_name(pdev), i);
701 } 692 }
702 } 693 }
703 694
@@ -769,8 +760,8 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent)
769 760
770 tmp = readl(mmio + HOST_CTL); 761 tmp = readl(mmio + HOST_CTL);
771 if (tmp & HOST_RESET) { 762 if (tmp & HOST_RESET) {
772 printk(KERN_ERR DRV_NAME "(%s): controller reset failed (0x%x)\n", 763 dev_printk(KERN_ERR, &pdev->dev,
773 pci_name(pdev), tmp); 764 "controller reset failed (0x%x)\n", tmp);
774 return -EIO; 765 return -EIO;
775 } 766 }
776 767
@@ -798,22 +789,22 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent)
798 if (rc) { 789 if (rc) {
799 rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); 790 rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
800 if (rc) { 791 if (rc) {
801 printk(KERN_ERR DRV_NAME "(%s): 64-bit DMA enable failed\n", 792 dev_printk(KERN_ERR, &pdev->dev,
802 pci_name(pdev)); 793 "64-bit DMA enable failed\n");
803 return rc; 794 return rc;
804 } 795 }
805 } 796 }
806 } else { 797 } else {
807 rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); 798 rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
808 if (rc) { 799 if (rc) {
809 printk(KERN_ERR DRV_NAME "(%s): 32-bit DMA enable failed\n", 800 dev_printk(KERN_ERR, &pdev->dev,
810 pci_name(pdev)); 801 "32-bit DMA enable failed\n");
811 return rc; 802 return rc;
812 } 803 }
813 rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); 804 rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
814 if (rc) { 805 if (rc) {
815 printk(KERN_ERR DRV_NAME "(%s): 32-bit consistent DMA enable failed\n", 806 dev_printk(KERN_ERR, &pdev->dev,
816 pci_name(pdev)); 807 "32-bit consistent DMA enable failed\n");
817 return rc; 808 return rc;
818 } 809 }
819 } 810 }
@@ -916,10 +907,10 @@ static void ahci_print_info(struct ata_probe_ent *probe_ent)
916 else 907 else
917 scc_s = "unknown"; 908 scc_s = "unknown";
918 909
919 printk(KERN_INFO DRV_NAME "(%s) AHCI %02x%02x.%02x%02x " 910 dev_printk(KERN_INFO, &pdev->dev,
911 "AHCI %02x%02x.%02x%02x "
920 "%u slots %u ports %s Gbps 0x%x impl %s mode\n" 912 "%u slots %u ports %s Gbps 0x%x impl %s mode\n"
921 , 913 ,
922 pci_name(pdev),
923 914
924 (vers >> 24) & 0xff, 915 (vers >> 24) & 0xff,
925 (vers >> 16) & 0xff, 916 (vers >> 16) & 0xff,
@@ -932,11 +923,11 @@ static void ahci_print_info(struct ata_probe_ent *probe_ent)
932 impl, 923 impl,
933 scc_s); 924 scc_s);
934 925
935 printk(KERN_INFO DRV_NAME "(%s) flags: " 926 dev_printk(KERN_INFO, &pdev->dev,
927 "flags: "
936 "%s%s%s%s%s%s" 928 "%s%s%s%s%s%s"
937 "%s%s%s%s%s%s%s\n" 929 "%s%s%s%s%s%s%s\n"
938 , 930 ,
939 pci_name(pdev),
940 931
941 cap & (1 << 31) ? "64bit " : "", 932 cap & (1 << 31) ? "64bit " : "",
942 cap & (1 << 30) ? "ncq " : "", 933 cap & (1 << 30) ? "ncq " : "",
@@ -969,7 +960,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
969 VPRINTK("ENTER\n"); 960 VPRINTK("ENTER\n");
970 961
971 if (!printed_version++) 962 if (!printed_version++)
972 printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); 963 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
973 964
974 rc = pci_enable_device(pdev); 965 rc = pci_enable_device(pdev);
975 if (rc) 966 if (rc)