aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-04-27 14:24:49 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-27 14:24:49 -0700
commita9aa0e24f7ed5acf2e0e1799fb28daf928293ba1 (patch)
tree38782b91d531c8d98b81372a7c964fa2c924b90f /include
parentMerge branch 'splice' of git://brick.kernel.dk/data/git/linux-2.6-block (diff)
parent[MIPS] Fix branch emulation for floating-point exceptions. (diff)
downloadlinux-dev-a9aa0e24f7ed5acf2e0e1799fb28daf928293ba1.tar.xz
linux-dev-a9aa0e24f7ed5acf2e0e1799fb28daf928293ba1.zip
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: [MIPS] Fix branch emulation for floating-point exceptions. [MIPS] Cleanup inode->r_dev usage. [MIPS] Update MIPS defconfigs. [MIPS] Get rid of CONFIG_ADVANCED. [MIPS] Kconfig: Clarify description of CROSSCOMPILE. [MIPS] 24K LV: Add core card id. [MIPS] Sparse: fix sparse for 64-bit kernels. [MIPS] Use __ffs() instead of ffs() in ip32_irq0(). [MIPS] Fix bitops for MIPS32/MIPS64 CPUs. [MIPS] Fix ip27 build. [MIPS] Oprofile: fix sparse warning. [MIPS] Fix oprofile module unloading
Diffstat (limited to 'include')
-rw-r--r--include/asm-mips/bitops.h56
-rw-r--r--include/asm-mips/mips-boards/generic.h1
2 files changed, 25 insertions, 32 deletions
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index a1728f8c0705..d2f444537e4b 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -467,64 +467,56 @@ static inline unsigned long __ffs(unsigned long word)
}
/*
- * ffs - find first bit set.
+ * fls - find last bit set.
* @word: The word to search
*
- * Returns 1..SZLONG
- * Returns 0 if no bit exists
+ * This is defined the same way as ffs.
+ * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
*/
-
-static inline unsigned long ffs(unsigned long word)
+static inline int fls(int word)
{
- if (!word)
- return 0;
+ __asm__ ("clz %0, %1" : "=r" (word) : "r" (word));
- return __ffs(word) + 1;
+ return 32 - word;
}
-/*
- * ffz - find first zero in word.
- * @word: The word to search
- *
- * Undefined if no zero exists, so code should check against ~0UL first.
- */
-static inline unsigned long ffz(unsigned long word)
+#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPS64)
+static inline int fls64(__u64 word)
{
- return __ffs (~word);
+ __asm__ ("dclz %0, %1" : "=r" (word) : "r" (word));
+
+ return 64 - word;
}
+#else
+#include <asm-generic/bitops/fls64.h>
+#endif
/*
- * fls - find last bit set.
+ * ffs - find first bit set.
* @word: The word to search
*
- * Returns 1..SZLONG
- * Returns 0 if no bit exists
+ * This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
*/
-static inline unsigned long fls(unsigned long word)
+static inline int ffs(int word)
{
-#ifdef CONFIG_CPU_MIPS32
- __asm__ ("clz %0, %1" : "=r" (word) : "r" (word));
-
- return 32 - word;
-#endif
-
-#ifdef CONFIG_CPU_MIPS64
- __asm__ ("dclz %0, %1" : "=r" (word) : "r" (word));
+ if (!word)
+ return 0;
- return 64 - word;
-#endif
+ return fls(word & -word);
}
#else
#include <asm-generic/bitops/__ffs.h>
#include <asm-generic/bitops/ffs.h>
-#include <asm-generic/bitops/ffz.h>
#include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/fls64.h>
#endif /*defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) */
-#include <asm-generic/bitops/fls64.h>
+#include <asm-generic/bitops/ffz.h>
#include <asm-generic/bitops/find.h>
#ifdef __KERNEL__
diff --git a/include/asm-mips/mips-boards/generic.h b/include/asm-mips/mips-boards/generic.h
index 25b6ffc26623..fa8b913cc3e0 100644
--- a/include/asm-mips/mips-boards/generic.h
+++ b/include/asm-mips/mips-boards/generic.h
@@ -67,6 +67,7 @@
#define MIPS_REVISION_CORID_CORE_FPGA2 7
#define MIPS_REVISION_CORID_CORE_FPGAR2 8
#define MIPS_REVISION_CORID_CORE_FPGA3 9
+#define MIPS_REVISION_CORID_CORE_24K 10
/**** Artificial corid defines ****/
/*