From owner-svn-src-head@FreeBSD.ORG Fri Sep 12 21:56:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A02536B1; Fri, 12 Sep 2014 21:56:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BEB3EF4; Fri, 12 Sep 2014 21:56:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8CLuvDt084339; Fri, 12 Sep 2014 21:56:57 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8CLuvDl084338; Fri, 12 Sep 2014 21:56:57 GMT (envelope-from np@FreeBSD.org) Message-Id: <201409122156.s8CLuvDl084338@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 12 Sep 2014 21:56:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271490 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Sep 2014 21:56:57 -0000 Author: np Date: Fri Sep 12 21:56:57 2014 New Revision: 271490 URL: http://svnweb.freebsd.org/changeset/base/271490 Log: cxgbe(4): add support for the SIOCGI2C ioctl. Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Sep 12 21:29:10 2014 (r271489) +++ head/sys/dev/cxgbe/t4_main.c Fri Sep 12 21:56:57 2014 (r271490) @@ -1378,6 +1378,31 @@ fail: ifmedia_ioctl(ifp, ifr, &pi->media, cmd); break; + case SIOCGI2C: { + struct ifi2creq i2c; + + rc = copyin(ifr->ifr_data, &i2c, sizeof(i2c)); + if (rc != 0) + break; + if (i2c.dev_addr != 0xA0 && i2c.dev_addr != 0xA2) { + rc = EPERM; + break; + } + if (i2c.len > sizeof(i2c.data)) { + rc = EINVAL; + break; + } + rc = begin_synchronized_op(sc, pi, SLEEP_OK | INTR_OK, "t4i2c"); + if (rc) + return (rc); + rc = -t4_i2c_rd(sc, sc->mbox, pi->port_id, i2c.dev_addr, + i2c.offset, i2c.len, &i2c.data[0]); + end_synchronized_op(sc, 0); + if (rc == 0) + rc = copyout(&i2c, ifr->ifr_data, sizeof(i2c)); + break; + } + default: rc = ether_ioctl(ifp, cmd, data); }