Merge branch 'merge' into next
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Sun, 25 Nov 2012 22:23:57 +0000 (09:23 +1100)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Sun, 25 Nov 2012 22:23:57 +0000 (09:23 +1100)
Merge my own merge branch to get various fixes from there
and upstream, especially the hvc console tty refcouting fixes
which which testing is quite a bit harder...

98 files changed:
Documentation/powerpc/ptrace.txt
arch/arm/mach-mxs/mach-mxs.c
arch/powerpc/Makefile
arch/powerpc/configs/pseries_defconfig
arch/powerpc/include/asm/bitops.h
arch/powerpc/include/asm/cputable.h
arch/powerpc/include/asm/dbell.h
arch/powerpc/include/asm/exception-64s.h
arch/powerpc/include/asm/firmware.h
arch/powerpc/include/asm/fsl_gtm.h
arch/powerpc/include/asm/hvcall.h
arch/powerpc/include/asm/immap_qe.h
arch/powerpc/include/asm/machdep.h
arch/powerpc/include/asm/mmu.h
arch/powerpc/include/asm/pSeries_reconfig.h [deleted file]
arch/powerpc/include/asm/ppc-opcode.h
arch/powerpc/include/asm/prom.h
arch/powerpc/include/asm/qe.h
arch/powerpc/include/asm/qe_ic.h
arch/powerpc/include/asm/reg.h
arch/powerpc/include/asm/rtas.h
arch/powerpc/include/asm/setup.h [new file with mode: 0644]
arch/powerpc/include/asm/ucc.h
arch/powerpc/include/asm/ucc_fast.h
arch/powerpc/include/asm/ucc_slow.h
arch/powerpc/include/asm/udbg.h
arch/powerpc/include/uapi/asm/setup.h
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/cpu_setup_power.S [moved from arch/powerpc/kernel/cpu_setup_power7.S with 80% similarity]
arch/powerpc/kernel/cputable.c
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/exceptions-64s.S
arch/powerpc/kernel/head_64.S
arch/powerpc/kernel/idle.c
arch/powerpc/kernel/iommu.c
arch/powerpc/kernel/machine_kexec.c
arch/powerpc/kernel/machine_kexec_64.c
arch/powerpc/kernel/pci_32.c
arch/powerpc/kernel/prom.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/kernel/ptrace.c
arch/powerpc/kernel/rtas.c
arch/powerpc/kernel/rtas_flash.c
arch/powerpc/kernel/setup_64.c
arch/powerpc/kernel/udbg.c
arch/powerpc/mm/numa.c
arch/powerpc/mm/tlb_nohash_low.S
arch/powerpc/perf/power7-pmu.c
arch/powerpc/platforms/52xx/lite5200.c
arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
arch/powerpc/platforms/83xx/mpc832x_mds.c
arch/powerpc/platforms/83xx/mpc836x_mds.c
arch/powerpc/platforms/83xx/mpc836x_rdk.c
arch/powerpc/platforms/83xx/mpc837x_rdb.c
arch/powerpc/platforms/85xx/mpc85xx_mds.c
arch/powerpc/platforms/85xx/p1022_ds.c
arch/powerpc/platforms/powermac/cpufreq_32.c
arch/powerpc/platforms/powernv/pci-ioda.c
arch/powerpc/platforms/ps3/os-area.c
arch/powerpc/platforms/pseries/dlpar.c
arch/powerpc/platforms/pseries/firmware.c
arch/powerpc/platforms/pseries/hotplug-cpu.c
arch/powerpc/platforms/pseries/hotplug-memory.c
arch/powerpc/platforms/pseries/iommu.c
arch/powerpc/platforms/pseries/mobility.c
arch/powerpc/platforms/pseries/plpar_wrappers.h
arch/powerpc/platforms/pseries/reconfig.c
arch/powerpc/platforms/pseries/setup.c
arch/powerpc/platforms/pseries/smp.c
arch/powerpc/sysdev/fsl_gtm.c
arch/powerpc/sysdev/pmi.c
arch/powerpc/sysdev/qe_lib/qe.c
arch/powerpc/sysdev/qe_lib/qe_ic.c
arch/powerpc/sysdev/qe_lib/qe_ic.h
arch/powerpc/sysdev/qe_lib/qe_io.c
arch/powerpc/sysdev/qe_lib/ucc.c
arch/powerpc/sysdev/qe_lib/ucc_fast.c
arch/powerpc/sysdev/qe_lib/ucc_slow.c
arch/powerpc/sysdev/qe_lib/usb.c
arch/powerpc/xmon/Makefile
arch/powerpc/xmon/nonstdio.c
arch/powerpc/xmon/nonstdio.h
arch/powerpc/xmon/start.c [deleted file]
arch/powerpc/xmon/xmon.c
drivers/crypto/nx/nx-842.c
drivers/crypto/nx/nx.c
drivers/infiniband/hw/ehca/hcp_if.c
drivers/macintosh/smu.c
drivers/macintosh/windfarm_fcu_controls.c
drivers/macintosh/windfarm_lm75_sensor.c
drivers/macintosh/windfarm_max6690_sensor.c
drivers/macintosh/windfarm_smu_sat.c
drivers/net/ethernet/ibm/ehea/ehea_phyp.h
drivers/of/base.c
drivers/video/Kconfig
drivers/video/gxt4500.c
include/linux/of.h
tools/perf/perf.h

index f4a5499b7bc6823fd95d6701965e4e1e0e7d07c5..f2a7a3919772ef8e36075231cdad82435cba718a 100644 (file)
@@ -127,6 +127,22 @@ Some examples of using the structure to:
   p.addr2           = (uint64_t) end_range;
   p.condition_value = 0;
 
+- set a watchpoint in server processors (BookS)
+
+  p.version         = 1;
+  p.trigger_type    = PPC_BREAKPOINT_TRIGGER_RW;
+  p.addr_mode       = PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE;
+  or
+  p.addr_mode       = PPC_BREAKPOINT_MODE_EXACT;
+
+  p.condition_mode  = PPC_BREAKPOINT_CONDITION_NONE;
+  p.addr            = (uint64_t) begin_range;
+  /* For PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE addr2 needs to be specified, where
+   * addr2 - addr <= 8 Bytes.
+   */
+  p.addr2           = (uint64_t) end_range;
+  p.condition_value = 0;
+
 3. PTRACE_DELHWDEBUG
 
 Takes an integer which identifies an existing breakpoint or watchpoint
index 4748ec551a6818f6f2eb55f520729c3ba17cc48e..d61b915ce52c9377958bdaf58515698333fd749c 100644 (file)
@@ -211,7 +211,7 @@ static void __init update_fec_mac_prop(enum mac_oui oui)
                macaddr[4] = (val >> 8) & 0xff;
                macaddr[5] = (val >> 0) & 0xff;
 
-               prom_update_property(np, newmac);
+               of_update_property(np, newmac);
        }
 }
 
index 159e94f4b22aa3b808587812ccc013ff7bc18ee7..b639852116fa3465a38347fc7186a605b0383ec9 100644 (file)
@@ -181,7 +181,7 @@ $(BOOT_TARGETS2): vmlinux
 bootwrapper_install:
        $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
 
-%.dtb:
+%.dtb: scripts
        $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
 
 define archhelp
index 1f710a32ffae840e4fca8af13e13b4607410b5c6..5b8e1e508270a9b931eb33508c37d971d4956432 100644 (file)
@@ -2,7 +2,7 @@ CONFIG_PPC64=y
 CONFIG_ALTIVEC=y
 CONFIG_VSX=y
 CONFIG_SMP=y
-CONFIG_NR_CPUS=1024
+CONFIG_NR_CPUS=2048
 CONFIG_EXPERIMENTAL=y
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
index dc2cf9c6d9e65cc0a3592ce8275dcb114b6d6401..ef918a2328bba044173e61a799d23f8ae3cf2576 100644 (file)
@@ -52,8 +52,6 @@
 #define smp_mb__before_clear_bit()     smp_mb()
 #define smp_mb__after_clear_bit()      smp_mb()
 
-#define BITOP_MASK(nr)         (1UL << ((nr) % BITS_PER_LONG))
-#define BITOP_WORD(nr)         ((nr) / BITS_PER_LONG)
 #define BITOP_LE_SWIZZLE       ((BITS_PER_LONG-1) & ~0x7)
 
 /* Macro for generating the ***_bits() functions */
@@ -83,22 +81,22 @@ DEFINE_BITOP(change_bits, xor, "", "")
 
 static __inline__ void set_bit(int nr, volatile unsigned long *addr)
 {
-       set_bits(BITOP_MASK(nr), addr + BITOP_WORD(nr));
+       set_bits(BIT_MASK(nr), addr + BIT_WORD(nr));
 }
 
 static __inline__ void clear_bit(int nr, volatile unsigned long *addr)
 {
-       clear_bits(BITOP_MASK(nr), addr + BITOP_WORD(nr));
+       clear_bits(BIT_MASK(nr), addr + BIT_WORD(nr));
 }
 
 static __inline__ void clear_bit_unlock(int nr, volatile unsigned long *addr)
 {
-       clear_bits_unlock(BITOP_MASK(nr), addr + BITOP_WORD(nr));
+       clear_bits_unlock(BIT_MASK(nr), addr + BIT_WORD(nr));
 }
 
 static __inline__ void change_bit(int nr, volatile unsigned long *addr)
 {
-       change_bits(BITOP_MASK(nr), addr + BITOP_WORD(nr));
+       change_bits(BIT_MASK(nr), addr + BIT_WORD(nr));
 }
 
 /* Like DEFINE_BITOP(), with changes to the arguments to 'op' and the output
@@ -136,26 +134,26 @@ DEFINE_TESTOP(test_and_change_bits, xor, PPC_ATOMIC_ENTRY_BARRIER,
 static __inline__ int test_and_set_bit(unsigned long nr,
                                       volatile unsigned long *addr)
 {
-       return test_and_set_bits(BITOP_MASK(nr), addr + BITOP_WORD(nr)) != 0;
+       return test_and_set_bits(BIT_MASK(nr), addr + BIT_WORD(nr)) != 0;
 }
 
 static __inline__ int test_and_set_bit_lock(unsigned long nr,
                                       volatile unsigned long *addr)
 {
-       return test_and_set_bits_lock(BITOP_MASK(nr),
-                               addr + BITOP_WORD(nr)) != 0;
+       return test_and_set_bits_lock(BIT_MASK(nr),
+                               addr + BIT_WORD(nr)) != 0;
 }
 
 static __inline__ int test_and_clear_bit(unsigned long nr,
                                         volatile unsigned long *addr)
 {
-       return test_and_clear_bits(BITOP_MASK(nr), addr + BITOP_WORD(nr)) != 0;
+       return test_and_clear_bits(BIT_MASK(nr), addr + BIT_WORD(nr)) != 0;
 }
 
 static __inline__ int test_and_change_bit(unsigned long nr,
                                          volatile unsigned long *addr)
 {
-       return test_and_change_bits(BITOP_MASK(nr), addr + BITOP_WORD(nr)) != 0;
+       return test_and_change_bits(BIT_MASK(nr), addr + BIT_WORD(nr)) != 0;
 }
 
 #include <asm-generic/bitops/non-atomic.h>
@@ -280,61 +278,8 @@ unsigned long __arch_hweight64(__u64 w);
 #include <asm-generic/bitops/find.h>
 
 /* Little-endian versions */
+#include <asm-generic/bitops/le.h>
 
-static __inline__ int test_bit_le(unsigned long nr,
-                                 __const__ void *addr)
-{
-       __const__ unsigned char *tmp = (__const__ unsigned char *) addr;
-       return (tmp[nr >> 3] >> (nr & 7)) & 1;
-}
-
-static inline void set_bit_le(int nr, void *addr)
-{
-       set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
-}
-
-static inline void clear_bit_le(int nr, void *addr)
-{
-       clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
-}
-
-static inline void __set_bit_le(int nr, void *addr)
-{
-       __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
-}
-
-static inline void __clear_bit_le(int nr, void *addr)
-{
-       __clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
-}
-
-static inline int test_and_set_bit_le(int nr, void *addr)
-{
-       return test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
-}
-
-static inline int test_and_clear_bit_le(int nr, void *addr)
-{
-       return test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
-}
-
-static inline int __test_and_set_bit_le(int nr, void *addr)
-{
-       return __test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
-}
-
-static inline int __test_and_clear_bit_le(int nr, void *addr)
-{
-       return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
-}
-
-#define find_first_zero_bit_le(addr, size) \
-       find_next_zero_bit_le((addr), (size), 0)
-unsigned long find_next_zero_bit_le(const void *addr,
-                                   unsigned long size, unsigned long offset);
-
-unsigned long find_next_bit_le(const void *addr,
-                                   unsigned long size, unsigned long offset);
 /* Bitmap functions for the ext2 filesystem */
 
 #include <asm-generic/bitops/ext2-atomic-setbit.h>
index 21a0687b8c4da061927ebb6e89e84b1d6035c16f..76f81bd64f1df31efca14ea59f9aa71f6e67af34 100644 (file)
@@ -401,6 +401,14 @@ extern const char *powerpc_base_platform;
            CPU_FTR_DSCR | CPU_FTR_SAO  | CPU_FTR_ASYM_SMT | \
            CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
            CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY)
+#define CPU_FTRS_POWER8 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
+           CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\
+           CPU_FTR_MMCRA | CPU_FTR_SMT | \
+           CPU_FTR_COHERENT_ICACHE | \
+           CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
+           CPU_FTR_DSCR | CPU_FTR_SAO  | \
+           CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
+           CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY)
 #define CPU_FTRS_CELL  (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
            CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
            CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
@@ -421,8 +429,8 @@ extern const char *powerpc_base_platform;
 #define CPU_FTRS_POSSIBLE      \
            (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 |        \
            CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 |       \
-           CPU_FTRS_POWER7 | CPU_FTRS_CELL | CPU_FTRS_PA6T |           \
-           CPU_FTR_VSX)
+           CPU_FTRS_POWER7 | CPU_FTRS_POWER8 | CPU_FTRS_CELL |         \
+           CPU_FTRS_PA6T | CPU_FTR_VSX)
 #endif
 #else
 enum {
index 154c067761b15bbf50af6bf099bed0c997ff542e..607e4eeeb694df518fe6db2078c5475ebeae01b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Freescale Semicondutor, Inc.
+ * Copyright 2009 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
index a43c1473915fd745cc50cb8b574065ce7ad12507..ad708dda3ba371a5a63b9f5e970870dd0e9aaa71 100644 (file)
 #define EX_LR          72
 #define EX_CFAR                80
 
+#ifdef CONFIG_RELOCATABLE
+#define EXCEPTION_RELON_PROLOG_PSERIES_1(label, h)                     \
+       ld      r12,PACAKBASE(r13);     /* get high part of &label */   \
+       mfspr   r11,SPRN_##h##SRR0;     /* save SRR0 */                 \
+       LOAD_HANDLER(r12,label);                                        \
+       mtlr    r12;                                                    \
+       mfspr   r12,SPRN_##h##SRR1;     /* and SRR1 */                  \
+       li      r10,MSR_RI;                                             \
+       mtmsrd  r10,1;                  /* Set RI (EE=0) */             \
+       blr;
+#else
+/* If not relocatable, we can jump directly -- and save messing with LR */
+#define EXCEPTION_RELON_PROLOG_PSERIES_1(label, h)                     \
+       mfspr   r11,SPRN_##h##SRR0;     /* save SRR0 */                 \
+       mfspr   r12,SPRN_##h##SRR1;     /* and SRR1 */                  \
+       li      r10,MSR_RI;                                             \
+       mtmsrd  r10,1;                  /* Set RI (EE=0) */             \
+       b       label;
+#endif
+
+/*
+ * As EXCEPTION_PROLOG_PSERIES(), except we've already got relocation on
+ * so no need to rfid.  Save lr in case we're CONFIG_RELOCATABLE, in which
+ * case EXCEPTION_RELON_PROLOG_PSERIES_1 will be using lr.
+ */
+#define EXCEPTION_RELON_PROLOG_PSERIES(area, label, h, extra, vec)     \
+       EXCEPTION_PROLOG_1(area, extra, vec);                           \
+       EXCEPTION_RELON_PROLOG_PSERIES_1(label, h)
+
 /*
  * We're short on space and time in the exception prolog, so we can't
  * use the normal SET_REG_IMMEDIATE macro. Normally we just need the
  * word.
  */
 #define LOAD_HANDLER(reg, label)                                       \
-       addi    reg,reg,(label)-_stext; /* virt addr of handler ... */
+       /* Handlers must be within 64K of kbase, which must be 64k aligned */ \
+       ori     reg,reg,(label)-_stext; /* virt addr of handler ... */
 
 /* Exception register prefixes */
 #define EXC_HV H
 #define EXC_STD
 
+#if defined(CONFIG_RELOCATABLE)
+/*
+ * If we support interrupts with relocation on AND we're a relocatable
+ * kernel, we need to use LR to get to the 2nd level handler.  So, save/restore
+ * it when required.
+ */
+#define SAVE_LR(reg, area)     mflr    reg ;   std     reg,area+EX_LR(r13)
+#define GET_LR(reg, area)                      ld      reg,area+EX_LR(r13)
+#define RESTORE_LR(reg, area)  ld      reg,area+EX_LR(r13) ; mtlr reg
+#else
+/* ...else LR is unused and in register. */
+#define SAVE_LR(reg, area)
+#define GET_LR(reg, area)      mflr    reg
+#define RESTORE_LR(reg, area)
+#endif
+
 #define __EXCEPTION_PROLOG_1(area, extra, vec)                         \
        GET_PACA(r13);                                                  \
        std     r9,area+EX_R9(r13);     /* save r9 - r12 */             \
        mfspr   r10,SPRN_CFAR;                                          \
        std     r10,area+EX_CFAR(r13);                                  \
        END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66);         \
+       SAVE_LR(r10, area);                                             \
        mfcr    r9;                                                     \
        extra(vec);                                                     \
        std     r11,area+EX_R11(r13);                                   \
@@ -169,6 +216,7 @@ do_kvm_##n:                                                         \
        sth     r1,PACA_TRAP_SAVE(r13);                                    \
        std     r3,area+EX_R3(r13);                                        \
        addi    r3,r13,area;            /* r3 -> where regs are saved*/    \
+       RESTORE_LR(r1, area);                                              \
        b       bad_stack;                                                 \
 3:     std     r9,_CCR(r1);            /* save CR in stackframe        */ \
        std     r11,_NIP(r1);           /* save SRR0 in stackframe      */ \
@@ -194,8 +242,8 @@ do_kvm_##n:                                                         \
        ld      r10,area+EX_CFAR(r13);                                     \
        std     r10,ORIG_GPR3(r1);                                         \
        END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66);            \
+       GET_LR(r9,area);                /* Get LR, later save to stack  */ \
        ld      r2,PACATOC(r13);        /* get kernel TOC into r2       */ \
-       mflr    r9;                     /* save LR in stackframe        */ \
        std     r9,_LINK(r1);                                              \
        mfctr   r10;                    /* save CTR in stackframe       */ \
        std     r10,_CTR(r1);                                              \
@@ -232,6 +280,26 @@ label##_hv:                                                \
        EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common,    \
                                 EXC_HV, KVMTEST, vec)
 
+#define STD_RELON_EXCEPTION_PSERIES(loc, vec, label)   \
+       . = loc;                                        \
+       .globl label##_relon_pSeries;                   \
+label##_relon_pSeries:                                 \
+       HMT_MEDIUM;                                     \
+       /* No guest interrupts come through here */     \
+       SET_SCRATCH0(r13);              /* save r13 */  \
+       EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
+                                      EXC_STD, KVMTEST_PR, vec)
+
+#define STD_RELON_EXCEPTION_HV(loc, vec, label)                \
+       . = loc;                                        \
+       .globl label##_relon_hv;                        \
+label##_relon_hv:                                      \
+       HMT_MEDIUM;                                     \
+       /* No guest interrupts come through here */     \
+       SET_SCRATCH0(r13);      /* save r13 */          \
+       EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
+                                      EXC_HV, KVMTEST, vec)
+
 /* This associate vector numbers with bits in paca->irq_happened */
 #define SOFTEN_VALUE_0x500     PACA_IRQ_EE
 #define SOFTEN_VALUE_0x502     PACA_IRQ_EE
@@ -257,6 +325,9 @@ label##_hv:                                         \
        KVMTEST(vec);                                                   \
        _SOFTEN_TEST(EXC_STD, vec)
 
+#define SOFTEN_NOTEST_PR(vec)          _SOFTEN_TEST(EXC_STD, vec)
+#define SOFTEN_NOTEST_HV(vec)          _SOFTEN_TEST(EXC_HV, vec)
+
 #define __MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra)             \
        HMT_MEDIUM;                                                     \
        SET_SCRATCH0(r13);    /* save r13 */                            \
@@ -279,6 +350,28 @@ label##_hv:                                                                \
        _MASKABLE_EXCEPTION_PSERIES(vec, label,                         \
                                    EXC_HV, SOFTEN_TEST_HV)
 
+#define __MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra)       \
+       HMT_MEDIUM;                                                     \
+       SET_SCRATCH0(r13);    /* save r13 */                            \
+       __EXCEPTION_PROLOG_1(PACA_EXGEN, extra, vec);           \
+       EXCEPTION_RELON_PROLOG_PSERIES_1(label##_common, h);
+#define _MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra)        \
+       __MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra)
+
+#define MASKABLE_RELON_EXCEPTION_PSERIES(loc, vec, label)              \
+       . = loc;                                                        \
+       .globl label##_relon_pSeries;                                   \
+label##_relon_pSeries:                                                 \
+       _MASKABLE_RELON_EXCEPTION_PSERIES(vec, label,                   \
+                                         EXC_STD, SOFTEN_NOTEST_PR)
+
+#define MASKABLE_RELON_EXCEPTION_HV(loc, vec, label)                   \
+       . = loc;                                                        \
+       .globl label##_relon_hv;                                        \
+label##_relon_hv:                                                      \
+       _MASKABLE_RELON_EXCEPTION_PSERIES(vec, label,                   \
+                                         EXC_HV, SOFTEN_NOTEST_HV)
+
 /*
  * Our exception common code can be passed various "additions"
  * to specify the behaviour of interrupts, whether to kick the
index ad0b751b0d78e418e799b7cb959091d4a6f35df7..973cc3be011b95950b7402a841337c02497cb06f 100644 (file)
@@ -49,6 +49,7 @@
 #define FW_FEATURE_XCMO                ASM_CONST(0x0000000008000000)
 #define FW_FEATURE_OPAL                ASM_CONST(0x0000000010000000)
 #define FW_FEATURE_OPALv2      ASM_CONST(0x0000000020000000)
+#define FW_FEATURE_SET_MODE    ASM_CONST(0x0000000040000000)
 
 #ifndef __ASSEMBLY__
 
@@ -62,7 +63,8 @@ enum {
                FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN |
                FW_FEATURE_BULK_REMOVE | FW_FEATURE_XDABR |
                FW_FEATURE_MULTITCE | FW_FEATURE_SPLPAR | FW_FEATURE_LPAR |
-               FW_FEATURE_CMO | FW_FEATURE_VPHN | FW_FEATURE_XCMO,
+               FW_FEATURE_CMO | FW_FEATURE_VPHN | FW_FEATURE_XCMO |
+               FW_FEATURE_SET_MODE,
        FW_FEATURE_PSERIES_ALWAYS = 0,
        FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL | FW_FEATURE_OPALv2,
        FW_FEATURE_POWERNV_ALWAYS = 0,
index 8e8c9b5032d33b61b9d9ca80c20369626f5a89a8..3b05808f9caa40cecda5b399daf39ca9fab095f0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Freescale General-purpose Timers Module
  *
- * Copyright (c) Freescale Semicondutor, Inc. 2006.
+ * Copyright 2006 Freescale Semiconductor, Inc.
  *               Shlomi Gridish <gridish@freescale.com>
  *               Jerry Huang <Chang-Ming.Huang@freescale.com>
  * Copyright (c) MontaVista Software, Inc. 2008.
index 7a867065db79a8286578180abc2e8a4d36272885..0975e5c0bb19f93f85cfc1b6552f4c405771ead4 100644 (file)
 #define H_RANDOM               0x300
 #define H_COP                  0x304
 #define H_GET_MPP_X            0x314
-#define MAX_HCALL_OPCODE       H_GET_MPP_X
+#define H_SET_MODE             0x31C
+#define MAX_HCALL_OPCODE       H_SET_MODE
 
 #ifndef __ASSEMBLY__
 
@@ -355,6 +356,26 @@ struct hvcall_mpp_x_data {
 
 int h_get_mpp_x(struct hvcall_mpp_x_data *mpp_x_data);
 
+static inline unsigned int get_longbusy_msecs(int longbusy_rc)
+{
+       switch (longbusy_rc) {
+       case H_LONG_BUSY_ORDER_1_MSEC:
+               return 1;
+       case H_LONG_BUSY_ORDER_10_MSEC:
+               return 10;
+       case H_LONG_BUSY_ORDER_100_MSEC:
+               return 100;
+       case H_LONG_BUSY_ORDER_1_SEC:
+               return 1000;
+       case H_LONG_BUSY_ORDER_10_SEC:
+               return 10000;
+       case H_LONG_BUSY_ORDER_100_SEC:
+               return 100000;
+       default:
+               return 1;
+       }
+}
+
 #ifdef CONFIG_PPC_PSERIES
 extern int CMO_PrPSP;
 extern int CMO_SecPSP;
index 61e8490786b808af0d93cb18729cb8b32c14bdec..bedbff891423de317b890b9b6e65ced3721d708f 100644 (file)
@@ -3,7 +3,7 @@
  * The Internal Memory Map for devices with QE on them. This
  * is the superset of all QE devices (8360, etc.).
 
- * Copyright (C) 2006. Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006. Freescale Semiconductor, Inc. All rights reserved.
  *
  * Authors:    Shlomi Gridish <gridish@freescale.com>
  *             Li Yang <leoli@freescale.com>
index c4231973edd351eacf480dacbdb3d1a529b1b08c..a338bc7cf9d48beefa3115ec78414f62dafb015b 100644 (file)
@@ -166,9 +166,6 @@ struct machdep_calls {
                                                unsigned long size,
                                                pgprot_t vma_prot);
 
-       /* Idle loop for this platform, leave empty for default idle loop */
-       void            (*idle_loop)(void);
-
        /*
         * Function for waiting for work with reduced power in idle loop;
         * called with interrupts disabled.
index 5e38eedea2186e679e989b2d8a8fd35aef897978..691fd8aca939f8762257de6423a9ea193fb96c8f 100644 (file)
 #define MMU_FTRS_POWER5                MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE
 #define MMU_FTRS_POWER6                MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE
 #define MMU_FTRS_POWER7                MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE
+#define MMU_FTRS_POWER8                MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE
 #define MMU_FTRS_CELL          MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \
                                MMU_FTR_CI_LARGE_PAGE
 #define MMU_FTRS_PA6T          MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \
diff --git a/arch/powerpc/include/asm/pSeries_reconfig.h b/arch/powerpc/include/asm/pSeries_reconfig.h
deleted file mode 100644 (file)
index c07edfe..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef _PPC64_PSERIES_RECONFIG_H
-#define _PPC64_PSERIES_RECONFIG_H
-#ifdef __KERNEL__
-
-#include <linux/notifier.h>
-
-/*
- * Use this API if your code needs to know about OF device nodes being
- * added or removed on pSeries systems.
- */
-
-#define PSERIES_RECONFIG_ADD           0x0001
-#define PSERIES_RECONFIG_REMOVE                0x0002
-#define PSERIES_DRCONF_MEM_ADD         0x0003
-#define PSERIES_DRCONF_MEM_REMOVE      0x0004
-#define PSERIES_UPDATE_PROPERTY                0x0005
-
-/**
- * pSeries_reconfig_notify - Notifier value structure for OFDT property updates
- *
- * @node: Device tree node which owns the property being updated
- * @property: Updated property
- */
-struct pSeries_reconfig_prop_update {
-       struct device_node *node;
-       struct property *property;
-};
-
-#ifdef CONFIG_PPC_PSERIES
-extern int pSeries_reconfig_notifier_register(struct notifier_block *);
-extern void pSeries_reconfig_notifier_unregister(struct notifier_block *);
-extern int pSeries_reconfig_notify(unsigned long action, void *p);
-/* Not the best place to put this, will be fixed when we move some
- * of the rtas suspend-me stuff to pseries */
-extern void pSeries_coalesce_init(void);
-#else /* !CONFIG_PPC_PSERIES */
-static inline int pSeries_reconfig_notifier_register(struct notifier_block *nb)
-{
-       return 0;
-}
-static inline void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) { }
-static inline void pSeries_coalesce_init(void) { }
-#endif /* CONFIG_PPC_PSERIES */
-
-
-#endif /* __KERNEL__ */
-#endif /* _PPC64_PSERIES_RECONFIG_H */
index 5f73ce63fcaeb79a6a10d7d77b92d82ad26331db..e434d8b68dda3dbc1871914d2b719c5e2f587e2e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Freescale Semicondutor, Inc.
+ * Copyright 2009 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -86,6 +86,7 @@
 #define PPC_INST_DCBA_MASK             0xfc0007fe
 #define PPC_INST_DCBAL                 0x7c2005ec
 #define PPC_INST_DCBZL                 0x7c2007ec
+#define PPC_INST_ICBT                  0x7c00002c
 #define PPC_INST_ISEL                  0x7c00001e
 #define PPC_INST_ISEL_MASK             0xfc00003e
 #define PPC_INST_LDARX                 0x7c0000a8
 #define __PPC_MB(s)    (((s) & 0x1f) << 6)
 #define __PPC_ME(s)    (((s) & 0x1f) << 1)
 #define __PPC_BI(s)    (((s) & 0x1f) << 16)
+#define __PPC_CT(t)    (((t) & 0x0f) << 21)
 
 /*
  * Only use the larx hint bit on 64bit CPUs. e500v1/v2 based CPUs will treat a
                                        __PPC_RS(t) | __PPC_RA0(a) | __PPC_RB(b))
 #define PPC_SLBFEE_DOT(t, b)   stringify_in_c(.long PPC_INST_SLBFEE | \
                                        __PPC_RT(t) | __PPC_RB(b))
+#define PPC_ICBT(c,a,b)                stringify_in_c(.long PPC_INST_ICBT | \
+                                      __PPC_CT(c) | __PPC_RA0(a) | __PPC_RB(b))
 /* PASemi instructions */
 #define LBZCIX(t,a,b)          stringify_in_c(.long PPC_INST_LBZCIX | \
                                       __PPC_RT(t) | __PPC_RA(a) | __PPC_RB(b))
index b5c91901e3840dd630c459c12322a122771e5030..99c92d5363e4d26d4917834deb36eaf1497c5519 100644 (file)
@@ -58,6 +58,22 @@ static inline int of_node_to_nid(struct device_node *device) { return 0; }
 
 extern void of_instantiate_rtc(void);
 
+/* The of_drconf_cell struct defines the layout of the LMB array
+ * specified in the device tree property
+ * ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory
+ */
+struct of_drconf_cell {
+       u64     base_addr;
+       u32     drc_index;
+       u32     reserved;
+       u32     aa_index;
+       u32     flags;
+};
+
+#define DRCONF_MEM_ASSIGNED    0x00000008
+#define DRCONF_MEM_AI_INVALID  0x00000040
+#define DRCONF_MEM_RESERVED    0x00000080
+
 /* These includes are put at the bottom because they may contain things
  * that are overridden by this file.  Ideally they shouldn't be included
  * by this file, but there are a bunch of .c files that currently depend
index 229571a49391366ed5eea30c8ce5d9cf05b91606..32b9bfa0c9bd39a3b17083afe4eda86dfbd34057 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Authors:    Shlomi Gridish <gridish@freescale.com>
  *             Li Yang <leoli@freescale.com>
index f706164b0bd0038d479f54a28b6314ff3861ba68..25784cc959a072a9dc50d0b596f28d0d3f56cc59 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Authors:    Shlomi Gridish <gridish@freescale.com>
  *             Li Yang <leoli@freescale.com>
index d24c14163966599ed3a78f559f80191f7cd53693..1b853f744f8b50e87c019b6740bba1aa140c48ee 100644 (file)
 #define   LPCR_RMLS    0x1C000000      /* impl dependent rmo limit sel */
 #define          LPCR_RMLS_SH  (63-37)
 #define   LPCR_ILE     0x02000000      /* !HV irqs set MSR:LE */
+#define   LPCR_AIL_0   0x00000000      /* MMU off exception offset 0x0 */
+#define   LPCR_AIL_3   0x01800000      /* MMU on exception offset 0xc00...4xxx */
 #define   LPCR_PECE    0x00007000      /* powersave exit cause enable */
 #define     LPCR_PECE0 0x00004000      /* ext. exceptions can cause exit */
 #define     LPCR_PECE1 0x00002000      /* decrementer can cause exit */
 #define PVR_970MP      0x0044
 #define PVR_970GX      0x0045
 #define PVR_POWER7p    0x004A
+#define PVR_POWER8     0x004B
 #define PVR_BE         0x0070
 #define PVR_PA6T       0x0090
 
index 557cff845deed0b6281bf983ccb8684352ea9874..aef00c675905eec1f718deefda05f08003a2936e 100644 (file)
@@ -353,8 +353,13 @@ static inline int page_is_rtas_user_buf(unsigned long pfn)
                return 1;
        return 0;
 }
+
+/* Not the best place to put pSeries_coalesce_init, will be fixed when we
+ * move some of the rtas suspend-me stuff to pseries */
+extern void pSeries_coalesce_init(void);
 #else
 static inline int page_is_rtas_user_buf(unsigned long pfn) { return 0;}
+static inline void pSeries_coalesce_init(void) { }
 #endif
 
 extern int call_rtas(const char *, int, int, unsigned long *, ...);
diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h
new file mode 100644 (file)
index 0000000..d3ca855
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef _ASM_POWERPC_SETUP_H
+#define _ASM_POWERPC_SETUP_H
+
+#include <uapi/asm/setup.h>
+
+#ifndef __ASSEMBLY__
+extern void ppc_printk_progress(char *s, unsigned short hex);
+
+extern unsigned int rtas_data;
+extern int mem_init_done;      /* set on boot once kmalloc can be called */
+extern int init_bootmem_done;  /* set once bootmem is available */
+extern unsigned long long memory_limit;
+extern unsigned long klimit;
+extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
+
+struct device_node;
+extern void note_scsi_host(struct device_node *, void *);
+
+/* Used in very early kernel initialization. */
+extern unsigned long reloc_offset(void);
+extern unsigned long add_reloc_offset(unsigned long);
+extern void reloc_got2(unsigned long);
+
+#define PTRRELOC(x)    ((typeof(x)) add_reloc_offset((unsigned long)(x)))
+
+#endif /* !__ASSEMBLY__ */
+
+#endif /* _ASM_POWERPC_SETUP_H */
+
index 46b09ba6bead6fa8b230436f6dc4508348189eff..6927ac26516ea7ef698c0552ef0f67cec27e6a65 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Authors:    Shlomi Gridish <gridish@freescale.com>
  *             Li Yang <leoli@freescale.com>
index 4644c840e2fad250364655e11f51ba06fc573274..72ea9bab07df4c1e63bd7022fe340cc7c16c0846 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Internal header file for UCC FAST unit routines.
  *
- * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Authors:    Shlomi Gridish <gridish@freescale.com>
  *             Li Yang <leoli@freescale.com>
index cf131ffdb8d1cbcb052ae95aedad8a8be8be6da6..c44131e68e11fa9566182766f42d4c57d314224a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Authors:    Shlomi Gridish <gridish@freescale.com>
  *             Li Yang <leoli@freescale.com>
index b3038817b8dc2a863287a5d0370d22e615e1377d..5a7510e9d09d3865619b7a874efa7584074b5f7a 100644 (file)
@@ -21,7 +21,6 @@ extern int (*udbg_getc_poll)(void);
 
 extern void udbg_puts(const char *s);
 extern int udbg_write(const char *s, int n);
-extern int udbg_read(char *buf, int buflen);
 
 extern void register_early_udbg_console(void);
 extern void udbg_printf(const char *fmt, ...)
index 8b9a306260b2cf7c7bc664d09ba2926bc1ac6dda..552df83f1a49627ddd1d49e1ba982c743a5bfefe 100644 (file)
@@ -1,32 +1 @@
-#ifndef _ASM_POWERPC_SETUP_H
-#define _ASM_POWERPC_SETUP_H
-
 #include <asm-generic/setup.h>
-
-#ifndef __ASSEMBLY__
-extern void ppc_printk_progress(char *s, unsigned short hex);
-
-extern unsigned int rtas_data;
-extern int mem_init_done;      /* set on boot once kmalloc can be called */
-extern int init_bootmem_done;  /* set once bootmem is available */
-extern unsigned long long memory_limit;
-extern unsigned long klimit;
-extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
-
-extern void via_cuda_init(void);
-extern void read_rtc_time(void);
-extern void pmac_find_display(void);
-
-struct device_node;
-extern void note_scsi_host(struct device_node *, void *);
-
-/* Used in very early kernel initialization. */
-extern unsigned long reloc_offset(void);
-extern unsigned long add_reloc_offset(unsigned long);
-extern void reloc_got2(unsigned long);
-
-#define PTRRELOC(x)    ((typeof(x)) add_reloc_offset((unsigned long)(x)))
-
-#endif /* !__ASSEMBLY__ */
-
-#endif /* _ASM_POWERPC_SETUP_H */
index cde12f8a4ebc4e98342491a2fcb91bd31fb26f05..8f619342f14c9b64fa03579b12c245ccad7ab489 100644 (file)
@@ -38,7 +38,7 @@ obj-$(CONFIG_PPC64)           += setup_64.o sys_ppc32.o \
                                   paca.o nvram_64.o firmware.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)       += hw_breakpoint.o
 obj-$(CONFIG_PPC_BOOK3S_64)    += cpu_setup_ppc970.o cpu_setup_pa6t.o
-obj-$(CONFIG_PPC_BOOK3S_64)    += cpu_setup_power7.o
+obj-$(CONFIG_PPC_BOOK3S_64)    += cpu_setup_power.o
 obj64-$(CONFIG_RELOCATABLE)    += reloc_64.o
 obj-$(CONFIG_PPC_BOOK3E_64)    += exceptions-64e.o idle_book3e.o
 obj-$(CONFIG_PPC_A2)           += cpu_setup_a2.o
similarity index 80%
rename from arch/powerpc/kernel/cpu_setup_power7.S
rename to arch/powerpc/kernel/cpu_setup_power.S
index 76797c5105d6f2e930da0fe6c639e26247d40515..57cf14065aecfd261269e21b428d8aba4f4856f4 100644 (file)
@@ -27,6 +27,7 @@ _GLOBAL(__setup_cpu_power7)
        beqlr
        li      r0,0
        mtspr   SPRN_LPID,r0
+       mfspr   r3,SPRN_LPCR
        bl      __init_LPCR
        bl      __init_TLB
        mtlr    r11
@@ -39,6 +40,35 @@ _GLOBAL(__restore_cpu_power7)
        beqlr
        li      r0,0
        mtspr   SPRN_LPID,r0
+       mfspr   r3,SPRN_LPCR
+       bl      __init_LPCR
+       bl      __init_TLB
+       mtlr    r11
+       blr
+
+_GLOBAL(__setup_cpu_power8)
+       mflr    r11
+       bl      __init_hvmode_206
+       mtlr    r11
+       beqlr
+       li      r0,0
+       mtspr   SPRN_LPID,r0
+       mfspr   r3,SPRN_LPCR
+       oris    r3, r3, LPCR_AIL_3@h
+       bl      __init_LPCR
+       bl      __init_TLB
+       mtlr    r11
+       blr
+
+_GLOBAL(__restore_cpu_power8)
+       mflr    r11
+       mfmsr   r3
+       rldicl. r0,r3,4,63
+       beqlr
+       li      r0,0
+       mtspr   SPRN_LPID,r0
+       mfspr   r3,SPRN_LPCR
+       oris    r3, r3, LPCR_AIL_3@h
        bl      __init_LPCR
        bl      __init_TLB
        mtlr    r11
@@ -57,6 +87,7 @@ __init_hvmode_206:
 
 __init_LPCR:
        /* Setup a sane LPCR:
+        *   Called with initial LPCR in R3
         *
         *   LPES = 0b01 (HSRR0/1 used for 0x500)
         *   PECE = 0b111
@@ -67,7 +98,6 @@ __init_LPCR:
         *
         * Other bits untouched for now
         */
-       mfspr   r3,SPRN_LPCR
        li      r5,1
        rldimi  r3,r5, LPCR_LPES_SH, 64-LPCR_LPES_SH-2
        ori     r3,r3,(LPCR_PECE0|LPCR_PECE1|LPCR_PECE2)
index 0514c21f138bee013812ab5bcffde2ddb84da60a..75a3d71b895d985e20307bdd90dda88e4449ed9c 100644 (file)
@@ -68,6 +68,8 @@ extern void __restore_cpu_pa6t(void);
 extern void __restore_cpu_ppc970(void);
 extern void __setup_cpu_power7(unsigned long offset, struct cpu_spec* spec);
 extern void __restore_cpu_power7(void);
+extern void __setup_cpu_power8(unsigned long offset, struct cpu_spec* spec);
+extern void __restore_cpu_power8(void);
 extern void __restore_cpu_a2(void);
 #endif /* CONFIG_PPC64 */
 #if defined(CONFIG_E500)
@@ -94,6 +96,10 @@ extern void __restore_cpu_e5500(void);
                                 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
                                 PPC_FEATURE_TRUE_LE | \
                                 PPC_FEATURE_PSERIES_PERFMON_COMPAT)
+#define COMMON_USER_POWER8     (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_06 |\
+                                PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
+                                PPC_FEATURE_TRUE_LE | \
+                                PPC_FEATURE_PSERIES_PERFMON_COMPAT)
 #define COMMON_USER_PA6T       (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
                                 PPC_FEATURE_TRUE_LE | \
                                 PPC_FEATURE_HAS_ALTIVEC_COMP)
@@ -429,6 +435,21 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .cpu_restore            = __restore_cpu_power7,
                .platform               = "power7",
        },
+       {       /* 2.07-compliant processor, i.e. Power8 "architected" mode */
+               .pvr_mask               = 0xffffffff,
+               .pvr_value              = 0x0f000004,
+               .cpu_name               = "POWER8 (architected)",
+               .cpu_features           = CPU_FTRS_POWER8,
+               .cpu_user_features      = COMMON_USER_POWER8,
+               .mmu_features           = MMU_FTRS_POWER8,
+               .icache_bsize           = 128,
+               .dcache_bsize           = 128,
+               .oprofile_type          = PPC_OPROFILE_POWER4,
+               .oprofile_cpu_type      = "ppc64/ibm-compat-v1",
+               .cpu_setup              = __setup_cpu_power8,
+               .cpu_restore            = __restore_cpu_power8,
+               .platform               = "power8",
+       },
        {       /* Power7 */
                .pvr_mask               = 0xffff0000,
                .pvr_value              = 0x003f0000,
@@ -463,6 +484,23 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .cpu_restore            = __restore_cpu_power7,
                .platform               = "power7+",
        },
+       {       /* Power8 */
+               .pvr_mask               = 0xffff0000,
+               .pvr_value              = 0x004b0000,
+               .cpu_name               = "POWER8 (raw)",
+               .cpu_features           = CPU_FTRS_POWER8,
+               .cpu_user_features      = COMMON_USER_POWER8,
+               .mmu_features           = MMU_FTRS_POWER8,
+               .icache_bsize           = 128,
+               .dcache_bsize           = 128,
+               .num_pmcs               = 6,
+               .pmc_type               = PPC_PMC_IBM,
+               .oprofile_cpu_type      = "ppc64/power8",
+               .oprofile_type          = PPC_OPROFILE_POWER4,
+               .cpu_setup              = __setup_cpu_power8,
+               .cpu_restore            = __restore_cpu_power8,
+               .platform               = "power8",
+       },
        {       /* Cell Broadband Engine */
                .pvr_mask               = 0xffff0000,
                .pvr_value              = 0x00700000,
index 56e0ff0878b5534c76b8c93818f7536498ce52df..ad7666695761103571c7aa5b258816d517a27392 100644 (file)
@@ -374,6 +374,8 @@ _GLOBAL(ret_from_kernel_thread)
        bl      .schedule_tail
        REST_NVGPRS(r1)
        REST_GPR(2,r1)
+       li      r3,0
+       std     r3,0(r1)
        mtlr    r14
        mr      r3,r15
        blrl
index 10b658ad65e16b455d7239670d42c0ae5c0b4d3b..4665e82fa37739a2ee9dec60880f033a68f060cf 100644 (file)
 /*
  * We layout physical memory as follows:
  * 0x0000 - 0x00ff : Secondary processor spin code
- * 0x0100 - 0x2fff : pSeries Interrupt prologs
- * 0x3000 - 0x5fff : interrupt support common interrupt prologs
- * 0x6000 - 0x6fff : Initial (CPU0) segment table
+ * 0x0100 - 0x17ff : pSeries Interrupt prologs
+ * 0x1800 - 0x4000 : interrupt support common interrupt prologs
+ * 0x4000 - 0x5fff : pSeries interrupts with IR=1,DR=1
+ * 0x6000 - 0x6fff : more interrupt support including for IR=1,DR=1
  * 0x7000 - 0x7fff : FWNMI data area
- * 0x8000 -        : Early init and support code
+ * 0x8000 - 0x8fff : Initial (CPU0) segment table
+ * 0x9000 -        : Early init and support code
  */
+       /* Syscall routine is used twice, in reloc-off and reloc-on paths */
+#define SYSCALL_PSERIES_1                                      \
+BEGIN_FTR_SECTION                                              \
+       cmpdi   r0,0x1ebe ;                                     \
+       beq-    1f ;                                            \
+END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)                         \
+       mr      r9,r13 ;                                        \
+       GET_PACA(r13) ;                                         \
+       mfspr   r11,SPRN_SRR0 ;                                 \
+0:
+
+#define SYSCALL_PSERIES_2_RFID                                         \
+       mfspr   r12,SPRN_SRR1 ;                                 \
+       ld      r10,PACAKBASE(r13) ;                            \
+       LOAD_HANDLER(r10, system_call_entry) ;                  \
+       mtspr   SPRN_SRR0,r10 ;                                 \
+       ld      r10,PACAKMSR(r13) ;                             \
+       mtspr   SPRN_SRR1,r10 ;                                 \
+       rfid ;                                                  \
+       b       . ;     /* prevent speculative execution */
+
+#define SYSCALL_PSERIES_3                                      \
+       /* Fast LE/BE switch system call */                     \
+1:     mfspr   r12,SPRN_SRR1 ;                                 \
+       xori    r12,r12,MSR_LE ;                                \
+       mtspr   SPRN_SRR1,r12 ;                                 \
+       rfid ;          /* return to userspace */               \
+       b       . ;                                             \
+2:     mfspr   r12,SPRN_SRR1 ;                                 \
+       andi.   r12,r12,MSR_PR ;                                \
+       bne     0b ;                                            \
+       mtspr   SPRN_SRR0,r3 ;                                  \
+       mtspr   SPRN_SRR1,r4 ;                                  \
+       mtspr   SPRN_SDR1,r5 ;                                  \
+       rfid ;                                                  \
+       b       . ;     /* prevent speculative execution */
+
+#if defined(CONFIG_RELOCATABLE)
+       /*
+        * We can't branch directly; in the direct case we use LR
+        * and system_call_entry restores LR.  (We thus need to move
+        * LR to r10 in the RFID case too.)
+        */
+#define SYSCALL_PSERIES_2_DIRECT                               \
+       mflr    r10 ;                                           \
+       ld      r12,PACAKBASE(r13) ;                            \
+       LOAD_HANDLER(r12, system_call_entry_direct) ;           \
+       mtlr    r12 ;                                           \
+       mfspr   r12,SPRN_SRR1 ;                                 \
+       /* Re-use of r13... No spare regs to do this */ \
+       li      r13,MSR_RI ;                                    \
+       mtmsrd  r13,1 ;                                         \
+       GET_PACA(r13) ; /* get r13 back */                      \
+       blr ;
+#else
+       /* We can branch directly */
+#define SYSCALL_PSERIES_2_DIRECT                               \
+       mfspr   r12,SPRN_SRR1 ;                                 \
+       li      r10,MSR_RI ;                                    \
+       mtmsrd  r10,1 ;                 /* Set RI (EE=0) */     \
+       b       system_call_entry_direct ;
+#endif
 
 /*
  * This is the start of the interrupt handlers for pSeries
@@ -207,31 +271,11 @@ system_call_pSeries:
        KVMTEST(0xc00)
        GET_SCRATCH0(r13)
 #endif
-BEGIN_FTR_SECTION
-       cmpdi   r0,0x1ebe
-       beq-    1f
-END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
-       mr      r9,r13
-       GET_PACA(r13)
-       mfspr   r11,SPRN_SRR0
-       mfspr   r12,SPRN_SRR1
-       ld      r10,PACAKBASE(r13)
-       LOAD_HANDLER(r10, system_call_entry)
-       mtspr   SPRN_SRR0,r10
-       ld      r10,PACAKMSR(r13)
-       mtspr   SPRN_SRR1,r10
-       rfid
-       b       .       /* prevent speculative execution */
-
+       SYSCALL_PSERIES_1
+       SYSCALL_PSERIES_2_RFID
+       SYSCALL_PSERIES_3
        KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xc00)
 
-/* Fast LE/BE switch system call */
-1:     mfspr   r12,SPRN_SRR1
-       xori    r12,r12,MSR_LE
-       mtspr   SPRN_SRR1,r12
-       rfid            /* return to userspace */
-       b       .
-
        STD_EXCEPTION_PSERIES(0xd00, 0xd00, single_step)
        KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xd00)
 
@@ -276,7 +320,7 @@ vsx_unavailable_pSeries_1:
        KVM_HANDLER_PR_SKIP(PACA_EXGEN, EXC_STD, 0x1300)
 
        . = 0x1500
-       .global denorm_Hypervisor
+       .global denorm_exception_hv
 denorm_exception_hv:
        HMT_MEDIUM
        mtspr   SPRN_SPRG_HSCRATCH0,r13
@@ -311,12 +355,14 @@ denorm_exception_hv:
 #ifdef CONFIG_CBE_RAS
        STD_EXCEPTION_HV(0x1800, 0x1802, cbe_thermal)
        KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1802)
+#else
+       . = 0x1800
 #endif /* CONFIG_CBE_RAS */
 
-       . = 0x3000
 
 /*** Out of line interrupts support ***/
 
+       .align  7
        /* moved from 0x200 */
 machine_check_pSeries:
        .globl machine_check_fwnmi
@@ -575,16 +621,12 @@ slb_miss_user_pseries:
        b       .                               /* prevent spec. execution */
 #endif /* __DISABLED__ */
 
-       .align  7
-       .globl  __end_interrupts
-__end_interrupts:
-
 /*
  * Code from here down to __end_handlers is invoked from the
  * exception prologs above.  Because the prologs assemble the
  * addresses of these handlers using the LOAD_HANDLER macro,
- * which uses an addi instruction, these handlers must be in
- * the first 32k of the kernel image.
+ * which uses an ori instruction, these handlers must be in
+ * the first 64k of the kernel image.
  */
 
 /*** Common interrupt handlers ***/
@@ -613,8 +655,8 @@ machine_check_common:
        STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception)
        STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception)
        STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception)
-        STD_EXCEPTION_COMMON(0xe40, emulation_assist, .program_check_exception)
-        STD_EXCEPTION_COMMON(0xe60, hmi_exception, .unknown_exception)
+       STD_EXCEPTION_COMMON(0xe40, emulation_assist, .program_check_exception)
+       STD_EXCEPTION_COMMON(0xe60, hmi_exception, .unknown_exception)
        STD_EXCEPTION_COMMON_ASYNC(0xf00, performance_monitor, .performance_monitor_exception)
        STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception)
        STD_EXCEPTION_COMMON(0x1502, denorm, .unknown_exception)
@@ -629,7 +671,158 @@ machine_check_common:
        STD_EXCEPTION_COMMON(0x1800, cbe_thermal, .cbe_thermal_exception)
 #endif /* CONFIG_CBE_RAS */
 
+       /*
+        * Relocation-on interrupts: A subset of the interrupts can be delivered
+        * with IR=1/DR=1, if AIL==2 and MSR.HV won't be changed by delivering
+        * it.  Addresses are the same as the original interrupt addresses, but
+        * offset by 0xc000000000004000.
+        * It's impossible to receive interrupts below 0x300 via this mechanism.
+        * KVM: None of these traps are from the guest ; anything that escalated
+        * to HV=1 from HV=0 is delivered via real mode handlers.
+        */
+
+       /*
+        * This uses the standard macro, since the original 0x300 vector
+        * only has extra guff for STAB-based processors -- which never
+        * come here.
+        */
+       STD_RELON_EXCEPTION_PSERIES(0x4300, 0x300, data_access)
+       . = 0x4380
+       .globl data_access_slb_relon_pSeries
+data_access_slb_relon_pSeries:
+       HMT_MEDIUM
+       SET_SCRATCH0(r13)
+       EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x380)
+       std     r3,PACA_EXSLB+EX_R3(r13)
+       mfspr   r3,SPRN_DAR
+       mfspr   r12,SPRN_SRR1
+#ifndef CONFIG_RELOCATABLE
+       b       .slb_miss_realmode
+#else
+       /*
+        * We can't just use a direct branch to .slb_miss_realmode
+        * because the distance from here to there depends on where
+        * the kernel ends up being put.
+        */
+       mfctr   r11
+       ld      r10,PACAKBASE(r13)
+       LOAD_HANDLER(r10, .slb_miss_realmode)
+       mtctr   r10
+       bctr
+#endif
+
+       STD_RELON_EXCEPTION_PSERIES(0x4400, 0x400, instruction_access)
+       . = 0x4480
+       .globl instruction_access_slb_relon_pSeries
+instruction_access_slb_relon_pSeries:
+       HMT_MEDIUM
+       SET_SCRATCH0(r13)
+       EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x480)
+       std     r3,PACA_EXSLB+EX_R3(r13)
+       mfspr   r3,SPRN_SRR0            /* SRR0 is faulting address */
+       mfspr   r12,SPRN_SRR1
+#ifndef CONFIG_RELOCATABLE
+       b       .slb_miss_realmode
+#else
+       mfctr   r11
+       ld      r10,PACAKBASE(r13)
+       LOAD_HANDLER(r10, .slb_miss_realmode)
+       mtctr   r10
+       bctr
+#endif
+
+       . = 0x4500
+       .globl hardware_interrupt_relon_pSeries;
+       .globl hardware_interrupt_relon_hv;
+hardware_interrupt_relon_pSeries:
+hardware_interrupt_relon_hv:
+       BEGIN_FTR_SECTION
+               _MASKABLE_RELON_EXCEPTION_PSERIES(0x502, hardware_interrupt, EXC_HV, SOFTEN_TEST_HV)
+       FTR_SECTION_ELSE
+               _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt, EXC_STD, SOFTEN_TEST_PR)
+       ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_206)
+       STD_RELON_EXCEPTION_PSERIES(0x4600, 0x600, alignment)
+       STD_RELON_EXCEPTION_PSERIES(0x4700, 0x700, program_check)
+       STD_RELON_EXCEPTION_PSERIES(0x4800, 0x800, fp_unavailable)
+       MASKABLE_RELON_EXCEPTION_PSERIES(0x4900, 0x900, decrementer)
+       STD_RELON_EXCEPTION_HV(0x4980, 0x982, hdecrementer)
+       STD_RELON_EXCEPTION_PSERIES(0x4b00, 0xb00, trap_0b)
+
+       . = 0x4c00
+       .globl system_call_relon_pSeries
+system_call_relon_pSeries:
+       HMT_MEDIUM
+       SYSCALL_PSERIES_1
+       SYSCALL_PSERIES_2_DIRECT
+       SYSCALL_PSERIES_3
+
+       STD_RELON_EXCEPTION_PSERIES(0x4d00, 0xd00, single_step)
+
+       . = 0x4e00
+       b       h_data_storage_relon_hv
+
+       . = 0x4e20
+       b       h_instr_storage_relon_hv
+
+       . = 0x4e40
+       b       emulation_assist_relon_hv
+
+       . = 0x4e50
+       b       hmi_exception_relon_hv
+
+       . = 0x4e60
+       b       hmi_exception_relon_hv
+
+       /* For when we support the doorbell interrupt:
+       STD_RELON_EXCEPTION_HYPERVISOR(0x4e80, 0xe80, doorbell_hyper)
+       */
+
+performance_monitor_relon_pSeries_1:
+       . = 0x4f00
+       b       performance_monitor_relon_pSeries
+
+altivec_unavailable_relon_pSeries_1:
+       . = 0x4f20
+       b       altivec_unavailable_relon_pSeries
+
+vsx_unavailable_relon_pSeries_1:
+       . = 0x4f40
+       b       vsx_unavailable_relon_pSeries
+
+#ifdef CONFIG_CBE_RAS
+       STD_RELON_EXCEPTION_HV(0x5200, 0x1202, cbe_system_error)
+#endif /* CONFIG_CBE_RAS */
+       STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint)
+#ifdef CONFIG_PPC_DENORMALISATION
+       . = 0x5500
+       b       denorm_exception_hv
+#endif
+#ifdef CONFIG_CBE_RAS
+       STD_RELON_EXCEPTION_HV(0x5600, 0x1602, cbe_maintenance)
+#else
+#ifdef CONFIG_HVC_SCOM
+       STD_RELON_EXCEPTION_HV(0x5600, 0x1600, maintence_interrupt)
+       KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1600)
+#endif /* CONFIG_HVC_SCOM */
+#endif /* CONFIG_CBE_RAS */
+       STD_RELON_EXCEPTION_PSERIES(0x5700, 0x1700, altivec_assist)
+#ifdef CONFIG_CBE_RAS
+       STD_RELON_EXCEPTION_HV(0x5800, 0x1802, cbe_thermal)
+#endif /* CONFIG_CBE_RAS */
+
+       /* Other future vectors */
        .align  7
+       .globl  __end_interrupts
+__end_interrupts:
+
+       .align  7
+system_call_entry_direct:
+#if defined(CONFIG_RELOCATABLE)
+       /* The first level prologue may have used LR to get here, saving
+        * orig in r10.  To save hacking/ifdeffing common code, restore here.
+        */
+       mtlr    r10
+#endif
 system_call_entry:
        b       system_call_common
 
@@ -714,21 +907,21 @@ data_access_common:
        ld      r3,PACA_EXGEN+EX_DAR(r13)
        lwz     r4,PACA_EXGEN+EX_DSISR(r13)
        li      r5,0x300
-       b       .do_hash_page           /* Try to handle as hpte fault */
+       b       .do_hash_page           /* Try to handle as hpte fault */
 
        .align  7
-        .globl  h_data_storage_common
+       .globl  h_data_storage_common
 h_data_storage_common:
-        mfspr   r10,SPRN_HDAR
-        std     r10,PACA_EXGEN+EX_DAR(r13)
-        mfspr   r10,SPRN_HDSISR
-        stw     r10,PACA_EXGEN+EX_DSISR(r13)
-        EXCEPTION_PROLOG_COMMON(0xe00, PACA_EXGEN)
-        bl      .save_nvgprs
+       mfspr   r10,SPRN_HDAR
+       std     r10,PACA_EXGEN+EX_DAR(r13)
+       mfspr   r10,SPRN_HDSISR
+       stw     r10,PACA_EXGEN+EX_DSISR(r13)
+       EXCEPTION_PROLOG_COMMON(0xe00, PACA_EXGEN)
+       bl      .save_nvgprs
        DISABLE_INTS
-        addi    r3,r1,STACK_FRAME_OVERHEAD
-        bl      .unknown_exception
-        b       .ret_from_except
+       addi    r3,r1,STACK_FRAME_OVERHEAD
+       bl      .unknown_exception
+       b       .ret_from_except
 
        .align  7
        .globl instruction_access_common
@@ -741,7 +934,7 @@ instruction_access_common:
        li      r5,0x400
        b       .do_hash_page           /* Try to handle as hpte fault */
 
-        STD_EXCEPTION_COMMON(0xe20, h_instr_storage, .unknown_exception)
+       STD_EXCEPTION_COMMON(0xe20, h_instr_storage, .unknown_exception)
 
 /*
  * Here is the common SLB miss user that is used when going to virtual
@@ -1152,6 +1345,21 @@ _GLOBAL(do_stab_bolted)
        rfid
        b       .       /* prevent speculative execution */
 
+
+       /* Equivalents to the above handlers for relocation-on interrupt vectors */
+       STD_RELON_EXCEPTION_HV(., 0xe00, h_data_storage)
+       KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe00)
+       STD_RELON_EXCEPTION_HV(., 0xe20, h_instr_storage)
+       KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe20)
+       STD_RELON_EXCEPTION_HV(., 0xe40, emulation_assist)
+       KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe40)
+       STD_RELON_EXCEPTION_HV(., 0xe60, hmi_exception)
+       KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe60)
+
+       STD_RELON_EXCEPTION_PSERIES(., 0xf00, performance_monitor)
+       STD_RELON_EXCEPTION_PSERIES(., 0xf20, altivec_unavailable)
+       STD_RELON_EXCEPTION_PSERIES(., 0xf40, vsx_unavailable)
+
 #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
 /*
  * Data area reserved for FWNMI option.
@@ -1164,7 +1372,7 @@ fwnmi_data_area:
        /* pseries and powernv need to keep the whole page from
         * 0x7000 to 0x8000 free for use by the firmware
         */
-        . = 0x8000
+       . = 0x8000
 #endif /* defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) */
 
 /* Space for CPU0's segment table */
index 58bddee8e1e8eea9a5cd5b8da113e9b7c0117dd6..116f0868695bc65a689d0759f9391247dc14eed3 100644 (file)
@@ -422,7 +422,7 @@ _STATIC(__after_prom_start)
        tovirt(r6,r6)                   /* on booke, we already run at PAGE_OFFSET */
 #endif
 
-#ifdef CONFIG_CRASH_DUMP
+#ifdef CONFIG_RELOCATABLE
 /*
  * Check if the kernel has to be running as relocatable kernel based on the
  * variable __run_at_load, if it is set the kernel is treated as relocatable
@@ -432,7 +432,8 @@ _STATIC(__after_prom_start)
        cmplwi  cr0,r7,1
        bne     3f
 
-       li      r5,__end_interrupts - _stext    /* just copy interrupts */
+       /* just copy interrupts */
+       LOAD_REG_IMMEDIATE(r5, __end_interrupts - _stext)
        b       5f
 3:
 #endif
@@ -703,6 +704,7 @@ _INIT_STATIC(start_here_multiplatform)
 
 #ifdef CONFIG_PPC_EARLY_DEBUG_OPAL
        /* Setup OPAL entry */
+       LOAD_REG_ADDR(r11, opal)
        std     r28,0(r11);
        std     r29,8(r11);
 #endif
index 2099d9a879e84ac43e6333f3d28d87fdd799c686..ea78761aa16972a71f00f6bf0824989995b7c841 100644 (file)
@@ -55,9 +55,6 @@ __setup("powersave=off", powersave_off);
  */
 void cpu_idle(void)
 {
-       if (ppc_md.idle_loop)
-               ppc_md.idle_loop();     /* doesn't return */
-
        set_thread_flag(TIF_POLLING_NRFLAG);
        while (1) {
                tick_nohz_idle_enter();
index 8226c6cb348afbf09fc287367637b835dced2100..c862fd716fe3ede17452e7bfe138b18292de31fb 100644 (file)
@@ -656,7 +656,7 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
        struct iommu_pool *p;
 
        /* number of bytes needed for the bitmap */
-       sz = (tbl->it_size + 7) >> 3;
+       sz = BITS_TO_LONGS(tbl->it_size) * sizeof(unsigned long);
 
        page = alloc_pages_node(nid, GFP_ATOMIC, get_order(sz));
        if (!page)
@@ -708,7 +708,7 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
 
 void iommu_free_table(struct iommu_table *tbl, const char *node_name)
 {
-       unsigned long bitmap_sz, i;
+       unsigned long bitmap_sz;
        unsigned int order;
 
        if (!tbl || !tbl->it_map) {
@@ -718,17 +718,11 @@ void iommu_free_table(struct iommu_table *tbl, const char *node_name)
        }
 
        /* verify that table contains no entries */
-       /* it_size is in entries, and we're examining 64 at a time */
-       for (i = 0; i < (tbl->it_size/64); i++) {
-               if (tbl->it_map[i] != 0) {
-                       printk(KERN_WARNING "%s: Unexpected TCEs for %s\n",
-                               __func__, node_name);
-                       break;
-               }
-       }
+       if (!bitmap_empty(tbl->it_map, tbl->it_size))
+               pr_warn("%s: Unexpected TCEs for %s\n", __func__, node_name);
 
        /* calculate bitmap size in bytes */
-       bitmap_sz = (tbl->it_size + 7) / 8;
+       bitmap_sz = BITS_TO_LONGS(tbl->it_size) * sizeof(unsigned long);
 
        /* free bitmap */
        order = get_order(bitmap_sz);
index fa9f6c72f557026aaf2a4c7c7e763fb45cb7805d..e1ec57e87b3b435b88ef55c4598d32c37c8e2e07 100644 (file)
@@ -218,23 +218,23 @@ static void __init export_crashk_values(struct device_node *node)
         * be sure what's in them, so remove them. */
        prop = of_find_property(node, "linux,crashkernel-base", NULL);
        if (prop)
-               prom_remove_property(node, prop);
+               of_remove_property(node, prop);
 
        prop = of_find_property(node, "linux,crashkernel-size", NULL);
        if (prop)
-               prom_remove_property(node, prop);
+               of_remove_property(node, prop);
 
        if (crashk_res.start != 0) {
-               prom_add_property(node, &crashk_base_prop);
+               of_add_property(node, &crashk_base_prop);
                crashk_size = resource_size(&crashk_res);
-               prom_add_property(node, &crashk_size_prop);
+               of_add_property(node, &crashk_size_prop);
        }
 
        /*
         * memory_limit is required by the kexec-tools to limit the
         * crash regions to the actual memory used.
         */
-       prom_update_property(node, &memory_limit_prop);
+       of_update_property(node, &memory_limit_prop);
 }
 
 static int __init kexec_setup(void)
@@ -249,11 +249,11 @@ static int __init kexec_setup(void)
        /* remove any stale properties so ours can be found */
        prop = of_find_property(node, kernel_end_prop.name, NULL);
        if (prop)
-               prom_remove_property(node, prop);
+               of_remove_property(node, prop);
 
        /* information needed by userspace when using default_machine_kexec */
        kernel_end = __pa(_end);
-       prom_add_property(node, &kernel_end_prop);
+       of_add_property(node, &kernel_end_prop);
 
        export_crashk_values(node);
 
index d7f609086a99925dc9b2a47b479079fbf5b466d4..7206701b1ff1cd5d7b58331128550c7ee1ac8cdf 100644 (file)
@@ -389,14 +389,14 @@ static int __init export_htab_values(void)
        /* remove any stale propertys so ours can be found */
        prop = of_find_property(node, htab_base_prop.name, NULL);
        if (prop)
-               prom_remove_property(node, prop);
+               of_remove_property(node, prop);
        prop = of_find_property(node, htab_size_prop.name, NULL);
        if (prop)
-               prom_remove_property(node, prop);
+               of_remove_property(node, prop);
 
        htab_base = __pa(htab_address);
-       prom_add_property(node, &htab_base_prop);
-       prom_add_property(node, &htab_size_prop);
+       of_add_property(node, &htab_base_prop);
+       of_add_property(node, &htab_size_prop);
 
        of_node_put(node);
        return 0;
index 4b06ec5a502e2ce47a31d7a6f3d9fa4b1d06bf72..64f526a321f5f82e2fc094dd10e674668844296a 100644 (file)
@@ -208,7 +208,7 @@ pci_create_OF_bus_map(void)
                of_prop->name = "pci-OF-bus-map";
                of_prop->length = 256;
                of_prop->value = &of_prop[1];
-               prom_add_property(dn, of_prop);
+               of_add_property(dn, of_prop);
                of_node_put(dn);
        }
 }
index 37725e86651e99bcce696665ba7199fad3445363..8b6f7a99cce2ba1af5e8a38a15b515d78804735f 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/debugfs.h>
 #include <linux/irq.h>
 #include <linux/memblock.h>
+#include <linux/of.h>
 
 #include <asm/prom.h>
 #include <asm/rtas.h>
 #include <asm/btext.h>
 #include <asm/sections.h>
 #include <asm/machdep.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/pci-bridge.h>
 #include <asm/kexec.h>
 #include <asm/opal.h>
 #include <asm/fadump.h>
+#include <asm/debug.h>
 
 #include <mm/mmu_decl.h>
 
@@ -802,7 +803,7 @@ static int prom_reconfig_notifier(struct notifier_block *nb,
        int err;
 
        switch (action) {
-       case PSERIES_RECONFIG_ADD:
+       case OF_RECONFIG_ATTACH_NODE:
                err = of_finish_dynamic_node(node);
                if (err < 0)
                        printk(KERN_ERR "finish_node returned %d\n", err);
@@ -821,7 +822,7 @@ static struct notifier_block prom_reconfig_nb = {
 
 static int __init prom_reconfig_setup(void)
 {
-       return pSeries_reconfig_notifier_register(&prom_reconfig_nb);
+       return of_reconfig_notifier_register(&prom_reconfig_nb);
 }
 __initcall(prom_reconfig_setup);
 #endif
index cb6c123722a214691d7c99519a08a5aa27e95577..779f34049a56f1020aeee94174e5584f90c645ae 100644 (file)
@@ -671,6 +671,7 @@ static void __init early_cmdline_parse(void)
 #define OV1_PPC_2_04           0x08    /* set if we support PowerPC 2.04 */
 #define OV1_PPC_2_05           0x04    /* set if we support PowerPC 2.05 */
 #define OV1_PPC_2_06           0x02    /* set if we support PowerPC 2.06 */
+#define OV1_PPC_2_07           0x01    /* set if we support PowerPC 2.07 */
 
 /* Option vector 2: Open Firmware options supported */
 #define OV2_REAL_MODE          0x20    /* set if we want OF in real mode */
@@ -707,6 +708,7 @@ static void __init early_cmdline_parse(void)
 #define OV5_PFO_HW_RNG         0x80    /* PFO Random Number Generator */
 #define OV5_PFO_HW_842         0x40    /* PFO Compression Accelerator */
 #define OV5_PFO_HW_ENCR                0x20    /* PFO Encryption Accelerator */
+#define OV5_SUB_PROCESSORS     0x01    /* 1,2,or 4 Sub-Processors supported */
 
 /* Option Vector 6: IBM PAPR hints */
 #define OV6_LINUX              0x02    /* Linux is our OS */
@@ -719,6 +721,8 @@ static unsigned char ibm_architecture_vec[] = {
        W(0xfffe0000), W(0x003a0000),   /* POWER5/POWER5+ */
        W(0xffff0000), W(0x003e0000),   /* POWER6 */
        W(0xffff0000), W(0x003f0000),   /* POWER7 */
+       W(0xffff0000), W(0x004b0000),   /* POWER8 */
+       W(0xffffffff), W(0x0f000004),   /* all 2.07-compliant */
        W(0xffffffff), W(0x0f000003),   /* all 2.06-compliant */
        W(0xffffffff), W(0x0f000002),   /* all 2.05-compliant */
        W(0xfffffffe), W(0x0f000001),   /* all 2.04-compliant and earlier */
@@ -728,7 +732,7 @@ static unsigned char ibm_architecture_vec[] = {
        3 - 2,                          /* length */
        0,                              /* don't ignore, don't halt */
        OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 |
-       OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06,
+       OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06 | OV1_PPC_2_07,
 
        /* option vector 2: Open Firmware options supported */
        34 - 2,                         /* length */
@@ -755,7 +759,7 @@ static unsigned char ibm_architecture_vec[] = {
        OV4_MIN_ENT_CAP,                /* minimum VP entitled capacity */
 
        /* option vector 5: PAPR/OF options */
-       18 - 2,                         /* length */
+       19 - 2,                         /* length */
        0,                              /* don't ignore, don't halt */
        OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES | OV5_DRCONF_MEMORY |
        OV5_DONATE_DEDICATE_CPU | OV5_MSI,
@@ -769,13 +773,14 @@ static unsigned char ibm_architecture_vec[] = {
         * must match by the macro below. Update the definition if
         * the structure layout changes.
         */
-#define IBM_ARCH_VEC_NRCORES_OFFSET    101
+#define IBM_ARCH_VEC_NRCORES_OFFSET    117
        W(NR_CPUS),                     /* number of cores supported */
        0,
        0,
        0,
        0,
        OV5_PFO_HW_RNG | OV5_PFO_HW_ENCR | OV5_PFO_HW_842,
+       OV5_SUB_PROCESSORS,
        /* option vector 6: IBM PAPR hints */
        4 - 2,                          /* length */
        0,
index 79d8e56470df8105c9119aee7f01f4938101acc8..c4970004d44d2cfa0e190cf6d7be973b5f4b03ec 100644 (file)
@@ -952,6 +952,10 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
                arch_bp_generic_fields(data &
                                        (DABR_DATA_WRITE | DABR_DATA_READ),
                                                        &attr.bp_type);
+
+               /* Enable breakpoint */
+               attr.disabled = false;
+
                ret =  modify_user_hw_breakpoint(bp, &attr);
                if (ret) {
                        ptrace_put_breakpoints(task);
@@ -1037,7 +1041,7 @@ void ptrace_disable(struct task_struct *child)
 }
 
 #ifdef CONFIG_PPC_ADV_DEBUG_REGS
-static long set_intruction_bp(struct task_struct *child,
+static long set_instruction_bp(struct task_struct *child,
                              struct ppc_hw_breakpoint *bp_info)
 {
        int slot;
@@ -1338,6 +1342,12 @@ static int set_dac_range(struct task_struct *child,
 static long ppc_set_hwdebug(struct task_struct *child,
                     struct ppc_hw_breakpoint *bp_info)
 {
+#ifdef CONFIG_HAVE_HW_BREAKPOINT
+       int len = 0;
+       struct thread_struct *thread = &(child->thread);
+       struct perf_event *bp;
+       struct perf_event_attr attr;
+#endif /* CONFIG_HAVE_HW_BREAKPOINT */
 #ifndef CONFIG_PPC_ADV_DEBUG_REGS
        unsigned long dabr;
 #endif
@@ -1365,7 +1375,7 @@ static long ppc_set_hwdebug(struct task_struct *child,
                if ((bp_info->trigger_type != PPC_BREAKPOINT_TRIGGER_EXECUTE) ||
                    (bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE))
                        return -EINVAL;
-               return set_intruction_bp(child, bp_info);
+               return set_instruction_bp(child, bp_info);
        }
        if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_EXACT)
                return set_dac(child, bp_info);
@@ -1381,13 +1391,9 @@ static long ppc_set_hwdebug(struct task_struct *child,
         */
        if ((bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_RW) == 0 ||
            (bp_info->trigger_type & ~PPC_BREAKPOINT_TRIGGER_RW) != 0 ||
-           bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT ||
            bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE)
                return -EINVAL;
 
-       if (child->thread.dabr)
-               return -ENOSPC;
-
        if ((unsigned long)bp_info->addr >= TASK_SIZE)
                return -EIO;
 
@@ -1397,6 +1403,50 @@ static long ppc_set_hwdebug(struct task_struct *child,
                dabr |= DABR_DATA_READ;
        if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE)
                dabr |= DABR_DATA_WRITE;
+#ifdef CONFIG_HAVE_HW_BREAKPOINT
+       if (ptrace_get_breakpoints(child) < 0)
+               return -ESRCH;
+
+       /*
+        * Check if the request is for 'range' breakpoints. We can
+        * support it if range < 8 bytes.
+        */
+       if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE) {
+               len = bp_info->addr2 - bp_info->addr;
+       } else if (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT) {
+               ptrace_put_breakpoints(child);
+               return -EINVAL;
+       }
+       bp = thread->ptrace_bps[0];
+       if (bp) {
+               ptrace_put_breakpoints(child);
+               return -ENOSPC;
+       }
+
+       /* Create a new breakpoint request if one doesn't exist already */
+       hw_breakpoint_init(&attr);
+       attr.bp_addr = (unsigned long)bp_info->addr & ~HW_BREAKPOINT_ALIGN;
+       attr.bp_len = len;
+       arch_bp_generic_fields(dabr & (DABR_DATA_WRITE | DABR_DATA_READ),
+                                                               &attr.bp_type);
+
+       thread->ptrace_bps[0] = bp = register_user_hw_breakpoint(&attr,
+                                              ptrace_triggered, NULL, child);
+       if (IS_ERR(bp)) {
+               thread->ptrace_bps[0] = NULL;
+               ptrace_put_breakpoints(child);
+               return PTR_ERR(bp);
+       }
+
+       ptrace_put_breakpoints(child);
+       return 1;
+#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+
+       if (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT)
+               return -EINVAL;
+
+       if (child->thread.dabr)
+               return -ENOSPC;
 
        child->thread.dabr = dabr;
        child->thread.dabrx = DABRX_ALL;
@@ -1405,8 +1455,13 @@ static long ppc_set_hwdebug(struct task_struct *child,
 #endif /* !CONFIG_PPC_ADV_DEBUG_DVCS */
 }
 
-static long ppc_del_hwdebug(struct task_struct *child, long addr, long data)
+static long ppc_del_hwdebug(struct task_struct *child, long data)
 {
+#ifdef CONFIG_HAVE_HW_BREAKPOINT
+       int ret = 0;
+       struct thread_struct *thread = &(child->thread);
+       struct perf_event *bp;
+#endif /* CONFIG_HAVE_HW_BREAKPOINT */
 #ifdef CONFIG_PPC_ADV_DEBUG_REGS
        int rc;
 
@@ -1426,10 +1481,25 @@ static long ppc_del_hwdebug(struct task_struct *child, long addr, long data)
 #else
        if (data != 1)
                return -EINVAL;
+
+#ifdef CONFIG_HAVE_HW_BREAKPOINT
+       if (ptrace_get_breakpoints(child) < 0)
+               return -ESRCH;
+
+       bp = thread->ptrace_bps[0];
+       if (bp) {
+               unregister_hw_breakpoint(bp);
+               thread->ptrace_bps[0] = NULL;
+       } else
+               ret = -ENOENT;
+       ptrace_put_breakpoints(child);
+       return ret;
+#else /* CONFIG_HAVE_HW_BREAKPOINT */
        if (child->thread.dabr == 0)
                return -ENOENT;
 
        child->thread.dabr = 0;
+#endif /* CONFIG_HAVE_HW_BREAKPOINT */
 
        return 0;
 #endif
@@ -1536,7 +1606,11 @@ long arch_ptrace(struct task_struct *child, long request,
                dbginfo.data_bp_alignment = 4;
 #endif
                dbginfo.sizeof_condition = 0;
+#ifdef CONFIG_HAVE_HW_BREAKPOINT
+               dbginfo.features = PPC_DEBUG_FEATURE_DATA_BP_RANGE;
+#else
                dbginfo.features = 0;
+#endif /* CONFIG_HAVE_HW_BREAKPOINT */
 #endif /* CONFIG_PPC_ADV_DEBUG_REGS */
 
                if (!access_ok(VERIFY_WRITE, datavp,
@@ -1563,7 +1637,7 @@ long arch_ptrace(struct task_struct *child, long request,
        }
 
        case PPC_PTRACE_DELHWDEBUG: {
-               ret = ppc_del_hwdebug(child, addr, data);
+               ret = ppc_del_hwdebug(child, data);
                break;
        }
 
index fcec38241f794f204e4f44a052c4b16ce25b125c..1fd6e7b2f390b41dac642f58e781baf735c04be4 100644 (file)
@@ -42,7 +42,6 @@
 #include <asm/time.h>
 #include <asm/mmu.h>
 #include <asm/topology.h>
-#include <asm/pSeries_reconfig.h>
 
 struct rtas_t rtas = {
        .lock = __ARCH_SPIN_LOCK_UNLOCKED
index 20b0120db0c341682f0d15710b690ca6b379b516..8329190312c1617b0a4560792f8578fe1f9d695b 100644 (file)
@@ -650,10 +650,8 @@ static int initialize_flash_pde_data(const char *rtas_call_name,
        int token;
 
        dp->data = kzalloc(buf_size, GFP_KERNEL);
-       if (dp->data == NULL) {
-               remove_flash_pde(dp);
+       if (dp->data == NULL)
                return -ENOMEM;
-       }
 
        /*
         * This code assumes that the status int is the first member of the
index efb6a41b3131bc1f115ba0b15ec82dba8392b31a..6da881b35dacce0aede124897342a3f5ed1b9a6c 100644 (file)
@@ -601,6 +601,11 @@ void __init setup_arch(char **cmdline_p)
 
        kvm_linear_init();
 
+       /* Interrupt code needs to be 64K-aligned */
+       if ((unsigned long)_stext & 0xffff)
+               panic("Kernelbase not 64K-aligned (0x%lx)!\n",
+                     (unsigned long)_stext);
+
        ppc64_boot_msg(0x15, "Setup Done");
 }
 
index c39c1ca77f46c6a83ada12367a31fb764596632b..f9748498fe5859c1d0863cdb0f1aa70465f0570e 100644 (file)
@@ -122,29 +122,6 @@ int udbg_write(const char *s, int n)
        return n - remain;
 }
 
-int udbg_read(char *buf, int buflen)
-{
-       char *p = buf;
-       int i, c;
-
-       if (!udbg_getc)
-               return 0;
-
-       for (i = 0; i < buflen; ++i) {
-               do {
-                       c = udbg_getc();
-                       if (c == -1 && i == 0)
-                               return -1;
-
-               } while (c == 0x11 || c == 0x13);
-               if (c == 0 || c == -1)
-                       break;
-               *p++ = c;
-       }
-
-       return i;
-}
-
 #define UDBG_BUFSIZE 256
 void udbg_printf(const char *fmt, ...)
 {
index 59213cfaeca9f868143261b2a246834c115b6542..bba87ca2b4d78a1a8fbedd70e6122d583d365d79 100644 (file)
@@ -399,18 +399,6 @@ static unsigned long read_n_cells(int n, const unsigned int **buf)
        return result;
 }
 
-struct of_drconf_cell {
-       u64     base_addr;
-       u32     drc_index;
-       u32     reserved;
-       u32     aa_index;
-       u32     flags;
-};
-
-#define DRCONF_MEM_ASSIGNED    0x00000008
-#define DRCONF_MEM_AI_INVALID  0x00000040
-#define DRCONF_MEM_RESERVED    0x00000080
-
 /*
  * Read the next memblock list entry from the ibm,dynamic-memory property
  * and return the information in the provided of_drconf_cell structure.
index fab919fd1384b8d3a8f589bc368f0e4bdaf03903..626ad081639f0e25e910bd3207082d097a684c6c 100644 (file)
@@ -190,12 +190,6 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_47x)
 
 #ifdef CONFIG_PPC_47x
 
-/*
- * 47x variant of icbt
- */
-# define ICBT(CT,RA,RB)        \
-       .long   0x7c00002c | ((CT) << 21) | ((RA) << 16) | ((RB) << 11)
-
 /*
  * _tlbivax_bcast is only on 47x. We don't bother doing a runtime
  * check though, it will blow up soon enough if we mistakenly try
@@ -208,8 +202,7 @@ _GLOBAL(_tlbivax_bcast)
        wrteei  0
        mtspr   SPRN_MMUCR,r5
        isync
-/*     tlbivax 0,r3 - use .long to avoid binutils deps */
-       .long 0x7c000624 | (r3 << 11)
+       PPC_TLBIVAX(0, R3)
        isync
        eieio
        tlbsync
@@ -227,11 +220,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_476_DD2)
        bl      2f
 2:     mflr    r6
        li      r7,32
-       ICBT(0,r6,r7)           /* touch next cache line */
+       PPC_ICBT(0,R6,R7)               /* touch next cache line */
        add     r6,r6,r7
-       ICBT(0,r6,r7)           /* touch next cache line */
+       PPC_ICBT(0,R6,R7)               /* touch next cache line */
        add     r6,r6,r7
-       ICBT(0,r6,r7)           /* touch next cache line */
+       PPC_ICBT(0,R6,R7)               /* touch next cache line */
        sync
        nop
        nop
index 441af08edf434cc9729d0df344e422f32f487962..2ee01e38d5e256b9a92f0ee678e08a19e768f572 100644 (file)
  * Layout of constraint bits:
  * 6666555555555544444444443333333333222222222211111111110000000000
  * 3210987654321098765432109876543210987654321098765432109876543210
- *                                                 [  ><><><><><><>
- *                                                  NC P6P5P4P3P2P1
+ *                                              < ><  ><><><><><><>
+ *                                              L2  NC P6P5P4P3P2P1
+ *
+ * L2 - 16-18 - Required L2SEL value (select field)
  *
  * NC - number of counters
  *     15: NC error 0x8000
@@ -72,7 +74,7 @@
 static int power7_get_constraint(u64 event, unsigned long *maskp,
                                 unsigned long *valp)
 {
-       int pmc, sh;
+       int pmc, sh, unit;
        unsigned long mask = 0, value = 0;
 
        pmc = (event >> PM_PMC_SH) & PM_PMC_MSK;
@@ -90,6 +92,15 @@ static int power7_get_constraint(u64 event, unsigned long *maskp,
                mask  |= 0x8000;
                value |= 0x1000;
        }
+
+       unit = (event >> PM_UNIT_SH) & PM_UNIT_MSK;
+       if (unit == 6) {
+               /* L2SEL must be identical across events */
+               int l2sel = (event >> PM_L2SEL_SH) & PM_L2SEL_MSK;
+               mask  |= 0x7 << 16;
+               value |= l2sel << 16;
+       }
+
        *maskp = mask;
        *valp = value;
        return 0;
index 448d862bcf3d76cfbfca3fba68d8b21c1a821ff4..1843bc9320118b84d47cc2e44a5a083b891de6c0 100644 (file)
@@ -4,7 +4,7 @@
  * Written by: Grant Likely <grant.likely@secretlab.ca>
  *
  * Copyright (C) Secret Lab Technologies Ltd. 2006. All rights reserved.
- * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
+ * Copyright 2006 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Description:
  * This program is free software; you can redistribute  it and/or modify it
index 328d221fd1c00f6c5144c6fac2b0adde8e544f96..74861a7fb807d8c2441f3cce86c5921e8c4787f5 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/spinlock.h>
 #include <linux/irq.h>
 #include <linux/types.h>
-#include <linux/bootmem.h>
 #include <linux/slab.h>
 
 #include <asm/io.h>
@@ -149,7 +148,7 @@ int __init pq2ads_pci_init_irq(void)
        priv->regs = of_iomap(np, 0);
        if (!priv->regs) {
                printk(KERN_ERR "Cannot map PCI PIC registers.\n");
-               goto out_free_bootmem;
+               goto out_free_kmalloc;
        }
 
        /* mask all PCI interrupts */
@@ -171,9 +170,8 @@ int __init pq2ads_pci_init_irq(void)
 
 out_unmap_regs:
        iounmap(priv->regs);
-out_free_bootmem:
-       free_bootmem((unsigned long)priv,
-                    sizeof(struct pq2ads_pci_pic));
+out_free_kmalloc:
+       kfree(priv);
        of_node_put(np);
 out_unmap_irq:
        irq_dispose_mapping(irq);
index d440435e055cc9ac1165294688760aed8087e991..8d762203eeffa103345c2d7acd09a4b6077ccc46 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
+ * Copyright 2006 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Description:
  * MPC832xE MDS board specific routines.
index 1b1f6c8a1a12b80907ef2194be0db1bc4d31c89a..1a26d2f83401964b49006abb1d7d3836e351d124 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
+ * Copyright 2006 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Author: Li Yang <LeoLi@freescale.com>
  *        Yin Olivia <Hong-hua.Yin@freescale.com>
index f8769d713d6116b94d90c09f5f28aa2d0c72d7e5..b63b42d11d6c92e4d0e476100df85ead02d49ccf 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * MPC8360E-RDK board file.
  *
- * Copyright (c) 2006  Freescale Semicondutor, Inc.
+ * Copyright (c) 2006  Freescale Semiconductor, Inc.
  * Copyright (c) 2007-2008  MontaVista Software, Inc.
  *
  * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
index eca1f0960fffac31e23307ddfe6f3010ddc481c4..9813c81e8e5bf38b7abcd921dcc56c3f505da4dc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/powerpc/platforms/83xx/mpc837x_rdb.c
  *
- * Copyright (C) 2007 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
  *
  * MPC837x RDB board specific routines
  *
index 8498f7323470c8447ef827440fe5355652f2c20d..bd12588fa25200962f1c2a5979ec03bd49034ed5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2010, 2012 Freescale Semicondutor, Inc.
+ * Copyright (C) 2006-2010, 2012 Freescale Semiconductor, Inc.
  * All rights reserved.
  *
  * Author: Andy Fleming <afleming@freescale.com>
index 848a3e98e1c1a187a8ddb96797af932681c2b6ab..8fb12570b2f52ff36d7999f4cf1fd3e83d8aedfe 100644 (file)
@@ -539,7 +539,7 @@ static void __init p1022_ds_setup_arch(void)
                                };
 
                                /*
-                                * prom_update_property() is called before
+                                * of_update_property() is called before
                                 * kmalloc() is available, so the 'new' object
                                 * should be allocated in the global area.
                                 * The easiest way is to do that is to
@@ -548,7 +548,7 @@ static void __init p1022_ds_setup_arch(void)
                                 */
                                pr_info("p1022ds: disabling %s node",
                                        np2->full_name);
-                               prom_update_property(np2, &nor_status);
+                               of_update_property(np2, &nor_status);
                                of_node_put(np2);
                        }
 
@@ -564,7 +564,7 @@ static void __init p1022_ds_setup_arch(void)
 
                                pr_info("p1022ds: disabling %s node",
                                        np2->full_name);
-                               prom_update_property(np2, &nand_status);
+                               of_update_property(np2, &nand_status);
                                of_node_put(np2);
                        }
 
index 64171198535ce7b181e6c67cdfb5d195514d588c..311b804353b14820c90e829902518a0ea350c6f2 100644 (file)
@@ -55,6 +55,7 @@ static unsigned int low_freq;
 static unsigned int hi_freq;
 static unsigned int cur_freq;
 static unsigned int sleep_freq;
+static unsigned long transition_latency;
 
 /*
  * Different models uses different mechanisms to switch the frequency
@@ -403,7 +404,7 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
        if (policy->cpu != 0)
                return -ENODEV;
 
-       policy->cpuinfo.transition_latency      = CPUFREQ_ETERNAL;
+       policy->cpuinfo.transition_latency      = transition_latency;
        policy->cur = cur_freq;
 
        cpufreq_frequency_table_get_attr(pmac_cpu_freqs, policy->cpu);
@@ -658,12 +659,14 @@ static int __init pmac_cpufreq_setup(void)
        if (!value)
                goto out;
        cur_freq = (*value) / 1000;
+       transition_latency = CPUFREQ_ETERNAL;
 
        /*  Check for 7447A based MacRISC3 */
        if (of_machine_is_compatible("MacRISC3") &&
            of_get_property(cpunode, "dynamic-power-step", NULL) &&
            PVR_VER(mfspr(SPRN_PVR)) == 0x8003) {
                pmac_cpufreq_init_7447A(cpunode);
+               transition_latency = 8000000;
        /* Check for other MacRISC3 machines */
        } else if (of_machine_is_compatible("PowerBook3,4") ||
                   of_machine_is_compatible("PowerBook3,5") ||
index 471aa3ccd9fd32411948e2226cf085b4ac9e4c0b..53d052e95cfcb043b339d7d110dc730cae1df9b7 100644 (file)
 #include "powernv.h"
 #include "pci.h"
 
-static int __pe_printk(const char *level, const struct pnv_ioda_pe *pe,
-                      struct va_format *vaf)
-{
-       char pfix[32];
-
-       if (pe->pdev)
-               strlcpy(pfix, dev_name(&pe->pdev->dev), sizeof(pfix));
-       else
-               sprintf(pfix, "%04x:%02x     ",
-                       pci_domain_nr(pe->pbus), pe->pbus->number);
-       return printk("pci %s%s: [PE# %.3d] %pV", level, pfix, pe->pe_number, vaf);
-}
-
 #define define_pe_printk_level(func, kern_level)               \
 static int func(const struct pnv_ioda_pe *pe, const char *fmt, ...)    \
 {                                                              \
        struct va_format vaf;                                   \
        va_list args;                                           \
+       char pfix[32];                                          \
        int r;                                                  \
                                                                \
        va_start(args, fmt);                                    \
@@ -59,7 +47,16 @@ static int func(const struct pnv_ioda_pe *pe, const char *fmt, ...)  \
        vaf.fmt = fmt;                                          \
        vaf.va = &args;                                         \
                                                                \
-       r = __pe_printk(kern_level, pe, &vaf);                  \
+       if (pe->pdev)                                           \
+               strlcpy(pfix, dev_name(&pe->pdev->dev),         \
+                       sizeof(pfix));                          \
+       else                                                    \
+               sprintf(pfix, "%04x:%02x     ",                 \
+                       pci_domain_nr(pe->pbus),                \
+                       pe->pbus->number);                      \
+       r = printk(kern_level "pci %s: [PE# %.3d] %pV",         \
+                  pfix, pe->pe_number, &vaf);                  \
+                                                               \
        va_end(args);                                           \
                                                                \
        return r;                                               \
index 56d26bc4fd413d1a727e57b463da8c0816e1d117..09787139834ddd8bd01fbce0448ca34297a1cd5c 100644 (file)
@@ -280,13 +280,13 @@ static void os_area_set_property(struct device_node *node,
 
        if (tmp) {
                pr_debug("%s:%d found %s\n", __func__, __LINE__, prop->name);
-               prom_remove_property(node, tmp);
+               of_remove_property(node, tmp);
        }
 
-       result = prom_add_property(node, prop);
+       result = of_add_property(node, prop);
 
        if (result)
-               pr_debug("%s:%d prom_set_property failed\n", __func__,
+               pr_debug("%s:%d of_set_property failed\n", __func__,
                        __LINE__);
 }
 
index 0f1b706506ed67d5ead6250051ba282f170d2ede..a1a7b9a67ffde37f588f3fc6c9db88faab3d02ba 100644 (file)
 #include <linux/kernel.h>
 #include <linux/kref.h>
 #include <linux/notifier.h>
-#include <linux/proc_fs.h>
 #include <linux/spinlock.h>
 #include <linux/cpu.h>
 #include <linux/slab.h>
+#include <linux/of.h>
 #include "offline_states.h"
 
 #include <asm/prom.h>
 #include <asm/machdep.h>
 #include <asm/uaccess.h>
 #include <asm/rtas.h>
-#include <asm/pSeries_reconfig.h>
 
 struct cc_workarea {
        u32     drc_index;
@@ -255,9 +254,6 @@ static struct device_node *derive_parent(const char *path)
 
 int dlpar_attach_node(struct device_node *dn)
 {
-#ifdef CONFIG_PROC_DEVICETREE
-       struct proc_dir_entry *ent;
-#endif
        int rc;
 
        of_node_set_flag(dn, OF_DYNAMIC);
@@ -266,44 +262,26 @@ int dlpar_attach_node(struct device_node *dn)
        if (!dn->parent)
                return -ENOMEM;
 
-       rc = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, dn);
+       rc = of_attach_node(dn);
        if (rc) {
                printk(KERN_ERR "Failed to add device node %s\n",
                       dn->full_name);
                return rc;
        }
 
-       of_attach_node(dn);
-
-#ifdef CONFIG_PROC_DEVICETREE
-       ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
-       if (ent)
-               proc_device_tree_add_node(dn, ent);
-#endif
-
        of_node_put(dn->parent);
        return 0;
 }
 
 int dlpar_detach_node(struct device_node *dn)
 {
-#ifdef CONFIG_PROC_DEVICETREE
-       struct device_node *parent = dn->parent;
-       struct property *prop = dn->properties;
-
-       while (prop) {
-               remove_proc_entry(prop->name, dn->pde);
-               prop = prop->next;
-       }
+       int rc;
 
-       if (dn->pde)
-               remove_proc_entry(dn->pde->name, parent->pde);
-#endif
+       rc = of_detach_node(dn);
+       if (rc)
+               return rc;
 
-       pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, dn);
-       of_detach_node(dn);
        of_node_put(dn); /* Must decrement the refcount */
-
        return 0;
 }
 
index 0b0eff0cce35e94b2888b05a5116581052dca2af..7b56118f531c5e09a5d9f602d1c4e409181a4d51 100644 (file)
@@ -56,6 +56,7 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = {
        {FW_FEATURE_MULTITCE,           "hcall-multi-tce"},
        {FW_FEATURE_SPLPAR,             "hcall-splpar"},
        {FW_FEATURE_VPHN,               "hcall-vphn"},
+       {FW_FEATURE_SET_MODE,           "hcall-set-mode"},
 };
 
 /* Build up the firmware features bitmask using the contents of
index 64c97d8ac0c563d9f14da2ae2f0f4cd0c8c80b82..a38956269fbf3dd63739d33d7650bf58bf3b4b49 100644 (file)
 #include <linux/delay.h>
 #include <linux/sched.h>       /* for idle_task_exit */
 #include <linux/cpu.h>
+#include <linux/of.h>
 #include <asm/prom.h>
 #include <asm/rtas.h>
 #include <asm/firmware.h>
 #include <asm/machdep.h>
 #include <asm/vdso_datapage.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/xics.h>
 #include "plpar_wrappers.h"
 #include "offline_states.h"
@@ -333,10 +333,10 @@ static int pseries_smp_notifier(struct notifier_block *nb,
        int err = 0;
 
        switch (action) {
-       case PSERIES_RECONFIG_ADD:
+       case OF_RECONFIG_ATTACH_NODE:
                err = pseries_add_processor(node);
                break;
-       case PSERIES_RECONFIG_REMOVE:
+       case OF_RECONFIG_DETACH_NODE:
                pseries_remove_processor(node);
                break;
        }
@@ -399,7 +399,7 @@ static int __init pseries_cpu_hotplug_init(void)
 
        /* Processors can be added/removed only on LPAR */
        if (firmware_has_feature(FW_FEATURE_LPAR)) {
-               pSeries_reconfig_notifier_register(&pseries_smp_nb);
+               of_reconfig_notifier_register(&pseries_smp_nb);
                cpu_maps_update_begin();
                if (cede_offline_enabled && parse_cede_parameters() == 0) {
                        default_offline_state = CPU_STATE_INACTIVE;
index ecdb0a6b317172f396a858d382c4a0946745943e..2372c609fa2b241962e9d7c9a5b72be2c1564322 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <asm/firmware.h>
 #include <asm/machdep.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/sparsemem.h>
 
 static unsigned long get_memblock_size(void)
@@ -187,42 +186,69 @@ static int pseries_add_memory(struct device_node *np)
        return (ret < 0) ? -EINVAL : 0;
 }
 
-static int pseries_drconf_memory(unsigned long *base, unsigned int action)
+static int pseries_update_drconf_memory(struct of_prop_reconfig *pr)
 {
+       struct of_drconf_cell *new_drmem, *old_drmem;
        unsigned long memblock_size;
-       int rc;
+       u32 entries;
+       u32 *p;
+       int i, rc = -EINVAL;
 
        memblock_size = get_memblock_size();
        if (!memblock_size)
                return -EINVAL;
 
-       if (action == PSERIES_DRCONF_MEM_ADD) {
-               rc = memblock_add(*base, memblock_size);
-               rc = (rc < 0) ? -EINVAL : 0;
-       } else if (action == PSERIES_DRCONF_MEM_REMOVE) {
-               rc = pseries_remove_memblock(*base, memblock_size);
-       } else {
-               rc = -EINVAL;
+       p = (u32 *)of_get_property(pr->dn, "ibm,dynamic-memory", NULL);
+       if (!p)
+               return -EINVAL;
+
+       /* The first int of the property is the number of lmb's described
+        * by the property. This is followed by an array of of_drconf_cell
+        * entries. Get the niumber of entries and skip to the array of
+        * of_drconf_cell's.
+        */
+       entries = *p++;
+       old_drmem = (struct of_drconf_cell *)p;
+
+       p = (u32 *)pr->prop->value;
+       p++;
+       new_drmem = (struct of_drconf_cell *)p;
+
+       for (i = 0; i < entries; i++) {
+               if ((old_drmem[i].flags & DRCONF_MEM_ASSIGNED) &&
+                   (!(new_drmem[i].flags & DRCONF_MEM_ASSIGNED))) {
+                       rc = pseries_remove_memblock(old_drmem[i].base_addr,
+                                                    memblock_size);
+                       break;
+               } else if ((!(old_drmem[i].flags & DRCONF_MEM_ASSIGNED)) &&
+                          (new_drmem[i].flags & DRCONF_MEM_ASSIGNED)) {
+                       rc = memblock_add(old_drmem[i].base_addr,
+                                         memblock_size);
+                       rc = (rc < 0) ? -EINVAL : 0;
+                       break;
+               }
        }
 
        return rc;
 }
 
 static int pseries_memory_notifier(struct notifier_block *nb,
-                               unsigned long action, void *node)
+                                  unsigned long action, void *node)
 {
+       struct of_prop_reconfig *pr;
        int err = 0;
 
        switch (action) {
-       case PSERIES_RECONFIG_ADD:
+       case OF_RECONFIG_ATTACH_NODE:
                err = pseries_add_memory(node);
                break;
-       case PSERIES_RECONFIG_REMOVE:
+       case OF_RECONFIG_DETACH_NODE:
                err = pseries_remove_memory(node);
                break;
-       case PSERIES_DRCONF_MEM_ADD:
-       case PSERIES_DRCONF_MEM_REMOVE:
-               err = pseries_drconf_memory(node, action);
+       case OF_RECONFIG_UPDATE_PROPERTY:
+               pr = (struct of_prop_reconfig *)node;
+               if (!strcmp(pr->prop->name, "ibm,dynamic-memory"))
+                       err = pseries_update_drconf_memory(pr);
                break;
        }
        return notifier_from_errno(err);
@@ -235,7 +261,7 @@ static struct notifier_block pseries_mem_nb = {
 static int __init pseries_memory_hotplug_init(void)
 {
        if (firmware_has_feature(FW_FEATURE_LPAR))
-               pSeries_reconfig_notifier_register(&pseries_mem_nb);
+               of_reconfig_notifier_register(&pseries_mem_nb);
 
        return 0;
 }
index 6153eea27ce7d39ea51fb4d1f210be2a1934bfdf..e2685badb5db1761c9621a486049361608f0742a 100644 (file)
 #include <linux/dma-mapping.h>
 #include <linux/crash_dump.h>
 #include <linux/memory.h>
+#include <linux/of.h>
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/rtas.h>
 #include <asm/iommu.h>
 #include <asm/pci-bridge.h>
 #include <asm/machdep.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/firmware.h>
 #include <asm/tce.h>
 #include <asm/ppc-pci.h>
@@ -760,7 +760,7 @@ static void remove_ddw(struct device_node *np)
        __remove_ddw(np, ddw_avail, liobn);
 
 delprop:
-       ret = prom_remove_property(np, win64);
+       ret = of_remove_property(np, win64);
        if (ret)
                pr_warning("%s: failed to remove direct window property: %d\n",
                        np->full_name, ret);
@@ -1070,7 +1070,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
                goto out_free_window;
        }
 
-       ret = prom_add_property(pdn, win64);
+       ret = of_add_property(pdn, win64);
        if (ret) {
                dev_err(&dev->dev, "unable to add dma window property for %s: %d",
                         pdn->full_name, ret);
@@ -1294,7 +1294,7 @@ static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long acti
        struct direct_window *window;
 
        switch (action) {
-       case PSERIES_RECONFIG_REMOVE:
+       case OF_RECONFIG_DETACH_NODE:
                if (pci && pci->iommu_table)
                        iommu_free_table(pci->iommu_table, np->full_name);
 
@@ -1357,7 +1357,7 @@ void iommu_init_early_pSeries(void)
        }
 
 
-       pSeries_reconfig_notifier_register(&iommu_reconfig_nb);
+       of_reconfig_notifier_register(&iommu_reconfig_nb);
        register_memory_notifier(&iommu_mem_nb);
 
        set_pci_dma_ops(&dma_iommu_ops);
index dd30b12edfe4c5d8166c6cf1ca67a1aaddca1711..6573808cc5f35c227216bdf2a853beb9b1b40a57 100644 (file)
@@ -116,7 +116,7 @@ static int update_dt_property(struct device_node *dn, struct property **prop,
        }
 
        if (!more) {
-               prom_update_property(dn, new_prop);
+               of_update_property(dn, new_prop);
                new_prop = NULL;
        }
 
@@ -172,7 +172,7 @@ static int update_dt_node(u32 phandle)
 
                        case 0x80000000:
                                prop = of_find_property(dn, prop_name, NULL);
-                               prom_remove_property(dn, prop);
+                               of_remove_property(dn, prop);
                                prop = NULL;
                                break;
 
index 13e8cc43adf7589d778b0ba05df274450728658c..e6cc34a670530ec4f0b2e3375c9791cac34230d1 100644 (file)
@@ -273,4 +273,35 @@ static inline long plpar_put_term_char(unsigned long termno, unsigned long len,
                        lbuf[1]);
 }
 
+/* Set various resource mode parameters */
+static inline long plpar_set_mode(unsigned long mflags, unsigned long resource,
+               unsigned long value1, unsigned long value2)
+{
+       return plpar_hcall_norets(H_SET_MODE, mflags, resource, value1, value2);
+}
+
+/*
+ * Enable relocation on exceptions on this partition
+ *
+ * Note: this call has a partition wide scope and can take a while to complete.
+ * If it returns H_LONG_BUSY_* it should be retried periodically until it
+ * returns H_SUCCESS.
+ */
+static inline long enable_reloc_on_exceptions(void)
+{
+       /* mflags = 3: Exceptions at 0xC000000000004000 */
+       return plpar_set_mode(3, 3, 0, 0);
+}
+
+/*
+ * Disable relocation on exceptions on this partition
+ *
+ * Note: this call has a partition wide scope and can take a while to complete.
+ * If it returns H_LONG_BUSY_* it should be retried periodically until it
+ * returns H_SUCCESS.
+ */
+static inline long disable_reloc_on_exceptions(void) {
+       return plpar_set_mode(0, 3, 0, 0);
+}
+
 #endif /* _PSERIES_PLPAR_WRAPPERS_H */
index 39f71fba9b38eed2e34d717d2bd2e4ea1ca38925..30b358dc2bebdac232ced9966daadf7b969fd1c6 100644 (file)
 #include <linux/notifier.h>
 #include <linux/proc_fs.h>
 #include <linux/slab.h>
+#include <linux/of.h>
 
 #include <asm/prom.h>
 #include <asm/machdep.h>
 #include <asm/uaccess.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/mmu.h>
 
-
-
-/*
- * Routines for "runtime" addition and removal of device tree nodes.
- */
-#ifdef CONFIG_PROC_DEVICETREE
-/*
- * Add a node to /proc/device-tree.
- */
-static void add_node_proc_entries(struct device_node *np)
-{
-       struct proc_dir_entry *ent;
-
-       ent = proc_mkdir(strrchr(np->full_name, '/') + 1, np->parent->pde);
-       if (ent)
-               proc_device_tree_add_node(np, ent);
-}
-
-static void remove_node_proc_entries(struct device_node *np)
-{
-       struct property *pp = np->properties;
-       struct device_node *parent = np->parent;
-
-       while (pp) {
-               remove_proc_entry(pp->name, np->pde);
-               pp = pp->next;
-       }
-       if (np->pde)
-               remove_proc_entry(np->pde->name, parent->pde);
-}
-#else /* !CONFIG_PROC_DEVICETREE */
-static void add_node_proc_entries(struct device_node *np)
-{
-       return;
-}
-
-static void remove_node_proc_entries(struct device_node *np)
-{
-       return;
-}
-#endif /* CONFIG_PROC_DEVICETREE */
-
 /**
  *     derive_parent - basically like dirname(1)
  *     @path:  the full_name of a node to be added to the tree
@@ -97,28 +55,6 @@ static struct device_node *derive_parent(const char *path)
        return parent;
 }
 
-static BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain);
-
-int pSeries_reconfig_notifier_register(struct notifier_block *nb)
-{
-       return blocking_notifier_chain_register(&pSeries_reconfig_chain, nb);
-}
-EXPORT_SYMBOL_GPL(pSeries_reconfig_notifier_register);
-
-void pSeries_reconfig_notifier_unregister(struct notifier_block *nb)
-{
-       blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb);
-}
-EXPORT_SYMBOL_GPL(pSeries_reconfig_notifier_unregister);
-
-int pSeries_reconfig_notify(unsigned long action, void *p)
-{
-       int err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
-                                               action, p);
-
-       return notifier_to_errno(err);
-}
-
 static int pSeries_reconfig_add_node(const char *path, struct property *proplist)
 {
        struct device_node *np;
@@ -142,16 +78,12 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
                goto out_err;
        }
 
-       err = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, np);
+       err = of_attach_node(np);
        if (err) {
                printk(KERN_ERR "Failed to add device node %s\n", path);
                goto out_err;
        }
 
-       of_attach_node(np);
-
-       add_node_proc_entries(np);
-
        of_node_put(np->parent);
 
        return 0;
@@ -179,11 +111,7 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
                return -EBUSY;
        }
 
-       remove_node_proc_entries(np);
-
-       pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, np);
        of_detach_node(np);
-
        of_node_put(parent);
        of_node_put(np); /* Must decrement the refcount */
        return 0;
@@ -398,7 +326,7 @@ static int do_add_property(char *buf, size_t bufsize)
        if (!prop)
                return -ENOMEM;
 
-       prom_add_property(np, prop);
+       of_add_property(np, prop);
 
        return 0;
 }
@@ -422,16 +350,15 @@ static int do_remove_property(char *buf, size_t bufsize)
 
        prop = of_find_property(np, buf, NULL);
 
-       return prom_remove_property(np, prop);
+       return of_remove_property(np, prop);
 }
 
 static int do_update_property(char *buf, size_t bufsize)
 {
        struct device_node *np;
-       struct pSeries_reconfig_prop_update upd_value;
        unsigned char *value;
        char *name, *end, *next_prop;
-       int rc, length;
+       int length;
        struct property *newprop;
        buf = parse_node(buf, bufsize, &np);
        end = buf + bufsize;
@@ -453,41 +380,7 @@ 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);
 
-       upd_value.node = np;
-       upd_value.property = newprop;
-       pSeries_reconfig_notify(PSERIES_UPDATE_PROPERTY, &upd_value);
-
-       rc = prom_update_property(np, newprop);
-       if (rc)
-               return rc;
-
-       /* For memory under the ibm,dynamic-reconfiguration-memory node
-        * of the device tree, adding and removing memory is just an update
-        * to the ibm,dynamic-memory property instead of adding/removing a
-        * memory node in the device tree.  For these cases we still need to
-        * involve the notifier chain.
-        */
-       if (!strcmp(name, "ibm,dynamic-memory")) {
-               int action;
-
-               next_prop = parse_next_property(next_prop, end, &name,
-                                               &length, &value);
-               if (!next_prop)
-                       return -EINVAL;
-
-               if (!strcmp(name, "add"))
-                       action = PSERIES_DRCONF_MEM_ADD;
-               else
-                       action = PSERIES_DRCONF_MEM_REMOVE;
-
-               rc = pSeries_reconfig_notify(action, value);
-               if (rc) {
-                       prom_update_property(np, newprop);
-                       return rc;
-               }
-       }
-
-       return 0;
+       return of_update_property(np, newprop);
 }
 
 /**
index e3cb7ae616587c4fa6239683e409fc38fce9328d..ca55882465d6b0d027ef785f941c64a342985f99 100644 (file)
@@ -40,6 +40,8 @@
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
 #include <linux/cpuidle.h>
+#include <linux/of.h>
+#include <linux/kexec.h>
 
 #include <asm/mmu.h>
 #include <asm/processor.h>
@@ -63,7 +65,6 @@
 #include <asm/smp.h>
 #include <asm/firmware.h>
 #include <asm/eeh.h>
-#include <asm/pSeries_reconfig.h>
 
 #include "plpar_wrappers.h"
 #include "pseries.h"
@@ -258,7 +259,7 @@ static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long act
        int err = NOTIFY_OK;
 
        switch (action) {
-       case PSERIES_RECONFIG_ADD:
+       case OF_RECONFIG_ATTACH_NODE:
                pci = np->parent->data;
                if (pci) {
                        update_dn_pci_info(np, pci->phb);
@@ -367,6 +368,65 @@ static void pSeries_idle(void)
        }
 }
 
+/*
+ * Enable relocation on during exceptions. This has partition wide scope and
+ * may take a while to complete, if it takes longer than one second we will
+ * just give up rather than wasting any more time on this - if that turns out
+ * to ever be a problem in practice we can move this into a kernel thread to
+ * finish off the process later in boot.
+ */
+static int __init pSeries_enable_reloc_on_exc(void)
+{
+       long rc;
+       unsigned int delay, total_delay = 0;
+
+       while (1) {
+               rc = enable_reloc_on_exceptions();
+               if (!H_IS_LONG_BUSY(rc))
+                       return rc;
+
+               delay = get_longbusy_msecs(rc);
+               total_delay += delay;
+               if (total_delay > 1000) {
+                       pr_warn("Warning: Giving up waiting to enable "
+                               "relocation on exceptions (%u msec)!\n",
+                               total_delay);
+                       return rc;
+               }
+
+               mdelay(delay);
+       }
+}
+
+#ifdef CONFIG_KEXEC
+static long pSeries_disable_reloc_on_exc(void)
+{
+       long rc;
+
+       while (1) {
+               rc = disable_reloc_on_exceptions();
+               if (!H_IS_LONG_BUSY(rc))
+                       return rc;
+               mdelay(get_longbusy_msecs(rc));
+       }
+}
+
+static void pSeries_machine_kexec(struct kimage *image)
+{
+       long rc;
+
+       if (firmware_has_feature(FW_FEATURE_SET_MODE) &&
+           (image->type != KEXEC_TYPE_CRASH)) {
+               rc = pSeries_disable_reloc_on_exc();
+               if (rc != H_SUCCESS)
+                       pr_warning("Warning: Failed to disable relocation on "
+                                  "exceptions: %ld\n", rc);
+       }
+
+       default_machine_kexec(image);
+}
+#endif
+
 static void __init pSeries_setup_arch(void)
 {
        panic_timeout = 10;
@@ -389,7 +449,7 @@ static void __init pSeries_setup_arch(void)
        /* Find and initialize PCI host bridges */
        init_pci_config_tokens();
        find_and_init_phbs();
-       pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb);
+       of_reconfig_notifier_register(&pci_dn_reconfig_nb);
 
        pSeries_nvram_init();
 
@@ -402,6 +462,14 @@ static void __init pSeries_setup_arch(void)
                ppc_md.enable_pmcs = pseries_lpar_enable_pmcs;
        else
                ppc_md.enable_pmcs = power4_enable_pmcs;
+
+       if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
+               long rc;
+               if ((rc = pSeries_enable_reloc_on_exc()) != H_SUCCESS) {
+                       pr_warn("Unable to enable relocation on exceptions: "
+                               "%ld\n", rc);
+               }
+       }
 }
 
 static int __init pSeries_init_panel(void)
@@ -659,4 +727,7 @@ define_machine(pseries) {
        .progress               = rtas_progress,
        .system_reset_exception = pSeries_system_reset_exception,
        .machine_check_exception = pSeries_machine_check_exception,
+#ifdef CONFIG_KEXEC
+       .machine_kexec          = pSeries_machine_kexec,
+#endif
 };
index 71706bc34a0dd8a117f5ef71d70b93ab65880ca3..9fc0a4941908589aa334a96d47f5b6bb96bfe460 100644 (file)
@@ -38,7 +38,6 @@
 #include <asm/cputable.h>
 #include <asm/firmware.h>
 #include <asm/rtas.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/mpic.h>
 #include <asm/vdso_datapage.h>
 #include <asm/cputhreads.h>
index 02cf1e7e77fc6a7bcf4a734d15099e8e4dcc25bc..0eb871cc3437f9250372422f727f112a18f6b002 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Freescale General-purpose Timers Module
  *
- * Copyright (c) Freescale Semicondutor, Inc. 2006.
+ * Copyright (c) Freescale Semiconductor, Inc. 2006.
  *               Shlomi Gridish <gridish@freescale.com>
  *               Jerry Huang <Chang-Ming.Huang@freescale.com>
  * Copyright (c) MontaVista Software, Inc. 2008.
index 8f0465422b1e3f2255fbee4d6402f87642d9a8d9..5aaf86c03893446474b538760d6d3fa169ec4e2b 100644 (file)
@@ -214,18 +214,7 @@ static struct platform_driver pmi_of_platform_driver = {
                .of_match_table = pmi_match,
        },
 };
-
-static int __init pmi_module_init(void)
-{
-       return platform_driver_register(&pmi_of_platform_driver);
-}
-module_init(pmi_module_init);
-
-static void __exit pmi_module_exit(void)
-{
-       platform_driver_unregister(&pmi_of_platform_driver);
-}
-module_exit(pmi_module_exit);
+module_platform_driver(pmi_of_platform_driver);
 
 int pmi_send_message(pmi_message_t msg)
 {
index b043675297299ceea7f317dfb1579c8a311aba98..238a07b97f2cb5c54cc2eec6a59663b4a8c3f3a2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2010 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006-2010 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Authors:    Shlomi Gridish <gridish@freescale.com>
  *             Li Yang <leoli@freescale.com>
index 2fba6ef2f95edeb3966d7bb76f9cc5c3d38b87c7..b2b87c30e2665d1e4d133f284a6d2f72d5b77cf3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/powerpc/sysdev/qe_lib/qe_ic.c
  *
- * Copyright (C) 2006 Freescale Semicondutor, Inc.  All rights reserved.
+ * Copyright (C) 2006 Freescale Semiconductor, Inc.  All rights reserved.
  *
  * Author: Li Yang <leoli@freescale.com>
  * Based on code from Shlomi Gridish <gridish@freescale.com>
index c327872ed35cf6c6127b522a94d54cfe278c89f5..efef7ab9b753eba14ba858c50583c6e3a844415b 100644 (file)
@@ -3,7 +3,7 @@
  *
  * QUICC ENGINE Interrupt Controller Header
  *
- * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Author: Li Yang <leoli@freescale.com>
  * Based on code from Shlomi Gridish <gridish@freescale.com>
index fd1a6c3b1721e73e6178f7b3209541ed2142e032..a88807b3dd578b7b4e2ed423d5305ef41dad00e3 100644 (file)
@@ -3,7 +3,7 @@
  *
  * QE Parallel I/O ports configuration routines
  *
- * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
+ * Copyright 2006 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Author: Li Yang <LeoLi@freescale.com>
  * Based on code from Shlomi Gridish <gridish@freescale.com>
index 04677505f20f52d2aab914a8ee7a3af9a4aaf572..134b07d2943564ee3e7244fee932366680c744d2 100644 (file)
@@ -3,7 +3,7 @@
  *
  * QE UCC API Set - UCC specific routines implementations.
  *
- * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Authors:    Shlomi Gridish <gridish@freescale.com>
  *             Li Yang <leoli@freescale.com>
index fba02440d122580e1dae6b4d0e99f644865f688b..cceb2e366738f90b7b9570c9dab1b1a14c37830d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Authors:    Shlomi Gridish <gridish@freescale.com>
  *             Li Yang <leoli@freescale.com>
index 524c0ead941d3eeed799ad83bad9b8b36fda890b..1c062f48f1ac8711e8975b3cf601cb595ce494fd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
  *
  * Authors:    Shlomi Gridish <gridish@freescale.com>
  *             Li Yang <leoli@freescale.com>
index 9162828f5da7351c88c9afcf99ab82eabb7ecbdf..27f23bd15eb65b75729cc7443a683219df74609e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * QE USB routines
  *
- * Copyright (c) Freescale Semicondutor, Inc. 2006.
+ * Copyright 2006 Freescale Semiconductor, Inc.
  *               Shlomi Gridish <gridish@freescale.com>
  *               Jerry Huang <Chang-Ming.Huang@freescale.com>
  * Copyright (c) MontaVista Software, Inc. 2008.
index c168c54e3c40caed0ead0ad449ebe00ad0232fd0..b49fdbd15808b5da74881412919a77178f35e4af 100644 (file)
@@ -6,7 +6,7 @@ GCOV_PROFILE := n
 
 ccflags-$(CONFIG_PPC64) := -mno-minimal-toc
 
-obj-y                  += xmon.o start.o nonstdio.o
+obj-y                  += xmon.o nonstdio.o
 
 ifdef CONFIG_XMON_DISASSEMBLY
 obj-y                  += ppc-dis.o ppc-opc.o
index bfac84fbe7806693797decdd8db0deaea98bf097..bce3dcfe50583440f09e7229e08305559acc12f9 100644 (file)
@@ -7,9 +7,23 @@
  *      2 of the License, or (at your option) any later version.
  */
 #include <linux/string.h>
+#include <asm/udbg.h>
 #include <asm/time.h>
 #include "nonstdio.h"
 
+
+static int xmon_write(const void *ptr, int nb)
+{
+       return udbg_write(ptr, nb);
+}
+
+static int xmon_readchar(void)
+{
+       if (udbg_getc)
+               return udbg_getc();
+       return -1;
+}
+
 int xmon_putchar(int c)
 {
        char ch = c;
@@ -23,34 +37,7 @@ static char line[256];
 static char *lineptr;
 static int lineleft;
 
-int xmon_expect(const char *str, unsigned long timeout)
-{
-       int c;
-       unsigned long t0;
-
-       /* assume 25MHz default timebase if tb_ticks_per_sec not set yet */
-       timeout *= tb_ticks_per_sec? tb_ticks_per_sec: 25000000;
-       t0 = get_tbl();
-       do {
-               lineptr = line;
-               for (;;) {
-                       c = xmon_read_poll();
-                       if (c == -1) {
-                               if (get_tbl() - t0 > timeout)
-                                       return 0;
-                               continue;
-                       }
-                       if (c == '\n')
-                               break;
-                       if (c != '\r' && lineptr < &line[sizeof(line) - 1])
-                               *lineptr++ = c;
-               }
-               *lineptr = 0;
-       } while (strstr(line, str) == NULL);
-       return 1;
-}
-
-int xmon_getchar(void)
+static int xmon_getchar(void)
 {
        int c;
 
@@ -124,13 +111,19 @@ char *xmon_gets(char *str, int nb)
 void xmon_printf(const char *format, ...)
 {
        va_list args;
-       int n;
        static char xmon_outbuf[1024];
+       int rc, n;
 
        va_start(args, format);
        n = vsnprintf(xmon_outbuf, sizeof(xmon_outbuf), format, args);
        va_end(args);
-       xmon_write(xmon_outbuf, n);
+
+       rc = xmon_write(xmon_outbuf, n);
+
+       if (n && rc == 0) {
+               /* No udbg hooks, fallback to printk() - dangerous */
+               printk(xmon_outbuf);
+       }
 }
 
 void xmon_puts(const char *str)
index 23dd95f4599c3fd049eb17be31990ca6b00d3732..18a51ded4ffdb0d9489b0065f6f26d0cfc93f5bf 100644 (file)
@@ -4,12 +4,6 @@
 #define putchar        xmon_putchar
 
 extern int xmon_putchar(int c);
-extern int xmon_getchar(void);
 extern void xmon_puts(const char *);
 extern char *xmon_gets(char *, int);
 extern void xmon_printf(const char *, ...);
-extern void xmon_map_scc(void);
-extern int xmon_expect(const char *str, unsigned long timeout);
-extern int xmon_write(const void *ptr, int nb);
-extern int xmon_readchar(void);
-extern int xmon_read_poll(void);
diff --git a/arch/powerpc/xmon/start.c b/arch/powerpc/xmon/start.c
deleted file mode 100644 (file)
index 8864de2..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 1996 Paul Mackerras.
- *
- *      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 <asm/machdep.h>
-#include <asm/udbg.h>
-#include "nonstdio.h"
-
-void xmon_map_scc(void)
-{
-}
-
-int xmon_write(const void *ptr, int nb)
-{
-       return udbg_write(ptr, nb);
-}
-
-int xmon_readchar(void)
-{
-       if (udbg_getc)
-               return udbg_getc();
-       return -1;
-}
-
-int xmon_read_poll(void)
-{
-       if (udbg_getc_poll)
-               return udbg_getc_poll();
-       return -1;
-}
index 3a56a639a92e88962a0b7c1274e9d8330d6e218e..1f8d2f10a432442c2419228d1e7cc4cb120020ef 100644 (file)
@@ -52,9 +52,6 @@
 #include "nonstdio.h"
 #include "dis-asm.h"
 
-#define scanhex        xmon_scanhex
-#define skipbl xmon_skipbl
-
 #ifdef CONFIG_SMP
 static cpumask_t cpus_in_xmon = CPU_MASK_NONE;
 static unsigned long xmon_taken = 1;
@@ -169,12 +166,8 @@ extern void xmon_leave(void);
 
 #ifdef CONFIG_PPC64
 #define REG            "%.16lx"
-#define REGS_PER_LINE  4
-#define LAST_VOLATILE  13
 #else
 #define REG            "%.8lx"
-#define REGS_PER_LINE  8
-#define LAST_VOLATILE  12
 #endif
 
 #define GETWORD(v)     (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3])
@@ -1288,27 +1281,19 @@ static void get_function_bounds(unsigned long pc, unsigned long *startp,
        catch_memory_errors = 0;
 }
 
-static int xmon_depth_to_print = 64;
-
 #define LRSAVE_OFFSET          (STACK_FRAME_LR_SAVE * sizeof(unsigned long))
 #define MARKER_OFFSET          (STACK_FRAME_MARKER * sizeof(unsigned long))
 
-#ifdef __powerpc64__
-#define REGS_OFFSET            0x70
-#else
-#define REGS_OFFSET            16
-#endif
-
 static void xmon_show_stack(unsigned long sp, unsigned long lr,
                            unsigned long pc)
 {
+       int max_to_print = 64;
        unsigned long ip;
        unsigned long newsp;
        unsigned long marker;
-       int count = 0;
        struct pt_regs regs;
 
-       do {
+       while (max_to_print--) {
                if (sp < PAGE_OFFSET) {
                        if (sp != 0)
                                printf("SP (%lx) is in userspace\n", sp);
@@ -1362,10 +1347,10 @@ static void xmon_show_stack(unsigned long sp, unsigned long lr,
                   an exception frame. */
                if (mread(sp + MARKER_OFFSET, &marker, sizeof(unsigned long))
                    && marker == STACK_FRAME_REGS_MARKER) {
-                       if (mread(sp + REGS_OFFSET, &regs, sizeof(regs))
+                       if (mread(sp + STACK_FRAME_OVERHEAD, &regs, sizeof(regs))
                            != sizeof(regs)) {
                                printf("Couldn't read registers at %lx\n",
-                                      sp + REGS_OFFSET);
+                                      sp + STACK_FRAME_OVERHEAD);
                                break;
                        }
                        printf("--- Exception: %lx %s at ", regs.trap,
@@ -1379,7 +1364,7 @@ static void xmon_show_stack(unsigned long sp, unsigned long lr,
                        break;
 
                sp = newsp;
-       } while (count++ < xmon_depth_to_print);
+       }
 }
 
 static void backtrace(struct pt_regs *excp)
@@ -2943,7 +2928,6 @@ static void xmon_init(int enable)
                __debugger_dabr_match = NULL;
                __debugger_fault_handler = NULL;
        }
-       xmon_map_scc();
 }
 
 #ifdef CONFIG_MAGIC_SYSRQ
index 0ce625738677951ebec20d02bd34ff4d926074d9..6c4c000671c50d88885bb39618c5ae9e4ceabe42 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/slab.h>
 
 #include <asm/page.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/vio.h>
 
 #include "nx_csbcpb.h" /* struct nx_csbcpb */
@@ -1014,26 +1013,23 @@ error_out:
  *     NOTIFY_BAD encoded with error number on failure, use
  *             notifier_to_errno() to decode this value
  */
-static int nx842_OF_notifier(struct notifier_block *np,
-                                       unsigned long action,
-                                       void *update)
+static int nx842_OF_notifier(struct notifier_block *np, unsigned long action,
+                            void *update)
 {
-       struct pSeries_reconfig_prop_update *upd;
+       struct of_prop_reconfig *upd = update;
        struct nx842_devdata *local_devdata;
        struct device_node *node = NULL;
 
-       upd = (struct pSeries_reconfig_prop_update *)update;
-
        rcu_read_lock();
        local_devdata = rcu_dereference(devdata);
        if (local_devdata)
                node = local_devdata->dev->of_node;
 
        if (local_devdata &&
-                       action == PSERIES_UPDATE_PROPERTY &&
-                       !strcmp(upd->node->name, node->name)) {
+                       action == OF_RECONFIG_UPDATE_PROPERTY &&
+                       !strcmp(upd->dn->name, node->name)) {
                rcu_read_unlock();
-               nx842_OF_upd(upd->property);
+               nx842_OF_upd(upd->prop);
        } else
                rcu_read_unlock();
 
@@ -1182,7 +1178,7 @@ static int __init nx842_probe(struct vio_dev *viodev,
        synchronize_rcu();
        kfree(old_devdata);
 
-       pSeries_reconfig_notifier_register(&nx842_of_nb);
+       of_reconfig_notifier_register(&nx842_of_nb);
 
        ret = nx842_OF_upd(NULL);
        if (ret && ret != -ENODEV) {
@@ -1228,7 +1224,7 @@ static int __exit nx842_remove(struct vio_dev *viodev)
        spin_lock_irqsave(&devdata_mutex, flags);
        old_devdata = rcu_dereference_check(devdata,
                        lockdep_is_held(&devdata_mutex));
-       pSeries_reconfig_notifier_unregister(&nx842_of_nb);
+       of_reconfig_notifier_unregister(&nx842_of_nb);
        rcu_assign_pointer(devdata, NULL);
        spin_unlock_irqrestore(&devdata_mutex, flags);
        synchronize_rcu();
index 638110efae9bede0b58e2f4f2b2315e73d07402d..f7a8a16aa7d39d796a07385540eddf60df79661d 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/scatterlist.h>
 #include <linux/device.h>
 #include <linux/of.h>
-#include <asm/pSeries_reconfig.h>
 #include <asm/hvcall.h>
 #include <asm/vio.h>
 
index 2d41d04fd959421df86e7348ea277e8e3a01f521..89517ffb4389ed8b1d781ef658b4f54b0ccd7a98 100644 (file)
 
 static DEFINE_SPINLOCK(hcall_lock);
 
-static u32 get_longbusy_msecs(int longbusy_rc)
-{
-       switch (longbusy_rc) {
-       case H_LONG_BUSY_ORDER_1_MSEC:
-               return 1;
-       case H_LONG_BUSY_ORDER_10_MSEC:
-               return 10;
-       case H_LONG_BUSY_ORDER_100_MSEC:
-               return 100;
-       case H_LONG_BUSY_ORDER_1_SEC:
-               return 1000;
-       case H_LONG_BUSY_ORDER_10_SEC:
-               return 10000;
-       case H_LONG_BUSY_ORDER_100_SEC:
-               return 100000;
-       default:
-               return 1;
-       }
-}
-
 static long ehca_plpar_hcall_norets(unsigned long opcode,
                                    unsigned long arg1,
                                    unsigned long arg2,
index 7d5a6b40b31cf973a99e7f7232ab52bcd0bddf90..5b939509db3bf36bae876194669640b28ebb0428 100644 (file)
@@ -997,7 +997,7 @@ static struct smu_sdbp_header *smu_create_sdb_partition(int id)
                       "%02x !\n", id, hdr->id);
                goto failure;
        }
-       if (prom_add_property(smu->of_node, prop)) {
+       if (of_add_property(smu->of_node, prop)) {
                printk(KERN_DEBUG "SMU: Failed creating sdb-partition-%02x "
                       "property !\n", id);
                goto failure;
index b3411edb324bea18cfdfbd02f6cedde49bb3bc9c..fd6ed15a979dfae62db35fb2fd7ea3ff4f1c650b 100644 (file)
@@ -593,19 +593,7 @@ static struct i2c_driver wf_fcu_driver = {
        .id_table       = wf_fcu_id,
 };
 
-static int __init wf_fcu_init(void)
-{
-       return i2c_add_driver(&wf_fcu_driver);
-}
-
-static void __exit wf_fcu_exit(void)
-{
-       i2c_del_driver(&wf_fcu_driver);
-}
-
-
-module_init(wf_fcu_init);
-module_exit(wf_fcu_exit);
+module_i2c_driver(wf_fcu_driver);
 
 MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
 MODULE_DESCRIPTION("FCU control objects for PowerMacs thermal control");
index b0c2d3695b347fc1e5c8f16c22527903ecfa1630..9ef32b3df91f060b0b85d399d207faad7c072384 100644 (file)
@@ -174,19 +174,7 @@ static struct i2c_driver wf_lm75_driver = {
        .id_table       = wf_lm75_id,
 };
 
-static int __init wf_lm75_sensor_init(void)
-{
-       return i2c_add_driver(&wf_lm75_driver);
-}
-
-static void __exit wf_lm75_sensor_exit(void)
-{
-       i2c_del_driver(&wf_lm75_driver);
-}
-
-
-module_init(wf_lm75_sensor_init);
-module_exit(wf_lm75_sensor_exit);
+module_i2c_driver(wf_lm75_driver);
 
 MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
 MODULE_DESCRIPTION("LM75 sensor objects for PowerMacs thermal control");
index 371b058d2f7d9565a4dada1a8bd99616ec30ec50..945a25b2f31ea78b82a746d6beff6407341e5db4 100644 (file)
@@ -130,18 +130,7 @@ static struct i2c_driver wf_max6690_driver = {
        .id_table       = wf_max6690_id,
 };
 
-static int __init wf_max6690_sensor_init(void)
-{
-       return i2c_add_driver(&wf_max6690_driver);
-}
-
-static void __exit wf_max6690_sensor_exit(void)
-{
-       i2c_del_driver(&wf_max6690_driver);
-}
-
-module_init(wf_max6690_sensor_init);
-module_exit(wf_max6690_sensor_exit);
+module_i2c_driver(wf_max6690_driver);
 
 MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>");
 MODULE_DESCRIPTION("MAX6690 sensor objects for PowerMac thermal control");
index 426e810233d7403595474f2a1e1ffa810daa141f..d87f5ee04ca9b3c1638e99c7a0655256d7fc8e66 100644 (file)
@@ -364,18 +364,7 @@ static struct i2c_driver wf_sat_driver = {
        .id_table       = wf_sat_id,
 };
 
-static int __init sat_sensors_init(void)
-{
-       return i2c_add_driver(&wf_sat_driver);
-}
-
-static void __exit sat_sensors_exit(void)
-{
-       i2c_del_driver(&wf_sat_driver);
-}
-
-module_init(sat_sensors_init);
-module_exit(sat_sensors_exit);
+module_i2c_driver(wf_sat_driver);
 
 MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>");
 MODULE_DESCRIPTION("SMU satellite sensors for PowerMac thermal control");
index 8364815c32ff63f04fd7942d2f240b980e156f2f..99b6c2a38dbf08e9458de1d165efc4719cc33506 100644 (file)
  * hcp_*  - structures, variables and functions releated to Hypervisor Calls
  */
 
-static inline u32 get_longbusy_msecs(int long_busy_ret_code)
-{
-       switch (long_busy_ret_code) {
-       case H_LONG_BUSY_ORDER_1_MSEC:
-               return 1;
-       case H_LONG_BUSY_ORDER_10_MSEC:
-               return 10;
-       case H_LONG_BUSY_ORDER_100_MSEC:
-               return 100;
-       case H_LONG_BUSY_ORDER_1_SEC:
-               return 1000;
-       case H_LONG_BUSY_ORDER_10_SEC:
-               return 10000;
-       case H_LONG_BUSY_ORDER_100_SEC:
-               return 100000;
-       default:
-               return 1;
-       }
-}
-
 /* Number of pages which can be registered at once by H_REGISTER_HEA_RPAGES */
 #define EHEA_MAX_RPAGE 512
 
index af3b22ac762755b532286ac505fb85ef936ca64b..02d94c4ea83c08b5b2e21daa330e615b530c907b 100644 (file)
@@ -1028,13 +1028,36 @@ int of_parse_phandle_with_args(struct device_node *np, const char *list_name,
 }
 EXPORT_SYMBOL(of_parse_phandle_with_args);
 
+#if defined(CONFIG_OF_DYNAMIC)
+static int of_property_notify(int action, struct device_node *np,
+                             struct property *prop)
+{
+       struct of_prop_reconfig pr;
+
+       pr.dn = np;
+       pr.prop = prop;
+       return of_reconfig_notify(action, &pr);
+}
+#else
+static int of_property_notify(int action, struct device_node *np,
+                             struct property *prop)
+{
+       return 0;
+}
+#endif
+
 /**
- * prom_add_property - Add a property to a node
+ * of_add_property - Add a property to a node
  */
-int prom_add_property(struct device_node *np, struct property *prop)
+int of_add_property(struct device_node *np, struct property *prop)
 {
        struct property **next;
        unsigned long flags;
+       int rc;
+
+       rc = of_property_notify(OF_RECONFIG_ADD_PROPERTY, np, prop);
+       if (rc)
+               return rc;
 
        prop->next = NULL;
        write_lock_irqsave(&devtree_lock, flags);
@@ -1060,18 +1083,23 @@ int prom_add_property(struct device_node *np, struct property *prop)
 }
 
 /**
- * prom_remove_property - Remove a property from a node.
+ * of_remove_property - Remove a property from 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.
  * Instead we just move the property to the "dead properties"
  * list, so it won't be found any more.
  */
-int prom_remove_property(struct device_node *np, struct property *prop)
+int of_remove_property(struct device_node *np, struct property *prop)
 {
        struct property **next;
        unsigned long flags;
        int found = 0;
+       int rc;
+
+       rc = of_property_notify(OF_RECONFIG_REMOVE_PROPERTY, np, prop);
+       if (rc)
+               return rc;
 
        write_lock_irqsave(&devtree_lock, flags);
        next = &np->properties;
@@ -1101,7 +1129,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
+ * of_update_property - Update a property in a node, if the property does
  * not exist, add it.
  *
  * Note that we don't actually remove it, since we have given out
@@ -1109,19 +1137,22 @@ int prom_remove_property(struct device_node *np, struct property *prop)
  * Instead we just move the property to the "dead properties" list,
  * and add the new property to the property list
  */
-int prom_update_property(struct device_node *np,
-                        struct property *newprop)
+int of_update_property(struct device_node *np, struct property *newprop)
 {
        struct property **next, *oldprop;
        unsigned long flags;
-       int found = 0;
+       int rc, found = 0;
+
+       rc = of_property_notify(OF_RECONFIG_UPDATE_PROPERTY, np, newprop);
+       if (rc)
+               return rc;
 
        if (!newprop->name)
                return -EINVAL;
 
        oldprop = of_find_property(np, newprop->name, NULL);
        if (!oldprop)
-               return prom_add_property(np, newprop);
+               return of_add_property(np, newprop);
 
        write_lock_irqsave(&devtree_lock, flags);
        next = &np->properties;
@@ -1160,12 +1191,53 @@ int prom_update_property(struct device_node *np,
  * device tree nodes.
  */
 
+static BLOCKING_NOTIFIER_HEAD(of_reconfig_chain);
+
+int of_reconfig_notifier_register(struct notifier_block *nb)
+{
+       return blocking_notifier_chain_register(&of_reconfig_chain, nb);
+}
+
+int of_reconfig_notifier_unregister(struct notifier_block *nb)
+{
+       return blocking_notifier_chain_unregister(&of_reconfig_chain, nb);
+}
+
+int of_reconfig_notify(unsigned long action, void *p)
+{
+       int rc;
+
+       rc = blocking_notifier_call_chain(&of_reconfig_chain, action, p);
+       return notifier_to_errno(rc);
+}
+
+#ifdef CONFIG_PROC_DEVICETREE
+static void of_add_proc_dt_entry(struct device_node *dn)
+{
+       struct proc_dir_entry *ent;
+
+       ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
+       if (ent)
+               proc_device_tree_add_node(dn, ent);
+}
+#else
+static void of_add_proc_dt_entry(struct device_node *dn)
+{
+       return;
+}
+#endif
+
 /**
  * of_attach_node - Plug a device node into the tree and global list.
  */
-void of_attach_node(struct device_node *np)
+int of_attach_node(struct device_node *np)
 {
        unsigned long flags;
+       int rc;
+
+       rc = of_reconfig_notify(OF_RECONFIG_ATTACH_NODE, np);
+       if (rc)
+               return rc;
 
        write_lock_irqsave(&devtree_lock, flags);
        np->sibling = np->parent->child;
@@ -1173,24 +1245,61 @@ void of_attach_node(struct device_node *np)
        np->parent->child = np;
        allnodes = np;
        write_unlock_irqrestore(&devtree_lock, flags);
+
+       of_add_proc_dt_entry(np);
+       return 0;
 }
 
+#ifdef CONFIG_PROC_DEVICETREE
+static void of_remove_proc_dt_entry(struct device_node *dn)
+{
+       struct device_node *parent = dn->parent;
+       struct property *prop = dn->properties;
+
+       while (prop) {
+               remove_proc_entry(prop->name, dn->pde);
+               prop = prop->next;
+       }
+
+       if (dn->pde)
+               remove_proc_entry(dn->pde->name, parent->pde);
+}
+#else
+static void of_remove_proc_dt_entry(struct device_node *dn)
+{
+       return;
+}
+#endif
+
 /**
  * of_detach_node - "Unplug" a node from the device tree.
  *
  * The caller must hold a reference to the node.  The memory associated with
  * the node is not freed until its refcount goes to zero.
  */
-void of_detach_node(struct device_node *np)
+int of_detach_node(struct device_node *np)
 {
        struct device_node *parent;
        unsigned long flags;
+       int rc = 0;
+
+       rc = of_reconfig_notify(OF_RECONFIG_DETACH_NODE, np);
+       if (rc)
+               return rc;
 
        write_lock_irqsave(&devtree_lock, flags);
 
+       if (of_node_check_flag(np, OF_DETACHED)) {
+               /* someone already detached it */
+               write_unlock_irqrestore(&devtree_lock, flags);
+               return rc;
+       }
+
        parent = np->parent;
-       if (!parent)
-               goto out_unlock;
+       if (!parent) {
+               write_unlock_irqrestore(&devtree_lock, flags);
+               return rc;
+       }
 
        if (allnodes == np)
                allnodes = np->allnext;
@@ -1215,9 +1324,10 @@ void of_detach_node(struct device_node *np)
        }
 
        of_node_set_flag(np, OF_DETACHED);
-
-out_unlock:
        write_unlock_irqrestore(&devtree_lock, flags);
+
+       of_remove_proc_dt_entry(np);
+       return rc;
 }
 #endif /* defined(CONFIG_OF_DYNAMIC) */
 
index d08d7998a4aae7835c607791b2308d6ed008a797..0cff083fbbe21c8cebe7bb6f30649145550540df 100644 (file)
@@ -2140,14 +2140,16 @@ config FB_UDL
          To compile as a module, choose M here: the module name is udlfb.
 
 config FB_IBM_GXT4500
-       tristate "Framebuffer support for IBM GXT4500P adaptor"
+       tristate "Framebuffer support for IBM GXT4000P/4500P/6000P/6500P adaptors"
        depends on FB && PPC
        select FB_CFB_FILLRECT
        select FB_CFB_COPYAREA
        select FB_CFB_IMAGEBLIT
        ---help---
-         Say Y here to enable support for the IBM GXT4500P display
-         adaptor, found on some IBM System P (pSeries) machines.
+         Say Y here to enable support for the IBM GXT4000P/6000P and
+         GXT4500P/6500P display adaptor based on Raster Engine RC1000,
+         found on some IBM System P (pSeries) machines. This driver
+         doesn't use Geometry Engine GT1000.
 
 config FB_PS3
        tristate "PS3 GPU framebuffer driver"
index 0e9afa41d1630589402d7af902d33ce02ee85105..4bdea6e9bd5590dfb5b42d47ac9c570d56699da5 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * Frame buffer device for IBM GXT4500P and GXT6000P display adaptors
+ * Frame buffer device for IBM GXT4500P/6500P and GXT4000P/6000P
+ * display adaptors
  *
  * Copyright (C) 2006 Paul Mackerras, IBM Corp. <paulus@samba.org>
  */
@@ -14,6 +15,8 @@
 #include <linux/string.h>
 
 #define PCI_DEVICE_ID_IBM_GXT4500P     0x21c
+#define PCI_DEVICE_ID_IBM_GXT6500P     0x21b
+#define PCI_DEVICE_ID_IBM_GXT4000P     0x16e
 #define PCI_DEVICE_ID_IBM_GXT6000P     0x170
 
 /* GXT4500P registers */
@@ -173,6 +176,8 @@ static const struct fb_videomode defaultmode __devinitconst = {
 /* List of supported cards */
 enum gxt_cards {
        GXT4500P,
+       GXT6500P,
+       GXT4000P,
        GXT6000P
 };
 
@@ -182,6 +187,8 @@ static const struct cardinfo {
        const char *cardname;
 } cardinfo[] = {
        [GXT4500P] = { .refclk_ps = 9259, .cardname = "IBM GXT4500P" },
+       [GXT6500P] = { .refclk_ps = 9259, .cardname = "IBM GXT6500P" },
+       [GXT4000P] = { .refclk_ps = 40000, .cardname = "IBM GXT4000P" },
        [GXT6000P] = { .refclk_ps = 40000, .cardname = "IBM GXT6000P" },
 };
 
@@ -736,6 +743,10 @@ static void __devexit gxt4500_remove(struct pci_dev *pdev)
 static const struct pci_device_id gxt4500_pci_tbl[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_GXT4500P),
          .driver_data = GXT4500P },
+       { PCI_DEVICE(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_GXT6500P),
+         .driver_data = GXT6500P },
+       { PCI_DEVICE(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_GXT4000P),
+         .driver_data = GXT4000P },
        { PCI_DEVICE(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_GXT6000P),
          .driver_data = GXT6000P },
        { 0 }
@@ -768,7 +779,7 @@ static void __exit gxt4500_exit(void)
 module_exit(gxt4500_exit);
 
 MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>");
-MODULE_DESCRIPTION("FBDev driver for IBM GXT4500P/6000P");
+MODULE_DESCRIPTION("FBDev driver for IBM GXT4500P/6500P and GXT4000P/6000P");
 MODULE_LICENSE("GPL");
 module_param(mode_option, charp, 0);
 MODULE_PARM_DESC(mode_option, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\"");
index b4e50d56fc7440b1b1d03849e33b77acf7ee41b6..681a6c88010fbfd4ede20c9d13d26939cc927a6f 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/mod_devicetable.h>
 #include <linux/spinlock.h>
 #include <linux/topology.h>
+#include <linux/notifier.h>
 
 #include <asm/byteorder.h>
 #include <asm/errno.h>
@@ -267,16 +268,28 @@ extern int of_alias_get_id(struct device_node *np, const char *stem);
 
 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);
+extern int of_add_property(struct device_node *np, struct property *prop);
+extern int of_remove_property(struct device_node *np, struct property *prop);
+extern int of_update_property(struct device_node *np, struct property *newprop);
 
-#if defined(CONFIG_OF_DYNAMIC)
 /* For updating the device tree at runtime */
-extern void of_attach_node(struct device_node *);
-extern void of_detach_node(struct device_node *);
-#endif
+#define OF_RECONFIG_ATTACH_NODE                0x0001
+#define OF_RECONFIG_DETACH_NODE                0x0002
+#define OF_RECONFIG_ADD_PROPERTY       0x0003
+#define OF_RECONFIG_REMOVE_PROPERTY    0x0004
+#define OF_RECONFIG_UPDATE_PROPERTY    0x0005
+
+struct of_prop_reconfig {
+       struct device_node      *dn;
+       struct property         *prop;
+};
+
+extern int of_reconfig_notifier_register(struct notifier_block *);
+extern int of_reconfig_notifier_unregister(struct notifier_block *);
+extern int of_reconfig_notify(unsigned long, void *);
+
+extern int of_attach_node(struct device_node *);
+extern int of_detach_node(struct device_node *);
 
 #define of_match_ptr(_ptr)     (_ptr)
 
index c50985eaec41f479d2593dab749d061d3cb03c3d..e2ba8f004d32826e57f776b71377f053052bd5dd 100644 (file)
@@ -26,7 +26,7 @@ void get_term_dimensions(struct winsize *ws);
 #endif
 
 #ifdef __powerpc__
-#include "../../arch/powerpc/include/asm/unistd.h"
+#include "../../arch/powerpc/include/uapi/asm/unistd.h"
 #define rmb()          asm volatile ("sync" ::: "memory")
 #define cpu_relax()    asm volatile ("" ::: "memory");
 #define CPUINFO_PROC   "cpu"