[ARM] nommu: MPU support in boot/compressed/head.S

This patch adds MPU support in boot/compressed/head.S.

Signed-off-by: Hyok S. Choi <hyok.choi@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Hyok S. Choi and committed by
Russell King
10c2df65 c76b6b41

+106
+106
arch/arm/boot/compressed/head.S
··· 2 * linux/arch/arm/boot/compressed/head.S 3 * 4 * Copyright (C) 1996-2002 Russell King 5 * 6 * 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 ··· 321 cache_on: mov r3, #8 @ cache_on function 322 b call_cache_fn 323 324 __setup_mmu: sub r3, r4, #16384 @ Page directory size 325 bic r3, r3, #0xff @ Align the pointer 326 bic r3, r3, #0x3f00 ··· 553 b __armv4_mmu_cache_off 554 mov pc, lr 555 556 .word 0x00007000 @ ARM7 IDs 557 .word 0x0000f000 558 mov pc, lr ··· 631 cache_off: mov r3, #12 @ cache_off function 632 b call_cache_fn 633 634 __armv4_mmu_cache_off: 635 mrc p15, 0, r0, c1, c0 636 bic r0, r0, #0x000d ··· 688 mov r3, #16 689 b call_cache_fn 690 691 __armv6_mmu_cache_flush: 692 mov r1, #0 693 mcr p15, 0, r1, c7, c14, 0 @ clean+invalidate D ··· 743 mov pc, lr 744 745 __armv3_mmu_cache_flush: 746 mov r1, #0 747 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 748 mov pc, lr
··· 2 * linux/arch/arm/boot/compressed/head.S 3 * 4 * Copyright (C) 1996-2002 Russell King 5 + * Copyright (C) 2004 Hyok S. Choi (MPU support) 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as ··· 320 cache_on: mov r3, #8 @ cache_on function 321 b call_cache_fn 322 323 + /* 324 + * Initialize the highest priority protection region, PR7 325 + * to cover all 32bit address and cacheable and bufferable. 326 + */ 327 + __armv4_mpu_cache_on: 328 + mov r0, #0x3f @ 4G, the whole 329 + mcr p15, 0, r0, c6, c7, 0 @ PR7 Area Setting 330 + mcr p15, 0, r0, c6, c7, 1 331 + 332 + mov r0, #0x80 @ PR7 333 + mcr p15, 0, r0, c2, c0, 0 @ D-cache on 334 + mcr p15, 0, r0, c2, c0, 1 @ I-cache on 335 + mcr p15, 0, r0, c3, c0, 0 @ write-buffer on 336 + 337 + mov r0, #0xc000 338 + mcr p15, 0, r0, c5, c0, 1 @ I-access permission 339 + mcr p15, 0, r0, c5, c0, 0 @ D-access permission 340 + 341 + mov r0, #0 342 + mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 343 + mcr p15, 0, r0, c7, c5, 0 @ flush(inval) I-Cache 344 + mcr p15, 0, r0, c7, c6, 0 @ flush(inval) D-Cache 345 + mrc p15, 0, r0, c1, c0, 0 @ read control reg 346 + @ ...I .... ..D. WC.M 347 + orr r0, r0, #0x002d @ .... .... ..1. 11.1 348 + orr r0, r0, #0x1000 @ ...1 .... .... .... 349 + 350 + mcr p15, 0, r0, c1, c0, 0 @ write control reg 351 + 352 + mov r0, #0 353 + mcr p15, 0, r0, c7, c5, 0 @ flush(inval) I-Cache 354 + mcr p15, 0, r0, c7, c6, 0 @ flush(inval) D-Cache 355 + mov pc, lr 356 + 357 + __armv3_mpu_cache_on: 358 + mov r0, #0x3f @ 4G, the whole 359 + mcr p15, 0, r0, c6, c7, 0 @ PR7 Area Setting 360 + 361 + mov r0, #0x80 @ PR7 362 + mcr p15, 0, r0, c2, c0, 0 @ cache on 363 + mcr p15, 0, r0, c3, c0, 0 @ write-buffer on 364 + 365 + mov r0, #0xc000 366 + mcr p15, 0, r0, c5, c0, 0 @ access permission 367 + 368 + mov r0, #0 369 + mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 370 + mrc p15, 0, r0, c1, c0, 0 @ read control reg 371 + @ .... .... .... WC.M 372 + orr r0, r0, #0x000d @ .... .... .... 11.1 373 + mov r0, #0 374 + mcr p15, 0, r0, c1, c0, 0 @ write control reg 375 + 376 + mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 377 + mov pc, lr 378 + 379 __setup_mmu: sub r3, r4, #16384 @ Page directory size 380 bic r3, r3, #0xff @ Align the pointer 381 bic r3, r3, #0x3f00 ··· 496 b __armv4_mmu_cache_off 497 mov pc, lr 498 499 + .word 0x41007400 @ ARM74x 500 + .word 0xff00ff00 501 + b __armv3_mpu_cache_on 502 + b __armv3_mpu_cache_off 503 + b __armv3_mpu_cache_flush 504 + 505 + .word 0x41009400 @ ARM94x 506 + .word 0xff00ff00 507 + b __armv4_mpu_cache_on 508 + b __armv4_mpu_cache_off 509 + b __armv4_mpu_cache_flush 510 + 511 .word 0x00007000 @ ARM7 IDs 512 .word 0x0000f000 513 mov pc, lr ··· 562 cache_off: mov r3, #12 @ cache_off function 563 b call_cache_fn 564 565 + __armv4_mpu_cache_off: 566 + mrc p15, 0, r0, c1, c0 567 + bic r0, r0, #0x000d 568 + mcr p15, 0, r0, c1, c0 @ turn MPU and cache off 569 + mov r0, #0 570 + mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 571 + mcr p15, 0, r0, c7, c6, 0 @ flush D-Cache 572 + mcr p15, 0, r0, c7, c5, 0 @ flush I-Cache 573 + mov pc, lr 574 + 575 + __armv3_mpu_cache_off: 576 + mrc p15, 0, r0, c1, c0 577 + bic r0, r0, #0x000d 578 + mcr p15, 0, r0, c1, c0, 0 @ turn MPU and cache off 579 + mov r0, #0 580 + mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 581 + mov pc, lr 582 + 583 __armv4_mmu_cache_off: 584 mrc p15, 0, r0, c1, c0 585 bic r0, r0, #0x000d ··· 601 mov r3, #16 602 b call_cache_fn 603 604 + __armv4_mpu_cache_flush: 605 + mov r2, #1 606 + mov r3, #0 607 + mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache 608 + mov r1, #7 << 5 @ 8 segments 609 + 1: orr r3, r1, #63 << 26 @ 64 entries 610 + 2: mcr p15, 0, r3, c7, c14, 2 @ clean & invalidate D index 611 + subs r3, r3, #1 << 26 612 + bcs 2b @ entries 63 to 0 613 + subs r1, r1, #1 << 5 614 + bcs 1b @ segments 7 to 0 615 + 616 + teq r2, #0 617 + mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 618 + mcr p15, 0, ip, c7, c10, 4 @ drain WB 619 + mov pc, lr 620 + 621 + 622 __armv6_mmu_cache_flush: 623 mov r1, #0 624 mcr p15, 0, r1, c7, c14, 0 @ clean+invalidate D ··· 638 mov pc, lr 639 640 __armv3_mmu_cache_flush: 641 + __armv3_mpu_cache_flush: 642 mov r1, #0 643 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 644 mov pc, lr