From ca9d3ab5c7e12929d1c64e3618bbd30e1ed2ea70 Mon Sep 17 00:00:00 2001 From: Stefan Kristiansson Date: Sat, 26 Nov 2011 19:04:49 +0000 Subject: openrisc: Add architecture header files Signed-off-by: Stefan Kristiansson --- arch/openrisc/include/asm/bitops/ffs.h | 26 ++++++++++++++++++++++++++ arch/openrisc/include/asm/bitops/fls.h | 26 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 arch/openrisc/include/asm/bitops/ffs.h create mode 100644 arch/openrisc/include/asm/bitops/fls.h (limited to 'arch/openrisc/include/asm/bitops') diff --git a/arch/openrisc/include/asm/bitops/ffs.h b/arch/openrisc/include/asm/bitops/ffs.h new file mode 100644 index 0000000000..1de5295816 --- /dev/null +++ b/arch/openrisc/include/asm/bitops/ffs.h @@ -0,0 +1,26 @@ +/* + * OpenRISC Linux + * + * Copyright (C) 2010-2011 Jonas Bonn + * + * 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. + */ + +#ifndef __ASM_OPENRISC_FFS_H +#define __ASM_OPENRISC_FFS_H + +static inline int ffs(int x) +{ + int ret; + + __asm__ ("l.ff1 %0,%1" + : "=r" (ret) + : "r" (x)); + + return ret; +} + +#endif /* __ASM_OPENRISC_FFS_H */ diff --git a/arch/openrisc/include/asm/bitops/fls.h b/arch/openrisc/include/asm/bitops/fls.h new file mode 100644 index 0000000000..8c77c13776 --- /dev/null +++ b/arch/openrisc/include/asm/bitops/fls.h @@ -0,0 +1,26 @@ +/* + * OpenRISC Linux + * + * Copyright (C) 2010-2011 Jonas Bonn + * + * 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. + */ + +#ifndef __ASM_OPENRISC_FLS_H +#define __ASM_OPENRISC_FLS_H + +static inline int fls(int x) +{ + int ret; + + __asm__ ("l.fl1 %0,%1" + : "=r" (ret) + : "r" (x)); + + return ret; +} + +#endif /* __ASM_OPENRISC_FLS_H */ -- cgit v1.2.1