svn commit: r295921 - in head/sys: boot/fdt/dts/riscv riscv/riscv
Ruslan Bukin
br at FreeBSD.org
Tue Feb 23 14:21:47 UTC 2016
Author: br
Date: Tue Feb 23 14:21:46 2016
New Revision: 295921
URL: https://svnweb.freebsd.org/changeset/base/295921
Log:
o Grab physical memory regions information from the device tree.
o Increase memory size.
Modified:
head/sys/boot/fdt/dts/riscv/qemu.dts
head/sys/boot/fdt/dts/riscv/spike.dts
head/sys/riscv/riscv/machdep.c
Modified: head/sys/boot/fdt/dts/riscv/qemu.dts
==============================================================================
--- head/sys/boot/fdt/dts/riscv/qemu.dts Tue Feb 23 10:12:50 2016 (r295920)
+++ head/sys/boot/fdt/dts/riscv/qemu.dts Tue Feb 23 14:21:46 2016 (r295921)
@@ -49,7 +49,7 @@
memory {
device_type = "memory";
- reg = <0x0 0x8000000>; /* 128MB at 0x0 */
+ reg = <0x0 0x40000000>; /* 1GB at 0x0 */
};
soc {
Modified: head/sys/boot/fdt/dts/riscv/spike.dts
==============================================================================
--- head/sys/boot/fdt/dts/riscv/spike.dts Tue Feb 23 10:12:50 2016 (r295920)
+++ head/sys/boot/fdt/dts/riscv/spike.dts Tue Feb 23 14:21:46 2016 (r295921)
@@ -49,7 +49,7 @@
memory {
device_type = "memory";
- reg = <0x0 0x8000000>; /* 128MB at 0x0 */
+ reg = <0x0 0x40000000>; /* 1GB at 0x0 */
};
soc {
Modified: head/sys/riscv/riscv/machdep.c
==============================================================================
--- head/sys/riscv/riscv/machdep.c Tue Feb 23 10:12:50 2016 (r295920)
+++ head/sys/riscv/riscv/machdep.c Tue Feb 23 14:21:46 2016 (r295921)
@@ -729,9 +729,13 @@ fake_preload_metadata(struct riscv_bootp
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];
More information about the svn-src-head
mailing list