Use memory regions information provided in FDT.
Reviewed by: brooks Sponsored by: DARPA, AFRL
This commit is contained in:
parent
2b8a4d8033
commit
e2d5f675a0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=275858
@ -88,6 +88,11 @@ static void
|
||||
mips_init(void)
|
||||
{
|
||||
int i;
|
||||
#ifdef FDT
|
||||
struct mem_region mr[FDT_MEM_REGIONS];
|
||||
int mr_cnt, val;
|
||||
int j;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
phys_avail[i] = 0;
|
||||
@ -102,6 +107,29 @@ mips_init(void)
|
||||
|
||||
physmem = realmem;
|
||||
|
||||
#ifdef FDT
|
||||
if (fdt_get_mem_regions(mr, &mr_cnt, &val) == 0) {
|
||||
|
||||
physmem = btoc(val);
|
||||
|
||||
KASSERT((phys_avail[0] >= mr[0].mr_start) && \
|
||||
(phys_avail[0] < (mr[0].mr_start + mr[0].mr_size)),
|
||||
("First region is not within FDT memory range"));
|
||||
|
||||
/* Limit size of the first region */
|
||||
phys_avail[1] = MIN(mr[0].mr_size, ctob(realmem));
|
||||
dump_avail[1] = phys_avail[1];
|
||||
|
||||
/* Add the rest of regions */
|
||||
for (i = 1, j = 2; i < mr_cnt; i++, j+=2) {
|
||||
phys_avail[j] = mr[i].mr_start;
|
||||
phys_avail[j+1] = mr[i].mr_size;
|
||||
dump_avail[j] = phys_avail[j];
|
||||
dump_avail[j+1] = phys_avail[j+1];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
init_param1();
|
||||
init_param2(physmem);
|
||||
mips_cpu_init();
|
||||
|
Loading…
Reference in New Issue
Block a user