blob: 07b62b23897909bca58218aec816e41e7608ab3f [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 King59244862006-06-22 15:05:36 +010013#include <asm/page.h>
Russell King3ff15592006-11-30 13:53:54 +000014#include <asm/mach/arch.h>
Russell King59244862006-06-22 15:05:36 +010015
Russell Kingd111e8f2006-09-27 15:27:33 +010016#include "mm.h"
17
Russell Kingd111e8f2006-09-27 15:27:33 +010018/*
19 * Reserve the various regions of node 0
20 */
21void __init reserve_node_zero(pg_data_t *pgdat)
22{
23 /*
24 * Register the kernel text and data with bootmem.
25 * Note that this can only be in node 0.
26 */
27#ifdef CONFIG_XIP_KERNEL
Bernhard Walle72a7fe32008-02-07 00:15:17 -080028 reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start,
29 BOOTMEM_DEFAULT);
Russell Kingd111e8f2006-09-27 15:27:33 +010030#else
Bernhard Walle72a7fe32008-02-07 00:15:17 -080031 reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext,
32 BOOTMEM_DEFAULT);
Russell Kingd111e8f2006-09-27 15:27:33 +010033#endif
34
35 /*
36 * Register the exception vector page.
37 * some architectures which the DRAM is the exception vector to trap,
38 * alloc_page breaks with error, although it is not NULL, but "0."
39 */
Bernhard Walle72a7fe32008-02-07 00:15:17 -080040 reserve_bootmem_node(pgdat, CONFIG_VECTORS_BASE, PAGE_SIZE,
41 BOOTMEM_DEFAULT);
Russell Kingd111e8f2006-09-27 15:27:33 +010042}
43
Russell Kingeca73212008-09-30 19:29:25 +010044static void __init sanity_check_meminfo(struct meminfo *mi)
45{
46 int i, j;
47
48 for (i = 0, j = 0; i < mi->nr_banks; i++) {
49 struct membank *mb = &mi->bank[i];
50
51 if (mb->size != 0 && mb->node < MAX_NUMNODES)
52 mi->bank[j++] = mi->bank[i];
53 }
54 mi->nr_banks = j;
55}
56
Russell Kingd111e8f2006-09-27 15:27:33 +010057/*
58 * paging_init() sets up the page tables, initialises the zone memory
59 * maps, and sets up the zero page, bad page and bad page tables.
60 */
61void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc)
62{
Russell Kingeca73212008-09-30 19:29:25 +010063 sanity_check_meminfo(mi);
Russell Kingd111e8f2006-09-27 15:27:33 +010064 bootmem_init(mi);
65}
66
Russell King80878d62006-09-27 15:43:47 +010067/*
68 * We don't need to do anything here for nommu machines.
69 */
70void setup_mm_for_reboot(char mode)
71{
72}
73
Russell Kinge6b1b382006-06-24 10:46:23 +010074void flush_dcache_page(struct page *page)
75{
76 __cpuc_flush_dcache_page(page_address(page));
77}
Hyok S. Choi3e361222006-06-27 20:55:43 +010078EXPORT_SYMBOL(flush_dcache_page);
Russell Kinge6b1b382006-06-24 10:46:23 +010079
Russell King3603ab22007-05-05 20:59:27 +010080void __iomem *__arm_ioremap_pfn(unsigned long pfn, unsigned long offset,
81 size_t size, unsigned int mtype)
Russell King59244862006-06-22 15:05:36 +010082{
83 if (pfn >= (0x100000000ULL >> PAGE_SHIFT))
84 return NULL;
85 return (void __iomem *) (offset + (pfn << PAGE_SHIFT));
86}
Russell King3603ab22007-05-05 20:59:27 +010087EXPORT_SYMBOL(__arm_ioremap_pfn);
Russell King59244862006-06-22 15:05:36 +010088
Russell King3603ab22007-05-05 20:59:27 +010089void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size,
90 unsigned int mtype)
Russell King59244862006-06-22 15:05:36 +010091{
92 return (void __iomem *)phys_addr;
93}
Russell King3603ab22007-05-05 20:59:27 +010094EXPORT_SYMBOL(__arm_ioremap);
Russell King59244862006-06-22 15:05:36 +010095
Russell King3ff15592006-11-30 13:53:54 +000096void __iounmap(volatile void __iomem *addr)
Russell King59244862006-06-22 15:05:36 +010097{
98}
99EXPORT_SYMBOL(__iounmap);