Page MenuHomeFreeBSD

D24155.id69775.diff
No OneTemporary

D24155.id69775.diff

Index: sys/riscv/riscv/machdep.c
===================================================================
--- sys/riscv/riscv/machdep.c
+++ sys/riscv/riscv/machdep.c
@@ -84,6 +84,7 @@
#include <machine/machdep.h>
#include <machine/metadata.h>
#include <machine/pcb.h>
+#include <machine/pte.h>
#include <machine/reg.h>
#include <machine/riscvreg.h>
#include <machine/sbi.h>
@@ -826,6 +827,26 @@
if (fdt_get_mem_regions(mem_regions, &mem_regions_sz, NULL) != 0)
panic("Cannot get physical memory regions");
physmem_hardware_regions(mem_regions, mem_regions_sz);
+
+ /*
+ * Exclude reserved memory specified by the device tree. Typically,
+ * this contains an entry for memory used by the runtime SBI firmware.
+ */
+ if (fdt_get_reserved_mem(mem_regions, &mem_regions_sz) == 0)
+ physmem_exclude_regions(mem_regions, mem_regions_sz,
+ EXFLAG_NODUMP | EXFLAG_NOALLOC);
+ else
+ /*
+ * XXX: Exclude the lowest 2MB of physical memory, since it is
+ * assumed to contain the SBI firmware. This is a little
+ * fragile, but it is consistent with the platforms we support
+ * so far.
+ *
+ * TODO: remove this when the all regular booting methods
+ * properly report reserved memory regions.
+ */
+ physmem_exclude_region(mem_regions[0].mr_start, L2_SIZE,
+ EXFLAG_NODUMP | EXFLAG_NOALLOC);
#endif
/* Do basic tuning, hz etc */

File Metadata

Mime Type
text/plain
Expires
Thu, Feb 19, 6:00 AM (1 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28868458
Default Alt Text
D24155.id69775.diff (1 KB)

Event Timeline