Module Name:    src
Committed By:   jmcneill
Date:           Fri Feb 12 12:26:09 UTC 2021

Modified Files:
        src/sys/arch/arm/acpi: acpi_platform.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/acpi/acpi_platform.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/arm/acpi/acpi_platform.c
diff -u src/sys/arch/arm/acpi/acpi_platform.c:1.23 src/sys/arch/arm/acpi/acpi_platform.c:1.24
--- src/sys/arch/arm/acpi/acpi_platform.c:1.23	Thu Feb  4 22:36:52 2021
+++ src/sys/arch/arm/acpi/acpi_platform.c	Fri Feb 12 12:26:09 2021
@@ -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 @@ acpi_platform_attach_uart(ACPI_TABLE_SPC
 		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

Reply via email to