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