Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/riscv/riscv riscv: Add FDT-based initrd, rndseed, a...
details: https://anonhg.NetBSD.org/src/rev/45e366865cec
branches: trunk
changeset: 377386:45e366865cec
user: rin <rin%NetBSD.org@localhost>
date: Mon Jul 10 07:04:20 2023 +0000
description:
riscv: Add FDT-based initrd, rndseed, and efirng support.
Can be used from our in-tree bootrisv64.efi.
diffstat:
sys/arch/riscv/riscv/autoconf.c | 12 +++++++++---
sys/arch/riscv/riscv/riscv_machdep.c | 15 +++++++++++++--
2 files changed, 22 insertions(+), 5 deletions(-)
diffs (85 lines):
diff -r 9f493c196ed2 -r 45e366865cec sys/arch/riscv/riscv/autoconf.c
--- a/sys/arch/riscv/riscv/autoconf.c Mon Jul 10 07:01:48 2023 +0000
+++ b/sys/arch/riscv/riscv/autoconf.c Mon Jul 10 07:04:20 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.4 2023/05/07 12:41:48 skrll Exp $ */
+/* $NetBSD: autoconf.c,v 1.5 2023/07/10 07:04:20 rin Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__RCSID("$NetBSD: autoconf.c,v 1.4 2023/05/07 12:41:48 skrll Exp $");
+__RCSID("$NetBSD: autoconf.c,v 1.5 2023/07/10 07:04:20 rin Exp $");
#include <sys/param.h>
@@ -44,6 +44,8 @@
#include <machine/sysreg.h>
+#include <dev/fdt/fdt_boot.h>
+
void
cpu_configure(void)
{
@@ -63,6 +65,10 @@ cpu_rootconf(void)
}
void
-device_register(device_t dv, void *aux)
+device_register(device_t self, void *aux)
{
+
+ if (device_is_a(self, "mainbus")) {
+ fdt_setup_initrd();
+ }
}
diff -r 9f493c196ed2 -r 45e366865cec sys/arch/riscv/riscv/riscv_machdep.c
--- a/sys/arch/riscv/riscv/riscv_machdep.c Mon Jul 10 07:01:48 2023 +0000
+++ b/sys/arch/riscv/riscv/riscv_machdep.c Mon Jul 10 07:04:20 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: riscv_machdep.c,v 1.30 2023/07/10 07:01:48 rin Exp $ */
+/* $NetBSD: riscv_machdep.c,v 1.31 2023/07/10 07:04:20 rin Exp $ */
/*-
* Copyright (c) 2014, 2019, 2022 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include "opt_riscv_debug.h"
#include <sys/cdefs.h>
-__RCSID("$NetBSD: riscv_machdep.c,v 1.30 2023/07/10 07:01:48 rin Exp $");
+__RCSID("$NetBSD: riscv_machdep.c,v 1.31 2023/07/10 07:04:20 rin Exp $");
#include <sys/param.h>
@@ -537,6 +537,9 @@ cpu_startup(void)
#endif
fdtbus_intr_init();
+
+ fdt_setup_rndseed();
+ fdt_setup_efirng();
}
static void
@@ -769,9 +772,17 @@ init_riscv(register_t hartid, paddr_t dt
VPRINTF("%s: memory start %" PRIx64 " end %" PRIx64 " (len %"
PRIx64 ")\n", __func__, memory_start, memory_end, memory_size);
+ /* Parse ramdisk, rndseed, and firmware's RNG from EFI */
+ fdt_probe_initrd();
+ fdt_probe_rndseed();
+ fdt_probe_efirng();
+
fdt_memory_remove_reserved(memory_start, memory_end);
fdt_memory_remove_range(dtb, dtbsize);
+ fdt_reserve_initrd();
+ fdt_reserve_rndseed();
+ fdt_reserve_efirng();
/* Perform PT build and VM init */
cpu_kernel_vm_init(memory_start, memory_end);
Home |
Main Index |
Thread Index |
Old Index