Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hp700/hp700 Define DPRINTF and use it.



details:   https://anonhg.NetBSD.org/src/rev/552530b11f11
branches:  trunk
changeset: 749557:552530b11f11
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Dec 02 13:49:32 2009 +0000

description:
Define DPRINTF and use it.

diffstat:

 sys/arch/hp700/hp700/mainbus.c |  31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diffs (82 lines):

diff -r 68dae7a70220 -r 552530b11f11 sys/arch/hp700/hp700/mainbus.c
--- a/sys/arch/hp700/hp700/mainbus.c    Wed Dec 02 13:45:13 2009 +0000
+++ b/sys/arch/hp700/hp700/mainbus.c    Wed Dec 02 13:49:32 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.57 2009/12/02 13:45:13 skrll Exp $       */
+/*     $NetBSD: mainbus.c,v 1.58 2009/12/02 13:49:32 skrll Exp $       */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.57 2009/12/02 13:45:13 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.58 2009/12/02 13:49:32 skrll Exp $");
 
 #include "locators.h"
 #include "power.h"
@@ -83,6 +83,18 @@
 
 static struct pdc_hpa pdc_hpa PDC_ALIGNMENT;
 
+#ifdef MBUSDEBUG
+
+#define        DPRINTF(s)      do {    \
+       if (mbusdebug)          \
+               printf s;       \
+} while(0)
+
+int mbusdebug = 1;
+#else
+#define        DPRINTF(s)      /* */
+#endif
+
 struct mainbus_softc {
        device_t sc_dv;
 
@@ -178,6 +190,9 @@
        int error;
 #endif /* USE_BTLB */
 
+       DPRINTF(("\n%s(%lx,%lx,%scachable,%p)\n", __func__,
+           bpa, size, flags? "" : "non", bshp));
+
        /*
         * We must be called with a page-aligned address in
         * I/O space, and with a multiple of the page size.
@@ -330,9 +345,9 @@
        error = mbus_add_mapping(bpa, size, flags, bshp);
        *bshp |= offset;
        if (error) {
+               DPRINTF(("bus_space_map: pa 0x%lx, size 0x%lx failed\n",
+                   bpa, size));
                if (extent_free(hp700_io_extent, bpa, size, EX_NOWAIT)) {
-                       printf ("bus_space_map: pa 0x%lx, size 0x%lx\n",
-                               bpa, size);
                        printf ("bus_space_map: can't free region\n");
                }
        }
@@ -367,8 +382,8 @@
         */
        error = extent_free(hp700_io_extent, bpa, size, EX_NOWAIT);
        if (error) {
-               printf("bus_space_unmap: ps 0x%lx, size 0x%lx\n",
-                   bpa, size);
+               DPRINTF(("bus_space_unmap: ps 0x%lx, size 0x%lx\n",
+                   bpa, size));
                panic("bus_space_unmap: can't free region (%d)", error);
        }
 }
@@ -405,9 +420,9 @@
         */
        error = mbus_add_mapping(bpa, size, flags, bshp);
        if (error) {
+               DPRINTF(("bus_space_alloc: pa 0x%lx, size 0x%lx failed\n",
+                   bpa, size));
                if (extent_free(hp700_io_extent, bpa, size, EX_NOWAIT)) {
-                       printf("bus_space_alloc: pa 0x%lx, size 0x%lx\n",
-                               bpa, size);
                        printf("bus_space_alloc: can't free region\n");
                }
        }



Home | Main Index | Thread Index | Old Index