Date: Tue, 23 Feb 2016 14:21:46 +0000 (UTC) From: Ruslan Bukin <br@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r295921 - in head/sys: boot/fdt/dts/riscv riscv/riscv Message-ID: <201602231421.u1NELk3V014090@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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];
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602231421.u1NELk3V014090>