Russell King | 5924486 | 2006-06-22 15:05:36 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mm/nommu.c |
| 3 | * |
| 4 | * ARM uCLinux supporting functions. |
| 5 | */ |
| 6 | #include <linux/module.h> |
Russell King | e6b1b38 | 2006-06-24 10:46:23 +0100 | [diff] [blame] | 7 | #include <linux/mm.h> |
| 8 | #include <linux/pagemap.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 9 | #include <linux/io.h> |
Russell King | 2778f62 | 2010-07-09 16:27:52 +0100 | [diff] [blame] | 10 | #include <linux/memblock.h> |
Russell King | 5924486 | 2006-06-22 15:05:36 +0100 | [diff] [blame] | 11 | |
Russell King | e6b1b38 | 2006-06-24 10:46:23 +0100 | [diff] [blame] | 12 | #include <asm/cacheflush.h> |
Russell King | 37efe64 | 2008-12-01 11:53:07 +0000 | [diff] [blame] | 13 | #include <asm/sections.h> |
Russell King | 5924486 | 2006-06-22 15:05:36 +0100 | [diff] [blame] | 14 | #include <asm/page.h> |
Catalin Marinas | b32f3af | 2009-07-24 12:35:03 +0100 | [diff] [blame] | 15 | #include <asm/setup.h> |
Will Deacon | 6b8e5c9 | 2012-04-12 17:16:01 +0100 | [diff] [blame] | 16 | #include <asm/traps.h> |
Russell King | 3ff1559 | 2006-11-30 13:53:54 +0000 | [diff] [blame] | 17 | #include <asm/mach/arch.h> |
Russell King | 5924486 | 2006-06-22 15:05:36 +0100 | [diff] [blame] | 18 | |
Russell King | d111e8f | 2006-09-27 15:27:33 +0100 | [diff] [blame] | 19 | #include "mm.h" |
| 20 | |
Russell King | 2778f62 | 2010-07-09 16:27:52 +0100 | [diff] [blame] | 21 | void __init arm_mm_memblock_reserve(void) |
Russell King | d111e8f | 2006-09-27 15:27:33 +0100 | [diff] [blame] | 22 | { |
| 23 | /* |
Russell King | d111e8f | 2006-09-27 15:27:33 +0100 | [diff] [blame] | 24 | * Register the exception vector page. |
| 25 | * some architectures which the DRAM is the exception vector to trap, |
| 26 | * alloc_page breaks with error, although it is not NULL, but "0." |
| 27 | */ |
Russell King | 2778f62 | 2010-07-09 16:27:52 +0100 | [diff] [blame] | 28 | memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE); |
Russell King | d111e8f | 2006-09-27 15:27:33 +0100 | [diff] [blame] | 29 | } |
| 30 | |
Russell King | 0371d3f | 2011-07-05 19:58:29 +0100 | [diff] [blame] | 31 | void __init sanity_check_meminfo(void) |
| 32 | { |
Nicolas Pitre | 55a8173 | 2011-09-18 22:40:00 -0400 | [diff] [blame] | 33 | phys_addr_t end = bank_phys_end(&meminfo.bank[meminfo.nr_banks - 1]); |
| 34 | high_memory = __va(end - 1) + 1; |
Russell King | 0371d3f | 2011-07-05 19:58:29 +0100 | [diff] [blame] | 35 | } |
| 36 | |
Russell King | d111e8f | 2006-09-27 15:27:33 +0100 | [diff] [blame] | 37 | /* |
| 38 | * paging_init() sets up the page tables, initialises the zone memory |
| 39 | * maps, and sets up the zero page, bad page and bad page tables. |
| 40 | */ |
Nicolas Pitre | 4b5f32c | 2008-10-06 13:24:40 -0400 | [diff] [blame] | 41 | void __init paging_init(struct machine_desc *mdesc) |
Russell King | d111e8f | 2006-09-27 15:27:33 +0100 | [diff] [blame] | 42 | { |
Will Deacon | 6b8e5c9 | 2012-04-12 17:16:01 +0100 | [diff] [blame] | 43 | early_trap_init((void *)CONFIG_VECTORS_BASE); |
Russell King | 8d717a5 | 2010-05-22 19:47:18 +0100 | [diff] [blame] | 44 | bootmem_init(); |
Russell King | d111e8f | 2006-09-27 15:27:33 +0100 | [diff] [blame] | 45 | } |
| 46 | |
Russell King | 80878d6 | 2006-09-27 15:43:47 +0100 | [diff] [blame] | 47 | /* |
| 48 | * We don't need to do anything here for nommu machines. |
| 49 | */ |
Russell King | 5aafec1 | 2011-11-01 10:15:27 +0000 | [diff] [blame] | 50 | void setup_mm_for_reboot(void) |
Russell King | 80878d6 | 2006-09-27 15:43:47 +0100 | [diff] [blame] | 51 | { |
| 52 | } |
| 53 | |
Russell King | e6b1b38 | 2006-06-24 10:46:23 +0100 | [diff] [blame] | 54 | void flush_dcache_page(struct page *page) |
| 55 | { |
Russell King | 2c9b9c8 | 2009-11-26 12:56:21 +0000 | [diff] [blame] | 56 | __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE); |
Russell King | e6b1b38 | 2006-06-24 10:46:23 +0100 | [diff] [blame] | 57 | } |
Hyok S. Choi | 3e36122 | 2006-06-27 20:55:43 +0100 | [diff] [blame] | 58 | EXPORT_SYMBOL(flush_dcache_page); |
Russell King | e6b1b38 | 2006-06-24 10:46:23 +0100 | [diff] [blame] | 59 | |
Catalin Marinas | b5a07fa | 2010-05-06 15:15:28 +0100 | [diff] [blame] | 60 | void copy_to_user_page(struct vm_area_struct *vma, struct page *page, |
| 61 | unsigned long uaddr, void *dst, const void *src, |
| 62 | unsigned long len) |
| 63 | { |
| 64 | memcpy(dst, src, len); |
| 65 | if (vma->vm_flags & VM_EXEC) |
| 66 | __cpuc_coherent_user_range(uaddr, uaddr + len); |
| 67 | } |
| 68 | |
Russell King | 3603ab2 | 2007-05-05 20:59:27 +0100 | [diff] [blame] | 69 | void __iomem *__arm_ioremap_pfn(unsigned long pfn, unsigned long offset, |
| 70 | size_t size, unsigned int mtype) |
Russell King | 5924486 | 2006-06-22 15:05:36 +0100 | [diff] [blame] | 71 | { |
| 72 | if (pfn >= (0x100000000ULL >> PAGE_SHIFT)) |
| 73 | return NULL; |
| 74 | return (void __iomem *) (offset + (pfn << PAGE_SHIFT)); |
| 75 | } |
Russell King | 3603ab2 | 2007-05-05 20:59:27 +0100 | [diff] [blame] | 76 | EXPORT_SYMBOL(__arm_ioremap_pfn); |
Russell King | 5924486 | 2006-06-22 15:05:36 +0100 | [diff] [blame] | 77 | |
Russell King | 31aa8fd | 2009-12-18 11:10:03 +0000 | [diff] [blame] | 78 | void __iomem *__arm_ioremap_pfn_caller(unsigned long pfn, unsigned long offset, |
| 79 | size_t size, unsigned int mtype, void *caller) |
| 80 | { |
| 81 | return __arm_ioremap_pfn(pfn, offset, size, mtype); |
| 82 | } |
| 83 | |
Russell King | 3603ab2 | 2007-05-05 20:59:27 +0100 | [diff] [blame] | 84 | void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size, |
| 85 | unsigned int mtype) |
Russell King | 5924486 | 2006-06-22 15:05:36 +0100 | [diff] [blame] | 86 | { |
| 87 | return (void __iomem *)phys_addr; |
| 88 | } |
Russell King | 3603ab2 | 2007-05-05 20:59:27 +0100 | [diff] [blame] | 89 | EXPORT_SYMBOL(__arm_ioremap); |
Russell King | 5924486 | 2006-06-22 15:05:36 +0100 | [diff] [blame] | 90 | |
Rob Herring | 8a2b625 | 2012-03-10 21:24:04 -0600 | [diff] [blame] | 91 | void __iomem * (*arch_ioremap_caller)(unsigned long, size_t, unsigned int, void *); |
| 92 | |
Catalin Marinas | b1a9ceb | 2010-05-06 15:14:09 +0100 | [diff] [blame] | 93 | void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size, |
| 94 | unsigned int mtype, void *caller) |
Russell King | 31aa8fd | 2009-12-18 11:10:03 +0000 | [diff] [blame] | 95 | { |
| 96 | return __arm_ioremap(phys_addr, size, mtype); |
| 97 | } |
| 98 | |
Rob Herring | 8a2b625 | 2012-03-10 21:24:04 -0600 | [diff] [blame] | 99 | void (*arch_iounmap)(volatile void __iomem *); |
| 100 | |
| 101 | void __arm_iounmap(volatile void __iomem *addr) |
Russell King | 5924486 | 2006-06-22 15:05:36 +0100 | [diff] [blame] | 102 | { |
| 103 | } |
Rob Herring | 8a2b625 | 2012-03-10 21:24:04 -0600 | [diff] [blame] | 104 | EXPORT_SYMBOL(__arm_iounmap); |