Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Aug 2018 23:53:12 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r337731 - head/sys/dev/iicbus
Message-ID:  <201808132353.w7DNrCs7070971@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Mon Aug 13 23:53:11 2018
New Revision: 337731
URL: https://svnweb.freebsd.org/changeset/base/337731

Log:
  Export the eeprom device size via readonly sysctl.  Also export the write
  page size and address size, although they are likely to be inherently
  less-interesting values outside of the driver.

Modified:
  head/sys/dev/iicbus/icee.c

Modified: head/sys/dev/iicbus/icee.c
==============================================================================
--- head/sys/dev/iicbus/icee.c	Mon Aug 13 23:46:44 2018	(r337730)
+++ head/sys/dev/iicbus/icee.c	Mon Aug 13 23:53:11 2018	(r337731)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/module.h>
 #include <sys/resource.h>
 #include <sys/sx.h>
+#include <sys/sysctl.h>
 #include <sys/uio.h>
 #include <machine/bus.h>
 
@@ -186,6 +187,8 @@ static int
 icee_attach(device_t dev)
 {
 	struct icee_softc *sc = device_get_softc(dev);
+	struct sysctl_ctx_list *ctx;
+	struct sysctl_oid_list *tree;
 
 	sc->dev = dev;
 	sc->addr = iicbus_get_addr(dev);
@@ -205,6 +208,16 @@ icee_attach(device_t dev)
 		return (ENOMEM);
 	}
 	sc->cdev->si_drv1 = sc;
+
+	ctx = device_get_sysctl_ctx(dev);
+	tree = SYSCTL_CHILDREN(device_get_sysctl_tree(dev));
+	SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "address_size", CTLFLAG_RD,
+	    &sc->type, 0, "Memory array address size in bits");
+	SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "device_size", CTLFLAG_RD,
+	    &sc->size, 0, "Memory array capacity in bytes");
+	SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "write_size", CTLFLAG_RD,
+	    &sc->wr_sz, 0, "Memory array page write size in bytes");
+
 	return (0);
 }
 



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