diff options
author | David Brown <davidb@codeaurora.org> | 2011-03-17 01:13:16 -0400 |
---|---|---|
committer | David Brown <davidb@codeaurora.org> | 2011-03-17 01:13:16 -0400 |
commit | 92c260f755c42337c550d8ac1f8ccd1b32bffb20 (patch) | |
tree | 6d04fefc1adeecabfb2b00c201e0db78fa2b5529 /arch/arm/lib/bitops.h | |
parent | 8e76a80960bf06c245160a484d5a363ca6b520bb (diff) | |
parent | 05e34754518b6a90d5c392790c032575fab12d66 (diff) |
Merge remote branch 'rmk/for-linus' into for-linus
* rmk/for-linus: (1557 commits)
ARM: 6806/1: irq: introduce entry and exit functions for chained handlers
ARM: 6781/1: Thumb-2: Work around buggy Thumb-2 short branch relocations in gas
ARM: 6747/1: P2V: Thumb2 support
ARM: 6798/1: aout-core: zero thread debug registers in a.out core dump
ARM: 6796/1: Footbridge: Fix I/O mappings for NOMMU mode
ARM: 6784/1: errata: no automatic Store Buffer drain on Cortex-A9
ARM: 6772/1: errata: possible fault MMU translations following an ASID switch
ARM: 6776/1: mach-ux500: activate fix for errata 753970
ARM: 6794/1: SPEAr: Append UL to device address macros.
ARM: 6793/1: SPEAr: Remove unused *_SIZE macros from spear*.h files
ARM: 6792/1: SPEAr: Replace SIZE macro's with SZ_4K macros
ARM: 6791/1: SPEAr3xx: Declare device structures after shirq code
ARM: 6790/1: SPEAr: Clock Framework: Rename usbd clock and align apb_clk entry
ARM: 6789/1: SPEAr3xx: Rename sdio to sdhci
ARM: 6788/1: SPEAr: Include mach/hardware.h instead of mach/spear.h
ARM: 6787/1: SPEAr: Reorder #includes in .h & .c files.
ARM: 6681/1: SPEAr: add debugfs support to clk API
ARM: 6703/1: SPEAr: update clk API support
ARM: 6679/1: SPEAr: make clk API functions more generic
ARM: 6737/1: SPEAr: formalized timer support
...
Conflicts:
arch/arm/mach-msm/board-msm7x27.c
arch/arm/mach-msm/board-msm7x30.c
arch/arm/mach-msm/board-qsd8x50.c
arch/arm/mach-msm/board-sapphire.c
arch/arm/mach-msm/include/mach/memory.h
Diffstat (limited to 'arch/arm/lib/bitops.h')
-rw-r--r-- | arch/arm/lib/bitops.h | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h index d42252918bfb..10d868a5a481 100644 --- a/arch/arm/lib/bitops.h +++ b/arch/arm/lib/bitops.h | |||
@@ -1,44 +1,52 @@ | |||
1 | 1 | #if __LINUX_ARM_ARCH__ >= 6 | |
2 | #if __LINUX_ARM_ARCH__ >= 6 && defined(CONFIG_CPU_32v6K) | ||
3 | .macro bitop, instr | 2 | .macro bitop, instr |
3 | ands ip, r1, #3 | ||
4 | strneb r1, [ip] @ assert word-aligned | ||
4 | mov r2, #1 | 5 | mov r2, #1 |
5 | and r3, r0, #7 @ Get bit offset | 6 | and r3, r0, #31 @ Get bit offset |
6 | add r1, r1, r0, lsr #3 @ Get byte offset | 7 | mov r0, r0, lsr #5 |
8 | add r1, r1, r0, lsl #2 @ Get word offset | ||
7 | mov r3, r2, lsl r3 | 9 | mov r3, r2, lsl r3 |
8 | 1: ldrexb r2, [r1] | 10 | 1: ldrex r2, [r1] |
9 | \instr r2, r2, r3 | 11 | \instr r2, r2, r3 |
10 | strexb r0, r2, [r1] | 12 | strex r0, r2, [r1] |
11 | cmp r0, #0 | 13 | cmp r0, #0 |
12 | bne 1b | 14 | bne 1b |
13 | mov pc, lr | 15 | bx lr |
14 | .endm | 16 | .endm |
15 | 17 | ||
16 | .macro testop, instr, store | 18 | .macro testop, instr, store |
17 | and r3, r0, #7 @ Get bit offset | 19 | ands ip, r1, #3 |
20 | strneb r1, [ip] @ assert word-aligned | ||
18 | mov r2, #1 | 21 | mov r2, #1 |
19 | add r1, r1, r0, lsr #3 @ Get byte offset | 22 | and r3, r0, #31 @ Get bit offset |
23 | mov r0, r0, lsr #5 | ||
24 | add r1, r1, r0, lsl #2 @ Get word offset | ||
20 | mov r3, r2, lsl r3 @ create mask | 25 | mov r3, r2, lsl r3 @ create mask |
21 | smp_dmb | 26 | smp_dmb |
22 | 1: ldrexb r2, [r1] | 27 | 1: ldrex r2, [r1] |
23 | ands r0, r2, r3 @ save old value of bit | 28 | ands r0, r2, r3 @ save old value of bit |
24 | \instr r2, r2, r3 @ toggle bit | 29 | \instr r2, r2, r3 @ toggle bit |
25 | strexb ip, r2, [r1] | 30 | strex ip, r2, [r1] |
26 | cmp ip, #0 | 31 | cmp ip, #0 |
27 | bne 1b | 32 | bne 1b |
28 | smp_dmb | 33 | smp_dmb |
29 | cmp r0, #0 | 34 | cmp r0, #0 |
30 | movne r0, #1 | 35 | movne r0, #1 |
31 | 2: mov pc, lr | 36 | 2: bx lr |
32 | .endm | 37 | .endm |
33 | #else | 38 | #else |
34 | .macro bitop, instr | 39 | .macro bitop, instr |
35 | and r2, r0, #7 | 40 | ands ip, r1, #3 |
41 | strneb r1, [ip] @ assert word-aligned | ||
42 | and r2, r0, #31 | ||
43 | mov r0, r0, lsr #5 | ||
36 | mov r3, #1 | 44 | mov r3, #1 |
37 | mov r3, r3, lsl r2 | 45 | mov r3, r3, lsl r2 |
38 | save_and_disable_irqs ip | 46 | save_and_disable_irqs ip |
39 | ldrb r2, [r1, r0, lsr #3] | 47 | ldr r2, [r1, r0, lsl #2] |
40 | \instr r2, r2, r3 | 48 | \instr r2, r2, r3 |
41 | strb r2, [r1, r0, lsr #3] | 49 | str r2, [r1, r0, lsl #2] |
42 | restore_irqs ip | 50 | restore_irqs ip |
43 | mov pc, lr | 51 | mov pc, lr |
44 | .endm | 52 | .endm |
@@ -52,11 +60,13 @@ | |||
52 | * to avoid dirtying the data cache. | 60 | * to avoid dirtying the data cache. |
53 | */ | 61 | */ |
54 | .macro testop, instr, store | 62 | .macro testop, instr, store |
55 | add r1, r1, r0, lsr #3 | 63 | ands ip, r1, #3 |
56 | and r3, r0, #7 | 64 | strneb r1, [ip] @ assert word-aligned |
57 | mov r0, #1 | 65 | and r3, r0, #31 |
66 | mov r0, r0, lsr #5 | ||
58 | save_and_disable_irqs ip | 67 | save_and_disable_irqs ip |
59 | ldrb r2, [r1] | 68 | ldr r2, [r1, r0, lsl #2]! |
69 | mov r0, #1 | ||
60 | tst r2, r0, lsl r3 | 70 | tst r2, r0, lsl r3 |
61 | \instr r2, r2, r0, lsl r3 | 71 | \instr r2, r2, r0, lsl r3 |
62 | \store r2, [r1] | 72 | \store r2, [r1] |