blob: ad7bacc693b2553b3571eee8ee4ec54b1bb44de5 [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 King3ff15592006-11-30 13:53:54 +00009#include <linux/bootmem.h>
Russell Kingfced80c2008-09-06 12:10:45 +010010#include <linux/io.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>
Russell King3ff15592006-11-30 13:53:54 +000015#include <asm/mach/arch.h>
Russell King59244862006-06-22 15:05:36 +010016
Russell Kingd111e8f2006-09-27 15:27:33 +010017#include "mm.h"
18
Russell Kingd111e8f2006-09-27 15:27:33 +010019/*
20 * Reserve the various regions of node 0
21 */
22void __init reserve_node_zero(pg_data_t *pgdat)
23{
24 /*
25 * Register the kernel text and data with bootmem.
26 * Note that this can only be in node 0.
27 */
28#ifdef CONFIG_XIP_KERNEL
Russell King37efe642008-12-01 11:53:07 +000029 reserve_bootmem_node(pgdat, __pa(_data), _end - _data,
Bernhard Walle72a7fe32008-02-07 00:15:17 -080030 BOOTMEM_DEFAULT);
Russell Kingd111e8f2006-09-27 15:27:33 +010031#else
Russell King37efe642008-12-01 11:53:07 +000032 reserve_bootmem_node(pgdat, __pa(_stext), _end - _stext,
Bernhard Walle72a7fe32008-02-07 00:15:17 -080033 BOOTMEM_DEFAULT);
Russell Kingd111e8f2006-09-27 15:27:33 +010034#endif
35
36 /*
37 * Register the exception vector page.
38 * some architectures which the DRAM is the exception vector to trap,
39 * alloc_page breaks with error, although it is not NULL, but "0."
40 */
Bernhard Walle72a7fe32008-02-07 00:15:17 -080041 reserve_bootmem_node(pgdat, CONFIG_VECTORS_BASE, PAGE_SIZE,
42 BOOTMEM_DEFAULT);
Russell Kingd111e8f2006-09-27 15:27:33 +010043}
44
45/*
46 * paging_init() sets up the page tables, initialises the zone memory
47 * maps, and sets up the zero page, bad page and bad page tables.
48 */
Nicolas Pitre4b5f32c2008-10-06 13:24:40 -040049void __init paging_init(struct machine_desc *mdesc)
Russell Kingd111e8f2006-09-27 15:27:33 +010050{
Nicolas Pitre4b5f32c2008-10-06 13:24:40 -040051 bootmem_init();
Russell Kingd111e8f2006-09-27 15:27:33 +010052}
53
Russell King80878d62006-09-27 15:43:47 +010054/*
55 * We don't need to do anything here for nommu machines.
56 */
57void setup_mm_for_reboot(char mode)
58{
59}
60
Russell Kinge6b1b382006-06-24 10:46:23 +010061void flush_dcache_page(struct page *page)
62{
63 __cpuc_flush_dcache_page(page_address(page));
64}
Hyok S. Choi3e361222006-06-27 20:55:43 +010065EXPORT_SYMBOL(flush_dcache_page);
Russell Kinge6b1b382006-06-24 10:46:23 +010066
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 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
Russell King3ff15592006-11-30 13:53:54 +000083void __iounmap(volatile void __iomem *addr)
Russell King59244862006-06-22 15:05:36 +010084{
85}
86EXPORT_SYMBOL(__iounmap);