diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2006-04-07 16:28:08 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2006-04-07 16:28:08 +0000 |
commit | 25d9d9c73f0ed66c79eebd14114a998107312a7c (patch) | |
tree | cac3602ef8c01b4b45c22e7ee02e8e293806594e /sys/dev/ic | |
parent | 155545a7d40a7cef2aef85546c9ab6b2c03b31a2 (diff) |
Make a better debug mechanism.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/mfi.c | 21 | ||||
-rw-r--r-- | sys/dev/ic/mfivar.h | 17 |
2 files changed, 29 insertions, 9 deletions
diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c index 33d25e56c51..b84801466ed 100644 --- a/sys/dev/ic/mfi.c +++ b/sys/dev/ic/mfi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfi.c,v 1.3 2006/04/07 16:11:21 marco Exp $ */ +/* $OpenBSD: mfi.c,v 1.4 2006/04/07 16:28:07 marco Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * @@ -40,7 +40,15 @@ #include <dev/biovar.h> #endif -#define MFI_DEBUG +#ifdef MFI_DEBUG +uint32_t mfi_debug = 0 + | MFI_D_CMD + | MFI_D_INTR + | MFI_D_MISC +/* | MFI_D_DMA */ +/* | MFI_D_IOCTL */ + ; +#endif struct cfdriver mfi_cd = { NULL, "mfi", DV_DULL @@ -66,17 +74,14 @@ mfi_transition_firmware(struct mfi_softc *sc) int32_t fw_state, cur_state; int max_wait, i; -#ifdef MFI_DEBUG - printf("%s: mfi_transition_mfi\n", DEVNAME(sc)); -#endif /* MFI_DEBUG */ + DNPRINTF(MFI_D_CMD, "%s: mfi_transition_mfi\n", DEVNAME(sc)); fw_state = bus_space_read_4(sc->sc_iot, sc->sc_ioh, MFI_OMSG0) & MFI_STATE_MASK; while (fw_state != MFI_STATE_READY) { -#ifdef MFI_DEBUG - printf("%s: waiting for firmware to become ready\n", + DNPRINTF(MFI_D_MISC, + "%s: waiting for firmware to become ready\n", DEVNAME(sc)); -#endif /* MFI_DEBUG */ cur_state = fw_state; switch (fw_state) { case MFI_STATE_FAULT: diff --git a/sys/dev/ic/mfivar.h b/sys/dev/ic/mfivar.h index 8dbf59a5332..15072878660 100644 --- a/sys/dev/ic/mfivar.h +++ b/sys/dev/ic/mfivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mfivar.h,v 1.2 2006/04/07 16:10:34 marco Exp $ */ +/* $OpenBSD: mfivar.h,v 1.3 2006/04/07 16:28:07 marco Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * @@ -17,6 +17,21 @@ #define DEVNAME(_s) ((_s)->sc_dev.dv_xname) +#define MFI_DEBUG +#ifdef MFI_DEBUG +extern uint32_t mfi_debug; +#define DPRINTF(x...) do { if (mfi_debug) printf(x); } while(0) +#define DNPRINTF(n,x...) do { if (mfi_debug & n) printf(x); } while(0) +#define MFI_D_CMD 0x0001 +#define MFI_D_INTR 0x0002 +#define MFI_D_MISC 0x0004 +#define MFI_D_DMA 0x0008 +#define MFI_D_IOCTL 0x0010 +#else +#define DPRINTF(x...) +#define DNPRINTF(n,x...) +#endif + struct mfi_softc { struct device sc_dev; void *sc_ih; |