···131131 || defined (CONFIG_CPU_R5000) \132132 || defined (CONFIG_CPU_NEVADA) \133133 || defined (CONFIG_CPU_TX49XX) \134134- || defined (CONFIG_CPU_MIPS64_R1)134134+ || defined (CONFIG_CPU_MIPS64)135135#define KUSIZE _LLCONST_(0x0000010000000000) /* 2^^40 */136136#define KUSIZE_64 _LLCONST_(0x0000010000000000) /* 2^^40 */137137#define K0SIZE _LLCONST_(0x0000001000000000) /* 2^^36 */
+28-28
include/asm-mips/bitops.h
···1212#include <linux/config.h>1313#include <linux/compiler.h>1414#include <linux/types.h>1515+#include <asm/bug.h>1516#include <asm/byteorder.h> /* sigh ... */1617#include <asm/cpu-features.h>1718···547546 return 1UL & (addr[nr >> SZLONG_LOG] >> (nr & SZLONG_MASK));548547}549548550550-#ifdef CONFIG_CPU_MIPS32_R1551551-/*552552- * Return the bit position (0..31) of the most significant 1 bit in a word553553- * Returns -1 if no 1 bit exists554554- */555555-static __inline__ int __ilog2(unsigned long x)556556-{557557- int lz;558558-559559- __asm__ (560560- " .set push \n"561561- " .set mips32 \n"562562- " clz %0, %1 \n"563563- " .set pop \n"564564- : "=r" (lz)565565- : "r" (x));566566-567567- return 31 - lz;568568-}569569-#elif defined(CONFIG_CPU_MIPS64_R1)570549/*571550 * Return the bit position (0..63) of the most significant 1 bit in a word572551 * Returns -1 if no 1 bit exists573552 */574574-static __inline__ int __ilog2(unsigned long x)553553+static inline int __ilog2(unsigned long x)575554{576555 int lz;556556+557557+ if (sizeof(x) == 4) {558558+ __asm__ (559559+ " .set push \n"560560+ " .set mips32 \n"561561+ " clz %0, %1 \n"562562+ " .set pop \n"563563+ : "=r" (lz)564564+ : "r" (x));565565+566566+ return 31 - lz;567567+ }568568+569569+ BUG_ON(sizeof(x) != 8);577570578571 __asm__ (579572 " .set push \n"···579584580585 return 63 - lz;581586}582582-#endif583587584588/*585589 * __ffs - find first bit in word.···589595 */590596static inline unsigned long __ffs(unsigned long word)591597{592592-#if defined(CONFIG_CPU_MIPS32_R1) || defined(CONFIG_CPU_MIPS64_R1)598598+#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)593599 return __ilog2(word & -word);594600#else595601 int b = 0, s;···600606 s = 4; if (word << 28 != 0) s = 0; b += s; word >>= s;601607 s = 2; if (word << 30 != 0) s = 0; b += s; word >>= s;602608 s = 1; if (word << 31 != 0) s = 0; b += s;609609+610610+ return b;603611#endif604612#ifdef CONFIG_64BIT605613 s = 32; if (word << 32 != 0) s = 0; b += s; word >>= s;···610614 s = 4; if (word << 60 != 0) s = 0; b += s; word >>= s;611615 s = 2; if (word << 62 != 0) s = 0; b += s; word >>= s;612616 s = 1; if (word << 63 != 0) s = 0; b += s;613613-#endif617617+614618 return b;619619+#endif615620#endif616621}617622···652655 */653656static inline unsigned long flz(unsigned long word)654657{655655-#if defined(CONFIG_CPU_MIPS32_R1) || defined(CONFIG_CPU_MIPS64_R1)658658+#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)656659 return __ilog2(~word);657660#else658658-#if defined(CONFIG_32BIT)661661+#ifdef CONFIG_32BIT659662 int r = 31, s;660663 word = ~word;661664 s = 16; if ((word & 0xffff0000)) s = 0; r -= s; word <<= s;···663666 s = 4; if ((word & 0xf0000000)) s = 0; r -= s; word <<= s;664667 s = 2; if ((word & 0xc0000000)) s = 0; r -= s; word <<= s;665668 s = 1; if ((word & 0x80000000)) s = 0; r -= s;669669+670670+ return r;666671#endif667667-#if defined(CONFIG_64BIT)672672+#ifdef CONFIG_64BIT668673 int r = 63, s;669674 word = ~word;670675 s = 32; if ((word & 0xffffffff00000000UL)) s = 0; r -= s; word <<= s;···675676 s = 4; if ((word & 0xf000000000000000UL)) s = 0; r -= s; word <<= s;676677 s = 2; if ((word & 0xc000000000000000UL)) s = 0; r -= s; word <<= s;677678 s = 1; if ((word & 0x8000000000000000UL)) s = 0; r -= s;678678-#endif679679+679680 return r;681681+#endif680682#endif681683}682684
···7676 * These are used to make use of C type-checking..7777 */7878#ifdef CONFIG_64BIT_PHYS_ADDR7979- #ifdef CONFIG_CPU_MIPS32_R17979+ #ifdef CONFIG_CPU_MIPS328080 typedef struct { unsigned long pte_low, pte_high; } pte_t;8181 #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32))8282 #else