diff options
author | jmallett <jmallett@FreeBSD.org> | 2012-10-29 07:06:23 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2012-10-29 07:06:23 +0000 |
commit | 7c53bf7ecdff00578c5f1a4b8d9acbf052fd7ec9 (patch) | |
tree | 3bc9f56fe10a2190a15ef018094140d309939abf /sys | |
parent | b2713d8866fc6705efa00bbd3d65c92be216230d (diff) | |
download | FreeBSD-src-7c53bf7ecdff00578c5f1a4b8d9acbf052fd7ec9.zip FreeBSD-src-7c53bf7ecdff00578c5f1a4b8d9acbf052fd7ec9.tar.gz |
Add a sysctl to change the LED display.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/mips/cavium/octeon_machdep.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/sys/mips/cavium/octeon_machdep.c b/sys/mips/cavium/octeon_machdep.c index 270e642..4cebb34 100644 --- a/sys/mips/cavium/octeon_machdep.c +++ b/sys/mips/cavium/octeon_machdep.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include <sys/ptrace.h> #include <sys/reboot.h> #include <sys/signalvar.h> +#include <sys/sysctl.h> #include <sys/sysent.h> #include <sys/sysproto.h> #include <sys/time.h> @@ -366,6 +367,46 @@ octeon_get_timecount(struct timecounter *tc) return ((unsigned)octeon_get_ticks()); } +static int +sysctl_machdep_led_display(SYSCTL_HANDLER_ARGS) +{ + size_t buflen; + char buf[9]; + int error; + + if (req->newptr == NULL) + return (EINVAL); + + if (cvmx_sysinfo_get()->led_display_base_addr == 0) + return (ENODEV); + + /* + * Revision 1.x of the EBT3000 only supports 4 characters, but + * other devices support 8. + */ + if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_EBT3000 && + cvmx_sysinfo_get()->board_rev_major == 1) + buflen = 4; + else + buflen = 8; + + if (req->newlen > buflen) + return (E2BIG); + + error = SYSCTL_IN(req, buf, req->newlen); + if (error != 0) + return (error); + + buf[req->newlen] = '\0'; + ebt3000_str_write(buf); + + return (0); +} + +SYSCTL_PROC(_machdep, OID_AUTO, led_display, CTLTYPE_STRING | CTLFLAG_WR, + NULL, 0, sysctl_machdep_led_display, "A", + "String to display on LED display"); + /** * version of printf that works better in exception context. * |