Skip to content

Commit

Permalink
Merge branch 'fixes-for-linus' of git://git.monstr.eu/linux-2.6-micro…
Browse files Browse the repository at this point in the history
…blaze

* 'fixes-for-linus' of git://git.monstr.eu/linux-2.6-microblaze:
  microblaze: Fix cast warning for init.c
  microblaze: Wire up new syscalls
  microblaze: use generic syscalls.h
  microblaze: clean up signal handling
  microblaze: convert all simple headers to use asm-generic
  microblaze: use the generic lib/checksum.c
  microblaze: fall back on generic header files for the ABI
  • Loading branch information
Linus Torvalds committed Jul 6, 2009
2 parents 9861df1 + db6e3f9 commit f560902
Show file tree
Hide file tree
Showing 49 changed files with 120 additions and 1,803 deletions.
3 changes: 3 additions & 0 deletions arch/microblaze/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ config GENERIC_HARDIRQS_NO__DO_IRQ
config GENERIC_GPIO
def_bool y

config GENERIC_CSUM
def_bool y

config PCI
def_bool n

Expand Down
101 changes: 1 addition & 100 deletions arch/microblaze/include/asm/atomic.h
Original file line number Diff line number Diff line change
@@ -1,95 +1,7 @@
/*
* Copyright (C) 2006 Atmark Techno, Inc.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/

#ifndef _ASM_MICROBLAZE_ATOMIC_H
#define _ASM_MICROBLAZE_ATOMIC_H

#include <linux/types.h>
#include <linux/compiler.h> /* likely */
#include <asm/system.h> /* local_irq_XXX and friends */

#define ATOMIC_INIT(i) { (i) }
#define atomic_read(v) ((v)->counter)
#define atomic_set(v, i) (((v)->counter) = (i))

#define atomic_inc(v) (atomic_add_return(1, (v)))
#define atomic_dec(v) (atomic_sub_return(1, (v)))

#define atomic_add(i, v) (atomic_add_return(i, (v)))
#define atomic_sub(i, v) (atomic_sub_return(i, (v)))

#define atomic_inc_return(v) (atomic_add_return(1, (v)))
#define atomic_dec_return(v) (atomic_sub_return(1, (v)))

#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)

#define atomic_inc_not_zero(v) (atomic_add_unless((v), 1, 0))

#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)

static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
{
int ret;
unsigned long flags;

local_irq_save(flags);
ret = v->counter;
if (likely(ret == old))
v->counter = new;
local_irq_restore(flags);

return ret;
}

static inline int atomic_add_unless(atomic_t *v, int a, int u)
{
int c, old;

c = atomic_read(v);
while (c != u && (old = atomic_cmpxchg((v), c, c + a)) != c)
c = old;
return c != u;
}

static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
{
unsigned long flags;

local_irq_save(flags);
*addr &= ~mask;
local_irq_restore(flags);
}

/**
* atomic_add_return - add and return
* @i: integer value to add
* @v: pointer of type atomic_t
*
* Atomically adds @i to @v and returns @i + @v
*/
static inline int atomic_add_return(int i, atomic_t *v)
{
unsigned long flags;
int val;

local_irq_save(flags);
val = v->counter;
v->counter = val += i;
local_irq_restore(flags);

return val;
}

static inline int atomic_sub_return(int i, atomic_t *v)
{
return atomic_add_return(-i, v);
}
#include <asm-generic/atomic.h>

/*
* Atomically test *v and decrement if it is greater than 0.
Expand All @@ -109,15 +21,4 @@ static inline int atomic_dec_if_positive(atomic_t *v)
return res;
}

#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
#define atomic_xchg(v, new) (xchg(&((v)->counter), new))

/* Atomic operations are already serializing */
#define smp_mb__before_atomic_dec() barrier()
#define smp_mb__after_atomic_dec() barrier()
#define smp_mb__before_atomic_inc() barrier()
#define smp_mb__after_atomic_inc() barrier()

#include <asm-generic/atomic-long.h>

#endif /* _ASM_MICROBLAZE_ATOMIC_H */
26 changes: 0 additions & 26 deletions arch/microblaze/include/asm/bitops.h
Original file line number Diff line number Diff line change
@@ -1,27 +1 @@
/*
* Copyright (C) 2006 Atmark Techno, Inc.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/

#ifndef _ASM_MICROBLAZE_BITOPS_H
#define _ASM_MICROBLAZE_BITOPS_H

/*
* Copyright 1992, Linus Torvalds.
*/

#include <asm/byteorder.h> /* swab32 */
#include <asm/system.h> /* save_flags */

/*
* clear_bit() doesn't provide any barrier for the compiler.
*/
#define smp_mb__before_clear_bit() barrier()
#define smp_mb__after_clear_bit() barrier()
#include <asm-generic/bitops.h>
#include <asm-generic/bitops/__fls.h>

#endif /* _ASM_MICROBLAZE_BITOPS_H */
14 changes: 0 additions & 14 deletions arch/microblaze/include/asm/bug.h
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
/*
* Copyright (C) 2006 Atmark Techno, Inc.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/

#ifndef _ASM_MICROBLAZE_BUG_H
#define _ASM_MICROBLAZE_BUG_H

#include <linux/kernel.h>
#include <asm-generic/bug.h>

#endif /* _ASM_MICROBLAZE_BUG_H */
18 changes: 1 addition & 17 deletions arch/microblaze/include/asm/bugs.h
Original file line number Diff line number Diff line change
@@ -1,17 +1 @@
/*
* Copyright (C) 2006 Atmark Techno, Inc.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/

#ifndef _ASM_MICROBLAZE_BUGS_H
#define _ASM_MICROBLAZE_BUGS_H

static inline void check_bugs(void)
{
/* nothing to do */
}

#endif /* _ASM_MICROBLAZE_BUGS_H */
#include <asm-generic/bugs.h>
70 changes: 2 additions & 68 deletions arch/microblaze/include/asm/checksum.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
#ifndef _ASM_MICROBLAZE_CHECKSUM_H
#define _ASM_MICROBLAZE_CHECKSUM_H

#include <linux/in6.h>

/*
* computes the checksum of the TCP/UDP pseudo-header
* returns a 16-bit checksum, already complemented
*/
#define csum_tcpudp_nofold csum_tcpudp_nofold
static inline __wsum
csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
unsigned short proto, __wsum sum)
Expand All @@ -30,71 +29,6 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
return sum;
}

/*
* computes the checksum of a memory block at buff, length len,
* and adds in "sum" (32-bit)
*
* returns a 32-bit number suitable for feeding into itself
* or csum_tcpudp_magic
*
* this function must be called with even lengths, except
* for the last fragment, which may be odd
*
* it's best to have buff aligned on a 32-bit boundary
*/
extern __wsum csum_partial(const void *buff, int len, __wsum sum);

/*
* the same as csum_partial, but copies from src while it
* checksums
*
* here even more important to align src and dst on a 32-bit (or even
* better 64-bit) boundary
*/
extern __wsum csum_partial_copy(const void *src, void *dst, int len,
__wsum sum);

/*
* the same as csum_partial_copy, but copies from user space.
*
* here even more important to align src and dst on a 32-bit (or even
* better 64-bit) boundary
*/
extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
int len, __wsum sum, int *csum_err);

#define csum_partial_copy_nocheck(src, dst, len, sum) \
csum_partial_copy((src), (dst), (len), (sum))

/*
* This is a version of ip_compute_csum() optimized for IP headers,
* which always checksum on 4 octet boundaries.
*
*/
extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);

/*
* Fold a partial checksum
*/
static inline __sum16 csum_fold(__wsum csum)
{
u32 sum = (__force u32)csum;
sum = (sum & 0xffff) + (sum >> 16);
sum = (sum & 0xffff) + (sum >> 16);
return (__force __sum16)~sum;
}

static inline __sum16
csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
unsigned short proto, __wsum sum)
{
return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
}

/*
* this routine is used for miscellaneous IP-like checksums, mainly
* in icmp.c
*/
extern __sum16 ip_compute_csum(const void *buff, int len);
#include <asm-generic/checksum.h>

#endif /* _ASM_MICROBLAZE_CHECKSUM_H */
1 change: 1 addition & 0 deletions arch/microblaze/include/asm/fb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <asm-generic/fb.h>
14 changes: 2 additions & 12 deletions arch/microblaze/include/asm/hardirq.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,11 @@
#ifndef _ASM_MICROBLAZE_HARDIRQ_H
#define _ASM_MICROBLAZE_HARDIRQ_H

#include <linux/cache.h>
#include <linux/irq.h>
#include <asm/irq.h>
#include <asm/current.h>
#include <linux/ptrace.h>

/* should be defined in each interrupt controller driver */
extern unsigned int get_irq(struct pt_regs *regs);

typedef struct {
unsigned int __softirq_pending;
} ____cacheline_aligned irq_cpustat_t;

#define ack_bad_irq ack_bad_irq
void ack_bad_irq(unsigned int irq);

#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
#include <asm-generic/hardirq.h>

#endif /* _ASM_MICROBLAZE_HARDIRQ_H */
92 changes: 1 addition & 91 deletions arch/microblaze/include/asm/ioctls.h
Original file line number Diff line number Diff line change
@@ -1,91 +1 @@
/*
* Copyright (C) 2006 Atmark Techno, Inc.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/

#ifndef _ASM_MICROBLAZE_IOCTLS_H
#define _ASM_MICROBLAZE_IOCTLS_H

#include <linux/ioctl.h>

/* 0x54 is just a magic number to make these relatively unique ('T') */

#define TCGETS 0x5401
#define TCSETS 0x5402
#define TCSETSW 0x5403
#define TCSETSF 0x5404
#define TCGETA 0x5405
#define TCSETA 0x5406
#define TCSETAW 0x5407
#define TCSETAF 0x5408
#define TCSBRK 0x5409
#define TCXONC 0x540A
#define TCFLSH 0x540B
#define TIOCEXCL 0x540C
#define TIOCNXCL 0x540D
#define TIOCSCTTY 0x540E
#define TIOCGPGRP 0x540F
#define TIOCSPGRP 0x5410
#define TIOCOUTQ 0x5411
#define TIOCSTI 0x5412
#define TIOCGWINSZ 0x5413
#define TIOCSWINSZ 0x5414
#define TIOCMGET 0x5415
#define TIOCMBIS 0x5416
#define TIOCMBIC 0x5417
#define TIOCMSET 0x5418
#define TIOCGSOFTCAR 0x5419
#define TIOCSSOFTCAR 0x541A
#define FIONREAD 0x541B
#define TIOCINQ FIONREAD
#define TIOCLINUX 0x541C
#define TIOCCONS 0x541D
#define TIOCGSERIAL 0x541E
#define TIOCSSERIAL 0x541F
#define TIOCPKT 0x5420
#define FIONBIO 0x5421
#define TIOCNOTTY 0x5422
#define TIOCSETD 0x5423
#define TIOCGETD 0x5424
#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
#define TIOCSBRK 0x5427 /* BSD compatibility */
#define TIOCCBRK 0x5428 /* BSD compatibility */
#define TIOCGSID 0x5429 /* Return the session ID of FD */
/* Get Pty Number (of pty-mux device) */
#define TIOCGPTN _IOR('T', 0x30, unsigned int)
#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */

#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define FIOCLEX 0x5451
#define FIOASYNC 0x5452
#define TIOCSERCONFIG 0x5453
#define TIOCSERGWILD 0x5454
#define TIOCSERSWILD 0x5455
#define TIOCGLCKTRMIOS 0x5456
#define TIOCSLCKTRMIOS 0x5457
#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
#define TIOCSERGETLSR 0x5459 /* Get line status register */
#define TIOCSERGETMULTI 0x545A /* Get multiport config */
#define TIOCSERSETMULTI 0x545B /* Set multiport config */

#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */

#define FIOQSIZE 0x545E

/* Used for packet mode */
#define TIOCPKT_DATA 0
#define TIOCPKT_FLUSHREAD 1
#define TIOCPKT_FLUSHWRITE 2
#define TIOCPKT_STOP 4
#define TIOCPKT_START 8
#define TIOCPKT_NOSTOP 16
#define TIOCPKT_DOSTOP 32

#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */

#endif /* _ASM_MICROBLAZE_IOCTLS_H */
#include <asm-generic/ioctls.h>
Loading

0 comments on commit f560902

Please sign in to comment.