Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/powerpc Convert more kernel printfs that mi...



details:   https://anonhg.NetBSD.org/src/rev/b1217af4a8b1
branches:  trunk
changeset: 372574:b1217af4a8b1
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Dec 10 13:06:41 2022 +0000

description:
Convert more kernel printfs that might happen very early (before kernel
console is usable) to ofprint.

diffstat:

 sys/arch/powerpc/powerpc/ofw_machdep.c |  29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diffs (105 lines):

diff -r aee8ef982300 -r b1217af4a8b1 sys/arch/powerpc/powerpc/ofw_machdep.c
--- a/sys/arch/powerpc/powerpc/ofw_machdep.c    Fri Dec 09 17:02:13 2022 +0000
+++ b/sys/arch/powerpc/powerpc/ofw_machdep.c    Sat Dec 10 13:06:41 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofw_machdep.c,v 1.33 2022/11/24 00:13:54 macallan Exp $        */
+/*     $NetBSD: ofw_machdep.c,v 1.34 2022/12/10 13:06:41 martin Exp $  */
 
 /*-
  * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.33 2022/11/24 00:13:54 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.34 2022/12/10 13:06:41 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -88,6 +88,11 @@
 #define DPRINTF while(0) printf
 #endif
 
+#define        ofpanic(FORMAT, ...)    do {                            \
+               ofprint(FORMAT __VA_OPT__(,) __VA_ARGS__);      \
+               panic(FORMAT __VA_OPT__(,) __VA_ARGS__);        \
+       } while (0)
+
 int    ofw_root;
 int    ofw_chosen;
 
@@ -185,7 +190,7 @@
 
        return;
  nocons:
-       panic("No /chosen could be found!\n");
+       ofpanic("No /chosen could be found!\n");
        console_node = -1;
 }
 
@@ -356,7 +361,7 @@
        OFavail[0].size = 0x20000000 - 0x3000;
 
 #else
-       panic("no memory?");
+       ofpanic("no memory?");
 #endif
        return;
 }
@@ -375,19 +380,19 @@
 
        if (OF_getprop(ofw_chosen, "mmu", &mmu_ihandle,
                       sizeof(mmu_ihandle)) <= 0) {
-               aprint_normal("No /chosen/mmu\n");
+               ofprint("No /chosen/mmu\n");
                return;
        }
        mmu_phandle = OF_instance_to_package(mmu_ihandle);
 
        proplen = OF_getproplen(mmu_phandle, "translations");
        if (proplen <= 0) {
-               aprint_normal("No translations in /chosen/mmu\n");
+               ofprint("No translations in /chosen/mmu\n");
                return;
        }
 
        if (proplen > sizeof(regs)) {
-               panic("/chosen/mmu translations too large");
+               ofpanic("/chosen/mmu translations too large");
        }
 
        proplen = OF_getprop(mmu_phandle, "translations", regs, sizeof(regs));
@@ -406,11 +411,11 @@
                        phys = (phys << 32) | *rp++;
                        break;
                default:
-                       panic("unexpected #address-cells");
+                       ofpanic("unexpected #address-cells");
                }
                mode = *rp++;
                if (rp > &regs[nregs]) {
-                       panic("unexpected OFW translations format");
+                       ofpanic("unexpected OFW translations format");
                }
 
                /* Wouldn't expect this, but... */
@@ -418,16 +423,16 @@
                        continue;
                }
 
-               aprint_normal("translation %d virt=%#"PRIx32
+               ofprint("translation %d virt=%#"PRIx32
                    " phys=%#"PRIx64" size=%#"PRIx32" mode=%#"PRIx32"\n",
                    idx, virt, phys, size, mode);
                
                if (sizeof(paddr_t) < 8 && phys >= 0x100000000ULL) {
-                       panic("translation phys out of range");
+                       ofpanic("translation phys out of range");
                }
 
                if (idx == OFW_MAX_TRANSLATIONS) {
-                       panic("too many OFW translations");
+                       ofpanic("too many OFW translations");
                }
 
                ofw_translations[idx].virt = virt;



Home | Main Index | Thread Index | Old Index