From 85129b4bd4d0be84070460827f0431ad99c13106 Mon Sep 17 00:00:00 2001 From: Juli Mallett Date: Sat, 24 Nov 2012 02:12:24 +0000 Subject: [PATCH] Use bootverbose to control debug printfs from the Cavium Simple Executive code. Also remove an unnecessary CVMX_ENABLE_DEBUG_PRINTS conditional around what is already a cvmx_dprintf. --- sys/contrib/octeon-sdk/cvmx-spi.c | 2 -- sys/contrib/octeon-sdk/cvmx-utils.h | 3 +++ sys/mips/cavium/octeon_machdep.c | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/sys/contrib/octeon-sdk/cvmx-spi.c b/sys/contrib/octeon-sdk/cvmx-spi.c index f901f890f6ef..5822c02b73d3 100644 --- a/sys/contrib/octeon-sdk/cvmx-spi.c +++ b/sys/contrib/octeon-sdk/cvmx-spi.c @@ -182,9 +182,7 @@ int cvmx_spi_restart_interface(int interface, cvmx_spi_mode_t mode, int timeout) if (!(OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX))) return res; -#if CVMX_ENABLE_DEBUG_PRINTS cvmx_dprintf ("SPI%d: Restart %s\n", interface, modes[mode]); -#endif // Callback to perform SPI4 reset INVOKE_CB(cvmx_spi_callbacks.reset_cb, interface,mode); diff --git a/sys/contrib/octeon-sdk/cvmx-utils.h b/sys/contrib/octeon-sdk/cvmx-utils.h index 6acd0fa31365..228c11dd2bce 100644 --- a/sys/contrib/octeon-sdk/cvmx-utils.h +++ b/sys/contrib/octeon-sdk/cvmx-utils.h @@ -76,6 +76,9 @@ extern "C" { #ifdef CVMX_BUILD_FOR_LINUX_KERNEL #define cvmx_dprintf printk #define cvmx_dvprintf vprintk + #elif defined(CVMX_BUILD_FOR_FREEBSD_KERNEL) + void cvmx_dvprintf(const char *, va_list); + void cvmx_dprintf(const char *, ...) __attribute__ ((format(printf, 1, 2))); #else #define cvmx_dprintf printf #define cvmx_dvprintf vprintf diff --git a/sys/mips/cavium/octeon_machdep.c b/sys/mips/cavium/octeon_machdep.c index 8bdcf749a2b1..fcf3ab66da14 100644 --- a/sys/mips/cavium/octeon_machdep.c +++ b/sys/mips/cavium/octeon_machdep.c @@ -446,6 +446,24 @@ SYSCTL_PROC(_machdep, OID_AUTO, led_display, CTLTYPE_STRING | CTLFLAG_WR, NULL, 0, sysctl_machdep_led_display, "A", "String to display on LED display"); +void +cvmx_dvprintf(const char *fmt, va_list ap) +{ + if (!bootverbose) + return; + vprintf(fmt, ap); +} + +void +cvmx_dprintf(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + cvmx_dvprintf(fmt, ap); + va_end(ap); +} + /** * version of printf that works better in exception context. *