Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Apr 2019 13:51:25 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r346548 - stable/11/sys/dev/iicbus
Message-ID:  <201904221351.x3MDpPJN021356@repo.freebsd.org>

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



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