summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-08-07 06:15:23 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-08-07 13:13:31 +0200
commit38c3b2455edea648f38d3e11baf478488fd698ed (patch)
treea66280a235dfd3fdb5c0411f4efc64b2b98aec0c /arch
parent5b7b7ee5d943c6b58d9b7f974167d0105ca1b787 (diff)
parentca22ccd7cdbb6b2bd720dd7e14280ee1efa29074 (diff)
downloadbarebox-38c3b2455edea648f38d3e11baf478488fd698ed.tar.gz
barebox-38c3b2455edea648f38d3e11baf478488fd698ed.tar.xz
Merge branch 'for-next/misc'
Conflicts: lib/Makefile
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/blackfin/Kconfig1
-rw-r--r--arch/blackfin/include/asm/bitops.h361
-rw-r--r--arch/efi/Kconfig1
-rw-r--r--arch/efi/include/asm/bitops.h7
-rw-r--r--arch/mips/dts/jz4755.dtsi5
-rw-r--r--arch/mips/include/asm/bitops.h26
-rw-r--r--arch/mips/mach-xburst/Kconfig2
-rw-r--r--arch/mips/mach-xburst/include/mach/jz4750d_regs.h22
-rw-r--r--arch/mips/mach-xburst/reset-jz4750.c18
-rw-r--r--arch/nios2/Kconfig2
-rw-r--r--arch/nios2/include/asm/bitops.h32
-rw-r--r--arch/openrisc/Kconfig2
-rw-r--r--arch/openrisc/include/asm/bitops.h29
-rw-r--r--arch/ppc/Kconfig2
-rw-r--r--arch/ppc/include/asm/bitops.h49
-rw-r--r--arch/sandbox/include/asm/bitops.h25
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/include/asm/bitops.h32
-rw-r--r--arch/x86/include/asm/types.h2
20 files changed, 149 insertions, 472 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a3208d27e4..9f34e1089b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2,6 +2,8 @@ config ARM
bool
select HAS_KALLSYMS
select HAS_MODULES
+ select HAS_DMA
+ select HAS_CACHE
select HAVE_CONFIGURABLE_TEXT_BASE
select HAVE_PBL_IMAGE
select HAVE_IMAGE_COMPRESSION
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index bea9f51e1e..6233614e19 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -5,6 +5,7 @@ config BLACKFIN
select HAS_MODULES
select HAVE_CONFIGURABLE_MEMORY_LAYOUT
select HAVE_CONFIGURABLE_TEXT_BASE
+ select GENERIC_FIND_NEXT_BIT
default y
config BF561
diff --git a/arch/blackfin/include/asm/bitops.h b/arch/blackfin/include/asm/bitops.h
index 4ab1471522..e77ab83202 100644
--- a/arch/blackfin/include/asm/bitops.h
+++ b/arch/blackfin/include/asm/bitops.h
@@ -1,11 +1,4 @@
/*
- * barebox - bitops.h Routines for bit operations
- *
- * Copyright (c) 2005 blackfin.uclinux.org
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
@@ -16,349 +9,27 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
+ *
*/
-#ifndef _BLACKFIN_BITOPS_H
-#define _BLACKFIN_BITOPS_H
-
-/*
- * Copyright 1992, Linus Torvalds.
- */
-
-#include <asm/byteorder.h>
-#include <asm/system.h>
-
-#ifdef __KERNEL__
-/*
- * Function prototypes to keep gcc -Wall happy
- */
-
-/*
- * The __ functions are not atomic
- */
-
-/*
- * ffz = Find First Zero in word. Undefined if no zero exists,
- * so code should check against ~0UL first..
- */
-static __inline__ unsigned long ffz(unsigned long word)
-{
- unsigned long result = 0;
-
- while (word & 1) {
- result++;
- word >>= 1;
- }
- return result;
-}
-
-static __inline__ void set_bit(int nr, volatile void *addr)
-{
- int *a = (int *) addr;
- int mask;
- unsigned long flags;
-
- a += nr >> 5;
- mask = 1 << (nr & 0x1f);
- save_and_cli(flags);
- *a |= mask;
- restore_flags(flags);
-}
-
-static __inline__ void __set_bit(int nr, volatile void *addr)
-{
- int *a = (int *) addr;
- int mask;
-
- a += nr >> 5;
- mask = 1 << (nr & 0x1f);
- *a |= mask;
-}
-
-/*
- * clear_bit() doesn't provide any barrier for the compiler.
- */
-#define smp_mb__before_clear_bit() barrier()
-#define smp_mb__after_clear_bit() barrier()
-
-static __inline__ void clear_bit(int nr, volatile void *addr)
-{
- int *a = (int *) addr;
- int mask;
- unsigned long flags;
-
- a += nr >> 5;
- mask = 1 << (nr & 0x1f);
- save_and_cli(flags);
- *a &= ~mask;
- restore_flags(flags);
-}
-
-static __inline__ void change_bit(int nr, volatile void *addr)
-{
- int mask, flags;
- unsigned long *ADDR = (unsigned long *) addr;
-
- ADDR += nr >> 5;
- mask = 1 << (nr & 31);
- save_and_cli(flags);
- *ADDR ^= mask;
- restore_flags(flags);
-}
-
-static __inline__ void __change_bit(int nr, volatile void *addr)
-{
- int mask;
- unsigned long *ADDR = (unsigned long *) addr;
-
- ADDR += nr >> 5;
- mask = 1 << (nr & 31);
- *ADDR ^= mask;
-}
-
-static __inline__ int test_and_set_bit(int nr, volatile void *addr)
-{
- int mask, retval;
- volatile unsigned int *a = (volatile unsigned int *) addr;
- unsigned long flags;
-
- a += nr >> 5;
- mask = 1 << (nr & 0x1f);
- save_and_cli(flags);
- retval = (mask & *a) != 0;
- *a |= mask;
- restore_flags(flags);
-
- return retval;
-}
-
-static __inline__ int __test_and_set_bit(int nr, volatile void *addr)
-{
- int mask, retval;
- volatile unsigned int *a = (volatile unsigned int *) addr;
-
- a += nr >> 5;
- mask = 1 << (nr & 0x1f);
- retval = (mask & *a) != 0;
- *a |= mask;
- return retval;
-}
-
-static __inline__ int test_and_clear_bit(int nr, volatile void *addr)
-{
- int mask, retval;
- volatile unsigned int *a = (volatile unsigned int *) addr;
- unsigned long flags;
-
- a += nr >> 5;
- mask = 1 << (nr & 0x1f);
- save_and_cli(flags);
- retval = (mask & *a) != 0;
- *a &= ~mask;
- restore_flags(flags);
-
- return retval;
-}
-
-static __inline__ int __test_and_clear_bit(int nr, volatile void *addr)
-{
- int mask, retval;
- volatile unsigned int *a = (volatile unsigned int *) addr;
-
- a += nr >> 5;
- mask = 1 << (nr & 0x1f);
- retval = (mask & *a) != 0;
- *a &= ~mask;
- return retval;
-}
-
-static __inline__ int test_and_change_bit(int nr, volatile void *addr)
-{
- int mask, retval;
- volatile unsigned int *a = (volatile unsigned int *) addr;
- unsigned long flags;
-
- a += nr >> 5;
- mask = 1 << (nr & 0x1f);
- save_and_cli(flags);
- retval = (mask & *a) != 0;
- *a ^= mask;
- restore_flags(flags);
-
- return retval;
-}
-
-static __inline__ int __test_and_change_bit(int nr, volatile void *addr)
-{
- int mask, retval;
- volatile unsigned int *a = (volatile unsigned int *) addr;
-
- a += nr >> 5;
- mask = 1 << (nr & 0x1f);
- retval = (mask & *a) != 0;
- *a ^= mask;
- return retval;
-}
-
-/*
- * This routine doesn't need to be atomic.
- */
-static __inline__ int __constant_test_bit(int nr,
- const volatile void *addr)
-{
- return ((1UL << (nr & 31)) &
- (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
-}
-
-static __inline__ int __test_bit(int nr, volatile void *addr)
-{
- int *a = (int *) addr;
- int mask;
-
- a += nr >> 5;
- mask = 1 << (nr & 0x1f);
- return ((mask & *a) != 0);
-}
-
-#define test_bit(nr,addr) \
-(__builtin_constant_p(nr) ? \
- __constant_test_bit((nr),(addr)) : \
- __test_bit((nr),(addr)))
-
-#define find_first_zero_bit(addr, size) \
- find_next_zero_bit((addr), (size), 0)
-
-static __inline__ int find_next_zero_bit(void *addr, int size, int offset)
-{
- unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
- unsigned long result = offset & ~31UL;
- unsigned long tmp;
-
- if (offset >= size)
- return size;
- size -= result;
- offset &= 31UL;
- if (offset) {
- tmp = *(p++);
- tmp |= ~0UL >> (32 - offset);
- if (size < 32)
- goto found_first;
- if (~tmp)
- goto found_middle;
- size -= 32;
- result += 32;
- }
- while (size & ~31UL) {
- if (~(tmp = *(p++)))
- goto found_middle;
- result += 32;
- size -= 32;
- }
- if (!size)
- return result;
- tmp = *p;
-
- found_first:
- tmp |= ~0UL >> size;
- found_middle:
- return result + ffz(tmp);
-}
+#ifndef _ASM_BITOPS_H_
+#define _ASM_BITOPS_H_
#include <asm-generic/bitops/__ffs.h>
#include <asm-generic/bitops/__fls.h>
#include <asm-generic/bitops/ffs.h>
#include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/ffz.h>
#include <asm-generic/bitops/hweight.h>
-
-static __inline__ int ext2_set_bit(int nr, volatile void *addr)
-{
- int mask, retval;
- unsigned long flags;
- volatile unsigned char *ADDR = (unsigned char *) addr;
-
- ADDR += nr >> 3;
- mask = 1 << (nr & 0x07);
- save_and_cli(flags);
- retval = (mask & *ADDR) != 0;
- *ADDR |= mask;
- restore_flags(flags);
- return retval;
-}
-
-static __inline__ int ext2_clear_bit(int nr, volatile void *addr)
-{
- int mask, retval;
- unsigned long flags;
- volatile unsigned char *ADDR = (unsigned char *) addr;
-
- ADDR += nr >> 3;
- mask = 1 << (nr & 0x07);
- save_and_cli(flags);
- retval = (mask & *ADDR) != 0;
- *ADDR &= ~mask;
- restore_flags(flags);
- return retval;
-}
-
-static __inline__ int ext2_test_bit(int nr, const volatile void *addr)
-{
- int mask;
- const volatile unsigned char *ADDR = (const unsigned char *) addr;
-
- ADDR += nr >> 3;
- mask = 1 << (nr & 0x07);
- return ((mask & *ADDR) != 0);
-}
-
-#define ext2_find_first_zero_bit(addr, size) \
- ext2_find_next_zero_bit((addr), (size), 0)
-
-static __inline__ unsigned long ext2_find_next_zero_bit(void *addr,
- unsigned long size,
- unsigned long
- offset)
-{
- unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
- unsigned long result = offset & ~31UL;
- unsigned long tmp;
-
- if (offset >= size)
- return size;
- size -= result;
- offset &= 31UL;
- if (offset) {
- tmp = *(p++);
- tmp |= ~0UL >> (32 - offset);
- if (size < 32)
- goto found_first;
- if (~tmp)
- goto found_middle;
- size -= 32;
- result += 32;
- }
- while (size & ~31UL) {
- if (~(tmp = *(p++)))
- goto found_middle;
- result += 32;
- size -= 32;
- }
- if (!size)
- return result;
- tmp = *p;
-
- found_first:
- tmp |= ~0UL >> size;
- found_middle:
- return result + ffz(tmp);
-}
-
-/* Bitmap functions for the minix filesystem. */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
-#define minix_test_bit(nr,addr) test_bit(nr,addr)
-#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
-
-#endif
-
-#endif
+#include <asm-generic/bitops/fls64.h>
+#include <asm-generic/bitops/find.h>
+#include <asm-generic/bitops/ops.h>
+
+#define set_bit(x, y) __set_bit(x, y)
+#define clear_bit(x, y) __clear_bit(x, y)
+#define change_bit(x, y) __change_bit(x, y)
+#define test_and_set_bit(x, y) __test_and_set_bit(x, y)
+#define test_and_clear_bit(x, y) __test_and_clear_bit(x, y)
+#define test_and_change_bit(x, y) __test_and_change_bit(x, y)
+
+#endif /* _ASM_BITOPS_H_ */
diff --git a/arch/efi/Kconfig b/arch/efi/Kconfig
index 71ac1c74e8..26fecaa392 100644
--- a/arch/efi/Kconfig
+++ b/arch/efi/Kconfig
@@ -7,6 +7,7 @@ config ARCH_EFI
select EFI_GUID
select EFI_DEVICEPATH
select PRINTF_UUID
+ select GENERIC_FIND_NEXT_BIT
config ARCH_TEXT_BASE
hex
diff --git a/arch/efi/include/asm/bitops.h b/arch/efi/include/asm/bitops.h
index 94646d4d0d..447023da63 100644
--- a/arch/efi/include/asm/bitops.h
+++ b/arch/efi/include/asm/bitops.h
@@ -12,4 +12,11 @@
#include <asm-generic/bitops/hweight.h>
#include <asm-generic/bitops/ops.h>
+#define set_bit(x, y) __set_bit(x, y)
+#define clear_bit(x, y) __clear_bit(x, y)
+#define change_bit(x, y) __change_bit(x, y)
+#define test_and_set_bit(x, y) __test_and_set_bit(x, y)
+#define test_and_clear_bit(x, y) __test_and_clear_bit(x, y)
+#define test_and_change_bit(x, y) __test_and_change_bit(x, y)
+
#endif
diff --git a/arch/mips/dts/jz4755.dtsi b/arch/mips/dts/jz4755.dtsi
index 0e655b65a1..718463548b 100644
--- a/arch/mips/dts/jz4755.dtsi
+++ b/arch/mips/dts/jz4755.dtsi
@@ -8,6 +8,11 @@
#size-cells = <1>;
ranges;
+ wdt: wdt@b0002000 {
+ compatible = "ingenic,jz4740-wdt";
+ reg = <0xb0002000 0x10>;
+ };
+
serial0: serial@b0030000 {
compatible = "ingenic,jz4740-uart";
reg = <0xb0030000 0x20>;
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h
index ebf8cf04d3..e77ab83202 100644
--- a/arch/mips/include/asm/bitops.h
+++ b/arch/mips/include/asm/bitops.h
@@ -12,20 +12,24 @@
*
*/
-/**
- * @file
- * @brief mips bit operations
- *
- * This file is required only to make all sources happy including
- * 'linux/bitops.h'
- */
-
-#ifndef _ASM_MIPS_BITOPS_H_
-#define _ASM_MIPS_BITOPS_H_
+#ifndef _ASM_BITOPS_H_
+#define _ASM_BITOPS_H_
#include <asm-generic/bitops/__ffs.h>
#include <asm-generic/bitops/__fls.h>
#include <asm-generic/bitops/ffs.h>
#include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/ffz.h>
+#include <asm-generic/bitops/hweight.h>
+#include <asm-generic/bitops/fls64.h>
+#include <asm-generic/bitops/find.h>
+#include <asm-generic/bitops/ops.h>
+
+#define set_bit(x, y) __set_bit(x, y)
+#define clear_bit(x, y) __clear_bit(x, y)
+#define change_bit(x, y) __change_bit(x, y)
+#define test_and_set_bit(x, y) __test_and_set_bit(x, y)
+#define test_and_clear_bit(x, y) __test_and_clear_bit(x, y)
+#define test_and_change_bit(x, y) __test_and_change_bit(x, y)
-#endif /* _ASM_MIPS_BITOPS_H_ */
+#endif /* _ASM_BITOPS_H_ */
diff --git a/arch/mips/mach-xburst/Kconfig b/arch/mips/mach-xburst/Kconfig
index 706d59249b..f7b8470cb8 100644
--- a/arch/mips/mach-xburst/Kconfig
+++ b/arch/mips/mach-xburst/Kconfig
@@ -6,6 +6,8 @@ config ARCH_TEXT_BASE
config CPU_JZ4755
bool
+ select WATCHDOG
+ select WATCHDOG_JZ4740
choice
prompt "Board type"
diff --git a/arch/mips/mach-xburst/include/mach/jz4750d_regs.h b/arch/mips/mach-xburst/include/mach/jz4750d_regs.h
index 7a3daadb18..396c823a1f 100644
--- a/arch/mips/mach-xburst/include/mach/jz4750d_regs.h
+++ b/arch/mips/mach-xburst/include/mach/jz4750d_regs.h
@@ -59,28 +59,6 @@
#define TCU_OSTCSR_PCK_EN (1 << 0) /* select pclk as the timer clock input */
/*************************************************************************
- * WDT (WatchDog Timer)
- *************************************************************************/
-#define WDT_TDR (WDT_BASE + 0x00)
-#define WDT_TCER (WDT_BASE + 0x04)
-#define WDT_TCNT (WDT_BASE + 0x08)
-#define WDT_TCSR (WDT_BASE + 0x0c)
-
-#define WDT_TCSR_PRESCALE_BIT 3
-#define WDT_TCSR_PRESCALE_MASK (0x7 << WDT_TCSR_PRESCALE_BIT)
- #define WDT_TCSR_PRESCALE1 (0x0 << WDT_TCSR_PRESCALE_BIT)
- #define WDT_TCSR_PRESCALE4 (0x1 << WDT_TCSR_PRESCALE_BIT)
- #define WDT_TCSR_PRESCALE16 (0x2 << WDT_TCSR_PRESCALE_BIT)
- #define WDT_TCSR_PRESCALE64 (0x3 << WDT_TCSR_PRESCALE_BIT)
- #define WDT_TCSR_PRESCALE256 (0x4 << WDT_TCSR_PRESCALE_BIT)
- #define WDT_TCSR_PRESCALE1024 (0x5 << WDT_TCSR_PRESCALE_BIT)
-#define WDT_TCSR_EXT_EN (1 << 2)
-#define WDT_TCSR_RTC_EN (1 << 1)
-#define WDT_TCSR_PCK_EN (1 << 0)
-
-#define WDT_TCER_TCEN (1 << 0)
-
-/*************************************************************************
* RTC
*************************************************************************/
#define RTC_RCR (RTC_BASE + 0x00) /* RTC Control Register */
diff --git a/arch/mips/mach-xburst/reset-jz4750.c b/arch/mips/mach-xburst/reset-jz4750.c
index 8f33672280..25830f130e 100644
--- a/arch/mips/mach-xburst/reset-jz4750.c
+++ b/arch/mips/mach-xburst/reset-jz4750.c
@@ -24,8 +24,6 @@
#include <io.h>
#include <mach/jz4750d_regs.h>
-#define JZ_EXTAL 24000000
-
static void __noreturn jz4750d_halt(void)
{
while (1) {
@@ -39,22 +37,6 @@ static void __noreturn jz4750d_halt(void)
unreachable();
}
-void __noreturn reset_cpu(ulong addr)
-{
- __raw_writew(WDT_TCSR_PRESCALE4 | WDT_TCSR_EXT_EN, (u16 *)WDT_TCSR);
- __raw_writew(0, (u16 *)WDT_TCNT);
-
- /* reset after 4ms */
- __raw_writew(JZ_EXTAL / 1000, (u16 *)WDT_TDR);
- /* enable wdt clock */
- __raw_writel(TCU_TSCR_WDTSC, (u32 *)TCU_TSCR);
- /* start wdt */
- __raw_writeb(WDT_TCER_TCEN, (u8 *)WDT_TCER);
-
- unreachable();
-}
-EXPORT_SYMBOL(reset_cpu);
-
void __noreturn poweroff()
{
u32 ctrl;
diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
index 116daa9bb9..199540ba74 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -2,7 +2,9 @@ config NIOS2
bool
select HAS_KALLSYMS
select HAS_MODULES
+ select HAS_CACHE
select HAVE_CONFIGURABLE_MEMORY_LAYOUT
+ select GENERIC_FIND_NEXT_BIT
default y
config ARCH_TEXT_BASE
diff --git a/arch/nios2/include/asm/bitops.h b/arch/nios2/include/asm/bitops.h
index 07128451c1..e77ab83202 100644
--- a/arch/nios2/include/asm/bitops.h
+++ b/arch/nios2/include/asm/bitops.h
@@ -1,9 +1,35 @@
-#ifndef _ASM_BITOPS_H
-#define _ASM_BITOPS_H
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ *
+ */
+
+#ifndef _ASM_BITOPS_H_
+#define _ASM_BITOPS_H_
#include <asm-generic/bitops/__ffs.h>
#include <asm-generic/bitops/__fls.h>
#include <asm-generic/bitops/ffs.h>
#include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/ffz.h>
+#include <asm-generic/bitops/hweight.h>
+#include <asm-generic/bitops/fls64.h>
+#include <asm-generic/bitops/find.h>
+#include <asm-generic/bitops/ops.h>
+
+#define set_bit(x, y) __set_bit(x, y)
+#define clear_bit(x, y) __clear_bit(x, y)
+#define change_bit(x, y) __change_bit(x, y)
+#define test_and_set_bit(x, y) __test_and_set_bit(x, y)
+#define test_and_clear_bit(x, y) __test_and_clear_bit(x, y)
+#define test_and_change_bit(x, y) __test_and_change_bit(x, y)
-#endif /* _ASM_BITOPS_H */
+#endif /* _ASM_BITOPS_H_ */
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index d8d4ee9b6d..23c6a71f3a 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -1,7 +1,9 @@
config OPENRISC
bool
+ select HAS_CACHE
select HAVE_CONFIGURABLE_MEMORY_LAYOUT
select HAVE_DEFAULT_ENVIRONMENT_NEW
+ select GENERIC_FIND_NEXT_BIT
default y
# not used
diff --git a/arch/openrisc/include/asm/bitops.h b/arch/openrisc/include/asm/bitops.h
index fa57901476..e77ab83202 100644
--- a/arch/openrisc/include/asm/bitops.h
+++ b/arch/openrisc/include/asm/bitops.h
@@ -1,6 +1,4 @@
/*
- * (C) Copyright 2011, Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
@@ -11,14 +9,27 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
+ *
*/
-#ifndef __ASM_OPENRISC_BITOPS_H
-#define __ASM_OPENRISC_BITOPS_H
+#ifndef _ASM_BITOPS_H_
+#define _ASM_BITOPS_H_
+
+#include <asm-generic/bitops/__ffs.h>
+#include <asm-generic/bitops/__fls.h>
+#include <asm-generic/bitops/ffs.h>
+#include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/ffz.h>
+#include <asm-generic/bitops/hweight.h>
+#include <asm-generic/bitops/fls64.h>
+#include <asm-generic/bitops/find.h>
+#include <asm-generic/bitops/ops.h>
-#define PLATFORM_FLS
-#include <asm/bitops/fls.h>
-#define PLATFORM_FFS
-#include <asm/bitops/ffs.h>
+#define set_bit(x, y) __set_bit(x, y)
+#define clear_bit(x, y) __clear_bit(x, y)
+#define change_bit(x, y) __change_bit(x, y)
+#define test_and_set_bit(x, y) __test_and_set_bit(x, y)
+#define test_and_clear_bit(x, y) __test_and_clear_bit(x, y)
+#define test_and_change_bit(x, y) __test_and_change_bit(x, y)
-#endif /* __ASM_GENERIC_BITOPS_H */
+#endif /* _ASM_BITOPS_H_ */
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index eaf60e0fe4..97e6c00689 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -3,6 +3,8 @@ config PPC
select HAVE_CONFIGURABLE_TEXT_BASE
select HAS_KALLSYMS
select HAS_MODULES
+ select HAS_CACHE
+ select GENERIC_FIND_NEXT_BIT
select OFTREE
default y
diff --git a/arch/ppc/include/asm/bitops.h b/arch/ppc/include/asm/bitops.h
index eea9e0c430..c4ed2de65f 100644
--- a/arch/ppc/include/asm/bitops.h
+++ b/arch/ppc/include/asm/bitops.h
@@ -153,6 +153,11 @@ extern __inline__ int ffz(unsigned int x)
return __ilog2(x & -x);
}
+static __inline__ int __ffs(unsigned long x)
+{
+ return __ilog2(x & -x);
+}
+
/*
* fls: find last (most-significant) bit set.
* Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
@@ -182,49 +187,7 @@ extern __inline__ int ffs(int x)
#endif /* __KERNEL__ */
-/*
- * This implementation of find_{first,next}_zero_bit was stolen from
- * Linus' asm-alpha/bitops.h.
- */
-#define find_first_zero_bit(addr, size) \
- find_next_zero_bit((addr), (size), 0)
-
-extern __inline__ unsigned long find_next_zero_bit(void * addr,
- unsigned long size, unsigned long offset)
-{
- unsigned int * p = ((unsigned int *) addr) + (offset >> 5);
- unsigned int result = offset & ~31UL;
- unsigned int tmp;
-
- if (offset >= size)
- return size;
- size -= result;
- offset &= 31UL;
- if (offset) {
- tmp = *p++;
- tmp |= ~0UL >> (32-offset);
- if (size < 32)
- goto found_first;
- if (tmp != ~0U)
- goto found_middle;
- size -= 32;
- result += 32;
- }
- while (size >= 32) {
- if ((tmp = *p++) != ~0U)
- goto found_middle;
- result += 32;
- size -= 32;
- }
- if (!size)
- return result;
- tmp = *p;
-found_first:
- tmp |= ~0UL << size;
-found_middle:
- return result + ffz(tmp);
-}
-
+#include <asm-generic/bitops/find.h>
#define _EXT2_HAVE_ASM_BITOPS_
diff --git a/arch/sandbox/include/asm/bitops.h b/arch/sandbox/include/asm/bitops.h
index 447023da63..e77ab83202 100644
--- a/arch/sandbox/include/asm/bitops.h
+++ b/arch/sandbox/include/asm/bitops.h
@@ -1,15 +1,28 @@
-#ifndef _SANDBOX_BITOPS_H
-#define _SANDBOX_BITOPS_H
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ *
+ */
+
+#ifndef _ASM_BITOPS_H_
+#define _ASM_BITOPS_H_
-/* nothing but the defaults.. */
#include <asm-generic/bitops/__ffs.h>
#include <asm-generic/bitops/__fls.h>
#include <asm-generic/bitops/ffs.h>
#include <asm-generic/bitops/fls.h>
#include <asm-generic/bitops/ffz.h>
-#include <asm-generic/bitops/find.h>
-#include <asm-generic/bitops/fls64.h>
#include <asm-generic/bitops/hweight.h>
+#include <asm-generic/bitops/fls64.h>
+#include <asm-generic/bitops/find.h>
#include <asm-generic/bitops/ops.h>
#define set_bit(x, y) __set_bit(x, y)
@@ -19,4 +32,4 @@
#define test_and_clear_bit(x, y) __test_and_clear_bit(x, y)
#define test_and_change_bit(x, y) __test_and_change_bit(x, y)
-#endif
+#endif /* _ASM_BITOPS_H_ */
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d8d7f0e651..346640dcda 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -20,6 +20,7 @@ config X86
select HAS_MODULES
select HAVE_CONFIGURABLE_MEMORY_LAYOUT
select HAVE_CONFIGURABLE_TEXT_BASE
+ select GENERIC_FIND_NEXT_BIT
default y
config X86_BOOTLOADER
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
index d741e44d4a..e77ab83202 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -12,22 +12,24 @@
*
*/
-/**
- * @file
- * @brief x86 bit operations
- *
- * This file is required only to make all sources happy including
- * 'linux/bitops.h'
- */
-
-#ifndef _ASM_X86_BITOPS_H_
-#define _ASM_X86_BITOPS_H_
+#ifndef _ASM_BITOPS_H_
+#define _ASM_BITOPS_H_
-#define BITS_PER_LONG 32
-
-#include <asm-generic/bitops/__fls.h>
#include <asm-generic/bitops/__ffs.h>
-#include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/__fls.h>
#include <asm-generic/bitops/ffs.h>
+#include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/ffz.h>
+#include <asm-generic/bitops/hweight.h>
+#include <asm-generic/bitops/fls64.h>
+#include <asm-generic/bitops/find.h>
+#include <asm-generic/bitops/ops.h>
+
+#define set_bit(x, y) __set_bit(x, y)
+#define clear_bit(x, y) __clear_bit(x, y)
+#define change_bit(x, y) __change_bit(x, y)
+#define test_and_set_bit(x, y) __test_and_set_bit(x, y)
+#define test_and_clear_bit(x, y) __test_and_clear_bit(x, y)
+#define test_and_change_bit(x, y) __test_and_change_bit(x, y)
-#endif /* _ASM_X86_BITOPS_H_ */
+#endif /* _ASM_BITOPS_H_ */
diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
index d473405ff9..b3fd1f644b 100644
--- a/arch/x86/include/asm/types.h
+++ b/arch/x86/include/asm/types.h
@@ -41,6 +41,8 @@ typedef unsigned int u32;
typedef signed long long s64;
typedef unsigned long long u64;
+#define BITS_PER_LONG 32
+
#endif /* __ASSEMBLY__ */
#endif /* __ASM_X86_TYPES_H */