freebsd-dev/sys/riscv
Mitchell Horne f7d2df2a8a Handle load from loader(8)
In locore, we must detect and handle different arguments passed by
loader(8) compared to what we recieve when booting directly via SBI
firmware. Currently we receive the hart ID in a0 and a pointer to the
device tree blob in a1. loader(8) provides only a pointer to its
metadata in a0.

The solution to this is to add an additional entry point, _alt_start.
This will be placed first in the .text section, so SBI firmware will
enter here, and jump to the common pagetable setup shortly after. Since
loader(8) understands our ELF kernel, it will enter at the ELF's entry
address, which points to _start. This approach leads to very little
guesswork as to which way we booted.

Fix-up initriscv() to parse the loader's metadata, continuing to use
fake_preload_metadata() in the SBI direct boot case.

Reviewed by:	markj, jrtc27 (asm portion)
Differential Revision:	https://reviews.freebsd.org/D24912
2020-06-24 15:20:00 +00:00
..
conf Retire the GENERICSF kernel config. 2020-04-27 21:51:22 +00:00
include Handle load from loader(8) 2020-06-24 15:20:00 +00:00
riscv Handle load from loader(8) 2020-06-24 15:20:00 +00:00
sifive riscv/sifive: add FE310 Always-on driver 2020-04-02 00:33:15 +00:00