diff options
Diffstat (limited to 'arch/sh/kernel/setup.c')
-rw-r--r-- | arch/sh/kernel/setup.c | 65 |
1 files changed, 47 insertions, 18 deletions
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index de832056bf1b..e7152cc6930e 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c | |||
@@ -26,6 +26,9 @@ | |||
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/debugfs.h> | 27 | #include <linux/debugfs.h> |
28 | #include <linux/crash_dump.h> | 28 | #include <linux/crash_dump.h> |
29 | #include <linux/mmzone.h> | ||
30 | #include <linux/clk.h> | ||
31 | #include <linux/delay.h> | ||
29 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
30 | #include <asm/io.h> | 33 | #include <asm/io.h> |
31 | #include <asm/page.h> | 34 | #include <asm/page.h> |
@@ -144,6 +147,7 @@ static void __init reserve_crashkernel(void) | |||
144 | { | 147 | { |
145 | unsigned long long free_mem; | 148 | unsigned long long free_mem; |
146 | unsigned long long crash_size, crash_base; | 149 | unsigned long long crash_size, crash_base; |
150 | void *vp; | ||
147 | int ret; | 151 | int ret; |
148 | 152 | ||
149 | free_mem = ((unsigned long long)max_low_pfn - min_low_pfn) << PAGE_SHIFT; | 153 | free_mem = ((unsigned long long)max_low_pfn - min_low_pfn) << PAGE_SHIFT; |
@@ -152,12 +156,14 @@ static void __init reserve_crashkernel(void) | |||
152 | &crash_size, &crash_base); | 156 | &crash_size, &crash_base); |
153 | if (ret == 0 && crash_size) { | 157 | if (ret == 0 && crash_size) { |
154 | if (crash_base <= 0) { | 158 | if (crash_base <= 0) { |
155 | printk(KERN_INFO "crashkernel reservation failed - " | 159 | vp = alloc_bootmem_nopanic(crash_size); |
156 | "you have to specify a base address\n"); | 160 | if (!vp) { |
157 | return; | 161 | printk(KERN_INFO "crashkernel allocation " |
158 | } | 162 | "failed\n"); |
159 | 163 | return; | |
160 | if (reserve_bootmem(crash_base, crash_size, | 164 | } |
165 | crash_base = __pa(vp); | ||
166 | } else if (reserve_bootmem(crash_base, crash_size, | ||
161 | BOOTMEM_EXCLUSIVE) < 0) { | 167 | BOOTMEM_EXCLUSIVE) < 0) { |
162 | printk(KERN_INFO "crashkernel reservation failed - " | 168 | printk(KERN_INFO "crashkernel reservation failed - " |
163 | "memory is in use\n"); | 169 | "memory is in use\n"); |
@@ -179,6 +185,24 @@ static inline void __init reserve_crashkernel(void) | |||
179 | {} | 185 | {} |
180 | #endif | 186 | #endif |
181 | 187 | ||
188 | #ifndef CONFIG_GENERIC_CALIBRATE_DELAY | ||
189 | void __cpuinit calibrate_delay(void) | ||
190 | { | ||
191 | struct clk *clk = clk_get(NULL, "cpu_clk"); | ||
192 | |||
193 | if (IS_ERR(clk)) | ||
194 | panic("Need a sane CPU clock definition!"); | ||
195 | |||
196 | loops_per_jiffy = (clk_get_rate(clk) >> 1) / HZ; | ||
197 | |||
198 | printk(KERN_INFO "Calibrating delay loop (skipped)... " | ||
199 | "%lu.%02lu BogoMIPS PRESET (lpj=%lu)\n", | ||
200 | loops_per_jiffy/(500000/HZ), | ||
201 | (loops_per_jiffy/(5000/HZ)) % 100, | ||
202 | loops_per_jiffy); | ||
203 | } | ||
204 | #endif | ||
205 | |||
182 | void __init __add_active_range(unsigned int nid, unsigned long start_pfn, | 206 | void __init __add_active_range(unsigned int nid, unsigned long start_pfn, |
183 | unsigned long end_pfn) | 207 | unsigned long end_pfn) |
184 | { | 208 | { |
@@ -232,15 +256,17 @@ void __init setup_bootmem_allocator(unsigned long free_pfn) | |||
232 | * case of us accidentally initializing the bootmem allocator with | 256 | * case of us accidentally initializing the bootmem allocator with |
233 | * an invalid RAM area. | 257 | * an invalid RAM area. |
234 | */ | 258 | */ |
235 | reserve_bootmem(__MEMORY_START+PAGE_SIZE, | 259 | reserve_bootmem(__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET, |
236 | (PFN_PHYS(free_pfn)+bootmap_size+PAGE_SIZE-1)-__MEMORY_START, | 260 | (PFN_PHYS(free_pfn) + bootmap_size + PAGE_SIZE - 1) - |
237 | BOOTMEM_DEFAULT); | 261 | (__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET), |
262 | BOOTMEM_DEFAULT); | ||
238 | 263 | ||
239 | /* | 264 | /* |
240 | * reserve physical page 0 - it's a special BIOS page on many boxes, | 265 | * reserve physical page 0 - it's a special BIOS page on many boxes, |
241 | * enabling clean reboots, SMP operation, laptop functions. | 266 | * enabling clean reboots, SMP operation, laptop functions. |
242 | */ | 267 | */ |
243 | reserve_bootmem(__MEMORY_START, PAGE_SIZE, BOOTMEM_DEFAULT); | 268 | reserve_bootmem(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET, |
269 | BOOTMEM_DEFAULT); | ||
244 | 270 | ||
245 | sparse_memory_present_with_active_regions(0); | 271 | sparse_memory_present_with_active_regions(0); |
246 | 272 | ||
@@ -248,17 +274,18 @@ void __init setup_bootmem_allocator(unsigned long free_pfn) | |||
248 | ROOT_DEV = Root_RAM0; | 274 | ROOT_DEV = Root_RAM0; |
249 | 275 | ||
250 | if (LOADER_TYPE && INITRD_START) { | 276 | if (LOADER_TYPE && INITRD_START) { |
251 | if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { | 277 | unsigned long initrd_start_phys = INITRD_START + __MEMORY_START; |
252 | reserve_bootmem(INITRD_START + __MEMORY_START, | 278 | |
253 | INITRD_SIZE, BOOTMEM_DEFAULT); | 279 | if (initrd_start_phys + INITRD_SIZE <= PFN_PHYS(max_low_pfn)) { |
254 | initrd_start = INITRD_START + PAGE_OFFSET + | 280 | reserve_bootmem(initrd_start_phys, INITRD_SIZE, |
255 | __MEMORY_START; | 281 | BOOTMEM_DEFAULT); |
282 | initrd_start = (unsigned long)__va(initrd_start_phys); | ||
256 | initrd_end = initrd_start + INITRD_SIZE; | 283 | initrd_end = initrd_start + INITRD_SIZE; |
257 | } else { | 284 | } else { |
258 | printk("initrd extends beyond end of memory " | 285 | printk("initrd extends beyond end of memory " |
259 | "(0x%08lx > 0x%08lx)\ndisabling initrd\n", | 286 | "(0x%08lx > 0x%08lx)\ndisabling initrd\n", |
260 | INITRD_START + INITRD_SIZE, | 287 | initrd_start_phys + INITRD_SIZE, |
261 | max_low_pfn << PAGE_SHIFT); | 288 | (unsigned long)PFN_PHYS(max_low_pfn)); |
262 | initrd_start = 0; | 289 | initrd_start = 0; |
263 | } | 290 | } |
264 | } | 291 | } |
@@ -530,6 +557,8 @@ struct dentry *sh_debugfs_root; | |||
530 | static int __init sh_debugfs_init(void) | 557 | static int __init sh_debugfs_init(void) |
531 | { | 558 | { |
532 | sh_debugfs_root = debugfs_create_dir("sh", NULL); | 559 | sh_debugfs_root = debugfs_create_dir("sh", NULL); |
560 | if (!sh_debugfs_root) | ||
561 | return -ENOMEM; | ||
533 | if (IS_ERR(sh_debugfs_root)) | 562 | if (IS_ERR(sh_debugfs_root)) |
534 | return PTR_ERR(sh_debugfs_root); | 563 | return PTR_ERR(sh_debugfs_root); |
535 | 564 | ||