Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc - Add a boolean "ofwbootcons_suppress" that...



details:   https://anonhg.NetBSD.org/src/rev/cc3e6682bb73
branches:  trunk
changeset: 953246:cc3e6682bb73
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Mar 02 02:28:45 2021 +0000

description:
- 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.

diffstat:

 sys/arch/powerpc/include/ofw_machdep.h |   4 +++-
 sys/arch/powerpc/powerpc/ofw_machdep.c |  18 ++++++++++++++----
 2 files changed, 17 insertions(+), 5 deletions(-)

diffs (78 lines):

diff -r a97df8811459 -r cc3e6682bb73 sys/arch/powerpc/include/ofw_machdep.h
--- a/sys/arch/powerpc/include/ofw_machdep.h    Tue Mar 02 01:47:44 2021 +0000
+++ b/sys/arch/powerpc/include/ofw_machdep.h    Tue Mar 02 02:28:45 2021 +0000
@@ -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 @@
 
 #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];
 
diff -r a97df8811459 -r cc3e6682bb73 sys/arch/powerpc/powerpc/ofw_machdep.c
--- a/sys/arch/powerpc/powerpc/ofw_machdep.c    Tue Mar 02 01:47:44 2021 +0000
+++ b/sys/arch/powerpc/powerpc/ofw_machdep.c    Tue Mar 02 02:28:45 2021 +0000
@@ -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 @@
 
 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 @@
        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 @@
 {
        char ch = c;
 
+       if (ofwbootcons_suppress) {
+               return;
+       }
+
        OF_write(ofw_stdout, &ch, 1);
 }
 
@@ -394,8 +404,8 @@
                }
 
                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");



Home | Main Index | Thread Index | Old Index