From ad5ba0d73ee6ef7d70cd0fc5091da7359f3bb8a5 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Mon, 16 May 2016 20:22:52 +0000 Subject: [PATCH] [siba] fix up debugging. * unbreak non-debug builds - don't default to debugging SCAN; that was left-over from my testing. * include opt_siba.h, now that it's generated as appropriate. * stick the debug enum outside the debug block, just so it's there for any code that wants to set siba_debug for some reason (like say, my debugging muckup.) * make DPRINTF() use __VA_ARGS__ for formatting too, so it correctly handles printing w/ no args. * Make DPRINTF() use device_printf(). Sponsored by: Palm Springs --- sys/dev/siba/siba_core.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/dev/siba/siba_core.c b/sys/dev/siba/siba_core.c index 6b100f078fe4..bbed7f6a8eae 100644 --- a/sys/dev/siba/siba_core.c +++ b/sys/dev/siba/siba_core.c @@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$"); * the Sonics Silicon Backplane driver. */ +#include "opt_siba.h" + #include #include #include @@ -60,7 +62,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef SIBA_DEBUG enum { SIBA_DEBUG_SCAN = 0x00000001, /* scan */ SIBA_DEBUG_PMU = 0x00000002, /* PMU */ @@ -70,13 +71,16 @@ enum { SIBA_DEBUG_CORE = 0x00000020, /* handling cores */ SIBA_DEBUG_ANY = 0xffffffff }; -#define DPRINTF(siba, m, fmt, ...) do { \ - if (siba->siba_debug & (m)) \ - printf(fmt, __VA_ARGS__); \ + +#ifdef SIBA_DEBUG +#define DPRINTF(siba, m, ...) do { \ + if (siba->siba_debug & (m)) \ + device_printf(siba->siba_dev, __VA_ARGS__); \ } while (0) #else -#define DPRINTF(siba, m, fmt, ...) do { (void) siba; } while (0) +#define DPRINTF(siba, m, ...) do { (void) siba; } while (0) #endif + #define N(a) (sizeof(a) / sizeof(a[0])) static void siba_pci_gpio(struct siba_softc *, uint32_t, int); @@ -184,8 +188,6 @@ siba_core_attach(struct siba_softc *siba) siba->siba_ops = &siba_pci_ops; - siba->siba_debug = SIBA_DEBUG_SCAN; - siba_pci_gpio(siba, SIBA_GPIO_CRYSTAL | SIBA_GPIO_PLL, 1); siba_scan(siba);