xref: /linux/arch/arm/mm/nommu.c (revision 44b56603c4c476b845a824cff6fe905c6268b2a1)
1 /*
2  *  linux/arch/arm/mm/nommu.c
3  *
4  * ARM uCLinux supporting functions.
5  */
6 #include <linux/module.h>
7 #include <linux/mm.h>
8 #include <linux/pagemap.h>
9 #include <linux/bootmem.h>
10 #include <linux/io.h>
11 
12 #include <asm/cacheflush.h>
13 #include <asm/sections.h>
14 #include <asm/page.h>
15 #include <asm/setup.h>
16 #include <asm/mach/arch.h>
17 
18 #include "mm.h"
19 
20 /*
21  * Reserve the various regions of node 0
22  */
23 void __init reserve_node_zero(pg_data_t *pgdat)
24 {
25 	/*
26 	 * Register the kernel text and data with bootmem.
27 	 * Note that this can only be in node 0.
28 	 */
29 #ifdef CONFIG_XIP_KERNEL
30 	reserve_bootmem_node(pgdat, __pa(_data), _end - _data,
31 			BOOTMEM_DEFAULT);
32 #else
33 	reserve_bootmem_node(pgdat, __pa(_stext), _end - _stext,
34 			BOOTMEM_DEFAULT);
35 #endif
36 
37 	/*
38 	 * Register the exception vector page.
39 	 * some architectures which the DRAM is the exception vector to trap,
40 	 * alloc_page breaks with error, although it is not NULL, but "0."
41 	 */
42 	reserve_bootmem_node(pgdat, CONFIG_VECTORS_BASE, PAGE_SIZE,
43 			BOOTMEM_DEFAULT);
44 }
45 
46 /*
47  * paging_init() sets up the page tables, initialises the zone memory
48  * maps, and sets up the zero page, bad page and bad page tables.
49  */
50 void __init paging_init(struct machine_desc *mdesc)
51 {
52 	bootmem_init();
53 }
54 
55 /*
56  * We don't need to do anything here for nommu machines.
57  */
58 void setup_mm_for_reboot(char mode)
59 {
60 }
61 
62 void flush_dcache_page(struct page *page)
63 {
64 	__cpuc_flush_dcache_area(page_address(page), PAGE_SIZE);
65 }
66 EXPORT_SYMBOL(flush_dcache_page);
67 
68 void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
69 		       unsigned long uaddr, void *dst, const void *src,
70 		       unsigned long len)
71 {
72 	memcpy(dst, src, len);
73 	if (vma->vm_flags & VM_EXEC)
74 		__cpuc_coherent_user_range(uaddr, uaddr + len);
75 }
76 
77 void __iomem *__arm_ioremap_pfn(unsigned long pfn, unsigned long offset,
78 				size_t size, unsigned int mtype)
79 {
80 	if (pfn >= (0x100000000ULL >> PAGE_SHIFT))
81 		return NULL;
82 	return (void __iomem *) (offset + (pfn << PAGE_SHIFT));
83 }
84 EXPORT_SYMBOL(__arm_ioremap_pfn);
85 
86 void __iomem *__arm_ioremap_pfn_caller(unsigned long pfn, unsigned long offset,
87 			   size_t size, unsigned int mtype, void *caller)
88 {
89 	return __arm_ioremap_pfn(pfn, offset, size, mtype);
90 }
91 
92 void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size,
93 			    unsigned int mtype)
94 {
95 	return (void __iomem *)phys_addr;
96 }
97 EXPORT_SYMBOL(__arm_ioremap);
98 
99 void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size,
100 				   unsigned int mtype, void *caller)
101 {
102 	return __arm_ioremap(phys_addr, size, mtype);
103 }
104 
105 void __iounmap(volatile void __iomem *addr)
106 {
107 }
108 EXPORT_SYMBOL(__iounmap);
109