ia64/linux-2.6.18-xen.hg

view arch/m68k/kernel/setup.c @ 452:c7ed6fe5dca0

kexec: dont initialise regions in reserve_memory()

There is no need to initialise efi_memmap_res and boot_param_res in
reserve_memory() for the initial xen domain as it is done in
machine_kexec_setup_resources() using values from the kexec hypercall.

Signed-off-by: Simon Horman <horms@verge.net.au>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 28 10:55:18 2008 +0000 (2008-02-28)
parents 831230e53067
children
line source
1 /*
2 * linux/arch/m68k/kernel/setup.c
3 *
4 * Copyright (C) 1995 Hamish Macdonald
5 */
7 /*
8 * This file handles the architecture-dependent parts of system setup
9 */
11 #include <linux/kernel.h>
12 #include <linux/mm.h>
13 #include <linux/sched.h>
14 #include <linux/delay.h>
15 #include <linux/interrupt.h>
16 #include <linux/fs.h>
17 #include <linux/console.h>
18 #include <linux/genhd.h>
19 #include <linux/errno.h>
20 #include <linux/string.h>
21 #include <linux/init.h>
22 #include <linux/bootmem.h>
23 #include <linux/seq_file.h>
24 #include <linux/module.h>
25 #include <linux/initrd.h>
27 #include <asm/bootinfo.h>
28 #include <asm/setup.h>
29 #include <asm/irq.h>
30 #include <asm/io.h>
31 #include <asm/machdep.h>
32 #ifdef CONFIG_AMIGA
33 #include <asm/amigahw.h>
34 #endif
35 #ifdef CONFIG_ATARI
36 #include <asm/atarihw.h>
37 #include <asm/atari_stram.h>
38 #endif
39 #ifdef CONFIG_SUN3X
40 #include <asm/dvma.h>
41 #endif
43 unsigned long m68k_machtype;
44 unsigned long m68k_cputype;
45 unsigned long m68k_fputype;
46 unsigned long m68k_mmutype;
47 #ifdef CONFIG_VME
48 unsigned long vme_brdtype;
49 #endif
51 int m68k_is040or060;
53 extern int end;
54 extern unsigned long availmem;
56 int m68k_num_memory;
57 int m68k_realnum_memory;
58 unsigned long m68k_memoffset;
59 struct mem_info m68k_memory[NUM_MEMINFO];
61 static struct mem_info m68k_ramdisk;
63 static char m68k_command_line[CL_SIZE];
65 char m68k_debug_device[6] = "";
67 void (*mach_sched_init) (irqreturn_t (*handler)(int, void *, struct pt_regs *)) __initdata = NULL;
68 /* machine dependent irq functions */
69 void (*mach_init_IRQ) (void) __initdata = NULL;
70 void (*mach_get_model) (char *model);
71 int (*mach_get_hardware_list) (char *buffer);
72 /* machine dependent timer functions */
73 unsigned long (*mach_gettimeoffset) (void);
74 int (*mach_hwclk) (int, struct rtc_time*);
75 int (*mach_set_clock_mmss) (unsigned long);
76 unsigned int (*mach_get_ss)(void);
77 int (*mach_get_rtc_pll)(struct rtc_pll_info *);
78 int (*mach_set_rtc_pll)(struct rtc_pll_info *);
79 void (*mach_reset)( void );
80 void (*mach_halt)( void );
81 void (*mach_power_off)( void );
82 long mach_max_dma_address = 0x00ffffff; /* default set to the lower 16MB */
83 #ifdef CONFIG_HEARTBEAT
84 void (*mach_heartbeat) (int);
85 EXPORT_SYMBOL(mach_heartbeat);
86 #endif
87 #ifdef CONFIG_M68K_L2_CACHE
88 void (*mach_l2_flush) (int);
89 #endif
90 #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
91 void (*mach_beep)(unsigned int, unsigned int);
92 #endif
93 #if defined(CONFIG_ISA) && defined(MULTI_ISA)
94 int isa_type;
95 int isa_sex;
96 EXPORT_SYMBOL(isa_type);
97 EXPORT_SYMBOL(isa_sex);
98 #endif
100 extern int amiga_parse_bootinfo(const struct bi_record *);
101 extern int atari_parse_bootinfo(const struct bi_record *);
102 extern int mac_parse_bootinfo(const struct bi_record *);
103 extern int q40_parse_bootinfo(const struct bi_record *);
104 extern int bvme6000_parse_bootinfo(const struct bi_record *);
105 extern int mvme16x_parse_bootinfo(const struct bi_record *);
106 extern int mvme147_parse_bootinfo(const struct bi_record *);
107 extern int hp300_parse_bootinfo(const struct bi_record *);
109 extern void config_amiga(void);
110 extern void config_atari(void);
111 extern void config_mac(void);
112 extern void config_sun3(void);
113 extern void config_apollo(void);
114 extern void config_mvme147(void);
115 extern void config_mvme16x(void);
116 extern void config_bvme6000(void);
117 extern void config_hp300(void);
118 extern void config_q40(void);
119 extern void config_sun3x(void);
121 extern void mac_debugging_short (int, short);
122 extern void mac_debugging_long (int, long);
124 #define MASK_256K 0xfffc0000
126 extern void paging_init(void);
128 static void __init m68k_parse_bootinfo(const struct bi_record *record)
129 {
130 while (record->tag != BI_LAST) {
131 int unknown = 0;
132 const unsigned long *data = record->data;
133 switch (record->tag) {
134 case BI_MACHTYPE:
135 case BI_CPUTYPE:
136 case BI_FPUTYPE:
137 case BI_MMUTYPE:
138 /* Already set up by head.S */
139 break;
141 case BI_MEMCHUNK:
142 if (m68k_num_memory < NUM_MEMINFO) {
143 m68k_memory[m68k_num_memory].addr = data[0];
144 m68k_memory[m68k_num_memory].size = data[1];
145 m68k_num_memory++;
146 } else
147 printk("m68k_parse_bootinfo: too many memory chunks\n");
148 break;
150 case BI_RAMDISK:
151 m68k_ramdisk.addr = data[0];
152 m68k_ramdisk.size = data[1];
153 break;
155 case BI_COMMAND_LINE:
156 strlcpy(m68k_command_line, (const char *)data, sizeof(m68k_command_line));
157 break;
159 default:
160 if (MACH_IS_AMIGA)
161 unknown = amiga_parse_bootinfo(record);
162 else if (MACH_IS_ATARI)
163 unknown = atari_parse_bootinfo(record);
164 else if (MACH_IS_MAC)
165 unknown = mac_parse_bootinfo(record);
166 else if (MACH_IS_Q40)
167 unknown = q40_parse_bootinfo(record);
168 else if (MACH_IS_BVME6000)
169 unknown = bvme6000_parse_bootinfo(record);
170 else if (MACH_IS_MVME16x)
171 unknown = mvme16x_parse_bootinfo(record);
172 else if (MACH_IS_MVME147)
173 unknown = mvme147_parse_bootinfo(record);
174 else if (MACH_IS_HP300)
175 unknown = hp300_parse_bootinfo(record);
176 else
177 unknown = 1;
178 }
179 if (unknown)
180 printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
181 record->tag);
182 record = (struct bi_record *)((unsigned long)record+record->size);
183 }
185 m68k_realnum_memory = m68k_num_memory;
186 #ifdef CONFIG_SINGLE_MEMORY_CHUNK
187 if (m68k_num_memory > 1) {
188 printk("Ignoring last %i chunks of physical memory\n",
189 (m68k_num_memory - 1));
190 m68k_num_memory = 1;
191 }
192 m68k_memoffset = m68k_memory[0].addr-PAGE_OFFSET;
193 #endif
194 }
196 void __init setup_arch(char **cmdline_p)
197 {
198 extern int _etext, _edata, _end;
199 #ifndef CONFIG_SUN3
200 unsigned long endmem, startmem;
201 #endif
202 int i;
203 char *p, *q;
205 /* The bootinfo is located right after the kernel bss */
206 m68k_parse_bootinfo((const struct bi_record *)&_end);
208 if (CPU_IS_040)
209 m68k_is040or060 = 4;
210 else if (CPU_IS_060)
211 m68k_is040or060 = 6;
213 /* FIXME: m68k_fputype is passed in by Penguin booter, which can
214 * be confused by software FPU emulation. BEWARE.
215 * We should really do our own FPU check at startup.
216 * [what do we do with buggy 68LC040s? if we have problems
217 * with them, we should add a test to check_bugs() below] */
218 #ifndef CONFIG_M68KFPU_EMU_ONLY
219 /* clear the fpu if we have one */
220 if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) {
221 volatile int zero = 0;
222 asm __volatile__ ("frestore %0" : : "m" (zero));
223 }
224 #endif
226 if (CPU_IS_060) {
227 u32 pcr;
229 asm (".chip 68060; movec %%pcr,%0; .chip 68k"
230 : "=d" (pcr));
231 if (((pcr >> 8) & 0xff) <= 5) {
232 printk("Enabling workaround for errata I14\n");
233 asm (".chip 68060; movec %0,%%pcr; .chip 68k"
234 : : "d" (pcr | 0x20));
235 }
236 }
238 init_mm.start_code = PAGE_OFFSET;
239 init_mm.end_code = (unsigned long) &_etext;
240 init_mm.end_data = (unsigned long) &_edata;
241 init_mm.brk = (unsigned long) &_end;
243 *cmdline_p = m68k_command_line;
244 memcpy(saved_command_line, *cmdline_p, CL_SIZE);
246 /* Parse the command line for arch-specific options.
247 * For the m68k, this is currently only "debug=xxx" to enable printing
248 * certain kernel messages to some machine-specific device.
249 */
250 for( p = *cmdline_p; p && *p; ) {
251 i = 0;
252 if (!strncmp( p, "debug=", 6 )) {
253 strlcpy( m68k_debug_device, p+6, sizeof(m68k_debug_device) );
254 if ((q = strchr( m68k_debug_device, ' ' ))) *q = 0;
255 i = 1;
256 }
257 #ifdef CONFIG_ATARI
258 /* This option must be parsed very early */
259 if (!strncmp( p, "switches=", 9 )) {
260 extern void atari_switches_setup( const char *, int );
261 atari_switches_setup( p+9, (q = strchr( p+9, ' ' )) ?
262 (q - (p+9)) : strlen(p+9) );
263 i = 1;
264 }
265 #endif
267 if (i) {
268 /* option processed, delete it */
269 if ((q = strchr( p, ' ' )))
270 strcpy( p, q+1 );
271 else
272 *p = 0;
273 } else {
274 if ((p = strchr( p, ' ' ))) ++p;
275 }
276 }
278 #ifdef CONFIG_DUMMY_CONSOLE
279 conswitchp = &dummy_con;
280 #endif
282 switch (m68k_machtype) {
283 #ifdef CONFIG_AMIGA
284 case MACH_AMIGA:
285 config_amiga();
286 break;
287 #endif
288 #ifdef CONFIG_ATARI
289 case MACH_ATARI:
290 config_atari();
291 break;
292 #endif
293 #ifdef CONFIG_MAC
294 case MACH_MAC:
295 config_mac();
296 break;
297 #endif
298 #ifdef CONFIG_SUN3
299 case MACH_SUN3:
300 config_sun3();
301 break;
302 #endif
303 #ifdef CONFIG_APOLLO
304 case MACH_APOLLO:
305 config_apollo();
306 break;
307 #endif
308 #ifdef CONFIG_MVME147
309 case MACH_MVME147:
310 config_mvme147();
311 break;
312 #endif
313 #ifdef CONFIG_MVME16x
314 case MACH_MVME16x:
315 config_mvme16x();
316 break;
317 #endif
318 #ifdef CONFIG_BVME6000
319 case MACH_BVME6000:
320 config_bvme6000();
321 break;
322 #endif
323 #ifdef CONFIG_HP300
324 case MACH_HP300:
325 config_hp300();
326 break;
327 #endif
328 #ifdef CONFIG_Q40
329 case MACH_Q40:
330 config_q40();
331 break;
332 #endif
333 #ifdef CONFIG_SUN3X
334 case MACH_SUN3X:
335 config_sun3x();
336 break;
337 #endif
338 default:
339 panic ("No configuration setup");
340 }
342 #ifndef CONFIG_SUN3
343 startmem= m68k_memory[0].addr;
344 endmem = startmem + m68k_memory[0].size;
345 high_memory = (void *)PAGE_OFFSET;
346 for (i = 0; i < m68k_num_memory; i++) {
347 m68k_memory[i].size &= MASK_256K;
348 if (m68k_memory[i].addr < startmem)
349 startmem = m68k_memory[i].addr;
350 if (m68k_memory[i].addr+m68k_memory[i].size > endmem)
351 endmem = m68k_memory[i].addr+m68k_memory[i].size;
352 high_memory += m68k_memory[i].size;
353 }
355 availmem += init_bootmem_node(NODE_DATA(0), availmem >> PAGE_SHIFT,
356 startmem >> PAGE_SHIFT, endmem >> PAGE_SHIFT);
358 for (i = 0; i < m68k_num_memory; i++)
359 free_bootmem(m68k_memory[i].addr, m68k_memory[i].size);
361 reserve_bootmem(m68k_memory[0].addr, availmem - m68k_memory[0].addr);
363 #ifdef CONFIG_BLK_DEV_INITRD
364 if (m68k_ramdisk.size) {
365 reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size);
366 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
367 initrd_end = initrd_start + m68k_ramdisk.size;
368 printk ("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
369 }
370 #endif
372 #ifdef CONFIG_ATARI
373 if (MACH_IS_ATARI)
374 atari_stram_reserve_pages((void *)availmem);
375 #endif
376 #ifdef CONFIG_SUN3X
377 if (MACH_IS_SUN3X) {
378 dvma_init();
379 }
380 #endif
382 #endif /* !CONFIG_SUN3 */
384 paging_init();
386 /* set ISA defs early as possible */
387 #if defined(CONFIG_ISA) && defined(MULTI_ISA)
388 #if defined(CONFIG_Q40)
389 if (MACH_IS_Q40) {
390 isa_type = Q40_ISA;
391 isa_sex = 0;
392 }
393 #elif defined(CONFIG_GG2)
394 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(GG2_ISA)){
395 isa_type = GG2_ISA;
396 isa_sex = 0;
397 }
398 #elif defined(CONFIG_AMIGA_PCMCIA)
399 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)){
400 isa_type = AG_ISA;
401 isa_sex = 1;
402 }
403 #endif
404 #endif
405 }
407 static int show_cpuinfo(struct seq_file *m, void *v)
408 {
409 const char *cpu, *mmu, *fpu;
410 unsigned long clockfreq, clockfactor;
412 #define LOOP_CYCLES_68020 (8)
413 #define LOOP_CYCLES_68030 (8)
414 #define LOOP_CYCLES_68040 (3)
415 #define LOOP_CYCLES_68060 (1)
417 if (CPU_IS_020) {
418 cpu = "68020";
419 clockfactor = LOOP_CYCLES_68020;
420 } else if (CPU_IS_030) {
421 cpu = "68030";
422 clockfactor = LOOP_CYCLES_68030;
423 } else if (CPU_IS_040) {
424 cpu = "68040";
425 clockfactor = LOOP_CYCLES_68040;
426 } else if (CPU_IS_060) {
427 cpu = "68060";
428 clockfactor = LOOP_CYCLES_68060;
429 } else {
430 cpu = "680x0";
431 clockfactor = 0;
432 }
434 #ifdef CONFIG_M68KFPU_EMU_ONLY
435 fpu="none(soft float)";
436 #else
437 if (m68k_fputype & FPU_68881)
438 fpu = "68881";
439 else if (m68k_fputype & FPU_68882)
440 fpu = "68882";
441 else if (m68k_fputype & FPU_68040)
442 fpu = "68040";
443 else if (m68k_fputype & FPU_68060)
444 fpu = "68060";
445 else if (m68k_fputype & FPU_SUNFPA)
446 fpu = "Sun FPA";
447 else
448 fpu = "none";
449 #endif
451 if (m68k_mmutype & MMU_68851)
452 mmu = "68851";
453 else if (m68k_mmutype & MMU_68030)
454 mmu = "68030";
455 else if (m68k_mmutype & MMU_68040)
456 mmu = "68040";
457 else if (m68k_mmutype & MMU_68060)
458 mmu = "68060";
459 else if (m68k_mmutype & MMU_SUN3)
460 mmu = "Sun-3";
461 else if (m68k_mmutype & MMU_APOLLO)
462 mmu = "Apollo";
463 else
464 mmu = "unknown";
466 clockfreq = loops_per_jiffy*HZ*clockfactor;
468 seq_printf(m, "CPU:\t\t%s\n"
469 "MMU:\t\t%s\n"
470 "FPU:\t\t%s\n"
471 "Clocking:\t%lu.%1luMHz\n"
472 "BogoMips:\t%lu.%02lu\n"
473 "Calibration:\t%lu loops\n",
474 cpu, mmu, fpu,
475 clockfreq/1000000,(clockfreq/100000)%10,
476 loops_per_jiffy/(500000/HZ),(loops_per_jiffy/(5000/HZ))%100,
477 loops_per_jiffy);
478 return 0;
479 }
481 static void *c_start(struct seq_file *m, loff_t *pos)
482 {
483 return *pos < 1 ? (void *)1 : NULL;
484 }
485 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
486 {
487 ++*pos;
488 return NULL;
489 }
490 static void c_stop(struct seq_file *m, void *v)
491 {
492 }
493 struct seq_operations cpuinfo_op = {
494 .start = c_start,
495 .next = c_next,
496 .stop = c_stop,
497 .show = show_cpuinfo,
498 };
500 int get_hardware_list(char *buffer)
501 {
502 int len = 0;
503 char model[80];
504 unsigned long mem;
505 int i;
507 if (mach_get_model)
508 mach_get_model(model);
509 else
510 strcpy(model, "Unknown m68k");
512 len += sprintf(buffer+len, "Model:\t\t%s\n", model);
513 for (mem = 0, i = 0; i < m68k_num_memory; i++)
514 mem += m68k_memory[i].size;
515 len += sprintf(buffer+len, "System Memory:\t%ldK\n", mem>>10);
517 if (mach_get_hardware_list)
518 len += mach_get_hardware_list(buffer+len);
520 return(len);
521 }
523 void check_bugs(void)
524 {
525 #ifndef CONFIG_M68KFPU_EMU
526 if (m68k_fputype == 0) {
527 printk( KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
528 "WHICH IS REQUIRED BY LINUX/M68K ***\n" );
529 printk( KERN_EMERG "Upgrade your hardware or join the FPU "
530 "emulation project\n" );
531 panic( "no FPU" );
532 }
533 #endif /* !CONFIG_M68KFPU_EMU */
534 }