diff options
Diffstat (limited to 'drivers/scsi/ahci.c')
-rw-r--r-- | drivers/scsi/ahci.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 4e96ec5f2ff9..894e7113e0b3 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -565,6 +565,17 @@ static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) | |||
565 | u32 tmp; | 565 | u32 tmp; |
566 | int work; | 566 | int work; |
567 | 567 | ||
568 | printk(KERN_WARNING "ata%u: port reset, " | ||
569 | "p_is %x is %x pis %x cmd %x tf %x ss %x se %x\n", | ||
570 | ap->id, | ||
571 | irq_stat, | ||
572 | readl(mmio + HOST_IRQ_STAT), | ||
573 | readl(port_mmio + PORT_IRQ_STAT), | ||
574 | readl(port_mmio + PORT_CMD), | ||
575 | readl(port_mmio + PORT_TFDATA), | ||
576 | readl(port_mmio + PORT_SCR_STAT), | ||
577 | readl(port_mmio + PORT_SCR_ERR)); | ||
578 | |||
568 | /* stop DMA */ | 579 | /* stop DMA */ |
569 | tmp = readl(port_mmio + PORT_CMD); | 580 | tmp = readl(port_mmio + PORT_CMD); |
570 | tmp &= ~PORT_CMD_START; | 581 | tmp &= ~PORT_CMD_START; |
@@ -602,8 +613,6 @@ static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) | |||
602 | tmp |= PORT_CMD_START; | 613 | tmp |= PORT_CMD_START; |
603 | writel(tmp, port_mmio + PORT_CMD); | 614 | writel(tmp, port_mmio + PORT_CMD); |
604 | readl(port_mmio + PORT_CMD); /* flush */ | 615 | readl(port_mmio + PORT_CMD); /* flush */ |
605 | |||
606 | printk(KERN_WARNING "ata%u: error occurred, port reset\n", ap->id); | ||
607 | } | 616 | } |
608 | 617 | ||
609 | static void ahci_eng_timeout(struct ata_port *ap) | 618 | static void ahci_eng_timeout(struct ata_port *ap) |
@@ -614,17 +623,17 @@ static void ahci_eng_timeout(struct ata_port *ap) | |||
614 | struct ata_queued_cmd *qc; | 623 | struct ata_queued_cmd *qc; |
615 | unsigned long flags; | 624 | unsigned long flags; |
616 | 625 | ||
617 | DPRINTK("ENTER\n"); | 626 | printk(KERN_WARNING "ata%u: handling error/timeout\n", ap->id); |
618 | 627 | ||
619 | spin_lock_irqsave(&host_set->lock, flags); | 628 | spin_lock_irqsave(&host_set->lock, flags); |
620 | 629 | ||
621 | ahci_intr_error(ap, readl(port_mmio + PORT_IRQ_STAT)); | ||
622 | |||
623 | qc = ata_qc_from_tag(ap, ap->active_tag); | 630 | qc = ata_qc_from_tag(ap, ap->active_tag); |
624 | if (!qc) { | 631 | if (!qc) { |
625 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", | 632 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", |
626 | ap->id); | 633 | ap->id); |
627 | } else { | 634 | } else { |
635 | ahci_intr_error(ap, readl(port_mmio + PORT_IRQ_STAT)); | ||
636 | |||
628 | /* hack alert! We cannot use the supplied completion | 637 | /* hack alert! We cannot use the supplied completion |
629 | * function from inside the ->eh_strategy_handler() thread. | 638 | * function from inside the ->eh_strategy_handler() thread. |
630 | * libata is the only user of ->eh_strategy_handler() in | 639 | * libata is the only user of ->eh_strategy_handler() in |
@@ -659,9 +668,19 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
659 | } | 668 | } |
660 | 669 | ||
661 | if (status & PORT_IRQ_FATAL) { | 670 | if (status & PORT_IRQ_FATAL) { |
671 | unsigned int err_mask; | ||
672 | if (status & PORT_IRQ_TF_ERR) | ||
673 | err_mask = AC_ERR_DEV; | ||
674 | else if (status & PORT_IRQ_IF_ERR) | ||
675 | err_mask = AC_ERR_ATA_BUS; | ||
676 | else | ||
677 | err_mask = AC_ERR_HOST_BUS; | ||
678 | |||
679 | /* command processing has stopped due to error; restart */ | ||
662 | ahci_intr_error(ap, status); | 680 | ahci_intr_error(ap, status); |
681 | |||
663 | if (qc) | 682 | if (qc) |
664 | ata_qc_complete(qc, AC_ERR_OTHER); | 683 | ata_qc_complete(qc, err_mask); |
665 | } | 684 | } |
666 | 685 | ||
667 | return 1; | 686 | return 1; |