Commit 41669553 authored by Tejun Heo's avatar Tejun Heo

[PATCH] ahci: ignore PORT_IRQ_IF_ERR on JMB controllers

JMicron AHCI controllers set PORT_IRQ_IF_ERR on device errors.  The
IRQ status bit indicates interface error or protocol mismatch and ahci
driver interprets it into AC_ERR_ATA_BUS.  So, whenever an ATAPI
device raises check condition, ahci interprets it as ATA bus error and
thus resets it which, in turn, raises check condition thus creating a
reset loop and rendering the device unuseable.

This patch makes JMB controllers ignore PORT_IRQ_IF_ERR when
interpreting error condition.
Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
Cc: Justin Tsai <justin@jmicron.com>
parent 08475a19
...@@ -78,6 +78,7 @@ enum { ...@@ -78,6 +78,7 @@ enum {
board_ahci = 0, board_ahci = 0,
board_ahci_vt8251 = 1, board_ahci_vt8251 = 1,
board_ahci_ign_iferr = 2,
/* global controller registers */ /* global controller registers */
HOST_CAP = 0x00, /* host capabilities */ HOST_CAP = 0x00, /* host capabilities */
...@@ -168,6 +169,7 @@ enum { ...@@ -168,6 +169,7 @@ enum {
/* ap->flags bits */ /* ap->flags bits */
AHCI_FLAG_RESET_NEEDS_CLO = (1 << 24), AHCI_FLAG_RESET_NEEDS_CLO = (1 << 24),
AHCI_FLAG_NO_NCQ = (1 << 25), AHCI_FLAG_NO_NCQ = (1 << 25),
AHCI_FLAG_IGN_IRQ_IF_ERR = (1 << 26), /* ignore IRQ_IF_ERR */
}; };
struct ahci_cmd_hdr { struct ahci_cmd_hdr {
...@@ -295,6 +297,17 @@ static const struct ata_port_info ahci_port_info[] = { ...@@ -295,6 +297,17 @@ static const struct ata_port_info ahci_port_info[] = {
.udma_mask = 0x7f, /* udma0-6 ; FIXME */ .udma_mask = 0x7f, /* udma0-6 ; FIXME */
.port_ops = &ahci_ops, .port_ops = &ahci_ops,
}, },
/* board_ahci_ign_iferr */
{
.sht = &ahci_sht,
.flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
ATA_FLAG_SKIP_D2H_BSY |
AHCI_FLAG_IGN_IRQ_IF_ERR,
.pio_mask = 0x1f, /* pio0-4 */
.udma_mask = 0x7f, /* udma0-6 ; FIXME */
.port_ops = &ahci_ops,
},
}; };
static const struct pci_device_id ahci_pci_tbl[] = { static const struct pci_device_id ahci_pci_tbl[] = {
...@@ -327,11 +340,11 @@ static const struct pci_device_id ahci_pci_tbl[] = { ...@@ -327,11 +340,11 @@ static const struct pci_device_id ahci_pci_tbl[] = {
{ PCI_VDEVICE(INTEL, 0x294e), board_ahci }, /* ICH9M */ { PCI_VDEVICE(INTEL, 0x294e), board_ahci }, /* ICH9M */
/* JMicron */ /* JMicron */
{ PCI_VDEVICE(JMICRON, 0x2360), board_ahci }, /* JMicron JMB360 */ { PCI_VDEVICE(JMICRON, 0x2360), board_ahci_ign_iferr }, /* JMB360 */
{ PCI_VDEVICE(JMICRON, 0x2361), board_ahci }, /* JMicron JMB361 */ { PCI_VDEVICE(JMICRON, 0x2361), board_ahci_ign_iferr }, /* JMB361 */
{ PCI_VDEVICE(JMICRON, 0x2363), board_ahci }, /* JMicron JMB363 */ { PCI_VDEVICE(JMICRON, 0x2363), board_ahci_ign_iferr }, /* JMB363 */
{ PCI_VDEVICE(JMICRON, 0x2365), board_ahci }, /* JMicron JMB365 */ { PCI_VDEVICE(JMICRON, 0x2365), board_ahci_ign_iferr }, /* JMB365 */
{ PCI_VDEVICE(JMICRON, 0x2366), board_ahci }, /* JMicron JMB366 */ { PCI_VDEVICE(JMICRON, 0x2366), board_ahci_ign_iferr }, /* JMB366 */
/* ATI */ /* ATI */
{ PCI_VDEVICE(ATI, 0x4380), board_ahci }, /* ATI SB600 non-raid */ { PCI_VDEVICE(ATI, 0x4380), board_ahci }, /* ATI SB600 non-raid */
...@@ -980,6 +993,10 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) ...@@ -980,6 +993,10 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
/* analyze @irq_stat */ /* analyze @irq_stat */
ata_ehi_push_desc(ehi, "irq_stat 0x%08x", irq_stat); ata_ehi_push_desc(ehi, "irq_stat 0x%08x", irq_stat);
/* some controllers set IRQ_IF_ERR on device errors, ignore it */
if (ap->flags & AHCI_FLAG_IGN_IRQ_IF_ERR)
irq_stat &= ~PORT_IRQ_IF_ERR;
if (irq_stat & PORT_IRQ_TF_ERR) if (irq_stat & PORT_IRQ_TF_ERR)
err_mask |= AC_ERR_DEV; err_mask |= AC_ERR_DEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment