aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/init/start.S
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-05-29 21:31:09 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-05-29 21:31:09 +0300
commit3ace1ddd76b9c04f3ed23883de6279b4485612e8 (patch)
tree2f4af69d70967c2455cb83d8c18a5416c8d1b54d /arch/riscv64/init/start.S
parentb7f53b9a9001708dea5303faf52f1b508eefb712 (diff)
downloadkmi-3ace1ddd76b9c04f3ed23883de6279b4485612e8.tar.gz
kmi-3ace1ddd76b9c04f3ed23883de6279b4485612e8.zip
start trying to boot on visionfive 2
+ Not bootable quite yet. Among other things, I couldn't get the current starfive u-boot fork to boot, so try adding support for booting with precompiled u-boot via the `go` command. Initial testing with qemu shows that this should be possible, and if it works, might be useful in the (far) future with other slightly janky SBCs. Also, NS16550 is 8250-based, and I'm really only using the base 8250, so rename and add visionfive 2 uart to list of compatibles. Visionfive 2 is still completely untested.
Diffstat (limited to 'arch/riscv64/init/start.S')
-rw-r--r--arch/riscv64/init/start.S20
1 files changed, 18 insertions, 2 deletions
diff --git a/arch/riscv64/init/start.S b/arch/riscv64/init/start.S
index 7439d93..b6394f7 100644
--- a/arch/riscv64/init/start.S
+++ b/arch/riscv64/init/start.S
@@ -1,17 +1,33 @@
/* SPDX-License-Identifier: copyleft-next-0.3.1 */
/* Copyright 2021 - 2022, Kim Kuparinen < kimi.h.kuparinen@gmail.com > */
+/* generic u-boot passes argc and argv as if we were a regular
+ * program, so our load address must be placed third.
+ * If we have a 'custom' u-boot with kmi support, the fdt
+ * will be passed to us directly, so the load address can go second.
+ */
+#if GENERIC_UBOOT
+# define LOAD_REG a2
+# define INIT init_go
+#else
+# define LOAD_REG a1
+# define INIT init
+#endif
+
.section .init
.global _start
/* Entry point to the kernel loader. */
_start:
/* get load address */
-auipc a1, 0
+auipc LOAD_REG, 0
/* keep using bootloader stack for now */
//li sp, PM_STACK_TOP
/* make sure there's no garbage in tp, important for id assignment */
li tp, 0
-call init
+call INIT
+// INIT shouldn't return, but if we do we might as well just jump back to u-boot
+// or wherever
+ret
.section .text
.global jump_to_kernel