Commit 2927e486 authored by Russell King's avatar Russell King

[ARM] Add ARMv6 memory type table initialisation tweaks.

parent 526c0a1a
...@@ -305,9 +305,35 @@ static struct mem_types mem_types[] __initdata = { ...@@ -305,9 +305,35 @@ static struct mem_types mem_types[] __initdata = {
*/ */
static void __init build_mem_type_table(void) static void __init build_mem_type_table(void)
{ {
unsigned int cr = get_cr();
int cpu_arch = cpu_architecture(); int cpu_arch = cpu_architecture();
const char *policy; const char *policy;
/*
* ARMv6 and above have extended page tables.
*/
if (cpu_arch >= CPU_ARCH_ARMv6 && (cr & CR_XP)) {
/*
* bit 4 becomes XN which we must clear for the
* kernel memory mapping.
*/
mem_types[MT_MEMORY].prot_sect &= ~PMD_BIT4;
/*
* Mark cache clean areas read only from SVC mode
* and no access from userspace.
*/
mem_types[MT_MINICLEAN].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE;
mem_types[MT_CACHECLEAN].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE;
}
/*
* ARMv6 can map the vectors as write-through.
*/
if (cpu_arch >= CPU_ARCH_ARMv6)
mem_types[MT_VECTORS].prot_pte |= PTE_CACHEABLE;
else
mem_types[MT_VECTORS].prot_pte |= PTE_BUFFERABLE|PTE_CACHEABLE;
/* /*
* ARMv5 and higher can use ECC memory. * ARMv5 and higher can use ECC memory.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment