mmu.c (cf9ce948f47640797bd19980e1d99c6d17d0bdc3) | mmu.c (2475ff9d2c6ea3bbfed55c4635426c371f9ad327) |
---|---|
1/* 2 * Based on arch/arm/mm/mmu.c 3 * 4 * Copyright (C) 1995-2005 Russell King 5 * Copyright (C) 2012 ARM Ltd. 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 11 unchanged lines hidden (view full) --- 20#include <linux/export.h> 21#include <linux/kernel.h> 22#include <linux/errno.h> 23#include <linux/init.h> 24#include <linux/mman.h> 25#include <linux/nodemask.h> 26#include <linux/memblock.h> 27#include <linux/fs.h> | 1/* 2 * Based on arch/arm/mm/mmu.c 3 * 4 * Copyright (C) 1995-2005 Russell King 5 * Copyright (C) 2012 ARM Ltd. 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 11 unchanged lines hidden (view full) --- 20#include <linux/export.h> 21#include <linux/kernel.h> 22#include <linux/errno.h> 23#include <linux/init.h> 24#include <linux/mman.h> 25#include <linux/nodemask.h> 26#include <linux/memblock.h> 27#include <linux/fs.h> |
28#include <linux/io.h> |
|
28 29#include <asm/cputype.h> 30#include <asm/sections.h> 31#include <asm/setup.h> 32#include <asm/sizes.h> 33#include <asm/tlb.h> 34#include <asm/mmu_context.h> 35 --- 210 unchanged lines hidden (view full) --- 246 end = addr + length; 247 do { 248 next = pgd_addr_end(addr, end); 249 alloc_init_pud(pgd, addr, next, phys); 250 phys += next - addr; 251 } while (pgd++, addr = next, addr != end); 252} 253 | 29 30#include <asm/cputype.h> 31#include <asm/sections.h> 32#include <asm/setup.h> 33#include <asm/sizes.h> 34#include <asm/tlb.h> 35#include <asm/mmu_context.h> 36 --- 210 unchanged lines hidden (view full) --- 247 end = addr + length; 248 do { 249 next = pgd_addr_end(addr, end); 250 alloc_init_pud(pgd, addr, next, phys); 251 phys += next - addr; 252 } while (pgd++, addr = next, addr != end); 253} 254 |
255#ifdef CONFIG_EARLY_PRINTK 256/* 257 * Create an early I/O mapping using the pgd/pmd entries already populated 258 * in head.S as this function is called too early to allocated any memory. The 259 * mapping size is 2MB with 4KB pages or 64KB or 64KB pages. 260 */ 261void __iomem * __init early_io_map(phys_addr_t phys, unsigned long virt) 262{ 263 unsigned long size, mask; 264 bool page64k = IS_ENABLED(ARM64_64K_PAGES); 265 pgd_t *pgd; 266 pud_t *pud; 267 pmd_t *pmd; 268 pte_t *pte; 269 270 /* 271 * No early pte entries with !ARM64_64K_PAGES configuration, so using 272 * sections (pmd). 273 */ 274 size = page64k ? PAGE_SIZE : SECTION_SIZE; 275 mask = ~(size - 1); 276 277 pgd = pgd_offset_k(virt); 278 pud = pud_offset(pgd, virt); 279 if (pud_none(*pud)) 280 return NULL; 281 pmd = pmd_offset(pud, virt); 282 283 if (page64k) { 284 if (pmd_none(*pmd)) 285 return NULL; 286 pte = pte_offset_kernel(pmd, virt); 287 set_pte(pte, __pte((phys & mask) | PROT_DEVICE_nGnRE)); 288 } else { 289 set_pmd(pmd, __pmd((phys & mask) | PROT_SECT_DEVICE_nGnRE)); 290 } 291 292 return (void __iomem *)((virt & mask) + (phys & ~mask)); 293} 294#endif 295 |
|
254static void __init map_mem(void) 255{ 256 struct memblock_region *reg; 257 258 /* map all the memory banks */ 259 for_each_memblock(memory, reg) { 260 phys_addr_t start = reg->base; 261 phys_addr_t end = start + reg->size; --- 134 unchanged lines hidden --- | 296static void __init map_mem(void) 297{ 298 struct memblock_region *reg; 299 300 /* map all the memory banks */ 301 for_each_memblock(memory, reg) { 302 phys_addr_t start = reg->base; 303 phys_addr_t end = start + reg->size; --- 134 unchanged lines hidden --- |