Module Name: src Committed By: thorpej Date: Tue Mar 2 02:28:45 UTC 2021
Modified Files: src/sys/arch/powerpc/include: ofw_machdep.h src/sys/arch/powerpc/powerpc: ofw_machdep.c Log Message: - Add a boolean "ofwbootcons_suppress" that, when true, suppresses ofwbootcons I/O (i.e. "doesn't call into OFW"). This allows platform code to ensure that early console I/O doesn't occur in certain critical sections. - When printing the translations, put phys next to virt for easier visual comparisons. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/include/ofw_machdep.h cvs rdiff -u -r1.29 -r1.30 src/sys/arch/powerpc/powerpc/ofw_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/powerpc/include/ofw_machdep.h diff -u src/sys/arch/powerpc/include/ofw_machdep.h:1.3 src/sys/arch/powerpc/include/ofw_machdep.h:1.4 --- src/sys/arch/powerpc/include/ofw_machdep.h:1.3 Sun Feb 28 20:31:32 2021 +++ src/sys/arch/powerpc/include/ofw_machdep.h Tue Mar 2 02:28:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ofw_machdep.h,v 1.3 2021/02/28 20:31:32 thorpej Exp $ */ +/* $NetBSD: ofw_machdep.h,v 1.4 2021/03/02 02:28:45 thorpej Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -54,6 +54,8 @@ struct OF_translation { #define OFW_MAX_TRANSLATIONS 48 +extern bool ofwbootcons_suppress; /* supporess OF console I/O */ + extern int ofw_chosen; /* cached handle for "/chosen" */ extern struct OF_translation ofw_translations[OFW_MAX_TRANSLATIONS]; Index: src/sys/arch/powerpc/powerpc/ofw_machdep.c diff -u src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.29 src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.30 --- src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.29 Sat Feb 20 01:57:54 2021 +++ src/sys/arch/powerpc/powerpc/ofw_machdep.c Tue Mar 2 02:28:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ofw_machdep.c,v 1.29 2021/02/20 01:57:54 thorpej Exp $ */ +/* $NetBSD: ofw_machdep.c,v 1.30 2021/03/02 02:28:45 thorpej 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.29 2021/02/20 01:57:54 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.30 2021/03/02 02:28:45 thorpej Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -99,6 +99,8 @@ bool ofw_real_mode; int console_node = -1, console_instance = -1; int ofw_stdin, ofw_stdout; +bool ofwbootcons_suppress; + int ofw_address_cells; int ofw_size_cells; @@ -108,6 +110,10 @@ ofwbootcons_cngetc(dev_t dev) unsigned char ch = '\0'; int l; + if (ofwbootcons_suppress) { + return ch; + } + while ((l = OF_read(ofw_stdin, &ch, 1)) != 1) { if (l != -2 && l != 0) { return -1; @@ -121,6 +127,10 @@ ofwbootcons_cnputc(dev_t dev, int c) { char ch = c; + if (ofwbootcons_suppress) { + return; + } + OF_write(ofw_stdout, &ch, 1); } @@ -394,8 +404,8 @@ ofw_bootstrap_get_translations(void) } aprint_normal("translation %d virt=%#"PRIx32 - " size=%#"PRIx32" phys=%#"PRIx64" mode=%#"PRIx32"\n", - idx, virt, size, phys, mode); + " 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");