fix too short span of sil24_issue_SRST() loop to reset non-native hard drives
PATCH 1/1 fix too short span of sil24_issue_SRST() loop to reset non-native hard drives
Hi,
I use the ASI ARAID99 2000 connected with Sil3124 pci card.
However, the Linux driver (sata_sil24.c) cannot finish phy_reset. The dmesg is displayed as follows:
========
ata1: SRST failed, disabling port
========
and ...
========sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0sata_sil24: interrupt form disabled port 0
irq XX: nobody cared (try booting with the "irqpoll" option)
========
This problem is fixed by this patch; the span of loop
in sil24_issue_SRST() is too short to reset non-native hard drive like my RAID subsystem.
*** drivers/scsi/sata_sil24.c._orig_ 2006-03-02 07:37:27.000000000 +0900
--- drivers/scsi/sata_sil24.c 2006-03-05 21:22:44.000000000 +0900
***************
*** 452,458 ****
writel((u32)paddr, port + PORT_CMD_ACTIVATE);
! for (cnt = 0; cnt < 100; cnt++) {
irq_stat = readl(port + PORT_IRQ_STAT);
writel(irq_stat, port + PORT_IRQ_STAT); /* clear irq */
--- 493,499 ----
writel((u32)paddr, port + PORT_CMD_ACTIVATE);
! for (cnt = 0; cnt < 1000; cnt++) {
irq_stat = readl(port + PORT_IRQ_STAT);
writel(irq_stat, port + PORT_IRQ_STAT); /* clear irq */
***************
*** 460,466 ****
if (irq_stat & (PORT_IRQ_COMPLETE | PORT_IRQ_ERROR))
break;
! msleep(1);
}
/* restore IRQs */
--- 501,507 ----
if (irq_stat & (PORT_IRQ_COMPLETE | PORT_IRQ_ERROR))
break;
! msleep(10);
}
/* restore IRQs */
== Chisato Yamauchi =================================
PATCH 1/1 sata_sil24: lengthen softreset timeout
sil24 softreset timeout was > 100ms (100 loops with msleep(1)), which turned out to be too short for some devices (ASI ARAID99 2000). This patch converts sil24 softreset waiting loop to use proper timeout condition and lengthen the timeout to 5 secs and check interval to 100ms. Chisato Yamauchi discovered the problem and supplied initial patch.
---
Jeff, this patch is against the current #linus-git. This doesn't really count as regression but I think this should go upstream ASAP. However, if that's not an option, this patch also applies to #upstream with some offsets.
Chisato, thanks a lot for spotting it and sending fix. :-)
drivers/scsi/sata_sil24.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/sata_sil24.c +4 -4
@@ -433,8 +433,8 @@ static int sil24_issue_SRST(struct ata_pstruct sil24_port_priv *pp = ap->private_data;struct sil24_prb *prb = &pp->cmd_block[0 ].ata.prb;dma_addr_t paddr = pp->cmd_block_dma; +unsigned long timeout = jiffies +5 *HZ ;u32 irq_enable, irq_stat; -int cnt;/* temporarily turn off IRQs during SRST */ irq_enable =readl (port +PORT_IRQ_ENABLE_SET );
@@ -451,7 +451,7 @@ static int sil24_issue_SRST(struct ata_pwritel ((u32 )paddr, port +PORT_CMD_ACTIVATE ); -for (cnt =0 ; cnt <100 ; cnt++) { + do { irq_stat = readl(port + PORT_IRQ_STAT); writel(irq_stat, port + PORT_IRQ_STAT); /* clear irq */
@@ -459,8 +459,8 @@ static int sil24_issue_SRST(struct ata_pif (irq_stat & (PORT_IRQ_COMPLETE |PORT_IRQ_ERROR ))break ; -msleep (1 ); - } +msleep (100 ); + }while (time_before (jiffies, timeout));/* restore IRQs */ writel (irq_enable, port +PORT_IRQ_ENABLE_SET );
Re: [PATCH] sata_sil24: lengthen softreset timeout
Hi, Tejun
Your patch also works fine with my ARAID99!
Thanks!!
Quoted 34 lines
Jeff, this patch is against the current #linus-git. This doesn't really count as regression but I think this should go upstream ASAP. However, if that's not an option, this patch also applies to #upstream with some offsets.
Chisato, thanks a lot for spotting it and sending fix. :-)
drivers/scsi/sata_sil24.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/scsi/sata_sil24.c +2
-2@@ -433,8 +433,8 @@ static int sil24_issue_SRST(struct ata_pstruct sil24_port_priv *pp = ap->private_data;struct sil24_prb *prb = &pp->cmd_block[0 ].ata.prb;dma_addr_t paddr = pp->cmd_block_dma; +unsigned long timeout = jiffies +5 *HZ ;u32 irq_enable, irq_stat; -int cnt;/* temporarily turn off IRQs during SRST */ irq_enable =readl (port +PORT_IRQ_ENABLE_SET );@@ -451,7 +451,7 @@ static int sil24_issue_SRST(struct ata_pwritel ((u32 )paddr, port +PORT_CMD_ACTIVATE ); -for (cnt =0 ; cnt <100 ; cnt++) { + do { irq_stat = readl(port + PORT_IRQ_STAT); writel(irq_stat, port + PORT_IRQ_STAT); /* clear irq */
drivers/scsi/sata_sil24.c static int sil24_issue_SRST(struct ata_p · line 466
Quoted 10 lines
drivers/scsi/sata_sil24.c +2
-2@@ -459,8 +459,8 @@ static int sil24_issue_SRST(struct ata_pif (irq_stat & (PORT_IRQ_COMPLETE |PORT_IRQ_ERROR ))break ; -msleep (1 ); - } +msleep (100 ); + }while (time_before (jiffies, timeout));/* restore IRQs */ writel (irq_enable, port +PORT_IRQ_ENABLE_SET );
== Chisato Yamauchi =================================