diff options
Diffstat (limited to 'arch/arm/kernel/head.S')
-rw-r--r-- | arch/arm/kernel/head.S | 207 |
1 files changed, 1 insertions, 206 deletions
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 53b6901f70a6..04b66a9328ef 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -102,49 +102,6 @@ ENTRY(stext) | |||
102 | adr lr, __enable_mmu @ return (PIC) address | 102 | adr lr, __enable_mmu @ return (PIC) address |
103 | add pc, r10, #PROCINFO_INITFUNC | 103 | add pc, r10, #PROCINFO_INITFUNC |
104 | 104 | ||
105 | .type __switch_data, %object | ||
106 | __switch_data: | ||
107 | .long __mmap_switched | ||
108 | .long __data_loc @ r4 | ||
109 | .long __data_start @ r5 | ||
110 | .long __bss_start @ r6 | ||
111 | .long _end @ r7 | ||
112 | .long processor_id @ r4 | ||
113 | .long __machine_arch_type @ r5 | ||
114 | .long cr_alignment @ r6 | ||
115 | .long init_thread_union + THREAD_START_SP @ sp | ||
116 | |||
117 | /* | ||
118 | * The following fragment of code is executed with the MMU on, and uses | ||
119 | * absolute addresses; this is not position independent. | ||
120 | * | ||
121 | * r0 = cp#15 control register | ||
122 | * r1 = machine ID | ||
123 | * r9 = processor ID | ||
124 | */ | ||
125 | .type __mmap_switched, %function | ||
126 | __mmap_switched: | ||
127 | adr r3, __switch_data + 4 | ||
128 | |||
129 | ldmia r3!, {r4, r5, r6, r7} | ||
130 | cmp r4, r5 @ Copy data segment if needed | ||
131 | 1: cmpne r5, r6 | ||
132 | ldrne fp, [r4], #4 | ||
133 | strne fp, [r5], #4 | ||
134 | bne 1b | ||
135 | |||
136 | mov fp, #0 @ Clear BSS (and zero fp) | ||
137 | 1: cmp r6, r7 | ||
138 | strcc fp, [r6],#4 | ||
139 | bcc 1b | ||
140 | |||
141 | ldmia r3, {r4, r5, r6, sp} | ||
142 | str r9, [r4] @ Save processor ID | ||
143 | str r1, [r5] @ Save machine type | ||
144 | bic r4, r0, #CR_A @ Clear 'A' bit | ||
145 | stmia r6, {r0, r4} @ Save control register values | ||
146 | b start_kernel | ||
147 | |||
148 | #if defined(CONFIG_SMP) | 105 | #if defined(CONFIG_SMP) |
149 | .type secondary_startup, #function | 106 | .type secondary_startup, #function |
150 | ENTRY(secondary_startup) | 107 | ENTRY(secondary_startup) |
@@ -367,166 +324,4 @@ __create_page_tables: | |||
367 | mov pc, lr | 324 | mov pc, lr |
368 | .ltorg | 325 | .ltorg |
369 | 326 | ||
370 | 327 | #include "head-common.S" | |
371 | |||
372 | /* | ||
373 | * Exception handling. Something went wrong and we can't proceed. We | ||
374 | * ought to tell the user, but since we don't have any guarantee that | ||
375 | * we're even running on the right architecture, we do virtually nothing. | ||
376 | * | ||
377 | * If CONFIG_DEBUG_LL is set we try to print out something about the error | ||
378 | * and hope for the best (useful if bootloader fails to pass a proper | ||
379 | * machine ID for example). | ||
380 | */ | ||
381 | |||
382 | .type __error_p, %function | ||
383 | __error_p: | ||
384 | #ifdef CONFIG_DEBUG_LL | ||
385 | adr r0, str_p1 | ||
386 | bl printascii | ||
387 | b __error | ||
388 | str_p1: .asciz "\nError: unrecognized/unsupported processor variant.\n" | ||
389 | .align | ||
390 | #endif | ||
391 | |||
392 | .type __error_a, %function | ||
393 | __error_a: | ||
394 | #ifdef CONFIG_DEBUG_LL | ||
395 | mov r4, r1 @ preserve machine ID | ||
396 | adr r0, str_a1 | ||
397 | bl printascii | ||
398 | mov r0, r4 | ||
399 | bl printhex8 | ||
400 | adr r0, str_a2 | ||
401 | bl printascii | ||
402 | adr r3, 3f | ||
403 | ldmia r3, {r4, r5, r6} @ get machine desc list | ||
404 | sub r4, r3, r4 @ get offset between virt&phys | ||
405 | add r5, r5, r4 @ convert virt addresses to | ||
406 | add r6, r6, r4 @ physical address space | ||
407 | 1: ldr r0, [r5, #MACHINFO_TYPE] @ get machine type | ||
408 | bl printhex8 | ||
409 | mov r0, #'\t' | ||
410 | bl printch | ||
411 | ldr r0, [r5, #MACHINFO_NAME] @ get machine name | ||
412 | add r0, r0, r4 | ||
413 | bl printascii | ||
414 | mov r0, #'\n' | ||
415 | bl printch | ||
416 | add r5, r5, #SIZEOF_MACHINE_DESC @ next machine_desc | ||
417 | cmp r5, r6 | ||
418 | blo 1b | ||
419 | adr r0, str_a3 | ||
420 | bl printascii | ||
421 | b __error | ||
422 | str_a1: .asciz "\nError: unrecognized/unsupported machine ID (r1 = 0x" | ||
423 | str_a2: .asciz ").\n\nAvailable machine support:\n\nID (hex)\tNAME\n" | ||
424 | str_a3: .asciz "\nPlease check your kernel config and/or bootloader.\n" | ||
425 | .align | ||
426 | #endif | ||
427 | |||
428 | .type __error, %function | ||
429 | __error: | ||
430 | #ifdef CONFIG_ARCH_RPC | ||
431 | /* | ||
432 | * Turn the screen red on a error - RiscPC only. | ||
433 | */ | ||
434 | mov r0, #0x02000000 | ||
435 | mov r3, #0x11 | ||
436 | orr r3, r3, r3, lsl #8 | ||
437 | orr r3, r3, r3, lsl #16 | ||
438 | str r3, [r0], #4 | ||
439 | str r3, [r0], #4 | ||
440 | str r3, [r0], #4 | ||
441 | str r3, [r0], #4 | ||
442 | #endif | ||
443 | 1: mov r0, r0 | ||
444 | b 1b | ||
445 | |||
446 | |||
447 | /* | ||
448 | * Read processor ID register (CP#15, CR0), and look up in the linker-built | ||
449 | * supported processor list. Note that we can't use the absolute addresses | ||
450 | * for the __proc_info lists since we aren't running with the MMU on | ||
451 | * (and therefore, we are not in the correct address space). We have to | ||
452 | * calculate the offset. | ||
453 | * | ||
454 | * r9 = cpuid | ||
455 | * Returns: | ||
456 | * r3, r4, r6 corrupted | ||
457 | * r5 = proc_info pointer in physical address space | ||
458 | * r9 = cpuid (preserved) | ||
459 | */ | ||
460 | .type __lookup_processor_type, %function | ||
461 | __lookup_processor_type: | ||
462 | adr r3, 3f | ||
463 | ldmda r3, {r5 - r7} | ||
464 | sub r3, r3, r7 @ get offset between virt&phys | ||
465 | add r5, r5, r3 @ convert virt addresses to | ||
466 | add r6, r6, r3 @ physical address space | ||
467 | 1: ldmia r5, {r3, r4} @ value, mask | ||
468 | and r4, r4, r9 @ mask wanted bits | ||
469 | teq r3, r4 | ||
470 | beq 2f | ||
471 | add r5, r5, #PROC_INFO_SZ @ sizeof(proc_info_list) | ||
472 | cmp r5, r6 | ||
473 | blo 1b | ||
474 | mov r5, #0 @ unknown processor | ||
475 | 2: mov pc, lr | ||
476 | |||
477 | /* | ||
478 | * This provides a C-API version of the above function. | ||
479 | */ | ||
480 | ENTRY(lookup_processor_type) | ||
481 | stmfd sp!, {r4 - r7, r9, lr} | ||
482 | mov r9, r0 | ||
483 | bl __lookup_processor_type | ||
484 | mov r0, r5 | ||
485 | ldmfd sp!, {r4 - r7, r9, pc} | ||
486 | |||
487 | /* | ||
488 | * Look in include/asm-arm/procinfo.h and arch/arm/kernel/arch.[ch] for | ||
489 | * more information about the __proc_info and __arch_info structures. | ||
490 | */ | ||
491 | .long __proc_info_begin | ||
492 | .long __proc_info_end | ||
493 | 3: .long . | ||
494 | .long __arch_info_begin | ||
495 | .long __arch_info_end | ||
496 | |||
497 | /* | ||
498 | * Lookup machine architecture in the linker-build list of architectures. | ||
499 | * Note that we can't use the absolute addresses for the __arch_info | ||
500 | * lists since we aren't running with the MMU on (and therefore, we are | ||
501 | * not in the correct address space). We have to calculate the offset. | ||
502 | * | ||
503 | * r1 = machine architecture number | ||
504 | * Returns: | ||
505 | * r3, r4, r6 corrupted | ||
506 | * r5 = mach_info pointer in physical address space | ||
507 | */ | ||
508 | .type __lookup_machine_type, %function | ||
509 | __lookup_machine_type: | ||
510 | adr r3, 3b | ||
511 | ldmia r3, {r4, r5, r6} | ||
512 | sub r3, r3, r4 @ get offset between virt&phys | ||
513 | add r5, r5, r3 @ convert virt addresses to | ||
514 | add r6, r6, r3 @ physical address space | ||
515 | 1: ldr r3, [r5, #MACHINFO_TYPE] @ get machine type | ||
516 | teq r3, r1 @ matches loader number? | ||
517 | beq 2f @ found | ||
518 | add r5, r5, #SIZEOF_MACHINE_DESC @ next machine_desc | ||
519 | cmp r5, r6 | ||
520 | blo 1b | ||
521 | mov r5, #0 @ unknown machine | ||
522 | 2: mov pc, lr | ||
523 | |||
524 | /* | ||
525 | * This provides a C-API version of the above function. | ||
526 | */ | ||
527 | ENTRY(lookup_machine_type) | ||
528 | stmfd sp!, {r4 - r6, lr} | ||
529 | mov r1, r0 | ||
530 | bl __lookup_machine_type | ||
531 | mov r0, r5 | ||
532 | ldmfd sp!, {r4 - r6, pc} | ||