Date: Thu, 14 Jul 2022 06:18:16 GMT From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 07007f314700 - main - uart: Don't check SPCR tables if !late_console Message-ID: <202207140618.26E6IGtd049221@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=07007f314700bb556baac724488b4ecbf8e4e29c commit 07007f314700bb556baac724488b4ecbf8e4e29c Author: Colin Percival <cperciva@FreeBSD.org> AuthorDate: 2022-07-13 00:39:00 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2022-07-14 06:17:44 +0000 uart: Don't check SPCR tables if !late_console On x86 systems, the debug.late_console tunable makes it possible to set up the console before we call pmap_bootstrap. (The tunable is turned on by default; setting late_console=0 results in consoles being probed early.) Unfortunately this is not compatible with using the ACPI SPCR table to find the console, since consulting ACPI tables requires mapping memory addresses. As such, we skip the call to uart_cpu_acpi_spcr from uart_cpu_x86 in the !late_console case. Reviewed by: imp Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D35794 --- sys/amd64/amd64/machdep.c | 3 +-- sys/dev/uart/uart_cpu_x86.c | 10 ++++++++-- sys/i386/i386/machdep.c | 3 +-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 9979592acc19..368a3c56c900 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -202,6 +202,7 @@ int cold = 1; long Maxmem = 0; long realmem = 0; +int late_console = 1; struct kva_md_info kmi; @@ -1301,7 +1302,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) struct user_segment_descriptor *gdt; struct region_descriptor r_gdt; size_t kstack0_sz; - int late_console; TSRAW(&thread0, TS_ENTER, __func__, NULL); @@ -1521,7 +1521,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) * Default to late console initialization to support these drivers. * This loses mainly printf()s in getmemsize() and early debugging. */ - late_console = 1; TUNABLE_INT_FETCH("debug.late_console", &late_console); if (!late_console) { cninit(); diff --git a/sys/dev/uart/uart_cpu_x86.c b/sys/dev/uart/uart_cpu_x86.c index b9e109646c5d..eeeabde21ebc 100644 --- a/sys/dev/uart/uart_cpu_x86.c +++ b/sys/dev/uart/uart_cpu_x86.c @@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$"); bus_space_tag_t uart_bus_space_io = X86_BUS_SPACE_IO; bus_space_tag_t uart_bus_space_mem = X86_BUS_SPACE_MEM; +extern int late_console; + int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) { @@ -66,8 +68,12 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) return (0); #ifdef DEV_ACPI - /* Check if SPCR can tell us what console to use. */ - if (uart_cpu_acpi_spcr(devtype, di) == 0) + /* + * Check if SPCR can tell us what console to use. If running with + * !late_console, we haven't set up our own page tables yet, so we + * can't map ACPI tables to look at them. + */ + if (late_console && uart_cpu_acpi_spcr(devtype, di) == 0) return (0); #endif diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 43c18042748e..c096ea220146 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -178,6 +178,7 @@ int cold = 1; long Maxmem = 0; long realmem = 0; +int late_console = 1; #ifdef PAE FEATURE(pae, "Physical Address Extensions"); @@ -1396,7 +1397,6 @@ init386(int first) caddr_t kmdp; vm_offset_t addend; size_t ucode_len; - int late_console; thread0.td_kstack = proc0kstack; thread0.td_kstack_pages = TD0_KSTACK_PAGES; @@ -1541,7 +1541,6 @@ init386(int first) * Default to late console initialization to support these drivers. * This loses mainly printf()s in getmemsize() and early debugging. */ - late_console = 1; TUNABLE_INT_FETCH("debug.late_console", &late_console); if (!late_console) { cninit();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207140618.26E6IGtd049221>