diff options
| author | martin <martin@NetBSD.org> | 2022-12-10 13:06:41 +0000 |
|---|---|---|
| committer | martin <martin@NetBSD.org> | 2022-12-10 13:06:41 +0000 |
| commit | a5f79b4d647818d6bf7e828f57cbc4e2a9cfd7cd (patch) | |
| tree | 88b44a16a19531eacc4c34fea33b61104eb10d69 /sys | |
| parent | 5960e8ba374aecd241d87a67c59fc4abcc5842ca (diff) | |
Convert more kernel printfs that might happen very early (before kernel
console is usable) to ofprint.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/arch/powerpc/powerpc/ofw_machdep.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/sys/arch/powerpc/powerpc/ofw_machdep.c b/sys/arch/powerpc/powerpc/ofw_machdep.c index 3d3222a71d6..91c874759b9 100644 --- a/sys/arch/powerpc/powerpc/ofw_machdep.c +++ b/sys/arch/powerpc/powerpc/ofw_machdep.c @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.33 2022/11/24 00:13:54 macallan Ex #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 @@ ofw_bootstrap_console(void) return; nocons: - panic("No /chosen could be found!\n"); + ofpanic("No /chosen could be found!\n"); console_node = -1; } @@ -356,7 +361,7 @@ error: OFavail[0].size = 0x20000000 - 0x3000; #else - panic("no memory?"); + ofpanic("no memory?"); #endif return; } @@ -375,19 +380,19 @@ ofw_bootstrap_get_translations(void) 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 @@ ofw_bootstrap_get_translations(void) phys = (phys << 32) | *rp++; break; default: - panic("unexpected #address-cells"); + ofpanic("unexpected #address-cells"); } mode = *rp++; if (rp > ®s[nregs]) { - panic("unexpected OFW translations format"); + ofpanic("unexpected OFW translations format"); } /* Wouldn't expect this, but... */ @@ -418,16 +423,16 @@ ofw_bootstrap_get_translations(void) 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; |
