git: da48ddbf7c38 - main - riscv: catch up with EARLY_PRINTF changes

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Mon, 04 Mar 2024 18:45:55 UTC
The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=da48ddbf7c38d481d01cf3a9752764bf826cb15e

commit da48ddbf7c38d481d01cf3a9752764bf826cb15e
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-03-04 18:45:17 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-03-04 18:45:17 +0000

    riscv: catch up with EARLY_PRINTF changes
    
    On this platform early console access is possible via SBI. Follow recent
    changes to EARLY_PRINTF option and give it a named constant.
    
    Update the commented option in GENERIC so that it compiles.
    
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D44100
---
 sys/riscv/conf/GENERIC          | 2 +-
 sys/riscv/riscv/riscv_console.c | 2 +-
 sys/sys/systm.h                 | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC
index 74ca1a94fc87..ca71f7423cfa 100644
--- a/sys/riscv/conf/GENERIC
+++ b/sys/riscv/conf/GENERIC
@@ -165,7 +165,7 @@ options 	WITNESS			# Enable checks to detect deadlocks and cycles
 options 	WITNESS_SKIPSPIN	# Don't run witness on spinlocks for speed
 options 	MALLOC_DEBUG_MAXZONES=8	# Separate malloc(9) zones
 options 	ALT_BREAK_TO_DEBUGGER	# Enter debugger on keyboard escape sequence
-# options 	EARLY_PRINTF
+# options 	EARLY_PRINTF=sbi
 options 	VERBOSE_SYSINIT=0	# Support debug.verbose_sysinit, off by default
 
 # Kernel dump features.
diff --git a/sys/riscv/riscv/riscv_console.c b/sys/riscv/riscv/riscv_console.c
index d6c4ce4540cb..e582b3385384 100644
--- a/sys/riscv/riscv/riscv_console.c
+++ b/sys/riscv/riscv/riscv_console.c
@@ -110,7 +110,7 @@ riscv_putc(int c)
 	sbi_console_putchar(c);
 }
 
-#ifdef EARLY_PRINTF
+#if CHECK_EARLY_PRINTF(sbi)
 early_putc_t *early_putc = riscv_putc;
 #endif
 
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index f72f82c100dc..17a1c814cf75 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -215,6 +215,7 @@ extern early_putc_t *early_putc;
 #define	early_printf_ns8250	3
 #define	early_printf_pl011	4
 #define	early_printf_snps	5
+#define	early_printf_sbi	6
 #else
 #define	CHECK_EARLY_PRINTF(x)	0
 #endif