blob: 6486d2f253cdd9dba5758d4402b11746dc0bda0a [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{
Nicolas Pitre55a81732011-09-18 22:40:00 -040032 phys_addr_t end = bank_phys_end(&meminfo.bank[meminfo.nr_banks - 1]);
33 high_memory = __va(end - 1) + 1;
Russell King0371d3f2011-07-05 19:58:29 +010034}
35
Russell Kingd111e8f2006-09-27 15:27:33 +010036/*
37 * paging_init() sets up the page tables, initialises the zone memory
38 * maps, and sets up the zero page, bad page and bad page tables.
39 */
Nicolas Pitre4b5f32c2008-10-06 13:24:40 -040040void __init paging_init(struct machine_desc *mdesc)
Russell Kingd111e8f2006-09-27 15:27:33 +010041{
Russell King8d717a52010-05-22 19:47:18 +010042 bootmem_init();
Russell Kingd111e8f2006-09-27 15:27:33 +010043}
44
Russell King80878d62006-09-27 15:43:47 +010045/*
46 * We don't need to do anything here for nommu machines.
47 */
Russell King5aafec12011-11-01 10:15:27 +000048void setup_mm_for_reboot(void)
Russell King80878d62006-09-27 15:43:47 +010049{
50}
51
Russell Kinge6b1b382006-06-24 10:46:23 +010052void flush_dcache_page(struct page *page)
53{
Russell King2c9b9c82009-11-26 12:56:21 +000054 __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE);
Russell Kinge6b1b382006-06-24 10:46:23 +010055}
Hyok S. Choi3e361222006-06-27 20:55:43 +010056EXPORT_SYMBOL(flush_dcache_page);
Russell Kinge6b1b382006-06-24 10:46:23 +010057
Catalin Marinasb5a07fa2010-05-06 15:15:28 +010058void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
59 unsigned long uaddr, void *dst, const void *src,
60 unsigned long len)
61{
62 memcpy(dst, src, len);
63 if (vma->vm_flags & VM_EXEC)
64 __cpuc_coherent_user_range(uaddr, uaddr + len);
65}
66
Russell King3603ab22007-05-05 20:59:27 +010067void __iomem *__arm_ioremap_pfn(unsigned long pfn, unsigned long offset,
68 size_t size, unsigned int mtype)
Russell King59244862006-06-22 15:05:36 +010069{
70 if (pfn >= (0x100000000ULL >> PAGE_SHIFT))
71 return NULL;
72 return (void __iomem *) (offset + (pfn << PAGE_SHIFT));
73}
Russell King3603ab22007-05-05 20:59:27 +010074EXPORT_SYMBOL(__arm_ioremap_pfn);
Russell King59244862006-06-22 15:05:36 +010075
Russell King31aa8fd2009-12-18 11:10:03 +000076void __iomem *__arm_ioremap_pfn_caller(unsigned long pfn, unsigned long offset,
77 size_t size, unsigned int mtype, void *caller)
78{
79 return __arm_ioremap_pfn(pfn, offset, size, mtype);
80}
81
Russell King3603ab22007-05-05 20:59:27 +010082void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size,
83 unsigned int mtype)
Russell King59244862006-06-22 15:05:36 +010084{
85 return (void __iomem *)phys_addr;
86}
Russell King3603ab22007-05-05 20:59:27 +010087EXPORT_SYMBOL(__arm_ioremap);
Russell King59244862006-06-22 15:05:36 +010088
Rob Herring8a2b6252012-03-10 21:24:04 -060089void __iomem * (*arch_ioremap_caller)(unsigned long, size_t, unsigned int, void *);
90
Catalin Marinasb1a9ceb2010-05-06 15:14:09 +010091void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size,
92 unsigned int mtype, void *caller)
Russell King31aa8fd2009-12-18 11:10:03 +000093{
94 return __arm_ioremap(phys_addr, size, mtype);
95}
96
Rob Herring8a2b6252012-03-10 21:24:04 -060097void (*arch_iounmap)(volatile void __iomem *);
98
99void __arm_iounmap(volatile void __iomem *addr)
Russell King59244862006-06-22 15:05:36 +0100100{
101}
Rob Herring8a2b6252012-03-10 21:24:04 -0600102EXPORT_SYMBOL(__arm_iounmap);