Subject: Re: PCI plug-in card interrupts in a CS20?
To: None <port-alpha@NetBSD.org>
From: Havard Eidnes <he@uninett.no>
List: port-alpha
Date: 11/09/2004 16:34:30
----Next_Part(Tue_Nov__9_16:34:30_2004_916)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hmm...
some more thinking led me to come to think of the bus_space_barrier()
function and that it might be required between the two bus_space_read_2
calls in quick succession in isp_pci_rd_debounced(). So, modifying the
diff as shown below moved the problem to somewhere else...
I now got, while trying:
kveite# dd of=/dev/null bs=8k count=100 if=/dev/rsd2a
100+0 records in
100+0 records out
819200 bytes transferred in 0.067 secs (12226865 bytes/sec)
kveite# dd of=/dev/null bs=8k count=1000 if=/dev/rsd2a
1000+0 records in
1000+0 records out
8192000 bytes transferred in 0.556 secs (14733812 bytes/sec)
kveite# dd of=/dev/null bs=8k count=10000 if=/dev/rsd2a
dd: /dev/rsd2a: Input/output error
1062+0 records in
1062+0 records out
8699904 bytes transferred in 0.716 secs (12150703 bytes/sec)
kveite#
on the console:
isp0: DMA error for command on 0.34.0
isp0: BOTCHED cmd for 0.34.0 cmd 0x8 datalen 8192
sd2(isp0:0:34:0): generic HBA error
Hm!
However, a subsequent attempt succeeded:
kveite# dd of=/dev/null bs=8k count=10000 if=/dev/rsd2a
10000+0 records in
10000+0 records out
81920000 bytes transferred in 5.424 secs (15103244 bytes/sec)
kveite#
but that was perhaps just pure luck?
Any hints for this one?
Regards,
- Havard
----Next_Part(Tue_Nov__9_16:34:30_2004_916)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Index: isp_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/isp_pci.c,v
retrieving revision 1.91
diff -u -u -p -r1.91 isp_pci.c
--- isp_pci.c 10 Mar 2004 22:42:47 -0000 1.91
+++ isp_pci.c 9 Nov 2004 15:22:33 -0000
@@ -698,10 +698,17 @@ isp_pci_attach(struct device *parent, st
(((struct isp_pcisoftc *)a)->pci_poff[((x) & _BLK_REG_MASK) >> \
_BLK_REG_SHFT] + ((x) & 0xff))
+#ifndef BUS_SPACE_BARRIER_READ_BEFORE_READ
+#define BUS_SPACE_BARRIER_READ_BEFORE_READ BUS_SPACE_BARRIER_READ
+#endif
+
#define BXR2(pcs, off) \
bus_space_read_2(pcs->pci_st, pcs->pci_sh, off)
#define BXW2(pcs, off, v) \
bus_space_write_2(pcs->pci_st, pcs->pci_sh, off, v)
+#define BXRBARRIER(pcs, off) \
+ bus_space_barrier(pcs->pci_st, pcs->pci_sh, off, 2, \
+ BUS_SPACE_BARRIER_READ_BEFORE_READ)
static INLINE int
@@ -713,9 +720,11 @@ isp_pci_rd_debounced(struct ispsoftc *is
do {
val0 = BXR2(pcs, IspVirt2Off(isp, off));
+ BXRBARRIER(pcs, IspVirt2Off(isp, off));
val1 = BXR2(pcs, IspVirt2Off(isp, off));
} while (val0 != val1 && ++i < 1000);
if (val0 != val1) {
+ printf("isp_pci de-bounce spin-out\n");
return (1);
}
*rp = val0;
@@ -732,7 +741,7 @@ isp_pci_rd_isr(struct ispsoftc *isp, u_i
u_int16_t *semap, u_int16_t *mbp)
{
struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp;
- u_int16_t isr, sema;
+ u_int16_t isr, sema, oisr, osema;
if (IS_2100(isp)) {
if (isp_pci_rd_debounced(isp, BIU_ISR, &isr)) {
@@ -746,15 +755,21 @@ isp_pci_rd_isr(struct ispsoftc *isp, u_i
sema = BXR2(pcs, IspVirt2Off(isp, BIU_SEMA));
}
isp_prt(isp, ISP_LOGDEBUG3, "ISR 0x%x SEMA 0x%x", isr, sema);
+ oisr = isr;
+ osema = sema;
isr &= INT_PENDING_MASK(isp);
sema &= BIU_SEMA_LOCK;
if (isr == 0 && sema == 0) {
+ printf("isp_pci_rd_isr: isr == 0 && sema == 0 (after mask)\n");
+ printf("isp_pci_rd_isr: isr == 0x%x, sema == 0x%x\n",
+ oisr, osema);
return (0);
}
*isrp = isr;
if ((*semap = sema) != 0) {
if (IS_2100(isp)) {
if (isp_pci_rd_debounced(isp, OUTMAILBOX0, mbp)) {
+ printf("isp_pci_rd_isr: failed mailbox read\n");
return (0);
}
} else {
----Next_Part(Tue_Nov__9_16:34:30_2004_916)----