From owner-svn-src-stable-8@FreeBSD.ORG Sun Apr 10 01:21:03 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9F70106566C; Sun, 10 Apr 2011 01:21:02 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF2E18FC0C; Sun, 10 Apr 2011 01:21:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3A1L2D7031075; Sun, 10 Apr 2011 01:21:02 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3A1L2r0031072; Sun, 10 Apr 2011 01:21:02 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201104100121.p3A1L2r0031072@svn.freebsd.org> From: Navdeep Parhar Date: Sun, 10 Apr 2011 01:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220509 - stable/8/sys/dev/cxgbe X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2011 01:21:03 -0000 Author: np Date: Sun Apr 10 01:21:02 2011 New Revision: 220509 URL: http://svn.freebsd.org/changeset/base/220509 Log: MFC r220410 Modify read/write ioctls to work with 64 bit registers too. Modified: stable/8/sys/dev/cxgbe/t4_ioctl.h stable/8/sys/dev/cxgbe/t4_main.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/cxgbe/t4_ioctl.h ============================================================================== --- stable/8/sys/dev/cxgbe/t4_ioctl.h Sun Apr 10 00:29:00 2011 (r220508) +++ stable/8/sys/dev/cxgbe/t4_ioctl.h Sun Apr 10 01:21:02 2011 (r220509) @@ -35,24 +35,25 @@ * Ioctl commands specific to this driver. */ enum { - T4_GET32 = 0x40, /* read 32 bit register */ - T4_SET32, /* write 32 bit register */ + T4_GETREG = 0x40, /* read register */ + T4_SETREG, /* write register */ T4_REGDUMP, /* dump of all registers */ }; -struct t4_reg32 { +struct t4_reg { uint32_t addr; - uint32_t val; + uint32_t size; + uint64_t val; }; #define T4_REGDUMP_SIZE (160 * 1024) struct t4_regdump { - uint32_t version; - uint32_t len; /* bytes */ - uint8_t *data; + uint32_t version; + uint32_t len; /* bytes */ + uint32_t *data; }; -#define CHELSIO_T4_GETREG32 _IOWR('f', T4_GET32, struct t4_reg32) -#define CHELSIO_T4_SETREG32 _IOW('f', T4_SET32, struct t4_reg32) +#define CHELSIO_T4_GETREG _IOWR('f', T4_GETREG, struct t4_reg) +#define CHELSIO_T4_SETREG _IOW('f', T4_SETREG, struct t4_reg) #define CHELSIO_T4_REGDUMP _IOWR('f', T4_REGDUMP, struct t4_regdump) #endif Modified: stable/8/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_main.c Sun Apr 10 00:29:00 2011 (r220508) +++ stable/8/sys/dev/cxgbe/t4_main.c Sun Apr 10 01:21:02 2011 (r220509) @@ -2803,18 +2803,35 @@ t4_ioctl(struct cdev *dev, unsigned long return (rc); switch (cmd) { - case CHELSIO_T4_GETREG32: { - struct t4_reg32 *edata = (struct t4_reg32 *)data; + case CHELSIO_T4_GETREG: { + struct t4_reg *edata = (struct t4_reg *)data; + if ((edata->addr & 0x3) != 0 || edata->addr >= sc->mmio_len) return (EFAULT); - edata->val = t4_read_reg(sc, edata->addr); + + if (edata->size == 4) + edata->val = t4_read_reg(sc, edata->addr); + else if (edata->size == 8) + edata->val = t4_read_reg64(sc, edata->addr); + else + return (EINVAL); + break; } - case CHELSIO_T4_SETREG32: { - struct t4_reg32 *edata = (struct t4_reg32 *)data; + case CHELSIO_T4_SETREG: { + struct t4_reg *edata = (struct t4_reg *)data; + if ((edata->addr & 0x3) != 0 || edata->addr >= sc->mmio_len) return (EFAULT); - t4_write_reg(sc, edata->addr, edata->val); + + if (edata->size == 4) { + if (edata->val & 0xffffffff00000000) + return (EINVAL); + t4_write_reg(sc, edata->addr, (uint32_t) edata->val); + } else if (edata->size == 8) + t4_write_reg64(sc, edata->addr, edata->val); + else + return (EINVAL); break; } case CHELSIO_T4_REGDUMP: {