From 983dc939ab652b3fc61837d0c228c663c31d6def Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 12 Jul 2024 14:43:09 +0200 Subject: [PATCH] Move the FDT to 0x80100000 --- JOURNAL.md | 118 +++++++++++++++++++++++++++++++++++++++++++++++++ lagarto-ox.nix | 4 ++ 2 files changed, 122 insertions(+) diff --git a/JOURNAL.md b/JOURNAL.md index f53252c..642d562 100644 --- a/JOURNAL.md +++ b/JOURNAL.md @@ -1752,3 +1752,121 @@ clears the -3 error. I'll leave it at 0x40002000, but I suspect the address might be 0x40170000: #define OX_ALVEO_TIMER_BASE 0x40170000 + +After booting again, now it seems to work. But I'm not sure if that +may cause more problems down the line. + + GGGGGGGGG + OpenSBI v1.5 + ____ _____ ____ _____ + / __ \ / ____| _ \_ _| + | | | |_ __ ___ _ __ | (___ | |_) || | + | | | | '_ \ / _ \ '_ \ \___ \| _ < | | + | |__| | |_) | __/ | | |____) | |_) || |_ + \____/| .__/ \___|_| |_|_____/|____/_____| + | | + |_| + + sbi_timer_init: begins + sbi_timer_init: got Zicntr extension + fdt_timer_cold_init: pos = 0 + fdt_timer_cold_init: got match, name = riscv,aclint-mtimer + fdt_timer_cold_init: enabled + timer_mtimer_cold_init: begins, is_clint = 0 + timer_mtimer_cold_init: mtime_addr = 0x40002000 + timer_mtimer_cold_init: mtime_size = 0x00000008 + timer_mtimer_cold_init: mtimecmp_addr = 0x40002008 + timer_mtimer_cold_init: mtimecmp_size = 0x00000008 + fdt_timer_cold_init: drc->cold_init = 0 + fdt_timer_cold_init: pos = 1 + fdt_timer_cold_init: returns 0 + Platform Name : Barcelona Supercomputing Center - Lagarto Ox (NixOS) + Platform Features : medeleg + Platform HART Count : 1 + Platform IPI Device : --- + Platform Timer Device : aclint-mtimer @ 50000Hz + Platform Console Device : uart8250 + Platform HSM Device : --- + Platform PMU Device : --- + Platform Reboot Device : --- + Platform Shutdown Device : --- + Platform Suspend Device : --- + Platform CPPC Device : --- + Firmware Base : 0x80000000 + Firmware Size : 327 KB + Firmware RW Offset : 0x40000 + Firmware RW Size : 71 KB + Firmware Heap Offset : 0x49000 + Firmware Heap Size : 35 KB (total), 2 KB (reserved), 11 KB (used), 21 KB (free) + Firmware Scratch Size : 4096 B (total), 408 B (used), 3688 B (free) + Runtime SBI Version : 2.0 + + Domain0 Name : root + Domain0 Boot HART : 0 + Domain0 HARTs : 0* + Domain0 Region00 : 0x0000000040002000-0x000000004000200f M: (I,R,W) S/U: () + Domain0 Region01 : 0x0000000040001000-0x0000000040001fff M: (I,R,W) S/U: (R,W) + Domain0 Region02 : 0x0000000080040000-0x000000008005ffff M: (R,W) S/U: () + Domain0 Region03 : 0x0000000080000000-0x000000008003ffff M: (R,X) S/U: () + Domain0 Region04 : 0x0000000040800000-0x0000000040bfffff M: (I,R,W) S/U: (R,W) + Domain0 Region05 : 0x0000000000000000-0xffffffffffffffff M: () S/U: (R,W,X) + Domain0 Next Address : 0x0000000080200000 + Domain0 Next Arg1 : 0x0000000082200000 + Domain0 Next Mode : S-mode + Domain0 SysReset : yes + Domain0 SysSuspend : yes + + Boot HART ID : 0 + Boot HART Domain : root + Boot HART Priv Version : v1.10 + Boot HART Base ISA : rv64imafdc + Boot HART ISA Extensions : zicntr,zihpm,sdtrig + Boot HART PMP Count : 0 + Boot HART PMP Granularity : 0 bits + Boot HART PMP Address Bits: 0 + Boot HART MHPM Info : 29 (0xfffffff8) + Boot HART Debug Triggers : 0 triggers + Boot HART MIDELEG : 0x0000000000000222 + Boot HART MEDELEG : 0x000000000000b109 + + + Core: 12 devices, 8 uclasses, devicetree: board + Loading Environment from nowhere... OK + In: serial,usbkbd + Out: serial,vidconsole + Err: serial,vidconsole + No working controllers found + Net: No ethernet found. + Working FDT set to 82200000 + Hit any key to stop autoboot: 0 + + Device 0: unknown device + + Device 1: unknown device + scanning bus for devices... + + Device 0: unknown device + starting USB... + No working controllers found + No ethernet found. + No ethernet found. + +However, now I cannot boot the kernel, as it is overwritting the FDT: + + => printenv fdtcontroladdr + fdtcontroladdr=82200000 + => fdt addr ${fdtcontroladdr } + Working fdt: 82200000 + => setenv bootargs "root=/dev/ram0 loglevel=7 debug rw earlycon=sbi console=hvc0" + => setenv ramdisk_size 12614846 + => #booti ${kernel_addr_r} ${ramdisk_addr_r}:${ramdisk_size} ${fdtcontroladdr} + => printenv kernel_addr_r + kernel_addr_r=0x84000000 + => printenv ramdisk_addr_r + ramdisk_addr_r=0x8c300000 + => booti ${kernel_addr_r} ${ramdisk_addr_r}:${ramdisk_size} ${fdtcontroladdr} + Moving Image from 0x84000000 to 0x80200000, end=83044650 + ERROR: Did not find a cmdline Flattened Device Tree + Could not find a valid device tree + +Let's move the FDT to 0x80100000. diff --git a/lagarto-ox.nix b/lagarto-ox.nix index c9ab49c..2cecee9 100644 --- a/lagarto-ox.nix +++ b/lagarto-ox.nix @@ -317,6 +317,10 @@ #"PLATFORM_RISCV_ABI=lp64d" "FW_PAYLOAD_PATH=${final.uboot}/u-boot-nodtb.bin" "FW_FDT_PATH=${final.ox-dtb}" + + # Ensure it doesn't overlap from the 0x80200000 where the kernel will be + # placed. + "FW_PAYLOAD_FDT_ADDR=0x80100000" ]; patches = [ ./opensbi-timer-debug.patch