Author: jmallett Date: Mon Oct 29 07:06:23 2012 New Revision: 242302 URL: http://svn.freebsd.org/changeset/base/242302
Log: Add a sysctl to change the LED display. Modified: head/sys/mips/cavium/octeon_machdep.c Modified: head/sys/mips/cavium/octeon_machdep.c ============================================================================== --- head/sys/mips/cavium/octeon_machdep.c Mon Oct 29 06:31:51 2012 (r242301) +++ head/sys/mips/cavium/octeon_machdep.c Mon Oct 29 07:06:23 2012 (r242302) @@ -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 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. * _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"