From 86821d18f9d8fd42fa3180ad3703d491aecc52d9 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 29 Oct 2008 23:18:41 -0700 Subject: [PATCH 01/98] sparc64: Rework auxio driver to save some text space. Use common functions instead of inlining and duplicating logic over and over to handle the SBUS vs. EBUS cases. Before: text data bss dec hex filename 715 568 16 1299 513 arch/sparc64/kernel/auxio.o After: text data bss dec hex filename 631 568 16 1215 4bf arch/sparc64/kernel/auxio.o Signed-off-by: David S. Miller --- arch/sparc64/kernel/auxio.c | 70 ++++++++++++++----------------------- 1 file changed, 26 insertions(+), 44 deletions(-) diff --git a/arch/sparc64/kernel/auxio.c b/arch/sparc64/kernel/auxio.c index 858beda86524..8b67347d4221 100644 --- a/arch/sparc64/kernel/auxio.c +++ b/arch/sparc64/kernel/auxio.c @@ -27,73 +27,55 @@ enum auxio_type { static enum auxio_type auxio_devtype = AUXIO_TYPE_NODEV; static DEFINE_SPINLOCK(auxio_lock); -static void __auxio_sbus_set(u8 bits_on, u8 bits_off) +static void __auxio_rmw(u8 bits_on, u8 bits_off, int ebus) { if (auxio_register) { - unsigned char regval; unsigned long flags; - unsigned char newval; + u8 regval, newval; spin_lock_irqsave(&auxio_lock, flags); - regval = sbus_readb(auxio_register); + regval = (ebus ? + (u8) readl(auxio_register) : + sbus_readb(auxio_register)); newval = regval | bits_on; newval &= ~bits_off; - newval &= ~AUXIO_AUX1_MASK; - sbus_writeb(newval, auxio_register); + if (!ebus) + newval &= ~AUXIO_AUX1_MASK; + if (ebus) + writel((u32) newval, auxio_register); + else + sbus_writeb(newval, auxio_register); spin_unlock_irqrestore(&auxio_lock, flags); } } -static void __auxio_ebus_set(u8 bits_on, u8 bits_off) +static void __auxio_set_bit(u8 bit, int on, int ebus) { - if (auxio_register) { - unsigned char regval; - unsigned long flags; - unsigned char newval; + u8 bits_on = (ebus ? AUXIO_PCIO_LED : AUXIO_AUX1_LED); + u8 bits_off = 0; - spin_lock_irqsave(&auxio_lock, flags); - - regval = (u8)readl(auxio_register); - newval = regval | bits_on; - newval &= ~bits_off; - writel((u32)newval, auxio_register); - - spin_unlock_irqrestore(&auxio_lock, flags); + if (!on) { + u8 tmp = bits_off; + bits_off = bits_on; + bits_on = tmp; } -} - -static inline void __auxio_ebus_set_led(int on) -{ - (on) ? __auxio_ebus_set(AUXIO_PCIO_LED, 0) : - __auxio_ebus_set(0, AUXIO_PCIO_LED) ; -} - -static inline void __auxio_sbus_set_led(int on) -{ - (on) ? __auxio_sbus_set(AUXIO_AUX1_LED, 0) : - __auxio_sbus_set(0, AUXIO_AUX1_LED) ; + __auxio_rmw(bits_on, bits_off, ebus); } void auxio_set_led(int on) { - switch(auxio_devtype) { - case AUXIO_TYPE_SBUS: - __auxio_sbus_set_led(on); - break; - case AUXIO_TYPE_EBUS: - __auxio_ebus_set_led(on); - break; - default: - break; - } + int ebus = auxio_devtype == AUXIO_TYPE_EBUS; + u8 bit; + + bit = (ebus ? AUXIO_PCIO_LED : AUXIO_AUX1_LED); + __auxio_set_bit(bit, on, ebus); } -static inline void __auxio_sbus_set_lte(int on) +static void __auxio_sbus_set_lte(int on) { - (on) ? __auxio_sbus_set(AUXIO_AUX1_LTE, 0) : - __auxio_sbus_set(0, AUXIO_AUX1_LTE) ; + __auxio_set_bit(AUXIO_AUX1_LTE, on, 0); } void auxio_set_lte(int on) From c9bb6003dd096ad190e1594a7d835ae1c39fae8f Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 29 Oct 2008 23:46:09 -0700 Subject: [PATCH 02/98] of: Fix comment, sparc no longer uses of_device objects on special busses. It only uses of_platform_bus_type. Signed-off-by: David S. Miller --- include/linux/of_platform.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index a8efcfeea732..3d327b67d7e2 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h @@ -26,8 +26,7 @@ extern struct bus_type of_platform_bus_type; /* * An of_platform_driver driver is attached to a basic of_device on - * the "platform bus" (of_platform_bus_type) (or ISA, EBUS and SBUS - * busses on sparc). + * the "platform bus" (of_platform_bus_type). */ struct of_platform_driver { From 64f2dde3f743c8a1ad8c0a1aa74166c1034afd92 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 29 Oct 2008 21:25:00 -0700 Subject: [PATCH 03/98] sparc64: Run the kernel always in the TSO memory model. The fact of the matter is, all UltraSPARC-III and later chips only implement TSO. They don't implement PSO and RMO memory models at all. Only the Ultra-I and Ultra-II family chips implement RMO and they are only helped marginally by using this setting when executing kernel code. The big plus to doing this is that we can eliminate all of the non-Sync memory barriers in the kernel except for the ones used in the optimized memcpy/memset code (these use block load and store operations which have their own memory ordering rules). Signed-off-by: David S. Miller --- arch/sparc/include/asm/spinlock_64.h | 17 ++++++----------- arch/sparc64/kernel/etrap.S | 6 +++--- arch/sparc64/kernel/rtrap.S | 6 +++--- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h index 120cfe4577c7..fbac9d00744a 100644 --- a/arch/sparc/include/asm/spinlock_64.h +++ b/arch/sparc/include/asm/spinlock_64.h @@ -13,17 +13,12 @@ * and rebuild your kernel. */ -/* All of these locking primitives are expected to work properly - * even in an RMO memory model, which currently is what the kernel - * runs in. - * - * There is another issue. Because we play games to save cycles - * in the non-contention case, we need to be extra careful about - * branch targets into the "spinning" code. They live in their - * own section, but the newer V9 branches have a shorter range - * than the traditional 32-bit sparc branch variants. The rule - * is that the branches that go into and out of the spinner sections - * must be pre-V9 branches. +/* Because we play games to save cycles in the non-contention case, we + * need to be extra careful about branch targets into the "spinning" + * code. They live in their own section, but the newer V9 branches + * have a shorter range than the traditional 32-bit sparc branch + * variants. The rule is that the branches that go into and out of + * the spinner sections must be pre-V9 branches. */ #define __raw_spin_is_locked(lp) ((lp)->lock != 0) diff --git a/arch/sparc64/kernel/etrap.S b/arch/sparc64/kernel/etrap.S index 29ce489bc188..786b185e6e3f 100644 --- a/arch/sparc64/kernel/etrap.S +++ b/arch/sparc64/kernel/etrap.S @@ -16,9 +16,9 @@ #include #define TASK_REGOFF (THREAD_SIZE-TRACEREG_SZ-STACKFRAME_SZ) -#define ETRAP_PSTATE1 (PSTATE_RMO | PSTATE_PRIV) +#define ETRAP_PSTATE1 (PSTATE_TSO | PSTATE_PRIV) #define ETRAP_PSTATE2 \ - (PSTATE_RMO | PSTATE_PEF | PSTATE_PRIV | PSTATE_IE) + (PSTATE_TSO | PSTATE_PEF | PSTATE_PRIV | PSTATE_IE) /* * On entry, %g7 is return address - 0x4. @@ -130,7 +130,7 @@ etrap_save: save %g2, -STACK_BIAS, %sp stx %g6, [%sp + PTREGS_OFF + PT_V9_G6] stx %g7, [%sp + PTREGS_OFF + PT_V9_G7] or %l7, %l0, %l7 - sethi %hi(TSTATE_RMO | TSTATE_PEF), %l0 + sethi %hi(TSTATE_TSO | TSTATE_PEF), %l0 or %l7, %l0, %l7 wrpr %l2, %tnpc wrpr %l7, (TSTATE_PRIV | TSTATE_IE), %tstate diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S index 97a993c1f7f3..6892cf556f45 100644 --- a/arch/sparc64/kernel/rtrap.S +++ b/arch/sparc64/kernel/rtrap.S @@ -14,9 +14,9 @@ #include #include -#define RTRAP_PSTATE (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV|PSTATE_IE) -#define RTRAP_PSTATE_IRQOFF (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV) -#define RTRAP_PSTATE_AG_IRQOFF (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV|PSTATE_AG) +#define RTRAP_PSTATE (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV|PSTATE_IE) +#define RTRAP_PSTATE_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV) +#define RTRAP_PSTATE_AG_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV|PSTATE_AG) .text .align 32 From 293666b7a17cb7a389fc274980439212386a19c4 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Sat, 15 Nov 2008 13:33:25 -0800 Subject: [PATCH 04/98] sparc64: Stop using memory barriers for atomics and locks. The kernel always executes in the TSO memory model now, so none of this stuff is necessary any more. With helpful feedback from Nick Piggin. Signed-off-by: David S. Miller --- arch/sparc/include/asm/atomic_64.h | 7 ------ arch/sparc/include/asm/bitops_64.h | 5 ---- arch/sparc/include/asm/spinlock_64.h | 14 ----------- arch/sparc/include/asm/system_64.h | 35 +++++++--------------------- arch/sparc/include/asm/tsb.h | 6 ----- arch/sparc64/kernel/smp.c | 11 ++++----- arch/sparc64/kernel/trampoline.S | 4 ---- arch/sparc64/kernel/traps.c | 1 - arch/sparc64/kernel/tsb.S | 6 ++--- arch/sparc64/lib/atomic.S | 26 --------------------- arch/sparc64/lib/bitops.S | 24 ------------------- arch/sparc64/lib/rwsem.S | 7 ------ arch/sparc64/mm/init.c | 2 -- arch/sparc64/mm/tsb.c | 4 +--- arch/sparc64/mm/ultra.S | 2 -- 15 files changed, 17 insertions(+), 137 deletions(-) diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h index 2c71ec4a3b18..5982c5ae7f07 100644 --- a/arch/sparc/include/asm/atomic_64.h +++ b/arch/sparc/include/asm/atomic_64.h @@ -112,17 +112,10 @@ static inline int atomic64_add_unless(atomic64_t *v, long a, long u) #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) /* Atomic operations are already serializing */ -#ifdef CONFIG_SMP -#define smp_mb__before_atomic_dec() membar_storeload_loadload(); -#define smp_mb__after_atomic_dec() membar_storeload_storestore(); -#define smp_mb__before_atomic_inc() membar_storeload_loadload(); -#define smp_mb__after_atomic_inc() membar_storeload_storestore(); -#else #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() -#endif #include #endif /* !(__ARCH_SPARC64_ATOMIC__) */ diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h index bb87b8080220..e72ac9cdfb98 100644 --- a/arch/sparc/include/asm/bitops_64.h +++ b/arch/sparc/include/asm/bitops_64.h @@ -23,13 +23,8 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr); #include -#ifdef CONFIG_SMP -#define smp_mb__before_clear_bit() membar_storeload_loadload() -#define smp_mb__after_clear_bit() membar_storeload_storestore() -#else #define smp_mb__before_clear_bit() barrier() #define smp_mb__after_clear_bit() barrier() -#endif #include #include diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h index fbac9d00744a..c4d274d330e9 100644 --- a/arch/sparc/include/asm/spinlock_64.h +++ b/arch/sparc/include/asm/spinlock_64.h @@ -33,12 +33,10 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock) __asm__ __volatile__( "1: ldstub [%1], %0\n" -" membar #StoreLoad | #StoreStore\n" " brnz,pn %0, 2f\n" " nop\n" " .subsection 2\n" "2: ldub [%1], %0\n" -" membar #LoadLoad\n" " brnz,pt %0, 2b\n" " nop\n" " ba,a,pt %%xcc, 1b\n" @@ -54,7 +52,6 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock) __asm__ __volatile__( " ldstub [%1], %0\n" -" membar #StoreLoad | #StoreStore" : "=r" (result) : "r" (lock) : "memory"); @@ -65,7 +62,6 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock) static inline void __raw_spin_unlock(raw_spinlock_t *lock) { __asm__ __volatile__( -" membar #StoreStore | #LoadStore\n" " stb %%g0, [%0]" : /* No outputs */ : "r" (lock) @@ -78,14 +74,12 @@ static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long fla __asm__ __volatile__( "1: ldstub [%2], %0\n" -" membar #StoreLoad | #StoreStore\n" " brnz,pn %0, 2f\n" " nop\n" " .subsection 2\n" "2: rdpr %%pil, %1\n" " wrpr %3, %%pil\n" "3: ldub [%2], %0\n" -" membar #LoadLoad\n" " brnz,pt %0, 3b\n" " nop\n" " ba,pt %%xcc, 1b\n" @@ -108,12 +102,10 @@ static void inline __read_lock(raw_rwlock_t *lock) "4: add %0, 1, %1\n" " cas [%2], %0, %1\n" " cmp %0, %1\n" -" membar #StoreLoad | #StoreStore\n" " bne,pn %%icc, 1b\n" " nop\n" " .subsection 2\n" "2: ldsw [%2], %0\n" -" membar #LoadLoad\n" " brlz,pt %0, 2b\n" " nop\n" " ba,a,pt %%xcc, 4b\n" @@ -134,7 +126,6 @@ static int inline __read_trylock(raw_rwlock_t *lock) " add %0, 1, %1\n" " cas [%2], %0, %1\n" " cmp %0, %1\n" -" membar #StoreLoad | #StoreStore\n" " bne,pn %%icc, 1b\n" " mov 1, %0\n" "2:" @@ -150,7 +141,6 @@ static void inline __read_unlock(raw_rwlock_t *lock) unsigned long tmp1, tmp2; __asm__ __volatile__( -" membar #StoreLoad | #LoadLoad\n" "1: lduw [%2], %0\n" " sub %0, 1, %1\n" " cas [%2], %0, %1\n" @@ -174,12 +164,10 @@ static void inline __write_lock(raw_rwlock_t *lock) "4: or %0, %3, %1\n" " cas [%2], %0, %1\n" " cmp %0, %1\n" -" membar #StoreLoad | #StoreStore\n" " bne,pn %%icc, 1b\n" " nop\n" " .subsection 2\n" "2: lduw [%2], %0\n" -" membar #LoadLoad\n" " brnz,pt %0, 2b\n" " nop\n" " ba,a,pt %%xcc, 4b\n" @@ -192,7 +180,6 @@ static void inline __write_lock(raw_rwlock_t *lock) static void inline __write_unlock(raw_rwlock_t *lock) { __asm__ __volatile__( -" membar #LoadStore | #StoreStore\n" " stw %%g0, [%0]" : /* no outputs */ : "r" (lock) @@ -212,7 +199,6 @@ static int inline __write_trylock(raw_rwlock_t *lock) " or %0, %4, %1\n" " cas [%3], %0, %1\n" " cmp %0, %1\n" -" membar #StoreLoad | #StoreStore\n" " bne,pn %%icc, 1b\n" " nop\n" " mov 1, %2\n" diff --git a/arch/sparc/include/asm/system_64.h b/arch/sparc/include/asm/system_64.h index 8759f2a1b837..7554ad39b5af 100644 --- a/arch/sparc/include/asm/system_64.h +++ b/arch/sparc/include/asm/system_64.h @@ -59,20 +59,9 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \ : : : "memory"); \ } while (0) -#define mb() \ - membar_safe("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad") -#define rmb() \ - membar_safe("#LoadLoad") -#define wmb() \ - membar_safe("#StoreStore") -#define membar_storeload() \ - membar_safe("#StoreLoad") -#define membar_storeload_storestore() \ - membar_safe("#StoreLoad | #StoreStore") -#define membar_storeload_loadload() \ - membar_safe("#StoreLoad | #LoadLoad") -#define membar_storestore_loadstore() \ - membar_safe("#StoreStore | #LoadStore") +#define mb() membar_safe("#StoreLoad") +#define rmb() __asm__ __volatile__("":::"memory") +#define wmb() __asm__ __volatile__("":::"memory") #endif @@ -80,20 +69,20 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \ #define read_barrier_depends() do { } while(0) #define set_mb(__var, __value) \ - do { __var = __value; membar_storeload_storestore(); } while(0) + do { __var = __value; membar_safe("#StoreLoad"); } while(0) #ifdef CONFIG_SMP #define smp_mb() mb() #define smp_rmb() rmb() #define smp_wmb() wmb() -#define smp_read_barrier_depends() read_barrier_depends() #else #define smp_mb() __asm__ __volatile__("":::"memory") #define smp_rmb() __asm__ __volatile__("":::"memory") #define smp_wmb() __asm__ __volatile__("":::"memory") -#define smp_read_barrier_depends() do { } while(0) #endif +#define smp_read_barrier_depends() do { } while(0) + #define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory") #define flushw_all() __asm__ __volatile__("flushw") @@ -209,14 +198,12 @@ static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int va unsigned long tmp1, tmp2; __asm__ __volatile__( -" membar #StoreLoad | #LoadLoad\n" " mov %0, %1\n" "1: lduw [%4], %2\n" " cas [%4], %2, %0\n" " cmp %2, %0\n" " bne,a,pn %%icc, 1b\n" " mov %1, %0\n" -" membar #StoreLoad | #StoreStore\n" : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) : "0" (val), "r" (m) : "cc", "memory"); @@ -228,14 +215,12 @@ static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long unsigned long tmp1, tmp2; __asm__ __volatile__( -" membar #StoreLoad | #LoadLoad\n" " mov %0, %1\n" "1: ldx [%4], %2\n" " casx [%4], %2, %0\n" " cmp %2, %0\n" " bne,a,pn %%xcc, 1b\n" " mov %1, %0\n" -" membar #StoreLoad | #StoreStore\n" : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) : "0" (val), "r" (m) : "cc", "memory"); @@ -272,9 +257,7 @@ extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noret static inline unsigned long __cmpxchg_u32(volatile int *m, int old, int new) { - __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n" - "cas [%2], %3, %0\n\t" - "membar #StoreLoad | #StoreStore" + __asm__ __volatile__("cas [%2], %3, %0" : "=&r" (new) : "0" (new), "r" (m), "r" (old) : "memory"); @@ -285,9 +268,7 @@ __cmpxchg_u32(volatile int *m, int old, int new) static inline unsigned long __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) { - __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n" - "casx [%2], %3, %0\n\t" - "membar #StoreLoad | #StoreStore" + __asm__ __volatile__("casx [%2], %3, %0" : "=&r" (new) : "0" (new), "r" (m), "r" (old) : "memory"); diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h index 76e4299dd9bc..83c571d8c8a7 100644 --- a/arch/sparc/include/asm/tsb.h +++ b/arch/sparc/include/asm/tsb.h @@ -50,8 +50,6 @@ #define TSB_TAG_INVALID_BIT 46 #define TSB_TAG_INVALID_HIGH (1 << (TSB_TAG_INVALID_BIT - 32)) -#define TSB_MEMBAR membar #StoreStore - /* Some cpus support physical address quad loads. We want to use * those if possible so we don't need to hard-lock the TSB mapping * into the TLB. We encode some instruction patching in order to @@ -128,13 +126,11 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; cmp REG1, REG2; \ bne,pn %icc, 99b; \ nop; \ - TSB_MEMBAR #define TSB_WRITE(TSB, TTE, TAG) \ add TSB, 0x8, TSB; \ TSB_STORE(TSB, TTE); \ sub TSB, 0x8, TSB; \ - TSB_MEMBAR; \ TSB_STORE(TSB, TAG); #define KTSB_LOAD_QUAD(TSB, REG) \ @@ -153,13 +149,11 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; cmp REG1, REG2; \ bne,pn %icc, 99b; \ nop; \ - TSB_MEMBAR #define KTSB_WRITE(TSB, TTE, TAG) \ add TSB, 0x8, TSB; \ stxa TTE, [TSB] ASI_N; \ sub TSB, 0x8, TSB; \ - TSB_MEMBAR; \ stxa TAG, [TSB] ASI_N; /* Do a kernel page table walk. Leaves physical PTE pointer in diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index f500b0618bb0..c6d06362728c 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c @@ -163,7 +163,7 @@ static inline long get_delta (long *rt, long *master) for (i = 0; i < NUM_ITERS; i++) { t0 = tick_ops->get_tick(); go[MASTER] = 1; - membar_storeload(); + membar_safe("#StoreLoad"); while (!(tm = go[SLAVE])) rmb(); go[SLAVE] = 0; @@ -257,7 +257,7 @@ static void smp_synchronize_one_tick(int cpu) /* now let the client proceed into his loop */ go[MASTER] = 0; - membar_storeload(); + membar_safe("#StoreLoad"); spin_lock_irqsave(&itc_sync_lock, flags); { @@ -267,7 +267,7 @@ static void smp_synchronize_one_tick(int cpu) go[MASTER] = 0; wmb(); go[SLAVE] = tick_ops->get_tick(); - membar_storeload(); + membar_safe("#StoreLoad"); } } spin_unlock_irqrestore(&itc_sync_lock, flags); @@ -1122,7 +1122,6 @@ void smp_capture(void) smp_processor_id()); #endif penguins_are_doing_time = 1; - membar_storestore_loadstore(); atomic_inc(&smp_capture_registry); smp_cross_call(&xcall_capture, 0, 0, 0); while (atomic_read(&smp_capture_registry) != ncpus) @@ -1142,7 +1141,7 @@ void smp_release(void) smp_processor_id()); #endif penguins_are_doing_time = 0; - membar_storeload_storestore(); + membar_safe("#StoreLoad"); atomic_dec(&smp_capture_registry); } } @@ -1161,7 +1160,7 @@ void smp_penguin_jailcell(int irq, struct pt_regs *regs) __asm__ __volatile__("flushw"); prom_world(1); atomic_inc(&smp_capture_registry); - membar_storeload_storestore(); + membar_safe("#StoreLoad"); while (penguins_are_doing_time) rmb(); atomic_dec(&smp_capture_registry); diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc64/kernel/trampoline.S index 83abd5ae88a4..da1b781b5e65 100644 --- a/arch/sparc64/kernel/trampoline.S +++ b/arch/sparc64/kernel/trampoline.S @@ -109,7 +109,6 @@ startup_continue: */ sethi %hi(prom_entry_lock), %g2 1: ldstub [%g2 + %lo(prom_entry_lock)], %g1 - membar #StoreLoad | #StoreStore brnz,pn %g1, 1b nop @@ -214,7 +213,6 @@ startup_continue: sethi %hi(prom_entry_lock), %g2 stb %g0, [%g2 + %lo(prom_entry_lock)] - membar #StoreStore | #StoreLoad ba,pt %xcc, after_lock_tlb nop @@ -330,7 +328,6 @@ after_lock_tlb: sethi %hi(prom_entry_lock), %g2 1: ldstub [%g2 + %lo(prom_entry_lock)], %g1 - membar #StoreLoad | #StoreStore brnz,pn %g1, 1b nop @@ -394,7 +391,6 @@ after_lock_tlb: 3: sethi %hi(prom_entry_lock), %g2 stb %g0, [%g2 + %lo(prom_entry_lock)] - membar #StoreStore | #StoreLoad ldx [%l0], %g6 ldx [%g6 + TI_TASK], %g4 diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index 81ccd22e78d4..04994fc8700d 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c @@ -1371,7 +1371,6 @@ static int cheetah_fix_ce(unsigned long physaddr) __asm__ __volatile__("ldxa [%0] %3, %%g0\n\t" "ldxa [%1] %3, %%g0\n\t" "casxa [%2] %3, %%g0, %%g0\n\t" - "membar #StoreLoad | #StoreStore\n\t" "ldxa [%0] %3, %%g0\n\t" "ldxa [%1] %3, %%g0\n\t" "membar #Sync" diff --git a/arch/sparc64/kernel/tsb.S b/arch/sparc64/kernel/tsb.S index c499214b501d..8c91d9b29a2f 100644 --- a/arch/sparc64/kernel/tsb.S +++ b/arch/sparc64/kernel/tsb.S @@ -317,7 +317,7 @@ tsb_flush: srlx %g1, 32, %o3 andcc %o3, %g2, %g0 bne,pn %icc, 1b - membar #LoadLoad + nop cmp %g1, %o1 mov 1, %o3 bne,pt %xcc, 2f @@ -327,7 +327,7 @@ tsb_flush: bne,pn %xcc, 1b nop 2: retl - TSB_MEMBAR + nop .size tsb_flush, .-tsb_flush /* Reload MMU related context switch state at @@ -478,7 +478,7 @@ copy_tsb: /* %o0=old_tsb_base, %o1=old_tsb_size nop retl - TSB_MEMBAR + nop .size copy_tsb, .-copy_tsb /* Set the invalid bit in all TSB entries. */ diff --git a/arch/sparc64/lib/atomic.S b/arch/sparc64/lib/atomic.S index 70ac4186f62b..0268210ca168 100644 --- a/arch/sparc64/lib/atomic.S +++ b/arch/sparc64/lib/atomic.S @@ -43,29 +43,10 @@ atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */ 2: BACKOFF_SPIN(%o2, %o3, 1b) .size atomic_sub, .-atomic_sub - /* On SMP we need to use memory barriers to ensure - * correct memory operation ordering, nop these out - * for uniprocessor. - */ -#ifdef CONFIG_SMP - -#define ATOMIC_PRE_BARRIER membar #StoreLoad | #LoadLoad; -#define ATOMIC_POST_BARRIER \ - ba,pt %xcc, 80b; \ - membar #StoreLoad | #StoreStore - -80: retl - nop -#else -#define ATOMIC_PRE_BARRIER -#define ATOMIC_POST_BARRIER -#endif - .globl atomic_add_ret .type atomic_add_ret,#function atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ BACKOFF_SETUP(%o2) - ATOMIC_PRE_BARRIER 1: lduw [%o1], %g1 add %g1, %o0, %g7 cas [%o1], %g1, %g7 @@ -73,7 +54,6 @@ atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ bne,pn %icc, 2f add %g7, %o0, %g7 sra %g7, 0, %o0 - ATOMIC_POST_BARRIER retl nop 2: BACKOFF_SPIN(%o2, %o3, 1b) @@ -83,7 +63,6 @@ atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ .type atomic_sub_ret,#function atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ BACKOFF_SETUP(%o2) - ATOMIC_PRE_BARRIER 1: lduw [%o1], %g1 sub %g1, %o0, %g7 cas [%o1], %g1, %g7 @@ -91,7 +70,6 @@ atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ bne,pn %icc, 2f sub %g7, %o0, %g7 sra %g7, 0, %o0 - ATOMIC_POST_BARRIER retl nop 2: BACKOFF_SPIN(%o2, %o3, 1b) @@ -131,7 +109,6 @@ atomic64_sub: /* %o0 = decrement, %o1 = atomic_ptr */ .type atomic64_add_ret,#function atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ BACKOFF_SETUP(%o2) - ATOMIC_PRE_BARRIER 1: ldx [%o1], %g1 add %g1, %o0, %g7 casx [%o1], %g1, %g7 @@ -139,7 +116,6 @@ atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ bne,pn %xcc, 2f add %g7, %o0, %g7 mov %g7, %o0 - ATOMIC_POST_BARRIER retl nop 2: BACKOFF_SPIN(%o2, %o3, 1b) @@ -149,7 +125,6 @@ atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ .type atomic64_sub_ret,#function atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ BACKOFF_SETUP(%o2) - ATOMIC_PRE_BARRIER 1: ldx [%o1], %g1 sub %g1, %o0, %g7 casx [%o1], %g1, %g7 @@ -157,7 +132,6 @@ atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ bne,pn %xcc, 2f sub %g7, %o0, %g7 mov %g7, %o0 - ATOMIC_POST_BARRIER retl nop 2: BACKOFF_SPIN(%o2, %o3, 1b) diff --git a/arch/sparc64/lib/bitops.S b/arch/sparc64/lib/bitops.S index 6b015a6eefb5..2b7228cb8c22 100644 --- a/arch/sparc64/lib/bitops.S +++ b/arch/sparc64/lib/bitops.S @@ -8,29 +8,10 @@ .text - /* On SMP we need to use memory barriers to ensure - * correct memory operation ordering, nop these out - * for uniprocessor. - */ - -#ifdef CONFIG_SMP -#define BITOP_PRE_BARRIER membar #StoreLoad | #LoadLoad -#define BITOP_POST_BARRIER \ - ba,pt %xcc, 80b; \ - membar #StoreLoad | #StoreStore - -80: retl - nop -#else -#define BITOP_PRE_BARRIER -#define BITOP_POST_BARRIER -#endif - .globl test_and_set_bit .type test_and_set_bit,#function test_and_set_bit: /* %o0=nr, %o1=addr */ BACKOFF_SETUP(%o3) - BITOP_PRE_BARRIER srlx %o0, 6, %g1 mov 1, %o2 sllx %g1, 3, %g3 @@ -45,7 +26,6 @@ test_and_set_bit: /* %o0=nr, %o1=addr */ and %g7, %o2, %g2 clr %o0 movrne %g2, 1, %o0 - BITOP_POST_BARRIER retl nop 2: BACKOFF_SPIN(%o3, %o4, 1b) @@ -55,7 +35,6 @@ test_and_set_bit: /* %o0=nr, %o1=addr */ .type test_and_clear_bit,#function test_and_clear_bit: /* %o0=nr, %o1=addr */ BACKOFF_SETUP(%o3) - BITOP_PRE_BARRIER srlx %o0, 6, %g1 mov 1, %o2 sllx %g1, 3, %g3 @@ -70,7 +49,6 @@ test_and_clear_bit: /* %o0=nr, %o1=addr */ and %g7, %o2, %g2 clr %o0 movrne %g2, 1, %o0 - BITOP_POST_BARRIER retl nop 2: BACKOFF_SPIN(%o3, %o4, 1b) @@ -80,7 +58,6 @@ test_and_clear_bit: /* %o0=nr, %o1=addr */ .type test_and_change_bit,#function test_and_change_bit: /* %o0=nr, %o1=addr */ BACKOFF_SETUP(%o3) - BITOP_PRE_BARRIER srlx %o0, 6, %g1 mov 1, %o2 sllx %g1, 3, %g3 @@ -95,7 +72,6 @@ test_and_change_bit: /* %o0=nr, %o1=addr */ and %g7, %o2, %g2 clr %o0 movrne %g2, 1, %o0 - BITOP_POST_BARRIER retl nop 2: BACKOFF_SPIN(%o3, %o4, 1b) diff --git a/arch/sparc64/lib/rwsem.S b/arch/sparc64/lib/rwsem.S index 1a4cc5654de4..91a7d29a79d5 100644 --- a/arch/sparc64/lib/rwsem.S +++ b/arch/sparc64/lib/rwsem.S @@ -17,7 +17,6 @@ __down_read: bne,pn %icc, 1b add %g7, 1, %g7 cmp %g7, 0 - membar #StoreLoad | #StoreStore bl,pn %icc, 3f nop 2: @@ -42,7 +41,6 @@ __down_read_trylock: cmp %g1, %g7 bne,pn %icc, 1b mov 1, %o1 - membar #StoreLoad | #StoreStore 2: retl mov %o1, %o0 .size __down_read_trylock, .-__down_read_trylock @@ -58,7 +56,6 @@ __down_write: cmp %g3, %g7 bne,pn %icc, 1b cmp %g7, 0 - membar #StoreLoad | #StoreStore bne,pn %icc, 3f nop 2: retl @@ -85,7 +82,6 @@ __down_write_trylock: cmp %g3, %g7 bne,pn %icc, 1b mov 1, %o1 - membar #StoreLoad | #StoreStore 2: retl mov %o1, %o0 .size __down_write_trylock, .-__down_write_trylock @@ -99,7 +95,6 @@ __up_read: cmp %g1, %g7 bne,pn %icc, 1b cmp %g7, 0 - membar #StoreLoad | #StoreStore bl,pn %icc, 3f nop 2: retl @@ -129,7 +124,6 @@ __up_write: bne,pn %icc, 1b sub %g7, %g1, %g7 cmp %g7, 0 - membar #StoreLoad | #StoreStore bl,pn %icc, 3f nop 2: @@ -155,7 +149,6 @@ __downgrade_write: bne,pn %icc, 1b sub %g7, %g1, %g7 cmp %g7, 0 - membar #StoreLoad | #StoreStore bl,pn %icc, 3f nop 2: diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index 185f34679110..4bd63968400d 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c @@ -214,7 +214,6 @@ static inline void set_dcache_dirty(struct page *page, int this_cpu) "or %%g1, %0, %%g1\n\t" "casx [%2], %%g7, %%g1\n\t" "cmp %%g7, %%g1\n\t" - "membar #StoreLoad | #StoreStore\n\t" "bne,pn %%xcc, 1b\n\t" " nop" : /* no outputs */ @@ -236,7 +235,6 @@ static inline void clear_dcache_dirty_cpu(struct page *page, unsigned long cpu) " andn %%g7, %1, %%g1\n\t" "casx [%2], %%g7, %%g1\n\t" "cmp %%g7, %%g1\n\t" - "membar #StoreLoad | #StoreStore\n\t" "bne,pn %%xcc, 1b\n\t" " nop\n" "2:" diff --git a/arch/sparc64/mm/tsb.c b/arch/sparc64/mm/tsb.c index 587f8efb2e05..f0282fad632a 100644 --- a/arch/sparc64/mm/tsb.c +++ b/arch/sparc64/mm/tsb.c @@ -41,10 +41,8 @@ void flush_tsb_kernel_range(unsigned long start, unsigned long end) KERNEL_TSB_NENTRIES); struct tsb *ent = &swapper_tsb[hash]; - if (tag_compare(ent->tag, v)) { + if (tag_compare(ent->tag, v)) ent->tag = (1UL << TSB_TAG_INVALID_BIT); - membar_storeload_storestore(); - } } } diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S index 86773e89dc1b..e4c146f7c7e9 100644 --- a/arch/sparc64/mm/ultra.S +++ b/arch/sparc64/mm/ultra.S @@ -125,7 +125,6 @@ __spitfire_flush_tlb_mm_slow: .align 32 .globl __flush_icache_page __flush_icache_page: /* %o0 = phys_page */ - membar #StoreStore srlx %o0, PAGE_SHIFT, %o0 sethi %uhi(PAGE_OFFSET), %g1 sllx %o0, PAGE_SHIFT, %o0 @@ -507,7 +506,6 @@ xcall_fetch_glob_regs: sllx %g2, TRAP_BLOCK_SZ_SHIFT, %g2 add %g7, %g2, %g7 ldx [%g7 + TRAP_PER_CPU_THREAD], %g3 - membar #StoreStore stx %g3, [%g1 + GR_SNAP_THREAD] retry From 5bb28a57a248c0bd4316f54c3e7129933cf146d0 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 15 Nov 2008 13:39:18 -0800 Subject: [PATCH 05/98] sparc: unify Kconfig.debug Let sparc and sparc64 use the same Kconfig.debug Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Kconfig.debug | 26 ++++++++++++++++++++++ arch/sparc64/Kconfig | 2 +- arch/sparc64/Kconfig.debug | 44 -------------------------------------- 3 files changed, 27 insertions(+), 45 deletions(-) delete mode 100644 arch/sparc64/Kconfig.debug diff --git a/arch/sparc/Kconfig.debug b/arch/sparc/Kconfig.debug index 87dd496f15eb..b8a15e271bfa 100644 --- a/arch/sparc/Kconfig.debug +++ b/arch/sparc/Kconfig.debug @@ -15,4 +15,30 @@ config DEBUG_STACK_USAGE This option will slow down process creation somewhat. +config DEBUG_DCFLUSH + bool "D-cache flush debugging" + depends on SPARC64 && DEBUG_KERNEL + +config STACK_DEBUG + bool "Stack Overflow Detection Support" + +config DEBUG_PAGEALLOC + bool "Debug page memory allocations" + depends on SPARC64 && DEBUG_KERNEL && !HIBERNATION + help + Unmap pages from the kernel linear mapping after free_pages(). + This results in a large slowdown, but helps to find certain types + of memory corruptions. + +config MCOUNT + bool + depends on SPARC64 + depends on STACK_DEBUG || FUNCTION_TRACER + default y + +config FRAME_POINTER + bool + depends on MCOUNT + default y + endmenu diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 3b96e70b4670..422c2b1c3da2 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig @@ -424,7 +424,7 @@ source "drivers/sbus/char/Kconfig" source "fs/Kconfig" -source "arch/sparc64/Kconfig.debug" +source "arch/sparc/Kconfig.debug" source "security/Kconfig" diff --git a/arch/sparc64/Kconfig.debug b/arch/sparc64/Kconfig.debug deleted file mode 100644 index c40515c06690..000000000000 --- a/arch/sparc64/Kconfig.debug +++ /dev/null @@ -1,44 +0,0 @@ -menu "Kernel hacking" - -config TRACE_IRQFLAGS_SUPPORT - bool - default y - -source "lib/Kconfig.debug" - -config DEBUG_STACK_USAGE - bool "Enable stack utilization instrumentation" - depends on DEBUG_KERNEL - help - Enables the display of the minimum amount of free stack which each - task has ever had available in the sysrq-T and sysrq-P debug output. - - This option will slow down process creation somewhat. - -config DEBUG_DCFLUSH - bool "D-cache flush debugging" - depends on DEBUG_KERNEL - -config STACK_DEBUG - depends on DEBUG_KERNEL - bool "Stack Overflow Detection Support" - -config DEBUG_PAGEALLOC - bool "Debug page memory allocations" - depends on DEBUG_KERNEL && !HIBERNATION - help - Unmap pages from the kernel linear mapping after free_pages(). - This results in a large slowdown, but helps to find certain types - of memory corruptions. - -config MCOUNT - bool - depends on STACK_DEBUG || FUNCTION_TRACER - default y - -config FRAME_POINTER - bool - depends on MCOUNT - default y - -endmenu From 35da3e39149ef58cedd04eb00b11ce2d3460cc02 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 15 Nov 2008 13:40:12 -0800 Subject: [PATCH 06/98] sparc: refactor Kconfig a little Mode declaration of SPARC up in the top to match the structure of sparc64 Kconfig Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 47 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index e594559c8dba..c83f6f036337 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -4,6 +4,30 @@ mainmenu "Linux/SPARC Kernel Configuration" +config SPARC + bool + default y + select HAVE_IDE + select HAVE_OPROFILE + select HAVE_ARCH_KGDB if !SMP + select HAVE_ARCH_TRACEHOOK + select ARCH_WANT_OPTIONAL_GPIOLIB + select RTC_CLASS + select RTC_DRV_M48T59 + +# Identify this as a Sparc32 build +config SPARC32 + bool + default y + help + SPARC is a family of RISC microprocessors designed and marketed by + Sun Microsystems, incorporated. They are very widely found in Sun + workstations and clones. This port covers the original 32-bit SPARC; + it is old and stable and usually considered one of the "big three" + along with the Intel and Alpha ports. The UltraLinux project + maintains both the SPARC32 and SPARC64 ports; its web page is + available at . + config MMU bool default y @@ -69,29 +93,6 @@ config NR_CPUS depends on SMP default "32" -config SPARC - bool - default y - select HAVE_IDE - select HAVE_OPROFILE - select HAVE_ARCH_KGDB if !SMP - select HAVE_ARCH_TRACEHOOK - select ARCH_WANT_OPTIONAL_GPIOLIB - select RTC_CLASS - select RTC_DRV_M48T59 - -# Identify this as a Sparc32 build -config SPARC32 - bool - default y - help - SPARC is a family of RISC microprocessors designed and marketed by - Sun Microsystems, incorporated. They are very widely found in Sun - workstations and clones. This port covers the original 32-bit SPARC; - it is old and stable and usually considered one of the "big three" - along with the Intel and Alpha ports. The UltraLinux project - maintains both the SPARC32 and SPARC64 ports; its web page is - available at . # Global things across all Sun machines. config ISA From b498e42498ba707bf18fd91ab0485f22b5c22a26 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 15 Nov 2008 13:41:31 -0800 Subject: [PATCH 07/98] sparc64: added more config options to the menus moved a few config entries inside a menu so we do not clutter the first screen up with a lot of detailed config options. The structure now remotely resemble the structure for i386 Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc64/Kconfig | 80 +++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 38 deletions(-) diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 422c2b1c3da2..4263e5e2a38d 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig @@ -250,8 +250,6 @@ config HUGETLB_PAGE_SIZE_64K endchoice -endmenu - config NUMA bool "NUMA support" depends on SMP @@ -285,6 +283,46 @@ config ARCH_SPARSEMEM_DEFAULT source "mm/Kconfig" +config SCHED_SMT + bool "SMT (Hyperthreading) scheduler support" + depends on SMP + default y + help + SMT scheduler support improves the CPU scheduler's decision making + when dealing with SPARC cpus at a cost of slightly increased overhead + in some places. If unsure say N here. + +config SCHED_MC + bool "Multi-core scheduler support" + depends on SMP + default y + help + Multi-core scheduler support improves the CPU scheduler's decision + making when dealing with multi-core CPU chips at a cost of slightly + increased overhead in some places. If unsure say N here. + +source "kernel/Kconfig.preempt" + +config CMDLINE_BOOL + bool "Default bootloader kernel arguments" + +config CMDLINE + string "Initial kernel command string" + depends on CMDLINE_BOOL + default "console=ttyS0,9600 root=/dev/sda1" + help + Say Y here if you want to be able to pass default arguments to + the kernel. This will be overridden by the bootloader, if you + use one (such as SILO). This is most useful if you want to boot + a kernel from TFTP, and want default options to be available + with having them passed on the command line. + + NOTE: This option WILL override the PROM bootargs setting! + +endmenu + +menu "Bus options (PCI etc.)" + config ISA bool @@ -364,6 +402,8 @@ config SUN_OPENPROMFS To compile the /proc/openprom support as a module, choose M here: the module will be called openpromfs. If unsure, choose M. +endmenu + menu "Executable file formats" source "fs/Kconfig.binfmt" @@ -380,42 +420,6 @@ config SYSVIPC_COMPAT endmenu -config SCHED_SMT - bool "SMT (Hyperthreading) scheduler support" - depends on SMP - default y - help - SMT scheduler support improves the CPU scheduler's decision making - when dealing with SPARC cpus at a cost of slightly increased overhead - in some places. If unsure say N here. - -config SCHED_MC - bool "Multi-core scheduler support" - depends on SMP - default y - help - Multi-core scheduler support improves the CPU scheduler's decision - making when dealing with multi-core CPU chips at a cost of slightly - increased overhead in some places. If unsure say N here. - -source "kernel/Kconfig.preempt" - -config CMDLINE_BOOL - bool "Default bootloader kernel arguments" - -config CMDLINE - string "Initial kernel command string" - depends on CMDLINE_BOOL - default "console=ttyS0,9600 root=/dev/sda1" - help - Say Y here if you want to be able to pass default arguments to - the kernel. This will be overridden by the bootloader, if you - use one (such as SILO). This is most useful if you want to boot - a kernel from TFTP, and want default options to be available - with having them passed on the command line. - - NOTE: This option WILL override the PROM bootargs setting! - source "net/Kconfig" source "drivers/Kconfig" From 655ab9940e6a6c50ef21d466b0f8af506026c22a Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 15 Nov 2008 13:42:31 -0800 Subject: [PATCH 08/98] sparc: drop UNIX98_PTYS from arch Kconfig We have it in drivers/char/Kconfig There is no need to ask twice Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index c83f6f036337..d460fc51d546 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -260,40 +260,6 @@ source "drivers/Kconfig" source "drivers/sbus/char/Kconfig" -# This one must be before the filesystem configs. -DaveM - -menu "Unix98 PTY support" - -config UNIX98_PTYS - bool "Unix98 PTY support" - ---help--- - A pseudo terminal (PTY) is a software device consisting of two - halves: a master and a slave. The slave device behaves identical to - a physical terminal; the master device is used by a process to - read data from and write data to the slave, thereby emulating a - terminal. Typical programs for the master side are telnet servers - and xterms. - - Linux has traditionally used the BSD-like names /dev/ptyxx for - masters and /dev/ttyxx for slaves of pseudo terminals. This scheme - has a number of problems. The GNU C library glibc 2.1 and later, - however, supports the Unix98 naming standard: in order to acquire a - pseudo terminal, a process opens /dev/ptmx; the number of the pseudo - terminal is then made available to the process and the pseudo - terminal slave can be accessed as /dev/pts/. What was - traditionally /dev/ttyp2 will then be /dev/pts/2, for example. - - The entries in /dev/pts/ are created on the fly by a virtual - file system; therefore, if you say Y here you should say Y to - "/dev/pts file system for Unix98 PTYs" as well. - - If you want to say Y here, you need to have the C library glibc 2.1 - or later (equal to libc-6.1, check with "ls -l /lib/libc.so.*"). - Read the instructions in pertaining to - pseudo terminals. It's safe to say N. - -endmenu - source "fs/Kconfig" source "arch/sparc/Kconfig.debug" From 71899704d66b7ce43e31e0f19e792292ff0684aa Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 15 Nov 2008 13:43:13 -0800 Subject: [PATCH 09/98] sparc: use Kconfig.hz We already has the proper definition in place in param.h. So use the common Kconfig.hz file Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index d460fc51d546..3ff77f81bd83 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -55,10 +55,6 @@ config ARCH_NO_VIRT_TO_BUS config OF def_bool y -config HZ - int - default 100 - source "init/Kconfig" source "kernel/Kconfig.freezer" @@ -93,6 +89,7 @@ config NR_CPUS depends on SMP default "32" +source "kernel/Kconfig.hz" # Global things across all Sun machines. config ISA From 12e271a84ece4fcdeb2554ad4dae0ab500939332 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 15 Nov 2008 13:43:49 -0800 Subject: [PATCH 10/98] sparc: add menu "Executable file formats" This is what we use in sparc64 - make sparc equal Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 3ff77f81bd83..0a2062eb15a1 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -245,12 +245,16 @@ config SPARC_LED by reading /proc/led and its blinking mode can be changed via writes to /proc/led -source "fs/Kconfig.binfmt" - source "mm/Kconfig" endmenu +menu "Executable file formats" + +source "fs/Kconfig.binfmt" + +endmenu + source "net/Kconfig" source "drivers/Kconfig" From 4b27e0e1189c605a89418754fac93a74a3434c31 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 15 Nov 2008 13:44:31 -0800 Subject: [PATCH 11/98] sparc: add "Bus options" to Kconfig To align with sparc64 add a "Bus options" menu This has the additiona advantage that all bus options are kept together Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 128 ++++++++++++++++++++++++--------------------- 1 file changed, 67 insertions(+), 61 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 0a2062eb15a1..61a3a0c5cd0b 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -92,50 +92,6 @@ config NR_CPUS source "kernel/Kconfig.hz" # Global things across all Sun machines. -config ISA - bool - help - ISA is found on Espresso only and is not supported currently. - Say N - -config EISA - bool - help - EISA is not supported. - Say N - -config MCA - bool - help - MCA is not supported. - Say N - -config PCMCIA - tristate - ---help--- - Say Y here if you want to attach PCMCIA- or PC-cards to your Linux - computer. These are credit-card size devices such as network cards, - modems or hard drives often used with laptops computers. There are - actually two varieties of these cards: the older 16 bit PCMCIA cards - and the newer 32 bit CardBus cards. If you want to use CardBus - cards, you need to say Y here and also to "CardBus support" below. - - To use your PC-cards, you will need supporting software from David - Hinds' pcmcia-cs package (see the file - for location). Please also read the PCMCIA-HOWTO, available from - . - - To compile this driver as modules, choose M here: the - modules will be called pcmcia_core and ds. - -config SBUS - bool - default y - -config SBUSCHAR - bool - default y - config SERIAL_CONSOLE bool default y @@ -159,14 +115,6 @@ config SERIAL_CONSOLE If unsure, say N. -config SUN_AUXIO - bool - default y - -config SUN_IO - bool - default y - config RWSEM_GENERIC_SPINLOCK bool default y @@ -212,6 +160,73 @@ config SUN_PM Enable power management and CPU standby features on supported SPARC platforms. +config SPARC_LED + tristate "Sun4m LED driver" + help + This driver toggles the front-panel LED on sun4m systems + in a user-specifiable manner. Its state can be probed + by reading /proc/led and its blinking mode can be changed + via writes to /proc/led + +source "mm/Kconfig" + +endmenu + +menu "Bus options (PCI etc.)" +config ISA + bool + help + ISA is found on Espresso only and is not supported currently. + +config ISAPNP + bool + help + ISAPNP is not supported + +config EISA + bool + help + EISA is not supported. + +config MCA + bool + help + MCA is not supported. + +config PCMCIA + tristate + ---help--- + Say Y here if you want to attach PCMCIA- or PC-cards to your Linux + computer. These are credit-card size devices such as network cards, + modems or hard drives often used with laptops computers. There are + actually two varieties of these cards: the older 16 bit PCMCIA cards + and the newer 32 bit CardBus cards. If you want to use CardBus + cards, you need to say Y here and also to "CardBus support" below. + + To use your PC-cards, you will need supporting software from David + Hinds' pcmcia-cs package (see the file + for location). Please also read the PCMCIA-HOWTO, available from + . + + To compile this driver as modules, choose M here: the + modules will be called pcmcia_core and ds. + +config SBUS + bool + default y + +config SBUSCHAR + bool + default y + +config SUN_AUXIO + bool + default y + +config SUN_IO + bool + default y + config PCI bool "Support for PCI and PS/2 keyboard/mouse" help @@ -237,15 +252,6 @@ config SUN_OPENPROMFS Only choose N if you know in advance that you will not need to modify OpenPROM settings on the running system. -config SPARC_LED - tristate "Sun4m LED driver" - help - This driver toggles the front-panel LED on sun4m systems - in a user-specifiable manner. Its state can be probed - by reading /proc/led and its blinking mode can be changed - via writes to /proc/led - -source "mm/Kconfig" endmenu From 26b4c912185a8902b0990166892d53be78ef8cfc Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 16 Nov 2008 20:01:17 -0800 Subject: [PATCH 12/98] sparc,sparc64: unify Kconfig files Merge all of sparc64 Kconfig to sparc Kconfig. The merge was checked by: - visual inspection in menuconfig - result of allnoconfig, allmodconfig, allyesconfig was checked before and after - result of a number of randconfig was checked before and after scripts/diffconfig was used to check if the config differed before and after The validity of the test was checked by on purpose introducing a few bugs - and they were all caught by first run. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 399 ++++++++++++++++++++++++++++++++------- arch/sparc64/Kconfig | 438 +------------------------------------------ 2 files changed, 335 insertions(+), 502 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 61a3a0c5cd0b..41c4cd2c81bd 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -9,7 +9,7 @@ config SPARC default y select HAVE_IDE select HAVE_OPROFILE - select HAVE_ARCH_KGDB if !SMP + select HAVE_ARCH_KGDB if !SMP || SPARC64 select HAVE_ARCH_TRACEHOOK select ARCH_WANT_OPTIONAL_GPIOLIB select RTC_CLASS @@ -18,7 +18,7 @@ config SPARC # Identify this as a Sparc32 build config SPARC32 bool - default y + default y if ARCH = "sparc" help SPARC is a family of RISC microprocessors designed and marketed by Sun Microsystems, incorporated. They are very widely found in Sun @@ -28,21 +28,76 @@ config SPARC32 maintains both the SPARC32 and SPARC64 ports; its web page is available at . +config SPARC64 + bool + default y if ARCH = "sparc64" + select HAVE_FUNCTION_TRACER + select HAVE_KRETPROBES + select HAVE_KPROBES + select HAVE_LMB + select USE_GENERIC_SMP_HELPERS if SMP + select RTC_DRV_CMOS + select RTC_DRV_BQ4802 + select RTC_DRV_SUN4V + select RTC_DRV_STARFIRE + +config 64BIT + def_bool y if SPARC64 + +config GENERIC_TIME + bool + default y if SPARC64 + +config GENERIC_CMOS_UPDATE + bool + default y if SPARC64 + +config GENERIC_CLOCKEVENTS + bool + default y if SPARC64 + +config IOMMU_HELPER + bool + default y if SPARC64 + +config QUICKLIST + bool + default y if SPARC64 + +config STACKTRACE_SUPPORT + bool + default y if SPARC64 + +config LOCKDEP_SUPPORT + bool + default y if SPARC64 + +config AUDIT_ARCH + bool + default y if SPARC64 + +config HAVE_SETUP_PER_CPU_AREA + def_bool y if SPARC64 + +config GENERIC_HARDIRQS_NO__DO_IRQ + bool + def_bool y if SPARC64 + config MMU bool default y config HIGHMEM bool - default y + default y if SPARC32 config ZONE_DMA bool - default y + default y if SPARC32 config GENERIC_ISA_DMA bool - default y + default y if SPARC32 config GENERIC_GPIO bool @@ -59,7 +114,7 @@ source "init/Kconfig" source "kernel/Kconfig.freezer" -menu "General machine setup" +menu "Processor type and features" config SMP bool "Symmetric multi-processing support (does not work on sun4/sun4c)" @@ -84,16 +139,258 @@ config SMP If you don't know what to do here, say N. config NR_CPUS - int "Maximum number of CPUs (2-32)" - range 2 32 + int "Maximum number of CPUs" depends on SMP - default "32" + range 2 32 if SPARC32 + range 2 1024 if SPARC64 + default 32 if SPARC32 + default 64 if SPARC64 -source "kernel/Kconfig.hz" +source kernel/Kconfig.hz + +config RWSEM_GENERIC_SPINLOCK + bool + default y if SPARC32 + +config RWSEM_XCHGADD_ALGORITHM + bool + default y if SPARC64 + +config GENERIC_FIND_NEXT_BIT + bool + default y + +config GENERIC_HWEIGHT + bool + default y if !ULTRA_HAS_POPULATION_COUNT + +config GENERIC_CALIBRATE_DELAY + bool + default y + +config ARCH_MAY_HAVE_PC_FDC + bool + default y + +config ARCH_HAS_ILOG2_U32 + bool + default n + +config ARCH_HAS_ILOG2_U64 + bool + default n + +config EMULATED_CMPXCHG + bool + default y if SPARC32 + help + Sparc32 does not have a CAS instruction like sparc64. cmpxchg() + is emulated, and therefore it is not completely atomic. + +choice + prompt "Kernel page size" if SPARC64 + default SPARC64_PAGE_SIZE_8KB + +config SPARC64_PAGE_SIZE_8KB + bool "8KB" + help + This lets you select the page size of the kernel. + + 8KB and 64KB work quite well, since SPARC ELF sections + provide for up to 64KB alignment. + + If you don't know what to do, choose 8KB. + +config SPARC64_PAGE_SIZE_64KB + bool "64KB" + +endchoice + +config SECCOMP + bool "Enable seccomp to safely compute untrusted bytecode" + depends on SPARC64 && PROC_FS + default y + help + This kernel feature is useful for number crunching applications + that may need to compute untrusted bytecode during their + execution. By using pipes or other transports made available to + the process as file descriptors supporting the read/write + syscalls, it's possible to isolate those applications in + their own address space using seccomp. Once seccomp is + enabled via /proc//seccomp, it cannot be disabled + and the task is only allowed to execute a few safe syscalls + defined by each seccomp mode. + + If unsure, say Y. Only embedded should say N here. + +config HOTPLUG_CPU + bool "Support for hot-pluggable CPUs" + depends on SPARC64 && SMP + select HOTPLUG + help + Say Y here to experiment with turning CPUs off and on. CPUs + can be controlled through /sys/devices/system/cpu/cpu#. + Say N if you want to disable CPU hotplug. + +config GENERIC_HARDIRQS + bool + default y if SPARC64 + +source "kernel/time/Kconfig" + +if SPARC64 +source "drivers/cpufreq/Kconfig" + +config US3_FREQ + tristate "UltraSPARC-III CPU Frequency driver" + depends on CPU_FREQ + select CPU_FREQ_TABLE + help + This adds the CPUFreq driver for UltraSPARC-III processors. + + For details, take a look at . + + If in doubt, say N. + +config US2E_FREQ + tristate "UltraSPARC-IIe CPU Frequency driver" + depends on CPU_FREQ + select CPU_FREQ_TABLE + help + This adds the CPUFreq driver for UltraSPARC-IIe processors. + + For details, take a look at . + + If in doubt, say N. + +endif + +config US3_MC + tristate "UltraSPARC-III Memory Controller driver" + depends on SPARC64 + default y + help + This adds a driver for the UltraSPARC-III memory controller. + Loading this driver allows exact mnemonic strings to be + printed in the event of a memory error, so that the faulty DIMM + on the motherboard can be matched to the error. + + If in doubt, say Y, as this information can be very useful. # Global things across all Sun machines. +config GENERIC_LOCKBREAK + bool + default y + depends on SPARC64 && SMP && PREEMPT + +choice + prompt "SPARC64 Huge TLB Page Size" + depends on SPARC64 && HUGETLB_PAGE + default HUGETLB_PAGE_SIZE_4MB + +config HUGETLB_PAGE_SIZE_4MB + bool "4MB" + +config HUGETLB_PAGE_SIZE_512K + bool "512K" + +config HUGETLB_PAGE_SIZE_64K + depends on !SPARC64_PAGE_SIZE_64KB + bool "64K" + +endchoice + +config NUMA + bool "NUMA support" + depends on SPARC64 && SMP + +config NODES_SHIFT + int + default "4" + depends on NEED_MULTIPLE_NODES + +# Some NUMA nodes have memory ranges that span +# other nodes. Even though a pfn is valid and +# between a node's start and end pfns, it may not +# reside on that node. See memmap_init_zone() +# for details. +config NODES_SPAN_OTHER_NODES + def_bool y + depends on NEED_MULTIPLE_NODES + +config ARCH_POPULATES_NODE_MAP + def_bool y if SPARC64 + +config ARCH_SELECT_MEMORY_MODEL + def_bool y if SPARC64 + +config ARCH_SPARSEMEM_ENABLE + def_bool y if SPARC64 + select SPARSEMEM_VMEMMAP_ENABLE + +config ARCH_SPARSEMEM_DEFAULT + def_bool y if SPARC64 + +source "mm/Kconfig" + +config SCHED_SMT + bool "SMT (Hyperthreading) scheduler support" + depends on SPARC64 && SMP + default y + help + SMT scheduler support improves the CPU scheduler's decision making + when dealing with SPARC cpus at a cost of slightly increased overhead + in some places. If unsure say N here. + +config SCHED_MC + bool "Multi-core scheduler support" + depends on SPARC64 && SMP + default y + help + Multi-core scheduler support improves the CPU scheduler's decision + making when dealing with multi-core CPU chips at a cost of slightly + increased overhead in some places. If unsure say N here. + +if SPARC64 +source "kernel/Kconfig.preempt" +endif + +config CMDLINE_BOOL + bool "Default bootloader kernel arguments" + depends on SPARC64 + +config CMDLINE + string "Initial kernel command string" + depends on CMDLINE_BOOL + default "console=ttyS0,9600 root=/dev/sda1" + help + Say Y here if you want to be able to pass default arguments to + the kernel. This will be overridden by the bootloader, if you + use one (such as SILO). This is most useful if you want to boot + a kernel from TFTP, and want default options to be available + with having them passed on the command line. + + NOTE: This option WILL override the PROM bootargs setting! + +config SUN_PM + bool + default y if SPARC32 + help + Enable power management and CPU standby features on supported + SPARC platforms. + +config SPARC_LED + tristate "Sun4m LED driver" + depends on SPARC32 + help + This driver toggles the front-panel LED on sun4m systems + in a user-specifiable manner. Its state can be probed + by reading /proc/led and its blinking mode can be changed + via writes to /proc/led + config SERIAL_CONSOLE bool + depends on SPARC32 default y ---help--- If you say Y here, it will be possible to use a serial port as the @@ -115,61 +412,6 @@ config SERIAL_CONSOLE If unsure, say N. -config RWSEM_GENERIC_SPINLOCK - bool - default y - -config RWSEM_XCHGADD_ALGORITHM - bool - -config GENERIC_FIND_NEXT_BIT - bool - default y - -config GENERIC_HWEIGHT - bool - default y - -config GENERIC_CALIBRATE_DELAY - bool - default y - -config ARCH_MAY_HAVE_PC_FDC - bool - default y - -config ARCH_HAS_ILOG2_U32 - bool - default n - -config ARCH_HAS_ILOG2_U64 - bool - default n - -config EMULATED_CMPXCHG - bool - default y - help - Sparc32 does not have a CAS instruction like sparc64. cmpxchg() - is emulated, and therefore it is not completely atomic. - -config SUN_PM - bool - default y - help - Enable power management and CPU standby features on supported - SPARC platforms. - -config SPARC_LED - tristate "Sun4m LED driver" - help - This driver toggles the front-panel LED on sun4m systems - in a user-specifiable manner. Its state can be probed - by reading /proc/led and its blinking mode can be changed - via writes to /proc/led - -source "mm/Kconfig" - endmenu menu "Bus options (PCI etc.)" @@ -227,13 +469,29 @@ config SUN_IO bool default y +config SUN_LDOMS + bool "Sun Logical Domains support" + depends on SPARC64 + help + Say Y here is you want to support virtual devices via + Logical Domains. + config PCI bool "Support for PCI and PS/2 keyboard/mouse" + select ARCH_SUPPORTS_MSI if SPARC64 help + Find out whether your system includes a PCI bus. PCI is the name of + a bus system, i.e. the way the CPU talks to the other stuff inside + your box. If you say Y here, the kernel will include drivers and + infrastructure code to support PCI bus devices. + CONFIG_PCI is needed for all JavaStation's (including MrCoffee), CP-1200, JavaEngine-1, Corona, Red October, and Serengeti SGSC. All of these platforms are extremely obscure, so say N if unsure. +config PCI_DOMAINS + def_bool PCI if SPARC64 + config PCI_SYSCALL def_bool PCI @@ -259,6 +517,17 @@ menu "Executable file formats" source "fs/Kconfig.binfmt" +config COMPAT + bool + depends on SPARC64 + default y + select COMPAT_BINFMT_ELF + +config SYSVIPC_COMPAT + bool + depends on COMPAT && SYSVIPC + default y + endmenu source "net/Kconfig" diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 4263e5e2a38d..caa9421d598a 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig @@ -1,437 +1 @@ -# sparc64 configuration -mainmenu "Linux Kernel Configuration for 64-bit SPARC" - -config SPARC - bool - default y - select HAVE_OPROFILE - select HAVE_KPROBES - select HAVE_KRETPROBES - -config SPARC64 - bool - default y - select HAVE_FUNCTION_TRACER - select HAVE_IDE - select HAVE_LMB - select HAVE_ARCH_KGDB - select USE_GENERIC_SMP_HELPERS if SMP - select HAVE_ARCH_TRACEHOOK - select ARCH_WANT_OPTIONAL_GPIOLIB - select RTC_CLASS - select RTC_DRV_M48T59 - select RTC_DRV_CMOS - select RTC_DRV_BQ4802 - select RTC_DRV_SUN4V - select RTC_DRV_STARFIRE - -config GENERIC_TIME - bool - default y - -config GENERIC_CMOS_UPDATE - bool - default y - -config GENERIC_CLOCKEVENTS - bool - default y - -config GENERIC_GPIO - bool - help - Generic GPIO API support - -config 64BIT - def_bool y - -config MMU - bool - default y - -config IOMMU_HELPER - bool - default y - -config QUICKLIST - bool - default y - -config STACKTRACE_SUPPORT - bool - default y - -config LOCKDEP_SUPPORT - bool - default y - -config ARCH_MAY_HAVE_PC_FDC - bool - default y - -config ARCH_HAS_ILOG2_U32 - bool - default n - -config ARCH_HAS_ILOG2_U64 - bool - default n - -config AUDIT_ARCH - bool - default y - -config HAVE_SETUP_PER_CPU_AREA - def_bool y - -config ARCH_NO_VIRT_TO_BUS - def_bool y - -config OF - def_bool y - -config GENERIC_HARDIRQS_NO__DO_IRQ - bool - def_bool y - -source "init/Kconfig" -source "kernel/Kconfig.freezer" - -menu "Processor type and features" - -choice - prompt "Kernel page size" - default SPARC64_PAGE_SIZE_8KB - -config SPARC64_PAGE_SIZE_8KB - bool "8KB" - help - This lets you select the page size of the kernel. - - 8KB and 64KB work quite well, since SPARC ELF sections - provide for up to 64KB alignment. - - If you don't know what to do, choose 8KB. - -config SPARC64_PAGE_SIZE_64KB - bool "64KB" - -endchoice - -config SECCOMP - bool "Enable seccomp to safely compute untrusted bytecode" - depends on PROC_FS - default y - help - This kernel feature is useful for number crunching applications - that may need to compute untrusted bytecode during their - execution. By using pipes or other transports made available to - the process as file descriptors supporting the read/write - syscalls, it's possible to isolate those applications in - their own address space using seccomp. Once seccomp is - enabled via /proc//seccomp, it cannot be disabled - and the task is only allowed to execute a few safe syscalls - defined by each seccomp mode. - - If unsure, say Y. Only embedded should say N here. - -source kernel/Kconfig.hz - -config HOTPLUG_CPU - bool "Support for hot-pluggable CPUs" - depends on SMP - select HOTPLUG - help - Say Y here to experiment with turning CPUs off and on. CPUs - can be controlled through /sys/devices/system/cpu/cpu#. - Say N if you want to disable CPU hotplug. - -config GENERIC_HARDIRQS - bool - default y - -source "kernel/time/Kconfig" - -config SMP - bool "Symmetric multi-processing support" - help - This enables support for systems with more than one CPU. If you have - a system with only one CPU, say N. If you have a system with more than - one CPU, say Y. - - If you say N here, the kernel will run on single and multiprocessor - machines, but will use only one CPU of a multiprocessor machine. If - you say Y here, the kernel will run on single-processor machines. - On a single-processor machine, the kernel will run faster if you say - N here. - - If you don't know what to do here, say N. - -config NR_CPUS - int "Maximum number of CPUs (2-1024)" - range 2 1024 - depends on SMP - default "64" - -source "drivers/cpufreq/Kconfig" - -config US3_FREQ - tristate "UltraSPARC-III CPU Frequency driver" - depends on CPU_FREQ - select CPU_FREQ_TABLE - help - This adds the CPUFreq driver for UltraSPARC-III processors. - - For details, take a look at . - - If in doubt, say N. - -config US2E_FREQ - tristate "UltraSPARC-IIe CPU Frequency driver" - depends on CPU_FREQ - select CPU_FREQ_TABLE - help - This adds the CPUFreq driver for UltraSPARC-IIe processors. - - For details, take a look at . - - If in doubt, say N. - -config US3_MC - tristate "UltraSPARC-III Memory Controller driver" - default y - help - This adds a driver for the UltraSPARC-III memory controller. - Loading this driver allows exact mnemonic strings to be - printed in the event of a memory error, so that the faulty DIMM - on the motherboard can be matched to the error. - - If in doubt, say Y, as this information can be very useful. - -# Global things across all Sun machines. -config GENERIC_LOCKBREAK - bool - default y - depends on SMP && PREEMPT - -config RWSEM_GENERIC_SPINLOCK - bool - -config RWSEM_XCHGADD_ALGORITHM - bool - default y - -config GENERIC_FIND_NEXT_BIT - bool - default y - -config GENERIC_HWEIGHT - bool - default y if !ULTRA_HAS_POPULATION_COUNT - -config GENERIC_CALIBRATE_DELAY - bool - default y - -choice - prompt "SPARC64 Huge TLB Page Size" - depends on HUGETLB_PAGE - default HUGETLB_PAGE_SIZE_4MB - -config HUGETLB_PAGE_SIZE_4MB - bool "4MB" - -config HUGETLB_PAGE_SIZE_512K - bool "512K" - -config HUGETLB_PAGE_SIZE_64K - depends on !SPARC64_PAGE_SIZE_64KB - bool "64K" - -endchoice - -config NUMA - bool "NUMA support" - depends on SMP - -config NODES_SHIFT - int - default "4" - depends on NEED_MULTIPLE_NODES - -# Some NUMA nodes have memory ranges that span -# other nodes. Even though a pfn is valid and -# between a node's start and end pfns, it may not -# reside on that node. See memmap_init_zone() -# for details. -config NODES_SPAN_OTHER_NODES - def_bool y - depends on NEED_MULTIPLE_NODES - -config ARCH_POPULATES_NODE_MAP - def_bool y - -config ARCH_SELECT_MEMORY_MODEL - def_bool y - -config ARCH_SPARSEMEM_ENABLE - def_bool y - select SPARSEMEM_VMEMMAP_ENABLE - -config ARCH_SPARSEMEM_DEFAULT - def_bool y - -source "mm/Kconfig" - -config SCHED_SMT - bool "SMT (Hyperthreading) scheduler support" - depends on SMP - default y - help - SMT scheduler support improves the CPU scheduler's decision making - when dealing with SPARC cpus at a cost of slightly increased overhead - in some places. If unsure say N here. - -config SCHED_MC - bool "Multi-core scheduler support" - depends on SMP - default y - help - Multi-core scheduler support improves the CPU scheduler's decision - making when dealing with multi-core CPU chips at a cost of slightly - increased overhead in some places. If unsure say N here. - -source "kernel/Kconfig.preempt" - -config CMDLINE_BOOL - bool "Default bootloader kernel arguments" - -config CMDLINE - string "Initial kernel command string" - depends on CMDLINE_BOOL - default "console=ttyS0,9600 root=/dev/sda1" - help - Say Y here if you want to be able to pass default arguments to - the kernel. This will be overridden by the bootloader, if you - use one (such as SILO). This is most useful if you want to boot - a kernel from TFTP, and want default options to be available - with having them passed on the command line. - - NOTE: This option WILL override the PROM bootargs setting! - -endmenu - -menu "Bus options (PCI etc.)" - -config ISA - bool - -config ISAPNP - bool - -config EISA - bool - -config MCA - bool - -config PCMCIA - tristate - help - Say Y here if you want to attach PCMCIA- or PC-cards to your Linux - computer. These are credit-card size devices such as network cards, - modems or hard drives often used with laptops computers. There are - actually two varieties of these cards: the older 16 bit PCMCIA cards - and the newer 32 bit CardBus cards. If you want to use CardBus - cards, you need to say Y here and also to "CardBus support" below. - - To use your PC-cards, you will need supporting software from David - Hinds' pcmcia-cs package (see the file - for location). Please also read the PCMCIA-HOWTO, available from - . - - To compile this driver as modules, choose M here: the - modules will be called pcmcia_core and ds. - -config SBUS - bool - default y - -config SBUSCHAR - bool - default y - -config SUN_AUXIO - bool - default y - -config SUN_IO - bool - default y - -config SUN_LDOMS - bool "Sun Logical Domains support" - help - Say Y here is you want to support virtual devices via - Logical Domains. - -config PCI - bool "PCI support" - select ARCH_SUPPORTS_MSI - help - Find out whether your system includes a PCI bus. PCI is the name of - a bus system, i.e. the way the CPU talks to the other stuff inside - your box. If you say Y here, the kernel will include drivers and - infrastructure code to support PCI bus devices. - -config PCI_DOMAINS - def_bool PCI - -config PCI_SYSCALL - def_bool PCI - -source "drivers/pci/Kconfig" - -config SUN_OPENPROMFS - tristate "Openprom tree appears in /proc/openprom" - help - If you say Y, the OpenPROM device tree will be available as a - virtual file system, which you can mount to /proc/openprom by "mount - -t openpromfs none /proc/openprom". - - To compile the /proc/openprom support as a module, choose M here: the - module will be called openpromfs. If unsure, choose M. - -endmenu - -menu "Executable file formats" - -source "fs/Kconfig.binfmt" - -config COMPAT - bool - default y - select COMPAT_BINFMT_ELF - -config SYSVIPC_COMPAT - bool - depends on COMPAT && SYSVIPC - default y - -endmenu - -source "net/Kconfig" - -source "drivers/Kconfig" - -source "drivers/sbus/char/Kconfig" - -source "fs/Kconfig" - -source "arch/sparc/Kconfig.debug" - -source "security/Kconfig" - -source "crypto/Kconfig" - -source "lib/Kconfig" +source arch/sparc/Kconfig From b0cdd599dbbea51bfb36801f5cc5634916bc2a36 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 16 Nov 2008 20:04:20 -0800 Subject: [PATCH 13/98] sparc,sparc64: add BITS to arch Makefile BITS will be used to simplify unified Makefiles Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Makefile | 7 ++++--- arch/sparc64/Makefile | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index 9592889a6fd0..c5f3d6fe8a67 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -11,9 +11,10 @@ # Uncomment the first KBUILD_CFLAGS if you are doing kgdb source level # debugging of the kernel to get the proper debugging information. -AS := $(AS) -32 -LDFLAGS := -m elf32_sparc -CHECKFLAGS += -D__sparc__ +AS := $(AS) -32 +LDFLAGS := -m elf32_sparc +CHECKFLAGS += -D__sparc__ +export BITS := 32 #KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7 KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile index c7214abc0d84..51bc33a6ef33 100644 --- a/arch/sparc64/Makefile +++ b/arch/sparc64/Makefile @@ -12,8 +12,8 @@ CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64 # Undefine sparc when processing vmlinux.lds - it is used # And teach CPP we are doing 64 bit builds (for this case) CPPFLAGS_vmlinux.lds += -m64 -Usparc - -LDFLAGS := -m elf64_sparc +LDFLAGS := -m elf64_sparc +export BITS := 64 KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \ -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \ From d59b3706a9d71a5ffe6135b537117662a6d3d920 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 16 Nov 2008 20:05:44 -0800 Subject: [PATCH 14/98] sparc: cleanup math-emu - Drop unused assignment from Makefile - Replace EXTRA_CFLAGS with ccflags-y - Delete unused file Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/math-emu/Makefile | 6 +++--- arch/sparc/math-emu/ashldi3.S | 36 ----------------------------------- 2 files changed, 3 insertions(+), 39 deletions(-) delete mode 100644 arch/sparc/math-emu/ashldi3.S diff --git a/arch/sparc/math-emu/Makefile b/arch/sparc/math-emu/Makefile index 8136987977f4..86995d6dd0ba 100644 --- a/arch/sparc/math-emu/Makefile +++ b/arch/sparc/math-emu/Makefile @@ -2,7 +2,7 @@ # Makefile for the FPU instruction emulation. # -obj-y := math.o +# supress all warnings - as math.c produces a lot! +ccflags-y := -w -EXTRA_AFLAGS := -ansi -EXTRA_CFLAGS = -I. -Iinclude/math-emu -w +obj-y := math.o diff --git a/arch/sparc/math-emu/ashldi3.S b/arch/sparc/math-emu/ashldi3.S deleted file mode 100644 index 7230ff5c7aa1..000000000000 --- a/arch/sparc/math-emu/ashldi3.S +++ /dev/null @@ -1,36 +0,0 @@ -/* - * ashldi3.S: Math-emu code creates all kinds of references to - * this little routine on the sparc with gcc. - * - * Copyright (C) 1998 Jakub Jelinek(jj@ultra.linux.cz) - */ - -#include - - .globl C_LABEL(__ashldi3) -C_LABEL(__ashldi3): - tst %o2 - be 3f - mov 32, %g2 - - sub %g2, %o2, %g2 - - tst %g2 - bg 1f - srl %o1, %g2, %g3 - - clr %o5 - neg %g2 - ba 2f - sll %o1, %g2, %o4 - -1: - sll %o1, %o2, %o5 - srl %o0, %o2, %g2 - or %g2, %g3, %o4 -2: - mov %o4, %o0 - mov %o5, %o1 -3: - jmpl %o7 + 8, %g0 - nop From 774434bf33bdc876c2818eba34e416fe1fc7a746 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 16 Nov 2008 20:06:33 -0800 Subject: [PATCH 15/98] sparc: prepare math-emu for unification Add _32 to filenames to make them 32 bit unique Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/math-emu/Makefile | 2 +- arch/sparc/math-emu/{math.c => math_32.c} | 2 +- arch/sparc/math-emu/{sfp-util.h => sfp-util_32.h} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename arch/sparc/math-emu/{math.c => math_32.c} (99%) rename arch/sparc/math-emu/{sfp-util.h => sfp-util_32.h} (100%) diff --git a/arch/sparc/math-emu/Makefile b/arch/sparc/math-emu/Makefile index 86995d6dd0ba..b9085ecbb27b 100644 --- a/arch/sparc/math-emu/Makefile +++ b/arch/sparc/math-emu/Makefile @@ -5,4 +5,4 @@ # supress all warnings - as math.c produces a lot! ccflags-y := -w -obj-y := math.o +obj-y := math_$(BITS).o diff --git a/arch/sparc/math-emu/math.c b/arch/sparc/math-emu/math_32.c similarity index 99% rename from arch/sparc/math-emu/math.c rename to arch/sparc/math-emu/math_32.c index 8613b3eb877c..e13f65da17df 100644 --- a/arch/sparc/math-emu/math.c +++ b/arch/sparc/math-emu/math_32.c @@ -69,7 +69,7 @@ #include #include -#include "sfp-util.h" +#include "sfp-util_32.h" #include #include #include diff --git a/arch/sparc/math-emu/sfp-util.h b/arch/sparc/math-emu/sfp-util_32.h similarity index 100% rename from arch/sparc/math-emu/sfp-util.h rename to arch/sparc/math-emu/sfp-util_32.h From 5115f39c2034cb80a050d996a2a6343bce189628 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 16 Nov 2008 20:07:11 -0800 Subject: [PATCH 16/98] sparc64: unify math-emu Move relavent files to sparc/math-emu and adjust path/include accordingly. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/{sparc64/math-emu/math.c => sparc/math-emu/math_64.c} | 2 +- .../math-emu/sfp-util.h => sparc/math-emu/sfp-util_64.h} | 0 arch/sparc64/Makefile | 2 +- arch/sparc64/math-emu/Makefile | 7 ------- 4 files changed, 2 insertions(+), 9 deletions(-) rename arch/{sparc64/math-emu/math.c => sparc/math-emu/math_64.c} (99%) rename arch/{sparc64/math-emu/sfp-util.h => sparc/math-emu/sfp-util_64.h} (100%) delete mode 100644 arch/sparc64/math-emu/Makefile diff --git a/arch/sparc64/math-emu/math.c b/arch/sparc/math-emu/math_64.c similarity index 99% rename from arch/sparc64/math-emu/math.c rename to arch/sparc/math-emu/math_64.c index add053e0f3b3..6863c9bde25c 100644 --- a/arch/sparc64/math-emu/math.c +++ b/arch/sparc/math-emu/math_64.c @@ -16,7 +16,7 @@ #include #include -#include "sfp-util.h" +#include "sfp-util_64.h" #include #include #include diff --git a/arch/sparc64/math-emu/sfp-util.h b/arch/sparc/math-emu/sfp-util_64.h similarity index 100% rename from arch/sparc64/math-emu/sfp-util.h rename to arch/sparc/math-emu/sfp-util_64.h diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile index 51bc33a6ef33..e9f98ec4a69e 100644 --- a/arch/sparc64/Makefile +++ b/arch/sparc64/Makefile @@ -28,7 +28,7 @@ endif head-y := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o core-y += arch/sparc64/kernel/ arch/sparc64/mm/ -core-y += arch/sparc64/math-emu/ +core-y += arch/sparc/math-emu/ libs-y += arch/sparc64/prom/ arch/sparc64/lib/ drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/ diff --git a/arch/sparc64/math-emu/Makefile b/arch/sparc64/math-emu/Makefile deleted file mode 100644 index cc5cb9baf6aa..000000000000 --- a/arch/sparc64/math-emu/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# Makefile for the FPU instruction emulation. -# - -obj-y := math.o - -EXTRA_CFLAGS = -Iinclude/math-emu -w From 7c979c49c9882badee45c0a7a3dbca1040b7ba73 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 16 Nov 2008 20:07:42 -0800 Subject: [PATCH 17/98] sparc64: unify arch/sparc64/oprofile/ A simple: diff arch/sparc64/oprofile/init.c arch/sparc/oprofile/init.c diff arch/sparc64/oprofile/Makefile arch/sparc/oprofile/Makefile revealed that the directories were equal. So let sparc64 point to the sparc version and drop the sparc64 oprofile dir Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc64/Makefile | 2 +- arch/sparc64/oprofile/Makefile | 9 --------- arch/sparc64/oprofile/init.c | 23 ----------------------- 3 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 arch/sparc64/oprofile/Makefile delete mode 100644 arch/sparc64/oprofile/init.c diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile index e9f98ec4a69e..3dbda408572b 100644 --- a/arch/sparc64/Makefile +++ b/arch/sparc64/Makefile @@ -30,7 +30,7 @@ head-y := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o core-y += arch/sparc64/kernel/ arch/sparc64/mm/ core-y += arch/sparc/math-emu/ libs-y += arch/sparc64/prom/ arch/sparc64/lib/ -drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/ +drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/ boot := arch/sparc64/boot diff --git a/arch/sparc64/oprofile/Makefile b/arch/sparc64/oprofile/Makefile deleted file mode 100644 index e9feca1ca28b..000000000000 --- a/arch/sparc64/oprofile/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -obj-$(CONFIG_OPROFILE) += oprofile.o - -DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \ - oprof.o cpu_buffer.o buffer_sync.o \ - event_buffer.o oprofile_files.o \ - oprofilefs.o oprofile_stats.o \ - timer_int.o ) - -oprofile-y := $(DRIVER_OBJS) init.o diff --git a/arch/sparc64/oprofile/init.c b/arch/sparc64/oprofile/init.c deleted file mode 100644 index 17bb6035069b..000000000000 --- a/arch/sparc64/oprofile/init.c +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @file init.c - * - * @remark Copyright 2002 OProfile authors - * @remark Read the file COPYING - * - * @author John Levon - */ - -#include -#include -#include -#include - -int __init oprofile_arch_init(struct oprofile_operations *ops) -{ - return -ENODEV; -} - - -void oprofile_arch_exit(void) -{ -} From c37ddd936d96b46cf2bb17e7b1a18b2bd24ec1fb Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 16 Nov 2008 20:08:19 -0800 Subject: [PATCH 18/98] sparc: prepare mm/ for unification - rename files where sparc64 has similar files to _32.c - Restructure Makefile - Sneak in -Werror as we have for sparc64 Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/mm/Makefile | 20 ++++++++++++-------- arch/sparc/mm/{fault.c => fault_32.c} | 0 arch/sparc/mm/{generic.c => generic_32.c} | 0 arch/sparc/mm/{init.c => init_32.c} | 0 4 files changed, 12 insertions(+), 8 deletions(-) rename arch/sparc/mm/{fault.c => fault_32.c} (100%) rename arch/sparc/mm/{generic.c => generic_32.c} (100%) rename arch/sparc/mm/{init.c => init_32.c} (100%) diff --git a/arch/sparc/mm/Makefile b/arch/sparc/mm/Makefile index ea88955d97ff..3ad1b1f9953e 100644 --- a/arch/sparc/mm/Makefile +++ b/arch/sparc/mm/Makefile @@ -1,17 +1,21 @@ # Makefile for the linux Sparc-specific parts of the memory manager. # -EXTRA_AFLAGS := -ansi +asflags-y := -ansi +ccflags-y := -Werror -obj-y := fault.o init.o loadmmu.o generic.o extable.o btfixup.o \ - srmmu.o iommu.o io-unit.o hypersparc.o viking.o tsunami.o swift.o +obj-y := fault_$(BITS).o +obj-y += init_$(BITS).o +obj-$(CONFIG_SPARC32) += loadmmu.o +obj-y += generic_$(BITS).o +obj-$(CONFIG_SPARC32) += extable.o btfixup.o srmmu.o iommu.o io-unit.o +obj-$(CONFIG_SPARC32) += hypersparc.o viking.o tsunami.o swift.o -ifdef CONFIG_HIGHMEM -obj-y += highmem.o -endif +# Only used by sparc32 +obj-$(CONFIG_HIGHMEM) += highmem.o ifdef CONFIG_SMP -obj-y += nosun4c.o +obj-$(CONFIG_SPARC32) += nosun4c.o else -obj-y += sun4c.o +obj-$(CONFIG_SPARC32) += sun4c.o endif diff --git a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault_32.c similarity index 100% rename from arch/sparc/mm/fault.c rename to arch/sparc/mm/fault_32.c diff --git a/arch/sparc/mm/generic.c b/arch/sparc/mm/generic_32.c similarity index 100% rename from arch/sparc/mm/generic.c rename to arch/sparc/mm/generic_32.c diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init_32.c similarity index 100% rename from arch/sparc/mm/init.c rename to arch/sparc/mm/init_32.c From 27137e5285a3388e8f86d7bc5fe0ed8b92bd4624 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 16 Nov 2008 20:08:45 -0800 Subject: [PATCH 19/98] sparc,sparc64: unify mm/ - move all sparc64/mm/ files to arch/sparc/mm/ - commonly named files are named _64.c - add files to sparc/mm/Makefile preserving link order - delete now unused sparc64/mm/Makefile - sparc64 now finds mm/ in sparc Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/mm/Makefile | 6 +++++- arch/{sparc64/mm/fault.c => sparc/mm/fault_64.c} | 0 arch/{sparc64/mm/generic.c => sparc/mm/generic_64.c} | 0 arch/{sparc64 => sparc}/mm/hugetlbpage.c | 0 arch/{sparc64/mm/init.c => sparc/mm/init_64.c} | 4 ++-- arch/{sparc64/mm/init.h => sparc/mm/init_64.h} | 0 arch/{sparc64 => sparc}/mm/tlb.c | 0 arch/{sparc64 => sparc}/mm/tsb.c | 0 arch/{sparc64 => sparc}/mm/ultra.S | 0 arch/sparc64/Makefile | 2 +- arch/sparc64/mm/Makefile | 9 --------- 11 files changed, 8 insertions(+), 13 deletions(-) rename arch/{sparc64/mm/fault.c => sparc/mm/fault_64.c} (100%) rename arch/{sparc64/mm/generic.c => sparc/mm/generic_64.c} (100%) rename arch/{sparc64 => sparc}/mm/hugetlbpage.c (100%) rename arch/{sparc64/mm/init.c => sparc/mm/init_64.c} (99%) rename arch/{sparc64/mm/init.h => sparc/mm/init_64.h} (100%) rename arch/{sparc64 => sparc}/mm/tlb.c (100%) rename arch/{sparc64 => sparc}/mm/tsb.c (100%) rename arch/{sparc64 => sparc}/mm/ultra.S (100%) delete mode 100644 arch/sparc64/mm/Makefile diff --git a/arch/sparc/mm/Makefile b/arch/sparc/mm/Makefile index 3ad1b1f9953e..681abe0a4594 100644 --- a/arch/sparc/mm/Makefile +++ b/arch/sparc/mm/Makefile @@ -4,13 +4,17 @@ asflags-y := -ansi ccflags-y := -Werror -obj-y := fault_$(BITS).o +obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o +obj-y += fault_$(BITS).o obj-y += init_$(BITS).o obj-$(CONFIG_SPARC32) += loadmmu.o obj-y += generic_$(BITS).o obj-$(CONFIG_SPARC32) += extable.o btfixup.o srmmu.o iommu.o io-unit.o obj-$(CONFIG_SPARC32) += hypersparc.o viking.o tsunami.o swift.o +# Only used by sparc64 +obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o + # Only used by sparc32 obj-$(CONFIG_HIGHMEM) += highmem.o diff --git a/arch/sparc64/mm/fault.c b/arch/sparc/mm/fault_64.c similarity index 100% rename from arch/sparc64/mm/fault.c rename to arch/sparc/mm/fault_64.c diff --git a/arch/sparc64/mm/generic.c b/arch/sparc/mm/generic_64.c similarity index 100% rename from arch/sparc64/mm/generic.c rename to arch/sparc/mm/generic_64.c diff --git a/arch/sparc64/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c similarity index 100% rename from arch/sparc64/mm/hugetlbpage.c rename to arch/sparc/mm/hugetlbpage.c diff --git a/arch/sparc64/mm/init.c b/arch/sparc/mm/init_64.c similarity index 99% rename from arch/sparc64/mm/init.c rename to arch/sparc/mm/init_64.c index 4bd63968400d..6ea73da29312 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc/mm/init_64.c @@ -50,7 +50,7 @@ #include #include -#include "init.h" +#include "init_64.h" unsigned long kern_linear_pte_xor[2] __read_mostly; @@ -954,7 +954,7 @@ int of_node_to_nid(struct device_node *dp) return nid; } -static void __init add_node_ranges(void) +static void add_node_ranges(void) { int i; diff --git a/arch/sparc64/mm/init.h b/arch/sparc/mm/init_64.h similarity index 100% rename from arch/sparc64/mm/init.h rename to arch/sparc/mm/init_64.h diff --git a/arch/sparc64/mm/tlb.c b/arch/sparc/mm/tlb.c similarity index 100% rename from arch/sparc64/mm/tlb.c rename to arch/sparc/mm/tlb.c diff --git a/arch/sparc64/mm/tsb.c b/arch/sparc/mm/tsb.c similarity index 100% rename from arch/sparc64/mm/tsb.c rename to arch/sparc/mm/tsb.c diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc/mm/ultra.S similarity index 100% rename from arch/sparc64/mm/ultra.S rename to arch/sparc/mm/ultra.S diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile index 3dbda408572b..bfe08680c897 100644 --- a/arch/sparc64/Makefile +++ b/arch/sparc64/Makefile @@ -27,7 +27,7 @@ endif head-y := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o -core-y += arch/sparc64/kernel/ arch/sparc64/mm/ +core-y += arch/sparc64/kernel/ arch/sparc/mm/ core-y += arch/sparc/math-emu/ libs-y += arch/sparc64/prom/ arch/sparc64/lib/ drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/ diff --git a/arch/sparc64/mm/Makefile b/arch/sparc64/mm/Makefile deleted file mode 100644 index 68d04c0370f4..000000000000 --- a/arch/sparc64/mm/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# Makefile for the linux Sparc64-specific parts of the memory manager. -# - -EXTRA_AFLAGS := -ansi -EXTRA_CFLAGS := -Werror - -obj-y := ultra.o tlb.o tsb.o fault.o init.o generic.o - -obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o From 0871420fad5844cb63cfcf85508c17bd9b15c08f Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Sun, 16 Nov 2008 23:49:24 -0800 Subject: [PATCH 20/98] sparc64: Add tsb-ratio sysctl. Add a sysctl to tweak the RSS limit used to decide when to grow the TSB for an address space. In order to avoid expensive divides and multiplies only simply positive and negative powers of two are supported. The function computed takes the number of TSB translations that will fit at one time in the TSB of a given size, and either adds or subtracts a percentage of entries. This final value is the RSS limit. See tsb_size_to_rss_limit(). Signed-off-by: David S. Miller --- arch/sparc/mm/tsb.c | 21 ++++++++++++++------- kernel/sysctl.c | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c index f0282fad632a..36a0813f9517 100644 --- a/arch/sparc/mm/tsb.c +++ b/arch/sparc/mm/tsb.c @@ -265,6 +265,18 @@ void __init pgtable_cache_init(void) } } +int sysctl_tsb_ratio = -2; + +static unsigned long tsb_size_to_rss_limit(unsigned long new_size) +{ + unsigned long num_ents = (new_size / sizeof(struct tsb)); + + if (sysctl_tsb_ratio < 0) + return num_ents - (num_ents >> -sysctl_tsb_ratio); + else + return num_ents + (num_ents >> sysctl_tsb_ratio); +} + /* When the RSS of an address space exceeds tsb_rss_limit for a TSB, * do_sparc64_fault() invokes this routine to try and grow it. * @@ -295,19 +307,14 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss) new_cache_index = 0; for (new_size = 8192; new_size < max_tsb_size; new_size <<= 1UL) { - unsigned long n_entries = new_size / sizeof(struct tsb); - - n_entries = (n_entries * 3) / 4; - if (n_entries > rss) + new_rss_limit = tsb_size_to_rss_limit(new_size); + if (new_rss_limit > rss) break; - new_cache_index++; } if (new_size == max_tsb_size) new_rss_limit = ~0UL; - else - new_rss_limit = ((new_size / sizeof(struct tsb)) * 3) / 4; retry_tsb_alloc: gfp_flags = GFP_KERNEL; diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 3d56fe7570da..4e2ac0aec9b0 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -121,6 +121,10 @@ extern int sg_big_buff; #include #endif +#ifdef CONFIG_SPARC64 +extern int sysctl_tsb_ratio; +#endif + #ifdef __hppa__ extern int pwrsw_enabled; extern int unaligned_enabled; @@ -451,6 +455,16 @@ static struct ctl_table kern_table[] = { .proc_handler = &proc_dointvec, }, #endif +#ifdef CONFIG_SPARC64 + { + .ctl_name = CTL_UNNUMBERED, + .procname = "tsb-ratio", + .data = &sysctl_tsb_ratio, + .maxlen = sizeof (int), + .mode = 0644, + .proc_handler = &proc_dointvec, + }, +#endif #ifdef __hppa__ { .ctl_name = KERN_HPPA_PWRSW, From 2c2551ab99f9ba3c726e6a41c84ef0c7390fc546 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 21 Nov 2008 02:06:07 -0800 Subject: [PATCH 21/98] sparc64: Add interface for registering a performance counter IRQ handler. Signed-off-by: David S. Miller --- arch/sparc/include/asm/irq_64.h | 3 ++ arch/sparc64/kernel/irq.c | 63 +++++++++++++++++++++++++++++++++ arch/sparc64/kernel/ttable.S | 2 +- 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h index 71673eca3660..d47d4a1955a9 100644 --- a/arch/sparc/include/asm/irq_64.h +++ b/arch/sparc/include/asm/irq_64.h @@ -66,6 +66,9 @@ extern void virt_irq_free(unsigned int virt_irq); extern void __init init_IRQ(void); extern void fixup_irqs(void); +extern int register_perfctr_intr(void (*handler)(struct pt_regs *)); +extern void release_perfctr_intr(void (*handler)(struct pt_regs *)); + static inline void set_softint(unsigned long bits) { __asm__ __volatile__("wr %0, 0x0, %%set_softint" diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c index 52fc836f464d..a3ea2bcb95de 100644 --- a/arch/sparc64/kernel/irq.c +++ b/arch/sparc64/kernel/irq.c @@ -775,6 +775,69 @@ void do_softirq(void) local_irq_restore(flags); } +static void unhandled_perf_irq(struct pt_regs *regs) +{ + unsigned long pcr, pic; + + read_pcr(pcr); + read_pic(pic); + + write_pcr(0); + + printk(KERN_EMERG "CPU %d: Got unexpected perf counter IRQ.\n", + smp_processor_id()); + printk(KERN_EMERG "CPU %d: PCR[%016lx] PIC[%016lx]\n", + smp_processor_id(), pcr, pic); +} + +/* Almost a direct copy of the powerpc PMC code. */ +static DEFINE_SPINLOCK(perf_irq_lock); +static void *perf_irq_owner_caller; /* mostly for debugging */ +static void (*perf_irq)(struct pt_regs *regs) = unhandled_perf_irq; + +/* Invoked from level 15 PIL handler in trap table. */ +void perfctr_irq(int irq, struct pt_regs *regs) +{ + clear_softint(1 << irq); + perf_irq(regs); +} + +int register_perfctr_intr(void (*handler)(struct pt_regs *)) +{ + int ret; + + if (!handler) + return -EINVAL; + + spin_lock(&perf_irq_lock); + if (perf_irq != unhandled_perf_irq) { + printk(KERN_WARNING "register_perfctr_intr: " + "perf IRQ busy (reserved by caller %p)\n", + perf_irq_owner_caller); + ret = -EBUSY; + goto out; + } + + perf_irq_owner_caller = __builtin_return_address(0); + perf_irq = handler; + + ret = 0; +out: + spin_unlock(&perf_irq_lock); + + return ret; +} +EXPORT_SYMBOL_GPL(register_perfctr_intr); + +void release_perfctr_intr(void (*handler)(struct pt_regs *)) +{ + spin_lock(&perf_irq_lock); + perf_irq_owner_caller = NULL; + perf_irq = unhandled_perf_irq; + spin_unlock(&perf_irq_lock); +} +EXPORT_SYMBOL_GPL(release_perfctr_intr); + #ifdef CONFIG_HOTPLUG_CPU void fixup_irqs(void) { diff --git a/arch/sparc64/kernel/ttable.S b/arch/sparc64/kernel/ttable.S index 1ade3d6fb7fc..2a31ffa4c28d 100644 --- a/arch/sparc64/kernel/ttable.S +++ b/arch/sparc64/kernel/ttable.S @@ -66,7 +66,7 @@ tl0_irq6: BTRAP(0x46) tl0_irq7: BTRAP(0x47) BTRAP(0x48) BTRAP(0x49) tl0_irq10: BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d) tl0_irq14: TRAP_IRQ(timer_interrupt, 14) -tl0_irq15: TRAP_IRQ(handler_irq, 15) +tl0_irq15: TRAP_IRQ(perfctr_irq, 15) tl0_resv050: BTRAP(0x50) BTRAP(0x51) BTRAP(0x52) BTRAP(0x53) BTRAP(0x54) BTRAP(0x55) tl0_resv056: BTRAP(0x56) BTRAP(0x57) BTRAP(0x58) BTRAP(0x59) BTRAP(0x5a) BTRAP(0x5b) tl0_resv05c: BTRAP(0x5c) BTRAP(0x5d) BTRAP(0x5e) BTRAP(0x5f) From c6afec5e4d323e7b88a7d6e291a5aa021a8fcb7d Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Sun, 23 Nov 2008 21:50:16 -0800 Subject: [PATCH 22/98] sparc: Include drivers/pcmcia/Kconfig Stephen Rothwell pointed out that pcmcia can't be enabled on sparc64. There is an empty non-prompt PCMCIA explicit entry in arch/sparc/Kconfig but that doesn't do anything. 32-bit sparc needs a small hack to make this work, since it doesn't use the generic IRQ layer yes. We have to provide a dummy definition of probe_irq_mask(), since this is used by the yenta socket driver. Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 20 ++------------------ arch/sparc/include/asm/system_32.h | 5 +++++ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 41c4cd2c81bd..10945c344304 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -435,24 +435,6 @@ config MCA help MCA is not supported. -config PCMCIA - tristate - ---help--- - Say Y here if you want to attach PCMCIA- or PC-cards to your Linux - computer. These are credit-card size devices such as network cards, - modems or hard drives often used with laptops computers. There are - actually two varieties of these cards: the older 16 bit PCMCIA cards - and the newer 32 bit CardBus cards. If you want to use CardBus - cards, you need to say Y here and also to "CardBus support" below. - - To use your PC-cards, you will need supporting software from David - Hinds' pcmcia-cs package (see the file - for location). Please also read the PCMCIA-HOWTO, available from - . - - To compile this driver as modules, choose M here: the - modules will be called pcmcia_core and ds. - config SBUS bool default y @@ -497,6 +479,8 @@ config PCI_SYSCALL source "drivers/pci/Kconfig" +source "drivers/pcmcia/Kconfig" + config SUN_OPENPROMFS tristate "Openprom tree appears in /proc/openprom" help diff --git a/arch/sparc/include/asm/system_32.h b/arch/sparc/include/asm/system_32.h index 8623fc48fe24..79c1ae2b42a3 100644 --- a/arch/sparc/include/asm/system_32.h +++ b/arch/sparc/include/asm/system_32.h @@ -15,6 +15,11 @@ #include +static inline unsigned int probe_irq_mask(unsigned long val) +{ + return 0; +} + /* * Sparc (general) CPU types */ From b4f4372f96e0573d752d9e45beda02fabf716cc8 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Sun, 23 Nov 2008 21:55:29 -0800 Subject: [PATCH 23/98] sparc64: Make %pil level 15 a pseudo-NMI. So that we can profile code even in a local_irq_disable() section, only write 14 (instead of 15) into the %pil register to disable IRQs. This allows PIL level 15 to serve as a pseudo NMI. Signed-off-by: David S. Miller --- arch/sparc/include/asm/irqflags_64.h | 6 ++++-- arch/sparc/include/asm/pil.h | 9 ++++++++- arch/sparc/include/asm/ttable.h | 15 +++++++++++++-- arch/sparc/mm/ultra.S | 4 ++-- arch/sparc64/kernel/cherrs.S | 10 +++++----- arch/sparc64/kernel/head.S | 2 +- arch/sparc64/kernel/hvtramp.S | 5 +++-- arch/sparc64/kernel/smp.c | 4 ++-- arch/sparc64/kernel/spiterrs.S | 2 +- arch/sparc64/kernel/sun4v_ivec.S | 8 ++++---- arch/sparc64/kernel/traps.c | 4 ++-- arch/sparc64/kernel/ttable.S | 2 +- 12 files changed, 46 insertions(+), 25 deletions(-) diff --git a/arch/sparc/include/asm/irqflags_64.h b/arch/sparc/include/asm/irqflags_64.h index bb42e59162aa..8b49bf920df3 100644 --- a/arch/sparc/include/asm/irqflags_64.h +++ b/arch/sparc/include/asm/irqflags_64.h @@ -10,6 +10,8 @@ #ifndef _ASM_IRQFLAGS_H #define _ASM_IRQFLAGS_H +#include + #ifndef __ASSEMBLY__ static inline unsigned long __raw_local_save_flags(void) @@ -40,9 +42,9 @@ static inline void raw_local_irq_restore(unsigned long flags) static inline void raw_local_irq_disable(void) { __asm__ __volatile__( - "wrpr 15, %%pil" + "wrpr %0, %%pil" : /* no outputs */ - : /* no inputs */ + : "i" (PIL_NORMAL_MAX) : "memory" ); } diff --git a/arch/sparc/include/asm/pil.h b/arch/sparc/include/asm/pil.h index 71819bb943fc..d573820c0ff4 100644 --- a/arch/sparc/include/asm/pil.h +++ b/arch/sparc/include/asm/pil.h @@ -10,7 +10,12 @@ * * In fact any XCALL which has to etrap/rtrap has a problem because * it is difficult to prevent rtrap from running BH's, and that would - * need to be done if the XCALL arrived while %pil==15. + * need to be done if the XCALL arrived while %pil==PIL_NORMAL_MAX. + * + * Finally, in order to handle profiling events even when a + * local_irq_disable() is in progress, we only disable up to level 14 + * interrupts. Profile counter overflow interrupts arrive at level + * 15. */ #define PIL_SMP_CALL_FUNC 1 #define PIL_SMP_RECEIVE_SIGNAL 2 @@ -18,5 +23,7 @@ #define PIL_SMP_CTX_NEW_VERSION 4 #define PIL_DEVICE_IRQ 5 #define PIL_SMP_CALL_FUNC_SNGL 6 +#define PIL_NORMAL_MAX 14 +#define PIL_NMI 15 #endif /* !(_SPARC64_PIL_H) */ diff --git a/arch/sparc/include/asm/ttable.h b/arch/sparc/include/asm/ttable.h index 5708ba2719fb..bb2c0770a6ac 100644 --- a/arch/sparc/include/asm/ttable.h +++ b/arch/sparc/include/asm/ttable.h @@ -2,6 +2,7 @@ #define _SPARC64_TTABLE_H #include +#include #ifdef __ASSEMBLY__ #include @@ -123,7 +124,7 @@ #define TRAP_IRQ(routine, level) \ rdpr %pil, %g2; \ - wrpr %g0, 15, %pil; \ + wrpr %g0, PIL_NORMAL_MAX, %pil; \ sethi %hi(1f-4), %g7; \ ba,pt %xcc, etrap_irq; \ or %g7, %lo(1f-4), %g7; \ @@ -143,7 +144,7 @@ #define TRAP_IRQ(routine, level) \ rdpr %pil, %g2; \ - wrpr %g0, 15, %pil; \ + wrpr %g0, PIL_NORMAL_MAX, %pil; \ ba,pt %xcc, etrap_irq; \ rd %pc, %g7; \ mov level, %o0; \ @@ -153,6 +154,16 @@ #endif +#define TRAP_NMI_IRQ(routine, level) \ + rdpr %pil, %g2; \ + wrpr %g0, PIL_NMI, %pil; \ + ba,pt %xcc, etrap_irq; \ + rd %pc, %g7; \ + mov level, %o0; \ + call routine; \ + add %sp, PTREGS_OFF, %o1; \ + ba,a,pt %xcc, rtrap_irq; + #define TRAP_IVEC TRAP_NOSAVE(do_ivec) #define BTRAP(lvl) TRAP_ARG(bad_trap, lvl) diff --git a/arch/sparc/mm/ultra.S b/arch/sparc/mm/ultra.S index e4c146f7c7e9..80c788ec7c32 100644 --- a/arch/sparc/mm/ultra.S +++ b/arch/sparc/mm/ultra.S @@ -466,7 +466,7 @@ xcall_sync_tick: .previous rdpr %pil, %g2 - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil sethi %hi(109f), %g7 b,pt %xcc, etrap_irq 109: or %g7, %lo(109b), %g7 @@ -688,7 +688,7 @@ xcall_kgdb_capture: .previous rdpr %pil, %g2 - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil sethi %hi(109f), %g7 ba,pt %xcc, etrap_irq 109: or %g7, %lo(109b), %g7 diff --git a/arch/sparc64/kernel/cherrs.S b/arch/sparc64/kernel/cherrs.S index 89afebd7eca0..4ee1ad420862 100644 --- a/arch/sparc64/kernel/cherrs.S +++ b/arch/sparc64/kernel/cherrs.S @@ -102,7 +102,7 @@ cheetah_plus_dcpe_trap_vector: .type do_cheetah_plus_data_parity,#function do_cheetah_plus_data_parity: rdpr %pil, %g2 - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil ba,pt %xcc, etrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS @@ -144,7 +144,7 @@ cheetah_plus_icpe_trap_vector: .type do_cheetah_plus_insn_parity,#function do_cheetah_plus_insn_parity: rdpr %pil, %g2 - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil ba,pt %xcc, etrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS @@ -492,7 +492,7 @@ cheetah_fast_ecc: .type c_fast_ecc,#function c_fast_ecc: rdpr %pil, %g2 - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil ba,pt %xcc, etrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS @@ -528,7 +528,7 @@ cheetah_cee: .type c_cee,#function c_cee: rdpr %pil, %g2 - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil ba,pt %xcc, etrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS @@ -564,7 +564,7 @@ cheetah_deferred_trap: .type c_deferred,#function c_deferred: rdpr %pil, %g2 - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil ba,pt %xcc, etrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S index 353226fa0239..45830c35fc6d 100644 --- a/arch/sparc64/kernel/head.S +++ b/arch/sparc64/kernel/head.S @@ -706,7 +706,7 @@ setup_trap_table: andn %l0, PSTATE_IE, %o1 wrpr %o1, 0x0, %pstate rdpr %pil, %l1 - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil /* Make the firmware call to jump over to the Linux trap table. */ sethi %hi(is_sun4v), %o0 diff --git a/arch/sparc64/kernel/hvtramp.S b/arch/sparc64/kernel/hvtramp.S index 0236c43772fa..9365432904d6 100644 --- a/arch/sparc64/kernel/hvtramp.S +++ b/arch/sparc64/kernel/hvtramp.S @@ -1,6 +1,6 @@ /* hvtramp.S: Hypervisor start-cpu trampoline code. * - * Copyright (C) 2007 David S. Miller + * Copyright (C) 2007, 2008 David S. Miller */ #include @@ -14,6 +14,7 @@ #include #include #include +#include __CPUINIT .align 8 @@ -32,7 +33,7 @@ */ hv_cpu_startup: SET_GL(0) - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil wrpr %g0, 0, %canrestore wrpr %g0, 0, %otherwin wrpr %g0, 6, %cansave diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index c6d06362728c..b5225c81556c 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c @@ -1146,8 +1146,8 @@ void smp_release(void) } } -/* Imprisoned penguins run with %pil == 15, but PSTATE_IE set, so they - * can service tlb flush xcalls... +/* Imprisoned penguins run with %pil == PIL_NORMAL_MAX, but PSTATE_IE + * set, so they can service tlb flush xcalls... */ extern void prom_world(int); diff --git a/arch/sparc64/kernel/spiterrs.S b/arch/sparc64/kernel/spiterrs.S index ef902c6f8e3c..c357e40ffd01 100644 --- a/arch/sparc64/kernel/spiterrs.S +++ b/arch/sparc64/kernel/spiterrs.S @@ -80,7 +80,7 @@ __spitfire_cee_trap_continue: cmp %g2, 1 rdpr %pil, %g2 bleu,pt %xcc, 1f - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil ba,pt %xcc, etraptl1 rd %pc, %g7 diff --git a/arch/sparc64/kernel/sun4v_ivec.S b/arch/sparc64/kernel/sun4v_ivec.S index e2f8e1b4882a..559bc5e9c199 100644 --- a/arch/sparc64/kernel/sun4v_ivec.S +++ b/arch/sparc64/kernel/sun4v_ivec.S @@ -186,7 +186,7 @@ sun4v_res_mondo: * when it's done. */ rdpr %pil, %g2 - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil mov %g1, %g4 ba,pt %xcc, etrap_irq rd %pc, %g7 @@ -216,7 +216,7 @@ sun4v_res_mondo_queue_full: membar #Sync rdpr %pil, %g2 - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil ba,pt %xcc, etrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS @@ -297,7 +297,7 @@ sun4v_nonres_mondo: * when it's done. */ rdpr %pil, %g2 - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil mov %g1, %g4 ba,pt %xcc, etrap_irq rd %pc, %g7 @@ -327,7 +327,7 @@ sun4v_nonres_mondo_queue_full: membar #Sync rdpr %pil, %g2 - wrpr %g0, 15, %pil + wrpr %g0, PIL_NORMAL_MAX, %pil ba,pt %xcc, etrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index 04994fc8700d..4638af2f55a0 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c @@ -1832,7 +1832,7 @@ static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent, } } -/* We run with %pil set to 15 and PSTATE_IE enabled in %pstate. +/* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate. * Log the event and clear the first word of the entry. */ void sun4v_resum_error(struct pt_regs *regs, unsigned long offset) @@ -1880,7 +1880,7 @@ void sun4v_resum_overflow(struct pt_regs *regs) atomic_inc(&sun4v_resum_oflow_cnt); } -/* We run with %pil set to 15 and PSTATE_IE enabled in %pstate. +/* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate. * Log the event, clear the first word of the entry, and die. */ void sun4v_nonresum_error(struct pt_regs *regs, unsigned long offset) diff --git a/arch/sparc64/kernel/ttable.S b/arch/sparc64/kernel/ttable.S index 2a31ffa4c28d..ea925503b42e 100644 --- a/arch/sparc64/kernel/ttable.S +++ b/arch/sparc64/kernel/ttable.S @@ -66,7 +66,7 @@ tl0_irq6: BTRAP(0x46) tl0_irq7: BTRAP(0x47) BTRAP(0x48) BTRAP(0x49) tl0_irq10: BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d) tl0_irq14: TRAP_IRQ(timer_interrupt, 14) -tl0_irq15: TRAP_IRQ(perfctr_irq, 15) +tl0_irq15: TRAP_NMI_IRQ(perfctr_irq, 15) tl0_resv050: BTRAP(0x50) BTRAP(0x51) BTRAP(0x52) BTRAP(0x53) BTRAP(0x54) BTRAP(0x55) tl0_resv056: BTRAP(0x56) BTRAP(0x57) BTRAP(0x58) BTRAP(0x59) BTRAP(0x5a) BTRAP(0x5b) tl0_resv05c: BTRAP(0x5c) BTRAP(0x5d) BTRAP(0x5e) BTRAP(0x5f) From 5565736e44fff06dc5f5c6559e04ac58d2d560ab Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 25 Nov 2008 22:24:59 -0800 Subject: [PATCH 24/98] sparc64: Make special trap return path for TRAP_NMI(). We don't want the rtrap path to try and run softirqs or anything like that when returning from a PIL==15 NMI. Signed-off-by: David S. Miller --- arch/sparc/include/asm/ttable.h | 2 +- arch/sparc64/kernel/rtrap.S | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/sparc/include/asm/ttable.h b/arch/sparc/include/asm/ttable.h index bb2c0770a6ac..48f2807d3265 100644 --- a/arch/sparc/include/asm/ttable.h +++ b/arch/sparc/include/asm/ttable.h @@ -162,7 +162,7 @@ mov level, %o0; \ call routine; \ add %sp, PTREGS_OFF, %o1; \ - ba,a,pt %xcc, rtrap_irq; + ba,a,pt %xcc, rtrap_nmi; #define TRAP_IVEC TRAP_NOSAVE(do_ivec) diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S index 6892cf556f45..fd3cee4d117c 100644 --- a/arch/sparc64/kernel/rtrap.S +++ b/arch/sparc64/kernel/rtrap.S @@ -132,6 +132,18 @@ __handle_signal: ba,pt %xcc, __handle_signal_continue andn %l1, %l4, %l1 + /* When returning from a NMI (%pil==15) interrupt we want to + * avoid running softirqs, doing IRQ tracing, preempting, etc. + */ + .globl rtrap_nmi +rtrap_nmi: ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1 + sethi %hi(0xf << 20), %l4 + and %l1, %l4, %l4 + andn %l1, %l4, %l1 + srl %l4, 20, %l4 + ba,pt %xcc, rtrap_no_irq_enable + wrpr %l4, %pil + .align 64 .globl rtrap_irq, rtrap, irqsz_patchme, rtrap_xcall rtrap_irq: @@ -161,8 +173,8 @@ rtrap_xcall: call trace_hardirqs_on nop wrpr %l4, %pil -rtrap_no_irq_enable: #endif +rtrap_no_irq_enable: andcc %l1, TSTATE_PRIV, %l3 bne,pn %icc, to_kernel nop From f9aad60010efa896319ed6e908a5cb5e3a852907 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 25 Nov 2008 22:26:59 -0800 Subject: [PATCH 25/98] sparc64: Block NMIs in critical section of context switch. In these instructions we load the new thread register, switch the register window, and setup the new frame pointer. All of these must appear atomic, and things will explode if we take a PIL=15 NMI interrupt in the middle of this sequence. Signed-off-by: David S. Miller --- arch/sparc/include/asm/system_64.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/sparc/include/asm/system_64.h b/arch/sparc/include/asm/system_64.h index 7554ad39b5af..779cf62d3ce9 100644 --- a/arch/sparc/include/asm/system_64.h +++ b/arch/sparc/include/asm/system_64.h @@ -159,6 +159,7 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \ "stb %%o5, [%%g6 + %5]\n\t" \ "rdpr %%cwp, %%o5\n\t" \ "stb %%o5, [%%g6 + %8]\n\t" \ + "wrpr %%g0, 15, %%pil\n\t" \ "mov %4, %%g6\n\t" \ "ldub [%4 + %8], %%g1\n\t" \ "wrpr %%g1, %%cwp\n\t" \ @@ -169,6 +170,7 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \ "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ "ldx [%%g6 + %9], %%g4\n\t" \ + "wrpr %%g0, 14, %%pil\n\t" \ "brz,pt %%o7, switch_to_pc\n\t" \ " mov %%g7, %0\n\t" \ "sethi %%hi(ret_from_syscall), %%g1\n\t" \ From 456cad8e4e1754672e6df1e716cff1482ea124ce Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 25 Nov 2008 22:27:50 -0800 Subject: [PATCH 26/98] sparc64: Add write_pic() helper. It writes the %pic register, keeping mind of processor bugs. Implement reset_pic() in terms of it. Signed-off-by: David S. Miller --- arch/sparc/include/asm/system_64.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/sparc/include/asm/system_64.h b/arch/sparc/include/asm/system_64.h index 779cf62d3ce9..6c077816ab28 100644 --- a/arch/sparc/include/asm/system_64.h +++ b/arch/sparc/include/asm/system_64.h @@ -96,11 +96,12 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \ * arch/sparc64/kernel/smp.c:smp_percpu_timer_interrupt() * for more information. */ -#define reset_pic() \ - __asm__ __volatile__("ba,pt %xcc, 99f\n\t" \ +#define write_pic(__p) \ + __asm__ __volatile__("ba,pt %%xcc, 99f\n\t" \ ".align 64\n" \ - "99:wr %g0, 0x0, %pic\n\t" \ - "rd %pic, %g0") + "99:wr %0, 0x0, %%pic\n\t" \ + "rd %%pic, %%g0" : : "r" (__p)) +#define reset_pic() write_pic(0) #ifndef __ASSEMBLY__ From 422e23ea0865177b61527874b1b80023e4215d67 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 25 Nov 2008 22:29:24 -0800 Subject: [PATCH 27/98] sparc64: Use NMI oprofile profiling on cheetah and derivative cpus. We use clock cycle counter, adjusted to HZ. This can be extended to sun4v based processors as well, as they also have a proper overflow interrupt facility for the performance counters. Signed-off-by: David S. Miller --- arch/sparc/oprofile/init.c | 110 ++++++++++++++++++++++++++++++++++++- 1 file changed, 109 insertions(+), 1 deletion(-) diff --git a/arch/sparc/oprofile/init.c b/arch/sparc/oprofile/init.c index 17bb6035069b..e979dcd77726 100644 --- a/arch/sparc/oprofile/init.c +++ b/arch/sparc/oprofile/init.c @@ -12,9 +12,117 @@ #include #include +#ifdef CONFIG_SPARC64 +#include +#include +#include + +static int nmi_enabled; + +static u64 picl_value(void) +{ + u32 delta = local_cpu_data().clock_tick / HZ; + + return (0 - delta) & 0xffffffff; +} + +#define PCR_PIC_PRIV 0x1 /* PIC access is privileged */ +#define PCR_STRACE 0x2 /* Trace supervisor events */ +#define PCR_UTRACE 0x4 /* Trace user events */ + +static void nmi_handler(struct pt_regs *regs) +{ + write_pcr(PCR_PIC_PRIV); + + if (nmi_enabled) { + oprofile_add_sample(regs, 0); + + write_pic(picl_value()); + write_pcr(PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE); + } +} + +/* We count "clock cycle" events in the lower 32-bit PIC. + * Then configure it such that it overflows every HZ, and thus + * generates a level 15 interrupt at that frequency. + */ +static void cpu_nmi_start(void *_unused) +{ + write_pcr(PCR_PIC_PRIV); + write_pic(picl_value()); + + /* Bit 0: PIC access is privileged + * Bit 1: Supervisor Trace + * Bit 2: User Trace + * + * And the event selection code for cpu cycles is zero. + */ + write_pcr(PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE); +} + +static void cpu_nmi_stop(void *_unused) +{ + write_pcr(PCR_PIC_PRIV); +} + +static int nmi_start(void) +{ + int err = register_perfctr_intr(nmi_handler); + + if (!err) { + nmi_enabled = 1; + wmb(); + err = on_each_cpu(cpu_nmi_start, NULL, 1); + if (err) { + nmi_enabled = 0; + wmb(); + on_each_cpu(cpu_nmi_stop, NULL, 1); + release_perfctr_intr(nmi_handler); + } + } + + return err; +} + +static void nmi_stop(void) +{ + nmi_enabled = 0; + wmb(); + + on_each_cpu(cpu_nmi_stop, NULL, 1); + release_perfctr_intr(nmi_handler); + synchronize_sched(); +} + +static int oprofile_nmi_init(struct oprofile_operations *ops) +{ + if (tlb_type != cheetah && tlb_type != cheetah_plus) + return -ENODEV; + + ops->create_files = NULL; + ops->setup = NULL; + ops->shutdown = NULL; + ops->start = nmi_start; + ops->stop = nmi_stop; + ops->cpu_type = "timer"; + + printk(KERN_INFO "oprofile: Using perfctr based NMI timer interrupt.\n"); + + return 0; +} +#endif + int __init oprofile_arch_init(struct oprofile_operations *ops) { - return -ENODEV; + int ret = -ENODEV; + +#ifdef CONFIG_SPARC64 + ret = oprofile_nmi_init(ops); + if (!ret) + return ret; +#endif + + return ret; } From 9acee190c8c055f634475ad3f742ff07049dd51e Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Wed, 26 Nov 2008 00:51:32 -0800 Subject: [PATCH 28/98] sparc: combine unistd_{32,64}.h This is complicated a little because compat_audit.c wants to see only the 32bit syscall numbers, but is being built in a 64bit compile. Signed-off-by: Stephen Rothwell Signed-off-by: David S. Miller --- arch/sparc/include/asm/Kbuild | 2 - arch/sparc/include/asm/unistd.h | 446 ++++++++++++++++++++++++++++- arch/sparc/include/asm/unistd_32.h | 385 ------------------------- arch/sparc/include/asm/unistd_64.h | 380 ------------------------ arch/sparc64/kernel/compat_audit.c | 3 +- 5 files changed, 443 insertions(+), 773 deletions(-) delete mode 100644 arch/sparc/include/asm/unistd_32.h delete mode 100644 arch/sparc/include/asm/unistd_64.h diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild index 2d2769d766ec..89c260aab45c 100644 --- a/arch/sparc/include/asm/Kbuild +++ b/arch/sparc/include/asm/Kbuild @@ -15,8 +15,6 @@ header-y += signal_32.h header-y += signal_64.h header-y += stat_32.h header-y += stat_64.h -header-y += unistd_32.h -header-y += unistd_64.h header-y += apc.h header-y += asi.h diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h index 4207fb362da0..031f038b19f7 100644 --- a/arch/sparc/include/asm/unistd.h +++ b/arch/sparc/include/asm/unistd.h @@ -1,8 +1,444 @@ -#ifndef ___ASM_SPARC_UNISTD_H -#define ___ASM_SPARC_UNISTD_H -#if defined(__sparc__) && defined(__arch64__) -#include +#ifndef _SPARC_UNISTD_H +#define _SPARC_UNISTD_H + +/* + * System calls under the Sparc. + * + * Don't be scared by the ugly clobbers, it is the only way I can + * think of right now to force the arguments into fixed registers + * before the trap into the system call with gcc 'asm' statements. + * + * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net) + * + * SunOS compatibility based upon preliminary work which is: + * + * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) + */ +#ifndef __32bit_syscall_numbers__ +#ifndef __arch64__ +#define __32bit_syscall_numbers__ +#endif +#endif + +#define __NR_restart_syscall 0 /* Linux Specific */ +#define __NR_exit 1 /* Common */ +#define __NR_fork 2 /* Common */ +#define __NR_read 3 /* Common */ +#define __NR_write 4 /* Common */ +#define __NR_open 5 /* Common */ +#define __NR_close 6 /* Common */ +#define __NR_wait4 7 /* Common */ +#define __NR_creat 8 /* Common */ +#define __NR_link 9 /* Common */ +#define __NR_unlink 10 /* Common */ +#define __NR_execv 11 /* SunOS Specific */ +#define __NR_chdir 12 /* Common */ +#define __NR_chown 13 /* Common */ +#define __NR_mknod 14 /* Common */ +#define __NR_chmod 15 /* Common */ +#define __NR_lchown 16 /* Common */ +#define __NR_brk 17 /* Common */ +#define __NR_perfctr 18 /* Performance counter operations */ +#define __NR_lseek 19 /* Common */ +#define __NR_getpid 20 /* Common */ +#define __NR_capget 21 /* Linux Specific */ +#define __NR_capset 22 /* Linux Specific */ +#define __NR_setuid 23 /* Implemented via setreuid in SunOS */ +#define __NR_getuid 24 /* Common */ +#define __NR_vmsplice 25 /* ENOSYS under SunOS */ +#define __NR_ptrace 26 /* Common */ +#define __NR_alarm 27 /* Implemented via setitimer in SunOS */ +#define __NR_sigaltstack 28 /* Common */ +#define __NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */ +#define __NR_utime 30 /* Implemented via utimes() under SunOS */ +#ifdef __32bit_syscall_numbers__ +#define __NR_lchown32 31 /* Linux sparc32 specific */ +#define __NR_fchown32 32 /* Linux sparc32 specific */ +#endif +#define __NR_access 33 /* Common */ +#define __NR_nice 34 /* Implemented via get/setpriority() in SunOS */ +#ifdef __32bit_syscall_numbers__ +#define __NR_chown32 35 /* Linux sparc32 specific */ +#endif +#define __NR_sync 36 /* Common */ +#define __NR_kill 37 /* Common */ +#define __NR_stat 38 /* Common */ +#define __NR_sendfile 39 /* Linux Specific */ +#define __NR_lstat 40 /* Common */ +#define __NR_dup 41 /* Common */ +#define __NR_pipe 42 /* Common */ +#define __NR_times 43 /* Implemented via getrusage() in SunOS */ +#ifdef __32bit_syscall_numbers__ +#define __NR_getuid32 44 /* Linux sparc32 specific */ +#endif +#define __NR_umount2 45 /* Linux Specific */ +#define __NR_setgid 46 /* Implemented via setregid() in SunOS */ +#define __NR_getgid 47 /* Common */ +#define __NR_signal 48 /* Implemented via sigvec() in SunOS */ +#define __NR_geteuid 49 /* SunOS calls getuid() */ +#define __NR_getegid 50 /* SunOS calls getgid() */ +#define __NR_acct 51 /* Common */ +#ifdef __32bit_syscall_numbers__ +#define __NR_getgid32 53 /* Linux sparc32 specific */ #else -#include +#define __NR_memory_ordering 52 /* Linux Specific */ +#endif +#define __NR_ioctl 54 /* Common */ +#define __NR_reboot 55 /* Common */ +#ifdef __32bit_syscall_numbers__ +#define __NR_mmap2 56 /* Linux sparc32 Specific */ +#endif +#define __NR_symlink 57 /* Common */ +#define __NR_readlink 58 /* Common */ +#define __NR_execve 59 /* Common */ +#define __NR_umask 60 /* Common */ +#define __NR_chroot 61 /* Common */ +#define __NR_fstat 62 /* Common */ +#define __NR_fstat64 63 /* Linux Specific */ +#define __NR_getpagesize 64 /* Common */ +#define __NR_msync 65 /* Common in newer 1.3.x revs... */ +#define __NR_vfork 66 /* Common */ +#define __NR_pread64 67 /* Linux Specific */ +#define __NR_pwrite64 68 /* Linux Specific */ +#ifdef __32bit_syscall_numbers__ +#define __NR_geteuid32 69 /* Linux sparc32, sbrk under SunOS */ +#define __NR_getegid32 70 /* Linux sparc32, sstk under SunOS */ +#endif +#define __NR_mmap 71 /* Common */ +#ifdef __32bit_syscall_numbers__ +#define __NR_setreuid32 72 /* Linux sparc32, vadvise under SunOS */ +#endif +#define __NR_munmap 73 /* Common */ +#define __NR_mprotect 74 /* Common */ +#define __NR_madvise 75 /* Common */ +#define __NR_vhangup 76 /* Common */ +#ifdef __32bit_syscall_numbers__ +#define __NR_truncate64 77 /* Linux sparc32 Specific */ +#endif +#define __NR_mincore 78 /* Common */ +#define __NR_getgroups 79 /* Common */ +#define __NR_setgroups 80 /* Common */ +#define __NR_getpgrp 81 /* Common */ +#ifdef __32bit_syscall_numbers__ +#define __NR_setgroups32 82 /* Linux sparc32, setpgrp under SunOS */ +#endif +#define __NR_setitimer 83 /* Common */ +#ifdef __32bit_syscall_numbers__ +#define __NR_ftruncate64 84 /* Linux sparc32 Specific */ +#endif +#define __NR_swapon 85 /* Common */ +#define __NR_getitimer 86 /* Common */ +#ifdef __32bit_syscall_numbers__ +#define __NR_setuid32 87 /* Linux sparc32, gethostname under SunOS */ +#endif +#define __NR_sethostname 88 /* Common */ +#ifdef __32bit_syscall_numbers__ +#define __NR_setgid32 89 /* Linux sparc32, getdtablesize under SunOS */ +#endif +#define __NR_dup2 90 /* Common */ +#ifdef __32bit_syscall_numbers__ +#define __NR_setfsuid32 91 /* Linux sparc32, getdopt under SunOS */ +#endif +#define __NR_fcntl 92 /* Common */ +#define __NR_select 93 /* Common */ +#ifdef __32bit_syscall_numbers__ +#define __NR_setfsgid32 94 /* Linux sparc32, setdopt under SunOS */ +#endif +#define __NR_fsync 95 /* Common */ +#define __NR_setpriority 96 /* Common */ +#define __NR_socket 97 /* Common */ +#define __NR_connect 98 /* Common */ +#define __NR_accept 99 /* Common */ +#define __NR_getpriority 100 /* Common */ +#define __NR_rt_sigreturn 101 /* Linux Specific */ +#define __NR_rt_sigaction 102 /* Linux Specific */ +#define __NR_rt_sigprocmask 103 /* Linux Specific */ +#define __NR_rt_sigpending 104 /* Linux Specific */ +#define __NR_rt_sigtimedwait 105 /* Linux Specific */ +#define __NR_rt_sigqueueinfo 106 /* Linux Specific */ +#define __NR_rt_sigsuspend 107 /* Linux Specific */ +#ifdef __32bit_syscall_numbers__ +#define __NR_setresuid32 108 /* Linux Specific, sigvec under SunOS */ +#define __NR_getresuid32 109 /* Linux Specific, sigblock under SunOS */ +#define __NR_setresgid32 110 /* Linux Specific, sigsetmask under SunOS */ +#define __NR_getresgid32 111 /* Linux Specific, sigpause under SunOS */ +#define __NR_setregid32 112 /* Linux sparc32, sigstack under SunOS */ +#else +#define __NR_setresuid 108 /* Linux Specific, sigvec under SunOS */ +#define __NR_getresuid 109 /* Linux Specific, sigblock under SunOS */ +#define __NR_setresgid 110 /* Linux Specific, sigsetmask under SunOS */ +#define __NR_getresgid 111 /* Linux Specific, sigpause under SunOS */ +#endif +#define __NR_recvmsg 113 /* Common */ +#define __NR_sendmsg 114 /* Common */ +#ifdef __32bit_syscall_numbers__ +#define __NR_getgroups32 115 /* Linux sparc32, vtrace under SunOS */ +#endif +#define __NR_gettimeofday 116 /* Common */ +#define __NR_getrusage 117 /* Common */ +#define __NR_getsockopt 118 /* Common */ +#define __NR_getcwd 119 /* Linux Specific */ +#define __NR_readv 120 /* Common */ +#define __NR_writev 121 /* Common */ +#define __NR_settimeofday 122 /* Common */ +#define __NR_fchown 123 /* Common */ +#define __NR_fchmod 124 /* Common */ +#define __NR_recvfrom 125 /* Common */ +#define __NR_setreuid 126 /* Common */ +#define __NR_setregid 127 /* Common */ +#define __NR_rename 128 /* Common */ +#define __NR_truncate 129 /* Common */ +#define __NR_ftruncate 130 /* Common */ +#define __NR_flock 131 /* Common */ +#define __NR_lstat64 132 /* Linux Specific */ +#define __NR_sendto 133 /* Common */ +#define __NR_shutdown 134 /* Common */ +#define __NR_socketpair 135 /* Common */ +#define __NR_mkdir 136 /* Common */ +#define __NR_rmdir 137 /* Common */ +#define __NR_utimes 138 /* SunOS Specific */ +#define __NR_stat64 139 /* Linux Specific */ +#define __NR_sendfile64 140 /* adjtime under SunOS */ +#define __NR_getpeername 141 /* Common */ +#define __NR_futex 142 /* gethostid under SunOS */ +#define __NR_gettid 143 /* ENOSYS under SunOS */ +#define __NR_getrlimit 144 /* Common */ +#define __NR_setrlimit 145 /* Common */ +#define __NR_pivot_root 146 /* Linux Specific, killpg under SunOS */ +#define __NR_prctl 147 /* ENOSYS under SunOS */ +#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */ +#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */ +#define __NR_getsockname 150 /* Common */ +#define __NR_inotify_init 151 /* Linux specific */ +#define __NR_inotify_add_watch 152 /* Linux specific */ +#define __NR_poll 153 /* Common */ +#define __NR_getdents64 154 /* Linux specific */ +#ifdef __32bit_syscall_numbers__ +#define __NR_fcntl64 155 /* Linux sparc32 Specific */ +#endif +#define __NR_inotify_rm_watch 156 /* Linux specific */ +#define __NR_statfs 157 /* Common */ +#define __NR_fstatfs 158 /* Common */ +#define __NR_umount 159 /* Common */ +#define __NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS */ +#define __NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS */ +#define __NR_getdomainname 162 /* SunOS Specific */ +#define __NR_setdomainname 163 /* Common */ +#ifndef __32bit_syscall_numbers__ +#define __NR_utrap_install 164 /* SYSV ABI/v9 required */ +#endif +#define __NR_quotactl 165 /* Common */ +#define __NR_set_tid_address 166 /* Linux specific, exportfs under SunOS */ +#define __NR_mount 167 /* Common */ +#define __NR_ustat 168 /* Common */ +#define __NR_setxattr 169 /* SunOS: semsys */ +#define __NR_lsetxattr 170 /* SunOS: msgsys */ +#define __NR_fsetxattr 171 /* SunOS: shmsys */ +#define __NR_getxattr 172 /* SunOS: auditsys */ +#define __NR_lgetxattr 173 /* SunOS: rfssys */ +#define __NR_getdents 174 /* Common */ +#define __NR_setsid 175 /* Common */ +#define __NR_fchdir 176 /* Common */ +#define __NR_fgetxattr 177 /* SunOS: fchroot */ +#define __NR_listxattr 178 /* SunOS: vpixsys */ +#define __NR_llistxattr 179 /* SunOS: aioread */ +#define __NR_flistxattr 180 /* SunOS: aiowrite */ +#define __NR_removexattr 181 /* SunOS: aiowait */ +#define __NR_lremovexattr 182 /* SunOS: aiocancel */ +#define __NR_sigpending 183 /* Common */ +#define __NR_query_module 184 /* Linux Specific */ +#define __NR_setpgid 185 /* Common */ +#define __NR_fremovexattr 186 /* SunOS: pathconf */ +#define __NR_tkill 187 /* SunOS: fpathconf */ +#define __NR_exit_group 188 /* Linux specific, sysconf undef SunOS */ +#define __NR_uname 189 /* Linux Specific */ +#define __NR_init_module 190 /* Linux Specific */ +#define __NR_personality 191 /* Linux Specific */ +#define __NR_remap_file_pages 192 /* Linux Specific */ +#define __NR_epoll_create 193 /* Linux Specific */ +#define __NR_epoll_ctl 194 /* Linux Specific */ +#define __NR_epoll_wait 195 /* Linux Specific */ +#define __NR_ioprio_set 196 /* Linux Specific */ +#define __NR_getppid 197 /* Linux Specific */ +#define __NR_sigaction 198 /* Linux Specific */ +#define __NR_sgetmask 199 /* Linux Specific */ +#define __NR_ssetmask 200 /* Linux Specific */ +#define __NR_sigsuspend 201 /* Linux Specific */ +#define __NR_oldlstat 202 /* Linux Specific */ +#define __NR_uselib 203 /* Linux Specific */ +#define __NR_readdir 204 /* Linux Specific */ +#define __NR_readahead 205 /* Linux Specific */ +#define __NR_socketcall 206 /* Linux Specific */ +#define __NR_syslog 207 /* Linux Specific */ +#define __NR_lookup_dcookie 208 /* Linux Specific */ +#define __NR_fadvise64 209 /* Linux Specific */ +#define __NR_fadvise64_64 210 /* Linux Specific */ +#define __NR_tgkill 211 /* Linux Specific */ +#define __NR_waitpid 212 /* Linux Specific */ +#define __NR_swapoff 213 /* Linux Specific */ +#define __NR_sysinfo 214 /* Linux Specific */ +#define __NR_ipc 215 /* Linux Specific */ +#define __NR_sigreturn 216 /* Linux Specific */ +#define __NR_clone 217 /* Linux Specific */ +#define __NR_ioprio_get 218 /* Linux Specific */ +#define __NR_adjtimex 219 /* Linux Specific */ +#define __NR_sigprocmask 220 /* Linux Specific */ +#define __NR_create_module 221 /* Linux Specific */ +#define __NR_delete_module 222 /* Linux Specific */ +#define __NR_get_kernel_syms 223 /* Linux Specific */ +#define __NR_getpgid 224 /* Linux Specific */ +#define __NR_bdflush 225 /* Linux Specific */ +#define __NR_sysfs 226 /* Linux Specific */ +#define __NR_afs_syscall 227 /* Linux Specific */ +#define __NR_setfsuid 228 /* Linux Specific */ +#define __NR_setfsgid 229 /* Linux Specific */ +#define __NR__newselect 230 /* Linux Specific */ +#ifdef __32bit_syscall_numbers__ +#define __NR_time 231 /* Linux Specific */ +#else +#ifdef __KERNEL__ +#define __NR_time 231 /* Linux sparc32 */ #endif #endif +#define __NR_splice 232 /* Linux Specific */ +#define __NR_stime 233 /* Linux Specific */ +#define __NR_statfs64 234 /* Linux Specific */ +#define __NR_fstatfs64 235 /* Linux Specific */ +#define __NR__llseek 236 /* Linux Specific */ +#define __NR_mlock 237 +#define __NR_munlock 238 +#define __NR_mlockall 239 +#define __NR_munlockall 240 +#define __NR_sched_setparam 241 +#define __NR_sched_getparam 242 +#define __NR_sched_setscheduler 243 +#define __NR_sched_getscheduler 244 +#define __NR_sched_yield 245 +#define __NR_sched_get_priority_max 246 +#define __NR_sched_get_priority_min 247 +#define __NR_sched_rr_get_interval 248 +#define __NR_nanosleep 249 +#define __NR_mremap 250 +#define __NR__sysctl 251 +#define __NR_getsid 252 +#define __NR_fdatasync 253 +#define __NR_nfsservctl 254 +#define __NR_sync_file_range 255 +#define __NR_clock_settime 256 +#define __NR_clock_gettime 257 +#define __NR_clock_getres 258 +#define __NR_clock_nanosleep 259 +#define __NR_sched_getaffinity 260 +#define __NR_sched_setaffinity 261 +#define __NR_timer_settime 262 +#define __NR_timer_gettime 263 +#define __NR_timer_getoverrun 264 +#define __NR_timer_delete 265 +#define __NR_timer_create 266 +/* #define __NR_vserver 267 Reserved for VSERVER */ +#define __NR_io_setup 268 +#define __NR_io_destroy 269 +#define __NR_io_submit 270 +#define __NR_io_cancel 271 +#define __NR_io_getevents 272 +#define __NR_mq_open 273 +#define __NR_mq_unlink 274 +#define __NR_mq_timedsend 275 +#define __NR_mq_timedreceive 276 +#define __NR_mq_notify 277 +#define __NR_mq_getsetattr 278 +#define __NR_waitid 279 +#define __NR_tee 280 +#define __NR_add_key 281 +#define __NR_request_key 282 +#define __NR_keyctl 283 +#define __NR_openat 284 +#define __NR_mkdirat 285 +#define __NR_mknodat 286 +#define __NR_fchownat 287 +#define __NR_futimesat 288 +#define __NR_fstatat64 289 +#define __NR_unlinkat 290 +#define __NR_renameat 291 +#define __NR_linkat 292 +#define __NR_symlinkat 293 +#define __NR_readlinkat 294 +#define __NR_fchmodat 295 +#define __NR_faccessat 296 +#define __NR_pselect6 297 +#define __NR_ppoll 298 +#define __NR_unshare 299 +#define __NR_set_robust_list 300 +#define __NR_get_robust_list 301 +#define __NR_migrate_pages 302 +#define __NR_mbind 303 +#define __NR_get_mempolicy 304 +#define __NR_set_mempolicy 305 +#define __NR_kexec_load 306 +#define __NR_move_pages 307 +#define __NR_getcpu 308 +#define __NR_epoll_pwait 309 +#define __NR_utimensat 310 +#define __NR_signalfd 311 +#define __NR_timerfd_create 312 +#define __NR_eventfd 313 +#define __NR_fallocate 314 +#define __NR_timerfd_settime 315 +#define __NR_timerfd_gettime 316 +#define __NR_signalfd4 317 +#define __NR_eventfd2 318 +#define __NR_epoll_create1 319 +#define __NR_dup3 320 +#define __NR_pipe2 321 +#define __NR_inotify_init1 322 +#define __NR_accept4 323 + +#define NR_SYSCALLS 324 + +#ifdef __32bit_syscall_numbers__ +/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, + * it never had the plain ones and there is no value to adding those + * old versions into the syscall table. + */ +#define __IGNORE_setresuid +#define __IGNORE_getresuid +#define __IGNORE_setresgid +#define __IGNORE_getresgid +#endif + +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#define __ARCH_WANT_SYS_RT_SIGSUSPEND +#ifndef __32bit_syscall_numbers__ +#define __ARCH_WANT_COMPAT_SYS_TIME +#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND +#endif + +/* + * "Conditional" syscalls + * + * What we want is __attribute__((weak,alias("sys_ni_syscall"))), + * but it doesn't work on all toolchains, so we just do it by hand + */ +#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") + +#endif /* __KERNEL__ */ +#endif /* _SPARC_UNISTD_H */ diff --git a/arch/sparc/include/asm/unistd_32.h b/arch/sparc/include/asm/unistd_32.h deleted file mode 100644 index 0d13d2a4c76f..000000000000 --- a/arch/sparc/include/asm/unistd_32.h +++ /dev/null @@ -1,385 +0,0 @@ -#ifndef _SPARC_UNISTD_H -#define _SPARC_UNISTD_H - -/* - * System calls under the Sparc. - * - * Don't be scared by the ugly clobbers, it is the only way I can - * think of right now to force the arguments into fixed registers - * before the trap into the system call with gcc 'asm' statements. - * - * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net) - * - * SunOS compatibility based upon preliminary work which is: - * - * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) - */ - -#define __NR_restart_syscall 0 /* Linux Specific */ -#define __NR_exit 1 /* Common */ -#define __NR_fork 2 /* Common */ -#define __NR_read 3 /* Common */ -#define __NR_write 4 /* Common */ -#define __NR_open 5 /* Common */ -#define __NR_close 6 /* Common */ -#define __NR_wait4 7 /* Common */ -#define __NR_creat 8 /* Common */ -#define __NR_link 9 /* Common */ -#define __NR_unlink 10 /* Common */ -#define __NR_execv 11 /* SunOS Specific */ -#define __NR_chdir 12 /* Common */ -#define __NR_chown 13 /* Common */ -#define __NR_mknod 14 /* Common */ -#define __NR_chmod 15 /* Common */ -#define __NR_lchown 16 /* Common */ -#define __NR_brk 17 /* Common */ -#define __NR_perfctr 18 /* Performance counter operations */ -#define __NR_lseek 19 /* Common */ -#define __NR_getpid 20 /* Common */ -#define __NR_capget 21 /* Linux Specific */ -#define __NR_capset 22 /* Linux Specific */ -#define __NR_setuid 23 /* Implemented via setreuid in SunOS */ -#define __NR_getuid 24 /* Common */ -#define __NR_vmsplice 25 /* ENOSYS under SunOS */ -#define __NR_ptrace 26 /* Common */ -#define __NR_alarm 27 /* Implemented via setitimer in SunOS */ -#define __NR_sigaltstack 28 /* Common */ -#define __NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */ -#define __NR_utime 30 /* Implemented via utimes() under SunOS */ -#define __NR_lchown32 31 /* Linux sparc32 specific */ -#define __NR_fchown32 32 /* Linux sparc32 specific */ -#define __NR_access 33 /* Common */ -#define __NR_nice 34 /* Implemented via get/setpriority() in SunOS */ -#define __NR_chown32 35 /* Linux sparc32 specific */ -#define __NR_sync 36 /* Common */ -#define __NR_kill 37 /* Common */ -#define __NR_stat 38 /* Common */ -#define __NR_sendfile 39 /* Linux Specific */ -#define __NR_lstat 40 /* Common */ -#define __NR_dup 41 /* Common */ -#define __NR_pipe 42 /* Common */ -#define __NR_times 43 /* Implemented via getrusage() in SunOS */ -#define __NR_getuid32 44 /* Linux sparc32 specific */ -#define __NR_umount2 45 /* Linux Specific */ -#define __NR_setgid 46 /* Implemented via setregid() in SunOS */ -#define __NR_getgid 47 /* Common */ -#define __NR_signal 48 /* Implemented via sigvec() in SunOS */ -#define __NR_geteuid 49 /* SunOS calls getuid() */ -#define __NR_getegid 50 /* SunOS calls getgid() */ -#define __NR_acct 51 /* Common */ -/* #define __NR_memory_ordering 52 Linux sparc64 specific */ -#define __NR_getgid32 53 /* Linux sparc32 specific */ -#define __NR_ioctl 54 /* Common */ -#define __NR_reboot 55 /* Common */ -#define __NR_mmap2 56 /* Linux sparc32 Specific */ -#define __NR_symlink 57 /* Common */ -#define __NR_readlink 58 /* Common */ -#define __NR_execve 59 /* Common */ -#define __NR_umask 60 /* Common */ -#define __NR_chroot 61 /* Common */ -#define __NR_fstat 62 /* Common */ -#define __NR_fstat64 63 /* Linux Specific */ -#define __NR_getpagesize 64 /* Common */ -#define __NR_msync 65 /* Common in newer 1.3.x revs... */ -#define __NR_vfork 66 /* Common */ -#define __NR_pread64 67 /* Linux Specific */ -#define __NR_pwrite64 68 /* Linux Specific */ -#define __NR_geteuid32 69 /* Linux sparc32, sbrk under SunOS */ -#define __NR_getegid32 70 /* Linux sparc32, sstk under SunOS */ -#define __NR_mmap 71 /* Common */ -#define __NR_setreuid32 72 /* Linux sparc32, vadvise under SunOS */ -#define __NR_munmap 73 /* Common */ -#define __NR_mprotect 74 /* Common */ -#define __NR_madvise 75 /* Common */ -#define __NR_vhangup 76 /* Common */ -#define __NR_truncate64 77 /* Linux sparc32 Specific */ -#define __NR_mincore 78 /* Common */ -#define __NR_getgroups 79 /* Common */ -#define __NR_setgroups 80 /* Common */ -#define __NR_getpgrp 81 /* Common */ -#define __NR_setgroups32 82 /* Linux sparc32, setpgrp under SunOS */ -#define __NR_setitimer 83 /* Common */ -#define __NR_ftruncate64 84 /* Linux sparc32 Specific */ -#define __NR_swapon 85 /* Common */ -#define __NR_getitimer 86 /* Common */ -#define __NR_setuid32 87 /* Linux sparc32, gethostname under SunOS */ -#define __NR_sethostname 88 /* Common */ -#define __NR_setgid32 89 /* Linux sparc32, getdtablesize under SunOS */ -#define __NR_dup2 90 /* Common */ -#define __NR_setfsuid32 91 /* Linux sparc32, getdopt under SunOS */ -#define __NR_fcntl 92 /* Common */ -#define __NR_select 93 /* Common */ -#define __NR_setfsgid32 94 /* Linux sparc32, setdopt under SunOS */ -#define __NR_fsync 95 /* Common */ -#define __NR_setpriority 96 /* Common */ -#define __NR_socket 97 /* Common */ -#define __NR_connect 98 /* Common */ -#define __NR_accept 99 /* Common */ -#define __NR_getpriority 100 /* Common */ -#define __NR_rt_sigreturn 101 /* Linux Specific */ -#define __NR_rt_sigaction 102 /* Linux Specific */ -#define __NR_rt_sigprocmask 103 /* Linux Specific */ -#define __NR_rt_sigpending 104 /* Linux Specific */ -#define __NR_rt_sigtimedwait 105 /* Linux Specific */ -#define __NR_rt_sigqueueinfo 106 /* Linux Specific */ -#define __NR_rt_sigsuspend 107 /* Linux Specific */ -#define __NR_setresuid32 108 /* Linux Specific, sigvec under SunOS */ -#define __NR_getresuid32 109 /* Linux Specific, sigblock under SunOS */ -#define __NR_setresgid32 110 /* Linux Specific, sigsetmask under SunOS */ -#define __NR_getresgid32 111 /* Linux Specific, sigpause under SunOS */ -#define __NR_setregid32 112 /* Linux sparc32, sigstack under SunOS */ -#define __NR_recvmsg 113 /* Common */ -#define __NR_sendmsg 114 /* Common */ -#define __NR_getgroups32 115 /* Linux sparc32, vtrace under SunOS */ -#define __NR_gettimeofday 116 /* Common */ -#define __NR_getrusage 117 /* Common */ -#define __NR_getsockopt 118 /* Common */ -#define __NR_getcwd 119 /* Linux Specific */ -#define __NR_readv 120 /* Common */ -#define __NR_writev 121 /* Common */ -#define __NR_settimeofday 122 /* Common */ -#define __NR_fchown 123 /* Common */ -#define __NR_fchmod 124 /* Common */ -#define __NR_recvfrom 125 /* Common */ -#define __NR_setreuid 126 /* Common */ -#define __NR_setregid 127 /* Common */ -#define __NR_rename 128 /* Common */ -#define __NR_truncate 129 /* Common */ -#define __NR_ftruncate 130 /* Common */ -#define __NR_flock 131 /* Common */ -#define __NR_lstat64 132 /* Linux Specific */ -#define __NR_sendto 133 /* Common */ -#define __NR_shutdown 134 /* Common */ -#define __NR_socketpair 135 /* Common */ -#define __NR_mkdir 136 /* Common */ -#define __NR_rmdir 137 /* Common */ -#define __NR_utimes 138 /* SunOS Specific */ -#define __NR_stat64 139 /* Linux Specific */ -#define __NR_sendfile64 140 /* adjtime under SunOS */ -#define __NR_getpeername 141 /* Common */ -#define __NR_futex 142 /* gethostid under SunOS */ -#define __NR_gettid 143 /* ENOSYS under SunOS */ -#define __NR_getrlimit 144 /* Common */ -#define __NR_setrlimit 145 /* Common */ -#define __NR_pivot_root 146 /* Linux Specific, killpg under SunOS */ -#define __NR_prctl 147 /* ENOSYS under SunOS */ -#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */ -#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */ -#define __NR_getsockname 150 /* Common */ -#define __NR_inotify_init 151 /* Linux specific */ -#define __NR_inotify_add_watch 152 /* Linux specific */ -#define __NR_poll 153 /* Common */ -#define __NR_getdents64 154 /* Linux specific */ -#define __NR_fcntl64 155 /* Linux sparc32 Specific */ -#define __NR_inotify_rm_watch 156 /* Linux specific */ -#define __NR_statfs 157 /* Common */ -#define __NR_fstatfs 158 /* Common */ -#define __NR_umount 159 /* Common */ -#define __NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS */ -#define __NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS */ -#define __NR_getdomainname 162 /* SunOS Specific */ -#define __NR_setdomainname 163 /* Common */ -/* #define __NR_utrap_install 164 Linux sparc64 specific */ -#define __NR_quotactl 165 /* Common */ -#define __NR_set_tid_address 166 /* Linux specific, exportfs under SunOS */ -#define __NR_mount 167 /* Common */ -#define __NR_ustat 168 /* Common */ -#define __NR_setxattr 169 /* SunOS: semsys */ -#define __NR_lsetxattr 170 /* SunOS: msgsys */ -#define __NR_fsetxattr 171 /* SunOS: shmsys */ -#define __NR_getxattr 172 /* SunOS: auditsys */ -#define __NR_lgetxattr 173 /* SunOS: rfssys */ -#define __NR_getdents 174 /* Common */ -#define __NR_setsid 175 /* Common */ -#define __NR_fchdir 176 /* Common */ -#define __NR_fgetxattr 177 /* SunOS: fchroot */ -#define __NR_listxattr 178 /* SunOS: vpixsys */ -#define __NR_llistxattr 179 /* SunOS: aioread */ -#define __NR_flistxattr 180 /* SunOS: aiowrite */ -#define __NR_removexattr 181 /* SunOS: aiowait */ -#define __NR_lremovexattr 182 /* SunOS: aiocancel */ -#define __NR_sigpending 183 /* Common */ -#define __NR_query_module 184 /* Linux Specific */ -#define __NR_setpgid 185 /* Common */ -#define __NR_fremovexattr 186 /* SunOS: pathconf */ -#define __NR_tkill 187 /* SunOS: fpathconf */ -#define __NR_exit_group 188 /* Linux specific, sysconf undef SunOS */ -#define __NR_uname 189 /* Linux Specific */ -#define __NR_init_module 190 /* Linux Specific */ -#define __NR_personality 191 /* Linux Specific */ -#define __NR_remap_file_pages 192 /* Linux Specific */ -#define __NR_epoll_create 193 /* Linux Specific */ -#define __NR_epoll_ctl 194 /* Linux Specific */ -#define __NR_epoll_wait 195 /* Linux Specific */ -#define __NR_ioprio_set 196 /* Linux Specific */ -#define __NR_getppid 197 /* Linux Specific */ -#define __NR_sigaction 198 /* Linux Specific */ -#define __NR_sgetmask 199 /* Linux Specific */ -#define __NR_ssetmask 200 /* Linux Specific */ -#define __NR_sigsuspend 201 /* Linux Specific */ -#define __NR_oldlstat 202 /* Linux Specific */ -#define __NR_uselib 203 /* Linux Specific */ -#define __NR_readdir 204 /* Linux Specific */ -#define __NR_readahead 205 /* Linux Specific */ -#define __NR_socketcall 206 /* Linux Specific */ -#define __NR_syslog 207 /* Linux Specific */ -#define __NR_lookup_dcookie 208 /* Linux Specific */ -#define __NR_fadvise64 209 /* Linux Specific */ -#define __NR_fadvise64_64 210 /* Linux Specific */ -#define __NR_tgkill 211 /* Linux Specific */ -#define __NR_waitpid 212 /* Linux Specific */ -#define __NR_swapoff 213 /* Linux Specific */ -#define __NR_sysinfo 214 /* Linux Specific */ -#define __NR_ipc 215 /* Linux Specific */ -#define __NR_sigreturn 216 /* Linux Specific */ -#define __NR_clone 217 /* Linux Specific */ -#define __NR_ioprio_get 218 /* Linux Specific */ -#define __NR_adjtimex 219 /* Linux Specific */ -#define __NR_sigprocmask 220 /* Linux Specific */ -#define __NR_create_module 221 /* Linux Specific */ -#define __NR_delete_module 222 /* Linux Specific */ -#define __NR_get_kernel_syms 223 /* Linux Specific */ -#define __NR_getpgid 224 /* Linux Specific */ -#define __NR_bdflush 225 /* Linux Specific */ -#define __NR_sysfs 226 /* Linux Specific */ -#define __NR_afs_syscall 227 /* Linux Specific */ -#define __NR_setfsuid 228 /* Linux Specific */ -#define __NR_setfsgid 229 /* Linux Specific */ -#define __NR__newselect 230 /* Linux Specific */ -#define __NR_time 231 /* Linux Specific */ -#define __NR_splice 232 /* Linux Specific */ -#define __NR_stime 233 /* Linux Specific */ -#define __NR_statfs64 234 /* Linux Specific */ -#define __NR_fstatfs64 235 /* Linux Specific */ -#define __NR__llseek 236 /* Linux Specific */ -#define __NR_mlock 237 -#define __NR_munlock 238 -#define __NR_mlockall 239 -#define __NR_munlockall 240 -#define __NR_sched_setparam 241 -#define __NR_sched_getparam 242 -#define __NR_sched_setscheduler 243 -#define __NR_sched_getscheduler 244 -#define __NR_sched_yield 245 -#define __NR_sched_get_priority_max 246 -#define __NR_sched_get_priority_min 247 -#define __NR_sched_rr_get_interval 248 -#define __NR_nanosleep 249 -#define __NR_mremap 250 -#define __NR__sysctl 251 -#define __NR_getsid 252 -#define __NR_fdatasync 253 -#define __NR_nfsservctl 254 -#define __NR_sync_file_range 255 -#define __NR_clock_settime 256 -#define __NR_clock_gettime 257 -#define __NR_clock_getres 258 -#define __NR_clock_nanosleep 259 -#define __NR_sched_getaffinity 260 -#define __NR_sched_setaffinity 261 -#define __NR_timer_settime 262 -#define __NR_timer_gettime 263 -#define __NR_timer_getoverrun 264 -#define __NR_timer_delete 265 -#define __NR_timer_create 266 -/* #define __NR_vserver 267 Reserved for VSERVER */ -#define __NR_io_setup 268 -#define __NR_io_destroy 269 -#define __NR_io_submit 270 -#define __NR_io_cancel 271 -#define __NR_io_getevents 272 -#define __NR_mq_open 273 -#define __NR_mq_unlink 274 -#define __NR_mq_timedsend 275 -#define __NR_mq_timedreceive 276 -#define __NR_mq_notify 277 -#define __NR_mq_getsetattr 278 -#define __NR_waitid 279 -#define __NR_tee 280 -#define __NR_add_key 281 -#define __NR_request_key 282 -#define __NR_keyctl 283 -#define __NR_openat 284 -#define __NR_mkdirat 285 -#define __NR_mknodat 286 -#define __NR_fchownat 287 -#define __NR_futimesat 288 -#define __NR_fstatat64 289 -#define __NR_unlinkat 290 -#define __NR_renameat 291 -#define __NR_linkat 292 -#define __NR_symlinkat 293 -#define __NR_readlinkat 294 -#define __NR_fchmodat 295 -#define __NR_faccessat 296 -#define __NR_pselect6 297 -#define __NR_ppoll 298 -#define __NR_unshare 299 -#define __NR_set_robust_list 300 -#define __NR_get_robust_list 301 -#define __NR_migrate_pages 302 -#define __NR_mbind 303 -#define __NR_get_mempolicy 304 -#define __NR_set_mempolicy 305 -#define __NR_kexec_load 306 -#define __NR_move_pages 307 -#define __NR_getcpu 308 -#define __NR_epoll_pwait 309 -#define __NR_utimensat 310 -#define __NR_signalfd 311 -#define __NR_timerfd_create 312 -#define __NR_eventfd 313 -#define __NR_fallocate 314 -#define __NR_timerfd_settime 315 -#define __NR_timerfd_gettime 316 -#define __NR_signalfd4 317 -#define __NR_eventfd2 318 -#define __NR_epoll_create1 319 -#define __NR_dup3 320 -#define __NR_pipe2 321 -#define __NR_inotify_init1 322 -#define __NR_accept4 323 - -#define NR_SYSCALLS 324 - -/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, - * it never had the plain ones and there is no value to adding those - * old versions into the syscall table. - */ -#define __IGNORE_setresuid -#define __IGNORE_getresuid -#define __IGNORE_setresgid -#define __IGNORE_getresgid - -#ifdef __KERNEL__ -#define __ARCH_WANT_IPC_PARSE_VERSION -#define __ARCH_WANT_OLD_READDIR -#define __ARCH_WANT_STAT64 -#define __ARCH_WANT_SYS_ALARM -#define __ARCH_WANT_SYS_GETHOSTNAME -#define __ARCH_WANT_SYS_PAUSE -#define __ARCH_WANT_SYS_SGETMASK -#define __ARCH_WANT_SYS_SIGNAL -#define __ARCH_WANT_SYS_TIME -#define __ARCH_WANT_SYS_UTIME -#define __ARCH_WANT_SYS_WAITPID -#define __ARCH_WANT_SYS_SOCKETCALL -#define __ARCH_WANT_SYS_FADVISE64 -#define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK -#define __ARCH_WANT_SYS_NICE -#define __ARCH_WANT_SYS_OLDUMOUNT -#define __ARCH_WANT_SYS_SIGPENDING -#define __ARCH_WANT_SYS_SIGPROCMASK -#define __ARCH_WANT_SYS_RT_SIGSUSPEND - -/* - * "Conditional" syscalls - * - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), - * but it doesn't work on all toolchains, so we just do it by hand - */ -#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") - -#endif /* __KERNEL__ */ -#endif /* _SPARC_UNISTD_H */ diff --git a/arch/sparc/include/asm/unistd_64.h b/arch/sparc/include/asm/unistd_64.h deleted file mode 100644 index fa5d3c0343c7..000000000000 --- a/arch/sparc/include/asm/unistd_64.h +++ /dev/null @@ -1,380 +0,0 @@ -#ifndef _SPARC64_UNISTD_H -#define _SPARC64_UNISTD_H - -/* - * System calls under the Sparc. - * - * Don't be scared by the ugly clobbers, it is the only way I can - * think of right now to force the arguments into fixed registers - * before the trap into the system call with gcc 'asm' statements. - * - * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net) - * - * SunOS compatibility based upon preliminary work which is: - * - * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) - */ - -#define __NR_restart_syscall 0 /* Linux Specific */ -#define __NR_exit 1 /* Common */ -#define __NR_fork 2 /* Common */ -#define __NR_read 3 /* Common */ -#define __NR_write 4 /* Common */ -#define __NR_open 5 /* Common */ -#define __NR_close 6 /* Common */ -#define __NR_wait4 7 /* Common */ -#define __NR_creat 8 /* Common */ -#define __NR_link 9 /* Common */ -#define __NR_unlink 10 /* Common */ -#define __NR_execv 11 /* SunOS Specific */ -#define __NR_chdir 12 /* Common */ -#define __NR_chown 13 /* Common */ -#define __NR_mknod 14 /* Common */ -#define __NR_chmod 15 /* Common */ -#define __NR_lchown 16 /* Common */ -#define __NR_brk 17 /* Common */ -#define __NR_perfctr 18 /* Performance counter operations */ -#define __NR_lseek 19 /* Common */ -#define __NR_getpid 20 /* Common */ -#define __NR_capget 21 /* Linux Specific */ -#define __NR_capset 22 /* Linux Specific */ -#define __NR_setuid 23 /* Implemented via setreuid in SunOS */ -#define __NR_getuid 24 /* Common */ -#define __NR_vmsplice 25 /* ENOSYS under SunOS */ -#define __NR_ptrace 26 /* Common */ -#define __NR_alarm 27 /* Implemented via setitimer in SunOS */ -#define __NR_sigaltstack 28 /* Common */ -#define __NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */ -#define __NR_utime 30 /* Implemented via utimes() under SunOS */ -/* #define __NR_lchown32 31 Linux sparc32 specific */ -/* #define __NR_fchown32 32 Linux sparc32 specific */ -#define __NR_access 33 /* Common */ -#define __NR_nice 34 /* Implemented via get/setpriority() in SunOS */ -/* #define __NR_chown32 35 Linux sparc32 specific */ -#define __NR_sync 36 /* Common */ -#define __NR_kill 37 /* Common */ -#define __NR_stat 38 /* Common */ -#define __NR_sendfile 39 /* Linux Specific */ -#define __NR_lstat 40 /* Common */ -#define __NR_dup 41 /* Common */ -#define __NR_pipe 42 /* Common */ -#define __NR_times 43 /* Implemented via getrusage() in SunOS */ -/* #define __NR_getuid32 44 Linux sparc32 specific */ -#define __NR_umount2 45 /* Linux Specific */ -#define __NR_setgid 46 /* Implemented via setregid() in SunOS */ -#define __NR_getgid 47 /* Common */ -#define __NR_signal 48 /* Implemented via sigvec() in SunOS */ -#define __NR_geteuid 49 /* SunOS calls getuid() */ -#define __NR_getegid 50 /* SunOS calls getgid() */ -#define __NR_acct 51 /* Common */ -#define __NR_memory_ordering 52 /* Linux Specific */ -/* #define __NR_getgid32 53 Linux sparc32 specific */ -#define __NR_ioctl 54 /* Common */ -#define __NR_reboot 55 /* Common */ -/* #define __NR_mmap2 56 Linux sparc32 Specific */ -#define __NR_symlink 57 /* Common */ -#define __NR_readlink 58 /* Common */ -#define __NR_execve 59 /* Common */ -#define __NR_umask 60 /* Common */ -#define __NR_chroot 61 /* Common */ -#define __NR_fstat 62 /* Common */ -#define __NR_fstat64 63 /* Linux Specific */ -#define __NR_getpagesize 64 /* Common */ -#define __NR_msync 65 /* Common in newer 1.3.x revs... */ -#define __NR_vfork 66 /* Common */ -#define __NR_pread64 67 /* Linux Specific */ -#define __NR_pwrite64 68 /* Linux Specific */ -/* #define __NR_geteuid32 69 Linux sparc32, sbrk under SunOS */ -/* #define __NR_getegid32 70 Linux sparc32, sstk under SunOS */ -#define __NR_mmap 71 /* Common */ -/* #define __NR_setreuid32 72 Linux sparc32, vadvise under SunOS */ -#define __NR_munmap 73 /* Common */ -#define __NR_mprotect 74 /* Common */ -#define __NR_madvise 75 /* Common */ -#define __NR_vhangup 76 /* Common */ -/* #define __NR_truncate64 77 Linux sparc32 Specific */ -#define __NR_mincore 78 /* Common */ -#define __NR_getgroups 79 /* Common */ -#define __NR_setgroups 80 /* Common */ -#define __NR_getpgrp 81 /* Common */ -/* #define __NR_setgroups32 82 Linux sparc32, setpgrp under SunOS */ -#define __NR_setitimer 83 /* Common */ -/* #define __NR_ftruncate64 84 Linux sparc32 Specific */ -#define __NR_swapon 85 /* Common */ -#define __NR_getitimer 86 /* Common */ -/* #define __NR_setuid32 87 Linux sparc32, gethostname under SunOS */ -#define __NR_sethostname 88 /* Common */ -/* #define __NR_setgid32 89 Linux sparc32, getdtablesize under SunOS */ -#define __NR_dup2 90 /* Common */ -/* #define __NR_setfsuid32 91 Linux sparc32, getdopt under SunOS */ -#define __NR_fcntl 92 /* Common */ -#define __NR_select 93 /* Common */ -/* #define __NR_setfsgid32 94 Linux sparc32, setdopt under SunOS */ -#define __NR_fsync 95 /* Common */ -#define __NR_setpriority 96 /* Common */ -#define __NR_socket 97 /* Common */ -#define __NR_connect 98 /* Common */ -#define __NR_accept 99 /* Common */ -#define __NR_getpriority 100 /* Common */ -#define __NR_rt_sigreturn 101 /* Linux Specific */ -#define __NR_rt_sigaction 102 /* Linux Specific */ -#define __NR_rt_sigprocmask 103 /* Linux Specific */ -#define __NR_rt_sigpending 104 /* Linux Specific */ -#define __NR_rt_sigtimedwait 105 /* Linux Specific */ -#define __NR_rt_sigqueueinfo 106 /* Linux Specific */ -#define __NR_rt_sigsuspend 107 /* Linux Specific */ -#define __NR_setresuid 108 /* Linux Specific, sigvec under SunOS */ -#define __NR_getresuid 109 /* Linux Specific, sigblock under SunOS */ -#define __NR_setresgid 110 /* Linux Specific, sigsetmask under SunOS */ -#define __NR_getresgid 111 /* Linux Specific, sigpause under SunOS */ -/* #define __NR_setregid32 75 Linux sparc32, sigstack under SunOS */ -#define __NR_recvmsg 113 /* Common */ -#define __NR_sendmsg 114 /* Common */ -/* #define __NR_getgroups32 115 Linux sparc32, vtrace under SunOS */ -#define __NR_gettimeofday 116 /* Common */ -#define __NR_getrusage 117 /* Common */ -#define __NR_getsockopt 118 /* Common */ -#define __NR_getcwd 119 /* Linux Specific */ -#define __NR_readv 120 /* Common */ -#define __NR_writev 121 /* Common */ -#define __NR_settimeofday 122 /* Common */ -#define __NR_fchown 123 /* Common */ -#define __NR_fchmod 124 /* Common */ -#define __NR_recvfrom 125 /* Common */ -#define __NR_setreuid 126 /* Common */ -#define __NR_setregid 127 /* Common */ -#define __NR_rename 128 /* Common */ -#define __NR_truncate 129 /* Common */ -#define __NR_ftruncate 130 /* Common */ -#define __NR_flock 131 /* Common */ -#define __NR_lstat64 132 /* Linux Specific */ -#define __NR_sendto 133 /* Common */ -#define __NR_shutdown 134 /* Common */ -#define __NR_socketpair 135 /* Common */ -#define __NR_mkdir 136 /* Common */ -#define __NR_rmdir 137 /* Common */ -#define __NR_utimes 138 /* SunOS Specific */ -#define __NR_stat64 139 /* Linux Specific */ -#define __NR_sendfile64 140 /* adjtime under SunOS */ -#define __NR_getpeername 141 /* Common */ -#define __NR_futex 142 /* gethostid under SunOS */ -#define __NR_gettid 143 /* ENOSYS under SunOS */ -#define __NR_getrlimit 144 /* Common */ -#define __NR_setrlimit 145 /* Common */ -#define __NR_pivot_root 146 /* Linux Specific, killpg under SunOS */ -#define __NR_prctl 147 /* ENOSYS under SunOS */ -#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */ -#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */ -#define __NR_getsockname 150 /* Common */ -#define __NR_inotify_init 151 /* Linux specific */ -#define __NR_inotify_add_watch 152 /* Linux specific */ -#define __NR_poll 153 /* Common */ -#define __NR_getdents64 154 /* Linux specific */ -/* #define __NR_fcntl64 155 Linux sparc32 Specific */ -#define __NR_inotify_rm_watch 156 /* Linux specific */ -#define __NR_statfs 157 /* Common */ -#define __NR_fstatfs 158 /* Common */ -#define __NR_umount 159 /* Common */ -#define __NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS */ -#define __NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS */ -#define __NR_getdomainname 162 /* SunOS Specific */ -#define __NR_setdomainname 163 /* Common */ -#define __NR_utrap_install 164 /* SYSV ABI/v9 required */ -#define __NR_quotactl 165 /* Common */ -#define __NR_set_tid_address 166 /* Linux specific, exportfs under SunOS */ -#define __NR_mount 167 /* Common */ -#define __NR_ustat 168 /* Common */ -#define __NR_setxattr 169 /* SunOS: semsys */ -#define __NR_lsetxattr 170 /* SunOS: msgsys */ -#define __NR_fsetxattr 171 /* SunOS: shmsys */ -#define __NR_getxattr 172 /* SunOS: auditsys */ -#define __NR_lgetxattr 173 /* SunOS: rfssys */ -#define __NR_getdents 174 /* Common */ -#define __NR_setsid 175 /* Common */ -#define __NR_fchdir 176 /* Common */ -#define __NR_fgetxattr 177 /* SunOS: fchroot */ -#define __NR_listxattr 178 /* SunOS: vpixsys */ -#define __NR_llistxattr 179 /* SunOS: aioread */ -#define __NR_flistxattr 180 /* SunOS: aiowrite */ -#define __NR_removexattr 181 /* SunOS: aiowait */ -#define __NR_lremovexattr 182 /* SunOS: aiocancel */ -#define __NR_sigpending 183 /* Common */ -#define __NR_query_module 184 /* Linux Specific */ -#define __NR_setpgid 185 /* Common */ -#define __NR_fremovexattr 186 /* SunOS: pathconf */ -#define __NR_tkill 187 /* SunOS: fpathconf */ -#define __NR_exit_group 188 /* Linux specific, sysconf undef SunOS */ -#define __NR_uname 189 /* Linux Specific */ -#define __NR_init_module 190 /* Linux Specific */ -#define __NR_personality 191 /* Linux Specific */ -#define __NR_remap_file_pages 192 /* Linux Specific */ -#define __NR_epoll_create 193 /* Linux Specific */ -#define __NR_epoll_ctl 194 /* Linux Specific */ -#define __NR_epoll_wait 195 /* Linux Specific */ -#define __NR_ioprio_set 196 /* Linux Specific */ -#define __NR_getppid 197 /* Linux Specific */ -#define __NR_sigaction 198 /* Linux Specific */ -#define __NR_sgetmask 199 /* Linux Specific */ -#define __NR_ssetmask 200 /* Linux Specific */ -#define __NR_sigsuspend 201 /* Linux Specific */ -#define __NR_oldlstat 202 /* Linux Specific */ -#define __NR_uselib 203 /* Linux Specific */ -#define __NR_readdir 204 /* Linux Specific */ -#define __NR_readahead 205 /* Linux Specific */ -#define __NR_socketcall 206 /* Linux Specific */ -#define __NR_syslog 207 /* Linux Specific */ -#define __NR_lookup_dcookie 208 /* Linux Specific */ -#define __NR_fadvise64 209 /* Linux Specific */ -#define __NR_fadvise64_64 210 /* Linux Specific */ -#define __NR_tgkill 211 /* Linux Specific */ -#define __NR_waitpid 212 /* Linux Specific */ -#define __NR_swapoff 213 /* Linux Specific */ -#define __NR_sysinfo 214 /* Linux Specific */ -#define __NR_ipc 215 /* Linux Specific */ -#define __NR_sigreturn 216 /* Linux Specific */ -#define __NR_clone 217 /* Linux Specific */ -#define __NR_ioprio_get 218 /* Linux Specific */ -#define __NR_adjtimex 219 /* Linux Specific */ -#define __NR_sigprocmask 220 /* Linux Specific */ -#define __NR_create_module 221 /* Linux Specific */ -#define __NR_delete_module 222 /* Linux Specific */ -#define __NR_get_kernel_syms 223 /* Linux Specific */ -#define __NR_getpgid 224 /* Linux Specific */ -#define __NR_bdflush 225 /* Linux Specific */ -#define __NR_sysfs 226 /* Linux Specific */ -#define __NR_afs_syscall 227 /* Linux Specific */ -#define __NR_setfsuid 228 /* Linux Specific */ -#define __NR_setfsgid 229 /* Linux Specific */ -#define __NR__newselect 230 /* Linux Specific */ -#ifdef __KERNEL__ -#define __NR_time 231 /* Linux sparc32 */ -#endif -#define __NR_splice 232 /* Linux Specific */ -#define __NR_stime 233 /* Linux Specific */ -#define __NR_statfs64 234 /* Linux Specific */ -#define __NR_fstatfs64 235 /* Linux Specific */ -#define __NR__llseek 236 /* Linux Specific */ -#define __NR_mlock 237 -#define __NR_munlock 238 -#define __NR_mlockall 239 -#define __NR_munlockall 240 -#define __NR_sched_setparam 241 -#define __NR_sched_getparam 242 -#define __NR_sched_setscheduler 243 -#define __NR_sched_getscheduler 244 -#define __NR_sched_yield 245 -#define __NR_sched_get_priority_max 246 -#define __NR_sched_get_priority_min 247 -#define __NR_sched_rr_get_interval 248 -#define __NR_nanosleep 249 -#define __NR_mremap 250 -#define __NR__sysctl 251 -#define __NR_getsid 252 -#define __NR_fdatasync 253 -#define __NR_nfsservctl 254 -#define __NR_sync_file_range 255 -#define __NR_clock_settime 256 -#define __NR_clock_gettime 257 -#define __NR_clock_getres 258 -#define __NR_clock_nanosleep 259 -#define __NR_sched_getaffinity 260 -#define __NR_sched_setaffinity 261 -#define __NR_timer_settime 262 -#define __NR_timer_gettime 263 -#define __NR_timer_getoverrun 264 -#define __NR_timer_delete 265 -#define __NR_timer_create 266 -/* #define __NR_vserver 267 Reserved for VSERVER */ -#define __NR_io_setup 268 -#define __NR_io_destroy 269 -#define __NR_io_submit 270 -#define __NR_io_cancel 271 -#define __NR_io_getevents 272 -#define __NR_mq_open 273 -#define __NR_mq_unlink 274 -#define __NR_mq_timedsend 275 -#define __NR_mq_timedreceive 276 -#define __NR_mq_notify 277 -#define __NR_mq_getsetattr 278 -#define __NR_waitid 279 -#define __NR_tee 280 -#define __NR_add_key 281 -#define __NR_request_key 282 -#define __NR_keyctl 283 -#define __NR_openat 284 -#define __NR_mkdirat 285 -#define __NR_mknodat 286 -#define __NR_fchownat 287 -#define __NR_futimesat 288 -#define __NR_fstatat64 289 -#define __NR_unlinkat 290 -#define __NR_renameat 291 -#define __NR_linkat 292 -#define __NR_symlinkat 293 -#define __NR_readlinkat 294 -#define __NR_fchmodat 295 -#define __NR_faccessat 296 -#define __NR_pselect6 297 -#define __NR_ppoll 298 -#define __NR_unshare 299 -#define __NR_set_robust_list 300 -#define __NR_get_robust_list 301 -#define __NR_migrate_pages 302 -#define __NR_mbind 303 -#define __NR_get_mempolicy 304 -#define __NR_set_mempolicy 305 -#define __NR_kexec_load 306 -#define __NR_move_pages 307 -#define __NR_getcpu 308 -#define __NR_epoll_pwait 309 -#define __NR_utimensat 310 -#define __NR_signalfd 311 -#define __NR_timerfd_create 312 -#define __NR_eventfd 313 -#define __NR_fallocate 314 -#define __NR_timerfd_settime 315 -#define __NR_timerfd_gettime 316 -#define __NR_signalfd4 317 -#define __NR_eventfd2 318 -#define __NR_epoll_create1 319 -#define __NR_dup3 320 -#define __NR_pipe2 321 -#define __NR_inotify_init1 322 -#define __NR_accept4 323 - -#define NR_SYSCALLS 324 - -#ifdef __KERNEL__ -#define __ARCH_WANT_IPC_PARSE_VERSION -#define __ARCH_WANT_OLD_READDIR -#define __ARCH_WANT_STAT64 -#define __ARCH_WANT_SYS_ALARM -#define __ARCH_WANT_SYS_GETHOSTNAME -#define __ARCH_WANT_SYS_PAUSE -#define __ARCH_WANT_SYS_SGETMASK -#define __ARCH_WANT_SYS_SIGNAL -#define __ARCH_WANT_SYS_TIME -#define __ARCH_WANT_COMPAT_SYS_TIME -#define __ARCH_WANT_SYS_UTIME -#define __ARCH_WANT_SYS_WAITPID -#define __ARCH_WANT_SYS_SOCKETCALL -#define __ARCH_WANT_SYS_FADVISE64 -#define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK -#define __ARCH_WANT_SYS_NICE -#define __ARCH_WANT_SYS_OLDUMOUNT -#define __ARCH_WANT_SYS_SIGPENDING -#define __ARCH_WANT_SYS_SIGPROCMASK -#define __ARCH_WANT_SYS_RT_SIGSUSPEND -#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND - -/* - * "Conditional" syscalls - * - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), - * but it doesn't work on all toolchains, so we just do it by hand - */ -#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") - -#endif /* __KERNEL__ */ -#endif /* _SPARC64_UNISTD_H */ diff --git a/arch/sparc64/kernel/compat_audit.c b/arch/sparc64/kernel/compat_audit.c index c831b0a4e660..d865575b25bf 100644 --- a/arch/sparc64/kernel/compat_audit.c +++ b/arch/sparc64/kernel/compat_audit.c @@ -1,4 +1,5 @@ -#include +#define __32bit_syscall_numbers__ +#include unsigned sparc32_dir_class[] = { #include From 64273d08dfb41549df3cd815baaaff781cd99992 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 26 Nov 2008 01:00:58 -0800 Subject: [PATCH 29/98] sparc32: Don't btfixup cache flush ops for viking multiple times. Just do it once. Pointed out by Al Viro. Signed-off-by: David S. Miller --- arch/sparc/mm/srmmu.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index dd8aa36f366c..56df59903eaa 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -1916,18 +1916,6 @@ static void __cpuinit poke_viking(void) mreg |= VIKING_SBENABLE; mreg &= ~(VIKING_ACENABLE); srmmu_set_mmureg(mreg); - -#ifdef CONFIG_SMP - /* Avoid unnecessary cross calls. */ - BTFIXUPCOPY_CALL(flush_cache_all, local_flush_cache_all); - BTFIXUPCOPY_CALL(flush_cache_mm, local_flush_cache_mm); - BTFIXUPCOPY_CALL(flush_cache_range, local_flush_cache_range); - BTFIXUPCOPY_CALL(flush_cache_page, local_flush_cache_page); - BTFIXUPCOPY_CALL(__flush_page_to_ram, local_flush_page_to_ram); - BTFIXUPCOPY_CALL(flush_sig_insns, local_flush_sig_insns); - BTFIXUPCOPY_CALL(flush_page_for_dma, local_flush_page_for_dma); - btfixup(); -#endif } static void __init init_viking(void) @@ -2272,6 +2260,17 @@ void __init ld_mmu_srmmu(void) BTFIXUPSET_CALL(__flush_page_to_ram, smp_flush_page_to_ram, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_sig_insns, smp_flush_sig_insns, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(flush_page_for_dma, smp_flush_page_for_dma, BTFIXUPCALL_NORM); + + if (poke_srmmu == poke_viking) { + /* Avoid unnecessary cross calls. */ + BTFIXUPCOPY_CALL(flush_cache_all, local_flush_cache_all); + BTFIXUPCOPY_CALL(flush_cache_mm, local_flush_cache_mm); + BTFIXUPCOPY_CALL(flush_cache_range, local_flush_cache_range); + BTFIXUPCOPY_CALL(flush_cache_page, local_flush_cache_page); + BTFIXUPCOPY_CALL(__flush_page_to_ram, local_flush_page_to_ram); + BTFIXUPCOPY_CALL(flush_sig_insns, local_flush_sig_insns); + BTFIXUPCOPY_CALL(flush_page_for_dma, local_flush_page_for_dma); + } #endif if (sparc_cpu_model == sun4d) From 3a29db32220387cd66e4d02c907c8949c28c5ecb Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 26 Nov 2008 01:07:13 -0800 Subject: [PATCH 30/98] sparc32: pdev_to_pnode() is used from __devinit Signed-off-by: Al Viro Signed-off-by: David S. Miller --- arch/sparc/kernel/pcic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index 462584e55fba..75ed98be3edf 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c @@ -436,7 +436,7 @@ int pcic_present(void) return pcic0_up; } -static int __init pdev_to_pnode(struct linux_pbm_info *pbm, +static int __devinit pdev_to_pnode(struct linux_pbm_info *pbm, struct pci_dev *pdev) { struct linux_prom_pci_registers regs[PROMREG_MAX]; From 6a5726dd6fcc330ef386016e160389e05fd0015d Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 28 Nov 2008 01:19:41 -0800 Subject: [PATCH 31/98] sparc64: Add save_stack_trace_tsk(). And this allows us to indicate HAVE_LATENCYTOP_SUPPORT. Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 4 ++++ arch/sparc64/kernel/stacktrace.c | 32 +++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 10945c344304..e16253531624 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -72,6 +72,10 @@ config LOCKDEP_SUPPORT bool default y if SPARC64 +config HAVE_LATENCYTOP_SUPPORT + bool + default y if SPARC64 + config AUDIT_ARCH bool default y if SPARC64 diff --git a/arch/sparc64/kernel/stacktrace.c b/arch/sparc64/kernel/stacktrace.c index 4e21d4a57d3b..acb12f673757 100644 --- a/arch/sparc64/kernel/stacktrace.c +++ b/arch/sparc64/kernel/stacktrace.c @@ -7,17 +7,18 @@ #include "kstack.h" -void save_stack_trace(struct stack_trace *trace) +static void __save_stack_trace(struct thread_info *tp, + struct stack_trace *trace, + bool skip_sched) { - struct thread_info *tp = task_thread_info(current); unsigned long ksp, fp; - stack_trace_flush(); - - __asm__ __volatile__( - "mov %%fp, %0" - : "=r" (ksp) - ); + if (tp == current_thread_info()) { + stack_trace_flush(); + __asm__ __volatile__("mov %%fp, %0" : "=r" (ksp)); + } else { + ksp = tp->ksp; + } fp = ksp + STACK_BIAS; do { @@ -43,8 +44,21 @@ void save_stack_trace(struct stack_trace *trace) if (trace->skip > 0) trace->skip--; - else + else if (!skip_sched || !in_sched_functions(pc)) trace->entries[trace->nr_entries++] = pc; } while (trace->nr_entries < trace->max_entries); } + +void save_stack_trace(struct stack_trace *trace) +{ + __save_stack_trace(current_thread_info(), trace, false); +} EXPORT_SYMBOL_GPL(save_stack_trace); + +void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) +{ + struct thread_info *tp = task_thread_info(tsk); + + __save_stack_trace(tp, trace, true); +} +EXPORT_SYMBOL_GPL(save_stack_trace_tsk); From 3178a07c33747305b7f7140bd55b0f77e7f239eb Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 28 Nov 2008 02:26:55 -0800 Subject: [PATCH 32/98] sparc64: Add performance counter hypervisor calls for sun4v. Signed-off-by: David S. Miller --- arch/sparc/include/asm/hypervisor.h | 24 ++++++++++++++++++++++ arch/sparc64/kernel/hvcalls.S | 32 +++++++++++++++++++++++++++++ arch/sparc64/kernel/sparc64_ksyms.c | 6 ++++++ 3 files changed, 62 insertions(+) diff --git a/arch/sparc/include/asm/hypervisor.h b/arch/sparc/include/asm/hypervisor.h index 109ae24ba242..bafe5a631b6d 100644 --- a/arch/sparc/include/asm/hypervisor.h +++ b/arch/sparc/include/asm/hypervisor.h @@ -2713,6 +2713,30 @@ extern unsigned long sun4v_ldc_revoke(unsigned long channel, */ #define HV_FAST_SET_PERFREG 0x101 +#define HV_N2_PERF_SPARC_CTL 0x0 +#define HV_N2_PERF_DRAM_CTL0 0x1 +#define HV_N2_PERF_DRAM_CNT0 0x2 +#define HV_N2_PERF_DRAM_CTL1 0x3 +#define HV_N2_PERF_DRAM_CNT1 0x4 +#define HV_N2_PERF_DRAM_CTL2 0x5 +#define HV_N2_PERF_DRAM_CNT2 0x6 +#define HV_N2_PERF_DRAM_CTL3 0x7 +#define HV_N2_PERF_DRAM_CNT3 0x8 + +#define HV_FAST_N2_GET_PERFREG 0x104 +#define HV_FAST_N2_SET_PERFREG 0x105 + +#ifndef __ASSEMBLY__ +extern unsigned long sun4v_niagara_getperf(unsigned long reg, + unsigned long *val); +extern unsigned long sun4v_niagara_setperf(unsigned long reg, + unsigned long val); +extern unsigned long sun4v_niagara2_getperf(unsigned long reg, + unsigned long *val); +extern unsigned long sun4v_niagara2_setperf(unsigned long reg, + unsigned long val); +#endif + /* MMU statistics services. * * The hypervisor maintains MMU statistics and privileged code provides diff --git a/arch/sparc64/kernel/hvcalls.S b/arch/sparc64/kernel/hvcalls.S index e066269d1594..8a5f35ffb15e 100644 --- a/arch/sparc64/kernel/hvcalls.S +++ b/arch/sparc64/kernel/hvcalls.S @@ -766,3 +766,35 @@ ENTRY(sun4v_mmu_demap_all) retl nop ENDPROC(sun4v_mmu_demap_all) + +ENTRY(sun4v_niagara_getperf) + mov %o0, %o4 + mov HV_FAST_GET_PERFREG, %o5 + ta HV_FAST_TRAP + stx %o1, [%o4] + retl + nop +ENDPROC(sun4v_niagara_getperf) + +ENTRY(sun4v_niagara_setperf) + mov HV_FAST_SET_PERFREG, %o5 + ta HV_FAST_TRAP + retl + nop +ENDPROC(sun4v_niagara_setperf) + +ENTRY(sun4v_niagara2_getperf) + mov %o0, %o4 + mov HV_FAST_N2_GET_PERFREG, %o5 + ta HV_FAST_TRAP + stx %o1, [%o4] + retl + nop +ENDPROC(sun4v_niagara2_getperf) + +ENTRY(sun4v_niagara2_setperf) + mov HV_FAST_N2_SET_PERFREG, %o5 + ta HV_FAST_TRAP + retl + nop +ENDPROC(sun4v_niagara2_setperf) diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c index 30bba8b0a3b0..c450825b3fe5 100644 --- a/arch/sparc64/kernel/sparc64_ksyms.c +++ b/arch/sparc64/kernel/sparc64_ksyms.c @@ -49,6 +49,7 @@ #include #include #include +#include struct poll { int fd; @@ -148,6 +149,11 @@ EXPORT_SYMBOL(flush_dcache_page); EXPORT_SYMBOL(__flush_dcache_range); #endif +EXPORT_SYMBOL(sun4v_niagara_getperf); +EXPORT_SYMBOL(sun4v_niagara_setperf); +EXPORT_SYMBOL(sun4v_niagara2_getperf); +EXPORT_SYMBOL(sun4v_niagara2_setperf); + #ifdef CONFIG_SUN_AUXIO EXPORT_SYMBOL(auxio_set_led); EXPORT_SYMBOL(auxio_set_lte); From 63ef34827c1f5ac838e869cc3ecc2d9cfebae152 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 28 Nov 2008 02:27:42 -0800 Subject: [PATCH 33/98] sparc64: Provide oprofile pseudo-NMI on Niagara. Signed-off-by: David S. Miller --- arch/sparc/oprofile/init.c | 151 +++++++++++++++++++++++++++++++++---- 1 file changed, 135 insertions(+), 16 deletions(-) diff --git a/arch/sparc/oprofile/init.c b/arch/sparc/oprofile/init.c index e979dcd77726..d6e170c074fc 100644 --- a/arch/sparc/oprofile/init.c +++ b/arch/sparc/oprofile/init.c @@ -13,32 +13,97 @@ #include #ifdef CONFIG_SPARC64 +#include #include #include #include static int nmi_enabled; +struct pcr_ops { + u64 (*read)(void); + void (*write)(u64); +}; +static const struct pcr_ops *pcr_ops; + +static u64 direct_pcr_read(void) +{ + u64 val; + + read_pcr(val); + return val; +} + +static void direct_pcr_write(u64 val) +{ + write_pcr(val); +} + +static const struct pcr_ops direct_pcr_ops = { + .read = direct_pcr_read, + .write = direct_pcr_write, +}; + +static void n2_pcr_write(u64 val) +{ + unsigned long ret; + + ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val); + if (val != HV_EOK) + write_pcr(val); +} + +static const struct pcr_ops n2_pcr_ops = { + .read = direct_pcr_read, + .write = n2_pcr_write, +}; + +/* In order to commonize as much of the implementation as + * possible, we use PICH as our counter. Mostly this is + * to accomodate Niagara-1 which can only count insn cycles + * in PICH. + */ static u64 picl_value(void) { u32 delta = local_cpu_data().clock_tick / HZ; - return (0 - delta) & 0xffffffff; + return ((u64)((0 - delta) & 0xffffffff)) << 32; } -#define PCR_PIC_PRIV 0x1 /* PIC access is privileged */ -#define PCR_STRACE 0x2 /* Trace supervisor events */ -#define PCR_UTRACE 0x4 /* Trace user events */ +#define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */ +#define PCR_STRACE 0x00000002 /* Trace supervisor events */ +#define PCR_UTRACE 0x00000004 /* Trace user events */ +#define PCR_N2_HTRACE 0x00000008 /* Trace hypervisor events */ +#define PCR_N2_TOE_OV0 0x00000010 /* Trap if PIC 0 overflows */ +#define PCR_N2_TOE_OV1 0x00000020 /* Trap if PIC 1 overflows */ +#define PCR_N2_MASK0 0x00003fc0 +#define PCR_N2_MASK0_SHIFT 6 +#define PCR_N2_SL0 0x0003c000 +#define PCR_N2_SL0_SHIFT 14 +#define PCR_N2_OV0 0x00040000 +#define PCR_N2_MASK1 0x07f80000 +#define PCR_N2_MASK1_SHIFT 19 +#define PCR_N2_SL1 0x78000000 +#define PCR_N2_SL1_SHIFT 27 +#define PCR_N2_OV1 0x80000000 + +#define PCR_SUN4U_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE) +#define PCR_N2_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE | \ + PCR_N2_TOE_OV1 | \ + (2 << PCR_N2_SL1_SHIFT) | \ + (0xff << PCR_N2_MASK1_SHIFT)) + +static u64 pcr_enable = PCR_SUN4U_ENABLE; static void nmi_handler(struct pt_regs *regs) { - write_pcr(PCR_PIC_PRIV); + pcr_ops->write(PCR_PIC_PRIV); if (nmi_enabled) { oprofile_add_sample(regs, 0); write_pic(picl_value()); - write_pcr(PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE); + pcr_ops->write(pcr_enable); } } @@ -48,21 +113,15 @@ static void nmi_handler(struct pt_regs *regs) */ static void cpu_nmi_start(void *_unused) { - write_pcr(PCR_PIC_PRIV); + pcr_ops->write(PCR_PIC_PRIV); write_pic(picl_value()); - /* Bit 0: PIC access is privileged - * Bit 1: Supervisor Trace - * Bit 2: User Trace - * - * And the event selection code for cpu cycles is zero. - */ - write_pcr(PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE); + pcr_ops->write(pcr_enable); } static void cpu_nmi_stop(void *_unused) { - write_pcr(PCR_PIC_PRIV); + pcr_ops->write(PCR_PIC_PRIV); } static int nmi_start(void) @@ -94,10 +153,67 @@ static void nmi_stop(void) synchronize_sched(); } +static unsigned long perf_hsvc_group; +static unsigned long perf_hsvc_major; +static unsigned long perf_hsvc_minor; + +static int __init register_perf_hsvc(void) +{ + if (tlb_type == hypervisor) { + switch (sun4v_chip_type) { + case SUN4V_CHIP_NIAGARA1: + perf_hsvc_group = HV_GRP_NIAG_PERF; + break; + + case SUN4V_CHIP_NIAGARA2: + perf_hsvc_group = HV_GRP_N2_CPU; + break; + + default: + return -ENODEV; + } + + + perf_hsvc_major = 1; + perf_hsvc_minor = 0; + if (sun4v_hvapi_register(perf_hsvc_group, + perf_hsvc_major, + &perf_hsvc_minor)) { + printk("perfmon: Could not register N2 hvapi.\n"); + return -ENODEV; + } + } + return 0; +} + +static void unregister_perf_hsvc(void) +{ + if (tlb_type != hypervisor) + return; + sun4v_hvapi_unregister(perf_hsvc_group); +} + static int oprofile_nmi_init(struct oprofile_operations *ops) { - if (tlb_type != cheetah && tlb_type != cheetah_plus) + int err = register_perf_hsvc(); + + if (err) + return err; + + switch (tlb_type) { + case hypervisor: + pcr_ops = &n2_pcr_ops; + pcr_enable = PCR_N2_ENABLE; + break; + + case cheetah: + case cheetah_plus: + pcr_ops = &direct_pcr_ops; + break; + + default: return -ENODEV; + } ops->create_files = NULL; ops->setup = NULL; @@ -128,4 +244,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) void oprofile_arch_exit(void) { +#ifdef CONFIG_SPARC64 + unregister_perf_hsvc(); +#endif } From 1b1fbbcaad56ede1442e7074bd935a2c98b99596 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 29 Nov 2008 21:44:32 -0800 Subject: [PATCH 34/98] sparc,sparc64: prepare vmlinux.lds.S for unification This patch makes the two vmlinux.lds.S files identical and serve as documentation for the changes in each file. This mainly add stuffs to sparc32 that is otherwise only used by sparc64 and thus it should have no effect. Build tested only. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/vmlinux.lds.S | 99 ++++++++++++++++++++++++------- arch/sparc64/kernel/vmlinux.lds.S | 45 +++++++++++--- 2 files changed, 116 insertions(+), 28 deletions(-) diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S index 5b7e69a8c32f..4bfbeffb7320 100644 --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S @@ -1,27 +1,55 @@ -/* ld script to make SparcLinux kernel */ +/* ld script for sparc32/sparc64 kernel */ #include #include +#ifdef CONFIG_SPARC32 +#define INITIAL_ADDRESS 0x10000 + SIZEOF_HEADERS +#define TEXTSTART 0xf0004000 + +#define SMP_CACHE_BYTES_SHIFT 5 + +#else +#define SMP_CACHE_BYTES_SHIFT 6 +#define INITIAL_ADDRESS 0x4000 +#define TEXTSTART 0x0000000000404000 + +#endif + +#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT) + +#ifdef CONFIG_SPARC32 OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc") OUTPUT_ARCH(sparc) ENTRY(_start) jiffies = jiffies_64 + 4; +#else +/* sparc64 */ +OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc") +OUTPUT_ARCH(sparc:v9a) +ENTRY(_start) +jiffies = jiffies_64; +#endif + SECTIONS { - . = 0x10000 + SIZEOF_HEADERS; - .text 0xf0004000 : + /* swapper_low_pmd_dir is sparc64 only */ + swapper_low_pmd_dir = 0x0000000000402000; + . = INITIAL_ADDRESS; + .text TEXTSTART : { _text = .; *(.text.head) TEXT_TEXT SCHED_TEXT LOCK_TEXT + KPROBES_TEXT *(.gnu.warning) } = 0 _etext = .; PROVIDE (etext = .); - RODATA + + RO_DATA(PAGE_SIZE) .data : { DATA_DATA CONSTRUCTORS @@ -29,25 +57,32 @@ SECTIONS .data1 : { *(.data1) } + . = ALIGN(SMP_CACHE_BYTES); + .data.cacheline_aligned : { + *(.data.cacheline_aligned) + } + . = ALIGN(SMP_CACHE_BYTES); + .data.read_mostly : { + *(.data.read_mostly) + } _edata = .; PROVIDE (edata = .); - .fixup : { __start___fixup = .; *(.fixup) __stop___fixup = .; } + . = ALIGN(16); __ex_table : { __start___ex_table = .; *(__ex_table) __stop___ex_table = .; } - NOTES . = ALIGN(PAGE_SIZE); - __init_begin = .; .init.text : { + __init_begin = .; _sinittext = .; INIT_TEXT _einittext = .; @@ -65,7 +100,7 @@ SECTIONS .initcall.init : { __initcall_start = .; INITCALLS - __initcall_end = .; + __initcall_end = .; } .con_initcall.init : { __con_initcall_start = .; @@ -74,31 +109,54 @@ SECTIONS } SECURITY_INIT + . = ALIGN(4); + .tsb_ldquad_phys_patch : { + __tsb_ldquad_phys_patch = .; + *(.tsb_ldquad_phys_patch) + __tsb_ldquad_phys_patch_end = .; + } + + .tsb_phys_patch : { + __tsb_phys_patch = .; + *(.tsb_phys_patch) + __tsb_phys_patch_end = .; + } + + .cpuid_patch : { + __cpuid_patch = .; + *(.cpuid_patch) + __cpuid_patch_end = .; + } + + .sun4v_1insn_patch : { + __sun4v_1insn_patch = .; + *(.sun4v_1insn_patch) + __sun4v_1insn_patch_end = .; + } + .sun4v_2insn_patch : { + __sun4v_2insn_patch = .; + *(.sun4v_2insn_patch) + __sun4v_2insn_patch_end = .; + } + #ifdef CONFIG_BLK_DEV_INITRD . = ALIGN(PAGE_SIZE); .init.ramfs : { - __initramfs_start = .; + __initramfs_start = .; *(.init.ramfs) - __initramfs_end = .; + __initramfs_end = .; } #endif PERCPU(PAGE_SIZE) + . = ALIGN(PAGE_SIZE); __init_end = .; - . = ALIGN(32); - .data.cacheline_aligned : { - *(.data.cacheline_aligned) - } - . = ALIGN(32); - .data.read_mostly : { - *(.data.read_mostly) - } - __bss_start = .; .sbss : { *(.sbss) - *(.scommon) } + *(.scommon) + } .bss : { *(.dynbss) *(.bss) @@ -106,6 +164,7 @@ SECTIONS } _end = . ; PROVIDE (end = .); + /DISCARD/ : { EXIT_TEXT EXIT_DATA diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S index 01f809617e5e..4bfbeffb7320 100644 --- a/arch/sparc64/kernel/vmlinux.lds.S +++ b/arch/sparc64/kernel/vmlinux.lds.S @@ -1,19 +1,45 @@ -/* ld script to make UltraLinux kernel */ +/* ld script for sparc32/sparc64 kernel */ -#include #include +#include +#ifdef CONFIG_SPARC32 +#define INITIAL_ADDRESS 0x10000 + SIZEOF_HEADERS +#define TEXTSTART 0xf0004000 + +#define SMP_CACHE_BYTES_SHIFT 5 + +#else +#define SMP_CACHE_BYTES_SHIFT 6 +#define INITIAL_ADDRESS 0x4000 +#define TEXTSTART 0x0000000000404000 + +#endif + +#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT) + +#ifdef CONFIG_SPARC32 +OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc") +OUTPUT_ARCH(sparc) +ENTRY(_start) +jiffies = jiffies_64 + 4; +#else +/* sparc64 */ OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc") OUTPUT_ARCH(sparc:v9a) ENTRY(_start) - jiffies = jiffies_64; +#endif + SECTIONS { + /* swapper_low_pmd_dir is sparc64 only */ swapper_low_pmd_dir = 0x0000000000402000; - . = 0x4000; - .text 0x0000000000404000 : { + . = INITIAL_ADDRESS; + .text TEXTSTART : + { _text = .; + *(.text.head) TEXT_TEXT SCHED_TEXT LOCK_TEXT @@ -24,25 +50,27 @@ SECTIONS PROVIDE (etext = .); RO_DATA(PAGE_SIZE) - .data : { + .data : { DATA_DATA CONSTRUCTORS } .data1 : { *(.data1) } - . = ALIGN(64); + . = ALIGN(SMP_CACHE_BYTES); .data.cacheline_aligned : { *(.data.cacheline_aligned) } - . = ALIGN(64); + . = ALIGN(SMP_CACHE_BYTES); .data.read_mostly : { *(.data.read_mostly) } _edata = .; PROVIDE (edata = .); .fixup : { + __start___fixup = .; *(.fixup) + __stop___fixup = .; } . = ALIGN(16); __ex_table : { @@ -59,6 +87,7 @@ SECTIONS INIT_TEXT _einittext = .; } + __init_text_end = .; .init.data : { INIT_DATA } From 104495a1ceea7cacff50fa33b48f3c0b6f8d307a Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 29 Nov 2008 21:45:49 -0800 Subject: [PATCH 35/98] sparc64: use vmlinux.lds.S from sparc Previous commit made them identical so use the sparc version Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc64/kernel/Makefile | 2 +- arch/sparc64/kernel/vmlinux.lds.S | 177 +----------------------------- 2 files changed, 2 insertions(+), 177 deletions(-) diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile index b3e0b986bef8..416eb9bff484 100644 --- a/arch/sparc64/kernel/Makefile +++ b/arch/sparc64/kernel/Makefile @@ -7,7 +7,7 @@ EXTRA_CFLAGS := -Werror CFLAGS_REMOVE_ftrace.o = -pg -extra-y := head.o init_task.o vmlinux.lds +extra-y := head.o init_task.o ../../sparc/kernel/vmlinux.lds obj-y := process.o setup.o cpu.o idprom.o reboot.o \ traps.o auxio.o una_asm.o sysfs.o iommu.o \ diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S index 4bfbeffb7320..4e8becb80112 100644 --- a/arch/sparc64/kernel/vmlinux.lds.S +++ b/arch/sparc64/kernel/vmlinux.lds.S @@ -1,176 +1 @@ -/* ld script for sparc32/sparc64 kernel */ - -#include -#include - -#ifdef CONFIG_SPARC32 -#define INITIAL_ADDRESS 0x10000 + SIZEOF_HEADERS -#define TEXTSTART 0xf0004000 - -#define SMP_CACHE_BYTES_SHIFT 5 - -#else -#define SMP_CACHE_BYTES_SHIFT 6 -#define INITIAL_ADDRESS 0x4000 -#define TEXTSTART 0x0000000000404000 - -#endif - -#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT) - -#ifdef CONFIG_SPARC32 -OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc") -OUTPUT_ARCH(sparc) -ENTRY(_start) -jiffies = jiffies_64 + 4; -#else -/* sparc64 */ -OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc") -OUTPUT_ARCH(sparc:v9a) -ENTRY(_start) -jiffies = jiffies_64; -#endif - -SECTIONS -{ - /* swapper_low_pmd_dir is sparc64 only */ - swapper_low_pmd_dir = 0x0000000000402000; - . = INITIAL_ADDRESS; - .text TEXTSTART : - { - _text = .; - *(.text.head) - TEXT_TEXT - SCHED_TEXT - LOCK_TEXT - KPROBES_TEXT - *(.gnu.warning) - } = 0 - _etext = .; - PROVIDE (etext = .); - - RO_DATA(PAGE_SIZE) - .data : { - DATA_DATA - CONSTRUCTORS - } - .data1 : { - *(.data1) - } - . = ALIGN(SMP_CACHE_BYTES); - .data.cacheline_aligned : { - *(.data.cacheline_aligned) - } - . = ALIGN(SMP_CACHE_BYTES); - .data.read_mostly : { - *(.data.read_mostly) - } - _edata = .; - PROVIDE (edata = .); - .fixup : { - __start___fixup = .; - *(.fixup) - __stop___fixup = .; - } - . = ALIGN(16); - __ex_table : { - __start___ex_table = .; - *(__ex_table) - __stop___ex_table = .; - } - NOTES - - . = ALIGN(PAGE_SIZE); - .init.text : { - __init_begin = .; - _sinittext = .; - INIT_TEXT - _einittext = .; - } - __init_text_end = .; - .init.data : { - INIT_DATA - } - . = ALIGN(16); - .init.setup : { - __setup_start = .; - *(.init.setup) - __setup_end = .; - } - .initcall.init : { - __initcall_start = .; - INITCALLS - __initcall_end = .; - } - .con_initcall.init : { - __con_initcall_start = .; - *(.con_initcall.init) - __con_initcall_end = .; - } - SECURITY_INIT - - . = ALIGN(4); - .tsb_ldquad_phys_patch : { - __tsb_ldquad_phys_patch = .; - *(.tsb_ldquad_phys_patch) - __tsb_ldquad_phys_patch_end = .; - } - - .tsb_phys_patch : { - __tsb_phys_patch = .; - *(.tsb_phys_patch) - __tsb_phys_patch_end = .; - } - - .cpuid_patch : { - __cpuid_patch = .; - *(.cpuid_patch) - __cpuid_patch_end = .; - } - - .sun4v_1insn_patch : { - __sun4v_1insn_patch = .; - *(.sun4v_1insn_patch) - __sun4v_1insn_patch_end = .; - } - .sun4v_2insn_patch : { - __sun4v_2insn_patch = .; - *(.sun4v_2insn_patch) - __sun4v_2insn_patch_end = .; - } - -#ifdef CONFIG_BLK_DEV_INITRD - . = ALIGN(PAGE_SIZE); - .init.ramfs : { - __initramfs_start = .; - *(.init.ramfs) - __initramfs_end = .; - } -#endif - - PERCPU(PAGE_SIZE) - - . = ALIGN(PAGE_SIZE); - __init_end = .; - __bss_start = .; - .sbss : { - *(.sbss) - *(.scommon) - } - .bss : { - *(.dynbss) - *(.bss) - *(COMMON) - } - _end = . ; - PROVIDE (end = .); - - /DISCARD/ : { - EXIT_TEXT - EXIT_DATA - *(.exitcall.exit) - } - - STABS_DEBUG - DWARF_DEBUG -} +#include "../../sparc/kernel/vmlinux.lds.S" From b5db854a91d93c46c6904506ef73ce0d0b074b44 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 29 Nov 2008 21:51:05 -0800 Subject: [PATCH 36/98] sparc,sparc64: unify asm-offsets.c sparc64 does not use constants generated from asm-offsets but to prepare it to do so the parts that could be shared do now generate constants for sparc64 too. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/asm-offsets.c | 19 ++++++++++++++++--- arch/sparc64/kernel/asm-offsets.c | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/arch/sparc/kernel/asm-offsets.c b/arch/sparc/kernel/asm-offsets.c index b5bb99ed892c..68f7e1118e9b 100644 --- a/arch/sparc/kernel/asm-offsets.c +++ b/arch/sparc/kernel/asm-offsets.c @@ -14,15 +14,28 @@ // #include #include -int foo(void) +#ifdef CONFIG_SPARC32 +int sparc32_foo(void) { - DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread)); - BLANK(); DEFINE(AOFF_thread_fork_kpsr, offsetof(struct thread_struct, fork_kpsr)); + return 0; +} +#else +int sparc64_foo(void) +{ + return 0; +} +#endif + +int foo(void) +{ + BLANK(); + DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread)); BLANK(); DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context)); /* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */ return 0; } + diff --git a/arch/sparc64/kernel/asm-offsets.c b/arch/sparc64/kernel/asm-offsets.c index 9e263112a6e2..8cbd958d50bd 100644 --- a/arch/sparc64/kernel/asm-offsets.c +++ b/arch/sparc64/kernel/asm-offsets.c @@ -1 +1 @@ -/* Dummy asm-offsets.c file. Required by kbuild and ready to be used - hint! */ +#include "../../sparc/kernel/asm-offsets.c" From db5ea21a14b7c69bf495a741ae37ba15fb9eabd1 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Tue, 2 Dec 2008 23:15:42 -0800 Subject: [PATCH 37/98] sparc: refactor Makefile The btfixup step needs knowledge of all the .o files, but there is no need to pass them in independent variables. Simplify it to use only two variables. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Makefile | 20 ++++++-------------- arch/sparc/boot/Makefile | 4 ++-- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index c5f3d6fe8a67..43db7e1d5335 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -27,7 +27,6 @@ CPPFLAGS_vmlinux.lds += -m32 LDFLAGS_vmlinux = -r head-y := arch/sparc/kernel/head.o arch/sparc/kernel/init_task.o -HEAD_Y := $(head-y) core-y += arch/sparc/kernel/ arch/sparc/mm/ arch/sparc/math-emu/ libs-y += arch/sparc/prom/ arch/sparc/lib/ @@ -35,23 +34,16 @@ libs-y += arch/sparc/prom/ arch/sparc/lib/ drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/ # Export what is needed by arch/sparc/boot/Makefile -# Renaming is done to avoid confusing pattern matching rules in 2.5.45 (multy-) -INIT_Y := $(patsubst %/, %/built-in.o, $(init-y)) -CORE_Y := $(core-y) -CORE_Y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ -CORE_Y := $(patsubst %/, %/built-in.o, $(CORE_Y)) -DRIVERS_Y := $(patsubst %/, %/built-in.o, $(drivers-y)) -NET_Y := $(patsubst %/, %/built-in.o, $(net-y)) -LIBS_Y1 := $(patsubst %/, %/lib.a, $(libs-y)) -LIBS_Y2 := $(patsubst %/, %/built-in.o, $(libs-y)) -LIBS_Y := $(LIBS_Y1) $(LIBS_Y2) +export VMLINUX_INIT VMLINUX_MAIN +VMLINUX_INIT := $(head-y) $(init-y) +VMLINUX_MAIN := $(core-y) kernel/ mm/ fs/ ipc/ security/ crypto/ block/ +VMLINUX_MAIN += $(patsubst %/, %/lib.a, $(libs-y)) $(libs-y) +VMLINUX_MAIN += $(drivers-y) $(net-y) ifdef CONFIG_KALLSYMS -kallsyms.o := .tmp_kallsyms2.o +export kallsyms.o := .tmp_kallsyms2.o endif -export INIT_Y CORE_Y DRIVERS_Y NET_Y LIBS_Y HEAD_Y kallsyms.o - # Default target all: zImage diff --git a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile index 3e77a9f52248..4fd562034a74 100644 --- a/arch/sparc/boot/Makefile +++ b/arch/sparc/boot/Makefile @@ -37,8 +37,8 @@ define rule_image echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd endef -BTOBJS := $(HEAD_Y) $(INIT_Y) -BTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_Y) +BTOBJS := $(patsubst %/, %/built-in.o, $(VMLINUX_INIT)) +BTLIBS := $(patsubst %/, %/built-in.o, $(VMLINUX_MAIN)) LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds $(BTOBJS) \ --start-group $(BTLIBS) --end-group \ $(kallsyms.o) $(obj)/btfix.o From c489326939b28ca93a8cfcbda8adbeb328101682 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 29 Nov 2008 21:53:26 -0800 Subject: [PATCH 38/98] sparc: clean boot/ Leave all cleaning to boot/Makefile and delete zImage too when we do a 'make clean' Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Makefile | 2 -- arch/sparc/boot/Makefile | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index 43db7e1d5335..9c4c8b8b451d 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -58,8 +58,6 @@ archclean: # This is the image used for packaging KBUILD_IMAGE := $(boot)/zImage -CLEAN_FILES += arch/$(ARCH)/boot/System.map - # Don't use tabs in echo arguments. define archhelp echo '* image - kernel image ($(boot)/image)' diff --git a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile index 4fd562034a74..06b653df820d 100644 --- a/arch/sparc/boot/Makefile +++ b/arch/sparc/boot/Makefile @@ -7,7 +7,8 @@ ROOT_IMG := /usr/src/root.img ELFTOAOUT := elftoaout hostprogs-y := piggyback btfixupprep -targets := tftpboot.img btfix.o btfix.S image +targets := tftpboot.img btfix.o btfix.S image zImage +clean-files := System.map quiet_cmd_elftoaout = ELFTOAOUT $@ cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@ From 14ae84c9933f22ccad34fa6375b8908389b304f0 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 29 Nov 2008 21:54:03 -0800 Subject: [PATCH 39/98] sparc: gitignore a few files With this 'git status' no longer reports any new files At least not for a sparc allnoconfig build Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/boot/.gitignore | 5 +++++ arch/sparc/kernel/.gitignore | 1 + 2 files changed, 6 insertions(+) create mode 100644 arch/sparc/boot/.gitignore create mode 100644 arch/sparc/kernel/.gitignore diff --git a/arch/sparc/boot/.gitignore b/arch/sparc/boot/.gitignore new file mode 100644 index 000000000000..8ffba5762be1 --- /dev/null +++ b/arch/sparc/boot/.gitignore @@ -0,0 +1,5 @@ +btfix.S +btfixupprep +image +zImage + diff --git a/arch/sparc/kernel/.gitignore b/arch/sparc/kernel/.gitignore new file mode 100644 index 000000000000..c5f676c3c224 --- /dev/null +++ b/arch/sparc/kernel/.gitignore @@ -0,0 +1 @@ +vmlinux.lds From 5e53879008b9acefe9f43498fd36db7376e08739 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Tue, 2 Dec 2008 23:17:12 -0800 Subject: [PATCH 40/98] sparc,sparc64: unify Makefile To unify Makefile for sparc and sparc64 a few other steps was needed: 1) separate defconfig files for sparc and sparc64 is required, so locate these in arch/sparc/configs 2) removoval of hack in toplevel Makefile to deal with that headers was in a separate directory compared to the rest The unification of the Makefile required usage of several foo-$(CONFIG_SPARCnn) += due to a few directories pending unification. This will be cleaned up when we unify the remaining directories. Included in this patch are the deletion of a few files in sparc64 as they are no longer needed: Makefile + Kconfig. arch/sparc64/ will after this patch is applied only have four directories (prom, lib, kernel, boot) Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- Makefile | 9 +- arch/sparc/Kconfig | 7 ++ arch/sparc/Makefile | 82 ++++++++++++++++--- .../{defconfig => configs/sparc32_defconfig} | 0 .../configs/sparc64_defconfig} | 0 arch/sparc64/Kconfig | 1 - arch/sparc64/Makefile | 48 ----------- 7 files changed, 81 insertions(+), 66 deletions(-) rename arch/sparc/{defconfig => configs/sparc32_defconfig} (100%) rename arch/{sparc64/defconfig => sparc/configs/sparc64_defconfig} (100%) delete mode 100644 arch/sparc64/Kconfig delete mode 100644 arch/sparc64/Makefile diff --git a/Makefile b/Makefile index 9a49960f7aad..7ec3b97336ca 100644 --- a/Makefile +++ b/Makefile @@ -205,13 +205,14 @@ ifeq ($(ARCH),x86_64) SRCARCH := x86 endif -# Where to locate arch specific headers +# Additional ARCH settings for sparc ifeq ($(ARCH),sparc64) - hdr-arch := sparc -else - hdr-arch := $(SRCARCH) + SRCARCH := sparc endif +# Where to locate arch specific headers +hdr-arch := $(SRCARCH) + KCONFIG_CONFIG ?= .config # SHELL used by kbuild diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index e16253531624..26ddeedb5166 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -41,6 +41,13 @@ config SPARC64 select RTC_DRV_SUN4V select RTC_DRV_STARFIRE +config ARCH_DEFCONFIG + string + default "arch/sparc/configs/sparc32_defconfig" if SPARC32 + default "arch/sparc/configs/sparc64_defconfig" if SPARC64 + + + config 64BIT def_bool y if SPARC64 diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index 9c4c8b8b451d..3c043baf92bc 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -2,9 +2,21 @@ # sparc/Makefile # # Makefile for the architecture dependent flags and dependencies on the -# Sparc. +# Sparc and sparc64. # -# Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu) +# Copyright (C) 1994,1996,1998 David S. Miller (davem@caip.rutgers.edu) +# Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz) + +# We are not yet configured - so test on arch +ifeq ($(ARCH),sparc) + KBUILD_DEFCONFIG := sparc32_defconfig +else + KBUILD_DEFCONFIG := sparc64_defconfig +endif + +ifeq ($(CONFIG_SPARC32),y) +##### +# sparc32 # # @@ -26,10 +38,48 @@ CPPFLAGS_vmlinux.lds += -m32 # Actual linking is done with "make image". LDFLAGS_vmlinux = -r -head-y := arch/sparc/kernel/head.o arch/sparc/kernel/init_task.o +# Default target +all: zImage -core-y += arch/sparc/kernel/ arch/sparc/mm/ arch/sparc/math-emu/ -libs-y += arch/sparc/prom/ arch/sparc/lib/ + +else +##### +# sparc64 +# + +CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64 + +# Undefine sparc when processing vmlinux.lds - it is used +# And teach CPP we are doing 64 bit builds (for this case) +CPPFLAGS_vmlinux.lds += -m64 -Usparc +LDFLAGS := -m elf64_sparc +export BITS := 64 + +KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \ + -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \ + -Wa,--undeclared-regs +KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3) +KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs + +ifeq ($(CONFIG_MCOUNT),y) + KBUILD_CFLAGS += -pg +endif + +endif + +head-$(CONFIG_SPARC32) := arch/sparc/kernel/head.o +head-$(CONFIG_SPARC32) += arch/sparc/kernel/init_task.o +head-$(CONFIG_SPARC64) := arch/sparc64/kernel/head.o +head-$(CONFIG_SPARC64) += arch/sparc64/kernel/init_task.o + +core-$(CONFIG_SPARC32) += arch/sparc/kernel/ +core-$(CONFIG_SPARC64) += arch/sparc64/kernel/ +core-y += arch/sparc/mm/ arch/sparc/math-emu/ + +libs-$(CONFIG_SPARC32) += arch/sparc/prom/ +libs-$(CONFIG_SPARC32) += arch/sparc/lib/ +libs-$(CONFIG_SPARC64) += arch/sparc64/prom/ +libs-$(CONFIG_SPARC64) += arch/sparc64/lib/ drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/ @@ -44,23 +94,29 @@ ifdef CONFIG_KALLSYMS export kallsyms.o := .tmp_kallsyms2.o endif -# Default target -all: zImage +boot-y := arch/sparc/boot +boot-$(CONFIG_SPARC64) := arch/sparc64/boot -boot := arch/sparc/boot - -image zImage tftpboot.img: vmlinux - $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ +image zImage tftpboot.img vmlinux.aout: vmlinux + $(Q)$(MAKE) $(build)=$(boot-y) $(boot-y)/$@ archclean: - $(Q)$(MAKE) $(clean)=$(boot) + $(Q)$(MAKE) $(clean)=$(boot-y) # This is the image used for packaging -KBUILD_IMAGE := $(boot)/zImage +KBUILD_IMAGE := $(boot-y)/zImage # Don't use tabs in echo arguments. +ifeq ($(ARCH),sparc) define archhelp echo '* image - kernel image ($(boot)/image)' echo '* zImage - stripped kernel image ($(boot)/zImage)' echo ' tftpboot.img - image prepared for tftp' endef +else +define archhelp + echo '* vmlinux - Standard sparc64 kernel' + echo ' vmlinux.aout - a.out kernel for sparc64' + echo ' tftpboot.img - image prepared for tftp' +endef +endif diff --git a/arch/sparc/defconfig b/arch/sparc/configs/sparc32_defconfig similarity index 100% rename from arch/sparc/defconfig rename to arch/sparc/configs/sparc32_defconfig diff --git a/arch/sparc64/defconfig b/arch/sparc/configs/sparc64_defconfig similarity index 100% rename from arch/sparc64/defconfig rename to arch/sparc/configs/sparc64_defconfig diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig deleted file mode 100644 index caa9421d598a..000000000000 --- a/arch/sparc64/Kconfig +++ /dev/null @@ -1 +0,0 @@ -source arch/sparc/Kconfig diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile deleted file mode 100644 index bfe08680c897..000000000000 --- a/arch/sparc64/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# sparc64/Makefile -# -# Makefile for the architecture dependent flags and dependencies on the -# 64-bit Sparc. -# -# Copyright (C) 1996,1998 David S. Miller (davem@caip.rutgers.edu) -# Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz) -# - -CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64 - -# Undefine sparc when processing vmlinux.lds - it is used -# And teach CPP we are doing 64 bit builds (for this case) -CPPFLAGS_vmlinux.lds += -m64 -Usparc -LDFLAGS := -m elf64_sparc -export BITS := 64 - -KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \ - -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \ - -Wa,--undeclared-regs -KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3) -KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs - -ifeq ($(CONFIG_MCOUNT),y) - KBUILD_CFLAGS += -pg -endif - -head-y := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o - -core-y += arch/sparc64/kernel/ arch/sparc/mm/ -core-y += arch/sparc/math-emu/ -libs-y += arch/sparc64/prom/ arch/sparc64/lib/ -drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/ - -boot := arch/sparc64/boot - -image tftpboot.img vmlinux.aout: vmlinux - $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ - -archclean: - $(Q)$(MAKE) $(clean)=$(boot) - -define archhelp - echo '* vmlinux - Standard sparc64 kernel' - echo ' vmlinux.aout - a.out kernel for sparc64' - echo ' tftpboot.img - Image prepared for tftp' -endef - From 708d4f09647106d549c646dc459c7ccf2c237cc8 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 29 Nov 2008 22:15:38 -0800 Subject: [PATCH 41/98] sparc: prepare prom/ for unification - rename files where sparc64 uses identical names to *_32.c - refactor Makefile (but keep linking order) Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/prom/Makefile | 15 +++++++++++++-- arch/sparc/prom/{bootstr.c => bootstr_32.c} | 0 arch/sparc/prom/{console.c => console_32.c} | 0 arch/sparc/prom/{devops.c => devops_32.c} | 0 arch/sparc/prom/{init.c => init_32.c} | 0 arch/sparc/prom/{misc.c => misc_32.c} | 0 arch/sparc/prom/{printf.c => printf_32.c} | 0 arch/sparc/prom/{tree.c => tree_32.c} | 0 8 files changed, 13 insertions(+), 2 deletions(-) rename arch/sparc/prom/{bootstr.c => bootstr_32.c} (100%) rename arch/sparc/prom/{console.c => console_32.c} (100%) rename arch/sparc/prom/{devops.c => devops_32.c} (100%) rename arch/sparc/prom/{init.c => init_32.c} (100%) rename arch/sparc/prom/{misc.c => misc_32.c} (100%) rename arch/sparc/prom/{printf.c => printf_32.c} (100%) rename arch/sparc/prom/{tree.c => tree_32.c} (100%) diff --git a/arch/sparc/prom/Makefile b/arch/sparc/prom/Makefile index 8f7e18546c97..74ca9cceaeea 100644 --- a/arch/sparc/prom/Makefile +++ b/arch/sparc/prom/Makefile @@ -2,5 +2,16 @@ # Linux. # -lib-y := bootstr.o devmap.o devops.o init.o memory.o misc.o mp.o \ - palloc.o ranges.o segment.o console.o printf.o tree.o +lib-y := bootstr_$(BITS).o +lib-$(CONFIG_SPARC32) += devmap.o +lib-y += devops_$(BITS).o +lib-y += init_$(BITS).o +lib-$(CONFIG_SPARC32) += memory.o +lib-y += misc_$(BITS).o +lib-$(CONFIG_SPARC32) += mp.o +lib-$(CONFIG_SPARC32) += palloc.o +lib-$(CONFIG_SPARC32) += ranges.o +lib-$(CONFIG_SPARC32) += segment.o +lib-y += console_$(BITS).o +lib-y += printf_$(BITS).o +lib-y += tree_$(BITS).o diff --git a/arch/sparc/prom/bootstr.c b/arch/sparc/prom/bootstr_32.c similarity index 100% rename from arch/sparc/prom/bootstr.c rename to arch/sparc/prom/bootstr_32.c diff --git a/arch/sparc/prom/console.c b/arch/sparc/prom/console_32.c similarity index 100% rename from arch/sparc/prom/console.c rename to arch/sparc/prom/console_32.c diff --git a/arch/sparc/prom/devops.c b/arch/sparc/prom/devops_32.c similarity index 100% rename from arch/sparc/prom/devops.c rename to arch/sparc/prom/devops_32.c diff --git a/arch/sparc/prom/init.c b/arch/sparc/prom/init_32.c similarity index 100% rename from arch/sparc/prom/init.c rename to arch/sparc/prom/init_32.c diff --git a/arch/sparc/prom/misc.c b/arch/sparc/prom/misc_32.c similarity index 100% rename from arch/sparc/prom/misc.c rename to arch/sparc/prom/misc_32.c diff --git a/arch/sparc/prom/printf.c b/arch/sparc/prom/printf_32.c similarity index 100% rename from arch/sparc/prom/printf.c rename to arch/sparc/prom/printf_32.c diff --git a/arch/sparc/prom/tree.c b/arch/sparc/prom/tree_32.c similarity index 100% rename from arch/sparc/prom/tree.c rename to arch/sparc/prom/tree_32.c From 5de18cde3b748aafc6d187d7655ba42f2260501d Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 29 Nov 2008 22:16:52 -0800 Subject: [PATCH 42/98] sparc,sparc64: unify prom/ - all files with identical names copied and renamed to *_64.c - the remaning files copied as is - added sparc64 specific files to sparc/prom/Makefile - teach sparc64 Makefile to look into sparc/prom/ - delete unused Makefile from sparc64/prom/ linking order was not kept for sparc64 with this change. It was not possible to keep linking order for both sparc and sparc64 and as sparc64 see more testing than sparc it was natural to break linking order on sparc64. Should it have any effect it would be detected sooner this way. printf_32.c and printf_64.c are obvious candidates to be merged but they are not 100% equal so that was left for later Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Makefile | 3 +-- arch/sparc/prom/Makefile | 4 ++++ arch/{sparc64/prom/bootstr.c => sparc/prom/bootstr_64.c} | 0 arch/{sparc64 => sparc}/prom/cif.S | 0 arch/{sparc64/prom/console.c => sparc/prom/console_64.c} | 0 arch/{sparc64/prom/devops.c => sparc/prom/devops_64.c} | 0 arch/{sparc64/prom/init.c => sparc/prom/init_64.c} | 0 arch/{sparc64/prom/misc.c => sparc/prom/misc_64.c} | 0 arch/{sparc64 => sparc}/prom/p1275.c | 0 arch/{sparc64/prom/printf.c => sparc/prom/printf_64.c} | 0 arch/{sparc64/prom/tree.c => sparc/prom/tree_64.c} | 0 arch/sparc64/prom/Makefile | 9 --------- 12 files changed, 5 insertions(+), 11 deletions(-) rename arch/{sparc64/prom/bootstr.c => sparc/prom/bootstr_64.c} (100%) rename arch/{sparc64 => sparc}/prom/cif.S (100%) rename arch/{sparc64/prom/console.c => sparc/prom/console_64.c} (100%) rename arch/{sparc64/prom/devops.c => sparc/prom/devops_64.c} (100%) rename arch/{sparc64/prom/init.c => sparc/prom/init_64.c} (100%) rename arch/{sparc64/prom/misc.c => sparc/prom/misc_64.c} (100%) rename arch/{sparc64 => sparc}/prom/p1275.c (100%) rename arch/{sparc64/prom/printf.c => sparc/prom/printf_64.c} (100%) rename arch/{sparc64/prom/tree.c => sparc/prom/tree_64.c} (100%) delete mode 100644 arch/sparc64/prom/Makefile diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index 3c043baf92bc..317aad600ed7 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -76,9 +76,8 @@ core-$(CONFIG_SPARC32) += arch/sparc/kernel/ core-$(CONFIG_SPARC64) += arch/sparc64/kernel/ core-y += arch/sparc/mm/ arch/sparc/math-emu/ -libs-$(CONFIG_SPARC32) += arch/sparc/prom/ +libs-y += arch/sparc/prom/ libs-$(CONFIG_SPARC32) += arch/sparc/lib/ -libs-$(CONFIG_SPARC64) += arch/sparc64/prom/ libs-$(CONFIG_SPARC64) += arch/sparc64/lib/ drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/ diff --git a/arch/sparc/prom/Makefile b/arch/sparc/prom/Makefile index 74ca9cceaeea..f8e0278b8b4f 100644 --- a/arch/sparc/prom/Makefile +++ b/arch/sparc/prom/Makefile @@ -1,6 +1,8 @@ # Makefile for the Sun Boot PROM interface library under # Linux. # +asflags := -ansi +ccflags := -Werror lib-y := bootstr_$(BITS).o lib-$(CONFIG_SPARC32) += devmap.o @@ -15,3 +17,5 @@ lib-$(CONFIG_SPARC32) += segment.o lib-y += console_$(BITS).o lib-y += printf_$(BITS).o lib-y += tree_$(BITS).o +lib-$(CONFIG_SPARC64) += p1275.o +lib-$(CONFIG_SPARC64) += cif.o diff --git a/arch/sparc64/prom/bootstr.c b/arch/sparc/prom/bootstr_64.c similarity index 100% rename from arch/sparc64/prom/bootstr.c rename to arch/sparc/prom/bootstr_64.c diff --git a/arch/sparc64/prom/cif.S b/arch/sparc/prom/cif.S similarity index 100% rename from arch/sparc64/prom/cif.S rename to arch/sparc/prom/cif.S diff --git a/arch/sparc64/prom/console.c b/arch/sparc/prom/console_64.c similarity index 100% rename from arch/sparc64/prom/console.c rename to arch/sparc/prom/console_64.c diff --git a/arch/sparc64/prom/devops.c b/arch/sparc/prom/devops_64.c similarity index 100% rename from arch/sparc64/prom/devops.c rename to arch/sparc/prom/devops_64.c diff --git a/arch/sparc64/prom/init.c b/arch/sparc/prom/init_64.c similarity index 100% rename from arch/sparc64/prom/init.c rename to arch/sparc/prom/init_64.c diff --git a/arch/sparc64/prom/misc.c b/arch/sparc/prom/misc_64.c similarity index 100% rename from arch/sparc64/prom/misc.c rename to arch/sparc/prom/misc_64.c diff --git a/arch/sparc64/prom/p1275.c b/arch/sparc/prom/p1275.c similarity index 100% rename from arch/sparc64/prom/p1275.c rename to arch/sparc/prom/p1275.c diff --git a/arch/sparc64/prom/printf.c b/arch/sparc/prom/printf_64.c similarity index 100% rename from arch/sparc64/prom/printf.c rename to arch/sparc/prom/printf_64.c diff --git a/arch/sparc64/prom/tree.c b/arch/sparc/prom/tree_64.c similarity index 100% rename from arch/sparc64/prom/tree.c rename to arch/sparc/prom/tree_64.c diff --git a/arch/sparc64/prom/Makefile b/arch/sparc64/prom/Makefile deleted file mode 100644 index 8c94483ca54d..000000000000 --- a/arch/sparc64/prom/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# Makefile for the Sun Boot PROM interface library under -# Linux. -# - -EXTRA_AFLAGS := -ansi -EXTRA_CFLAGS := -Werror - -lib-y := bootstr.o devops.o init.o misc.o \ - tree.o console.o printf.o p1275.o cif.o From 18269c0fd4db9bec2668f895f21d742486ccb90f Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Wed, 3 Dec 2008 03:07:00 -0800 Subject: [PATCH 43/98] sparc: prepare lib/ for unification Identical named files renamed to _32.S Refactored Makefile to prepare for unification. Linking order was altered slightly - but this is a lib.a file so it should not matter. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/lib/Makefile | 25 +++++++++++++------ arch/sparc/lib/{atomic.S => atomic_32.S} | 0 arch/sparc/lib/{checksum.S => checksum_32.S} | 0 arch/sparc/lib/{memcmp.S => memcmp_32.S} | 0 arch/sparc/lib/{memscan.S => memscan_32.S} | 0 arch/sparc/lib/{rwsem.S => rwsem_32.S} | 0 arch/sparc/lib/{strlen.S => strlen_32.S} | 0 .../lib/{strlen_user.S => strlen_user_32.S} | 0 arch/sparc/lib/{strncmp.S => strncmp_32.S} | 0 ...cpy_from_user.S => strncpy_from_user_32.S} | 0 10 files changed, 17 insertions(+), 8 deletions(-) rename arch/sparc/lib/{atomic.S => atomic_32.S} (100%) rename arch/sparc/lib/{checksum.S => checksum_32.S} (100%) rename arch/sparc/lib/{memcmp.S => memcmp_32.S} (100%) rename arch/sparc/lib/{memscan.S => memscan_32.S} (100%) rename arch/sparc/lib/{rwsem.S => rwsem_32.S} (100%) rename arch/sparc/lib/{strlen.S => strlen_32.S} (100%) rename arch/sparc/lib/{strlen_user.S => strlen_user_32.S} (100%) rename arch/sparc/lib/{strncmp.S => strncmp_32.S} (100%) rename arch/sparc/lib/{strncpy_from_user.S => strncpy_from_user_32.S} (100%) diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile index 6e303e10c3b9..f2650545c774 100644 --- a/arch/sparc/lib/Makefile +++ b/arch/sparc/lib/Makefile @@ -1,13 +1,22 @@ # Makefile for Sparc library files.. # -EXTRA_AFLAGS := -ansi -DST_DIV0=0x02 +asflags-y := -ansi -DST_DIV0=0x02 +ccflags-y := -Werror -lib-y := mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o memcpy.o memset.o \ - strlen.o checksum.o blockops.o memscan.o memcmp.o strncmp.o \ - strncpy_from_user.o divdi3.o udivdi3.o strlen_user.o \ - copy_user.o locks.o atomic.o \ - lshrdi3.o ashldi3.o rwsem.o muldi3.o bitext.o \ - cmpdi2.o +lib-$(CONFIG_SPARC32) += mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o +lib-$(CONFIG_SPARC32) += memcpy.o memset.o +lib-y += strlen_$(BITS).o +lib-y += checksum_$(BITS).o +lib-$(CONFIG_SPARC32) += blockops.o +lib-y += memscan_$(BITS).o memcmp_$(BITS).o strncmp_$(BITS).o +lib-y += strncpy_from_user_$(BITS).o strlen_user_$(BITS).o +lib-$(CONFIG_SPARC32) += divdi3.o udivdi3.o +lib-$(CONFIG_SPARC32) += copy_user.o locks.o +lib-y += atomic_$(BITS).o +lib-$(CONFIG_SPARC32) += lshrdi3.o ashldi3.o +lib-y += rwsem_$(BITS).o +lib-$(CONFIG_SPARC32) += muldi3.o bitext.o cmpdi2.o -obj-y += iomap.o atomic32.o +obj-y += iomap.o +obj-$(CONFIG_SPARC32) += atomic32.o diff --git a/arch/sparc/lib/atomic.S b/arch/sparc/lib/atomic_32.S similarity index 100% rename from arch/sparc/lib/atomic.S rename to arch/sparc/lib/atomic_32.S diff --git a/arch/sparc/lib/checksum.S b/arch/sparc/lib/checksum_32.S similarity index 100% rename from arch/sparc/lib/checksum.S rename to arch/sparc/lib/checksum_32.S diff --git a/arch/sparc/lib/memcmp.S b/arch/sparc/lib/memcmp_32.S similarity index 100% rename from arch/sparc/lib/memcmp.S rename to arch/sparc/lib/memcmp_32.S diff --git a/arch/sparc/lib/memscan.S b/arch/sparc/lib/memscan_32.S similarity index 100% rename from arch/sparc/lib/memscan.S rename to arch/sparc/lib/memscan_32.S diff --git a/arch/sparc/lib/rwsem.S b/arch/sparc/lib/rwsem_32.S similarity index 100% rename from arch/sparc/lib/rwsem.S rename to arch/sparc/lib/rwsem_32.S diff --git a/arch/sparc/lib/strlen.S b/arch/sparc/lib/strlen_32.S similarity index 100% rename from arch/sparc/lib/strlen.S rename to arch/sparc/lib/strlen_32.S diff --git a/arch/sparc/lib/strlen_user.S b/arch/sparc/lib/strlen_user_32.S similarity index 100% rename from arch/sparc/lib/strlen_user.S rename to arch/sparc/lib/strlen_user_32.S diff --git a/arch/sparc/lib/strncmp.S b/arch/sparc/lib/strncmp_32.S similarity index 100% rename from arch/sparc/lib/strncmp.S rename to arch/sparc/lib/strncmp_32.S diff --git a/arch/sparc/lib/strncpy_from_user.S b/arch/sparc/lib/strncpy_from_user_32.S similarity index 100% rename from arch/sparc/lib/strncpy_from_user.S rename to arch/sparc/lib/strncpy_from_user_32.S From 478b8fecda511942404ac232897a718cecd13e48 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Wed, 3 Dec 2008 03:10:25 -0800 Subject: [PATCH 44/98] sparc,sparc64: unify lib/ o Renamed files in sparc64 to _64.S when identical to sparc32 files. o iomap.c were equal for sparc32 and sparc64 o adjusted sparc/Makefile now we have only one lib/ Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Makefile | 3 +- arch/{sparc64 => sparc}/lib/GENbzero.S | 0 .../lib/GENcopy_from_user.S | 0 arch/{sparc64 => sparc}/lib/GENcopy_to_user.S | 0 arch/{sparc64 => sparc}/lib/GENmemcpy.S | 0 arch/{sparc64 => sparc}/lib/GENpage.S | 0 arch/{sparc64 => sparc}/lib/GENpatch.S | 0 arch/sparc/lib/Makefile | 22 +++++++++ .../lib/NG2copy_from_user.S | 0 arch/{sparc64 => sparc}/lib/NG2copy_to_user.S | 0 arch/{sparc64 => sparc}/lib/NG2memcpy.S | 0 arch/{sparc64 => sparc}/lib/NG2page.S | 0 arch/{sparc64 => sparc}/lib/NG2patch.S | 0 arch/{sparc64 => sparc}/lib/NGbzero.S | 0 .../{sparc64 => sparc}/lib/NGcopy_from_user.S | 0 arch/{sparc64 => sparc}/lib/NGcopy_to_user.S | 0 arch/{sparc64 => sparc}/lib/NGmemcpy.S | 0 arch/{sparc64 => sparc}/lib/NGpage.S | 0 arch/{sparc64 => sparc}/lib/NGpatch.S | 0 arch/{sparc64 => sparc}/lib/PeeCeeI.c | 0 .../{sparc64 => sparc}/lib/U1copy_from_user.S | 0 arch/{sparc64 => sparc}/lib/U1copy_to_user.S | 0 arch/{sparc64 => sparc}/lib/U1memcpy.S | 0 .../{sparc64 => sparc}/lib/U3copy_from_user.S | 0 arch/{sparc64 => sparc}/lib/U3copy_to_user.S | 0 arch/{sparc64 => sparc}/lib/U3memcpy.S | 0 arch/{sparc64 => sparc}/lib/U3patch.S | 0 arch/{sparc64 => sparc}/lib/VISsave.S | 0 .../lib/atomic.S => sparc/lib/atomic_64.S} | 0 arch/{sparc64 => sparc}/lib/bitops.S | 0 arch/{sparc64 => sparc}/lib/bzero.S | 0 .../checksum.S => sparc/lib/checksum_64.S} | 0 arch/{sparc64 => sparc}/lib/clear_page.S | 0 arch/{sparc64 => sparc}/lib/copy_in_user.S | 0 arch/{sparc64 => sparc}/lib/copy_page.S | 0 arch/{sparc64 => sparc}/lib/csum_copy.S | 0 .../lib/csum_copy_from_user.S | 0 .../lib/csum_copy_to_user.S | 0 arch/{sparc64 => sparc}/lib/ipcsum.S | 0 arch/{sparc64 => sparc}/lib/mcount.S | 0 .../lib/memcmp.S => sparc/lib/memcmp_64.S} | 0 arch/{sparc64 => sparc}/lib/memmove.S | 0 .../lib/memscan.S => sparc/lib/memscan_64.S} | 0 .../lib/rwsem.S => sparc/lib/rwsem_64.S} | 0 .../lib/strlen.S => sparc/lib/strlen_64.S} | 0 .../lib/strlen_user_64.S} | 0 .../lib/strncmp.S => sparc/lib/strncmp_64.S} | 0 .../lib/strncpy_from_user_64.S} | 0 arch/{sparc64 => sparc}/lib/user_fixup.c | 0 arch/{sparc64 => sparc}/lib/xor.S | 0 arch/sparc64/lib/Makefile | 23 --------- arch/sparc64/lib/iomap.c | 48 ------------------- 52 files changed, 23 insertions(+), 73 deletions(-) rename arch/{sparc64 => sparc}/lib/GENbzero.S (100%) rename arch/{sparc64 => sparc}/lib/GENcopy_from_user.S (100%) rename arch/{sparc64 => sparc}/lib/GENcopy_to_user.S (100%) rename arch/{sparc64 => sparc}/lib/GENmemcpy.S (100%) rename arch/{sparc64 => sparc}/lib/GENpage.S (100%) rename arch/{sparc64 => sparc}/lib/GENpatch.S (100%) rename arch/{sparc64 => sparc}/lib/NG2copy_from_user.S (100%) rename arch/{sparc64 => sparc}/lib/NG2copy_to_user.S (100%) rename arch/{sparc64 => sparc}/lib/NG2memcpy.S (100%) rename arch/{sparc64 => sparc}/lib/NG2page.S (100%) rename arch/{sparc64 => sparc}/lib/NG2patch.S (100%) rename arch/{sparc64 => sparc}/lib/NGbzero.S (100%) rename arch/{sparc64 => sparc}/lib/NGcopy_from_user.S (100%) rename arch/{sparc64 => sparc}/lib/NGcopy_to_user.S (100%) rename arch/{sparc64 => sparc}/lib/NGmemcpy.S (100%) rename arch/{sparc64 => sparc}/lib/NGpage.S (100%) rename arch/{sparc64 => sparc}/lib/NGpatch.S (100%) rename arch/{sparc64 => sparc}/lib/PeeCeeI.c (100%) rename arch/{sparc64 => sparc}/lib/U1copy_from_user.S (100%) rename arch/{sparc64 => sparc}/lib/U1copy_to_user.S (100%) rename arch/{sparc64 => sparc}/lib/U1memcpy.S (100%) rename arch/{sparc64 => sparc}/lib/U3copy_from_user.S (100%) rename arch/{sparc64 => sparc}/lib/U3copy_to_user.S (100%) rename arch/{sparc64 => sparc}/lib/U3memcpy.S (100%) rename arch/{sparc64 => sparc}/lib/U3patch.S (100%) rename arch/{sparc64 => sparc}/lib/VISsave.S (100%) rename arch/{sparc64/lib/atomic.S => sparc/lib/atomic_64.S} (100%) rename arch/{sparc64 => sparc}/lib/bitops.S (100%) rename arch/{sparc64 => sparc}/lib/bzero.S (100%) rename arch/{sparc64/lib/checksum.S => sparc/lib/checksum_64.S} (100%) rename arch/{sparc64 => sparc}/lib/clear_page.S (100%) rename arch/{sparc64 => sparc}/lib/copy_in_user.S (100%) rename arch/{sparc64 => sparc}/lib/copy_page.S (100%) rename arch/{sparc64 => sparc}/lib/csum_copy.S (100%) rename arch/{sparc64 => sparc}/lib/csum_copy_from_user.S (100%) rename arch/{sparc64 => sparc}/lib/csum_copy_to_user.S (100%) rename arch/{sparc64 => sparc}/lib/ipcsum.S (100%) rename arch/{sparc64 => sparc}/lib/mcount.S (100%) rename arch/{sparc64/lib/memcmp.S => sparc/lib/memcmp_64.S} (100%) rename arch/{sparc64 => sparc}/lib/memmove.S (100%) rename arch/{sparc64/lib/memscan.S => sparc/lib/memscan_64.S} (100%) rename arch/{sparc64/lib/rwsem.S => sparc/lib/rwsem_64.S} (100%) rename arch/{sparc64/lib/strlen.S => sparc/lib/strlen_64.S} (100%) rename arch/{sparc64/lib/strlen_user.S => sparc/lib/strlen_user_64.S} (100%) rename arch/{sparc64/lib/strncmp.S => sparc/lib/strncmp_64.S} (100%) rename arch/{sparc64/lib/strncpy_from_user.S => sparc/lib/strncpy_from_user_64.S} (100%) rename arch/{sparc64 => sparc}/lib/user_fixup.c (100%) rename arch/{sparc64 => sparc}/lib/xor.S (100%) delete mode 100644 arch/sparc64/lib/Makefile delete mode 100644 arch/sparc64/lib/iomap.c diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index 317aad600ed7..b1d691489ed4 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -77,8 +77,7 @@ core-$(CONFIG_SPARC64) += arch/sparc64/kernel/ core-y += arch/sparc/mm/ arch/sparc/math-emu/ libs-y += arch/sparc/prom/ -libs-$(CONFIG_SPARC32) += arch/sparc/lib/ -libs-$(CONFIG_SPARC64) += arch/sparc64/lib/ +libs-y += arch/sparc/lib/ drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/ diff --git a/arch/sparc64/lib/GENbzero.S b/arch/sparc/lib/GENbzero.S similarity index 100% rename from arch/sparc64/lib/GENbzero.S rename to arch/sparc/lib/GENbzero.S diff --git a/arch/sparc64/lib/GENcopy_from_user.S b/arch/sparc/lib/GENcopy_from_user.S similarity index 100% rename from arch/sparc64/lib/GENcopy_from_user.S rename to arch/sparc/lib/GENcopy_from_user.S diff --git a/arch/sparc64/lib/GENcopy_to_user.S b/arch/sparc/lib/GENcopy_to_user.S similarity index 100% rename from arch/sparc64/lib/GENcopy_to_user.S rename to arch/sparc/lib/GENcopy_to_user.S diff --git a/arch/sparc64/lib/GENmemcpy.S b/arch/sparc/lib/GENmemcpy.S similarity index 100% rename from arch/sparc64/lib/GENmemcpy.S rename to arch/sparc/lib/GENmemcpy.S diff --git a/arch/sparc64/lib/GENpage.S b/arch/sparc/lib/GENpage.S similarity index 100% rename from arch/sparc64/lib/GENpage.S rename to arch/sparc/lib/GENpage.S diff --git a/arch/sparc64/lib/GENpatch.S b/arch/sparc/lib/GENpatch.S similarity index 100% rename from arch/sparc64/lib/GENpatch.S rename to arch/sparc/lib/GENpatch.S diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile index f2650545c774..05ae5c945e35 100644 --- a/arch/sparc/lib/Makefile +++ b/arch/sparc/lib/Makefile @@ -18,5 +18,27 @@ lib-$(CONFIG_SPARC32) += lshrdi3.o ashldi3.o lib-y += rwsem_$(BITS).o lib-$(CONFIG_SPARC32) += muldi3.o bitext.o cmpdi2.o +lib-$(CONFIG_SPARC64) += PeeCeeI.o copy_page.o clear_page.o bzero.o +lib-$(CONFIG_SPARC64) += csum_copy.o csum_copy_from_user.o csum_copy_to_user.o +lib-$(CONFIG_SPARC64) += VISsave.o +lib-$(CONFIG_SPARC64) += bitops.o + +lib-$(CONFIG_SPARC64) += U1memcpy.o U1copy_from_user.o U1copy_to_user.o + +lib-$(CONFIG_SPARC64) += U3memcpy.o U3copy_from_user.o U3copy_to_user.o +lib-$(CONFIG_SPARC64) += U3patch.o + +lib-$(CONFIG_SPARC64) += NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o +lib-$(CONFIG_SPARC64) += NGpatch.o NGpage.o NGbzero.o + +lib-$(CONFIG_SPARC64) += NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o +lib-$(CONFIG_SPARC64) += NG2patch.o NG2page.o + +lib-$(CONFIG_SPARC64) += GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o +lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o + +lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o +lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o + obj-y += iomap.o obj-$(CONFIG_SPARC32) += atomic32.o diff --git a/arch/sparc64/lib/NG2copy_from_user.S b/arch/sparc/lib/NG2copy_from_user.S similarity index 100% rename from arch/sparc64/lib/NG2copy_from_user.S rename to arch/sparc/lib/NG2copy_from_user.S diff --git a/arch/sparc64/lib/NG2copy_to_user.S b/arch/sparc/lib/NG2copy_to_user.S similarity index 100% rename from arch/sparc64/lib/NG2copy_to_user.S rename to arch/sparc/lib/NG2copy_to_user.S diff --git a/arch/sparc64/lib/NG2memcpy.S b/arch/sparc/lib/NG2memcpy.S similarity index 100% rename from arch/sparc64/lib/NG2memcpy.S rename to arch/sparc/lib/NG2memcpy.S diff --git a/arch/sparc64/lib/NG2page.S b/arch/sparc/lib/NG2page.S similarity index 100% rename from arch/sparc64/lib/NG2page.S rename to arch/sparc/lib/NG2page.S diff --git a/arch/sparc64/lib/NG2patch.S b/arch/sparc/lib/NG2patch.S similarity index 100% rename from arch/sparc64/lib/NG2patch.S rename to arch/sparc/lib/NG2patch.S diff --git a/arch/sparc64/lib/NGbzero.S b/arch/sparc/lib/NGbzero.S similarity index 100% rename from arch/sparc64/lib/NGbzero.S rename to arch/sparc/lib/NGbzero.S diff --git a/arch/sparc64/lib/NGcopy_from_user.S b/arch/sparc/lib/NGcopy_from_user.S similarity index 100% rename from arch/sparc64/lib/NGcopy_from_user.S rename to arch/sparc/lib/NGcopy_from_user.S diff --git a/arch/sparc64/lib/NGcopy_to_user.S b/arch/sparc/lib/NGcopy_to_user.S similarity index 100% rename from arch/sparc64/lib/NGcopy_to_user.S rename to arch/sparc/lib/NGcopy_to_user.S diff --git a/arch/sparc64/lib/NGmemcpy.S b/arch/sparc/lib/NGmemcpy.S similarity index 100% rename from arch/sparc64/lib/NGmemcpy.S rename to arch/sparc/lib/NGmemcpy.S diff --git a/arch/sparc64/lib/NGpage.S b/arch/sparc/lib/NGpage.S similarity index 100% rename from arch/sparc64/lib/NGpage.S rename to arch/sparc/lib/NGpage.S diff --git a/arch/sparc64/lib/NGpatch.S b/arch/sparc/lib/NGpatch.S similarity index 100% rename from arch/sparc64/lib/NGpatch.S rename to arch/sparc/lib/NGpatch.S diff --git a/arch/sparc64/lib/PeeCeeI.c b/arch/sparc/lib/PeeCeeI.c similarity index 100% rename from arch/sparc64/lib/PeeCeeI.c rename to arch/sparc/lib/PeeCeeI.c diff --git a/arch/sparc64/lib/U1copy_from_user.S b/arch/sparc/lib/U1copy_from_user.S similarity index 100% rename from arch/sparc64/lib/U1copy_from_user.S rename to arch/sparc/lib/U1copy_from_user.S diff --git a/arch/sparc64/lib/U1copy_to_user.S b/arch/sparc/lib/U1copy_to_user.S similarity index 100% rename from arch/sparc64/lib/U1copy_to_user.S rename to arch/sparc/lib/U1copy_to_user.S diff --git a/arch/sparc64/lib/U1memcpy.S b/arch/sparc/lib/U1memcpy.S similarity index 100% rename from arch/sparc64/lib/U1memcpy.S rename to arch/sparc/lib/U1memcpy.S diff --git a/arch/sparc64/lib/U3copy_from_user.S b/arch/sparc/lib/U3copy_from_user.S similarity index 100% rename from arch/sparc64/lib/U3copy_from_user.S rename to arch/sparc/lib/U3copy_from_user.S diff --git a/arch/sparc64/lib/U3copy_to_user.S b/arch/sparc/lib/U3copy_to_user.S similarity index 100% rename from arch/sparc64/lib/U3copy_to_user.S rename to arch/sparc/lib/U3copy_to_user.S diff --git a/arch/sparc64/lib/U3memcpy.S b/arch/sparc/lib/U3memcpy.S similarity index 100% rename from arch/sparc64/lib/U3memcpy.S rename to arch/sparc/lib/U3memcpy.S diff --git a/arch/sparc64/lib/U3patch.S b/arch/sparc/lib/U3patch.S similarity index 100% rename from arch/sparc64/lib/U3patch.S rename to arch/sparc/lib/U3patch.S diff --git a/arch/sparc64/lib/VISsave.S b/arch/sparc/lib/VISsave.S similarity index 100% rename from arch/sparc64/lib/VISsave.S rename to arch/sparc/lib/VISsave.S diff --git a/arch/sparc64/lib/atomic.S b/arch/sparc/lib/atomic_64.S similarity index 100% rename from arch/sparc64/lib/atomic.S rename to arch/sparc/lib/atomic_64.S diff --git a/arch/sparc64/lib/bitops.S b/arch/sparc/lib/bitops.S similarity index 100% rename from arch/sparc64/lib/bitops.S rename to arch/sparc/lib/bitops.S diff --git a/arch/sparc64/lib/bzero.S b/arch/sparc/lib/bzero.S similarity index 100% rename from arch/sparc64/lib/bzero.S rename to arch/sparc/lib/bzero.S diff --git a/arch/sparc64/lib/checksum.S b/arch/sparc/lib/checksum_64.S similarity index 100% rename from arch/sparc64/lib/checksum.S rename to arch/sparc/lib/checksum_64.S diff --git a/arch/sparc64/lib/clear_page.S b/arch/sparc/lib/clear_page.S similarity index 100% rename from arch/sparc64/lib/clear_page.S rename to arch/sparc/lib/clear_page.S diff --git a/arch/sparc64/lib/copy_in_user.S b/arch/sparc/lib/copy_in_user.S similarity index 100% rename from arch/sparc64/lib/copy_in_user.S rename to arch/sparc/lib/copy_in_user.S diff --git a/arch/sparc64/lib/copy_page.S b/arch/sparc/lib/copy_page.S similarity index 100% rename from arch/sparc64/lib/copy_page.S rename to arch/sparc/lib/copy_page.S diff --git a/arch/sparc64/lib/csum_copy.S b/arch/sparc/lib/csum_copy.S similarity index 100% rename from arch/sparc64/lib/csum_copy.S rename to arch/sparc/lib/csum_copy.S diff --git a/arch/sparc64/lib/csum_copy_from_user.S b/arch/sparc/lib/csum_copy_from_user.S similarity index 100% rename from arch/sparc64/lib/csum_copy_from_user.S rename to arch/sparc/lib/csum_copy_from_user.S diff --git a/arch/sparc64/lib/csum_copy_to_user.S b/arch/sparc/lib/csum_copy_to_user.S similarity index 100% rename from arch/sparc64/lib/csum_copy_to_user.S rename to arch/sparc/lib/csum_copy_to_user.S diff --git a/arch/sparc64/lib/ipcsum.S b/arch/sparc/lib/ipcsum.S similarity index 100% rename from arch/sparc64/lib/ipcsum.S rename to arch/sparc/lib/ipcsum.S diff --git a/arch/sparc64/lib/mcount.S b/arch/sparc/lib/mcount.S similarity index 100% rename from arch/sparc64/lib/mcount.S rename to arch/sparc/lib/mcount.S diff --git a/arch/sparc64/lib/memcmp.S b/arch/sparc/lib/memcmp_64.S similarity index 100% rename from arch/sparc64/lib/memcmp.S rename to arch/sparc/lib/memcmp_64.S diff --git a/arch/sparc64/lib/memmove.S b/arch/sparc/lib/memmove.S similarity index 100% rename from arch/sparc64/lib/memmove.S rename to arch/sparc/lib/memmove.S diff --git a/arch/sparc64/lib/memscan.S b/arch/sparc/lib/memscan_64.S similarity index 100% rename from arch/sparc64/lib/memscan.S rename to arch/sparc/lib/memscan_64.S diff --git a/arch/sparc64/lib/rwsem.S b/arch/sparc/lib/rwsem_64.S similarity index 100% rename from arch/sparc64/lib/rwsem.S rename to arch/sparc/lib/rwsem_64.S diff --git a/arch/sparc64/lib/strlen.S b/arch/sparc/lib/strlen_64.S similarity index 100% rename from arch/sparc64/lib/strlen.S rename to arch/sparc/lib/strlen_64.S diff --git a/arch/sparc64/lib/strlen_user.S b/arch/sparc/lib/strlen_user_64.S similarity index 100% rename from arch/sparc64/lib/strlen_user.S rename to arch/sparc/lib/strlen_user_64.S diff --git a/arch/sparc64/lib/strncmp.S b/arch/sparc/lib/strncmp_64.S similarity index 100% rename from arch/sparc64/lib/strncmp.S rename to arch/sparc/lib/strncmp_64.S diff --git a/arch/sparc64/lib/strncpy_from_user.S b/arch/sparc/lib/strncpy_from_user_64.S similarity index 100% rename from arch/sparc64/lib/strncpy_from_user.S rename to arch/sparc/lib/strncpy_from_user_64.S diff --git a/arch/sparc64/lib/user_fixup.c b/arch/sparc/lib/user_fixup.c similarity index 100% rename from arch/sparc64/lib/user_fixup.c rename to arch/sparc/lib/user_fixup.c diff --git a/arch/sparc64/lib/xor.S b/arch/sparc/lib/xor.S similarity index 100% rename from arch/sparc64/lib/xor.S rename to arch/sparc/lib/xor.S diff --git a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile deleted file mode 100644 index f095e13910bc..000000000000 --- a/arch/sparc64/lib/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# -# Makefile for Sparc64 library files.. -# - -EXTRA_AFLAGS := -ansi -EXTRA_CFLAGS := -Werror - -lib-y := PeeCeeI.o copy_page.o clear_page.o strlen.o strncmp.o \ - memscan.o strncpy_from_user.o strlen_user.o memcmp.o checksum.o \ - bzero.o csum_copy.o csum_copy_from_user.o csum_copy_to_user.o \ - VISsave.o atomic.o bitops.o \ - U1memcpy.o U1copy_from_user.o U1copy_to_user.o \ - U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \ - NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o NGpatch.o \ - NGpage.o NGbzero.o \ - NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o NG2patch.o \ - NG2page.o \ - GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o GENpatch.o \ - GENpage.o GENbzero.o \ - copy_in_user.o user_fixup.o memmove.o \ - mcount.o ipcsum.o rwsem.o xor.o - -obj-y += iomap.o diff --git a/arch/sparc64/lib/iomap.c b/arch/sparc64/lib/iomap.c deleted file mode 100644 index 7120ebbd4d03..000000000000 --- a/arch/sparc64/lib/iomap.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Implement the sparc64 iomap interfaces - */ -#include -#include -#include - -/* Create a virtual mapping cookie for an IO port range */ -void __iomem *ioport_map(unsigned long port, unsigned int nr) -{ - return (void __iomem *) (unsigned long) port; -} - -void ioport_unmap(void __iomem *addr) -{ - /* Nothing to do */ -} -EXPORT_SYMBOL(ioport_map); -EXPORT_SYMBOL(ioport_unmap); - -/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ -void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) -{ - resource_size_t start = pci_resource_start(dev, bar); - resource_size_t len = pci_resource_len(dev, bar); - unsigned long flags = pci_resource_flags(dev, bar); - - if (!len || !start) - return NULL; - if (maxlen && len > maxlen) - len = maxlen; - if (flags & IORESOURCE_IO) - return ioport_map(start, len); - if (flags & IORESOURCE_MEM) { - if (flags & IORESOURCE_CACHEABLE) - return ioremap(start, len); - return ioremap_nocache(start, len); - } - /* What? */ - return NULL; -} - -void pci_iounmap(struct pci_dev *dev, void __iomem * addr) -{ - /* nothing to do */ -} -EXPORT_SYMBOL(pci_iomap); -EXPORT_SYMBOL(pci_iounmap); From d670bd4f803c8b646acd20f3ba21e65458293faf Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Wed, 3 Dec 2008 03:08:37 -0800 Subject: [PATCH 45/98] sparc: prepare kernel/ for unification o sparc32 files with identical names to sparc64 renamed to _32.S o introduced a few Kconfig helpers to simplify Makefile logic o refactored Makefile to prepare for unification - use obj-$(CONFIG_SPARC32) for sparc32 specific files - use _$(BITS) for files where sparc64 has a _64 variant - sparc64 directly include a few files where sparc32 builds them, refer to these files directly (no BITS) - sneaked in -Werror as used by sparc64 o modified sparc/Makefile to use the new names for head/init_task Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 21 ++++++ arch/sparc/Makefile | 4 +- arch/sparc/kernel/Makefile | 68 ++++++++++++++----- arch/sparc/kernel/{auxio.c => auxio_32.c} | 0 arch/sparc/kernel/{cpu.c => cpu_32.c} | 0 arch/sparc/kernel/{etrap.S => etrap_32.S} | 0 arch/sparc/kernel/{head.S => head_32.S} | 0 arch/sparc/kernel/{idprom.c => idprom_32.c} | 0 .../kernel/{init_task.c => init_task_32.c} | 0 arch/sparc/kernel/{irq.c => irq_32.c} | 0 arch/sparc/kernel/{kgdb.c => kgdb_32.c} | 0 arch/sparc/kernel/{module.c => module_32.c} | 0 .../kernel/{of_device.c => of_device_32.c} | 0 arch/sparc/kernel/{process.c => process_32.c} | 0 arch/sparc/kernel/{prom.c => prom_32.c} | 0 arch/sparc/kernel/{ptrace.c => ptrace_32.c} | 0 arch/sparc/kernel/{rtrap.S => rtrap_32.S} | 0 arch/sparc/kernel/{setup.c => setup_32.c} | 0 arch/sparc/kernel/{signal.c => signal_32.c} | 0 arch/sparc/kernel/{smp.c => smp_32.c} | 0 .../{sparc_ksyms.c => sparc_ksyms_32.c} | 0 .../kernel/{sys_sparc.c => sys_sparc_32.c} | 0 arch/sparc/kernel/{systbls.S => systbls_32.S} | 0 arch/sparc/kernel/{time.c => time_32.c} | 0 .../kernel/{trampoline.S => trampoline_32.S} | 0 arch/sparc/kernel/{traps.c => traps_32.c} | 0 arch/sparc/kernel/{una_asm.S => una_asm_32.S} | 0 .../kernel/{unaligned.c => unaligned_32.c} | 0 28 files changed, 73 insertions(+), 20 deletions(-) rename arch/sparc/kernel/{auxio.c => auxio_32.c} (100%) rename arch/sparc/kernel/{cpu.c => cpu_32.c} (100%) rename arch/sparc/kernel/{etrap.S => etrap_32.S} (100%) rename arch/sparc/kernel/{head.S => head_32.S} (100%) rename arch/sparc/kernel/{idprom.c => idprom_32.c} (100%) rename arch/sparc/kernel/{init_task.c => init_task_32.c} (100%) rename arch/sparc/kernel/{irq.c => irq_32.c} (100%) rename arch/sparc/kernel/{kgdb.c => kgdb_32.c} (100%) rename arch/sparc/kernel/{module.c => module_32.c} (100%) rename arch/sparc/kernel/{of_device.c => of_device_32.c} (100%) rename arch/sparc/kernel/{process.c => process_32.c} (100%) rename arch/sparc/kernel/{prom.c => prom_32.c} (100%) rename arch/sparc/kernel/{ptrace.c => ptrace_32.c} (100%) rename arch/sparc/kernel/{rtrap.S => rtrap_32.S} (100%) rename arch/sparc/kernel/{setup.c => setup_32.c} (100%) rename arch/sparc/kernel/{signal.c => signal_32.c} (100%) rename arch/sparc/kernel/{smp.c => smp_32.c} (100%) rename arch/sparc/kernel/{sparc_ksyms.c => sparc_ksyms_32.c} (100%) rename arch/sparc/kernel/{sys_sparc.c => sys_sparc_32.c} (100%) rename arch/sparc/kernel/{systbls.S => systbls_32.S} (100%) rename arch/sparc/kernel/{time.c => time_32.c} (100%) rename arch/sparc/kernel/{trampoline.S => trampoline_32.S} (100%) rename arch/sparc/kernel/{traps.c => traps_32.c} (100%) rename arch/sparc/kernel/{una_asm.S => una_asm_32.S} (100%) rename arch/sparc/kernel/{unaligned.c => unaligned_32.c} (100%) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 26ddeedb5166..7cfe557db23d 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -198,6 +198,17 @@ config EMULATED_CMPXCHG Sparc32 does not have a CAS instruction like sparc64. cmpxchg() is emulated, and therefore it is not completely atomic. +# Makefile helpers +config SPARC32_SMP + bool + default y + depends on SPARC32 && SMP + +config SPARC64_SMP + bool + default y + depends on SPARC64 && SMP + choice prompt "Kernel page size" if SPARC64 default SPARC64_PAGE_SIZE_8KB @@ -505,6 +516,16 @@ config SUN_OPENPROMFS Only choose N if you know in advance that you will not need to modify OpenPROM settings on the running system. +# Makefile helpers +config SPARC32_PCI + bool + default y + depends on SPARC32 && PCI + +config SPARC64_PCI + bool + default y + depends on SPARC64 && PCI endmenu diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index b1d691489ed4..f061d0ada158 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -67,8 +67,8 @@ endif endif -head-$(CONFIG_SPARC32) := arch/sparc/kernel/head.o -head-$(CONFIG_SPARC32) += arch/sparc/kernel/init_task.o +head-$(CONFIG_SPARC32) := arch/sparc/kernel/head_$(BITS).o +head-$(CONFIG_SPARC32) += arch/sparc/kernel/init_task_$(BITS).o head-$(CONFIG_SPARC64) := arch/sparc64/kernel/head.o head-$(CONFIG_SPARC64) += arch/sparc64/kernel/init_task.o diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 2d6582095099..6558eea5f0bc 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -2,25 +2,57 @@ # Makefile for the linux kernel. # -extra-y := head.o init_task.o vmlinux.lds +asflags-y := -ansi +ccflags-y := -Werror -EXTRA_AFLAGS := -ansi +extra-y := head_$(BITS).o +extra-y += init_task_$(BITS).o +extra-y += vmlinux.lds -IRQ_OBJS := irq.o sun4m_irq.o sun4c_irq.o sun4d_irq.o -obj-y := entry.o wof.o wuf.o etrap.o rtrap.o traps.o $(IRQ_OBJS) \ - process.o signal.o ioport.o setup.o idprom.o \ - sys_sparc.o systbls.o \ - time.o windows.o cpu.o devices.o \ - tadpole.o tick14.o ptrace.o \ - unaligned.o una_asm.o muldiv.o \ - prom.o of_device.o devres.o dma.o +obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o +obj-$(CONFIG_SPARC32) += etrap_32.o +obj-$(CONFIG_SPARC32) += rtrap_32.o +obj-y += traps_$(BITS).o -devres-y = ../../../kernel/irq/devres.o +# IRQ +obj-y += irq_$(BITS).o +obj-$(CONFIG_SPARC32) += sun4m_irq.o sun4c_irq.o sun4d_irq.o -obj-$(CONFIG_PCI) += pcic.o -obj-$(CONFIG_SMP) += trampoline.o smp.o sun4m_smp.o sun4d_smp.o -obj-$(CONFIG_SUN_AUXIO) += auxio.o -obj-$(CONFIG_SUN_PM) += apc.o pmc.o -obj-$(CONFIG_MODULES) += module.o sparc_ksyms.o -obj-$(CONFIG_SPARC_LED) += led.o -obj-$(CONFIG_KGDB) += kgdb.o +obj-y += process_$(BITS).o +obj-y += signal_$(BITS).o +obj-$(CONFIG_SPARC32) += ioport.o +obj-y += setup_$(BITS).o +obj-y += idprom_$(BITS).o +obj-y += sys_sparc_$(BITS).o +obj-$(CONFIG_SPARC32) += systbls_32.o +obj-y += time_$(BITS).o +obj-$(CONFIG_SPARC32) += windows.o +obj-y += cpu_$(BITS).o +obj-$(CONFIG_SPARC32) += devices.o +obj-$(CONFIG_SPARC32) += tadpole.o +obj-$(CONFIG_SPARC32) += tick14.o +obj-y += ptrace_$(BITS).o +obj-y += unaligned_$(BITS).o +obj-y += una_asm_$(BITS).o +obj-$(CONFIG_SPARC32) += muldiv.o +obj-y += prom_$(BITS).o +obj-y += of_device_$(BITS).o + +# sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation +obj-$(CONFIG_SPARC32) += devres.o +devres-y := ../../../kernel/irq/devres.o + +obj-$(CONFIG_SPARC32) += dma.o + +obj-$(CONFIG_SPARC32_PCI) += pcic.o + +obj-$(CONFIG_SMP) += trampoline_$(BITS).o smp_$(BITS).o +obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o + +obj-y += auxio_$(BITS).o +obj-$(CONFIG_SUN_PM) += apc.o pmc.o + +obj-$(CONFIG_MODULES) += module_$(BITS).o +obj-$(CONFIG_MODULES) += sparc_ksyms_$(BITS).o +obj-$(CONFIG_SPARC_LED) += led.o +obj-$(CONFIG_KGDB) += kgdb_$(BITS).o diff --git a/arch/sparc/kernel/auxio.c b/arch/sparc/kernel/auxio_32.c similarity index 100% rename from arch/sparc/kernel/auxio.c rename to arch/sparc/kernel/auxio_32.c diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu_32.c similarity index 100% rename from arch/sparc/kernel/cpu.c rename to arch/sparc/kernel/cpu_32.c diff --git a/arch/sparc/kernel/etrap.S b/arch/sparc/kernel/etrap_32.S similarity index 100% rename from arch/sparc/kernel/etrap.S rename to arch/sparc/kernel/etrap_32.S diff --git a/arch/sparc/kernel/head.S b/arch/sparc/kernel/head_32.S similarity index 100% rename from arch/sparc/kernel/head.S rename to arch/sparc/kernel/head_32.S diff --git a/arch/sparc/kernel/idprom.c b/arch/sparc/kernel/idprom_32.c similarity index 100% rename from arch/sparc/kernel/idprom.c rename to arch/sparc/kernel/idprom_32.c diff --git a/arch/sparc/kernel/init_task.c b/arch/sparc/kernel/init_task_32.c similarity index 100% rename from arch/sparc/kernel/init_task.c rename to arch/sparc/kernel/init_task_32.c diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq_32.c similarity index 100% rename from arch/sparc/kernel/irq.c rename to arch/sparc/kernel/irq_32.c diff --git a/arch/sparc/kernel/kgdb.c b/arch/sparc/kernel/kgdb_32.c similarity index 100% rename from arch/sparc/kernel/kgdb.c rename to arch/sparc/kernel/kgdb_32.c diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module_32.c similarity index 100% rename from arch/sparc/kernel/module.c rename to arch/sparc/kernel/module_32.c diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device_32.c similarity index 100% rename from arch/sparc/kernel/of_device.c rename to arch/sparc/kernel/of_device_32.c diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process_32.c similarity index 100% rename from arch/sparc/kernel/process.c rename to arch/sparc/kernel/process_32.c diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom_32.c similarity index 100% rename from arch/sparc/kernel/prom.c rename to arch/sparc/kernel/prom_32.c diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace_32.c similarity index 100% rename from arch/sparc/kernel/ptrace.c rename to arch/sparc/kernel/ptrace_32.c diff --git a/arch/sparc/kernel/rtrap.S b/arch/sparc/kernel/rtrap_32.S similarity index 100% rename from arch/sparc/kernel/rtrap.S rename to arch/sparc/kernel/rtrap_32.S diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup_32.c similarity index 100% rename from arch/sparc/kernel/setup.c rename to arch/sparc/kernel/setup_32.c diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal_32.c similarity index 100% rename from arch/sparc/kernel/signal.c rename to arch/sparc/kernel/signal_32.c diff --git a/arch/sparc/kernel/smp.c b/arch/sparc/kernel/smp_32.c similarity index 100% rename from arch/sparc/kernel/smp.c rename to arch/sparc/kernel/smp_32.c diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms_32.c similarity index 100% rename from arch/sparc/kernel/sparc_ksyms.c rename to arch/sparc/kernel/sparc_ksyms_32.c diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc_32.c similarity index 100% rename from arch/sparc/kernel/sys_sparc.c rename to arch/sparc/kernel/sys_sparc_32.c diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls_32.S similarity index 100% rename from arch/sparc/kernel/systbls.S rename to arch/sparc/kernel/systbls_32.S diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time_32.c similarity index 100% rename from arch/sparc/kernel/time.c rename to arch/sparc/kernel/time_32.c diff --git a/arch/sparc/kernel/trampoline.S b/arch/sparc/kernel/trampoline_32.S similarity index 100% rename from arch/sparc/kernel/trampoline.S rename to arch/sparc/kernel/trampoline_32.S diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps_32.c similarity index 100% rename from arch/sparc/kernel/traps.c rename to arch/sparc/kernel/traps_32.c diff --git a/arch/sparc/kernel/una_asm.S b/arch/sparc/kernel/una_asm_32.S similarity index 100% rename from arch/sparc/kernel/una_asm.S rename to arch/sparc/kernel/una_asm_32.S diff --git a/arch/sparc/kernel/unaligned.c b/arch/sparc/kernel/unaligned_32.c similarity index 100% rename from arch/sparc/kernel/unaligned.c rename to arch/sparc/kernel/unaligned_32.c From a88b5ba8bd8ac18aad65ee6c6a254e2e74876db3 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Wed, 3 Dec 2008 03:11:52 -0800 Subject: [PATCH 46/98] sparc,sparc64: unify kernel/ o Move all files from sparc64/kernel/ to sparc/kernel - rename as appropriate o Update sparc/Makefile to the changes o Update sparc/kernel/Makefile to include the sparc64 files NOTE: This commit changes link order on sparc64! Link order had to change for either of sparc32 and sparc64. And assuming sparc64 see more testing than sparc32 change link order on sparc64 where issues will be caught faster. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Makefile | 9 ++--- arch/sparc/kernel/Makefile | 39 +++++++++++++++++++ arch/{sparc64 => sparc}/kernel/audit.c | 0 .../auxio.c => sparc/kernel/auxio_64.c} | 0 arch/{sparc64 => sparc}/kernel/central.c | 0 arch/{sparc64 => sparc}/kernel/cherrs.S | 0 arch/{sparc64 => sparc}/kernel/chmc.c | 0 arch/{sparc64 => sparc}/kernel/compat_audit.c | 0 .../kernel/cpu.c => sparc/kernel/cpu_64.c} | 0 arch/{sparc64 => sparc}/kernel/ds.c | 0 arch/{sparc64 => sparc}/kernel/dtlb_miss.S | 0 arch/{sparc64 => sparc}/kernel/dtlb_prot.S | 0 arch/{sparc64 => sparc}/kernel/ebus.c | 0 arch/{sparc64 => sparc}/kernel/entry.h | 0 .../etrap.S => sparc/kernel/etrap_64.S} | 0 arch/{sparc64 => sparc}/kernel/fpu_traps.S | 0 arch/{sparc64 => sparc}/kernel/ftrace.c | 0 arch/{sparc64 => sparc}/kernel/getsetcc.S | 0 .../kernel/head.S => sparc/kernel/head_64.S} | 6 +-- arch/{sparc64 => sparc}/kernel/helpers.S | 0 arch/{sparc64 => sparc}/kernel/hvapi.c | 0 arch/{sparc64 => sparc}/kernel/hvcalls.S | 0 arch/{sparc64 => sparc}/kernel/hvtramp.S | 0 .../idprom.c => sparc/kernel/idprom_64.c} | 0 .../kernel/init_task_64.c} | 0 arch/{sparc64 => sparc}/kernel/iommu.c | 0 arch/{sparc64 => sparc}/kernel/iommu_common.h | 0 .../kernel/irq.c => sparc/kernel/irq_64.c} | 0 arch/{sparc64 => sparc}/kernel/itlb_miss.S | 0 arch/{sparc64 => sparc}/kernel/ivec.S | 0 .../kernel/kgdb.c => sparc/kernel/kgdb_64.c} | 0 arch/{sparc64 => sparc}/kernel/kprobes.c | 0 arch/{sparc64 => sparc}/kernel/kstack.h | 0 arch/{sparc64 => sparc}/kernel/ktlb.S | 0 arch/{sparc64 => sparc}/kernel/ldc.c | 0 arch/{sparc64 => sparc}/kernel/mdesc.c | 0 arch/{sparc64 => sparc}/kernel/misctrap.S | 0 .../module.c => sparc/kernel/module_64.c} | 0 .../kernel/of_device_64.c} | 0 arch/{sparc64 => sparc}/kernel/pci.c | 0 arch/{sparc64 => sparc}/kernel/pci_common.c | 0 arch/{sparc64 => sparc}/kernel/pci_fire.c | 0 arch/{sparc64 => sparc}/kernel/pci_impl.h | 0 arch/{sparc64 => sparc}/kernel/pci_msi.c | 0 arch/{sparc64 => sparc}/kernel/pci_psycho.c | 0 arch/{sparc64 => sparc}/kernel/pci_sabre.c | 0 arch/{sparc64 => sparc}/kernel/pci_schizo.c | 0 arch/{sparc64 => sparc}/kernel/pci_sun4v.c | 0 arch/{sparc64 => sparc}/kernel/pci_sun4v.h | 0 .../{sparc64 => sparc}/kernel/pci_sun4v_asm.S | 0 arch/{sparc64 => sparc}/kernel/power.c | 0 .../process.c => sparc/kernel/process_64.c} | 0 .../kernel/prom.c => sparc/kernel/prom_64.c} | 0 .../{sparc64 => sparc}/kernel/psycho_common.c | 0 .../{sparc64 => sparc}/kernel/psycho_common.h | 0 .../ptrace.c => sparc/kernel/ptrace_64.c} | 0 arch/{sparc64 => sparc}/kernel/reboot.c | 0 .../rtrap.S => sparc/kernel/rtrap_64.S} | 0 arch/{sparc64 => sparc}/kernel/sbus.c | 0 .../setup.c => sparc/kernel/setup_64.c} | 0 arch/{sparc64 => sparc}/kernel/signal32.c | 0 .../signal.c => sparc/kernel/signal_64.c} | 0 .../kernel/smp.c => sparc/kernel/smp_64.c} | 0 .../kernel/sparc_ksyms_64.c} | 0 arch/{sparc64 => sparc}/kernel/spiterrs.S | 0 arch/{sparc64 => sparc}/kernel/sstate.c | 0 arch/{sparc64 => sparc}/kernel/stacktrace.c | 0 arch/{sparc64 => sparc}/kernel/starfire.c | 0 arch/{sparc64 => sparc}/kernel/sun4v_ivec.S | 0 .../kernel/sun4v_tlb_miss.S | 0 arch/{sparc64 => sparc}/kernel/sys32.S | 0 arch/{sparc64 => sparc}/kernel/sys_sparc32.c | 0 .../kernel/sys_sparc_64.c} | 0 arch/{sparc64 => sparc}/kernel/syscalls.S | 0 arch/{sparc64 => sparc}/kernel/sysfs.c | 0 arch/{sparc64 => sparc}/kernel/systbls.h | 0 .../systbls.S => sparc/kernel/systbls_64.S} | 0 .../kernel/time.c => sparc/kernel/time_64.c} | 0 .../kernel/trampoline_64.S} | 0 .../traps.c => sparc/kernel/traps_64.c} | 0 arch/{sparc64 => sparc}/kernel/tsb.S | 0 arch/{sparc64 => sparc}/kernel/ttable.S | 0 .../una_asm.S => sparc/kernel/una_asm_64.S} | 0 .../kernel/unaligned_64.c} | 0 arch/{sparc64 => sparc}/kernel/us2e_cpufreq.c | 0 arch/{sparc64 => sparc}/kernel/us3_cpufreq.c | 0 arch/{sparc64 => sparc}/kernel/utrap.S | 0 arch/{sparc64 => sparc}/kernel/vio.c | 0 arch/{sparc64 => sparc}/kernel/viohs.c | 0 arch/{sparc64 => sparc}/kernel/visemul.c | 0 arch/{sparc64 => sparc}/kernel/winfixup.S | 0 arch/sparc64/kernel/Makefile | 36 ----------------- arch/sparc64/kernel/asm-offsets.c | 1 - arch/sparc64/kernel/vmlinux.lds.S | 1 - 94 files changed, 45 insertions(+), 47 deletions(-) rename arch/{sparc64 => sparc}/kernel/audit.c (100%) rename arch/{sparc64/kernel/auxio.c => sparc/kernel/auxio_64.c} (100%) rename arch/{sparc64 => sparc}/kernel/central.c (100%) rename arch/{sparc64 => sparc}/kernel/cherrs.S (100%) rename arch/{sparc64 => sparc}/kernel/chmc.c (100%) rename arch/{sparc64 => sparc}/kernel/compat_audit.c (100%) rename arch/{sparc64/kernel/cpu.c => sparc/kernel/cpu_64.c} (100%) rename arch/{sparc64 => sparc}/kernel/ds.c (100%) rename arch/{sparc64 => sparc}/kernel/dtlb_miss.S (100%) rename arch/{sparc64 => sparc}/kernel/dtlb_prot.S (100%) rename arch/{sparc64 => sparc}/kernel/ebus.c (100%) rename arch/{sparc64 => sparc}/kernel/entry.h (100%) rename arch/{sparc64/kernel/etrap.S => sparc/kernel/etrap_64.S} (100%) rename arch/{sparc64 => sparc}/kernel/fpu_traps.S (100%) rename arch/{sparc64 => sparc}/kernel/ftrace.c (100%) rename arch/{sparc64 => sparc}/kernel/getsetcc.S (100%) rename arch/{sparc64/kernel/head.S => sparc/kernel/head_64.S} (99%) rename arch/{sparc64 => sparc}/kernel/helpers.S (100%) rename arch/{sparc64 => sparc}/kernel/hvapi.c (100%) rename arch/{sparc64 => sparc}/kernel/hvcalls.S (100%) rename arch/{sparc64 => sparc}/kernel/hvtramp.S (100%) rename arch/{sparc64/kernel/idprom.c => sparc/kernel/idprom_64.c} (100%) rename arch/{sparc64/kernel/init_task.c => sparc/kernel/init_task_64.c} (100%) rename arch/{sparc64 => sparc}/kernel/iommu.c (100%) rename arch/{sparc64 => sparc}/kernel/iommu_common.h (100%) rename arch/{sparc64/kernel/irq.c => sparc/kernel/irq_64.c} (100%) rename arch/{sparc64 => sparc}/kernel/itlb_miss.S (100%) rename arch/{sparc64 => sparc}/kernel/ivec.S (100%) rename arch/{sparc64/kernel/kgdb.c => sparc/kernel/kgdb_64.c} (100%) rename arch/{sparc64 => sparc}/kernel/kprobes.c (100%) rename arch/{sparc64 => sparc}/kernel/kstack.h (100%) rename arch/{sparc64 => sparc}/kernel/ktlb.S (100%) rename arch/{sparc64 => sparc}/kernel/ldc.c (100%) rename arch/{sparc64 => sparc}/kernel/mdesc.c (100%) rename arch/{sparc64 => sparc}/kernel/misctrap.S (100%) rename arch/{sparc64/kernel/module.c => sparc/kernel/module_64.c} (100%) rename arch/{sparc64/kernel/of_device.c => sparc/kernel/of_device_64.c} (100%) rename arch/{sparc64 => sparc}/kernel/pci.c (100%) rename arch/{sparc64 => sparc}/kernel/pci_common.c (100%) rename arch/{sparc64 => sparc}/kernel/pci_fire.c (100%) rename arch/{sparc64 => sparc}/kernel/pci_impl.h (100%) rename arch/{sparc64 => sparc}/kernel/pci_msi.c (100%) rename arch/{sparc64 => sparc}/kernel/pci_psycho.c (100%) rename arch/{sparc64 => sparc}/kernel/pci_sabre.c (100%) rename arch/{sparc64 => sparc}/kernel/pci_schizo.c (100%) rename arch/{sparc64 => sparc}/kernel/pci_sun4v.c (100%) rename arch/{sparc64 => sparc}/kernel/pci_sun4v.h (100%) rename arch/{sparc64 => sparc}/kernel/pci_sun4v_asm.S (100%) rename arch/{sparc64 => sparc}/kernel/power.c (100%) rename arch/{sparc64/kernel/process.c => sparc/kernel/process_64.c} (100%) rename arch/{sparc64/kernel/prom.c => sparc/kernel/prom_64.c} (100%) rename arch/{sparc64 => sparc}/kernel/psycho_common.c (100%) rename arch/{sparc64 => sparc}/kernel/psycho_common.h (100%) rename arch/{sparc64/kernel/ptrace.c => sparc/kernel/ptrace_64.c} (100%) rename arch/{sparc64 => sparc}/kernel/reboot.c (100%) rename arch/{sparc64/kernel/rtrap.S => sparc/kernel/rtrap_64.S} (100%) rename arch/{sparc64 => sparc}/kernel/sbus.c (100%) rename arch/{sparc64/kernel/setup.c => sparc/kernel/setup_64.c} (100%) rename arch/{sparc64 => sparc}/kernel/signal32.c (100%) rename arch/{sparc64/kernel/signal.c => sparc/kernel/signal_64.c} (100%) rename arch/{sparc64/kernel/smp.c => sparc/kernel/smp_64.c} (100%) rename arch/{sparc64/kernel/sparc64_ksyms.c => sparc/kernel/sparc_ksyms_64.c} (100%) rename arch/{sparc64 => sparc}/kernel/spiterrs.S (100%) rename arch/{sparc64 => sparc}/kernel/sstate.c (100%) rename arch/{sparc64 => sparc}/kernel/stacktrace.c (100%) rename arch/{sparc64 => sparc}/kernel/starfire.c (100%) rename arch/{sparc64 => sparc}/kernel/sun4v_ivec.S (100%) rename arch/{sparc64 => sparc}/kernel/sun4v_tlb_miss.S (100%) rename arch/{sparc64 => sparc}/kernel/sys32.S (100%) rename arch/{sparc64 => sparc}/kernel/sys_sparc32.c (100%) rename arch/{sparc64/kernel/sys_sparc.c => sparc/kernel/sys_sparc_64.c} (100%) rename arch/{sparc64 => sparc}/kernel/syscalls.S (100%) rename arch/{sparc64 => sparc}/kernel/sysfs.c (100%) rename arch/{sparc64 => sparc}/kernel/systbls.h (100%) rename arch/{sparc64/kernel/systbls.S => sparc/kernel/systbls_64.S} (100%) rename arch/{sparc64/kernel/time.c => sparc/kernel/time_64.c} (100%) rename arch/{sparc64/kernel/trampoline.S => sparc/kernel/trampoline_64.S} (100%) rename arch/{sparc64/kernel/traps.c => sparc/kernel/traps_64.c} (100%) rename arch/{sparc64 => sparc}/kernel/tsb.S (100%) rename arch/{sparc64 => sparc}/kernel/ttable.S (100%) rename arch/{sparc64/kernel/una_asm.S => sparc/kernel/una_asm_64.S} (100%) rename arch/{sparc64/kernel/unaligned.c => sparc/kernel/unaligned_64.c} (100%) rename arch/{sparc64 => sparc}/kernel/us2e_cpufreq.c (100%) rename arch/{sparc64 => sparc}/kernel/us3_cpufreq.c (100%) rename arch/{sparc64 => sparc}/kernel/utrap.S (100%) rename arch/{sparc64 => sparc}/kernel/vio.c (100%) rename arch/{sparc64 => sparc}/kernel/viohs.c (100%) rename arch/{sparc64 => sparc}/kernel/visemul.c (100%) rename arch/{sparc64 => sparc}/kernel/winfixup.S (100%) delete mode 100644 arch/sparc64/kernel/Makefile delete mode 100644 arch/sparc64/kernel/asm-offsets.c delete mode 100644 arch/sparc64/kernel/vmlinux.lds.S diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index f061d0ada158..4b39ac68c3b1 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -67,13 +67,10 @@ endif endif -head-$(CONFIG_SPARC32) := arch/sparc/kernel/head_$(BITS).o -head-$(CONFIG_SPARC32) += arch/sparc/kernel/init_task_$(BITS).o -head-$(CONFIG_SPARC64) := arch/sparc64/kernel/head.o -head-$(CONFIG_SPARC64) += arch/sparc64/kernel/init_task.o +head-y := arch/sparc/kernel/head_$(BITS).o +head-y += arch/sparc/kernel/init_task_$(BITS).o -core-$(CONFIG_SPARC32) += arch/sparc/kernel/ -core-$(CONFIG_SPARC64) += arch/sparc64/kernel/ +core-y += arch/sparc/kernel/ core-y += arch/sparc/mm/ arch/sparc/math-emu/ libs-y += arch/sparc/prom/ diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 6558eea5f0bc..46439465c3b2 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -38,6 +38,19 @@ obj-$(CONFIG_SPARC32) += muldiv.o obj-y += prom_$(BITS).o obj-y += of_device_$(BITS).o +obj-$(CONFIG_SPARC64) += reboot.o +obj-$(CONFIG_SPARC64) += sysfs.o +obj-$(CONFIG_SPARC64) += iommu.o +obj-$(CONFIG_SPARC64) += central.o +obj-$(CONFIG_SPARC64) += starfire.o +obj-$(CONFIG_SPARC64) += power.o +obj-$(CONFIG_SPARC64) += sbus.o +obj-$(CONFIG_SPARC64) += ebus.o +obj-$(CONFIG_SPARC64) += visemul.o +obj-$(CONFIG_SPARC64) += hvapi.o +obj-$(CONFIG_SPARC64) += sstate.o +obj-$(CONFIG_SPARC64) += mdesc.o + # sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation obj-$(CONFIG_SPARC32) += devres.o devres-y := ../../../kernel/irq/devres.o @@ -48,6 +61,7 @@ obj-$(CONFIG_SPARC32_PCI) += pcic.o obj-$(CONFIG_SMP) += trampoline_$(BITS).o smp_$(BITS).o obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o +obj-$(CONFIG_SPARC64_SMP) += hvtramp.o obj-y += auxio_$(BITS).o obj-$(CONFIG_SUN_PM) += apc.o pmc.o @@ -56,3 +70,28 @@ obj-$(CONFIG_MODULES) += module_$(BITS).o obj-$(CONFIG_MODULES) += sparc_ksyms_$(BITS).o obj-$(CONFIG_SPARC_LED) += led.o obj-$(CONFIG_KGDB) += kgdb_$(BITS).o + + +obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o +CFLAGS_REMOVE_ftrace.o := -pg + +obj-$(CONFIG_STACKTRACE) += stacktrace.o +# sparc64 PCI +obj-$(CONFIG_SPARC64_PCI) += pci.o pci_common.o psycho_common.o +obj-$(CONFIG_SPARC64_PCI) += pci_psycho.o pci_sabre.o pci_schizo.o +obj-$(CONFIG_SPARC64_PCI) += pci_sun4v.o pci_sun4v_asm.o pci_fire.o +obj-$(CONFIG_PCI_MSI) += pci_msi.o + +obj-$(CONFIG_COMPAT) += sys32.o sys_sparc32.o signal32.o + +# sparc64 cpufreq +obj-$(CONFIG_US3_FREQ) += us3_cpufreq.o +obj-$(CONFIG_US2E_FREQ) += us2e_cpufreq.o +obj-$(CONFIG_US3_MC) += chmc.o + +obj-$(CONFIG_KPROBES) += kprobes.o +obj-$(CONFIG_SUN_LDOMS) += ldc.o vio.o viohs.o ds.o + +obj-$(CONFIG_AUDIT) += audit.o +audit--$(CONFIG_AUDIT) := compat_audit.o +obj-$(CONFIG_COMPAT) += $(audit--y) diff --git a/arch/sparc64/kernel/audit.c b/arch/sparc/kernel/audit.c similarity index 100% rename from arch/sparc64/kernel/audit.c rename to arch/sparc/kernel/audit.c diff --git a/arch/sparc64/kernel/auxio.c b/arch/sparc/kernel/auxio_64.c similarity index 100% rename from arch/sparc64/kernel/auxio.c rename to arch/sparc/kernel/auxio_64.c diff --git a/arch/sparc64/kernel/central.c b/arch/sparc/kernel/central.c similarity index 100% rename from arch/sparc64/kernel/central.c rename to arch/sparc/kernel/central.c diff --git a/arch/sparc64/kernel/cherrs.S b/arch/sparc/kernel/cherrs.S similarity index 100% rename from arch/sparc64/kernel/cherrs.S rename to arch/sparc/kernel/cherrs.S diff --git a/arch/sparc64/kernel/chmc.c b/arch/sparc/kernel/chmc.c similarity index 100% rename from arch/sparc64/kernel/chmc.c rename to arch/sparc/kernel/chmc.c diff --git a/arch/sparc64/kernel/compat_audit.c b/arch/sparc/kernel/compat_audit.c similarity index 100% rename from arch/sparc64/kernel/compat_audit.c rename to arch/sparc/kernel/compat_audit.c diff --git a/arch/sparc64/kernel/cpu.c b/arch/sparc/kernel/cpu_64.c similarity index 100% rename from arch/sparc64/kernel/cpu.c rename to arch/sparc/kernel/cpu_64.c diff --git a/arch/sparc64/kernel/ds.c b/arch/sparc/kernel/ds.c similarity index 100% rename from arch/sparc64/kernel/ds.c rename to arch/sparc/kernel/ds.c diff --git a/arch/sparc64/kernel/dtlb_miss.S b/arch/sparc/kernel/dtlb_miss.S similarity index 100% rename from arch/sparc64/kernel/dtlb_miss.S rename to arch/sparc/kernel/dtlb_miss.S diff --git a/arch/sparc64/kernel/dtlb_prot.S b/arch/sparc/kernel/dtlb_prot.S similarity index 100% rename from arch/sparc64/kernel/dtlb_prot.S rename to arch/sparc/kernel/dtlb_prot.S diff --git a/arch/sparc64/kernel/ebus.c b/arch/sparc/kernel/ebus.c similarity index 100% rename from arch/sparc64/kernel/ebus.c rename to arch/sparc/kernel/ebus.c diff --git a/arch/sparc64/kernel/entry.h b/arch/sparc/kernel/entry.h similarity index 100% rename from arch/sparc64/kernel/entry.h rename to arch/sparc/kernel/entry.h diff --git a/arch/sparc64/kernel/etrap.S b/arch/sparc/kernel/etrap_64.S similarity index 100% rename from arch/sparc64/kernel/etrap.S rename to arch/sparc/kernel/etrap_64.S diff --git a/arch/sparc64/kernel/fpu_traps.S b/arch/sparc/kernel/fpu_traps.S similarity index 100% rename from arch/sparc64/kernel/fpu_traps.S rename to arch/sparc/kernel/fpu_traps.S diff --git a/arch/sparc64/kernel/ftrace.c b/arch/sparc/kernel/ftrace.c similarity index 100% rename from arch/sparc64/kernel/ftrace.c rename to arch/sparc/kernel/ftrace.c diff --git a/arch/sparc64/kernel/getsetcc.S b/arch/sparc/kernel/getsetcc.S similarity index 100% rename from arch/sparc64/kernel/getsetcc.S rename to arch/sparc/kernel/getsetcc.S diff --git a/arch/sparc64/kernel/head.S b/arch/sparc/kernel/head_64.S similarity index 99% rename from arch/sparc64/kernel/head.S rename to arch/sparc/kernel/head_64.S index 45830c35fc6d..8ffee714f932 100644 --- a/arch/sparc64/kernel/head.S +++ b/arch/sparc/kernel/head_64.S @@ -825,8 +825,8 @@ setup_tba: restore sparc64_boot_end: -#include "etrap.S" -#include "rtrap.S" +#include "etrap_64.S" +#include "rtrap_64.S" #include "winfixup.S" #include "fpu_traps.S" #include "ivec.S" @@ -882,7 +882,7 @@ swapper_4m_tsb: ! 0x0000000000428000 -#include "systbls.S" +#include "systbls_64.S" .data .align 8 diff --git a/arch/sparc64/kernel/helpers.S b/arch/sparc/kernel/helpers.S similarity index 100% rename from arch/sparc64/kernel/helpers.S rename to arch/sparc/kernel/helpers.S diff --git a/arch/sparc64/kernel/hvapi.c b/arch/sparc/kernel/hvapi.c similarity index 100% rename from arch/sparc64/kernel/hvapi.c rename to arch/sparc/kernel/hvapi.c diff --git a/arch/sparc64/kernel/hvcalls.S b/arch/sparc/kernel/hvcalls.S similarity index 100% rename from arch/sparc64/kernel/hvcalls.S rename to arch/sparc/kernel/hvcalls.S diff --git a/arch/sparc64/kernel/hvtramp.S b/arch/sparc/kernel/hvtramp.S similarity index 100% rename from arch/sparc64/kernel/hvtramp.S rename to arch/sparc/kernel/hvtramp.S diff --git a/arch/sparc64/kernel/idprom.c b/arch/sparc/kernel/idprom_64.c similarity index 100% rename from arch/sparc64/kernel/idprom.c rename to arch/sparc/kernel/idprom_64.c diff --git a/arch/sparc64/kernel/init_task.c b/arch/sparc/kernel/init_task_64.c similarity index 100% rename from arch/sparc64/kernel/init_task.c rename to arch/sparc/kernel/init_task_64.c diff --git a/arch/sparc64/kernel/iommu.c b/arch/sparc/kernel/iommu.c similarity index 100% rename from arch/sparc64/kernel/iommu.c rename to arch/sparc/kernel/iommu.c diff --git a/arch/sparc64/kernel/iommu_common.h b/arch/sparc/kernel/iommu_common.h similarity index 100% rename from arch/sparc64/kernel/iommu_common.h rename to arch/sparc/kernel/iommu_common.h diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc/kernel/irq_64.c similarity index 100% rename from arch/sparc64/kernel/irq.c rename to arch/sparc/kernel/irq_64.c diff --git a/arch/sparc64/kernel/itlb_miss.S b/arch/sparc/kernel/itlb_miss.S similarity index 100% rename from arch/sparc64/kernel/itlb_miss.S rename to arch/sparc/kernel/itlb_miss.S diff --git a/arch/sparc64/kernel/ivec.S b/arch/sparc/kernel/ivec.S similarity index 100% rename from arch/sparc64/kernel/ivec.S rename to arch/sparc/kernel/ivec.S diff --git a/arch/sparc64/kernel/kgdb.c b/arch/sparc/kernel/kgdb_64.c similarity index 100% rename from arch/sparc64/kernel/kgdb.c rename to arch/sparc/kernel/kgdb_64.c diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c similarity index 100% rename from arch/sparc64/kernel/kprobes.c rename to arch/sparc/kernel/kprobes.c diff --git a/arch/sparc64/kernel/kstack.h b/arch/sparc/kernel/kstack.h similarity index 100% rename from arch/sparc64/kernel/kstack.h rename to arch/sparc/kernel/kstack.h diff --git a/arch/sparc64/kernel/ktlb.S b/arch/sparc/kernel/ktlb.S similarity index 100% rename from arch/sparc64/kernel/ktlb.S rename to arch/sparc/kernel/ktlb.S diff --git a/arch/sparc64/kernel/ldc.c b/arch/sparc/kernel/ldc.c similarity index 100% rename from arch/sparc64/kernel/ldc.c rename to arch/sparc/kernel/ldc.c diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c similarity index 100% rename from arch/sparc64/kernel/mdesc.c rename to arch/sparc/kernel/mdesc.c diff --git a/arch/sparc64/kernel/misctrap.S b/arch/sparc/kernel/misctrap.S similarity index 100% rename from arch/sparc64/kernel/misctrap.S rename to arch/sparc/kernel/misctrap.S diff --git a/arch/sparc64/kernel/module.c b/arch/sparc/kernel/module_64.c similarity index 100% rename from arch/sparc64/kernel/module.c rename to arch/sparc/kernel/module_64.c diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc/kernel/of_device_64.c similarity index 100% rename from arch/sparc64/kernel/of_device.c rename to arch/sparc/kernel/of_device_64.c diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc/kernel/pci.c similarity index 100% rename from arch/sparc64/kernel/pci.c rename to arch/sparc/kernel/pci.c diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c similarity index 100% rename from arch/sparc64/kernel/pci_common.c rename to arch/sparc/kernel/pci_common.c diff --git a/arch/sparc64/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c similarity index 100% rename from arch/sparc64/kernel/pci_fire.c rename to arch/sparc/kernel/pci_fire.c diff --git a/arch/sparc64/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h similarity index 100% rename from arch/sparc64/kernel/pci_impl.h rename to arch/sparc/kernel/pci_impl.h diff --git a/arch/sparc64/kernel/pci_msi.c b/arch/sparc/kernel/pci_msi.c similarity index 100% rename from arch/sparc64/kernel/pci_msi.c rename to arch/sparc/kernel/pci_msi.c diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c similarity index 100% rename from arch/sparc64/kernel/pci_psycho.c rename to arch/sparc/kernel/pci_psycho.c diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c similarity index 100% rename from arch/sparc64/kernel/pci_sabre.c rename to arch/sparc/kernel/pci_sabre.c diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c similarity index 100% rename from arch/sparc64/kernel/pci_schizo.c rename to arch/sparc/kernel/pci_schizo.c diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c similarity index 100% rename from arch/sparc64/kernel/pci_sun4v.c rename to arch/sparc/kernel/pci_sun4v.c diff --git a/arch/sparc64/kernel/pci_sun4v.h b/arch/sparc/kernel/pci_sun4v.h similarity index 100% rename from arch/sparc64/kernel/pci_sun4v.h rename to arch/sparc/kernel/pci_sun4v.h diff --git a/arch/sparc64/kernel/pci_sun4v_asm.S b/arch/sparc/kernel/pci_sun4v_asm.S similarity index 100% rename from arch/sparc64/kernel/pci_sun4v_asm.S rename to arch/sparc/kernel/pci_sun4v_asm.S diff --git a/arch/sparc64/kernel/power.c b/arch/sparc/kernel/power.c similarity index 100% rename from arch/sparc64/kernel/power.c rename to arch/sparc/kernel/power.c diff --git a/arch/sparc64/kernel/process.c b/arch/sparc/kernel/process_64.c similarity index 100% rename from arch/sparc64/kernel/process.c rename to arch/sparc/kernel/process_64.c diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc/kernel/prom_64.c similarity index 100% rename from arch/sparc64/kernel/prom.c rename to arch/sparc/kernel/prom_64.c diff --git a/arch/sparc64/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c similarity index 100% rename from arch/sparc64/kernel/psycho_common.c rename to arch/sparc/kernel/psycho_common.c diff --git a/arch/sparc64/kernel/psycho_common.h b/arch/sparc/kernel/psycho_common.h similarity index 100% rename from arch/sparc64/kernel/psycho_common.h rename to arch/sparc/kernel/psycho_common.h diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc/kernel/ptrace_64.c similarity index 100% rename from arch/sparc64/kernel/ptrace.c rename to arch/sparc/kernel/ptrace_64.c diff --git a/arch/sparc64/kernel/reboot.c b/arch/sparc/kernel/reboot.c similarity index 100% rename from arch/sparc64/kernel/reboot.c rename to arch/sparc/kernel/reboot.c diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc/kernel/rtrap_64.S similarity index 100% rename from arch/sparc64/kernel/rtrap.S rename to arch/sparc/kernel/rtrap_64.S diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc/kernel/sbus.c similarity index 100% rename from arch/sparc64/kernel/sbus.c rename to arch/sparc/kernel/sbus.c diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc/kernel/setup_64.c similarity index 100% rename from arch/sparc64/kernel/setup.c rename to arch/sparc/kernel/setup_64.c diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc/kernel/signal32.c similarity index 100% rename from arch/sparc64/kernel/signal32.c rename to arch/sparc/kernel/signal32.c diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc/kernel/signal_64.c similarity index 100% rename from arch/sparc64/kernel/signal.c rename to arch/sparc/kernel/signal_64.c diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc/kernel/smp_64.c similarity index 100% rename from arch/sparc64/kernel/smp.c rename to arch/sparc/kernel/smp_64.c diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc/kernel/sparc_ksyms_64.c similarity index 100% rename from arch/sparc64/kernel/sparc64_ksyms.c rename to arch/sparc/kernel/sparc_ksyms_64.c diff --git a/arch/sparc64/kernel/spiterrs.S b/arch/sparc/kernel/spiterrs.S similarity index 100% rename from arch/sparc64/kernel/spiterrs.S rename to arch/sparc/kernel/spiterrs.S diff --git a/arch/sparc64/kernel/sstate.c b/arch/sparc/kernel/sstate.c similarity index 100% rename from arch/sparc64/kernel/sstate.c rename to arch/sparc/kernel/sstate.c diff --git a/arch/sparc64/kernel/stacktrace.c b/arch/sparc/kernel/stacktrace.c similarity index 100% rename from arch/sparc64/kernel/stacktrace.c rename to arch/sparc/kernel/stacktrace.c diff --git a/arch/sparc64/kernel/starfire.c b/arch/sparc/kernel/starfire.c similarity index 100% rename from arch/sparc64/kernel/starfire.c rename to arch/sparc/kernel/starfire.c diff --git a/arch/sparc64/kernel/sun4v_ivec.S b/arch/sparc/kernel/sun4v_ivec.S similarity index 100% rename from arch/sparc64/kernel/sun4v_ivec.S rename to arch/sparc/kernel/sun4v_ivec.S diff --git a/arch/sparc64/kernel/sun4v_tlb_miss.S b/arch/sparc/kernel/sun4v_tlb_miss.S similarity index 100% rename from arch/sparc64/kernel/sun4v_tlb_miss.S rename to arch/sparc/kernel/sun4v_tlb_miss.S diff --git a/arch/sparc64/kernel/sys32.S b/arch/sparc/kernel/sys32.S similarity index 100% rename from arch/sparc64/kernel/sys32.S rename to arch/sparc/kernel/sys32.S diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c similarity index 100% rename from arch/sparc64/kernel/sys_sparc32.c rename to arch/sparc/kernel/sys_sparc32.c diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc_64.c similarity index 100% rename from arch/sparc64/kernel/sys_sparc.c rename to arch/sparc/kernel/sys_sparc_64.c diff --git a/arch/sparc64/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S similarity index 100% rename from arch/sparc64/kernel/syscalls.S rename to arch/sparc/kernel/syscalls.S diff --git a/arch/sparc64/kernel/sysfs.c b/arch/sparc/kernel/sysfs.c similarity index 100% rename from arch/sparc64/kernel/sysfs.c rename to arch/sparc/kernel/sysfs.c diff --git a/arch/sparc64/kernel/systbls.h b/arch/sparc/kernel/systbls.h similarity index 100% rename from arch/sparc64/kernel/systbls.h rename to arch/sparc/kernel/systbls.h diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc/kernel/systbls_64.S similarity index 100% rename from arch/sparc64/kernel/systbls.S rename to arch/sparc/kernel/systbls_64.S diff --git a/arch/sparc64/kernel/time.c b/arch/sparc/kernel/time_64.c similarity index 100% rename from arch/sparc64/kernel/time.c rename to arch/sparc/kernel/time_64.c diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc/kernel/trampoline_64.S similarity index 100% rename from arch/sparc64/kernel/trampoline.S rename to arch/sparc/kernel/trampoline_64.S diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc/kernel/traps_64.c similarity index 100% rename from arch/sparc64/kernel/traps.c rename to arch/sparc/kernel/traps_64.c diff --git a/arch/sparc64/kernel/tsb.S b/arch/sparc/kernel/tsb.S similarity index 100% rename from arch/sparc64/kernel/tsb.S rename to arch/sparc/kernel/tsb.S diff --git a/arch/sparc64/kernel/ttable.S b/arch/sparc/kernel/ttable.S similarity index 100% rename from arch/sparc64/kernel/ttable.S rename to arch/sparc/kernel/ttable.S diff --git a/arch/sparc64/kernel/una_asm.S b/arch/sparc/kernel/una_asm_64.S similarity index 100% rename from arch/sparc64/kernel/una_asm.S rename to arch/sparc/kernel/una_asm_64.S diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc/kernel/unaligned_64.c similarity index 100% rename from arch/sparc64/kernel/unaligned.c rename to arch/sparc/kernel/unaligned_64.c diff --git a/arch/sparc64/kernel/us2e_cpufreq.c b/arch/sparc/kernel/us2e_cpufreq.c similarity index 100% rename from arch/sparc64/kernel/us2e_cpufreq.c rename to arch/sparc/kernel/us2e_cpufreq.c diff --git a/arch/sparc64/kernel/us3_cpufreq.c b/arch/sparc/kernel/us3_cpufreq.c similarity index 100% rename from arch/sparc64/kernel/us3_cpufreq.c rename to arch/sparc/kernel/us3_cpufreq.c diff --git a/arch/sparc64/kernel/utrap.S b/arch/sparc/kernel/utrap.S similarity index 100% rename from arch/sparc64/kernel/utrap.S rename to arch/sparc/kernel/utrap.S diff --git a/arch/sparc64/kernel/vio.c b/arch/sparc/kernel/vio.c similarity index 100% rename from arch/sparc64/kernel/vio.c rename to arch/sparc/kernel/vio.c diff --git a/arch/sparc64/kernel/viohs.c b/arch/sparc/kernel/viohs.c similarity index 100% rename from arch/sparc64/kernel/viohs.c rename to arch/sparc/kernel/viohs.c diff --git a/arch/sparc64/kernel/visemul.c b/arch/sparc/kernel/visemul.c similarity index 100% rename from arch/sparc64/kernel/visemul.c rename to arch/sparc/kernel/visemul.c diff --git a/arch/sparc64/kernel/winfixup.S b/arch/sparc/kernel/winfixup.S similarity index 100% rename from arch/sparc64/kernel/winfixup.S rename to arch/sparc/kernel/winfixup.S diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile deleted file mode 100644 index 416eb9bff484..000000000000 --- a/arch/sparc64/kernel/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# Makefile for the linux kernel. -# - -EXTRA_AFLAGS := -ansi -EXTRA_CFLAGS := -Werror - -CFLAGS_REMOVE_ftrace.o = -pg - -extra-y := head.o init_task.o ../../sparc/kernel/vmlinux.lds - -obj-y := process.o setup.o cpu.o idprom.o reboot.o \ - traps.o auxio.o una_asm.o sysfs.o iommu.o \ - irq.o ptrace.o time.o sys_sparc.o signal.o \ - unaligned.o central.o starfire.o \ - power.o sbus.o sparc64_ksyms.o ebus.o \ - visemul.o prom.o of_device.o hvapi.o sstate.o mdesc.o - -obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o -obj-$(CONFIG_STACKTRACE) += stacktrace.o -obj-$(CONFIG_PCI) += pci.o pci_common.o psycho_common.o \ - pci_psycho.o pci_sabre.o pci_schizo.o \ - pci_sun4v.o pci_sun4v_asm.o pci_fire.o -obj-$(CONFIG_PCI_MSI) += pci_msi.o -obj-$(CONFIG_SMP) += smp.o trampoline.o hvtramp.o -obj-$(CONFIG_COMPAT) += sys32.o sys_sparc32.o signal32.o -obj-$(CONFIG_MODULES) += module.o -obj-$(CONFIG_US3_FREQ) += us3_cpufreq.o -obj-$(CONFIG_US2E_FREQ) += us2e_cpufreq.o -obj-$(CONFIG_US3_MC) += chmc.o -obj-$(CONFIG_KPROBES) += kprobes.o -obj-$(CONFIG_SUN_LDOMS) += ldc.o vio.o viohs.o ds.o -obj-$(CONFIG_AUDIT) += audit.o -obj-$(CONFIG_AUDIT)$(CONFIG_COMPAT) += compat_audit.o -obj-y += $(obj-yy) -obj-$(CONFIG_KGDB) += kgdb.o diff --git a/arch/sparc64/kernel/asm-offsets.c b/arch/sparc64/kernel/asm-offsets.c deleted file mode 100644 index 8cbd958d50bd..000000000000 --- a/arch/sparc64/kernel/asm-offsets.c +++ /dev/null @@ -1 +0,0 @@ -#include "../../sparc/kernel/asm-offsets.c" diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S deleted file mode 100644 index 4e8becb80112..000000000000 --- a/arch/sparc64/kernel/vmlinux.lds.S +++ /dev/null @@ -1 +0,0 @@ -#include "../../sparc/kernel/vmlinux.lds.S" From a8c601ca21e790f6a9d996bb0bf31f7496eb9509 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Wed, 3 Dec 2008 03:14:26 -0800 Subject: [PATCH 47/98] sparc,sparc64: unify boot/ Simple unification: o renamed piggyback to *_32.c/*_64.c o copied content of Makefile from sparc64 to sparc and guard it o updated sparc/boot/.gitignore o deleted remaining files in sparc64/boot Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Makefile | 9 +++-- arch/sparc/boot/.gitignore | 3 ++ arch/sparc/boot/Makefile | 33 +++++++++++++++++-- .../boot/{piggyback.c => piggyback_32.c} | 0 .../piggyback.c => sparc/boot/piggyback_64.c} | 0 arch/sparc64/boot/.gitignore | 4 --- arch/sparc64/boot/Makefile | 33 ------------------- 7 files changed, 37 insertions(+), 45 deletions(-) rename arch/sparc/boot/{piggyback.c => piggyback_32.c} (100%) rename arch/{sparc64/boot/piggyback.c => sparc/boot/piggyback_64.c} (100%) delete mode 100644 arch/sparc64/boot/.gitignore delete mode 100644 arch/sparc64/boot/Makefile diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index 4b39ac68c3b1..efc90711f79d 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -89,17 +89,16 @@ ifdef CONFIG_KALLSYMS export kallsyms.o := .tmp_kallsyms2.o endif -boot-y := arch/sparc/boot -boot-$(CONFIG_SPARC64) := arch/sparc64/boot +boot := arch/sparc/boot image zImage tftpboot.img vmlinux.aout: vmlinux - $(Q)$(MAKE) $(build)=$(boot-y) $(boot-y)/$@ + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ archclean: - $(Q)$(MAKE) $(clean)=$(boot-y) + $(Q)$(MAKE) $(clean)=$(boot) # This is the image used for packaging -KBUILD_IMAGE := $(boot-y)/zImage +KBUILD_IMAGE := $(boot)/zImage # Don't use tabs in echo arguments. ifeq ($(ARCH),sparc) diff --git a/arch/sparc/boot/.gitignore b/arch/sparc/boot/.gitignore index 8ffba5762be1..fc6f3986c76c 100644 --- a/arch/sparc/boot/.gitignore +++ b/arch/sparc/boot/.gitignore @@ -2,4 +2,7 @@ btfix.S btfixupprep image zImage +tftpboot.img +vmlinux.aout +piggyback diff --git a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile index 06b653df820d..96041a8d39e8 100644 --- a/arch/sparc/boot/Makefile +++ b/arch/sparc/boot/Makefile @@ -6,14 +6,16 @@ ROOT_IMG := /usr/src/root.img ELFTOAOUT := elftoaout -hostprogs-y := piggyback btfixupprep -targets := tftpboot.img btfix.o btfix.S image zImage +hostprogs-y := piggyback_32 piggyback_64 btfixupprep +targets := tftpboot.img btfix.o btfix.S image zImage vmlinux.aout clean-files := System.map quiet_cmd_elftoaout = ELFTOAOUT $@ cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@ + +ifeq ($(CONFIG_SPARC32),y) quiet_cmd_piggy = PIGGY $@ - cmd_piggy = $(obj)/piggyback $@ $(obj)/System.map $(ROOT_IMG) + cmd_piggy = $(obj)/piggyback_32 $@ $(obj)/System.map $(ROOT_IMG) quiet_cmd_btfix = BTFIX $@ cmd_btfix = $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@ quiet_cmd_sysmap = SYSMAP $(obj)/System.map @@ -62,3 +64,28 @@ $(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE $(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE $(call if_changed,btfix) + +endif + +ifeq ($(CONFIG_SPARC64),y) +quiet_cmd_piggy = PIGGY $@ + cmd_piggy = $(obj)/piggyback_64 $@ System.map $(ROOT_IMG) +quiet_cmd_strip = STRIP $@ + cmd_strip = $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start vmlinux -o $@ + + +# Actual linking +$(obj)/image: vmlinux FORCE + $(call if_changed,strip) + @echo ' kernel: $@ is ready' + +$(obj)/tftpboot.img: vmlinux $(obj)/piggyback_64 System.map $(ROOT_IMG) FORCE + $(call if_changed,elftoaout) + $(call if_changed,piggy) + @echo ' kernel: $@ is ready' + +$(obj)/vmlinux.aout: vmlinux FORCE + $(call if_changed,elftoaout) + @echo ' kernel: $@ is ready' +endif + diff --git a/arch/sparc/boot/piggyback.c b/arch/sparc/boot/piggyback_32.c similarity index 100% rename from arch/sparc/boot/piggyback.c rename to arch/sparc/boot/piggyback_32.c diff --git a/arch/sparc64/boot/piggyback.c b/arch/sparc/boot/piggyback_64.c similarity index 100% rename from arch/sparc64/boot/piggyback.c rename to arch/sparc/boot/piggyback_64.c diff --git a/arch/sparc64/boot/.gitignore b/arch/sparc64/boot/.gitignore deleted file mode 100644 index 36356f9d498e..000000000000 --- a/arch/sparc64/boot/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -image -tftpboot.img -vmlinux.aout -piggyback diff --git a/arch/sparc64/boot/Makefile b/arch/sparc64/boot/Makefile deleted file mode 100644 index 0458b5244f09..000000000000 --- a/arch/sparc64/boot/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# Makefile for the Sparc64 boot stuff. -# -# Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) -# Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - -ROOT_IMG := /usr/src/root.img -ELFTOAOUT := elftoaout - -hostprogs-y := piggyback -targets := image tftpboot.img vmlinux.aout - -quiet_cmd_elftoaout = ELF2AOUT $@ - cmd_elftoaout = $(ELFTOAOUT) vmlinux -o $@ -quiet_cmd_piggy = PIGGY $@ - cmd_piggy = $(obj)/piggyback $@ System.map $(ROOT_IMG) -quiet_cmd_strip = STRIP $@ - cmd_strip = $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start vmlinux -o $@ - - -# Actual linking -$(obj)/image: vmlinux FORCE - $(call if_changed,strip) - @echo ' kernel: $@ is ready' - -$(obj)/tftpboot.img: vmlinux $(obj)/piggyback System.map $(ROOT_IMG) FORCE - $(call if_changed,elftoaout) - $(call if_changed,piggy) - @echo ' kernel: $@ is ready' - -$(obj)/vmlinux.aout: vmlinux FORCE - $(call if_changed,elftoaout) - @echo ' kernel: $@ is ready' - From c2e27c359ab76fecbbd292dbfc0bcfa8399afdd9 Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Wed, 3 Dec 2008 21:10:57 -0800 Subject: [PATCH 48/98] sparc: Add missing of_node_put of_node_put is needed before discarding a value received from of_find_node_by_name, eg in error handling code or when the device node is no longer used. The semantic match that catches the bug is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression struct device_node *n; position p1, p2; struct device_node *n1; statement S; identifier f; expression E; expression *ptr != NULL; @@ n@p1 = of_find_node_by_name(...) ... if (!n) S ... when != of_node_put(n) when != n1 = f(n,...) when != E = n when any when strict ( return \(0\|<+...n...+>\|ptr\); | return@p2 ...; | of_node_put(n); | n1 = f(n,...) | E = n ) @script:python@ p1 << r.p1; p2 << r.p2; @@ print "* file: %s of_find_node_by_name %s return %s" % (p1[0].file,p1[0].line,p2[0].line) // Signed-off-by: Nicolas Palix Signed-off-by: Julia Lawall Signed-off-by: David S. Miller --- arch/sparc/kernel/sun4c_irq.c | 2 ++ arch/sparc/kernel/sun4d_irq.c | 1 + arch/sparc/kernel/sun4m_irq.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/arch/sparc/kernel/sun4c_irq.c b/arch/sparc/kernel/sun4c_irq.c index 5dc8a5769489..bc3adbf79c6a 100644 --- a/arch/sparc/kernel/sun4c_irq.c +++ b/arch/sparc/kernel/sun4c_irq.c @@ -160,6 +160,7 @@ static void __init sun4c_init_timers(irq_handler_t counter_fn) sun4c_timers = (void __iomem *) (unsigned long) addr[0]; irq = of_get_property(dp, "intr", NULL); + of_node_put(dp); if (!irq) { prom_printf("sun4c_init_timers: No intr property\n"); prom_halt(); @@ -200,6 +201,7 @@ void __init sun4c_init_IRQ(void) } addr = of_get_property(dp, "address", NULL); + of_node_put(dp); if (!addr) { prom_printf("sun4c_init_IRQ: No address property\n"); prom_halt(); diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c index d3cb76ce418b..1c98821e1a64 100644 --- a/arch/sparc/kernel/sun4d_irq.c +++ b/arch/sparc/kernel/sun4d_irq.c @@ -508,6 +508,7 @@ static void __init sun4d_init_timers(irq_handler_t counter_fn) * bootbus. */ reg = of_get_property(dp, "reg", NULL); + of_node_put(dp); if (!reg) { prom_printf("sun4d_init_timers: No reg property\n"); prom_halt(); diff --git a/arch/sparc/kernel/sun4m_irq.c b/arch/sparc/kernel/sun4m_irq.c index f10317179ee6..301892e2d718 100644 --- a/arch/sparc/kernel/sun4m_irq.c +++ b/arch/sparc/kernel/sun4m_irq.c @@ -374,6 +374,7 @@ static void __init sun4m_init_timers(irq_handler_t counter_fn) } addr = of_get_property(dp, "address", &len); + of_node_put(dp); if (!addr) { printk(KERN_ERR "sun4m_init_timers: No 'address' prop.\n"); return; @@ -437,6 +438,7 @@ void __init sun4m_init_IRQ(void) } addr = of_get_property(dp, "address", &len); + of_node_put(dp); if (!addr) { printk(KERN_ERR "sun4m_init_IRQ: No 'address' prop.\n"); return; From 757498c63ed70ec8961aa432173247f4373ef0c3 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Thu, 4 Dec 2008 13:26:31 -0800 Subject: [PATCH 49/98] sparc: drop CONFIG_SUN_AUXIO It is always equals y so no need to test for it Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 4 ---- arch/sparc/kernel/devices.c | 2 -- arch/sparc/kernel/process_32.c | 2 -- arch/sparc/kernel/sparc_ksyms_32.c | 2 -- arch/sparc/kernel/sparc_ksyms_64.c | 2 -- arch/sparc/mm/sun4c.c | 2 -- arch/sparc/prom/misc_32.c | 2 -- 7 files changed, 16 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 7cfe557db23d..ecb5ff9f01fa 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -465,10 +465,6 @@ config SBUSCHAR bool default y -config SUN_AUXIO - bool - default y - config SUN_IO bool default y diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c index ad656b044b8c..b171ae8de90d 100644 --- a/arch/sparc/kernel/devices.c +++ b/arch/sparc/kernel/devices.c @@ -133,14 +133,12 @@ void __init device_scan(void) #endif /* !CONFIG_SMP */ cpu_probe(); -#ifdef CONFIG_SUN_AUXIO { extern void auxio_probe(void); extern void auxio_power_probe(void); auxio_probe(); auxio_power_probe(); } -#endif clock_stop_probe(); if (ARCH_SUN4C) diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c index e8c43ffe317e..69d9315f4a93 100644 --- a/arch/sparc/kernel/process_32.c +++ b/arch/sparc/kernel/process_32.c @@ -168,11 +168,9 @@ void machine_restart(char * cmd) void machine_power_off(void) { -#ifdef CONFIG_SUN_AUXIO if (auxio_power_register && (strcmp(of_console_device->type, "serial") || scons_pwroff)) *auxio_power_register |= AUXIO_POWER_OFF; -#endif machine_halt(); } diff --git a/arch/sparc/kernel/sparc_ksyms_32.c b/arch/sparc/kernel/sparc_ksyms_32.c index b0dfff848653..3c80562faa8a 100644 --- a/arch/sparc/kernel/sparc_ksyms_32.c +++ b/arch/sparc/kernel/sparc_ksyms_32.c @@ -122,10 +122,8 @@ EXPORT_SYMBOL(phys_cpu_present_map); EXPORT_SYMBOL(__udelay); EXPORT_SYMBOL(__ndelay); EXPORT_SYMBOL(rtc_lock); -#ifdef CONFIG_SUN_AUXIO EXPORT_SYMBOL(set_auxio); EXPORT_SYMBOL(get_auxio); -#endif EXPORT_SYMBOL(io_remap_pfn_range); #ifndef CONFIG_SMP diff --git a/arch/sparc/kernel/sparc_ksyms_64.c b/arch/sparc/kernel/sparc_ksyms_64.c index c450825b3fe5..e6d2bb86a46f 100644 --- a/arch/sparc/kernel/sparc_ksyms_64.c +++ b/arch/sparc/kernel/sparc_ksyms_64.c @@ -154,10 +154,8 @@ EXPORT_SYMBOL(sun4v_niagara_setperf); EXPORT_SYMBOL(sun4v_niagara2_getperf); EXPORT_SYMBOL(sun4v_niagara2_setperf); -#ifdef CONFIG_SUN_AUXIO EXPORT_SYMBOL(auxio_set_led); EXPORT_SYMBOL(auxio_set_lte); -#endif #ifdef CONFIG_SBUS EXPORT_SYMBOL(sbus_set_sbus64); #endif diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index fe65aeeb3947..6b0c49004ba6 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c @@ -240,9 +240,7 @@ void sun4c_complete_all_stores(void) _unused = sun4c_get_context(); sun4c_set_context(_unused); -#ifdef CONFIG_SUN_AUXIO _unused = get_auxio(); -#endif } /* Bootup utility functions. */ diff --git a/arch/sparc/prom/misc_32.c b/arch/sparc/prom/misc_32.c index 49b5057b9601..cf6c3f6d36c3 100644 --- a/arch/sparc/prom/misc_32.c +++ b/arch/sparc/prom/misc_32.c @@ -61,9 +61,7 @@ prom_cmdline(void) restore_current(); install_linux_ticker(); spin_unlock_irqrestore(&prom_lock, flags); -#ifdef CONFIG_SUN_AUXIO set_auxio(AUXIO_LED, 0); -#endif } /* Drop into the prom, but completely terminate the program. From b28017f57f1ec16ab515e99d863bf9f33ea0d737 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Thu, 4 Dec 2008 13:28:09 -0800 Subject: [PATCH 50/98] sparc: unify kernel/init_task A closer inspection revealed that these two files had identical functionality - but the implementation of it differed slightly. Base it on the sparc version as it was the best. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Makefile | 2 +- arch/sparc/kernel/Makefile | 2 +- .../kernel/{init_task_32.c => init_task.c} | 0 arch/sparc/kernel/init_task_64.c | 35 ------------------- 4 files changed, 2 insertions(+), 37 deletions(-) rename arch/sparc/kernel/{init_task_32.c => init_task.c} (100%) delete mode 100644 arch/sparc/kernel/init_task_64.c diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index efc90711f79d..2003ded054c2 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -68,7 +68,7 @@ endif endif head-y := arch/sparc/kernel/head_$(BITS).o -head-y += arch/sparc/kernel/init_task_$(BITS).o +head-y += arch/sparc/kernel/init_task.o core-y += arch/sparc/kernel/ core-y += arch/sparc/mm/ arch/sparc/math-emu/ diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 46439465c3b2..cd13d7fcfccf 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -6,7 +6,7 @@ asflags-y := -ansi ccflags-y := -Werror extra-y := head_$(BITS).o -extra-y += init_task_$(BITS).o +extra-y += init_task.o extra-y += vmlinux.lds obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o diff --git a/arch/sparc/kernel/init_task_32.c b/arch/sparc/kernel/init_task.c similarity index 100% rename from arch/sparc/kernel/init_task_32.c rename to arch/sparc/kernel/init_task.c diff --git a/arch/sparc/kernel/init_task_64.c b/arch/sparc/kernel/init_task_64.c deleted file mode 100644 index d2b312381c19..000000000000 --- a/arch/sparc/kernel/init_task_64.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -static struct fs_struct init_fs = INIT_FS; -static struct signal_struct init_signals = INIT_SIGNALS(init_signals); -static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); -struct mm_struct init_mm = INIT_MM(init_mm); - -EXPORT_SYMBOL(init_mm); - -/* .text section in head.S is aligned at 2 page boundary and this gets linked - * right after that so that the init_thread_union is aligned properly as well. - * We really don't need this special alignment like the Intel does, but - * I do it anyways for completeness. - */ -__asm__ (".text"); -union thread_union init_thread_union = { INIT_THREAD_INFO(init_task) }; - -/* - * Initial task structure. - * - * All other task structs will be allocated on slabs in fork.c - */ -EXPORT_SYMBOL(init_task); - -__asm__(".data"); -struct task_struct init_task = INIT_TASK(init_task); From 657f201df693c26d294f6c789b8a87cd8c16eb53 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 4 Dec 2008 20:12:20 -0800 Subject: [PATCH 51/98] sparc: Create common header file for prom_{32,64}.c This is where common declarations will go as we unify these files as much as possible into common code. Signed-off-by: David S. Miller --- arch/sparc/kernel/prom.h | 10 ++++++++++ arch/sparc/kernel/prom_32.c | 4 +--- arch/sparc/kernel/prom_64.c | 4 +--- 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 arch/sparc/kernel/prom.h diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h new file mode 100644 index 000000000000..dce53de274e8 --- /dev/null +++ b/arch/sparc/kernel/prom.h @@ -0,0 +1,10 @@ +#ifndef __PROM_H +#define __PROM_H + +#include +#include + +extern struct device_node *allnodes; /* temporary while merging */ +extern rwlock_t devtree_lock; /* temporary while merging */ + +#endif /* __PROM_H */ diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index eee5efcfe50e..715455ba3689 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -25,9 +25,7 @@ #include #include -extern struct device_node *allnodes; /* temporary while merging */ - -extern rwlock_t devtree_lock; /* temporary while merging */ +#include "prom.h" struct device_node *of_find_node_by_phandle(phandle handle) { diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index dbba82f9b142..651448d3cc5a 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -30,9 +30,7 @@ #include #include -extern struct device_node *allnodes; /* temporary while merging */ - -extern rwlock_t devtree_lock; /* temporary while merging */ +#include "prom.h" struct device_node *of_find_node_by_phandle(phandle handle) { From ab04323e5b8c50d6e8f7f4a3e4118ba5fcba61a1 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 5 Dec 2008 16:54:44 -0800 Subject: [PATCH 52/98] sparc: Const'ify prom_*prop*() on sparc32. This brings things in line with sparc64. Signed-off-by: David S. Miller --- arch/sparc/include/asm/openprom_32.h | 6 +++--- arch/sparc/include/asm/oplib_32.h | 6 +++--- arch/sparc/prom/tree_32.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/sparc/include/asm/openprom_32.h b/arch/sparc/include/asm/openprom_32.h index 8b1649f29ed9..875da3552d80 100644 --- a/arch/sparc/include/asm/openprom_32.h +++ b/arch/sparc/include/asm/openprom_32.h @@ -170,9 +170,9 @@ struct linux_romvec { struct linux_nodeops { int (*no_nextnode)(int node); int (*no_child)(int node); - int (*no_proplen)(int node, char *name); - int (*no_getprop)(int node, char *name, char *val); - int (*no_setprop)(int node, char *name, char *val, int len); + int (*no_proplen)(int node, const char *name); + int (*no_getprop)(int node, const char *name, char *val); + int (*no_setprop)(int node, const char *name, char *val, int len); char * (*no_nextprop)(int node, char *name); }; diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h index 699da05235c8..3bdf56f46883 100644 --- a/arch/sparc/include/asm/oplib_32.h +++ b/arch/sparc/include/asm/oplib_32.h @@ -199,12 +199,12 @@ extern int prom_getsibling(int node); /* Get the length, at the passed node, of the given property type. * Returns -1 on error (ie. no such property at this node). */ -extern int prom_getproplen(int thisnode, char *property); +extern int prom_getproplen(int thisnode, const char *property); /* Fetch the requested property using the given buffer. Returns * the number of bytes the prom put into your buffer or -1 on error. */ -extern int __must_check prom_getproperty(int thisnode, char *property, +extern int __must_check prom_getproperty(int thisnode, const char *property, char *prop_buffer, int propbuf_size); /* Acquire an integer property. */ @@ -246,7 +246,7 @@ extern int prom_node_has_property(int node, char *property); /* Set the indicated property at the given node with the passed value. * Returns the number of bytes of your value that the prom took. */ -extern int prom_setprop(int node, char *prop_name, char *prop_value, +extern int prom_setprop(int node, const char *prop_name, char *prop_value, int value_size); extern int prom_pathtoinode(char *path); diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c index f228fe057b24..6d8187357331 100644 --- a/arch/sparc/prom/tree_32.c +++ b/arch/sparc/prom/tree_32.c @@ -85,7 +85,7 @@ int prom_getsibling(int node) /* Return the length in bytes of property 'prop' at node 'node'. * Return -1 on error. */ -int prom_getproplen(int node, char *prop) +int prom_getproplen(int node, const char *prop) { int ret; unsigned long flags; @@ -104,7 +104,7 @@ int prom_getproplen(int node, char *prop) * 'buffer' which has a size of 'bufsize'. If the acquisition * was successful the length will be returned, else -1 is returned. */ -int prom_getproperty(int node, char *prop, char *buffer, int bufsize) +int prom_getproperty(int node, const char *prop, char *buffer, int bufsize) { int plen, ret; unsigned long flags; @@ -303,7 +303,7 @@ int prom_node_has_property(int node, char *prop) /* Set property 'pname' at node 'node' to value 'value' which has a length * of 'size' bytes. Return the number of bytes the prom accepted. */ -int prom_setprop(int node, char *pname, char *value, int size) +int prom_setprop(int node, const char *pname, char *value, int size) { unsigned long flags; int ret; From dfa76060be85dd48d3803bc26f6a6d2e93e812f0 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 4 Dec 2008 20:28:22 -0800 Subject: [PATCH 53/98] sparc: Create common area for OF device layer code. This is where common code implementations will go as we unify 32-bit and 64-bit OF device tree code. Signed-off-by: David S. Miller --- arch/sparc/kernel/Makefile | 1 + arch/sparc/kernel/prom_32.c | 94 ------------------------- arch/sparc/kernel/prom_64.c | 94 ------------------------- arch/sparc/kernel/prom_common.c | 121 ++++++++++++++++++++++++++++++++ 4 files changed, 122 insertions(+), 188 deletions(-) create mode 100644 arch/sparc/kernel/prom_common.c diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index cd13d7fcfccf..d0d63b1ab02e 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -35,6 +35,7 @@ obj-y += ptrace_$(BITS).o obj-y += unaligned_$(BITS).o obj-y += una_asm_$(BITS).o obj-$(CONFIG_SPARC32) += muldiv.o +obj-y += prom_common.o obj-y += prom_$(BITS).o obj-y += of_device_$(BITS).o diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index 715455ba3689..e41df66192e5 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -27,100 +27,6 @@ #include "prom.h" -struct device_node *of_find_node_by_phandle(phandle handle) -{ - struct device_node *np; - - for (np = allnodes; np != 0; np = np->allnext) - if (np->node == handle) - break; - - return np; -} -EXPORT_SYMBOL(of_find_node_by_phandle); - -int of_getintprop_default(struct device_node *np, const char *name, int def) -{ - struct property *prop; - int len; - - prop = of_find_property(np, name, &len); - if (!prop || len != 4) - return def; - - return *(int *) prop->value; -} -EXPORT_SYMBOL(of_getintprop_default); - -DEFINE_MUTEX(of_set_property_mutex); -EXPORT_SYMBOL(of_set_property_mutex); - -int of_set_property(struct device_node *dp, const char *name, void *val, int len) -{ - struct property **prevp; - void *new_val; - int err; - - new_val = kmalloc(len, GFP_KERNEL); - if (!new_val) - return -ENOMEM; - - memcpy(new_val, val, len); - - err = -ENODEV; - - write_lock(&devtree_lock); - prevp = &dp->properties; - while (*prevp) { - struct property *prop = *prevp; - - if (!strcasecmp(prop->name, name)) { - void *old_val = prop->value; - int ret; - - mutex_lock(&of_set_property_mutex); - ret = prom_setprop(dp->node, (char *) name, val, len); - mutex_unlock(&of_set_property_mutex); - - err = -EINVAL; - if (ret >= 0) { - prop->value = new_val; - prop->length = len; - - if (OF_IS_DYNAMIC(prop)) - kfree(old_val); - - OF_MARK_DYNAMIC(prop); - - err = 0; - } - break; - } - prevp = &(*prevp)->next; - } - write_unlock(&devtree_lock); - - /* XXX Upate procfs if necessary... */ - - return err; -} -EXPORT_SYMBOL(of_set_property); - -int of_find_in_proplist(const char *list, const char *match, int len) -{ - while (len > 0) { - int l; - - if (!strcmp(list, match)) - return 1; - l = strlen(list) + 1; - list += l; - len -= l; - } - return 0; -} -EXPORT_SYMBOL(of_find_in_proplist); - static unsigned int prom_early_allocated; static void * __init prom_early_alloc(unsigned long size) diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index 651448d3cc5a..1f5666a94884 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -32,100 +32,6 @@ #include "prom.h" -struct device_node *of_find_node_by_phandle(phandle handle) -{ - struct device_node *np; - - for (np = allnodes; np; np = np->allnext) - if (np->node == handle) - break; - - return np; -} -EXPORT_SYMBOL(of_find_node_by_phandle); - -int of_getintprop_default(struct device_node *np, const char *name, int def) -{ - struct property *prop; - int len; - - prop = of_find_property(np, name, &len); - if (!prop || len != 4) - return def; - - return *(int *) prop->value; -} -EXPORT_SYMBOL(of_getintprop_default); - -DEFINE_MUTEX(of_set_property_mutex); -EXPORT_SYMBOL(of_set_property_mutex); - -int of_set_property(struct device_node *dp, const char *name, void *val, int len) -{ - struct property **prevp; - void *new_val; - int err; - - new_val = kmalloc(len, GFP_KERNEL); - if (!new_val) - return -ENOMEM; - - memcpy(new_val, val, len); - - err = -ENODEV; - - write_lock(&devtree_lock); - prevp = &dp->properties; - while (*prevp) { - struct property *prop = *prevp; - - if (!strcasecmp(prop->name, name)) { - void *old_val = prop->value; - int ret; - - mutex_lock(&of_set_property_mutex); - ret = prom_setprop(dp->node, name, val, len); - mutex_unlock(&of_set_property_mutex); - - err = -EINVAL; - if (ret >= 0) { - prop->value = new_val; - prop->length = len; - - if (OF_IS_DYNAMIC(prop)) - kfree(old_val); - - OF_MARK_DYNAMIC(prop); - - err = 0; - } - break; - } - prevp = &(*prevp)->next; - } - write_unlock(&devtree_lock); - - /* XXX Upate procfs if necessary... */ - - return err; -} -EXPORT_SYMBOL(of_set_property); - -int of_find_in_proplist(const char *list, const char *match, int len) -{ - while (len > 0) { - int l; - - if (!strcmp(list, match)) - return 1; - l = strlen(list) + 1; - list += l; - len -= l; - } - return 0; -} -EXPORT_SYMBOL(of_find_in_proplist); - static unsigned int prom_early_allocated __initdata; static void * __init prom_early_alloc(unsigned long size) diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c new file mode 100644 index 000000000000..ded8c628811f --- /dev/null +++ b/arch/sparc/kernel/prom_common.c @@ -0,0 +1,121 @@ +/* prom_common.c: OF device tree support common code. + * + * Paul Mackerras August 1996. + * Copyright (C) 1996-2005 Paul Mackerras. + * + * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner. + * {engebret|bergner}@us.ibm.com + * + * Adapted for sparc by David S. Miller davem@davemloft.net + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "prom.h" + +struct device_node *of_find_node_by_phandle(phandle handle) +{ + struct device_node *np; + + for (np = allnodes; np; np = np->allnext) + if (np->node == handle) + break; + + return np; +} +EXPORT_SYMBOL(of_find_node_by_phandle); + +int of_getintprop_default(struct device_node *np, const char *name, int def) +{ + struct property *prop; + int len; + + prop = of_find_property(np, name, &len); + if (!prop || len != 4) + return def; + + return *(int *) prop->value; +} +EXPORT_SYMBOL(of_getintprop_default); + +DEFINE_MUTEX(of_set_property_mutex); +EXPORT_SYMBOL(of_set_property_mutex); + +int of_set_property(struct device_node *dp, const char *name, void *val, int len) +{ + struct property **prevp; + void *new_val; + int err; + + new_val = kmalloc(len, GFP_KERNEL); + if (!new_val) + return -ENOMEM; + + memcpy(new_val, val, len); + + err = -ENODEV; + + write_lock(&devtree_lock); + prevp = &dp->properties; + while (*prevp) { + struct property *prop = *prevp; + + if (!strcasecmp(prop->name, name)) { + void *old_val = prop->value; + int ret; + + mutex_lock(&of_set_property_mutex); + ret = prom_setprop(dp->node, name, val, len); + mutex_unlock(&of_set_property_mutex); + + err = -EINVAL; + if (ret >= 0) { + prop->value = new_val; + prop->length = len; + + if (OF_IS_DYNAMIC(prop)) + kfree(old_val); + + OF_MARK_DYNAMIC(prop); + + err = 0; + } + break; + } + prevp = &(*prevp)->next; + } + write_unlock(&devtree_lock); + + /* XXX Upate procfs if necessary... */ + + return err; +} +EXPORT_SYMBOL(of_set_property); + +int of_find_in_proplist(const char *list, const char *match, int len) +{ + while (len > 0) { + int l; + + if (!strcmp(list, match)) + return 1; + l = strlen(list) + 1; + list += l; + len -= l; + } + return 0; +} +EXPORT_SYMBOL(of_find_in_proplist); + From efeac2f87609ab25dab329ce16876eb9110b2084 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 5 Dec 2008 00:40:43 -0800 Subject: [PATCH 54/98] sparc: Mark prom_early_alloc non-static. A subsequent changeset will use this. Signed-off-by: David S. Miller --- arch/sparc/kernel/prom.h | 2 ++ arch/sparc/kernel/prom_32.c | 2 +- arch/sparc/kernel/prom_64.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h index dce53de274e8..b7258ce87ccc 100644 --- a/arch/sparc/kernel/prom.h +++ b/arch/sparc/kernel/prom.h @@ -7,4 +7,6 @@ extern struct device_node *allnodes; /* temporary while merging */ extern rwlock_t devtree_lock; /* temporary while merging */ +extern void * prom_early_alloc(unsigned long size); + #endif /* __PROM_H */ diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index e41df66192e5..ba3c55186823 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -29,7 +29,7 @@ static unsigned int prom_early_allocated; -static void * __init prom_early_alloc(unsigned long size) +void * __init prom_early_alloc(unsigned long size) { void *ret; diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index 1f5666a94884..1c7b9d7b7889 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -34,7 +34,7 @@ static unsigned int prom_early_allocated __initdata; -static void * __init prom_early_alloc(unsigned long size) +void * __init prom_early_alloc(unsigned long size) { unsigned long paddr = lmb_alloc(size, SMP_CACHE_BYTES); void *ret; From 5fce09c6f636449d6df971971af1bd4328a21890 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 5 Dec 2008 00:43:03 -0800 Subject: [PATCH 55/98] sparc: Move irq_trans_init() and support code into seperate file. All sparc64 specific, so only build this file on sparc64. Signed-off-by: David S. Miller --- arch/sparc/kernel/Makefile | 1 + arch/sparc/kernel/prom.h | 4 + arch/sparc/kernel/prom_64.c | 830 ----------------------------- arch/sparc/kernel/prom_irqtrans.c | 842 ++++++++++++++++++++++++++++++ 4 files changed, 847 insertions(+), 830 deletions(-) create mode 100644 arch/sparc/kernel/prom_irqtrans.c diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index d0d63b1ab02e..04c74d00f832 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -38,6 +38,7 @@ obj-$(CONFIG_SPARC32) += muldiv.o obj-y += prom_common.o obj-y += prom_$(BITS).o obj-y += of_device_$(BITS).o +obj-$(CONFIG_SPARC64) += prom_irqtrans.o obj-$(CONFIG_SPARC64) += reboot.o obj-$(CONFIG_SPARC64) += sysfs.o diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h index b7258ce87ccc..49925101f8f8 100644 --- a/arch/sparc/kernel/prom.h +++ b/arch/sparc/kernel/prom.h @@ -9,4 +9,8 @@ extern rwlock_t devtree_lock; /* temporary while merging */ extern void * prom_early_alloc(unsigned long size); +#ifdef CONFIG_SPARC64 +extern void irq_trans_init(struct device_node *dp); +#endif + #endif /* __PROM_H */ diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index 1c7b9d7b7889..d745b9f44d2d 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -51,836 +51,6 @@ void * __init prom_early_alloc(unsigned long size) return ret; } -#ifdef CONFIG_PCI -/* PSYCHO interrupt mapping support. */ -#define PSYCHO_IMAP_A_SLOT0 0x0c00UL -#define PSYCHO_IMAP_B_SLOT0 0x0c20UL -static unsigned long psycho_pcislot_imap_offset(unsigned long ino) -{ - unsigned int bus = (ino & 0x10) >> 4; - unsigned int slot = (ino & 0x0c) >> 2; - - if (bus == 0) - return PSYCHO_IMAP_A_SLOT0 + (slot * 8); - else - return PSYCHO_IMAP_B_SLOT0 + (slot * 8); -} - -#define PSYCHO_OBIO_IMAP_BASE 0x1000UL - -#define PSYCHO_ONBOARD_IRQ_BASE 0x20 -#define psycho_onboard_imap_offset(__ino) \ - (PSYCHO_OBIO_IMAP_BASE + (((__ino) & 0x1f) << 3)) - -#define PSYCHO_ICLR_A_SLOT0 0x1400UL -#define PSYCHO_ICLR_SCSI 0x1800UL - -#define psycho_iclr_offset(ino) \ - ((ino & 0x20) ? (PSYCHO_ICLR_SCSI + (((ino) & 0x1f) << 3)) : \ - (PSYCHO_ICLR_A_SLOT0 + (((ino) & 0x1f)<<3))) - -static unsigned int psycho_irq_build(struct device_node *dp, - unsigned int ino, - void *_data) -{ - unsigned long controller_regs = (unsigned long) _data; - unsigned long imap, iclr; - unsigned long imap_off, iclr_off; - int inofixup = 0; - - ino &= 0x3f; - if (ino < PSYCHO_ONBOARD_IRQ_BASE) { - /* PCI slot */ - imap_off = psycho_pcislot_imap_offset(ino); - } else { - /* Onboard device */ - imap_off = psycho_onboard_imap_offset(ino); - } - - /* Now build the IRQ bucket. */ - imap = controller_regs + imap_off; - - iclr_off = psycho_iclr_offset(ino); - iclr = controller_regs + iclr_off; - - if ((ino & 0x20) == 0) - inofixup = ino & 0x03; - - return build_irq(inofixup, iclr, imap); -} - -static void __init psycho_irq_trans_init(struct device_node *dp) -{ - const struct linux_prom64_registers *regs; - - dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); - dp->irq_trans->irq_build = psycho_irq_build; - - regs = of_get_property(dp, "reg", NULL); - dp->irq_trans->data = (void *) regs[2].phys_addr; -} - -#define sabre_read(__reg) \ -({ u64 __ret; \ - __asm__ __volatile__("ldxa [%1] %2, %0" \ - : "=r" (__ret) \ - : "r" (__reg), "i" (ASI_PHYS_BYPASS_EC_E) \ - : "memory"); \ - __ret; \ -}) - -struct sabre_irq_data { - unsigned long controller_regs; - unsigned int pci_first_busno; -}; -#define SABRE_CONFIGSPACE 0x001000000UL -#define SABRE_WRSYNC 0x1c20UL - -#define SABRE_CONFIG_BASE(CONFIG_SPACE) \ - (CONFIG_SPACE | (1UL << 24)) -#define SABRE_CONFIG_ENCODE(BUS, DEVFN, REG) \ - (((unsigned long)(BUS) << 16) | \ - ((unsigned long)(DEVFN) << 8) | \ - ((unsigned long)(REG))) - -/* When a device lives behind a bridge deeper in the PCI bus topology - * than APB, a special sequence must run to make sure all pending DMA - * transfers at the time of IRQ delivery are visible in the coherency - * domain by the cpu. This sequence is to perform a read on the far - * side of the non-APB bridge, then perform a read of Sabre's DMA - * write-sync register. - */ -static void sabre_wsync_handler(unsigned int ino, void *_arg1, void *_arg2) -{ - unsigned int phys_hi = (unsigned int) (unsigned long) _arg1; - struct sabre_irq_data *irq_data = _arg2; - unsigned long controller_regs = irq_data->controller_regs; - unsigned long sync_reg = controller_regs + SABRE_WRSYNC; - unsigned long config_space = controller_regs + SABRE_CONFIGSPACE; - unsigned int bus, devfn; - u16 _unused; - - config_space = SABRE_CONFIG_BASE(config_space); - - bus = (phys_hi >> 16) & 0xff; - devfn = (phys_hi >> 8) & 0xff; - - config_space |= SABRE_CONFIG_ENCODE(bus, devfn, 0x00); - - __asm__ __volatile__("membar #Sync\n\t" - "lduha [%1] %2, %0\n\t" - "membar #Sync" - : "=r" (_unused) - : "r" ((u16 *) config_space), - "i" (ASI_PHYS_BYPASS_EC_E_L) - : "memory"); - - sabre_read(sync_reg); -} - -#define SABRE_IMAP_A_SLOT0 0x0c00UL -#define SABRE_IMAP_B_SLOT0 0x0c20UL -#define SABRE_ICLR_A_SLOT0 0x1400UL -#define SABRE_ICLR_B_SLOT0 0x1480UL -#define SABRE_ICLR_SCSI 0x1800UL -#define SABRE_ICLR_ETH 0x1808UL -#define SABRE_ICLR_BPP 0x1810UL -#define SABRE_ICLR_AU_REC 0x1818UL -#define SABRE_ICLR_AU_PLAY 0x1820UL -#define SABRE_ICLR_PFAIL 0x1828UL -#define SABRE_ICLR_KMS 0x1830UL -#define SABRE_ICLR_FLPY 0x1838UL -#define SABRE_ICLR_SHW 0x1840UL -#define SABRE_ICLR_KBD 0x1848UL -#define SABRE_ICLR_MS 0x1850UL -#define SABRE_ICLR_SER 0x1858UL -#define SABRE_ICLR_UE 0x1870UL -#define SABRE_ICLR_CE 0x1878UL -#define SABRE_ICLR_PCIERR 0x1880UL - -static unsigned long sabre_pcislot_imap_offset(unsigned long ino) -{ - unsigned int bus = (ino & 0x10) >> 4; - unsigned int slot = (ino & 0x0c) >> 2; - - if (bus == 0) - return SABRE_IMAP_A_SLOT0 + (slot * 8); - else - return SABRE_IMAP_B_SLOT0 + (slot * 8); -} - -#define SABRE_OBIO_IMAP_BASE 0x1000UL -#define SABRE_ONBOARD_IRQ_BASE 0x20 -#define sabre_onboard_imap_offset(__ino) \ - (SABRE_OBIO_IMAP_BASE + (((__ino) & 0x1f) << 3)) - -#define sabre_iclr_offset(ino) \ - ((ino & 0x20) ? (SABRE_ICLR_SCSI + (((ino) & 0x1f) << 3)) : \ - (SABRE_ICLR_A_SLOT0 + (((ino) & 0x1f)<<3))) - -static int sabre_device_needs_wsync(struct device_node *dp) -{ - struct device_node *parent = dp->parent; - const char *parent_model, *parent_compat; - - /* This traversal up towards the root is meant to - * handle two cases: - * - * 1) non-PCI bus sitting under PCI, such as 'ebus' - * 2) the PCI controller interrupts themselves, which - * will use the sabre_irq_build but do not need - * the DMA synchronization handling - */ - while (parent) { - if (!strcmp(parent->type, "pci")) - break; - parent = parent->parent; - } - - if (!parent) - return 0; - - parent_model = of_get_property(parent, - "model", NULL); - if (parent_model && - (!strcmp(parent_model, "SUNW,sabre") || - !strcmp(parent_model, "SUNW,simba"))) - return 0; - - parent_compat = of_get_property(parent, - "compatible", NULL); - if (parent_compat && - (!strcmp(parent_compat, "pci108e,a000") || - !strcmp(parent_compat, "pci108e,a001"))) - return 0; - - return 1; -} - -static unsigned int sabre_irq_build(struct device_node *dp, - unsigned int ino, - void *_data) -{ - struct sabre_irq_data *irq_data = _data; - unsigned long controller_regs = irq_data->controller_regs; - const struct linux_prom_pci_registers *regs; - unsigned long imap, iclr; - unsigned long imap_off, iclr_off; - int inofixup = 0; - int virt_irq; - - ino &= 0x3f; - if (ino < SABRE_ONBOARD_IRQ_BASE) { - /* PCI slot */ - imap_off = sabre_pcislot_imap_offset(ino); - } else { - /* onboard device */ - imap_off = sabre_onboard_imap_offset(ino); - } - - /* Now build the IRQ bucket. */ - imap = controller_regs + imap_off; - - iclr_off = sabre_iclr_offset(ino); - iclr = controller_regs + iclr_off; - - if ((ino & 0x20) == 0) - inofixup = ino & 0x03; - - virt_irq = build_irq(inofixup, iclr, imap); - - /* If the parent device is a PCI<->PCI bridge other than - * APB, we have to install a pre-handler to ensure that - * all pending DMA is drained before the interrupt handler - * is run. - */ - regs = of_get_property(dp, "reg", NULL); - if (regs && sabre_device_needs_wsync(dp)) { - irq_install_pre_handler(virt_irq, - sabre_wsync_handler, - (void *) (long) regs->phys_hi, - (void *) irq_data); - } - - return virt_irq; -} - -static void __init sabre_irq_trans_init(struct device_node *dp) -{ - const struct linux_prom64_registers *regs; - struct sabre_irq_data *irq_data; - const u32 *busrange; - - dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); - dp->irq_trans->irq_build = sabre_irq_build; - - irq_data = prom_early_alloc(sizeof(struct sabre_irq_data)); - - regs = of_get_property(dp, "reg", NULL); - irq_data->controller_regs = regs[0].phys_addr; - - busrange = of_get_property(dp, "bus-range", NULL); - irq_data->pci_first_busno = busrange[0]; - - dp->irq_trans->data = irq_data; -} - -/* SCHIZO interrupt mapping support. Unlike Psycho, for this controller the - * imap/iclr registers are per-PBM. - */ -#define SCHIZO_IMAP_BASE 0x1000UL -#define SCHIZO_ICLR_BASE 0x1400UL - -static unsigned long schizo_imap_offset(unsigned long ino) -{ - return SCHIZO_IMAP_BASE + (ino * 8UL); -} - -static unsigned long schizo_iclr_offset(unsigned long ino) -{ - return SCHIZO_ICLR_BASE + (ino * 8UL); -} - -static unsigned long schizo_ino_to_iclr(unsigned long pbm_regs, - unsigned int ino) -{ - - return pbm_regs + schizo_iclr_offset(ino); -} - -static unsigned long schizo_ino_to_imap(unsigned long pbm_regs, - unsigned int ino) -{ - return pbm_regs + schizo_imap_offset(ino); -} - -#define schizo_read(__reg) \ -({ u64 __ret; \ - __asm__ __volatile__("ldxa [%1] %2, %0" \ - : "=r" (__ret) \ - : "r" (__reg), "i" (ASI_PHYS_BYPASS_EC_E) \ - : "memory"); \ - __ret; \ -}) -#define schizo_write(__reg, __val) \ - __asm__ __volatile__("stxa %0, [%1] %2" \ - : /* no outputs */ \ - : "r" (__val), "r" (__reg), \ - "i" (ASI_PHYS_BYPASS_EC_E) \ - : "memory") - -static void tomatillo_wsync_handler(unsigned int ino, void *_arg1, void *_arg2) -{ - unsigned long sync_reg = (unsigned long) _arg2; - u64 mask = 1UL << (ino & IMAP_INO); - u64 val; - int limit; - - schizo_write(sync_reg, mask); - - limit = 100000; - val = 0; - while (--limit) { - val = schizo_read(sync_reg); - if (!(val & mask)) - break; - } - if (limit <= 0) { - printk("tomatillo_wsync_handler: DMA won't sync [%lx:%lx]\n", - val, mask); - } - - if (_arg1) { - static unsigned char cacheline[64] - __attribute__ ((aligned (64))); - - __asm__ __volatile__("rd %%fprs, %0\n\t" - "or %0, %4, %1\n\t" - "wr %1, 0x0, %%fprs\n\t" - "stda %%f0, [%5] %6\n\t" - "wr %0, 0x0, %%fprs\n\t" - "membar #Sync" - : "=&r" (mask), "=&r" (val) - : "0" (mask), "1" (val), - "i" (FPRS_FEF), "r" (&cacheline[0]), - "i" (ASI_BLK_COMMIT_P)); - } -} - -struct schizo_irq_data { - unsigned long pbm_regs; - unsigned long sync_reg; - u32 portid; - int chip_version; -}; - -static unsigned int schizo_irq_build(struct device_node *dp, - unsigned int ino, - void *_data) -{ - struct schizo_irq_data *irq_data = _data; - unsigned long pbm_regs = irq_data->pbm_regs; - unsigned long imap, iclr; - int ign_fixup; - int virt_irq; - int is_tomatillo; - - ino &= 0x3f; - - /* Now build the IRQ bucket. */ - imap = schizo_ino_to_imap(pbm_regs, ino); - iclr = schizo_ino_to_iclr(pbm_regs, ino); - - /* On Schizo, no inofixup occurs. This is because each - * INO has it's own IMAP register. On Psycho and Sabre - * there is only one IMAP register for each PCI slot even - * though four different INOs can be generated by each - * PCI slot. - * - * But, for JBUS variants (essentially, Tomatillo), we have - * to fixup the lowest bit of the interrupt group number. - */ - ign_fixup = 0; - - is_tomatillo = (irq_data->sync_reg != 0UL); - - if (is_tomatillo) { - if (irq_data->portid & 1) - ign_fixup = (1 << 6); - } - - virt_irq = build_irq(ign_fixup, iclr, imap); - - if (is_tomatillo) { - irq_install_pre_handler(virt_irq, - tomatillo_wsync_handler, - ((irq_data->chip_version <= 4) ? - (void *) 1 : (void *) 0), - (void *) irq_data->sync_reg); - } - - return virt_irq; -} - -static void __init __schizo_irq_trans_init(struct device_node *dp, - int is_tomatillo) -{ - const struct linux_prom64_registers *regs; - struct schizo_irq_data *irq_data; - - dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); - dp->irq_trans->irq_build = schizo_irq_build; - - irq_data = prom_early_alloc(sizeof(struct schizo_irq_data)); - - regs = of_get_property(dp, "reg", NULL); - dp->irq_trans->data = irq_data; - - irq_data->pbm_regs = regs[0].phys_addr; - if (is_tomatillo) - irq_data->sync_reg = regs[3].phys_addr + 0x1a18UL; - else - irq_data->sync_reg = 0UL; - irq_data->portid = of_getintprop_default(dp, "portid", 0); - irq_data->chip_version = of_getintprop_default(dp, "version#", 0); -} - -static void __init schizo_irq_trans_init(struct device_node *dp) -{ - __schizo_irq_trans_init(dp, 0); -} - -static void __init tomatillo_irq_trans_init(struct device_node *dp) -{ - __schizo_irq_trans_init(dp, 1); -} - -static unsigned int pci_sun4v_irq_build(struct device_node *dp, - unsigned int devino, - void *_data) -{ - u32 devhandle = (u32) (unsigned long) _data; - - return sun4v_build_irq(devhandle, devino); -} - -static void __init pci_sun4v_irq_trans_init(struct device_node *dp) -{ - const struct linux_prom64_registers *regs; - - dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); - dp->irq_trans->irq_build = pci_sun4v_irq_build; - - regs = of_get_property(dp, "reg", NULL); - dp->irq_trans->data = (void *) (unsigned long) - ((regs->phys_addr >> 32UL) & 0x0fffffff); -} - -struct fire_irq_data { - unsigned long pbm_regs; - u32 portid; -}; - -#define FIRE_IMAP_BASE 0x001000 -#define FIRE_ICLR_BASE 0x001400 - -static unsigned long fire_imap_offset(unsigned long ino) -{ - return FIRE_IMAP_BASE + (ino * 8UL); -} - -static unsigned long fire_iclr_offset(unsigned long ino) -{ - return FIRE_ICLR_BASE + (ino * 8UL); -} - -static unsigned long fire_ino_to_iclr(unsigned long pbm_regs, - unsigned int ino) -{ - return pbm_regs + fire_iclr_offset(ino); -} - -static unsigned long fire_ino_to_imap(unsigned long pbm_regs, - unsigned int ino) -{ - return pbm_regs + fire_imap_offset(ino); -} - -static unsigned int fire_irq_build(struct device_node *dp, - unsigned int ino, - void *_data) -{ - struct fire_irq_data *irq_data = _data; - unsigned long pbm_regs = irq_data->pbm_regs; - unsigned long imap, iclr; - unsigned long int_ctrlr; - - ino &= 0x3f; - - /* Now build the IRQ bucket. */ - imap = fire_ino_to_imap(pbm_regs, ino); - iclr = fire_ino_to_iclr(pbm_regs, ino); - - /* Set the interrupt controller number. */ - int_ctrlr = 1 << 6; - upa_writeq(int_ctrlr, imap); - - /* The interrupt map registers do not have an INO field - * like other chips do. They return zero in the INO - * field, and the interrupt controller number is controlled - * in bits 6 to 9. So in order for build_irq() to get - * the INO right we pass it in as part of the fixup - * which will get added to the map register zero value - * read by build_irq(). - */ - ino |= (irq_data->portid << 6); - ino -= int_ctrlr; - return build_irq(ino, iclr, imap); -} - -static void __init fire_irq_trans_init(struct device_node *dp) -{ - const struct linux_prom64_registers *regs; - struct fire_irq_data *irq_data; - - dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); - dp->irq_trans->irq_build = fire_irq_build; - - irq_data = prom_early_alloc(sizeof(struct fire_irq_data)); - - regs = of_get_property(dp, "reg", NULL); - dp->irq_trans->data = irq_data; - - irq_data->pbm_regs = regs[0].phys_addr; - irq_data->portid = of_getintprop_default(dp, "portid", 0); -} -#endif /* CONFIG_PCI */ - -#ifdef CONFIG_SBUS -/* INO number to IMAP register offset for SYSIO external IRQ's. - * This should conform to both Sunfire/Wildfire server and Fusion - * desktop designs. - */ -#define SYSIO_IMAP_SLOT0 0x2c00UL -#define SYSIO_IMAP_SLOT1 0x2c08UL -#define SYSIO_IMAP_SLOT2 0x2c10UL -#define SYSIO_IMAP_SLOT3 0x2c18UL -#define SYSIO_IMAP_SCSI 0x3000UL -#define SYSIO_IMAP_ETH 0x3008UL -#define SYSIO_IMAP_BPP 0x3010UL -#define SYSIO_IMAP_AUDIO 0x3018UL -#define SYSIO_IMAP_PFAIL 0x3020UL -#define SYSIO_IMAP_KMS 0x3028UL -#define SYSIO_IMAP_FLPY 0x3030UL -#define SYSIO_IMAP_SHW 0x3038UL -#define SYSIO_IMAP_KBD 0x3040UL -#define SYSIO_IMAP_MS 0x3048UL -#define SYSIO_IMAP_SER 0x3050UL -#define SYSIO_IMAP_TIM0 0x3060UL -#define SYSIO_IMAP_TIM1 0x3068UL -#define SYSIO_IMAP_UE 0x3070UL -#define SYSIO_IMAP_CE 0x3078UL -#define SYSIO_IMAP_SBERR 0x3080UL -#define SYSIO_IMAP_PMGMT 0x3088UL -#define SYSIO_IMAP_GFX 0x3090UL -#define SYSIO_IMAP_EUPA 0x3098UL - -#define bogon ((unsigned long) -1) -static unsigned long sysio_irq_offsets[] = { - /* SBUS Slot 0 --> 3, level 1 --> 7 */ - SYSIO_IMAP_SLOT0, SYSIO_IMAP_SLOT0, SYSIO_IMAP_SLOT0, SYSIO_IMAP_SLOT0, - SYSIO_IMAP_SLOT0, SYSIO_IMAP_SLOT0, SYSIO_IMAP_SLOT0, SYSIO_IMAP_SLOT0, - SYSIO_IMAP_SLOT1, SYSIO_IMAP_SLOT1, SYSIO_IMAP_SLOT1, SYSIO_IMAP_SLOT1, - SYSIO_IMAP_SLOT1, SYSIO_IMAP_SLOT1, SYSIO_IMAP_SLOT1, SYSIO_IMAP_SLOT1, - SYSIO_IMAP_SLOT2, SYSIO_IMAP_SLOT2, SYSIO_IMAP_SLOT2, SYSIO_IMAP_SLOT2, - SYSIO_IMAP_SLOT2, SYSIO_IMAP_SLOT2, SYSIO_IMAP_SLOT2, SYSIO_IMAP_SLOT2, - SYSIO_IMAP_SLOT3, SYSIO_IMAP_SLOT3, SYSIO_IMAP_SLOT3, SYSIO_IMAP_SLOT3, - SYSIO_IMAP_SLOT3, SYSIO_IMAP_SLOT3, SYSIO_IMAP_SLOT3, SYSIO_IMAP_SLOT3, - - /* Onboard devices (not relevant/used on SunFire). */ - SYSIO_IMAP_SCSI, - SYSIO_IMAP_ETH, - SYSIO_IMAP_BPP, - bogon, - SYSIO_IMAP_AUDIO, - SYSIO_IMAP_PFAIL, - bogon, - bogon, - SYSIO_IMAP_KMS, - SYSIO_IMAP_FLPY, - SYSIO_IMAP_SHW, - SYSIO_IMAP_KBD, - SYSIO_IMAP_MS, - SYSIO_IMAP_SER, - bogon, - bogon, - SYSIO_IMAP_TIM0, - SYSIO_IMAP_TIM1, - bogon, - bogon, - SYSIO_IMAP_UE, - SYSIO_IMAP_CE, - SYSIO_IMAP_SBERR, - SYSIO_IMAP_PMGMT, - SYSIO_IMAP_GFX, - SYSIO_IMAP_EUPA, -}; - -#undef bogon - -#define NUM_SYSIO_OFFSETS ARRAY_SIZE(sysio_irq_offsets) - -/* Convert Interrupt Mapping register pointer to associated - * Interrupt Clear register pointer, SYSIO specific version. - */ -#define SYSIO_ICLR_UNUSED0 0x3400UL -#define SYSIO_ICLR_SLOT0 0x3408UL -#define SYSIO_ICLR_SLOT1 0x3448UL -#define SYSIO_ICLR_SLOT2 0x3488UL -#define SYSIO_ICLR_SLOT3 0x34c8UL -static unsigned long sysio_imap_to_iclr(unsigned long imap) -{ - unsigned long diff = SYSIO_ICLR_UNUSED0 - SYSIO_IMAP_SLOT0; - return imap + diff; -} - -static unsigned int sbus_of_build_irq(struct device_node *dp, - unsigned int ino, - void *_data) -{ - unsigned long reg_base = (unsigned long) _data; - const struct linux_prom_registers *regs; - unsigned long imap, iclr; - int sbus_slot = 0; - int sbus_level = 0; - - ino &= 0x3f; - - regs = of_get_property(dp, "reg", NULL); - if (regs) - sbus_slot = regs->which_io; - - if (ino < 0x20) - ino += (sbus_slot * 8); - - imap = sysio_irq_offsets[ino]; - if (imap == ((unsigned long)-1)) { - prom_printf("get_irq_translations: Bad SYSIO INO[%x]\n", - ino); - prom_halt(); - } - imap += reg_base; - - /* SYSIO inconsistency. For external SLOTS, we have to select - * the right ICLR register based upon the lower SBUS irq level - * bits. - */ - if (ino >= 0x20) { - iclr = sysio_imap_to_iclr(imap); - } else { - sbus_level = ino & 0x7; - - switch(sbus_slot) { - case 0: - iclr = reg_base + SYSIO_ICLR_SLOT0; - break; - case 1: - iclr = reg_base + SYSIO_ICLR_SLOT1; - break; - case 2: - iclr = reg_base + SYSIO_ICLR_SLOT2; - break; - default: - case 3: - iclr = reg_base + SYSIO_ICLR_SLOT3; - break; - }; - - iclr += ((unsigned long)sbus_level - 1UL) * 8UL; - } - return build_irq(sbus_level, iclr, imap); -} - -static void __init sbus_irq_trans_init(struct device_node *dp) -{ - const struct linux_prom64_registers *regs; - - dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); - dp->irq_trans->irq_build = sbus_of_build_irq; - - regs = of_get_property(dp, "reg", NULL); - dp->irq_trans->data = (void *) (unsigned long) regs->phys_addr; -} -#endif /* CONFIG_SBUS */ - - -static unsigned int central_build_irq(struct device_node *dp, - unsigned int ino, - void *_data) -{ - struct device_node *central_dp = _data; - struct of_device *central_op = of_find_device_by_node(central_dp); - struct resource *res; - unsigned long imap, iclr; - u32 tmp; - - if (!strcmp(dp->name, "eeprom")) { - res = ¢ral_op->resource[5]; - } else if (!strcmp(dp->name, "zs")) { - res = ¢ral_op->resource[4]; - } else if (!strcmp(dp->name, "clock-board")) { - res = ¢ral_op->resource[3]; - } else { - return ino; - } - - imap = res->start + 0x00UL; - iclr = res->start + 0x10UL; - - /* Set the INO state to idle, and disable. */ - upa_writel(0, iclr); - upa_readl(iclr); - - tmp = upa_readl(imap); - tmp &= ~0x80000000; - upa_writel(tmp, imap); - - return build_irq(0, iclr, imap); -} - -static void __init central_irq_trans_init(struct device_node *dp) -{ - dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); - dp->irq_trans->irq_build = central_build_irq; - - dp->irq_trans->data = dp; -} - -struct irq_trans { - const char *name; - void (*init)(struct device_node *); -}; - -#ifdef CONFIG_PCI -static struct irq_trans __initdata pci_irq_trans_table[] = { - { "SUNW,sabre", sabre_irq_trans_init }, - { "pci108e,a000", sabre_irq_trans_init }, - { "pci108e,a001", sabre_irq_trans_init }, - { "SUNW,psycho", psycho_irq_trans_init }, - { "pci108e,8000", psycho_irq_trans_init }, - { "SUNW,schizo", schizo_irq_trans_init }, - { "pci108e,8001", schizo_irq_trans_init }, - { "SUNW,schizo+", schizo_irq_trans_init }, - { "pci108e,8002", schizo_irq_trans_init }, - { "SUNW,tomatillo", tomatillo_irq_trans_init }, - { "pci108e,a801", tomatillo_irq_trans_init }, - { "SUNW,sun4v-pci", pci_sun4v_irq_trans_init }, - { "pciex108e,80f0", fire_irq_trans_init }, -}; -#endif - -static unsigned int sun4v_vdev_irq_build(struct device_node *dp, - unsigned int devino, - void *_data) -{ - u32 devhandle = (u32) (unsigned long) _data; - - return sun4v_build_irq(devhandle, devino); -} - -static void __init sun4v_vdev_irq_trans_init(struct device_node *dp) -{ - const struct linux_prom64_registers *regs; - - dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); - dp->irq_trans->irq_build = sun4v_vdev_irq_build; - - regs = of_get_property(dp, "reg", NULL); - dp->irq_trans->data = (void *) (unsigned long) - ((regs->phys_addr >> 32UL) & 0x0fffffff); -} - -static void __init irq_trans_init(struct device_node *dp) -{ -#ifdef CONFIG_PCI - const char *model; - int i; -#endif - -#ifdef CONFIG_PCI - model = of_get_property(dp, "model", NULL); - if (!model) - model = of_get_property(dp, "compatible", NULL); - if (model) { - for (i = 0; i < ARRAY_SIZE(pci_irq_trans_table); i++) { - struct irq_trans *t = &pci_irq_trans_table[i]; - - if (!strcmp(model, t->name)) { - t->init(dp); - return; - } - } - } -#endif -#ifdef CONFIG_SBUS - if (!strcmp(dp->name, "sbus") || - !strcmp(dp->name, "sbi")) { - sbus_irq_trans_init(dp); - return; - } -#endif - if (!strcmp(dp->name, "fhc") && - !strcmp(dp->parent->name, "central")) { - central_irq_trans_init(dp); - return; - } - if (!strcmp(dp->name, "virtual-devices") || - !strcmp(dp->name, "niu")) { - sun4v_vdev_irq_trans_init(dp); - return; - } -} - static int is_root_node(const struct device_node *dp) { if (!dp) diff --git a/arch/sparc/kernel/prom_irqtrans.c b/arch/sparc/kernel/prom_irqtrans.c new file mode 100644 index 000000000000..96958c4dce8e --- /dev/null +++ b/arch/sparc/kernel/prom_irqtrans.c @@ -0,0 +1,842 @@ +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "prom.h" + +#ifdef CONFIG_PCI +/* PSYCHO interrupt mapping support. */ +#define PSYCHO_IMAP_A_SLOT0 0x0c00UL +#define PSYCHO_IMAP_B_SLOT0 0x0c20UL +static unsigned long psycho_pcislot_imap_offset(unsigned long ino) +{ + unsigned int bus = (ino & 0x10) >> 4; + unsigned int slot = (ino & 0x0c) >> 2; + + if (bus == 0) + return PSYCHO_IMAP_A_SLOT0 + (slot * 8); + else + return PSYCHO_IMAP_B_SLOT0 + (slot * 8); +} + +#define PSYCHO_OBIO_IMAP_BASE 0x1000UL + +#define PSYCHO_ONBOARD_IRQ_BASE 0x20 +#define psycho_onboard_imap_offset(__ino) \ + (PSYCHO_OBIO_IMAP_BASE + (((__ino) & 0x1f) << 3)) + +#define PSYCHO_ICLR_A_SLOT0 0x1400UL +#define PSYCHO_ICLR_SCSI 0x1800UL + +#define psycho_iclr_offset(ino) \ + ((ino & 0x20) ? (PSYCHO_ICLR_SCSI + (((ino) & 0x1f) << 3)) : \ + (PSYCHO_ICLR_A_SLOT0 + (((ino) & 0x1f)<<3))) + +static unsigned int psycho_irq_build(struct device_node *dp, + unsigned int ino, + void *_data) +{ + unsigned long controller_regs = (unsigned long) _data; + unsigned long imap, iclr; + unsigned long imap_off, iclr_off; + int inofixup = 0; + + ino &= 0x3f; + if (ino < PSYCHO_ONBOARD_IRQ_BASE) { + /* PCI slot */ + imap_off = psycho_pcislot_imap_offset(ino); + } else { + /* Onboard device */ + imap_off = psycho_onboard_imap_offset(ino); + } + + /* Now build the IRQ bucket. */ + imap = controller_regs + imap_off; + + iclr_off = psycho_iclr_offset(ino); + iclr = controller_regs + iclr_off; + + if ((ino & 0x20) == 0) + inofixup = ino & 0x03; + + return build_irq(inofixup, iclr, imap); +} + +static void __init psycho_irq_trans_init(struct device_node *dp) +{ + const struct linux_prom64_registers *regs; + + dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); + dp->irq_trans->irq_build = psycho_irq_build; + + regs = of_get_property(dp, "reg", NULL); + dp->irq_trans->data = (void *) regs[2].phys_addr; +} + +#define sabre_read(__reg) \ +({ u64 __ret; \ + __asm__ __volatile__("ldxa [%1] %2, %0" \ + : "=r" (__ret) \ + : "r" (__reg), "i" (ASI_PHYS_BYPASS_EC_E) \ + : "memory"); \ + __ret; \ +}) + +struct sabre_irq_data { + unsigned long controller_regs; + unsigned int pci_first_busno; +}; +#define SABRE_CONFIGSPACE 0x001000000UL +#define SABRE_WRSYNC 0x1c20UL + +#define SABRE_CONFIG_BASE(CONFIG_SPACE) \ + (CONFIG_SPACE | (1UL << 24)) +#define SABRE_CONFIG_ENCODE(BUS, DEVFN, REG) \ + (((unsigned long)(BUS) << 16) | \ + ((unsigned long)(DEVFN) << 8) | \ + ((unsigned long)(REG))) + +/* When a device lives behind a bridge deeper in the PCI bus topology + * than APB, a special sequence must run to make sure all pending DMA + * transfers at the time of IRQ delivery are visible in the coherency + * domain by the cpu. This sequence is to perform a read on the far + * side of the non-APB bridge, then perform a read of Sabre's DMA + * write-sync register. + */ +static void sabre_wsync_handler(unsigned int ino, void *_arg1, void *_arg2) +{ + unsigned int phys_hi = (unsigned int) (unsigned long) _arg1; + struct sabre_irq_data *irq_data = _arg2; + unsigned long controller_regs = irq_data->controller_regs; + unsigned long sync_reg = controller_regs + SABRE_WRSYNC; + unsigned long config_space = controller_regs + SABRE_CONFIGSPACE; + unsigned int bus, devfn; + u16 _unused; + + config_space = SABRE_CONFIG_BASE(config_space); + + bus = (phys_hi >> 16) & 0xff; + devfn = (phys_hi >> 8) & 0xff; + + config_space |= SABRE_CONFIG_ENCODE(bus, devfn, 0x00); + + __asm__ __volatile__("membar #Sync\n\t" + "lduha [%1] %2, %0\n\t" + "membar #Sync" + : "=r" (_unused) + : "r" ((u16 *) config_space), + "i" (ASI_PHYS_BYPASS_EC_E_L) + : "memory"); + + sabre_read(sync_reg); +} + +#define SABRE_IMAP_A_SLOT0 0x0c00UL +#define SABRE_IMAP_B_SLOT0 0x0c20UL +#define SABRE_ICLR_A_SLOT0 0x1400UL +#define SABRE_ICLR_B_SLOT0 0x1480UL +#define SABRE_ICLR_SCSI 0x1800UL +#define SABRE_ICLR_ETH 0x1808UL +#define SABRE_ICLR_BPP 0x1810UL +#define SABRE_ICLR_AU_REC 0x1818UL +#define SABRE_ICLR_AU_PLAY 0x1820UL +#define SABRE_ICLR_PFAIL 0x1828UL +#define SABRE_ICLR_KMS 0x1830UL +#define SABRE_ICLR_FLPY 0x1838UL +#define SABRE_ICLR_SHW 0x1840UL +#define SABRE_ICLR_KBD 0x1848UL +#define SABRE_ICLR_MS 0x1850UL +#define SABRE_ICLR_SER 0x1858UL +#define SABRE_ICLR_UE 0x1870UL +#define SABRE_ICLR_CE 0x1878UL +#define SABRE_ICLR_PCIERR 0x1880UL + +static unsigned long sabre_pcislot_imap_offset(unsigned long ino) +{ + unsigned int bus = (ino & 0x10) >> 4; + unsigned int slot = (ino & 0x0c) >> 2; + + if (bus == 0) + return SABRE_IMAP_A_SLOT0 + (slot * 8); + else + return SABRE_IMAP_B_SLOT0 + (slot * 8); +} + +#define SABRE_OBIO_IMAP_BASE 0x1000UL +#define SABRE_ONBOARD_IRQ_BASE 0x20 +#define sabre_onboard_imap_offset(__ino) \ + (SABRE_OBIO_IMAP_BASE + (((__ino) & 0x1f) << 3)) + +#define sabre_iclr_offset(ino) \ + ((ino & 0x20) ? (SABRE_ICLR_SCSI + (((ino) & 0x1f) << 3)) : \ + (SABRE_ICLR_A_SLOT0 + (((ino) & 0x1f)<<3))) + +static int sabre_device_needs_wsync(struct device_node *dp) +{ + struct device_node *parent = dp->parent; + const char *parent_model, *parent_compat; + + /* This traversal up towards the root is meant to + * handle two cases: + * + * 1) non-PCI bus sitting under PCI, such as 'ebus' + * 2) the PCI controller interrupts themselves, which + * will use the sabre_irq_build but do not need + * the DMA synchronization handling + */ + while (parent) { + if (!strcmp(parent->type, "pci")) + break; + parent = parent->parent; + } + + if (!parent) + return 0; + + parent_model = of_get_property(parent, + "model", NULL); + if (parent_model && + (!strcmp(parent_model, "SUNW,sabre") || + !strcmp(parent_model, "SUNW,simba"))) + return 0; + + parent_compat = of_get_property(parent, + "compatible", NULL); + if (parent_compat && + (!strcmp(parent_compat, "pci108e,a000") || + !strcmp(parent_compat, "pci108e,a001"))) + return 0; + + return 1; +} + +static unsigned int sabre_irq_build(struct device_node *dp, + unsigned int ino, + void *_data) +{ + struct sabre_irq_data *irq_data = _data; + unsigned long controller_regs = irq_data->controller_regs; + const struct linux_prom_pci_registers *regs; + unsigned long imap, iclr; + unsigned long imap_off, iclr_off; + int inofixup = 0; + int virt_irq; + + ino &= 0x3f; + if (ino < SABRE_ONBOARD_IRQ_BASE) { + /* PCI slot */ + imap_off = sabre_pcislot_imap_offset(ino); + } else { + /* onboard device */ + imap_off = sabre_onboard_imap_offset(ino); + } + + /* Now build the IRQ bucket. */ + imap = controller_regs + imap_off; + + iclr_off = sabre_iclr_offset(ino); + iclr = controller_regs + iclr_off; + + if ((ino & 0x20) == 0) + inofixup = ino & 0x03; + + virt_irq = build_irq(inofixup, iclr, imap); + + /* If the parent device is a PCI<->PCI bridge other than + * APB, we have to install a pre-handler to ensure that + * all pending DMA is drained before the interrupt handler + * is run. + */ + regs = of_get_property(dp, "reg", NULL); + if (regs && sabre_device_needs_wsync(dp)) { + irq_install_pre_handler(virt_irq, + sabre_wsync_handler, + (void *) (long) regs->phys_hi, + (void *) irq_data); + } + + return virt_irq; +} + +static void __init sabre_irq_trans_init(struct device_node *dp) +{ + const struct linux_prom64_registers *regs; + struct sabre_irq_data *irq_data; + const u32 *busrange; + + dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); + dp->irq_trans->irq_build = sabre_irq_build; + + irq_data = prom_early_alloc(sizeof(struct sabre_irq_data)); + + regs = of_get_property(dp, "reg", NULL); + irq_data->controller_regs = regs[0].phys_addr; + + busrange = of_get_property(dp, "bus-range", NULL); + irq_data->pci_first_busno = busrange[0]; + + dp->irq_trans->data = irq_data; +} + +/* SCHIZO interrupt mapping support. Unlike Psycho, for this controller the + * imap/iclr registers are per-PBM. + */ +#define SCHIZO_IMAP_BASE 0x1000UL +#define SCHIZO_ICLR_BASE 0x1400UL + +static unsigned long schizo_imap_offset(unsigned long ino) +{ + return SCHIZO_IMAP_BASE + (ino * 8UL); +} + +static unsigned long schizo_iclr_offset(unsigned long ino) +{ + return SCHIZO_ICLR_BASE + (ino * 8UL); +} + +static unsigned long schizo_ino_to_iclr(unsigned long pbm_regs, + unsigned int ino) +{ + + return pbm_regs + schizo_iclr_offset(ino); +} + +static unsigned long schizo_ino_to_imap(unsigned long pbm_regs, + unsigned int ino) +{ + return pbm_regs + schizo_imap_offset(ino); +} + +#define schizo_read(__reg) \ +({ u64 __ret; \ + __asm__ __volatile__("ldxa [%1] %2, %0" \ + : "=r" (__ret) \ + : "r" (__reg), "i" (ASI_PHYS_BYPASS_EC_E) \ + : "memory"); \ + __ret; \ +}) +#define schizo_write(__reg, __val) \ + __asm__ __volatile__("stxa %0, [%1] %2" \ + : /* no outputs */ \ + : "r" (__val), "r" (__reg), \ + "i" (ASI_PHYS_BYPASS_EC_E) \ + : "memory") + +static void tomatillo_wsync_handler(unsigned int ino, void *_arg1, void *_arg2) +{ + unsigned long sync_reg = (unsigned long) _arg2; + u64 mask = 1UL << (ino & IMAP_INO); + u64 val; + int limit; + + schizo_write(sync_reg, mask); + + limit = 100000; + val = 0; + while (--limit) { + val = schizo_read(sync_reg); + if (!(val & mask)) + break; + } + if (limit <= 0) { + printk("tomatillo_wsync_handler: DMA won't sync [%lx:%lx]\n", + val, mask); + } + + if (_arg1) { + static unsigned char cacheline[64] + __attribute__ ((aligned (64))); + + __asm__ __volatile__("rd %%fprs, %0\n\t" + "or %0, %4, %1\n\t" + "wr %1, 0x0, %%fprs\n\t" + "stda %%f0, [%5] %6\n\t" + "wr %0, 0x0, %%fprs\n\t" + "membar #Sync" + : "=&r" (mask), "=&r" (val) + : "0" (mask), "1" (val), + "i" (FPRS_FEF), "r" (&cacheline[0]), + "i" (ASI_BLK_COMMIT_P)); + } +} + +struct schizo_irq_data { + unsigned long pbm_regs; + unsigned long sync_reg; + u32 portid; + int chip_version; +}; + +static unsigned int schizo_irq_build(struct device_node *dp, + unsigned int ino, + void *_data) +{ + struct schizo_irq_data *irq_data = _data; + unsigned long pbm_regs = irq_data->pbm_regs; + unsigned long imap, iclr; + int ign_fixup; + int virt_irq; + int is_tomatillo; + + ino &= 0x3f; + + /* Now build the IRQ bucket. */ + imap = schizo_ino_to_imap(pbm_regs, ino); + iclr = schizo_ino_to_iclr(pbm_regs, ino); + + /* On Schizo, no inofixup occurs. This is because each + * INO has it's own IMAP register. On Psycho and Sabre + * there is only one IMAP register for each PCI slot even + * though four different INOs can be generated by each + * PCI slot. + * + * But, for JBUS variants (essentially, Tomatillo), we have + * to fixup the lowest bit of the interrupt group number. + */ + ign_fixup = 0; + + is_tomatillo = (irq_data->sync_reg != 0UL); + + if (is_tomatillo) { + if (irq_data->portid & 1) + ign_fixup = (1 << 6); + } + + virt_irq = build_irq(ign_fixup, iclr, imap); + + if (is_tomatillo) { + irq_install_pre_handler(virt_irq, + tomatillo_wsync_handler, + ((irq_data->chip_version <= 4) ? + (void *) 1 : (void *) 0), + (void *) irq_data->sync_reg); + } + + return virt_irq; +} + +static void __init __schizo_irq_trans_init(struct device_node *dp, + int is_tomatillo) +{ + const struct linux_prom64_registers *regs; + struct schizo_irq_data *irq_data; + + dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); + dp->irq_trans->irq_build = schizo_irq_build; + + irq_data = prom_early_alloc(sizeof(struct schizo_irq_data)); + + regs = of_get_property(dp, "reg", NULL); + dp->irq_trans->data = irq_data; + + irq_data->pbm_regs = regs[0].phys_addr; + if (is_tomatillo) + irq_data->sync_reg = regs[3].phys_addr + 0x1a18UL; + else + irq_data->sync_reg = 0UL; + irq_data->portid = of_getintprop_default(dp, "portid", 0); + irq_data->chip_version = of_getintprop_default(dp, "version#", 0); +} + +static void __init schizo_irq_trans_init(struct device_node *dp) +{ + __schizo_irq_trans_init(dp, 0); +} + +static void __init tomatillo_irq_trans_init(struct device_node *dp) +{ + __schizo_irq_trans_init(dp, 1); +} + +static unsigned int pci_sun4v_irq_build(struct device_node *dp, + unsigned int devino, + void *_data) +{ + u32 devhandle = (u32) (unsigned long) _data; + + return sun4v_build_irq(devhandle, devino); +} + +static void __init pci_sun4v_irq_trans_init(struct device_node *dp) +{ + const struct linux_prom64_registers *regs; + + dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); + dp->irq_trans->irq_build = pci_sun4v_irq_build; + + regs = of_get_property(dp, "reg", NULL); + dp->irq_trans->data = (void *) (unsigned long) + ((regs->phys_addr >> 32UL) & 0x0fffffff); +} + +struct fire_irq_data { + unsigned long pbm_regs; + u32 portid; +}; + +#define FIRE_IMAP_BASE 0x001000 +#define FIRE_ICLR_BASE 0x001400 + +static unsigned long fire_imap_offset(unsigned long ino) +{ + return FIRE_IMAP_BASE + (ino * 8UL); +} + +static unsigned long fire_iclr_offset(unsigned long ino) +{ + return FIRE_ICLR_BASE + (ino * 8UL); +} + +static unsigned long fire_ino_to_iclr(unsigned long pbm_regs, + unsigned int ino) +{ + return pbm_regs + fire_iclr_offset(ino); +} + +static unsigned long fire_ino_to_imap(unsigned long pbm_regs, + unsigned int ino) +{ + return pbm_regs + fire_imap_offset(ino); +} + +static unsigned int fire_irq_build(struct device_node *dp, + unsigned int ino, + void *_data) +{ + struct fire_irq_data *irq_data = _data; + unsigned long pbm_regs = irq_data->pbm_regs; + unsigned long imap, iclr; + unsigned long int_ctrlr; + + ino &= 0x3f; + + /* Now build the IRQ bucket. */ + imap = fire_ino_to_imap(pbm_regs, ino); + iclr = fire_ino_to_iclr(pbm_regs, ino); + + /* Set the interrupt controller number. */ + int_ctrlr = 1 << 6; + upa_writeq(int_ctrlr, imap); + + /* The interrupt map registers do not have an INO field + * like other chips do. They return zero in the INO + * field, and the interrupt controller number is controlled + * in bits 6 to 9. So in order for build_irq() to get + * the INO right we pass it in as part of the fixup + * which will get added to the map register zero value + * read by build_irq(). + */ + ino |= (irq_data->portid << 6); + ino -= int_ctrlr; + return build_irq(ino, iclr, imap); +} + +static void __init fire_irq_trans_init(struct device_node *dp) +{ + const struct linux_prom64_registers *regs; + struct fire_irq_data *irq_data; + + dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); + dp->irq_trans->irq_build = fire_irq_build; + + irq_data = prom_early_alloc(sizeof(struct fire_irq_data)); + + regs = of_get_property(dp, "reg", NULL); + dp->irq_trans->data = irq_data; + + irq_data->pbm_regs = regs[0].phys_addr; + irq_data->portid = of_getintprop_default(dp, "portid", 0); +} +#endif /* CONFIG_PCI */ + +#ifdef CONFIG_SBUS +/* INO number to IMAP register offset for SYSIO external IRQ's. + * This should conform to both Sunfire/Wildfire server and Fusion + * desktop designs. + */ +#define SYSIO_IMAP_SLOT0 0x2c00UL +#define SYSIO_IMAP_SLOT1 0x2c08UL +#define SYSIO_IMAP_SLOT2 0x2c10UL +#define SYSIO_IMAP_SLOT3 0x2c18UL +#define SYSIO_IMAP_SCSI 0x3000UL +#define SYSIO_IMAP_ETH 0x3008UL +#define SYSIO_IMAP_BPP 0x3010UL +#define SYSIO_IMAP_AUDIO 0x3018UL +#define SYSIO_IMAP_PFAIL 0x3020UL +#define SYSIO_IMAP_KMS 0x3028UL +#define SYSIO_IMAP_FLPY 0x3030UL +#define SYSIO_IMAP_SHW 0x3038UL +#define SYSIO_IMAP_KBD 0x3040UL +#define SYSIO_IMAP_MS 0x3048UL +#define SYSIO_IMAP_SER 0x3050UL +#define SYSIO_IMAP_TIM0 0x3060UL +#define SYSIO_IMAP_TIM1 0x3068UL +#define SYSIO_IMAP_UE 0x3070UL +#define SYSIO_IMAP_CE 0x3078UL +#define SYSIO_IMAP_SBERR 0x3080UL +#define SYSIO_IMAP_PMGMT 0x3088UL +#define SYSIO_IMAP_GFX 0x3090UL +#define SYSIO_IMAP_EUPA 0x3098UL + +#define bogon ((unsigned long) -1) +static unsigned long sysio_irq_offsets[] = { + /* SBUS Slot 0 --> 3, level 1 --> 7 */ + SYSIO_IMAP_SLOT0, SYSIO_IMAP_SLOT0, SYSIO_IMAP_SLOT0, SYSIO_IMAP_SLOT0, + SYSIO_IMAP_SLOT0, SYSIO_IMAP_SLOT0, SYSIO_IMAP_SLOT0, SYSIO_IMAP_SLOT0, + SYSIO_IMAP_SLOT1, SYSIO_IMAP_SLOT1, SYSIO_IMAP_SLOT1, SYSIO_IMAP_SLOT1, + SYSIO_IMAP_SLOT1, SYSIO_IMAP_SLOT1, SYSIO_IMAP_SLOT1, SYSIO_IMAP_SLOT1, + SYSIO_IMAP_SLOT2, SYSIO_IMAP_SLOT2, SYSIO_IMAP_SLOT2, SYSIO_IMAP_SLOT2, + SYSIO_IMAP_SLOT2, SYSIO_IMAP_SLOT2, SYSIO_IMAP_SLOT2, SYSIO_IMAP_SLOT2, + SYSIO_IMAP_SLOT3, SYSIO_IMAP_SLOT3, SYSIO_IMAP_SLOT3, SYSIO_IMAP_SLOT3, + SYSIO_IMAP_SLOT3, SYSIO_IMAP_SLOT3, SYSIO_IMAP_SLOT3, SYSIO_IMAP_SLOT3, + + /* Onboard devices (not relevant/used on SunFire). */ + SYSIO_IMAP_SCSI, + SYSIO_IMAP_ETH, + SYSIO_IMAP_BPP, + bogon, + SYSIO_IMAP_AUDIO, + SYSIO_IMAP_PFAIL, + bogon, + bogon, + SYSIO_IMAP_KMS, + SYSIO_IMAP_FLPY, + SYSIO_IMAP_SHW, + SYSIO_IMAP_KBD, + SYSIO_IMAP_MS, + SYSIO_IMAP_SER, + bogon, + bogon, + SYSIO_IMAP_TIM0, + SYSIO_IMAP_TIM1, + bogon, + bogon, + SYSIO_IMAP_UE, + SYSIO_IMAP_CE, + SYSIO_IMAP_SBERR, + SYSIO_IMAP_PMGMT, + SYSIO_IMAP_GFX, + SYSIO_IMAP_EUPA, +}; + +#undef bogon + +#define NUM_SYSIO_OFFSETS ARRAY_SIZE(sysio_irq_offsets) + +/* Convert Interrupt Mapping register pointer to associated + * Interrupt Clear register pointer, SYSIO specific version. + */ +#define SYSIO_ICLR_UNUSED0 0x3400UL +#define SYSIO_ICLR_SLOT0 0x3408UL +#define SYSIO_ICLR_SLOT1 0x3448UL +#define SYSIO_ICLR_SLOT2 0x3488UL +#define SYSIO_ICLR_SLOT3 0x34c8UL +static unsigned long sysio_imap_to_iclr(unsigned long imap) +{ + unsigned long diff = SYSIO_ICLR_UNUSED0 - SYSIO_IMAP_SLOT0; + return imap + diff; +} + +static unsigned int sbus_of_build_irq(struct device_node *dp, + unsigned int ino, + void *_data) +{ + unsigned long reg_base = (unsigned long) _data; + const struct linux_prom_registers *regs; + unsigned long imap, iclr; + int sbus_slot = 0; + int sbus_level = 0; + + ino &= 0x3f; + + regs = of_get_property(dp, "reg", NULL); + if (regs) + sbus_slot = regs->which_io; + + if (ino < 0x20) + ino += (sbus_slot * 8); + + imap = sysio_irq_offsets[ino]; + if (imap == ((unsigned long)-1)) { + prom_printf("get_irq_translations: Bad SYSIO INO[%x]\n", + ino); + prom_halt(); + } + imap += reg_base; + + /* SYSIO inconsistency. For external SLOTS, we have to select + * the right ICLR register based upon the lower SBUS irq level + * bits. + */ + if (ino >= 0x20) { + iclr = sysio_imap_to_iclr(imap); + } else { + sbus_level = ino & 0x7; + + switch(sbus_slot) { + case 0: + iclr = reg_base + SYSIO_ICLR_SLOT0; + break; + case 1: + iclr = reg_base + SYSIO_ICLR_SLOT1; + break; + case 2: + iclr = reg_base + SYSIO_ICLR_SLOT2; + break; + default: + case 3: + iclr = reg_base + SYSIO_ICLR_SLOT3; + break; + }; + + iclr += ((unsigned long)sbus_level - 1UL) * 8UL; + } + return build_irq(sbus_level, iclr, imap); +} + +static void __init sbus_irq_trans_init(struct device_node *dp) +{ + const struct linux_prom64_registers *regs; + + dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); + dp->irq_trans->irq_build = sbus_of_build_irq; + + regs = of_get_property(dp, "reg", NULL); + dp->irq_trans->data = (void *) (unsigned long) regs->phys_addr; +} +#endif /* CONFIG_SBUS */ + + +static unsigned int central_build_irq(struct device_node *dp, + unsigned int ino, + void *_data) +{ + struct device_node *central_dp = _data; + struct of_device *central_op = of_find_device_by_node(central_dp); + struct resource *res; + unsigned long imap, iclr; + u32 tmp; + + if (!strcmp(dp->name, "eeprom")) { + res = ¢ral_op->resource[5]; + } else if (!strcmp(dp->name, "zs")) { + res = ¢ral_op->resource[4]; + } else if (!strcmp(dp->name, "clock-board")) { + res = ¢ral_op->resource[3]; + } else { + return ino; + } + + imap = res->start + 0x00UL; + iclr = res->start + 0x10UL; + + /* Set the INO state to idle, and disable. */ + upa_writel(0, iclr); + upa_readl(iclr); + + tmp = upa_readl(imap); + tmp &= ~0x80000000; + upa_writel(tmp, imap); + + return build_irq(0, iclr, imap); +} + +static void __init central_irq_trans_init(struct device_node *dp) +{ + dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); + dp->irq_trans->irq_build = central_build_irq; + + dp->irq_trans->data = dp; +} + +struct irq_trans { + const char *name; + void (*init)(struct device_node *); +}; + +#ifdef CONFIG_PCI +static struct irq_trans __initdata pci_irq_trans_table[] = { + { "SUNW,sabre", sabre_irq_trans_init }, + { "pci108e,a000", sabre_irq_trans_init }, + { "pci108e,a001", sabre_irq_trans_init }, + { "SUNW,psycho", psycho_irq_trans_init }, + { "pci108e,8000", psycho_irq_trans_init }, + { "SUNW,schizo", schizo_irq_trans_init }, + { "pci108e,8001", schizo_irq_trans_init }, + { "SUNW,schizo+", schizo_irq_trans_init }, + { "pci108e,8002", schizo_irq_trans_init }, + { "SUNW,tomatillo", tomatillo_irq_trans_init }, + { "pci108e,a801", tomatillo_irq_trans_init }, + { "SUNW,sun4v-pci", pci_sun4v_irq_trans_init }, + { "pciex108e,80f0", fire_irq_trans_init }, +}; +#endif + +static unsigned int sun4v_vdev_irq_build(struct device_node *dp, + unsigned int devino, + void *_data) +{ + u32 devhandle = (u32) (unsigned long) _data; + + return sun4v_build_irq(devhandle, devino); +} + +static void __init sun4v_vdev_irq_trans_init(struct device_node *dp) +{ + const struct linux_prom64_registers *regs; + + dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller)); + dp->irq_trans->irq_build = sun4v_vdev_irq_build; + + regs = of_get_property(dp, "reg", NULL); + dp->irq_trans->data = (void *) (unsigned long) + ((regs->phys_addr >> 32UL) & 0x0fffffff); +} + +void __init irq_trans_init(struct device_node *dp) +{ +#ifdef CONFIG_PCI + const char *model; + int i; +#endif + +#ifdef CONFIG_PCI + model = of_get_property(dp, "model", NULL); + if (!model) + model = of_get_property(dp, "compatible", NULL); + if (model) { + for (i = 0; i < ARRAY_SIZE(pci_irq_trans_table); i++) { + struct irq_trans *t = &pci_irq_trans_table[i]; + + if (!strcmp(model, t->name)) { + t->init(dp); + return; + } + } + } +#endif +#ifdef CONFIG_SBUS + if (!strcmp(dp->name, "sbus") || + !strcmp(dp->name, "sbi")) { + sbus_irq_trans_init(dp); + return; + } +#endif + if (!strcmp(dp->name, "fhc") && + !strcmp(dp->parent->name, "central")) { + central_irq_trans_init(dp); + return; + } + if (!strcmp(dp->name, "virtual-devices") || + !strcmp(dp->name, "niu")) { + sun4v_vdev_irq_trans_init(dp); + return; + } +} From e5ff0fe31d69e716f2599bcfb297ca3757e957c5 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 5 Dec 2008 00:50:22 -0800 Subject: [PATCH 56/98] sparc: Move 'unique_id' into prom_common.c and rename to 'prom_unique_id' This will be used in a subsequent changeset. Signed-off-by: David S. Miller --- arch/sparc/kernel/prom.h | 2 ++ arch/sparc/kernel/prom_32.c | 6 ++---- arch/sparc/kernel/prom_64.c | 6 ++---- arch/sparc/kernel/prom_common.c | 1 + 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h index 49925101f8f8..2575cdbbed6f 100644 --- a/arch/sparc/kernel/prom.h +++ b/arch/sparc/kernel/prom.h @@ -13,4 +13,6 @@ extern void * prom_early_alloc(unsigned long size); extern void irq_trans_init(struct device_node *dp); #endif +extern unsigned int prom_unique_id; + #endif /* __PROM_H */ diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index ba3c55186823..c34888a21b2d 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -196,8 +196,6 @@ static char * __init build_full_name(struct device_node *dp) return n; } -static unsigned int unique_id; - static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len) { static struct property *tmp = NULL; @@ -211,7 +209,7 @@ static struct property * __init build_one_prop(phandle node, char *prev, char *s tmp = NULL; } else { p = prom_early_alloc(sizeof(struct property) + 32); - p->unique_id = unique_id++; + p->unique_id = prom_unique_id++; } p->name = (char *) (p + 1); @@ -286,7 +284,7 @@ static struct device_node * __init create_node(phandle node) return NULL; dp = prom_early_alloc(sizeof(*dp)); - dp->unique_id = unique_id++; + dp->unique_id = prom_unique_id++; kref_init(&dp->kref); diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index d745b9f44d2d..61cc967b149d 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -399,8 +399,6 @@ static char * __init build_full_name(struct device_node *dp) return n; } -static unsigned int unique_id; - static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len) { static struct property *tmp = NULL; @@ -412,7 +410,7 @@ static struct property * __init build_one_prop(phandle node, char *prev, char *s tmp = NULL; } else { p = prom_early_alloc(sizeof(struct property) + 32); - p->unique_id = unique_id++; + p->unique_id = prom_unique_id++; } p->name = (char *) (p + 1); @@ -483,7 +481,7 @@ static struct device_node * __init create_node(phandle node, struct device_node return NULL; dp = prom_early_alloc(sizeof(*dp)); - dp->unique_id = unique_id++; + dp->unique_id = prom_unique_id++; dp->parent = parent; kref_init(&dp->kref); diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index ded8c628811f..a23180801014 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c @@ -119,3 +119,4 @@ int of_find_in_proplist(const char *list, const char *match, int len) } EXPORT_SYMBOL(of_find_in_proplist); +unsigned int prom_unique_id; From b9e5567cda6387e0f4061bfceebbc1bd63ee42a6 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 5 Dec 2008 01:00:46 -0800 Subject: [PATCH 57/98] sparc: Move property building code into prom_common.c Unfortunately there is some sparc32/sparc64 ifdef'ery in here due to the difference in how the prom_firstprop() and prom_nextprop() routines work. This will be eliminated eventually. Signed-off-by: David S. Miller --- arch/sparc/kernel/prom.h | 2 + arch/sparc/kernel/prom_32.c | 66 --------------------------- arch/sparc/kernel/prom_64.c | 60 ------------------------ arch/sparc/kernel/prom_common.c | 81 +++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 126 deletions(-) diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h index 2575cdbbed6f..49c25bdaeff3 100644 --- a/arch/sparc/kernel/prom.h +++ b/arch/sparc/kernel/prom.h @@ -15,4 +15,6 @@ extern void irq_trans_init(struct device_node *dp); extern unsigned int prom_unique_id; +extern struct property * __init build_prop_list(phandle node); + #endif /* __PROM_H */ diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index c34888a21b2d..a9859d2b2565 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -196,72 +196,6 @@ static char * __init build_full_name(struct device_node *dp) return n; } -static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len) -{ - static struct property *tmp = NULL; - struct property *p; - int len; - const char *name; - - if (tmp) { - p = tmp; - memset(p, 0, sizeof(*p) + 32); - tmp = NULL; - } else { - p = prom_early_alloc(sizeof(struct property) + 32); - p->unique_id = prom_unique_id++; - } - - p->name = (char *) (p + 1); - if (special_name) { - strcpy(p->name, special_name); - p->length = special_len; - p->value = prom_early_alloc(special_len); - memcpy(p->value, special_val, special_len); - } else { - if (prev == NULL) { - name = prom_firstprop(node, NULL); - } else { - name = prom_nextprop(node, prev, NULL); - } - if (strlen(name) == 0) { - tmp = p; - return NULL; - } - strcpy(p->name, name); - p->length = prom_getproplen(node, p->name); - if (p->length <= 0) { - p->length = 0; - } else { - p->value = prom_early_alloc(p->length + 1); - len = prom_getproperty(node, p->name, p->value, - p->length); - if (len <= 0) - p->length = 0; - ((unsigned char *)p->value)[p->length] = '\0'; - } - } - return p; -} - -static struct property * __init build_prop_list(phandle node) -{ - struct property *head, *tail; - - head = tail = build_one_prop(node, NULL, - ".node", &node, sizeof(node)); - - tail->next = build_one_prop(node, NULL, NULL, NULL, 0); - tail = tail->next; - while(tail) { - tail->next = build_one_prop(node, tail->name, - NULL, NULL, 0); - tail = tail->next; - } - - return head; -} - static char * __init get_one_property(phandle node, char *name) { char *buf = ""; diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index 61cc967b149d..e3969db4d58b 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -399,66 +399,6 @@ static char * __init build_full_name(struct device_node *dp) return n; } -static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len) -{ - static struct property *tmp = NULL; - struct property *p; - - if (tmp) { - p = tmp; - memset(p, 0, sizeof(*p) + 32); - tmp = NULL; - } else { - p = prom_early_alloc(sizeof(struct property) + 32); - p->unique_id = prom_unique_id++; - } - - p->name = (char *) (p + 1); - if (special_name) { - strcpy(p->name, special_name); - p->length = special_len; - p->value = prom_early_alloc(special_len); - memcpy(p->value, special_val, special_len); - } else { - if (prev == NULL) { - prom_firstprop(node, p->name); - } else { - prom_nextprop(node, prev, p->name); - } - if (strlen(p->name) == 0) { - tmp = p; - return NULL; - } - p->length = prom_getproplen(node, p->name); - if (p->length <= 0) { - p->length = 0; - } else { - p->value = prom_early_alloc(p->length + 1); - prom_getproperty(node, p->name, p->value, p->length); - ((unsigned char *)p->value)[p->length] = '\0'; - } - } - return p; -} - -static struct property * __init build_prop_list(phandle node) -{ - struct property *head, *tail; - - head = tail = build_one_prop(node, NULL, - ".node", &node, sizeof(node)); - - tail->next = build_one_prop(node, NULL, NULL, NULL, 0); - tail = tail->next; - while(tail) { - tail->next = build_one_prop(node, tail->name, - NULL, NULL, 0); - tail = tail->next; - } - - return head; -} - static char * __init get_one_property(phandle node, const char *name) { char *buf = ""; diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index a23180801014..762056762b72 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c @@ -120,3 +120,84 @@ int of_find_in_proplist(const char *list, const char *match, int len) EXPORT_SYMBOL(of_find_in_proplist); unsigned int prom_unique_id; + +static struct property * __init build_one_prop(phandle node, char *prev, + char *special_name, + void *special_val, + int special_len) +{ + static struct property *tmp = NULL; + struct property *p; + const char *name; + + if (tmp) { + p = tmp; + memset(p, 0, sizeof(*p) + 32); + tmp = NULL; + } else { + p = prom_early_alloc(sizeof(struct property) + 32); + p->unique_id = prom_unique_id++; + } + + p->name = (char *) (p + 1); + if (special_name) { + strcpy(p->name, special_name); + p->length = special_len; + p->value = prom_early_alloc(special_len); + memcpy(p->value, special_val, special_len); + } else { +#ifdef CONFIG_SPARC32 + if (prev == NULL) { + name = prom_firstprop(node, NULL); + } else { + name = prom_nextprop(node, prev, NULL); + } +#else + if (prev == NULL) { + prom_firstprop(node, p->name); + } else { + prom_nextprop(node, prev, p->name); + } + name = p->name; +#endif + if (strlen(name) == 0) { + tmp = p; + return NULL; + } +#ifdef CONFIG_SPARC32 + strcpy(p->name, name); +#endif + p->length = prom_getproplen(node, p->name); + if (p->length <= 0) { + p->length = 0; + } else { + int len; + + p->value = prom_early_alloc(p->length + 1); + len = prom_getproperty(node, p->name, p->value, + p->length); + if (len <= 0) + p->length = 0; + ((unsigned char *)p->value)[p->length] = '\0'; + } + } + return p; +} + +struct property * __init build_prop_list(phandle node) +{ + struct property *head, *tail; + + head = tail = build_one_prop(node, NULL, + ".node", &node, sizeof(node)); + + tail->next = build_one_prop(node, NULL, NULL, NULL, 0); + tail = tail->next; + while(tail) { + tail->next = build_one_prop(node, tail->name, + NULL, NULL, 0); + tail = tail->next; + } + + return head; +} From 59966e3b4e9e6573b352301ad0ceed15196d4e2d Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 5 Dec 2008 17:06:47 -0800 Subject: [PATCH 58/98] sparc: Commonize get_one_property() implementations. Add final len assignment in sparc64's get_one_property() (it's necessary to avoid unchecked return value warnings on the sparc32 side), and mark name argument const on sparc32's copy. Signed-off-by: David S. Miller --- arch/sparc/kernel/prom_32.c | 2 +- arch/sparc/kernel/prom_64.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index a9859d2b2565..a6809bc9ab9d 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -196,7 +196,7 @@ static char * __init build_full_name(struct device_node *dp) return n; } -static char * __init get_one_property(phandle node, char *name) +static char * __init get_one_property(phandle node, const char *name) { char *buf = ""; int len; diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index e3969db4d58b..ce96c1cf6c3a 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -407,7 +407,7 @@ static char * __init get_one_property(phandle node, const char *name) len = prom_getproplen(node, name); if (len > 0) { buf = prom_early_alloc(len); - prom_getproperty(node, name, buf, len); + len = prom_getproperty(node, name, buf, len); } return buf; From 06c0db7221de09cdf1d5dd2ce2780cc3361ad9f9 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 5 Dec 2008 01:06:52 -0800 Subject: [PATCH 59/98] sparc: Make sparc32's create_node() assign parent pointer. This makes it match what sparc64's version does. Signed-off-by: David S. Miller --- arch/sparc/kernel/prom_32.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index a6809bc9ab9d..5818aa9e85a0 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -210,7 +210,7 @@ static char * __init get_one_property(phandle node, const char *name) return buf; } -static struct device_node * __init create_node(phandle node) +static struct device_node * __init create_node(phandle node, struct device_node *parent) { struct device_node *dp; @@ -219,6 +219,7 @@ static struct device_node * __init create_node(phandle node) dp = prom_early_alloc(sizeof(*dp)); dp->unique_id = prom_unique_id++; + dp->parent = parent; kref_init(&dp->kref); @@ -237,7 +238,7 @@ static struct device_node * __init build_tree(struct device_node *parent, phandl { struct device_node *dp; - dp = create_node(node); + dp = create_node(node, parent); if (dp) { *(*nextp) = dp; *nextp = &dp->allnext; @@ -387,7 +388,7 @@ void __init prom_build_devicetree(void) { struct device_node **nextp; - allnodes = create_node(prom_root_node); + allnodes = create_node(prom_root_node, NULL); allnodes->path_component_name = ""; allnodes->full_name = "/"; From 7d9439d50b6dadcfdf6d28be2234461709719e14 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 5 Dec 2008 01:10:18 -0800 Subject: [PATCH 60/98] sparc: Move create_node() and friends into prom_common.c Signed-off-by: David S. Miller --- arch/sparc/kernel/prom.h | 3 ++- arch/sparc/kernel/prom_32.c | 38 ------------------------------ arch/sparc/kernel/prom_64.c | 38 ------------------------------ arch/sparc/kernel/prom_common.c | 41 ++++++++++++++++++++++++++++++++- 4 files changed, 42 insertions(+), 78 deletions(-) diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h index 49c25bdaeff3..d14b4ae4fc57 100644 --- a/arch/sparc/kernel/prom.h +++ b/arch/sparc/kernel/prom.h @@ -15,6 +15,7 @@ extern void irq_trans_init(struct device_node *dp); extern unsigned int prom_unique_id; -extern struct property * __init build_prop_list(phandle node); +extern struct device_node * __init create_node(phandle node, + struct device_node *parent); #endif /* __PROM_H */ diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index 5818aa9e85a0..5881c1438198 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -196,44 +196,6 @@ static char * __init build_full_name(struct device_node *dp) return n; } -static char * __init get_one_property(phandle node, const char *name) -{ - char *buf = ""; - int len; - - len = prom_getproplen(node, name); - if (len > 0) { - buf = prom_early_alloc(len); - len = prom_getproperty(node, name, buf, len); - } - - return buf; -} - -static struct device_node * __init create_node(phandle node, struct device_node *parent) -{ - struct device_node *dp; - - if (!node) - return NULL; - - dp = prom_early_alloc(sizeof(*dp)); - dp->unique_id = prom_unique_id++; - dp->parent = parent; - - kref_init(&dp->kref); - - dp->name = get_one_property(node, "name"); - dp->type = get_one_property(node, "device_type"); - dp->node = node; - - /* Build interrupts later... */ - - dp->properties = build_prop_list(node); - - return dp; -} - static struct device_node * __init build_tree(struct device_node *parent, phandle node, struct device_node ***nextp) { struct device_node *dp; diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index ce96c1cf6c3a..c1ce987b8429 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -399,44 +399,6 @@ static char * __init build_full_name(struct device_node *dp) return n; } -static char * __init get_one_property(phandle node, const char *name) -{ - char *buf = ""; - int len; - - len = prom_getproplen(node, name); - if (len > 0) { - buf = prom_early_alloc(len); - len = prom_getproperty(node, name, buf, len); - } - - return buf; -} - -static struct device_node * __init create_node(phandle node, struct device_node *parent) -{ - struct device_node *dp; - - if (!node) - return NULL; - - dp = prom_early_alloc(sizeof(*dp)); - dp->unique_id = prom_unique_id++; - dp->parent = parent; - - kref_init(&dp->kref); - - dp->name = get_one_property(node, "name"); - dp->type = get_one_property(node, "device_type"); - dp->node = node; - - dp->properties = build_prop_list(node); - - irq_trans_init(dp); - - return dp; -} - static struct device_node * __init build_tree(struct device_node *parent, phandle node, struct device_node ***nextp) { struct device_node *ret = NULL, *prev_sibling = NULL; diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index 762056762b72..d3eddc76763d 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c @@ -184,7 +184,7 @@ static struct property * __init build_one_prop(phandle node, char *prev, return p; } -struct property * __init build_prop_list(phandle node) +static struct property * __init build_prop_list(phandle node) { struct property *head, *tail; @@ -201,3 +201,42 @@ struct property * __init build_prop_list(phandle node) return head; } + +static char * __init get_one_property(phandle node, const char *name) +{ + char *buf = ""; + int len; + + len = prom_getproplen(node, name); + if (len > 0) { + buf = prom_early_alloc(len); + len = prom_getproperty(node, name, buf, len); + } + + return buf; +} + +struct device_node * __init create_node(phandle node, + struct device_node *parent) +{ + struct device_node *dp; + + if (!node) + return NULL; + + dp = prom_early_alloc(sizeof(*dp)); + dp->unique_id = prom_unique_id++; + dp->parent = parent; + + kref_init(&dp->kref); + + dp->name = get_one_property(node, "name"); + dp->type = get_one_property(node, "device_type"); + dp->node = node; + + /* Build interrupts later... */ + + dp->properties = build_prop_list(node); + + return dp; +} From 4aef8c53fe517542d8185b7d771f291865b49177 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 5 Dec 2008 01:12:32 -0800 Subject: [PATCH 61/98] sparc: Match sparc32's build_tree() up to sparc64's Sparc64 uses a non-recursive sibling traversal algorithm that never got propagated into the sparc32 copy of this code. Sync them up. Signed-off-by: David S. Miller --- arch/sparc/kernel/prom_32.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index 5881c1438198..35cb4c742524 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -198,23 +198,33 @@ static char * __init build_full_name(struct device_node *dp) static struct device_node * __init build_tree(struct device_node *parent, phandle node, struct device_node ***nextp) { + struct device_node *ret = NULL, *prev_sibling = NULL; struct device_node *dp; - dp = create_node(node, parent); - if (dp) { + while (1) { + dp = create_node(node, parent); + if (!dp) + break; + + if (prev_sibling) + prev_sibling->sibling = dp; + + if (!ret) + ret = dp; + prev_sibling = dp; + *(*nextp) = dp; *nextp = &dp->allnext; - dp->parent = parent; dp->path_component_name = build_path_component(dp); dp->full_name = build_full_name(dp); dp->child = build_tree(dp, prom_getchild(node), nextp); - dp->sibling = build_tree(parent, prom_getsibling(node), nextp); + node = prom_getsibling(node); } - return dp; + return ret; } struct device_node *of_console_device; From 6524036a1e5736a07466208362d83ddf31aae3ac Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 5 Dec 2008 01:21:41 -0800 Subject: [PATCH 62/98] sparc: Move core of OF device tree building code into prom_common.c Signed-off-by: David S. Miller --- arch/sparc/kernel/prom.h | 17 +++++++- arch/sparc/kernel/prom_32.c | 69 +++------------------------------ arch/sparc/kernel/prom_64.c | 69 +++------------------------------ arch/sparc/kernel/prom_common.c | 57 ++++++++++++++++++++++++++- 4 files changed, 80 insertions(+), 132 deletions(-) diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h index d14b4ae4fc57..dea8b91b6960 100644 --- a/arch/sparc/kernel/prom.h +++ b/arch/sparc/kernel/prom.h @@ -15,7 +15,20 @@ extern void irq_trans_init(struct device_node *dp); extern unsigned int prom_unique_id; -extern struct device_node * __init create_node(phandle node, - struct device_node *parent); +static inline int is_root_node(const struct device_node *dp) +{ + if (!dp) + return 0; + return (dp->parent == NULL); +} + +extern char *build_path_component(struct device_node *dp); + +extern struct device_node * __init prom_create_node(phandle node, + struct device_node *parent); + +extern struct device_node * __init prom_build_tree(struct device_node *parent, + phandle node, + struct device_node ***nextp); #endif /* __PROM_H */ diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index 35cb4c742524..75eb40be5e8a 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -42,14 +42,6 @@ void * __init prom_early_alloc(unsigned long size) return ret; } -static int is_root_node(const struct device_node *dp) -{ - if (!dp) - return 0; - - return (dp->parent == NULL); -} - /* The following routines deal with the black magic of fully naming a * node. * @@ -161,7 +153,7 @@ static void __init __build_path_component(struct device_node *dp, char *tmp_buf) return sparc32_path_component(dp, tmp_buf); } -static char * __init build_path_component(struct device_node *dp) +char * __init build_path_component(struct device_node *dp) { char tmp_buf[64], *n; @@ -176,57 +168,6 @@ static char * __init build_path_component(struct device_node *dp) return n; } -static char * __init build_full_name(struct device_node *dp) -{ - int len, ourlen, plen; - char *n; - - plen = strlen(dp->parent->full_name); - ourlen = strlen(dp->path_component_name); - len = ourlen + plen + 2; - - n = prom_early_alloc(len); - strcpy(n, dp->parent->full_name); - if (!is_root_node(dp->parent)) { - strcpy(n + plen, "/"); - plen++; - } - strcpy(n + plen, dp->path_component_name); - - return n; -} - -static struct device_node * __init build_tree(struct device_node *parent, phandle node, struct device_node ***nextp) -{ - struct device_node *ret = NULL, *prev_sibling = NULL; - struct device_node *dp; - - while (1) { - dp = create_node(node, parent); - if (!dp) - break; - - if (prev_sibling) - prev_sibling->sibling = dp; - - if (!ret) - ret = dp; - prev_sibling = dp; - - *(*nextp) = dp; - *nextp = &dp->allnext; - - dp->path_component_name = build_path_component(dp); - dp->full_name = build_full_name(dp); - - dp->child = build_tree(dp, prom_getchild(node), nextp); - - node = prom_getsibling(node); - } - - return ret; -} - struct device_node *of_console_device; EXPORT_SYMBOL(of_console_device); @@ -360,14 +301,14 @@ void __init prom_build_devicetree(void) { struct device_node **nextp; - allnodes = create_node(prom_root_node, NULL); + allnodes = prom_create_node(prom_root_node, NULL); allnodes->path_component_name = ""; allnodes->full_name = "/"; nextp = &allnodes->allnext; - allnodes->child = build_tree(allnodes, - prom_getchild(allnodes->node), - &nextp); + allnodes->child = prom_build_tree(allnodes, + prom_getchild(allnodes->node), + &nextp); of_console_init(); printk("PROM: Built device tree with %u bytes of memory.\n", diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index c1ce987b8429..0279811d17bc 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -51,14 +51,6 @@ void * __init prom_early_alloc(unsigned long size) return ret; } -static int is_root_node(const struct device_node *dp) -{ - if (!dp) - return 0; - - return (dp->parent == NULL); -} - /* The following routines deal with the black magic of fully naming a * node. * @@ -364,7 +356,7 @@ static void __init __build_path_component(struct device_node *dp, char *tmp_buf) } } -static char * __init build_path_component(struct device_node *dp) +char * __init build_path_component(struct device_node *dp) { char tmp_buf[64], *n; @@ -379,57 +371,6 @@ static char * __init build_path_component(struct device_node *dp) return n; } -static char * __init build_full_name(struct device_node *dp) -{ - int len, ourlen, plen; - char *n; - - plen = strlen(dp->parent->full_name); - ourlen = strlen(dp->path_component_name); - len = ourlen + plen + 2; - - n = prom_early_alloc(len); - strcpy(n, dp->parent->full_name); - if (!is_root_node(dp->parent)) { - strcpy(n + plen, "/"); - plen++; - } - strcpy(n + plen, dp->path_component_name); - - return n; -} - -static struct device_node * __init build_tree(struct device_node *parent, phandle node, struct device_node ***nextp) -{ - struct device_node *ret = NULL, *prev_sibling = NULL; - struct device_node *dp; - - while (1) { - dp = create_node(node, parent); - if (!dp) - break; - - if (prev_sibling) - prev_sibling->sibling = dp; - - if (!ret) - ret = dp; - prev_sibling = dp; - - *(*nextp) = dp; - *nextp = &dp->allnext; - - dp->path_component_name = build_path_component(dp); - dp->full_name = build_full_name(dp); - - dp->child = build_tree(dp, prom_getchild(node), nextp); - - node = prom_getsibling(node); - } - - return ret; -} - static const char *get_mid_prop(void) { return (tlb_type == spitfire ? "upa-portid" : "portid"); @@ -640,14 +581,14 @@ void __init prom_build_devicetree(void) { struct device_node **nextp; - allnodes = create_node(prom_root_node, NULL); + allnodes = prom_create_node(prom_root_node, NULL); allnodes->path_component_name = ""; allnodes->full_name = "/"; nextp = &allnodes->allnext; - allnodes->child = build_tree(allnodes, - prom_getchild(allnodes->node), - &nextp); + allnodes->child = prom_build_tree(allnodes, + prom_getchild(allnodes->node), + &nextp); of_console_init(); printk("PROM: Built device tree with %u bytes of memory.\n", diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index d3eddc76763d..3b5de2f3fcd1 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c @@ -216,8 +216,8 @@ static char * __init get_one_property(phandle node, const char *name) return buf; } -struct device_node * __init create_node(phandle node, - struct device_node *parent) +struct device_node * __init prom_create_node(phandle node, + struct device_node *parent) { struct device_node *dp; @@ -240,3 +240,56 @@ struct device_node * __init create_node(phandle node, return dp; } + +static char * __init build_full_name(struct device_node *dp) +{ + int len, ourlen, plen; + char *n; + + plen = strlen(dp->parent->full_name); + ourlen = strlen(dp->path_component_name); + len = ourlen + plen + 2; + + n = prom_early_alloc(len); + strcpy(n, dp->parent->full_name); + if (!is_root_node(dp->parent)) { + strcpy(n + plen, "/"); + plen++; + } + strcpy(n + plen, dp->path_component_name); + + return n; +} + +struct device_node * __init prom_build_tree(struct device_node *parent, + phandle node, + struct device_node ***nextp) +{ + struct device_node *ret = NULL, *prev_sibling = NULL; + struct device_node *dp; + + while (1) { + dp = prom_create_node(node, parent); + if (!dp) + break; + + if (prev_sibling) + prev_sibling->sibling = dp; + + if (!ret) + ret = dp; + prev_sibling = dp; + + *(*nextp) = dp; + *nextp = &dp->allnext; + + dp->path_component_name = build_path_component(dp); + dp->full_name = build_full_name(dp); + + dp->child = prom_build_tree(dp, prom_getchild(node), nextp); + + node = prom_getsibling(node); + } + + return ret; +} From 23dc758e47aeb3cc2414c2ec69b7b3e95f447071 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 5 Dec 2008 18:16:48 -0800 Subject: [PATCH 63/98] sparc: Move prom_build_devicetree() into prom_common.c To make this work we provide a dummy nop implementation of of_fill_in_cpu_data() for sparc32. Signed-off-by: David S. Miller --- arch/sparc/kernel/prom.h | 8 +++----- arch/sparc/kernel/prom_32.c | 20 ++------------------ arch/sparc/kernel/prom_64.c | 33 +++++++-------------------------- arch/sparc/kernel/prom_common.c | 32 +++++++++++++++++++++++++++----- 4 files changed, 39 insertions(+), 54 deletions(-) diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h index dea8b91b6960..0764b354b52c 100644 --- a/arch/sparc/kernel/prom.h +++ b/arch/sparc/kernel/prom.h @@ -24,11 +24,9 @@ static inline int is_root_node(const struct device_node *dp) } extern char *build_path_component(struct device_node *dp); +extern void of_console_init(void); +extern void of_fill_in_cpu_data(void); -extern struct device_node * __init prom_create_node(phandle node, - struct device_node *parent); +extern unsigned int prom_early_allocated; -extern struct device_node * __init prom_build_tree(struct device_node *parent, - phandle node, - struct device_node ***nextp); #endif /* __PROM_H */ diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index 75eb40be5e8a..5ad2012ae104 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -27,8 +27,6 @@ #include "prom.h" -static unsigned int prom_early_allocated; - void * __init prom_early_alloc(unsigned long size) { void *ret; @@ -179,7 +177,7 @@ EXPORT_SYMBOL(of_console_options); extern void restore_current(void); -static void __init of_console_init(void) +void __init of_console_init(void) { char *msg = "OF stdout device is: %s\n"; struct device_node *dp; @@ -297,20 +295,6 @@ static void __init of_console_init(void) printk(msg, of_console_path); } -void __init prom_build_devicetree(void) +void __init of_fill_in_cpu_data(void) { - struct device_node **nextp; - - allnodes = prom_create_node(prom_root_node, NULL); - allnodes->path_component_name = ""; - allnodes->full_name = "/"; - - nextp = &allnodes->allnext; - allnodes->child = prom_build_tree(allnodes, - prom_getchild(allnodes->node), - &nextp); - of_console_init(); - - printk("PROM: Built device tree with %u bytes of memory.\n", - prom_early_allocated); } diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index 0279811d17bc..3afb838a6e61 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -32,8 +32,6 @@ #include "prom.h" -static unsigned int prom_early_allocated __initdata; - void * __init prom_early_alloc(unsigned long size) { unsigned long paddr = lmb_alloc(size, SMP_CACHE_BYTES); @@ -401,11 +399,15 @@ struct device_node *of_find_node_by_cpuid(int cpuid) return NULL; } -static void __init of_fill_in_cpu_data(void) +void __init of_fill_in_cpu_data(void) { struct device_node *dp; - const char *mid_prop = get_mid_prop(); + const char *mid_prop; + if (tlb_type == hypervisor) + return; + + mid_prop = get_mid_prop(); ncpus_probed = 0; for_each_node_by_type(dp, "cpu") { int cpuid = of_getintprop_default(dp, mid_prop, -1); @@ -533,7 +535,7 @@ EXPORT_SYMBOL(of_console_path); char *of_console_options; EXPORT_SYMBOL(of_console_options); -static void __init of_console_init(void) +void __init of_console_init(void) { char *msg = "OF stdout device is: %s\n"; struct device_node *dp; @@ -576,24 +578,3 @@ static void __init of_console_init(void) printk(msg, of_console_path); } - -void __init prom_build_devicetree(void) -{ - struct device_node **nextp; - - allnodes = prom_create_node(prom_root_node, NULL); - allnodes->path_component_name = ""; - allnodes->full_name = "/"; - - nextp = &allnodes->allnext; - allnodes->child = prom_build_tree(allnodes, - prom_getchild(allnodes->node), - &nextp); - of_console_init(); - - printk("PROM: Built device tree with %u bytes of memory.\n", - prom_early_allocated); - - if (tlb_type != hypervisor) - of_fill_in_cpu_data(); -} diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index 3b5de2f3fcd1..95e8e5d1b0fb 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c @@ -216,8 +216,8 @@ static char * __init get_one_property(phandle node, const char *name) return buf; } -struct device_node * __init prom_create_node(phandle node, - struct device_node *parent) +static struct device_node * __init prom_create_node(phandle node, + struct device_node *parent) { struct device_node *dp; @@ -261,9 +261,9 @@ static char * __init build_full_name(struct device_node *dp) return n; } -struct device_node * __init prom_build_tree(struct device_node *parent, - phandle node, - struct device_node ***nextp) +static struct device_node * __init prom_build_tree(struct device_node *parent, + phandle node, + struct device_node ***nextp) { struct device_node *ret = NULL, *prev_sibling = NULL; struct device_node *dp; @@ -293,3 +293,25 @@ struct device_node * __init prom_build_tree(struct device_node *parent, return ret; } + +unsigned int prom_early_allocated __initdata; + +void __init prom_build_devicetree(void) +{ + struct device_node **nextp; + + allnodes = prom_create_node(prom_root_node, NULL); + allnodes->path_component_name = ""; + allnodes->full_name = "/"; + + nextp = &allnodes->allnext; + allnodes->child = prom_build_tree(allnodes, + prom_getchild(allnodes->node), + &nextp); + of_console_init(); + + printk("PROM: Built device tree with %u bytes of memory.\n", + prom_early_allocated); + + of_fill_in_cpu_data(); +} From ad07aed8ca2023bcfe224a5e3e55bafec2c741d0 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 5 Dec 2008 15:20:26 -0800 Subject: [PATCH 64/98] sparc: Move of_console_{device,path,options} info prom_common.c Signed-off-by: David S. Miller --- arch/sparc/kernel/prom_32.c | 9 --------- arch/sparc/kernel/prom_64.c | 9 --------- arch/sparc/kernel/prom_common.c | 9 +++++++++ 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index 5ad2012ae104..f21e8fc9a8fb 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -166,15 +166,6 @@ char * __init build_path_component(struct device_node *dp) return n; } -struct device_node *of_console_device; -EXPORT_SYMBOL(of_console_device); - -char *of_console_path; -EXPORT_SYMBOL(of_console_path); - -char *of_console_options; -EXPORT_SYMBOL(of_console_options); - extern void restore_current(void); void __init of_console_init(void) diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index 3afb838a6e61..edecca7b8116 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -526,15 +526,6 @@ void __init of_fill_in_cpu_data(void) smp_fill_in_sib_core_maps(); } -struct device_node *of_console_device; -EXPORT_SYMBOL(of_console_device); - -char *of_console_path; -EXPORT_SYMBOL(of_console_path); - -char *of_console_options; -EXPORT_SYMBOL(of_console_options); - void __init of_console_init(void) { char *msg = "OF stdout device is: %s\n"; diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index 95e8e5d1b0fb..2736f3d74c7f 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c @@ -25,6 +25,15 @@ #include "prom.h" +struct device_node *of_console_device; +EXPORT_SYMBOL(of_console_device); + +char *of_console_path; +EXPORT_SYMBOL(of_console_path); + +char *of_console_options; +EXPORT_SYMBOL(of_console_options); + struct device_node *of_find_node_by_phandle(phandle handle) { struct device_node *np; From 8a563f016049bcdc9b0de0c8622afcf04b860e5e Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 5 Dec 2008 19:07:35 -0800 Subject: [PATCH 65/98] sparc: beautify kernel/cpu_32.c Fixed style issues Use C99 struct assignments Use KERN_DEBUG for printk Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/cpu_32.c | 204 +++++++++++++++++++------------------ 1 file changed, 104 insertions(+), 100 deletions(-) diff --git a/arch/sparc/kernel/cpu_32.c b/arch/sparc/kernel/cpu_32.c index 1fc17f59c6bf..d0fe5d249206 100644 --- a/arch/sparc/kernel/cpu_32.c +++ b/arch/sparc/kernel/cpu_32.c @@ -18,105 +18,109 @@ DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; struct cpu_iu_info { - int psr_impl; - int psr_vers; - char* cpu_name; /* should be enough I hope... */ + int psr_impl; + int psr_vers; + char *cpu_name; /* should be enough I hope... */ }; struct cpu_fp_info { - int psr_impl; - int fp_vers; - char* fp_name; + int psr_impl; + int fp_vers; + char *fp_name; }; /* In order to get the fpu type correct, you need to take the IDPROM's * machine type value into consideration too. I will fix this. */ +#define CPU_FP(psr, ver, name) \ +{ .psr_impl = (psr), .fp_vers = (ver), .fp_name = (name) } static struct cpu_fp_info linux_sparc_fpu[] = { - { 0, 0, "Fujitsu MB86910 or Weitek WTL1164/5"}, - { 0, 1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"}, - { 0, 2, "LSI Logic L64802 or Texas Instruments ACT8847"}, - /* SparcStation SLC, SparcStation1 */ - { 0, 3, "Weitek WTL3170/2"}, - /* SPARCstation-5 */ - { 0, 4, "Lsi Logic/Meiko L64804 or compatible"}, - { 0, 5, "reserved"}, - { 0, 6, "reserved"}, - { 0, 7, "No FPU"}, - { 1, 0, "ROSS HyperSparc combined IU/FPU"}, - { 1, 1, "Lsi Logic L64814"}, - { 1, 2, "Texas Instruments TMS390-C602A"}, - { 1, 3, "Cypress CY7C602 FPU"}, - { 1, 4, "reserved"}, - { 1, 5, "reserved"}, - { 1, 6, "reserved"}, - { 1, 7, "No FPU"}, - { 2, 0, "BIT B5010 or B5110/20 or B5210"}, - { 2, 1, "reserved"}, - { 2, 2, "reserved"}, - { 2, 3, "reserved"}, - { 2, 4, "reserved"}, - { 2, 5, "reserved"}, - { 2, 6, "reserved"}, - { 2, 7, "No FPU"}, - /* SuperSparc 50 module */ - { 4, 0, "SuperSparc on-chip FPU"}, - /* SparcClassic */ - { 4, 4, "TI MicroSparc on chip FPU"}, - { 5, 0, "Matsushita MN10501"}, - { 5, 1, "reserved"}, - { 5, 2, "reserved"}, - { 5, 3, "reserved"}, - { 5, 4, "reserved"}, - { 5, 5, "reserved"}, - { 5, 6, "reserved"}, - { 5, 7, "No FPU"}, - { 9, 3, "Fujitsu or Weitek on-chip FPU"}, + CPU_FP(0, 0, "Fujitsu MB86910 or Weitek WTL1164/5"), + CPU_FP(0, 1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"), + CPU_FP(0, 2, "LSI Logic L64802 or Texas Instruments ACT8847"), + /* SparcStation SLC, SparcStation1 */ + CPU_FP(0, 3, "Weitek WTL3170/2"), + /* SPARCstation-5 */ + CPU_FP(0, 4, "Lsi Logic/Meiko L64804 or compatible"), + CPU_FP(0, 5, "reserved"), + CPU_FP(0, 6, "reserved"), + CPU_FP(0, 7, "No FPU"), + CPU_FP(1, 0, "ROSS HyperSparc combined IU/FPU"), + CPU_FP(1, 1, "Lsi Logic L64814"), + CPU_FP(1, 2, "Texas Instruments TMS390-C602A"), + CPU_FP(1, 3, "Cypress CY7C602 FPU"), + CPU_FP(1, 4, "reserved"), + CPU_FP(1, 5, "reserved"), + CPU_FP(1, 6, "reserved"), + CPU_FP(1, 7, "No FPU"), + CPU_FP(2, 0, "BIT B5010 or B5110/20 or B5210"), + CPU_FP(2, 1, "reserved"), + CPU_FP(2, 2, "reserved"), + CPU_FP(2, 3, "reserved"), + CPU_FP(2, 4, "reserved"), + CPU_FP(2, 5, "reserved"), + CPU_FP(2, 6, "reserved"), + CPU_FP(2, 7, "No FPU"), + /* SuperSparc 50 module */ + CPU_FP(4, 0, "SuperSparc on-chip FPU"), + /* SparcClassic */ + CPU_FP(4, 4, "TI MicroSparc on chip FPU"), + CPU_FP(5, 0, "Matsushita MN10501"), + CPU_FP(5, 1, "reserved"), + CPU_FP(5, 2, "reserved"), + CPU_FP(5, 3, "reserved"), + CPU_FP(5, 4, "reserved"), + CPU_FP(5, 5, "reserved"), + CPU_FP(5, 6, "reserved"), + CPU_FP(5, 7, "No FPU"), + CPU_FP(9, 3, "Fujitsu or Weitek on-chip FPU"), }; #define NSPARCFPU ARRAY_SIZE(linux_sparc_fpu) +#define CPU_INFO(psr, ver, name) \ +{ .psr_impl = (psr), .psr_vers = (ver), .cpu_name = (name) } static struct cpu_iu_info linux_sparc_chips[] = { - /* Sun4/100, 4/200, SLC */ - { 0, 0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"}, - /* borned STP1012PGA */ - { 0, 4, "Fujitsu MB86904"}, - { 0, 5, "Fujitsu TurboSparc MB86907"}, - /* SparcStation2, SparcServer 490 & 690 */ - { 1, 0, "LSI Logic Corporation - L64811"}, - /* SparcStation2 */ - { 1, 1, "Cypress/ROSS CY7C601"}, - /* Embedded controller */ - { 1, 3, "Cypress/ROSS CY7C611"}, - /* Ross Technologies HyperSparc */ - { 1, 0xf, "ROSS HyperSparc RT620"}, - { 1, 0xe, "ROSS HyperSparc RT625 or RT626"}, - /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */ - /* Someone please write the code to support this beast! ;) */ - { 2, 0, "Bipolar Integrated Technology - B5010"}, - { 3, 0, "LSI Logic Corporation - unknown-type"}, - { 4, 0, "Texas Instruments, Inc. - SuperSparc-(II)"}, - /* SparcClassic -- borned STP1010TAB-50*/ - { 4, 1, "Texas Instruments, Inc. - MicroSparc"}, - { 4, 2, "Texas Instruments, Inc. - MicroSparc II"}, - { 4, 3, "Texas Instruments, Inc. - SuperSparc 51"}, - { 4, 4, "Texas Instruments, Inc. - SuperSparc 61"}, - { 4, 5, "Texas Instruments, Inc. - unknown"}, - { 5, 0, "Matsushita - MN10501"}, - { 6, 0, "Philips Corporation - unknown"}, - { 7, 0, "Harvest VLSI Design Center, Inc. - unknown"}, - /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */ - { 8, 0, "Systems and Processes Engineering Corporation (SPEC)"}, - { 9, 0, "Fujitsu or Weitek Power-UP"}, - { 9, 1, "Fujitsu or Weitek Power-UP"}, - { 9, 2, "Fujitsu or Weitek Power-UP"}, - { 9, 3, "Fujitsu or Weitek Power-UP"}, - { 0xa, 0, "UNKNOWN CPU-VENDOR/TYPE"}, - { 0xb, 0, "UNKNOWN CPU-VENDOR/TYPE"}, - { 0xc, 0, "UNKNOWN CPU-VENDOR/TYPE"}, - { 0xd, 0, "UNKNOWN CPU-VENDOR/TYPE"}, - { 0xe, 0, "UNKNOWN CPU-VENDOR/TYPE"}, - { 0xf, 0, "UNKNOWN CPU-VENDOR/TYPE"}, + /* Sun4/100, 4/200, SLC */ + CPU_INFO(0, 0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"), + /* borned STP1012PGA */ + CPU_INFO(0, 4, "Fujitsu MB86904"), + CPU_INFO(0, 5, "Fujitsu TurboSparc MB86907"), + /* SparcStation2, SparcServer 490 & 690 */ + CPU_INFO(1, 0, "LSI Logic Corporation - L64811"), + /* SparcStation2 */ + CPU_INFO(1, 1, "Cypress/ROSS CY7C601"), + /* Embedded controller */ + CPU_INFO(1, 3, "Cypress/ROSS CY7C611"), + /* Ross Technologies HyperSparc */ + CPU_INFO(1, 0xf, "ROSS HyperSparc RT620"), + CPU_INFO(1, 0xe, "ROSS HyperSparc RT625 or RT626"), + /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */ + /* Someone please write the code to support this beast! ;) */ + CPU_INFO(2, 0, "Bipolar Integrated Technology - B5010"), + CPU_INFO(3, 0, "LSI Logic Corporation - unknown-type"), + CPU_INFO(4, 0, "Texas Instruments, Inc. - SuperSparc-(II)"), + /* SparcClassic -- borned STP1010TAB-50*/ + CPU_INFO(4, 1, "Texas Instruments, Inc. - MicroSparc"), + CPU_INFO(4, 2, "Texas Instruments, Inc. - MicroSparc II"), + CPU_INFO(4, 3, "Texas Instruments, Inc. - SuperSparc 51"), + CPU_INFO(4, 4, "Texas Instruments, Inc. - SuperSparc 61"), + CPU_INFO(4, 5, "Texas Instruments, Inc. - unknown"), + CPU_INFO(5, 0, "Matsushita - MN10501"), + CPU_INFO(6, 0, "Philips Corporation - unknown"), + CPU_INFO(7, 0, "Harvest VLSI Design Center, Inc. - unknown"), + /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */ + CPU_INFO(8, 0, "Systems and Processes Engineering Corporation (SPEC)"), + CPU_INFO(9, 0, "Fujitsu or Weitek Power-UP"), + CPU_INFO(9, 1, "Fujitsu or Weitek Power-UP"), + CPU_INFO(9, 2, "Fujitsu or Weitek Power-UP"), + CPU_INFO(9, 3, "Fujitsu or Weitek Power-UP"), + CPU_INFO(0xa, 0, "UNKNOWN CPU-VENDOR/TYPE"), + CPU_INFO(0xb, 0, "UNKNOWN CPU-VENDOR/TYPE"), + CPU_INFO(0xc, 0, "UNKNOWN CPU-VENDOR/TYPE"), + CPU_INFO(0xd, 0, "UNKNOWN CPU-VENDOR/TYPE"), + CPU_INFO(0xe, 0, "UNKNOWN CPU-VENDOR/TYPE"), + CPU_INFO(0xf, 0, "UNKNOWN CPU-VENDOR/TYPE"), }; #define NSPARCCHIPS ARRAY_SIZE(linux_sparc_chips) @@ -131,37 +135,37 @@ void __cpuinit cpu_probe(void) int psr_impl, psr_vers, fpu_vers; int i, psr; - psr_impl = ((get_psr()>>28)&0xf); - psr_vers = ((get_psr()>>24)&0xf); + psr_impl = ((get_psr() >> 28) & 0xf); + psr_vers = ((get_psr() >> 24) & 0xf); psr = get_psr(); put_psr(psr | PSR_EF); - fpu_vers = ((get_fsr()>>17)&0x7); + fpu_vers = ((get_fsr() >> 17) & 0x7); put_psr(psr); - for(i = 0; i Date: Fri, 5 Dec 2008 19:08:22 -0800 Subject: [PATCH 66/98] sparc: report "Unknown CPU/FPU" for unknown cpu/fpu If we cannot determine the CPU or FPU report "Unknown CPU" or "Unknown FPU" like sparc64 does. And report with KERN_ERR that we cannot determine the CPU. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/cpu_32.c | 9 ++++++--- arch/sparc/kernel/setup_32.c | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/sparc/kernel/cpu_32.c b/arch/sparc/kernel/cpu_32.c index d0fe5d249206..cdaf7630df81 100644 --- a/arch/sparc/kernel/cpu_32.c +++ b/arch/sparc/kernel/cpu_32.c @@ -152,8 +152,11 @@ void __cpuinit cpu_probe(void) } if (i == NSPARCCHIPS) - printk(KERN_DEBUG "psr.impl = 0x%x psr.vers = 0x%x\n", + { + printk(KERN_ERR "CPU: Unknown chip, impl[0x%x] vers[0x%x]\n", psr_impl, psr_vers); + sparc_cpu_type = "Unknown CPU"; + } for (i = 0; i < NSPARCFPU; i++) { if (linux_sparc_fpu[i].psr_impl == psr_impl) @@ -164,8 +167,8 @@ void __cpuinit cpu_probe(void) } if (i == NSPARCFPU) { - printk(KERN_DEBUG "psr.impl = 0x%x fsr.vers = 0x%x\n", + printk(KERN_ERR "FPU: Unknown chip, impl[0x%x] vers[0x%x]\n", psr_impl, fpu_vers); - sparc_fpu_type = linux_sparc_fpu[31].fp_name; + sparc_fpu_type = "Unknown FPU"; } } diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index 24fe3078bd4b..d21abbe26360 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c @@ -328,8 +328,8 @@ static int show_cpuinfo(struct seq_file *m, void *__unused) "CPU0ClkTck\t: %ld\n" #endif , - sparc_cpu_type ? sparc_cpu_type : "undetermined", - sparc_fpu_type ? sparc_fpu_type : "undetermined", + sparc_cpu_type, + sparc_fpu_type , romvec->pv_romvers, prom_rev, romvec->pv_printrev >> 16, From 7e7e93a22851f7bf0cbb7cd70878ebd811e4a044 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 5 Dec 2008 22:18:40 -0800 Subject: [PATCH 67/98] sparc: Always set AUDIT_ARCH, not just on sparc64. Without fancy makefile rules it's not straightforward to prevent both arch/sparc/kernel/audit.o and lib/audit.o from both being used on sparc32. Since arch/sparc/kernel/audit.c is identical to lib/audit.c except some CONFIG_COMPAT protected sections of code, just use it on sparc32 too as that's the simplest way to fix this. Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index ecb5ff9f01fa..c8c7738f2a32 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -85,7 +85,7 @@ config HAVE_LATENCYTOP_SUPPORT config AUDIT_ARCH bool - default y if SPARC64 + default y config HAVE_SETUP_PER_CPU_AREA def_bool y if SPARC64 From 53ae341926b1238af3170f2f306f52a22430776c Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 7 Dec 2008 00:02:08 -0800 Subject: [PATCH 68/98] sparc: fix sparse warnings in cpu_*.c o declare variables from cpu_*.c o declare function from cpu_32.c To do this introduce a new header "kernel.h" which is local to kernel/ Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/cpu_32.c | 6 ++++-- arch/sparc/kernel/cpu_64.c | 1 + arch/sparc/kernel/entry.h | 3 --- arch/sparc/kernel/kernel.h | 8 ++++++++ arch/sparc/kernel/setup_32.c | 5 ++--- arch/sparc/kernel/setup_64.c | 1 + 6 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 arch/sparc/kernel/kernel.h diff --git a/arch/sparc/kernel/cpu_32.c b/arch/sparc/kernel/cpu_32.c index cdaf7630df81..4e14240f9ce3 100644 --- a/arch/sparc/kernel/cpu_32.c +++ b/arch/sparc/kernel/cpu_32.c @@ -15,6 +15,8 @@ #include #include +#include "kernel.h" + DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; struct cpu_iu_info { @@ -125,8 +127,8 @@ static struct cpu_iu_info linux_sparc_chips[] = { #define NSPARCCHIPS ARRAY_SIZE(linux_sparc_chips) -char *sparc_cpu_type; -char *sparc_fpu_type; +const char *sparc_cpu_type; +const char *sparc_fpu_type; unsigned int fsr_storage; diff --git a/arch/sparc/kernel/cpu_64.c b/arch/sparc/kernel/cpu_64.c index 0c9ac83ed0a8..4a81ed744477 100644 --- a/arch/sparc/kernel/cpu_64.c +++ b/arch/sparc/kernel/cpu_64.c @@ -16,6 +16,7 @@ #include #include "entry.h" +#include "kernel.h" DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h index 34d7ab5e10d2..a9ab19aa0411 100644 --- a/arch/sparc/kernel/entry.h +++ b/arch/sparc/kernel/entry.h @@ -5,9 +5,6 @@ #include #include -extern const char *sparc_cpu_type; -extern const char *sparc_fpu_type; - extern void __init per_cpu_patch(void); extern void __init sun4v_patch(void); extern void __init boot_cpu_id_too_large(int cpu); diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h new file mode 100644 index 000000000000..7f02aad2e1ab --- /dev/null +++ b/arch/sparc/kernel/kernel.h @@ -0,0 +1,8 @@ +/* cpu.c */ +extern const char *sparc_cpu_type; +extern const char *sparc_fpu_type; + +extern unsigned int fsr_storage; + +extern void cpu_probe(void); + diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index d21abbe26360..c96c65d1b58b 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c @@ -46,6 +46,8 @@ #include #include +#include "kernel.h" + struct screen_info screen_info = { 0, 0, /* orig-x, orig-y */ 0, /* unused */ @@ -308,9 +310,6 @@ void __init setup_arch(char **cmdline_p) smp_setup_cpu_possible_map(); } -extern char *sparc_cpu_type; -extern char *sparc_fpu_type; - static int ncpus_probed; static int show_cpuinfo(struct seq_file *m, void *__unused) diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index c8b03a4f68bf..555db7452ebe 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c @@ -52,6 +52,7 @@ #endif #include "entry.h" +#include "kernel.h" /* Used to synchronize accesses to NatSemi SUPER I/O chip configure * operations in asm/ns87303.h From 2bf05fa03ea10e7dcfd38cc8643bbb29c3ad6f9e Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 7 Dec 2008 00:03:26 -0800 Subject: [PATCH 69/98] sparc: expand cpu table Prepare cputable to include sparc64 versions Declare it __initconst so it can be dropped after init Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/cpu_32.c | 325 ++++++++++++++++++++++--------------- 1 file changed, 198 insertions(+), 127 deletions(-) diff --git a/arch/sparc/kernel/cpu_32.c b/arch/sparc/kernel/cpu_32.c index 4e14240f9ce3..60528227e591 100644 --- a/arch/sparc/kernel/cpu_32.c +++ b/arch/sparc/kernel/cpu_32.c @@ -19,123 +19,221 @@ DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; -struct cpu_iu_info { - int psr_impl; +struct cpu_info { int psr_vers; - char *cpu_name; /* should be enough I hope... */ + const char *name; }; -struct cpu_fp_info { - int psr_impl; +struct fpu_info { int fp_vers; - char *fp_name; + const char *name; }; +#define NOCPU 8 +#define NOFPU 8 + +struct manufacturer_info { + int psr_impl; + struct cpu_info cpu_info[NOCPU]; + struct fpu_info fpu_info[NOFPU]; +}; + +#define CPU(ver, _name) \ +{ .psr_vers = ver, .name = _name } + +#define FPU(ver, _name) \ +{ .fp_vers = ver, .name = _name } + +static const struct manufacturer_info __initconst manufacturer_info[] = { +{ + 0, + /* Sun4/100, 4/200, SLC */ + .cpu_info = { + CPU(0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"), + /* borned STP1012PGA */ + CPU(4, "Fujitsu MB86904"), + CPU(5, "Fujitsu TurboSparc MB86907"), + CPU(-1, NULL) + }, + .fpu_info = { + FPU(0, "Fujitsu MB86910 or Weitek WTL1164/5"), + FPU(1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"), + FPU(2, "LSI Logic L64802 or Texas Instruments ACT8847"), + /* SparcStation SLC, SparcStation1 */ + FPU(3, "Weitek WTL3170/2"), + /* SPARCstation-5 */ + FPU(4, "Lsi Logic/Meiko L64804 or compatible"), + FPU(-1, NULL) + } +},{ + 1, + .cpu_info = { + /* SparcStation2, SparcServer 490 & 690 */ + CPU(0, "LSI Logic Corporation - L64811"), + /* SparcStation2 */ + CPU(1, "Cypress/ROSS CY7C601"), + /* Embedded controller */ + CPU(3, "Cypress/ROSS CY7C611"), + /* Ross Technologies HyperSparc */ + CPU(0xf, "ROSS HyperSparc RT620"), + CPU(0xe, "ROSS HyperSparc RT625 or RT626"), + CPU(-1, NULL) + }, + .fpu_info = { + FPU(0, "ROSS HyperSparc combined IU/FPU"), + FPU(1, "Lsi Logic L64814"), + FPU(2, "Texas Instruments TMS390-C602A"), + FPU(3, "Cypress CY7C602 FPU"), + FPU(-1, NULL) + } +},{ + 2, + .cpu_info = { + /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */ + /* Someone please write the code to support this beast! ;) */ + CPU(0, "Bipolar Integrated Technology - B5010"), + CPU(-1, NULL) + }, + .fpu_info = { + FPU(-1, NULL) + } +},{ + 3, + .cpu_info = { + CPU(0, "LSI Logic Corporation - unknown-type"), + CPU(-1, NULL) + }, + .fpu_info = { + FPU(-1, NULL) + } +},{ + 4, + .cpu_info = { + CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"), + /* SparcClassic -- borned STP1010TAB-50*/ + CPU(1, "Texas Instruments, Inc. - MicroSparc"), + CPU(2, "Texas Instruments, Inc. - MicroSparc II"), + CPU(3, "Texas Instruments, Inc. - SuperSparc 51"), + CPU(4, "Texas Instruments, Inc. - SuperSparc 61"), + CPU(5, "Texas Instruments, Inc. - unknown"), + CPU(-1, NULL) + }, + .fpu_info = { + /* SuperSparc 50 module */ + FPU(0, "SuperSparc on-chip FPU"), + /* SparcClassic */ + FPU(4, "TI MicroSparc on chip FPU"), + FPU(-1, NULL) + } +},{ + 5, + .cpu_info = { + CPU(0, "Matsushita - MN10501"), + CPU(-1, NULL) + }, + .fpu_info = { + FPU(0, "Matsushita MN10501"), + FPU(-1, NULL) + } +},{ + 6, + .cpu_info = { + CPU(0, "Philips Corporation - unknown"), + CPU(-1, NULL) + }, + .fpu_info = { + FPU(-1, NULL) + } +},{ + 7, + .cpu_info = { + CPU(0, "Harvest VLSI Design Center, Inc. - unknown"), + CPU(-1, NULL) + }, + .fpu_info = { + FPU(-1, NULL) + } +},{ + 8, + .cpu_info = { + CPU(0, "Systems and Processes Engineering Corporation (SPEC)"), + CPU(-1, NULL) + }, + .fpu_info = { + FPU(-1, NULL) + } +},{ + 9, + .cpu_info = { + /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */ + CPU(0, "Fujitsu or Weitek Power-UP"), + CPU(1, "Fujitsu or Weitek Power-UP"), + CPU(2, "Fujitsu or Weitek Power-UP"), + CPU(3, "Fujitsu or Weitek Power-UP"), + CPU(-1, NULL) + }, + .fpu_info = { + FPU(3, "Fujitsu or Weitek on-chip FPU"), + FPU(-1, NULL) + } +}}; + /* In order to get the fpu type correct, you need to take the IDPROM's * machine type value into consideration too. I will fix this. */ -#define CPU_FP(psr, ver, name) \ -{ .psr_impl = (psr), .fp_vers = (ver), .fp_name = (name) } -static struct cpu_fp_info linux_sparc_fpu[] = { - CPU_FP(0, 0, "Fujitsu MB86910 or Weitek WTL1164/5"), - CPU_FP(0, 1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"), - CPU_FP(0, 2, "LSI Logic L64802 or Texas Instruments ACT8847"), - /* SparcStation SLC, SparcStation1 */ - CPU_FP(0, 3, "Weitek WTL3170/2"), - /* SPARCstation-5 */ - CPU_FP(0, 4, "Lsi Logic/Meiko L64804 or compatible"), - CPU_FP(0, 5, "reserved"), - CPU_FP(0, 6, "reserved"), - CPU_FP(0, 7, "No FPU"), - CPU_FP(1, 0, "ROSS HyperSparc combined IU/FPU"), - CPU_FP(1, 1, "Lsi Logic L64814"), - CPU_FP(1, 2, "Texas Instruments TMS390-C602A"), - CPU_FP(1, 3, "Cypress CY7C602 FPU"), - CPU_FP(1, 4, "reserved"), - CPU_FP(1, 5, "reserved"), - CPU_FP(1, 6, "reserved"), - CPU_FP(1, 7, "No FPU"), - CPU_FP(2, 0, "BIT B5010 or B5110/20 or B5210"), - CPU_FP(2, 1, "reserved"), - CPU_FP(2, 2, "reserved"), - CPU_FP(2, 3, "reserved"), - CPU_FP(2, 4, "reserved"), - CPU_FP(2, 5, "reserved"), - CPU_FP(2, 6, "reserved"), - CPU_FP(2, 7, "No FPU"), - /* SuperSparc 50 module */ - CPU_FP(4, 0, "SuperSparc on-chip FPU"), - /* SparcClassic */ - CPU_FP(4, 4, "TI MicroSparc on chip FPU"), - CPU_FP(5, 0, "Matsushita MN10501"), - CPU_FP(5, 1, "reserved"), - CPU_FP(5, 2, "reserved"), - CPU_FP(5, 3, "reserved"), - CPU_FP(5, 4, "reserved"), - CPU_FP(5, 5, "reserved"), - CPU_FP(5, 6, "reserved"), - CPU_FP(5, 7, "No FPU"), - CPU_FP(9, 3, "Fujitsu or Weitek on-chip FPU"), -}; - -#define NSPARCFPU ARRAY_SIZE(linux_sparc_fpu) - -#define CPU_INFO(psr, ver, name) \ -{ .psr_impl = (psr), .psr_vers = (ver), .cpu_name = (name) } -static struct cpu_iu_info linux_sparc_chips[] = { - /* Sun4/100, 4/200, SLC */ - CPU_INFO(0, 0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"), - /* borned STP1012PGA */ - CPU_INFO(0, 4, "Fujitsu MB86904"), - CPU_INFO(0, 5, "Fujitsu TurboSparc MB86907"), - /* SparcStation2, SparcServer 490 & 690 */ - CPU_INFO(1, 0, "LSI Logic Corporation - L64811"), - /* SparcStation2 */ - CPU_INFO(1, 1, "Cypress/ROSS CY7C601"), - /* Embedded controller */ - CPU_INFO(1, 3, "Cypress/ROSS CY7C611"), - /* Ross Technologies HyperSparc */ - CPU_INFO(1, 0xf, "ROSS HyperSparc RT620"), - CPU_INFO(1, 0xe, "ROSS HyperSparc RT625 or RT626"), - /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */ - /* Someone please write the code to support this beast! ;) */ - CPU_INFO(2, 0, "Bipolar Integrated Technology - B5010"), - CPU_INFO(3, 0, "LSI Logic Corporation - unknown-type"), - CPU_INFO(4, 0, "Texas Instruments, Inc. - SuperSparc-(II)"), - /* SparcClassic -- borned STP1010TAB-50*/ - CPU_INFO(4, 1, "Texas Instruments, Inc. - MicroSparc"), - CPU_INFO(4, 2, "Texas Instruments, Inc. - MicroSparc II"), - CPU_INFO(4, 3, "Texas Instruments, Inc. - SuperSparc 51"), - CPU_INFO(4, 4, "Texas Instruments, Inc. - SuperSparc 61"), - CPU_INFO(4, 5, "Texas Instruments, Inc. - unknown"), - CPU_INFO(5, 0, "Matsushita - MN10501"), - CPU_INFO(6, 0, "Philips Corporation - unknown"), - CPU_INFO(7, 0, "Harvest VLSI Design Center, Inc. - unknown"), - /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */ - CPU_INFO(8, 0, "Systems and Processes Engineering Corporation (SPEC)"), - CPU_INFO(9, 0, "Fujitsu or Weitek Power-UP"), - CPU_INFO(9, 1, "Fujitsu or Weitek Power-UP"), - CPU_INFO(9, 2, "Fujitsu or Weitek Power-UP"), - CPU_INFO(9, 3, "Fujitsu or Weitek Power-UP"), - CPU_INFO(0xa, 0, "UNKNOWN CPU-VENDOR/TYPE"), - CPU_INFO(0xb, 0, "UNKNOWN CPU-VENDOR/TYPE"), - CPU_INFO(0xc, 0, "UNKNOWN CPU-VENDOR/TYPE"), - CPU_INFO(0xd, 0, "UNKNOWN CPU-VENDOR/TYPE"), - CPU_INFO(0xe, 0, "UNKNOWN CPU-VENDOR/TYPE"), - CPU_INFO(0xf, 0, "UNKNOWN CPU-VENDOR/TYPE"), -}; - -#define NSPARCCHIPS ARRAY_SIZE(linux_sparc_chips) const char *sparc_cpu_type; const char *sparc_fpu_type; unsigned int fsr_storage; +static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers) +{ + sparc_cpu_type = NULL; + sparc_fpu_type = NULL; + if (psr_impl < ARRAY_SIZE(manufacturer_info)) + { + const struct cpu_info *cpu; + const struct fpu_info *fpu; + + cpu = &manufacturer_info[psr_impl].cpu_info[0]; + while (cpu->psr_vers != -1) + { + if (cpu->psr_vers == psr_vers) { + sparc_cpu_type = cpu->name; + sparc_fpu_type = "No FPU"; + break; + } + cpu++; + } + fpu = &manufacturer_info[psr_impl].fpu_info[0]; + while (fpu->fp_vers != -1) + { + if (fpu->fp_vers == fpu_vers) { + sparc_fpu_type = fpu->name; + break; + } + fpu++; + } + } + if (sparc_cpu_type == NULL) + { + printk(KERN_ERR "CPU: Unknown chip, impl[0x%x] vers[0x%x]\n", + psr_impl, psr_vers); + sparc_cpu_type = "Unknown CPU"; + } + if (sparc_fpu_type == NULL) + { + printk(KERN_ERR "FPU: Unknown chip, impl[0x%x] vers[0x%x]\n", + psr_impl, fpu_vers); + sparc_fpu_type = "Unknown FPU"; + } +} + void __cpuinit cpu_probe(void) { int psr_impl, psr_vers, fpu_vers; - int i, psr; + int psr; psr_impl = ((get_psr() >> 28) & 0xf); psr_vers = ((get_psr() >> 24) & 0xf); @@ -145,32 +243,5 @@ void __cpuinit cpu_probe(void) fpu_vers = ((get_fsr() >> 17) & 0x7); put_psr(psr); - for (i = 0; i < NSPARCCHIPS; i++) { - if (linux_sparc_chips[i].psr_impl == psr_impl) - if (linux_sparc_chips[i].psr_vers == psr_vers) { - sparc_cpu_type = linux_sparc_chips[i].cpu_name; - break; - } - } - - if (i == NSPARCCHIPS) - { - printk(KERN_ERR "CPU: Unknown chip, impl[0x%x] vers[0x%x]\n", - psr_impl, psr_vers); - sparc_cpu_type = "Unknown CPU"; - } - - for (i = 0; i < NSPARCFPU; i++) { - if (linux_sparc_fpu[i].psr_impl == psr_impl) - if (linux_sparc_fpu[i].fp_vers == fpu_vers) { - sparc_fpu_type = linux_sparc_fpu[i].fp_name; - break; - } - } - - if (i == NSPARCFPU) { - printk(KERN_ERR "FPU: Unknown chip, impl[0x%x] vers[0x%x]\n", - psr_impl, fpu_vers); - sparc_fpu_type = "Unknown FPU"; - } + set_cpu_and_fpu(psr_impl, psr_vers, fpu_vers); } From d34dd82905fb8e1117b67ab6c32989f88cfa0ba8 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 7 Dec 2008 00:04:30 -0800 Subject: [PATCH 70/98] sparc: unify kernel/cpu o use cpu_32.c as base o move all sparc64 definitions to the common cpu.c o use ifdef for the parts that differs and use cpu_32 as base o spitfire.h required a CONFIG_SPARC64 guard to fix build on 32 bit Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/include/asm/spitfire.h | 4 +- arch/sparc/kernel/Makefile | 2 +- arch/sparc/kernel/{cpu_32.c => cpu.c} | 91 ++++++++++++++ arch/sparc/kernel/cpu_64.c | 167 -------------------------- 4 files changed, 95 insertions(+), 169 deletions(-) rename arch/sparc/kernel/{cpu_32.c => cpu.c} (70%) delete mode 100644 arch/sparc/kernel/cpu_64.c diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h index 985ea7e31992..f0d0c40c44da 100644 --- a/arch/sparc/include/asm/spitfire.h +++ b/arch/sparc/include/asm/spitfire.h @@ -6,6 +6,8 @@ #ifndef _SPARC64_SPITFIRE_H #define _SPARC64_SPITFIRE_H +#ifdef CONFIG_SPARC64 + #include /* The following register addresses are accessible via ASI_DMMU @@ -338,5 +340,5 @@ static inline void cheetah_put_itlb_data(int entry, unsigned long data) } #endif /* !(__ASSEMBLY__) */ - +#endif /* CONFIG_SPARC64 */ #endif /* !(_SPARC64_SPITFIRE_H) */ diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 04c74d00f832..0ba314b7f111 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -27,7 +27,7 @@ obj-y += sys_sparc_$(BITS).o obj-$(CONFIG_SPARC32) += systbls_32.o obj-y += time_$(BITS).o obj-$(CONFIG_SPARC32) += windows.o -obj-y += cpu_$(BITS).o +obj-y += cpu.o obj-$(CONFIG_SPARC32) += devices.o obj-$(CONFIG_SPARC32) += tadpole.o obj-$(CONFIG_SPARC32) += tick14.o diff --git a/arch/sparc/kernel/cpu_32.c b/arch/sparc/kernel/cpu.c similarity index 70% rename from arch/sparc/kernel/cpu_32.c rename to arch/sparc/kernel/cpu.c index 60528227e591..6c2da2420f76 100644 --- a/arch/sparc/kernel/cpu_32.c +++ b/arch/sparc/kernel/cpu.c @@ -8,6 +8,8 @@ #include #include #include + +#include #include #include #include @@ -176,6 +178,52 @@ static const struct manufacturer_info __initconst manufacturer_info[] = { FPU(3, "Fujitsu or Weitek on-chip FPU"), FPU(-1, NULL) } +},{ + 0x17, + .cpu_info = { + CPU(0x10, "TI UltraSparc I (SpitFire)"), + CPU(0x11, "TI UltraSparc II (BlackBird)"), + CPU(0x12, "TI UltraSparc IIi (Sabre)"), + CPU(0x13, "TI UltraSparc IIe (Hummingbird)"), + CPU(-1, NULL) + }, + .fpu_info = { + FPU(0x10, "UltraSparc I integrated FPU"), + FPU(0x11, "UltraSparc II integrated FPU"), + FPU(0x12, "UltraSparc IIi integrated FPU"), + FPU(0x13, "UltraSparc IIe integrated FPU"), + FPU(-1, NULL) + } +},{ + 0x22, + .cpu_info = { + CPU(0x10, "TI UltraSparc I (SpitFire)"), + CPU(-1, NULL) + }, + .fpu_info = { + FPU(0x10, "UltraSparc I integrated FPU"), + FPU(-1, NULL) + } +},{ + 0x3e, + .cpu_info = { + CPU(0x14, "TI UltraSparc III (Cheetah)"), + CPU(0x15, "TI UltraSparc III+ (Cheetah+)"), + CPU(0x16, "TI UltraSparc IIIi (Jalapeno)"), + CPU(0x18, "TI UltraSparc IV (Jaguar)"), + CPU(0x19, "TI UltraSparc IV+ (Panther)"), + CPU(0x22, "TI UltraSparc IIIi+ (Serrano)"), + CPU(-1, NULL) + }, + .fpu_info = { + FPU(0x14, "UltraSparc III integrated FPU"), + FPU(0x15, "UltraSparc III+ integrated FPU"), + FPU(0x16, "UltraSparc IIIi integrated FPU"), + FPU(0x18, "UltraSparc IV integrated FPU"), + FPU(0x19, "UltraSparc IV+ integrated FPU"), + FPU(0x22, "UltraSparc IIIi+ integrated FPU"), + FPU(-1, NULL) + } }}; /* In order to get the fpu type correct, you need to take the IDPROM's @@ -230,6 +278,7 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers) } } +#ifdef CONFIG_SPARC32 void __cpuinit cpu_probe(void) { int psr_impl, psr_vers, fpu_vers; @@ -245,3 +294,45 @@ void __cpuinit cpu_probe(void) set_cpu_and_fpu(psr_impl, psr_vers, fpu_vers); } +#else +static void __init sun4v_cpu_probe(void) +{ + switch (sun4v_chip_type) { + case SUN4V_CHIP_NIAGARA1: + sparc_cpu_type = "UltraSparc T1 (Niagara)"; + sparc_fpu_type = "UltraSparc T1 integrated FPU"; + break; + + case SUN4V_CHIP_NIAGARA2: + sparc_cpu_type = "UltraSparc T2 (Niagara2)"; + sparc_fpu_type = "UltraSparc T2 integrated FPU"; + break; + + default: + printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n", + prom_cpu_compatible); + sparc_cpu_type = "Unknown SUN4V CPU"; + sparc_fpu_type = "Unknown SUN4V FPU"; + break; + } +} + +static int __init cpu_type_probe(void) +{ + if (tlb_type == hypervisor) { + sun4v_cpu_probe(); + } else { + unsigned long ver; + int manuf, impl; + + __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver)); + + manuf = ((ver >> 48) & 0xffff); + impl = ((ver >> 32) & 0xffff); + set_cpu_and_fpu(manuf, impl, impl); + } + return 0; +} + +arch_initcall(cpu_type_probe); +#endif diff --git a/arch/sparc/kernel/cpu_64.c b/arch/sparc/kernel/cpu_64.c deleted file mode 100644 index 4a81ed744477..000000000000 --- a/arch/sparc/kernel/cpu_64.c +++ /dev/null @@ -1,167 +0,0 @@ -/* cpu.c: Dinky routines to look for the kind of Sparc cpu - * we are on. - * - * Copyright (C) 1996, 2007, 2008 David S. Miller (davem@davemloft.net) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "entry.h" -#include "kernel.h" - -DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; - -struct cpu_chip_info { - unsigned short manuf; - unsigned short impl; - const char *cpu_name; - const char *fp_name; -}; - -static const struct cpu_chip_info cpu_chips[] = { - { - .manuf = 0x17, - .impl = 0x10, - .cpu_name = "TI UltraSparc I (SpitFire)", - .fp_name = "UltraSparc I integrated FPU", - }, - { - .manuf = 0x22, - .impl = 0x10, - .cpu_name = "TI UltraSparc I (SpitFire)", - .fp_name = "UltraSparc I integrated FPU", - }, - { - .manuf = 0x17, - .impl = 0x11, - .cpu_name = "TI UltraSparc II (BlackBird)", - .fp_name = "UltraSparc II integrated FPU", - }, - { - .manuf = 0x17, - .impl = 0x12, - .cpu_name = "TI UltraSparc IIi (Sabre)", - .fp_name = "UltraSparc IIi integrated FPU", - }, - { - .manuf = 0x17, - .impl = 0x13, - .cpu_name = "TI UltraSparc IIe (Hummingbird)", - .fp_name = "UltraSparc IIe integrated FPU", - }, - { - .manuf = 0x3e, - .impl = 0x14, - .cpu_name = "TI UltraSparc III (Cheetah)", - .fp_name = "UltraSparc III integrated FPU", - }, - { - .manuf = 0x3e, - .impl = 0x15, - .cpu_name = "TI UltraSparc III+ (Cheetah+)", - .fp_name = "UltraSparc III+ integrated FPU", - }, - { - .manuf = 0x3e, - .impl = 0x16, - .cpu_name = "TI UltraSparc IIIi (Jalapeno)", - .fp_name = "UltraSparc IIIi integrated FPU", - }, - { - .manuf = 0x3e, - .impl = 0x18, - .cpu_name = "TI UltraSparc IV (Jaguar)", - .fp_name = "UltraSparc IV integrated FPU", - }, - { - .manuf = 0x3e, - .impl = 0x19, - .cpu_name = "TI UltraSparc IV+ (Panther)", - .fp_name = "UltraSparc IV+ integrated FPU", - }, - { - .manuf = 0x3e, - .impl = 0x22, - .cpu_name = "TI UltraSparc IIIi+ (Serrano)", - .fp_name = "UltraSparc IIIi+ integrated FPU", - }, -}; - -#define NSPARCCHIPS ARRAY_SIZE(linux_sparc_chips) - -const char *sparc_cpu_type; -const char *sparc_fpu_type; - -static void __init sun4v_cpu_probe(void) -{ - switch (sun4v_chip_type) { - case SUN4V_CHIP_NIAGARA1: - sparc_cpu_type = "UltraSparc T1 (Niagara)"; - sparc_fpu_type = "UltraSparc T1 integrated FPU"; - break; - - case SUN4V_CHIP_NIAGARA2: - sparc_cpu_type = "UltraSparc T2 (Niagara2)"; - sparc_fpu_type = "UltraSparc T2 integrated FPU"; - break; - - default: - printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n", - prom_cpu_compatible); - sparc_cpu_type = "Unknown SUN4V CPU"; - sparc_fpu_type = "Unknown SUN4V FPU"; - break; - } -} - -static const struct cpu_chip_info * __init find_cpu_chip(unsigned short manuf, - unsigned short impl) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(cpu_chips); i++) { - const struct cpu_chip_info *p = &cpu_chips[i]; - - if (p->manuf == manuf && p->impl == impl) - return p; - } - return NULL; -} - -static int __init cpu_type_probe(void) -{ - if (tlb_type == hypervisor) { - sun4v_cpu_probe(); - } else { - unsigned long ver, manuf, impl; - const struct cpu_chip_info *p; - - __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver)); - - manuf = ((ver >> 48) & 0xffff); - impl = ((ver >> 32) & 0xffff); - - p = find_cpu_chip(manuf, impl); - if (p) { - sparc_cpu_type = p->cpu_name; - sparc_fpu_type = p->fp_name; - } else { - printk(KERN_ERR "CPU: Unknown chip, manuf[%lx] impl[%lx]\n", - manuf, impl); - sparc_cpu_type = "Unknown CPU"; - sparc_fpu_type = "Unknown FPU"; - } - } - return 0; -} - -arch_initcall(cpu_type_probe); From bf944c370ab181ada51c0754a2d13ae8543b149a Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Sun, 7 Dec 2008 00:46:33 -0800 Subject: [PATCH 71/98] sparc: Restore irq_trans_init() call in prom_create_node(). This broke sparc64 in various ways. Add an empty dummy hook in sparc32's prom_32.c so that we can potentially handle things on that side similarly, and in particular avoid a prom_common.c ifdef :-) Signed-off-by: David S. Miller --- arch/sparc/kernel/prom.h | 3 --- arch/sparc/kernel/prom_32.c | 4 ++++ arch/sparc/kernel/prom_common.c | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h index 0764b354b52c..bb0f0fda6cab 100644 --- a/arch/sparc/kernel/prom.h +++ b/arch/sparc/kernel/prom.h @@ -8,10 +8,7 @@ extern struct device_node *allnodes; /* temporary while merging */ extern rwlock_t devtree_lock; /* temporary while merging */ extern void * prom_early_alloc(unsigned long size); - -#ifdef CONFIG_SPARC64 extern void irq_trans_init(struct device_node *dp); -#endif extern unsigned int prom_unique_id; diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index f21e8fc9a8fb..fe43e80772db 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c @@ -289,3 +289,7 @@ void __init of_console_init(void) void __init of_fill_in_cpu_data(void) { } + +void __init irq_trans_init(struct device_node *dp) +{ +} diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index 2736f3d74c7f..4e9af593db49 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c @@ -243,10 +243,10 @@ static struct device_node * __init prom_create_node(phandle node, dp->type = get_one_property(node, "device_type"); dp->node = node; - /* Build interrupts later... */ - dp->properties = build_prop_list(node); + irq_trans_init(dp); + return dp; } From 7d3a70012005a9bcaebb5f44d5546376b9c6daa9 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 7 Dec 2008 00:49:53 -0800 Subject: [PATCH 72/98] sparc: idprom_32.c cleanup o Use C99 initializer for struct members o fix code style issues o Add KERN_WARNING to all printk o Update prints to match sparc64 Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/idprom_32.c | 50 ++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/arch/sparc/kernel/idprom_32.c b/arch/sparc/kernel/idprom_32.c index 223a6582e1e2..3e2fe0972428 100644 --- a/arch/sparc/kernel/idprom_32.c +++ b/arch/sparc/kernel/idprom_32.c @@ -11,35 +11,36 @@ #include #include -#include /* Fun with Sun released architectures. */ struct idprom *idprom; static struct idprom idprom_buffer; +#include /* Fun with Sun released architectures. */ + /* Here is the master table of Sun machines which use some implementation * of the Sparc CPU and have a meaningful IDPROM machtype value that we * know about. See asm-sparc/machines.h for empirical constants. */ static struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = { /* First, Sun4's */ -{ "Sun 4/100 Series", (SM_SUN4 | SM_4_110) }, -{ "Sun 4/200 Series", (SM_SUN4 | SM_4_260) }, -{ "Sun 4/300 Series", (SM_SUN4 | SM_4_330) }, -{ "Sun 4/400 Series", (SM_SUN4 | SM_4_470) }, +{ .name = "Sun 4/100 Series", .id_machtype = (SM_SUN4 | SM_4_110) }, +{ .name = "Sun 4/200 Series", .id_machtype = (SM_SUN4 | SM_4_260) }, +{ .name = "Sun 4/300 Series", .id_machtype = (SM_SUN4 | SM_4_330) }, +{ .name = "Sun 4/400 Series", .id_machtype = (SM_SUN4 | SM_4_470) }, /* Now, Sun4c's */ -{ "Sun4c SparcStation 1", (SM_SUN4C | SM_4C_SS1) }, -{ "Sun4c SparcStation IPC", (SM_SUN4C | SM_4C_IPC) }, -{ "Sun4c SparcStation 1+", (SM_SUN4C | SM_4C_SS1PLUS) }, -{ "Sun4c SparcStation SLC", (SM_SUN4C | SM_4C_SLC) }, -{ "Sun4c SparcStation 2", (SM_SUN4C | SM_4C_SS2) }, -{ "Sun4c SparcStation ELC", (SM_SUN4C | SM_4C_ELC) }, -{ "Sun4c SparcStation IPX", (SM_SUN4C | SM_4C_IPX) }, +{ .name = "Sun4c SparcStation 1", .id_machtype = (SM_SUN4C | SM_4C_SS1) }, +{ .name = "Sun4c SparcStation IPC", .id_machtype = (SM_SUN4C | SM_4C_IPC) }, +{ .name = "Sun4c SparcStation 1+", .id_machtype = (SM_SUN4C | SM_4C_SS1PLUS) }, +{ .name = "Sun4c SparcStation SLC", .id_machtype = (SM_SUN4C | SM_4C_SLC) }, +{ .name = "Sun4c SparcStation 2", .id_machtype = (SM_SUN4C | SM_4C_SS2) }, +{ .name = "Sun4c SparcStation ELC", .id_machtype = (SM_SUN4C | SM_4C_ELC) }, +{ .name = "Sun4c SparcStation IPX", .id_machtype = (SM_SUN4C | SM_4C_IPX) }, /* Finally, early Sun4m's */ -{ "Sun4m SparcSystem600", (SM_SUN4M | SM_4M_SS60) }, -{ "Sun4m SparcStation10/20", (SM_SUN4M | SM_4M_SS50) }, -{ "Sun4m SparcStation5", (SM_SUN4M | SM_4M_SS40) }, +{ .name = "Sun4m SparcSystem600", .id_machtype = (SM_SUN4M | SM_4M_SS60) }, +{ .name = "Sun4m SparcStation10/20", .id_machtype = (SM_SUN4M | SM_4M_SS50) }, +{ .name = "Sun4m SparcStation5", .id_machtype = (SM_SUN4M | SM_4M_SS40) }, /* One entry for the OBP arch's which are sun4d, sun4e, and newer sun4m's */ -{ "Sun4M OBP based system", (SM_SUN4M_OBP | 0x0) } }; +{ .name = "Sun4M OBP based system", .id_machtype = (SM_SUN4M_OBP | 0x0) } }; static void __init display_system_type(unsigned char machtype) { @@ -47,18 +48,19 @@ static void __init display_system_type(unsigned char machtype) register int i; for (i = 0; i < NUM_SUN_MACHINES; i++) { - if(Sun_Machines[i].id_machtype == machtype) { + if (Sun_Machines[i].id_machtype == machtype) { if (machtype != (SM_SUN4M_OBP | 0x00) || prom_getproperty(prom_root_node, "banner-name", sysname, sizeof(sysname)) <= 0) - printk("TYPE: %s\n", Sun_Machines[i].name); + printk(KERN_WARNING "TYPE: %s\n", + Sun_Machines[i].name); else - printk("TYPE: %s\n", sysname); + printk(KERN_WARNING "TYPE: %s\n", sysname); return; } } - prom_printf("IDPROM: Bogus id_machtype value, 0x%x\n", machtype); + prom_printf("IDPROM: Warning, bogus id_machtype value, 0x%x\n", machtype); prom_halt(); } @@ -80,20 +82,20 @@ void __init idprom_init(void) idprom = &idprom_buffer; - if (idprom->id_format != 0x01) { - prom_printf("IDPROM: Unknown format type!\n"); + if (idprom->id_format != 0x01) { + prom_printf("IDPROM: Warning, unknown format type!\n"); prom_halt(); } if (idprom->id_cksum != calc_idprom_cksum(idprom)) { - prom_printf("IDPROM: Checksum failure (nvram=%x, calc=%x)!\n", + prom_printf("IDPROM: Warning, checksum failure (nvram=%x, calc=%x)!\n", idprom->id_cksum, calc_idprom_cksum(idprom)); prom_halt(); } display_system_type(idprom->id_machtype); - printk("Ethernet address: %x:%x:%x:%x:%x:%x\n", + printk(KERN_WARNING "Ethernet address: %02x:%02x:%02x:%02x:%02x:%02x\n", idprom->id_ethaddr[0], idprom->id_ethaddr[1], idprom->id_ethaddr[2], idprom->id_ethaddr[3], idprom->id_ethaddr[4], idprom->id_ethaddr[5]); From 680e58f809fee29cb81b15ec44fedc09aabaa698 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 7 Dec 2008 00:50:29 -0800 Subject: [PATCH 73/98] sparc: unify kernel/idprom.c o in sparc32 variant removed prom_halt in warning situations o ifdef out sparc32 specific code Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/Makefile | 2 +- arch/sparc/kernel/{idprom_32.c => idprom.c} | 16 +++---- arch/sparc/kernel/idprom_64.c | 49 --------------------- 3 files changed, 9 insertions(+), 58 deletions(-) rename arch/sparc/kernel/{idprom_32.c => idprom.c} (95%) delete mode 100644 arch/sparc/kernel/idprom_64.c diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 0ba314b7f111..59aab6a81e89 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -22,7 +22,7 @@ obj-y += process_$(BITS).o obj-y += signal_$(BITS).o obj-$(CONFIG_SPARC32) += ioport.o obj-y += setup_$(BITS).o -obj-y += idprom_$(BITS).o +obj-y += idprom.o obj-y += sys_sparc_$(BITS).o obj-$(CONFIG_SPARC32) += systbls_32.o obj-y += time_$(BITS).o diff --git a/arch/sparc/kernel/idprom_32.c b/arch/sparc/kernel/idprom.c similarity index 95% rename from arch/sparc/kernel/idprom_32.c rename to arch/sparc/kernel/idprom.c index 3e2fe0972428..1b0bd9120c1c 100644 --- a/arch/sparc/kernel/idprom_32.c +++ b/arch/sparc/kernel/idprom.c @@ -15,6 +15,7 @@ struct idprom *idprom; static struct idprom idprom_buffer; +#ifdef CONFIG_SPARC32 #include /* Fun with Sun released architectures. */ /* Here is the master table of Sun machines which use some implementation @@ -61,9 +62,12 @@ static void __init display_system_type(unsigned char machtype) } prom_printf("IDPROM: Warning, bogus id_machtype value, 0x%x\n", machtype); - prom_halt(); } - +#else +static void __init display_system_type(unsigned char machtype) +{ +} +#endif /* Calculate the IDPROM checksum (xor of the data bytes). */ static unsigned char __init calc_idprom_cksum(struct idprom *idprom) { @@ -82,16 +86,12 @@ void __init idprom_init(void) idprom = &idprom_buffer; - if (idprom->id_format != 0x01) { + if (idprom->id_format != 0x01) prom_printf("IDPROM: Warning, unknown format type!\n"); - prom_halt(); - } - if (idprom->id_cksum != calc_idprom_cksum(idprom)) { + if (idprom->id_cksum != calc_idprom_cksum(idprom)) prom_printf("IDPROM: Warning, checksum failure (nvram=%x, calc=%x)!\n", idprom->id_cksum, calc_idprom_cksum(idprom)); - prom_halt(); - } display_system_type(idprom->id_machtype); diff --git a/arch/sparc/kernel/idprom_64.c b/arch/sparc/kernel/idprom_64.c deleted file mode 100644 index 5b45a808c621..000000000000 --- a/arch/sparc/kernel/idprom_64.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * idprom.c: Routines to load the idprom into kernel addresses and - * interpret the data contained within. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - */ - -#include -#include -#include - -#include -#include - -struct idprom *idprom; -static struct idprom idprom_buffer; - -/* Calculate the IDPROM checksum (xor of the data bytes). */ -static unsigned char __init calc_idprom_cksum(struct idprom *idprom) -{ - unsigned char cksum, i, *ptr = (unsigned char *)idprom; - - for (i = cksum = 0; i <= 0x0E; i++) - cksum ^= *ptr++; - - return cksum; -} - -/* Create a local IDPROM copy and verify integrity. */ -void __init idprom_init(void) -{ - prom_get_idprom((char *) &idprom_buffer, sizeof(idprom_buffer)); - - idprom = &idprom_buffer; - - if (idprom->id_format != 0x01) { - prom_printf("IDPROM: Warning, unknown format type!\n"); - } - - if (idprom->id_cksum != calc_idprom_cksum(idprom)) { - prom_printf("IDPROM: Warning, checksum failure (nvram=%x, calc=%x)!\n", - idprom->id_cksum, calc_idprom_cksum(idprom)); - } - - printk("Ethernet address: %02x:%02x:%02x:%02x:%02x:%02x\n", - idprom->id_ethaddr[0], idprom->id_ethaddr[1], - idprom->id_ethaddr[2], idprom->id_ethaddr[3], - idprom->id_ethaddr[4], idprom->id_ethaddr[5]); -} From 89b409f77017171c55e79628eefc557126c8fd7f Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 8 Dec 2008 01:00:08 -0800 Subject: [PATCH 74/98] cyber2000fb: Kill the one modular sparc prom_printf call. Noticed by Robert Reif and Sam Ravnborg. Signed-off-by: David S. Miller --- drivers/video/cyber2000fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c index 41d62632dcdb..39d5d643a50b 100644 --- a/drivers/video/cyber2000fb.c +++ b/drivers/video/cyber2000fb.c @@ -1513,7 +1513,7 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb) iop = ioremap(0x3000000, 0x5000); if (iop == NULL) { - prom_printf("iga5000: cannot map I/O\n"); + printk(KERN_ERR "iga5000: cannot map I/O\n"); return -ENOMEM; } From efe6c3dd8b7df809d46fb521eb9af471c47ed608 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Mon, 8 Dec 2008 00:59:17 -0800 Subject: [PATCH 75/98] sparc: Use sparc64 version of prom/printf.c Use sparc64 version of prom/printf.c. The only differences for sparc32 is that prom_printf is no longer exported for modules which should be OK. Signed-off-by: Robert Reif Signed-off-by: David S. Miller --- arch/sparc/include/asm/oplib_32.h | 2 +- arch/sparc/prom/Makefile | 2 +- arch/sparc/prom/{printf_64.c => printf.c} | 0 arch/sparc/prom/printf_32.c | 48 ----------------------- 4 files changed, 2 insertions(+), 50 deletions(-) rename arch/sparc/prom/{printf_64.c => printf.c} (100%) delete mode 100644 arch/sparc/prom/printf_32.c diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h index 3bdf56f46883..73d45521db04 100644 --- a/arch/sparc/include/asm/oplib_32.h +++ b/arch/sparc/include/asm/oplib_32.h @@ -136,7 +136,7 @@ extern char prom_getchar(void); extern void prom_putchar(char character); /* Prom's internal routines, don't use in kernel/boot code. */ -extern void prom_printf(char *fmt, ...); +extern void prom_printf(const char *fmt, ...); extern void prom_write(const char *buf, unsigned int len); /* Multiprocessor operations... */ diff --git a/arch/sparc/prom/Makefile b/arch/sparc/prom/Makefile index f8e0278b8b4f..1b8c073adb44 100644 --- a/arch/sparc/prom/Makefile +++ b/arch/sparc/prom/Makefile @@ -15,7 +15,7 @@ lib-$(CONFIG_SPARC32) += palloc.o lib-$(CONFIG_SPARC32) += ranges.o lib-$(CONFIG_SPARC32) += segment.o lib-y += console_$(BITS).o -lib-y += printf_$(BITS).o +lib-y += printf.o lib-y += tree_$(BITS).o lib-$(CONFIG_SPARC64) += p1275.o lib-$(CONFIG_SPARC64) += cif.o diff --git a/arch/sparc/prom/printf_64.c b/arch/sparc/prom/printf.c similarity index 100% rename from arch/sparc/prom/printf_64.c rename to arch/sparc/prom/printf.c diff --git a/arch/sparc/prom/printf_32.c b/arch/sparc/prom/printf_32.c deleted file mode 100644 index a36ab9c5ee08..000000000000 --- a/arch/sparc/prom/printf_32.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * printf.c: Internal prom library printf facility. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com) - * - * We used to warn all over the code: DO NOT USE prom_printf(), - * and yet people do. Anton's banking code was outputting banks - * with prom_printf for most of the 2.4 lifetime. Since an effective - * stick is not available, we deployed a carrot: an early printk - * through PROM by means of -p boot option. This ought to fix it. - * USE printk; if you need, deploy -p. - */ - -#include -#include - -#include -#include - -static char ppbuf[1024]; - -void -prom_write(const char *buf, unsigned int n) -{ - char ch; - - while (n != 0) { - --n; - if ((ch = *buf++) == '\n') - prom_putchar('\r'); - prom_putchar(ch); - } -} - -void -prom_printf(char *fmt, ...) -{ - va_list args; - int i; - - va_start(args, fmt); - i = vscnprintf(ppbuf, sizeof(ppbuf), fmt, args); - va_end(args); - - prom_write(ppbuf, i); -} -EXPORT_SYMBOL(prom_printf); From 39f6649b61536138fd16188c1a8dd30795a3696a Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 8 Dec 2008 01:02:23 -0800 Subject: [PATCH 76/98] sparc: fix sparse warning in kernel/pmc.c Fix following warning: arch/sparc/kernel/pmc.c:41:6: warning: symbol 'pmc_swift_idle' was not declared. Should it be static? It was not used outside this file - make it static Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/pmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c index 2afcfab4f11c..33cd4998eb04 100644 --- a/arch/sparc/kernel/pmc.c +++ b/arch/sparc/kernel/pmc.c @@ -38,7 +38,7 @@ static u8 __iomem *regs; * CPU idle callback function * See .../arch/sparc/kernel/process.c */ -void pmc_swift_idle(void) +static void pmc_swift_idle(void) { #ifdef PMC_DEBUG_LED set_auxio(0x00, AUXIO_LED); From 85bfbf44c37e403d4fcbcd630b3ca2377b156485 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 8 Dec 2008 01:02:55 -0800 Subject: [PATCH 77/98] sparc: fix trivial style issues in kernel/pmc.c o drop trailing whitespaces o align a fix things properly Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/pmc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c index 33cd4998eb04..5e4563d86f19 100644 --- a/arch/sparc/kernel/pmc.c +++ b/arch/sparc/kernel/pmc.c @@ -24,32 +24,32 @@ */ #define PMC_OBPNAME "SUNW,pmc" -#define PMC_DEVNAME "pmc" +#define PMC_DEVNAME "pmc" #define PMC_IDLE_REG 0x00 -#define PMC_IDLE_ON 0x01 +#define PMC_IDLE_ON 0x01 static u8 __iomem *regs; #define pmc_readb(offs) (sbus_readb(regs+offs)) -#define pmc_writeb(val, offs) (sbus_writeb(val, regs+offs)) +#define pmc_writeb(val, offs) (sbus_writeb(val, regs+offs)) -/* +/* * CPU idle callback function * See .../arch/sparc/kernel/process.c */ static void pmc_swift_idle(void) { #ifdef PMC_DEBUG_LED - set_auxio(0x00, AUXIO_LED); + set_auxio(0x00, AUXIO_LED); #endif pmc_writeb(pmc_readb(PMC_IDLE_REG) | PMC_IDLE_ON, PMC_IDLE_REG); #ifdef PMC_DEBUG_LED - set_auxio(AUXIO_LED, 0x00); + set_auxio(AUXIO_LED, 0x00); #endif -} +} static int __devinit pmc_probe(struct of_device *op, const struct of_device_id *match) @@ -63,7 +63,7 @@ static int __devinit pmc_probe(struct of_device *op, #ifndef PMC_NO_IDLE /* Assign power management IDLE handler */ - pm_idle = pmc_swift_idle; + pm_idle = pmc_swift_idle; #endif printk(KERN_INFO "%s: power management initialized\n", PMC_DEVNAME); From 8d74e32a537e8dbb22a1d5e9005d11111dab979a Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 8 Dec 2008 01:04:59 -0800 Subject: [PATCH 78/98] sparc: fix sparse warnings in traps_32.c o add decalrations to entry.h for functions only used from assembler o add declaratiosn to kernel.h for functions only used from .c o removed unused functions/extern declarations Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/entry.h | 35 +++++++++++++++++++++++++++++++++++ arch/sparc/kernel/kernel.h | 9 +++++++++ arch/sparc/kernel/muldiv.c | 5 ++--- arch/sparc/kernel/traps_32.c | 34 +++------------------------------- 4 files changed, 49 insertions(+), 34 deletions(-) diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h index a9ab19aa0411..06db4f18e453 100644 --- a/arch/sparc/kernel/entry.h +++ b/arch/sparc/kernel/entry.h @@ -5,6 +5,40 @@ #include #include +#ifdef CONFIG_SPARC32 +/* traps */ +extern void do_hw_interrupt(struct pt_regs *regs, unsigned long type); +extern void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, + unsigned long npc, unsigned long psr); + +extern void do_priv_instruction(struct pt_regs *regs, unsigned long pc, + unsigned long npc, unsigned long psr); +extern void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc, + unsigned long npc, + unsigned long psr); +extern void do_fpd_trap(struct pt_regs *regs, unsigned long pc, + unsigned long npc, unsigned long psr); +extern void do_fpe_trap(struct pt_regs *regs, unsigned long pc, + unsigned long npc, unsigned long psr); +extern void handle_tag_overflow(struct pt_regs *regs, unsigned long pc, + unsigned long npc, unsigned long psr); +extern void handle_watchpoint(struct pt_regs *regs, unsigned long pc, + unsigned long npc, unsigned long psr); +extern void handle_reg_access(struct pt_regs *regs, unsigned long pc, + unsigned long npc, unsigned long psr); +extern void handle_cp_disabled(struct pt_regs *regs, unsigned long pc, + unsigned long npc, unsigned long psr); +extern void handle_cp_exception(struct pt_regs *regs, unsigned long pc, + unsigned long npc, unsigned long psr); + + + +/* entry.S */ +extern void fpsave(unsigned long *fpregs, unsigned long *fsr, + void *fpqueue, unsigned long *fpqdepth); +extern void fpload(unsigned long *fpregs, unsigned long *fsr); + +#else /* CONFIG_SPARC32 */ extern void __init per_cpu_patch(void); extern void __init sun4v_patch(void); extern void __init boot_cpu_id_too_large(int cpu); @@ -189,4 +223,5 @@ extern void handler_irq(int irq, struct pt_regs *regs); extern void init_irqwork_curcpu(void); extern void __cpuinit sun4v_register_mondo_queues(int this_cpu); +#endif /* CONFIG_SPARC32 */ #endif /* _ENTRY_H */ diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index 7f02aad2e1ab..3fa833843a00 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h @@ -4,5 +4,14 @@ extern const char *sparc_fpu_type; extern unsigned int fsr_storage; +#ifdef CONFIG_SPARC32 +/* cpu.c */ extern void cpu_probe(void); +/* traps_32.c */ +extern void handle_hw_divzero(struct pt_regs *regs, unsigned long pc, + unsigned long npc, unsigned long psr); +/* muldiv.c */ +extern int do_user_muldiv (struct pt_regs *, unsigned long); +#else /* CONFIG_SPARC32 */ +#endif diff --git a/arch/sparc/kernel/muldiv.c b/arch/sparc/kernel/muldiv.c index e352239e72c8..ba960c02bb55 100644 --- a/arch/sparc/kernel/muldiv.c +++ b/arch/sparc/kernel/muldiv.c @@ -17,6 +17,8 @@ #include #include +#include "kernel.h" + /* #define DEBUG_MULDIV */ static inline int has_imm13(int insn) @@ -88,9 +90,6 @@ store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs) return (put_user(result, &win->locals[reg - 16])); } } - -extern void handle_hw_divzero (struct pt_regs *regs, unsigned long pc, - unsigned long npc, unsigned long psr); /* Should return 0 if mul/div emulation succeeded and SIGILL should * not be issued. diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c index 2b7d50659036..716f3946c494 100644 --- a/arch/sparc/kernel/traps_32.c +++ b/arch/sparc/kernel/traps_32.c @@ -25,32 +25,11 @@ #include #include +#include "entry.h" +#include "kernel.h" + /* #define TRAP_DEBUG */ -struct trap_trace_entry { - unsigned long pc; - unsigned long type; -}; - -void syscall_trace_entry(struct pt_regs *regs) -{ - printk("%s[%d]: ", current->comm, task_pid_nr(current)); - printk("scall<%d> (could be %d)\n", (int) regs->u_regs[UREG_G1], - (int) regs->u_regs[UREG_I0]); -} - -void syscall_trace_exit(struct pt_regs *regs) -{ -} - -void sun4d_nmi(struct pt_regs *regs) -{ - printk("Aieee: sun4d NMI received!\n"); - printk("you lose buddy boy...\n"); - show_regs(regs); - prom_halt(); -} - static void instruction_dump(unsigned long *pc) { int i; @@ -134,7 +113,6 @@ void do_hw_interrupt(struct pt_regs *regs, unsigned long type) void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, unsigned long npc, unsigned long psr) { - extern int do_user_muldiv (struct pt_regs *, unsigned long); siginfo_t info; if(psr & PSR_PS) @@ -195,10 +173,6 @@ void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc, unsigned lon send_sig_info(SIGBUS, &info, current); } -extern void fpsave(unsigned long *fpregs, unsigned long *fsr, - void *fpqueue, unsigned long *fpqdepth); -extern void fpload(unsigned long *fpregs, unsigned long *fsr); - static unsigned long init_fsr = 0x0UL; static unsigned long init_fregs[32] __attribute__ ((aligned (8))) = { ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, @@ -456,8 +430,6 @@ void do_BUG(const char *file, int line) * up here so that timer interrupts work during initialization. */ -extern void sparc_cpu_startup(void); - void trap_init(void) { extern void thread_info_offsets_are_bolixed_pete(void); From 7105de84f1cb5ef640bfe4b8b137837c346caab5 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 8 Dec 2008 01:07:47 -0800 Subject: [PATCH 79/98] sparc: add include guards to kernel.h Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/kernel.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index 3fa833843a00..48e703714baa 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h @@ -1,3 +1,5 @@ +#ifndef __SPARC_KERNEL_H +#define __SPARC_KERNEL_H /* cpu.c */ extern const char *sparc_cpu_type; extern const char *sparc_fpu_type; @@ -14,4 +16,5 @@ extern void handle_hw_divzero(struct pt_regs *regs, unsigned long pc, /* muldiv.c */ extern int do_user_muldiv (struct pt_regs *, unsigned long); #else /* CONFIG_SPARC32 */ -#endif +#endif /* CONFIG_SPARC32 */ +#endif /* !(__SPARC_KERNEL_H) */ From 81265fd93bc40c7c43fd36796571786ae3df00e0 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 8 Dec 2008 01:08:24 -0800 Subject: [PATCH 80/98] sparc: fix sparse warnings in irq_32.c Fix following sparse warnings: symbol 'static_irqaction' was not declared. Should it be static? symbol 'static_irq_count' was not declared. Should it be static? symbol 'irq_action_lock' was not declared. Should it be static? symbol 'unexpected_irq' was not declared. Should it be static? symbol 'handler_irq' was not declared. Should it be static? returning void-valued expression returning void-valued expression returning void-valued expression symbol 'init_IRQ' was not declared. Should it be static? Warnings were fixed by addding proper declarations and fixing return path of a few functions. There remains several warnings all related to the floppy driver. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/include/asm/irq_32.h | 1 + arch/sparc/kernel/entry.h | 4 +++- arch/sparc/kernel/irq_32.c | 7 ++++--- arch/sparc/kernel/kernel.h | 11 +++++++++++ arch/sparc/kernel/sun4d_irq.c | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/arch/sparc/include/asm/irq_32.h b/arch/sparc/include/asm/irq_32.h index fe205cc444b8..ea43057d4763 100644 --- a/arch/sparc/include/asm/irq_32.h +++ b/arch/sparc/include/asm/irq_32.h @@ -12,4 +12,5 @@ #define irq_canonicalize(irq) (irq) +extern void __init init_IRQ(void); #endif diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h index 06db4f18e453..4f53a2395ac6 100644 --- a/arch/sparc/kernel/entry.h +++ b/arch/sparc/kernel/entry.h @@ -5,6 +5,9 @@ #include #include +/* irq */ +extern void handler_irq(int irq, struct pt_regs *regs); + #ifdef CONFIG_SPARC32 /* traps */ extern void do_hw_interrupt(struct pt_regs *regs, unsigned long type); @@ -219,7 +222,6 @@ struct ino_bucket { extern struct ino_bucket *ivector_table; extern unsigned long ivector_table_pa; -extern void handler_irq(int irq, struct pt_regs *regs); extern void init_irqwork_curcpu(void); extern void __cpuinit sun4v_register_mondo_queues(int this_cpu); diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c index 93e1d1c65290..f3488c45d57a 100644 --- a/arch/sparc/kernel/irq_32.c +++ b/arch/sparc/kernel/irq_32.c @@ -46,6 +46,7 @@ #include #include +#include "kernel.h" #include "irq.h" #ifdef CONFIG_SMP @@ -592,19 +593,19 @@ EXPORT_SYMBOL(request_irq); void disable_irq_nosync(unsigned int irq) { - return __disable_irq(irq); + __disable_irq(irq); } EXPORT_SYMBOL(disable_irq_nosync); void disable_irq(unsigned int irq) { - return __disable_irq(irq); + __disable_irq(irq); } EXPORT_SYMBOL(disable_irq); void enable_irq(unsigned int irq) { - return __enable_irq(irq); + __enable_irq(irq); } EXPORT_SYMBOL(enable_irq); diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index 48e703714baa..81a972e8d8ea 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h @@ -1,5 +1,8 @@ #ifndef __SPARC_KERNEL_H #define __SPARC_KERNEL_H + +#include + /* cpu.c */ extern const char *sparc_cpu_type; extern const char *sparc_fpu_type; @@ -15,6 +18,14 @@ extern void handle_hw_divzero(struct pt_regs *regs, unsigned long pc, unsigned long npc, unsigned long psr); /* muldiv.c */ extern int do_user_muldiv (struct pt_regs *, unsigned long); + +/* irq_32.c */ +extern struct irqaction static_irqaction[]; +extern int static_irq_count; +extern spinlock_t irq_action_lock; + +extern void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs); + #else /* CONFIG_SPARC32 */ #endif /* CONFIG_SPARC32 */ #endif /* !(__SPARC_KERNEL_H) */ diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c index 1c98821e1a64..3369fef5b4b3 100644 --- a/arch/sparc/kernel/sun4d_irq.c +++ b/arch/sparc/kernel/sun4d_irq.c @@ -40,6 +40,7 @@ #include #include +#include "kernel.h" #include "irq.h" /* If you trust current SCSI layer to handle different SCSI IRQs, enable this. I don't trust it... -jj */ @@ -58,7 +59,6 @@ static struct sun4d_timer_regs __iomem *sun4d_timers; #define TIMER_IRQ 10 #define MAX_STATIC_ALLOC 4 -extern struct irqaction static_irqaction[MAX_STATIC_ALLOC]; extern int static_irq_count; static unsigned char sbus_tid[32]; From 8e757281defc3e45df0df8e4610f57e8ebfd7f5f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 8 Dec 2008 01:10:08 -0800 Subject: [PATCH 81/98] sparc: replace for_each_cpu_mask_nr with for_each_cpu Simple replacement, now the _nr is redundant. Signed-off-by: Rusty Russell Signed-off-by: Mike Travis Signed-off-by: David S. Miller --- arch/sparc/kernel/smp_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index b5225c81556c..bfe99d82d458 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c @@ -773,7 +773,7 @@ static void xcall_deliver(u64 data0, u64 data1, u64 data2, const cpumask_t *mask /* Setup the initial cpu list. */ cnt = 0; - for_each_cpu_mask_nr(i, *mask) { + for_each_cpu(i, mask) { if (i == this_cpu || !cpu_online(i)) continue; cpu_list[cnt++] = i; From 8bf68e4d90c4ad862356679ab616726eee1abf93 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 8 Dec 2008 16:05:49 -0800 Subject: [PATCH 82/98] sparc: Kill memcmp_32.S code which has been ifdef'd out for centuries. Signed-off-by: David S. Miller --- arch/sparc/lib/memcmp_32.S | 282 ------------------------------------- 1 file changed, 282 deletions(-) diff --git a/arch/sparc/lib/memcmp_32.S b/arch/sparc/lib/memcmp_32.S index cb4bdb0cc2af..9e21f0282659 100644 --- a/arch/sparc/lib/memcmp_32.S +++ b/arch/sparc/lib/memcmp_32.S @@ -3,7 +3,6 @@ .global __memcmp, memcmp __memcmp: memcmp: -#if 1 cmp %o2, 0 ble L3 mov 0, %g3 @@ -29,284 +28,3 @@ L3: retl nop -#else - save %sp, -104, %sp - mov %i2, %o4 - mov %i0, %o0 - - cmp %o4, 15 - ble L72 - mov %i1, %i2 - - andcc %i2, 3, %g0 - be L161 - andcc %o0, 3, %g2 -L75: - ldub [%o0], %g3 - ldub [%i2], %g2 - add %o0,1, %o0 - - subcc %g3, %g2, %i0 - bne L156 - add %i2, 1, %i2 - - andcc %i2, 3, %g0 - bne L75 - add %o4, -1, %o4 - - andcc %o0, 3, %g2 -L161: - bne,a L78 - mov %i2, %i1 - - mov %o0, %i5 - mov %i2, %i3 - srl %o4, 2, %i4 - - cmp %i4, 0 - bge L93 - mov %i4, %g2 - - add %i4, 3, %g2 -L93: - sra %g2, 2, %g2 - sll %g2, 2, %g2 - sub %i4, %g2, %g2 - - cmp %g2, 1 - be,a L88 - add %o0, 4, %i5 - - bg L94 - cmp %g2, 2 - - cmp %g2, 0 - be,a L86 - ld [%o0], %g3 - - b L162 - ld [%i5], %g3 -L94: - be L81 - cmp %g2, 3 - - be,a L83 - add %o0, -4, %i5 - - b L162 - ld [%i5], %g3 -L81: - add %o0, -8, %i5 - ld [%o0], %g3 - add %i2, -8, %i3 - ld [%i2], %g2 - - b L82 - add %i4, 2, %i4 -L83: - ld [%o0], %g4 - add %i2, -4, %i3 - ld [%i2], %g1 - - b L84 - add %i4, 1, %i4 -L86: - b L87 - ld [%i2], %g2 -L88: - add %i2, 4, %i3 - ld [%o0], %g4 - add %i4, -1, %i4 - ld [%i2], %g1 -L95: - ld [%i5], %g3 -L162: - cmp %g4, %g1 - be L87 - ld [%i3], %g2 - - cmp %g4, %g1 -L163: - bleu L114 - mov -1, %i0 - - b L114 - mov 1, %i0 -L87: - ld [%i5 + 4], %g4 - cmp %g3, %g2 - bne L163 - ld [%i3 + 4], %g1 -L84: - ld [%i5 + 8], %g3 - - cmp %g4, %g1 - bne L163 - ld [%i3 + 8], %g2 -L82: - ld [%i5 + 12], %g4 - cmp %g3, %g2 - bne L163 - ld [%i3 + 12], %g1 - - add %i5, 16, %i5 - - addcc %i4, -4, %i4 - bne L95 - add %i3, 16, %i3 - - cmp %g4, %g1 - bne L163 - nop - - b L114 - mov 0, %i0 -L78: - srl %o4, 2, %i0 - and %o0, -4, %i3 - orcc %i0, %g0, %g3 - sll %g2, 3, %o7 - mov 32, %g2 - - bge L129 - sub %g2, %o7, %o1 - - add %i0, 3, %g3 -L129: - sra %g3, 2, %g2 - sll %g2, 2, %g2 - sub %i0, %g2, %g2 - - cmp %g2, 1 - be,a L124 - ld [%i3], %o3 - - bg L130 - cmp %g2, 2 - - cmp %g2, 0 - be,a L122 - ld [%i3], %o2 - - b L164 - sll %o3, %o7, %g3 -L130: - be L117 - cmp %g2, 3 - - be,a L119 - ld [%i3], %g1 - - b L164 - sll %o3, %o7, %g3 -L117: - ld [%i3], %g4 - add %i2, -8, %i1 - ld [%i3 + 4], %o3 - add %i0, 2, %i0 - ld [%i2], %i4 - - b L118 - add %i3, -4, %i3 -L119: - ld [%i3 + 4], %g4 - add %i2, -4, %i1 - ld [%i2], %i5 - - b L120 - add %i0, 1, %i0 -L122: - ld [%i3 + 4], %g1 - ld [%i2], %i4 - - b L123 - add %i3, 4, %i3 -L124: - add %i2, 4, %i1 - ld [%i3 + 4], %o2 - add %i0, -1, %i0 - ld [%i2], %i5 - add %i3, 8, %i3 -L131: - sll %o3, %o7, %g3 -L164: - srl %o2, %o1, %g2 - ld [%i3], %g1 - or %g3, %g2, %g3 - - cmp %g3, %i5 - bne L163 - ld [%i1], %i4 -L123: - sll %o2, %o7, %g3 - srl %g1, %o1, %g2 - ld [%i3 + 4], %g4 - or %g3, %g2, %g3 - - cmp %g3, %i4 - bne L163 - ld [%i1 + 4], %i5 -L120: - sll %g1, %o7, %g3 - srl %g4, %o1, %g2 - ld [%i3 + 8], %o3 - or %g3, %g2, %g3 - - cmp %g3, %i5 - bne L163 - ld [%i1 + 8], %i4 -L118: - sll %g4, %o7, %g3 - srl %o3, %o1, %g2 - ld [%i3 + 12], %o2 - or %g3, %g2, %g3 - - cmp %g3, %i4 - bne L163 - ld [%i1 + 12], %i5 - - add %i3, 16, %i3 - addcc %i0, -4, %i0 - bne L131 - add %i1, 16, %i1 - - sll %o3, %o7, %g3 - srl %o2, %o1, %g2 - or %g3, %g2, %g3 - - cmp %g3, %i5 - be,a L114 - mov 0, %i0 - - b,a L163 -L114: - cmp %i0, 0 - bne L156 - and %o4, -4, %g2 - - add %o0, %g2, %o0 - add %i2, %g2, %i2 - and %o4, 3, %o4 -L72: - cmp %o4, 0 - be L156 - mov 0, %i0 - - ldub [%o0], %g3 -L165: - ldub [%i2], %g2 - add %o0, 1, %o0 - - subcc %g3, %g2, %i0 - bne L156 - add %i2, 1, %i2 - - addcc %o4, -1, %o4 - bne,a L165 - ldub [%o0], %g3 - - mov 0, %i0 -L156: - ret - restore -#endif From 5c03d590910a6ccddc144b382b0ecdb122c349f3 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 9 Dec 2008 00:50:13 -0800 Subject: [PATCH 83/98] sparc: Add asm/asm.h This will contain macros that help share assembler code between the 32-bit and 64-bit platform. Signed-off-by: David S. Miller --- arch/sparc/include/asm/asm.h | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 arch/sparc/include/asm/asm.h diff --git a/arch/sparc/include/asm/asm.h b/arch/sparc/include/asm/asm.h new file mode 100644 index 000000000000..e8e1d94b4cc9 --- /dev/null +++ b/arch/sparc/include/asm/asm.h @@ -0,0 +1,40 @@ +#ifndef _SPARC_ASM_H +#define _SPARC_ASM_H + +/* Macros to assist the sharing of assembler code between 32-bit and + * 64-bit sparc. + */ + +#ifdef CONFIG_SPARC64 +#define BRANCH32(TYPE, PREDICT, DEST) \ + TYPE,PREDICT %icc, DEST +#define BRANCH32_ANNUL(TYPE, PREDICT, DEST) \ + TYPE,a,PREDICT %icc, DEST +#define BRANCH_REG_ZERO(PREDICT, REG, DEST) \ + brz,PREDICT REG, DEST +#define BRANCH_REG_ZERO_ANNUL(PREDICT, REG, DEST) \ + brz,a,PREDICT REG, DEST +#define BRANCH_REG_NOT_ZERO(PREDICT, REG, DEST) \ + brnz,PREDICT REG, DEST +#define BRANCH_REG_NOT_ZERO_ANNUL(PREDICT, REG, DEST) \ + brnz,a,PREDICT REG, DEST +#else +#define BRANCH32(TYPE, PREDICT, DEST) \ + TYPE DEST +#define BRANCH32_ANNUL(TYPE, PREDICT, DEST) \ + TYPE,a DEST +#define BRANCH_REG_ZERO(PREDICT, REG, DEST) \ + cmp REG, 0; \ + be DEST +#define BRANCH_REG_ZERO_ANNUL(PREDICT, REG, DEST) \ + cmp REG, 0; \ + be,a DEST +#define BRANCH_REG_NOT_ZERO(PREDICT, REG, DEST) \ + cmp REG, 0; \ + bne DEST +#define BRANCH_REG_NOT_ZERO_ANNUL(PREDICT, REG, DEST) \ + cmp REG, 0; \ + bne,a DEST +#endif + +#endif /* _SPARC_ASM_H */ From ae984d72e0632782dd98c3fcf469b9045ad0d449 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 9 Dec 2008 01:07:09 -0800 Subject: [PATCH 84/98] sparc: Unify strlen assembler. Use the new asm/asm.h header to help commonize the strlen assembler between 32-bit and 64-bit While we're here, use proper linux/linkage.h macros instead of by-hand stuff. Signed-off-by: David S. Miller --- arch/sparc/lib/Makefile | 2 +- arch/sparc/lib/{strlen_64.S => strlen.S} | 40 ++++++------ arch/sparc/lib/strlen_32.S | 81 ------------------------ 3 files changed, 21 insertions(+), 102 deletions(-) rename arch/sparc/lib/{strlen_64.S => strlen.S} (67%) delete mode 100644 arch/sparc/lib/strlen_32.S diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile index 05ae5c945e35..0db2c61a0f78 100644 --- a/arch/sparc/lib/Makefile +++ b/arch/sparc/lib/Makefile @@ -6,7 +6,7 @@ ccflags-y := -Werror lib-$(CONFIG_SPARC32) += mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o lib-$(CONFIG_SPARC32) += memcpy.o memset.o -lib-y += strlen_$(BITS).o +lib-y += strlen.o lib-y += checksum_$(BITS).o lib-$(CONFIG_SPARC32) += blockops.o lib-y += memscan_$(BITS).o memcmp_$(BITS).o strncmp_$(BITS).o diff --git a/arch/sparc/lib/strlen_64.S b/arch/sparc/lib/strlen.S similarity index 67% rename from arch/sparc/lib/strlen_64.S rename to arch/sparc/lib/strlen.S index e9ba1920d818..536f83507fbf 100644 --- a/arch/sparc/lib/strlen_64.S +++ b/arch/sparc/lib/strlen.S @@ -1,37 +1,38 @@ -/* strlen.S: Sparc64 optimized strlen code +/* strlen.S: Sparc optimized strlen code * Hand optimized from GNU libc's strlen * Copyright (C) 1991,1996 Free Software Foundation - * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) + * Copyright (C) 1996,2008 David S. Miller (davem@davemloft.net) * Copyright (C) 1996, 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) */ +#include +#include + #define LO_MAGIC 0x01010101 #define HI_MAGIC 0x80808080 - .align 32 - .globl strlen - .type strlen,#function -strlen: + .text +ENTRY(strlen) mov %o0, %o1 andcc %o0, 3, %g0 - be,pt %icc, 9f + BRANCH32(be, pt, 9f) sethi %hi(HI_MAGIC), %o4 ldub [%o0], %o5 - brz,pn %o5, 11f + BRANCH_REG_ZERO(pn, %o5, 11f) add %o0, 1, %o0 andcc %o0, 3, %g0 - be,pn %icc, 4f + BRANCH32(be, pn, 4f) or %o4, %lo(HI_MAGIC), %o3 ldub [%o0], %o5 - brz,pn %o5, 12f + BRANCH_REG_ZERO(pn, %o5, 12f) add %o0, 1, %o0 andcc %o0, 3, %g0 - be,pt %icc, 5f + BRANCH32(be, pt, 5f) sethi %hi(LO_MAGIC), %o4 ldub [%o0], %o5 - brz,pn %o5, 13f + BRANCH_REG_ZERO(pn, %o5, 13f) add %o0, 1, %o0 - ba,pt %icc, 8f + BRANCH32(ba, pt, 8f) or %o4, %lo(LO_MAGIC), %o2 9: or %o4, %lo(HI_MAGIC), %o3 @@ -44,24 +45,24 @@ strlen: 2: sub %o5, %o2, %o4 andcc %o4, %o3, %g0 - be,pt %icc, 8b + BRANCH32(be, pt, 8b) add %o0, 4, %o0 /* Check every byte. */ srl %o5, 24, %g7 andcc %g7, 0xff, %g0 - be,pn %icc, 1f + BRANCH32(be, pn, 1f) add %o0, -4, %o4 srl %o5, 16, %g7 andcc %g7, 0xff, %g0 - be,pn %icc, 1f + BRANCH32(be, pn, 1f) add %o4, 1, %o4 srl %o5, 8, %g7 andcc %g7, 0xff, %g0 - be,pn %icc, 1f + BRANCH32(be, pn, 1f) add %o4, 1, %o4 andcc %o5, 0xff, %g0 - bne,a,pt %icc, 2b + BRANCH32_ANNUL(bne, pt, 2b) ld [%o0], %o5 add %o4, 1, %o4 1: @@ -76,5 +77,4 @@ strlen: 13: retl mov 2, %o0 - - .size strlen, .-strlen +ENDPROC(strlen) diff --git a/arch/sparc/lib/strlen_32.S b/arch/sparc/lib/strlen_32.S deleted file mode 100644 index ed9a763368cd..000000000000 --- a/arch/sparc/lib/strlen_32.S +++ /dev/null @@ -1,81 +0,0 @@ -/* strlen.S: Sparc optimized strlen code - * Hand optimized from GNU libc's strlen - * Copyright (C) 1991,1996 Free Software Foundation - * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - */ - -#define LO_MAGIC 0x01010101 -#define HI_MAGIC 0x80808080 - -0: - ldub [%o0], %o5 - cmp %o5, 0 - be 1f - add %o0, 1, %o0 - andcc %o0, 3, %g0 - be 4f - or %o4, %lo(HI_MAGIC), %o3 - ldub [%o0], %o5 - cmp %o5, 0 - be 2f - add %o0, 1, %o0 - andcc %o0, 3, %g0 - be 5f - sethi %hi(LO_MAGIC), %o4 - ldub [%o0], %o5 - cmp %o5, 0 - be 3f - add %o0, 1, %o0 - b 8f - or %o4, %lo(LO_MAGIC), %o2 -1: - retl - mov 0, %o0 -2: - retl - mov 1, %o0 -3: - retl - mov 2, %o0 - - .align 4 - .global strlen -strlen: - mov %o0, %o1 - andcc %o0, 3, %g0 - bne 0b - sethi %hi(HI_MAGIC), %o4 - or %o4, %lo(HI_MAGIC), %o3 -4: - sethi %hi(LO_MAGIC), %o4 -5: - or %o4, %lo(LO_MAGIC), %o2 -8: - ld [%o0], %o5 -2: - sub %o5, %o2, %o4 - andcc %o4, %o3, %g0 - be 8b - add %o0, 4, %o0 - - /* Check every byte. */ - srl %o5, 24, %g5 - andcc %g5, 0xff, %g0 - be 1f - add %o0, -4, %o4 - srl %o5, 16, %g5 - andcc %g5, 0xff, %g0 - be 1f - add %o4, 1, %o4 - srl %o5, 8, %g5 - andcc %g5, 0xff, %g0 - be 1f - add %o4, 1, %o4 - andcc %o5, 0xff, %g0 - bne,a 2b - ld [%o0], %o5 - add %o4, 1, %o4 -1: - retl - sub %o4, %o1, %o0 From 18cdae68e7bb24f33883e58f366cde38ea89ba17 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 9 Dec 2008 04:09:07 -0800 Subject: [PATCH 85/98] sparc: Commonize memcmp assembler. Signed-off-by: David S. Miller --- arch/sparc/kernel/sparc_ksyms_32.c | 2 -- arch/sparc/kernel/sparc_ksyms_64.c | 2 -- arch/sparc/lib/Makefile | 2 +- arch/sparc/lib/memcmp.S | 27 +++++++++++++++++++++++++++ arch/sparc/lib/memcmp_32.S | 30 ------------------------------ arch/sparc/lib/memcmp_64.S | 28 ---------------------------- 6 files changed, 28 insertions(+), 63 deletions(-) create mode 100644 arch/sparc/lib/memcmp.S delete mode 100644 arch/sparc/lib/memcmp_32.S delete mode 100644 arch/sparc/lib/memcmp_64.S diff --git a/arch/sparc/kernel/sparc_ksyms_32.c b/arch/sparc/kernel/sparc_ksyms_32.c index 3c80562faa8a..a4d45fc29b21 100644 --- a/arch/sparc/kernel/sparc_ksyms_32.c +++ b/arch/sparc/kernel/sparc_ksyms_32.c @@ -61,7 +61,6 @@ extern void (*bzero_1page)(void *); extern void *__bzero(void *, size_t); extern void *__memscan_zero(void *, size_t); extern void *__memscan_generic(void *, int, size_t); -extern int __memcmp(const void *, const void *, __kernel_size_t); extern int __strncmp(const char *, const char *, __kernel_size_t); extern int __ashrdi3(int, int); @@ -211,7 +210,6 @@ EXPORT_SYMBOL(bzero_1page); EXPORT_SYMBOL(__bzero); EXPORT_SYMBOL(__memscan_zero); EXPORT_SYMBOL(__memscan_generic); -EXPORT_SYMBOL(__memcmp); EXPORT_SYMBOL(__strncmp); EXPORT_SYMBOL(__memmove); diff --git a/arch/sparc/kernel/sparc_ksyms_64.c b/arch/sparc/kernel/sparc_ksyms_64.c index e6d2bb86a46f..59e7ca0108e9 100644 --- a/arch/sparc/kernel/sparc_ksyms_64.c +++ b/arch/sparc/kernel/sparc_ksyms_64.c @@ -62,7 +62,6 @@ extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); extern void *__bzero(void *, size_t); extern void *__memscan_zero(void *, size_t); extern void *__memscan_generic(void *, int, size_t); -extern int __memcmp(const void *, const void *, __kernel_size_t); extern __kernel_size_t strlen(const char *); extern void sys_sigsuspend(void); extern int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg); @@ -223,7 +222,6 @@ EXPORT_SYMBOL(copy_user_page); EXPORT_SYMBOL(__bzero); EXPORT_SYMBOL(__memscan_zero); EXPORT_SYMBOL(__memscan_generic); -EXPORT_SYMBOL(__memcmp); EXPORT_SYMBOL(__memset); EXPORT_SYMBOL(csum_partial); diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile index 0db2c61a0f78..375016e19144 100644 --- a/arch/sparc/lib/Makefile +++ b/arch/sparc/lib/Makefile @@ -9,7 +9,7 @@ lib-$(CONFIG_SPARC32) += memcpy.o memset.o lib-y += strlen.o lib-y += checksum_$(BITS).o lib-$(CONFIG_SPARC32) += blockops.o -lib-y += memscan_$(BITS).o memcmp_$(BITS).o strncmp_$(BITS).o +lib-y += memscan_$(BITS).o memcmp.o strncmp_$(BITS).o lib-y += strncpy_from_user_$(BITS).o strlen_user_$(BITS).o lib-$(CONFIG_SPARC32) += divdi3.o udivdi3.o lib-$(CONFIG_SPARC32) += copy_user.o locks.o diff --git a/arch/sparc/lib/memcmp.S b/arch/sparc/lib/memcmp.S new file mode 100644 index 000000000000..efa106c41ed0 --- /dev/null +++ b/arch/sparc/lib/memcmp.S @@ -0,0 +1,27 @@ +/* Sparc optimized memcmp code. + * + * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) + * Copyright (C) 2000, 2008 David S. Miller (davem@davemloft.net) + */ + +#include +#include + + .text +ENTRY(memcmp) + cmp %o2, 0 +1: BRANCH32(be, pn, 2f) + nop + ldub [%o0], %g7 + ldub [%o1], %g3 + sub %o2, 1, %o2 + add %o0, 1, %o0 + add %o1, 1, %o1 + subcc %g7, %g3, %g3 + BRANCH32(be, pt, 1b) + cmp %o2, 0 + retl + mov %g3, %o0 +2: retl + mov 0, %o0 +ENDPROC(memcmp) diff --git a/arch/sparc/lib/memcmp_32.S b/arch/sparc/lib/memcmp_32.S deleted file mode 100644 index 9e21f0282659..000000000000 --- a/arch/sparc/lib/memcmp_32.S +++ /dev/null @@ -1,30 +0,0 @@ - .text - .align 4 - .global __memcmp, memcmp -__memcmp: -memcmp: - cmp %o2, 0 - ble L3 - mov 0, %g3 -L5: - ldub [%o0], %g2 - ldub [%o1], %g3 - sub %g2, %g3, %g2 - mov %g2, %g3 - sll %g2, 24, %g2 - - cmp %g2, 0 - bne L3 - add %o0, 1, %o0 - - add %o2, -1, %o2 - - cmp %o2, 0 - bg L5 - add %o1, 1, %o1 -L3: - sll %g3, 24, %o0 - sra %o0, 24, %o0 - - retl - nop diff --git a/arch/sparc/lib/memcmp_64.S b/arch/sparc/lib/memcmp_64.S deleted file mode 100644 index d3fdaa898566..000000000000 --- a/arch/sparc/lib/memcmp_64.S +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Sparc64 optimized memcmp code. - * - * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * Copyright (C) 2000 David S. Miller (davem@redhat.com) - */ - - .text - .align 32 - .globl __memcmp, memcmp -__memcmp: -memcmp: - cmp %o2, 0 ! IEU1 Group -loop: be,pn %icc, ret_0 ! CTI - nop ! IEU0 - ldub [%o0], %g7 ! LSU Group - ldub [%o1], %g3 ! LSU Group - sub %o2, 1, %o2 ! IEU0 - add %o0, 1, %o0 ! IEU1 - add %o1, 1, %o1 ! IEU0 Group - subcc %g7, %g3, %g3 ! IEU1 Group - be,pt %icc, loop ! CTI - cmp %o2, 0 ! IEU1 Group - -ret_n0: retl - mov %g3, %o0 -ret_0: retl - mov 0, %o0 From aa83a26a193bf06ac6c822ccd881c62898a351c6 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Thu, 11 Dec 2008 20:24:58 -0800 Subject: [PATCH 86/98] sparc: use sparc64 version of scatterlist.h Use sparc64 version of scatterlist.h. There are three main differences: dma_addr_t replaces __u32 dma_address replaces dvma_address dma_length replaces dvma_length dma_addr_t is a u32 on sparc32. Boot tested on sparc32. Signed-off-by: Robert Reif Signed-off-by: David S. Miller --- arch/sparc/include/asm/scatterlist.h | 33 +++++++++++++++++++------ arch/sparc/include/asm/scatterlist_32.h | 26 ------------------- arch/sparc/include/asm/scatterlist_64.h | 27 -------------------- arch/sparc/kernel/ioport.c | 4 +-- arch/sparc/mm/io-unit.c | 8 +++--- arch/sparc/mm/iommu.c | 16 ++++++------ arch/sparc/mm/sun4c.c | 6 ++--- 7 files changed, 43 insertions(+), 77 deletions(-) delete mode 100644 arch/sparc/include/asm/scatterlist_32.h delete mode 100644 arch/sparc/include/asm/scatterlist_64.h diff --git a/arch/sparc/include/asm/scatterlist.h b/arch/sparc/include/asm/scatterlist.h index ec21a4517641..e580f5581c88 100644 --- a/arch/sparc/include/asm/scatterlist.h +++ b/arch/sparc/include/asm/scatterlist.h @@ -1,8 +1,27 @@ -#ifndef ___ASM_SPARC_SCATTERLIST_H -#define ___ASM_SPARC_SCATTERLIST_H -#if defined(__sparc__) && defined(__arch64__) -#include -#else -#include -#endif +#ifndef _SPARC_SCATTERLIST_H +#define _SPARC_SCATTERLIST_H + +#include +#include + +struct scatterlist { +#ifdef CONFIG_DEBUG_SG + unsigned long sg_magic; #endif + unsigned long page_link; + unsigned int offset; + + unsigned int length; + + dma_addr_t dma_address; + __u32 dma_length; +}; + +#define sg_dma_address(sg) ((sg)->dma_address) +#define sg_dma_len(sg) ((sg)->dma_length) + +#define ISA_DMA_THRESHOLD (~0UL) + +#define ARCH_HAS_SG_CHAIN + +#endif /* !(_SPARC_SCATTERLIST_H) */ diff --git a/arch/sparc/include/asm/scatterlist_32.h b/arch/sparc/include/asm/scatterlist_32.h deleted file mode 100644 index c82609ca1d0f..000000000000 --- a/arch/sparc/include/asm/scatterlist_32.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _SPARC_SCATTERLIST_H -#define _SPARC_SCATTERLIST_H - -#include - -struct scatterlist { -#ifdef CONFIG_DEBUG_SG - unsigned long sg_magic; -#endif - unsigned long page_link; - unsigned int offset; - - unsigned int length; - - __u32 dvma_address; /* A place to hang host-specific addresses at. */ - __u32 dvma_length; -}; - -#define sg_dma_address(sg) ((sg)->dvma_address) -#define sg_dma_len(sg) ((sg)->dvma_length) - -#define ISA_DMA_THRESHOLD (~0UL) - -#define ARCH_HAS_SG_CHAIN - -#endif /* !(_SPARC_SCATTERLIST_H) */ diff --git a/arch/sparc/include/asm/scatterlist_64.h b/arch/sparc/include/asm/scatterlist_64.h deleted file mode 100644 index 81bd058f9382..000000000000 --- a/arch/sparc/include/asm/scatterlist_64.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _SPARC64_SCATTERLIST_H -#define _SPARC64_SCATTERLIST_H - -#include -#include - -struct scatterlist { -#ifdef CONFIG_DEBUG_SG - unsigned long sg_magic; -#endif - unsigned long page_link; - unsigned int offset; - - unsigned int length; - - dma_addr_t dma_address; - __u32 dma_length; -}; - -#define sg_dma_address(sg) ((sg)->dma_address) -#define sg_dma_len(sg) ((sg)->dma_length) - -#define ISA_DMA_THRESHOLD (~0UL) - -#define ARCH_HAS_SG_CHAIN - -#endif /* !(_SPARC64_SCATTERLIST_H) */ diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 4f025b36934b..7ce14f05eb48 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c @@ -552,8 +552,8 @@ int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sgl, int nents, /* IIep is write-through, not flushing. */ for_each_sg(sgl, sg, nents, n) { BUG_ON(page_address(sg_page(sg)) == NULL); - sg->dvma_address = virt_to_phys(sg_virt(sg)); - sg->dvma_length = sg->length; + sg->dma_address = virt_to_phys(sg_virt(sg)); + sg->dma_length = sg->length; } return nents; } diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c index daadf5f88050..005e758a4db7 100644 --- a/arch/sparc/mm/io-unit.c +++ b/arch/sparc/mm/io-unit.c @@ -156,8 +156,8 @@ static void iounit_get_scsi_sgl(struct device *dev, struct scatterlist *sg, int spin_lock_irqsave(&iounit->lock, flags); while (sz != 0) { --sz; - sg->dvma_address = iounit_get_area(iounit, (unsigned long) sg_virt(sg), sg->length); - sg->dvma_length = sg->length; + sg->dma_address = iounit_get_area(iounit, (unsigned long) sg_virt(sg), sg->length); + sg->dma_length = sg->length; sg = sg_next(sg); } spin_unlock_irqrestore(&iounit->lock, flags); @@ -186,8 +186,8 @@ static void iounit_release_scsi_sgl(struct device *dev, struct scatterlist *sg, spin_lock_irqsave(&iounit->lock, flags); while (sz != 0) { --sz; - len = ((sg->dvma_address & ~PAGE_MASK) + sg->length + (PAGE_SIZE-1)) >> PAGE_SHIFT; - vaddr = (sg->dvma_address - IOUNIT_DMA_BASE) >> PAGE_SHIFT; + len = ((sg->dma_address & ~PAGE_MASK) + sg->length + (PAGE_SIZE-1)) >> PAGE_SHIFT; + vaddr = (sg->dma_address - IOUNIT_DMA_BASE) >> PAGE_SHIFT; IOD(("iounit_release %08lx-%08lx\n", (long)vaddr, (long)len+vaddr)); for (len += vaddr; vaddr < len; vaddr++) clear_bit(vaddr, iounit->bmap); diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c index e7a499e3aa3c..b2e6e73888b5 100644 --- a/arch/sparc/mm/iommu.c +++ b/arch/sparc/mm/iommu.c @@ -245,8 +245,8 @@ static void iommu_get_scsi_sgl_noflush(struct device *dev, struct scatterlist *s while (sz != 0) { --sz; n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; - sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; - sg->dvma_length = (__u32) sg->length; + sg->dma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; + sg->dma_length = sg->length; sg = sg_next(sg); } } @@ -259,8 +259,8 @@ static void iommu_get_scsi_sgl_gflush(struct device *dev, struct scatterlist *sg while (sz != 0) { --sz; n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; - sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; - sg->dvma_length = (__u32) sg->length; + sg->dma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; + sg->dma_length = sg->length; sg = sg_next(sg); } } @@ -290,8 +290,8 @@ static void iommu_get_scsi_sgl_pflush(struct device *dev, struct scatterlist *sg } } - sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; - sg->dvma_length = (__u32) sg->length; + sg->dma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; + sg->dma_length = sg->length; sg = sg_next(sg); } } @@ -330,8 +330,8 @@ static void iommu_release_scsi_sgl(struct device *dev, struct scatterlist *sg, i --sz; n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; - iommu_release_one(dev, sg->dvma_address & PAGE_MASK, n); - sg->dvma_address = 0x21212121; + iommu_release_one(dev, sg->dma_address & PAGE_MASK, n); + sg->dma_address = 0x21212121; sg = sg_next(sg); } } diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index 6b0c49004ba6..ad0ce117f352 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c @@ -1122,8 +1122,8 @@ static void sun4c_get_scsi_sgl(struct device *dev, struct scatterlist *sg, int s { while (sz != 0) { --sz; - sg->dvma_address = (__u32)sun4c_lockarea(sg_virt(sg), sg->length); - sg->dvma_length = sg->length; + sg->dma_address = (__u32)sun4c_lockarea(sg_virt(sg), sg->length); + sg->dma_length = sg->length; sg = sg_next(sg); } } @@ -1139,7 +1139,7 @@ static void sun4c_release_scsi_sgl(struct device *dev, struct scatterlist *sg, i { while (sz != 0) { --sz; - sun4c_unlockarea((char *)sg->dvma_address, sg->length); + sun4c_unlockarea((char *)sg->dma_address, sg->length); sg = sg_next(sg); } } From 968196a9506f9d26d9b840a3f189de93cfa76ff7 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Thu, 11 Dec 2008 20:28:59 -0800 Subject: [PATCH 87/98] sparc64: do not export pus_fs_struct Al asked: BTW, why does sparc64 export put_fs_struct? Grepping the kernel tree did not show any users of an exported put_fs_struct - so drop the export. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/sparc_ksyms_64.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/sparc/kernel/sparc_ksyms_64.c b/arch/sparc/kernel/sparc_ksyms_64.c index 59e7ca0108e9..0133211ab634 100644 --- a/arch/sparc/kernel/sparc_ksyms_64.c +++ b/arch/sparc/kernel/sparc_ksyms_64.c @@ -180,7 +180,6 @@ EXPORT_SYMBOL(pci_dma_supported); EXPORT_SYMBOL(io_remap_pfn_range); EXPORT_SYMBOL(dump_fpu); -EXPORT_SYMBOL(put_fs_struct); /* math-emu wants this */ EXPORT_SYMBOL(die_if_kernel); From 6e6ab2e2f0083314265f90bf0aefefcb7a46c702 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 26 Dec 2008 15:33:07 -0800 Subject: [PATCH 88/98] sparc: fix hardirq.h removal fallout When hardirq.h are removed from asm-generic/local.h a few bits fails to build. Fix these upfront. Reported by Alexey Dobriyan. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/mdesc.c | 1 + arch/sparc/kernel/sysfs.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c index dde52bcf5c64..3c539a6d7c18 100644 --- a/arch/sparc/kernel/mdesc.c +++ b/arch/sparc/kernel/mdesc.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include diff --git a/arch/sparc/kernel/sysfs.c b/arch/sparc/kernel/sysfs.c index 84e5ce146713..d28f496f4669 100644 --- a/arch/sparc/kernel/sysfs.c +++ b/arch/sparc/kernel/sysfs.c @@ -8,6 +8,7 @@ #include #include +#include #include #include From fe6875ec5c3ca7f6bcb399b6649ba2b64744df51 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 26 Dec 2008 15:35:16 -0800 Subject: [PATCH 89/98] sparc: introduce CONFIG_BITS CONFIG_BITS is set to 32 for sparc32 and 64 for sparc64. This allow us to use this symbol in for example header files to ease unification of sparc32 and sparc64. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index c8c7738f2a32..cd8c585a6b02 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -46,7 +46,11 @@ config ARCH_DEFCONFIG default "arch/sparc/configs/sparc32_defconfig" if SPARC32 default "arch/sparc/configs/sparc64_defconfig" if SPARC64 - +# CONFIG_BITS can be used at source level to get 32/64 bits +config BITS + int + default 32 if SPARC32 + default 64 if SPARC64 config 64BIT def_bool y if SPARC64 From e1648a8194117c7afeb432afb0d10896e10cbea4 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 26 Dec 2008 15:35:41 -0800 Subject: [PATCH 90/98] sparc: unify module.h Use some preprocessor magic in combination with the newly introduced CONFIG_BITS to unify module.h. A few additional symbols are added as they are needed in a follow-up patch Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/include/asm/module.h | 32 ++++++++++++++++++++++-------- arch/sparc/include/asm/module_32.h | 7 ------- arch/sparc/include/asm/module_64.h | 7 ------- 3 files changed, 24 insertions(+), 22 deletions(-) delete mode 100644 arch/sparc/include/asm/module_32.h delete mode 100644 arch/sparc/include/asm/module_64.h diff --git a/arch/sparc/include/asm/module.h b/arch/sparc/include/asm/module.h index e82cf9a3e60e..ff8e02d80334 100644 --- a/arch/sparc/include/asm/module.h +++ b/arch/sparc/include/asm/module.h @@ -1,8 +1,24 @@ -#ifndef ___ASM_SPARC_MODULE_H -#define ___ASM_SPARC_MODULE_H -#if defined(__sparc__) && defined(__arch64__) -#include -#else -#include -#endif -#endif +#ifndef __SPARC_MODULE_H +#define __SPARC_MODULE_H +struct mod_arch_specific { }; + +/* + * Use some preprocessor magic to define the correct symbol + * for sparc32 and sparc64. + * Elf_Addr becomes Elf32_Addr for sparc32 and Elf64_Addr for sparc64 + */ +#define ___ELF(a, b, c) a##b##c +#define __ELF(a, b, c) ___ELF(a, b, c) +#define _Elf(t) __ELF(Elf, CONFIG_BITS, t) +#define _ELF(t) __ELF(ELF, CONFIG_BITS, t) + +#define Elf_Shdr _Elf(_Shdr) +#define Elf_Sym _Elf(_Sym) +#define Elf_Ehdr _Elf(_Ehdr) +#define Elf_Rela _Elf(_Rela) +#define Elf_Addr _Elf(_Addr) + +#define ELF_R_SYM _ELF(_R_SYM) +#define ELF_R_TYPE _ELF(_R_TYPE) + +#endif /* __SPARC_MODULE_H */ diff --git a/arch/sparc/include/asm/module_32.h b/arch/sparc/include/asm/module_32.h deleted file mode 100644 index cbd9e67b0c0b..000000000000 --- a/arch/sparc/include/asm/module_32.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _ASM_SPARC_MODULE_H -#define _ASM_SPARC_MODULE_H -struct mod_arch_specific { }; -#define Elf_Shdr Elf32_Shdr -#define Elf_Sym Elf32_Sym -#define Elf_Ehdr Elf32_Ehdr -#endif /* _ASM_SPARC_MODULE_H */ diff --git a/arch/sparc/include/asm/module_64.h b/arch/sparc/include/asm/module_64.h deleted file mode 100644 index 3d77ba465783..000000000000 --- a/arch/sparc/include/asm/module_64.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _ASM_SPARC64_MODULE_H -#define _ASM_SPARC64_MODULE_H -struct mod_arch_specific { }; -#define Elf_Shdr Elf64_Shdr -#define Elf_Sym Elf64_Sym -#define Elf_Ehdr Elf64_Ehdr -#endif /* _ASM_SPARC64_MODULE_H */ From c45d1c209f7420a01afd1f82c08af8d681fd56b8 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 26 Dec 2008 15:36:29 -0800 Subject: [PATCH 91/98] sparc64: use bit neutral Elf symbols To prepare for unification use the bit neutral versions of the Elf types defined by asm/module.h Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/module_64.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/arch/sparc/kernel/module_64.c b/arch/sparc/kernel/module_64.c index 158484bf5999..9f7e8d078d58 100644 --- a/arch/sparc/kernel/module_64.c +++ b/arch/sparc/kernel/module_64.c @@ -63,7 +63,7 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, struct module *mod) { unsigned int symidx; - Elf64_Sym *sym; + Elf_Sym *sym; const char *strtab; int i; @@ -73,18 +73,18 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, return -ENOEXEC; } } - sym = (Elf64_Sym *)sechdrs[symidx].sh_addr; + sym = (Elf_Sym *)sechdrs[symidx].sh_addr; strtab = (char *)sechdrs[sechdrs[symidx].sh_link].sh_addr; for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) { if (sym[i].st_shndx == SHN_UNDEF && - ELF64_ST_TYPE(sym[i].st_info) == STT_REGISTER) + ELF_ST_TYPE(sym[i].st_info) == STT_REGISTER) sym[i].st_shndx = SHN_ABS; } return 0; } -int apply_relocate(Elf64_Shdr *sechdrs, +int apply_relocate(Elf_Shdr *sechdrs, const char *strtab, unsigned int symindex, unsigned int relsec, @@ -95,20 +95,20 @@ int apply_relocate(Elf64_Shdr *sechdrs, return -ENOEXEC; } -int apply_relocate_add(Elf64_Shdr *sechdrs, +int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, unsigned int symindex, unsigned int relsec, struct module *me) { unsigned int i; - Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr; - Elf64_Sym *sym; + Elf_Rela *rel = (void *)sechdrs[relsec].sh_addr; + Elf_Sym *sym; u8 *location; u32 *loc32; for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { - Elf64_Addr v; + Elf_Addr v; /* This is where to make the change */ location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr @@ -119,11 +119,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, /* This is the symbol it is referring to. Note that all undefined symbols have been resolved. */ - sym = (Elf64_Sym *)sechdrs[symindex].sh_addr - + ELF64_R_SYM(rel[i].r_info); + sym = (Elf_Sym *)sechdrs[symindex].sh_addr + + ELF_R_SYM(rel[i].r_info); v = sym->st_value + rel[i].r_addend; - switch (ELF64_R_TYPE(rel[i].r_info) & 0xff) { + switch (ELF_R_TYPE(rel[i].r_info) & 0xff) { case R_SPARC_64: location[0] = v >> 56; location[1] = v >> 48; @@ -143,24 +143,24 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, break; case R_SPARC_DISP32: - v -= (Elf64_Addr) location; + v -= (Elf_Addr) location; *loc32 = v; break; case R_SPARC_WDISP30: - v -= (Elf64_Addr) location; + v -= (Elf_Addr) location; *loc32 = (*loc32 & ~0x3fffffff) | ((v >> 2) & 0x3fffffff); break; case R_SPARC_WDISP22: - v -= (Elf64_Addr) location; + v -= (Elf_Addr) location; *loc32 = (*loc32 & ~0x3fffff) | ((v >> 2) & 0x3fffff); break; case R_SPARC_WDISP19: - v -= (Elf64_Addr) location; + v -= (Elf_Addr) location; *loc32 = (*loc32 & ~0x7ffff) | ((v >> 2) & 0x7ffff); break; @@ -177,14 +177,14 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, case R_SPARC_OLO10: *loc32 = (*loc32 & ~0x1fff) | (((v & 0x3ff) + - (ELF64_R_TYPE(rel[i].r_info) >> 8)) + (ELF_R_TYPE(rel[i].r_info) >> 8)) & 0x1fff); break; default: printk(KERN_ERR "module %s: Unknown relocation: %x\n", me->name, - (int) (ELF64_R_TYPE(rel[i].r_info) & 0xff)); + (int) (ELF_R_TYPE(rel[i].r_info) & 0xff)); return -ENOEXEC; }; } From 627bf2f678ba7325461922af137ff5f20b6523eb Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 26 Dec 2008 15:37:24 -0800 Subject: [PATCH 92/98] sparc64: prepare module_64.c for unification o Introduce a helper function o Combine sparc64 specific case values o add ifdef's around sparc64 code snippets Note: The ifdef around the BUG_ON is highly questionable but for now the safe approach was taken Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/module_64.c | 62 ++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/arch/sparc/kernel/module_64.c b/arch/sparc/kernel/module_64.c index 9f7e8d078d58..4deb88715039 100644 --- a/arch/sparc/kernel/module_64.c +++ b/arch/sparc/kernel/module_64.c @@ -16,6 +16,7 @@ #include #include +#ifdef CONFIG_SPARC64 static void *module_map(unsigned long size) { struct vm_struct *area; @@ -31,6 +32,12 @@ static void *module_map(unsigned long size) return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL); } +static char *dot2underscore(char *name) +{ + return name; +} +#endif /* CONFIG_SPARC64 */ + void *module_alloc(unsigned long size) { void *ret; @@ -64,7 +71,7 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, { unsigned int symidx; Elf_Sym *sym; - const char *strtab; + char *strtab; int i; for (symidx = 0; sechdrs[symidx].sh_type != SHT_SYMTAB; symidx++) { @@ -77,9 +84,14 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, strtab = (char *)sechdrs[sechdrs[symidx].sh_link].sh_addr; for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) { - if (sym[i].st_shndx == SHN_UNDEF && - ELF_ST_TYPE(sym[i].st_info) == STT_REGISTER) - sym[i].st_shndx = SHN_ABS; + if (sym[i].st_shndx == SHN_UNDEF) { + if (ELF_ST_TYPE(sym[i].st_info) == STT_REGISTER) { + sym[i].st_shndx = SHN_ABS; + } else { + char *name = strtab + sym[i].st_name; + dot2underscore(name); + } + } } return 0; } @@ -115,7 +127,9 @@ int apply_relocate_add(Elf_Shdr *sechdrs, + rel[i].r_offset; loc32 = (u32 *) location; +#ifdef CONFIG_SPARC64 BUG_ON(((u64)location >> (u64)32) != (u64)0); +#endif /* CONFIG_SPARC64 */ /* This is the symbol it is referring to. Note that all undefined symbols have been resolved. */ @@ -124,6 +138,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, v = sym->st_value + rel[i].r_addend; switch (ELF_R_TYPE(rel[i].r_info) & 0xff) { +#ifdef CONFIG_SPARC64 case R_SPARC_64: location[0] = v >> 56; location[1] = v >> 48; @@ -135,6 +150,25 @@ int apply_relocate_add(Elf_Shdr *sechdrs, location[7] = v >> 0; break; + case R_SPARC_DISP32: + v -= (Elf_Addr) location; + *loc32 = v; + break; + + case R_SPARC_WDISP19: + v -= (Elf_Addr) location; + *loc32 = (*loc32 & ~0x7ffff) | + ((v >> 2) & 0x7ffff); + break; + + case R_SPARC_OLO10: + *loc32 = (*loc32 & ~0x1fff) | + (((v & 0x3ff) + + (ELF_R_TYPE(rel[i].r_info) >> 8)) + & 0x1fff); + break; +#endif /* CONFIG_SPARC64 */ + case R_SPARC_32: location[0] = v >> 24; location[1] = v >> 16; @@ -142,11 +176,6 @@ int apply_relocate_add(Elf_Shdr *sechdrs, location[3] = v >> 0; break; - case R_SPARC_DISP32: - v -= (Elf_Addr) location; - *loc32 = v; - break; - case R_SPARC_WDISP30: v -= (Elf_Addr) location; *loc32 = (*loc32 & ~0x3fffffff) | @@ -159,12 +188,6 @@ int apply_relocate_add(Elf_Shdr *sechdrs, ((v >> 2) & 0x3fffff); break; - case R_SPARC_WDISP19: - v -= (Elf_Addr) location; - *loc32 = (*loc32 & ~0x7ffff) | - ((v >> 2) & 0x7ffff); - break; - case R_SPARC_LO10: *loc32 = (*loc32 & ~0x3ff) | (v & 0x3ff); break; @@ -174,13 +197,6 @@ int apply_relocate_add(Elf_Shdr *sechdrs, ((v >> 10) & 0x3fffff); break; - case R_SPARC_OLO10: - *loc32 = (*loc32 & ~0x1fff) | - (((v & 0x3ff) + - (ELF_R_TYPE(rel[i].r_info) >> 8)) - & 0x1fff); - break; - default: printk(KERN_ERR "module %s: Unknown relocation: %x\n", me->name, @@ -191,6 +207,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, return 0; } +#ifdef CONFIG_SPARC64 int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, struct module *me) @@ -207,6 +224,7 @@ int module_finalize(const Elf_Ehdr *hdr, return 0; } +#endif /* CONFIG_SPARC64 */ void module_arch_cleanup(struct module *mod) { From e6b04fe0bae3c0c9204c8190c8988efa6646ef35 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 26 Dec 2008 15:38:17 -0800 Subject: [PATCH 93/98] sparc: unify module.c o Copy module_64.c to module.c o Add all sparc specific bits to module.c o delete module_32.c o update Makefile Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/Makefile | 2 +- arch/sparc/kernel/{module_64.c => module.c} | 24 +++ arch/sparc/kernel/module_32.c | 163 -------------------- 3 files changed, 25 insertions(+), 164 deletions(-) rename arch/sparc/kernel/{module_64.c => module.c} (91%) delete mode 100644 arch/sparc/kernel/module_32.c diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 59aab6a81e89..53adcaa0348b 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -68,7 +68,7 @@ obj-$(CONFIG_SPARC64_SMP) += hvtramp.o obj-y += auxio_$(BITS).o obj-$(CONFIG_SUN_PM) += apc.o pmc.o -obj-$(CONFIG_MODULES) += module_$(BITS).o +obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_MODULES) += sparc_ksyms_$(BITS).o obj-$(CONFIG_SPARC_LED) += led.o obj-$(CONFIG_KGDB) += kgdb_$(BITS).o diff --git a/arch/sparc/kernel/module_64.c b/arch/sparc/kernel/module.c similarity index 91% rename from arch/sparc/kernel/module_64.c rename to arch/sparc/kernel/module.c index 4deb88715039..90273765e81f 100644 --- a/arch/sparc/kernel/module_64.c +++ b/arch/sparc/kernel/module.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,21 @@ static char *dot2underscore(char *name) { return name; } +#else +static void *module_map(unsigned long size) +{ + return vmalloc(size); +} + +/* Replace references to .func with _Func */ +static char *dot2underscore(char *name) +{ + if (name[0] == '.') { + name[0] = '_'; + name[1] = toupper(name[1]); + } + return name; +} #endif /* CONFIG_SPARC64 */ void *module_alloc(unsigned long size) @@ -170,6 +186,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, #endif /* CONFIG_SPARC64 */ case R_SPARC_32: + case R_SPARC_UA32: location[0] = v >> 24; location[1] = v >> 16; location[2] = v >> 8; @@ -224,6 +241,13 @@ int module_finalize(const Elf_Ehdr *hdr, return 0; } +#else +int module_finalize(const Elf_Ehdr *hdr, + const Elf_Shdr *sechdrs, + struct module *me) +{ + return 0; +} #endif /* CONFIG_SPARC64 */ void module_arch_cleanup(struct module *mod) diff --git a/arch/sparc/kernel/module_32.c b/arch/sparc/kernel/module_32.c deleted file mode 100644 index 598682f31ebf..000000000000 --- a/arch/sparc/kernel/module_32.c +++ /dev/null @@ -1,163 +0,0 @@ -/* Kernel module help for sparc32. - * - * Copyright (C) 2001 Rusty Russell. - * Copyright (C) 2002 David S. Miller. - */ - -#include -#include -#include -#include -#include -#include -#include - -void *module_alloc(unsigned long size) -{ - void *ret; - - /* We handle the zero case fine, unlike vmalloc */ - if (size == 0) - return NULL; - - ret = vmalloc(size); - if (!ret) - ret = ERR_PTR(-ENOMEM); - else - memset(ret, 0, size); - - return ret; -} - -/* Free memory returned from module_core_alloc/module_init_alloc */ -void module_free(struct module *mod, void *module_region) -{ - vfree(module_region); - /* FIXME: If module_region == mod->init_region, trim exception - table entries. */ -} - -/* Make generic code ignore STT_REGISTER dummy undefined symbols, - * and replace references to .func with _Func - */ -int module_frob_arch_sections(Elf_Ehdr *hdr, - Elf_Shdr *sechdrs, - char *secstrings, - struct module *mod) -{ - unsigned int symidx; - Elf32_Sym *sym; - char *strtab; - int i; - - for (symidx = 0; sechdrs[symidx].sh_type != SHT_SYMTAB; symidx++) { - if (symidx == hdr->e_shnum-1) { - printk("%s: no symtab found.\n", mod->name); - return -ENOEXEC; - } - } - sym = (Elf32_Sym *)sechdrs[symidx].sh_addr; - strtab = (char *)sechdrs[sechdrs[symidx].sh_link].sh_addr; - - for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) { - if (sym[i].st_shndx == SHN_UNDEF) { - if (ELF32_ST_TYPE(sym[i].st_info) == STT_REGISTER) - sym[i].st_shndx = SHN_ABS; - else { - char *name = strtab + sym[i].st_name; - if (name[0] == '.') { - name[0] = '_'; - name[1] = toupper(name[1]); - } - } - } - } - return 0; -} - -int apply_relocate(Elf32_Shdr *sechdrs, - const char *strtab, - unsigned int symindex, - unsigned int relsec, - struct module *me) -{ - printk(KERN_ERR "module %s: non-ADD RELOCATION unsupported\n", - me->name); - return -ENOEXEC; -} - -int apply_relocate_add(Elf32_Shdr *sechdrs, - const char *strtab, - unsigned int symindex, - unsigned int relsec, - struct module *me) -{ - unsigned int i; - Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; - Elf32_Sym *sym; - u8 *location; - u32 *loc32; - - for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { - Elf32_Addr v; - - /* This is where to make the change */ - location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr - + rel[i].r_offset; - loc32 = (u32 *) location; - /* This is the symbol it is referring to. Note that all - undefined symbols have been resolved. */ - sym = (Elf32_Sym *)sechdrs[symindex].sh_addr - + ELF32_R_SYM(rel[i].r_info); - v = sym->st_value + rel[i].r_addend; - - switch (ELF32_R_TYPE(rel[i].r_info)) { - case R_SPARC_32: - case R_SPARC_UA32: - location[0] = v >> 24; - location[1] = v >> 16; - location[2] = v >> 8; - location[3] = v >> 0; - break; - - case R_SPARC_WDISP30: - v -= (Elf32_Addr) location; - *loc32 = (*loc32 & ~0x3fffffff) | - ((v >> 2) & 0x3fffffff); - break; - - case R_SPARC_WDISP22: - v -= (Elf32_Addr) location; - *loc32 = (*loc32 & ~0x3fffff) | - ((v >> 2) & 0x3fffff); - break; - - case R_SPARC_LO10: - *loc32 = (*loc32 & ~0x3ff) | (v & 0x3ff); - break; - - case R_SPARC_HI22: - *loc32 = (*loc32 & ~0x3fffff) | - ((v >> 10) & 0x3fffff); - break; - - default: - printk(KERN_ERR "module %s: Unknown relocation: %x\n", - me->name, - (int) (ELF32_R_TYPE(rel[i].r_info) & 0xff)); - return -ENOEXEC; - }; - } - return 0; -} - -int module_finalize(const Elf_Ehdr *hdr, - const Elf_Shdr *sechdrs, - struct module *me) -{ - return 0; -} - -void module_arch_cleanup(struct module *mod) -{ -} From 92d9091f305cc32eb64edc1757d925b93acde6da Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Fri, 26 Dec 2008 15:39:11 -0800 Subject: [PATCH 94/98] sparc: fix array overrun check in of_device_64.c Do the array length check and fixup before copying the array. Signed-off-by: Robert Reif Signed-off-by: David S. Miller --- arch/sparc/kernel/of_device_64.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c index 0f616ae3246c..46e231f7c5ce 100644 --- a/arch/sparc/kernel/of_device_64.c +++ b/arch/sparc/kernel/of_device_64.c @@ -811,20 +811,20 @@ static struct of_device * __init scan_one_device(struct device_node *dp, irq = of_get_property(dp, "interrupts", &len); if (irq) { - memcpy(op->irqs, irq, len); op->num_irqs = len / 4; + + /* Prevent overrunning the op->irqs[] array. */ + if (op->num_irqs > PROMINTR_MAX) { + printk(KERN_WARNING "%s: Too many irqs (%d), " + "limiting to %d.\n", + dp->full_name, op->num_irqs, PROMINTR_MAX); + op->num_irqs = PROMINTR_MAX; + } + memcpy(op->irqs, irq, op->num_irqs * 4); } else { op->num_irqs = 0; } - /* Prevent overrunning the op->irqs[] array. */ - if (op->num_irqs > PROMINTR_MAX) { - printk(KERN_WARNING "%s: Too many irqs (%d), " - "limiting to %d.\n", - dp->full_name, op->num_irqs, PROMINTR_MAX); - op->num_irqs = PROMINTR_MAX; - } - build_device_resources(op, parent); for (i = 0; i < op->num_irqs; i++) op->irqs[i] = build_one_device_irq(op, parent, op->irqs[i]); From b74e34dbdeb39136e0557930a373392b7d644f43 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 27 Dec 2008 00:34:41 -0800 Subject: [PATCH 95/98] sparc: use .data.init_task section for init_thread_union Use a dedicated aligned section for the init_thread_union variable and declare this section in vmlinux.lds. This align sparc with most other architectures. Eventually this allow the init_task bits to be unified across all architectures. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/kernel/init_task.c | 3 +-- arch/sparc/kernel/vmlinux.lds.S | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/sparc/kernel/init_task.c b/arch/sparc/kernel/init_task.c index 8e64ebc445ef..62126e4cec54 100644 --- a/arch/sparc/kernel/init_task.c +++ b/arch/sparc/kernel/init_task.c @@ -23,6 +23,5 @@ EXPORT_SYMBOL(init_task); * in etrap.S which assumes it. */ union thread_union init_thread_union - __attribute__((section (".text\"\n\t#"))) - __attribute__((aligned (THREAD_SIZE))) + __attribute__((section (".data.init_task"))) = { INIT_THREAD_INFO(init_task) }; diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S index 4bfbeffb7320..59c8d090920c 100644 --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S @@ -1,7 +1,9 @@ /* ld script for sparc32/sparc64 kernel */ #include + #include +#include #ifdef CONFIG_SPARC32 #define INITIAL_ADDRESS 0x10000 + SIZEOF_HEADERS @@ -65,8 +67,15 @@ SECTIONS .data.read_mostly : { *(.data.read_mostly) } + /* End of data section */ _edata = .; PROVIDE (edata = .); + + /* init_task */ + . = ALIGN(THREAD_SIZE); + .data.init_task : { + *(.data.init_task) + } .fixup : { __start___fixup = .; *(.fixup) From 86ed40bd6fe511d26bb8f3fa65a84cb65c235366 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 27 Dec 2008 00:35:12 -0800 Subject: [PATCH 96/98] sparc: unify sections.h While doing this use standard names for start/end so we could use definitions straight from asm-generic for all the typical symbols. This also allowed us to drop the use of PROVIDE in the linker script so sprc is less non-standard on this area. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/include/asm/sections.h | 16 +++++++++------- arch/sparc/include/asm/sections_32.h | 6 ------ arch/sparc/include/asm/sections_64.h | 9 --------- arch/sparc/kernel/head_32.S | 2 +- arch/sparc/kernel/vmlinux.lds.S | 3 --- arch/sparc/mm/init_32.c | 14 +++++++------- arch/sparc/mm/sun4c.c | 4 ++-- 7 files changed, 19 insertions(+), 35 deletions(-) delete mode 100644 arch/sparc/include/asm/sections_32.h delete mode 100644 arch/sparc/include/asm/sections_64.h diff --git a/arch/sparc/include/asm/sections.h b/arch/sparc/include/asm/sections.h index c7c69b00967f..0b0553bbd8a0 100644 --- a/arch/sparc/include/asm/sections.h +++ b/arch/sparc/include/asm/sections.h @@ -1,8 +1,10 @@ -#ifndef ___ASM_SPARC_SECTIONS_H -#define ___ASM_SPARC_SECTIONS_H -#if defined(__sparc__) && defined(__arch64__) -#include -#else -#include -#endif +#ifndef __SPARC_SECTIONS_H +#define __SPARC_SECTIONS_H + +/* nothing to see, move along */ +#include + +/* sparc entry point */ +extern char _start[]; + #endif diff --git a/arch/sparc/include/asm/sections_32.h b/arch/sparc/include/asm/sections_32.h deleted file mode 100644 index 6832841df051..000000000000 --- a/arch/sparc/include/asm/sections_32.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _SPARC_SECTIONS_H -#define _SPARC_SECTIONS_H - -#include - -#endif diff --git a/arch/sparc/include/asm/sections_64.h b/arch/sparc/include/asm/sections_64.h deleted file mode 100644 index 3f4b9fdc28d0..000000000000 --- a/arch/sparc/include/asm/sections_64.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _SPARC64_SECTIONS_H -#define _SPARC64_SECTIONS_H - -/* nothing to see, move along */ -#include - -extern char _start[]; - -#endif diff --git a/arch/sparc/kernel/head_32.S b/arch/sparc/kernel/head_32.S index 51b40426f9c6..f0b4b516304f 100644 --- a/arch/sparc/kernel/head_32.S +++ b/arch/sparc/kernel/head_32.S @@ -990,7 +990,7 @@ sun4c_continue_boot: /* Zero out our BSS section. */ set __bss_start , %o0 ! First address of BSS - set end , %o1 ! Last address of BSS + set _end , %o1 ! Last address of BSS add %o0, 0x1, %o0 1: stb %g0, [%o0] diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S index 59c8d090920c..76267085b13b 100644 --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S @@ -49,7 +49,6 @@ SECTIONS *(.gnu.warning) } = 0 _etext = .; - PROVIDE (etext = .); RO_DATA(PAGE_SIZE) .data : { @@ -69,7 +68,6 @@ SECTIONS } /* End of data section */ _edata = .; - PROVIDE (edata = .); /* init_task */ . = ALIGN(THREAD_SIZE); @@ -172,7 +170,6 @@ SECTIONS *(COMMON) } _end = . ; - PROVIDE (end = .); /DISCARD/ : { EXIT_TEXT diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index 677c1e187a23..fec926021f49 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -48,9 +49,6 @@ unsigned long sparc_unmapped_base; struct pgtable_cache_struct pgt_quicklists; -/* References to section boundaries */ -extern char __init_begin, __init_end, _start, _end, etext , edata; - /* Initial ramdisk setup */ extern unsigned int sparc_ramdisk_image; extern unsigned int sparc_ramdisk_size; @@ -450,9 +448,9 @@ void __init mem_init(void) totalram_pages += totalhigh_pages; - codepages = (((unsigned long) &etext) - ((unsigned long)&_start)); + codepages = (((unsigned long) &_etext) - ((unsigned long)&_start)); codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT; - datapages = (((unsigned long) &edata) - ((unsigned long)&etext)); + datapages = (((unsigned long) &_edata) - ((unsigned long)&_etext)); datapages = PAGE_ALIGN(datapages) >> PAGE_SHIFT; initpages = (((unsigned long) &__init_end) - ((unsigned long) &__init_begin)); initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT; @@ -476,8 +474,10 @@ void __init mem_init(void) void free_initmem (void) { unsigned long addr; + unsigned long freed; addr = (unsigned long)(&__init_begin); + freed = (unsigned long)(&__init_end) - addr; for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { struct page *p; @@ -490,8 +490,8 @@ void free_initmem (void) totalram_pages++; num_physpages++; } - printk(KERN_INFO "Freeing unused kernel memory: %dk freed\n", - (&__init_end - &__init_begin) >> 10); + printk(KERN_INFO "Freeing unused kernel memory: %ldk freed\n", + freed >> 10); } #ifdef CONFIG_BLK_DEV_INITRD diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index ad0ce117f352..2ffacd67c424 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -1951,7 +1952,6 @@ void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, p } extern void sparc_context_init(int); -extern unsigned long end; extern unsigned long bootmem_init(unsigned long *pages_avail); extern unsigned long last_valid_pfn; @@ -1962,7 +1962,7 @@ void __init sun4c_paging_init(void) extern struct resource sparc_iomap; unsigned long end_pfn, pages_avail; - kernel_end = (unsigned long) &end; + kernel_end = (unsigned long) &_end; kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end); pages_avail = 0; From c4a4a21977573141fd6d53b9cf0879782ae3dda2 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 27 Dec 2008 00:55:45 -0800 Subject: [PATCH 97/98] sparc: drop SUN_IO SUN_IO is always 'y' so drop it and thus killing an ifdef/endif pair Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 4 ---- arch/sparc/mm/srmmu.c | 2 -- 2 files changed, 6 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index cd8c585a6b02..8ec81b684cae 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -469,10 +469,6 @@ config SBUSCHAR bool default y -config SUN_IO - bool - default y - config SUN_LDOMS bool "Sun Logical Domains support" depends on SPARC64 diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index 56df59903eaa..fe7ed08390bb 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -1312,10 +1312,8 @@ void __init srmmu_paging_init(void) #endif poke_srmmu(); -#ifdef CONFIG_SUN_IO srmmu_allocate_ptable_skeleton(sparc_iomap.start, IOBASE_END); srmmu_allocate_ptable_skeleton(DVMA_VADDR, DVMA_END); -#endif srmmu_allocate_ptable_skeleton( __fix_to_virt(__end_of_fixed_addresses - 1), FIXADDR_TOP); From 5bc053089376217943187ed5153d0d1e5c5085b6 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 27 Dec 2008 00:56:29 -0800 Subject: [PATCH 98/98] sparc: move select of ARCH_SUPPORTS_MSI It is counter intuitive to have the select listed as part of the PCI option. Move the select to the SPARC64 specific part of the config. PCI_MSI has a dependency on PCI so it does not harm to have it always selected. Signed-off-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 8ec81b684cae..0a94d9c9cde1 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -31,6 +31,7 @@ config SPARC32 config SPARC64 bool default y if ARCH = "sparc64" + select ARCH_SUPPORTS_MSI select HAVE_FUNCTION_TRACER select HAVE_KRETPROBES select HAVE_KPROBES @@ -478,7 +479,6 @@ config SUN_LDOMS config PCI bool "Support for PCI and PS/2 keyboard/mouse" - select ARCH_SUPPORTS_MSI if SPARC64 help Find out whether your system includes a PCI bus. PCI is the name of a bus system, i.e. the way the CPU talks to the other stuff inside