diff --git a/sys/arch/hpc/hpc/debug_subr.c b/sys/arch/hpc/hpc/debug_subr.c index 1efccc1bbbc7..276e0e6bc642 100644 --- a/sys/arch/hpc/hpc/debug_subr.c +++ b/sys/arch/hpc/hpc/debug_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: debug_subr.c,v 1.3 2002/02/22 19:56:27 uch Exp $ */ +/* $NetBSD: debug_subr.c,v 1.4 2002/05/03 07:31:23 takemura Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ static const char onoff[2] = "_x"; void __dbg_bit_print(u_int32_t a, int len, int start, int end, char *title, - int count) + int flags) { u_int32_t j, j1; int i, n; @@ -60,7 +60,8 @@ __dbg_bit_print(u_int32_t a, int len, int start, int end, char *title, j1 = 1 << n; end = end ? end : n; - printf(" "); + if (!(flags & DBG_BIT_PRINT_QUIET)) + printf(" "); if (title) { printf("[%-16s] ", title); } @@ -73,10 +74,12 @@ __dbg_bit_print(u_int32_t a, int len, int start, int end, char *title, } } - snprintf(buf, sizeof buf, " [0x%%0%dx %%12d]", len << 1); - printf(buf, a, a); + if (!(flags & DBG_BIT_PRINT_QUIET)) { + snprintf(buf, sizeof buf, " [0x%%0%dx %%12d]", len << 1); + printf(buf, a, a); + } - if (count) { + if (flags & DBG_BIT_PRINT_COUNT) { for (j = j1, i = n; j > 0; j >>=1, i--) { if (!(i > end || i < start) && (a & j)) { printf(" %d", i); @@ -84,7 +87,8 @@ __dbg_bit_print(u_int32_t a, int len, int start, int end, char *title, } } - printf("\n"); + if (!(flags & DBG_BIT_PRINT_QUIET)) + printf("\n"); } void diff --git a/sys/arch/hpc/include/debug.h b/sys/arch/hpc/include/debug.h index f4f9b3eb8ec5..9b4ea8b2d062 100644 --- a/sys/arch/hpc/include/debug.h +++ b/sys/arch/hpc/include/debug.h @@ -1,4 +1,4 @@ -/* $NetBSD: debug.h,v 1.3 2002/02/13 16:25:33 uch Exp $ */ +/* $NetBSD: debug.h,v 1.4 2002/05/03 07:31:24 takemura Exp $ */ /*- * Copyright (c) 1999-2002 The NetBSD Foundation, Inc. @@ -103,9 +103,14 @@ int DPRINTF_DEBUG = DPRINTF_LEVEL; /* * debug print utility */ -#define dbg_bit_print(a) __dbg_bit_print((a), sizeof(typeof(a)), 0, 0, 0, 1) +#define DBG_BIT_PRINT_COUNT (1 << 0) +#define DBG_BIT_PRINT_QUIET (1 << 1) +#define dbg_bit_print(a) \ + __dbg_bit_print((a), sizeof(typeof(a)), 0, 0, 0, DBG_BIT_PRINT_COUNT) #define dbg_bit_print_msg(a, m) \ - __dbg_bit_print((a), sizeof(typeof(a)), 0, 0, (m), 1) + __dbg_bit_print((a), sizeof(typeof(a)), 0, 0, (m), DBG_BIT_PRINT_COUNT) +#define dbg_bit_display(a) \ + __dbg_bit_print((a), sizeof(typeof(a)), 0, 0, 0, DBG_BIT_PRINT_QUIET) void __dbg_bit_print(u_int32_t, int, int, int, char *, int); void dbg_bitmask_print(u_int32_t, u_int32_t, const char *); void dbg_draw_line(int); diff --git a/sys/arch/hpcmips/dev/it8368.c b/sys/arch/hpcmips/dev/it8368.c index e33bfdd9232f..a9e5d0a66acc 100644 --- a/sys/arch/hpcmips/dev/it8368.c +++ b/sys/arch/hpcmips/dev/it8368.c @@ -1,4 +1,4 @@ -/* $NetBSD: it8368.c,v 1.12 2002/01/29 18:53:09 uch Exp $ */ +/* $NetBSD: it8368.c,v 1.13 2002/05/03 07:31:24 takemura Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -745,9 +745,9 @@ it8368_chip_socket_disable(pcmcia_chipset_handle_t pch) #ifdef IT8368DEBUG #define PRINTGPIO(m) __dbg_bit_print(it8368_reg_read(csregt, csregh, \ - IT8368_GPIO##m##_REG), 0, IT8368_GPIO_MAX, #m, 1) + IT8368_GPIO##m##_REG), 0, IT8368_GPIO_MAX, #m, DBG_BIT_PRINT_COUNT) #define PRINTMFIO(m) __dbg_bit_print(it8368_reg_read(csregt, csregh, \ - IT8368_MFIO##m##_REG), 0, IT8368_MFIO_MAX, #m, 1) + IT8368_MFIO##m##_REG), 0, IT8368_MFIO_MAX, #m, DBG_BIT_PRINT_COUNT) void it8368_dump(struct it8368e_softc *sc) { @@ -772,8 +772,8 @@ it8368_dump(struct it8368e_softc *sc) PRINTMFIO(POSINTSTAT); PRINTMFIO(NEGINTSTAT); __dbg_bit_print(it8368_reg_read(csregt, csregh, IT8368_CTRL_REG), 0, 15, - "CTRL", 1); + "CTRL", DBG_BIT_PRINT_COUNT); __dbg_bit_print(it8368_reg_read(csregt, csregh, IT8368_GPIODATAIN_REG), - 8, 11, "]CRDDET/SENSE[", 1); + 8, 11, "]CRDDET/SENSE[", DBG_BIT_PRINT_COUNT); } #endif /* IT8368DEBUG */ diff --git a/sys/arch/hpcmips/tx/tx39icu.c b/sys/arch/hpcmips/tx/tx39icu.c index 4e9e8b9f9aed..079f07e8f479 100644 --- a/sys/arch/hpcmips/tx/tx39icu.c +++ b/sys/arch/hpcmips/tx/tx39icu.c @@ -1,4 +1,4 @@ -/* $NetBSD: tx39icu.c,v 1.16 2002/01/29 18:53:15 uch Exp $ */ +/* $NetBSD: tx39icu.c,v 1.17 2002/05/03 07:31:25 takemura Exp $ */ /*- * Copyright (c) 1999-2001 The NetBSD Foundation, Inc. @@ -402,7 +402,7 @@ TX_INTR(u_int32_t status, u_int32_t cause, u_int32_t pc, u_int32_t ipending) pend &= ~reg; if (pend) { printf("%d pending:", i); - __dbg_bit_print(pend, 0, 31, 0, 1); + dbg_bit_print(pend); } #endif @@ -761,13 +761,13 @@ tx39_intr_dump(struct tx39icu_softc *sc) } } sprintf(msg, "%d high", i); - __dbg_bit_print(reg, sizeof(reg), 0, 0, msg, 1); + dbg_bit_print_msg(reg, msg); sprintf(msg, "%d status", i); - __dbg_bit_print(sc->sc_regs[i], sizeof(reg), 0, 0, msg, 1); + dbg_bit_print_msg(sc->sc_regs[i], msg); ofs = TX39_INTRENABLE_REG(i); reg = tx_conf_read(tc, ofs); sprintf(msg, "%d enable", i); - __dbg_bit_print(reg, sizeof(reg), 0, 0, msg, 1); + dbg_bit_print_msg(reg, msg); } reg = sc->sc_regs[0]; printf("<%s><%s> vector=%2d\t\t[6 status]\n", @@ -775,6 +775,7 @@ tx39_intr_dump(struct tx39icu_softc *sc) reg & TX39_INTRSTATUS6_IRQLOW ? "LO" : "--", TX39_INTRSTATUS6_INTVECT(reg)); reg = tx_conf_read(tc, TX39_INTRENABLE6_REG); - __dbg_bit_print(reg, sizeof(reg), 0, 18, "6 enable", 1); + __dbg_bit_print(reg, sizeof(reg), 0, 18, "6 enable", + DBG_BIT_PRINT_COUNT); } diff --git a/sys/arch/hpcmips/vr/vrgiu.c b/sys/arch/hpcmips/vr/vrgiu.c index 4c017740c671..60d678805bd2 100644 --- a/sys/arch/hpcmips/vr/vrgiu.c +++ b/sys/arch/hpcmips/vr/vrgiu.c @@ -1,4 +1,4 @@ -/* $NetBSD: vrgiu.c,v 1.34 2002/02/10 13:47:06 takemura Exp $ */ +/* $NetBSD: vrgiu.c,v 1.35 2002/05/03 07:31:25 takemura Exp $ */ /*- * Copyright (c) 1999-2001 * Shin Takemura and PocketBSD Project. All rights reserved. @@ -363,8 +363,9 @@ void vrgiu_dump_io(struct vrgiu_softc *sc) { - dbg_bit_print(vrgiu_regread_4(sc, GIUPIOD_REG)); - dbg_bit_print(vrgiu_regread_4(sc, GIUPODAT_REG)); + dbg_bit_display(vrgiu_regread_4(sc, GIUPODAT_REG)); + dbg_bit_display(vrgiu_regread_4(sc, GIUPIOD_REG)); + printf("\n"); } void @@ -379,8 +380,9 @@ vrgiu_diff_io() if (opreg[0] != preg[0] || opreg[1] != preg[1]) { printf("giu data: "); - dbg_bit_print(preg[0]); - dbg_bit_print(preg[1]); + dbg_bit_display(preg[1]); + dbg_bit_display(preg[0]); + printf("\n"); } opreg[0] = preg[0]; opreg[1] = preg[1]; diff --git a/sys/arch/hpcsh/dev/hd64461/hd64461video.c b/sys/arch/hpcsh/dev/hd64461/hd64461video.c index a676fa60e661..23483e7ed048 100644 --- a/sys/arch/hpcsh/dev/hd64461/hd64461video.c +++ b/sys/arch/hpcsh/dev/hd64461/hd64461video.c @@ -1,4 +1,4 @@ -/* $NetBSD: hd64461video.c,v 1.10 2002/04/13 09:29:54 takemura Exp $ */ +/* $NetBSD: hd64461video.c,v 1.11 2002/05/03 07:31:25 takemura Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -1225,7 +1225,7 @@ hd64461video_dump() printf("---[Display Mode Setting]---\n"); #define DUMPREG(x) \ r = hd64461_reg_read_2(HD64461_LCD ## x ## _REG16); \ - __dbg_bit_print(r, sizeof(u_int16_t), 0, 0, #x, 1) + __dbg_bit_print(r, sizeof(u_int16_t), 0, 0, #x, DBG_BIT_PRINT_COUNT) DUMPREG(CBAR); DUMPREG(CLOR); DUMPREG(CCR);