aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/kernel/setup.c
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2007-05-01 16:32:43 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 20:59:06 -0400
commit6ff5801acbb643e81d3420ac0f37c96089309063 (patch)
tree2406744e75f7cd06e96d8cd62ba82970a0f79922 /arch/m68k/kernel/setup.c
parentb3e2fd9cebcf4e82d0306fe7e796eeca5aac0614 (diff)
m68k: reformat various m68k files
Reformat various m68k files, so they actually look like Linux sources. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/m68k/kernel/setup.c')
-rw-r--r--arch/m68k/kernel/setup.c371
1 files changed, 187 insertions, 184 deletions
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index 42b8fd09ea8f..852cefe7c800 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -133,78 +133,78 @@ extern void config_hp300(void);
133extern void config_q40(void); 133extern void config_q40(void);
134extern void config_sun3x(void); 134extern void config_sun3x(void);
135 135
136extern void mac_debugging_short (int, short);
137extern void mac_debugging_long (int, long);
138
139#define MASK_256K 0xfffc0000 136#define MASK_256K 0xfffc0000
140 137
141extern void paging_init(void); 138extern void paging_init(void);
142 139
143static void __init m68k_parse_bootinfo(const struct bi_record *record) 140static void __init m68k_parse_bootinfo(const struct bi_record *record)
144{ 141{
145 while (record->tag != BI_LAST) { 142 while (record->tag != BI_LAST) {
146 int unknown = 0; 143 int unknown = 0;
147 const unsigned long *data = record->data; 144 const unsigned long *data = record->data;
148 switch (record->tag) { 145
149 case BI_MACHTYPE: 146 switch (record->tag) {
150 case BI_CPUTYPE: 147 case BI_MACHTYPE:
151 case BI_FPUTYPE: 148 case BI_CPUTYPE:
152 case BI_MMUTYPE: 149 case BI_FPUTYPE:
153 /* Already set up by head.S */ 150 case BI_MMUTYPE:
154 break; 151 /* Already set up by head.S */
155 152 break;
156 case BI_MEMCHUNK: 153
157 if (m68k_num_memory < NUM_MEMINFO) { 154 case BI_MEMCHUNK:
158 m68k_memory[m68k_num_memory].addr = data[0]; 155 if (m68k_num_memory < NUM_MEMINFO) {
159 m68k_memory[m68k_num_memory].size = data[1]; 156 m68k_memory[m68k_num_memory].addr = data[0];
160 m68k_num_memory++; 157 m68k_memory[m68k_num_memory].size = data[1];
161 } else 158 m68k_num_memory++;
162 printk("m68k_parse_bootinfo: too many memory chunks\n"); 159 } else
163 break; 160 printk("m68k_parse_bootinfo: too many memory chunks\n");
164 161 break;
165 case BI_RAMDISK: 162
166 m68k_ramdisk.addr = data[0]; 163 case BI_RAMDISK:
167 m68k_ramdisk.size = data[1]; 164 m68k_ramdisk.addr = data[0];
168 break; 165 m68k_ramdisk.size = data[1];
169 166 break;
170 case BI_COMMAND_LINE: 167
171 strlcpy(m68k_command_line, (const char *)data, sizeof(m68k_command_line)); 168 case BI_COMMAND_LINE:
172 break; 169 strlcpy(m68k_command_line, (const char *)data,
173 170 sizeof(m68k_command_line));
174 default: 171 break;
175 if (MACH_IS_AMIGA) 172
176 unknown = amiga_parse_bootinfo(record); 173 default:
177 else if (MACH_IS_ATARI) 174 if (MACH_IS_AMIGA)
178 unknown = atari_parse_bootinfo(record); 175 unknown = amiga_parse_bootinfo(record);
179 else if (MACH_IS_MAC) 176 else if (MACH_IS_ATARI)
180 unknown = mac_parse_bootinfo(record); 177 unknown = atari_parse_bootinfo(record);
181 else if (MACH_IS_Q40) 178 else if (MACH_IS_MAC)
182 unknown = q40_parse_bootinfo(record); 179 unknown = mac_parse_bootinfo(record);
183 else if (MACH_IS_BVME6000) 180 else if (MACH_IS_Q40)
184 unknown = bvme6000_parse_bootinfo(record); 181 unknown = q40_parse_bootinfo(record);
185 else if (MACH_IS_MVME16x) 182 else if (MACH_IS_BVME6000)
186 unknown = mvme16x_parse_bootinfo(record); 183 unknown = bvme6000_parse_bootinfo(record);
187 else if (MACH_IS_MVME147) 184 else if (MACH_IS_MVME16x)
188 unknown = mvme147_parse_bootinfo(record); 185 unknown = mvme16x_parse_bootinfo(record);
189 else if (MACH_IS_HP300) 186 else if (MACH_IS_MVME147)
190 unknown = hp300_parse_bootinfo(record); 187 unknown = mvme147_parse_bootinfo(record);
191 else 188 else if (MACH_IS_HP300)
192 unknown = 1; 189 unknown = hp300_parse_bootinfo(record);
190 else
191 unknown = 1;
192 }
193 if (unknown)
194 printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
195 record->tag);
196 record = (struct bi_record *)((unsigned long)record +
197 record->size);
193 } 198 }
194 if (unknown)
195 printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
196 record->tag);
197 record = (struct bi_record *)((unsigned long)record+record->size);
198 }
199 199
200 m68k_realnum_memory = m68k_num_memory; 200 m68k_realnum_memory = m68k_num_memory;
201#ifdef CONFIG_SINGLE_MEMORY_CHUNK 201#ifdef CONFIG_SINGLE_MEMORY_CHUNK
202 if (m68k_num_memory > 1) { 202 if (m68k_num_memory > 1) {
203 printk("Ignoring last %i chunks of physical memory\n", 203 printk("Ignoring last %i chunks of physical memory\n",
204 (m68k_num_memory - 1)); 204 (m68k_num_memory - 1));
205 m68k_num_memory = 1; 205 m68k_num_memory = 1;
206 } 206 }
207 m68k_memoffset = m68k_memory[0].addr-PAGE_OFFSET; 207 m68k_memoffset = m68k_memory[0].addr-PAGE_OFFSET;
208#endif 208#endif
209} 209}
210 210
@@ -234,7 +234,7 @@ void __init setup_arch(char **cmdline_p)
234 /* clear the fpu if we have one */ 234 /* clear the fpu if we have one */
235 if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) { 235 if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) {
236 volatile int zero = 0; 236 volatile int zero = 0;
237 asm __volatile__ ("frestore %0" : : "m" (zero)); 237 asm volatile ("frestore %0" : : "m" (zero));
238 } 238 }
239#endif 239#endif
240 240
@@ -262,32 +262,35 @@ void __init setup_arch(char **cmdline_p)
262 * For the m68k, this is currently only "debug=xxx" to enable printing 262 * For the m68k, this is currently only "debug=xxx" to enable printing
263 * certain kernel messages to some machine-specific device. 263 * certain kernel messages to some machine-specific device.
264 */ 264 */
265 for( p = *cmdline_p; p && *p; ) { 265 for (p = *cmdline_p; p && *p;) {
266 i = 0; 266 i = 0;
267 if (!strncmp( p, "debug=", 6 )) { 267 if (!strncmp(p, "debug=", 6)) {
268 strlcpy( m68k_debug_device, p+6, sizeof(m68k_debug_device) ); 268 strlcpy(m68k_debug_device, p+6, sizeof(m68k_debug_device));
269 if ((q = strchr( m68k_debug_device, ' ' ))) *q = 0; 269 q = strchr(m68k_debug_device, ' ');
270 i = 1; 270 if (q)
271 } 271 *q = 0;
272 i = 1;
273 }
272#ifdef CONFIG_ATARI 274#ifdef CONFIG_ATARI
273 /* This option must be parsed very early */ 275 /* This option must be parsed very early */
274 if (!strncmp( p, "switches=", 9 )) { 276 if (!strncmp(p, "switches=", 9)) {
275 extern void atari_switches_setup( const char *, int ); 277 extern void atari_switches_setup(const char *, int);
276 atari_switches_setup( p+9, (q = strchr( p+9, ' ' )) ? 278 q = strchr(p + 9, ' ');
277 (q - (p+9)) : strlen(p+9) ); 279 atari_switches_setup(p + 9, q ? (q - (p + 9)) : strlen(p + 9));
278 i = 1; 280 i = 1;
279 } 281 }
280#endif 282#endif
281 283
282 if (i) { 284 if (i) {
283 /* option processed, delete it */ 285 /* option processed, delete it */
284 if ((q = strchr( p, ' ' ))) 286 if ((q = strchr(p, ' ')))
285 strcpy( p, q+1 ); 287 strcpy(p, q + 1);
286 else 288 else
287 *p = 0; 289 *p = 0;
288 } else { 290 } else {
289 if ((p = strchr( p, ' ' ))) ++p; 291 if ((p = strchr(p, ' ')))
290 } 292 ++p;
293 }
291 } 294 }
292 295
293#ifdef CONFIG_DUMMY_CONSOLE 296#ifdef CONFIG_DUMMY_CONSOLE
@@ -296,62 +299,62 @@ void __init setup_arch(char **cmdline_p)
296 299
297 switch (m68k_machtype) { 300 switch (m68k_machtype) {
298#ifdef CONFIG_AMIGA 301#ifdef CONFIG_AMIGA
299 case MACH_AMIGA: 302 case MACH_AMIGA:
300 config_amiga(); 303 config_amiga();
301 break; 304 break;
302#endif 305#endif
303#ifdef CONFIG_ATARI 306#ifdef CONFIG_ATARI
304 case MACH_ATARI: 307 case MACH_ATARI:
305 config_atari(); 308 config_atari();
306 break; 309 break;
307#endif 310#endif
308#ifdef CONFIG_MAC 311#ifdef CONFIG_MAC
309 case MACH_MAC: 312 case MACH_MAC:
310 config_mac(); 313 config_mac();
311 break; 314 break;
312#endif 315#endif
313#ifdef CONFIG_SUN3 316#ifdef CONFIG_SUN3
314 case MACH_SUN3: 317 case MACH_SUN3:
315 config_sun3(); 318 config_sun3();
316 break; 319 break;
317#endif 320#endif
318#ifdef CONFIG_APOLLO 321#ifdef CONFIG_APOLLO
319 case MACH_APOLLO: 322 case MACH_APOLLO:
320 config_apollo(); 323 config_apollo();
321 break; 324 break;
322#endif 325#endif
323#ifdef CONFIG_MVME147 326#ifdef CONFIG_MVME147
324 case MACH_MVME147: 327 case MACH_MVME147:
325 config_mvme147(); 328 config_mvme147();
326 break; 329 break;
327#endif 330#endif
328#ifdef CONFIG_MVME16x 331#ifdef CONFIG_MVME16x
329 case MACH_MVME16x: 332 case MACH_MVME16x:
330 config_mvme16x(); 333 config_mvme16x();
331 break; 334 break;
332#endif 335#endif
333#ifdef CONFIG_BVME6000 336#ifdef CONFIG_BVME6000
334 case MACH_BVME6000: 337 case MACH_BVME6000:
335 config_bvme6000(); 338 config_bvme6000();
336 break; 339 break;
337#endif 340#endif
338#ifdef CONFIG_HP300 341#ifdef CONFIG_HP300
339 case MACH_HP300: 342 case MACH_HP300:
340 config_hp300(); 343 config_hp300();
341 break; 344 break;
342#endif 345#endif
343#ifdef CONFIG_Q40 346#ifdef CONFIG_Q40
344 case MACH_Q40: 347 case MACH_Q40:
345 config_q40(); 348 config_q40();
346 break; 349 break;
347#endif 350#endif
348#ifdef CONFIG_SUN3X 351#ifdef CONFIG_SUN3X
349 case MACH_SUN3X: 352 case MACH_SUN3X:
350 config_sun3x(); 353 config_sun3x();
351 break; 354 break;
352#endif 355#endif
353 default: 356 default:
354 panic ("No configuration setup"); 357 panic("No configuration setup");
355 } 358 }
356 359
357#ifndef CONFIG_SUN3 360#ifndef CONFIG_SUN3
@@ -380,7 +383,7 @@ void __init setup_arch(char **cmdline_p)
380 reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size); 383 reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size);
381 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr); 384 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
382 initrd_end = initrd_start + m68k_ramdisk.size; 385 initrd_end = initrd_start + m68k_ramdisk.size;
383 printk ("initrd: %08lx - %08lx\n", initrd_start, initrd_end); 386 printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
384 } 387 }
385#endif 388#endif
386 389
@@ -402,18 +405,18 @@ void __init setup_arch(char **cmdline_p)
402#if defined(CONFIG_ISA) && defined(MULTI_ISA) 405#if defined(CONFIG_ISA) && defined(MULTI_ISA)
403#if defined(CONFIG_Q40) 406#if defined(CONFIG_Q40)
404 if (MACH_IS_Q40) { 407 if (MACH_IS_Q40) {
405 isa_type = Q40_ISA; 408 isa_type = Q40_ISA;
406 isa_sex = 0; 409 isa_sex = 0;
407 } 410 }
408#elif defined(CONFIG_GG2) 411#elif defined(CONFIG_GG2)
409 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(GG2_ISA)){ 412 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(GG2_ISA)) {
410 isa_type = GG2_ISA; 413 isa_type = GG2_ISA;
411 isa_sex = 0; 414 isa_sex = 0;
412 } 415 }
413#elif defined(CONFIG_AMIGA_PCMCIA) 416#elif defined(CONFIG_AMIGA_PCMCIA)
414 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)){ 417 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)) {
415 isa_type = AG_ISA; 418 isa_type = AG_ISA;
416 isa_sex = 1; 419 isa_sex = 1;
417 } 420 }
418#endif 421#endif
419#endif 422#endif
@@ -421,66 +424,66 @@ void __init setup_arch(char **cmdline_p)
421 424
422static int show_cpuinfo(struct seq_file *m, void *v) 425static int show_cpuinfo(struct seq_file *m, void *v)
423{ 426{
424 const char *cpu, *mmu, *fpu; 427 const char *cpu, *mmu, *fpu;
425 unsigned long clockfreq, clockfactor; 428 unsigned long clockfreq, clockfactor;
426 429
427#define LOOP_CYCLES_68020 (8) 430#define LOOP_CYCLES_68020 (8)
428#define LOOP_CYCLES_68030 (8) 431#define LOOP_CYCLES_68030 (8)
429#define LOOP_CYCLES_68040 (3) 432#define LOOP_CYCLES_68040 (3)
430#define LOOP_CYCLES_68060 (1) 433#define LOOP_CYCLES_68060 (1)
431 434
432 if (CPU_IS_020) { 435 if (CPU_IS_020) {
433 cpu = "68020"; 436 cpu = "68020";
434 clockfactor = LOOP_CYCLES_68020; 437 clockfactor = LOOP_CYCLES_68020;
435 } else if (CPU_IS_030) { 438 } else if (CPU_IS_030) {
436 cpu = "68030"; 439 cpu = "68030";
437 clockfactor = LOOP_CYCLES_68030; 440 clockfactor = LOOP_CYCLES_68030;
438 } else if (CPU_IS_040) { 441 } else if (CPU_IS_040) {
439 cpu = "68040"; 442 cpu = "68040";
440 clockfactor = LOOP_CYCLES_68040; 443 clockfactor = LOOP_CYCLES_68040;
441 } else if (CPU_IS_060) { 444 } else if (CPU_IS_060) {
442 cpu = "68060"; 445 cpu = "68060";
443 clockfactor = LOOP_CYCLES_68060; 446 clockfactor = LOOP_CYCLES_68060;
444 } else { 447 } else {
445 cpu = "680x0"; 448 cpu = "680x0";
446 clockfactor = 0; 449 clockfactor = 0;
447 } 450 }
448 451
449#ifdef CONFIG_M68KFPU_EMU_ONLY 452#ifdef CONFIG_M68KFPU_EMU_ONLY
450 fpu="none(soft float)"; 453 fpu = "none(soft float)";
451#else 454#else
452 if (m68k_fputype & FPU_68881) 455 if (m68k_fputype & FPU_68881)
453 fpu = "68881"; 456 fpu = "68881";
454 else if (m68k_fputype & FPU_68882) 457 else if (m68k_fputype & FPU_68882)
455 fpu = "68882"; 458 fpu = "68882";
456 else if (m68k_fputype & FPU_68040) 459 else if (m68k_fputype & FPU_68040)
457 fpu = "68040"; 460 fpu = "68040";
458 else if (m68k_fputype & FPU_68060) 461 else if (m68k_fputype & FPU_68060)
459 fpu = "68060"; 462 fpu = "68060";
460 else if (m68k_fputype & FPU_SUNFPA) 463 else if (m68k_fputype & FPU_SUNFPA)
461 fpu = "Sun FPA"; 464 fpu = "Sun FPA";
462 else 465 else
463 fpu = "none"; 466 fpu = "none";
464#endif 467#endif
465 468
466 if (m68k_mmutype & MMU_68851) 469 if (m68k_mmutype & MMU_68851)
467 mmu = "68851"; 470 mmu = "68851";
468 else if (m68k_mmutype & MMU_68030) 471 else if (m68k_mmutype & MMU_68030)
469 mmu = "68030"; 472 mmu = "68030";
470 else if (m68k_mmutype & MMU_68040) 473 else if (m68k_mmutype & MMU_68040)
471 mmu = "68040"; 474 mmu = "68040";
472 else if (m68k_mmutype & MMU_68060) 475 else if (m68k_mmutype & MMU_68060)
473 mmu = "68060"; 476 mmu = "68060";
474 else if (m68k_mmutype & MMU_SUN3) 477 else if (m68k_mmutype & MMU_SUN3)
475 mmu = "Sun-3"; 478 mmu = "Sun-3";
476 else if (m68k_mmutype & MMU_APOLLO) 479 else if (m68k_mmutype & MMU_APOLLO)
477 mmu = "Apollo"; 480 mmu = "Apollo";
478 else 481 else
479 mmu = "unknown"; 482 mmu = "unknown";
480 483
481 clockfreq = loops_per_jiffy*HZ*clockfactor; 484 clockfreq = loops_per_jiffy * HZ * clockfactor;
482 485
483 seq_printf(m, "CPU:\t\t%s\n" 486 seq_printf(m, "CPU:\t\t%s\n"
484 "MMU:\t\t%s\n" 487 "MMU:\t\t%s\n"
485 "FPU:\t\t%s\n" 488 "FPU:\t\t%s\n"
486 "Clocking:\t%lu.%1luMHz\n" 489 "Clocking:\t%lu.%1luMHz\n"
@@ -490,7 +493,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
490 clockfreq/1000000,(clockfreq/100000)%10, 493 clockfreq/1000000,(clockfreq/100000)%10,
491 loops_per_jiffy/(500000/HZ),(loops_per_jiffy/(5000/HZ))%100, 494 loops_per_jiffy/(500000/HZ),(loops_per_jiffy/(5000/HZ))%100,
492 loops_per_jiffy); 495 loops_per_jiffy);
493 return 0; 496 return 0;
494} 497}
495 498
496static void *c_start(struct seq_file *m, loff_t *pos) 499static void *c_start(struct seq_file *m, loff_t *pos)
@@ -506,44 +509,44 @@ static void c_stop(struct seq_file *m, void *v)
506{ 509{
507} 510}
508struct seq_operations cpuinfo_op = { 511struct seq_operations cpuinfo_op = {
509 .start = c_start, 512 .start = c_start,
510 .next = c_next, 513 .next = c_next,
511 .stop = c_stop, 514 .stop = c_stop,
512 .show = show_cpuinfo, 515 .show = show_cpuinfo,
513}; 516};
514 517
515int get_hardware_list(char *buffer) 518int get_hardware_list(char *buffer)
516{ 519{
517 int len = 0; 520 int len = 0;
518 char model[80]; 521 char model[80];
519 unsigned long mem; 522 unsigned long mem;
520 int i; 523 int i;
521 524
522 if (mach_get_model) 525 if (mach_get_model)
523 mach_get_model(model); 526 mach_get_model(model);
524 else 527 else
525 strcpy(model, "Unknown m68k"); 528 strcpy(model, "Unknown m68k");
526 529
527 len += sprintf(buffer+len, "Model:\t\t%s\n", model); 530 len += sprintf(buffer + len, "Model:\t\t%s\n", model);
528 for (mem = 0, i = 0; i < m68k_num_memory; i++) 531 for (mem = 0, i = 0; i < m68k_num_memory; i++)
529 mem += m68k_memory[i].size; 532 mem += m68k_memory[i].size;
530 len += sprintf(buffer+len, "System Memory:\t%ldK\n", mem>>10); 533 len += sprintf(buffer + len, "System Memory:\t%ldK\n", mem >> 10);
531 534
532 if (mach_get_hardware_list) 535 if (mach_get_hardware_list)
533 len += mach_get_hardware_list(buffer+len); 536 len += mach_get_hardware_list(buffer + len);
534 537
535 return(len); 538 return len;
536} 539}
537 540
538void check_bugs(void) 541void check_bugs(void)
539{ 542{
540#ifndef CONFIG_M68KFPU_EMU 543#ifndef CONFIG_M68KFPU_EMU
541 if (m68k_fputype == 0) { 544 if (m68k_fputype == 0) {
542 printk( KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, " 545 printk(KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
543 "WHICH IS REQUIRED BY LINUX/M68K ***\n" ); 546 "WHICH IS REQUIRED BY LINUX/M68K ***\n");
544 printk( KERN_EMERG "Upgrade your hardware or join the FPU " 547 printk(KERN_EMERG "Upgrade your hardware or join the FPU "
545 "emulation project\n" ); 548 "emulation project\n");
546 panic( "no FPU" ); 549 panic("no FPU");
547 } 550 }
548#endif /* !CONFIG_M68KFPU_EMU */ 551#endif /* !CONFIG_M68KFPU_EMU */
549} 552}