Creation of Cybook 2416 (actually Gen4) repository
This commit is contained in:
37
include/asm-generic/4level-fixup.h
Normal file
37
include/asm-generic/4level-fixup.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef _4LEVEL_FIXUP_H
|
||||
#define _4LEVEL_FIXUP_H
|
||||
|
||||
#define __ARCH_HAS_4LEVEL_HACK
|
||||
#define __PAGETABLE_PUD_FOLDED
|
||||
|
||||
#define PUD_SIZE PGDIR_SIZE
|
||||
#define PUD_MASK PGDIR_MASK
|
||||
#define PTRS_PER_PUD 1
|
||||
|
||||
#define pud_t pgd_t
|
||||
|
||||
#define pmd_alloc(mm, pud, address) \
|
||||
((unlikely(pgd_none(*(pud))) && __pmd_alloc(mm, pud, address))? \
|
||||
NULL: pmd_offset(pud, address))
|
||||
|
||||
#define pud_alloc(mm, pgd, address) (pgd)
|
||||
#define pud_offset(pgd, start) (pgd)
|
||||
#define pud_none(pud) 0
|
||||
#define pud_bad(pud) 0
|
||||
#define pud_present(pud) 1
|
||||
#define pud_ERROR(pud) do { } while (0)
|
||||
#define pud_clear(pud) pgd_clear(pud)
|
||||
#define pud_val(pud) pgd_val(pud)
|
||||
#define pud_populate(mm, pud, pmd) pgd_populate(mm, pud, pmd)
|
||||
#define pud_page(pud) pgd_page(pud)
|
||||
#define pud_page_vaddr(pud) pgd_page_vaddr(pud)
|
||||
|
||||
#undef pud_free_tlb
|
||||
#define pud_free_tlb(tlb, x) do { } while (0)
|
||||
#define pud_free(x) do { } while (0)
|
||||
#define __pud_free_tlb(tlb, x) do { } while (0)
|
||||
|
||||
#undef pud_addr_end
|
||||
#define pud_addr_end(addr, end) (end)
|
||||
|
||||
#endif
|
||||
11
include/asm-generic/Kbuild
Normal file
11
include/asm-generic/Kbuild
Normal file
@@ -0,0 +1,11 @@
|
||||
header-y += errno-base.h
|
||||
header-y += errno.h
|
||||
header-y += fcntl.h
|
||||
header-y += ioctl.h
|
||||
header-y += ipc.h
|
||||
header-y += mman.h
|
||||
header-y += signal.h
|
||||
header-y += statfs.h
|
||||
|
||||
unifdef-y += resource.h
|
||||
unifdef-y += siginfo.h
|
||||
35
include/asm-generic/Kbuild.asm
Normal file
35
include/asm-generic/Kbuild.asm
Normal file
@@ -0,0 +1,35 @@
|
||||
unifdef-y += a.out.h
|
||||
unifdef-y += auxvec.h
|
||||
unifdef-y += byteorder.h
|
||||
unifdef-y += errno.h
|
||||
unifdef-y += fcntl.h
|
||||
unifdef-y += ioctl.h
|
||||
unifdef-y += ioctls.h
|
||||
unifdef-y += ipcbuf.h
|
||||
unifdef-y += mman.h
|
||||
unifdef-y += msgbuf.h
|
||||
unifdef-y += param.h
|
||||
unifdef-y += poll.h
|
||||
unifdef-y += posix_types.h
|
||||
unifdef-y += ptrace.h
|
||||
unifdef-y += resource.h
|
||||
unifdef-y += sembuf.h
|
||||
unifdef-y += setup.h
|
||||
unifdef-y += shmbuf.h
|
||||
unifdef-y += sigcontext.h
|
||||
unifdef-y += siginfo.h
|
||||
unifdef-y += signal.h
|
||||
unifdef-y += socket.h
|
||||
unifdef-y += sockios.h
|
||||
unifdef-y += stat.h
|
||||
unifdef-y += statfs.h
|
||||
unifdef-y += termbits.h
|
||||
unifdef-y += termios.h
|
||||
unifdef-y += types.h
|
||||
unifdef-y += unistd.h
|
||||
unifdef-y += user.h
|
||||
|
||||
# These probably shouldn't be exported
|
||||
unifdef-y += shmparam.h
|
||||
unifdef-y += elf.h
|
||||
unifdef-y += page.h
|
||||
118
include/asm-generic/atomic.h
Normal file
118
include/asm-generic/atomic.h
Normal file
@@ -0,0 +1,118 @@
|
||||
#ifndef _ASM_GENERIC_ATOMIC_H
|
||||
#define _ASM_GENERIC_ATOMIC_H
|
||||
/*
|
||||
* Copyright (C) 2005 Silicon Graphics, Inc.
|
||||
* Christoph Lameter <clameter@sgi.com>
|
||||
*
|
||||
* Allows to provide arch independent atomic definitions without the need to
|
||||
* edit all arch specific atomic.h files.
|
||||
*/
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
/*
|
||||
* Suppport for atomic_long_t
|
||||
*
|
||||
* Casts for parameters are avoided for existing atomic functions in order to
|
||||
* avoid issues with cast-as-lval under gcc 4.x and other limitations that the
|
||||
* macros of a platform may have.
|
||||
*/
|
||||
|
||||
#if BITS_PER_LONG == 64
|
||||
|
||||
typedef atomic64_t atomic_long_t;
|
||||
|
||||
#define ATOMIC_LONG_INIT(i) ATOMIC64_INIT(i)
|
||||
|
||||
static inline long atomic_long_read(atomic_long_t *l)
|
||||
{
|
||||
atomic64_t *v = (atomic64_t *)l;
|
||||
|
||||
return (long)atomic64_read(v);
|
||||
}
|
||||
|
||||
static inline void atomic_long_set(atomic_long_t *l, long i)
|
||||
{
|
||||
atomic64_t *v = (atomic64_t *)l;
|
||||
|
||||
atomic64_set(v, i);
|
||||
}
|
||||
|
||||
static inline void atomic_long_inc(atomic_long_t *l)
|
||||
{
|
||||
atomic64_t *v = (atomic64_t *)l;
|
||||
|
||||
atomic64_inc(v);
|
||||
}
|
||||
|
||||
static inline void atomic_long_dec(atomic_long_t *l)
|
||||
{
|
||||
atomic64_t *v = (atomic64_t *)l;
|
||||
|
||||
atomic64_dec(v);
|
||||
}
|
||||
|
||||
static inline void atomic_long_add(long i, atomic_long_t *l)
|
||||
{
|
||||
atomic64_t *v = (atomic64_t *)l;
|
||||
|
||||
atomic64_add(i, v);
|
||||
}
|
||||
|
||||
static inline void atomic_long_sub(long i, atomic_long_t *l)
|
||||
{
|
||||
atomic64_t *v = (atomic64_t *)l;
|
||||
|
||||
atomic64_sub(i, v);
|
||||
}
|
||||
|
||||
#else /* BITS_PER_LONG == 64 */
|
||||
|
||||
typedef atomic_t atomic_long_t;
|
||||
|
||||
#define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i)
|
||||
static inline long atomic_long_read(atomic_long_t *l)
|
||||
{
|
||||
atomic_t *v = (atomic_t *)l;
|
||||
|
||||
return (long)atomic_read(v);
|
||||
}
|
||||
|
||||
static inline void atomic_long_set(atomic_long_t *l, long i)
|
||||
{
|
||||
atomic_t *v = (atomic_t *)l;
|
||||
|
||||
atomic_set(v, i);
|
||||
}
|
||||
|
||||
static inline void atomic_long_inc(atomic_long_t *l)
|
||||
{
|
||||
atomic_t *v = (atomic_t *)l;
|
||||
|
||||
atomic_inc(v);
|
||||
}
|
||||
|
||||
static inline void atomic_long_dec(atomic_long_t *l)
|
||||
{
|
||||
atomic_t *v = (atomic_t *)l;
|
||||
|
||||
atomic_dec(v);
|
||||
}
|
||||
|
||||
static inline void atomic_long_add(long i, atomic_long_t *l)
|
||||
{
|
||||
atomic_t *v = (atomic_t *)l;
|
||||
|
||||
atomic_add(i, v);
|
||||
}
|
||||
|
||||
static inline void atomic_long_sub(long i, atomic_long_t *l)
|
||||
{
|
||||
atomic_t *v = (atomic_t *)l;
|
||||
|
||||
atomic_sub(i, v);
|
||||
}
|
||||
|
||||
#endif /* BITS_PER_LONG == 64 */
|
||||
|
||||
#endif /* _ASM_GENERIC_ATOMIC_H */
|
||||
22
include/asm-generic/audit_change_attr.h
Normal file
22
include/asm-generic/audit_change_attr.h
Normal file
@@ -0,0 +1,22 @@
|
||||
__NR_chmod,
|
||||
__NR_fchmod,
|
||||
#ifdef __NR_chown
|
||||
__NR_chown,
|
||||
__NR_fchown,
|
||||
__NR_lchown,
|
||||
#endif
|
||||
__NR_setxattr,
|
||||
__NR_lsetxattr,
|
||||
__NR_fsetxattr,
|
||||
__NR_removexattr,
|
||||
__NR_lremovexattr,
|
||||
__NR_fremovexattr,
|
||||
#ifdef __NR_fchownat
|
||||
__NR_fchownat,
|
||||
__NR_fchmodat,
|
||||
#endif
|
||||
#ifdef __NR_chown32
|
||||
__NR_chown32,
|
||||
__NR_fchown32,
|
||||
__NR_lchown32,
|
||||
#endif
|
||||
18
include/asm-generic/audit_dir_write.h
Normal file
18
include/asm-generic/audit_dir_write.h
Normal file
@@ -0,0 +1,18 @@
|
||||
__NR_rename,
|
||||
__NR_mkdir,
|
||||
__NR_rmdir,
|
||||
#ifdef __NR_creat
|
||||
__NR_creat,
|
||||
#endif
|
||||
__NR_link,
|
||||
__NR_unlink,
|
||||
__NR_symlink,
|
||||
__NR_mknod,
|
||||
#ifdef __NR_mkdirat
|
||||
__NR_mkdirat,
|
||||
__NR_mknodat,
|
||||
__NR_unlinkat,
|
||||
__NR_renameat,
|
||||
__NR_linkat,
|
||||
__NR_symlinkat,
|
||||
#endif
|
||||
8
include/asm-generic/audit_read.h
Normal file
8
include/asm-generic/audit_read.h
Normal file
@@ -0,0 +1,8 @@
|
||||
__NR_readlink,
|
||||
__NR_quotactl,
|
||||
__NR_listxattr,
|
||||
__NR_llistxattr,
|
||||
__NR_flistxattr,
|
||||
__NR_getxattr,
|
||||
__NR_lgetxattr,
|
||||
__NR_fgetxattr,
|
||||
11
include/asm-generic/audit_write.h
Normal file
11
include/asm-generic/audit_write.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <asm-generic/audit_dir_write.h>
|
||||
__NR_acct,
|
||||
__NR_swapon,
|
||||
__NR_quotactl,
|
||||
__NR_truncate,
|
||||
#ifdef __NR_truncate64
|
||||
__NR_truncate64,
|
||||
#endif
|
||||
#ifdef __NR_bind
|
||||
__NR_bind, /* bind can affect fs object only in one way... */
|
||||
#endif
|
||||
32
include/asm-generic/bitops.h
Normal file
32
include/asm-generic/bitops.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#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 <asm-generic/bitops/__ffs.h>
|
||||
#include <asm-generic/bitops/ffz.h>
|
||||
#include <asm-generic/bitops/fls.h>
|
||||
#include <asm-generic/bitops/fls64.h>
|
||||
#include <asm-generic/bitops/find.h>
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <asm-generic/bitops/sched.h>
|
||||
#include <asm-generic/bitops/ffs.h>
|
||||
#include <asm-generic/bitops/hweight.h>
|
||||
|
||||
#include <asm-generic/bitops/ext2-non-atomic.h>
|
||||
#include <asm-generic/bitops/ext2-atomic.h>
|
||||
#include <asm-generic/bitops/minix.h>
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_H */
|
||||
43
include/asm-generic/bitops/__ffs.h
Normal file
43
include/asm-generic/bitops/__ffs.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS___FFS_H_
|
||||
#define _ASM_GENERIC_BITOPS___FFS_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
/**
|
||||
* __ffs - find first bit in word.
|
||||
* @word: The word to search
|
||||
*
|
||||
* Undefined if no bit exists, so code should check against 0 first.
|
||||
*/
|
||||
static inline unsigned long __ffs(unsigned long word)
|
||||
{
|
||||
int num = 0;
|
||||
|
||||
#if BITS_PER_LONG == 64
|
||||
if ((word & 0xffffffff) == 0) {
|
||||
num += 32;
|
||||
word >>= 32;
|
||||
}
|
||||
#endif
|
||||
if ((word & 0xffff) == 0) {
|
||||
num += 16;
|
||||
word >>= 16;
|
||||
}
|
||||
if ((word & 0xff) == 0) {
|
||||
num += 8;
|
||||
word >>= 8;
|
||||
}
|
||||
if ((word & 0xf) == 0) {
|
||||
num += 4;
|
||||
word >>= 4;
|
||||
}
|
||||
if ((word & 0x3) == 0) {
|
||||
num += 2;
|
||||
word >>= 2;
|
||||
}
|
||||
if ((word & 0x1) == 0)
|
||||
num += 1;
|
||||
return num;
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS___FFS_H_ */
|
||||
191
include/asm-generic/bitops/atomic.h
Normal file
191
include/asm-generic/bitops/atomic.h
Normal file
@@ -0,0 +1,191 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_ATOMIC_H_
|
||||
#define _ASM_GENERIC_BITOPS_ATOMIC_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
|
||||
#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
#include <asm/spinlock.h>
|
||||
#include <asm/cache.h> /* we use L1_CACHE_BYTES */
|
||||
|
||||
/* Use an array of spinlocks for our atomic_ts.
|
||||
* Hash function to index into a different SPINLOCK.
|
||||
* Since "a" is usually an address, use one spinlock per cacheline.
|
||||
*/
|
||||
# define ATOMIC_HASH_SIZE 4
|
||||
# define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ]))
|
||||
|
||||
extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned;
|
||||
|
||||
/* Can't use raw_spin_lock_irq because of #include problems, so
|
||||
* this is the substitute */
|
||||
#define _atomic_spin_lock_irqsave(l,f) do { \
|
||||
raw_spinlock_t *s = ATOMIC_HASH(l); \
|
||||
local_irq_save(f); \
|
||||
__raw_spin_lock(s); \
|
||||
} while(0)
|
||||
|
||||
#define _atomic_spin_unlock_irqrestore(l,f) do { \
|
||||
raw_spinlock_t *s = ATOMIC_HASH(l); \
|
||||
__raw_spin_unlock(s); \
|
||||
local_irq_restore(f); \
|
||||
} while(0)
|
||||
|
||||
|
||||
#else
|
||||
# define _atomic_spin_lock_irqsave(l,f) do { local_irq_save(f); } while (0)
|
||||
# define _atomic_spin_unlock_irqrestore(l,f) do { local_irq_restore(f); } while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NMI events can occur at any time, including when interrupts have been
|
||||
* disabled by *_irqsave(). So you can get NMI events occurring while a
|
||||
* *_bit function is holding a spin lock. If the NMI handler also wants
|
||||
* to do bit manipulation (and they do) then you can get a deadlock
|
||||
* between the original caller of *_bit() and the NMI handler.
|
||||
*
|
||||
* by Keith Owens
|
||||
*/
|
||||
|
||||
/**
|
||||
* set_bit - Atomically set a bit in memory
|
||||
* @nr: the bit to set
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* This function is atomic and may not be reordered. See __set_bit()
|
||||
* if you do not require the atomic guarantees.
|
||||
*
|
||||
* Note: there are no guarantees that this function will not be reordered
|
||||
* on non x86 architectures, so if you are writting portable code,
|
||||
* make sure not to rely on its reordering guarantees.
|
||||
*
|
||||
* Note that @nr may be almost arbitrarily large; this function is not
|
||||
* restricted to acting on a single-word quantity.
|
||||
*/
|
||||
static inline void set_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BITOP_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
|
||||
unsigned long flags;
|
||||
|
||||
_atomic_spin_lock_irqsave(p, flags);
|
||||
*p |= mask;
|
||||
_atomic_spin_unlock_irqrestore(p, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* clear_bit - Clears a bit in memory
|
||||
* @nr: Bit to clear
|
||||
* @addr: Address to start counting from
|
||||
*
|
||||
* clear_bit() is atomic and may not be reordered. However, it does
|
||||
* not contain a memory barrier, so if it is used for locking purposes,
|
||||
* you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
|
||||
* in order to ensure changes are visible on other processors.
|
||||
*/
|
||||
static inline void clear_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BITOP_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
|
||||
unsigned long flags;
|
||||
|
||||
_atomic_spin_lock_irqsave(p, flags);
|
||||
*p &= ~mask;
|
||||
_atomic_spin_unlock_irqrestore(p, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* change_bit - Toggle a bit in memory
|
||||
* @nr: Bit to change
|
||||
* @addr: Address to start counting from
|
||||
*
|
||||
* change_bit() is atomic and may not be reordered. It may be
|
||||
* reordered on other architectures than x86.
|
||||
* Note that @nr may be almost arbitrarily large; this function is not
|
||||
* restricted to acting on a single-word quantity.
|
||||
*/
|
||||
static inline void change_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BITOP_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
|
||||
unsigned long flags;
|
||||
|
||||
_atomic_spin_lock_irqsave(p, flags);
|
||||
*p ^= mask;
|
||||
_atomic_spin_unlock_irqrestore(p, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* test_and_set_bit - Set a bit and return its old value
|
||||
* @nr: Bit to set
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is atomic and cannot be reordered.
|
||||
* It may be reordered on other architectures than x86.
|
||||
* It also implies a memory barrier.
|
||||
*/
|
||||
static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BITOP_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
|
||||
unsigned long old;
|
||||
unsigned long flags;
|
||||
|
||||
_atomic_spin_lock_irqsave(p, flags);
|
||||
old = *p;
|
||||
*p = old | mask;
|
||||
_atomic_spin_unlock_irqrestore(p, flags);
|
||||
|
||||
return (old & mask) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* test_and_clear_bit - Clear a bit and return its old value
|
||||
* @nr: Bit to clear
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is atomic and cannot be reordered.
|
||||
* It can be reorderdered on other architectures other than x86.
|
||||
* It also implies a memory barrier.
|
||||
*/
|
||||
static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BITOP_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
|
||||
unsigned long old;
|
||||
unsigned long flags;
|
||||
|
||||
_atomic_spin_lock_irqsave(p, flags);
|
||||
old = *p;
|
||||
*p = old & ~mask;
|
||||
_atomic_spin_unlock_irqrestore(p, flags);
|
||||
|
||||
return (old & mask) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* test_and_change_bit - Change a bit and return its old value
|
||||
* @nr: Bit to change
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is atomic and cannot be reordered.
|
||||
* It also implies a memory barrier.
|
||||
*/
|
||||
static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BITOP_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
|
||||
unsigned long old;
|
||||
unsigned long flags;
|
||||
|
||||
_atomic_spin_lock_irqsave(p, flags);
|
||||
old = *p;
|
||||
*p = old ^ mask;
|
||||
_atomic_spin_unlock_irqrestore(p, flags);
|
||||
|
||||
return (old & mask) != 0;
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_ATOMIC_H */
|
||||
22
include/asm-generic/bitops/ext2-atomic.h
Normal file
22
include/asm-generic/bitops/ext2-atomic.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
|
||||
#define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
|
||||
|
||||
#define ext2_set_bit_atomic(lock, nr, addr) \
|
||||
({ \
|
||||
int ret; \
|
||||
spin_lock(lock); \
|
||||
ret = ext2_set_bit((nr), (unsigned long *)(addr)); \
|
||||
spin_unlock(lock); \
|
||||
ret; \
|
||||
})
|
||||
|
||||
#define ext2_clear_bit_atomic(lock, nr, addr) \
|
||||
({ \
|
||||
int ret; \
|
||||
spin_lock(lock); \
|
||||
ret = ext2_clear_bit((nr), (unsigned long *)(addr)); \
|
||||
spin_unlock(lock); \
|
||||
ret; \
|
||||
})
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */
|
||||
18
include/asm-generic/bitops/ext2-non-atomic.h
Normal file
18
include/asm-generic/bitops/ext2-non-atomic.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
|
||||
#define _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
|
||||
|
||||
#include <asm-generic/bitops/le.h>
|
||||
|
||||
#define ext2_set_bit(nr,addr) \
|
||||
generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
|
||||
#define ext2_clear_bit(nr,addr) \
|
||||
generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
|
||||
|
||||
#define ext2_test_bit(nr,addr) \
|
||||
generic_test_le_bit((nr),(unsigned long *)(addr))
|
||||
#define ext2_find_first_zero_bit(addr, size) \
|
||||
generic_find_first_zero_le_bit((unsigned long *)(addr), (size))
|
||||
#define ext2_find_next_zero_bit(addr, size, off) \
|
||||
generic_find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */
|
||||
41
include/asm-generic/bitops/ffs.h
Normal file
41
include/asm-generic/bitops/ffs.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_FFS_H_
|
||||
#define _ASM_GENERIC_BITOPS_FFS_H_
|
||||
|
||||
/**
|
||||
* ffs - find first bit set
|
||||
* @x: the word to search
|
||||
*
|
||||
* This is defined the same way as
|
||||
* the libc and compiler builtin ffs routines, therefore
|
||||
* differs in spirit from the above ffz (man ffs).
|
||||
*/
|
||||
static inline int ffs(int x)
|
||||
{
|
||||
int r = 1;
|
||||
|
||||
if (!x)
|
||||
return 0;
|
||||
if (!(x & 0xffff)) {
|
||||
x >>= 16;
|
||||
r += 16;
|
||||
}
|
||||
if (!(x & 0xff)) {
|
||||
x >>= 8;
|
||||
r += 8;
|
||||
}
|
||||
if (!(x & 0xf)) {
|
||||
x >>= 4;
|
||||
r += 4;
|
||||
}
|
||||
if (!(x & 3)) {
|
||||
x >>= 2;
|
||||
r += 2;
|
||||
}
|
||||
if (!(x & 1)) {
|
||||
x >>= 1;
|
||||
r += 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_FFS_H_ */
|
||||
12
include/asm-generic/bitops/ffz.h
Normal file
12
include/asm-generic/bitops/ffz.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_FFZ_H_
|
||||
#define _ASM_GENERIC_BITOPS_FFZ_H_
|
||||
|
||||
/*
|
||||
* ffz - find first zero in word.
|
||||
* @word: The word to search
|
||||
*
|
||||
* Undefined if no zero exists, so code should check against ~0UL first.
|
||||
*/
|
||||
#define ffz(x) __ffs(~(x))
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_FFZ_H_ */
|
||||
13
include/asm-generic/bitops/find.h
Normal file
13
include/asm-generic/bitops/find.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_FIND_H_
|
||||
#define _ASM_GENERIC_BITOPS_FIND_H_
|
||||
|
||||
extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
|
||||
size, unsigned long offset);
|
||||
|
||||
extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
|
||||
long size, unsigned long offset);
|
||||
|
||||
#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
|
||||
#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
|
||||
|
||||
#endif /*_ASM_GENERIC_BITOPS_FIND_H_ */
|
||||
41
include/asm-generic/bitops/fls.h
Normal file
41
include/asm-generic/bitops/fls.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_FLS_H_
|
||||
#define _ASM_GENERIC_BITOPS_FLS_H_
|
||||
|
||||
/**
|
||||
* fls - find last (most-significant) bit set
|
||||
* @x: the word to search
|
||||
*
|
||||
* This is defined the same way as ffs.
|
||||
* Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
|
||||
*/
|
||||
|
||||
static inline int fls(int x)
|
||||
{
|
||||
int r = 32;
|
||||
|
||||
if (!x)
|
||||
return 0;
|
||||
if (!(x & 0xffff0000u)) {
|
||||
x <<= 16;
|
||||
r -= 16;
|
||||
}
|
||||
if (!(x & 0xff000000u)) {
|
||||
x <<= 8;
|
||||
r -= 8;
|
||||
}
|
||||
if (!(x & 0xf0000000u)) {
|
||||
x <<= 4;
|
||||
r -= 4;
|
||||
}
|
||||
if (!(x & 0xc0000000u)) {
|
||||
x <<= 2;
|
||||
r -= 2;
|
||||
}
|
||||
if (!(x & 0x80000000u)) {
|
||||
x <<= 1;
|
||||
r -= 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_FLS_H_ */
|
||||
14
include/asm-generic/bitops/fls64.h
Normal file
14
include/asm-generic/bitops/fls64.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_FLS64_H_
|
||||
#define _ASM_GENERIC_BITOPS_FLS64_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
static inline int fls64(__u64 x)
|
||||
{
|
||||
__u32 h = x >> 32;
|
||||
if (h)
|
||||
return fls(h) + 32;
|
||||
return fls(x);
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */
|
||||
11
include/asm-generic/bitops/hweight.h
Normal file
11
include/asm-generic/bitops/hweight.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_
|
||||
#define _ASM_GENERIC_BITOPS_HWEIGHT_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
extern unsigned int hweight32(unsigned int w);
|
||||
extern unsigned int hweight16(unsigned int w);
|
||||
extern unsigned int hweight8(unsigned int w);
|
||||
extern unsigned long hweight64(__u64 w);
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
|
||||
53
include/asm-generic/bitops/le.h
Normal file
53
include/asm-generic/bitops/le.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_LE_H_
|
||||
#define _ASM_GENERIC_BITOPS_LE_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
|
||||
#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
|
||||
|
||||
#if defined(__LITTLE_ENDIAN)
|
||||
|
||||
#define generic_test_le_bit(nr, addr) test_bit(nr, addr)
|
||||
#define generic___set_le_bit(nr, addr) __set_bit(nr, addr)
|
||||
#define generic___clear_le_bit(nr, addr) __clear_bit(nr, addr)
|
||||
|
||||
#define generic_test_and_set_le_bit(nr, addr) test_and_set_bit(nr, addr)
|
||||
#define generic_test_and_clear_le_bit(nr, addr) test_and_clear_bit(nr, addr)
|
||||
|
||||
#define generic___test_and_set_le_bit(nr, addr) __test_and_set_bit(nr, addr)
|
||||
#define generic___test_and_clear_le_bit(nr, addr) __test_and_clear_bit(nr, addr)
|
||||
|
||||
#define generic_find_next_zero_le_bit(addr, size, offset) find_next_zero_bit(addr, size, offset)
|
||||
|
||||
#elif defined(__BIG_ENDIAN)
|
||||
|
||||
#define generic_test_le_bit(nr, addr) \
|
||||
test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
|
||||
#define generic___set_le_bit(nr, addr) \
|
||||
__set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
|
||||
#define generic___clear_le_bit(nr, addr) \
|
||||
__clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
|
||||
|
||||
#define generic_test_and_set_le_bit(nr, addr) \
|
||||
test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
|
||||
#define generic_test_and_clear_le_bit(nr, addr) \
|
||||
test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
|
||||
|
||||
#define generic___test_and_set_le_bit(nr, addr) \
|
||||
__test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
|
||||
#define generic___test_and_clear_le_bit(nr, addr) \
|
||||
__test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
|
||||
|
||||
extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
|
||||
unsigned long size, unsigned long offset);
|
||||
|
||||
#else
|
||||
#error "Please fix <asm/byteorder.h>"
|
||||
#endif
|
||||
|
||||
#define generic_find_first_zero_le_bit(addr, size) \
|
||||
generic_find_next_zero_le_bit((addr), (size), 0)
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_LE_H_ */
|
||||
17
include/asm-generic/bitops/minix-le.h
Normal file
17
include/asm-generic/bitops/minix-le.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_
|
||||
#define _ASM_GENERIC_BITOPS_MINIX_LE_H_
|
||||
|
||||
#include <asm-generic/bitops/le.h>
|
||||
|
||||
#define minix_test_and_set_bit(nr,addr) \
|
||||
generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
|
||||
#define minix_set_bit(nr,addr) \
|
||||
generic___set_le_bit((nr),(unsigned long *)(addr))
|
||||
#define minix_test_and_clear_bit(nr,addr) \
|
||||
generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
|
||||
#define minix_test_bit(nr,addr) \
|
||||
generic_test_le_bit((nr),(unsigned long *)(addr))
|
||||
#define minix_find_first_zero_bit(addr,size) \
|
||||
generic_find_first_zero_le_bit((unsigned long *)(addr),(size))
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */
|
||||
15
include/asm-generic/bitops/minix.h
Normal file
15
include/asm-generic/bitops/minix.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_MINIX_H_
|
||||
#define _ASM_GENERIC_BITOPS_MINIX_H_
|
||||
|
||||
#define minix_test_and_set_bit(nr,addr) \
|
||||
__test_and_set_bit((nr),(unsigned long *)(addr))
|
||||
#define minix_set_bit(nr,addr) \
|
||||
__set_bit((nr),(unsigned long *)(addr))
|
||||
#define minix_test_and_clear_bit(nr,addr) \
|
||||
__test_and_clear_bit((nr),(unsigned long *)(addr))
|
||||
#define minix_test_bit(nr,addr) \
|
||||
test_bit((nr),(unsigned long *)(addr))
|
||||
#define minix_find_first_zero_bit(addr,size) \
|
||||
find_first_zero_bit((unsigned long *)(addr),(size))
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_MINIX_H_ */
|
||||
111
include/asm-generic/bitops/non-atomic.h
Normal file
111
include/asm-generic/bitops/non-atomic.h
Normal file
@@ -0,0 +1,111 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
|
||||
#define _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
|
||||
#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
|
||||
|
||||
/**
|
||||
* __set_bit - Set a bit in memory
|
||||
* @nr: the bit to set
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* Unlike set_bit(), this function is non-atomic and may be reordered.
|
||||
* If it's called on the same region of memory simultaneously, the effect
|
||||
* may be that only one operation succeeds.
|
||||
*/
|
||||
static inline void __set_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BITOP_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
|
||||
|
||||
*p |= mask;
|
||||
}
|
||||
|
||||
static inline void __clear_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BITOP_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
|
||||
|
||||
*p &= ~mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* __change_bit - Toggle a bit in memory
|
||||
* @nr: the bit to change
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* Unlike change_bit(), this function is non-atomic and may be reordered.
|
||||
* If it's called on the same region of memory simultaneously, the effect
|
||||
* may be that only one operation succeeds.
|
||||
*/
|
||||
static inline void __change_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BITOP_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
|
||||
|
||||
*p ^= mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* __test_and_set_bit - Set a bit and return its old value
|
||||
* @nr: Bit to set
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is non-atomic and can be reordered.
|
||||
* If two examples of this operation race, one can appear to succeed
|
||||
* but actually fail. You must protect multiple accesses with a lock.
|
||||
*/
|
||||
static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BITOP_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
|
||||
unsigned long old = *p;
|
||||
|
||||
*p = old | mask;
|
||||
return (old & mask) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* __test_and_clear_bit - Clear a bit and return its old value
|
||||
* @nr: Bit to clear
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is non-atomic and can be reordered.
|
||||
* If two examples of this operation race, one can appear to succeed
|
||||
* but actually fail. You must protect multiple accesses with a lock.
|
||||
*/
|
||||
static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BITOP_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
|
||||
unsigned long old = *p;
|
||||
|
||||
*p = old & ~mask;
|
||||
return (old & mask) != 0;
|
||||
}
|
||||
|
||||
/* WARNING: non atomic and it can be reordered! */
|
||||
static inline int __test_and_change_bit(int nr,
|
||||
volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BITOP_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
|
||||
unsigned long old = *p;
|
||||
|
||||
*p = old ^ mask;
|
||||
return (old & mask) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* test_bit - Determine whether a bit is set
|
||||
* @nr: bit number to test
|
||||
* @addr: Address to start counting from
|
||||
*/
|
||||
static inline int test_bit(int nr, const volatile unsigned long *addr)
|
||||
{
|
||||
return 1UL & (addr[BITOP_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_NON_ATOMIC_H_ */
|
||||
31
include/asm-generic/bitops/sched.h
Normal file
31
include/asm-generic/bitops/sched.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef _ASM_GENERIC_BITOPS_SCHED_H_
|
||||
#define _ASM_GENERIC_BITOPS_SCHED_H_
|
||||
|
||||
#include <linux/compiler.h> /* unlikely() */
|
||||
#include <asm/types.h>
|
||||
|
||||
/*
|
||||
* Every architecture must define this function. It's the fastest
|
||||
* way of searching a 100-bit bitmap. It's guaranteed that at least
|
||||
* one of the 100 bits is cleared.
|
||||
*/
|
||||
static inline int sched_find_first_bit(const unsigned long *b)
|
||||
{
|
||||
#if BITS_PER_LONG == 64
|
||||
if (b[0])
|
||||
return __ffs(b[0]);
|
||||
return __ffs(b[1]) + 64;
|
||||
#elif BITS_PER_LONG == 32
|
||||
if (b[0])
|
||||
return __ffs(b[0]);
|
||||
if (b[1])
|
||||
return __ffs(b[1]) + 32;
|
||||
if (b[2])
|
||||
return __ffs(b[2]) + 64;
|
||||
return __ffs(b[3]) + 96;
|
||||
#else
|
||||
#error BITS_PER_LONG not defined
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_SCHED_H_ */
|
||||
79
include/asm-generic/bug.h
Normal file
79
include/asm-generic/bug.h
Normal file
@@ -0,0 +1,79 @@
|
||||
#ifndef _ASM_GENERIC_BUG_H
|
||||
#define _ASM_GENERIC_BUG_H
|
||||
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#ifdef CONFIG_BUG
|
||||
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
#ifndef __ASSEMBLY__
|
||||
struct bug_entry {
|
||||
unsigned long bug_addr;
|
||||
#ifdef CONFIG_DEBUG_BUGVERBOSE
|
||||
const char *file;
|
||||
unsigned short line;
|
||||
#endif
|
||||
unsigned short flags;
|
||||
};
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#define BUGFLAG_WARNING (1<<0)
|
||||
#endif /* CONFIG_GENERIC_BUG */
|
||||
|
||||
#ifndef HAVE_ARCH_BUG
|
||||
#define BUG() do { \
|
||||
printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
|
||||
panic("BUG!"); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ARCH_BUG_ON
|
||||
#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ARCH_WARN_ON
|
||||
#define WARN_ON(condition) ({ \
|
||||
typeof(condition) __ret_warn_on = (condition); \
|
||||
if (unlikely(__ret_warn_on)) { \
|
||||
printk("BUG: at %s:%d %s()\n", __FILE__, \
|
||||
__LINE__, __FUNCTION__); \
|
||||
dump_stack(); \
|
||||
} \
|
||||
unlikely(__ret_warn_on); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#else /* !CONFIG_BUG */
|
||||
#ifndef HAVE_ARCH_BUG
|
||||
#define BUG()
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ARCH_BUG_ON
|
||||
#define BUG_ON(condition) do { if (condition) ; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ARCH_WARN_ON
|
||||
#define WARN_ON(condition) ({ \
|
||||
typeof(condition) __ret_warn_on = (condition); \
|
||||
unlikely(__ret_warn_on); \
|
||||
})
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define WARN_ON_ONCE(condition) ({ \
|
||||
static int __warned; \
|
||||
typeof(condition) __ret_warn_once = (condition); \
|
||||
\
|
||||
if (unlikely(__ret_warn_once)) \
|
||||
if (WARN_ON(!__warned)) \
|
||||
__warned = 1; \
|
||||
unlikely(__ret_warn_once); \
|
||||
})
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
# define WARN_ON_SMP(x) WARN_ON(x)
|
||||
#else
|
||||
# define WARN_ON_SMP(x) do { } while (0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
68
include/asm-generic/cputime.h
Normal file
68
include/asm-generic/cputime.h
Normal file
@@ -0,0 +1,68 @@
|
||||
#ifndef _ASM_GENERIC_CPUTIME_H
|
||||
#define _ASM_GENERIC_CPUTIME_H
|
||||
|
||||
#include <linux/time.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
typedef unsigned long cputime_t;
|
||||
|
||||
#define cputime_zero (0UL)
|
||||
#define cputime_max ((~0UL >> 1) - 1)
|
||||
#define cputime_add(__a, __b) ((__a) + (__b))
|
||||
#define cputime_sub(__a, __b) ((__a) - (__b))
|
||||
#define cputime_div(__a, __n) ((__a) / (__n))
|
||||
#define cputime_halve(__a) ((__a) >> 1)
|
||||
#define cputime_eq(__a, __b) ((__a) == (__b))
|
||||
#define cputime_gt(__a, __b) ((__a) > (__b))
|
||||
#define cputime_ge(__a, __b) ((__a) >= (__b))
|
||||
#define cputime_lt(__a, __b) ((__a) < (__b))
|
||||
#define cputime_le(__a, __b) ((__a) <= (__b))
|
||||
#define cputime_to_jiffies(__ct) (__ct)
|
||||
#define jiffies_to_cputime(__hz) (__hz)
|
||||
|
||||
typedef u64 cputime64_t;
|
||||
|
||||
#define cputime64_zero (0ULL)
|
||||
#define cputime64_add(__a, __b) ((__a) + (__b))
|
||||
#define cputime64_sub(__a, __b) ((__a) - (__b))
|
||||
#define cputime64_to_jiffies64(__ct) (__ct)
|
||||
#define jiffies64_to_cputime64(__jif) (__jif)
|
||||
#define cputime_to_cputime64(__ct) ((u64) __ct)
|
||||
|
||||
|
||||
/*
|
||||
* Convert cputime to milliseconds and back.
|
||||
*/
|
||||
#define cputime_to_msecs(__ct) jiffies_to_msecs(__ct)
|
||||
#define msecs_to_cputime(__msecs) msecs_to_jiffies(__msecs)
|
||||
|
||||
/*
|
||||
* Convert cputime to seconds and back.
|
||||
*/
|
||||
#define cputime_to_secs(jif) ((jif) / HZ)
|
||||
#define secs_to_cputime(sec) ((sec) * HZ)
|
||||
|
||||
/*
|
||||
* Convert cputime to timespec and back.
|
||||
*/
|
||||
#define timespec_to_cputime(__val) timespec_to_jiffies(__val)
|
||||
#define cputime_to_timespec(__ct,__val) jiffies_to_timespec(__ct,__val)
|
||||
|
||||
/*
|
||||
* Convert cputime to timeval and back.
|
||||
*/
|
||||
#define timeval_to_cputime(__val) timeval_to_jiffies(__val)
|
||||
#define cputime_to_timeval(__ct,__val) jiffies_to_timeval(__ct,__val)
|
||||
|
||||
/*
|
||||
* Convert cputime to clock and back.
|
||||
*/
|
||||
#define cputime_to_clock_t(__ct) jiffies_to_clock_t(__ct)
|
||||
#define clock_t_to_cputime(__x) clock_t_to_jiffies(__x)
|
||||
|
||||
/*
|
||||
* Convert cputime64 to clock.
|
||||
*/
|
||||
#define cputime64_to_clock_t(__ct) jiffies_64_to_clock_t(__ct)
|
||||
|
||||
#endif
|
||||
12
include/asm-generic/device.h
Normal file
12
include/asm-generic/device.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Arch specific extensions to struct device
|
||||
*
|
||||
* This file is released under the GPLv2
|
||||
*/
|
||||
#ifndef _ASM_GENERIC_DEVICE_H
|
||||
#define _ASM_GENERIC_DEVICE_H
|
||||
|
||||
struct dev_archdata {
|
||||
};
|
||||
|
||||
#endif /* _ASM_GENERIC_DEVICE_H */
|
||||
65
include/asm-generic/div64.h
Normal file
65
include/asm-generic/div64.h
Normal file
@@ -0,0 +1,65 @@
|
||||
#ifndef _ASM_GENERIC_DIV64_H
|
||||
#define _ASM_GENERIC_DIV64_H
|
||||
/*
|
||||
* Copyright (C) 2003 Bernardo Innocenti <bernie@develer.com>
|
||||
* Based on former asm-ppc/div64.h and asm-m68knommu/div64.h
|
||||
*
|
||||
* The semantics of do_div() are:
|
||||
*
|
||||
* uint32_t do_div(uint64_t *n, uint32_t base)
|
||||
* {
|
||||
* uint32_t remainder = *n % base;
|
||||
* *n = *n / base;
|
||||
* return remainder;
|
||||
* }
|
||||
*
|
||||
* NOTE: macro parameter n is evaluated multiple times,
|
||||
* beware of side effects!
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#if BITS_PER_LONG == 64
|
||||
|
||||
# define do_div(n,base) ({ \
|
||||
uint32_t __base = (base); \
|
||||
uint32_t __rem; \
|
||||
__rem = ((uint64_t)(n)) % __base; \
|
||||
(n) = ((uint64_t)(n)) / __base; \
|
||||
__rem; \
|
||||
})
|
||||
|
||||
static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
|
||||
{
|
||||
return dividend / divisor;
|
||||
}
|
||||
|
||||
#elif BITS_PER_LONG == 32
|
||||
|
||||
extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
|
||||
|
||||
/* The unnecessary pointer compare is there
|
||||
* to check for type safety (n must be 64bit)
|
||||
*/
|
||||
# define do_div(n,base) ({ \
|
||||
uint32_t __base = (base); \
|
||||
uint32_t __rem; \
|
||||
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
|
||||
if (likely(((n) >> 32) == 0)) { \
|
||||
__rem = (uint32_t)(n) % __base; \
|
||||
(n) = (uint32_t)(n) / __base; \
|
||||
} else \
|
||||
__rem = __div64_32(&(n), __base); \
|
||||
__rem; \
|
||||
})
|
||||
|
||||
extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
|
||||
|
||||
#else /* BITS_PER_LONG == ?? */
|
||||
|
||||
# error do_div() does not yet support the C64
|
||||
|
||||
#endif /* BITS_PER_LONG */
|
||||
|
||||
#endif /* _ASM_GENERIC_DIV64_H */
|
||||
24
include/asm-generic/dma-mapping-broken.h
Normal file
24
include/asm-generic/dma-mapping-broken.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef _ASM_GENERIC_DMA_MAPPING_H
|
||||
#define _ASM_GENERIC_DMA_MAPPING_H
|
||||
|
||||
/* This is used for archs that do not support DMA */
|
||||
|
||||
static inline void *
|
||||
dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
|
||||
gfp_t flag)
|
||||
{
|
||||
BUG();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
|
||||
dma_addr_t dma_handle)
|
||||
{
|
||||
BUG();
|
||||
}
|
||||
|
||||
#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
|
||||
#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
|
||||
|
||||
#endif /* _ASM_GENERIC_DMA_MAPPING_H */
|
||||
308
include/asm-generic/dma-mapping.h
Normal file
308
include/asm-generic/dma-mapping.h
Normal file
@@ -0,0 +1,308 @@
|
||||
/* Copyright (C) 2002 by James.Bottomley@HansenPartnership.com
|
||||
*
|
||||
* Implements the generic device dma API via the existing pci_ one
|
||||
* for unconverted architectures
|
||||
*/
|
||||
|
||||
#ifndef _ASM_GENERIC_DMA_MAPPING_H
|
||||
#define _ASM_GENERIC_DMA_MAPPING_H
|
||||
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
|
||||
/* we implement the API below in terms of the existing PCI one,
|
||||
* so include it */
|
||||
#include <linux/pci.h>
|
||||
/* need struct page definitions */
|
||||
#include <linux/mm.h>
|
||||
|
||||
static inline int
|
||||
dma_supported(struct device *dev, u64 mask)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
return pci_dma_supported(to_pci_dev(dev), mask);
|
||||
}
|
||||
|
||||
static inline int
|
||||
dma_set_mask(struct device *dev, u64 dma_mask)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
|
||||
gfp_t flag)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
return pci_alloc_consistent(to_pci_dev(dev), size, dma_handle);
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
|
||||
dma_addr_t dma_handle)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle);
|
||||
}
|
||||
|
||||
static inline dma_addr_t
|
||||
dma_map_single(struct device *dev, void *cpu_addr, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction);
|
||||
}
|
||||
|
||||
static inline dma_addr_t
|
||||
dma_map_page(struct device *dev, struct page *page,
|
||||
unsigned long offset, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction);
|
||||
}
|
||||
|
||||
static inline int
|
||||
dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle,
|
||||
size, (int)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle,
|
||||
size, (int)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(dev->bus != &pci_bus_type);
|
||||
|
||||
pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction);
|
||||
}
|
||||
|
||||
static inline int
|
||||
dma_mapping_error(dma_addr_t dma_addr)
|
||||
{
|
||||
return pci_dma_mapping_error(dma_addr);
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
static inline int
|
||||
dma_supported(struct device *dev, u64 mask)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dma_set_mask(struct device *dev, u64 dma_mask)
|
||||
{
|
||||
BUG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
|
||||
gfp_t flag)
|
||||
{
|
||||
BUG();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
|
||||
dma_addr_t dma_handle)
|
||||
{
|
||||
BUG();
|
||||
}
|
||||
|
||||
static inline dma_addr_t
|
||||
dma_map_single(struct device *dev, void *cpu_addr, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG();
|
||||
}
|
||||
|
||||
static inline dma_addr_t
|
||||
dma_map_page(struct device *dev, struct page *page,
|
||||
unsigned long offset, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG();
|
||||
}
|
||||
|
||||
static inline int
|
||||
dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG();
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG();
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG();
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG();
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG();
|
||||
}
|
||||
|
||||
static inline int
|
||||
dma_error(dma_addr_t dma_addr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Now for the API extensions over the pci_ one */
|
||||
|
||||
#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
|
||||
#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
|
||||
#define dma_is_consistent(d, h) (1)
|
||||
|
||||
static inline int
|
||||
dma_get_cache_alignment(void)
|
||||
{
|
||||
/* no easy way to get cache size on all processors, so return
|
||||
* the maximum possible, to be safe */
|
||||
return (1 << INTERNODE_CACHE_SHIFT);
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
|
||||
unsigned long offset, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
/* just sync everything, that's all the pci API can do */
|
||||
dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
|
||||
unsigned long offset, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
/* just sync everything, that's all the pci API can do */
|
||||
dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
dma_cache_sync(struct device *dev, void *vaddr, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
/* could define this in terms of the dma_cache ... operations,
|
||||
* but if you get this on a platform, you should convert the platform
|
||||
* to using the generic device DMA API */
|
||||
BUG();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
9
include/asm-generic/emergency-restart.h
Normal file
9
include/asm-generic/emergency-restart.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef _ASM_GENERIC_EMERGENCY_RESTART_H
|
||||
#define _ASM_GENERIC_EMERGENCY_RESTART_H
|
||||
|
||||
static inline void machine_emergency_restart(void)
|
||||
{
|
||||
machine_restart(NULL);
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_EMERGENCY_RESTART_H */
|
||||
39
include/asm-generic/errno-base.h
Normal file
39
include/asm-generic/errno-base.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef _ASM_GENERIC_ERRNO_BASE_H
|
||||
#define _ASM_GENERIC_ERRNO_BASE_H
|
||||
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* I/O error */
|
||||
#define ENXIO 6 /* No such device or address */
|
||||
#define E2BIG 7 /* Argument list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file number */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EAGAIN 11 /* Try again */
|
||||
#define ENOMEM 12 /* Out of memory */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#define EBUSY 16 /* Device or resource busy */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* No such device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* File table overflow */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Not a typewriter */
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
#define EDOM 33 /* Math argument out of domain of func */
|
||||
#define ERANGE 34 /* Math result not representable */
|
||||
|
||||
#endif
|
||||
109
include/asm-generic/errno.h
Normal file
109
include/asm-generic/errno.h
Normal file
@@ -0,0 +1,109 @@
|
||||
#ifndef _ASM_GENERIC_ERRNO_H
|
||||
#define _ASM_GENERIC_ERRNO_H
|
||||
|
||||
#include <asm-generic/errno-base.h>
|
||||
|
||||
#define EDEADLK 35 /* Resource deadlock would occur */
|
||||
#define ENAMETOOLONG 36 /* File name too long */
|
||||
#define ENOLCK 37 /* No record locks available */
|
||||
#define ENOSYS 38 /* Function not implemented */
|
||||
#define ENOTEMPTY 39 /* Directory not empty */
|
||||
#define ELOOP 40 /* Too many symbolic links encountered */
|
||||
#define EWOULDBLOCK EAGAIN /* Operation would block */
|
||||
#define ENOMSG 42 /* No message of desired type */
|
||||
#define EIDRM 43 /* Identifier removed */
|
||||
#define ECHRNG 44 /* Channel number out of range */
|
||||
#define EL2NSYNC 45 /* Level 2 not synchronized */
|
||||
#define EL3HLT 46 /* Level 3 halted */
|
||||
#define EL3RST 47 /* Level 3 reset */
|
||||
#define ELNRNG 48 /* Link number out of range */
|
||||
#define EUNATCH 49 /* Protocol driver not attached */
|
||||
#define ENOCSI 50 /* No CSI structure available */
|
||||
#define EL2HLT 51 /* Level 2 halted */
|
||||
#define EBADE 52 /* Invalid exchange */
|
||||
#define EBADR 53 /* Invalid request descriptor */
|
||||
#define EXFULL 54 /* Exchange full */
|
||||
#define ENOANO 55 /* No anode */
|
||||
#define EBADRQC 56 /* Invalid request code */
|
||||
#define EBADSLT 57 /* Invalid slot */
|
||||
|
||||
#define EDEADLOCK EDEADLK
|
||||
|
||||
#define EBFONT 59 /* Bad font file format */
|
||||
#define ENOSTR 60 /* Device not a stream */
|
||||
#define ENODATA 61 /* No data available */
|
||||
#define ETIME 62 /* Timer expired */
|
||||
#define ENOSR 63 /* Out of streams resources */
|
||||
#define ENONET 64 /* Machine is not on the network */
|
||||
#define ENOPKG 65 /* Package not installed */
|
||||
#define EREMOTE 66 /* Object is remote */
|
||||
#define ENOLINK 67 /* Link has been severed */
|
||||
#define EADV 68 /* Advertise error */
|
||||
#define ESRMNT 69 /* Srmount error */
|
||||
#define ECOMM 70 /* Communication error on send */
|
||||
#define EPROTO 71 /* Protocol error */
|
||||
#define EMULTIHOP 72 /* Multihop attempted */
|
||||
#define EDOTDOT 73 /* RFS specific error */
|
||||
#define EBADMSG 74 /* Not a data message */
|
||||
#define EOVERFLOW 75 /* Value too large for defined data type */
|
||||
#define ENOTUNIQ 76 /* Name not unique on network */
|
||||
#define EBADFD 77 /* File descriptor in bad state */
|
||||
#define EREMCHG 78 /* Remote address changed */
|
||||
#define ELIBACC 79 /* Can not access a needed shared library */
|
||||
#define ELIBBAD 80 /* Accessing a corrupted shared library */
|
||||
#define ELIBSCN 81 /* .lib section in a.out corrupted */
|
||||
#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
|
||||
#define ELIBEXEC 83 /* Cannot exec a shared library directly */
|
||||
#define EILSEQ 84 /* Illegal byte sequence */
|
||||
#define ERESTART 85 /* Interrupted system call should be restarted */
|
||||
#define ESTRPIPE 86 /* Streams pipe error */
|
||||
#define EUSERS 87 /* Too many users */
|
||||
#define ENOTSOCK 88 /* Socket operation on non-socket */
|
||||
#define EDESTADDRREQ 89 /* Destination address required */
|
||||
#define EMSGSIZE 90 /* Message too long */
|
||||
#define EPROTOTYPE 91 /* Protocol wrong type for socket */
|
||||
#define ENOPROTOOPT 92 /* Protocol not available */
|
||||
#define EPROTONOSUPPORT 93 /* Protocol not supported */
|
||||
#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
|
||||
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
|
||||
#define EPFNOSUPPORT 96 /* Protocol family not supported */
|
||||
#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
|
||||
#define EADDRINUSE 98 /* Address already in use */
|
||||
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
|
||||
#define ENETDOWN 100 /* Network is down */
|
||||
#define ENETUNREACH 101 /* Network is unreachable */
|
||||
#define ENETRESET 102 /* Network dropped connection because of reset */
|
||||
#define ECONNABORTED 103 /* Software caused connection abort */
|
||||
#define ECONNRESET 104 /* Connection reset by peer */
|
||||
#define ENOBUFS 105 /* No buffer space available */
|
||||
#define EISCONN 106 /* Transport endpoint is already connected */
|
||||
#define ENOTCONN 107 /* Transport endpoint is not connected */
|
||||
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
|
||||
#define ETOOMANYREFS 109 /* Too many references: cannot splice */
|
||||
#define ETIMEDOUT 110 /* Connection timed out */
|
||||
#define ECONNREFUSED 111 /* Connection refused */
|
||||
#define EHOSTDOWN 112 /* Host is down */
|
||||
#define EHOSTUNREACH 113 /* No route to host */
|
||||
#define EALREADY 114 /* Operation already in progress */
|
||||
#define EINPROGRESS 115 /* Operation now in progress */
|
||||
#define ESTALE 116 /* Stale NFS file handle */
|
||||
#define EUCLEAN 117 /* Structure needs cleaning */
|
||||
#define ENOTNAM 118 /* Not a XENIX named type file */
|
||||
#define ENAVAIL 119 /* No XENIX semaphores available */
|
||||
#define EISNAM 120 /* Is a named type file */
|
||||
#define EREMOTEIO 121 /* Remote I/O error */
|
||||
#define EDQUOT 122 /* Quota exceeded */
|
||||
|
||||
#define ENOMEDIUM 123 /* No medium found */
|
||||
#define EMEDIUMTYPE 124 /* Wrong medium type */
|
||||
#define ECANCELED 125 /* Operation Canceled */
|
||||
#define ENOKEY 126 /* Required key not available */
|
||||
#define EKEYEXPIRED 127 /* Key has expired */
|
||||
#define EKEYREVOKED 128 /* Key has been revoked */
|
||||
#define EKEYREJECTED 129 /* Key was rejected by service */
|
||||
|
||||
/* for robust mutexes */
|
||||
#define EOWNERDEAD 130 /* Owner died */
|
||||
#define ENOTRECOVERABLE 131 /* State not recoverable */
|
||||
|
||||
#endif
|
||||
148
include/asm-generic/fcntl.h
Normal file
148
include/asm-generic/fcntl.h
Normal file
@@ -0,0 +1,148 @@
|
||||
#ifndef _ASM_GENERIC_FCNTL_H
|
||||
#define _ASM_GENERIC_FCNTL_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
|
||||
located on an ext2 file system */
|
||||
#define O_ACCMODE 00000003
|
||||
#define O_RDONLY 00000000
|
||||
#define O_WRONLY 00000001
|
||||
#define O_RDWR 00000002
|
||||
#ifndef O_CREAT
|
||||
#define O_CREAT 00000100 /* not fcntl */
|
||||
#endif
|
||||
#ifndef O_EXCL
|
||||
#define O_EXCL 00000200 /* not fcntl */
|
||||
#endif
|
||||
#ifndef O_NOCTTY
|
||||
#define O_NOCTTY 00000400 /* not fcntl */
|
||||
#endif
|
||||
#ifndef O_TRUNC
|
||||
#define O_TRUNC 00001000 /* not fcntl */
|
||||
#endif
|
||||
#ifndef O_APPEND
|
||||
#define O_APPEND 00002000
|
||||
#endif
|
||||
#ifndef O_NONBLOCK
|
||||
#define O_NONBLOCK 00004000
|
||||
#endif
|
||||
#ifndef O_SYNC
|
||||
#define O_SYNC 00010000
|
||||
#endif
|
||||
#ifndef FASYNC
|
||||
#define FASYNC 00020000 /* fcntl, for BSD compatibility */
|
||||
#endif
|
||||
#ifndef O_DIRECT
|
||||
#define O_DIRECT 00040000 /* direct disk access hint */
|
||||
#endif
|
||||
#ifndef O_LARGEFILE
|
||||
#define O_LARGEFILE 00100000
|
||||
#endif
|
||||
#ifndef O_DIRECTORY
|
||||
#define O_DIRECTORY 00200000 /* must be a directory */
|
||||
#endif
|
||||
#ifndef O_NOFOLLOW
|
||||
#define O_NOFOLLOW 00400000 /* don't follow links */
|
||||
#endif
|
||||
#ifndef O_NOATIME
|
||||
#define O_NOATIME 01000000
|
||||
#endif
|
||||
#ifndef O_NDELAY
|
||||
#define O_NDELAY O_NONBLOCK
|
||||
#endif
|
||||
|
||||
#define F_DUPFD 0 /* dup */
|
||||
#define F_GETFD 1 /* get close_on_exec */
|
||||
#define F_SETFD 2 /* set/clear close_on_exec */
|
||||
#define F_GETFL 3 /* get file->f_flags */
|
||||
#define F_SETFL 4 /* set file->f_flags */
|
||||
#ifndef F_GETLK
|
||||
#define F_GETLK 5
|
||||
#define F_SETLK 6
|
||||
#define F_SETLKW 7
|
||||
#endif
|
||||
#ifndef F_SETOWN
|
||||
#define F_SETOWN 8 /* for sockets. */
|
||||
#define F_GETOWN 9 /* for sockets. */
|
||||
#endif
|
||||
#ifndef F_SETSIG
|
||||
#define F_SETSIG 10 /* for sockets. */
|
||||
#define F_GETSIG 11 /* for sockets. */
|
||||
#endif
|
||||
|
||||
/* for F_[GET|SET]FL */
|
||||
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
|
||||
|
||||
/* for posix fcntl() and lockf() */
|
||||
#ifndef F_RDLCK
|
||||
#define F_RDLCK 0
|
||||
#define F_WRLCK 1
|
||||
#define F_UNLCK 2
|
||||
#endif
|
||||
|
||||
/* for old implementation of bsd flock () */
|
||||
#ifndef F_EXLCK
|
||||
#define F_EXLCK 4 /* or 3 */
|
||||
#define F_SHLCK 8 /* or 4 */
|
||||
#endif
|
||||
|
||||
/* for leases */
|
||||
#ifndef F_INPROGRESS
|
||||
#define F_INPROGRESS 16
|
||||
#endif
|
||||
|
||||
/* operations for bsd flock(), also used by the kernel implementation */
|
||||
#define LOCK_SH 1 /* shared lock */
|
||||
#define LOCK_EX 2 /* exclusive lock */
|
||||
#define LOCK_NB 4 /* or'd with one of the above to prevent
|
||||
blocking */
|
||||
#define LOCK_UN 8 /* remove lock */
|
||||
|
||||
#define LOCK_MAND 32 /* This is a mandatory flock ... */
|
||||
#define LOCK_READ 64 /* which allows concurrent read operations */
|
||||
#define LOCK_WRITE 128 /* which allows concurrent write operations */
|
||||
#define LOCK_RW 192 /* which allows concurrent read & write ops */
|
||||
|
||||
#define F_LINUX_SPECIFIC_BASE 1024
|
||||
|
||||
#ifndef HAVE_ARCH_STRUCT_FLOCK
|
||||
#ifndef __ARCH_FLOCK_PAD
|
||||
#define __ARCH_FLOCK_PAD
|
||||
#endif
|
||||
|
||||
struct flock {
|
||||
short l_type;
|
||||
short l_whence;
|
||||
off_t l_start;
|
||||
off_t l_len;
|
||||
pid_t l_pid;
|
||||
__ARCH_FLOCK_PAD
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_64BIT
|
||||
|
||||
#ifndef F_GETLK64
|
||||
#define F_GETLK64 12 /* using 'struct flock64' */
|
||||
#define F_SETLK64 13
|
||||
#define F_SETLKW64 14
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ARCH_STRUCT_FLOCK64
|
||||
#ifndef __ARCH_FLOCK64_PAD
|
||||
#define __ARCH_FLOCK64_PAD
|
||||
#endif
|
||||
|
||||
struct flock64 {
|
||||
short l_type;
|
||||
short l_whence;
|
||||
loff_t l_start;
|
||||
loff_t l_len;
|
||||
pid_t l_pid;
|
||||
__ARCH_FLOCK64_PAD
|
||||
};
|
||||
#endif
|
||||
#endif /* !CONFIG_64BIT */
|
||||
|
||||
#endif /* _ASM_GENERIC_FCNTL_H */
|
||||
59
include/asm-generic/futex.h
Normal file
59
include/asm-generic/futex.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#ifndef _ASM_GENERIC_FUTEX_H
|
||||
#define _ASM_GENERIC_FUTEX_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/futex.h>
|
||||
#include <asm/errno.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
static inline int
|
||||
futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
|
||||
{
|
||||
int op = (encoded_op >> 28) & 7;
|
||||
int cmp = (encoded_op >> 24) & 15;
|
||||
int oparg = (encoded_op << 8) >> 20;
|
||||
int cmparg = (encoded_op << 20) >> 20;
|
||||
int oldval = 0, ret;
|
||||
if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
|
||||
oparg = 1 << oparg;
|
||||
|
||||
if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
|
||||
return -EFAULT;
|
||||
|
||||
pagefault_disable();
|
||||
|
||||
switch (op) {
|
||||
case FUTEX_OP_SET:
|
||||
case FUTEX_OP_ADD:
|
||||
case FUTEX_OP_OR:
|
||||
case FUTEX_OP_ANDN:
|
||||
case FUTEX_OP_XOR:
|
||||
default:
|
||||
ret = -ENOSYS;
|
||||
}
|
||||
|
||||
pagefault_enable();
|
||||
|
||||
if (!ret) {
|
||||
switch (cmp) {
|
||||
case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
|
||||
case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
|
||||
case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
|
||||
case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
|
||||
case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
|
||||
case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
|
||||
default: ret = -ENOSYS;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int
|
||||
futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
25
include/asm-generic/gpio.h
Normal file
25
include/asm-generic/gpio.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef _ASM_GENERIC_GPIO_H
|
||||
#define _ASM_GENERIC_GPIO_H
|
||||
|
||||
/* platforms that don't directly support access to GPIOs through I2C, SPI,
|
||||
* or other blocking infrastructure can use these wrappers.
|
||||
*/
|
||||
|
||||
static inline int gpio_cansleep(unsigned gpio)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int gpio_get_value_cansleep(unsigned gpio)
|
||||
{
|
||||
might_sleep();
|
||||
return gpio_get_value(gpio);
|
||||
}
|
||||
|
||||
static inline void gpio_set_value_cansleep(unsigned gpio, int value)
|
||||
{
|
||||
might_sleep();
|
||||
gpio_set_value(gpio, value);
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_GPIO_H */
|
||||
38
include/asm-generic/ide_iops.h
Normal file
38
include/asm-generic/ide_iops.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/* Generic I/O and MEMIO string operations. */
|
||||
|
||||
#define __ide_insw insw
|
||||
#define __ide_insl insl
|
||||
#define __ide_outsw outsw
|
||||
#define __ide_outsl outsl
|
||||
|
||||
static __inline__ void __ide_mm_insw(void __iomem *port, void *addr, u32 count)
|
||||
{
|
||||
while (count--) {
|
||||
*(u16 *)addr = readw(port);
|
||||
addr += 2;
|
||||
}
|
||||
}
|
||||
|
||||
static __inline__ void __ide_mm_insl(void __iomem *port, void *addr, u32 count)
|
||||
{
|
||||
while (count--) {
|
||||
*(u32 *)addr = readl(port);
|
||||
addr += 4;
|
||||
}
|
||||
}
|
||||
|
||||
static __inline__ void __ide_mm_outsw(void __iomem *port, void *addr, u32 count)
|
||||
{
|
||||
while (count--) {
|
||||
writew(*(u16 *)addr, port);
|
||||
addr += 2;
|
||||
}
|
||||
}
|
||||
|
||||
static __inline__ void __ide_mm_outsl(void __iomem * port, void *addr, u32 count)
|
||||
{
|
||||
while (count--) {
|
||||
writel(*(u32 *)addr, port);
|
||||
addr += 4;
|
||||
}
|
||||
}
|
||||
80
include/asm-generic/ioctl.h
Normal file
80
include/asm-generic/ioctl.h
Normal file
@@ -0,0 +1,80 @@
|
||||
#ifndef _ASM_GENERIC_IOCTL_H
|
||||
#define _ASM_GENERIC_IOCTL_H
|
||||
|
||||
/* ioctl command encoding: 32 bits total, command in lower 16 bits,
|
||||
* size of the parameter structure in the lower 14 bits of the
|
||||
* upper 16 bits.
|
||||
* Encoding the size of the parameter structure in the ioctl request
|
||||
* is useful for catching programs compiled with old versions
|
||||
* and to avoid overwriting user space outside the user buffer area.
|
||||
* The highest 2 bits are reserved for indicating the ``access mode''.
|
||||
* NOTE: This limits the max parameter size to 16kB -1 !
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following is for compatibility across the various Linux
|
||||
* platforms. The generic ioctl numbering scheme doesn't really enforce
|
||||
* a type field. De facto, however, the top 8 bits of the lower 16
|
||||
* bits are indeed used as a type field, so we might just as well make
|
||||
* this explicit here. Please be sure to use the decoding macros
|
||||
* below from now on.
|
||||
*/
|
||||
#define _IOC_NRBITS 8
|
||||
#define _IOC_TYPEBITS 8
|
||||
#define _IOC_SIZEBITS 14
|
||||
#define _IOC_DIRBITS 2
|
||||
|
||||
#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
|
||||
#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
|
||||
#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
|
||||
#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
|
||||
|
||||
#define _IOC_NRSHIFT 0
|
||||
#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
|
||||
#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
|
||||
#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
|
||||
|
||||
/*
|
||||
* Direction bits.
|
||||
*/
|
||||
#define _IOC_NONE 0U
|
||||
#define _IOC_WRITE 1U
|
||||
#define _IOC_READ 2U
|
||||
|
||||
#define _IOC(dir,type,nr,size) \
|
||||
(((dir) << _IOC_DIRSHIFT) | \
|
||||
((type) << _IOC_TYPESHIFT) | \
|
||||
((nr) << _IOC_NRSHIFT) | \
|
||||
((size) << _IOC_SIZESHIFT))
|
||||
|
||||
/* provoke compile error for invalid uses of size argument */
|
||||
extern unsigned int __invalid_size_argument_for_IOC;
|
||||
#define _IOC_TYPECHECK(t) \
|
||||
((sizeof(t) == sizeof(t[1]) && \
|
||||
sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
|
||||
sizeof(t) : __invalid_size_argument_for_IOC)
|
||||
|
||||
/* used to create numbers */
|
||||
#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
|
||||
#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
|
||||
#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
|
||||
#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
|
||||
#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
|
||||
#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
|
||||
#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
|
||||
|
||||
/* used to decode ioctl numbers.. */
|
||||
#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
|
||||
#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
|
||||
#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
|
||||
#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
|
||||
|
||||
/* ...and for the drivers/sound files... */
|
||||
|
||||
#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
|
||||
#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
|
||||
#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
|
||||
#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
|
||||
#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
|
||||
|
||||
#endif /* _ASM_GENERIC_IOCTL_H */
|
||||
68
include/asm-generic/iomap.h
Normal file
68
include/asm-generic/iomap.h
Normal file
@@ -0,0 +1,68 @@
|
||||
#ifndef __GENERIC_IO_H
|
||||
#define __GENERIC_IO_H
|
||||
|
||||
#include <linux/linkage.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
/*
|
||||
* These are the "generic" interfaces for doing new-style
|
||||
* memory-mapped or PIO accesses. Architectures may do
|
||||
* their own arch-optimized versions, these just act as
|
||||
* wrappers around the old-style IO register access functions:
|
||||
* read[bwl]/write[bwl]/in[bwl]/out[bwl]
|
||||
*
|
||||
* Don't include this directly, include it from <asm/io.h>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Read/write from/to an (offsettable) iomem cookie. It might be a PIO
|
||||
* access or a MMIO access, these functions don't care. The info is
|
||||
* encoded in the hardware mapping set up by the mapping functions
|
||||
* (or the cookie itself, depending on implementation and hw).
|
||||
*
|
||||
* The generic routines just encode the PIO/MMIO as part of the
|
||||
* cookie, and coldly assume that the MMIO IO mappings are not
|
||||
* in the low address range. Architectures for which this is not
|
||||
* true can't use this generic implementation.
|
||||
*/
|
||||
extern unsigned int fastcall ioread8(void __iomem *);
|
||||
extern unsigned int fastcall ioread16(void __iomem *);
|
||||
extern unsigned int fastcall ioread16be(void __iomem *);
|
||||
extern unsigned int fastcall ioread32(void __iomem *);
|
||||
extern unsigned int fastcall ioread32be(void __iomem *);
|
||||
|
||||
extern void fastcall iowrite8(u8, void __iomem *);
|
||||
extern void fastcall iowrite16(u16, void __iomem *);
|
||||
extern void fastcall iowrite16be(u16, void __iomem *);
|
||||
extern void fastcall iowrite32(u32, void __iomem *);
|
||||
extern void fastcall iowrite32be(u32, void __iomem *);
|
||||
|
||||
/*
|
||||
* "string" versions of the above. Note that they
|
||||
* use native byte ordering for the accesses (on
|
||||
* the assumption that IO and memory agree on a
|
||||
* byte order, and CPU byteorder is irrelevant).
|
||||
*
|
||||
* They do _not_ update the port address. If you
|
||||
* want MMIO that copies stuff laid out in MMIO
|
||||
* memory across multiple ports, use "memcpy_toio()"
|
||||
* and friends.
|
||||
*/
|
||||
extern void fastcall ioread8_rep(void __iomem *port, void *buf, unsigned long count);
|
||||
extern void fastcall ioread16_rep(void __iomem *port, void *buf, unsigned long count);
|
||||
extern void fastcall ioread32_rep(void __iomem *port, void *buf, unsigned long count);
|
||||
|
||||
extern void fastcall iowrite8_rep(void __iomem *port, const void *buf, unsigned long count);
|
||||
extern void fastcall iowrite16_rep(void __iomem *port, const void *buf, unsigned long count);
|
||||
extern void fastcall iowrite32_rep(void __iomem *port, const void *buf, unsigned long count);
|
||||
|
||||
/* Create a virtual mapping cookie for an IO port range */
|
||||
extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
|
||||
extern void ioport_unmap(void __iomem *);
|
||||
|
||||
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
|
||||
struct pci_dev;
|
||||
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
|
||||
extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
|
||||
|
||||
#endif
|
||||
31
include/asm-generic/ipc.h
Normal file
31
include/asm-generic/ipc.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef _ASM_GENERIC_IPC_H
|
||||
#define _ASM_GENERIC_IPC_H
|
||||
/*
|
||||
* These are used to wrap system calls.
|
||||
*
|
||||
* See architecture code for ugly details..
|
||||
*/
|
||||
struct ipc_kludge {
|
||||
struct msgbuf __user *msgp;
|
||||
long msgtyp;
|
||||
};
|
||||
|
||||
#define SEMOP 1
|
||||
#define SEMGET 2
|
||||
#define SEMCTL 3
|
||||
#define SEMTIMEDOP 4
|
||||
#define MSGSND 11
|
||||
#define MSGRCV 12
|
||||
#define MSGGET 13
|
||||
#define MSGCTL 14
|
||||
#define SHMAT 21
|
||||
#define SHMDT 22
|
||||
#define SHMGET 23
|
||||
#define SHMCTL 24
|
||||
|
||||
/* Used by the DIPC package, try and avoid reusing it */
|
||||
#define DIPC 25
|
||||
|
||||
#define IPCCALL(version,op) ((version)<<16 | (op))
|
||||
|
||||
#endif /* _ASM_GENERIC_IPC_H */
|
||||
37
include/asm-generic/irq_regs.h
Normal file
37
include/asm-generic/irq_regs.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/* Fallback per-CPU frame pointer holder
|
||||
*
|
||||
* Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
|
||||
* Written by David Howells (dhowells@redhat.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef _ASM_GENERIC_IRQ_REGS_H
|
||||
#define _ASM_GENERIC_IRQ_REGS_H
|
||||
|
||||
#include <linux/percpu.h>
|
||||
|
||||
/*
|
||||
* Per-cpu current frame pointer - the location of the last exception frame on
|
||||
* the stack
|
||||
*/
|
||||
DECLARE_PER_CPU(struct pt_regs *, __irq_regs);
|
||||
|
||||
static inline struct pt_regs *get_irq_regs(void)
|
||||
{
|
||||
return __get_cpu_var(__irq_regs);
|
||||
}
|
||||
|
||||
static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs)
|
||||
{
|
||||
struct pt_regs *old_regs, **pp_regs = &__get_cpu_var(__irq_regs);
|
||||
|
||||
old_regs = *pp_regs;
|
||||
*pp_regs = new_regs;
|
||||
return old_regs;
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_IRQ_REGS_H */
|
||||
12
include/asm-generic/libata-portmap.h
Normal file
12
include/asm-generic/libata-portmap.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef __ASM_GENERIC_LIBATA_PORTMAP_H
|
||||
#define __ASM_GENERIC_LIBATA_PORTMAP_H
|
||||
|
||||
#define ATA_PRIMARY_CMD 0x1F0
|
||||
#define ATA_PRIMARY_CTL 0x3F6
|
||||
#define ATA_PRIMARY_IRQ(dev) 14
|
||||
|
||||
#define ATA_SECONDARY_CMD 0x170
|
||||
#define ATA_SECONDARY_CTL 0x376
|
||||
#define ATA_SECONDARY_IRQ(dev) 15
|
||||
|
||||
#endif
|
||||
62
include/asm-generic/local.h
Normal file
62
include/asm-generic/local.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#ifndef _ASM_GENERIC_LOCAL_H
|
||||
#define _ASM_GENERIC_LOCAL_H
|
||||
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/hardirq.h>
|
||||
#include <asm/atomic.h>
|
||||
#include <asm/types.h>
|
||||
|
||||
/*
|
||||
* A signed long type for operations which are atomic for a single CPU.
|
||||
* Usually used in combination with per-cpu variables.
|
||||
*
|
||||
* This is the default implementation, which uses atomic_long_t. Which is
|
||||
* rather pointless. The whole point behind local_t is that some processors
|
||||
* can perform atomic adds and subtracts in a manner which is atomic wrt IRQs
|
||||
* running on this CPU. local_t allows exploitation of such capabilities.
|
||||
*/
|
||||
|
||||
/* Implement in terms of atomics. */
|
||||
|
||||
/* Don't use typedef: don't want them to be mixed with atomic_t's. */
|
||||
typedef struct
|
||||
{
|
||||
atomic_long_t a;
|
||||
} local_t;
|
||||
|
||||
#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
|
||||
|
||||
#define local_read(l) atomic_long_read(&(l)->a)
|
||||
#define local_set(l,i) atomic_long_set((&(l)->a),(i))
|
||||
#define local_inc(l) atomic_long_inc(&(l)->a)
|
||||
#define local_dec(l) atomic_long_dec(&(l)->a)
|
||||
#define local_add(i,l) atomic_long_add((i),(&(l)->a))
|
||||
#define local_sub(i,l) atomic_long_sub((i),(&(l)->a))
|
||||
|
||||
/* Non-atomic variants, ie. preemption disabled and won't be touched
|
||||
* in interrupt, etc. Some archs can optimize this case well. */
|
||||
#define __local_inc(l) local_set((l), local_read(l) + 1)
|
||||
#define __local_dec(l) local_set((l), local_read(l) - 1)
|
||||
#define __local_add(i,l) local_set((l), local_read(l) + (i))
|
||||
#define __local_sub(i,l) local_set((l), local_read(l) - (i))
|
||||
|
||||
/* Use these for per-cpu local_t variables: on some archs they are
|
||||
* much more efficient than these naive implementations. Note they take
|
||||
* a variable (eg. mystruct.foo), not an address.
|
||||
*/
|
||||
#define cpu_local_read(v) local_read(&__get_cpu_var(v))
|
||||
#define cpu_local_set(v, i) local_set(&__get_cpu_var(v), (i))
|
||||
#define cpu_local_inc(v) local_inc(&__get_cpu_var(v))
|
||||
#define cpu_local_dec(v) local_dec(&__get_cpu_var(v))
|
||||
#define cpu_local_add(i, v) local_add((i), &__get_cpu_var(v))
|
||||
#define cpu_local_sub(i, v) local_sub((i), &__get_cpu_var(v))
|
||||
|
||||
/* Non-atomic increments, ie. preemption disabled and won't be touched
|
||||
* in interrupt, etc. Some archs can optimize this case well.
|
||||
*/
|
||||
#define __cpu_local_inc(v) __local_inc(&__get_cpu_var(v))
|
||||
#define __cpu_local_dec(v) __local_dec(&__get_cpu_var(v))
|
||||
#define __cpu_local_add(i, v) __local_add((i), &__get_cpu_var(v))
|
||||
#define __cpu_local_sub(i, v) __local_sub((i), &__get_cpu_var(v))
|
||||
|
||||
#endif /* _ASM_GENERIC_LOCAL_H */
|
||||
80
include/asm-generic/memory_model.h
Normal file
80
include/asm-generic/memory_model.h
Normal file
@@ -0,0 +1,80 @@
|
||||
#ifndef __ASM_MEMORY_MODEL_H
|
||||
#define __ASM_MEMORY_MODEL_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#if defined(CONFIG_FLATMEM)
|
||||
|
||||
#ifndef ARCH_PFN_OFFSET
|
||||
#define ARCH_PFN_OFFSET (0UL)
|
||||
#endif
|
||||
|
||||
#elif defined(CONFIG_DISCONTIGMEM)
|
||||
|
||||
#ifndef arch_pfn_to_nid
|
||||
#define arch_pfn_to_nid(pfn) pfn_to_nid(pfn)
|
||||
#endif
|
||||
|
||||
#ifndef arch_local_page_offset
|
||||
#define arch_local_page_offset(pfn, nid) \
|
||||
((pfn) - NODE_DATA(nid)->node_start_pfn)
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_DISCONTIGMEM */
|
||||
|
||||
/*
|
||||
* supports 3 memory models.
|
||||
*/
|
||||
#if defined(CONFIG_FLATMEM)
|
||||
|
||||
#define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET))
|
||||
#define __page_to_pfn(page) ((unsigned long)((page) - mem_map) + \
|
||||
ARCH_PFN_OFFSET)
|
||||
#elif defined(CONFIG_DISCONTIGMEM)
|
||||
|
||||
#define __pfn_to_page(pfn) \
|
||||
({ unsigned long __pfn = (pfn); \
|
||||
unsigned long __nid = arch_pfn_to_nid(pfn); \
|
||||
NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\
|
||||
})
|
||||
|
||||
#define __page_to_pfn(pg) \
|
||||
({ struct page *__pg = (pg); \
|
||||
struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg)); \
|
||||
(unsigned long)(__pg - __pgdat->node_mem_map) + \
|
||||
__pgdat->node_start_pfn; \
|
||||
})
|
||||
|
||||
#elif defined(CONFIG_SPARSEMEM)
|
||||
/*
|
||||
* Note: section's mem_map is encorded to reflect its start_pfn.
|
||||
* section[i].section_mem_map == mem_map's address - start_pfn;
|
||||
*/
|
||||
#define __page_to_pfn(pg) \
|
||||
({ struct page *__pg = (pg); \
|
||||
int __sec = page_to_section(__pg); \
|
||||
(unsigned long)(__pg - __section_mem_map_addr(__nr_to_section(__sec))); \
|
||||
})
|
||||
|
||||
#define __pfn_to_page(pfn) \
|
||||
({ unsigned long __pfn = (pfn); \
|
||||
struct mem_section *__sec = __pfn_to_section(__pfn); \
|
||||
__section_mem_map_addr(__sec) + __pfn; \
|
||||
})
|
||||
#endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */
|
||||
|
||||
#ifdef CONFIG_OUT_OF_LINE_PFN_TO_PAGE
|
||||
struct page;
|
||||
/* this is useful when inlined pfn_to_page is too big */
|
||||
extern struct page *pfn_to_page(unsigned long pfn);
|
||||
extern unsigned long page_to_pfn(struct page *page);
|
||||
#else
|
||||
#define page_to_pfn __page_to_pfn
|
||||
#define pfn_to_page __pfn_to_page
|
||||
#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif
|
||||
41
include/asm-generic/mman.h
Normal file
41
include/asm-generic/mman.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef _ASM_GENERIC_MMAN_H
|
||||
#define _ASM_GENERIC_MMAN_H
|
||||
|
||||
/*
|
||||
Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd.
|
||||
Based on: asm-xxx/mman.h
|
||||
*/
|
||||
|
||||
#define PROT_READ 0x1 /* page can be read */
|
||||
#define PROT_WRITE 0x2 /* page can be written */
|
||||
#define PROT_EXEC 0x4 /* page can be executed */
|
||||
#define PROT_SEM 0x8 /* page may be used for atomic ops */
|
||||
#define PROT_NONE 0x0 /* page can not be accessed */
|
||||
#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
|
||||
#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
|
||||
|
||||
#define MAP_SHARED 0x01 /* Share changes */
|
||||
#define MAP_PRIVATE 0x02 /* Changes are private */
|
||||
#define MAP_TYPE 0x0f /* Mask for type of mapping */
|
||||
#define MAP_FIXED 0x10 /* Interpret addr exactly */
|
||||
#define MAP_ANONYMOUS 0x20 /* don't use a file */
|
||||
|
||||
#define MS_ASYNC 1 /* sync memory asynchronously */
|
||||
#define MS_INVALIDATE 2 /* invalidate the caches */
|
||||
#define MS_SYNC 4 /* synchronous memory sync */
|
||||
|
||||
#define MADV_NORMAL 0 /* no further special treatment */
|
||||
#define MADV_RANDOM 1 /* expect random page references */
|
||||
#define MADV_SEQUENTIAL 2 /* expect sequential page references */
|
||||
#define MADV_WILLNEED 3 /* will need these pages */
|
||||
#define MADV_DONTNEED 4 /* don't need these pages */
|
||||
|
||||
/* common parameters: try to keep these consistent across architectures */
|
||||
#define MADV_REMOVE 9 /* remove these pages & resources */
|
||||
#define MADV_DONTFORK 10 /* don't inherit across fork */
|
||||
#define MADV_DOFORK 11 /* do inherit across fork */
|
||||
|
||||
/* compatibility flags */
|
||||
#define MAP_FILE 0
|
||||
|
||||
#endif
|
||||
112
include/asm-generic/mutex-dec.h
Normal file
112
include/asm-generic/mutex-dec.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* include/asm-generic/mutex-dec.h
|
||||
*
|
||||
* Generic implementation of the mutex fastpath, based on atomic
|
||||
* decrement/increment.
|
||||
*/
|
||||
#ifndef _ASM_GENERIC_MUTEX_DEC_H
|
||||
#define _ASM_GENERIC_MUTEX_DEC_H
|
||||
|
||||
/**
|
||||
* __mutex_fastpath_lock - try to take the lock by moving the count
|
||||
* from 1 to a 0 value
|
||||
* @count: pointer of type atomic_t
|
||||
* @fail_fn: function to call if the original value was not 1
|
||||
*
|
||||
* Change the count from 1 to a value lower than 1, and call <fail_fn> if
|
||||
* it wasn't 1 originally. This function MUST leave the value lower than
|
||||
* 1 even when the "1" assertion wasn't true.
|
||||
*/
|
||||
static inline void
|
||||
__mutex_fastpath_lock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
|
||||
{
|
||||
if (unlikely(atomic_dec_return(count) < 0))
|
||||
fail_fn(count);
|
||||
else
|
||||
smp_mb();
|
||||
}
|
||||
|
||||
/**
|
||||
* __mutex_fastpath_lock_retval - try to take the lock by moving the count
|
||||
* from 1 to a 0 value
|
||||
* @count: pointer of type atomic_t
|
||||
* @fail_fn: function to call if the original value was not 1
|
||||
*
|
||||
* Change the count from 1 to a value lower than 1, and call <fail_fn> if
|
||||
* it wasn't 1 originally. This function returns 0 if the fastpath succeeds,
|
||||
* or anything the slow path function returns.
|
||||
*/
|
||||
static inline int
|
||||
__mutex_fastpath_lock_retval(atomic_t *count, fastcall int (*fail_fn)(atomic_t *))
|
||||
{
|
||||
if (unlikely(atomic_dec_return(count) < 0))
|
||||
return fail_fn(count);
|
||||
else {
|
||||
smp_mb();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* __mutex_fastpath_unlock - try to promote the count from 0 to 1
|
||||
* @count: pointer of type atomic_t
|
||||
* @fail_fn: function to call if the original value was not 0
|
||||
*
|
||||
* Try to promote the count from 0 to 1. If it wasn't 0, call <fail_fn>.
|
||||
* In the failure case, this function is allowed to either set the value to
|
||||
* 1, or to set it to a value lower than 1.
|
||||
*
|
||||
* If the implementation sets it to a value of lower than 1, then the
|
||||
* __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs
|
||||
* to return 0 otherwise.
|
||||
*/
|
||||
static inline void
|
||||
__mutex_fastpath_unlock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
|
||||
{
|
||||
smp_mb();
|
||||
if (unlikely(atomic_inc_return(count) <= 0))
|
||||
fail_fn(count);
|
||||
}
|
||||
|
||||
#define __mutex_slowpath_needs_to_unlock() 1
|
||||
|
||||
/**
|
||||
* __mutex_fastpath_trylock - try to acquire the mutex, without waiting
|
||||
*
|
||||
* @count: pointer of type atomic_t
|
||||
* @fail_fn: fallback function
|
||||
*
|
||||
* Change the count from 1 to a value lower than 1, and return 0 (failure)
|
||||
* if it wasn't 1 originally, or return 1 (success) otherwise. This function
|
||||
* MUST leave the value lower than 1 even when the "1" assertion wasn't true.
|
||||
* Additionally, if the value was < 0 originally, this function must not leave
|
||||
* it to 0 on failure.
|
||||
*
|
||||
* If the architecture has no effective trylock variant, it should call the
|
||||
* <fail_fn> spinlock-based trylock variant unconditionally.
|
||||
*/
|
||||
static inline int
|
||||
__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
|
||||
{
|
||||
/*
|
||||
* We have two variants here. The cmpxchg based one is the best one
|
||||
* because it never induce a false contention state. It is included
|
||||
* here because architectures using the inc/dec algorithms over the
|
||||
* xchg ones are much more likely to support cmpxchg natively.
|
||||
*
|
||||
* If not we fall back to the spinlock based variant - that is
|
||||
* just as efficient (and simpler) as a 'destructive' probing of
|
||||
* the mutex state would be.
|
||||
*/
|
||||
#ifdef __HAVE_ARCH_CMPXCHG
|
||||
if (likely(atomic_cmpxchg(count, 1, 0) == 1)) {
|
||||
smp_mb();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
return fail_fn(count);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
19
include/asm-generic/mutex-null.h
Normal file
19
include/asm-generic/mutex-null.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* include/asm-generic/mutex-null.h
|
||||
*
|
||||
* Generic implementation of the mutex fastpath, based on NOP :-)
|
||||
*
|
||||
* This is used by the mutex-debugging infrastructure, but it can also
|
||||
* be used by architectures that (for whatever reason) want to use the
|
||||
* spinlock based slowpath.
|
||||
*/
|
||||
#ifndef _ASM_GENERIC_MUTEX_NULL_H
|
||||
#define _ASM_GENERIC_MUTEX_NULL_H
|
||||
|
||||
#define __mutex_fastpath_lock(count, fail_fn) fail_fn(count)
|
||||
#define __mutex_fastpath_lock_retval(count, fail_fn) fail_fn(count)
|
||||
#define __mutex_fastpath_unlock(count, fail_fn) fail_fn(count)
|
||||
#define __mutex_fastpath_trylock(count, fail_fn) fail_fn(count)
|
||||
#define __mutex_slowpath_needs_to_unlock() 1
|
||||
|
||||
#endif
|
||||
118
include/asm-generic/mutex-xchg.h
Normal file
118
include/asm-generic/mutex-xchg.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* include/asm-generic/mutex-xchg.h
|
||||
*
|
||||
* Generic implementation of the mutex fastpath, based on xchg().
|
||||
*
|
||||
* NOTE: An xchg based implementation might be less optimal than an atomic
|
||||
* decrement/increment based implementation. If your architecture
|
||||
* has a reasonable atomic dec/inc then you should probably use
|
||||
* asm-generic/mutex-dec.h instead, or you could open-code an
|
||||
* optimized version in asm/mutex.h.
|
||||
*/
|
||||
#ifndef _ASM_GENERIC_MUTEX_XCHG_H
|
||||
#define _ASM_GENERIC_MUTEX_XCHG_H
|
||||
|
||||
/**
|
||||
* __mutex_fastpath_lock - try to take the lock by moving the count
|
||||
* from 1 to a 0 value
|
||||
* @count: pointer of type atomic_t
|
||||
* @fail_fn: function to call if the original value was not 1
|
||||
*
|
||||
* Change the count from 1 to a value lower than 1, and call <fail_fn> if it
|
||||
* wasn't 1 originally. This function MUST leave the value lower than 1
|
||||
* even when the "1" assertion wasn't true.
|
||||
*/
|
||||
static inline void
|
||||
__mutex_fastpath_lock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
|
||||
{
|
||||
if (unlikely(atomic_xchg(count, 0) != 1))
|
||||
fail_fn(count);
|
||||
else
|
||||
smp_mb();
|
||||
}
|
||||
|
||||
/**
|
||||
* __mutex_fastpath_lock_retval - try to take the lock by moving the count
|
||||
* from 1 to a 0 value
|
||||
* @count: pointer of type atomic_t
|
||||
* @fail_fn: function to call if the original value was not 1
|
||||
*
|
||||
* Change the count from 1 to a value lower than 1, and call <fail_fn> if it
|
||||
* wasn't 1 originally. This function returns 0 if the fastpath succeeds,
|
||||
* or anything the slow path function returns
|
||||
*/
|
||||
static inline int
|
||||
__mutex_fastpath_lock_retval(atomic_t *count, fastcall int (*fail_fn)(atomic_t *))
|
||||
{
|
||||
if (unlikely(atomic_xchg(count, 0) != 1))
|
||||
return fail_fn(count);
|
||||
else {
|
||||
smp_mb();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* __mutex_fastpath_unlock - try to promote the mutex from 0 to 1
|
||||
* @count: pointer of type atomic_t
|
||||
* @fail_fn: function to call if the original value was not 0
|
||||
*
|
||||
* try to promote the mutex from 0 to 1. if it wasn't 0, call <function>
|
||||
* In the failure case, this function is allowed to either set the value to
|
||||
* 1, or to set it to a value lower than one.
|
||||
* If the implementation sets it to a value of lower than one, the
|
||||
* __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs
|
||||
* to return 0 otherwise.
|
||||
*/
|
||||
static inline void
|
||||
__mutex_fastpath_unlock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
|
||||
{
|
||||
smp_mb();
|
||||
if (unlikely(atomic_xchg(count, 1) != 0))
|
||||
fail_fn(count);
|
||||
}
|
||||
|
||||
#define __mutex_slowpath_needs_to_unlock() 0
|
||||
|
||||
/**
|
||||
* __mutex_fastpath_trylock - try to acquire the mutex, without waiting
|
||||
*
|
||||
* @count: pointer of type atomic_t
|
||||
* @fail_fn: spinlock based trylock implementation
|
||||
*
|
||||
* Change the count from 1 to a value lower than 1, and return 0 (failure)
|
||||
* if it wasn't 1 originally, or return 1 (success) otherwise. This function
|
||||
* MUST leave the value lower than 1 even when the "1" assertion wasn't true.
|
||||
* Additionally, if the value was < 0 originally, this function must not leave
|
||||
* it to 0 on failure.
|
||||
*
|
||||
* If the architecture has no effective trylock variant, it should call the
|
||||
* <fail_fn> spinlock-based trylock variant unconditionally.
|
||||
*/
|
||||
static inline int
|
||||
__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
|
||||
{
|
||||
int prev = atomic_xchg(count, 0);
|
||||
|
||||
if (unlikely(prev < 0)) {
|
||||
/*
|
||||
* The lock was marked contended so we must restore that
|
||||
* state. If while doing so we get back a prev value of 1
|
||||
* then we just own it.
|
||||
*
|
||||
* [ In the rare case of the mutex going to 1, to 0, to -1
|
||||
* and then back to 0 in this few-instructions window,
|
||||
* this has the potential to trigger the slowpath for the
|
||||
* owner's unlock path needlessly, but that's not a problem
|
||||
* in practice. ]
|
||||
*/
|
||||
prev = atomic_xchg(count, prev);
|
||||
if (prev < 0)
|
||||
prev = 0;
|
||||
}
|
||||
smp_mb();
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
#endif
|
||||
26
include/asm-generic/page.h
Normal file
26
include/asm-generic/page.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef _ASM_GENERIC_PAGE_H
|
||||
#define _ASM_GENERIC_PAGE_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/compiler.h>
|
||||
|
||||
/* Pure 2^n version of get_order */
|
||||
static __inline__ __attribute_const__ int get_order(unsigned long size)
|
||||
{
|
||||
int order;
|
||||
|
||||
size = (size - 1) >> (PAGE_SHIFT - 1);
|
||||
order = -1;
|
||||
do {
|
||||
size >>= 1;
|
||||
order++;
|
||||
} while (size);
|
||||
return order;
|
||||
}
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _ASM_GENERIC_PAGE_H */
|
||||
107
include/asm-generic/pci-dma-compat.h
Normal file
107
include/asm-generic/pci-dma-compat.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/* include this file if the platform implements the dma_ DMA Mapping API
|
||||
* and wants to provide the pci_ DMA Mapping API in terms of it */
|
||||
|
||||
#ifndef _ASM_GENERIC_PCI_DMA_COMPAT_H
|
||||
#define _ASM_GENERIC_PCI_DMA_COMPAT_H
|
||||
|
||||
#include <linux/dma-mapping.h>
|
||||
|
||||
/* note pci_set_dma_mask isn't here, since it's a public function
|
||||
* exported from drivers/pci, use dma_supported instead */
|
||||
|
||||
static inline int
|
||||
pci_dma_supported(struct pci_dev *hwdev, u64 mask)
|
||||
{
|
||||
return dma_supported(hwdev == NULL ? NULL : &hwdev->dev, mask);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
|
||||
dma_addr_t *dma_handle)
|
||||
{
|
||||
return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pci_free_consistent(struct pci_dev *hwdev, size_t size,
|
||||
void *vaddr, dma_addr_t dma_handle)
|
||||
{
|
||||
dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle);
|
||||
}
|
||||
|
||||
static inline dma_addr_t
|
||||
pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
|
||||
{
|
||||
return dma_map_single(hwdev == NULL ? NULL : &hwdev->dev, ptr, size, (enum dma_data_direction)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
|
||||
size_t size, int direction)
|
||||
{
|
||||
dma_unmap_single(hwdev == NULL ? NULL : &hwdev->dev, dma_addr, size, (enum dma_data_direction)direction);
|
||||
}
|
||||
|
||||
static inline dma_addr_t
|
||||
pci_map_page(struct pci_dev *hwdev, struct page *page,
|
||||
unsigned long offset, size_t size, int direction)
|
||||
{
|
||||
return dma_map_page(hwdev == NULL ? NULL : &hwdev->dev, page, offset, size, (enum dma_data_direction)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address,
|
||||
size_t size, int direction)
|
||||
{
|
||||
dma_unmap_page(hwdev == NULL ? NULL : &hwdev->dev, dma_address, size, (enum dma_data_direction)direction);
|
||||
}
|
||||
|
||||
static inline int
|
||||
pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
|
||||
int nents, int direction)
|
||||
{
|
||||
return dma_map_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
|
||||
int nents, int direction)
|
||||
{
|
||||
dma_unmap_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle,
|
||||
size_t size, int direction)
|
||||
{
|
||||
dma_sync_single_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
|
||||
size_t size, int direction)
|
||||
{
|
||||
dma_sync_single_for_device(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg,
|
||||
int nelems, int direction)
|
||||
{
|
||||
dma_sync_sg_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
|
||||
}
|
||||
|
||||
static inline void
|
||||
pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
|
||||
int nelems, int direction)
|
||||
{
|
||||
dma_sync_sg_for_device(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
|
||||
}
|
||||
|
||||
static inline int
|
||||
pci_dma_mapping_error(dma_addr_t dma_addr)
|
||||
{
|
||||
return dma_mapping_error(dma_addr);
|
||||
}
|
||||
|
||||
#endif
|
||||
55
include/asm-generic/pci.h
Normal file
55
include/asm-generic/pci.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* linux/include/asm-generic/pci.h
|
||||
*
|
||||
* Copyright (C) 2003 Russell King
|
||||
*/
|
||||
#ifndef _ASM_GENERIC_PCI_H
|
||||
#define _ASM_GENERIC_PCI_H
|
||||
|
||||
/**
|
||||
* pcibios_resource_to_bus - convert resource to PCI bus address
|
||||
* @dev: device which owns this resource
|
||||
* @region: converted bus-centric region (start,end)
|
||||
* @res: resource to convert
|
||||
*
|
||||
* Convert a resource to a PCI device bus address or bus window.
|
||||
*/
|
||||
static inline void
|
||||
pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
|
||||
struct resource *res)
|
||||
{
|
||||
region->start = res->start;
|
||||
region->end = res->end;
|
||||
}
|
||||
|
||||
static inline void
|
||||
pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
|
||||
struct pci_bus_region *region)
|
||||
{
|
||||
res->start = region->start;
|
||||
res->end = region->end;
|
||||
}
|
||||
|
||||
static inline struct resource *
|
||||
pcibios_select_root(struct pci_dev *pdev, struct resource *res)
|
||||
{
|
||||
struct resource *root = NULL;
|
||||
|
||||
if (res->flags & IORESOURCE_IO)
|
||||
root = &ioport_resource;
|
||||
if (res->flags & IORESOURCE_MEM)
|
||||
root = &iomem_resource;
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
#define pcibios_scan_all_fns(a, b) 0
|
||||
|
||||
#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
|
||||
static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
|
||||
{
|
||||
return channel ? 15 : 14;
|
||||
}
|
||||
#endif /* HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ */
|
||||
|
||||
#endif
|
||||
47
include/asm-generic/percpu.h
Normal file
47
include/asm-generic/percpu.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef _ASM_GENERIC_PERCPU_H_
|
||||
#define _ASM_GENERIC_PERCPU_H_
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#define __GENERIC_PER_CPU
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
extern unsigned long __per_cpu_offset[NR_CPUS];
|
||||
|
||||
#define per_cpu_offset(x) (__per_cpu_offset[x])
|
||||
|
||||
/* Separate out the type, so (int[3], foo) works. */
|
||||
#define DEFINE_PER_CPU(type, name) \
|
||||
__attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
|
||||
|
||||
/* var is in discarded region: offset to particular copy we want */
|
||||
#define per_cpu(var, cpu) (*({ \
|
||||
extern int simple_identifier_##var(void); \
|
||||
RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]); }))
|
||||
#define __get_cpu_var(var) per_cpu(var, smp_processor_id())
|
||||
#define __raw_get_cpu_var(var) per_cpu(var, raw_smp_processor_id())
|
||||
|
||||
/* A macro to avoid #include hell... */
|
||||
#define percpu_modcopy(pcpudst, src, size) \
|
||||
do { \
|
||||
unsigned int __i; \
|
||||
for_each_possible_cpu(__i) \
|
||||
memcpy((pcpudst)+__per_cpu_offset[__i], \
|
||||
(src), (size)); \
|
||||
} while (0)
|
||||
#else /* ! SMP */
|
||||
|
||||
#define DEFINE_PER_CPU(type, name) \
|
||||
__typeof__(type) per_cpu__##name
|
||||
|
||||
#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
|
||||
#define __get_cpu_var(var) per_cpu__##var
|
||||
#define __raw_get_cpu_var(var) per_cpu__##var
|
||||
|
||||
#endif /* SMP */
|
||||
|
||||
#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
|
||||
|
||||
#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
|
||||
#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
|
||||
|
||||
#endif /* _ASM_GENERIC_PERCPU_H_ */
|
||||
65
include/asm-generic/pgtable-nopmd.h
Normal file
65
include/asm-generic/pgtable-nopmd.h
Normal file
@@ -0,0 +1,65 @@
|
||||
#ifndef _PGTABLE_NOPMD_H
|
||||
#define _PGTABLE_NOPMD_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <asm-generic/pgtable-nopud.h>
|
||||
|
||||
#define __PAGETABLE_PMD_FOLDED
|
||||
|
||||
/*
|
||||
* Having the pmd type consist of a pud gets the size right, and allows
|
||||
* us to conceptually access the pud entry that this pmd is folded into
|
||||
* without casting.
|
||||
*/
|
||||
typedef struct { pud_t pud; } pmd_t;
|
||||
|
||||
#define PMD_SHIFT PUD_SHIFT
|
||||
#define PTRS_PER_PMD 1
|
||||
#define PMD_SIZE (1UL << PMD_SHIFT)
|
||||
#define PMD_MASK (~(PMD_SIZE-1))
|
||||
|
||||
/*
|
||||
* The "pud_xxx()" functions here are trivial for a folded two-level
|
||||
* setup: the pmd is never bad, and a pmd always exists (as it's folded
|
||||
* into the pud entry)
|
||||
*/
|
||||
static inline int pud_none(pud_t pud) { return 0; }
|
||||
static inline int pud_bad(pud_t pud) { return 0; }
|
||||
static inline int pud_present(pud_t pud) { return 1; }
|
||||
static inline void pud_clear(pud_t *pud) { }
|
||||
#define pmd_ERROR(pmd) (pud_ERROR((pmd).pud))
|
||||
|
||||
#define pud_populate(mm, pmd, pte) do { } while (0)
|
||||
|
||||
/*
|
||||
* (pmds are folded into puds so this doesn't get actually called,
|
||||
* but the define is needed for a generic inline function.)
|
||||
*/
|
||||
#define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
|
||||
|
||||
static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
|
||||
{
|
||||
return (pmd_t *)pud;
|
||||
}
|
||||
|
||||
#define pmd_val(x) (pud_val((x).pud))
|
||||
#define __pmd(x) ((pmd_t) { __pud(x) } )
|
||||
|
||||
#define pud_page(pud) (pmd_page((pmd_t){ pud }))
|
||||
#define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud }))
|
||||
|
||||
/*
|
||||
* allocating and freeing a pmd is trivial: the 1-entry pmd is
|
||||
* inside the pud, so has no extra memory associated with it.
|
||||
*/
|
||||
#define pmd_alloc_one(mm, address) NULL
|
||||
#define pmd_free(x) do { } while (0)
|
||||
#define __pmd_free_tlb(tlb, x) do { } while (0)
|
||||
|
||||
#undef pmd_addr_end
|
||||
#define pmd_addr_end(addr, end) (end)
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* _PGTABLE_NOPMD_H */
|
||||
61
include/asm-generic/pgtable-nopud.h
Normal file
61
include/asm-generic/pgtable-nopud.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#ifndef _PGTABLE_NOPUD_H
|
||||
#define _PGTABLE_NOPUD_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#define __PAGETABLE_PUD_FOLDED
|
||||
|
||||
/*
|
||||
* Having the pud type consist of a pgd gets the size right, and allows
|
||||
* us to conceptually access the pgd entry that this pud is folded into
|
||||
* without casting.
|
||||
*/
|
||||
typedef struct { pgd_t pgd; } pud_t;
|
||||
|
||||
#define PUD_SHIFT PGDIR_SHIFT
|
||||
#define PTRS_PER_PUD 1
|
||||
#define PUD_SIZE (1UL << PUD_SHIFT)
|
||||
#define PUD_MASK (~(PUD_SIZE-1))
|
||||
|
||||
/*
|
||||
* The "pgd_xxx()" functions here are trivial for a folded two-level
|
||||
* setup: the pud is never bad, and a pud always exists (as it's folded
|
||||
* into the pgd entry)
|
||||
*/
|
||||
static inline int pgd_none(pgd_t pgd) { return 0; }
|
||||
static inline int pgd_bad(pgd_t pgd) { return 0; }
|
||||
static inline int pgd_present(pgd_t pgd) { return 1; }
|
||||
static inline void pgd_clear(pgd_t *pgd) { }
|
||||
#define pud_ERROR(pud) (pgd_ERROR((pud).pgd))
|
||||
|
||||
#define pgd_populate(mm, pgd, pud) do { } while (0)
|
||||
/*
|
||||
* (puds are folded into pgds so this doesn't get actually called,
|
||||
* but the define is needed for a generic inline function.)
|
||||
*/
|
||||
#define set_pgd(pgdptr, pgdval) set_pud((pud_t *)(pgdptr), (pud_t) { pgdval })
|
||||
|
||||
static inline pud_t * pud_offset(pgd_t * pgd, unsigned long address)
|
||||
{
|
||||
return (pud_t *)pgd;
|
||||
}
|
||||
|
||||
#define pud_val(x) (pgd_val((x).pgd))
|
||||
#define __pud(x) ((pud_t) { __pgd(x) } )
|
||||
|
||||
#define pgd_page(pgd) (pud_page((pud_t){ pgd }))
|
||||
#define pgd_page_vaddr(pgd) (pud_page_vaddr((pud_t){ pgd }))
|
||||
|
||||
/*
|
||||
* allocating and freeing a pud is trivial: the 1-entry pud is
|
||||
* inside the pgd, so has no extra memory associated with it.
|
||||
*/
|
||||
#define pud_alloc_one(mm, address) NULL
|
||||
#define pud_free(x) do { } while (0)
|
||||
#define __pud_free_tlb(tlb, x) do { } while (0)
|
||||
|
||||
#undef pud_addr_end
|
||||
#define pud_addr_end(addr, end) (end)
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* _PGTABLE_NOPUD_H */
|
||||
268
include/asm-generic/pgtable.h
Normal file
268
include/asm-generic/pgtable.h
Normal file
@@ -0,0 +1,268 @@
|
||||
#ifndef _ASM_GENERIC_PGTABLE_H
|
||||
#define _ASM_GENERIC_PGTABLE_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#ifndef __HAVE_ARCH_PTEP_ESTABLISH
|
||||
/*
|
||||
* Establish a new mapping:
|
||||
* - flush the old one
|
||||
* - update the page tables
|
||||
* - inform the TLB about the new one
|
||||
*
|
||||
* We hold the mm semaphore for reading, and the pte lock.
|
||||
*
|
||||
* Note: the old pte is known to not be writable, so we don't need to
|
||||
* worry about dirty bits etc getting lost.
|
||||
*/
|
||||
#define ptep_establish(__vma, __address, __ptep, __entry) \
|
||||
do { \
|
||||
set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
|
||||
flush_tlb_page(__vma, __address); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
|
||||
/*
|
||||
* Largely same as above, but only sets the access flags (dirty,
|
||||
* accessed, and writable). Furthermore, we know it always gets set
|
||||
* to a "more permissive" setting, which allows most architectures
|
||||
* to optimize this.
|
||||
*/
|
||||
#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
|
||||
do { \
|
||||
set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
|
||||
flush_tlb_page(__vma, __address); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
|
||||
#define ptep_test_and_clear_young(__vma, __address, __ptep) \
|
||||
({ \
|
||||
pte_t __pte = *(__ptep); \
|
||||
int r = 1; \
|
||||
if (!pte_young(__pte)) \
|
||||
r = 0; \
|
||||
else \
|
||||
set_pte_at((__vma)->vm_mm, (__address), \
|
||||
(__ptep), pte_mkold(__pte)); \
|
||||
r; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
|
||||
#define ptep_clear_flush_young(__vma, __address, __ptep) \
|
||||
({ \
|
||||
int __young; \
|
||||
__young = ptep_test_and_clear_young(__vma, __address, __ptep); \
|
||||
if (__young) \
|
||||
flush_tlb_page(__vma, __address); \
|
||||
__young; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
|
||||
#define ptep_test_and_clear_dirty(__vma, __address, __ptep) \
|
||||
({ \
|
||||
pte_t __pte = *__ptep; \
|
||||
int r = 1; \
|
||||
if (!pte_dirty(__pte)) \
|
||||
r = 0; \
|
||||
else \
|
||||
set_pte_at((__vma)->vm_mm, (__address), (__ptep), \
|
||||
pte_mkclean(__pte)); \
|
||||
r; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
|
||||
#define ptep_clear_flush_dirty(__vma, __address, __ptep) \
|
||||
({ \
|
||||
int __dirty; \
|
||||
__dirty = ptep_test_and_clear_dirty(__vma, __address, __ptep); \
|
||||
if (__dirty) \
|
||||
flush_tlb_page(__vma, __address); \
|
||||
__dirty; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR
|
||||
#define ptep_get_and_clear(__mm, __address, __ptep) \
|
||||
({ \
|
||||
pte_t __pte = *(__ptep); \
|
||||
pte_clear((__mm), (__address), (__ptep)); \
|
||||
__pte; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
|
||||
#define ptep_get_and_clear_full(__mm, __address, __ptep, __full) \
|
||||
({ \
|
||||
pte_t __pte; \
|
||||
__pte = ptep_get_and_clear((__mm), (__address), (__ptep)); \
|
||||
__pte; \
|
||||
})
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Some architectures may be able to avoid expensive synchronization
|
||||
* primitives when modifications are made to PTE's which are already
|
||||
* not present, or in the process of an address space destruction.
|
||||
*/
|
||||
#ifndef __HAVE_ARCH_PTE_CLEAR_NOT_PRESENT_FULL
|
||||
#define pte_clear_not_present_full(__mm, __address, __ptep, __full) \
|
||||
do { \
|
||||
pte_clear((__mm), (__address), (__ptep)); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH
|
||||
#define ptep_clear_flush(__vma, __address, __ptep) \
|
||||
({ \
|
||||
pte_t __pte; \
|
||||
__pte = ptep_get_and_clear((__vma)->vm_mm, __address, __ptep); \
|
||||
flush_tlb_page(__vma, __address); \
|
||||
__pte; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT
|
||||
struct mm_struct;
|
||||
static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long address, pte_t *ptep)
|
||||
{
|
||||
pte_t old_pte = *ptep;
|
||||
set_pte_at(mm, address, ptep, pte_wrprotect(old_pte));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PTE_SAME
|
||||
#define pte_same(A,B) (pte_val(A) == pte_val(B))
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
|
||||
#define page_test_and_clear_dirty(page) (0)
|
||||
#define pte_maybe_dirty(pte) pte_dirty(pte)
|
||||
#else
|
||||
#define pte_maybe_dirty(pte) (1)
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
|
||||
#define page_test_and_clear_young(page) (0)
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PGD_OFFSET_GATE
|
||||
#define pgd_offset_gate(mm, addr) pgd_offset(mm, addr)
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_LAZY_MMU_PROT_UPDATE
|
||||
#define lazy_mmu_prot_update(pte) do { } while (0)
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_MOVE_PTE
|
||||
#define move_pte(pte, prot, old_addr, new_addr) (pte)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A facility to provide lazy MMU batching. This allows PTE updates and
|
||||
* page invalidations to be delayed until a call to leave lazy MMU mode
|
||||
* is issued. Some architectures may benefit from doing this, and it is
|
||||
* beneficial for both shadow and direct mode hypervisors, which may batch
|
||||
* the PTE updates which happen during this window. Note that using this
|
||||
* interface requires that read hazards be removed from the code. A read
|
||||
* hazard could result in the direct mode hypervisor case, since the actual
|
||||
* write to the page tables may not yet have taken place, so reads though
|
||||
* a raw PTE pointer after it has been modified are not guaranteed to be
|
||||
* up to date. This mode can only be entered and left under the protection of
|
||||
* the page table locks for all page tables which may be modified. In the UP
|
||||
* case, this is required so that preemption is disabled, and in the SMP case,
|
||||
* it must synchronize the delayed page table writes properly on other CPUs.
|
||||
*/
|
||||
#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
|
||||
#define arch_enter_lazy_mmu_mode() do {} while (0)
|
||||
#define arch_leave_lazy_mmu_mode() do {} while (0)
|
||||
#define arch_flush_lazy_mmu_mode() do {} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A facility to provide batching of the reload of page tables with the
|
||||
* actual context switch code for paravirtualized guests. By convention,
|
||||
* only one of the lazy modes (CPU, MMU) should be active at any given
|
||||
* time, entry should never be nested, and entry and exits should always
|
||||
* be paired. This is for sanity of maintaining and reasoning about the
|
||||
* kernel code.
|
||||
*/
|
||||
#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE
|
||||
#define arch_enter_lazy_cpu_mode() do {} while (0)
|
||||
#define arch_leave_lazy_cpu_mode() do {} while (0)
|
||||
#define arch_flush_lazy_cpu_mode() do {} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When walking page tables, get the address of the next boundary,
|
||||
* or the end address of the range if that comes earlier. Although no
|
||||
* vma end wraps to 0, rounded up __boundary may wrap to 0 throughout.
|
||||
*/
|
||||
|
||||
#define pgd_addr_end(addr, end) \
|
||||
({ unsigned long __boundary = ((addr) + PGDIR_SIZE) & PGDIR_MASK; \
|
||||
(__boundary - 1 < (end) - 1)? __boundary: (end); \
|
||||
})
|
||||
|
||||
#ifndef pud_addr_end
|
||||
#define pud_addr_end(addr, end) \
|
||||
({ unsigned long __boundary = ((addr) + PUD_SIZE) & PUD_MASK; \
|
||||
(__boundary - 1 < (end) - 1)? __boundary: (end); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef pmd_addr_end
|
||||
#define pmd_addr_end(addr, end) \
|
||||
({ unsigned long __boundary = ((addr) + PMD_SIZE) & PMD_MASK; \
|
||||
(__boundary - 1 < (end) - 1)? __boundary: (end); \
|
||||
})
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When walking page tables, we usually want to skip any p?d_none entries;
|
||||
* and any p?d_bad entries - reporting the error before resetting to none.
|
||||
* Do the tests inline, but report and clear the bad entry in mm/memory.c.
|
||||
*/
|
||||
void pgd_clear_bad(pgd_t *);
|
||||
void pud_clear_bad(pud_t *);
|
||||
void pmd_clear_bad(pmd_t *);
|
||||
|
||||
static inline int pgd_none_or_clear_bad(pgd_t *pgd)
|
||||
{
|
||||
if (pgd_none(*pgd))
|
||||
return 1;
|
||||
if (unlikely(pgd_bad(*pgd))) {
|
||||
pgd_clear_bad(pgd);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int pud_none_or_clear_bad(pud_t *pud)
|
||||
{
|
||||
if (pud_none(*pud))
|
||||
return 1;
|
||||
if (unlikely(pud_bad(*pud))) {
|
||||
pud_clear_bad(pud);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int pmd_none_or_clear_bad(pmd_t *pmd)
|
||||
{
|
||||
if (pmd_none(*pmd))
|
||||
return 1;
|
||||
if (unlikely(pmd_bad(*pmd))) {
|
||||
pmd_clear_bad(pmd);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* _ASM_GENERIC_PGTABLE_H */
|
||||
93
include/asm-generic/resource.h
Normal file
93
include/asm-generic/resource.h
Normal file
@@ -0,0 +1,93 @@
|
||||
#ifndef _ASM_GENERIC_RESOURCE_H
|
||||
#define _ASM_GENERIC_RESOURCE_H
|
||||
|
||||
/*
|
||||
* Resource limit IDs
|
||||
*
|
||||
* ( Compatibility detail: there are architectures that have
|
||||
* a different rlimit ID order in the 5-9 range and want
|
||||
* to keep that order for binary compatibility. The reasons
|
||||
* are historic and all new rlimits are identical across all
|
||||
* arches. If an arch has such special order for some rlimits
|
||||
* then it defines them prior including asm-generic/resource.h. )
|
||||
*/
|
||||
|
||||
#define RLIMIT_CPU 0 /* CPU time in ms */
|
||||
#define RLIMIT_FSIZE 1 /* Maximum filesize */
|
||||
#define RLIMIT_DATA 2 /* max data size */
|
||||
#define RLIMIT_STACK 3 /* max stack size */
|
||||
#define RLIMIT_CORE 4 /* max core file size */
|
||||
|
||||
#ifndef RLIMIT_RSS
|
||||
# define RLIMIT_RSS 5 /* max resident set size */
|
||||
#endif
|
||||
|
||||
#ifndef RLIMIT_NPROC
|
||||
# define RLIMIT_NPROC 6 /* max number of processes */
|
||||
#endif
|
||||
|
||||
#ifndef RLIMIT_NOFILE
|
||||
# define RLIMIT_NOFILE 7 /* max number of open files */
|
||||
#endif
|
||||
|
||||
#ifndef RLIMIT_MEMLOCK
|
||||
# define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
|
||||
#endif
|
||||
|
||||
#ifndef RLIMIT_AS
|
||||
# define RLIMIT_AS 9 /* address space limit */
|
||||
#endif
|
||||
|
||||
#define RLIMIT_LOCKS 10 /* maximum file locks held */
|
||||
#define RLIMIT_SIGPENDING 11 /* max number of pending signals */
|
||||
#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */
|
||||
#define RLIMIT_NICE 13 /* max nice prio allowed to raise to
|
||||
0-39 for nice level 19 .. -20 */
|
||||
#define RLIMIT_RTPRIO 14 /* maximum realtime priority */
|
||||
|
||||
#define RLIM_NLIMITS 15
|
||||
|
||||
/*
|
||||
* SuS says limits have to be unsigned.
|
||||
* Which makes a ton more sense anyway.
|
||||
*
|
||||
* Some architectures override this (for compatibility reasons):
|
||||
*/
|
||||
#ifndef RLIM_INFINITY
|
||||
# define RLIM_INFINITY (~0UL)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* RLIMIT_STACK default maximum - some architectures override it:
|
||||
*/
|
||||
#ifndef _STK_LIM_MAX
|
||||
# define _STK_LIM_MAX RLIM_INFINITY
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
/*
|
||||
* boot-time rlimit defaults for the init task:
|
||||
*/
|
||||
#define INIT_RLIMITS \
|
||||
{ \
|
||||
[RLIMIT_CPU] = { RLIM_INFINITY, RLIM_INFINITY }, \
|
||||
[RLIMIT_FSIZE] = { RLIM_INFINITY, RLIM_INFINITY }, \
|
||||
[RLIMIT_DATA] = { RLIM_INFINITY, RLIM_INFINITY }, \
|
||||
[RLIMIT_STACK] = { _STK_LIM, _STK_LIM_MAX }, \
|
||||
[RLIMIT_CORE] = { 0, RLIM_INFINITY }, \
|
||||
[RLIMIT_RSS] = { RLIM_INFINITY, RLIM_INFINITY }, \
|
||||
[RLIMIT_NPROC] = { 0, 0 }, \
|
||||
[RLIMIT_NOFILE] = { INR_OPEN, INR_OPEN }, \
|
||||
[RLIMIT_MEMLOCK] = { MLOCK_LIMIT, MLOCK_LIMIT }, \
|
||||
[RLIMIT_AS] = { RLIM_INFINITY, RLIM_INFINITY }, \
|
||||
[RLIMIT_LOCKS] = { RLIM_INFINITY, RLIM_INFINITY }, \
|
||||
[RLIMIT_SIGPENDING] = { 0, 0 }, \
|
||||
[RLIMIT_MSGQUEUE] = { MQ_BYTES_MAX, MQ_BYTES_MAX }, \
|
||||
[RLIMIT_NICE] = { 0, 0 }, \
|
||||
[RLIMIT_RTPRIO] = { 0, 0 }, \
|
||||
}
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif
|
||||
214
include/asm-generic/rtc.h
Normal file
214
include/asm-generic/rtc.h
Normal file
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* include/asm-generic/rtc.h
|
||||
*
|
||||
* Author: Tom Rini <trini@mvista.com>
|
||||
*
|
||||
* Based on:
|
||||
* drivers/char/rtc.c
|
||||
*
|
||||
* Please read the COPYING file for all license details.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_RTC_H__
|
||||
#define __ASM_RTC_H__
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/mc146818rtc.h>
|
||||
#include <linux/rtc.h>
|
||||
#include <linux/bcd.h>
|
||||
|
||||
#define RTC_PIE 0x40 /* periodic interrupt enable */
|
||||
#define RTC_AIE 0x20 /* alarm interrupt enable */
|
||||
#define RTC_UIE 0x10 /* update-finished interrupt enable */
|
||||
|
||||
/* some dummy definitions */
|
||||
#define RTC_BATT_BAD 0x100 /* battery bad */
|
||||
#define RTC_SQWE 0x08 /* enable square-wave output */
|
||||
#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */
|
||||
#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
|
||||
#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */
|
||||
|
||||
/*
|
||||
* Returns true if a clock update is in progress
|
||||
*/
|
||||
static inline unsigned char rtc_is_updating(void)
|
||||
{
|
||||
unsigned char uip;
|
||||
|
||||
spin_lock_irq(&rtc_lock);
|
||||
uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
return uip;
|
||||
}
|
||||
|
||||
static inline unsigned int get_rtc_time(struct rtc_time *time)
|
||||
{
|
||||
unsigned long uip_watchdog = jiffies;
|
||||
unsigned char ctrl;
|
||||
#ifdef CONFIG_MACH_DECSTATION
|
||||
unsigned int real_year;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* read RTC once any update in progress is done. The update
|
||||
* can take just over 2ms. We wait 10 to 20ms. There is no need to
|
||||
* to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP.
|
||||
* If you need to know *exactly* when a second has started, enable
|
||||
* periodic update complete interrupts, (via ioctl) and then
|
||||
* immediately read /dev/rtc which will block until you get the IRQ.
|
||||
* Once the read clears, read the RTC time (again via ioctl). Easy.
|
||||
*/
|
||||
|
||||
if (rtc_is_updating() != 0)
|
||||
while (jiffies - uip_watchdog < 2*HZ/100) {
|
||||
barrier();
|
||||
cpu_relax();
|
||||
}
|
||||
|
||||
/*
|
||||
* Only the values that we read from the RTC are set. We leave
|
||||
* tm_wday, tm_yday and tm_isdst untouched. Even though the
|
||||
* RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
|
||||
* by the RTC when initially set to a non-zero value.
|
||||
*/
|
||||
spin_lock_irq(&rtc_lock);
|
||||
time->tm_sec = CMOS_READ(RTC_SECONDS);
|
||||
time->tm_min = CMOS_READ(RTC_MINUTES);
|
||||
time->tm_hour = CMOS_READ(RTC_HOURS);
|
||||
time->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH);
|
||||
time->tm_mon = CMOS_READ(RTC_MONTH);
|
||||
time->tm_year = CMOS_READ(RTC_YEAR);
|
||||
#ifdef CONFIG_MACH_DECSTATION
|
||||
real_year = CMOS_READ(RTC_DEC_YEAR);
|
||||
#endif
|
||||
ctrl = CMOS_READ(RTC_CONTROL);
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
|
||||
if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
|
||||
{
|
||||
BCD_TO_BIN(time->tm_sec);
|
||||
BCD_TO_BIN(time->tm_min);
|
||||
BCD_TO_BIN(time->tm_hour);
|
||||
BCD_TO_BIN(time->tm_mday);
|
||||
BCD_TO_BIN(time->tm_mon);
|
||||
BCD_TO_BIN(time->tm_year);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MACH_DECSTATION
|
||||
time->tm_year += real_year - 72;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Account for differences between how the RTC uses the values
|
||||
* and how they are defined in a struct rtc_time;
|
||||
*/
|
||||
if (time->tm_year <= 69)
|
||||
time->tm_year += 100;
|
||||
|
||||
time->tm_mon--;
|
||||
|
||||
return RTC_24H;
|
||||
}
|
||||
|
||||
/* Set the current date and time in the real time clock. */
|
||||
static inline int set_rtc_time(struct rtc_time *time)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned char mon, day, hrs, min, sec;
|
||||
unsigned char save_control, save_freq_select;
|
||||
unsigned int yrs;
|
||||
#ifdef CONFIG_MACH_DECSTATION
|
||||
unsigned int real_yrs, leap_yr;
|
||||
#endif
|
||||
|
||||
yrs = time->tm_year;
|
||||
mon = time->tm_mon + 1; /* tm_mon starts at zero */
|
||||
day = time->tm_mday;
|
||||
hrs = time->tm_hour;
|
||||
min = time->tm_min;
|
||||
sec = time->tm_sec;
|
||||
|
||||
if (yrs > 255) /* They are unsigned */
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock_irqsave(&rtc_lock, flags);
|
||||
#ifdef CONFIG_MACH_DECSTATION
|
||||
real_yrs = yrs;
|
||||
leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) ||
|
||||
!((yrs + 1900) % 400));
|
||||
yrs = 72;
|
||||
|
||||
/*
|
||||
* We want to keep the year set to 73 until March
|
||||
* for non-leap years, so that Feb, 29th is handled
|
||||
* correctly.
|
||||
*/
|
||||
if (!leap_yr && mon < 3) {
|
||||
real_yrs--;
|
||||
yrs = 73;
|
||||
}
|
||||
#endif
|
||||
/* These limits and adjustments are independent of
|
||||
* whether the chip is in binary mode or not.
|
||||
*/
|
||||
if (yrs > 169) {
|
||||
spin_unlock_irqrestore(&rtc_lock, flags);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (yrs >= 100)
|
||||
yrs -= 100;
|
||||
|
||||
if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY)
|
||||
|| RTC_ALWAYS_BCD) {
|
||||
BIN_TO_BCD(sec);
|
||||
BIN_TO_BCD(min);
|
||||
BIN_TO_BCD(hrs);
|
||||
BIN_TO_BCD(day);
|
||||
BIN_TO_BCD(mon);
|
||||
BIN_TO_BCD(yrs);
|
||||
}
|
||||
|
||||
save_control = CMOS_READ(RTC_CONTROL);
|
||||
CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
|
||||
save_freq_select = CMOS_READ(RTC_FREQ_SELECT);
|
||||
CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
|
||||
|
||||
#ifdef CONFIG_MACH_DECSTATION
|
||||
CMOS_WRITE(real_yrs, RTC_DEC_YEAR);
|
||||
#endif
|
||||
CMOS_WRITE(yrs, RTC_YEAR);
|
||||
CMOS_WRITE(mon, RTC_MONTH);
|
||||
CMOS_WRITE(day, RTC_DAY_OF_MONTH);
|
||||
CMOS_WRITE(hrs, RTC_HOURS);
|
||||
CMOS_WRITE(min, RTC_MINUTES);
|
||||
CMOS_WRITE(sec, RTC_SECONDS);
|
||||
|
||||
CMOS_WRITE(save_control, RTC_CONTROL);
|
||||
CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
|
||||
|
||||
spin_unlock_irqrestore(&rtc_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned int get_rtc_ss(void)
|
||||
{
|
||||
struct rtc_time h;
|
||||
|
||||
get_rtc_time(&h);
|
||||
return h.tm_sec;
|
||||
}
|
||||
|
||||
static inline int get_rtc_pll(struct rtc_pll_info *pll)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
static inline int set_rtc_pll(struct rtc_pll_info *pll)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* __ASM_RTC_H__ */
|
||||
19
include/asm-generic/sections.h
Normal file
19
include/asm-generic/sections.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef _ASM_GENERIC_SECTIONS_H_
|
||||
#define _ASM_GENERIC_SECTIONS_H_
|
||||
|
||||
/* References to section boundaries */
|
||||
|
||||
extern char _text[], _stext[], _etext[];
|
||||
extern char _data[], _sdata[], _edata[];
|
||||
extern char __bss_start[], __bss_stop[];
|
||||
extern char __init_begin[], __init_end[];
|
||||
extern char _sinittext[], _einittext[];
|
||||
extern char _sextratext[] __attribute__((weak));
|
||||
extern char _eextratext[] __attribute__((weak));
|
||||
extern char _end[];
|
||||
extern char __per_cpu_start[], __per_cpu_end[];
|
||||
extern char __kprobes_text_start[], __kprobes_text_end[];
|
||||
extern char __initdata_begin[], __initdata_end[];
|
||||
extern char __start_rodata[], __end_rodata[];
|
||||
|
||||
#endif /* _ASM_GENERIC_SECTIONS_H_ */
|
||||
294
include/asm-generic/siginfo.h
Normal file
294
include/asm-generic/siginfo.h
Normal file
@@ -0,0 +1,294 @@
|
||||
#ifndef _ASM_GENERIC_SIGINFO_H
|
||||
#define _ASM_GENERIC_SIGINFO_H
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
typedef union sigval {
|
||||
int sival_int;
|
||||
void __user *sival_ptr;
|
||||
} sigval_t;
|
||||
|
||||
/*
|
||||
* This is the size (including padding) of the part of the
|
||||
* struct siginfo that is before the union.
|
||||
*/
|
||||
#ifndef __ARCH_SI_PREAMBLE_SIZE
|
||||
#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
|
||||
#endif
|
||||
|
||||
#define SI_MAX_SIZE 128
|
||||
#ifndef SI_PAD_SIZE
|
||||
#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
|
||||
#endif
|
||||
|
||||
#ifndef __ARCH_SI_UID_T
|
||||
#define __ARCH_SI_UID_T uid_t
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The default "si_band" type is "long", as specified by POSIX.
|
||||
* However, some architectures want to override this to "int"
|
||||
* for historical compatibility reasons, so we allow that.
|
||||
*/
|
||||
#ifndef __ARCH_SI_BAND_T
|
||||
#define __ARCH_SI_BAND_T long
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ARCH_SIGINFO_T
|
||||
|
||||
typedef struct siginfo {
|
||||
int si_signo;
|
||||
int si_errno;
|
||||
int si_code;
|
||||
|
||||
union {
|
||||
int _pad[SI_PAD_SIZE];
|
||||
|
||||
/* kill() */
|
||||
struct {
|
||||
pid_t _pid; /* sender's pid */
|
||||
__ARCH_SI_UID_T _uid; /* sender's uid */
|
||||
} _kill;
|
||||
|
||||
/* POSIX.1b timers */
|
||||
struct {
|
||||
timer_t _tid; /* timer id */
|
||||
int _overrun; /* overrun count */
|
||||
char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
|
||||
sigval_t _sigval; /* same as below */
|
||||
int _sys_private; /* not to be passed to user */
|
||||
} _timer;
|
||||
|
||||
/* POSIX.1b signals */
|
||||
struct {
|
||||
pid_t _pid; /* sender's pid */
|
||||
__ARCH_SI_UID_T _uid; /* sender's uid */
|
||||
sigval_t _sigval;
|
||||
} _rt;
|
||||
|
||||
/* SIGCHLD */
|
||||
struct {
|
||||
pid_t _pid; /* which child */
|
||||
__ARCH_SI_UID_T _uid; /* sender's uid */
|
||||
int _status; /* exit code */
|
||||
clock_t _utime;
|
||||
clock_t _stime;
|
||||
} _sigchld;
|
||||
|
||||
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
|
||||
struct {
|
||||
void __user *_addr; /* faulting insn/memory ref. */
|
||||
#ifdef __ARCH_SI_TRAPNO
|
||||
int _trapno; /* TRAP # which caused the signal */
|
||||
#endif
|
||||
} _sigfault;
|
||||
|
||||
/* SIGPOLL */
|
||||
struct {
|
||||
__ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
|
||||
int _fd;
|
||||
} _sigpoll;
|
||||
} _sifields;
|
||||
} siginfo_t;
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* How these fields are to be accessed.
|
||||
*/
|
||||
#define si_pid _sifields._kill._pid
|
||||
#define si_uid _sifields._kill._uid
|
||||
#define si_tid _sifields._timer._tid
|
||||
#define si_overrun _sifields._timer._overrun
|
||||
#define si_sys_private _sifields._timer._sys_private
|
||||
#define si_status _sifields._sigchld._status
|
||||
#define si_utime _sifields._sigchld._utime
|
||||
#define si_stime _sifields._sigchld._stime
|
||||
#define si_value _sifields._rt._sigval
|
||||
#define si_int _sifields._rt._sigval.sival_int
|
||||
#define si_ptr _sifields._rt._sigval.sival_ptr
|
||||
#define si_addr _sifields._sigfault._addr
|
||||
#ifdef __ARCH_SI_TRAPNO
|
||||
#define si_trapno _sifields._sigfault._trapno
|
||||
#endif
|
||||
#define si_band _sifields._sigpoll._band
|
||||
#define si_fd _sifields._sigpoll._fd
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#define __SI_MASK 0xffff0000u
|
||||
#define __SI_KILL (0 << 16)
|
||||
#define __SI_TIMER (1 << 16)
|
||||
#define __SI_POLL (2 << 16)
|
||||
#define __SI_FAULT (3 << 16)
|
||||
#define __SI_CHLD (4 << 16)
|
||||
#define __SI_RT (5 << 16)
|
||||
#define __SI_MESGQ (6 << 16)
|
||||
#define __SI_CODE(T,N) ((T) | ((N) & 0xffff))
|
||||
#else
|
||||
#define __SI_KILL 0
|
||||
#define __SI_TIMER 0
|
||||
#define __SI_POLL 0
|
||||
#define __SI_FAULT 0
|
||||
#define __SI_CHLD 0
|
||||
#define __SI_RT 0
|
||||
#define __SI_MESGQ 0
|
||||
#define __SI_CODE(T,N) (N)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* si_code values
|
||||
* Digital reserves positive values for kernel-generated signals.
|
||||
*/
|
||||
#define SI_USER 0 /* sent by kill, sigsend, raise */
|
||||
#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
|
||||
#define SI_QUEUE -1 /* sent by sigqueue */
|
||||
#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */
|
||||
#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3) /* sent by real time mesq state change */
|
||||
#define SI_ASYNCIO -4 /* sent by AIO completion */
|
||||
#define SI_SIGIO -5 /* sent by queued SIGIO */
|
||||
#define SI_TKILL -6 /* sent by tkill system call */
|
||||
#define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */
|
||||
|
||||
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
|
||||
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
|
||||
|
||||
/*
|
||||
* SIGILL si_codes
|
||||
*/
|
||||
#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */
|
||||
#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */
|
||||
#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */
|
||||
#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */
|
||||
#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */
|
||||
#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */
|
||||
#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */
|
||||
#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */
|
||||
#define NSIGILL 8
|
||||
|
||||
/*
|
||||
* SIGFPE si_codes
|
||||
*/
|
||||
#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */
|
||||
#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */
|
||||
#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */
|
||||
#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */
|
||||
#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */
|
||||
#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */
|
||||
#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */
|
||||
#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */
|
||||
#define NSIGFPE 8
|
||||
|
||||
/*
|
||||
* SIGSEGV si_codes
|
||||
*/
|
||||
#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */
|
||||
#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */
|
||||
#define NSIGSEGV 2
|
||||
|
||||
/*
|
||||
* SIGBUS si_codes
|
||||
*/
|
||||
#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */
|
||||
#define BUS_ADRERR (__SI_FAULT|2) /* non-existant physical address */
|
||||
#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */
|
||||
#define NSIGBUS 3
|
||||
|
||||
/*
|
||||
* SIGTRAP si_codes
|
||||
*/
|
||||
#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */
|
||||
#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */
|
||||
#define NSIGTRAP 2
|
||||
|
||||
/*
|
||||
* SIGCHLD si_codes
|
||||
*/
|
||||
#define CLD_EXITED (__SI_CHLD|1) /* child has exited */
|
||||
#define CLD_KILLED (__SI_CHLD|2) /* child was killed */
|
||||
#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */
|
||||
#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */
|
||||
#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */
|
||||
#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */
|
||||
#define NSIGCHLD 6
|
||||
|
||||
/*
|
||||
* SIGPOLL si_codes
|
||||
*/
|
||||
#define POLL_IN (__SI_POLL|1) /* data input available */
|
||||
#define POLL_OUT (__SI_POLL|2) /* output buffers available */
|
||||
#define POLL_MSG (__SI_POLL|3) /* input message available */
|
||||
#define POLL_ERR (__SI_POLL|4) /* i/o error */
|
||||
#define POLL_PRI (__SI_POLL|5) /* high priority input available */
|
||||
#define POLL_HUP (__SI_POLL|6) /* device disconnected */
|
||||
#define NSIGPOLL 6
|
||||
|
||||
/*
|
||||
* sigevent definitions
|
||||
*
|
||||
* It seems likely that SIGEV_THREAD will have to be handled from
|
||||
* userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
|
||||
* thread manager then catches and does the appropriate nonsense.
|
||||
* However, everything is written out here so as to not get lost.
|
||||
*/
|
||||
#define SIGEV_SIGNAL 0 /* notify via signal */
|
||||
#define SIGEV_NONE 1 /* other notification: meaningless */
|
||||
#define SIGEV_THREAD 2 /* deliver via thread creation */
|
||||
#define SIGEV_THREAD_ID 4 /* deliver to thread */
|
||||
|
||||
/*
|
||||
* This works because the alignment is ok on all current architectures
|
||||
* but we leave open this being overridden in the future
|
||||
*/
|
||||
#ifndef __ARCH_SIGEV_PREAMBLE_SIZE
|
||||
#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t))
|
||||
#endif
|
||||
|
||||
#define SIGEV_MAX_SIZE 64
|
||||
#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \
|
||||
/ sizeof(int))
|
||||
|
||||
typedef struct sigevent {
|
||||
sigval_t sigev_value;
|
||||
int sigev_signo;
|
||||
int sigev_notify;
|
||||
union {
|
||||
int _pad[SIGEV_PAD_SIZE];
|
||||
int _tid;
|
||||
|
||||
struct {
|
||||
void (*_function)(sigval_t);
|
||||
void *_attribute; /* really pthread_attr_t */
|
||||
} _sigev_thread;
|
||||
} _sigev_un;
|
||||
} sigevent_t;
|
||||
|
||||
#define sigev_notify_function _sigev_un._sigev_thread._function
|
||||
#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
|
||||
#define sigev_notify_thread_id _sigev_un._tid
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
struct siginfo;
|
||||
void do_schedule_next_timer(struct siginfo *info);
|
||||
|
||||
#ifndef HAVE_ARCH_COPY_SIGINFO
|
||||
|
||||
#include <linux/string.h>
|
||||
|
||||
static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
|
||||
{
|
||||
if (from->si_code < 0)
|
||||
memcpy(to, from, sizeof(*to));
|
||||
else
|
||||
/* _sigchld is currently the largest know union member */
|
||||
memcpy(to, from, __ARCH_SI_PREAMBLE_SIZE + sizeof(from->_sifields._sigchld));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
extern int copy_siginfo_to_user(struct siginfo __user *to, struct siginfo *from);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif
|
||||
28
include/asm-generic/signal.h
Normal file
28
include/asm-generic/signal.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef __ASM_GENERIC_SIGNAL_H
|
||||
#define __ASM_GENERIC_SIGNAL_H
|
||||
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#ifndef SIG_BLOCK
|
||||
#define SIG_BLOCK 0 /* for blocking signals */
|
||||
#endif
|
||||
#ifndef SIG_UNBLOCK
|
||||
#define SIG_UNBLOCK 1 /* for unblocking signals */
|
||||
#endif
|
||||
#ifndef SIG_SETMASK
|
||||
#define SIG_SETMASK 2 /* for setting the signal mask */
|
||||
#endif
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
typedef void __signalfn_t(int);
|
||||
typedef __signalfn_t __user *__sighandler_t;
|
||||
|
||||
typedef void __restorefn_t(void);
|
||||
typedef __restorefn_t __user *__sigrestore_t;
|
||||
|
||||
#define SIG_DFL ((__force __sighandler_t)0) /* default signal handling */
|
||||
#define SIG_IGN ((__force __sighandler_t)1) /* ignore signal */
|
||||
#define SIG_ERR ((__force __sighandler_t)-1) /* error return from signal */
|
||||
#endif
|
||||
|
||||
#endif /* __ASM_GENERIC_SIGNAL_H */
|
||||
51
include/asm-generic/statfs.h
Normal file
51
include/asm-generic/statfs.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#ifndef _GENERIC_STATFS_H
|
||||
#define _GENERIC_STATFS_H
|
||||
|
||||
#ifndef __KERNEL_STRICT_NAMES
|
||||
# include <linux/types.h>
|
||||
typedef __kernel_fsid_t fsid_t;
|
||||
#endif
|
||||
|
||||
struct statfs {
|
||||
__u32 f_type;
|
||||
__u32 f_bsize;
|
||||
__u32 f_blocks;
|
||||
__u32 f_bfree;
|
||||
__u32 f_bavail;
|
||||
__u32 f_files;
|
||||
__u32 f_ffree;
|
||||
__kernel_fsid_t f_fsid;
|
||||
__u32 f_namelen;
|
||||
__u32 f_frsize;
|
||||
__u32 f_spare[5];
|
||||
};
|
||||
|
||||
struct statfs64 {
|
||||
__u32 f_type;
|
||||
__u32 f_bsize;
|
||||
__u64 f_blocks;
|
||||
__u64 f_bfree;
|
||||
__u64 f_bavail;
|
||||
__u64 f_files;
|
||||
__u64 f_ffree;
|
||||
__kernel_fsid_t f_fsid;
|
||||
__u32 f_namelen;
|
||||
__u32 f_frsize;
|
||||
__u32 f_spare[5];
|
||||
};
|
||||
|
||||
struct compat_statfs64 {
|
||||
__u32 f_type;
|
||||
__u32 f_bsize;
|
||||
__u64 f_blocks;
|
||||
__u64 f_bfree;
|
||||
__u64 f_bavail;
|
||||
__u64 f_files;
|
||||
__u64 f_ffree;
|
||||
__kernel_fsid_t f_fsid;
|
||||
__u32 f_namelen;
|
||||
__u32 f_frsize;
|
||||
__u32 f_spare[5];
|
||||
};
|
||||
|
||||
#endif
|
||||
69
include/asm-generic/termios.h
Normal file
69
include/asm-generic/termios.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* termios.h: generic termios/termio user copying/translation
|
||||
*/
|
||||
|
||||
#ifndef _ASM_GENERIC_TERMIOS_H
|
||||
#define _ASM_GENERIC_TERMIOS_H
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#ifndef __ARCH_TERMIO_GETPUT
|
||||
|
||||
/*
|
||||
* Translate a "termio" structure into a "termios". Ugh.
|
||||
*/
|
||||
static inline int user_termio_to_kernel_termios(struct ktermios *termios,
|
||||
struct termio __user *termio)
|
||||
{
|
||||
unsigned short tmp;
|
||||
|
||||
if (get_user(tmp, &termio->c_iflag) < 0)
|
||||
goto fault;
|
||||
termios->c_iflag = (0xffff0000 & termios->c_iflag) | tmp;
|
||||
|
||||
if (get_user(tmp, &termio->c_oflag) < 0)
|
||||
goto fault;
|
||||
termios->c_oflag = (0xffff0000 & termios->c_oflag) | tmp;
|
||||
|
||||
if (get_user(tmp, &termio->c_cflag) < 0)
|
||||
goto fault;
|
||||
termios->c_cflag = (0xffff0000 & termios->c_cflag) | tmp;
|
||||
|
||||
if (get_user(tmp, &termio->c_lflag) < 0)
|
||||
goto fault;
|
||||
termios->c_lflag = (0xffff0000 & termios->c_lflag) | tmp;
|
||||
|
||||
if (get_user(termios->c_line, &termio->c_line) < 0)
|
||||
goto fault;
|
||||
|
||||
if (copy_from_user(termios->c_cc, termio->c_cc, NCC) != 0)
|
||||
goto fault;
|
||||
|
||||
return 0;
|
||||
|
||||
fault:
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate a "termios" structure into a "termio". Ugh.
|
||||
*/
|
||||
static inline int kernel_termios_to_user_termio(struct termio __user *termio,
|
||||
struct ktermios *termios)
|
||||
{
|
||||
if (put_user(termios->c_iflag, &termio->c_iflag) < 0 ||
|
||||
put_user(termios->c_oflag, &termio->c_oflag) < 0 ||
|
||||
put_user(termios->c_cflag, &termio->c_cflag) < 0 ||
|
||||
put_user(termios->c_lflag, &termio->c_lflag) < 0 ||
|
||||
put_user(termios->c_line, &termio->c_line) < 0 ||
|
||||
copy_to_user(termio->c_cc, termios->c_cc, NCC) != 0)
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
|
||||
#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
|
||||
|
||||
#endif /* __ARCH_TERMIO_GETPUT */
|
||||
|
||||
#endif /* _ASM_GENERIC_TERMIOS_H */
|
||||
148
include/asm-generic/tlb.h
Normal file
148
include/asm-generic/tlb.h
Normal file
@@ -0,0 +1,148 @@
|
||||
/* include/asm-generic/tlb.h
|
||||
*
|
||||
* Generic TLB shootdown code
|
||||
*
|
||||
* Copyright 2001 Red Hat, Inc.
|
||||
* Based on code from mm/memory.c Copyright Linus Torvalds and others.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
#ifndef _ASM_GENERIC__TLB_H
|
||||
#define _ASM_GENERIC__TLB_H
|
||||
|
||||
#include <linux/swap.h>
|
||||
#include <asm/pgalloc.h>
|
||||
#include <asm/tlbflush.h>
|
||||
|
||||
/*
|
||||
* For UP we don't need to worry about TLB flush
|
||||
* and page free order so much..
|
||||
*/
|
||||
#ifdef CONFIG_SMP
|
||||
#ifdef ARCH_FREE_PTR_NR
|
||||
#define FREE_PTR_NR ARCH_FREE_PTR_NR
|
||||
#else
|
||||
#define FREE_PTE_NR 506
|
||||
#endif
|
||||
#define tlb_fast_mode(tlb) ((tlb)->nr == ~0U)
|
||||
#else
|
||||
#define FREE_PTE_NR 1
|
||||
#define tlb_fast_mode(tlb) 1
|
||||
#endif
|
||||
|
||||
/* struct mmu_gather is an opaque type used by the mm code for passing around
|
||||
* any data needed by arch specific code for tlb_remove_page.
|
||||
*/
|
||||
struct mmu_gather {
|
||||
struct mm_struct *mm;
|
||||
unsigned int nr; /* set to ~0U means fast mode */
|
||||
unsigned int need_flush;/* Really unmapped some ptes? */
|
||||
unsigned int fullmm; /* non-zero means full mm flush */
|
||||
struct page * pages[FREE_PTE_NR];
|
||||
};
|
||||
|
||||
/* Users of the generic TLB shootdown code must declare this storage space. */
|
||||
DECLARE_PER_CPU(struct mmu_gather, mmu_gathers);
|
||||
|
||||
/* tlb_gather_mmu
|
||||
* Return a pointer to an initialized struct mmu_gather.
|
||||
*/
|
||||
static inline struct mmu_gather *
|
||||
tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush)
|
||||
{
|
||||
struct mmu_gather *tlb = &get_cpu_var(mmu_gathers);
|
||||
|
||||
tlb->mm = mm;
|
||||
|
||||
/* Use fast mode if only one CPU is online */
|
||||
tlb->nr = num_online_cpus() > 1 ? 0U : ~0U;
|
||||
|
||||
tlb->fullmm = full_mm_flush;
|
||||
|
||||
return tlb;
|
||||
}
|
||||
|
||||
static inline void
|
||||
tlb_flush_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
|
||||
{
|
||||
if (!tlb->need_flush)
|
||||
return;
|
||||
tlb->need_flush = 0;
|
||||
tlb_flush(tlb);
|
||||
if (!tlb_fast_mode(tlb)) {
|
||||
free_pages_and_swap_cache(tlb->pages, tlb->nr);
|
||||
tlb->nr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* tlb_finish_mmu
|
||||
* Called at the end of the shootdown operation to free up any resources
|
||||
* that were required.
|
||||
*/
|
||||
static inline void
|
||||
tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
|
||||
{
|
||||
tlb_flush_mmu(tlb, start, end);
|
||||
|
||||
/* keep the page table cache within bounds */
|
||||
check_pgt_cache();
|
||||
|
||||
put_cpu_var(mmu_gathers);
|
||||
}
|
||||
|
||||
/* tlb_remove_page
|
||||
* Must perform the equivalent to __free_pte(pte_get_and_clear(ptep)), while
|
||||
* handling the additional races in SMP caused by other CPUs caching valid
|
||||
* mappings in their TLBs.
|
||||
*/
|
||||
static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
|
||||
{
|
||||
tlb->need_flush = 1;
|
||||
if (tlb_fast_mode(tlb)) {
|
||||
free_page_and_swap_cache(page);
|
||||
return;
|
||||
}
|
||||
tlb->pages[tlb->nr++] = page;
|
||||
if (tlb->nr >= FREE_PTE_NR)
|
||||
tlb_flush_mmu(tlb, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* tlb_remove_tlb_entry - remember a pte unmapping for later tlb invalidation.
|
||||
*
|
||||
* Record the fact that pte's were really umapped in ->need_flush, so we can
|
||||
* later optimise away the tlb invalidate. This helps when userspace is
|
||||
* unmapping already-unmapped pages, which happens quite a lot.
|
||||
*/
|
||||
#define tlb_remove_tlb_entry(tlb, ptep, address) \
|
||||
do { \
|
||||
tlb->need_flush = 1; \
|
||||
__tlb_remove_tlb_entry(tlb, ptep, address); \
|
||||
} while (0)
|
||||
|
||||
#define pte_free_tlb(tlb, ptep) \
|
||||
do { \
|
||||
tlb->need_flush = 1; \
|
||||
__pte_free_tlb(tlb, ptep); \
|
||||
} while (0)
|
||||
|
||||
#ifndef __ARCH_HAS_4LEVEL_HACK
|
||||
#define pud_free_tlb(tlb, pudp) \
|
||||
do { \
|
||||
tlb->need_flush = 1; \
|
||||
__pud_free_tlb(tlb, pudp); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#define pmd_free_tlb(tlb, pmdp) \
|
||||
do { \
|
||||
tlb->need_flush = 1; \
|
||||
__pmd_free_tlb(tlb, pmdp); \
|
||||
} while (0)
|
||||
|
||||
#define tlb_migrate_finish(mm) do {} while (0)
|
||||
|
||||
#endif /* _ASM_GENERIC__TLB_H */
|
||||
55
include/asm-generic/topology.h
Normal file
55
include/asm-generic/topology.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* linux/include/asm-generic/topology.h
|
||||
*
|
||||
* Written by: Matthew Dobson, IBM Corporation
|
||||
*
|
||||
* Copyright (C) 2002, IBM Corp.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* Send feedback to <colpatch@us.ibm.com>
|
||||
*/
|
||||
#ifndef _ASM_GENERIC_TOPOLOGY_H
|
||||
#define _ASM_GENERIC_TOPOLOGY_H
|
||||
|
||||
/* Other architectures wishing to use this simple topology API should fill
|
||||
in the below functions as appropriate in their own <asm/topology.h> file. */
|
||||
#ifndef cpu_to_node
|
||||
#define cpu_to_node(cpu) (0)
|
||||
#endif
|
||||
#ifndef parent_node
|
||||
#define parent_node(node) (0)
|
||||
#endif
|
||||
#ifndef node_to_cpumask
|
||||
#define node_to_cpumask(node) (cpu_online_map)
|
||||
#endif
|
||||
#ifndef node_to_first_cpu
|
||||
#define node_to_first_cpu(node) (0)
|
||||
#endif
|
||||
#ifndef pcibus_to_node
|
||||
#define pcibus_to_node(node) (-1)
|
||||
#endif
|
||||
|
||||
#ifndef pcibus_to_cpumask
|
||||
#define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \
|
||||
CPU_MASK_ALL : \
|
||||
node_to_cpumask(pcibus_to_node(bus)) \
|
||||
)
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_GENERIC_TOPOLOGY_H */
|
||||
26
include/asm-generic/uaccess.h
Normal file
26
include/asm-generic/uaccess.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef _ASM_GENERIC_UACCESS_H_
|
||||
#define _ASM_GENERIC_UACCESS_H_
|
||||
|
||||
/*
|
||||
* This macro should be used instead of __get_user() when accessing
|
||||
* values at locations that are not known to be aligned.
|
||||
*/
|
||||
#define __get_user_unaligned(x, ptr) \
|
||||
({ \
|
||||
__typeof__ (*(ptr)) __x; \
|
||||
__copy_from_user(&__x, (ptr), sizeof(*(ptr))) ? -EFAULT : 0; \
|
||||
(x) = __x; \
|
||||
})
|
||||
|
||||
|
||||
/*
|
||||
* This macro should be used instead of __put_user() when accessing
|
||||
* values at locations that are not known to be aligned.
|
||||
*/
|
||||
#define __put_user_unaligned(x, ptr) \
|
||||
({ \
|
||||
__typeof__ (*(ptr)) __x = (x); \
|
||||
__copy_to_user((ptr), &__x, sizeof(*(ptr))) ? -EFAULT : 0; \
|
||||
})
|
||||
|
||||
#endif /* _ASM_GENERIC_UACCESS_H */
|
||||
122
include/asm-generic/unaligned.h
Normal file
122
include/asm-generic/unaligned.h
Normal file
@@ -0,0 +1,122 @@
|
||||
#ifndef _ASM_GENERIC_UNALIGNED_H_
|
||||
#define _ASM_GENERIC_UNALIGNED_H_
|
||||
|
||||
/*
|
||||
* For the benefit of those who are trying to port Linux to another
|
||||
* architecture, here are some C-language equivalents.
|
||||
*
|
||||
* This is based almost entirely upon Richard Henderson's
|
||||
* asm-alpha/unaligned.h implementation. Some comments were
|
||||
* taken from David Mosberger's asm-ia64/unaligned.h header.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/*
|
||||
* The main single-value unaligned transfer routines.
|
||||
*/
|
||||
#define get_unaligned(ptr) \
|
||||
__get_unaligned((ptr), sizeof(*(ptr)))
|
||||
#define put_unaligned(x,ptr) \
|
||||
__put_unaligned((__u64)(x), (ptr), sizeof(*(ptr)))
|
||||
|
||||
/*
|
||||
* This function doesn't actually exist. The idea is that when
|
||||
* someone uses the macros below with an unsupported size (datatype),
|
||||
* the linker will alert us to the problem via an unresolved reference
|
||||
* error.
|
||||
*/
|
||||
extern void bad_unaligned_access_length(void) __attribute__((noreturn));
|
||||
|
||||
struct __una_u64 { __u64 x __attribute__((packed)); };
|
||||
struct __una_u32 { __u32 x __attribute__((packed)); };
|
||||
struct __una_u16 { __u16 x __attribute__((packed)); };
|
||||
|
||||
/*
|
||||
* Elemental unaligned loads
|
||||
*/
|
||||
|
||||
static inline __u64 __uldq(const __u64 *addr)
|
||||
{
|
||||
const struct __una_u64 *ptr = (const struct __una_u64 *) addr;
|
||||
return ptr->x;
|
||||
}
|
||||
|
||||
static inline __u32 __uldl(const __u32 *addr)
|
||||
{
|
||||
const struct __una_u32 *ptr = (const struct __una_u32 *) addr;
|
||||
return ptr->x;
|
||||
}
|
||||
|
||||
static inline __u16 __uldw(const __u16 *addr)
|
||||
{
|
||||
const struct __una_u16 *ptr = (const struct __una_u16 *) addr;
|
||||
return ptr->x;
|
||||
}
|
||||
|
||||
/*
|
||||
* Elemental unaligned stores
|
||||
*/
|
||||
|
||||
static inline void __ustq(__u64 val, __u64 *addr)
|
||||
{
|
||||
struct __una_u64 *ptr = (struct __una_u64 *) addr;
|
||||
ptr->x = val;
|
||||
}
|
||||
|
||||
static inline void __ustl(__u32 val, __u32 *addr)
|
||||
{
|
||||
struct __una_u32 *ptr = (struct __una_u32 *) addr;
|
||||
ptr->x = val;
|
||||
}
|
||||
|
||||
static inline void __ustw(__u16 val, __u16 *addr)
|
||||
{
|
||||
struct __una_u16 *ptr = (struct __una_u16 *) addr;
|
||||
ptr->x = val;
|
||||
}
|
||||
|
||||
#define __get_unaligned(ptr, size) ({ \
|
||||
const void *__gu_p = ptr; \
|
||||
__u64 val; \
|
||||
switch (size) { \
|
||||
case 1: \
|
||||
val = *(const __u8 *)__gu_p; \
|
||||
break; \
|
||||
case 2: \
|
||||
val = __uldw(__gu_p); \
|
||||
break; \
|
||||
case 4: \
|
||||
val = __uldl(__gu_p); \
|
||||
break; \
|
||||
case 8: \
|
||||
val = __uldq(__gu_p); \
|
||||
break; \
|
||||
default: \
|
||||
bad_unaligned_access_length(); \
|
||||
}; \
|
||||
(__typeof__(*(ptr)))val; \
|
||||
})
|
||||
|
||||
#define __put_unaligned(val, ptr, size) \
|
||||
do { \
|
||||
void *__gu_p = ptr; \
|
||||
switch (size) { \
|
||||
case 1: \
|
||||
*(__u8 *)__gu_p = val; \
|
||||
break; \
|
||||
case 2: \
|
||||
__ustw(val, __gu_p); \
|
||||
break; \
|
||||
case 4: \
|
||||
__ustl(val, __gu_p); \
|
||||
break; \
|
||||
case 8: \
|
||||
__ustq(val, __gu_p); \
|
||||
break; \
|
||||
default: \
|
||||
bad_unaligned_access_length(); \
|
||||
}; \
|
||||
} while(0)
|
||||
|
||||
#endif /* _ASM_GENERIC_UNALIGNED_H */
|
||||
231
include/asm-generic/vmlinux.lds.h
Normal file
231
include/asm-generic/vmlinux.lds.h
Normal file
@@ -0,0 +1,231 @@
|
||||
#ifndef LOAD_OFFSET
|
||||
#define LOAD_OFFSET 0
|
||||
#endif
|
||||
|
||||
#ifndef VMLINUX_SYMBOL
|
||||
#define VMLINUX_SYMBOL(_sym_) _sym_
|
||||
#endif
|
||||
|
||||
/* Align . to a 8 byte boundary equals to maximum function alignment. */
|
||||
#define ALIGN_FUNCTION() . = ALIGN(8)
|
||||
|
||||
#define RODATA \
|
||||
. = ALIGN(4096); \
|
||||
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start_rodata) = .; \
|
||||
*(.rodata) *(.rodata.*) \
|
||||
*(__vermagic) /* Kernel version magic */ \
|
||||
} \
|
||||
\
|
||||
.rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
|
||||
*(.rodata1) \
|
||||
} \
|
||||
\
|
||||
/* PCI quirks */ \
|
||||
.pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
|
||||
*(.pci_fixup_early) \
|
||||
VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
|
||||
VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
|
||||
*(.pci_fixup_header) \
|
||||
VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
|
||||
VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
|
||||
*(.pci_fixup_final) \
|
||||
VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
|
||||
VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
|
||||
*(.pci_fixup_enable) \
|
||||
VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
|
||||
VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
|
||||
*(.pci_fixup_resume) \
|
||||
VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
|
||||
} \
|
||||
\
|
||||
/* RapidIO route ops */ \
|
||||
.rio_route : AT(ADDR(.rio_route) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start_rio_route_ops) = .; \
|
||||
*(.rio_route_ops) \
|
||||
VMLINUX_SYMBOL(__end_rio_route_ops) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: Normal symbols */ \
|
||||
__ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ksymtab) = .; \
|
||||
*(__ksymtab) \
|
||||
VMLINUX_SYMBOL(__stop___ksymtab) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-only symbols */ \
|
||||
__ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
|
||||
*(__ksymtab_gpl) \
|
||||
VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: Normal unused symbols */ \
|
||||
__ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
|
||||
*(__ksymtab_unused) \
|
||||
VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-only unused symbols */ \
|
||||
__ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
|
||||
*(__ksymtab_unused_gpl) \
|
||||
VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-future-only symbols */ \
|
||||
__ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
|
||||
*(__ksymtab_gpl_future) \
|
||||
VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: Normal symbols */ \
|
||||
__kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___kcrctab) = .; \
|
||||
*(__kcrctab) \
|
||||
VMLINUX_SYMBOL(__stop___kcrctab) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-only symbols */ \
|
||||
__kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
|
||||
*(__kcrctab_gpl) \
|
||||
VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: Normal unused symbols */ \
|
||||
__kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \
|
||||
*(__kcrctab_unused) \
|
||||
VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-only unused symbols */ \
|
||||
__kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
|
||||
*(__kcrctab_unused_gpl) \
|
||||
VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-future-only symbols */ \
|
||||
__kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
|
||||
*(__kcrctab_gpl_future) \
|
||||
VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: strings */ \
|
||||
__ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
|
||||
*(__ksymtab_strings) \
|
||||
} \
|
||||
\
|
||||
/* Built-in module parameters. */ \
|
||||
__param : AT(ADDR(__param) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___param) = .; \
|
||||
*(__param) \
|
||||
VMLINUX_SYMBOL(__stop___param) = .; \
|
||||
VMLINUX_SYMBOL(__end_rodata) = .; \
|
||||
} \
|
||||
\
|
||||
. = ALIGN(4096);
|
||||
|
||||
#define SECURITY_INIT \
|
||||
.security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__security_initcall_start) = .; \
|
||||
*(.security_initcall.init) \
|
||||
VMLINUX_SYMBOL(__security_initcall_end) = .; \
|
||||
}
|
||||
|
||||
/* sched.text is aling to function alignment to secure we have same
|
||||
* address even at second ld pass when generating System.map */
|
||||
#define SCHED_TEXT \
|
||||
ALIGN_FUNCTION(); \
|
||||
VMLINUX_SYMBOL(__sched_text_start) = .; \
|
||||
*(.sched.text) \
|
||||
VMLINUX_SYMBOL(__sched_text_end) = .;
|
||||
|
||||
/* spinlock.text is aling to function alignment to secure we have same
|
||||
* address even at second ld pass when generating System.map */
|
||||
#define LOCK_TEXT \
|
||||
ALIGN_FUNCTION(); \
|
||||
VMLINUX_SYMBOL(__lock_text_start) = .; \
|
||||
*(.spinlock.text) \
|
||||
VMLINUX_SYMBOL(__lock_text_end) = .;
|
||||
|
||||
#define KPROBES_TEXT \
|
||||
ALIGN_FUNCTION(); \
|
||||
VMLINUX_SYMBOL(__kprobes_text_start) = .; \
|
||||
*(.kprobes.text) \
|
||||
VMLINUX_SYMBOL(__kprobes_text_end) = .;
|
||||
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to
|
||||
the beginning of the section so we begin them at 0. */
|
||||
#define DWARF_DEBUG \
|
||||
/* DWARF 1 */ \
|
||||
.debug 0 : { *(.debug) } \
|
||||
.line 0 : { *(.line) } \
|
||||
/* GNU DWARF 1 extensions */ \
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) } \
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) } \
|
||||
/* DWARF 1.1 and DWARF 2 */ \
|
||||
.debug_aranges 0 : { *(.debug_aranges) } \
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) } \
|
||||
/* DWARF 2 */ \
|
||||
.debug_info 0 : { *(.debug_info \
|
||||
.gnu.linkonce.wi.*) } \
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) } \
|
||||
.debug_line 0 : { *(.debug_line) } \
|
||||
.debug_frame 0 : { *(.debug_frame) } \
|
||||
.debug_str 0 : { *(.debug_str) } \
|
||||
.debug_loc 0 : { *(.debug_loc) } \
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) } \
|
||||
/* SGI/MIPS DWARF 2 extensions */ \
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) } \
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) } \
|
||||
.debug_typenames 0 : { *(.debug_typenames) } \
|
||||
.debug_varnames 0 : { *(.debug_varnames) } \
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
#define STABS_DEBUG \
|
||||
.stab 0 : { *(.stab) } \
|
||||
.stabstr 0 : { *(.stabstr) } \
|
||||
.stab.excl 0 : { *(.stab.excl) } \
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) } \
|
||||
.stab.index 0 : { *(.stab.index) } \
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) } \
|
||||
.comment 0 : { *(.comment) }
|
||||
|
||||
#define BUG_TABLE \
|
||||
. = ALIGN(8); \
|
||||
__bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
|
||||
__start___bug_table = .; \
|
||||
*(__bug_table) \
|
||||
__stop___bug_table = .; \
|
||||
}
|
||||
|
||||
#define NOTES \
|
||||
.notes : { *(.note.*) } :note
|
||||
|
||||
#define INITCALLS \
|
||||
*(.initcall0.init) \
|
||||
*(.initcall0s.init) \
|
||||
*(.initcall1.init) \
|
||||
*(.initcall1s.init) \
|
||||
*(.initcall2.init) \
|
||||
*(.initcall2s.init) \
|
||||
*(.initcall3.init) \
|
||||
*(.initcall3s.init) \
|
||||
*(.initcall4.init) \
|
||||
*(.initcall4s.init) \
|
||||
*(.initcall5.init) \
|
||||
*(.initcall5s.init) \
|
||||
*(.initcallrootfs.init) \
|
||||
*(.initcall6.init) \
|
||||
*(.initcall6s.init) \
|
||||
*(.initcall7.init) \
|
||||
*(.initcall7s.init)
|
||||
|
||||
718
include/asm-generic/xor.h
Normal file
718
include/asm-generic/xor.h
Normal file
@@ -0,0 +1,718 @@
|
||||
/*
|
||||
* include/asm-generic/xor.h
|
||||
*
|
||||
* Generic optimized RAID-5 checksumming functions.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* (for example /usr/src/linux/COPYING); if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <asm/processor.h>
|
||||
|
||||
static void
|
||||
xor_8regs_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8;
|
||||
|
||||
do {
|
||||
p1[0] ^= p2[0];
|
||||
p1[1] ^= p2[1];
|
||||
p1[2] ^= p2[2];
|
||||
p1[3] ^= p2[3];
|
||||
p1[4] ^= p2[4];
|
||||
p1[5] ^= p2[5];
|
||||
p1[6] ^= p2[6];
|
||||
p1[7] ^= p2[7];
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
} while (--lines > 0);
|
||||
}
|
||||
|
||||
static void
|
||||
xor_8regs_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
|
||||
unsigned long *p3)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8;
|
||||
|
||||
do {
|
||||
p1[0] ^= p2[0] ^ p3[0];
|
||||
p1[1] ^= p2[1] ^ p3[1];
|
||||
p1[2] ^= p2[2] ^ p3[2];
|
||||
p1[3] ^= p2[3] ^ p3[3];
|
||||
p1[4] ^= p2[4] ^ p3[4];
|
||||
p1[5] ^= p2[5] ^ p3[5];
|
||||
p1[6] ^= p2[6] ^ p3[6];
|
||||
p1[7] ^= p2[7] ^ p3[7];
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
p3 += 8;
|
||||
} while (--lines > 0);
|
||||
}
|
||||
|
||||
static void
|
||||
xor_8regs_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
|
||||
unsigned long *p3, unsigned long *p4)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8;
|
||||
|
||||
do {
|
||||
p1[0] ^= p2[0] ^ p3[0] ^ p4[0];
|
||||
p1[1] ^= p2[1] ^ p3[1] ^ p4[1];
|
||||
p1[2] ^= p2[2] ^ p3[2] ^ p4[2];
|
||||
p1[3] ^= p2[3] ^ p3[3] ^ p4[3];
|
||||
p1[4] ^= p2[4] ^ p3[4] ^ p4[4];
|
||||
p1[5] ^= p2[5] ^ p3[5] ^ p4[5];
|
||||
p1[6] ^= p2[6] ^ p3[6] ^ p4[6];
|
||||
p1[7] ^= p2[7] ^ p3[7] ^ p4[7];
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
p3 += 8;
|
||||
p4 += 8;
|
||||
} while (--lines > 0);
|
||||
}
|
||||
|
||||
static void
|
||||
xor_8regs_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
|
||||
unsigned long *p3, unsigned long *p4, unsigned long *p5)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8;
|
||||
|
||||
do {
|
||||
p1[0] ^= p2[0] ^ p3[0] ^ p4[0] ^ p5[0];
|
||||
p1[1] ^= p2[1] ^ p3[1] ^ p4[1] ^ p5[1];
|
||||
p1[2] ^= p2[2] ^ p3[2] ^ p4[2] ^ p5[2];
|
||||
p1[3] ^= p2[3] ^ p3[3] ^ p4[3] ^ p5[3];
|
||||
p1[4] ^= p2[4] ^ p3[4] ^ p4[4] ^ p5[4];
|
||||
p1[5] ^= p2[5] ^ p3[5] ^ p4[5] ^ p5[5];
|
||||
p1[6] ^= p2[6] ^ p3[6] ^ p4[6] ^ p5[6];
|
||||
p1[7] ^= p2[7] ^ p3[7] ^ p4[7] ^ p5[7];
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
p3 += 8;
|
||||
p4 += 8;
|
||||
p5 += 8;
|
||||
} while (--lines > 0);
|
||||
}
|
||||
|
||||
static void
|
||||
xor_32regs_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8;
|
||||
|
||||
do {
|
||||
register long d0, d1, d2, d3, d4, d5, d6, d7;
|
||||
d0 = p1[0]; /* Pull the stuff into registers */
|
||||
d1 = p1[1]; /* ... in bursts, if possible. */
|
||||
d2 = p1[2];
|
||||
d3 = p1[3];
|
||||
d4 = p1[4];
|
||||
d5 = p1[5];
|
||||
d6 = p1[6];
|
||||
d7 = p1[7];
|
||||
d0 ^= p2[0];
|
||||
d1 ^= p2[1];
|
||||
d2 ^= p2[2];
|
||||
d3 ^= p2[3];
|
||||
d4 ^= p2[4];
|
||||
d5 ^= p2[5];
|
||||
d6 ^= p2[6];
|
||||
d7 ^= p2[7];
|
||||
p1[0] = d0; /* Store the result (in bursts) */
|
||||
p1[1] = d1;
|
||||
p1[2] = d2;
|
||||
p1[3] = d3;
|
||||
p1[4] = d4;
|
||||
p1[5] = d5;
|
||||
p1[6] = d6;
|
||||
p1[7] = d7;
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
} while (--lines > 0);
|
||||
}
|
||||
|
||||
static void
|
||||
xor_32regs_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
|
||||
unsigned long *p3)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8;
|
||||
|
||||
do {
|
||||
register long d0, d1, d2, d3, d4, d5, d6, d7;
|
||||
d0 = p1[0]; /* Pull the stuff into registers */
|
||||
d1 = p1[1]; /* ... in bursts, if possible. */
|
||||
d2 = p1[2];
|
||||
d3 = p1[3];
|
||||
d4 = p1[4];
|
||||
d5 = p1[5];
|
||||
d6 = p1[6];
|
||||
d7 = p1[7];
|
||||
d0 ^= p2[0];
|
||||
d1 ^= p2[1];
|
||||
d2 ^= p2[2];
|
||||
d3 ^= p2[3];
|
||||
d4 ^= p2[4];
|
||||
d5 ^= p2[5];
|
||||
d6 ^= p2[6];
|
||||
d7 ^= p2[7];
|
||||
d0 ^= p3[0];
|
||||
d1 ^= p3[1];
|
||||
d2 ^= p3[2];
|
||||
d3 ^= p3[3];
|
||||
d4 ^= p3[4];
|
||||
d5 ^= p3[5];
|
||||
d6 ^= p3[6];
|
||||
d7 ^= p3[7];
|
||||
p1[0] = d0; /* Store the result (in bursts) */
|
||||
p1[1] = d1;
|
||||
p1[2] = d2;
|
||||
p1[3] = d3;
|
||||
p1[4] = d4;
|
||||
p1[5] = d5;
|
||||
p1[6] = d6;
|
||||
p1[7] = d7;
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
p3 += 8;
|
||||
} while (--lines > 0);
|
||||
}
|
||||
|
||||
static void
|
||||
xor_32regs_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
|
||||
unsigned long *p3, unsigned long *p4)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8;
|
||||
|
||||
do {
|
||||
register long d0, d1, d2, d3, d4, d5, d6, d7;
|
||||
d0 = p1[0]; /* Pull the stuff into registers */
|
||||
d1 = p1[1]; /* ... in bursts, if possible. */
|
||||
d2 = p1[2];
|
||||
d3 = p1[3];
|
||||
d4 = p1[4];
|
||||
d5 = p1[5];
|
||||
d6 = p1[6];
|
||||
d7 = p1[7];
|
||||
d0 ^= p2[0];
|
||||
d1 ^= p2[1];
|
||||
d2 ^= p2[2];
|
||||
d3 ^= p2[3];
|
||||
d4 ^= p2[4];
|
||||
d5 ^= p2[5];
|
||||
d6 ^= p2[6];
|
||||
d7 ^= p2[7];
|
||||
d0 ^= p3[0];
|
||||
d1 ^= p3[1];
|
||||
d2 ^= p3[2];
|
||||
d3 ^= p3[3];
|
||||
d4 ^= p3[4];
|
||||
d5 ^= p3[5];
|
||||
d6 ^= p3[6];
|
||||
d7 ^= p3[7];
|
||||
d0 ^= p4[0];
|
||||
d1 ^= p4[1];
|
||||
d2 ^= p4[2];
|
||||
d3 ^= p4[3];
|
||||
d4 ^= p4[4];
|
||||
d5 ^= p4[5];
|
||||
d6 ^= p4[6];
|
||||
d7 ^= p4[7];
|
||||
p1[0] = d0; /* Store the result (in bursts) */
|
||||
p1[1] = d1;
|
||||
p1[2] = d2;
|
||||
p1[3] = d3;
|
||||
p1[4] = d4;
|
||||
p1[5] = d5;
|
||||
p1[6] = d6;
|
||||
p1[7] = d7;
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
p3 += 8;
|
||||
p4 += 8;
|
||||
} while (--lines > 0);
|
||||
}
|
||||
|
||||
static void
|
||||
xor_32regs_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
|
||||
unsigned long *p3, unsigned long *p4, unsigned long *p5)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8;
|
||||
|
||||
do {
|
||||
register long d0, d1, d2, d3, d4, d5, d6, d7;
|
||||
d0 = p1[0]; /* Pull the stuff into registers */
|
||||
d1 = p1[1]; /* ... in bursts, if possible. */
|
||||
d2 = p1[2];
|
||||
d3 = p1[3];
|
||||
d4 = p1[4];
|
||||
d5 = p1[5];
|
||||
d6 = p1[6];
|
||||
d7 = p1[7];
|
||||
d0 ^= p2[0];
|
||||
d1 ^= p2[1];
|
||||
d2 ^= p2[2];
|
||||
d3 ^= p2[3];
|
||||
d4 ^= p2[4];
|
||||
d5 ^= p2[5];
|
||||
d6 ^= p2[6];
|
||||
d7 ^= p2[7];
|
||||
d0 ^= p3[0];
|
||||
d1 ^= p3[1];
|
||||
d2 ^= p3[2];
|
||||
d3 ^= p3[3];
|
||||
d4 ^= p3[4];
|
||||
d5 ^= p3[5];
|
||||
d6 ^= p3[6];
|
||||
d7 ^= p3[7];
|
||||
d0 ^= p4[0];
|
||||
d1 ^= p4[1];
|
||||
d2 ^= p4[2];
|
||||
d3 ^= p4[3];
|
||||
d4 ^= p4[4];
|
||||
d5 ^= p4[5];
|
||||
d6 ^= p4[6];
|
||||
d7 ^= p4[7];
|
||||
d0 ^= p5[0];
|
||||
d1 ^= p5[1];
|
||||
d2 ^= p5[2];
|
||||
d3 ^= p5[3];
|
||||
d4 ^= p5[4];
|
||||
d5 ^= p5[5];
|
||||
d6 ^= p5[6];
|
||||
d7 ^= p5[7];
|
||||
p1[0] = d0; /* Store the result (in bursts) */
|
||||
p1[1] = d1;
|
||||
p1[2] = d2;
|
||||
p1[3] = d3;
|
||||
p1[4] = d4;
|
||||
p1[5] = d5;
|
||||
p1[6] = d6;
|
||||
p1[7] = d7;
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
p3 += 8;
|
||||
p4 += 8;
|
||||
p5 += 8;
|
||||
} while (--lines > 0);
|
||||
}
|
||||
|
||||
static void
|
||||
xor_8regs_p_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8 - 1;
|
||||
prefetchw(p1);
|
||||
prefetch(p2);
|
||||
|
||||
do {
|
||||
prefetchw(p1+8);
|
||||
prefetch(p2+8);
|
||||
once_more:
|
||||
p1[0] ^= p2[0];
|
||||
p1[1] ^= p2[1];
|
||||
p1[2] ^= p2[2];
|
||||
p1[3] ^= p2[3];
|
||||
p1[4] ^= p2[4];
|
||||
p1[5] ^= p2[5];
|
||||
p1[6] ^= p2[6];
|
||||
p1[7] ^= p2[7];
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
} while (--lines > 0);
|
||||
if (lines == 0)
|
||||
goto once_more;
|
||||
}
|
||||
|
||||
static void
|
||||
xor_8regs_p_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
|
||||
unsigned long *p3)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8 - 1;
|
||||
prefetchw(p1);
|
||||
prefetch(p2);
|
||||
prefetch(p3);
|
||||
|
||||
do {
|
||||
prefetchw(p1+8);
|
||||
prefetch(p2+8);
|
||||
prefetch(p3+8);
|
||||
once_more:
|
||||
p1[0] ^= p2[0] ^ p3[0];
|
||||
p1[1] ^= p2[1] ^ p3[1];
|
||||
p1[2] ^= p2[2] ^ p3[2];
|
||||
p1[3] ^= p2[3] ^ p3[3];
|
||||
p1[4] ^= p2[4] ^ p3[4];
|
||||
p1[5] ^= p2[5] ^ p3[5];
|
||||
p1[6] ^= p2[6] ^ p3[6];
|
||||
p1[7] ^= p2[7] ^ p3[7];
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
p3 += 8;
|
||||
} while (--lines > 0);
|
||||
if (lines == 0)
|
||||
goto once_more;
|
||||
}
|
||||
|
||||
static void
|
||||
xor_8regs_p_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
|
||||
unsigned long *p3, unsigned long *p4)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8 - 1;
|
||||
|
||||
prefetchw(p1);
|
||||
prefetch(p2);
|
||||
prefetch(p3);
|
||||
prefetch(p4);
|
||||
|
||||
do {
|
||||
prefetchw(p1+8);
|
||||
prefetch(p2+8);
|
||||
prefetch(p3+8);
|
||||
prefetch(p4+8);
|
||||
once_more:
|
||||
p1[0] ^= p2[0] ^ p3[0] ^ p4[0];
|
||||
p1[1] ^= p2[1] ^ p3[1] ^ p4[1];
|
||||
p1[2] ^= p2[2] ^ p3[2] ^ p4[2];
|
||||
p1[3] ^= p2[3] ^ p3[3] ^ p4[3];
|
||||
p1[4] ^= p2[4] ^ p3[4] ^ p4[4];
|
||||
p1[5] ^= p2[5] ^ p3[5] ^ p4[5];
|
||||
p1[6] ^= p2[6] ^ p3[6] ^ p4[6];
|
||||
p1[7] ^= p2[7] ^ p3[7] ^ p4[7];
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
p3 += 8;
|
||||
p4 += 8;
|
||||
} while (--lines > 0);
|
||||
if (lines == 0)
|
||||
goto once_more;
|
||||
}
|
||||
|
||||
static void
|
||||
xor_8regs_p_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
|
||||
unsigned long *p3, unsigned long *p4, unsigned long *p5)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8 - 1;
|
||||
|
||||
prefetchw(p1);
|
||||
prefetch(p2);
|
||||
prefetch(p3);
|
||||
prefetch(p4);
|
||||
prefetch(p5);
|
||||
|
||||
do {
|
||||
prefetchw(p1+8);
|
||||
prefetch(p2+8);
|
||||
prefetch(p3+8);
|
||||
prefetch(p4+8);
|
||||
prefetch(p5+8);
|
||||
once_more:
|
||||
p1[0] ^= p2[0] ^ p3[0] ^ p4[0] ^ p5[0];
|
||||
p1[1] ^= p2[1] ^ p3[1] ^ p4[1] ^ p5[1];
|
||||
p1[2] ^= p2[2] ^ p3[2] ^ p4[2] ^ p5[2];
|
||||
p1[3] ^= p2[3] ^ p3[3] ^ p4[3] ^ p5[3];
|
||||
p1[4] ^= p2[4] ^ p3[4] ^ p4[4] ^ p5[4];
|
||||
p1[5] ^= p2[5] ^ p3[5] ^ p4[5] ^ p5[5];
|
||||
p1[6] ^= p2[6] ^ p3[6] ^ p4[6] ^ p5[6];
|
||||
p1[7] ^= p2[7] ^ p3[7] ^ p4[7] ^ p5[7];
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
p3 += 8;
|
||||
p4 += 8;
|
||||
p5 += 8;
|
||||
} while (--lines > 0);
|
||||
if (lines == 0)
|
||||
goto once_more;
|
||||
}
|
||||
|
||||
static void
|
||||
xor_32regs_p_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8 - 1;
|
||||
|
||||
prefetchw(p1);
|
||||
prefetch(p2);
|
||||
|
||||
do {
|
||||
register long d0, d1, d2, d3, d4, d5, d6, d7;
|
||||
|
||||
prefetchw(p1+8);
|
||||
prefetch(p2+8);
|
||||
once_more:
|
||||
d0 = p1[0]; /* Pull the stuff into registers */
|
||||
d1 = p1[1]; /* ... in bursts, if possible. */
|
||||
d2 = p1[2];
|
||||
d3 = p1[3];
|
||||
d4 = p1[4];
|
||||
d5 = p1[5];
|
||||
d6 = p1[6];
|
||||
d7 = p1[7];
|
||||
d0 ^= p2[0];
|
||||
d1 ^= p2[1];
|
||||
d2 ^= p2[2];
|
||||
d3 ^= p2[3];
|
||||
d4 ^= p2[4];
|
||||
d5 ^= p2[5];
|
||||
d6 ^= p2[6];
|
||||
d7 ^= p2[7];
|
||||
p1[0] = d0; /* Store the result (in bursts) */
|
||||
p1[1] = d1;
|
||||
p1[2] = d2;
|
||||
p1[3] = d3;
|
||||
p1[4] = d4;
|
||||
p1[5] = d5;
|
||||
p1[6] = d6;
|
||||
p1[7] = d7;
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
} while (--lines > 0);
|
||||
if (lines == 0)
|
||||
goto once_more;
|
||||
}
|
||||
|
||||
static void
|
||||
xor_32regs_p_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
|
||||
unsigned long *p3)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8 - 1;
|
||||
|
||||
prefetchw(p1);
|
||||
prefetch(p2);
|
||||
prefetch(p3);
|
||||
|
||||
do {
|
||||
register long d0, d1, d2, d3, d4, d5, d6, d7;
|
||||
|
||||
prefetchw(p1+8);
|
||||
prefetch(p2+8);
|
||||
prefetch(p3+8);
|
||||
once_more:
|
||||
d0 = p1[0]; /* Pull the stuff into registers */
|
||||
d1 = p1[1]; /* ... in bursts, if possible. */
|
||||
d2 = p1[2];
|
||||
d3 = p1[3];
|
||||
d4 = p1[4];
|
||||
d5 = p1[5];
|
||||
d6 = p1[6];
|
||||
d7 = p1[7];
|
||||
d0 ^= p2[0];
|
||||
d1 ^= p2[1];
|
||||
d2 ^= p2[2];
|
||||
d3 ^= p2[3];
|
||||
d4 ^= p2[4];
|
||||
d5 ^= p2[5];
|
||||
d6 ^= p2[6];
|
||||
d7 ^= p2[7];
|
||||
d0 ^= p3[0];
|
||||
d1 ^= p3[1];
|
||||
d2 ^= p3[2];
|
||||
d3 ^= p3[3];
|
||||
d4 ^= p3[4];
|
||||
d5 ^= p3[5];
|
||||
d6 ^= p3[6];
|
||||
d7 ^= p3[7];
|
||||
p1[0] = d0; /* Store the result (in bursts) */
|
||||
p1[1] = d1;
|
||||
p1[2] = d2;
|
||||
p1[3] = d3;
|
||||
p1[4] = d4;
|
||||
p1[5] = d5;
|
||||
p1[6] = d6;
|
||||
p1[7] = d7;
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
p3 += 8;
|
||||
} while (--lines > 0);
|
||||
if (lines == 0)
|
||||
goto once_more;
|
||||
}
|
||||
|
||||
static void
|
||||
xor_32regs_p_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
|
||||
unsigned long *p3, unsigned long *p4)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8 - 1;
|
||||
|
||||
prefetchw(p1);
|
||||
prefetch(p2);
|
||||
prefetch(p3);
|
||||
prefetch(p4);
|
||||
|
||||
do {
|
||||
register long d0, d1, d2, d3, d4, d5, d6, d7;
|
||||
|
||||
prefetchw(p1+8);
|
||||
prefetch(p2+8);
|
||||
prefetch(p3+8);
|
||||
prefetch(p4+8);
|
||||
once_more:
|
||||
d0 = p1[0]; /* Pull the stuff into registers */
|
||||
d1 = p1[1]; /* ... in bursts, if possible. */
|
||||
d2 = p1[2];
|
||||
d3 = p1[3];
|
||||
d4 = p1[4];
|
||||
d5 = p1[5];
|
||||
d6 = p1[6];
|
||||
d7 = p1[7];
|
||||
d0 ^= p2[0];
|
||||
d1 ^= p2[1];
|
||||
d2 ^= p2[2];
|
||||
d3 ^= p2[3];
|
||||
d4 ^= p2[4];
|
||||
d5 ^= p2[5];
|
||||
d6 ^= p2[6];
|
||||
d7 ^= p2[7];
|
||||
d0 ^= p3[0];
|
||||
d1 ^= p3[1];
|
||||
d2 ^= p3[2];
|
||||
d3 ^= p3[3];
|
||||
d4 ^= p3[4];
|
||||
d5 ^= p3[5];
|
||||
d6 ^= p3[6];
|
||||
d7 ^= p3[7];
|
||||
d0 ^= p4[0];
|
||||
d1 ^= p4[1];
|
||||
d2 ^= p4[2];
|
||||
d3 ^= p4[3];
|
||||
d4 ^= p4[4];
|
||||
d5 ^= p4[5];
|
||||
d6 ^= p4[6];
|
||||
d7 ^= p4[7];
|
||||
p1[0] = d0; /* Store the result (in bursts) */
|
||||
p1[1] = d1;
|
||||
p1[2] = d2;
|
||||
p1[3] = d3;
|
||||
p1[4] = d4;
|
||||
p1[5] = d5;
|
||||
p1[6] = d6;
|
||||
p1[7] = d7;
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
p3 += 8;
|
||||
p4 += 8;
|
||||
} while (--lines > 0);
|
||||
if (lines == 0)
|
||||
goto once_more;
|
||||
}
|
||||
|
||||
static void
|
||||
xor_32regs_p_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
|
||||
unsigned long *p3, unsigned long *p4, unsigned long *p5)
|
||||
{
|
||||
long lines = bytes / (sizeof (long)) / 8 - 1;
|
||||
|
||||
prefetchw(p1);
|
||||
prefetch(p2);
|
||||
prefetch(p3);
|
||||
prefetch(p4);
|
||||
prefetch(p5);
|
||||
|
||||
do {
|
||||
register long d0, d1, d2, d3, d4, d5, d6, d7;
|
||||
|
||||
prefetchw(p1+8);
|
||||
prefetch(p2+8);
|
||||
prefetch(p3+8);
|
||||
prefetch(p4+8);
|
||||
prefetch(p5+8);
|
||||
once_more:
|
||||
d0 = p1[0]; /* Pull the stuff into registers */
|
||||
d1 = p1[1]; /* ... in bursts, if possible. */
|
||||
d2 = p1[2];
|
||||
d3 = p1[3];
|
||||
d4 = p1[4];
|
||||
d5 = p1[5];
|
||||
d6 = p1[6];
|
||||
d7 = p1[7];
|
||||
d0 ^= p2[0];
|
||||
d1 ^= p2[1];
|
||||
d2 ^= p2[2];
|
||||
d3 ^= p2[3];
|
||||
d4 ^= p2[4];
|
||||
d5 ^= p2[5];
|
||||
d6 ^= p2[6];
|
||||
d7 ^= p2[7];
|
||||
d0 ^= p3[0];
|
||||
d1 ^= p3[1];
|
||||
d2 ^= p3[2];
|
||||
d3 ^= p3[3];
|
||||
d4 ^= p3[4];
|
||||
d5 ^= p3[5];
|
||||
d6 ^= p3[6];
|
||||
d7 ^= p3[7];
|
||||
d0 ^= p4[0];
|
||||
d1 ^= p4[1];
|
||||
d2 ^= p4[2];
|
||||
d3 ^= p4[3];
|
||||
d4 ^= p4[4];
|
||||
d5 ^= p4[5];
|
||||
d6 ^= p4[6];
|
||||
d7 ^= p4[7];
|
||||
d0 ^= p5[0];
|
||||
d1 ^= p5[1];
|
||||
d2 ^= p5[2];
|
||||
d3 ^= p5[3];
|
||||
d4 ^= p5[4];
|
||||
d5 ^= p5[5];
|
||||
d6 ^= p5[6];
|
||||
d7 ^= p5[7];
|
||||
p1[0] = d0; /* Store the result (in bursts) */
|
||||
p1[1] = d1;
|
||||
p1[2] = d2;
|
||||
p1[3] = d3;
|
||||
p1[4] = d4;
|
||||
p1[5] = d5;
|
||||
p1[6] = d6;
|
||||
p1[7] = d7;
|
||||
p1 += 8;
|
||||
p2 += 8;
|
||||
p3 += 8;
|
||||
p4 += 8;
|
||||
p5 += 8;
|
||||
} while (--lines > 0);
|
||||
if (lines == 0)
|
||||
goto once_more;
|
||||
}
|
||||
|
||||
static struct xor_block_template xor_block_8regs = {
|
||||
.name = "8regs",
|
||||
.do_2 = xor_8regs_2,
|
||||
.do_3 = xor_8regs_3,
|
||||
.do_4 = xor_8regs_4,
|
||||
.do_5 = xor_8regs_5,
|
||||
};
|
||||
|
||||
static struct xor_block_template xor_block_32regs = {
|
||||
.name = "32regs",
|
||||
.do_2 = xor_32regs_2,
|
||||
.do_3 = xor_32regs_3,
|
||||
.do_4 = xor_32regs_4,
|
||||
.do_5 = xor_32regs_5,
|
||||
};
|
||||
|
||||
static struct xor_block_template xor_block_8regs_p = {
|
||||
.name = "8regs_prefetch",
|
||||
.do_2 = xor_8regs_p_2,
|
||||
.do_3 = xor_8regs_p_3,
|
||||
.do_4 = xor_8regs_p_4,
|
||||
.do_5 = xor_8regs_p_5,
|
||||
};
|
||||
|
||||
static struct xor_block_template xor_block_32regs_p = {
|
||||
.name = "32regs_prefetch",
|
||||
.do_2 = xor_32regs_p_2,
|
||||
.do_3 = xor_32regs_p_3,
|
||||
.do_4 = xor_32regs_p_4,
|
||||
.do_5 = xor_32regs_p_5,
|
||||
};
|
||||
|
||||
#define XOR_TRY_TEMPLATES \
|
||||
do { \
|
||||
xor_speed(&xor_block_8regs); \
|
||||
xor_speed(&xor_block_8regs_p); \
|
||||
xor_speed(&xor_block_32regs); \
|
||||
xor_speed(&xor_block_32regs_p); \
|
||||
} while (0)
|
||||
Reference in New Issue
Block a user