summaryrefslogtreecommitdiffstats
path: root/sys/riscv
diff options
context:
space:
mode:
authorbr <br@FreeBSD.org>2016-02-23 14:21:46 +0000
committerbr <br@FreeBSD.org>2016-02-23 14:21:46 +0000
commit9b8bacd93f21ebd5722d215c99467a60f2704734 (patch)
tree6eaa853ae4136201eb2a0ba211d86cd9d4445a01 /sys/riscv
parent6a8922d3a7d0dfec707c2c644e85796766e00a1f (diff)
downloadFreeBSD-src-9b8bacd93f21ebd5722d215c99467a60f2704734.zip
FreeBSD-src-9b8bacd93f21ebd5722d215c99467a60f2704734.tar.gz
o Grab physical memory regions information from the device tree.
o Increase memory size.
Diffstat (limited to 'sys/riscv')
-rw-r--r--sys/riscv/riscv/machdep.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c
index 399be20..6fcf4a0 100644
--- a/sys/riscv/riscv/machdep.c
+++ b/sys/riscv/riscv/machdep.c
@@ -729,9 +729,13 @@ fake_preload_metadata(struct riscv_bootparams *rvbp __unused)
void
initriscv(struct riscv_bootparams *rvbp)
{
+ struct mem_region mem_regions[FDT_MEM_REGIONS];
vm_offset_t lastaddr;
+ int mem_regions_sz;
vm_size_t kernlen;
+ uint32_t memsize;
caddr_t kmdp;
+ int i;
/* Set the module data location */
lastaddr = fake_preload_metadata(rvbp);
@@ -752,11 +756,12 @@ initriscv(struct riscv_bootparams *rvbp)
/* Load the physical memory ranges */
physmap_idx = 0;
- /*
- * RISCVTODO: figure out whether platform provides ranges,
- * or grab from FDT.
- */
- add_physmap_entry(0, 0x8000000, physmap, &physmap_idx);
+ /* Grab physical memory regions information from device tree. */
+ if (fdt_get_mem_regions(mem_regions, &mem_regions_sz, &memsize) != 0)
+ panic("Cannot get physical memory regions");
+ for (i = 0; i < mem_regions_sz; i++)
+ add_physmap_entry(mem_regions[i].mr_start,
+ mem_regions[i].mr_size, physmap, &physmap_idx);
/* Set the pcpu data, this is needed by pmap_bootstrap */
pcpup = &__pcpu[0];
OpenPOWER on IntegriCloud