diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-09-06 15:47:54 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-10-01 11:40:58 -0400 |
commit | 9e8b5199a753a2583a8ef8360e6428304a242283 (patch) | |
tree | cfd065b410dd5fe5c14843b71368e0916a496739 /arch/arm | |
parent | bb30f36f9b71c31dc8fe3483bba4c9884fc86080 (diff) |
[ARM] Convert Xscale and Xscale3 to use new memory types
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/include/asm/pgtable.h | 4 | ||||
-rw-r--r-- | arch/arm/mm/proc-xsc3.S | 30 | ||||
-rw-r--r-- | arch/arm/mm/proc-xscale.S | 52 |
3 files changed, 55 insertions, 31 deletions
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index 8df2e254a3e4..8f039a08b00c 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h | |||
@@ -188,8 +188,8 @@ extern void __pgd_error(const char *file, int line, unsigned long val); | |||
188 | #define L_PTE_MT_DEV_SHARED2 (0x05 << 2) /* 0101 (v6) */ | 188 | #define L_PTE_MT_DEV_SHARED2 (0x05 << 2) /* 0101 (v6) */ |
189 | #define L_PTE_MT_DEV_NONSHARED (0x0c << 2) /* 1100 */ | 189 | #define L_PTE_MT_DEV_NONSHARED (0x0c << 2) /* 1100 */ |
190 | #define L_PTE_MT_DEV_IXP2000 (0x0d << 2) /* 1101 */ | 190 | #define L_PTE_MT_DEV_IXP2000 (0x0d << 2) /* 1101 */ |
191 | #define L_PTE_MT_DEV_WC (0x09 << 2) /* 1001 (pre-v6, !xsc3) */ | 191 | #define L_PTE_MT_DEV_WC (0x09 << 2) /* 1001 (pre-v6) */ |
192 | #define L_PTE_MT_DEV_WC2 (0x08 << 2) /* 1000 (xsc3, v6) */ | 192 | #define L_PTE_MT_DEV_WC2 (0x08 << 2) /* 1000 (v6) */ |
193 | #define L_PTE_MT_DEV_CACHED (0x0b << 2) /* 1011 */ | 193 | #define L_PTE_MT_DEV_CACHED (0x0b << 2) /* 1011 */ |
194 | #define L_PTE_MT_MASK (0x0f << 2) | 194 | #define L_PTE_MT_MASK (0x0f << 2) |
195 | 195 | ||
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S index ad1ce5a89221..96e47fc7fd6f 100644 --- a/arch/arm/mm/proc-xsc3.S +++ b/arch/arm/mm/proc-xsc3.S | |||
@@ -347,16 +347,36 @@ ENTRY(cpu_xsc3_switch_mm) | |||
347 | * Set a PTE and flush it out | 347 | * Set a PTE and flush it out |
348 | * | 348 | * |
349 | */ | 349 | */ |
350 | |||
351 | cpu_xsc3_mt_table: | ||
352 | .long 0x00 @ L_PTE_MT_UNCACHED | ||
353 | .long PTE_BUFFERABLE @ L_PTE_MT_BUFFERABLE | ||
354 | .long PTE_EXT_TEX(5) | PTE_CACHEABLE @ L_PTE_MT_WRITETHROUGH | ||
355 | .long PTE_EXT_TEX(5) | PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEBACK | ||
356 | .long 0x00 @ L_PTE_MT_DEV_SHARED | ||
357 | .long 0x00 @ L_PTE_MT_DEV_SHARED2 | ||
358 | .long 0x00 @ L_PTE_MT_MINICACHE (not present) | ||
359 | .long PTE_EXT_TEX(5) | PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEALLOC (not present?) | ||
360 | .long PTE_EXT_TEX(1) @ L_PTE_MT_DEV_WC2 | ||
361 | .long PTE_EXT_TEX(1) @ L_PTE_MT_DEV_WC | ||
362 | .long 0x00 @ unused | ||
363 | .long PTE_EXT_TEX(5) | PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_DEV_CACHED | ||
364 | .long 0x00 @ L_PTE_MT_DEV_NONSHARED | ||
365 | .long 0x00 @ L_PTE_MT_DEV_IXP2000 (not present) | ||
366 | .long 0x00 @ unused | ||
367 | .long 0x00 @ unused | ||
368 | |||
350 | .align 5 | 369 | .align 5 |
351 | ENTRY(cpu_xsc3_set_pte_ext) | 370 | ENTRY(cpu_xsc3_set_pte_ext) |
352 | xscale_set_pte_ext_prologue | 371 | xscale_set_pte_ext_prologue |
353 | 372 | ||
354 | @ If it's cacheable, it needs to be in L2 also. | ||
355 | tst r1, #L_PTE_CACHEABLE | ||
356 | orrne r2, r2, #PTE_EXT_TEX(0x5) | ||
357 | |||
358 | tst r1, #L_PTE_SHARED @ shared? | 373 | tst r1, #L_PTE_SHARED @ shared? |
359 | orrne r2, r2, #0x200 | 374 | and r1, r1, #L_PTE_MT_MASK |
375 | adr ip, cpu_xsc3_mt_table | ||
376 | ldr ip, [ip, r1] | ||
377 | orrne r2, r2, #PTE_EXT_COHERENT @ interlock: mask in coherent bit | ||
378 | bic r2, r2, #0x0c @ clear old C,B bits | ||
379 | orr r2, r2, ip | ||
360 | 380 | ||
361 | xscale_set_pte_ext_epilogue | 381 | xscale_set_pte_ext_epilogue |
362 | mov pc, lr | 382 | mov pc, lr |
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S index 8d7512f9cba7..6fa525364bb7 100644 --- a/arch/arm/mm/proc-xscale.S +++ b/arch/arm/mm/proc-xscale.S | |||
@@ -406,8 +406,6 @@ ENTRY(cpu_xscale_dcache_clean_area) | |||
406 | 406 | ||
407 | /* =============================== PageTable ============================== */ | 407 | /* =============================== PageTable ============================== */ |
408 | 408 | ||
409 | #define PTE_CACHE_WRITE_ALLOCATE 0 | ||
410 | |||
411 | /* | 409 | /* |
412 | * cpu_xscale_switch_mm(pgd) | 410 | * cpu_xscale_switch_mm(pgd) |
413 | * | 411 | * |
@@ -431,34 +429,40 @@ ENTRY(cpu_xscale_switch_mm) | |||
431 | * | 429 | * |
432 | * Errata 40: must set memory to write-through for user read-only pages. | 430 | * Errata 40: must set memory to write-through for user read-only pages. |
433 | */ | 431 | */ |
432 | cpu_xscale_mt_table: | ||
433 | .long 0x00 @ L_PTE_MT_UNCACHED | ||
434 | .long PTE_BUFFERABLE @ L_PTE_MT_BUFFERABLE | ||
435 | .long PTE_CACHEABLE @ L_PTE_MT_WRITETHROUGH | ||
436 | .long PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEBACK | ||
437 | .long 0x00 @ L_PTE_MT_DEV_SHARED | ||
438 | .long 0x00 @ L_PTE_MT_DEV_SHARED2 | ||
439 | .long PTE_EXT_TEX(1) | PTE_CACHEABLE @ L_PTE_MT_MINICACHE | ||
440 | .long PTE_EXT_TEX(1) | PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_WRITEALLOC | ||
441 | .long PTE_BUFFERABLE @ L_PTE_MT_DEV_WC2 | ||
442 | .long PTE_BUFFERABLE @ L_PTE_MT_DEV_WC | ||
443 | .long 0x00 @ unused | ||
444 | .long PTE_CACHEABLE | PTE_BUFFERABLE @ L_PTE_MT_DEV_CACHED | ||
445 | .long 0x00 @ L_PTE_MT_DEV_NONSHARED | ||
446 | .long PTE_EXT_TEX(1) | PTE_BUFFERABLE @ L_PTE_MT_DEV_IXP2000 | ||
447 | .long 0x00 @ unused | ||
448 | .long 0x00 @ unused | ||
449 | |||
434 | .align 5 | 450 | .align 5 |
435 | ENTRY(cpu_xscale_set_pte_ext) | 451 | ENTRY(cpu_xscale_set_pte_ext) |
436 | xscale_set_pte_ext_prologue | 452 | xscale_set_pte_ext_prologue |
437 | @ | ||
438 | @ Handle the X bit. We want to set this bit for the minicache | ||
439 | @ (U = E = B = W = 0, C = 1) or when write allocate is enabled, | ||
440 | @ and we have a writeable, cacheable region. If we ignore the | ||
441 | @ U and E bits, we can allow user space to use the minicache as | ||
442 | @ well. | ||
443 | @ | ||
444 | @ X = (C & ~W & ~B) | (C & W & B & write_allocate) | ||
445 | @ | ||
446 | and ip, r1, #L_PTE_CACHEABLE | L_PTE_WRITE | L_PTE_BUFFERABLE | ||
447 | teq ip, #L_PTE_CACHEABLE | ||
448 | #if PTE_CACHE_WRITE_ALLOCATE | ||
449 | teqne ip, #L_PTE_CACHEABLE | L_PTE_WRITE | L_PTE_BUFFERABLE | ||
450 | #endif | ||
451 | orreq r2, r2, #PTE_EXT_TEX(1) | ||
452 | 453 | ||
453 | @ | 454 | @ |
454 | @ Erratum 40: The B bit must be cleared for a user read-only | 455 | @ Erratum 40: must set memory to write-through for user read-only pages |
455 | @ cacheable page. | ||
456 | @ | ||
457 | @ B = B & ~(U & C & ~W) | ||
458 | @ | 456 | @ |
459 | and ip, r1, #L_PTE_USER | L_PTE_WRITE | L_PTE_CACHEABLE | 457 | and ip, r1, #(L_PTE_MT_MASK | L_PTE_USER | L_PTE_WRITE) & ~(4 << 2) |
460 | teq ip, #L_PTE_USER | L_PTE_CACHEABLE | 458 | teq ip, #L_PTE_MT_WRITEBACK | L_PTE_USER |
461 | biceq r2, r2, #PTE_BUFFERABLE | 459 | |
460 | moveq r1, #L_PTE_MT_WRITETHROUGH | ||
461 | and r1, r1, #L_PTE_MT_MASK | ||
462 | adr ip, cpu_xscale_mt_table | ||
463 | ldr ip, [ip, r1] | ||
464 | bic r2, r2, #0x0c | ||
465 | orr r2, r2, ip | ||
462 | 466 | ||
463 | xscale_set_pte_ext_epilogue | 467 | xscale_set_pte_ext_epilogue |
464 | mov pc, lr | 468 | mov pc, lr |