diff options
-rw-r--r-- | arch/arm/boot/compressed/head.S | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 491c7e4c9ac6..b56f5e691d65 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S | |||
@@ -2,6 +2,7 @@ | |||
2 | * linux/arch/arm/boot/compressed/head.S | 2 | * linux/arch/arm/boot/compressed/head.S |
3 | * | 3 | * |
4 | * Copyright (C) 1996-2002 Russell King | 4 | * Copyright (C) 1996-2002 Russell King |
5 | * Copyright (C) 2004 Hyok S. Choi (MPU support) | ||
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
@@ -320,6 +321,62 @@ params: ldr r0, =params_phys | |||
320 | cache_on: mov r3, #8 @ cache_on function | 321 | cache_on: mov r3, #8 @ cache_on function |
321 | b call_cache_fn | 322 | b call_cache_fn |
322 | 323 | ||
324 | /* | ||
325 | * Initialize the highest priority protection region, PR7 | ||
326 | * to cover all 32bit address and cacheable and bufferable. | ||
327 | */ | ||
328 | __armv4_mpu_cache_on: | ||
329 | mov r0, #0x3f @ 4G, the whole | ||
330 | mcr p15, 0, r0, c6, c7, 0 @ PR7 Area Setting | ||
331 | mcr p15, 0, r0, c6, c7, 1 | ||
332 | |||
333 | mov r0, #0x80 @ PR7 | ||
334 | mcr p15, 0, r0, c2, c0, 0 @ D-cache on | ||
335 | mcr p15, 0, r0, c2, c0, 1 @ I-cache on | ||
336 | mcr p15, 0, r0, c3, c0, 0 @ write-buffer on | ||
337 | |||
338 | mov r0, #0xc000 | ||
339 | mcr p15, 0, r0, c5, c0, 1 @ I-access permission | ||
340 | mcr p15, 0, r0, c5, c0, 0 @ D-access permission | ||
341 | |||
342 | mov r0, #0 | ||
343 | mcr p15, 0, r0, c7, c10, 4 @ drain write buffer | ||
344 | mcr p15, 0, r0, c7, c5, 0 @ flush(inval) I-Cache | ||
345 | mcr p15, 0, r0, c7, c6, 0 @ flush(inval) D-Cache | ||
346 | mrc p15, 0, r0, c1, c0, 0 @ read control reg | ||
347 | @ ...I .... ..D. WC.M | ||
348 | orr r0, r0, #0x002d @ .... .... ..1. 11.1 | ||
349 | orr r0, r0, #0x1000 @ ...1 .... .... .... | ||
350 | |||
351 | mcr p15, 0, r0, c1, c0, 0 @ write control reg | ||
352 | |||
353 | mov r0, #0 | ||
354 | mcr p15, 0, r0, c7, c5, 0 @ flush(inval) I-Cache | ||
355 | mcr p15, 0, r0, c7, c6, 0 @ flush(inval) D-Cache | ||
356 | mov pc, lr | ||
357 | |||
358 | __armv3_mpu_cache_on: | ||
359 | mov r0, #0x3f @ 4G, the whole | ||
360 | mcr p15, 0, r0, c6, c7, 0 @ PR7 Area Setting | ||
361 | |||
362 | mov r0, #0x80 @ PR7 | ||
363 | mcr p15, 0, r0, c2, c0, 0 @ cache on | ||
364 | mcr p15, 0, r0, c3, c0, 0 @ write-buffer on | ||
365 | |||
366 | mov r0, #0xc000 | ||
367 | mcr p15, 0, r0, c5, c0, 0 @ access permission | ||
368 | |||
369 | mov r0, #0 | ||
370 | mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 | ||
371 | mrc p15, 0, r0, c1, c0, 0 @ read control reg | ||
372 | @ .... .... .... WC.M | ||
373 | orr r0, r0, #0x000d @ .... .... .... 11.1 | ||
374 | mov r0, #0 | ||
375 | mcr p15, 0, r0, c1, c0, 0 @ write control reg | ||
376 | |||
377 | mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 | ||
378 | mov pc, lr | ||
379 | |||
323 | __setup_mmu: sub r3, r4, #16384 @ Page directory size | 380 | __setup_mmu: sub r3, r4, #16384 @ Page directory size |
324 | bic r3, r3, #0xff @ Align the pointer | 381 | bic r3, r3, #0xff @ Align the pointer |
325 | bic r3, r3, #0x3f00 | 382 | bic r3, r3, #0x3f00 |
@@ -496,6 +553,18 @@ proc_types: | |||
496 | b __armv4_mmu_cache_off | 553 | b __armv4_mmu_cache_off |
497 | mov pc, lr | 554 | mov pc, lr |
498 | 555 | ||
556 | .word 0x41007400 @ ARM74x | ||
557 | .word 0xff00ff00 | ||
558 | b __armv3_mpu_cache_on | ||
559 | b __armv3_mpu_cache_off | ||
560 | b __armv3_mpu_cache_flush | ||
561 | |||
562 | .word 0x41009400 @ ARM94x | ||
563 | .word 0xff00ff00 | ||
564 | b __armv4_mpu_cache_on | ||
565 | b __armv4_mpu_cache_off | ||
566 | b __armv4_mpu_cache_flush | ||
567 | |||
499 | .word 0x00007000 @ ARM7 IDs | 568 | .word 0x00007000 @ ARM7 IDs |
500 | .word 0x0000f000 | 569 | .word 0x0000f000 |
501 | mov pc, lr | 570 | mov pc, lr |
@@ -562,6 +631,24 @@ proc_types: | |||
562 | cache_off: mov r3, #12 @ cache_off function | 631 | cache_off: mov r3, #12 @ cache_off function |
563 | b call_cache_fn | 632 | b call_cache_fn |
564 | 633 | ||
634 | __armv4_mpu_cache_off: | ||
635 | mrc p15, 0, r0, c1, c0 | ||
636 | bic r0, r0, #0x000d | ||
637 | mcr p15, 0, r0, c1, c0 @ turn MPU and cache off | ||
638 | mov r0, #0 | ||
639 | mcr p15, 0, r0, c7, c10, 4 @ drain write buffer | ||
640 | mcr p15, 0, r0, c7, c6, 0 @ flush D-Cache | ||
641 | mcr p15, 0, r0, c7, c5, 0 @ flush I-Cache | ||
642 | mov pc, lr | ||
643 | |||
644 | __armv3_mpu_cache_off: | ||
645 | mrc p15, 0, r0, c1, c0 | ||
646 | bic r0, r0, #0x000d | ||
647 | mcr p15, 0, r0, c1, c0, 0 @ turn MPU and cache off | ||
648 | mov r0, #0 | ||
649 | mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 | ||
650 | mov pc, lr | ||
651 | |||
565 | __armv4_mmu_cache_off: | 652 | __armv4_mmu_cache_off: |
566 | mrc p15, 0, r0, c1, c0 | 653 | mrc p15, 0, r0, c1, c0 |
567 | bic r0, r0, #0x000d | 654 | bic r0, r0, #0x000d |
@@ -601,6 +688,24 @@ cache_clean_flush: | |||
601 | mov r3, #16 | 688 | mov r3, #16 |
602 | b call_cache_fn | 689 | b call_cache_fn |
603 | 690 | ||
691 | __armv4_mpu_cache_flush: | ||
692 | mov r2, #1 | ||
693 | mov r3, #0 | ||
694 | mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache | ||
695 | mov r1, #7 << 5 @ 8 segments | ||
696 | 1: orr r3, r1, #63 << 26 @ 64 entries | ||
697 | 2: mcr p15, 0, r3, c7, c14, 2 @ clean & invalidate D index | ||
698 | subs r3, r3, #1 << 26 | ||
699 | bcs 2b @ entries 63 to 0 | ||
700 | subs r1, r1, #1 << 5 | ||
701 | bcs 1b @ segments 7 to 0 | ||
702 | |||
703 | teq r2, #0 | ||
704 | mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache | ||
705 | mcr p15, 0, ip, c7, c10, 4 @ drain WB | ||
706 | mov pc, lr | ||
707 | |||
708 | |||
604 | __armv6_mmu_cache_flush: | 709 | __armv6_mmu_cache_flush: |
605 | mov r1, #0 | 710 | mov r1, #0 |
606 | mcr p15, 0, r1, c7, c14, 0 @ clean+invalidate D | 711 | mcr p15, 0, r1, c7, c14, 0 @ clean+invalidate D |
@@ -638,6 +743,7 @@ no_cache_id: | |||
638 | mov pc, lr | 743 | mov pc, lr |
639 | 744 | ||
640 | __armv3_mmu_cache_flush: | 745 | __armv3_mmu_cache_flush: |
746 | __armv3_mpu_cache_flush: | ||
641 | mov r1, #0 | 747 | mov r1, #0 |
642 | mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 | 748 | mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 |
643 | mov pc, lr | 749 | mov pc, lr |