Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/riscv Add some bus_space(9), bus_dma(9) and FDT inf...
details: https://anonhg.NetBSD.org/src/rev/5e99a34c51d6
branches: trunk
changeset: 369983:5e99a34c51d6
user: skrll <skrll%NetBSD.org@localhost>
date: Sun Sep 11 15:31:11 2022 +0000
description:
Add some bus_space(9), bus_dma(9) and FDT infrastructure. Baby steps.
Remove the RISC-V Host Target Interface (HTIF) Emulation code.
diffstat:
sys/arch/riscv/conf/GENERIC | 36 +-
sys/arch/riscv/conf/files.riscv | 42 +-
sys/arch/riscv/fdt/fdt_dma_machdep.c | 46 +
sys/arch/riscv/htif/htif.c | 74 ---
sys/arch/riscv/htif/htif_cons.c | 66 --
sys/arch/riscv/htif/htif_disk.c | 43 -
sys/arch/riscv/htif/htif_var.h | 54 --
sys/arch/riscv/include/bus.h | 16 -
sys/arch/riscv/include/bus_defs.h | 493 ++++++++++++++++++++
sys/arch/riscv/include/bus_funcs.h | 735 +++++++++++++++++++++++++++++++
sys/arch/riscv/include/types.h | 5 +-
sys/arch/riscv/riscv/bus_space.c | 256 ++++++++++
sys/arch/riscv/riscv/bus_space_generic.S | 381 ++++++++++++++++
sys/arch/riscv/riscv/bus_space_notimpl.S | 187 +++++++
sys/arch/riscv/riscv/genassym.cf | 7 +-
sys/arch/riscv/riscv/mainbus.c | 47 +-
16 files changed, 2185 insertions(+), 303 deletions(-)
diffs (truncated from 2668 to 300 lines):
diff -r b5f16eb819fd -r 5e99a34c51d6 sys/arch/riscv/conf/GENERIC
--- a/sys/arch/riscv/conf/GENERIC Sun Sep 11 15:23:39 2022 +0000
+++ b/sys/arch/riscv/conf/GENERIC Sun Sep 11 15:31:11 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.13 2022/08/07 02:52:29 simonb Exp $
+# $NetBSD: GENERIC,v 1.14 2022/09/11 15:31:11 skrll Exp $
#
# GENERIC machine description file
#
@@ -22,10 +22,16 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.13 $"
+#ident "GENERIC-$Revision: 1.14 $"
maxusers 64 # estimated number of users
+options FDT
+
+#options EARLYCONS=com, CONSADDR=0x10000000
+#options EARLYCONS=com, CONSADDR=0x12440000
+options VERBOSE_INIT_RISCV
+
# Standard system options
#options FPE # Floating-point extension support
options NTP # NTP phase/frequency locked loop
@@ -51,8 +57,18 @@
# Diagnostic/debugging support options
options DIAGNOSTIC # inexpensive kernel consistency checks
# XXX to be commented out on release branch
-#options DEBUG # expensive debugging checks/support
-#options LOCKDEBUG # expensive locking checks/support
+#options DEBUG # expensive debugging checks/support
+#options LOCKDEBUG # expensive locking checks/support
+#options KERNHIST
+#options KERNHIST_PRINT
+#options UVMHIST
+#options UVMHIST_PRINT
+#options PMAPHIST
+#options PMAPHIST_PRINT
+#options SYSCTL_DEBUG
+#options SYSCTL_DEBUG_SETUP
+#options SYSCTL_DEBUG_CREATE
+
#
# Because gcc omits the frame pointer for any -O level, the line below
@@ -62,7 +78,7 @@
makeoptions COPY_SYMTAB=1
options DDB # in-kernel debugger
#options DDB_COMMANDONENTER="bt" # execute command when ddb is entered
-#options DDB_ONPANIC=1 # see also sysctl(7): `ddb.onpanic'
+options DDB_ONPANIC=1 # see also sysctl(7): `ddb.onpanic'
options DDB_HISTORY_SIZE=512 # enable history editing in DDB
#options KGDB # remote debugger
#options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
@@ -135,13 +151,11 @@
#
# Device configuration
#
-mainbus0 at root
-cpu0 at mainbus0
-htif0 at mainbus0
-htifcons0 at htif0
-htifdisk0 at htif0
-ld0 at htifdisk0
+mainbus0 at root
+simplebus* at fdt? pass 0
+# UART
+com* at fdt? # UART
# Pseudo-Devices
diff -r b5f16eb819fd -r 5e99a34c51d6 sys/arch/riscv/conf/files.riscv
--- a/sys/arch/riscv/conf/files.riscv Sun Sep 11 15:23:39 2022 +0000
+++ b/sys/arch/riscv/conf/files.riscv Sun Sep 11 15:31:11 2022 +0000
@@ -1,14 +1,25 @@
-# $NetBSD: files.riscv,v 1.7 2020/11/04 06:56:56 skrll Exp $
+# $NetBSD: files.riscv,v 1.8 2022/09/11 15:31:11 skrll Exp $
#
maxpartitions 16
maxusers 8 32 64
+# Console options
+defparam opt_console.h CONSADDR
+
+# RISC-V specific debug options
+defflag opt_riscv_debug.h VERBOSE_INIT_RISCV
+
defflag opt_ddb.h DDB_TRACE
-#file arch/riscv/riscv/locore.S
+file arch/riscv/fdt/fdt_dma_machdep.c
+
file arch/riscv/riscv/spl.S
+file arch/riscv/riscv/bus_space.c
+file arch/riscv/riscv/bus_space_generic.S
+file arch/riscv/riscv/bus_space_notimpl.S
+
file arch/riscv/riscv/autoconf.c
file arch/riscv/riscv/cpu_subr.c
file arch/riscv/riscv/db_disasm.c ddb
@@ -50,25 +61,24 @@
file arch/riscv/riscv/sig32_machdep.c compat_netbsd32
include "compat/netbsd32/files.netbsd32"
-device mainbus { [instance=-1] }
+device mainbus {}: fdt
attach mainbus at root
+
file arch/riscv/riscv/mainbus.c mainbus
-device cpu
-attach cpu at mainbus with cpu_mainbus
-file arch/riscv/riscv/cpu_mainbus.c cpu_mainbus
+# Machine-independent I2O drivers.
+include "dev/i2o/files.i2o"
-device htif { }
-attach htif at mainbus with htif_mainbus
-file arch/riscv/htif/htif.c htif_mainbus
+# Machine-independent SCSI drivers
+include "dev/scsipi/files.scsipi"
-device htifcons { } : tty
-attach htifcons at htif with htif_cons
-file arch/riscv/htif/htif_cons.c htif_cons
+# Machine-independent ATA drivers
+include "dev/ata/files.ata"
-device htifdisk { } : disk
-attach htifdisk at htif with htif_disk
-attach ld at htifdisk with ld_htifdisk
-file arch/riscv/htif/htif_disk.c htif_disk
+# Machine-independent USB device support
+include "dev/usb/files.usb"
+
+# Machine-independent PCI device support
+#include "dev/pci/files.pci"
include "arch/riscv/conf/majors.riscv"
diff -r b5f16eb819fd -r 5e99a34c51d6 sys/arch/riscv/fdt/fdt_dma_machdep.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/riscv/fdt/fdt_dma_machdep.c Sun Sep 11 15:31:11 2022 +0000
@@ -0,0 +1,46 @@
+/* $NetBSD: fdt_dma_machdep.c,v 1.1 2022/09/11 15:31:12 skrll Exp $ */
+
+/*-
+ * Copyright (c) 2022 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: fdt_dma_machdep.c,v 1.1 2022/09/11 15:31:12 skrll Exp $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/kmem.h>
+
+#include <dev/fdt/fdtvar.h>
+
+bus_dma_tag_t
+fdtbus_dma_tag_create(int phandle, const struct fdt_dma_range *ranges,
+ u_int nranges)
+{
+ return NULL;
+}
diff -r b5f16eb819fd -r 5e99a34c51d6 sys/arch/riscv/htif/htif.c
--- a/sys/arch/riscv/htif/htif.c Sun Sep 11 15:23:39 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/* $NetBSD: htif.c,v 1.4 2021/08/07 16:19:03 thorpej Exp $ */
-
-/*-
- * Copyright (c) 2014 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Matt Thomas of 3am Software Foundry.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-
-__RCSID("$NetBSD: htif.c,v 1.4 2021/08/07 16:19:03 thorpej Exp $");
-
-#include <sys/param.h>
-#include <sys/device.h>
-
-#include <riscv/locore.h>
-#include <riscv/htif/htif_var.h>
-
-static int htif_mainbus_match(device_t, cfdata_t, void *);
-static void htif_mainbus_attach(device_t, device_t, void *);
-
-CFATTACH_DECL_NEW(htif_mainbus, 0,
- htif_mainbus_match, htif_mainbus_attach, NULL, NULL);
-
-int
-htif_mainbus_match(device_t parent, cfdata_t cf, void *aux)
-{
- struct mainbus_attach_args * const maa = aux;
-
- if (strcmp(maa->maa_name, cf->cf_name))
- return 0;
-
- return 0;
-}
-
-static int
-htif_mainbus_print(void *aux, const char *name)
-{
- return QUIET;
-}
-
-void
-htif_mainbus_attach(device_t parent, device_t self, void *aux)
-{
- struct htif_attach_args haa;
-
- haa.haa_name = "htifcons";
- config_found(self, &haa, htif_mainbus_print, CFARGS_NONE);
- haa.haa_name = "htifdisk";
- config_found(self, &haa, htif_mainbus_print, CFARGS_NONE);
-}
diff -r b5f16eb819fd -r 5e99a34c51d6 sys/arch/riscv/htif/htif_cons.c
--- a/sys/arch/riscv/htif/htif_cons.c Sun Sep 11 15:23:39 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/* $NetBSD: htif_cons.c,v 1.2 2020/11/04 07:09:45 skrll Exp $ */
-
-/*-
- * Copyright (c) 2014 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Matt Thomas of 3am Software Foundry.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
Home |
Main Index |
Thread Index |
Old Index