asm-generic headers, v4
Subsystems (19)
Arnd Bergmann
maintainercover asm-generic headers, v4
This is the complete set of new asm-generic header files, with all the comments that I have received addressed. I'd like to merge this early in the 2.6.31 cycle, so that the and score architecture port can use it right away and microblaze can convert early.
I have kept the changes to existing architectures to the bare minimum here, but have separate changesets for microblaze and x86 to remove all arch specific header files that become obsolete after adding generic versions.
Stephen, can you add git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic next to linux-next?
Should this go to Linus directly, or does anyone already maintain a tree to collect changes this this area?
Thanks everone for the comments so far, I hope I'm getting close to a mergeable state now. I'm starting to use git-send-email now as well, hopefully this will be the end of screwed-up email headers for me.
Arnd <><
---
asm-generic: rename termios.h, signal.h and mman.h
asm-generic: introduce asm/bitsperlong.h
asm-generic: add generic sysv ipc headers
asm-generic: add generic ABI headers
asm-generic: add a generic unistd.h
asm-generic: rename atomic.h to atomic-long.h
asm-generic: rename page.h and uaccess.h
asm-generic: make pci.h usable directly
asm-generic: make bitops.h usable
asm-generic: add generic versions of common headers
asm-generic: add legacy I/O header files
asm-generic: add generic atomic.h and io.h
asm-generic: add generic NOMMU versions of some headers
asm-generic: add a generic uaccess.h
asm-generic: Add missing generic tlb_flush definition add generic lib/checksum.c
arch/alpha/include/asm/atomic.h | 2 +-
arch/alpha/include/asm/bitsperlong.h | 8 +
arch/alpha/include/asm/page.h | 2 +-
arch/alpha/include/asm/signal.h | 2 +-
arch/alpha/include/asm/types.h | 3 -
arch/arm/include/asm/atomic.h | 2 +-
arch/arm/include/asm/bitsperlong.h | 1 +
arch/arm/include/asm/mman.h | 2 +-
arch/arm/include/asm/page.h | 2 +-
arch/arm/include/asm/signal.h | 2 +-
arch/avr32/include/asm/atomic.h | 2 +-
arch/avr32/include/asm/bitsperlong.h | 1 +
arch/avr32/include/asm/mman.h | 2 +-
arch/avr32/include/asm/signal.h | 2 +-
arch/avr32/include/asm/termios.h | 2 +-
arch/blackfin/include/asm/atomic.h | 2 +-
arch/blackfin/include/asm/bitsperlong.h | 1 +
arch/blackfin/include/asm/page.h | 2 +-
arch/blackfin/include/asm/signal.h | 2 +-
arch/cris/include/asm/atomic.h | 2 +-
arch/cris/include/asm/bitsperlong.h | 1 +
arch/cris/include/asm/mman.h | 2 +-
arch/cris/include/asm/page.h | 2 +-
arch/cris/include/asm/signal.h | 2 +-
arch/frv/include/asm/atomic.h | 2 +-
arch/frv/include/asm/bitsperlong.h | 1 +
arch/frv/include/asm/mman.h | 2 +-
arch/frv/include/asm/page.h | 2 +-
arch/frv/include/asm/pci.h | 13 +-
arch/frv/include/asm/termios.h | 2 +-
arch/h8300/include/asm/atomic.h | 2 +-
arch/h8300/include/asm/bitsperlong.h | 1 +
arch/h8300/include/asm/mman.h | 2 +-
arch/h8300/include/asm/page.h | 2 +-
arch/h8300/include/asm/signal.h | 2 +-
arch/ia64/include/asm/atomic.h | 2 +-
arch/ia64/include/asm/bitsperlong.h | 8 +
arch/ia64/include/asm/mman.h | 2 +-
arch/ia64/include/asm/signal.h | 2 +-
arch/ia64/include/asm/types.h | 7 -
arch/m32r/include/asm/atomic.h | 2 +-
arch/m32r/include/asm/bitsperlong.h | 1 +
arch/m32r/include/asm/mman.h | 2 +-
arch/m32r/include/asm/page.h | 2 +-
arch/m32r/include/asm/pci.h | 2 -
arch/m32r/include/asm/signal.h | 2 +-
arch/m68k/include/asm/atomic_mm.h | 2 +-
arch/m68k/include/asm/atomic_no.h | 2 +-
arch/m68k/include/asm/bitsperlong.h | 1 +
arch/m68k/include/asm/mman.h | 2 +-
arch/m68k/include/asm/page_mm.h | 2 +-
arch/m68k/include/asm/page_no.h | 2 +-
arch/m68k/include/asm/signal.h | 2 +-
arch/microblaze/include/asm/atomic.h | 2 +-
arch/microblaze/include/asm/bitsperlong.h | 1 +
arch/microblaze/include/asm/page.h | 2 +-
arch/microblaze/include/asm/signal.h | 2 +-
arch/microblaze/include/asm/termios.h | 2 +-
arch/mips/include/asm/atomic.h | 2 +-
arch/mips/include/asm/bitsperlong.h | 8 +
arch/mips/include/asm/page.h | 2 +-
arch/mips/include/asm/signal.h | 2 +-
arch/mips/include/asm/types.h | 3 -
arch/mn10300/include/asm/atomic.h | 2 +-
arch/mn10300/include/asm/bitsperlong.h | 1 +
arch/mn10300/include/asm/mman.h | 2 +-
arch/mn10300/include/asm/signal.h | 2 +-
arch/parisc/include/asm/atomic.h | 2 +-
arch/parisc/include/asm/bitsperlong.h | 20 +
arch/parisc/include/asm/page.h | 2 +-
arch/parisc/include/asm/types.h | 8 -
arch/parisc/include/asm/uaccess.h | 2 +-
arch/powerpc/include/asm/atomic.h | 2 +-
arch/powerpc/include/asm/bitsperlong.h | 12 +
arch/powerpc/include/asm/mman.h | 2 +-
arch/powerpc/include/asm/page_32.h | 2 +-
arch/powerpc/include/asm/page_64.h | 2 +-
arch/powerpc/include/asm/signal.h | 2 +-
arch/powerpc/include/asm/termios.h | 2 +-
arch/powerpc/include/asm/types.h | 9 -
arch/s390/include/asm/atomic.h | 2 +-
arch/s390/include/asm/bitsperlong.h | 13 +
arch/s390/include/asm/mman.h | 2 +-
arch/s390/include/asm/page.h | 2 +-
arch/s390/include/asm/signal.h | 2 +-
arch/s390/include/asm/termios.h | 2 +-
arch/s390/include/asm/types.h | 6 -
arch/sh/include/asm/atomic.h | 2 +-
arch/sh/include/asm/bitsperlong.h | 1 +
arch/sh/include/asm/mman.h | 2 +-
arch/sh/include/asm/page.h | 2 +-
arch/sh/include/asm/signal.h | 2 +-
arch/sparc/include/asm/atomic_32.h | 2 +-
arch/sparc/include/asm/atomic_64.h | 2 +-
arch/sparc/include/asm/bitsperlong.h | 13 +
arch/sparc/include/asm/mman.h | 2 +-
arch/sparc/include/asm/page_32.h | 2 +-
arch/sparc/include/asm/page_64.h | 2 +-
arch/sparc/include/asm/signal.h | 2 +-
arch/sparc/include/asm/types.h | 4 -
arch/sparc/include/asm/uaccess_64.h | 2 +-
arch/um/include/asm/page.h | 2 +-
arch/x86/include/asm/atomic_32.h | 2 +-
arch/x86/include/asm/atomic_64.h | 2 +-
arch/x86/include/asm/bitsperlong.h | 13 +
arch/x86/include/asm/mman.h | 2 +-
arch/x86/include/asm/page.h | 2 +-
arch/x86/include/asm/signal.h | 2 +-
arch/x86/include/asm/types.h | 6 -
arch/xtensa/include/asm/atomic.h | 2 +-
arch/xtensa/include/asm/bitsperlong.h | 1 +
arch/xtensa/include/asm/page.h | 2 +-
include/asm-generic/Kbuild | 22 +
include/asm-generic/Kbuild.asm | 1 +
include/asm-generic/{atomic.h => atomic-long.h} | 6 +-
include/asm-generic/atomic.h | 423 ++++------
include/asm-generic/auxvec.h | 8 +
include/asm-generic/bitops.h | 24 +-
include/asm-generic/bitops/atomic.h | 1 +
include/asm-generic/bitsperlong.h | 32 +
include/asm-generic/bugs.h | 10 +
include/asm-generic/cache.h | 12 +
include/asm-generic/cacheflush.h | 30 +
include/asm-generic/checksum.h | 79 ++
include/asm-generic/current.h | 9 +
include/asm-generic/delay.h | 9 +
include/asm-generic/dma.h | 15 +
include/asm-generic/fb.h | 12 +
include/asm-generic/{page.h => getorder.h} | 8 +-
include/asm-generic/hardirq.h | 34 +
include/asm-generic/hw_irq.h | 9 +
include/asm-generic/int-l64.h | 2 +
include/asm-generic/int-ll64.h | 2 +
include/asm-generic/io.h | 300 +++++++
include/asm-generic/ioctls.h | 110 +++
include/asm-generic/ipcbuf.h | 33 +
include/asm-generic/irq.h | 18 +
include/asm-generic/irqflags.h | 72 ++
include/asm-generic/kmap_types.h | 29 +
include/asm-generic/linkage.h | 8 +
include/asm-generic/{mman.h => mman-common.h} | 6 +-
include/asm-generic/mman.h | 59 +-
include/asm-generic/mmu.h | 15 +
include/asm-generic/mmu_context.h | 45 +
include/asm-generic/module.h | 22 +
include/asm-generic/msgbuf.h | 47 ++
include/asm-generic/mutex.h | 9 +
include/asm-generic/page.h | 123 +++-
include/asm-generic/param.h | 24 +
include/asm-generic/parport.h | 23 +
include/asm-generic/pci.h | 8 +
include/asm-generic/pgalloc.h | 12 +
include/asm-generic/posix_types.h | 165 ++++
include/asm-generic/scatterlist.h | 43 +
include/asm-generic/segment.h | 9 +
include/asm-generic/sembuf.h | 38 +
include/asm-generic/serial.h | 13 +
include/asm-generic/setup.h | 6 +
include/asm-generic/shmbuf.h | 59 ++
include/asm-generic/shmparam.h | 6 +
include/asm-generic/{signal.h => signal-defs.h} | 6 +-
include/asm-generic/signal.h | 159 +++-
include/asm-generic/socket.h | 60 ++
include/asm-generic/sockios.h | 13 +
include/asm-generic/spinlock.h | 11 +
include/asm-generic/stat.h | 72 ++
include/asm-generic/string.h | 10 +
include/asm-generic/swab.h | 18 +
include/asm-generic/syscalls.h | 60 ++
include/asm-generic/system.h | 161 ++++
include/asm-generic/termbits.h | 198 +++++
include/asm-generic/termios-base.h | 77 ++
include/asm-generic/termios.h | 105 +++-
include/asm-generic/timex.h | 22 +
include/asm-generic/tlb.h | 4 +
include/asm-generic/tlbflush.h | 18 +
include/asm-generic/types.h | 42 +
.../asm-generic/{uaccess.h => uaccess-unaligned.h} | 6 +-
include/asm-generic/uaccess.h | 351 ++++++++-
include/asm-generic/ucontext.h | 12 +
include/asm-generic/unaligned.h | 30 +
include/asm-generic/unistd.h | 854 ++++++++++++++++++++
include/asm-generic/user.h | 8 +
include/asm-generic/vga.h | 24 +
lib/Makefile | 2 +
lib/checksum.c | 193 +++++
scripts/checksyscalls.sh | 92 ++-
187 files changed, 4434 insertions(+), 556 deletions(-)
create mode 100644 arch/alpha/include/asm/bitsperlong.h
create mode 100644 arch/arm/include/asm/bitsperlong.h
create mode 100644 arch/avr32/include/asm/bitsperlong.h
create mode 100644 arch/blackfin/include/asm/bitsperlong.h
create mode 100644 arch/cris/include/asm/bitsperlong.h
create mode 100644 arch/frv/include/asm/bitsperlong.h
create mode 100644 arch/h8300/include/asm/bitsperlong.h
create mode 100644 arch/ia64/include/asm/bitsperlong.h
create mode 100644 arch/m32r/include/asm/bitsperlong.h
create mode 100644 arch/m68k/include/asm/bitsperlong.h
create mode 100644 arch/microblaze/include/asm/bitsperlong.h
create mode 100644 arch/mips/include/asm/bitsperlong.h
create mode 100644 arch/mn10300/include/asm/bitsperlong.h
create mode 100644 arch/parisc/include/asm/bitsperlong.h
create mode 100644 arch/powerpc/include/asm/bitsperlong.h
create mode 100644 arch/s390/include/asm/bitsperlong.h
create mode 100644 arch/sh/include/asm/bitsperlong.h
create mode 100644 arch/sparc/include/asm/bitsperlong.h
create mode 100644 arch/x86/include/asm/bitsperlong.h
create mode 100644 arch/xtensa/include/asm/bitsperlong.h
rename include/asm-generic/{atomic.h => atomic-long.h} (97%)
rewrite include/asm-generic/atomic.h (98%)
create mode 100644 include/asm-generic/auxvec.h
create mode 100644 include/asm-generic/bitsperlong.h
create mode 100644 include/asm-generic/bugs.h
create mode 100644 include/asm-generic/cache.h
create mode 100644 include/asm-generic/cacheflush.h
create mode 100644 include/asm-generic/checksum.h
create mode 100644 include/asm-generic/current.h
create mode 100644 include/asm-generic/delay.h
create mode 100644 include/asm-generic/dma.h
create mode 100644 include/asm-generic/fb.h
rename include/asm-generic/{page.h => getorder.h} (59%)
create mode 100644 include/asm-generic/hardirq.h
create mode 100644 include/asm-generic/hw_irq.h
create mode 100644 include/asm-generic/io.h
create mode 100644 include/asm-generic/ioctls.h
create mode 100644 include/asm-generic/ipcbuf.h
create mode 100644 include/asm-generic/irq.h
create mode 100644 include/asm-generic/irqflags.h
create mode 100644 include/asm-generic/kmap_types.h
create mode 100644 include/asm-generic/linkage.h
rename include/asm-generic/{mman.h => mman-common.h} (93%)
rewrite include/asm-generic/mman.h (99%)
create mode 100644 include/asm-generic/mmu.h
create mode 100644 include/asm-generic/mmu_context.h
create mode 100644 include/asm-generic/module.h
create mode 100644 include/asm-generic/msgbuf.h
create mode 100644 include/asm-generic/mutex.h
rewrite include/asm-generic/page.h (93%)
create mode 100644 include/asm-generic/param.h
create mode 100644 include/asm-generic/parport.h
create mode 100644 include/asm-generic/pgalloc.h
create mode 100644 include/asm-generic/posix_types.h
create mode 100644 include/asm-generic/scatterlist.h
create mode 100644 include/asm-generic/segment.h
create mode 100644 include/asm-generic/sembuf.h
create mode 100644 include/asm-generic/serial.h
create mode 100644 include/asm-generic/setup.h
create mode 100644 include/asm-generic/shmbuf.h
create mode 100644 include/asm-generic/shmparam.h
rename include/asm-generic/{signal.h => signal-defs.h} (85%)
rewrite include/asm-generic/signal.h (86%)
create mode 100644 include/asm-generic/socket.h
create mode 100644 include/asm-generic/sockios.h
create mode 100644 include/asm-generic/spinlock.h
create mode 100644 include/asm-generic/stat.h
create mode 100644 include/asm-generic/string.h
create mode 100644 include/asm-generic/swab.h
create mode 100644 include/asm-generic/syscalls.h
create mode 100644 include/asm-generic/system.h
create mode 100644 include/asm-generic/termbits.h
create mode 100644 include/asm-generic/termios-base.h
create mode 100644 include/asm-generic/timex.h
create mode 100644 include/asm-generic/tlbflush.h
create mode 100644 include/asm-generic/types.h
rename include/asm-generic/{uaccess.h => uaccess-unaligned.h} (82%)
rewrite include/asm-generic/uaccess.h (96%)
create mode 100644 include/asm-generic/ucontext.h
create mode 100644 include/asm-generic/unaligned.h
create mode 100644 include/asm-generic/unistd.h
create mode 100644 include/asm-generic/user.h
create mode 100644 include/asm-generic/vga.h
create mode 100644 lib/checksum.cArnd Bergmann
maintainerPATCH 1/15 asm-generic: rename termios.h, signal.h and mman.h
The existing asm-generic versions are incomplete and included by some architectures. New architectures should be able to use a generic version, so rename the existing files and change all users, which lets us add the new files.
---
arch/alpha/include/asm/signal.h | 2 +-
arch/arm/include/asm/mman.h | 2 +-
arch/arm/include/asm/signal.h | 2 +-
arch/avr32/include/asm/mman.h | 2 +-
arch/avr32/include/asm/signal.h | 2 +-
arch/avr32/include/asm/termios.h | 2 +-
arch/blackfin/include/asm/signal.h | 2 +-
arch/cris/include/asm/mman.h | 2 +-
arch/cris/include/asm/signal.h | 2 +-
arch/frv/include/asm/mman.h | 2 +-
arch/frv/include/asm/termios.h | 2 +-
arch/h8300/include/asm/mman.h | 2 +-
arch/h8300/include/asm/signal.h | 2 +-
arch/ia64/include/asm/mman.h | 2 +-
arch/ia64/include/asm/signal.h | 2 +-
arch/m32r/include/asm/mman.h | 2 +-
arch/m32r/include/asm/signal.h | 2 +-
arch/m68k/include/asm/mman.h | 2 +-
arch/m68k/include/asm/signal.h | 2 +-
arch/microblaze/include/asm/signal.h | 2 +-
arch/microblaze/include/asm/termios.h | 2 +-
arch/mips/include/asm/signal.h | 2 +-
arch/mn10300/include/asm/mman.h | 2 +-
arch/mn10300/include/asm/signal.h | 2 +-
arch/powerpc/include/asm/mman.h | 2 +-
arch/powerpc/include/asm/signal.h | 2 +-
arch/powerpc/include/asm/termios.h | 2 +-
arch/s390/include/asm/mman.h | 2 +-
arch/s390/include/asm/signal.h | 2 +-
arch/s390/include/asm/termios.h | 2 +-
arch/sh/include/asm/mman.h | 2 +-
arch/sh/include/asm/signal.h | 2 +-
arch/sparc/include/asm/mman.h | 2 +-
arch/sparc/include/asm/signal.h | 2 +-
arch/x86/include/asm/mman.h | 2 +-
arch/x86/include/asm/signal.h | 2 +-
include/asm-generic/Kbuild | 4 ++--
include/asm-generic/{mman.h => mman-common.h} | 6 +++---
include/asm-generic/{signal.h => signal-defs.h} | 6 +++---
include/asm-generic/{termios.h => termios-base.h} | 6 +++---
40 files changed, 47 insertions(+), 47 deletions(-)
rename include/asm-generic/{mman.h => mman-common.h} (93%)
rename include/asm-generic/{signal.h => signal-defs.h} (85%)
rename include/asm-generic/{termios.h => termios-base.h} (94%)arch/alpha/include/asm/signal.h +1 -1
@@ -111,7 +111,7 @@ typedef unsigned long sigset_t;#define SIG_UNBLOCK 2/* for unblocking signals */ #define SIG_SETMASK 3/* for setting the signal mask */ -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> #ifdef __KERNEL__ struct osf_sigaction {
arch/arm/include/asm/mman.h +1 -1
@@ -1,7 +1,7 @@#ifndef __ARM_MMAN_H__#define __ARM_MMAN_H__ -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> #define MAP_GROWSDOWN 0x0100/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */
arch/arm/include/asm/signal.h +1 -1
@@ -111,7 +111,7 @@ typedef unsigned long sigset_t;#define MINSIGSTKSZ 2048#define SIGSTKSZ 8192 -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> #ifdef __KERNEL__ struct old_sigaction {
arch/avr32/include/asm/mman.h +1 -1
@@ -1,7 +1,7 @@#ifndef __ASM_AVR32_MMAN_H__#define __ASM_AVR32_MMAN_H__ -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> #define MAP_GROWSDOWN 0x0100/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */
arch/avr32/include/asm/signal.h +1 -1
@@ -112,7 +112,7 @@ typedef unsigned long sigset_t;#define MINSIGSTKSZ 2048#define SIGSTKSZ 8192 -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> #ifdef __KERNEL__ struct old_sigaction {
arch/avr32/include/asm/termios.h +1 -1
@@ -55,7 +55,7 @@ struct termio {*/ #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" -#include <asm-generic/termios.h> +#include <asm-generic/termios-base.h> #endif /* __KERNEL__ */
arch/blackfin/include/asm/signal.h +1 -1
@@ -104,7 +104,7 @@ typedef unsigned long sigset_t;#define MINSIGSTKSZ 2048#define SIGSTKSZ 8192 -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> #ifdef __KERNEL__ struct old_sigaction {
arch/cris/include/asm/mman.h +1 -1
@@ -3,7 +3,7 @@/* verbatim copy of asm-i386/ version */ -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> #define MAP_GROWSDOWN 0x0100/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */
arch/cris/include/asm/signal.h +1 -1
@@ -106,7 +106,7 @@ typedef unsigned long sigset_t;#define MINSIGSTKSZ 2048#define SIGSTKSZ 8192 -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> #ifdef __KERNEL__ struct old_sigaction {
arch/frv/include/asm/mman.h +1 -1
@@ -1,7 +1,7 @@#ifndef __ASM_MMAN_H__#define __ASM_MMAN_H__ -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> #define MAP_GROWSDOWN 0x0100/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */
arch/frv/include/asm/termios.h +1 -1
@@ -52,7 +52,7 @@ struct termio {/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ #ifdef __KERNEL__ -#include <asm-generic/termios.h> +#include <asm-generic/termios-base.h> #endif #endif /* _ASM_TERMIOS_H */
arch/h8300/include/asm/mman.h +1 -1
@@ -1,7 +1,7 @@#ifndef __H8300_MMAN_H__#define __H8300_MMAN_H__ -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> #define MAP_GROWSDOWN 0x0100/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */
arch/h8300/include/asm/signal.h +1 -1
@@ -105,7 +105,7 @@ typedef unsigned long sigset_t;#define MINSIGSTKSZ 2048#define SIGSTKSZ 8192 -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> #ifdef __KERNEL__ struct old_sigaction {
arch/ia64/include/asm/mman.h +1 -1
@@ -8,7 +8,7 @@* David Mosberger-Tang <[email protected]>, Hewlett-Packard Co */ -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> #define MAP_GROWSDOWN 0x00100/* stack-like segment */ #define MAP_GROWSUP 0x00200/* register stack-like segment */
arch/ia64/include/asm/signal.h +1 -1
@@ -114,7 +114,7 @@#endif /* __KERNEL__ */ -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> # ifndef __ASSEMBLY__
arch/m32r/include/asm/mman.h +1 -1
@@ -1,7 +1,7 @@#ifndef __M32R_MMAN_H__#define __M32R_MMAN_H__ -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> #define MAP_GROWSDOWN 0x0100/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */
arch/m32r/include/asm/signal.h +1 -1
@@ -107,7 +107,7 @@ typedef unsigned long sigset_t;#define MINSIGSTKSZ 2048#define SIGSTKSZ 8192 -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> #ifdef __KERNEL__ struct old_sigaction {
arch/m68k/include/asm/mman.h +1 -1
@@ -1,7 +1,7 @@#ifndef __M68K_MMAN_H__#define __M68K_MMAN_H__ -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> #define MAP_GROWSDOWN 0x0100/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */
arch/m68k/include/asm/signal.h +1 -1
@@ -103,7 +103,7 @@ typedef unsigned long sigset_t;#define MINSIGSTKSZ 2048#define SIGSTKSZ 8192 -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> #ifdef __KERNEL__ struct old_sigaction {
arch/microblaze/include/asm/signal.h +1 -1
@@ -90,7 +90,7 @@# ifndef __ASSEMBLY__# include <linux/types.h> -# include <asm-generic/signal.h> +# include <asm-generic/signal-defs.h> /* Avoid too many header ordering problems. */ struct siginfo ;
arch/microblaze/include/asm/termios.h +1 -1
@@ -81,7 +81,7 @@ struct termio {#ifdef __KERNEL__ -#include <asm-generic/termios.h> +#include <asm-generic/termios-base.h> #endif /* __KERNEL__ */
arch/mips/include/asm/signal.h +1 -1
@@ -109,7 +109,7 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */#define SIG_UNBLOCK 2/* for unblocking signals */ #define SIG_SETMASK 3/* for setting the signal mask */ -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> struct sigaction {unsigned int sa_flags;
arch/mn10300/include/asm/mman.h +1 -1
@@ -12,7 +12,7 @@#ifndef _ASM_MMAN_H#define _ASM_MMAN_H -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> #define MAP_GROWSDOWN 0x0100/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */
arch/mn10300/include/asm/signal.h +1 -1
@@ -115,7 +115,7 @@ typedef unsigned long sigset_t;#define MINSIGSTKSZ 2048#define SIGSTKSZ 8192 -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> #ifdef __KERNEL__ struct old_sigaction {
arch/powerpc/include/asm/mman.h +1 -1
@@ -1,7 +1,7 @@#ifndef _ASM_POWERPC_MMAN_H#define _ASM_POWERPC_MMAN_H -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> /* * This program is free software; you can redistribute it and/or
arch/powerpc/include/asm/signal.h +1 -1
@@ -94,7 +94,7 @@ typedef struct {#define MINSIGSTKSZ 2048#define SIGSTKSZ 8192 -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> struct old_sigaction {__sighandler_t sa_handler;
arch/powerpc/include/asm/termios.h +1 -1
@@ -78,7 +78,7 @@ struct termio {#ifdef __KERNEL__ -#include <asm-generic/termios.h> +#include <asm-generic/termios-base.h> #endif /* __KERNEL__ */
arch/s390/include/asm/mman.h +1 -1
@@ -9,7 +9,7 @@#ifndef __S390_MMAN_H__#define __S390_MMAN_H__ -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> #define MAP_GROWSDOWN 0x0100/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */
arch/s390/include/asm/signal.h +1 -1
@@ -115,7 +115,7 @@ typedef unsigned long sigset_t;#define MINSIGSTKSZ 2048#define SIGSTKSZ 8192 -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> #ifdef __KERNEL__ struct old_sigaction {
arch/s390/include/asm/termios.h +1 -1
@@ -60,7 +60,7 @@ struct termio {#define user_termios_to_kernel_termios (k, u) copy_from_user(k, u, sizeof(struct termios2))#define kernel_termios_to_user_termios (u, k) copy_to_user(u, k, sizeof(struct termios2)) -#include <asm-generic/termios.h> +#include <asm-generic/termios-base.h> #endif /* __KERNEL__ */
arch/sh/include/asm/mman.h +1 -1
@@ -1,7 +1,7 @@#ifndef __ASM_SH_MMAN_H#define __ASM_SH_MMAN_H -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> #define MAP_GROWSDOWN 0x0100/* stack-like segment */ #define MAP_DENYWRITE 0x0800/* ETXTBSY */
arch/sh/include/asm/signal.h +1 -1
@@ -106,7 +106,7 @@ typedef unsigned long sigset_t;#define MINSIGSTKSZ 2048#define SIGSTKSZ 8192 -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> #ifdef __KERNEL__ struct old_sigaction {
arch/sparc/include/asm/mman.h +1 -1
@@ -1,7 +1,7 @@#ifndef __SPARC_MMAN_H__#define __SPARC_MMAN_H__ -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> /* SunOS'ified... */
arch/sparc/include/asm/signal.h +1 -1
@@ -176,7 +176,7 @@ struct sigstack {#define SA_STATIC_ALLOC 0x8000#endif -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> struct __new_sigaction {__sighandler_t sa_handler;
arch/x86/include/asm/mman.h +1 -1
@@ -1,7 +1,7 @@#ifndef _ASM_X86_MMAN_H#define _ASM_X86_MMAN_H -#include <asm-generic/mman.h> +#include <asm-generic/mman-common.h> #define MAP_32BIT 0x40/* only give out 32bit addresses */
arch/x86/include/asm/signal.h +1 -1
@@ -117,7 +117,7 @@ typedef unsigned long sigset_t;#define MINSIGSTKSZ 2048#define SIGSTKSZ 8192 -#include <asm-generic/signal.h> +#include <asm-generic/signal-defs.h> #ifndef __ASSEMBLY__
include/asm-generic/Kbuild +2 -2
@@ -2,9 +2,9 @@ header-y += errno-base.h header-y += errno.h header-y += fcntl.h header-y += ioctl.h -header-y += mman.h +header-y += mman-common.h header-y += poll.h -header-y += signal.h +header-y += signal-defs.h header-y += statfs.h unifdef-y += int-l64.h
include/asm-generic/mman-common.h renamed from include/asm-generic/mman.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_GENERIC_MMAN_H -#define _ASM_GENERIC_MMAN_H +#ifndef __ASM_GENERIC_MMAN_COMMON_H +#define __ASM_GENERIC_MMAN_COMMON_H/* Author: Michael S. Tsirkin <[email protected]>, Mellanox Technologies Ltd.
@@ -38,4 +38,4 @@/* compatibility flags */ #define MAP_FILE 0 -#endif +#endif /* __ASM_GENERIC_MMAN_COMMON_H */
include/asm-generic/signal-defs.h renamed from include/asm-generic/signal.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef __ASM_GENERIC_SIGNAL_H -#define __ASM_GENERIC_SIGNAL_H +#ifndef __ASM_GENERIC_SIGNAL_DEFS_H +#define __ASM_GENERIC_SIGNAL_DEFS_H#include <linux/compiler.h>
@@ -25,4 +25,4 @@ typedef __restorefn_t __user *__sigrestore_t;#define SIG_ERR ((__force __sighandler_t)-1)/* error return from signal */ #endif -#endif /* __ASM_GENERIC_SIGNAL_H */ +#endif /* __ASM_GENERIC_SIGNAL_DEFS_H */
include/asm-generic/termios-base.h renamed from include/asm-generic/termios.h +3 -3
@@ -1,8 +1,8 @@/* termios.h: generic termios/termio user copying/translation */ -#ifndef _ASM_GENERIC_TERMIOS_H -#define _ASM_GENERIC_TERMIOS_H +#ifndef _ASM_GENERIC_TERMIOS_BASE_H +#define _ASM_GENERIC_TERMIOS_BASE_H#include <asm/uaccess.h>
@@ -74,4 +74,4 @@ static inline int kernel_termios_to_user_termio(struct termio __user *termio,#endif /* __ARCH_TERMIO_GETPUT */ -#endif /* _ASM_GENERIC_TERMIOS_H */ +#endif /* _ASM_GENERIC_TERMIOS_BASE_H */
Signature · 1 line
1.6.0.4
Re: [PATCH 01/15] asm-generic: rename termios.h, signal.h and mman.h
Hi Arnd,
include/asm-generic/Kbuild header-y += errno-base.h · line 8
Quoted 13 lines · On Wed, 13 May 2009 22:56:24 +0000 Arnd Bergmann <[email protected]> wrote:
include/asm-generic/Kbuild +2
-2@@ -2,9 +2,9 @@ header-y += errno-base.h header-y += errno.h header-y += fcntl.h header-y += ioctl.h -header-y += mman.h +header-y += mman-common.h header-y += poll.h -header-y += signal.h +header-y += signal-defs.h header-y += statfs.h
I think that this change will prevent asm/mman.h and asm/signal.h from being exported from the arch include/asm directories. include/asm-generic/Kbuild is included by the arch/*/include/asm/Kbuild files.
Maybe Sam (cc'd) could comment.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Re: [PATCH 01/15] asm-generic: rename termios.h, signal.h and mman.h
Quoted 13 lines · Stephen Rothwell
Hi Arnd,
Quoted 10 lines · On Wed, 13 May 2009 22:56:24 +0000 Arnd Bergmann <[email protected]> wrote:
include/asm-generic/Kbuild +1
-1@@ -2,9 +2,9 @@ header-y += errno-base.h header-y += errno.h header-y += fcntl.h header-y += ioctl.h -header-y += mman.h +header-y += mman-common.h header-y += poll.h
Quoted 8 lines
include/asm-generic/Kbuild header-y += errno-base.h · line 8
Quoted 3 lines
include/asm-generic/Kbuild +1
-1-header-y += signal.h +header-y += signal-defs.h header-y += statfs.hI think that this change will prevent
asm/mman.handasm/signal.hfrom being exported from the archinclude/asmdirectories.include/asm-generic/Kbuildis included by thearch/*/include/asm/Kbuildfiles.
We have two Kbuild files in asm-generic.
Kbuild (the one patched above) which specifies the files to be exported from asm-generic. Kbuild.asm which specify the commen set of files all architctures hall export.
The latter is the file included from the arch's Kbuild file.
I'm not sure this answer/address your comment above...
Sam
Re: [PATCH 01/15] asm-generic: rename termios.h, signal.h and mman.h
Hi Sam,
Quoted 7 lines · On Thu, 14 May 2009 08:16:23 +0200 Sam Ravnborg <[email protected]> wrote:
We have two
Kbuildfiles in asm-generic.
Kbuild(the one patched above) which specifies the files to be exported from asm-generic. Kbuild.asm which specify the commen set of files all architctures hall export.The latter is the file included from the arch's
Kbuildfile.
My mistake, thanks for the clarification.
/me cleans his glasses :-)
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Arnd Bergmann
maintainerPATCH 2/15 asm-generic: introduce asm/bitsperlong.h
In reply to Arnd BergmannThis provides a reliable way for asm-generic/types.h and other files to find out if it is running on a 32 or 64 bit platform.
We cannot use CONFIG_64BIT for this in headers that are included from user space because CONFIG symbols are not available there. We also cannot do it inside of asm/types.h because some headers need the word size but cannot include types.h.
The solution is to introduce a new header <asm/bitsperlong.h> that defines both __BITS_PER_LONG for user space and BITS_PER_LONG for usage in the kernel. The asm-generic version falls back to 32 bit unless the architecture overrides it, which I did for all 64 bit platforms.
--- arch/alpha/include/asm/bitsperlong.h | 8 +++++++ arch/alpha/include/asm/types.h | 3 -- arch/arm/include/asm/bitsperlong.h | 1 + arch/avr32/include/asm/bitsperlong.h | 1 + arch/blackfin/include/asm/bitsperlong.h | 1 + arch/cris/include/asm/bitsperlong.h | 1 + arch/frv/include/asm/bitsperlong.h | 1 + arch/h8300/include/asm/bitsperlong.h | 1 + arch/ia64/include/asm/bitsperlong.h | 8 +++++++ arch/ia64/include/asm/types.h | 7 ------ arch/m32r/include/asm/bitsperlong.h | 1 + arch/m68k/include/asm/bitsperlong.h | 1 + arch/microblaze/include/asm/bitsperlong.h | 1 + arch/mips/include/asm/bitsperlong.h | 8 +++++++ arch/mips/include/asm/types.h | 3 -- arch/mn10300/include/asm/bitsperlong.h | 1 + arch/parisc/include/asm/bitsperlong.h | 20 ++++++++++++++++++ arch/parisc/include/asm/types.h | 8 ------- arch/powerpc/include/asm/bitsperlong.h | 12 ++++++++++ arch/powerpc/include/asm/types.h | 9 -------- arch/s390/include/asm/bitsperlong.h | 13 +++++++++++ arch/s390/include/asm/types.h | 6 ----- arch/sh/include/asm/bitsperlong.h | 1 + arch/sparc/include/asm/bitsperlong.h | 13 +++++++++++ arch/sparc/include/asm/types.h | 4 --- arch/x86/include/asm/bitsperlong.h | 13 +++++++++++ arch/x86/include/asm/types.h | 6 ----- arch/xtensa/include/asm/bitsperlong.h | 1 + include/asm-generic/Kbuild | 1 + include/asm-generic/Kbuild.asm | 1 + include/asm-generic/bitsperlong.h | 32 +++++++++++++++++++++++++++++ include/asm-generic/int-l64.h | 2 + include/asm-generic/int-ll64.h | 2 + 33 files changed, 145 insertions(+), 46 deletions(-) create mode 100644 arch/alpha/include/asm/bitsperlong.h create mode 100644 arch/arm/include/asm/bitsperlong.h create mode 100644 arch/avr32/include/asm/bitsperlong.h create mode 100644 arch/blackfin/include/asm/bitsperlong.h create mode 100644 arch/cris/include/asm/bitsperlong.h create mode 100644 arch/frv/include/asm/bitsperlong.h create mode 100644 arch/h8300/include/asm/bitsperlong.h create mode 100644 arch/ia64/include/asm/bitsperlong.h create mode 100644 arch/m32r/include/asm/bitsperlong.h create mode 100644 arch/m68k/include/asm/bitsperlong.h create mode 100644 arch/microblaze/include/asm/bitsperlong.h create mode 100644 arch/mips/include/asm/bitsperlong.h create mode 100644 arch/mn10300/include/asm/bitsperlong.h create mode 100644 arch/parisc/include/asm/bitsperlong.h create mode 100644 arch/powerpc/include/asm/bitsperlong.h create mode 100644 arch/s390/include/asm/bitsperlong.h create mode 100644 arch/sh/include/asm/bitsperlong.h create mode 100644 arch/sparc/include/asm/bitsperlong.h create mode 100644 arch/x86/include/asm/bitsperlong.h create mode 100644 arch/xtensa/include/asm/bitsperlong.h create mode 100644 include/asm-generic/bitsperlong.h
arch/alpha/include/asm/bitsperlong.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef __ASM_ALPHA_BITSPERLONG_H +#define __ASM_ALPHA_BITSPERLONG_H + +#define __BITS_PER_LONG 64 + +#include <asm-generic/bitsperlong.h> + +#endif /* __ASM_ALPHA_BITSPERLONG_H */
arch/alpha/include/asm/types.h +0 -3
@@ -25,9 +25,6 @@ typedef unsigned int umode_t;* These aren't exported outside the kernel to avoid name space clashes */ #ifdef __KERNEL__ - -#define BITS_PER_LONG 64 -#ifndef __ASSEMBLY__typedef u64 dma_addr_t ;
arch/arm/include/asm/bitsperlong.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/bitsperlong.h>
arch/avr32/include/asm/bitsperlong.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/bitsperlong.h>
arch/blackfin/include/asm/bitsperlong.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/bitsperlong.h>
arch/cris/include/asm/bitsperlong.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/bitsperlong.h>
arch/frv/include/asm/bitsperlong.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/bitsperlong.h>
arch/h8300/include/asm/bitsperlong.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/bitsperlong.h>
arch/ia64/include/asm/bitsperlong.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef __ASM_IA64_BITSPERLONG_H +#define __ASM_IA64_BITSPERLONG_H + +#define __BITS_PER_LONG 64 + +#include <asm-generic/bitsperlong.h> + +#endif /* __ASM_IA64_BITSPERLONG_H */
arch/ia64/include/asm/types.h +0 -7
@@ -19,10 +19,6 @@# define __IA64_UL (x) (x)# define __IA64_UL_CONST (x) x -# ifdef __KERNEL__ -# define BITS_PER_LONG 64 -# endif -#else # define __IA64_UL (x) ((unsigned long)(x))# define __IA64_UL_CONST (x) x##UL
@@ -34,10 +30,7 @@ typedef unsigned int umode_t;*/ # ifdef __KERNEL__ -#define BITS_PER_LONG 64 -/* DMA addresses are 64-bits wide, in general. */ -typedef u64 dma_addr_t ;# endif /* __KERNEL__ */
arch/m32r/include/asm/bitsperlong.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/bitsperlong.h>
arch/m68k/include/asm/bitsperlong.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/bitsperlong.h>
arch/microblaze/include/asm/bitsperlong.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/bitsperlong.h>
arch/mips/include/asm/bitsperlong.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef __ASM_MIPS_BITSPERLONG_H +#define __ASM_MIPS_BITSPERLONG_H + +#define __BITS_PER_LONG _MIPS_SZLONG + +#include <asm-generic/bitsperlong.h> + +#endif /* __ASM_MIPS_BITSPERLONG_H */
arch/mips/include/asm/types.h +0 -3
@@ -31,9 +31,6 @@ typedef unsigned short umode_t;* These aren't exported outside the kernel to avoid name space clashes */ #ifdef __KERNEL__ - -#define BITS_PER_LONG _MIPS_SZLONG -#ifndef __ASSEMBLY__#if (defined(CONFIG_HIGHMEM ) && defined(CONFIG_64BIT_PHYS_ADDR )) \
arch/mn10300/include/asm/bitsperlong.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/bitsperlong.h>
arch/parisc/include/asm/bitsperlong.h new file +20 -0
@@ -0,0 +1,20 @@ +#ifndef __ASM_PARISC_BITSPERLONG_H +#define __ASM_PARISC_BITSPERLONG_H + +/* +* using CONFIG_* outside of __KERNEL__ is wrong, +* __LP64__ was also removed from headers, so what +* is the right approach on parisc? +* -arnd +*/ +#if (defined(__KERNEL__) && defined(CONFIG_64BIT )) || defined (__LP64__) +#define __BITS_PER_LONG 64 +#define SHIFT_PER_LONG 6 +#else +#define __BITS_PER_LONG 32 +#define SHIFT_PER_LONG 5 +#endif + +#include <asm-generic/bitsperlong.h> + +#endif /* __ASM_PARISC_BITSPERLONG_H */
arch/parisc/include/asm/types.h +0 -8
@@ -14,14 +14,6 @@ typedef unsigned short umode_t;*/ #ifdef __KERNEL__ -#ifdef CONFIG_64BIT -#define BITS_PER_LONG 64 -#define SHIFT_PER_LONG 6 -#else -#define BITS_PER_LONG 32 -#define SHIFT_PER_LONG 5 -#endif -#ifndef __ASSEMBLY__/* Dma addresses are 32-bits wide. */
arch/powerpc/include/asm/bitsperlong.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef __ASM_POWERPC_BITSPERLONG_H +#define __ASM_POWERPC_BITSPERLONG_H + +#if defined(__powerpc64__) +# define __BITS_PER_LONG 64 +#else +# define __BITS_PER_LONG 32 +#endif + +#include <asm-generic/bitsperlong.h> + +#endif /* __ASM_POWERPC_BITSPERLONG_H */
arch/powerpc/include/asm/types.h +0 -9
@@ -40,15 +40,6 @@ typedef struct {#endif /* __ASSEMBLY__ */ #ifdef __KERNEL__ -/* -* These aren't exported outside the kernel to avoid name space clashes -*/ -#ifdef __powerpc64__ -#define BITS_PER_LONG 64 -#else -#define BITS_PER_LONG 32 -#endif -#ifndef __ASSEMBLY__typedef __vector128 vector128 ;
arch/s390/include/asm/bitsperlong.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef __ASM_S390_BITSPERLONG_H +#define __ASM_S390_BITSPERLONG_H + +#ifndef __s390x__ +#define __BITS_PER_LONG 32 +#else +#define __BITS_PER_LONG 64 +#endif + +#include <asm-generic/bitsperlong.h> + +#endif /* __ASM_S390_BITSPERLONG_H */ +
arch/s390/include/asm/types.h +0 -6
@@ -28,12 +28,6 @@ typedef __signed__ long saddr_t;*/ #ifdef __KERNEL__ -#ifndef __s390x__ -#define BITS_PER_LONG 32 -#else -#define BITS_PER_LONG 64 -#endif -#ifndef __ASSEMBLY__typedef u64 dma64_addr_t ;
arch/sh/include/asm/bitsperlong.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/bitsperlong.h>
arch/sparc/include/asm/bitsperlong.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef __ASM_ALPHA_BITSPERLONG_H +#define __ASM_ALPHA_BITSPERLONG_H + +#if defined(__sparc__) && defined(__arch64__) +#define __BITS_PER_LONG 64 +#else +#define __BITS_PER_LONG 32 +#endif + +#include <asm-generic/bitsperlong.h> + +#endif /* __ASM_ALPHA_BITSPERLONG_H */ +
arch/sparc/include/asm/types.h +0 -4
@@ -21,8 +21,6 @@ typedef unsigned short umode_t;#ifdef __KERNEL__ -#define BITS_PER_LONG 64 -#ifndef __ASSEMBLY__/* Dma addresses come in generic and 64-bit flavours. */
@@ -46,8 +44,6 @@ typedef unsigned short umode_t;#ifdef __KERNEL__ -#define BITS_PER_LONG 32 -#ifndef __ASSEMBLY__typedef u32 dma_addr_t ;
arch/x86/include/asm/bitsperlong.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef __ASM_X86_BITSPERLONG_H +#define __ASM_X86_BITSPERLONG_H + +#ifdef __x86_64__ +# define __BITS_PER_LONG 64 +#else +# define __BITS_PER_LONG 32 +#endif + +#include <asm-generic/bitsperlong.h> + +#endif /* __ASM_X86_BITSPERLONG_H */ +
arch/x86/include/asm/types.h +0 -6
@@ -14,12 +14,6 @@ typedef unsigned short umode_t;*/ #ifdef __KERNEL__ -#ifdef CONFIG_X86_32 -# define BITS_PER_LONG 32 -#else -# define BITS_PER_LONG 64 -#endif -#ifndef __ASSEMBLY__typedef u64 dma64_addr_t ;
arch/xtensa/include/asm/bitsperlong.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/bitsperlong.h>
include/asm-generic/Kbuild +1 -0
@@ -1,3 +1,4 @@ +header-y += bitsperlong.h header-y += errno-base.h header-y += errno.h header-y += fcntl.h
include/asm-generic/Kbuild.asm +1 -0
@@ -9,6 +9,7 @@ unifdef-y += a.out.h endif unifdef-y += auxvec.h unifdef-y += byteorder.h +unifdef-y += bitsperlong.h unifdef-y += errno.h unifdef-y += fcntl.h unifdef-y += ioctl.h
include/asm-generic/bitsperlong.h new file +32 -0
@@ -0,0 +1,32 @@ +#ifndef __ASM_GENERIC_BITS_PER_LONG +#define __ASM_GENERIC_BITS_PER_LONG + +/* +* There seems to be no way of detecting this automatically from user +* space, so 64 bit architectures should override this in their +* bitsperlong.h. In particular, an architecture that supports +* both 32 and 64 bit user space must not rely on CONFIG_64BIT +* to decide it, but rather check a compiler provided macro. +*/ +#ifndef __BITS_PER_LONG +#define __BITS_PER_LONG 32 +#endif + +#ifdef __KERNEL__ + +#ifdef CONFIG_64BIT +#define BITS_PER_LONG 64 +#else +#define BITS_PER_LONG 32 +#endif /* CONFIG_64BIT */ + +/* +* FIXME: The check currently breaks x86-64 build, so it's +* temporarily disabled. Please fix x86-64 and reenable +*/ +#if 0 &&BITS_PER_LONG != __BITS_PER_LONG +#error Inconsistent word size. Check asm/bitsperlong.h +#endif + +#endif /* __KERNEL__ */ +#endif /* __ASM_GENERIC_BITS_PER_LONG */
include/asm-generic/int-l64.h +2 -0
@@ -8,6 +8,8 @@#ifndef _ASM_GENERIC_INT_L64_H#define _ASM_GENERIC_INT_L64_H +#include <asm/bitsperlong.h> +#ifndef __ASSEMBLY__/* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
include/asm-generic/int-ll64.h +2 -0
@@ -8,6 +8,8 @@#ifndef _ASM_GENERIC_INT_LL64_H#define _ASM_GENERIC_INT_LL64_H +#include <asm/bitsperlong.h> +#ifndef __ASSEMBLY__/* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
Signature · 1 line
1.6.0.4
Arnd Bergmann
maintainerPATCH 3/15 asm-generic: add generic sysv ipc headers
In reply to Arnd BergmannThe ipc64 data structures were originally meant to be architecture specific so that each architecture could add their own optimizations for padding.
In the end, most of them just copied the x86 version, and most got that wrong. UClibc expects the x86 anyway, so we might just declare that the default and get rid of the extra copies.
--- include/asm-generic/Kbuild | 5 +++ include/asm-generic/ipcbuf.h | 33 ++++++++++++++++++++++ include/asm-generic/msgbuf.h | 47 +++++++++++++++++++++++++++++++ include/asm-generic/sembuf.h | 38 +++++++++++++++++++++++++ include/asm-generic/shmbuf.h | 59 ++++++++++++++++++++++++++++++++++++++++ include/asm-generic/shmparam.h | 6 ++++ 6 files changed, 188 insertions(+), 0 deletions(-) create mode 100644 include/asm-generic/ipcbuf.h create mode 100644 include/asm-generic/msgbuf.h create mode 100644 include/asm-generic/sembuf.h create mode 100644 include/asm-generic/shmbuf.h create mode 100644 include/asm-generic/shmparam.h
include/asm-generic/Kbuild +5 -0
@@ -3,8 +3,13 @@ header-y += errno-base.h header-y += errno.h header-y += fcntl.h header-y += ioctl.h +header-y += ipcbuf.h header-y += mman-common.h +header-y += msgbuf.h header-y += poll.h +header-y += sembuf.h +header-y += shmbuf.h +header-y += shmparam.h header-y += signal-defs.h header-y += statfs.h
include/asm-generic/ipcbuf.h new file +33 -0
@@ -0,0 +1,33 @@ +#ifndef __ASM_GENERIC_IPCBUF_H +#define __ASM_GENERIC_IPCBUF_H + +/* +* The generic ipc64_perm structure: +* Note extra padding because this structure is passed back and forth +* between kernel and user space. +* +* ipc64_perm was originally meant to be architecture specific, but +* everyone just ended up making identical copies without specific +* optimizations, so we may just as well all use the same one. +* +* Pad space is left for: +* - 32-bit mode_t on architectures that only had 16 bit +* - 32-bit seq +* - 2 miscellaneous 32-bit values +*/ + +struct ipc64_perm { +__kernel_key_t key; +__kernel_uid32_t uid; +__kernel_gid32_t gid; +__kernel_uid32_t cuid; +__kernel_gid32_t cgid; +__kernel_mode_t mode; +unsigned short __pad1; +unsigned short seq; +unsigned short __pad2; +unsigned long __unused1; +unsigned long __unused2; +}; + +#endif /* __ASM_GENERIC_IPCBUF_H */
include/asm-generic/msgbuf.h new file +47 -0
47 lines not on this page · raw message
include/asm-generic/sembuf.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef __ASM_GENERIC_SEMBUF_H +#define __ASM_GENERIC_SEMBUF_H + +#include <asm/bitsperlong.h> + +/* +* The semid64_ds structure for x86 architecture. +* Note extra padding because this structure is passed back and forth +* between kernel and user space. +* +* semid64_ds was originally meant to be architecture specific, but +* everyone just ended up making identical copies without specific +* optimizations, so we may just as well all use the same one. +* +* 64 bit architectures typically define a 64 bit __kernel_time_t, +* so they do not need the first two padding words. +* On big-endian systems, the padding is in the wrong place. +* +* Pad space is left for: +* - 64-bit time_t to solve y2038 problem +* - 2 miscellaneous 32-bit values +*/ +struct semid64_ds { +struct ipc64_perm sem_perm;/* permissions .. see ipc.h */ +__kernel_time_t sem_otime;/* last semop time */ +#if __BITS_PER_LONG !=64 +unsigned long __unused1; +#endif +__kernel_time_t sem_ctime;/* last change time */ +#if __BITS_PER_LONG !=64 +unsigned long __unused2; +#endif +unsigned long sem_nsems;/* no. of semaphores in array */ +unsigned long __unused3; +unsigned long __unused4; +}; + +#endif /* __ASM_GENERIC_SEMBUF_H */
include/asm-generic/shmbuf.h new file +59 -0
59 lines not on this page · raw message
include/asm-generic/shmparam.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_GENERIC_SHMPARAM_H +#define __ASM_GENERIC_SHMPARAM_H + +#define SHMLBA PAGE_SIZE/* attach addr a multiple of this */ + +#endif /* _ASM_GENERIC_SHMPARAM_H */
Signature · 1 line
1.6.0.4
Arnd Bergmann
maintainerPATCH 4/15 asm-generic: add generic ABI headers
In reply to Arnd BergmannThese header files are typically copied from an existing architecture into any new one, slightly modified and then remain untouched until the end of time in the name of ABI stability.
To make it easier for future architectures, provide a sane generic version here. In cases where multiple architectures already use identical code, I used the most common version. In cases like stat.h that are more or less broken everywhere, I provide a version that is meant to be ideal for new architectures.
--- include/asm-generic/Kbuild | 15 +++ include/asm-generic/auxvec.h | 8 ++ include/asm-generic/ioctls.h | 110 ++++++++++++++++++++ include/asm-generic/mman.h | 18 ++++ include/asm-generic/param.h | 24 +++++ include/asm-generic/posix_types.h | 165 ++++++++++++++++++++++++++++++ include/asm-generic/setup.h | 6 + include/asm-generic/signal.h | 131 ++++++++++++++++++++++++ include/asm-generic/socket.h | 60 +++++++++++ include/asm-generic/sockios.h | 13 +++ include/asm-generic/stat.h | 72 +++++++++++++ include/asm-generic/swab.h | 18 ++++ include/asm-generic/termbits.h | 198 +++++++++++++++++++++++++++++++++++++ include/asm-generic/termios.h | 154 ++++++++++++++++++++++++++++ include/asm-generic/types.h | 42 ++++++++ include/asm-generic/ucontext.h | 12 +++ 16 files changed, 1046 insertions(+), 0 deletions(-) create mode 100644 include/asm-generic/auxvec.h create mode 100644 include/asm-generic/ioctls.h create mode 100644 include/asm-generic/mman.h create mode 100644 include/asm-generic/param.h create mode 100644 include/asm-generic/posix_types.h create mode 100644 include/asm-generic/setup.h create mode 100644 include/asm-generic/signal.h create mode 100644 include/asm-generic/socket.h create mode 100644 include/asm-generic/sockios.h create mode 100644 include/asm-generic/stat.h create mode 100644 include/asm-generic/swab.h create mode 100644 include/asm-generic/termbits.h create mode 100644 include/asm-generic/termios.h create mode 100644 include/asm-generic/types.h create mode 100644 include/asm-generic/ucontext.h
include/asm-generic/Kbuild +15 -0
@@ -1,17 +1,32 @@ +header-y += auxvec.h header-y += bitsperlong.h header-y += errno-base.h header-y += errno.h header-y += fcntl.h header-y += ioctl.h +header-y += ioctls.h header-y += ipcbuf.h header-y += mman-common.h +header-y += mman.h header-y += msgbuf.h +header-y += param.h header-y += poll.h +header-y += posix_types.h header-y += sembuf.h +header-y += setup.h header-y += shmbuf.h header-y += shmparam.h header-y += signal-defs.h +header-y += signal.h +header-y += socket.h +header-y += sockios.h +header-y += stat.h header-y += statfs.h +header-y += swab.h +header-y += termbits.h +header-y += termios.h +header-y += types.h +header-y += ucontext.h unifdef-y += int-l64.h unifdef-y += int-ll64.h
include/asm-generic/auxvec.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef __ASM_GENERIC_AUXVEC_H +#define __ASM_GENERIC_AUXVEC_H +/* +* Not all architectures need their own auxvec.h, the most +* common definitions are already in linux/auxvec.h. +*/ + +#endif /* __ASM_GENERIC_AUXVEC_H */
include/asm-generic/ioctls.h new file +110 -0
110 lines not on this page · raw message
include/asm-generic/mman.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef __ASM_GENERIC_MMAN_H +#define __ASM_GENERIC_MMAN_H + +#include <asm-generic/mman-common.h> + +#define MAP_GROWSDOWN 0x0100/* stack-like segment */ +#define MAP_DENYWRITE 0x0800/* ETXTBSY */ +#define MAP_EXECUTABLE 0x1000/* mark it as an executable */ +#define MAP_LOCKED 0x2000/* pages are locked */ +#define MAP_NORESERVE 0x4000/* don't check for reservations */ +#define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ +#define MAP_NONBLOCK 0x10000/* do not block on IO */ +#define MAP_STACK 0x20000/* give out an address that is best suited for process/thread stacks */ + +#define MCL_CURRENT 1/* lock all current mappings */ +#define MCL_FUTURE 2/* lock all future mappings */ + +#endif /* __ASM_GENERIC_MMAN_H */
include/asm-generic/param.h new file +24 -0
@@ -0,0 +1,24 @@ +#ifndef __ASM_GENERIC_PARAM_H +#define __ASM_GENERIC_PARAM_H + +#ifdef __KERNEL__ +# define HZ CONFIG_HZ/* Internal kernel timer frequency */ +# define USER_HZ 100/* some user interfaces are */ +# define CLOCKS_PER_SEC (USER_HZ)/* in "ticks" like times() */ +#endif + +#ifndef HZ +#define HZ 100 +#endif + +#ifndef EXEC_PAGESIZE +#define EXEC_PAGESIZE 4096 +#endif + +#ifndef NOGROUP +#define NOGROUP (-1) +#endif + +#define MAXHOSTNAMELEN 64/* max length of hostname */ + +#endif /* __ASM_GENERIC_PARAM_H */
include/asm-generic/posix_types.h new file +165 -0
165 lines not on this page · raw message
include/asm-generic/setup.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_GENERIC_SETUP_H +#define __ASM_GENERIC_SETUP_H + +#define COMMAND_LINE_SIZE 512 + +#endif /* __ASM_GENERIC_SETUP_H */
include/asm-generic/signal.h new file +131 -0
131 lines not on this page · raw message
include/asm-generic/socket.h new file +60 -0
60 lines not on this page · raw message
include/asm-generic/sockios.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef __ASM_GENERIC_SOCKIOS_H +#define __ASM_GENERIC_SOCKIOS_H + +/* Socket-level I/O control calls. */ +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#define SIOCGSTAMP 0x8906/* Get stamp (timeval) */ +#define SIOCGSTAMPNS 0x8907/* Get stamp (timespec) */ + +#endif /* __ASM_GENERIC_SOCKIOS_H */
include/asm-generic/stat.h new file +72 -0
72 lines not on this page · raw message
include/asm-generic/swab.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef _ASM_GENERIC_SWAB_H +#define _ASM_GENERIC_SWAB_H + +#include <asm/bitsperlong.h> + +/* +* 32 bit architectures typically (but not always) want to +* set __SWAB_64_THRU_32__. In user space, this is only +* valid if the compiler supports 64 bit data types. +*/ + +#if __BITS_PER_LONG ==32 +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) +#define __SWAB_64_THRU_32__ +#endif +#endif + +#endif /* _ASM_GENERIC_SWAB_H */
include/asm-generic/termbits.h new file +198 -0
198 lines not on this page · raw message
include/asm-generic/termios.h new file +154 -0
154 lines not on this page · raw message
include/asm-generic/types.h new file +42 -0
42 lines not on this page · raw message
include/asm-generic/ucontext.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef __ASM_GENERIC_UCONTEXT_H +#define __ASM_GENERIC_UCONTEXT_H + +struct ucontext { +unsigned long uc_flags; +struct ucontext *uc_link; +stack_t uc_stack; +struct sigcontext uc_mcontext; +sigset_t uc_sigmask;/* mask last for extensibility */ +}; + +#endif /* __ASM_GENERIC_UCONTEXT_H */
Signature · 1 line
1.6.0.4
Arnd Bergmann
maintainerPATCH 5/15 asm-generic: add a generic unistd.h
In reply to Arnd BergmannA new architecture should only define a minimal set of system calls while still providing the full functionality. This version of unistd.h has gone through intensive review to make sure that by default it only enables syscalls that do not already have a more featureful replacement.
It is modeled after the x86-64 version of unistd.h, which unifies the syscall number definition and the actual system call table in a single file, in order to keep them synchronized much more easily.
This first version still keeps legacy system call definitions around, guarded by various #ifdefs, and with numbers larger than 1024. The idea behind this is to make it easier for new architectures to transition from a full list to the reduced set. In particular, the new microblaze architecture that should migrate to using the generic ABI headers can at least use an existing uClibc source tree without major rewrites during the conversion.
--- include/asm-generic/Kbuild | 1 + include/asm-generic/unistd.h | 854 ++++++++++++++++++++++++++++++++++++++++++ scripts/checksyscalls.sh | 92 +++++- 3 files changed, 944 insertions(+), 3 deletions(-) create mode 100644 include/asm-generic/unistd.h
include/asm-generic/Kbuild +1 -0
@@ -27,6 +27,7 @@ header-y += termbits.h header-y += termios.h header-y += types.h header-y += ucontext.h +header-y += unistd.h unifdef-y += int-l64.h unifdef-y += int-ll64.h
include/asm-generic/unistd.h new file +854 -0
854 lines not on this page · raw message
scripts/checksyscalls.sh +89 -3
130 lines not on this page · raw message
Signature · 1 line
1.6.0.4
Arnd Bergmann
maintainerPATCH 6/15 asm-generic: rename atomic.h to atomic-long.h
In reply to Arnd BergmannThe existing asm-generic/atomic.h only defines the atomic_long type. This renames it to atomic-long.h so we have a place to add a truly generic atomic.h that can be used on all non-SMP systems.
---
arch/alpha/include/asm/atomic.h | 2 +-
arch/arm/include/asm/atomic.h | 2 +-
arch/avr32/include/asm/atomic.h | 2 +-
arch/blackfin/include/asm/atomic.h | 2 +-
arch/cris/include/asm/atomic.h | 2 +-
arch/frv/include/asm/atomic.h | 2 +-
arch/h8300/include/asm/atomic.h | 2 +-
arch/ia64/include/asm/atomic.h | 2 +-
arch/m32r/include/asm/atomic.h | 2 +-
arch/m68k/include/asm/atomic_mm.h | 2 +-
arch/m68k/include/asm/atomic_no.h | 2 +-
arch/microblaze/include/asm/atomic.h | 2 +-
arch/mips/include/asm/atomic.h | 2 +-
arch/mn10300/include/asm/atomic.h | 2 +-
arch/parisc/include/asm/atomic.h | 2 +-
arch/powerpc/include/asm/atomic.h | 2 +-
arch/s390/include/asm/atomic.h | 2 +-
arch/sh/include/asm/atomic.h | 2 +-
arch/sparc/include/asm/atomic_32.h | 2 +-
arch/sparc/include/asm/atomic_64.h | 2 +-
arch/x86/include/asm/atomic_32.h | 2 +-
arch/x86/include/asm/atomic_64.h | 2 +-
arch/xtensa/include/asm/atomic.h | 2 +-
include/asm-generic/{atomic.h => atomic-long.h} | 6 +++---
include/asm-generic/bitops/atomic.h | 1 +
25 files changed, 27 insertions(+), 26 deletions(-)
rename include/asm-generic/{atomic.h => atomic-long.h} (97%)arch/alpha/include/asm/atomic.h +1 -1
@@ -256,5 +256,5 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)#define smp_mb__before_atomic_inc () smp_mb()#define smp_mb__after_atomic_inc () smp_mb() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* _ALPHA_ATOMIC_H */
arch/arm/include/asm/atomic.h +1 -1
@@ -206,6 +206,6 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif #endif
arch/avr32/include/asm/atomic.h +1 -1
@@ -196,6 +196,6 @@ static inline int atomic_sub_if_positive(int i, atomic_t *v)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* __ASM_AVR32_ATOMIC_H */
arch/blackfin/include/asm/atomic.h +1 -1
@@ -208,6 +208,6 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v)#define atomic_sub_and_test (i,v) (atomic_sub_return((i), (v)) == 0)#define atomic_dec_and_test (v) (atomic_sub_return(1, (v)) == 0) -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* __ARCH_BLACKFIN_ATOMIC __ */
arch/cris/include/asm/atomic.h +1 -1
@@ -158,5 +158,5 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif
arch/frv/include/asm/atomic.h +1 -1
@@ -194,5 +194,5 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)#define atomic_inc_not_zero (v) atomic_add_unless((v), 1, 0) -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* _ASM_ATOMIC_H */
arch/h8300/include/asm/atomic.h +1 -1
@@ -141,5 +141,5 @@ static __inline__ void atomic_set_mask(unsigned long mask, unsigned long *v)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* __ARCH_H8300_ATOMIC __ */
arch/ia64/include/asm/atomic.h +1 -1
@@ -216,5 +216,5 @@ atomic64_add_negative (__s64 i, atomic64_t *v)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* _ASM_IA64_ATOMIC_H */
arch/m32r/include/asm/atomic.h +1 -1
@@ -314,5 +314,5 @@ static __inline__ void atomic_set_mask(unsigned long mask, atomic_t *addr)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* _ASM_M32R_ATOMIC_H */
arch/m68k/include/asm/atomic_mm.h +1 -1
@@ -192,5 +192,5 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* __ARCH_M68K_ATOMIC __ */
arch/m68k/include/asm/atomic_no.h +1 -1
@@ -151,5 +151,5 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)#define atomic_dec_return (v) atomic_sub_return(1,(v))#define atomic_inc_return (v) atomic_add_return(1,(v)) -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* __ARCH_M68KNOMMU_ATOMIC __ */
arch/microblaze/include/asm/atomic.h +1 -1
@@ -118,6 +118,6 @@ static inline int atomic_dec_if_positive(atomic_t *v)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* _ASM_MICROBLAZE_ATOMIC_H */
arch/mips/include/asm/atomic.h +1 -1
@@ -793,6 +793,6 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)#define smp_mb__before_atomic_inc () smp_llsc_mb()#define smp_mb__after_atomic_inc () smp_llsc_mb() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* _ASM_ATOMIC_H */
arch/mn10300/include/asm/atomic.h +1 -1
@@ -151,7 +151,7 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* __KERNEL__ */ #endif /* _ASM_ATOMIC_H */
arch/parisc/include/asm/atomic.h +1 -1
@@ -338,6 +338,6 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)#endif /* CONFIG_64BIT */ -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* _ASM_PARISC_ATOMIC_H_ */
arch/powerpc/include/asm/atomic.h +1 -1
@@ -472,6 +472,6 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)#endif /* __powerpc64__ */ -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_ATOMIC_H_ */
arch/s390/include/asm/atomic.h +1 -1
@@ -275,6 +275,6 @@ static __inline__ int atomic64_add_unless(atomic64_t *v,#define smp_mb__before_atomic_inc () smp_mb()#define smp_mb__after_atomic_inc () smp_mb() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* __KERNEL__ */ #endif /* __ARCH_S390_ATOMIC__ */
arch/sh/include/asm/atomic.h +1 -1
@@ -84,5 +84,5 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* __ASM_SH_ATOMIC_H */
arch/sparc/include/asm/atomic_32.h +1 -1
@@ -161,5 +161,5 @@ static inline int __atomic24_sub(int i, atomic24_t *v)#endif /* !(__KERNEL__) */ -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* !(__ARCH_SPARC_ATOMIC__) */
arch/sparc/include/asm/atomic_64.h +1 -1
@@ -114,5 +114,5 @@ static inline int atomic64_add_unless(atomic64_t *v, long a, long u)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* !(__ARCH_SPARC64_ATOMIC__) */
arch/x86/include/asm/atomic_32.h +1 -1
@@ -247,5 +247,5 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* _ASM_X86_ATOMIC_32_H */
arch/x86/include/asm/atomic_64.h +1 -1
@@ -455,5 +455,5 @@ static inline void atomic_or_long(unsigned long *v1, unsigned long v2)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* _ASM_X86_ATOMIC_64_H */
arch/xtensa/include/asm/atomic.h +1 -1
@@ -292,7 +292,7 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v)#define smp_mb__before_atomic_inc () barrier()#define smp_mb__after_atomic_inc () barrier() -#include <asm-generic/atomic.h> +#include <asm-generic/atomic-long.h> #endif /* __KERNEL__ */ #endif /* _XTENSA_ATOMIC_H */
include/asm-generic/atomic-long.h renamed from include/asm-generic/atomic.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_GENERIC_ATOMIC_H -#define _ASM_GENERIC_ATOMIC_H +#ifndef _ASM_GENERIC_ATOMIC_LONG_H +#define _ASM_GENERIC_ATOMIC_LONG_H/* * Copyright (C) 2005 Silicon Graphics, Inc. * Christoph Lameter
@@ -255,4 +255,4 @@ static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u)#endif /* BITS_PER_LONG == 64 */ -#endif /* _ASM_GENERIC_ATOMIC_H */ +#endif /* _ASM_GENERIC_ATOMIC_LONG_H */
include/asm-generic/bitops/atomic.h +1 -0
@@ -2,6 +2,7 @@#define _ASM_GENERIC_BITOPS_ATOMIC_H_#include <asm/types.h> +#include <asm/system.h> #ifdef CONFIG_SMP #include <asm/spinlock.h>
Signature · 1 line
1.6.0.4
Arnd Bergmann
maintainerPATCH 7/15 asm-generic: rename page.h and uaccess.h
In reply to Arnd BergmannThe current asm-generic/page.h only contains the get_order function, and asm-generic/uaccess.h only implements unaligned accesses. This renames the file to getorder.h and uaccess-unaligned.h to make room for new page.h and uaccess.h file that will be usable by all simple (e.g. nommu) architectures.
---
arch/alpha/include/asm/page.h | 2 +-
arch/arm/include/asm/page.h | 2 +-
arch/blackfin/include/asm/page.h | 2 +-
arch/cris/include/asm/page.h | 2 +-
arch/frv/include/asm/page.h | 2 +-
arch/h8300/include/asm/page.h | 2 +-
arch/m32r/include/asm/page.h | 2 +-
arch/m68k/include/asm/page_mm.h | 2 +-
arch/m68k/include/asm/page_no.h | 2 +-
arch/microblaze/include/asm/page.h | 2 +-
arch/mips/include/asm/page.h | 2 +-
arch/parisc/include/asm/page.h | 2 +-
arch/parisc/include/asm/uaccess.h | 2 +-
arch/powerpc/include/asm/page_32.h | 2 +-
arch/powerpc/include/asm/page_64.h | 2 +-
arch/s390/include/asm/page.h | 2 +-
arch/sh/include/asm/page.h | 2 +-
arch/sparc/include/asm/page_32.h | 2 +-
arch/sparc/include/asm/page_64.h | 2 +-
arch/sparc/include/asm/uaccess_64.h | 2 +-
arch/um/include/asm/page.h | 2 +-
arch/x86/include/asm/page.h | 2 +-
arch/xtensa/include/asm/page.h | 2 +-
include/asm-generic/{page.h => getorder.h} | 8 ++++----
.../asm-generic/{uaccess.h => uaccess-unaligned.h} | 6 +++---
25 files changed, 30 insertions(+), 30 deletions(-)
rename include/asm-generic/{page.h => getorder.h} (59%)
rename include/asm-generic/{uaccess.h => uaccess-unaligned.h} (82%)arch/alpha/include/asm/page.h +1 -1
@@ -93,6 +93,6 @@ typedef struct page *pgtable_t; VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)#include <asm-generic/memory_model.h> -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* _ALPHA_PAGE_H */
arch/arm/include/asm/page.h +1 -1
@@ -209,6 +209,6 @@ typedef struct page *pgtable_t;#define ARCH_SLAB_MINALIGN 8#endif -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif
arch/blackfin/include/asm/page.h +1 -1
@@ -81,7 +81,7 @@ extern unsigned long memory_end;#define virt_addr_valid (kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ ((void *)(kaddr) < (void *)memory_end)) -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* __ASSEMBLY__ */
arch/cris/include/asm/page.h +1 -1
@@ -68,7 +68,7 @@ typedef struct page *pgtable_t; VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)#include <asm-generic/memory_model.h> -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* _CRIS_PAGE_H */
arch/frv/include/asm/page.h +1 -1
@@ -73,6 +73,6 @@ extern unsigned long max_pfn;#endif /* __ASSEMBLY__ */ #include <asm-generic/memory_model.h> -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* _ASM_PAGE_H */
arch/h8300/include/asm/page.h +1 -1
@@ -73,6 +73,6 @@ extern unsigned long memory_end;#endif /* __ASSEMBLY__ */ #include <asm-generic/memory_model.h> -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* _H8300_PAGE_H */
arch/m32r/include/asm/page.h +1 -1
@@ -82,6 +82,6 @@ typedef struct page *pgtable_t;#define devmem_is_allowed (x) 1#include <asm-generic/memory_model.h> -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* _ASM_M32R_PAGE_H */
arch/m68k/include/asm/page_mm.h +1 -1
@@ -223,6 +223,6 @@ static inline __attribute_const__ int __virt_to_node_shift(void)#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* _M68K_PAGE_H */
arch/m68k/include/asm/page_no.h +1 -1
@@ -72,6 +72,6 @@ extern unsigned long memory_end;#endif /* __ASSEMBLY__ */ -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* _M68KNOMMU_PAGE_H */
arch/microblaze/include/asm/page.h +1 -1
@@ -135,6 +135,6 @@ extern unsigned int memory_size;#endif /* __KERNEL__ */ #include <asm-generic/memory_model.h> -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* _ASM_MICROBLAZE_PAGE_H */
arch/mips/include/asm/page.h +1 -1
@@ -186,6 +186,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;#define CAC_ADDR (addr) ((addr) - UNCAC_BASE + PAGE_OFFSET)#include <asm-generic/memory_model.h> -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* _ASM_PAGE_H */
arch/parisc/include/asm/page.h +1 -1
@@ -159,6 +159,6 @@ extern int npmem_ranges; VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)#include <asm-generic/memory_model.h> -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* _PARISC_PAGE_H */
arch/parisc/include/asm/uaccess.h +1 -1
@@ -7,7 +7,7 @@#include <asm/page.h> #include <asm/system.h> #include <asm/cache.h> -#include <asm-generic/uaccess.h> +#include <asm-generic/uaccess-unaligned.h> #define VERIFY_READ 0#define VERIFY_WRITE 1
arch/powerpc/include/asm/page_32.h +1 -1
@@ -41,7 +41,7 @@ extern void clear_pages(void *page, int order);static inline void clear_page (void *page) {clear_pages (page,0 ); }extern void copy_page (void *to,void *from); -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #define PGD_T_LOG2 (__builtin_ffs(sizeof(pgd_t)) - 1)#define PTE_T_LOG2 (__builtin_ffs(sizeof(pte_t)) - 1)
arch/powerpc/include/asm/page_64.h +1 -1
@@ -180,6 +180,6 @@ do { \ (test_thread_flag (TIF_32BIT ) ? \ VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64) -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* _ASM_POWERPC_PAGE_64_H */
arch/s390/include/asm/page.h +1 -1
@@ -150,7 +150,7 @@ void arch_alloc_page(struct page *page, int order); VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)#include <asm-generic/memory_model.h> -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #define __HAVE_ARCH_GATE_AREA 1
arch/sh/include/asm/page.h +1 -1
@@ -163,7 +163,7 @@ typedef struct page *pgtable_t; VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)#include <asm-generic/memory_model.h> -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> /* vDSO support */ #ifdef CONFIG_VSYSCALL
arch/sparc/include/asm/page_32.h +1 -1
@@ -152,6 +152,6 @@ extern unsigned long pfn_base; VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)#include <asm-generic/memory_model.h> -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* _SPARC_PAGE_H */
arch/sparc/include/asm/page_64.h +1 -1
@@ -132,6 +132,6 @@ typedef struct page *pgtable_t;#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* _SPARC64_PAGE_H */
arch/sparc/include/asm/uaccess_64.h +1 -1
@@ -12,7 +12,7 @@#include <asm/asi.h> #include <asm/system.h> #include <asm/spitfire.h> -#include <asm-generic/uaccess.h> +#include <asm-generic/uaccess-unaligned.h> #endif #ifndef __ASSEMBLY__
arch/um/include/asm/page.h +1 -1
@@ -116,7 +116,7 @@ extern unsigned long uml_physmem;#define virt_addr_valid (v) pfn_valid(phys_to_pfn(__pa(v)))#include <asm-generic/memory_model.h> -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #endif /* __ASSEMBLY__ */ #endif /* __UM_PAGE_H */
arch/x86/include/asm/page.h +1 -1
@@ -56,7 +56,7 @@ extern bool __virt_addr_valid(unsigned long kaddr);#endif /* __ASSEMBLY__ */ #include <asm-generic/memory_model.h> -#include <asm-generic/page.h> +#include <asm-generic/getorder.h> #define __HAVE_ARCH_GATE_AREA 1
arch/xtensa/include/asm/page.h +1 -1
@@ -129,7 +129,7 @@ static inline __attribute_const__ int get_order(unsigned long size)#else -# include <asm-generic/page.h> +# include <asm-generic/getorder.h> #endif
include/asm-generic/getorder.h renamed from include/asm-generic/page.h +4 -4
@@ -1,12 +1,12 @@ -#ifndef _ASM_GENERIC_PAGE_H -#define _ASM_GENERIC_PAGE_H +#ifndef __ASM_GENERIC_GETORDER_H +#define __ASM_GENERIC_GETORDER_H #ifndef __ASSEMBLY__ #include <linux/compiler.h> /* Pure 2^n version of get_order */ -static __inline__ __attribute_const__ int get_order(unsigned long size) +static inline __attribute_const__ int get_order(unsigned long size) { int order;
@@ -21,4 +21,4 @@ static __inline__ __attribute_const__ int get_order(unsigned long size)#endif /* __ASSEMBLY__ */ -#endif /* _ASM_GENERIC_PAGE_H */ +#endif /* __ASM_GENERIC_GETORDER_H */
include/asm-generic/uaccess-unaligned.h renamed from include/asm-generic/uaccess.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_GENERIC_UACCESS_H_ -#define _ASM_GENERIC_UACCESS_H_ +#ifndef __ASM_GENERIC_UACCESS_UNALIGNED_H +#define __ASM_GENERIC_UACCESS_UNALIGNED_H/* * This macro should be used instead of __get_user() when accessing
@@ -23,4 +23,4 @@__copy_to_user ((ptr), &__x,sizeof (*(ptr))) ? -EFAULT :0 ; \ }) -#endif /* _ASM_GENERIC_UACCESS_H */ +#endif /* __ASM_GENERIC_UACCESS_UNALIGNED_H */
Signature · 1 line
1.6.0.4
Arnd Bergmann
maintainerPATCH 8/15 asm-generic: make pci.h usable directly
In reply to Arnd BergmannSome generic code is using the horribly misnamed PCI_DMA_BUS_IS_PHYS from asm/pci.h. This makes sure that an architecture without PCI support does not have to define this itself but can rely on the asm-generic version.
--- arch/frv/include/asm/pci.h | 13 +++---------- arch/m32r/include/asm/pci.h | 2 -- include/asm-generic/pci.h | 8 ++++++++ 3 files changed, 11 insertions(+), 12 deletions(-)
arch/frv/include/asm/pci.h +3 -10
@@ -10,8 +10,8 @@* 2 of the License, or (at your option) any later version. */ -#ifndef ASM_PCI_H -#define ASM_PCI_H +#ifndef _ASM_FRV_PCI_H +#define _ASM_FRV_PCI_H#include <linux/mm.h> #include <asm/scatterlist.h>
@@ -43,12 +43,6 @@ extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,/* Return the index of the PCI controller for device PDEV. */ #define pci_controller_num (PDEV ) (0) -/* The PCI address space does equal the physical memory -* address space. The networking and block device layers use -* this boolean for bounce buffer decisions. -*/ -#define PCI_DMA_BUS_IS_PHYS (1) -/* pci_unmap_{page,single} is a nop so... */ #define DECLARE_PCI_UNMAP_ADDR (ADDR_NAME )#define DECLARE_PCI_UNMAP_LEN (LEN_NAME )
@@ -114,5 +108,4 @@ static inline void pci_dma_sync_sg(struct pci_dev *hwdev, sg_dma_address(&sg[i])+sg_dma_len(&sg[i])); } - -#endif +#endif /* _ASM_FRV_PCI_H */
arch/m32r/include/asm/pci.h +0 -2
@@ -3,6 +3,4 @@#include <asm-generic/pci.h> -#define PCI_DMA_BUS_IS_PHYS (1) -#endif /* _ASM_M32R_PCI_H */
include/asm-generic/pci.h +8 -0
@@ -52,4 +52,12 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) }#endif /* HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ */ +/* +* By default, assume that no iommu is in use and that the PCI +* space is mapped to address physical 0. +*/ +#ifndef PCI_DMA_BUS_IS_PHYS +#define PCI_DMA_BUS_IS_PHYS (1)#endif + +#endif /* _ASM_GENERIC_PCI_H */
Signature · 1 line
1.6.0.4
Arnd Bergmann
maintainerPATCH 9/15 asm-generic: make bitops.h usable
In reply to Arnd Bergmannbitops.h apparently suffered from some level of bitrot, it was missing the smp_mb__{before,after}_clear_bit functions, and included other headers in an invalid order.
This changes the file so that new architectures can use it out of the box.
--- include/asm-generic/bitops.h | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-)
include/asm-generic/bitops.h +18 -6
@@ -1,19 +1,29 @@ -#ifndef _ASM_GENERIC_BITOPS_H_ -#define _ASM_GENERIC_BITOPS_H_ +#ifndef __ASM_GENERIC_BITOPS_H +#define __ASM_GENERIC_BITOPS_H/* * For the benefit of those who are trying to port Linux to another * architecture, here are some C-language equivalents. You should * recode these in the native assembly language, if at all possible. -* +* * C language equivalents written by Theodore Ts'o, 9/26/92 */ -#include <asm-generic/bitops/atomic.h> -#include <asm-generic/bitops/non-atomic.h> +#include <linux/irqflags.h> +#include <linux/compiler.h> + +/* +* clear_bit may not imply a memory barrier +*/ +#ifndef smp_mb__before_clear_bit +#define smp_mb__before_clear_bit () smp_mb() +#define smp_mb__after_clear_bit () smp_mb() +#endif +#include <asm-generic/bitops/__ffs.h> #include <asm-generic/bitops/ffz.h> #include <asm-generic/bitops/fls.h> +#include <asm-generic/bitops/__fls.h> #include <asm-generic/bitops/fls64.h> #include <asm-generic/bitops/find.h>
@@ -26,8 +36,10 @@#include <asm-generic/bitops/hweight.h> #include <asm-generic/bitops/lock.h> +#include <asm-generic/bitops/atomic.h> +#include <asm-generic/bitops/non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-atomic.h> #include <asm-generic/bitops/minix.h> -#endif /* _ASM_GENERIC_BITOPS_H */ +#endif /* __ASM_GENERIC_BITOPS_H */
Signature · 1 line
1.6.0.4
Arnd Bergmann
maintainerPATCH 10/15 asm-generic: add generic versions of common headers
In reply to Arnd BergmannThese are all kernel internal interfaces that get copied around a lot. In most cases, architectures can provide their own optimized versions, but these generic versions can work as well.
I have tried to use the most common contents of each header to allow existing architectures to migrate easily.
Thanks to Remis for suggesting a number of cleanups.
--- include/asm-generic/bugs.h | 10 +++ include/asm-generic/current.h | 9 ++ include/asm-generic/delay.h | 9 ++ include/asm-generic/fb.h | 12 +++ include/asm-generic/hardirq.h | 34 ++++++++ include/asm-generic/irq.h | 18 ++++ include/asm-generic/irqflags.h | 72 ++++++++++++++++ include/asm-generic/kmap_types.h | 29 +++++++ include/asm-generic/linkage.h | 8 ++ include/asm-generic/module.h | 22 +++++ include/asm-generic/mutex.h | 9 ++ include/asm-generic/scatterlist.h | 43 ++++++++++ include/asm-generic/spinlock.h | 11 +++ include/asm-generic/string.h | 10 +++ include/asm-generic/syscalls.h | 60 ++++++++++++++ include/asm-generic/system.h | 161 +++++++++++++++++++++++++++++++++++++ include/asm-generic/unaligned.h | 30 +++++++ include/asm-generic/user.h | 8 ++ 18 files changed, 555 insertions(+), 0 deletions(-) create mode 100644 include/asm-generic/bugs.h create mode 100644 include/asm-generic/current.h create mode 100644 include/asm-generic/delay.h create mode 100644 include/asm-generic/fb.h create mode 100644 include/asm-generic/hardirq.h create mode 100644 include/asm-generic/irq.h create mode 100644 include/asm-generic/irqflags.h create mode 100644 include/asm-generic/kmap_types.h create mode 100644 include/asm-generic/linkage.h create mode 100644 include/asm-generic/module.h create mode 100644 include/asm-generic/mutex.h create mode 100644 include/asm-generic/scatterlist.h create mode 100644 include/asm-generic/spinlock.h create mode 100644 include/asm-generic/string.h create mode 100644 include/asm-generic/syscalls.h create mode 100644 include/asm-generic/system.h create mode 100644 include/asm-generic/unaligned.h create mode 100644 include/asm-generic/user.h
include/asm-generic/bugs.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef __ASM_GENERIC_BUGS_H +#define __ASM_GENERIC_BUGS_H +/* +* This file is included by 'init/main.c' to check for +* architecture-dependent bugs. +*/ + +static inline void check_bugs (void ) { } + +#endif /* __ASM_GENERIC_BUGS_H */
include/asm-generic/current.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef __ASM_GENERIC_CURRENT_H +#define __ASM_GENERIC_CURRENT_H + +#include <linux/thread_info.h> + +#define get_current () (current_thread_info()->task) +#define current get_current() + +#endif /* __ASM_GENERIC_CURRENT_H */
include/asm-generic/delay.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef __ASM_GENERIC_DELAY_H +#define __ASM_GENERIC_DELAY_H + +extern void __udelay (unsigned long usecs); +extern void __delay (unsigned long loops); + +#define udelay (n) __udelay(n) + +#endif /* __ASM_GENERIC_DELAY_H */
include/asm-generic/fb.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef __ASM_GENERIC_FB_H_ +#define __ASM_GENERIC_FB_H_ +#include <linux/fb.h> + +#define fb_pgprotect (...) do {} while (0) + +static inline int fb_is_primary_device (struct fb_info *info) +{ +return 0 ; +} + +#endif /* __ASM_GENERIC_FB_H_ */
include/asm-generic/hardirq.h new file +34 -0
@@ -0,0 +1,34 @@ +#ifndef __ASM_GENERIC_HARDIRQ_H +#define __ASM_GENERIC_HARDIRQ_H + +#include <linux/cache.h> +#include <linux/threads.h> +#include <linux/irq.h> + +typedef struct { +unsigned long __softirq_pending; +}____cacheline_aligned irq_cpustat_t ; + +#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ + +#ifndef HARDIRQ_BITS +#define HARDIRQ_BITS 8 +#endif + +/* +* The hardirq mask has to be large enough to have +* space for potentially all IRQ sources in the system +* nesting on a single CPU: +*/ +#if (1 <<HARDIRQ_BITS ) <NR_IRQS +# error HARDIRQ_BITS is too low! +#endif + +#ifndef ack_bad_irq +static inline void ack_bad_irq (unsigned int irq) +{ +printk (KERN_CRIT "unexpected IRQ trap at vector %02x\n" , irq); +} +#endif + +#endif /* __ASM_GENERIC_HARDIRQ_H */
include/asm-generic/irq.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef __ASM_GENERIC_IRQ_H +#define __ASM_GENERIC_IRQ_H + +/* +* NR_IRQS is the upper bound of how many interrupts can be handled +* in the platform. It is used to size the static irq_map array, +* so don't make it too big. +*/ +#ifndef NR_IRQS +#define NR_IRQS 64 +#endif + +static inline int irq_canonicalize (int irq) +{ +return irq; +} + +#endif /* __ASM_GENERIC_IRQ_H */
include/asm-generic/irqflags.h new file +72 -0
72 lines not on this page · raw message
include/asm-generic/kmap_types.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef __ASM_GENERIC_KMAP_TYPES_H +#define __ASM_GENERIC_KMAP_TYPES_H + +#ifdef CONFIG_DEBUG_HIGHMEM +# define D (n) __KM_FENCE_##n , +#else +# define D (n) +#endif + +enum km_type { +D(0) KM_BOUNCE_READ, +D(1) KM_SKB_SUNRPC_DATA, +D(2) KM_SKB_DATA_SOFTIRQ, +D(3) KM_USER0, +D(4) KM_USER1, +D(5) KM_BIO_SRC_IRQ, +D(6) KM_BIO_DST_IRQ, +D(7) KM_PTE0, +D(8) KM_PTE1, +D(9) KM_IRQ0, +D(10) KM_IRQ1, +D(11) KM_SOFTIRQ0, +D(12) KM_SOFTIRQ1, +D(13) KM_TYPE_NR +}; + +#undef D + +#endif /* __ASM_GENERIC_KMAP_TYPES_H */
include/asm-generic/linkage.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef __ASM_GENERIC_LINKAGE_H +#define __ASM_GENERIC_LINKAGE_H +/* +* linux/linkage.h provides reasonable defaults. +* an architecture can override them by providing its own version. +*/ + +#endif /* __ASM_GENERIC_LINKAGE_H */
include/asm-generic/module.h new file +22 -0
@@ -0,0 +1,22 @@ +#ifndef __ASM_GENERIC_MODULE_H +#define __ASM_GENERIC_MODULE_H + +/* +* Many architectures just need a simple module +* loader without arch specific data. +*/ +struct mod_arch_specific +{ +}; + +#ifdef CONFIG_64BIT +#define Elf_Shdr Elf64_Shdr +#define Elf_Sym Elf64_Sym +#define Elf_Ehdr Elf64_Ehdr +#else +#define Elf_Shdr Elf32_Shdr +#define Elf_Sym Elf32_Sym +#define Elf_Ehdr Elf32_Ehdr +#endif + +#endif /* __ASM_GENERIC_MODULE_H */
include/asm-generic/mutex.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef __ASM_GENERIC_MUTEX_H +#define __ASM_GENERIC_MUTEX_H +/* +* Pull in the generic implementation for the mutex fastpath, +* which is a reasonable default on many architectures. +*/ + +#include <asm-generic/mutex-dec.h> +#endif /* __ASM_GENERIC_MUTEX_H */
include/asm-generic/scatterlist.h new file +43 -0
43 lines not on this page · raw message
include/asm-generic/spinlock.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef __ASM_GENERIC_SPINLOCK_H +#define __ASM_GENERIC_SPINLOCK_H +/* +* You need to implement asm/spinlock.h for SMP support. The generic +* version does not handle SMP. +*/ +#ifdef CONFIG_SMP +#error need an architecture specific asm/spinlock.h +#endif + +#endif /* __ASM_GENERIC_SPINLOCK_H */
include/asm-generic/string.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef __ASM_GENERIC_STRING_H +#define __ASM_GENERIC_STRING_H +/* +* The kernel provides all required functions in lib/string.c +* +* Architectures probably want to provide at least their own optimized +* memcpy and memset functions though. +*/ + +#endif /* __ASM_GENERIC_STRING_H */
include/asm-generic/syscalls.h new file +60 -0
60 lines not on this page · raw message
include/asm-generic/system.h new file +161 -0
161 lines not on this page · raw message
include/asm-generic/unaligned.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef __ASM_GENERIC_UNALIGNED_H +#define __ASM_GENERIC_UNALIGNED_H + +/* +* This is the most generic implementation of unaligned accesses +* and should work almost anywhere. +* +* If an architecture can handle unaligned accesses in hardware, +* it may want to use the linux/unaligned/access_ok.h implementation +* instead. +*/ +#include <asm/byteorder.h> + +#if defined(__LITTLE_ENDIAN) +# include <linux/unaligned/le_struct.h> +# include <linux/unaligned/be_byteshift.h> +# include <linux/unaligned/generic.h> +# define get_unaligned __get_unaligned_le +# define put_unaligned __put_unaligned_le +#elif defined(__BIG_ENDIAN) +# include <linux/unaligned/be_struct.h> +# include <linux/unaligned/le_byteshift.h> +# include <linux/unaligned/generic.h> +# define get_unaligned __get_unaligned_be +# define put_unaligned __put_unaligned_be +#else +# error need to define endianess +#endif + +#endif /* __ASM_GENERIC_UNALIGNED_H */
include/asm-generic/user.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef __ASM_GENERIC_USER_H +#define __ASM_GENERIC_USER_H +/* +* This file may define a 'struct user' structure. However, it it only +* used for a.out file, which are not supported on new architectures. +*/ + +#endif /* __ASM_GENERIC_USER_H */
Signature · 1 line
1.6.0.4
Arnd Bergmann
maintainerPATCH 11/15 asm-generic: add legacy I/O header files
In reply to Arnd BergmannThe dma.h, hw_irq.h, serial.h and timex.h files originally described PC-style i8237, i8259A, i8250, i8253 and i8255 chips as well as the VGA style text mode graphics.
Modern architectures live happily without these specific interfaces, but a few definitions from these headers keep getting used in common code.
The new generic headers are what most architectures use anyway nowadays, just implementing the minimal definitions.
--- include/asm-generic/dma.h | 15 +++++++++++++++ include/asm-generic/hw_irq.h | 9 +++++++++ include/asm-generic/parport.h | 23 +++++++++++++++++++++++ include/asm-generic/serial.h | 13 +++++++++++++ include/asm-generic/timex.h | 22 ++++++++++++++++++++++ include/asm-generic/vga.h | 24 ++++++++++++++++++++++++ 6 files changed, 106 insertions(+), 0 deletions(-) create mode 100644 include/asm-generic/dma.h create mode 100644 include/asm-generic/hw_irq.h create mode 100644 include/asm-generic/parport.h create mode 100644 include/asm-generic/serial.h create mode 100644 include/asm-generic/timex.h create mode 100644 include/asm-generic/vga.h
include/asm-generic/dma.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef __ASM_GENERIC_DMA_H +#define __ASM_GENERIC_DMA_H +/* +* This file traditionally describes the i8237 PC style DMA controller. +* Most architectures don't have these any more and can get the minimal +* implementation from kernel/dma.c by not defining MAX_DMA_CHANNELS. +* +* Some code relies on seeing MAX_DMA_ADDRESS though. +*/ +#define MAX_DMA_ADDRESS PAGE_OFFSET + +extern int request_dma (unsigned int dmanr,const char *device_id); +extern void free_dma (unsigned int dmanr); + +#endif /* __ASM_GENERIC_DMA_H */
include/asm-generic/hw_irq.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef __ASM_GENERIC_HW_IRQ_H +#define __ASM_GENERIC_HW_IRQ_H +/* +* hw_irq.h has internal declarations for the low-level interrupt +* controller, like the original i8259A. +* In general, this is not needed for new architectures. +*/ + +#endif /* __ASM_GENERIC_HW_IRQ_H */
include/asm-generic/parport.h new file +23 -0
@@ -0,0 +1,23 @@ +#ifndef __ASM_GENERIC_PARPORT_H +#define __ASM_GENERIC_PARPORT_H + +/* +* An ISA bus may have i8255 parallel ports at well-known +* locations in the I/O space, which are scanned by +* parport_pc_find_isa_ports. +* +* Without ISA support, the driver will only attach +* to devices on the PCI bus. +*/ + +static int __devinit parport_pc_find_isa_ports (int autoirq,int autodma); +static int __devinit parport_pc_find_nonpci_ports (int autoirq,int autodma) +{ +#ifdef CONFIG_ISA +return parport_pc_find_isa_ports (autoirq, autodma); +#else +return 0 ; +#endif +} + +#endif /* __ASM_GENERIC_PARPORT_H */
include/asm-generic/serial.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef __ASM_GENERIC_SERIAL_H +#define __ASM_GENERIC_SERIAL_H + +/* +* This should not be an architecture specific #define, oh well. +* +* Traditionally, it just describes i8250 and related serial ports +* that have this clock rate. +*/ + +#define BASE_BAUD (1843200 / 16) + +#endif /* __ASM_GENERIC_SERIAL_H */
include/asm-generic/timex.h new file +22 -0
@@ -0,0 +1,22 @@ +#ifndef __ASM_GENERIC_TIMEX_H +#define __ASM_GENERIC_TIMEX_H + +/* +* If you have a cycle counter, return the value here. +*/ +typedef unsigned long cycles_t ; +#ifndef get_cycles +static inline cycles_t get_cycles (void ) +{ +return 0 ; +} +#endif + +/* +* Architectures are encouraged to implement read_current_timer +* and define this in order to avoid the expensive delay loop +* calibration during boot. +*/ +#undef ARCH_HAS_READ_CURRENT_TIMER + +#endif /* __ASM_GENERIC_TIMEX_H */
include/asm-generic/vga.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Access to VGA videoram +* +* (c) 1998 Martin Mares <[email protected]> +*/ +#ifndef __ASM_GENERIC_VGA_H +#define __ASM_GENERIC_VGA_H + +/* +* On most architectures that support VGA, we can just +* recalculate addresses and then access the videoram +* directly without any black magic. +* +* Everyone else needs to ioremap the address and use +* proper I/O accesses. +*/ +#ifndef VGA_MAP_MEM +#define VGA_MAP_MEM (x, s) (unsigned long)phys_to_virt(x) +#endif + +#define vga_readb (x) (*(x)) +#define vga_writeb (x, y) (*(y) = (x)) + +#endif /* _ASM_GENERIC_VGA_H */
Signature · 1 line
1.6.0.4
Arnd Bergmann
maintainerPATCH 12/15 asm-generic: add generic atomic.h and io.h
In reply to Arnd Bergmannatomic.h and io.h are based on the mn10300 architecture, which is already pretty generic and can be used by other architectures that do not have hardware support for atomic operations or out-of-order I/O access.
--- include/asm-generic/atomic.h | 165 +++++++++++++++++++++++ include/asm-generic/io.h | 300 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 465 insertions(+), 0 deletions(-) create mode 100644 include/asm-generic/atomic.h create mode 100644 include/asm-generic/io.h
include/asm-generic/atomic.h new file +165 -0
@@ -0,0 +1,165 @@ +/* +* Generic C implementation of atomic counter operations +* Originally implemented for MN10300. +* +* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. +* Written by David Howells ([email protected]) +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public Licence +* as published by the Free Software Foundation; either version +* 2 of the Licence, or (at your option) any later version. +*/ +#ifndef __ASM_GENERIC_ATOMIC_H +#define __ASM_GENERIC_ATOMIC_H + +#ifdef CONFIG_SMP +#error not SMP safe +#endif + +/* +* Atomic operations that C can't guarantee us. Useful for +* resource counting etc.. +*/ + +#define ATOMIC_INIT (i) { (i) } + +#ifdef __KERNEL__ + +/** +* atomic_read - read atomic variable +* @v: pointer of type atomic_t +* +* Atomically reads the value of @v. Note that the guaranteed +* useful range of an atomic_t is only 24 bits. +*/ +#define atomic_read (v) ((v)->counter) + +/** +* atomic_set - set atomic variable +* @v: pointer of type atomic_t +* @i: required value +* +* Atomically sets the value of @v to @i. Note that the guaranteed +* useful range of an atomic_t is only 24 bits. +*/ +#define atomic_set (v, i) (((v)->counter) = (i)) + +#include <asm/system.h> + +/** +* atomic_add_return - add integer to atomic variable +* @i: integer value to add +* @v: pointer of type atomic_t +* +* Atomically adds @i to @v and returns the result +* Note that the guaranteed useful range of an atomic_t is only 24 bits. +*/ +static inline int atomic_add_return (int i,atomic_t *v) +{ +unsigned long flags; +int temp; + +local_irq_save (flags); + temp = v->counter; + temp += i; + v->counter = temp; +local_irq_restore (flags); + +return temp; +} + +/** +* atomic_sub_return - subtract integer from atomic variable +* @i: integer value to subtract +* @v: pointer of type atomic_t +* +* Atomically subtracts @i from @v and returns the result +* Note that the guaranteed useful range of an atomic_t is only 24 bits. +*/ +static inline int atomic_sub_return (int i,atomic_t *v) +{ +unsigned long flags; +int temp; + +local_irq_save (flags); + temp = v->counter; + temp -= i; + v->counter = temp; +local_irq_restore (flags); + +return temp; +} + +static inline int atomic_add_negative (int i,atomic_t *v) +{ +return atomic_add_return (i, v) <0 ; +} + +static inline void atomic_add (int i,atomic_t *v) +{ +atomic_add_return (i, v); +} + +static inline void atomic_sub (int i,atomic_t *v) +{ +atomic_sub_return (i, v); +} + +static inline void atomic_inc (atomic_t *v) +{ +atomic_add_return (1 , v); +} + +static inline void atomic_dec (atomic_t *v) +{ +atomic_sub_return (1 , v); +} + +#define atomic_dec_return (v) atomic_sub_return(1, (v)) +#define atomic_inc_return (v) atomic_add_return(1, (v)) + +#define atomic_sub_and_test (i, v) (atomic_sub_return((i), (v)) == 0) +#define atomic_dec_and_test (v) (atomic_sub_return(1, (v)) == 0) +#define atomic_inc_and_test (v) (atomic_add_return(1, (v)) == 0) + +#define atomic_add_unless (v, a, u) \ +({ \ + int c, old; \ + c = atomic_read(v); \ + while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ + c = old; \ + c != (u); \ +}) + +#define atomic_inc_not_zero (v) atomic_add_unless((v), 1, 0) + +static inline void atomic_clear_mask (unsigned long mask,unsigned long *addr) +{ +unsigned long flags; + + mask = ~mask; +local_irq_save (flags); + *addr &= mask; +local_irq_restore (flags); +} + +#define atomic_xchg (ptr, v) (xchg(&(ptr)->counter, (v))) +#define atomic_cmpxchg (v, old, new) (cmpxchg(&((v)->counter), (old), (new))) + +#define cmpxchg_local (ptr, o, n) \ + ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ + (unsigned long)(n), sizeof(*(ptr)))) + +#define cmpxchg64_local (ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) + +/* Assume that atomic operations are already serializing */ +#define smp_mb__before_atomic_dec () barrier() +#define smp_mb__after_atomic_dec () barrier() +#define smp_mb__before_atomic_inc () barrier() +#define smp_mb__after_atomic_inc () barrier() + +#include <asm-generic/atomic-long.h> + +#endif /* __KERNEL__ */ +#endif /* __ASM_GENERIC_ATOMIC_H */
include/asm-generic/io.h new file +300 -0
300 lines not on this page · raw message
Signature · 1 line
1.6.0.4
Arnd Bergmann
maintainerPATCH 13/15 asm-generic: add generic NOMMU versions of some headers
In reply to Arnd BergmannMemory management in generic is highly architecture specific, but on NOMMU architectures, it is mostly trivial, so just add a default implementation in asm-generic that applies to all NOMMU architectures.
The two files cache.h and cacheflush.h can possibly also be used by architectures that have an MMU but never require flushing the cache or have cache lines larger than 32 bytes.
--- include/asm-generic/cache.h | 12 +++++ include/asm-generic/cacheflush.h | 30 +++++++++++ include/asm-generic/mmu.h | 15 ++++++ include/asm-generic/mmu_context.h | 45 +++++++++++++++++ include/asm-generic/page.h | 99 +++++++++++++++++++++++++++++++++++++ include/asm-generic/pgalloc.h | 12 +++++ include/asm-generic/segment.h | 9 +++ include/asm-generic/tlbflush.h | 18 +++++++ 8 files changed, 240 insertions(+), 0 deletions(-) create mode 100644 include/asm-generic/cache.h create mode 100644 include/asm-generic/cacheflush.h create mode 100644 include/asm-generic/mmu.h create mode 100644 include/asm-generic/mmu_context.h create mode 100644 include/asm-generic/page.h create mode 100644 include/asm-generic/pgalloc.h create mode 100644 include/asm-generic/segment.h create mode 100644 include/asm-generic/tlbflush.h
include/asm-generic/cache.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef __ASM_GENERIC_CACHE_H +#define __ASM_GENERIC_CACHE_H +/* +* 32 bytes appears to be the most common cache line size, +* so make that the default here. Architectures with larger +* cache lines need to provide their own cache.h. +*/ + +#define L1_CACHE_SHIFT 5 +#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) + +#endif /* __ASM_GENERIC_CACHE_H */
include/asm-generic/cacheflush.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef __ASM_CACHEFLUSH_H +#define __ASM_CACHEFLUSH_H + +/* Keep includes the same across arches. */ +#include <linux/mm.h> + +/* +* The cache doesn't need to be flushed when TLB entries change when +* the cache is mapped to physical memory, not virtual memory +*/ +#define flush_cache_all () do { } while (0) +#define flush_cache_mm (mm) do { } while (0) +#define flush_cache_dup_mm (mm) do { } while (0) +#define flush_cache_range (vma, start, end) do { } while (0) +#define flush_cache_page (vma, vmaddr, pfn) do { } while (0) +#define flush_dcache_page (page) do { } while (0) +#define flush_dcache_mmap_lock (mapping) do { } while (0) +#define flush_dcache_mmap_unlock (mapping) do { } while (0) +#define flush_icache_range (start, end) do { } while (0) +#define flush_icache_page (vma,pg) do { } while (0) +#define flush_icache_user_range (vma,pg,adr,len) do { } while (0) +#define flush_cache_vmap (start, end) do { } while (0) +#define flush_cache_vunmap (start, end) do { } while (0) + +#define copy_to_user_page (vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) +#define copy_from_user_page (vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + +#endif /* __ASM_CACHEFLUSH_H */
include/asm-generic/mmu.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef __ASM_GENERIC_MMU_H +#define __ASM_GENERIC_MMU_H + +/* +* This is the mmu.h header for nommu implementations. +* Architectures with an MMU need something more complex. +*/ +#ifndef __ASSEMBLY__ +typedef struct { +struct vm_list_struct *vmlist; +unsigned long end_brk; +}mm_context_t ; +#endif + +#endif /* __ASM_GENERIC_MMU_H */
include/asm-generic/mmu_context.h new file +45 -0
45 lines not on this page · raw message
include/asm-generic/page.h new file +99 -0
99 lines not on this page · raw message
include/asm-generic/pgalloc.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef __ASM_GENERIC_PGALLOC_H +#define __ASM_GENERIC_PGALLOC_H +/* +* an empty file is enough for a nommu architecture +*/ +#ifdef CONFIG_MMU +#error need to implement an architecture specific asm/pgalloc.h +#endif + +#define check_pgt_cache () do { } while (0) + +#endif /* __ASM_GENERIC_PGALLOC_H */
include/asm-generic/segment.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef __ASM_GENERIC_SEGMENT_H +#define __ASM_GENERIC_SEGMENT_H +/* +* Only here because we have some old header files that expect it... +* +* New architectures probably don't want to have their own version. +*/ + +#endif /* __ASM_GENERIC_SEGMENT_H */
include/asm-generic/tlbflush.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef __ASM_GENERIC_TLBFLUSH_H +#define __ASM_GENERIC_TLBFLUSH_H +/* +* This is a dummy tlbflush implementation that can be used on all +* nommu architectures. +* If you have an MMU, you need to write your own functions. +*/ +#ifdef CONFIG_MMU +#error need to implement an architecture specific asm/tlbflush.h +#endif + +static inline void flush_tlb_mm (struct mm_struct *mm) +{ +BUG (); +} + + +#endif /* __ASM_GENERIC_TLBFLUSH_H */
Signature · 1 line
1.6.0.4
Arnd Bergmann
maintainerPATCH 14/15 asm-generic: add a generic uaccess.h
In reply to Arnd BergmannBased on discussions with Michal Simek and code from m68knommu and h8300, this version of uaccess.h should be usable by most architectures, by overriding some parts of it.
Simple NOMMU architectures can use it out of
the box, but a minimal __access_ok() should be
added there as well.
--- include/asm-generic/uaccess.h | 325 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 325 insertions(+), 0 deletions(-) create mode 100644 include/asm-generic/uaccess.h
include/asm-generic/uaccess.h new file +325 -0
@@ -0,0 +1,325 @@ +#ifndef __ASM_GENERIC_UACCESS_H +#define __ASM_GENERIC_UACCESS_H + +/* +* User space memory access functions, these should work +* on a ny machine that has kernel and user data in the same +* address space, e.g. all NOMMU machines. +*/ +#include <linux/sched.h> +#include <linux/mm.h> +#include <linux/string.h> + +#include <asm/segment.h> + +#define MAKE_MM_SEG (s) ((mm_segment_t) { (s) }) + +#ifndef KERNEL_DS +#define KERNEL_DS MAKE_MM_SEG(~0UL) +#endif + +#ifndef USER_DS +#define USER_DS MAKE_MM_SEG(TASK_SIZE - 1) +#endif + +#ifndef get_fs +#define get_ds () (KERNEL_DS) +#define get_fs () (current_thread_info()->addr_limit) + +static inline void set_fs (mm_segment_t fs) +{ +current_thread_info ()->addr_limit = fs; +} +#endif + +#define segment_eq (a, b) ((a).seg == (b).seg) + +#define VERIFY_READ 0 +#define VERIFY_WRITE 1 + +#define access_ok (type, addr, size) __access_ok((unsigned long)(addr),(size)) + +/* +* The architecture should really override this if possible, at least +* doing a check on the get_fs() +*/ +#ifndef __access_ok +static inline int __access_ok (unsigned long addr,unsigned long size) +{ +return 1 ; +} +#endif + +/* +* The exception table consists of pairs of addresses: the first is the +* address of an instruction that is allowed to fault, and the second is +* the address at which the program should continue. No registers are +* modified, so it is entirely up to the continuation code to figure out +* what to do. +* +* All the routines below use bits of fixup code that are out of line +* with the main instruction path. This means when everything is well, +* we don't even have to jump over them. Further, they do not intrude +* on our cache or tlb entries. +*/ + +struct exception_table_entry +{ +unsigned long insn, fixup; +}; + +/* Returns 0 if exception not found and fixup otherwise. */ +extern unsigned long search_exception_table (unsigned long ); + +/* +* architectures with an MMU should override these two +*/ +#ifndef __copy_from_user +static inline __must_check long __copy_from_user (void *to, +const void __user * from,unsigned long n) +{ +if (__builtin_constant_p (n)) { +switch (n) { +case 1 : + *(u8 *)to = *(u8 __force *)from; +return 0 ; +case 2 : + *(u16 *)to = *(u16 __force *)from; +return 0 ; +case 4 : + *(u32 *)to = *(u32 __force *)from; +return 0 ; +#ifdef CONFIG_64BIT +case 8 : + *(u64 *)to = *(u64 __force *)from; +return 0 ; +#endif +default : +break ; + } + } + +memcpy (to, (const void __force *)from, n); +return 0 ; +} +#endif + +#ifndef __copy_to_user +static inline __must_check long __copy_to_user (void __user *to, +const void *from,unsigned long n) +{ +if (__builtin_constant_p (n)) { +switch (n) { +case 1 : + *(u8 __force *)to = *(u8 *)from; +return 0 ; +case 2 : + *(u16 __force *)to = *(u16 *)from; +return 0 ; +case 4 : + *(u32 __force *)to = *(u32 *)from; +return 0 ; +#ifdef CONFIG_64BIT +case 8 : + *(u64 __force *)to = *(u64 *)from; +return 0 ; +#endif +default : +break ; + } + } + +memcpy ((void __force *)to, from, n); +return 0 ; +} +#endif + +/* +* These are the main single-value transfer routines. They automatically +* use the right size if we just have the right pointer type. +* This version just falls back to copy_{from,to}_user, which should +* provide a fast-path for small values. +*/ +#define __put_user (x, ptr) \ +({ \ + __typeof__(*(ptr)) __x = (x); \ + int __pu_err = -EFAULT; \ + __chk_user_ptr(ptr); \ + switch (sizeof (*(ptr))) { \ + case 1: \ + case 2: \ + case 4: \ + case 8: \ + __pu_err = __put_user_fn(sizeof (*(ptr)), \ + ptr, &__x); \ + break; \ + default: \ + __put_user_bad(); \ + break; \ + } \ + __pu_err; \ +}) + +#define put_user (x, ptr) \ +({ \ + might_sleep(); \ + __access_ok(ptr, sizeof (*ptr)) ? \ + __put_user(x, ptr) : \ + -EFAULT; \ +}) + +static inline int __put_user_fn (size_t size,void __user *ptr,void *x) +{ + size =__copy_to_user (ptr, x, size); +return size ? -EFAULT : size; +} + +extern int __put_user_bad (void ) __attribute__((noreturn)); + +#define __get_user (x, ptr) \ +({ \ + int __gu_err = -EFAULT; \ + __chk_user_ptr(ptr); \ + switch (sizeof(*(ptr))) { \ + case 1: { \ + unsigned char __x; \ + __gu_err = __get_user_fn(sizeof (*(ptr)), \ + ptr, &__x); \ + (x) = *(__force __typeof__(*(ptr)) *) &__x; \ + break; \ + }; \ + case 2: { \ + unsigned short __x; \ + __gu_err = __get_user_fn(sizeof (*(ptr)), \ + ptr, &__x); \ + (x) = *(__force __typeof__(*(ptr)) *) &__x; \ + break; \ + }; \ + case 4: { \ + unsigned int __x; \ + __gu_err = __get_user_fn(sizeof (*(ptr)), \ + ptr, &__x); \ + (x) = *(__force __typeof__(*(ptr)) *) &__x; \ + break; \ + }; \ + case 8: { \ + unsigned long long __x; \ + __gu_err = __get_user_fn(sizeof (*(ptr)), \ + ptr, &__x); \ + (x) = *(__force __typeof__(*(ptr)) *) &__x; \ + break; \ + }; \ + default: \ + __get_user_bad(); \ + break; \ + } \ + __gu_err; \ +}) + +#define get_user (x, ptr) \ +({ \ + might_sleep(); \ + __access_ok(ptr, sizeof (*ptr)) ? \ + __get_user(x, ptr) : \ + -EFAULT; \ +}) + +static inline int __get_user_fn (size_t size,const void __user *ptr,void *x) +{ + size =__copy_from_user (x, ptr, size); +return size ? -EFAULT : size; +} + +extern int __get_user_bad (void ) __attribute__((noreturn)); + +#ifndef __copy_from_user_inatomic +#define __copy_from_user_inatomic __copy_from_user +#endif + +#ifndef __copy_to_user_inatomic +#define __copy_to_user_inatomic __copy_to_user +#endif + +static inline long copy_from_user (void *to, +const void __user * from,unsigned long n) +{ +might_sleep (); +if (__access_ok (from, n)) +return __copy_from_user (to, from, n); +else +return n; +} + +static inline long copy_to_user (void __user *to, +const void *from,unsigned long n) +{ +might_sleep (); +if (__access_ok (to, n)) +return __copy_to_user (to, from, n); +else +return n; +} + +/* +* Copy a null terminated string from userspace. +*/ +#ifndef __strncpy_from_user +static inline long +__strncpy_from_user (char *dst,const char __user *src,long count) +{ +char *tmp; +strncpy (dst, (const char __force *)src, count); +for (tmp = dst; *tmp && count >0 ; tmp++, count--) + ; +return (tmp - dst); +} +#endif + +static inline long +strncpy_from_user (char *dst,const char __user *src,long count) +{ +if (!__access_ok (src,1 )) +return -EFAULT ; +return __strncpy_from_user (dst, src, count); +} + +/* +* Return the size of a string (including the ending 0) +* +* Return 0 on exception, a value greater than N if too long +*/ +#ifndef strnlen_user +static inline long strnlen_user (const char __user *src,long n) +{ +return strlen ((void *__force )src) +1 ; +} +#endif + +static inline long strlen_user (const char __user *src) +{ +return strnlen_user (src,32767 ); +} + +/* +* Zero Userspace +*/ +#ifndef __clear_user +static inline __must_check unsigned long +__clear_user (void __user *to,unsigned long n) +{ +memset ((void __force *)to,0 , n); +return 0 ; +} +#endif + +static inline __must_check unsigned long +clear_user (void __user *to,unsigned long n) +{ +might_sleep (); +if (!__access_ok (to, n)) +return n; + +return __clear_user (to, n); +} + +#endif /* __ASM_GENERIC_UACCESS_H */
Signature · 1 line
1.6.0.4
Arnd Bergmann
maintainerPATCH 15/15 add generic lib/checksum.c
In reply to Arnd BergmannAdd a generic (unoptimized) implementation of checksum.c in pure C for use by all architectures.
Based on microblaze code by Michal Simek <[email protected]>
--- include/asm-generic/checksum.h | 79 ++++++++++++++++ lib/Makefile | 2 + lib/checksum.c | 193 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 274 insertions(+), 0 deletions(-) create mode 100644 include/asm-generic/checksum.h create mode 100644 lib/checksum.c
include/asm-generic/checksum.h new file +79 -0
@@ -0,0 +1,79 @@ +#ifndef __ASM_GENERIC_CHECKSUM_H +#define __ASM_GENERIC_CHECKSUM_H + +/* +* computes the checksum of a memory block at buff, length len, +* and adds in "sum" (32-bit) +* +* returns a 32-bit number suitable for feeding into itself +* or csum_tcpudp_magic +* +* this function must be called with even lengths, except +* for the last fragment, which may be odd +* +* it's best to have buff aligned on a 32-bit boundary +*/ +extern __wsum csum_partial (const void *buff,int len,__wsum sum); + +/* +* the same as csum_partial, but copies from src while it +* checksums +* +* here even more important to align src and dst on a 32-bit (or even +* better 64-bit) boundary +*/ +extern __wsum csum_partial_copy (const void *src,void *dst,int len,__wsum sum); + +/* +* the same as csum_partial_copy, but copies from user space. +* +* here even more important to align src and dst on a 32-bit (or even +* better 64-bit) boundary +*/ +extern __wsum csum_partial_copy_from_user (const void __user *src,void *dst, +int len,__wsum sum,int *csum_err); + +#define csum_partial_copy_nocheck (src, dst, len, sum) \ + csum_partial_copy((src), (dst), (len), (sum)) + +/* +* This is a version of ip_compute_csum() optimized for IP headers, +* which always checksum on 4 octet boundaries. +*/ +extern __sum16 ip_fast_csum (const void *iph,unsigned int ihl); + +/* +* Fold a partial checksum +*/ +static inline __sum16 csum_fold (__wsum csum) +{ +u32 sum = (__force u32 )csum; + sum = (sum &0xffff ) + (sum >>16 ); + sum = (sum &0xffff ) + (sum >>16 ); +return (__force __sum16 )~sum; +} + +#ifndef csum_tcpudp_nofold +/* +* computes the checksum of the TCP/UDP pseudo-header +* returns a 16-bit checksum, already complemented +*/ +extern __wsum +csum_tcpudp_nofold (__be32 saddr,__be32 daddr,unsigned short len, +unsigned short proto,__wsum sum); +#endif + +static inline __sum16 +csum_tcpudp_magic (__be32 saddr,__be32 daddr,unsigned short len, +unsigned short proto,__wsum sum) +{ +return csum_fold (csum_tcpudp_nofold (saddr, daddr, len, proto, sum)); +} + +/* +* this routine is used for miscellaneous IP-like checksums, mainly +* in icmp.c +*/ +extern __sum16 ip_compute_csum (const void *buff,int len); + +#endif /* __ASM_GENERIC_CHECKSUM_H */
lib/Makefile +2 -0
@@ -92,6 +92,8 @@ obj-$(CONFIG_NLATTR) += nlattr.o obj-$(CONFIG_DMA_API_DEBUG) += dma-debug.o +obj-$(CONFIG_GENERIC_CSUM) += checksum.o + hostprogs-y := gen_crc32table clean-files := crc32table.h
lib/checksum.c new file +193 -0
193 lines not on this page · raw message
Signature · 1 line
1.6.0.4
Hi Arnd,
Quoted 4 lines · On Wed, 13 May 2009 22:56:23 +0000 Arnd Bergmann <[email protected]> wrote:
Stephen, can you add git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic next to linux-next?
I will try this tomorrow. It will be interesting to see just how many conflicts we get.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Arnd Bergmann
maintainerQuoted 10 lines · Stephen Rothwell
Hi Arnd,
Quoted 4 lines · On Wed, 13 May 2009 22:56:23 +0000 Arnd Bergmann <[email protected]> wrote:
Stephen, can you add git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic next to linux-next?
I will try this tomorrow. It will be interesting to see just how many conflicts we get.
Thanks!
I've tried to make this patch set as non-invasive as possible, basically just adding files and making single line changes to existing files where necessary. I've never seen conflicts when I tried merging with linux-next/master.
In the beginning, I was thinking about doing one series per file, adding the asm-generic version in one patch and changing the per-arch versions to use it in follow-on patches.
Hopefully, the way I'm doing it now turns out to be less time consuming, as I can add all the generic headers once without impacting any of the architectures, and the next patches can easily be done in the arch maintainer tree for all files at once.
Arnd <><
Hi Arnd,
Quoted 5 lines · On Thu, 14 May 2009 09:28:01 +0200 Arnd Bergmann <[email protected]> wrote:
I've tried to make this patch set as non-invasive as possible, basically just adding files and making single line changes to existing files where necessary. I've never seen conflicts when I tried merging with linux-next/master.
Yeah, I just did a test merge and no conflicts at all! A test merge against mmotm seems to get conflicts only in files not modified by your patches.
Looks good from that point of view.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/