Skip to content

Commit

Permalink
MIPS: mm: init: Add free_init_pages() callback for EVA
Browse files Browse the repository at this point in the history
A core in EVA mode can have any possible segment mapping, so the
default free_initmem_default() function may not always work as expected.
Therefore, add a callback that platforms can use to free up the init section.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
  • Loading branch information
Markos Chandras authored and Ralf Baechle committed Mar 26, 2014
1 parent 9111968 commit 0893d3f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions arch/mips/include/asm/bootinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ extern void prom_free_prom_memory(void);
extern void free_init_pages(const char *what,
unsigned long begin, unsigned long end);

extern void (*free_init_pages_eva)(void *begin, void *end);

/*
* Initial kernel command line, usually setup by prom_init()
*/
Expand Down
12 changes: 11 additions & 1 deletion arch/mips/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,20 @@ void free_initrd_mem(unsigned long start, unsigned long end)
}
#endif

void (*free_init_pages_eva)(void *begin, void *end) = NULL;

void __init_refok free_initmem(void)
{
prom_free_prom_memory();
free_initmem_default(POISON_FREE_INITMEM);
/*
* Let the platform define a specific function to free the
* init section since EVA may have used any possible mapping
* between virtual and physical addresses.
*/
if (free_init_pages_eva)
free_init_pages_eva((void *)&__init_begin, (void *)&__init_end);
else
free_initmem_default(POISON_FREE_INITMEM);
}

#ifndef CONFIG_MIPS_PGD_C0_CONTEXT
Expand Down

0 comments on commit 0893d3f

Please sign in to comment.