svn commit: r346548 - stable/11/sys/dev/iicbus

Ian Lepore ian at FreeBSD.org
Tue Sep 3 14:08:13 UTC 2019


Author: ian
Date: Mon Apr 22 13:51:25 2019
New Revision: 346548
URL: https://svnweb.freebsd.org/changeset/base/346548

Log:
  MFC r337731:
  
  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:
  stable/11/sys/dev/iicbus/icee.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/iicbus/icee.c
==============================================================================
--- stable/11/sys/dev/iicbus/icee.c	Mon Apr 22 13:45:08 2019	(r346547)
+++ stable/11/sys/dev/iicbus/icee.c	Mon Apr 22 13:51:25 2019	(r346548)
@@ -38,6 +38,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>
 
@@ -184,6 +185,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);
@@ -203,6 +206,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);
 }
 




More information about the svn-src-all mailing list