summaryrefslogtreecommitdiff
path: root/sys/arch/sparc
diff options
context:
space:
mode:
authormjacob <mjacob@cvs.openbsd.org>2001-09-01 07:16:41 +0000
committermjacob <mjacob@cvs.openbsd.org>2001-09-01 07:16:41 +0000
commit12d884abf1047520b53d046341e7575af4e4b3b3 (patch)
tree1758d469abfa46037bcdc4f646333a7e06c66dfd /sys/arch/sparc
parent62aed17c49c1b0d9f5091657be7fa35f73271aac (diff)
Catch up with mainline of code development.
Add support for 2 Gigabit cards (2300/2312). This necessitated a change in how interrupts are down- the 23XX has not only a different place to check for an interrupt, but unlike all other QLogic cards, you have to read the status as a 32 bit word- not 16 bit words. Rather than have device specific functions as called from the core module (in isp_intr), it makes more sense to have the platform/bus modules do the gruntwork of splitting out the isr, semaphore register and the first outgoing mailbox register (if needed) *prior* to calling isp_intr (if calling isp_intr is necessary at all). Rearchitect how regular SCSI parameters are stored or used.
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r--sys/arch/sparc/dev/isp_sbus.c58
1 files changed, 48 insertions, 10 deletions
diff --git a/sys/arch/sparc/dev/isp_sbus.c b/sys/arch/sparc/dev/isp_sbus.c
index ccbe0d68712..c564086e0e1 100644
--- a/sys/arch/sparc/dev/isp_sbus.c
+++ b/sys/arch/sparc/dev/isp_sbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isp_sbus.c,v 1.17 2001/05/16 12:49:48 ho Exp $ */
+/* $OpenBSD: isp_sbus.c,v 1.18 2001/09/01 07:16:39 mjacob Exp $ */
/*
* SBus specific probe and attach routines for Qlogic ISP SCSI adapters.
*
@@ -47,6 +47,8 @@
#include <dev/microcode/isp/asm_sbus.h>
#endif
+static int
+isp_sbus_rd_isr(struct ispsoftc *, u_int16_t *, u_int16_t *, u_int16_t *);
static u_int16_t isp_sbus_rd_reg(struct ispsoftc *, int);
static void isp_sbus_wr_reg(struct ispsoftc *, int, u_int16_t);
static int isp_sbus_mbxdma(struct ispsoftc *);
@@ -61,6 +63,7 @@ static int isp_sbus_intr(void *);
#endif
static struct ispmdvec mdvec = {
+ isp_sbus_rd_isr,
isp_sbus_rd_reg,
isp_sbus_wr_reg,
isp_sbus_mbxdma,
@@ -266,6 +269,35 @@ isp_sbus_attach(struct device *parent, struct device *self, void *aux)
ISP_UNLOCK(isp);
}
+#define IspVirt2Off(a, x) \
+ (((struct isp_sbussoftc *)a)->sbus_poff[((x) & _BLK_REG_MASK) >> \
+ _BLK_REG_SHFT] + ((x) & 0xff))
+
+#define BXR2(pcs, off) \
+ (*((u_int16_t *) &sbc->sbus_reg[off]))
+
+static int
+isp_sbus_rd_isr(struct ispsoftc *isp, u_int16_t *isrp,
+ u_int16_t *semap, u_int16_t *mbp)
+{
+ struct isp_sbussoftc *sbc = (struct isp_sbussoftc *) isp;
+ u_int16_t isr, sema;
+
+ isr = BXR2(pcs, IspVirt2Off(isp, BIU_ISR));
+ sema = BXR2(pcs, IspVirt2Off(isp, BIU_SEMA));
+ isp_prt(isp, ISP_LOGDEBUG3, "ISR 0x%x SEMA 0x%x", isr, sema);
+ isr &= INT_PENDING_MASK(isp);
+ sema &= BIU_SEMA_LOCK;
+ if (isr == 0 && sema == 0) {
+ return (0);
+ }
+ *isrp = isr;
+ if ((*semap = sema) != 0) {
+ *mbp = BXR2(pcs, IspVirt2Off(isp, OUTMAILBOX0));
+ }
+ return (1);
+}
+
static u_int16_t
isp_sbus_rd_reg(struct ispsoftc *isp, int regoff)
{
@@ -438,16 +470,22 @@ isp_sbus_dmateardown(struct ispsoftc *isp, XS_T *xs, u_int16_t handle)
static int
isp_sbus_intr(void *arg)
{
- int r;
+ u_int16_t isr, sema, mbox;
struct ispsoftc *isp = (struct ispsoftc *)arg;
-#if 0
- struct iss_sbussoftc *s = (struct isp_sbussoftc *)isp;
- bus_dmamap_sync(p->pci_dmat, p->pci_result_dmap, BUS_DMASYNC_POSTREAD);
+ isp->isp_intcnt++;
+ if (ISP_READ_ISR(isp, &isr, &sema, &mbox) == 0) {
+ isp->isp_intbogus++;
+ return (0);
+ } else {
+#if 0
+ struct iss_sbussoftc *s = (struct isp_sbussoftc *)isp;
+ bus_dmamap_sync(s->pci_dmat, s->pci_result_dmap,
+ BUS_DMASYNC_POSTREAD);
#endif
-
- isp->isp_osinfo.onintstack = 1;
- r = isp_intr(arg);
- isp->isp_osinfo.onintstack = 0;
- return (r);
+ isp->isp_osinfo.onintstack = 1;
+ isp_intr(isp, isr, sema, mbox);
+ isp->isp_osinfo.onintstack = 0;
+ return (1);
+ }
}