summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2003-08-20 05:44:55 +0000
committerimp <imp@FreeBSD.org>2003-08-20 05:44:55 +0000
commit8b251db37c57403074283cdc44200b4124088064 (patch)
treeb7bd38c5d2a84c22b22cddc7de8fb07b44d73984
parentef7e40c45196cb84991cf5a82ee07e0f77267b0a (diff)
downloadFreeBSD-src-8b251db37c57403074283cdc44200b4124088064.zip
FreeBSD-src-8b251db37c57403074283cdc44200b4124088064.tar.gz
When debugging CIS, only print 10 CISTPL_NULLs. Chances are good they
are all bogus, and the cards that don't decode things quite right often have hundreds of them. This will fix starvation of small dmesg buffers and allow better debugging to happen. I thought about adding an override, but there is such a thing as too many knobs. :-)
-rw-r--r--sys/dev/pccard/pccard_cis.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/dev/pccard/pccard_cis.c b/sys/dev/pccard/pccard_cis.c
index e1b498b..2b8648d 100644
--- a/sys/dev/pccard/pccard_cis.c
+++ b/sys/dev/pccard/pccard_cis.c
@@ -52,8 +52,8 @@ extern int pccard_cis_debug;
#define PCCARDCISDEBUG
#ifdef PCCARDCISDEBUG
-#define DPRINTF(arg) if (pccard_cis_debug) printf arg
-#define DEVPRINTF(arg) if (pccard_cis_debug) device_printf arg
+#define DPRINTF(arg) do { if (pccard_cis_debug) printf arg; } while (0)
+#define DEVPRINTF(arg) do { if (pccard_cis_debug) device_printf arg; } while (0)
#else
#define DPRINTF(arg)
#define DEVPRINTF(arg)
@@ -112,6 +112,9 @@ pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
u_long longlink_addr; /* Type suspect */
int mfc_count;
int mfc_index;
+#ifdef PCCARDCISDEBUG
+ int cis_none_cnt = 10; /* Only report 10 CIS_NONEs */
+#endif
struct {
int common;
u_long addr;
@@ -169,7 +172,13 @@ pccard_scan_cis(device_t dev, int (*fct)(struct pccard_tuple *, void *),
/* two special-case tuples */
if (tuple.code == PCCARD_CISTPL_NULL) {
- DPRINTF(("CISTPL_NONE\n 00\n"));
+#ifdef PCCARDCISDEBUG
+ if (cis_none_cnt > 0)
+ DPRINTF(("CISTPL_NONE\n 00\n"));
+ else if (cis_none_cnt == 0)
+ DPRINTF(("TOO MANY CIS_NONE\n"));
+ cis_none_cnt--;
+#endif
tuple.ptr++;
continue;
} else if (tuple.code == PCCARD_CISTPL_END) {
OpenPOWER on IntegriCloud