Message ID | 20190808075013.4852-6-jiaxun.yang@flygoat.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [1/7] MIPS: init: Drop boot_mem_map | expand |
On Thu, Aug 08, 2019 at 03:50:11PM +0800, Jiaxun Yang wrote: > boot_mem_map is nolonger exist so we need to maintain a list > of prom memory by ourselves > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > --- > arch/mips/pmcs-msp71xx/msp_prom.c | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) > > diff --git a/arch/mips/pmcs-msp71xx/msp_prom.c b/arch/mips/pmcs-msp71xx/msp_prom.c > index 6fdcb3d6fbb5..13a5eb47af94 100644 > --- a/arch/mips/pmcs-msp71xx/msp_prom.c > +++ b/arch/mips/pmcs-msp71xx/msp_prom.c > @@ -61,6 +61,10 @@ int init_debug = 1; > /* memory blocks */ > struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS]; > > +static phys_addr_t prom_mem_base[MAX_PROM_MEM] __initdata; > +static phys_addr_t prom_mem_size[MAX_PROM_MEM] __initdata; > +static unsigned int nr_prom_mem __initdata; > + > /* default feature sets */ > static char msp_default_features[] = > #if defined(CONFIG_PMC_MSP4200_EVAL) \ > @@ -352,6 +356,12 @@ void __init prom_meminit(void) > > add_memory_region(base, size, type); > p++; > + > + if (type == BOOT_MEM_ROM_DATA) { > + prom_mem_base[nr_prom_mem] = base; > + prom_mem_size[nr_prom_mem] = size; > + nr_prom_mem++; The same as for FW_ARC. I suggest to add a sanity check here as well. -Sergey > + } > } > } > > @@ -407,13 +417,9 @@ void __init prom_free_prom_memory(void) > envp[i] = NULL; /* end array with null pointer */ > prom_envp = envp; > > - for (i = 0; i < boot_mem_map.nr_map; i++) { > - if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA) > - continue; > - > - addr = boot_mem_map.map[i].addr; > + for (i = 0; i < nr_prom_mem; i++) { > free_init_pages("prom memory", > - addr, addr + boot_mem_map.map[i].size); > + prom_mem_base[i], prom_mem_base[i] + prom_mem_size[i]); > } > } > > -- > 2.22.0 >
diff --git a/arch/mips/pmcs-msp71xx/msp_prom.c b/arch/mips/pmcs-msp71xx/msp_prom.c index 6fdcb3d6fbb5..13a5eb47af94 100644 --- a/arch/mips/pmcs-msp71xx/msp_prom.c +++ b/arch/mips/pmcs-msp71xx/msp_prom.c @@ -61,6 +61,10 @@ int init_debug = 1; /* memory blocks */ struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS]; +static phys_addr_t prom_mem_base[MAX_PROM_MEM] __initdata; +static phys_addr_t prom_mem_size[MAX_PROM_MEM] __initdata; +static unsigned int nr_prom_mem __initdata; + /* default feature sets */ static char msp_default_features[] = #if defined(CONFIG_PMC_MSP4200_EVAL) \ @@ -352,6 +356,12 @@ void __init prom_meminit(void) add_memory_region(base, size, type); p++; + + if (type == BOOT_MEM_ROM_DATA) { + prom_mem_base[nr_prom_mem] = base; + prom_mem_size[nr_prom_mem] = size; + nr_prom_mem++; + } } } @@ -407,13 +417,9 @@ void __init prom_free_prom_memory(void) envp[i] = NULL; /* end array with null pointer */ prom_envp = envp; - for (i = 0; i < boot_mem_map.nr_map; i++) { - if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA) - continue; - - addr = boot_mem_map.map[i].addr; + for (i = 0; i < nr_prom_mem; i++) { free_init_pages("prom memory", - addr, addr + boot_mem_map.map[i].size); + prom_mem_base[i], prom_mem_base[i] + prom_mem_size[i]); } }
boot_mem_map is nolonger exist so we need to maintain a list of prom memory by ourselves Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- arch/mips/pmcs-msp71xx/msp_prom.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)