diff options
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/proc-arm940.S | 26 | ||||
-rw-r--r-- | arch/arm/mm/proc-arm946.S | 22 | ||||
-rw-r--r-- | arch/arm/mm/proc-macros.S | 24 |
3 files changed, 38 insertions, 34 deletions
diff --git a/arch/arm/mm/proc-arm940.S b/arch/arm/mm/proc-arm940.S index e5212d489377..c42cdd3b44bc 100644 --- a/arch/arm/mm/proc-arm940.S +++ b/arch/arm/mm/proc-arm940.S | |||
@@ -297,26 +297,16 @@ __arm940_setup: | |||
297 | mcr p15, 0, r0, c6, c0, 1 | 297 | mcr p15, 0, r0, c6, c0, 1 |
298 | 298 | ||
299 | ldr r0, =(CONFIG_DRAM_BASE & 0xFFFFF000) @ base[31:12] of RAM | 299 | ldr r0, =(CONFIG_DRAM_BASE & 0xFFFFF000) @ base[31:12] of RAM |
300 | ldr r1, =(CONFIG_DRAM_SIZE >> 12) @ size of RAM (must be >= 4KB) | 300 | ldr r7, =CONFIG_DRAM_SIZE >> 12 @ size of RAM (must be >= 4KB) |
301 | mov r2, #10 @ 11 is the minimum (4KB) | 301 | pr_val r3, r0, r7, #1 |
302 | 1: add r2, r2, #1 @ area size *= 2 | 302 | mcr p15, 0, r3, c6, c1, 0 @ set area 1, RAM |
303 | mov r1, r1, lsr #1 | 303 | mcr p15, 0, r3, c6, c1, 1 |
304 | bne 1b @ count not zero r-shift | ||
305 | orr r0, r0, r2, lsl #1 @ the area register value | ||
306 | orr r0, r0, #1 @ set enable bit | ||
307 | mcr p15, 0, r0, c6, c1, 0 @ set area 1, RAM | ||
308 | mcr p15, 0, r0, c6, c1, 1 | ||
309 | 304 | ||
310 | ldr r0, =(CONFIG_FLASH_MEM_BASE & 0xFFFFF000) @ base[31:12] of FLASH | 305 | ldr r0, =(CONFIG_FLASH_MEM_BASE & 0xFFFFF000) @ base[31:12] of FLASH |
311 | ldr r1, =(CONFIG_FLASH_SIZE >> 12) @ size of FLASH (must be >= 4KB) | 306 | ldr r7, =CONFIG_FLASH_SIZE @ size of FLASH (must be >= 4KB) |
312 | mov r2, #10 @ 11 is the minimum (4KB) | 307 | pr_val r3, r0, r6, #1 |
313 | 1: add r2, r2, #1 @ area size *= 2 | 308 | mcr p15, 0, r3, c6, c2, 0 @ set area 2, ROM/FLASH |
314 | mov r1, r1, lsr #1 | 309 | mcr p15, 0, r3, c6, c2, 1 |
315 | bne 1b @ count not zero r-shift | ||
316 | orr r0, r0, r2, lsl #1 @ the area register value | ||
317 | orr r0, r0, #1 @ set enable bit | ||
318 | mcr p15, 0, r0, c6, c2, 0 @ set area 2, ROM/FLASH | ||
319 | mcr p15, 0, r0, c6, c2, 1 | ||
320 | 310 | ||
321 | mov r0, #0x06 | 311 | mov r0, #0x06 |
322 | mcr p15, 0, r0, c2, c0, 0 @ Region 1&2 cacheable | 312 | mcr p15, 0, r0, c2, c0, 0 @ Region 1&2 cacheable |
diff --git a/arch/arm/mm/proc-arm946.S b/arch/arm/mm/proc-arm946.S index b3dd9b2d0b8e..17a8c2075c62 100644 --- a/arch/arm/mm/proc-arm946.S +++ b/arch/arm/mm/proc-arm946.S | |||
@@ -343,24 +343,14 @@ __arm946_setup: | |||
343 | mcr p15, 0, r0, c6, c0, 0 @ set region 0, default | 343 | mcr p15, 0, r0, c6, c0, 0 @ set region 0, default |
344 | 344 | ||
345 | ldr r0, =(CONFIG_DRAM_BASE & 0xFFFFF000) @ base[31:12] of RAM | 345 | ldr r0, =(CONFIG_DRAM_BASE & 0xFFFFF000) @ base[31:12] of RAM |
346 | ldr r1, =(CONFIG_DRAM_SIZE >> 12) @ size of RAM (must be >= 4KB) | 346 | ldr r7, =CONFIG_DRAM_SIZE @ size of RAM (must be >= 4KB) |
347 | mov r2, #10 @ 11 is the minimum (4KB) | 347 | pr_val r3, r0, r7, #1 |
348 | 1: add r2, r2, #1 @ area size *= 2 | 348 | mcr p15, 0, r3, c6, c1, 0 |
349 | mov r1, r1, lsr #1 | ||
350 | bne 1b @ count not zero r-shift | ||
351 | orr r0, r0, r2, lsl #1 @ the region register value | ||
352 | orr r0, r0, #1 @ set enable bit | ||
353 | mcr p15, 0, r0, c6, c1, 0 @ set region 1, RAM | ||
354 | 349 | ||
355 | ldr r0, =(CONFIG_FLASH_MEM_BASE & 0xFFFFF000) @ base[31:12] of FLASH | 350 | ldr r0, =(CONFIG_FLASH_MEM_BASE & 0xFFFFF000) @ base[31:12] of FLASH |
356 | ldr r1, =(CONFIG_FLASH_SIZE >> 12) @ size of FLASH (must be >= 4KB) | 351 | ldr r7, =CONFIG_FLASH_SIZE @ size of FLASH (must be >= 4KB) |
357 | mov r2, #10 @ 11 is the minimum (4KB) | 352 | pr_val r3, r0, r7, #1 |
358 | 1: add r2, r2, #1 @ area size *= 2 | 353 | mcr p15, 0, r3, c6, c2, 0 |
359 | mov r1, r1, lsr #1 | ||
360 | bne 1b @ count not zero r-shift | ||
361 | orr r0, r0, r2, lsl #1 @ the region register value | ||
362 | orr r0, r0, #1 @ set enable bit | ||
363 | mcr p15, 0, r0, c6, c2, 0 @ set region 2, ROM/FLASH | ||
364 | 354 | ||
365 | mov r0, #0x06 | 355 | mov r0, #0x06 |
366 | mcr p15, 0, r0, c2, c0, 0 @ region 1,2 d-cacheable | 356 | mcr p15, 0, r0, c2, c0, 0 @ region 1,2 d-cacheable |
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S index 082b9f2f7e90..d081c9d9420d 100644 --- a/arch/arm/mm/proc-macros.S +++ b/arch/arm/mm/proc-macros.S | |||
@@ -331,3 +331,27 @@ ENTRY(\name\()_tlb_fns) | |||
331 | .globl \x | 331 | .globl \x |
332 | .equ \x, \y | 332 | .equ \x, \y |
333 | .endm | 333 | .endm |
334 | |||
335 | /* | ||
336 | * Macro to calculate the log2 size for the protection region | ||
337 | * registers. This calculates rd = log2(size) - 1. tmp must | ||
338 | * not be the same register as rd. | ||
339 | */ | ||
340 | .macro pr_sz, rd, size, tmp | ||
341 | mov \tmp, \size, lsr #12 | ||
342 | mov \rd, #11 | ||
343 | 1: movs \tmp, \tmp, lsr #1 | ||
344 | addne \rd, \rd, #1 | ||
345 | bne 1b | ||
346 | .endm | ||
347 | |||
348 | /* | ||
349 | * Macro to generate a protection region register value | ||
350 | * given a pre-masked address, size, and enable bit. | ||
351 | * Corrupts size. | ||
352 | */ | ||
353 | .macro pr_val, dest, addr, size, enable | ||
354 | pr_sz \dest, \size, \size @ calculate log2(size) - 1 | ||
355 | orr \dest, \addr, \dest, lsl #1 @ mask in the region size | ||
356 | orr \dest, \dest, \enable | ||
357 | .endm | ||