mmu.c (0bf757c73d6612d3d279de3f61b35062aa9c8b1d) | mmu.c (bf4b558eba920a38f91beb5ee62a8ce2628c92f7) |
---|---|
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 --- 246 unchanged lines hidden (view full) --- 255 end = addr + length; 256 do { 257 next = pgd_addr_end(addr, end); 258 alloc_init_pud(pgd, addr, next, phys); 259 phys += next - addr; 260 } while (pgd++, addr = next, addr != end); 261} 262 | 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 --- 246 unchanged lines hidden (view full) --- 255 end = addr + length; 256 do { 257 next = pgd_addr_end(addr, end); 258 alloc_init_pud(pgd, addr, next, phys); 259 phys += next - addr; 260 } while (pgd++, addr = next, addr != end); 261} 262 |
263#ifdef CONFIG_EARLY_PRINTK 264/* 265 * Create an early I/O mapping using the pgd/pmd entries already populated 266 * in head.S as this function is called too early to allocated any memory. The 267 * mapping size is 2MB with 4KB pages or 64KB or 64KB pages. 268 */ 269void __iomem * __init early_io_map(phys_addr_t phys, unsigned long virt) 270{ 271 unsigned long size, mask; 272 bool page64k = IS_ENABLED(CONFIG_ARM64_64K_PAGES); 273 pgd_t *pgd; 274 pud_t *pud; 275 pmd_t *pmd; 276 pte_t *pte; 277 278 /* 279 * No early pte entries with !ARM64_64K_PAGES configuration, so using 280 * sections (pmd). 281 */ 282 size = page64k ? PAGE_SIZE : SECTION_SIZE; 283 mask = ~(size - 1); 284 285 pgd = pgd_offset_k(virt); 286 pud = pud_offset(pgd, virt); 287 if (pud_none(*pud)) 288 return NULL; 289 pmd = pmd_offset(pud, virt); 290 291 if (page64k) { 292 if (pmd_none(*pmd)) 293 return NULL; 294 pte = pte_offset_kernel(pmd, virt); 295 set_pte(pte, __pte((phys & mask) | PROT_DEVICE_nGnRE)); 296 } else { 297 set_pmd(pmd, __pmd((phys & mask) | PROT_SECT_DEVICE_nGnRE)); 298 } 299 300 return (void __iomem *)((virt & mask) + (phys & ~mask)); 301} 302#endif 303 | |
304static void __init map_mem(void) 305{ 306 struct memblock_region *reg; 307 phys_addr_t limit; 308 309 /* 310 * Temporarily limit the memblock range. We need to do this as 311 * create_mapping requires puds, pmds and ptes to be allocated from --- 158 unchanged lines hidden --- | 263static void __init map_mem(void) 264{ 265 struct memblock_region *reg; 266 phys_addr_t limit; 267 268 /* 269 * Temporarily limit the memblock range. We need to do this as 270 * create_mapping requires puds, pmds and ptes to be allocated from --- 158 unchanged lines hidden --- |