svn commit: r253330 - head/sys/dev/isp

Matt Jacob mjacob at FreeBSD.org
Sat Jul 13 21:24:26 UTC 2013


Author: mjacob
Date: Sat Jul 13 21:24:25 2013
New Revision: 253330
URL: http://svnweb.freebsd.org/changeset/base/253330

Log:
  When fiddling with options of which registers to copy out for
  a mailbox command and which registers to copy back in when
  the command completes, the bits being set need to not only
  specify what bits you want to add from the default from the
  table but also what bits you want *subtract* (mask) from the
  default from the table.
  
  A failing ISP2200 command pointed this out.
  
  Much appreciation to: marius, who persisted and narrowed down what
  the failure delta was, and shamed me into actually fixing it.
  MFC after:	1 week

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/ispreg.h

Modified: head/sys/dev/isp/isp.c
==============================================================================
--- head/sys/dev/isp/isp.c	Sat Jul 13 20:56:09 2013	(r253329)
+++ head/sys/dev/isp/isp.c	Sat Jul 13 21:24:25 2013	(r253330)
@@ -2589,7 +2589,7 @@ isp_get_wwn(ispsoftc_t *isp, int chan, i
 		}
 		mbs.param[9] = chan;
 	} else {
-		mbs.ibits = 3;
+		mbs.ibitm = 3;
 		mbs.param[1] = loopid << 8;
 		if (nodename) {
 			mbs.param[1] |= 1;
@@ -7363,6 +7363,13 @@ isp_mboxcmd(ispsoftc_t *isp, mbreg_t *mb
 	ibits |= mbp->ibits;
 	obits |= mbp->obits;
 
+	/*
+	 * Mask any bits that the caller wants us to mask
+	 */
+	ibits &= mbp->ibitm;
+	obits &= mbp->obitm;
+
+
 	if (ibits == 0 && obits == 0) {
 		mbp->param[0] = MBOX_COMMAND_PARAM_ERROR;
 		isp_prt(isp, ISP_LOGERR, "no parameters for 0x%x", opcode);

Modified: head/sys/dev/isp/ispreg.h
==============================================================================
--- head/sys/dev/isp/ispreg.h	Sat Jul 13 20:56:09 2013	(r253329)
+++ head/sys/dev/isp/ispreg.h	Sat Jul 13 21:24:25 2013	(r253330)
@@ -464,8 +464,10 @@
 #define	MBCMD_DEFAULT_TIMEOUT	100000	/* 100 ms */
 typedef struct {
 	uint16_t param[MAX_MAILBOX];
-	uint32_t ibits;
-	uint32_t obits;
+	uint32_t ibits;	/* bits to add for register copyin */
+	uint32_t obits;	/* bits to add for register copyout */
+	uint32_t ibitm;	/* bits to mask for register copyin */
+	uint32_t obitm;	/* bits to mask for register copyout */
 	uint32_t
 		lineno	: 16,
 			: 12,
@@ -475,6 +477,8 @@ typedef struct {
 } mbreg_t;
 #define	MBSINIT(mbxp, code, loglev, timo)	\
 	ISP_MEMZERO((mbxp), sizeof (mbreg_t));	\
+	(mbxp)->ibitm = ~0;			\
+	(mbxp)->obitm = ~0;			\
 	(mbxp)->param[0] = code;		\
 	(mbxp)->lineno = __LINE__;		\
 	(mbxp)->func = __func__;		\


More information about the svn-src-head mailing list