Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Restore the ability to have EARLYCONS work for the ...
details: https://anonhg.NetBSD.org/src/rev/680626c708dd
branches: trunk
changeset: 373734:680626c708dd
user: skrll <skrll%NetBSD.org@localhost>
date: Sat Feb 25 08:19:35 2023 +0000
description:
Restore the ability to have EARLYCONS work for the QEMU virt after
SOC_VIRT got removed.
diffstat:
sys/arch/arm/fdt/arm_platform.c | 36 +++++++++++++++++++++++++++++++++---
sys/arch/evbarm/conf/GENERIC | 6 ++++--
sys/arch/evbarm/conf/GENERIC64 | 6 ++++--
3 files changed, 41 insertions(+), 7 deletions(-)
diffs (122 lines):
diff -r 4795c72af973 -r 680626c708dd sys/arch/arm/fdt/arm_platform.c
--- a/sys/arch/arm/fdt/arm_platform.c Sat Feb 25 08:05:46 2023 +0000
+++ b/sys/arch/arm/fdt/arm_platform.c Sat Feb 25 08:19:35 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_platform.c,v 1.5 2021/04/24 23:36:26 thorpej Exp $ */
+/* $NetBSD: arm_platform.c,v 1.6 2023/02/25 08:19:35 skrll Exp $ */
/*-
* Copyright (c) 2020 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -35,8 +35,10 @@
* - Console UART is pre-configured by firmware
*/
+#include "opt_console.h"
+
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm_platform.c,v 1.5 2021/04/24 23:36:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_platform.c,v 1.6 2023/02/25 08:19:35 skrll Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -58,6 +60,9 @@
#include <arm/arm/psci.h>
#include <arm/fdt/psci_fdtvar.h>
+#include <evbarm/dev/plcomreg.h>
+#include <evbarm/dev/plcomvar.h>
+
#include <libfdt.h>
#include <arch/evbarm/fdt/platform.h>
@@ -65,6 +70,31 @@
extern struct arm32_bus_dma_tag arm_generic_dma_tag;
extern struct bus_space arm_generic_bs_tag;
+void plcom_platform_early_putchar(char);
+
+#define ARM_PTOV(p) (((p) - DEVMAP_ALIGN(uart_base)) + KERNEL_IO_VBASE)
+
+void __noasan
+plcom_platform_early_putchar(char c)
+{
+#ifdef CONSADDR
+ bus_addr_t uart_base = CONSADDR;
+
+ volatile uint32_t *uartaddr = cpu_earlydevice_va_p() ?
+ (volatile uint32_t *)ARM_PTOV(uart_base):
+ (volatile uint32_t *)uart_base;
+
+ while ((le32toh(uartaddr[PL01XCOM_FR / 4]) & PL01X_FR_TXFF) != 0)
+ continue;
+
+ uartaddr[PL01XCOM_DR / 4] = htole32(c);
+ dsb(sy);
+
+ while ((le32toh(uartaddr[PL01XCOM_FR / 4]) & PL01X_FR_TXFE) == 0)
+ continue;
+#endif
+}
+
static void
arm_platform_init_attach_args(struct fdt_attach_args *faa)
{
@@ -87,12 +117,12 @@
DEVMAP_ENTRY(KERNEL_IO_VBASE, 0, PAGE_SIZE),
DEVMAP_ENTRY_END
};
- bus_addr_t uart_base;
const int phandle = fdtbus_get_stdout_phandle();
if (phandle <= 0)
return devmap_empty;
+ bus_addr_t uart_base;
if (fdtbus_get_reg(phandle, 0, &uart_base, NULL) != 0)
return devmap_empty;
diff -r 4795c72af973 -r 680626c708dd sys/arch/evbarm/conf/GENERIC
--- a/sys/arch/evbarm/conf/GENERIC Sat Feb 25 08:05:46 2023 +0000
+++ b/sys/arch/evbarm/conf/GENERIC Sat Feb 25 08:19:35 2023 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: GENERIC,v 1.117 2023/02/09 14:09:48 abs Exp $
+# $NetBSD: GENERIC,v 1.118 2023/02/25 08:19:35 skrll Exp $
#
# GENERIC ARM (aarch32) kernel
#
@@ -78,10 +78,12 @@
#options EARLYCONS=tegra, CONSADDR=0x70006300
#options EARLYCONS=vexpress, CONSADDR=0x1c090000
-#options EARLYCONS=virt, CONSADDR=0x09000000
#options EARLYCONS=zynq, CONSADDR=0xe0001000
#options EARLYCONS=rk3288, CONSADDR=0xff690000
+# The QEMU virt machine
+#options EARLYCONS=plcom, CONSADDR=0x09000000
+
# Kernel Undefined Behavior Sanitizer (kUBSan). Use UBSAN_ALWAYS_FATAL
# if you want panics instead of warnings.
#options KUBSAN # mandatory
diff -r 4795c72af973 -r 680626c708dd sys/arch/evbarm/conf/GENERIC64
--- a/sys/arch/evbarm/conf/GENERIC64 Sat Feb 25 08:05:46 2023 +0000
+++ b/sys/arch/evbarm/conf/GENERIC64 Sat Feb 25 08:19:35 2023 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: GENERIC64,v 1.209 2023/02/11 07:01:32 mrg Exp $
+# $NetBSD: GENERIC64,v 1.210 2023/02/25 08:19:35 skrll Exp $
#
# GENERIC ARM (aarch64) kernel
#
@@ -47,7 +47,9 @@
#options EARLYCONS=sunxi, CONSADDR=0x01c28000
#options EARLYCONS=tegra, CONSADDR=0x70006000
#options EARLYCONS=thunderx, CONSADDR=0x87e024000000
-#options EARLYCONS=virt, CONSADDR=0x09000000
+
+# The QEMU virt machine
+#options EARLYCONS=plcom, CONSADDR=0x09000000
# Hardware management of the Access flag and dirty state (HAFDBS).
options ARMV81_HAFDBS
Home |
Main Index |
Thread Index |
Old Index