CVSROOT:        /cvs
Module name:    src
Changes by:     kette...@cvs.openbsd.org        2021/05/03 05:35:29

Modified files:
        sys/arch/riscv64/riscv64: machdep.c pmap.c 
        sys/arch/riscv64/include: pmap.h 

Log message:
Use the EFI memory map (if available) to determine available physical
memory.  This brings the code closer to arm64 but some key differences
remain.  The most notable difference is that the riscv64 currently uses
its own private direct map of physical memory.  Therefore it needs to know
the RAM address range which we derive from the /memory node in the FDT.

The code also needs to work around some bugs/flaws in the firmware:

* Newer OpenSBI versions no longer add a "no-map" property to the
reserved memory block that covers the memory used by OpenSBI itself.
This makes it appear as EfiBootServicesData in the EFI memory map,
which means it is available for general use.

* The OpenSBI shipped with the beaglev prototype boards doesn't reserve
the memory used by OpenBSI at all.

The workaround for the first issue is to remove all reserved memory blocks
specified in the FDT.  In its current implementation this may remove
too much memory on certain boards.

The workaround for the second issue is to remove 2MB before the memory
where the kernel lives.  This workaround is fragile since it relies on
a specific memory layout.  Hopefully the beaglev firmware gets fixed and
we can remove this hack.

ok jsg@

Reply via email to