From owner-svn-src-stable@FreeBSD.ORG Mon Jul 15 20:33:55 2013 Return-Path: <owner-svn-src-stable@FreeBSD.ORG> Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0AFED905; Mon, 15 Jul 2013 20:33:55 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D838F975; Mon, 15 Jul 2013 20:33:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6FKXslE039113; Mon, 15 Jul 2013 20:33:54 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6FKXsI0039111; Mon, 15 Jul 2013 20:33:54 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201307152033.r6FKXsI0039111@svn.freebsd.org> From: Matt Jacob <mjacob@FreeBSD.org> Date: Mon, 15 Jul 2013 20:33:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r253371 - stable/9/sys/dev/isp X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree <svn-src-stable.freebsd.org> List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-stable>, <mailto:svn-src-stable-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable> List-Post: <mailto:svn-src-stable@freebsd.org> List-Help: <mailto:svn-src-stable-request@freebsd.org?subject=help> List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable>, <mailto:svn-src-stable-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 15 Jul 2013 20:33:55 -0000 Author: mjacob Date: Mon Jul 15 20:33:54 2013 New Revision: 253371 URL: http://svnweb.freebsd.org/changeset/base/253371 Log: MFC of 253330 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. Approved by: re Modified: stable/9/sys/dev/isp/isp.c stable/9/sys/dev/isp/ispreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/isp/ (props changed) Modified: stable/9/sys/dev/isp/isp.c ============================================================================== --- stable/9/sys/dev/isp/isp.c Mon Jul 15 18:17:31 2013 (r253370) +++ stable/9/sys/dev/isp/isp.c Mon Jul 15 20:33:54 2013 (r253371) @@ -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: stable/9/sys/dev/isp/ispreg.h ============================================================================== --- stable/9/sys/dev/isp/ispreg.h Mon Jul 15 18:17:31 2013 (r253370) +++ stable/9/sys/dev/isp/ispreg.h Mon Jul 15 20:33:54 2013 (r253371) @@ -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__; \