dm snapshot: avoid storing private suspended state
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / score / kernel / setup.c
blob6f898c0578781cf0862863d6e23a931c60b12c17
1 /*
2 * arch/score/kernel/setup.c
4 * Score Processor version.
6 * Copyright (C) 2009 Sunplus Core Technology Co., Ltd.
7 * Chen Liqin <liqin.chen@sunplusct.com>
8 * Lennox Wu <lennox.wu@sunplusct.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see the file COPYING, or write
22 * to the Free Software Foundation, Inc.,
23 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #include <linux/bootmem.h>
27 #include <linux/initrd.h>
28 #include <linux/ioport.h>
29 #include <linux/mm.h>
30 #include <linux/seq_file.h>
31 #include <linux/screen_info.h>
33 #include <asm-generic/sections.h>
34 #include <asm/setup.h>
36 struct screen_info screen_info;
37 unsigned long kernelsp;
39 static char command_line[COMMAND_LINE_SIZE];
40 static struct resource code_resource = { .name = "Kernel code",};
41 static struct resource data_resource = { .name = "Kernel data",};
43 static void __init bootmem_init(void)
45 unsigned long start_pfn, bootmap_size;
46 unsigned long size = initrd_end - initrd_start;
48 start_pfn = PFN_UP(__pa(&_end));
50 min_low_pfn = PFN_UP(MEMORY_START);
51 max_low_pfn = PFN_UP(MEMORY_START + MEMORY_SIZE);
52 max_mapnr = max_low_pfn - min_low_pfn;
54 /* Initialize the boot-time allocator with low memory only. */
55 bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
56 min_low_pfn, max_low_pfn);
57 add_active_range(0, min_low_pfn, max_low_pfn);
59 free_bootmem(PFN_PHYS(start_pfn),
60 (max_low_pfn - start_pfn) << PAGE_SHIFT);
61 memory_present(0, start_pfn, max_low_pfn);
63 /* Reserve space for the bootmem bitmap. */
64 reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT);
66 if (size == 0) {
67 printk(KERN_INFO "Initrd not found or empty");
68 goto disable;
71 if (__pa(initrd_end) > PFN_PHYS(max_low_pfn)) {
72 printk(KERN_ERR "Initrd extends beyond end of memory");
73 goto disable;
76 /* Reserve space for the initrd bitmap. */
77 reserve_bootmem(__pa(initrd_start), size, BOOTMEM_DEFAULT);
78 initrd_below_start_ok = 1;
80 pr_info("Initial ramdisk at: 0x%lx (%lu bytes)\n",
81 initrd_start, size);
82 return;
83 disable:
84 printk(KERN_CONT " - disabling initrd\n");
85 initrd_start = 0;
86 initrd_end = 0;
89 static void __init resource_init(void)
91 struct resource *res;
93 code_resource.start = __pa(&_text);
94 code_resource.end = __pa(&_etext) - 1;
95 data_resource.start = __pa(&_etext);
96 data_resource.end = __pa(&_edata) - 1;
98 res = alloc_bootmem(sizeof(struct resource));
99 res->name = "System RAM";
100 res->start = MEMORY_START;
101 res->end = MEMORY_START + MEMORY_SIZE - 1;
102 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
103 request_resource(&iomem_resource, res);
105 request_resource(res, &code_resource);
106 request_resource(res, &data_resource);
109 void __init setup_arch(char **cmdline_p)
111 randomize_va_space = 0;
112 *cmdline_p = command_line;
114 cpu_cache_init();
115 tlb_init();
116 bootmem_init();
117 paging_init();
118 resource_init();
121 static int show_cpuinfo(struct seq_file *m, void *v)
123 unsigned long n = (unsigned long) v - 1;
125 seq_printf(m, "processor\t\t: %ld\n", n);
126 seq_printf(m, "\n");
128 return 0;
131 static void *c_start(struct seq_file *m, loff_t *pos)
133 unsigned long i = *pos;
135 return i < 1 ? (void *) (i + 1) : NULL;
138 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
140 ++*pos;
141 return c_start(m, pos);
144 static void c_stop(struct seq_file *m, void *v)
148 const struct seq_operations cpuinfo_op = {
149 .start = c_start,
150 .next = c_next,
151 .stop = c_stop,
152 .show = show_cpuinfo,
155 static int __init topology_init(void)
157 return 0;
160 subsys_initcall(topology_init);