o Grab physical memory regions information from the device tree.

o Increase memory size.
This commit is contained in:
Ruslan Bukin 2016-02-23 14:21:46 +00:00
parent fe6928058c
commit cea32c0742
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=295921
3 changed files with 12 additions and 7 deletions

View File

@ -49,7 +49,7 @@
memory {
device_type = "memory";
reg = <0x0 0x8000000>; /* 128MB at 0x0 */
reg = <0x0 0x40000000>; /* 1GB at 0x0 */
};
soc {

View File

@ -49,7 +49,7 @@
memory {
device_type = "memory";
reg = <0x0 0x8000000>; /* 128MB at 0x0 */
reg = <0x0 0x40000000>; /* 1GB at 0x0 */
};
soc {

View File

@ -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];