aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 21:34:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 21:34:03 -0500
commitf341535193c338b4ce4af8e32be51e6aae7f22a6 (patch)
treed054a10be84681b93ce53c348cde0d764e1e24a2 /arch/arm/include/asm
parent13c789a6b219aa23f917466c7e630566106b14c2 (diff)
parent857989a7fdd2f6de42272578b8aaa413ed6e63e4 (diff)
Merge branch 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
Pull ARM updates from Russell King: "In this set, we have: - Refactoring of some of the old StrongARM-1100 GPIO code to make things simpler by Dmitry Eremin-Solenikov - Read-only and non-executable support for modules on ARM from Laura Abbot - Removal of unnecessary set_drvdata() calls in AMBA code - Some non-executable support for kernel lowmem mappings at the 1MB section granularity, and dumping of kernel page tables via debugfs - Some improvements for the timer/clock code on Footbridge platforms, and cleanup some of the LED code there - Fix fls/ffs() signatures to match x86 to prevent build warnings, particularly where these are used with min/max() macros - Avoid using the bootmem allocator on ARM (patches from Santosh Shilimkar) - Various asid/unaligned access updates from Will Deacon" * 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm: (51 commits) ARM: SMP implementations are not supposed to return from smp_ops.cpu_die() ARM: ignore memory below PHYS_OFFSET Fix select-induced Kconfig warning for ZBOOT_ROM ARM: fix ffs/fls implementations to match x86 ARM: 7935/1: sa1100: collie: add gpio-keys configuration ARM: 7932/1: bcm: Add DEBUG_LL console support ARM: 7929/1: Remove duplicate SCHED_HRTICK config option ARM: 7928/1: kconfig: select HAVE_EFFICIENT_UNALIGNED_ACCESS for CPUv6+ && MMU ARM: 7927/1: dcache: select DCACHE_WORD_ACCESS for big-endian CPUs ARM: 7926/1: mm: flesh out and fix the comments in the ASID allocator ARM: 7925/1: mm: keep track of last ASID allocation to improve bitmap searching ARM: 7924/1: mm: don't bother with reserved ttbr0 when running with LPAE ARM: PCI: add legacy IDE IRQ implementation ARM: footbridge: cleanup LEDs code ARM: pgd allocation: retry on failure ARM: footbridge: add one-shot mode for DC21285 timer ARM: footbridge: add sched_clock implementation ARM: 7922/1: l2x0: add Marvell Tauros3 support ARM: 7877/1: use built-in byte swap function ARM: 7921/1: mcpm: remove redundant dsb instructions prior to sev ...
Diffstat (limited to 'arch/arm/include/asm')
-rw-r--r--arch/arm/include/asm/bitops.h54
-rw-r--r--arch/arm/include/asm/cacheflush.h5
-rw-r--r--arch/arm/include/asm/checksum.h34
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h1
-rw-r--r--arch/arm/include/asm/mach/map.h27
-rw-r--r--arch/arm/include/asm/pci.h5
-rw-r--r--arch/arm/include/asm/pgtable-2level.h1
-rw-r--r--arch/arm/include/asm/pgtable-3level.h1
-rw-r--r--arch/arm/include/asm/pgtable.h2
-rw-r--r--arch/arm/include/asm/word-at-a-time.h18
10 files changed, 104 insertions, 44 deletions
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index e691ec91e4d3..b2e298a90d76 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -254,25 +254,59 @@ static inline int constant_fls(int x)
254} 254}
255 255
256/* 256/*
257 * On ARMv5 and above those functions can be implemented around 257 * On ARMv5 and above those functions can be implemented around the
258 * the clz instruction for much better code efficiency. 258 * clz instruction for much better code efficiency. __clz returns
259 * the number of leading zeros, zero input will return 32, and
260 * 0x80000000 will return 0.
259 */ 261 */
262static inline unsigned int __clz(unsigned int x)
263{
264 unsigned int ret;
265
266 asm("clz\t%0, %1" : "=r" (ret) : "r" (x));
260 267
268 return ret;
269}
270
271/*
272 * fls() returns zero if the input is zero, otherwise returns the bit
273 * position of the last set bit, where the LSB is 1 and MSB is 32.
274 */
261static inline int fls(int x) 275static inline int fls(int x)
262{ 276{
263 int ret;
264
265 if (__builtin_constant_p(x)) 277 if (__builtin_constant_p(x))
266 return constant_fls(x); 278 return constant_fls(x);
267 279
268 asm("clz\t%0, %1" : "=r" (ret) : "r" (x)); 280 return 32 - __clz(x);
269 ret = 32 - ret; 281}
270 return ret; 282
283/*
284 * __fls() returns the bit position of the last bit set, where the
285 * LSB is 0 and MSB is 31. Zero input is undefined.
286 */
287static inline unsigned long __fls(unsigned long x)
288{
289 return fls(x) - 1;
290}
291
292/*
293 * ffs() returns zero if the input was zero, otherwise returns the bit
294 * position of the first set bit, where the LSB is 1 and MSB is 32.
295 */
296static inline int ffs(int x)
297{
298 return fls(x & -x);
299}
300
301/*
302 * __ffs() returns the bit position of the first bit set, where the
303 * LSB is 0 and MSB is 31. Zero input is undefined.
304 */
305static inline unsigned long __ffs(unsigned long x)
306{
307 return ffs(x) - 1;
271} 308}
272 309
273#define __fls(x) (fls(x) - 1)
274#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
275#define __ffs(x) (ffs(x) - 1)
276#define ffz(x) __ffs( ~(x) ) 310#define ffz(x) __ffs( ~(x) )
277 311
278#endif 312#endif
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index ee753f1749cd..e9a49fe0284e 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -481,4 +481,9 @@ static inline void __sync_cache_range_r(volatile void *p, size_t size)
481 : : : "r0","r1","r2","r3","r4","r5","r6","r7", \ 481 : : : "r0","r1","r2","r3","r4","r5","r6","r7", \
482 "r9","r10","lr","memory" ) 482 "r9","r10","lr","memory" )
483 483
484int set_memory_ro(unsigned long addr, int numpages);
485int set_memory_rw(unsigned long addr, int numpages);
486int set_memory_x(unsigned long addr, int numpages);
487int set_memory_nx(unsigned long addr, int numpages);
488
484#endif 489#endif
diff --git a/arch/arm/include/asm/checksum.h b/arch/arm/include/asm/checksum.h
index 6dcc16430868..523315115478 100644
--- a/arch/arm/include/asm/checksum.h
+++ b/arch/arm/include/asm/checksum.h
@@ -87,19 +87,33 @@ static inline __wsum
87csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 87csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
88 unsigned short proto, __wsum sum) 88 unsigned short proto, __wsum sum)
89{ 89{
90 __asm__( 90 u32 lenprot = len | proto << 16;
91 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\ 91 if (__builtin_constant_p(sum) && sum == 0) {
92 adcs %0, %0, %3 \n" 92 __asm__(
93 "adds %0, %1, %2 @ csum_tcpudp_nofold0 \n\t"
93#ifdef __ARMEB__ 94#ifdef __ARMEB__
94 "adcs %0, %0, %4 \n" 95 "adcs %0, %0, %3 \n\t"
95#else 96#else
96 "adcs %0, %0, %4, lsl #8 \n" 97 "adcs %0, %0, %3, ror #8 \n\t"
97#endif 98#endif
98 "adcs %0, %0, %5 \n\ 99 "adc %0, %0, #0"
99 adc %0, %0, #0" 100 : "=&r" (sum)
100 : "=&r"(sum) 101 : "r" (daddr), "r" (saddr), "r" (lenprot)
101 : "r" (sum), "r" (daddr), "r" (saddr), "r" (len), "Ir" (htons(proto)) 102 : "cc");
102 : "cc"); 103 } else {
104 __asm__(
105 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\t"
106 "adcs %0, %0, %3 \n\t"
107#ifdef __ARMEB__
108 "adcs %0, %0, %4 \n\t"
109#else
110 "adcs %0, %0, %4, ror #8 \n\t"
111#endif
112 "adc %0, %0, #0"
113 : "=&r"(sum)
114 : "r" (sum), "r" (daddr), "r" (saddr), "r" (lenprot)
115 : "cc");
116 }
103 return sum; 117 return sum;
104} 118}
105/* 119/*
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index 3b2c40b5bfa2..6795ff743b3d 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -131,6 +131,7 @@ struct l2x0_regs {
131 unsigned long prefetch_ctrl; 131 unsigned long prefetch_ctrl;
132 unsigned long pwr_ctrl; 132 unsigned long pwr_ctrl;
133 unsigned long ctrl; 133 unsigned long ctrl;
134 unsigned long aux2_ctrl;
134}; 135};
135 136
136extern struct l2x0_regs l2x0_saved_regs; 137extern struct l2x0_regs l2x0_saved_regs;
diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h
index 2fe141fcc8d6..f98c7f32c9c8 100644
--- a/arch/arm/include/asm/mach/map.h
+++ b/arch/arm/include/asm/mach/map.h
@@ -22,18 +22,21 @@ struct map_desc {
22}; 22};
23 23
24/* types 0-3 are defined in asm/io.h */ 24/* types 0-3 are defined in asm/io.h */
25#define MT_UNCACHED 4 25enum {
26#define MT_CACHECLEAN 5 26 MT_UNCACHED = 4,
27#define MT_MINICLEAN 6 27 MT_CACHECLEAN,
28#define MT_LOW_VECTORS 7 28 MT_MINICLEAN,
29#define MT_HIGH_VECTORS 8 29 MT_LOW_VECTORS,
30#define MT_MEMORY 9 30 MT_HIGH_VECTORS,
31#define MT_ROM 10 31 MT_MEMORY_RWX,
32#define MT_MEMORY_NONCACHED 11 32 MT_MEMORY_RW,
33#define MT_MEMORY_DTCM 12 33 MT_ROM,
34#define MT_MEMORY_ITCM 13 34 MT_MEMORY_RWX_NONCACHED,
35#define MT_MEMORY_SO 14 35 MT_MEMORY_RW_DTCM,
36#define MT_MEMORY_DMA_READY 15 36 MT_MEMORY_RWX_ITCM,
37 MT_MEMORY_RW_SO,
38 MT_MEMORY_DMA_READY,
39};
37 40
38#ifdef CONFIG_MMU 41#ifdef CONFIG_MMU
39extern void iotable_init(struct map_desc *, int); 42extern void iotable_init(struct map_desc *, int);
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h
index a98a2e112fae..680a83e94467 100644
--- a/arch/arm/include/asm/pci.h
+++ b/arch/arm/include/asm/pci.h
@@ -57,12 +57,9 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
57extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 57extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
58 enum pci_mmap_state mmap_state, int write_combine); 58 enum pci_mmap_state mmap_state, int write_combine);
59 59
60/*
61 * Dummy implementation; always return 0.
62 */
63static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 60static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
64{ 61{
65 return 0; 62 return channel ? 15 : 14;
66} 63}
67 64
68#endif /* __KERNEL__ */ 65#endif /* __KERNEL__ */
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
index 86a659a19526..dfff709fda3c 100644
--- a/arch/arm/include/asm/pgtable-2level.h
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -160,6 +160,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
160 return (pmd_t *)pud; 160 return (pmd_t *)pud;
161} 161}
162 162
163#define pmd_large(pmd) (pmd_val(pmd) & 2)
163#define pmd_bad(pmd) (pmd_val(pmd) & 2) 164#define pmd_bad(pmd) (pmd_val(pmd) & 2)
164 165
165#define copy_pmd(pmdpd,pmdps) \ 166#define copy_pmd(pmdpd,pmdps) \
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index 4f9503908dca..03243f7eeddf 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -142,6 +142,7 @@
142 PMD_TYPE_TABLE) 142 PMD_TYPE_TABLE)
143#define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ 143#define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \
144 PMD_TYPE_SECT) 144 PMD_TYPE_SECT)
145#define pmd_large(pmd) pmd_sect(pmd)
145 146
146#define pud_clear(pudp) \ 147#define pud_clear(pudp) \
147 do { \ 148 do { \
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 1571d126e9dd..7d59b524f2af 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -254,6 +254,8 @@ PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY);
254PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY); 254PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY);
255PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG); 255PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG);
256PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG); 256PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG);
257PTE_BIT_FUNC(mkexec, &= ~L_PTE_XN);
258PTE_BIT_FUNC(mknexec, |= L_PTE_XN);
257 259
258static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 260static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
259 261
diff --git a/arch/arm/include/asm/word-at-a-time.h b/arch/arm/include/asm/word-at-a-time.h
index 4d52f92967a6..a6d0a29861e7 100644
--- a/arch/arm/include/asm/word-at-a-time.h
+++ b/arch/arm/include/asm/word-at-a-time.h
@@ -48,10 +48,14 @@ static inline unsigned long find_zero(unsigned long mask)
48 return ret; 48 return ret;
49} 49}
50 50
51#ifdef CONFIG_DCACHE_WORD_ACCESS
52
53#define zero_bytemask(mask) (mask) 51#define zero_bytemask(mask) (mask)
54 52
53#else /* __ARMEB__ */
54#include <asm-generic/word-at-a-time.h>
55#endif
56
57#ifdef CONFIG_DCACHE_WORD_ACCESS
58
55/* 59/*
56 * Load an unaligned word from kernel space. 60 * Load an unaligned word from kernel space.
57 * 61 *
@@ -73,7 +77,11 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
73 " bic %2, %2, #0x3\n" 77 " bic %2, %2, #0x3\n"
74 " ldr %0, [%2]\n" 78 " ldr %0, [%2]\n"
75 " lsl %1, %1, #0x3\n" 79 " lsl %1, %1, #0x3\n"
80#ifndef __ARMEB__
76 " lsr %0, %0, %1\n" 81 " lsr %0, %0, %1\n"
82#else
83 " lsl %0, %0, %1\n"
84#endif
77 " b 2b\n" 85 " b 2b\n"
78 " .popsection\n" 86 " .popsection\n"
79 " .pushsection __ex_table,\"a\"\n" 87 " .pushsection __ex_table,\"a\"\n"
@@ -86,11 +94,5 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
86 return ret; 94 return ret;
87} 95}
88 96
89
90#endif /* DCACHE_WORD_ACCESS */ 97#endif /* DCACHE_WORD_ACCESS */
91
92#else /* __ARMEB__ */
93#include <asm-generic/word-at-a-time.h>
94#endif
95
96#endif /* __ASM_ARM_WORD_AT_A_TIME_H */ 98#endif /* __ASM_ARM_WORD_AT_A_TIME_H */