diff options
Diffstat (limited to 'arch/arm/kernel/head.S')
-rw-r--r-- | arch/arm/kernel/head.S | 60 |
1 files changed, 36 insertions, 24 deletions
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index f17d9a09e8f..f06ff9feb0d 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -391,25 +391,24 @@ ENDPROC(__turn_mmu_on) | |||
391 | 391 | ||
392 | 392 | ||
393 | #ifdef CONFIG_SMP_ON_UP | 393 | #ifdef CONFIG_SMP_ON_UP |
394 | __INIT | ||
394 | __fixup_smp: | 395 | __fixup_smp: |
395 | mov r4, #0x00070000 | 396 | and r3, r9, #0x000f0000 @ architecture version |
396 | orr r3, r4, #0xff000000 @ mask 0xff070000 | 397 | teq r3, #0x000f0000 @ CPU ID supported? |
397 | orr r4, r4, #0x41000000 @ val 0x41070000 | ||
398 | and r0, r9, r3 | ||
399 | teq r0, r4 @ ARM CPU and ARMv6/v7? | ||
400 | bne __fixup_smp_on_up @ no, assume UP | 398 | bne __fixup_smp_on_up @ no, assume UP |
401 | 399 | ||
402 | orr r3, r3, #0x0000ff00 | 400 | bic r3, r9, #0x00ff0000 |
403 | orr r3, r3, #0x000000f0 @ mask 0xff07fff0 | 401 | bic r3, r3, #0x0000000f @ mask 0xff00fff0 |
402 | mov r4, #0x41000000 | ||
404 | orr r4, r4, #0x0000b000 | 403 | orr r4, r4, #0x0000b000 |
405 | orr r4, r4, #0x00000020 @ val 0x4107b020 | 404 | orr r4, r4, #0x00000020 @ val 0x4100b020 |
406 | and r0, r9, r3 | 405 | teq r3, r4 @ ARM 11MPCore? |
407 | teq r0, r4 @ ARM 11MPCore? | ||
408 | moveq pc, lr @ yes, assume SMP | 406 | moveq pc, lr @ yes, assume SMP |
409 | 407 | ||
410 | mrc p15, 0, r0, c0, c0, 5 @ read MPIDR | 408 | mrc p15, 0, r0, c0, c0, 5 @ read MPIDR |
411 | tst r0, #1 << 31 | 409 | and r0, r0, #0xc0000000 @ multiprocessing extensions and |
412 | movne pc, lr @ bit 31 => SMP | 410 | teq r0, #0x80000000 @ not part of a uniprocessor system? |
411 | moveq pc, lr @ yes, assume SMP | ||
413 | 412 | ||
414 | __fixup_smp_on_up: | 413 | __fixup_smp_on_up: |
415 | adr r0, 1f | 414 | adr r0, 1f |
@@ -417,18 +416,7 @@ __fixup_smp_on_up: | |||
417 | sub r3, r0, r3 | 416 | sub r3, r0, r3 |
418 | add r4, r4, r3 | 417 | add r4, r4, r3 |
419 | add r5, r5, r3 | 418 | add r5, r5, r3 |
420 | 2: cmp r4, r5 | 419 | b __do_fixup_smp_on_up |
421 | movhs pc, lr | ||
422 | ldmia r4!, {r0, r6} | ||
423 | ARM( str r6, [r0, r3] ) | ||
424 | THUMB( add r0, r0, r3 ) | ||
425 | #ifdef __ARMEB__ | ||
426 | THUMB( mov r6, r6, ror #16 ) @ Convert word order for big-endian. | ||
427 | #endif | ||
428 | THUMB( strh r6, [r0], #2 ) @ For Thumb-2, store as two halfwords | ||
429 | THUMB( mov r6, r6, lsr #16 ) @ to be robust against misaligned r3. | ||
430 | THUMB( strh r6, [r0] ) | ||
431 | b 2b | ||
432 | ENDPROC(__fixup_smp) | 420 | ENDPROC(__fixup_smp) |
433 | 421 | ||
434 | .align | 422 | .align |
@@ -442,7 +430,31 @@ smp_on_up: | |||
442 | ALT_SMP(.long 1) | 430 | ALT_SMP(.long 1) |
443 | ALT_UP(.long 0) | 431 | ALT_UP(.long 0) |
444 | .popsection | 432 | .popsection |
433 | #endif | ||
445 | 434 | ||
435 | .text | ||
436 | __do_fixup_smp_on_up: | ||
437 | cmp r4, r5 | ||
438 | movhs pc, lr | ||
439 | ldmia r4!, {r0, r6} | ||
440 | ARM( str r6, [r0, r3] ) | ||
441 | THUMB( add r0, r0, r3 ) | ||
442 | #ifdef __ARMEB__ | ||
443 | THUMB( mov r6, r6, ror #16 ) @ Convert word order for big-endian. | ||
446 | #endif | 444 | #endif |
445 | THUMB( strh r6, [r0], #2 ) @ For Thumb-2, store as two halfwords | ||
446 | THUMB( mov r6, r6, lsr #16 ) @ to be robust against misaligned r3. | ||
447 | THUMB( strh r6, [r0] ) | ||
448 | b __do_fixup_smp_on_up | ||
449 | ENDPROC(__do_fixup_smp_on_up) | ||
450 | |||
451 | ENTRY(fixup_smp) | ||
452 | stmfd sp!, {r4 - r6, lr} | ||
453 | mov r4, r0 | ||
454 | add r5, r0, r1 | ||
455 | mov r3, #0 | ||
456 | bl __do_fixup_smp_on_up | ||
457 | ldmfd sp!, {r4 - r6, pc} | ||
458 | ENDPROC(fixup_smp) | ||
447 | 459 | ||
448 | #include "head-common.S" | 460 | #include "head-common.S" |