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 Replace #ifdef DEBUG/BTLBDEBUG with DPR...
details: https://anonhg.NetBSD.org/src/rev/b5cb116bc596
branches: trunk
changeset: 778580:b5cb116bc596
user: skrll <skrll%NetBSD.org@localhost>
date: Thu Apr 05 20:12:09 2012 +0000
description:
Replace #ifdef DEBUG/BTLBDEBUG with DPRINTF{,N}
diffstat:
sys/arch/hp700/hp700/machdep.c | 174 +++++++++++++++++++---------------------
1 files changed, 81 insertions(+), 93 deletions(-)
diffs (truncated from 342 to 300 lines):
diff -r cab26352b526 -r b5cb116bc596 sys/arch/hp700/hp700/machdep.c
--- a/sys/arch/hp700/hp700/machdep.c Thu Apr 05 19:53:35 2012 +0000
+++ b/sys/arch/hp700/hp700/machdep.c Thu Apr 05 20:12:09 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.109 2012/02/26 07:52:52 skrll Exp $ */
+/* $NetBSD: machdep.c,v 1.110 2012/04/05 20:12:09 skrll Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.109 2012/02/26 07:52:52 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.110 2012/04/05 20:12:09 skrll Exp $");
#include "opt_cputype.h"
#include "opt_ddb.h"
@@ -133,6 +133,24 @@
#include "ksyms.h"
#include "lcd.h"
+#ifdef MACHDEPDEBUG
+
+#define DPRINTF(s) do { \
+ if (machdepdebug) \
+ printf s; \
+} while(0)
+
+#define DPRINTFN(l,s) do { \
+ if (machdepdebug >= (1)) \
+ printf s; \
+} while(0)
+
+int machdepdebug = 1;
+#else
+#define DPRINTF(s) /* */
+#define DPRINTFN(l,s) /* */
+#endif
+
/*
* Different kinds of flags used throughout the kernel.
*/
@@ -466,9 +484,7 @@
/* cache parameters */
error = pdcproc_cache(&pdc_cache);
if (error < 0) {
-#ifdef DEBUG
- printf("WARNING: PDC_CACHE error %d\n", error);
-#endif
+ DPRINTF(("WARNING: PDC_CACHE error %d\n", error));
}
dcache_line_mask = pdc_cache.dc_conf.cc_line * 16 - 1;
@@ -477,9 +493,7 @@
icache_stride = pdc_cache.ic_stride;
error = pdcproc_cache_spidbits(&pdc_spidbits);
-#ifdef DEBUG
- printf("SPID bits: 0x%x, error = %d\n", pdc_spidbits.spidbits, error);
-#endif
+ DPRINTF(("SPID bits: 0x%x, error = %d\n", pdc_spidbits.spidbits, error));
/* Calculate the OS_HPMC handler checksums. */
p = &os_hpmc;
@@ -568,15 +582,12 @@
* WITHOUT TAKING SPECIAL MEASURES.
*/
-#ifdef DEBUG
- printf("%s: PDC_CHASSIS\n", __func__);
-#endif
+ DPRINTF(("%s: PDC_CHASSIS\n", __func__));
+
/* they say PDC_COPROC might turn fault light on */
pdcproc_chassis_display(PDC_OSTAT(PDC_OSTAT_RUN) | 0xCEC0);
-#ifdef DEBUG
- printf("%s: intr bootstrap\n", __func__);
-#endif
+ DPRINTF(("%s: intr bootstrap\n", __func__));
/* Bootstrap interrupt masking and dispatching. */
hp700_intr_bootstrap();
@@ -658,39 +669,34 @@
/* identify system type */
error = pdcproc_model_info(&pdc_model);
if (error < 0) {
-#ifdef DEBUG
- printf("WARNING: PDC_MODEL_INFO error %d\n", error);
-#endif
+ DPRINTF(("WARNING: PDC_MODEL_INFO error %d\n", error));
+
pdc_model.hwmodel = 0;
pdc_model.hv = 0;
} else {
-#ifdef DEBUG
- printf("pdc_model.hwmodel/hv %x/%x\n", pdc_model.hwmodel,
- pdc_model.hv);
-#endif
+ DPRINTF(("pdc_model.hwmodel/hv %x/%x\n", pdc_model.hwmodel,
+ pdc_model.hv));
}
cpu_modelno = pdc_model.hwmodel;
model = hppa_mod_info(HPPA_TYPE_BOARD, cpu_modelno);
-#ifdef DEBUG
- printf("%s: model %s\n", __func__, model);
-#endif
+
+ DPRINTF(("%s: model %s\n", __func__, model));
+
pdc_settype(cpu_modelno);
memset(&pdc_cpuid, 0, sizeof(pdc_cpuid));
error = pdcproc_model_cpuid(&pdc_cpuid);
if (error < 0) {
-#ifdef DEBUG
- printf("WARNING: PDC_MODEL_CPUID error %d. "
- "Using cpu_modelno based cpu_type.\n", error);
-#endif
+ DPRINTF(("WARNING: PDC_MODEL_CPUID error %d. "
+ "Using cpu_modelno based cpu_type.\n", error));
+
cpu_type = cpu_model_cpuid(cpu_modelno);
} else {
-#ifdef DEBUG
- printf("%s: cpuid.version = %x\n", __func__,
- pdc_cpuid.version);
- printf("%s: cpuid.revision = %x\n", __func__,
- pdc_cpuid.revision);
-#endif
+ DPRINTF(("%s: cpuid.version = %x\n", __func__,
+ pdc_cpuid.version));
+ DPRINTF(("%s: cpuid.revision = %x\n", __func__,
+ pdc_cpuid.revision));
+
cpu_version = pdc_cpuid.version;
/* XXXNH why? */
@@ -704,62 +710,50 @@
memset(&pdc_coproc, 0, sizeof(pdc_coproc));
error = pdcproc_coproc(&pdc_coproc);
if (error < 0) {
- printf("WARNING: PDC_COPROC error %d\n", error);
+ DPRINTF(("WARNING: PDC_COPROC error %d\n", error));
pdc_coproc.ccr_enable = 0;
} else {
-#ifdef DEBUG
- printf("pdc_coproc: 0x%x, 0x%x; model %x rev %x\n",
+ DPRINTF(("pdc_coproc: 0x%x, 0x%x; model %x rev %x\n",
pdc_coproc.ccr_enable, pdc_coproc.ccr_present,
- pdc_coproc.fpu_model, pdc_coproc.fpu_revision);
+ pdc_coproc.fpu_model, pdc_coproc.fpu_revision));
-#endif
/* a kludge to detect PCXW */
if (pdc_coproc.fpu_model == HPPA_FPU_PCXW)
cpu_version = HPPA_CPU_PCXW;
}
mtctl(pdc_coproc.ccr_enable & CCR_MASK, CR_CCR);
-#ifdef DEBUG
- printf("%s: bootstrap fpu\n", __func__);
-#endif
-
+ DPRINTF(("%s: bootstrap fpu\n", __func__));
+
usebtlb = 0;
if (cpu_version == HPPA_CPU_PCXW || cpu_version > HPPA_CPU_PCXL2) {
-#ifdef DEBUG
- printf("WARNING: BTLB no supported on cpu %d\n", cpu_version);
-#endif
+ DPRINTF(("WARNING: BTLB no supported on cpu %d\n", cpu_version));
} else {
/* BTLB params */
error = pdcproc_block_tlb(&pdc_btlb);
if (error < 0) {
-#ifdef DEBUG
- printf("WARNING: PDC_BTLB error %d\n", error);
-#endif
+ DPRINTF(("WARNING: PDC_BTLB error %d\n", error));
} else {
-#define BTLBDEBUG 1
-
-#ifdef BTLBDEBUG
- printf("btlb info: minsz=%d, maxsz=%d\n",
- pdc_btlb.min_size, pdc_btlb.max_size);
- printf("btlb fixed: i=%d, d=%d, c=%d\n",
+ DPRINTFN(10, ("btlb info: minsz=%d, maxsz=%d\n",
+ pdc_btlb.min_size, pdc_btlb.max_size));
+ DPRINTFN(10, ("btlb fixed: i=%d, d=%d, c=%d\n",
pdc_btlb.finfo.num_i,
pdc_btlb.finfo.num_d,
- pdc_btlb.finfo.num_c);
- printf("btlb varbl: i=%d, d=%d, c=%d\n",
+ pdc_btlb.finfo.num_c));
+ DPRINTFN(10, ("btlb varbl: i=%d, d=%d, c=%d\n",
pdc_btlb.vinfo.num_i,
pdc_btlb.vinfo.num_d,
- pdc_btlb.vinfo.num_c);
-#endif /* BTLBDEBUG */
+ pdc_btlb.vinfo.num_c));
+
/* purge TLBs and caches */
if (pdcproc_btlb_purgeall() < 0)
- printf("WARNING: BTLB purge failed\n");
+ DPRINTFN(10, ("WARNING: BTLB purge failed\n"));
hppa_btlb_size_min = pdc_btlb.min_size;
hppa_btlb_size_max = pdc_btlb.max_size;
-#ifdef DEBUG
- printf("hppa_btlb_size_min 0x%x\n", hppa_btlb_size_min);
- printf("hppa_btlb_size_max 0x%x\n", hppa_btlb_size_max);
-#endif
+
+ DPRINTF(("hppa_btlb_size_min 0x%x\n", hppa_btlb_size_min));
+ DPRINTF(("hppa_btlb_size_max 0x%x\n", hppa_btlb_size_max));
if (pdc_btlb.finfo.num_c)
cpu_features |= HPPA_FTRS_BTLBU;
@@ -775,13 +769,11 @@
pmap_hptsize = pdc_hwtlb.max_size;
else if (pmap_hptsize && pmap_hptsize < pdc_hwtlb.min_size)
pmap_hptsize = pdc_hwtlb.min_size;
-#ifdef DEBUG
- printf("%s: pmap_hptsize 0x%x\n", __func__, pmap_hptsize);
-#endif
+
+ DPRINTF(("%s: pmap_hptsize 0x%x\n", __func__, pmap_hptsize));
} else {
-#ifdef DEBUG
- printf("WARNING: no HPT support, fine!\n");
-#endif
+ DPRINTF(("WARNING: no HPT support, fine!\n"));
+
pmap_hptsize = 0;
}
@@ -918,7 +910,7 @@
#ifdef DEBUG
if (totalphysmem > physmem) {
format_bytes(pbuf[0], sizeof(pbuf[0]), ptoa(totalphysmem - physmem));
- printf("lost mem = %s\n", pbuf[0]);
+ DPRINTF(("lost mem = %s\n", pbuf[0]));
}
#endif
@@ -1067,7 +1059,7 @@
error = pdcproc_btlb_insert(sp, va, pa, sz, prot, i);
if (error < 0) {
#ifdef BTLBDEBUG
- printf("WARNING: BTLB insert failed (%d)\n", error);
+ DPRINTF(("WARNING: BTLB insert failed (%d)\n", error);
#endif
}
return error;
@@ -1099,21 +1091,22 @@
default: prot = "??????"; break;
}
- printf(" [ BTLB slot %d: %s 0x%08x @ 0x%x:0x%08x len 0x%08x prot 0x%08x] ",
- btlb_slot->btlb_slot_number,
- prot,
- (u_int)btlb_slot->btlb_slot_pa_frame << PGSHIFT,
- btlb_slot->btlb_slot_va_space,
- (u_int)btlb_slot->btlb_slot_va_frame << PGSHIFT,
- (u_int)btlb_slot->btlb_slot_frames << PGSHIFT,
- btlb_slot->btlb_slot_tlbprot);
+ DPRINTFN(10, (
+ " [ BTLB %d: %s 0x%08x @ 0x%x:0x%08x len 0x%08x prot 0x%08x] ",
+ btlb_slot->btlb_slot_number,
+ prot,
+ (u_int)btlb_slot->btlb_slot_pa_frame << PGSHIFT,
+ btlb_slot->btlb_slot_va_space,
+ (u_int)btlb_slot->btlb_slot_va_frame << PGSHIFT,
+ (u_int)btlb_slot->btlb_slot_frames << PGSHIFT,
+ btlb_slot->btlb_slot_tlbprot));
/*
* Non-I/O space mappings are entered by the pmap,
* so we do print a newline to make things look better.
*/
if (btlb_slot->btlb_slot_pa_frame < (HPPA_IOSPACE >> PGSHIFT))
- printf("\n");
+ DPRINTFN(10, ("\n"));
#endif
/* Insert this mapping. */
@@ -1126,7 +1119,7 @@
btlb_slot->btlb_slot_number);
if (error < 0) {
#ifdef BTLBDEBUG
- printf("WARNING: BTLB insert failed (%d)\n", error);
+ DPRINTF(("WARNING: BTLB insert failed (%d)\n", error);
#endif
}
return (error ? EINVAL : 0);
@@ -1181,7 +1174,7 @@
frames >>= PGSHIFT;
if (frames > pdc_btlb.max_size) {
Home |
Main Index |
Thread Index |
Old Index