Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Sep 2014 21:56:57 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r271490 - head/sys/dev/cxgbe
Message-ID:  <201409122156.s8CLuvDl084338@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409122156.s8CLuvDl084338>