blob: 941a98c9e8aaf327b5131227ccaddb1d697ad2e5 [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
Russell King0371d3f2011-07-05 19:58:29 +010030void __init sanity_check_meminfo(void)
31{
32}
33
Russell Kingd111e8f2006-09-27 15:27:33 +010034/*
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 Pitre4b5f32c2008-10-06 13:24:40 -040038void __init paging_init(struct machine_desc *mdesc)
Russell Kingd111e8f2006-09-27 15:27:33 +010039{
Russell King8d717a52010-05-22 19:47:18 +010040 bootmem_init();
Russell Kingd111e8f2006-09-27 15:27:33 +010041}
42
Russell King80878d62006-09-27 15:43:47 +010043/*
44 * We don't need to do anything here for nommu machines.
45 */
46void setup_mm_for_reboot(char mode)
47{
48}
49
Russell Kinge6b1b382006-06-24 10:46:23 +010050void flush_dcache_page(struct page *page)
51{
Russell King2c9b9c82009-11-26 12:56:21 +000052 __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE);
Russell Kinge6b1b382006-06-24 10:46:23 +010053}
Hyok S. Choi3e361222006-06-27 20:55:43 +010054EXPORT_SYMBOL(flush_dcache_page);
Russell Kinge6b1b382006-06-24 10:46:23 +010055
Catalin Marinasb5a07fa2010-05-06 15:15:28 +010056void 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 King3603ab22007-05-05 20:59:27 +010065void __iomem *__arm_ioremap_pfn(unsigned long pfn, unsigned long offset,
66 size_t size, unsigned int mtype)
Russell King59244862006-06-22 15:05:36 +010067{
68 if (pfn >= (0x100000000ULL >> PAGE_SHIFT))
69 return NULL;
70 return (void __iomem *) (offset + (pfn << PAGE_SHIFT));
71}
Russell King3603ab22007-05-05 20:59:27 +010072EXPORT_SYMBOL(__arm_ioremap_pfn);
Russell King59244862006-06-22 15:05:36 +010073
Russell King31aa8fd2009-12-18 11:10:03 +000074void __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 King3603ab22007-05-05 20:59:27 +010080void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size,
81 unsigned int mtype)
Russell King59244862006-06-22 15:05:36 +010082{
83 return (void __iomem *)phys_addr;
84}
Russell King3603ab22007-05-05 20:59:27 +010085EXPORT_SYMBOL(__arm_ioremap);
Russell King59244862006-06-22 15:05:36 +010086
Catalin Marinasb1a9ceb2010-05-06 15:14:09 +010087void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size,
88 unsigned int mtype, void *caller)
Russell King31aa8fd2009-12-18 11:10:03 +000089{
90 return __arm_ioremap(phys_addr, size, mtype);
91}
92
Russell King3ff15592006-11-30 13:53:54 +000093void __iounmap(volatile void __iomem *addr)
Russell King59244862006-06-22 15:05:36 +010094{
95}
96EXPORT_SYMBOL(__iounmap);