Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/acpi Reset serial terminal to default state at ...



details:   https://anonhg.NetBSD.org/src/rev/233bc6d79198
branches:  trunk
changeset: 952304:233bc6d79198
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Feb 12 12:26:09 2021 +0000

description:
Reset serial terminal to default state at boot.

UEFI may leave the serial console in an undesireable state (incorrect
foreground and background colour, etc) when exiting. Send ANSI escape
sequences when setting up the early console attachments to turn off
character attributes and erase from the cursor to the end of the screen.

diffstat:

 sys/arch/arm/acpi/acpi_platform.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r fc76c69421f9 -r 233bc6d79198 sys/arch/arm/acpi/acpi_platform.c
--- a/sys/arch/arm/acpi/acpi_platform.c Fri Feb 12 08:56:04 2021 +0000
+++ b/sys/arch/arm/acpi/acpi_platform.c Fri Feb 12 12:26:09 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_platform.c,v 1.23 2021/02/04 22:36:52 thorpej Exp $ */
+/* $NetBSD: acpi_platform.c,v 1.24 2021/02/12 12:26:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -35,13 +35,14 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.23 2021/02/04 22:36:52 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.24 2021/02/12 12:26:09 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
 #include <sys/cpu.h>
 #include <sys/device.h>
 #include <sys/termios.h>
+#include <sys/kprintf.h>
 
 #include <dev/fdt/fdtvar.h>
 #include <arm/fdt/arm_fdtvar.h>
@@ -214,6 +215,13 @@
                break;
        }
 
+       /*
+        * UEFI firmware may leave the console in an undesireable state (wrong
+        * foreground/background colour, etc). Reset the terminal and clear
+        * text from the cursor to the end of the screne.
+        */
+        printf_flags(TOCONS|NOTSTAMP, "\033[0m");
+        printf_flags(TOCONS|NOTSTAMP, "\033[0J");
 }
 
 static void



Home | Main Index | Thread Index | Old Index