blob: 40e38fcccc7aa56c7f0f39338f6146996bcac530 [file] [log] [blame]
Russell King59244862006-06-22 15:05:36 +01001/*
2 * linux/arch/arm/mm/nommu.c
3 *
4 * ARM uCLinux supporting functions.
5 */
6#include <linux/module.h>
Russell Kinge6b1b382006-06-24 10:46:23 +01007#include <linux/mm.h>
8#include <linux/pagemap.h>
Russell Kingfced80c2008-09-06 12:10:45 +01009#include <linux/io.h>
Russell King2778f622010-07-09 16:27:52 +010010#include <linux/memblock.h>
Russell King59244862006-06-22 15:05:36 +010011
Russell Kinge6b1b382006-06-24 10:46:23 +010012#include <asm/cacheflush.h>
Russell King37efe642008-12-01 11:53:07 +000013#include <asm/sections.h>
Russell King59244862006-06-22 15:05:36 +010014#include <asm/page.h>
Catalin Marinasb32f3af2009-07-24 12:35:03 +010015#include <asm/setup.h>
Russell King3ff15592006-11-30 13:53:54 +000016#include <asm/mach/arch.h>
Russell King59244862006-06-22 15:05:36 +010017
Russell Kingd111e8f2006-09-27 15:27:33 +010018#include "mm.h"
19
Russell King2778f622010-07-09 16:27:52 +010020void __init arm_mm_memblock_reserve(void)
Russell Kingd111e8f2006-09-27 15:27:33 +010021{
22 /*
Russell Kingd111e8f2006-09-27 15:27:33 +010023 * 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 King2778f622010-07-09 16:27:52 +010027 memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE);
Russell Kingd111e8f2006-09-27 15:27:33 +010028}
29
30/*
31 * paging_init() sets up the page tables, initialises the zone memory
32 * maps, and sets up the zero page, bad page and bad page tables.
33 */
Nicolas Pitre4b5f32c2008-10-06 13:24:40 -040034void __init paging_init(struct machine_desc *mdesc)
Russell Kingd111e8f2006-09-27 15:27:33 +010035{
Russell King98c672c2010-05-22 18:18:57 +010036 bootmem_init(mdesc);
Russell Kingd111e8f2006-09-27 15:27:33 +010037}
38
Russell King80878d62006-09-27 15:43:47 +010039/*
40 * We don't need to do anything here for nommu machines.
41 */
42void setup_mm_for_reboot(char mode)
43{
44}
45
Russell Kinge6b1b382006-06-24 10:46:23 +010046void flush_dcache_page(struct page *page)
47{
Russell King2c9b9c82009-11-26 12:56:21 +000048 __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE);
Russell Kinge6b1b382006-06-24 10:46:23 +010049}
Hyok S. Choi3e361222006-06-27 20:55:43 +010050EXPORT_SYMBOL(flush_dcache_page);
Russell Kinge6b1b382006-06-24 10:46:23 +010051
Catalin Marinasb5a07fa2010-05-06 15:15:28 +010052void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
53 unsigned long uaddr, void *dst, const void *src,
54 unsigned long len)
55{
56 memcpy(dst, src, len);
57 if (vma->vm_flags & VM_EXEC)
58 __cpuc_coherent_user_range(uaddr, uaddr + len);
59}
60
Russell King3603ab22007-05-05 20:59:27 +010061void __iomem *__arm_ioremap_pfn(unsigned long pfn, unsigned long offset,
62 size_t size, unsigned int mtype)
Russell King59244862006-06-22 15:05:36 +010063{
64 if (pfn >= (0x100000000ULL >> PAGE_SHIFT))
65 return NULL;
66 return (void __iomem *) (offset + (pfn << PAGE_SHIFT));
67}
Russell King3603ab22007-05-05 20:59:27 +010068EXPORT_SYMBOL(__arm_ioremap_pfn);
Russell King59244862006-06-22 15:05:36 +010069
Russell King31aa8fd2009-12-18 11:10:03 +000070void __iomem *__arm_ioremap_pfn_caller(unsigned long pfn, unsigned long offset,
71 size_t size, unsigned int mtype, void *caller)
72{
73 return __arm_ioremap_pfn(pfn, offset, size, mtype);
74}
75
Russell King3603ab22007-05-05 20:59:27 +010076void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size,
77 unsigned int mtype)
Russell King59244862006-06-22 15:05:36 +010078{
79 return (void __iomem *)phys_addr;
80}
Russell King3603ab22007-05-05 20:59:27 +010081EXPORT_SYMBOL(__arm_ioremap);
Russell King59244862006-06-22 15:05:36 +010082
Catalin Marinasb1a9ceb2010-05-06 15:14:09 +010083void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size,
84 unsigned int mtype, void *caller)
Russell King31aa8fd2009-12-18 11:10:03 +000085{
86 return __arm_ioremap(phys_addr, size, mtype);
87}
88
Russell King3ff15592006-11-30 13:53:54 +000089void __iounmap(volatile void __iomem *addr)
Russell King59244862006-06-22 15:05:36 +010090{
91}
92EXPORT_SYMBOL(__iounmap);