diff --git a/[refs] b/[refs] index 2befa89f72d6..d8388427b17d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 10db8d212864cb6741df7d7fafda5ab6661f6f88 +refs/heads/master: dea0ed4a64b9d62b266d54350c2514fa7b2b1dbd diff --git a/trunk/arch/powerpc/include/asm/exception-64s.h b/trunk/arch/powerpc/include/asm/exception-64s.h index a43c1473915f..d58fc4e4149c 100644 --- a/trunk/arch/powerpc/include/asm/exception-64s.h +++ b/trunk/arch/powerpc/include/asm/exception-64s.h @@ -293,7 +293,7 @@ label##_hv: \ #define RUNLATCH_ON \ BEGIN_FTR_SECTION \ - CURRENT_THREAD_INFO(r3, r1); \ + clrrdi r3,r1,THREAD_SHIFT; \ ld r4,TI_LOCAL_FLAGS(r3); \ andi. r0,r4,_TLF_RUNLATCH; \ beql ppc64_runlatch_on_trampoline; \ @@ -332,7 +332,7 @@ label##_common: \ #ifdef CONFIG_PPC_970_NAP #define FINISH_NAP \ BEGIN_FTR_SECTION \ - CURRENT_THREAD_INFO(r11, r1); \ + clrrdi r11,r1,THREAD_SHIFT; \ ld r9,TI_LOCAL_FLAGS(r11); \ andi. r10,r9,_TLF_NAPPING; \ bnel power4_fixup_nap; \ diff --git a/trunk/arch/powerpc/include/asm/io.h b/trunk/arch/powerpc/include/asm/io.h index f94ef4213e9d..a3855b81eada 100644 --- a/trunk/arch/powerpc/include/asm/io.h +++ b/trunk/arch/powerpc/include/asm/io.h @@ -20,14 +20,6 @@ extern int check_legacy_ioport(unsigned long base_port); #define _PNPWRP 0xa79 #define PNPBIOS_BASE 0xf000 -#if defined(CONFIG_PPC64) && defined(CONFIG_PCI) -extern struct pci_dev *isa_bridge_pcidev; -/* - * has legacy ISA devices ? - */ -#define arch_has_dev_port() (isa_bridge_pcidev != NULL) -#endif - #include #include diff --git a/trunk/arch/powerpc/include/asm/kvm_book3s_asm.h b/trunk/arch/powerpc/include/asm/kvm_book3s_asm.h index bfcd00c1485d..88609b23b775 100644 --- a/trunk/arch/powerpc/include/asm/kvm_book3s_asm.h +++ b/trunk/arch/powerpc/include/asm/kvm_book3s_asm.h @@ -74,7 +74,6 @@ struct kvmppc_host_state { ulong vmhandler; ulong scratch0; ulong scratch1; - ulong sprg3; u8 in_guest; u8 restore_hid5; u8 napping; diff --git a/trunk/arch/powerpc/include/asm/reg.h b/trunk/arch/powerpc/include/asm/reg.h index 638608677e2a..f0cb7f461b9d 100644 --- a/trunk/arch/powerpc/include/asm/reg.h +++ b/trunk/arch/powerpc/include/asm/reg.h @@ -491,7 +491,6 @@ #define SPRN_SPRG1 0x111 /* Special Purpose Register General 1 */ #define SPRN_SPRG2 0x112 /* Special Purpose Register General 2 */ #define SPRN_SPRG3 0x113 /* Special Purpose Register General 3 */ -#define SPRN_USPRG3 0x103 /* SPRG3 userspace read */ #define SPRN_SPRG4 0x114 /* Special Purpose Register General 4 */ #define SPRN_SPRG5 0x115 /* Special Purpose Register General 5 */ #define SPRN_SPRG6 0x116 /* Special Purpose Register General 6 */ @@ -754,14 +753,14 @@ * 64-bit server: * - SPRG0 unused (reserved for HV on Power4) * - SPRG2 scratch for exception vectors - * - SPRG3 CPU and NUMA node for VDSO getcpu (user visible) + * - SPRG3 unused (user visible) * - HSPRG0 stores PACA in HV mode * - HSPRG1 scratch for "HV" exceptions * * 64-bit embedded * - SPRG0 generic exception scratch * - SPRG2 TLB exception stack - * - SPRG3 CPU and NUMA node for VDSO getcpu (user visible) + * - SPRG3 unused (user visible) * - SPRG4 unused (user visible) * - SPRG6 TLB miss scratch (user visible, sorry !) * - SPRG7 critical exception scratch @@ -1025,8 +1024,7 @@ /* Macros for setting and retrieving special purpose registers */ #ifndef __ASSEMBLY__ #define mfmsr() ({unsigned long rval; \ - asm volatile("mfmsr %0" : "=r" (rval) : \ - : "memory"); rval;}) + asm volatile("mfmsr %0" : "=r" (rval)); rval;}) #ifdef CONFIG_PPC_BOOK3S_64 #define __mtmsrd(v, l) asm volatile("mtmsrd %0," __stringify(l) \ : : "r" (v) : "memory") diff --git a/trunk/arch/powerpc/include/asm/thread_info.h b/trunk/arch/powerpc/include/asm/thread_info.h index faf93529cbf0..68831e9cf82f 100644 --- a/trunk/arch/powerpc/include/asm/thread_info.h +++ b/trunk/arch/powerpc/include/asm/thread_info.h @@ -22,12 +22,6 @@ #define THREAD_SIZE (1 << THREAD_SHIFT) -#ifdef CONFIG_PPC64 -#define CURRENT_THREAD_INFO(dest, sp) clrrdi dest, sp, THREAD_SHIFT -#else -#define CURRENT_THREAD_INFO(dest, sp) rlwinm dest, sp, 0, 0, 31-THREAD_SHIFT -#endif - #ifndef __ASSEMBLY__ #include #include diff --git a/trunk/arch/powerpc/include/asm/vdso.h b/trunk/arch/powerpc/include/asm/vdso.h index 50f261bc3e95..dc0419b66f17 100644 --- a/trunk/arch/powerpc/include/asm/vdso.h +++ b/trunk/arch/powerpc/include/asm/vdso.h @@ -22,8 +22,6 @@ extern unsigned long vdso64_rt_sigtramp; extern unsigned long vdso32_sigtramp; extern unsigned long vdso32_rt_sigtramp; -int __cpuinit vdso_getcpu_init(void); - #else /* __ASSEMBLY__ */ #ifdef __VDSO64__ diff --git a/trunk/arch/powerpc/kernel/asm-offsets.c b/trunk/arch/powerpc/kernel/asm-offsets.c index 85b05c463fae..52c7ad78242e 100644 --- a/trunk/arch/powerpc/kernel/asm-offsets.c +++ b/trunk/arch/powerpc/kernel/asm-offsets.c @@ -533,7 +533,6 @@ int main(void) HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler); HSTATE_FIELD(HSTATE_SCRATCH0, scratch0); HSTATE_FIELD(HSTATE_SCRATCH1, scratch1); - HSTATE_FIELD(HSTATE_SPRG3, sprg3); HSTATE_FIELD(HSTATE_IN_GUEST, in_guest); HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5); HSTATE_FIELD(HSTATE_NAPPING, napping); diff --git a/trunk/arch/powerpc/kernel/entry_32.S b/trunk/arch/powerpc/kernel/entry_32.S index 5207d5a405e2..ba3aeb4bc06a 100644 --- a/trunk/arch/powerpc/kernel/entry_32.S +++ b/trunk/arch/powerpc/kernel/entry_32.S @@ -92,7 +92,7 @@ crit_transfer_to_handler: mfspr r8,SPRN_SPRG_THREAD lwz r0,KSP_LIMIT(r8) stw r0,SAVED_KSP_LIMIT(r11) - CURRENT_THREAD_INFO(r0, r1) + rlwimi r0,r1,0,0,(31-THREAD_SHIFT) stw r0,KSP_LIMIT(r8) /* fall through */ #endif @@ -112,7 +112,7 @@ crit_transfer_to_handler: mfspr r8,SPRN_SPRG_THREAD lwz r0,KSP_LIMIT(r8) stw r0,saved_ksp_limit@l(0) - CURRENT_THREAD_INFO(r0, r1) + rlwimi r0,r1,0,0,(31-THREAD_SHIFT) stw r0,KSP_LIMIT(r8) /* fall through */ #endif @@ -158,7 +158,7 @@ transfer_to_handler: tophys(r11,r11) addi r11,r11,global_dbcr0@l #ifdef CONFIG_SMP - CURRENT_THREAD_INFO(r9, r1) + rlwinm r9,r1,0,0,(31-THREAD_SHIFT) lwz r9,TI_CPU(r9) slwi r9,r9,3 add r11,r11,r9 @@ -179,7 +179,7 @@ transfer_to_handler: ble- stack_ovf /* then the kernel stack overflowed */ 5: #if defined(CONFIG_6xx) || defined(CONFIG_E500) - CURRENT_THREAD_INFO(r9, r1) + rlwinm r9,r1,0,0,31-THREAD_SHIFT tophys(r9,r9) /* check local flags */ lwz r12,TI_LOCAL_FLAGS(r9) mtcrf 0x01,r12 @@ -226,7 +226,13 @@ reenable_mmu: /* re-enable mmu so we can */ stw r3,16(r1) stw r4,20(r1) stw r5,24(r1) + andi. r12,r12,MSR_PR + b 11f bl trace_hardirqs_off + b 12f +11: + bl trace_hardirqs_off +12: lwz r5,24(r1) lwz r4,20(r1) lwz r3,16(r1) @@ -327,7 +333,7 @@ _GLOBAL(DoSyscall) mtmsr r11 1: #endif /* CONFIG_TRACE_IRQFLAGS */ - CURRENT_THREAD_INFO(r10, r1) + rlwinm r10,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */ lwz r11,TI_FLAGS(r10) andi. r11,r11,_TIF_SYSCALL_T_OR_A bne- syscall_dotrace @@ -348,7 +354,7 @@ ret_from_syscall: bl do_show_syscall_exit #endif mr r6,r3 - CURRENT_THREAD_INFO(r12, r1) + rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */ /* disable interrupts so current_thread_info()->flags can't change */ LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */ /* Note: We don't bother telling lockdep about it */ @@ -809,7 +815,7 @@ ret_from_except: user_exc_return: /* r10 contains MSR_KERNEL here */ /* Check current_thread_info()->flags */ - CURRENT_THREAD_INFO(r9, r1) + rlwinm r9,r1,0,0,(31-THREAD_SHIFT) lwz r9,TI_FLAGS(r9) andi. r0,r9,_TIF_USER_WORK_MASK bne do_work @@ -829,7 +835,7 @@ restore_user: /* N.B. the only way to get here is from the beq following ret_from_except. */ resume_kernel: /* check current_thread_info->preempt_count */ - CURRENT_THREAD_INFO(r9, r1) + rlwinm r9,r1,0,0,(31-THREAD_SHIFT) lwz r0,TI_PREEMPT(r9) cmpwi 0,r0,0 /* if non-zero, just restore regs and return */ bne restore @@ -846,7 +852,7 @@ resume_kernel: bl trace_hardirqs_off #endif 1: bl preempt_schedule_irq - CURRENT_THREAD_INFO(r9, r1) + rlwinm r9,r1,0,0,(31-THREAD_SHIFT) lwz r3,TI_FLAGS(r9) andi. r0,r3,_TIF_NEED_RESCHED bne- 1b @@ -1116,7 +1122,7 @@ ret_from_debug_exc: lwz r10,SAVED_KSP_LIMIT(r1) stw r10,KSP_LIMIT(r9) lwz r9,THREAD_INFO-THREAD(r9) - CURRENT_THREAD_INFO(r10, r1) + rlwinm r10,r1,0,0,(31-THREAD_SHIFT) lwz r10,TI_PREEMPT(r10) stw r10,TI_PREEMPT(r9) RESTORE_xSRR(SRR0,SRR1); @@ -1150,7 +1156,7 @@ load_dbcr0: lis r11,global_dbcr0@ha addi r11,r11,global_dbcr0@l #ifdef CONFIG_SMP - CURRENT_THREAD_INFO(r9, r1) + rlwinm r9,r1,0,0,(31-THREAD_SHIFT) lwz r9,TI_CPU(r9) slwi r9,r9,3 add r11,r11,r9 @@ -1191,7 +1197,7 @@ recheck: LOAD_MSR_KERNEL(r10,MSR_KERNEL) SYNC MTMSRD(r10) /* disable interrupts */ - CURRENT_THREAD_INFO(r9, r1) + rlwinm r9,r1,0,0,(31-THREAD_SHIFT) lwz r9,TI_FLAGS(r9) andi. r0,r9,_TIF_NEED_RESCHED bne- do_resched diff --git a/trunk/arch/powerpc/kernel/entry_64.S b/trunk/arch/powerpc/kernel/entry_64.S index 4b01a25e29ef..cf38a17ab28a 100644 --- a/trunk/arch/powerpc/kernel/entry_64.S +++ b/trunk/arch/powerpc/kernel/entry_64.S @@ -146,7 +146,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) REST_2GPRS(7,r1) addi r9,r1,STACK_FRAME_OVERHEAD #endif - CURRENT_THREAD_INFO(r11, r1) + clrrdi r11,r1,THREAD_SHIFT ld r10,TI_FLAGS(r11) andi. r11,r10,_TIF_SYSCALL_T_OR_A bne- syscall_dotrace @@ -181,7 +181,7 @@ syscall_exit: bl .do_show_syscall_exit ld r3,RESULT(r1) #endif - CURRENT_THREAD_INFO(r12, r1) + clrrdi r12,r1,THREAD_SHIFT ld r8,_MSR(r1) #ifdef CONFIG_PPC_BOOK3S @@ -260,7 +260,7 @@ syscall_dotrace: ld r7,GPR7(r1) ld r8,GPR8(r1) addi r9,r1,STACK_FRAME_OVERHEAD - CURRENT_THREAD_INFO(r10, r1) + clrrdi r10,r1,THREAD_SHIFT ld r10,TI_FLAGS(r10) b .Lsyscall_dotrace_cont @@ -500,7 +500,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) 2: #endif /* !CONFIG_PPC_BOOK3S */ - CURRENT_THREAD_INFO(r7, r8) /* base of new stack */ + clrrdi r7,r8,THREAD_SHIFT /* base of new stack */ /* Note: this uses SWITCH_FRAME_SIZE rather than INT_FRAME_SIZE because we don't need to leave the 288-byte ABI gap at the top of the kernel stack. */ @@ -559,7 +559,7 @@ _GLOBAL(ret_from_except_lite) mtmsrd r10,1 /* Update machine state */ #endif /* CONFIG_PPC_BOOK3E */ - CURRENT_THREAD_INFO(r9, r1) + clrrdi r9,r1,THREAD_SHIFT /* current_thread_info() */ ld r3,_MSR(r1) ld r4,TI_FLAGS(r9) andi. r3,r3,MSR_PR @@ -602,7 +602,7 @@ resume_kernel: 1: bl .preempt_schedule_irq /* Re-test flags and eventually loop */ - CURRENT_THREAD_INFO(r9, r1) + clrrdi r9,r1,THREAD_SHIFT ld r4,TI_FLAGS(r9) andi. r0,r4,_TIF_NEED_RESCHED bne 1b diff --git a/trunk/arch/powerpc/kernel/exceptions-64e.S b/trunk/arch/powerpc/kernel/exceptions-64e.S index 98be7f0cd227..ecba705bd628 100644 --- a/trunk/arch/powerpc/kernel/exceptions-64e.S +++ b/trunk/arch/powerpc/kernel/exceptions-64e.S @@ -222,7 +222,7 @@ exc_##n##_bad_stack: \ * interrupts happen before the wait instruction. */ #define CHECK_NAPPING() \ - CURRENT_THREAD_INFO(r11, r1); \ + clrrdi r11,r1,THREAD_SHIFT; \ ld r10,TI_LOCAL_FLAGS(r11); \ andi. r9,r10,_TLF_NAPPING; \ beq+ 1f; \ diff --git a/trunk/arch/powerpc/kernel/exceptions-64s.S b/trunk/arch/powerpc/kernel/exceptions-64s.S index e894515e77bb..1c06d2971545 100644 --- a/trunk/arch/powerpc/kernel/exceptions-64s.S +++ b/trunk/arch/powerpc/kernel/exceptions-64s.S @@ -239,7 +239,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) * out of line to handle them */ . = 0xe00 -hv_exception_trampoline: b h_data_storage_hv . = 0xe20 b h_instr_storage_hv @@ -852,7 +851,7 @@ BEGIN_FTR_SECTION bne- do_ste_alloc /* If so handle it */ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_SLB) - CURRENT_THREAD_INFO(r11, r1) + clrrdi r11,r1,THREAD_SHIFT lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */ andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */ bne 77f /* then don't call hash_page now */ diff --git a/trunk/arch/powerpc/kernel/ftrace.c b/trunk/arch/powerpc/kernel/ftrace.c index 91b46b7f6f0d..6f33296a0570 100644 --- a/trunk/arch/powerpc/kernel/ftrace.c +++ b/trunk/arch/powerpc/kernel/ftrace.c @@ -240,9 +240,9 @@ __ftrace_make_nop(struct module *mod, /* * On PPC32 the trampoline looks like: - * 0x3d, 0x80, 0x00, 0x00 lis r12,sym@ha - * 0x39, 0x8c, 0x00, 0x00 addi r12,r12,sym@l - * 0x7d, 0x89, 0x03, 0xa6 mtctr r12 + * 0x3d, 0x60, 0x00, 0x00 lis r11,sym@ha + * 0x39, 0x6b, 0x00, 0x00 addi r11,r11,sym@l + * 0x7d, 0x69, 0x03, 0xa6 mtctr r11 * 0x4e, 0x80, 0x04, 0x20 bctr */ @@ -257,9 +257,9 @@ __ftrace_make_nop(struct module *mod, pr_devel(" %08x %08x ", jmp[0], jmp[1]); /* verify that this is what we expect it to be */ - if (((jmp[0] & 0xffff0000) != 0x3d800000) || - ((jmp[1] & 0xffff0000) != 0x398c0000) || - (jmp[2] != 0x7d8903a6) || + if (((jmp[0] & 0xffff0000) != 0x3d600000) || + ((jmp[1] & 0xffff0000) != 0x396b0000) || + (jmp[2] != 0x7d6903a6) || (jmp[3] != 0x4e800420)) { printk(KERN_ERR "Not a trampoline\n"); return -EINVAL; diff --git a/trunk/arch/powerpc/kernel/head_fsl_booke.S b/trunk/arch/powerpc/kernel/head_fsl_booke.S index 7e7bd88674db..1f4434a38608 100644 --- a/trunk/arch/powerpc/kernel/head_fsl_booke.S +++ b/trunk/arch/powerpc/kernel/head_fsl_booke.S @@ -192,7 +192,7 @@ _ENTRY(__early_start) li r0,0 stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1) - CURRENT_THREAD_INFO(r22, r1) + rlwinm r22,r1,0,0,31-THREAD_SHIFT /* current thread_info */ stw r24, TI_CPU(r22) bl early_init diff --git a/trunk/arch/powerpc/kernel/hw_breakpoint.c b/trunk/arch/powerpc/kernel/hw_breakpoint.c index f3a82dde61db..2bc0584be81c 100644 --- a/trunk/arch/powerpc/kernel/hw_breakpoint.c +++ b/trunk/arch/powerpc/kernel/hw_breakpoint.c @@ -111,7 +111,7 @@ void arch_unregister_hw_breakpoint(struct perf_event *bp) * and the single_step_dabr_instruction(), then cleanup the breakpoint * restoration variables to prevent dangling pointers. */ - if (bp->ctx && bp->ctx->task) + if (bp->ctx->task) bp->ctx->task->thread.last_hit_ubp = NULL; } diff --git a/trunk/arch/powerpc/kernel/idle_6xx.S b/trunk/arch/powerpc/kernel/idle_6xx.S index 1686916cc7f0..15c611de1ee2 100644 --- a/trunk/arch/powerpc/kernel/idle_6xx.S +++ b/trunk/arch/powerpc/kernel/idle_6xx.S @@ -135,7 +135,7 @@ BEGIN_FTR_SECTION DSSALL sync END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) - CURRENT_THREAD_INFO(r9, r1) + rlwinm r9,r1,0,0,31-THREAD_SHIFT /* current thread_info */ lwz r8,TI_LOCAL_FLAGS(r9) /* set napping bit */ ori r8,r8,_TLF_NAPPING /* so when we take an exception */ stw r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */ @@ -158,7 +158,7 @@ _GLOBAL(power_save_ppc32_restore) stw r9,_NIP(r11) /* make it do a blr */ #ifdef CONFIG_SMP - CURRENT_THREAD_INFO(r12, r11) + rlwinm r12,r11,0,0,31-THREAD_SHIFT lwz r11,TI_CPU(r12) /* get cpu number * 4 */ slwi r11,r11,2 #else diff --git a/trunk/arch/powerpc/kernel/idle_book3e.S b/trunk/arch/powerpc/kernel/idle_book3e.S index 4c7cb4008585..ff007b59448d 100644 --- a/trunk/arch/powerpc/kernel/idle_book3e.S +++ b/trunk/arch/powerpc/kernel/idle_book3e.S @@ -60,7 +60,7 @@ _GLOBAL(book3e_idle) 1: /* Let's set the _TLF_NAPPING flag so interrupts make us return * to the right spot */ - CURRENT_THREAD_INFO(r11, r1) + clrrdi r11,r1,THREAD_SHIFT ld r10,TI_LOCAL_FLAGS(r11) ori r10,r10,_TLF_NAPPING std r10,TI_LOCAL_FLAGS(r11) diff --git a/trunk/arch/powerpc/kernel/idle_e500.S b/trunk/arch/powerpc/kernel/idle_e500.S index 15448668988d..4f0ab85f3788 100644 --- a/trunk/arch/powerpc/kernel/idle_e500.S +++ b/trunk/arch/powerpc/kernel/idle_e500.S @@ -21,7 +21,7 @@ .text _GLOBAL(e500_idle) - CURRENT_THREAD_INFO(r3, r1) + rlwinm r3,r1,0,0,31-THREAD_SHIFT /* current thread_info */ lwz r4,TI_LOCAL_FLAGS(r3) /* set napping bit */ ori r4,r4,_TLF_NAPPING /* so when we take an exception */ stw r4,TI_LOCAL_FLAGS(r3) /* it will return to our caller */ @@ -96,7 +96,7 @@ _GLOBAL(power_save_ppc32_restore) stw r9,_NIP(r11) /* make it do a blr */ #ifdef CONFIG_SMP - CURRENT_THREAD_INFO(r12, r1) + rlwinm r12,r1,0,0,31-THREAD_SHIFT lwz r11,TI_CPU(r12) /* get cpu number * 4 */ slwi r11,r11,2 #else diff --git a/trunk/arch/powerpc/kernel/idle_power4.S b/trunk/arch/powerpc/kernel/idle_power4.S index e3edaa189911..2c71b0fc9f91 100644 --- a/trunk/arch/powerpc/kernel/idle_power4.S +++ b/trunk/arch/powerpc/kernel/idle_power4.S @@ -59,7 +59,7 @@ BEGIN_FTR_SECTION DSSALL sync END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) - CURRENT_THREAD_INFO(r9, r1) + clrrdi r9,r1,THREAD_SHIFT /* current thread_info */ ld r8,TI_LOCAL_FLAGS(r9) /* set napping bit */ ori r8,r8,_TLF_NAPPING /* so when we take an exception */ std r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */ diff --git a/trunk/arch/powerpc/kernel/iommu.c.rej b/trunk/arch/powerpc/kernel/iommu.c.rej deleted file mode 100644 index 9d10d341cf86..000000000000 --- a/trunk/arch/powerpc/kernel/iommu.c.rej +++ /dev/null @@ -1,22 +0,0 @@ ---- arch/powerpc/kernel/iommu.c 2012-06-08 09:01:02.785709100 +1000 -+++ arch/powerpc/kernel/iommu.c 2012-06-08 09:01:07.489784856 +1000 -@@ -33,7 +33,9 @@ - #include - #include - #include -+#include - #include -+#include - #include - #include - #include -@@ -171,6 +261,9 @@ - return DMA_ERROR_CODE; - } - -+ if (should_fail_iommu(dev)) -+ return DMA_ERROR_CODE; -+ - if (handle && *handle) - start = *handle; - else diff --git a/trunk/arch/powerpc/kernel/misc_32.S b/trunk/arch/powerpc/kernel/misc_32.S index 407e293aad2f..386d57f66f28 100644 --- a/trunk/arch/powerpc/kernel/misc_32.S +++ b/trunk/arch/powerpc/kernel/misc_32.S @@ -179,7 +179,7 @@ _GLOBAL(low_choose_750fx_pll) mtspr SPRN_HID1,r4 /* Store new HID1 image */ - CURRENT_THREAD_INFO(r6, r1) + rlwinm r6,r1,0,0,(31-THREAD_SHIFT) lwz r6,TI_CPU(r6) slwi r6,r6,2 addis r6,r6,nap_save_hid1@ha @@ -699,7 +699,7 @@ _GLOBAL(kernel_thread) #ifdef CONFIG_SMP _GLOBAL(start_secondary_resume) /* Reset stack */ - CURRENT_THREAD_INFO(r1, r1) + rlwinm r1,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */ addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD li r3,0 stw r3,0(r1) /* Zero the stack frame pointer */ diff --git a/trunk/arch/powerpc/kernel/smp.c b/trunk/arch/powerpc/kernel/smp.c index 0321007086f7..e1417c42155c 100644 --- a/trunk/arch/powerpc/kernel/smp.c +++ b/trunk/arch/powerpc/kernel/smp.c @@ -48,7 +48,6 @@ #ifdef CONFIG_PPC64 #include #endif -#include #include #ifdef DEBUG @@ -571,8 +570,6 @@ void __devinit start_secondary(void *unused) #ifdef CONFIG_PPC64 if (system_state == SYSTEM_RUNNING) vdso_data->processorCount++; - - vdso_getcpu_init(); #endif notify_cpu_starting(cpu); set_cpu_online(cpu, true); diff --git a/trunk/arch/powerpc/kernel/vdso.c b/trunk/arch/powerpc/kernel/vdso.c index b67db22e102d..9eb5b9b536a7 100644 --- a/trunk/arch/powerpc/kernel/vdso.c +++ b/trunk/arch/powerpc/kernel/vdso.c @@ -706,34 +706,6 @@ static void __init vdso_setup_syscall_map(void) } } -#ifdef CONFIG_PPC64 -int __cpuinit vdso_getcpu_init(void) -{ - unsigned long cpu, node, val; - - /* - * SPRG3 contains the CPU in the bottom 16 bits and the NUMA node in - * the next 16 bits. The VDSO uses this to implement getcpu(). - */ - cpu = get_cpu(); - WARN_ON_ONCE(cpu > 0xffff); - - node = cpu_to_node(cpu); - WARN_ON_ONCE(node > 0xffff); - - val = (cpu & 0xfff) | ((node & 0xffff) << 16); - mtspr(SPRN_SPRG3, val); -#ifdef CONFIG_KVM_BOOK3S_HANDLER - get_paca()->kvm_hstate.sprg3 = val; -#endif - - put_cpu(); - - return 0; -} -/* We need to call this before SMP init */ -early_initcall(vdso_getcpu_init); -#endif static int __init vdso_init(void) { diff --git a/trunk/arch/powerpc/kernel/vdso32/Makefile b/trunk/arch/powerpc/kernel/vdso32/Makefile index 53e6c9b979ec..9a7946c41738 100644 --- a/trunk/arch/powerpc/kernel/vdso32/Makefile +++ b/trunk/arch/powerpc/kernel/vdso32/Makefile @@ -1,9 +1,7 @@ # List of files in the vdso, has to be asm only for now -obj-vdso32-$(CONFIG_PPC64) = getcpu.o -obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o \ - $(obj-vdso32-y) +obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o # Build rules diff --git a/trunk/arch/powerpc/kernel/vdso32/getcpu.S b/trunk/arch/powerpc/kernel/vdso32/getcpu.S deleted file mode 100644 index 47afd08c90f7..000000000000 --- a/trunk/arch/powerpc/kernel/vdso32/getcpu.S +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright (C) IBM Corporation, 2012 - * - * Author: Anton Blanchard - */ -#include -#include - - .text -/* - * Exact prototype of getcpu - * - * int __kernel_getcpu(unsigned *cpu, unsigned *node); - * - */ -V_FUNCTION_BEGIN(__kernel_getcpu) - .cfi_startproc - mfspr r5,SPRN_USPRG3 - cmpdi cr0,r3,0 - cmpdi cr1,r4,0 - clrlwi r6,r5,16 - rlwinm r7,r5,16,31-15,31-0 - beq cr0,1f - stw r6,0(r3) -1: beq cr1,2f - stw r7,0(r4) -2: crclr cr0*4+so - li r3,0 /* always success */ - blr - .cfi_endproc -V_FUNCTION_END(__kernel_getcpu) diff --git a/trunk/arch/powerpc/kernel/vdso32/vdso32.lds.S b/trunk/arch/powerpc/kernel/vdso32/vdso32.lds.S index 43200ba2e570..0546bcd49cd0 100644 --- a/trunk/arch/powerpc/kernel/vdso32/vdso32.lds.S +++ b/trunk/arch/powerpc/kernel/vdso32/vdso32.lds.S @@ -147,9 +147,6 @@ VERSION __kernel_sync_dicache_p5; __kernel_sigtramp32; __kernel_sigtramp_rt32; -#ifdef CONFIG_PPC64 - __kernel_getcpu; -#endif local: *; }; diff --git a/trunk/arch/powerpc/kernel/vdso64/Makefile b/trunk/arch/powerpc/kernel/vdso64/Makefile index effca9404b17..8c500d8622e4 100644 --- a/trunk/arch/powerpc/kernel/vdso64/Makefile +++ b/trunk/arch/powerpc/kernel/vdso64/Makefile @@ -1,6 +1,6 @@ # List of files in the vdso, has to be asm only for now -obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o +obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o # Build rules diff --git a/trunk/arch/powerpc/kernel/vdso64/getcpu.S b/trunk/arch/powerpc/kernel/vdso64/getcpu.S deleted file mode 100644 index 47afd08c90f7..000000000000 --- a/trunk/arch/powerpc/kernel/vdso64/getcpu.S +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright (C) IBM Corporation, 2012 - * - * Author: Anton Blanchard - */ -#include -#include - - .text -/* - * Exact prototype of getcpu - * - * int __kernel_getcpu(unsigned *cpu, unsigned *node); - * - */ -V_FUNCTION_BEGIN(__kernel_getcpu) - .cfi_startproc - mfspr r5,SPRN_USPRG3 - cmpdi cr0,r3,0 - cmpdi cr1,r4,0 - clrlwi r6,r5,16 - rlwinm r7,r5,16,31-15,31-0 - beq cr0,1f - stw r6,0(r3) -1: beq cr1,2f - stw r7,0(r4) -2: crclr cr0*4+so - li r3,0 /* always success */ - blr - .cfi_endproc -V_FUNCTION_END(__kernel_getcpu) diff --git a/trunk/arch/powerpc/kernel/vdso64/vdso64.lds.S b/trunk/arch/powerpc/kernel/vdso64/vdso64.lds.S index e6c1758f3588..0e615404e247 100644 --- a/trunk/arch/powerpc/kernel/vdso64/vdso64.lds.S +++ b/trunk/arch/powerpc/kernel/vdso64/vdso64.lds.S @@ -146,7 +146,6 @@ VERSION __kernel_sync_dicache; __kernel_sync_dicache_p5; __kernel_sigtramp_rt64; - __kernel_getcpu; local: *; }; diff --git a/trunk/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/trunk/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 5a84c8d3d040..e764e2361d47 100644 --- a/trunk/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/trunk/arch/powerpc/kvm/book3s_hv_rmhandlers.S @@ -1064,10 +1064,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) mtspr SPRN_DABR,r5 mtspr SPRN_DABRX,r6 - /* Restore SPRG3 */ - ld r3,HSTATE_SPRG3(r13) - mtspr SPRN_SPRG3,r3 - /* * Reload DEC. HDEC interrupts were disabled when * we reloaded the host's LPCR value. diff --git a/trunk/arch/powerpc/kvm/bookehv_interrupts.S b/trunk/arch/powerpc/kvm/bookehv_interrupts.S index 1685dc43bcf2..18cee4b0098a 100644 --- a/trunk/arch/powerpc/kvm/bookehv_interrupts.S +++ b/trunk/arch/powerpc/kvm/bookehv_interrupts.S @@ -160,7 +160,11 @@ mtspr SPRN_EPLC, r8 /* disable preemption, so we are sure we hit the fixup handler */ - CURRENT_THREAD_INFO(r8, r1) +#ifdef CONFIG_PPC64 + clrrdi r8,r1,THREAD_SHIFT +#else + rlwinm r8,r1,0,0,31-THREAD_SHIFT /* current thread_info */ +#endif li r7, 1 stw r7, TI_PREEMPT(r8) diff --git a/trunk/arch/powerpc/lib/crtsavres.S b/trunk/arch/powerpc/lib/crtsavres.S index b2c68ce139ae..1c893f05d224 100644 --- a/trunk/arch/powerpc/lib/crtsavres.S +++ b/trunk/arch/powerpc/lib/crtsavres.S @@ -41,13 +41,12 @@ #include .file "crtsavres.S" + .section ".text" #ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE #ifndef CONFIG_PPC64 - .section ".text" - /* Routines for saving integer registers, called by the compiler. */ /* Called with r11 pointing to the stack header word of the caller of the */ /* function, just beyond the end of the integer save area. */ @@ -233,8 +232,6 @@ _GLOBAL(_rest32gpr_31_x) #else /* CONFIG_PPC64 */ - .section ".text.save.restore","ax",@progbits - .globl _savegpr0_14 _savegpr0_14: std r14,-144(r1) diff --git a/trunk/arch/powerpc/mm/hash_low_32.S b/trunk/arch/powerpc/mm/hash_low_32.S index 115347f74ce5..b13d58932bf6 100644 --- a/trunk/arch/powerpc/mm/hash_low_32.S +++ b/trunk/arch/powerpc/mm/hash_low_32.S @@ -184,7 +184,7 @@ _GLOBAL(add_hash_page) add r3,r3,r0 /* note create_hpte trims to 24 bits */ #ifdef CONFIG_SMP - CURRENT_THREAD_INFO(r8, r1) /* use cpu number to make tag */ + rlwinm r8,r1,0,0,(31-THREAD_SHIFT) /* use cpu number to make tag */ lwz r8,TI_CPU(r8) /* to go in mmu_hash_lock */ oris r8,r8,12 #endif /* CONFIG_SMP */ @@ -545,7 +545,7 @@ _GLOBAL(flush_hash_pages) #ifdef CONFIG_SMP addis r9,r7,mmu_hash_lock@ha addi r9,r9,mmu_hash_lock@l - CURRENT_THREAD_INFO(r8, r1) + rlwinm r8,r1,0,0,(31-THREAD_SHIFT) add r8,r8,r7 lwz r8,TI_CPU(r8) oris r8,r8,9 @@ -639,7 +639,7 @@ _GLOBAL(flush_hash_patch_B) */ _GLOBAL(_tlbie) #ifdef CONFIG_SMP - CURRENT_THREAD_INFO(r8, r1) + rlwinm r8,r1,0,0,(31-THREAD_SHIFT) lwz r8,TI_CPU(r8) oris r8,r8,11 mfmsr r10 @@ -677,7 +677,7 @@ _GLOBAL(_tlbie) */ _GLOBAL(_tlbia) #if defined(CONFIG_SMP) - CURRENT_THREAD_INFO(r8, r1) + rlwinm r8,r1,0,0,(31-THREAD_SHIFT) lwz r8,TI_CPU(r8) oris r8,r8,10 mfmsr r10 diff --git a/trunk/arch/powerpc/platforms/85xx/p1022_ds.c b/trunk/arch/powerpc/platforms/85xx/p1022_ds.c index 31d18b964f94..74e310b4b460 100644 --- a/trunk/arch/powerpc/platforms/85xx/p1022_ds.c +++ b/trunk/arch/powerpc/platforms/85xx/p1022_ds.c @@ -348,7 +348,13 @@ void __init p1022_ds_pic_init(void) */ static void __init disable_one_node(struct device_node *np, struct property *new) { - prom_update_property(np, new); + struct property *old; + + old = of_find_property(np, new->name, NULL); + if (old) + prom_update_property(np, new, old); + else + prom_add_property(np, new); } /* TRUE if there is a "video=fslfb" command-line parameter. */ diff --git a/trunk/arch/powerpc/platforms/pseries/eeh_event.c b/trunk/arch/powerpc/platforms/pseries/eeh_event.c index fb506317ebb0..4cb375c0f8d1 100644 --- a/trunk/arch/powerpc/platforms/pseries/eeh_event.c +++ b/trunk/arch/powerpc/platforms/pseries/eeh_event.c @@ -85,10 +85,8 @@ static int eeh_event_handler(void * dummy) set_current_state(TASK_INTERRUPTIBLE); /* Don't add to load average */ edev = handle_eeh_events(event); - if (edev) { - eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING); - pci_dev_put(edev->pdev); - } + eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING); + pci_dev_put(edev->pdev); kfree(event); mutex_unlock(&eeh_event_mutex); diff --git a/trunk/arch/powerpc/platforms/pseries/mobility.c b/trunk/arch/powerpc/platforms/pseries/mobility.c index dd30b12edfe4..029a562af373 100644 --- a/trunk/arch/powerpc/platforms/pseries/mobility.c +++ b/trunk/arch/powerpc/platforms/pseries/mobility.c @@ -67,6 +67,7 @@ static int update_dt_property(struct device_node *dn, struct property **prop, const char *name, u32 vd, char *value) { struct property *new_prop = *prop; + struct property *old_prop; int more = 0; /* A negative 'vd' value indicates that only part of the new property @@ -116,7 +117,12 @@ static int update_dt_property(struct device_node *dn, struct property **prop, } if (!more) { - prom_update_property(dn, new_prop); + old_prop = of_find_property(dn, new_prop->name, NULL); + if (old_prop) + prom_update_property(dn, new_prop, old_prop); + else + prom_add_property(dn, new_prop); + new_prop = NULL; } diff --git a/trunk/arch/powerpc/platforms/pseries/processor_idle.c b/trunk/arch/powerpc/platforms/pseries/processor_idle.c index 455760b1fe6e..7f5668b94165 100644 --- a/trunk/arch/powerpc/platforms/pseries/processor_idle.c +++ b/trunk/arch/powerpc/platforms/pseries/processor_idle.c @@ -197,25 +197,13 @@ static int pseries_cpuidle_add_cpu_notifier(struct notifier_block *n, struct cpuidle_device *dev = per_cpu_ptr(pseries_cpuidle_devices, hotcpu); - if (dev && cpuidle_get_driver()) { - switch (action) { - case CPU_ONLINE: - case CPU_ONLINE_FROZEN: - cpuidle_pause_and_lock(); - cpuidle_enable_device(dev); - cpuidle_resume_and_unlock(); - break; - - case CPU_DEAD: - case CPU_DEAD_FROZEN: - cpuidle_pause_and_lock(); + switch (action & 0xf) { + case CPU_ONLINE: + if (dev && cpuidle_get_driver()) { cpuidle_disable_device(dev); - cpuidle_resume_and_unlock(); - break; - - default: - return NOTIFY_DONE; + cpuidle_enable_device(dev); } + break; } return NOTIFY_OK; } @@ -357,7 +345,6 @@ static int __init pseries_processor_idle_init(void) static void __exit pseries_processor_idle_exit(void) { - unregister_cpu_notifier(&setup_hotplug_notifier); pseries_idle_devices_uninit(); cpuidle_unregister_driver(&pseries_idle_driver); diff --git a/trunk/arch/powerpc/platforms/pseries/reconfig.c b/trunk/arch/powerpc/platforms/pseries/reconfig.c index 39f71fba9b38..7b3bf76ef834 100644 --- a/trunk/arch/powerpc/platforms/pseries/reconfig.c +++ b/trunk/arch/powerpc/platforms/pseries/reconfig.c @@ -432,7 +432,7 @@ static int do_update_property(char *buf, size_t bufsize) unsigned char *value; char *name, *end, *next_prop; int rc, length; - struct property *newprop; + struct property *newprop, *oldprop; buf = parse_node(buf, bufsize, &np); end = buf + bufsize; @@ -443,9 +443,6 @@ static int do_update_property(char *buf, size_t bufsize) if (!next_prop) return -EINVAL; - if (!strlen(name)) - return -ENODEV; - newprop = new_property(name, length, value, NULL); if (!newprop) return -ENOMEM; @@ -453,11 +450,18 @@ static int do_update_property(char *buf, size_t bufsize) if (!strcmp(name, "slb-size") || !strcmp(name, "ibm,slb-size")) slb_set_size(*(int *)value); + oldprop = of_find_property(np, name,NULL); + if (!oldprop) { + if (strlen(name)) + return prom_add_property(np, newprop); + return -ENODEV; + } + upd_value.node = np; upd_value.property = newprop; pSeries_reconfig_notify(PSERIES_UPDATE_PROPERTY, &upd_value); - rc = prom_update_property(np, newprop); + rc = prom_update_property(np, newprop, oldprop); if (rc) return rc; @@ -482,7 +486,7 @@ static int do_update_property(char *buf, size_t bufsize) rc = pSeries_reconfig_notify(action, value); if (rc) { - prom_update_property(np, newprop); + prom_update_property(np, oldprop, newprop); return rc; } } diff --git a/trunk/arch/powerpc/sysdev/6xx-suspend.S b/trunk/arch/powerpc/sysdev/6xx-suspend.S index cf48e9cb2575..21cda085d926 100644 --- a/trunk/arch/powerpc/sysdev/6xx-suspend.S +++ b/trunk/arch/powerpc/sysdev/6xx-suspend.S @@ -29,7 +29,7 @@ _GLOBAL(mpc6xx_enter_standby) ori r5, r5, ret_from_standby@l mtlr r5 - CURRENT_THREAD_INFO(r5, r1) + rlwinm r5, r1, 0, 0, 31-THREAD_SHIFT lwz r6, TI_LOCAL_FLAGS(r5) ori r6, r6, _TLF_SLEEPING stw r6, TI_LOCAL_FLAGS(r5) diff --git a/trunk/arch/powerpc/sysdev/fsl_pci.c b/trunk/arch/powerpc/sysdev/fsl_pci.c index 6073288fed29..edbf79465d50 100644 --- a/trunk/arch/powerpc/sysdev/fsl_pci.c +++ b/trunk/arch/powerpc/sysdev/fsl_pci.c @@ -36,7 +36,7 @@ static int fsl_pcie_bus_fixup, is_mpc83xx_pci; -static void __init quirk_fsl_pcie_header(struct pci_dev *dev) +static void __devinit quirk_fsl_pcie_header(struct pci_dev *dev) { u8 progif; diff --git a/trunk/drivers/char/mem.c b/trunk/drivers/char/mem.c index e5eedfa24c91..67c3371723cc 100644 --- a/trunk/drivers/char/mem.c +++ b/trunk/drivers/char/mem.c @@ -27,16 +27,14 @@ #include #include #include -#include #include +#include #ifdef CONFIG_IA64 # include #endif -#define DEVPORT_MINOR 4 - static inline unsigned long size_inside_page(unsigned long start, unsigned long size) { @@ -896,13 +894,6 @@ static int __init chr_dev_init(void) for (minor = 1; minor < ARRAY_SIZE(devlist); minor++) { if (!devlist[minor].name) continue; - - /* - * Create /dev/port? - */ - if ((minor == DEVPORT_MINOR) && !arch_has_dev_port()) - continue; - device_create(mem_class, NULL, MKDEV(MEM_MAJOR, minor), NULL, devlist[minor].name); } diff --git a/trunk/drivers/i2c/busses/i2c-powermac.c b/trunk/drivers/i2c/busses/i2c-powermac.c index 5285f8565de4..31c47e18d83c 100644 --- a/trunk/drivers/i2c/busses/i2c-powermac.c +++ b/trunk/drivers/i2c/busses/i2c-powermac.c @@ -227,138 +227,28 @@ static int __devexit i2c_powermac_remove(struct platform_device *dev) return 0; } -static u32 __devinit i2c_powermac_get_addr(struct i2c_adapter *adap, - struct pmac_i2c_bus *bus, - struct device_node *node) -{ - const __be32 *prop; - int len; - - /* First check for valid "reg" */ - prop = of_get_property(node, "reg", &len); - if (prop && (len >= sizeof(int))) - return (be32_to_cpup(prop) & 0xff) >> 1; - - /* Then check old-style "i2c-address" */ - prop = of_get_property(node, "i2c-address", &len); - if (prop && (len >= sizeof(int))) - return (be32_to_cpup(prop) & 0xff) >> 1; - - /* Now handle some devices with missing "reg" properties */ - if (!strcmp(node->name, "cereal")) - return 0x60; - else if (!strcmp(node->name, "deq")) - return 0x34; - - dev_warn(&adap->dev, "No i2c address for %s\n", node->full_name); - - return 0xffffffff; -} - -static void __devinit i2c_powermac_create_one(struct i2c_adapter *adap, - const char *type, - u32 addr) -{ - struct i2c_board_info info = {}; - struct i2c_client *newdev; - - strncpy(info.type, type, sizeof(info.type)); - info.addr = addr; - newdev = i2c_new_device(adap, &info); - if (!newdev) - dev_err(&adap->dev, - "i2c-powermac: Failure to register missing %s\n", - type); -} - -static void __devinit i2c_powermac_add_missing(struct i2c_adapter *adap, - struct pmac_i2c_bus *bus, - bool found_onyx) -{ - struct device_node *busnode = pmac_i2c_get_bus_node(bus); - int rc; - - /* Check for the onyx audio codec */ -#define ONYX_REG_CONTROL 67 - if (of_device_is_compatible(busnode, "k2-i2c") && !found_onyx) { - union i2c_smbus_data data; - - rc = i2c_smbus_xfer(adap, 0x46, 0, I2C_SMBUS_READ, - ONYX_REG_CONTROL, I2C_SMBUS_BYTE_DATA, - &data); - if (rc >= 0) - i2c_powermac_create_one(adap, "MAC,pcm3052", 0x46); - - rc = i2c_smbus_xfer(adap, 0x47, 0, I2C_SMBUS_READ, - ONYX_REG_CONTROL, I2C_SMBUS_BYTE_DATA, - &data); - if (rc >= 0) - i2c_powermac_create_one(adap, "MAC,pcm3052", 0x47); - } -} - -static bool __devinit i2c_powermac_get_type(struct i2c_adapter *adap, - struct device_node *node, - u32 addr, char *type, int type_size) -{ - char tmp[16]; - - /* Note: we to _NOT_ want the standard - * i2c drivers to match with any of our powermac stuff - * unless they have been specifically modified to handle - * it on a case by case basis. For example, for thermal - * control, things like lm75 etc... shall match with their - * corresponding windfarm drivers, _NOT_ the generic ones, - * so we force a prefix of AAPL, onto the modalias to - * make that happen - */ - - /* First try proper modalias */ - if (of_modalias_node(node, tmp, sizeof(tmp)) >= 0) { - snprintf(type, type_size, "MAC,%s", tmp); - return true; - } - - /* Now look for known workarounds */ - if (!strcmp(node->name, "deq")) { - /* Apple uses address 0x34 for TAS3001 and 0x35 for TAS3004 */ - if (addr == 0x34) { - snprintf(type, type_size, "MAC,tas3001"); - return true; - } else if (addr == 0x35) { - snprintf(type, type_size, "MAC,tas3004"); - return true; - } - } - - dev_err(&adap->dev, "i2c-powermac: modalias failure" - " on %s\n", node->full_name); - return false; -} - static void __devinit i2c_powermac_register_devices(struct i2c_adapter *adap, struct pmac_i2c_bus *bus) { struct i2c_client *newdev; struct device_node *node; - bool found_onyx = 0; - - /* - * In some cases we end up with the via-pmu node itself, in this - * case we skip this function completely as the device-tree will - * not contain anything useful. - */ - if (!strcmp(adap->dev.of_node->name, "via-pmu")) - return; for_each_child_of_node(adap->dev.of_node, node) { struct i2c_board_info info = {}; + struct dev_archdata dev_ad = {}; + const __be32 *reg; + char tmp[16]; u32 addr; + int len; /* Get address & channel */ - addr = i2c_powermac_get_addr(adap, bus, node); - if (addr == 0xffffffff) + reg = of_get_property(node, "reg", &len); + if (!reg || (len < sizeof(int))) { + dev_err(&adap->dev, "i2c-powermac: invalid reg on %s\n", + node->full_name); continue; + } + addr = be32_to_cpup(reg); /* Multibus setup, check channel */ if (!pmac_i2c_match_adapter(node, adap)) @@ -367,23 +257,27 @@ static void __devinit i2c_powermac_register_devices(struct i2c_adapter *adap, dev_dbg(&adap->dev, "i2c-powermac: register %s\n", node->full_name); - /* - * Keep track of some device existence to handle - * workarounds later. + /* Make up a modalias. Note: we to _NOT_ want the standard + * i2c drivers to match with any of our powermac stuff + * unless they have been specifically modified to handle + * it on a case by case basis. For example, for thermal + * control, things like lm75 etc... shall match with their + * corresponding windfarm drivers, _NOT_ the generic ones, + * so we force a prefix of AAPL, onto the modalias to + * make that happen */ - if (of_device_is_compatible(node, "pcm3052")) - found_onyx = true; - - /* Make up a modalias */ - if (!i2c_powermac_get_type(adap, node, addr, - info.type, sizeof(info.type))) { + if (of_modalias_node(node, tmp, sizeof(tmp)) < 0) { + dev_err(&adap->dev, "i2c-powermac: modalias failure" + " on %s\n", node->full_name); continue; } + snprintf(info.type, sizeof(info.type), "MAC,%s", tmp); /* Fill out the rest of the info structure */ - info.addr = addr; + info.addr = (addr & 0xff) >> 1; info.irq = irq_of_parse_and_map(node, 0); info.of_node = of_node_get(node); + info.archdata = &dev_ad; newdev = i2c_new_device(adap, &info); if (!newdev) { @@ -398,9 +292,6 @@ static void __devinit i2c_powermac_register_devices(struct i2c_adapter *adap, continue; } } - - /* Additional workarounds */ - i2c_powermac_add_missing(adap, bus, found_onyx); } static int __devinit i2c_powermac_probe(struct platform_device *dev) diff --git a/trunk/drivers/of/base.c b/trunk/drivers/of/base.c index bc86ea2af668..eada3f4ef801 100644 --- a/trunk/drivers/of/base.c +++ b/trunk/drivers/of/base.c @@ -1073,8 +1073,7 @@ int prom_remove_property(struct device_node *np, struct property *prop) } /* - * prom_update_property - Update a property in a node, if the property does - * not exist, add it. + * prom_update_property - Update a property in a node. * * Note that we don't actually remove it, since we have given out * who-knows-how-many pointers to the data using get-property. @@ -1082,19 +1081,13 @@ int prom_remove_property(struct device_node *np, struct property *prop) * and add the new property to the property list */ int prom_update_property(struct device_node *np, - struct property *newprop) + struct property *newprop, + struct property *oldprop) { - struct property **next, *oldprop; + struct property **next; unsigned long flags; int found = 0; - if (!newprop->name) - return -EINVAL; - - oldprop = of_find_property(np, newprop->name, NULL); - if (!oldprop) - return prom_add_property(np, newprop); - write_lock_irqsave(&devtree_lock, flags); next = &np->properties; while (*next) { diff --git a/trunk/fs/proc/proc_devtree.c b/trunk/fs/proc/proc_devtree.c index df7dd08d4391..927cbd115e53 100644 --- a/trunk/fs/proc/proc_devtree.c +++ b/trunk/fs/proc/proc_devtree.c @@ -101,11 +101,6 @@ void proc_device_tree_update_prop(struct proc_dir_entry *pde, { struct proc_dir_entry *ent; - if (!oldprop) { - proc_device_tree_add_prop(pde, newprop); - return; - } - for (ent = pde->subdir; ent != NULL; ent = ent->next) if (ent->data == oldprop) break; diff --git a/trunk/include/linux/io.h b/trunk/include/linux/io.h index 069e4075f872..7fd2d2138bf3 100644 --- a/trunk/include/linux/io.h +++ b/trunk/include/linux/io.h @@ -67,13 +67,4 @@ int check_signature(const volatile void __iomem *io_addr, const unsigned char *signature, int length); void devm_ioremap_release(struct device *dev, void *res); -/* - * Some systems do not have legacy ISA devices. - * /dev/port is not a valid interface on these systems. - * So for those archs, should define the following symbol. - */ -#ifndef arch_has_dev_port -#define arch_has_dev_port() (1) -#endif - #endif /* _LINUX_IO_H */ diff --git a/trunk/include/linux/of.h b/trunk/include/linux/of.h index b27c87191df2..2ec1083af7ff 100644 --- a/trunk/include/linux/of.h +++ b/trunk/include/linux/of.h @@ -260,7 +260,8 @@ extern int of_machine_is_compatible(const char *compat); extern int prom_add_property(struct device_node* np, struct property* prop); extern int prom_remove_property(struct device_node *np, struct property *prop); extern int prom_update_property(struct device_node *np, - struct property *newprop); + struct property *newprop, + struct property *oldprop); #if defined(CONFIG_OF_DYNAMIC) /* For updating the device tree at runtime */ diff --git a/trunk/sound/aoa/codecs/onyx.c b/trunk/sound/aoa/codecs/onyx.c index 4cedc6950d72..270790d384e2 100644 --- a/trunk/sound/aoa/codecs/onyx.c +++ b/trunk/sound/aoa/codecs/onyx.c @@ -997,10 +997,45 @@ static void onyx_exit_codec(struct aoa_codec *codec) onyx->codec.soundbus_dev->detach_codec(onyx->codec.soundbus_dev, onyx); } +static int onyx_create(struct i2c_adapter *adapter, + struct device_node *node, + int addr) +{ + struct i2c_board_info info; + struct i2c_client *client; + + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "aoa_codec_onyx", I2C_NAME_SIZE); + info.addr = addr; + info.platform_data = node; + client = i2c_new_device(adapter, &info); + if (!client) + return -ENODEV; + + /* + * We know the driver is already loaded, so the device should be + * already bound. If not it means binding failed, which suggests + * the device doesn't really exist and should be deleted. + * Ideally this would be replaced by better checks _before_ + * instantiating the device. + */ + if (!client->driver) { + i2c_unregister_device(client); + return -ENODEV; + } + + /* + * Let i2c-core delete that device on driver removal. + * This is safe because i2c-core holds the core_lock mutex for us. + */ + list_add_tail(&client->detected, &client->driver->clients); + return 0; +} + static int onyx_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { - struct device_node *node = client->dev.of_node; + struct device_node *node = client->dev.platform_data; struct onyx *onyx; u8 dummy; @@ -1036,6 +1071,40 @@ static int onyx_i2c_probe(struct i2c_client *client, return -ENODEV; } +static int onyx_i2c_attach(struct i2c_adapter *adapter) +{ + struct device_node *busnode, *dev = NULL; + struct pmac_i2c_bus *bus; + + bus = pmac_i2c_adapter_to_bus(adapter); + if (bus == NULL) + return -ENODEV; + busnode = pmac_i2c_get_bus_node(bus); + + while ((dev = of_get_next_child(busnode, dev)) != NULL) { + if (of_device_is_compatible(dev, "pcm3052")) { + const u32 *addr; + printk(KERN_DEBUG PFX "found pcm3052\n"); + addr = of_get_property(dev, "reg", NULL); + if (!addr) + return -ENODEV; + return onyx_create(adapter, dev, (*addr)>>1); + } + } + + /* if that didn't work, try desperate mode for older + * machines that have stuff missing from the device tree */ + + if (!of_device_is_compatible(busnode, "k2-i2c")) + return -ENODEV; + + printk(KERN_DEBUG PFX "found k2-i2c, checking if onyx chip is on it\n"); + /* probe both possible addresses for the onyx chip */ + if (onyx_create(adapter, NULL, 0x46) == 0) + return 0; + return onyx_create(adapter, NULL, 0x47); +} + static int onyx_i2c_remove(struct i2c_client *client) { struct onyx *onyx = i2c_get_clientdata(client); @@ -1048,16 +1117,16 @@ static int onyx_i2c_remove(struct i2c_client *client) } static const struct i2c_device_id onyx_i2c_id[] = { - { "MAC,pcm3052", 0 }, + { "aoa_codec_onyx", 0 }, { } }; -MODULE_DEVICE_TABLE(i2c,onyx_i2c_id); static struct i2c_driver onyx_driver = { .driver = { .name = "aoa_codec_onyx", .owner = THIS_MODULE, }, + .attach_adapter = onyx_i2c_attach, .probe = onyx_i2c_probe, .remove = onyx_i2c_remove, .id_table = onyx_i2c_id, diff --git a/trunk/sound/aoa/codecs/tas.c b/trunk/sound/aoa/codecs/tas.c index c491ae0f749c..8e63d1f35ce1 100644 --- a/trunk/sound/aoa/codecs/tas.c +++ b/trunk/sound/aoa/codecs/tas.c @@ -883,10 +883,43 @@ static void tas_exit_codec(struct aoa_codec *codec) } +static int tas_create(struct i2c_adapter *adapter, + struct device_node *node, + int addr) +{ + struct i2c_board_info info; + struct i2c_client *client; + + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "aoa_codec_tas", I2C_NAME_SIZE); + info.addr = addr; + info.platform_data = node; + + client = i2c_new_device(adapter, &info); + if (!client) + return -ENODEV; + /* + * We know the driver is already loaded, so the device should be + * already bound. If not it means binding failed, and then there + * is no point in keeping the device instantiated. + */ + if (!client->driver) { + i2c_unregister_device(client); + return -ENODEV; + } + + /* + * Let i2c-core delete that device on driver removal. + * This is safe because i2c-core holds the core_lock mutex for us. + */ + list_add_tail(&client->detected, &client->driver->clients); + return 0; +} + static int tas_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { - struct device_node *node = client->dev.of_node; + struct device_node *node = client->dev.platform_data; struct tas *tas; tas = kzalloc(sizeof(struct tas), GFP_KERNEL); @@ -920,6 +953,47 @@ static int tas_i2c_probe(struct i2c_client *client, return -EINVAL; } +static int tas_i2c_attach(struct i2c_adapter *adapter) +{ + struct device_node *busnode, *dev = NULL; + struct pmac_i2c_bus *bus; + + bus = pmac_i2c_adapter_to_bus(adapter); + if (bus == NULL) + return -ENODEV; + busnode = pmac_i2c_get_bus_node(bus); + + while ((dev = of_get_next_child(busnode, dev)) != NULL) { + if (of_device_is_compatible(dev, "tas3004")) { + const u32 *addr; + printk(KERN_DEBUG PFX "found tas3004\n"); + addr = of_get_property(dev, "reg", NULL); + if (!addr) + continue; + return tas_create(adapter, dev, ((*addr) >> 1) & 0x7f); + } + /* older machines have no 'codec' node with a 'compatible' + * property that says 'tas3004', they just have a 'deq' + * node without any such property... */ + if (strcmp(dev->name, "deq") == 0) { + const u32 *_addr; + u32 addr; + printk(KERN_DEBUG PFX "found 'deq' node\n"); + _addr = of_get_property(dev, "i2c-address", NULL); + if (!_addr) + continue; + addr = ((*_addr) >> 1) & 0x7f; + /* now, if the address doesn't match any of the two + * that a tas3004 can have, we cannot handle this. + * I doubt it ever happens but hey. */ + if (addr != 0x34 && addr != 0x35) + continue; + return tas_create(adapter, dev, addr); + } + } + return -ENODEV; +} + static int tas_i2c_remove(struct i2c_client *client) { struct tas *tas = i2c_get_clientdata(client); @@ -937,16 +1011,16 @@ static int tas_i2c_remove(struct i2c_client *client) } static const struct i2c_device_id tas_i2c_id[] = { - { "MAC,tas3004", 0 }, + { "aoa_codec_tas", 0 }, { } }; -MODULE_DEVICE_TABLE(i2c,tas_i2c_id); static struct i2c_driver tas_driver = { .driver = { .name = "aoa_codec_tas", .owner = THIS_MODULE, }, + .attach_adapter = tas_i2c_attach, .probe = tas_i2c_probe, .remove = tas_i2c_remove, .id_table = tas_i2c_id,