diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2013-01-18 04:42:20 -0500 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2013-02-15 12:45:54 -0500 |
commit | c121c5063c0674fad6811f0b0d86ec3bc6eecbbd (patch) | |
tree | 956c6f18fcf72d3e20a86168669237ecdabd8a13 /arch | |
parent | 1162b0701b14ba112d4e3fe5c27c694caf983539 (diff) |
ARC: Boot #1: low-level, setup_arch(), /proc/cpuinfo, mem init
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arc/Kconfig | 2 | ||||
-rw-r--r-- | arch/arc/include/asm/arcregs.h | 5 | ||||
-rw-r--r-- | arch/arc/include/asm/setup.h | 22 | ||||
-rw-r--r-- | arch/arc/kernel/head.S | 78 | ||||
-rw-r--r-- | arch/arc/kernel/reset.c | 33 | ||||
-rw-r--r-- | arch/arc/kernel/setup.c | 166 | ||||
-rw-r--r-- | arch/arc/mm/init.c | 171 | ||||
-rw-r--r-- | arch/arc/plat-arcfpga/platform.c | 29 |
8 files changed, 506 insertions, 0 deletions
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 756beffd20cb..a3538493e353 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig | |||
@@ -23,7 +23,9 @@ config ARC | |||
23 | select GENERIC_SIGALTSTACK | 23 | select GENERIC_SIGALTSTACK |
24 | select GENERIC_SMP_IDLE_THREAD | 24 | select GENERIC_SMP_IDLE_THREAD |
25 | select HAVE_GENERIC_HARDIRQS | 25 | select HAVE_GENERIC_HARDIRQS |
26 | select HAVE_MEMBLOCK | ||
26 | select MODULES_USE_ELF_RELA | 27 | select MODULES_USE_ELF_RELA |
28 | select NO_BOOTMEM | ||
27 | 29 | ||
28 | config SCHED_OMIT_FRAME_POINTER | 30 | config SCHED_OMIT_FRAME_POINTER |
29 | def_bool y | 31 | def_bool y |
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h index 1c24485fd04b..9e42611e39d3 100644 --- a/arch/arc/include/asm/arcregs.h +++ b/arch/arc/include/asm/arcregs.h | |||
@@ -258,6 +258,11 @@ | |||
258 | } \ | 258 | } \ |
259 | } | 259 | } |
260 | 260 | ||
261 | /* Helpers */ | ||
262 | #define TO_KB(bytes) ((bytes) >> 10) | ||
263 | #define TO_MB(bytes) (TO_KB(bytes) >> 10) | ||
264 | #define PAGES_TO_KB(n_pages) ((n_pages) << (PAGE_SHIFT - 10)) | ||
265 | #define PAGES_TO_MB(n_pages) (PAGES_TO_KB(n_pages) >> 10) | ||
261 | 266 | ||
262 | #ifdef CONFIG_ARC_FPU_SAVE_RESTORE | 267 | #ifdef CONFIG_ARC_FPU_SAVE_RESTORE |
263 | /* These DPFP regs need to be saved/restored across ctx-sw */ | 268 | /* These DPFP regs need to be saved/restored across ctx-sw */ |
diff --git a/arch/arc/include/asm/setup.h b/arch/arc/include/asm/setup.h new file mode 100644 index 000000000000..ab427e6a2cb5 --- /dev/null +++ b/arch/arc/include/asm/setup.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef __ASMARC_SETUP_H | ||
10 | #define __ASMARC_SETUP_H | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | |||
14 | #define COMMAND_LINE_SIZE 256 | ||
15 | |||
16 | extern int root_mountflags, end_mem; | ||
17 | extern int running_on_hw; | ||
18 | |||
19 | void __init setup_processor(void); | ||
20 | void __init setup_arch_memory(void); | ||
21 | |||
22 | #endif /* __ASMARC_SETUP_H */ | ||
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S new file mode 100644 index 000000000000..e63f6a43abb1 --- /dev/null +++ b/arch/arc/kernel/head.S | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * ARC CPU startup Code | ||
3 | * | ||
4 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * Vineetg: Dec 2007 | ||
11 | * -Check if we are running on Simulator or on real hardware | ||
12 | * to skip certain things during boot on simulator | ||
13 | */ | ||
14 | |||
15 | #include <asm/asm-offsets.h> | ||
16 | #include <asm/entry.h> | ||
17 | #include <linux/linkage.h> | ||
18 | #include <asm/arcregs.h> | ||
19 | |||
20 | .cpu A7 | ||
21 | |||
22 | .section .init.text, "ax",@progbits | ||
23 | .type stext, @function | ||
24 | .globl stext | ||
25 | stext: | ||
26 | ;------------------------------------------------------------------- | ||
27 | ; Don't clobber r0-r4 yet. It might have bootloader provided info | ||
28 | ;------------------------------------------------------------------- | ||
29 | |||
30 | ; Clear BSS before updating any globals | ||
31 | ; XXX: use ZOL here | ||
32 | mov r5, __bss_start | ||
33 | mov r6, __bss_stop | ||
34 | 1: | ||
35 | st.ab 0, [r5,4] | ||
36 | brlt r5, r6, 1b | ||
37 | |||
38 | #ifdef CONFIG_CMDLINE_UBOOT | ||
39 | ; support for bootloader provided cmdline | ||
40 | ; If cmdline passed by u-boot, then | ||
41 | ; r0 = 1 (because ATAGS parsing, now retired, used to use 0) | ||
42 | ; r1 = magic number (board identity) | ||
43 | ; r2 = addr of cmdline string (somewhere in memory/flash) | ||
44 | |||
45 | brne r0, 1, .Lother_bootup_chores ; u-boot didn't pass cmdline | ||
46 | breq r2, 0, .Lother_bootup_chores ; or cmdline is NULL | ||
47 | |||
48 | mov r5, @command_line | ||
49 | 1: | ||
50 | ldb.ab r6, [r2, 1] | ||
51 | breq r6, 0, .Lother_bootup_chores | ||
52 | b.d 1b | ||
53 | stb.ab r6, [r5, 1] | ||
54 | #endif | ||
55 | |||
56 | .Lother_bootup_chores: | ||
57 | |||
58 | ; Identify if running on ISS vs Silicon | ||
59 | ; IDENTITY Reg [ 3 2 1 0 ] | ||
60 | ; (chip-id) ^^^^^ ==> 0xffff for ISS | ||
61 | lr r0, [identity] | ||
62 | lsr r3, r0, 16 | ||
63 | cmp r3, 0xffff | ||
64 | mov.z r4, 0 | ||
65 | mov.nz r4, 1 | ||
66 | st r4, [@running_on_hw] | ||
67 | |||
68 | ; setup "current" tsk and optionally cache it in dedicated r25 | ||
69 | mov r9, @init_task | ||
70 | SET_CURR_TASK_ON_CPU r9, r0 ; r9 = tsk, r0 = scratch | ||
71 | |||
72 | ; setup stack (fp, sp) | ||
73 | mov fp, 0 | ||
74 | |||
75 | ; tsk->thread_info is really a PAGE, whose bottom hoists stack | ||
76 | GET_TSK_STACK_BASE r9, sp ; r9 = tsk, sp = stack base(output) | ||
77 | |||
78 | j start_kernel ; "C" entry point | ||
diff --git a/arch/arc/kernel/reset.c b/arch/arc/kernel/reset.c new file mode 100644 index 000000000000..e227a2b1c943 --- /dev/null +++ b/arch/arc/kernel/reset.c | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/printk.h> | ||
11 | #include <linux/reboot.h> | ||
12 | #include <linux/pm.h> | ||
13 | |||
14 | void machine_halt(void) | ||
15 | { | ||
16 | /* Halt the processor */ | ||
17 | __asm__ __volatile__("flag 1\n"); | ||
18 | } | ||
19 | |||
20 | void machine_restart(char *__unused) | ||
21 | { | ||
22 | /* Soft reset : jump to reset vector */ | ||
23 | pr_info("Put your restart handler here\n"); | ||
24 | machine_halt(); | ||
25 | } | ||
26 | |||
27 | void machine_power_off(void) | ||
28 | { | ||
29 | /* FIXME :: power off ??? */ | ||
30 | machine_halt(); | ||
31 | } | ||
32 | |||
33 | void (*pm_power_off) (void) = NULL; | ||
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c new file mode 100644 index 000000000000..82ac20603398 --- /dev/null +++ b/arch/arc/kernel/setup.c | |||
@@ -0,0 +1,166 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #include <linux/seq_file.h> | ||
10 | #include <linux/fs.h> | ||
11 | #include <linux/delay.h> | ||
12 | #include <linux/root_dev.h> | ||
13 | #include <linux/console.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/cpu.h> | ||
16 | #include <asm/arcregs.h> | ||
17 | #include <asm/tlb.h> | ||
18 | #include <asm/cache.h> | ||
19 | #include <asm/setup.h> | ||
20 | #include <asm/page.h> | ||
21 | #include <asm/irq.h> | ||
22 | #include <asm/arcregs.h> | ||
23 | |||
24 | #define FIX_PTR(x) __asm__ __volatile__(";" : "+r"(x)) | ||
25 | |||
26 | int running_on_hw = 1; /* vs. on ISS */ | ||
27 | |||
28 | char __initdata command_line[COMMAND_LINE_SIZE]; | ||
29 | |||
30 | struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ | ||
31 | |||
32 | struct cpuinfo_arc cpuinfo_arc700[NR_CPUS]; | ||
33 | |||
34 | void __init read_arc_build_cfg_regs(void) | ||
35 | { | ||
36 | read_decode_mmu_bcr(); | ||
37 | read_decode_cache_bcr(); | ||
38 | } | ||
39 | |||
40 | /* | ||
41 | * Initialize and setup the processor core | ||
42 | * This is called by all the CPUs thus should not do special case stuff | ||
43 | * such as only for boot CPU etc | ||
44 | */ | ||
45 | |||
46 | void __init setup_processor(void) | ||
47 | { | ||
48 | read_arc_build_cfg_regs(); | ||
49 | arc_init_IRQ(); | ||
50 | arc_mmu_init(); | ||
51 | arc_cache_init(); | ||
52 | } | ||
53 | |||
54 | void __init __attribute__((weak)) arc_platform_early_init(void) | ||
55 | { | ||
56 | } | ||
57 | |||
58 | void __init setup_arch(char **cmdline_p) | ||
59 | { | ||
60 | #ifdef CONFIG_CMDLINE_UBOOT | ||
61 | /* Make sure that a whitespace is inserted before */ | ||
62 | strlcat(command_line, " ", sizeof(command_line)); | ||
63 | #endif | ||
64 | /* | ||
65 | * Append .config cmdline to base command line, which might already | ||
66 | * contain u-boot "bootargs" (handled by head.S, if so configured) | ||
67 | */ | ||
68 | strlcat(command_line, CONFIG_CMDLINE, sizeof(command_line)); | ||
69 | |||
70 | /* Save unparsed command line copy for /proc/cmdline */ | ||
71 | strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); | ||
72 | *cmdline_p = command_line; | ||
73 | |||
74 | /* To force early parsing of things like mem=xxx */ | ||
75 | parse_early_param(); | ||
76 | |||
77 | /* Platform/board specific: e.g. early console registration */ | ||
78 | arc_platform_early_init(); | ||
79 | |||
80 | setup_processor(); | ||
81 | |||
82 | setup_arch_memory(); | ||
83 | |||
84 | /* Can be issue if someone passes cmd line arg "ro" | ||
85 | * But that is unlikely so keeping it as it is | ||
86 | */ | ||
87 | root_mountflags &= ~MS_RDONLY; | ||
88 | |||
89 | console_verbose(); | ||
90 | |||
91 | #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE) | ||
92 | conswitchp = &dummy_con; | ||
93 | #endif | ||
94 | |||
95 | } | ||
96 | |||
97 | /* | ||
98 | * Get CPU information for use by the procfs. | ||
99 | */ | ||
100 | |||
101 | #define cpu_to_ptr(c) ((void *)(0xFFFF0000 | (unsigned int)(c))) | ||
102 | #define ptr_to_cpu(p) (~0xFFFF0000UL & (unsigned int)(p)) | ||
103 | |||
104 | static int show_cpuinfo(struct seq_file *m, void *v) | ||
105 | { | ||
106 | char *str; | ||
107 | int cpu_id = ptr_to_cpu(v); | ||
108 | |||
109 | str = (char *)__get_free_page(GFP_TEMPORARY); | ||
110 | if (!str) | ||
111 | goto done; | ||
112 | |||
113 | seq_printf(m, "ARC700 #%d\n", cpu_id); | ||
114 | |||
115 | seq_printf(m, "Bogo MIPS : \t%lu.%02lu\n", | ||
116 | loops_per_jiffy / (500000 / HZ), | ||
117 | (loops_per_jiffy / (5000 / HZ)) % 100); | ||
118 | |||
119 | free_page((unsigned long)str); | ||
120 | done: | ||
121 | seq_printf(m, "\n\n"); | ||
122 | |||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | static void *c_start(struct seq_file *m, loff_t *pos) | ||
127 | { | ||
128 | /* | ||
129 | * Callback returns cpu-id to iterator for show routine, NULL to stop. | ||
130 | * However since NULL is also a valid cpu-id (0), we use a round-about | ||
131 | * way to pass it w/o having to kmalloc/free a 2 byte string. | ||
132 | * Encode cpu-id as 0xFFcccc, which is decoded by show routine. | ||
133 | */ | ||
134 | return *pos < num_possible_cpus() ? cpu_to_ptr(*pos) : NULL; | ||
135 | } | ||
136 | |||
137 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | ||
138 | { | ||
139 | ++*pos; | ||
140 | return c_start(m, pos); | ||
141 | } | ||
142 | |||
143 | static void c_stop(struct seq_file *m, void *v) | ||
144 | { | ||
145 | } | ||
146 | |||
147 | const struct seq_operations cpuinfo_op = { | ||
148 | .start = c_start, | ||
149 | .next = c_next, | ||
150 | .stop = c_stop, | ||
151 | .show = show_cpuinfo | ||
152 | }; | ||
153 | |||
154 | static DEFINE_PER_CPU(struct cpu, cpu_topology); | ||
155 | |||
156 | static int __init topology_init(void) | ||
157 | { | ||
158 | int cpu; | ||
159 | |||
160 | for_each_present_cpu(cpu) | ||
161 | register_cpu(&per_cpu(cpu_topology, cpu), cpu); | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | subsys_initcall(topology_init); | ||
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c new file mode 100644 index 000000000000..63da3478521f --- /dev/null +++ b/arch/arc/mm/init.c | |||
@@ -0,0 +1,171 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/mm.h> | ||
11 | #include <linux/bootmem.h> | ||
12 | #include <linux/memblock.h> | ||
13 | #ifdef CONFIG_BLOCK_DEV_RAM | ||
14 | #include <linux/blk.h> | ||
15 | #endif | ||
16 | #include <linux/swap.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <asm/page.h> | ||
19 | #include <asm/pgalloc.h> | ||
20 | #include <asm/sections.h> | ||
21 | #include <asm/arcregs.h> | ||
22 | |||
23 | pgd_t swapper_pg_dir[PTRS_PER_PGD] __aligned(PAGE_SIZE); | ||
24 | char empty_zero_page[PAGE_SIZE] __aligned(PAGE_SIZE); | ||
25 | EXPORT_SYMBOL(empty_zero_page); | ||
26 | |||
27 | /* Default tot mem from .config */ | ||
28 | static unsigned long arc_mem_sz = CONFIG_ARC_PLAT_SDRAM_SIZE; | ||
29 | |||
30 | /* User can over-ride above with "mem=nnn[KkMm]" in cmdline */ | ||
31 | static int __init setup_mem_sz(char *str) | ||
32 | { | ||
33 | arc_mem_sz = memparse(str, NULL) & PAGE_MASK; | ||
34 | |||
35 | /* early console might not be setup yet - it will show up later */ | ||
36 | pr_info("\"mem=%s\": mem sz set to %ldM\n", str, TO_MB(arc_mem_sz)); | ||
37 | |||
38 | return 0; | ||
39 | } | ||
40 | early_param("mem", setup_mem_sz); | ||
41 | |||
42 | /* | ||
43 | * First memory setup routine called from setup_arch() | ||
44 | * 1. setup swapper's mm @init_mm | ||
45 | * 2. Count the pages we have and setup bootmem allocator | ||
46 | * 3. zone setup | ||
47 | */ | ||
48 | void __init setup_arch_memory(void) | ||
49 | { | ||
50 | unsigned long zones_size[MAX_NR_ZONES] = { 0, 0 }; | ||
51 | unsigned long end_mem = CONFIG_LINUX_LINK_BASE + arc_mem_sz; | ||
52 | |||
53 | init_mm.start_code = (unsigned long)_text; | ||
54 | init_mm.end_code = (unsigned long)_etext; | ||
55 | init_mm.end_data = (unsigned long)_edata; | ||
56 | init_mm.brk = (unsigned long)_end; | ||
57 | |||
58 | /* | ||
59 | * We do it here, so that memory is correctly instantiated | ||
60 | * even if "mem=xxx" cmline over-ride is not given | ||
61 | */ | ||
62 | memblock_add(CONFIG_LINUX_LINK_BASE, arc_mem_sz); | ||
63 | |||
64 | /*------------- externs in mm need setting up ---------------*/ | ||
65 | |||
66 | /* first page of system - kernel .vector starts here */ | ||
67 | min_low_pfn = PFN_DOWN(CONFIG_LINUX_LINK_BASE); | ||
68 | |||
69 | /* Last usable page of low mem (no HIGHMEM yet for ARC port) */ | ||
70 | max_low_pfn = max_pfn = PFN_DOWN(end_mem); | ||
71 | |||
72 | max_mapnr = num_physpages = max_low_pfn - min_low_pfn; | ||
73 | |||
74 | /*------------- reserve kernel image -----------------------*/ | ||
75 | memblock_reserve(CONFIG_LINUX_LINK_BASE, | ||
76 | __pa(_end) - CONFIG_LINUX_LINK_BASE); | ||
77 | |||
78 | memblock_dump_all(); | ||
79 | |||
80 | /*-------------- node setup --------------------------------*/ | ||
81 | memset(zones_size, 0, sizeof(zones_size)); | ||
82 | zones_size[ZONE_NORMAL] = num_physpages; | ||
83 | |||
84 | /* | ||
85 | * We can't use the helper free_area_init(zones[]) because it uses | ||
86 | * PAGE_OFFSET to compute the @min_low_pfn which would be wrong | ||
87 | * when our kernel doesn't start at PAGE_OFFSET, i.e. | ||
88 | * PAGE_OFFSET != CONFIG_LINUX_LINK_BASE | ||
89 | */ | ||
90 | free_area_init_node(0, /* node-id */ | ||
91 | zones_size, /* num pages per zone */ | ||
92 | min_low_pfn, /* first pfn of node */ | ||
93 | NULL); /* NO holes */ | ||
94 | } | ||
95 | |||
96 | /* | ||
97 | * mem_init - initializes memory | ||
98 | * | ||
99 | * Frees up bootmem | ||
100 | * Calculates and displays memory available/used | ||
101 | */ | ||
102 | void __init mem_init(void) | ||
103 | { | ||
104 | int codesize, datasize, initsize, reserved_pages, free_pages; | ||
105 | int tmp; | ||
106 | |||
107 | high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz); | ||
108 | |||
109 | totalram_pages = free_all_bootmem(); | ||
110 | |||
111 | /* count all reserved pages [kernel code/data/mem_map..] */ | ||
112 | reserved_pages = 0; | ||
113 | for (tmp = 0; tmp < max_mapnr; tmp++) | ||
114 | if (PageReserved(mem_map + tmp)) | ||
115 | reserved_pages++; | ||
116 | |||
117 | /* XXX: nr_free_pages() is equivalent */ | ||
118 | free_pages = max_mapnr - reserved_pages; | ||
119 | |||
120 | /* | ||
121 | * For the purpose of display below, split the "reserve mem" | ||
122 | * kernel code/data is already shown explicitly, | ||
123 | * Show any other reservations (mem_map[ ] et al) | ||
124 | */ | ||
125 | reserved_pages -= (((unsigned int)_end - CONFIG_LINUX_LINK_BASE) >> | ||
126 | PAGE_SHIFT); | ||
127 | |||
128 | codesize = _etext - _text; | ||
129 | datasize = _end - _etext; | ||
130 | initsize = __init_end - __init_begin; | ||
131 | |||
132 | pr_info("Memory Available: %dM / %ldM (%dK code, %dK data, %dK init, %dK reserv)\n", | ||
133 | PAGES_TO_MB(free_pages), | ||
134 | TO_MB(arc_mem_sz), | ||
135 | TO_KB(codesize), TO_KB(datasize), TO_KB(initsize), | ||
136 | PAGES_TO_KB(reserved_pages)); | ||
137 | } | ||
138 | |||
139 | static void __init free_init_pages(const char *what, unsigned long begin, | ||
140 | unsigned long end) | ||
141 | { | ||
142 | unsigned long addr; | ||
143 | |||
144 | pr_info("Freeing %s: %ldk [%lx] to [%lx]\n", | ||
145 | what, TO_KB(end - begin), begin, end); | ||
146 | |||
147 | /* need to check that the page we free is not a partial page */ | ||
148 | for (addr = begin; addr + PAGE_SIZE <= end; addr += PAGE_SIZE) { | ||
149 | ClearPageReserved(virt_to_page(addr)); | ||
150 | init_page_count(virt_to_page(addr)); | ||
151 | free_page(addr); | ||
152 | totalram_pages++; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | /* | ||
157 | * free_initmem: Free all the __init memory. | ||
158 | */ | ||
159 | void __init_refok free_initmem(void) | ||
160 | { | ||
161 | free_init_pages("unused kernel memory", | ||
162 | (unsigned long)__init_begin, | ||
163 | (unsigned long)__init_end); | ||
164 | } | ||
165 | |||
166 | #ifdef CONFIG_BLK_DEV_INITRD | ||
167 | void __init free_initrd_mem(unsigned long start, unsigned long end) | ||
168 | { | ||
169 | free_init_pages("initrd memory", start, end); | ||
170 | } | ||
171 | #endif | ||
diff --git a/arch/arc/plat-arcfpga/platform.c b/arch/arc/plat-arcfpga/platform.c new file mode 100644 index 000000000000..7b5dcab5becb --- /dev/null +++ b/arch/arc/plat-arcfpga/platform.c | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * ARC FPGA Platform support code | ||
3 | * | ||
4 | * Copyright (C) 2012 Synopsys, Inc. (www.synopsys.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/types.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | |||
15 | /* | ||
16 | * Early Platform Initialization called from setup_arch() | ||
17 | */ | ||
18 | void __init arc_platform_early_init(void) | ||
19 | { | ||
20 | pr_info("[plat-arcfpga]: registering early dev resources\n"); | ||
21 | } | ||
22 | |||
23 | int __init fpga_plat_init(void) | ||
24 | { | ||
25 | pr_info("[plat-arcfpga]: registering device resources\n"); | ||
26 | |||
27 | return 0; | ||
28 | } | ||
29 | arch_initcall(fpga_plat_init); | ||