Linux Audio

Check our new training course

Loading...
v3.5.6
  1#ifndef __ASM_SH_BITOPS_H
  2#define __ASM_SH_BITOPS_H
  3
  4#ifdef __KERNEL__
  5
  6#ifndef _LINUX_BITOPS_H
  7#error only <linux/bitops.h> can be included directly
  8#endif
  9
 10/* For __swab32 */
 11#include <asm/byteorder.h>
 
 12
 13#ifdef CONFIG_GUSA_RB
 14#include <asm/bitops-grb.h>
 15#elif defined(CONFIG_CPU_SH2A)
 16#include <asm-generic/bitops/atomic.h>
 17#include <asm/bitops-op32.h>
 18#elif defined(CONFIG_CPU_SH4A)
 19#include <asm/bitops-llsc.h>
 20#else
 21#include <asm-generic/bitops/atomic.h>
 22#include <asm-generic/bitops/non-atomic.h>
 23#endif
 24
 25/*
 26 * clear_bit() doesn't provide any barrier for the compiler.
 27 */
 28#define smp_mb__before_clear_bit()	smp_mb()
 29#define smp_mb__after_clear_bit()	smp_mb()
 30
 31#ifdef CONFIG_SUPERH32
 32static inline unsigned long ffz(unsigned long word)
 33{
 34	unsigned long result;
 35
 36	__asm__("1:\n\t"
 37		"shlr	%1\n\t"
 38		"bt/s	1b\n\t"
 39		" add	#1, %0"
 40		: "=r" (result), "=r" (word)
 41		: "0" (~0L), "1" (word)
 42		: "t");
 43	return result;
 44}
 45
 46/**
 47 * __ffs - find first bit in word.
 48 * @word: The word to search
 49 *
 50 * Undefined if no bit exists, so code should check against 0 first.
 51 */
 52static inline unsigned long __ffs(unsigned long word)
 53{
 54	unsigned long result;
 55
 56	__asm__("1:\n\t"
 57		"shlr	%1\n\t"
 58		"bf/s	1b\n\t"
 59		" add	#1, %0"
 60		: "=r" (result), "=r" (word)
 61		: "0" (~0L), "1" (word)
 62		: "t");
 63	return result;
 64}
 65#else
 66static inline unsigned long ffz(unsigned long word)
 67{
 68	unsigned long result, __d2, __d3;
 69
 70        __asm__("gettr  tr0, %2\n\t"
 71                "pta    $+32, tr0\n\t"
 72                "andi   %1, 1, %3\n\t"
 73                "beq    %3, r63, tr0\n\t"
 74                "pta    $+4, tr0\n"
 75                "0:\n\t"
 76                "shlri.l        %1, 1, %1\n\t"
 77                "addi   %0, 1, %0\n\t"
 78                "andi   %1, 1, %3\n\t"
 79                "beqi   %3, 1, tr0\n"
 80                "1:\n\t"
 81                "ptabs  %2, tr0\n\t"
 82                : "=r" (result), "=r" (word), "=r" (__d2), "=r" (__d3)
 83                : "0" (0L), "1" (word));
 84
 85	return result;
 86}
 87
 88#include <asm-generic/bitops/__ffs.h>
 89#endif
 90
 91#include <asm-generic/bitops/find.h>
 92#include <asm-generic/bitops/ffs.h>
 93#include <asm-generic/bitops/hweight.h>
 94#include <asm-generic/bitops/lock.h>
 95#include <asm-generic/bitops/sched.h>
 96#include <asm-generic/bitops/le.h>
 97#include <asm-generic/bitops/ext2-atomic.h>
 98#include <asm-generic/bitops/fls.h>
 99#include <asm-generic/bitops/__fls.h>
100#include <asm-generic/bitops/fls64.h>
101
102#endif /* __KERNEL__ */
103
104#endif /* __ASM_SH_BITOPS_H */
v4.6
 1#ifndef __ASM_SH_BITOPS_H
 2#define __ASM_SH_BITOPS_H
 3
 4#ifdef __KERNEL__
 5
 6#ifndef _LINUX_BITOPS_H
 7#error only <linux/bitops.h> can be included directly
 8#endif
 9
10/* For __swab32 */
11#include <asm/byteorder.h>
12#include <asm/barrier.h>
13
14#ifdef CONFIG_GUSA_RB
15#include <asm/bitops-grb.h>
16#elif defined(CONFIG_CPU_SH2A)
17#include <asm-generic/bitops/atomic.h>
18#include <asm/bitops-op32.h>
19#elif defined(CONFIG_CPU_SH4A)
20#include <asm/bitops-llsc.h>
21#else
22#include <asm-generic/bitops/atomic.h>
23#include <asm-generic/bitops/non-atomic.h>
24#endif
 
 
 
 
 
 
25
26#ifdef CONFIG_SUPERH32
27static inline unsigned long ffz(unsigned long word)
28{
29	unsigned long result;
30
31	__asm__("1:\n\t"
32		"shlr	%1\n\t"
33		"bt/s	1b\n\t"
34		" add	#1, %0"
35		: "=r" (result), "=r" (word)
36		: "0" (~0L), "1" (word)
37		: "t");
38	return result;
39}
40
41/**
42 * __ffs - find first bit in word.
43 * @word: The word to search
44 *
45 * Undefined if no bit exists, so code should check against 0 first.
46 */
47static inline unsigned long __ffs(unsigned long word)
48{
49	unsigned long result;
50
51	__asm__("1:\n\t"
52		"shlr	%1\n\t"
53		"bf/s	1b\n\t"
54		" add	#1, %0"
55		: "=r" (result), "=r" (word)
56		: "0" (~0L), "1" (word)
57		: "t");
58	return result;
59}
60#else
61static inline unsigned long ffz(unsigned long word)
62{
63	unsigned long result, __d2, __d3;
64
65        __asm__("gettr  tr0, %2\n\t"
66                "pta    $+32, tr0\n\t"
67                "andi   %1, 1, %3\n\t"
68                "beq    %3, r63, tr0\n\t"
69                "pta    $+4, tr0\n"
70                "0:\n\t"
71                "shlri.l        %1, 1, %1\n\t"
72                "addi   %0, 1, %0\n\t"
73                "andi   %1, 1, %3\n\t"
74                "beqi   %3, 1, tr0\n"
75                "1:\n\t"
76                "ptabs  %2, tr0\n\t"
77                : "=r" (result), "=r" (word), "=r" (__d2), "=r" (__d3)
78                : "0" (0L), "1" (word));
79
80	return result;
81}
82
83#include <asm-generic/bitops/__ffs.h>
84#endif
85
86#include <asm-generic/bitops/find.h>
87#include <asm-generic/bitops/ffs.h>
88#include <asm-generic/bitops/hweight.h>
89#include <asm-generic/bitops/lock.h>
90#include <asm-generic/bitops/sched.h>
91#include <asm-generic/bitops/le.h>
92#include <asm-generic/bitops/ext2-atomic.h>
93#include <asm-generic/bitops/fls.h>
94#include <asm-generic/bitops/__fls.h>
95#include <asm-generic/bitops/fls64.h>
96
97#endif /* __KERNEL__ */
98
99#endif /* __ASM_SH_BITOPS_H */