Module Name:    src
Committed By:   mjacob
Date:           Mon Feb 28 17:17:55 UTC 2011

Modified Files:
        src/sys/dev/ic: isp.c isp_library.c isp_netbsd.h ispvar.h
        src/sys/dev/pci: isp_pci.c

Log Message:
Update isp driver to be in sync with other platforms. Mostly very minor changes
with effectively zero impact on NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/dev/ic/isp.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/isp_library.c
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/ic/isp_netbsd.h
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/ic/ispvar.h
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/isp_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/isp.c
diff -u src/sys/dev/ic/isp.c:1.121 src/sys/dev/ic/isp.c:1.122
--- src/sys/dev/ic/isp.c:1.121	Fri Mar 26 20:52:00 2010
+++ src/sys/dev/ic/isp.c	Mon Feb 28 17:17:55 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: isp.c,v 1.121 2010/03/26 20:52:00 mjacob Exp $ */
+/* $NetBSD: isp.c,v 1.122 2011/02/28 17:17:55 mjacob Exp $ */
 /*
  * Machine and OS Independent (well, as best as possible)
  * code for the Qlogic ISP SCSI adapters.
@@ -43,7 +43,7 @@
  */
 #ifdef	__NetBSD__
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.121 2010/03/26 20:52:00 mjacob Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.122 2011/02/28 17:17:55 mjacob Exp $");
 #include <dev/ic/isp_netbsd.h>
 #endif
 #ifdef	__FreeBSD__
@@ -778,7 +778,7 @@
 					ISP_IOXPUT_32(isp,  ptr[wi++], &cp[i]);
 					wl--;
 				}
-				MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)));
+				MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)), -1);
 				ISP_MEMZERO(&mbs, sizeof (mbs));
 				if (la < 0x10000 && nw < 0x10000) {
 					mbs.param[0] = MBOX_LOAD_RISC_RAM_2100;
@@ -847,7 +847,7 @@
 					ISP_IOXPUT_16(isp,  ptr[wi++], &cp[i]);
 					wl--;
 				}
-				MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)));
+				MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)), -1);
 				ISP_MEMZERO(&mbs, sizeof (mbs));
 				if (la < 0x10000) {
 					mbs.param[0] = MBOX_LOAD_RISC_RAM_2100;
@@ -1717,7 +1717,7 @@
 	isp_prt(isp, ISP_LOGDEBUG0, "INIT F/W from %p (%08x%08x)",
 	    fcp->isp_scratch, (uint32_t) ((uint64_t)fcp->isp_scdma >> 32),
 	    (uint32_t) fcp->isp_scdma);
-	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp));
+	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp), 0);
 	isp_mboxcmd(isp, &mbs);
 	FC_SCRATCH_RELEASE(isp, 0);
 	if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -2009,7 +2009,7 @@
 	mbs.param[6] = DMA_WD3(fcp->isp_scdma);
 	mbs.param[7] = DMA_WD2(fcp->isp_scdma);
 	isp_prt(isp, ISP_LOGDEBUG0, "INIT F/W from %04x%04x%04x%04x", DMA_WD3(fcp->isp_scdma), DMA_WD2(fcp->isp_scdma), DMA_WD1(fcp->isp_scdma), DMA_WD0(fcp->isp_scdma));
-	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp));
+	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp), 0);
 	isp_mboxcmd(isp, &mbs);
 	FC_SCRATCH_RELEASE(isp, 0);
 
@@ -2126,13 +2126,13 @@
 	mbs.param[3] = DMA_WD0(fcp->isp_scdma);
 	mbs.param[6] = DMA_WD3(fcp->isp_scdma);
 	mbs.param[7] = DMA_WD2(fcp->isp_scdma);
-	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, QENTRY_LEN);
+	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, QENTRY_LEN, chan);
 	isp_mboxcmd(isp, &mbs);
 	if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
 		rval = mbs.param[0];
 		goto out;
 	}
-	MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN);
+	MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan);
 	scp += QENTRY_LEN;
 	isp_get_plogx(isp, (isp_plogx_t *) scp, plp);
 	if (isp->isp_dblev & ISP_LOGDEBUG1) {
@@ -2325,7 +2325,7 @@
 			return (-1);
 		}
 	}
-	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (un));
+	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (un), chan);
 	isp_mboxcmd(isp, &mbs);
 	if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
 		if (dolock) {
@@ -3216,7 +3216,7 @@
 	rq->snscb_fc4_type = FC4_SCSI;
 
 	isp_put_gid_ft_request(isp, rq, fcp->isp_scratch);
-	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GID_FT_REQ_SIZE);
+	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GID_FT_REQ_SIZE, chan);
 
 	MBSINIT(&mbs, MBOX_SEND_SNS, MBLOGALL, 10000000);
 	mbs.param[0] = MBOX_SEND_SNS;
@@ -3311,12 +3311,12 @@
 	mbs.param[3] = DMA_WD0(fcp->isp_scdma + CTXOFF);
 	mbs.param[6] = DMA_WD3(fcp->isp_scdma + CTXOFF);
 	mbs.param[7] = DMA_WD2(fcp->isp_scdma + CTXOFF);
-	MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN);
+	MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN, chan);
 	isp_mboxcmd(isp, &mbs);
 	if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
 		return (-1);
 	}
-	MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN);
+	MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN, chan);
 	pt = &un.plocal;
 	isp_get_ct_pt(isp, (isp_ct_pt_t *) &scp[ZTXOFF], pt);
 	if (isp->isp_dblev & ISP_LOGDEBUG1) {
@@ -3329,7 +3329,7 @@
 		    chan, pt->ctp_status);
 		return (-1);
 	}
-	MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN + 16);
+	MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN + 16, chan);
 	if (isp->isp_dblev & ISP_LOGDEBUG1) {
 		isp_print_bytes(isp, "CT response", GIDLEN+16, &scp[IGPOFF]);
 	}
@@ -3415,7 +3415,7 @@
 		return (0);
 	}
 
-	MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN);
+	MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN, chan);
 	rs0 = (sns_gid_ft_rsp_t *) ((uint8_t *)fcp->isp_scratch+IGPOFF);
 	rs1 = (sns_gid_ft_rsp_t *) ((uint8_t *)fcp->isp_scratch+OGPOFF);
 	isp_get_gid_ft_response(isp, rs0, rs1, NGENT);
@@ -3937,14 +3937,18 @@
 				i = lim;
 			}
 			break;
-		} else if (r != MBOX_LOOP_ID_USED) {
+		} else if ((r & 0xffff) == MBOX_LOOP_ID_USED) {
+			/*
+			 * Try the next loop id.
+			 */
+			*ohp = handle;
+			handle = isp_nxt_handle(isp, chan, handle);
+		} else {
+			/*
+			 * Give up.
+			 */
 			i = lim;
 			break;
-		} else if (r == MBOX_TIMEOUT) {
-			return (-1);
-		} else {
-			*ohp = handle;
-			handle = isp_nxt_handle(isp, chan, *ohp);
 		}
 	}
 
@@ -4005,7 +4009,7 @@
 	mbs.param[3] = DMA_WD0(fcp->isp_scdma);
 	mbs.param[6] = DMA_WD3(fcp->isp_scdma);
 	mbs.param[7] = DMA_WD2(fcp->isp_scdma);
-	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_RFT_ID_REQ_SIZE);
+	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_RFT_ID_REQ_SIZE, chan);
 	isp_mboxcmd(isp, &mbs);
 	FC_SCRATCH_RELEASE(isp, chan);
 	if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
@@ -4091,13 +4095,13 @@
 	mbs.param[3] = DMA_WD0(fcp->isp_scdma + CTXOFF);
 	mbs.param[6] = DMA_WD3(fcp->isp_scdma + CTXOFF);
 	mbs.param[7] = DMA_WD2(fcp->isp_scdma + CTXOFF);
-	MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN);
+	MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN, chan);
 	isp_mboxcmd(isp, &mbs);
 	if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
 		FC_SCRATCH_RELEASE(isp, chan);
 		return (-1);
 	}
-	MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN);
+	MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN, chan);
 	pt = &un.plocal;
 	isp_get_ct_pt(isp, (isp_ct_pt_t *) &scp[ZTXOFF], pt);
 	if (isp->isp_dblev & ISP_LOGDEBUG1) {
@@ -4181,7 +4185,7 @@
 isp_start(XS_T *xs)
 {
 	ispsoftc_t *isp;
-	uint32_t handle;
+	uint32_t handle, cdblen;
 	uint8_t local[QENTRY_LEN];
 	ispreq_t *reqp;
 	void *cdbp, *qep;
@@ -4314,8 +4318,7 @@
 			reqp->req_header.rqs_entry_type = RQSTYPE_REQUEST;
 		}
 	}
-	/* reqp->req_header.rqs_flags = 0; */
-	/* reqp->req_header.rqs_seqno = 0; */
+
 	if (IS_24XX(isp)) {
 		int ttype;
 		if (XS_TAG_P(xs)) {
@@ -4364,39 +4367,57 @@
 			reqp->req_flags = XS_TAG_TYPE(xs);
 		}
 	}
-	cdbp = reqp->req_cdb;
+
 	tptr = &reqp->req_time;
 
+	/*
+	 * NB: we do not support long CDBs
+	 */
+	cdblen = XS_CDBLEN(xs);
+
 	if (IS_SCSI(isp)) {
 		reqp->req_target = target | (XS_CHANNEL(xs) << 7);
 		reqp->req_lun_trn = XS_LUN(xs);
-		reqp->req_cdblen = XS_CDBLEN(xs);
+		cdblen = ISP_MIN(cdblen, sizeof (reqp->req_cdb));
+		cdbp = reqp->req_cdb;
+		reqp->req_cdblen = cdblen;
 	} else if (IS_24XX(isp)) {
+		ispreqt7_t *t7 = (ispreqt7_t *)local;
 		fcportdb_t *lp;
 
 		lp = &FCPARAM(isp, XS_CHANNEL(xs))->portdb[hdlidx];
-		((ispreqt7_t *)reqp)->req_nphdl = target;
-		((ispreqt7_t *)reqp)->req_tidlo = lp->portid;
-		((ispreqt7_t *)reqp)->req_tidhi = lp->portid >> 16;
-		((ispreqt7_t *)reqp)->req_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(xs));
+		t7->req_nphdl = target;
+		t7->req_tidlo = lp->portid;
+		t7->req_tidhi = lp->portid >> 16;
+		t7->req_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(xs));
 		if (XS_LUN(xs) > 256) {
-			((ispreqt7_t *)reqp)->req_lun[0] = XS_LUN(xs) >> 8;
-			((ispreqt7_t *)reqp)->req_lun[0] |= 0x40;
+			t7->req_lun[0] = XS_LUN(xs) >> 8;
+			t7->req_lun[0] |= 0x40;
 		}
-		((ispreqt7_t *)reqp)->req_lun[1] = XS_LUN(xs);
-		cdbp = ((ispreqt7_t *)reqp)->req_cdb;
-		tptr = &((ispreqt7_t *)reqp)->req_time;
+		t7->req_lun[1] = XS_LUN(xs);
+		tptr = &t7->req_time;
+		cdbp = t7->req_cdb;
+		cdblen = ISP_MIN(cdblen, sizeof (t7->req_cdb));
 	} else if (ISP_CAP_2KLOGIN(isp)) {
-		((ispreqt2e_t *)reqp)->req_target = target;
-		((ispreqt2e_t *)reqp)->req_scclun = XS_LUN(xs);
+		ispreqt2e_t *t2e = (ispreqt2e_t *)local;
+		t2e->req_target = target;
+		t2e->req_scclun = XS_LUN(xs);
+		cdbp = t2e->req_cdb;
+		cdblen = ISP_MIN(cdblen, sizeof (t2e->req_cdb));
 	} else if (ISP_CAP_SCCFW(isp)) {
-		((ispreqt2_t *)reqp)->req_target = target;
-		((ispreqt2_t *)reqp)->req_scclun = XS_LUN(xs);
-	} else {
-		((ispreqt2_t *)reqp)->req_target = target;
-		((ispreqt2_t *)reqp)->req_lun_trn = XS_LUN(xs);
+		ispreqt2_t *t2 = (ispreqt2_t *)local;
+		t2->req_target = target;
+		t2->req_scclun = XS_LUN(xs);
+		cdbp = t2->req_cdb;
+		cdblen = ISP_MIN(cdblen, sizeof (t2->req_cdb));
+	} else {
+		ispreqt2_t *t2 = (ispreqt2_t *)local;
+		t2->req_target = target;
+		t2->req_lun_trn = XS_LUN(xs);
+		cdbp = t2->req_cdb;
+		cdblen = ISP_MIN(cdblen, sizeof (t2->req_cdb));
 	}
-	ISP_MEMCPY(cdbp, XS_CDBP(xs), XS_CDBLEN(xs));
+	ISP_MEMCPY(cdbp, XS_CDBP(xs), cdblen);
 
 	*tptr = XS_TIME(xs) / 1000;
 	if (*tptr == 0 && XS_TIME(xs)) {
@@ -4532,7 +4553,7 @@
 				break;
 			}
 			isp_put_24xx_tmf(isp, tmf, fcp->isp_scratch);
-			MEMORYBARRIER(isp, SYNC_SFORDEV, 0, QENTRY_LEN);
+			MEMORYBARRIER(isp, SYNC_SFORDEV, 0, QENTRY_LEN, chan);
 			fcp->sendmarker = 1;
 			isp_mboxcmd(isp, &mbs);
 			if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -4540,7 +4561,7 @@
 				break;
 			}
 			MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN,
-			    QENTRY_LEN);
+			    QENTRY_LEN, chan);
 			sp = (isp24xx_statusreq_t *) local;
 			isp_get_24xx_response(isp,
 			    &((isp24xx_statusreq_t *)fcp->isp_scratch)[1], sp);
@@ -4636,14 +4657,14 @@
 			ab2 = (isp24xx_abrt_t *)
 			    &((uint8_t *)fcp->isp_scratch)[QENTRY_LEN];
 			ab2->abrt_nphdl = 0xdeaf;
-			MEMORYBARRIER(isp, SYNC_SFORDEV, 0, 2 * QENTRY_LEN);
+			MEMORYBARRIER(isp, SYNC_SFORDEV, 0, 2 * QENTRY_LEN, chan);
 			isp_mboxcmd(isp, &mbs);
 			if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
 				FC_SCRATCH_RELEASE(isp, chan);
 				break;
 			}
 			MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN,
-			    QENTRY_LEN);
+			    QENTRY_LEN, chan);
 			isp_get_24xx_abrt(isp, ab2, ab);
 			FC_SCRATCH_RELEASE(isp, chan);
 			if (ab->abrt_nphdl == ISP24XX_ABRT_OKAY) {
@@ -4916,7 +4937,7 @@
 			void *addr;
 
 			oop = optr;
-			MEMORYBARRIER(isp, SYNC_ATIOQ, oop, QENTRY_LEN);
+			MEMORYBARRIER(isp, SYNC_ATIOQ, oop, QENTRY_LEN, -1);
 			addr = ISP_QUEUE_ENTRY(isp->isp_atioq, oop);
 			isp_get_hdr(isp, addr, (isphdr_t *)qe);
 			hp = (isphdr_t *)qe;
@@ -5033,7 +5054,7 @@
 		/*
 		 * Synchronize our view of this response queue entry.
 		 */
-		MEMORYBARRIER(isp, SYNC_RESULT, oop, QENTRY_LEN);
+		MEMORYBARRIER(isp, SYNC_RESULT, oop, QENTRY_LEN, -1);
 		isp_get_hdr(isp, hp, &sp->req_header);
 		etype = sp->req_header.rqs_entry_type;
 

Index: src/sys/dev/ic/isp_library.c
diff -u src/sys/dev/ic/isp_library.c:1.6 src/sys/dev/ic/isp_library.c:1.7
--- src/sys/dev/ic/isp_library.c:1.6	Fri Mar 26 20:52:00 2010
+++ src/sys/dev/ic/isp_library.c	Mon Feb 28 17:17:55 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_library.c,v 1.6 2010/03/26 20:52:00 mjacob Exp $ */
+/* $NetBSD: isp_library.c,v 1.7 2011/02/28 17:17:55 mjacob Exp $ */
 /*
  * Copyright (c) 2006-2007 by Matthew Jacob
  * All rights reserved.
@@ -30,7 +30,7 @@
  */
 #ifdef	__NetBSD__
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isp_library.c,v 1.6 2010/03/26 20:52:00 mjacob Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_library.c,v 1.7 2011/02/28 17:17:55 mjacob Exp $");
 #include <dev/ic/isp_netbsd.h>
 #endif
 #ifdef	__FreeBSD__
@@ -344,7 +344,7 @@
 		for (j = 0; j < (QENTRY_LEN >> 2); j++) {
 			ISP_SNPRINTF(buf, TBA, "%s %02x", buf, ptr[amt++] & 0xff);
 		}
-		isp_prt(isp, ISP_LOGALL, buf);
+		isp_prt(isp, ISP_LOGALL, "%s", buf);
 	}
 }
 
@@ -591,13 +591,13 @@
 		mbs.param[3] = DMA_WD0(fcp->isp_scdma);
 		mbs.param[6] = DMA_WD3(fcp->isp_scdma);
 		mbs.param[7] = DMA_WD2(fcp->isp_scdma);
-		MEMORYBARRIER(isp, SYNC_SFORDEV, 0, 2 * QENTRY_LEN);
+		MEMORYBARRIER(isp, SYNC_SFORDEV, 0, 2 * QENTRY_LEN, chan);
 		isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs);
 		if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
 			FC_SCRATCH_RELEASE(isp, chan);
 			return (EIO);
 		}
-		MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN);
+		MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan);
 		isp_get_vp_modify(isp, (vp_modify_t *)&scp[QENTRY_LEN], vp);
 
 #ifdef	ISP_TARGET_MODE
@@ -1338,7 +1338,7 @@
 		ISP_IOXPUT_16(isp, src->vp_ctrl_idmap[i], &dst->vp_ctrl_idmap[i]);
 	}
 	for (i = 0; i < ASIZE(src->vp_ctrl_reserved); i++) {
-		ISP_IOXPUT_8(isp, src->vp_ctrl_idmap[i], &dst->vp_ctrl_idmap[i]);
+		ISP_IOXPUT_8(isp, src->vp_ctrl_reserved[i], &dst->vp_ctrl_reserved[i]);
 	}
 }
 
@@ -2064,7 +2064,7 @@
 				ct2->ct_reloff = 0;
 				memset(&ct2->rsp, 0, sizeof (ct2->rsp));
 				if (swd == SCSI_CHECK && snsptr && snslen) {
-					ct2->rsp.m1.ct_senselen = min(snslen, MAXRESPLEN);
+					ct2->rsp.m1.ct_senselen = ISP_MIN(snslen, MAXRESPLEN);
 					memcpy(ct2->rsp.m1.ct_resp, snsptr, ct2->rsp.m1.ct_senselen);
 					swd |= CT2_SNSLEN_VALID;
 				}
@@ -2112,7 +2112,7 @@
 				ct2->ct_seg_count = 0;
 				memset(&ct2->rsp, 0, sizeof (ct2->rsp));
 				if (swd == SCSI_CHECK && snsptr && snslen) {
-					ct2->rsp.m1.ct_resplen = min(snslen, MAXRESPLEN_24XX);
+					ct2->rsp.m1.ct_resplen = ISP_MIN(snslen, MAXRESPLEN_24XX);
 					memcpy(ct2->rsp.m1.ct_resp, snsptr, ct2->rsp.m1.ct_resplen);
 					swd |= (FCP_SNSLEN_VALID << 8);
 				}

Index: src/sys/dev/ic/isp_netbsd.h
diff -u src/sys/dev/ic/isp_netbsd.h:1.72 src/sys/dev/ic/isp_netbsd.h:1.73
--- src/sys/dev/ic/isp_netbsd.h:1.72	Fri Mar 26 20:52:00 2010
+++ src/sys/dev/ic/isp_netbsd.h	Mon Feb 28 17:17:55 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.h,v 1.72 2010/03/26 20:52:00 mjacob Exp $ */
+/* $NetBSD: isp_netbsd.h,v 1.73 2011/02/28 17:17:55 mjacob Exp $ */
 /*
  * NetBSD Specific definitions for the Qlogic ISP Host Adapter
  */
@@ -129,6 +129,7 @@
 	if (!ISP_MUSTPOLL(isp))		\
 		ISP_LOCK(isp)
 
+#define	ISP_MIN	imin
 #define	ISP_INLINE
 
 #define	NANOTIME_T		struct timeval
@@ -139,7 +140,7 @@
 #define	MAXISPREQUEST(isp)	256
 
 
-#define	MEMORYBARRIER(isp, type, offset, size)			\
+#define	MEMORYBARRIER(isp, type, offset, size, c)		\
 switch (type) {							\
 case SYNC_REQUEST:						\
 {								\

Index: src/sys/dev/ic/ispvar.h
diff -u src/sys/dev/ic/ispvar.h:1.71 src/sys/dev/ic/ispvar.h:1.72
--- src/sys/dev/ic/ispvar.h:1.71	Fri Mar 26 20:52:01 2010
+++ src/sys/dev/ic/ispvar.h	Mon Feb 28 17:17:55 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ispvar.h,v 1.71 2010/03/26 20:52:01 mjacob Exp $ */
+/* $NetBSD: ispvar.h,v 1.72 2011/02/28 17:17:55 mjacob Exp $ */
 /*
  * Copyright (C) 1999 National Aeronautics & Space Administration
  * All rights reserved.
@@ -182,13 +182,13 @@
 #define	ISP_QAVAIL(isp)	\
 	ISP_QFREE(isp->isp_reqidx, isp->isp_reqodx, RQUEST_QUEUE_LEN(isp))
 
-#define	ISP_ADD_REQUEST(isp, nxti)					\
-	MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN);	\
-	ISP_WRITE(isp, isp->isp_rqstinrp, nxti);			\
+#define	ISP_ADD_REQUEST(isp, nxti)						\
+	MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN, -1);	\
+	ISP_WRITE(isp, isp->isp_rqstinrp, nxti);				\
 	isp->isp_reqidx = nxti
 
 #define	ISP_SYNC_REQUEST(isp)								\
-	MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN);			\
+	MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN, -1);		\
 	isp->isp_reqidx = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp));	\
 	ISP_WRITE(isp, isp->isp_rqstinrp, isp->isp_reqidx)
 
@@ -454,6 +454,7 @@
 			new_portid	: 24;
 	uint64_t	node_wwn;
 	uint64_t	port_wwn;
+	uint32_t	gone_timer;
 } fcportdb_t;
 
 #define	FC_PORTDB_STATE_NIL		0
@@ -1024,6 +1025,7 @@
  *
  *	ISP_INLINE				___inline or not- depending on how
  *						good your debugger is
+ *	ISP_MIN					shorthand for ((a) < (b))? (a) : (b)
  *
  *	NANOTIME_T				nanosecond time type
  *
@@ -1037,7 +1039,7 @@
  *	MAXISPREQUEST(ispsoftc_t *)		maximum request queue size
  *						for this particular board type
  *
- *	MEMORYBARRIER(ispsoftc_t *, barrier_type, offset, size)
+ *	MEMORYBARRIER(ispsoftc_t *, barrier_type, offset, size, chan)
  *
  *		Function/Macro the provides memory synchronization on
  *		various objects so that the ISP's and the system's view

Index: src/sys/dev/pci/isp_pci.c
diff -u src/sys/dev/pci/isp_pci.c:1.113 src/sys/dev/pci/isp_pci.c:1.114
--- src/sys/dev/pci/isp_pci.c:1.113	Sat Nov 13 13:52:07 2010
+++ src/sys/dev/pci/isp_pci.c	Mon Feb 28 17:17:55 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_pci.c,v 1.113 2010/11/13 13:52:07 uebayasi Exp $ */
+/* $NetBSD: isp_pci.c,v 1.114 2011/02/28 17:17:55 mjacob Exp $ */
 /*
  * Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration
  * All rights reserved.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isp_pci.c,v 1.113 2010/11/13 13:52:07 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_pci.c,v 1.114 2011/02/28 17:17:55 mjacob Exp $");
 
 #include <dev/ic/isp_netbsd.h>
 #include <dev/pci/pcireg.h>
@@ -130,6 +130,8 @@
 #define	ISP_2400_RISC_CODE	NULL
 #define	ISP_2500_RISC_CODE	NULL
 #else
+#define	ISP_2500
+#define	ISP_2400
 #define	ISP_2400_RISC_CODE	(const uint32_t *) isp_2400_risc_code
 #define	ISP_2500_RISC_CODE	(const uint32_t *) isp_2500_risc_code
 #include <dev/microcode/isp/asm_2400.h>

Reply via email to