static void __init alloc_init_pmd(struct mm_struct *mm, pud_t *pud,
unsigned long addr, unsigned long end,
- phys_addr_t phys, int map_io)
+ phys_addr_t phys, pgprot_t prot)
{
pmd_t *pmd;
unsigned long next;
- pmdval_t prot_sect;
- pgprot_t prot_pte;
-
- if (map_io) {
- prot_sect = PROT_SECT_DEVICE_nGnRE;
- prot_pte = __pgprot(PROT_DEVICE_nGnRE);
- } else {
- prot_sect = PROT_SECT_NORMAL_EXEC;
- prot_pte = PAGE_KERNEL_EXEC;
- }
/*
* Check for initial section mappings in the pgd/pud and remove them.
/* try section mapping first */
if (((addr | next | phys) & ~SECTION_MASK) == 0) {
pmd_t old_pmd =*pmd;
- set_pmd(pmd, __pmd(phys | prot_sect));
+ set_pmd(pmd, __pmd(phys |
+ pgprot_val(mk_sect_prot(prot))));
/*
* Check for previous table entries created during
* boot (__create_page_tables) and flush them.
flush_tlb_all();
} else {
alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys),
- prot_pte);
+ prot);
}
phys += next - addr;
} while (pmd++, addr = next, addr != end);
static void __init alloc_init_pud(struct mm_struct *mm, pgd_t *pgd,
unsigned long addr, unsigned long end,
- phys_addr_t phys, int map_io)
+ phys_addr_t phys, pgprot_t prot)
{
pud_t *pud;
unsigned long next;
/*
* For 4K granule only, attempt to put down a 1GB block
*/
- if (!map_io && (PAGE_SHIFT == 12) &&
+ if ((PAGE_SHIFT == 12) &&
((addr | next | phys) & ~PUD_MASK) == 0) {
pud_t old_pud = *pud;
- set_pud(pud, __pud(phys | PROT_SECT_NORMAL_EXEC));
+ set_pud(pud, __pud(phys |
+ pgprot_val(mk_sect_prot(prot))));
/*
* If we have an old value for a pud, it will
flush_tlb_all();
}
} else {
- alloc_init_pmd(mm, pud, addr, next, phys, map_io);
+ alloc_init_pmd(mm, pud, addr, next, phys, prot);
}
phys += next - addr;
} while (pud++, addr = next, addr != end);
*/
static void __init __create_mapping(struct mm_struct *mm, pgd_t *pgd,
phys_addr_t phys, unsigned long virt,
- phys_addr_t size, int map_io)
+ phys_addr_t size, pgprot_t prot)
{
unsigned long addr, length, end, next;
end = addr + length;
do {
next = pgd_addr_end(addr, end);
- alloc_init_pud(mm, pgd, addr, next, phys, map_io);
+ alloc_init_pud(mm, pgd, addr, next, phys, prot);
phys += next - addr;
} while (pgd++, addr = next, addr != end);
}
return;
}
__create_mapping(&init_mm, pgd_offset_k(virt & PAGE_MASK), phys, virt,
- size, 0);
+ size, PAGE_KERNEL_EXEC);
}
void __init create_id_mapping(phys_addr_t addr, phys_addr_t size, int map_io)
return;
}
__create_mapping(&init_mm, &idmap_pg_dir[pgd_index(addr)],
- addr, addr, size, map_io);
+ addr, addr, size,
+ map_io ? __pgprot(PROT_DEVICE_nGnRE)
+ : PAGE_KERNEL_EXEC);
+}
+
+void __init create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys,
+ unsigned long virt, phys_addr_t size,
+ pgprot_t prot)
+{
+ __create_mapping(mm, pgd_offset(mm, virt), phys, virt, size, prot);
}
static void __init map_mem(void)