aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-18 12:58:09 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-18 12:58:09 -0500
commit16e024f30ce96ef5fa651e2914e19d175a924cab (patch)
treed68106151a0b36e22625d7af7b23081a48c92e87 /arch/powerpc
parentc36e0501ee91d7616a188efbf9714b1fce150032 (diff)
parent376bddd34433065aeb9b9a140870537feecf90ef (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Pull powerpc update from Benjamin Herrenschmidt: "The main highlight is probably some base POWER8 support. There's more to come such as transactional memory support but that will wait for the next one. Overall it's pretty quiet, or rather I've been pretty poor at picking things up from patchwork and reviewing them this time around and Kumar no better on the FSL side it seems..." * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (73 commits) powerpc+of: Rename and fix OF reconfig notifier error inject module powerpc: mpc5200: Add a3m071 board support powerpc/512x: don't compile any platform DIU code if the DIU is not enabled powerpc/mpc52xx: use module_platform_driver macro powerpc+of: Export of_reconfig_notifier_[register,unregister] powerpc/dma/raidengine: add raidengine device powerpc/iommu/fsl: Add PAMU bypass enable register to ccsr_guts struct powerpc/mpc85xx: Change spin table to cached memory powerpc/fsl-pci: Add PCI controller ATMU PM support powerpc/86xx: fsl_pcibios_fixup_bus requires CONFIG_PCI drivers/virt: the Freescale hypervisor driver doesn't need to check MSR[GS] powerpc/85xx: p1022ds: Use NULL instead of 0 for pointers powerpc: Disable relocation on exceptions when kexecing powerpc: Enable relocation on during exceptions at boot powerpc: Move get_longbusy_msecs into hvcall.h and remove duplicate function powerpc: Add wrappers to enable/disable relocation on exceptions powerpc: Add set_mode hcall powerpc: Setup relocation on exceptions for bare metal systems powerpc: Move initial mfspr LPCR out of __init_LPCR powerpc: Add relocation on exception vector handlers ...
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Makefile2
-rw-r--r--arch/powerpc/boot/dts/a3m071.dts144
-rw-r--r--arch/powerpc/boot/dts/fsl/p5020si-post.dtsi1
-rw-r--r--arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi6
-rw-r--r--arch/powerpc/boot/dts/fsl/qoriq-raid1.0-0.dtsi85
-rw-r--r--arch/powerpc/configs/pseries_defconfig2
-rw-r--r--arch/powerpc/include/asm/bitops.h75
-rw-r--r--arch/powerpc/include/asm/cputable.h12
-rw-r--r--arch/powerpc/include/asm/dbell.h2
-rw-r--r--arch/powerpc/include/asm/exception-64s.h97
-rw-r--r--arch/powerpc/include/asm/firmware.h4
-rw-r--r--arch/powerpc/include/asm/fsl_gtm.h2
-rw-r--r--arch/powerpc/include/asm/fsl_guts.h4
-rw-r--r--arch/powerpc/include/asm/hvcall.h23
-rw-r--r--arch/powerpc/include/asm/immap_qe.h2
-rw-r--r--arch/powerpc/include/asm/machdep.h3
-rw-r--r--arch/powerpc/include/asm/mmu.h1
-rw-r--r--arch/powerpc/include/asm/pSeries_reconfig.h47
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h6
-rw-r--r--arch/powerpc/include/asm/prom.h16
-rw-r--r--arch/powerpc/include/asm/qe.h2
-rw-r--r--arch/powerpc/include/asm/qe_ic.h2
-rw-r--r--arch/powerpc/include/asm/reg.h3
-rw-r--r--arch/powerpc/include/asm/rtas.h5
-rw-r--r--arch/powerpc/include/asm/setup.h29
-rw-r--r--arch/powerpc/include/asm/ucc.h2
-rw-r--r--arch/powerpc/include/asm/ucc_fast.h2
-rw-r--r--arch/powerpc/include/asm/ucc_slow.h2
-rw-r--r--arch/powerpc/include/asm/udbg.h1
-rw-r--r--arch/powerpc/include/uapi/asm/setup.h31
-rw-r--r--arch/powerpc/kernel/Makefile2
-rw-r--r--arch/powerpc/kernel/cpu_setup_power.S (renamed from arch/powerpc/kernel/cpu_setup_power7.S)32
-rw-r--r--arch/powerpc/kernel/cputable.c38
-rw-r--r--arch/powerpc/kernel/entry_64.S2
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S308
-rw-r--r--arch/powerpc/kernel/head_64.S6
-rw-r--r--arch/powerpc/kernel/idle.c3
-rw-r--r--arch/powerpc/kernel/iommu.c16
-rw-r--r--arch/powerpc/kernel/machine_kexec.c14
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c8
-rw-r--r--arch/powerpc/kernel/pci_32.c2
-rw-r--r--arch/powerpc/kernel/prom.c7
-rw-r--r--arch/powerpc/kernel/prom_init.c11
-rw-r--r--arch/powerpc/kernel/ptrace.c90
-rw-r--r--arch/powerpc/kernel/rtas.c1
-rw-r--r--arch/powerpc/kernel/rtas_flash.c4
-rw-r--r--arch/powerpc/kernel/setup_64.c5
-rw-r--r--arch/powerpc/kernel/udbg.c23
-rw-r--r--arch/powerpc/mm/numa.c12
-rw-r--r--arch/powerpc/mm/tlb_nohash_low.S15
-rw-r--r--arch/powerpc/perf/power7-pmu.c17
-rw-r--r--arch/powerpc/platforms/512x/Kconfig1
-rw-r--r--arch/powerpc/platforms/512x/mpc5121_ads.c3
-rw-r--r--arch/powerpc/platforms/512x/mpc512x.h11
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_shared.c25
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c2
-rw-r--r--arch/powerpc/platforms/52xx/mpc5200_simple.c1
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c16
-rw-r--r--arch/powerpc/platforms/82xx/pq2ads-pci-pic.c8
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_mds.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc836x_mds.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc836x_rdk.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc837x_rdb.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c2
-rw-r--r--arch/powerpc/platforms/85xx/p1022_ds.c8
-rw-r--r--arch/powerpc/platforms/85xx/smp.c49
-rw-r--r--arch/powerpc/platforms/86xx/mpc8610_hpcd.c2
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c5
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c25
-rw-r--r--arch/powerpc/platforms/ps3/os-area.c6
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c34
-rw-r--r--arch/powerpc/platforms/pseries/firmware.c1
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c8
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c60
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c10
-rw-r--r--arch/powerpc/platforms/pseries/mobility.c4
-rw-r--r--arch/powerpc/platforms/pseries/plpar_wrappers.h31
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c119
-rw-r--r--arch/powerpc/platforms/pseries/setup.c77
-rw-r--r--arch/powerpc/platforms/pseries/smp.c1
-rw-r--r--arch/powerpc/sysdev/fsl_gtm.c2
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c37
-rw-r--r--arch/powerpc/sysdev/pmi.c13
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_ic.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_ic.h2
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_io.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc_fast.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc_slow.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/usb.c2
-rw-r--r--arch/powerpc/xmon/Makefile2
-rw-r--r--arch/powerpc/xmon/nonstdio.c53
-rw-r--r--arch/powerpc/xmon/nonstdio.h6
-rw-r--r--arch/powerpc/xmon/start.c34
-rw-r--r--arch/powerpc/xmon/xmon.c26
96 files changed, 1250 insertions, 685 deletions
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 159e94f4b22a..b639852116fa 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -181,7 +181,7 @@ $(BOOT_TARGETS2): vmlinux
181bootwrapper_install: 181bootwrapper_install:
182 $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 182 $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
183 183
184%.dtb: 184%.dtb: scripts
185 $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 185 $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
186 186
187define archhelp 187define archhelp
diff --git a/arch/powerpc/boot/dts/a3m071.dts b/arch/powerpc/boot/dts/a3m071.dts
new file mode 100644
index 000000000000..877a28cb77e4
--- /dev/null
+++ b/arch/powerpc/boot/dts/a3m071.dts
@@ -0,0 +1,144 @@
1/*
2 * a3m071 board Device Tree Source
3 *
4 * Copyright 2012 Stefan Roese <sr@denx.de>
5 *
6 * Copyright (C) 2011 DENX Software Engineering GmbH
7 * Heiko Schocher <hs@denx.de>
8 *
9 * Copyright (C) 2007 Semihalf
10 * Marian Balakowicz <m8@semihalf.com>
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18/include/ "mpc5200b.dtsi"
19
20/ {
21 model = "anonymous,a3m071";
22 compatible = "anonymous,a3m071";
23
24 soc5200@f0000000 {
25 #address-cells = <1>;
26 #size-cells = <1>;
27 compatible = "fsl,mpc5200b-immr";
28 ranges = <0 0xf0000000 0x0000c000>;
29 reg = <0xf0000000 0x00000100>;
30 bus-frequency = <0>; /* From boot loader */
31 system-frequency = <0>; /* From boot loader */
32
33 timer@600 {
34 fsl,has-wdt;
35 };
36
37 spi@f00 {
38 status = "disabled";
39 };
40
41 usb: usb@1000 {
42 status = "disabled";
43 };
44
45 psc@2000 {
46 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
47 reg = <0x2000 0x100>;
48 interrupts = <2 1 0>;
49 };
50
51 psc@2200 {
52 status = "disabled";
53 };
54
55 psc@2400 {
56 status = "disabled";
57 };
58
59 psc@2600 {
60 status = "disabled";
61 };
62
63 psc@2800 {
64 status = "disabled";
65 };
66
67 psc@2c00 { // PSC6
68 compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
69 reg = <0x2c00 0x100>;
70 interrupts = <2 4 0>;
71 };
72
73 ethernet@3000 {
74 phy-handle = <&phy0>;
75 };
76
77 mdio@3000 {
78 phy0: ethernet-phy@3 {
79 reg = <0x03>;
80 };
81 };
82
83 ata@3a00 {
84 status = "disabled";
85 };
86
87 i2c@3d00 {
88 status = "disabled";
89 };
90
91 i2c@3d40 {
92 status = "disabled";
93 };
94 };
95
96 localbus {
97 compatible = "fsl,mpc5200b-lpb","simple-bus";
98 #address-cells = <2>;
99 #size-cells = <1>;
100 ranges = <0 0 0xfc000000 0x02000000
101 3 0 0xe9000000 0x00080000
102 5 0 0xe8000000 0x00010000>;
103
104 flash@0,0 {
105 #address-cells = <1>;
106 #size-cells = <1>;
107 reg = <0 0x0 0x02000000>;
108 compatible = "cfi-flash";
109 bank-width = <2>;
110 partition@0x0 {
111 label = "u-boot";
112 reg = <0x00000000 0x00040000>;
113 read-only;
114 };
115 partition@0x00040000 {
116 label = "env";
117 reg = <0x00040000 0x00020000>;
118 };
119 partition@0x00060000 {
120 label = "dtb";
121 reg = <0x00060000 0x00020000>;
122 };
123 partition@0x00080000 {
124 label = "kernel";
125 reg = <0x00080000 0x00500000>;
126 };
127 partition@0x00580000 {
128 label = "root";
129 reg = <0x00580000 0x00A80000>;
130 };
131 };
132
133 fpga@3,0 {
134 compatible = "anonymous,a3m071-fpga";
135 reg = <3 0x0 0x00080000
136 5 0x0 0x00010000>;
137 interrupts = <0 0 3>; /* level low */
138 };
139 };
140
141 pci@f0000d00 {
142 status = "disabled";
143 };
144};
diff --git a/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi b/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi
index 64b6abea8464..5d7205b7bb05 100644
--- a/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi
@@ -354,4 +354,5 @@
354/include/ "qoriq-sata2-0.dtsi" 354/include/ "qoriq-sata2-0.dtsi"
355/include/ "qoriq-sata2-1.dtsi" 355/include/ "qoriq-sata2-1.dtsi"
356/include/ "qoriq-sec4.2-0.dtsi" 356/include/ "qoriq-sec4.2-0.dtsi"
357/include/ "qoriq-raid1.0-0.dtsi"
357}; 358};
diff --git a/arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi b/arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi
index 0a198b0a77e5..8df47fc45ab5 100644
--- a/arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi
@@ -73,6 +73,12 @@
73 rtic_c = &rtic_c; 73 rtic_c = &rtic_c;
74 rtic_d = &rtic_d; 74 rtic_d = &rtic_d;
75 sec_mon = &sec_mon; 75 sec_mon = &sec_mon;
76
77 raideng = &raideng;
78 raideng_jr0 = &raideng_jr0;
79 raideng_jr1 = &raideng_jr1;
80 raideng_jr2 = &raideng_jr2;
81 raideng_jr3 = &raideng_jr3;
76 }; 82 };
77 83
78 cpus { 84 cpus {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-raid1.0-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-raid1.0-0.dtsi
new file mode 100644
index 000000000000..8d2e8aa6cf8a
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/qoriq-raid1.0-0.dtsi
@@ -0,0 +1,85 @@
1/*
2 * QorIQ RAID 1.0 device tree stub [ controller @ offset 0x320000 ]
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35raideng: raideng@320000 {
36 compatible = "fsl,raideng-v1.0";
37 #address-cells = <1>;
38 #size-cells = <1>;
39 reg = <0x320000 0x10000>;
40 ranges = <0 0x320000 0x10000>;
41
42 raideng_jq0@1000 {
43 compatible = "fsl,raideng-v1.0-job-queue";
44 #address-cells = <1>;
45 #size-cells = <1>;
46 reg = <0x1000 0x1000>;
47 ranges = <0x0 0x1000 0x1000>;
48
49 raideng_jr0: jr@0 {
50 compatible = "fsl,raideng-v1.0-job-ring", "fsl,raideng-v1.0-hp-ring";
51 reg = <0x0 0x400>;
52 interrupts = <139 2 0 0>;
53 interrupt-parent = <&mpic>;
54 };
55
56 raideng_jr1: jr@400 {
57 compatible = "fsl,raideng-v1.0-job-ring", "fsl,raideng-v1.0-lp-ring";
58 reg = <0x400 0x400>;
59 interrupts = <140 2 0 0>;
60 interrupt-parent = <&mpic>;
61 };
62 };
63
64 raideng_jq1@2000 {
65 compatible = "fsl,raideng-v1.0-job-queue";
66 #address-cells = <1>;
67 #size-cells = <1>;
68 reg = <0x2000 0x1000>;
69 ranges = <0x0 0x2000 0x1000>;
70
71 raideng_jr2: jr@0 {
72 compatible = "fsl,raideng-v1.0-job-ring", "fsl,raideng-v1.0-hp-ring";
73 reg = <0x0 0x400>;
74 interrupts = <141 2 0 0>;
75 interrupt-parent = <&mpic>;
76 };
77
78 raideng_jr3: jr@400 {
79 compatible = "fsl,raideng-v1.0-job-ring", "fsl,raideng-v1.0-lp-ring";
80 reg = <0x400 0x400>;
81 interrupts = <142 2 0 0>;
82 interrupt-parent = <&mpic>;
83 };
84 };
85};
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index 1f710a32ffae..5b8e1e508270 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -2,7 +2,7 @@ CONFIG_PPC64=y
2CONFIG_ALTIVEC=y 2CONFIG_ALTIVEC=y
3CONFIG_VSX=y 3CONFIG_VSX=y
4CONFIG_SMP=y 4CONFIG_SMP=y
5CONFIG_NR_CPUS=1024 5CONFIG_NR_CPUS=2048
6CONFIG_EXPERIMENTAL=y 6CONFIG_EXPERIMENTAL=y
7CONFIG_SYSVIPC=y 7CONFIG_SYSVIPC=y
8CONFIG_POSIX_MQUEUE=y 8CONFIG_POSIX_MQUEUE=y
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h
index dc2cf9c6d9e6..ef918a2328bb 100644
--- a/arch/powerpc/include/asm/bitops.h
+++ b/arch/powerpc/include/asm/bitops.h
@@ -52,8 +52,6 @@
52#define smp_mb__before_clear_bit() smp_mb() 52#define smp_mb__before_clear_bit() smp_mb()
53#define smp_mb__after_clear_bit() smp_mb() 53#define smp_mb__after_clear_bit() smp_mb()
54 54
55#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
56#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
57#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7) 55#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
58 56
59/* Macro for generating the ***_bits() functions */ 57/* Macro for generating the ***_bits() functions */
@@ -83,22 +81,22 @@ DEFINE_BITOP(change_bits, xor, "", "")
83 81
84static __inline__ void set_bit(int nr, volatile unsigned long *addr) 82static __inline__ void set_bit(int nr, volatile unsigned long *addr)
85{ 83{
86 set_bits(BITOP_MASK(nr), addr + BITOP_WORD(nr)); 84 set_bits(BIT_MASK(nr), addr + BIT_WORD(nr));
87} 85}
88 86
89static __inline__ void clear_bit(int nr, volatile unsigned long *addr) 87static __inline__ void clear_bit(int nr, volatile unsigned long *addr)
90{ 88{
91 clear_bits(BITOP_MASK(nr), addr + BITOP_WORD(nr)); 89 clear_bits(BIT_MASK(nr), addr + BIT_WORD(nr));
92} 90}
93 91
94static __inline__ void clear_bit_unlock(int nr, volatile unsigned long *addr) 92static __inline__ void clear_bit_unlock(int nr, volatile unsigned long *addr)
95{ 93{
96 clear_bits_unlock(BITOP_MASK(nr), addr + BITOP_WORD(nr)); 94 clear_bits_unlock(BIT_MASK(nr), addr + BIT_WORD(nr));
97} 95}
98 96
99static __inline__ void change_bit(int nr, volatile unsigned long *addr) 97static __inline__ void change_bit(int nr, volatile unsigned long *addr)
100{ 98{
101 change_bits(BITOP_MASK(nr), addr + BITOP_WORD(nr)); 99 change_bits(BIT_MASK(nr), addr + BIT_WORD(nr));
102} 100}
103 101
104/* Like DEFINE_BITOP(), with changes to the arguments to 'op' and the output 102/* 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,
136static __inline__ int test_and_set_bit(unsigned long nr, 134static __inline__ int test_and_set_bit(unsigned long nr,
137 volatile unsigned long *addr) 135 volatile unsigned long *addr)
138{ 136{
139 return test_and_set_bits(BITOP_MASK(nr), addr + BITOP_WORD(nr)) != 0; 137 return test_and_set_bits(BIT_MASK(nr), addr + BIT_WORD(nr)) != 0;
140} 138}
141 139
142static __inline__ int test_and_set_bit_lock(unsigned long nr, 140static __inline__ int test_and_set_bit_lock(unsigned long nr,
143 volatile unsigned long *addr) 141 volatile unsigned long *addr)
144{ 142{
145 return test_and_set_bits_lock(BITOP_MASK(nr), 143 return test_and_set_bits_lock(BIT_MASK(nr),
146 addr + BITOP_WORD(nr)) != 0; 144 addr + BIT_WORD(nr)) != 0;
147} 145}
148 146
149static __inline__ int test_and_clear_bit(unsigned long nr, 147static __inline__ int test_and_clear_bit(unsigned long nr,
150 volatile unsigned long *addr) 148 volatile unsigned long *addr)
151{ 149{
152 return test_and_clear_bits(BITOP_MASK(nr), addr + BITOP_WORD(nr)) != 0; 150 return test_and_clear_bits(BIT_MASK(nr), addr + BIT_WORD(nr)) != 0;
153} 151}
154 152
155static __inline__ int test_and_change_bit(unsigned long nr, 153static __inline__ int test_and_change_bit(unsigned long nr,
156 volatile unsigned long *addr) 154 volatile unsigned long *addr)
157{ 155{
158 return test_and_change_bits(BITOP_MASK(nr), addr + BITOP_WORD(nr)) != 0; 156 return test_and_change_bits(BIT_MASK(nr), addr + BIT_WORD(nr)) != 0;
159} 157}
160 158
161#include <asm-generic/bitops/non-atomic.h> 159#include <asm-generic/bitops/non-atomic.h>
@@ -280,61 +278,8 @@ unsigned long __arch_hweight64(__u64 w);
280#include <asm-generic/bitops/find.h> 278#include <asm-generic/bitops/find.h>
281 279
282/* Little-endian versions */ 280/* Little-endian versions */
281#include <asm-generic/bitops/le.h>
283 282
284static __inline__ int test_bit_le(unsigned long nr,
285 __const__ void *addr)
286{
287 __const__ unsigned char *tmp = (__const__ unsigned char *) addr;
288 return (tmp[nr >> 3] >> (nr & 7)) & 1;
289}
290
291static inline void set_bit_le(int nr, void *addr)
292{
293 set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
294}
295
296static inline void clear_bit_le(int nr, void *addr)
297{
298 clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
299}
300
301static inline void __set_bit_le(int nr, void *addr)
302{
303 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
304}
305
306static inline void __clear_bit_le(int nr, void *addr)
307{
308 __clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
309}
310
311static inline int test_and_set_bit_le(int nr, void *addr)
312{
313 return test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
314}
315
316static inline int test_and_clear_bit_le(int nr, void *addr)
317{
318 return test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
319}
320
321static inline int __test_and_set_bit_le(int nr, void *addr)
322{
323 return __test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
324}
325
326static inline int __test_and_clear_bit_le(int nr, void *addr)
327{
328 return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
329}
330
331#define find_first_zero_bit_le(addr, size) \
332 find_next_zero_bit_le((addr), (size), 0)
333unsigned long find_next_zero_bit_le(const void *addr,
334 unsigned long size, unsigned long offset);
335
336unsigned long find_next_bit_le(const void *addr,
337 unsigned long size, unsigned long offset);
338/* Bitmap functions for the ext2 filesystem */ 283/* Bitmap functions for the ext2 filesystem */
339 284
340#include <asm-generic/bitops/ext2-atomic-setbit.h> 285#include <asm-generic/bitops/ext2-atomic-setbit.h>
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index 21a0687b8c4d..76f81bd64f1d 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -401,6 +401,14 @@ extern const char *powerpc_base_platform;
401 CPU_FTR_DSCR | CPU_FTR_SAO | CPU_FTR_ASYM_SMT | \ 401 CPU_FTR_DSCR | CPU_FTR_SAO | CPU_FTR_ASYM_SMT | \
402 CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ 402 CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
403 CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY) 403 CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY)
404#define CPU_FTRS_POWER8 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
405 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\
406 CPU_FTR_MMCRA | CPU_FTR_SMT | \
407 CPU_FTR_COHERENT_ICACHE | \
408 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
409 CPU_FTR_DSCR | CPU_FTR_SAO | \
410 CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
411 CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY)
404#define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 412#define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
405 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 413 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
406 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 414 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
@@ -421,8 +429,8 @@ extern const char *powerpc_base_platform;
421#define CPU_FTRS_POSSIBLE \ 429#define CPU_FTRS_POSSIBLE \
422 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \ 430 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \
423 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \ 431 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \
424 CPU_FTRS_POWER7 | CPU_FTRS_CELL | CPU_FTRS_PA6T | \ 432 CPU_FTRS_POWER7 | CPU_FTRS_POWER8 | CPU_FTRS_CELL | \
425 CPU_FTR_VSX) 433 CPU_FTRS_PA6T | CPU_FTR_VSX)
426#endif 434#endif
427#else 435#else
428enum { 436enum {
diff --git a/arch/powerpc/include/asm/dbell.h b/arch/powerpc/include/asm/dbell.h
index 154c067761b1..607e4eeeb694 100644
--- a/arch/powerpc/include/asm/dbell.h
+++ b/arch/powerpc/include/asm/dbell.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2009 Freescale Semicondutor, Inc. 2 * Copyright 2009 Freescale Semiconductor, Inc.
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index a43c1473915f..ad708dda3ba3 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -48,6 +48,35 @@
48#define EX_LR 72 48#define EX_LR 72
49#define EX_CFAR 80 49#define EX_CFAR 80
50 50
51#ifdef CONFIG_RELOCATABLE
52#define EXCEPTION_RELON_PROLOG_PSERIES_1(label, h) \
53 ld r12,PACAKBASE(r13); /* get high part of &label */ \
54 mfspr r11,SPRN_##h##SRR0; /* save SRR0 */ \
55 LOAD_HANDLER(r12,label); \
56 mtlr r12; \
57 mfspr r12,SPRN_##h##SRR1; /* and SRR1 */ \
58 li r10,MSR_RI; \
59 mtmsrd r10,1; /* Set RI (EE=0) */ \
60 blr;
61#else
62/* If not relocatable, we can jump directly -- and save messing with LR */
63#define EXCEPTION_RELON_PROLOG_PSERIES_1(label, h) \
64 mfspr r11,SPRN_##h##SRR0; /* save SRR0 */ \
65 mfspr r12,SPRN_##h##SRR1; /* and SRR1 */ \
66 li r10,MSR_RI; \
67 mtmsrd r10,1; /* Set RI (EE=0) */ \
68 b label;
69#endif
70
71/*
72 * As EXCEPTION_PROLOG_PSERIES(), except we've already got relocation on
73 * so no need to rfid. Save lr in case we're CONFIG_RELOCATABLE, in which
74 * case EXCEPTION_RELON_PROLOG_PSERIES_1 will be using lr.
75 */
76#define EXCEPTION_RELON_PROLOG_PSERIES(area, label, h, extra, vec) \
77 EXCEPTION_PROLOG_1(area, extra, vec); \
78 EXCEPTION_RELON_PROLOG_PSERIES_1(label, h)
79
51/* 80/*
52 * We're short on space and time in the exception prolog, so we can't 81 * We're short on space and time in the exception prolog, so we can't
53 * use the normal SET_REG_IMMEDIATE macro. Normally we just need the 82 * use the normal SET_REG_IMMEDIATE macro. Normally we just need the
@@ -55,12 +84,29 @@
55 * word. 84 * word.
56 */ 85 */
57#define LOAD_HANDLER(reg, label) \ 86#define LOAD_HANDLER(reg, label) \
58 addi reg,reg,(label)-_stext; /* virt addr of handler ... */ 87 /* Handlers must be within 64K of kbase, which must be 64k aligned */ \
88 ori reg,reg,(label)-_stext; /* virt addr of handler ... */
59 89
60/* Exception register prefixes */ 90/* Exception register prefixes */
61#define EXC_HV H 91#define EXC_HV H
62#define EXC_STD 92#define EXC_STD
63 93
94#if defined(CONFIG_RELOCATABLE)
95/*
96 * If we support interrupts with relocation on AND we're a relocatable
97 * kernel, we need to use LR to get to the 2nd level handler. So, save/restore
98 * it when required.
99 */
100#define SAVE_LR(reg, area) mflr reg ; std reg,area+EX_LR(r13)
101#define GET_LR(reg, area) ld reg,area+EX_LR(r13)
102#define RESTORE_LR(reg, area) ld reg,area+EX_LR(r13) ; mtlr reg
103#else
104/* ...else LR is unused and in register. */
105#define SAVE_LR(reg, area)
106#define GET_LR(reg, area) mflr reg
107#define RESTORE_LR(reg, area)
108#endif
109
64#define __EXCEPTION_PROLOG_1(area, extra, vec) \ 110#define __EXCEPTION_PROLOG_1(area, extra, vec) \
65 GET_PACA(r13); \ 111 GET_PACA(r13); \
66 std r9,area+EX_R9(r13); /* save r9 - r12 */ \ 112 std r9,area+EX_R9(r13); /* save r9 - r12 */ \
@@ -69,6 +115,7 @@
69 mfspr r10,SPRN_CFAR; \ 115 mfspr r10,SPRN_CFAR; \
70 std r10,area+EX_CFAR(r13); \ 116 std r10,area+EX_CFAR(r13); \
71 END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66); \ 117 END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66); \
118 SAVE_LR(r10, area); \
72 mfcr r9; \ 119 mfcr r9; \
73 extra(vec); \ 120 extra(vec); \
74 std r11,area+EX_R11(r13); \ 121 std r11,area+EX_R11(r13); \
@@ -169,6 +216,7 @@ do_kvm_##n: \
169 sth r1,PACA_TRAP_SAVE(r13); \ 216 sth r1,PACA_TRAP_SAVE(r13); \
170 std r3,area+EX_R3(r13); \ 217 std r3,area+EX_R3(r13); \
171 addi r3,r13,area; /* r3 -> where regs are saved*/ \ 218 addi r3,r13,area; /* r3 -> where regs are saved*/ \
219 RESTORE_LR(r1, area); \
172 b bad_stack; \ 220 b bad_stack; \
1733: std r9,_CCR(r1); /* save CR in stackframe */ \ 2213: std r9,_CCR(r1); /* save CR in stackframe */ \
174 std r11,_NIP(r1); /* save SRR0 in stackframe */ \ 222 std r11,_NIP(r1); /* save SRR0 in stackframe */ \
@@ -194,8 +242,8 @@ do_kvm_##n: \
194 ld r10,area+EX_CFAR(r13); \ 242 ld r10,area+EX_CFAR(r13); \
195 std r10,ORIG_GPR3(r1); \ 243 std r10,ORIG_GPR3(r1); \
196 END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66); \ 244 END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66); \
245 GET_LR(r9,area); /* Get LR, later save to stack */ \
197 ld r2,PACATOC(r13); /* get kernel TOC into r2 */ \ 246 ld r2,PACATOC(r13); /* get kernel TOC into r2 */ \
198 mflr r9; /* save LR in stackframe */ \
199 std r9,_LINK(r1); \ 247 std r9,_LINK(r1); \
200 mfctr r10; /* save CTR in stackframe */ \ 248 mfctr r10; /* save CTR in stackframe */ \
201 std r10,_CTR(r1); \ 249 std r10,_CTR(r1); \
@@ -232,6 +280,26 @@ label##_hv: \
232 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, \ 280 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
233 EXC_HV, KVMTEST, vec) 281 EXC_HV, KVMTEST, vec)
234 282
283#define STD_RELON_EXCEPTION_PSERIES(loc, vec, label) \
284 . = loc; \
285 .globl label##_relon_pSeries; \
286label##_relon_pSeries: \
287 HMT_MEDIUM; \
288 /* No guest interrupts come through here */ \
289 SET_SCRATCH0(r13); /* save r13 */ \
290 EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
291 EXC_STD, KVMTEST_PR, vec)
292
293#define STD_RELON_EXCEPTION_HV(loc, vec, label) \
294 . = loc; \
295 .globl label##_relon_hv; \
296label##_relon_hv: \
297 HMT_MEDIUM; \
298 /* No guest interrupts come through here */ \
299 SET_SCRATCH0(r13); /* save r13 */ \
300 EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
301 EXC_HV, KVMTEST, vec)
302
235/* This associate vector numbers with bits in paca->irq_happened */ 303/* This associate vector numbers with bits in paca->irq_happened */
236#define SOFTEN_VALUE_0x500 PACA_IRQ_EE 304#define SOFTEN_VALUE_0x500 PACA_IRQ_EE
237#define SOFTEN_VALUE_0x502 PACA_IRQ_EE 305#define SOFTEN_VALUE_0x502 PACA_IRQ_EE
@@ -257,6 +325,9 @@ label##_hv: \
257 KVMTEST(vec); \ 325 KVMTEST(vec); \
258 _SOFTEN_TEST(EXC_STD, vec) 326 _SOFTEN_TEST(EXC_STD, vec)
259 327
328#define SOFTEN_NOTEST_PR(vec) _SOFTEN_TEST(EXC_STD, vec)
329#define SOFTEN_NOTEST_HV(vec) _SOFTEN_TEST(EXC_HV, vec)
330
260#define __MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra) \ 331#define __MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra) \
261 HMT_MEDIUM; \ 332 HMT_MEDIUM; \
262 SET_SCRATCH0(r13); /* save r13 */ \ 333 SET_SCRATCH0(r13); /* save r13 */ \
@@ -279,6 +350,28 @@ label##_hv: \
279 _MASKABLE_EXCEPTION_PSERIES(vec, label, \ 350 _MASKABLE_EXCEPTION_PSERIES(vec, label, \
280 EXC_HV, SOFTEN_TEST_HV) 351 EXC_HV, SOFTEN_TEST_HV)
281 352
353#define __MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra) \
354 HMT_MEDIUM; \
355 SET_SCRATCH0(r13); /* save r13 */ \
356 __EXCEPTION_PROLOG_1(PACA_EXGEN, extra, vec); \
357 EXCEPTION_RELON_PROLOG_PSERIES_1(label##_common, h);
358#define _MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra) \
359 __MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra)
360
361#define MASKABLE_RELON_EXCEPTION_PSERIES(loc, vec, label) \
362 . = loc; \
363 .globl label##_relon_pSeries; \
364label##_relon_pSeries: \
365 _MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, \
366 EXC_STD, SOFTEN_NOTEST_PR)
367
368#define MASKABLE_RELON_EXCEPTION_HV(loc, vec, label) \
369 . = loc; \
370 .globl label##_relon_hv; \
371label##_relon_hv: \
372 _MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, \
373 EXC_HV, SOFTEN_NOTEST_HV)
374
282/* 375/*
283 * Our exception common code can be passed various "additions" 376 * Our exception common code can be passed various "additions"
284 * to specify the behaviour of interrupts, whether to kick the 377 * to specify the behaviour of interrupts, whether to kick the
diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/include/asm/firmware.h
index ad0b751b0d78..973cc3be011b 100644
--- a/arch/powerpc/include/asm/firmware.h
+++ b/arch/powerpc/include/asm/firmware.h
@@ -49,6 +49,7 @@
49#define FW_FEATURE_XCMO ASM_CONST(0x0000000008000000) 49#define FW_FEATURE_XCMO ASM_CONST(0x0000000008000000)
50#define FW_FEATURE_OPAL ASM_CONST(0x0000000010000000) 50#define FW_FEATURE_OPAL ASM_CONST(0x0000000010000000)
51#define FW_FEATURE_OPALv2 ASM_CONST(0x0000000020000000) 51#define FW_FEATURE_OPALv2 ASM_CONST(0x0000000020000000)
52#define FW_FEATURE_SET_MODE ASM_CONST(0x0000000040000000)
52 53
53#ifndef __ASSEMBLY__ 54#ifndef __ASSEMBLY__
54 55
@@ -62,7 +63,8 @@ enum {
62 FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN | 63 FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN |
63 FW_FEATURE_BULK_REMOVE | FW_FEATURE_XDABR | 64 FW_FEATURE_BULK_REMOVE | FW_FEATURE_XDABR |
64 FW_FEATURE_MULTITCE | FW_FEATURE_SPLPAR | FW_FEATURE_LPAR | 65 FW_FEATURE_MULTITCE | FW_FEATURE_SPLPAR | FW_FEATURE_LPAR |
65 FW_FEATURE_CMO | FW_FEATURE_VPHN | FW_FEATURE_XCMO, 66 FW_FEATURE_CMO | FW_FEATURE_VPHN | FW_FEATURE_XCMO |
67 FW_FEATURE_SET_MODE,
66 FW_FEATURE_PSERIES_ALWAYS = 0, 68 FW_FEATURE_PSERIES_ALWAYS = 0,
67 FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL | FW_FEATURE_OPALv2, 69 FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL | FW_FEATURE_OPALv2,
68 FW_FEATURE_POWERNV_ALWAYS = 0, 70 FW_FEATURE_POWERNV_ALWAYS = 0,
diff --git a/arch/powerpc/include/asm/fsl_gtm.h b/arch/powerpc/include/asm/fsl_gtm.h
index 8e8c9b5032d3..3b05808f9caa 100644
--- a/arch/powerpc/include/asm/fsl_gtm.h
+++ b/arch/powerpc/include/asm/fsl_gtm.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Freescale General-purpose Timers Module 2 * Freescale General-purpose Timers Module
3 * 3 *
4 * Copyright (c) Freescale Semicondutor, Inc. 2006. 4 * Copyright 2006 Freescale Semiconductor, Inc.
5 * Shlomi Gridish <gridish@freescale.com> 5 * Shlomi Gridish <gridish@freescale.com>
6 * Jerry Huang <Chang-Ming.Huang@freescale.com> 6 * Jerry Huang <Chang-Ming.Huang@freescale.com>
7 * Copyright (c) MontaVista Software, Inc. 2008. 7 * Copyright (c) MontaVista Software, Inc. 2008.
diff --git a/arch/powerpc/include/asm/fsl_guts.h b/arch/powerpc/include/asm/fsl_guts.h
index dd5ba2c22771..77ced0b3d81d 100644
--- a/arch/powerpc/include/asm/fsl_guts.h
+++ b/arch/powerpc/include/asm/fsl_guts.h
@@ -71,7 +71,9 @@ struct ccsr_guts {
71 u8 res0c4[0x224 - 0xc4]; 71 u8 res0c4[0x224 - 0xc4];
72 __be32 iodelay1; /* 0x.0224 - IO delay control register 1 */ 72 __be32 iodelay1; /* 0x.0224 - IO delay control register 1 */
73 __be32 iodelay2; /* 0x.0228 - IO delay control register 2 */ 73 __be32 iodelay2; /* 0x.0228 - IO delay control register 2 */
74 u8 res22c[0x800 - 0x22c]; 74 u8 res22c[0x604 - 0x22c];
75 __be32 pamubypenr; /* 0x.604 - PAMU bypass enable register */
76 u8 res608[0x800 - 0x608];
75 __be32 clkdvdr; /* 0x.0800 - Clock Divide Register */ 77 __be32 clkdvdr; /* 0x.0800 - Clock Divide Register */
76 u8 res804[0x900 - 0x804]; 78 u8 res804[0x900 - 0x804];
77 __be32 ircr; /* 0x.0900 - Infrared Control Register */ 79 __be32 ircr; /* 0x.0900 - Infrared Control Register */
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 7a867065db79..0975e5c0bb19 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -267,7 +267,8 @@
267#define H_RANDOM 0x300 267#define H_RANDOM 0x300
268#define H_COP 0x304 268#define H_COP 0x304
269#define H_GET_MPP_X 0x314 269#define H_GET_MPP_X 0x314
270#define MAX_HCALL_OPCODE H_GET_MPP_X 270#define H_SET_MODE 0x31C
271#define MAX_HCALL_OPCODE H_SET_MODE
271 272
272#ifndef __ASSEMBLY__ 273#ifndef __ASSEMBLY__
273 274
@@ -355,6 +356,26 @@ struct hvcall_mpp_x_data {
355 356
356int h_get_mpp_x(struct hvcall_mpp_x_data *mpp_x_data); 357int h_get_mpp_x(struct hvcall_mpp_x_data *mpp_x_data);
357 358
359static inline unsigned int get_longbusy_msecs(int longbusy_rc)
360{
361 switch (longbusy_rc) {
362 case H_LONG_BUSY_ORDER_1_MSEC:
363 return 1;
364 case H_LONG_BUSY_ORDER_10_MSEC:
365 return 10;
366 case H_LONG_BUSY_ORDER_100_MSEC:
367 return 100;
368 case H_LONG_BUSY_ORDER_1_SEC:
369 return 1000;
370 case H_LONG_BUSY_ORDER_10_SEC:
371 return 10000;
372 case H_LONG_BUSY_ORDER_100_SEC:
373 return 100000;
374 default:
375 return 1;
376 }
377}
378
358#ifdef CONFIG_PPC_PSERIES 379#ifdef CONFIG_PPC_PSERIES
359extern int CMO_PrPSP; 380extern int CMO_PrPSP;
360extern int CMO_SecPSP; 381extern int CMO_SecPSP;
diff --git a/arch/powerpc/include/asm/immap_qe.h b/arch/powerpc/include/asm/immap_qe.h
index 61e8490786b8..bedbff891423 100644
--- a/arch/powerpc/include/asm/immap_qe.h
+++ b/arch/powerpc/include/asm/immap_qe.h
@@ -3,7 +3,7 @@
3 * The Internal Memory Map for devices with QE on them. This 3 * The Internal Memory Map for devices with QE on them. This
4 * is the superset of all QE devices (8360, etc.). 4 * is the superset of all QE devices (8360, etc.).
5 5
6 * Copyright (C) 2006. Freescale Semicondutor, Inc. All rights reserved. 6 * Copyright (C) 2006. Freescale Semiconductor, Inc. All rights reserved.
7 * 7 *
8 * Authors: Shlomi Gridish <gridish@freescale.com> 8 * Authors: Shlomi Gridish <gridish@freescale.com>
9 * Li Yang <leoli@freescale.com> 9 * Li Yang <leoli@freescale.com>
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 3c82daf8be99..19d9d96eb8d3 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -166,9 +166,6 @@ struct machdep_calls {
166 unsigned long size, 166 unsigned long size,
167 pgprot_t vma_prot); 167 pgprot_t vma_prot);
168 168
169 /* Idle loop for this platform, leave empty for default idle loop */
170 void (*idle_loop)(void);
171
172 /* 169 /*
173 * Function for waiting for work with reduced power in idle loop; 170 * Function for waiting for work with reduced power in idle loop;
174 * called with interrupts disabled. 171 * called with interrupts disabled.
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index 5e38eedea218..691fd8aca939 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -101,6 +101,7 @@
101#define MMU_FTRS_POWER5 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE 101#define MMU_FTRS_POWER5 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE
102#define MMU_FTRS_POWER6 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE 102#define MMU_FTRS_POWER6 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE
103#define MMU_FTRS_POWER7 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE 103#define MMU_FTRS_POWER7 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE
104#define MMU_FTRS_POWER8 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE
104#define MMU_FTRS_CELL MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ 105#define MMU_FTRS_CELL MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \
105 MMU_FTR_CI_LARGE_PAGE 106 MMU_FTR_CI_LARGE_PAGE
106#define MMU_FTRS_PA6T MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ 107#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
index c07edfe98b98..000000000000
--- a/arch/powerpc/include/asm/pSeries_reconfig.h
+++ /dev/null
@@ -1,47 +0,0 @@
1#ifndef _PPC64_PSERIES_RECONFIG_H
2#define _PPC64_PSERIES_RECONFIG_H
3#ifdef __KERNEL__
4
5#include <linux/notifier.h>
6
7/*
8 * Use this API if your code needs to know about OF device nodes being
9 * added or removed on pSeries systems.
10 */
11
12#define PSERIES_RECONFIG_ADD 0x0001
13#define PSERIES_RECONFIG_REMOVE 0x0002
14#define PSERIES_DRCONF_MEM_ADD 0x0003
15#define PSERIES_DRCONF_MEM_REMOVE 0x0004
16#define PSERIES_UPDATE_PROPERTY 0x0005
17
18/**
19 * pSeries_reconfig_notify - Notifier value structure for OFDT property updates
20 *
21 * @node: Device tree node which owns the property being updated
22 * @property: Updated property
23 */
24struct pSeries_reconfig_prop_update {
25 struct device_node *node;
26 struct property *property;
27};
28
29#ifdef CONFIG_PPC_PSERIES
30extern int pSeries_reconfig_notifier_register(struct notifier_block *);
31extern void pSeries_reconfig_notifier_unregister(struct notifier_block *);
32extern int pSeries_reconfig_notify(unsigned long action, void *p);
33/* Not the best place to put this, will be fixed when we move some
34 * of the rtas suspend-me stuff to pseries */
35extern void pSeries_coalesce_init(void);
36#else /* !CONFIG_PPC_PSERIES */
37static inline int pSeries_reconfig_notifier_register(struct notifier_block *nb)
38{
39 return 0;
40}
41static inline void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) { }
42static inline void pSeries_coalesce_init(void) { }
43#endif /* CONFIG_PPC_PSERIES */
44
45
46#endif /* __KERNEL__ */
47#endif /* _PPC64_PSERIES_RECONFIG_H */
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 42b1f43b943b..51fb00a20d7e 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2009 Freescale Semicondutor, Inc. 2 * Copyright 2009 Freescale Semiconductor, Inc.
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
@@ -86,6 +86,7 @@
86#define PPC_INST_DCBA_MASK 0xfc0007fe 86#define PPC_INST_DCBA_MASK 0xfc0007fe
87#define PPC_INST_DCBAL 0x7c2005ec 87#define PPC_INST_DCBAL 0x7c2005ec
88#define PPC_INST_DCBZL 0x7c2007ec 88#define PPC_INST_DCBZL 0x7c2007ec
89#define PPC_INST_ICBT 0x7c00002c
89#define PPC_INST_ISEL 0x7c00001e 90#define PPC_INST_ISEL 0x7c00001e
90#define PPC_INST_ISEL_MASK 0xfc00003e 91#define PPC_INST_ISEL_MASK 0xfc00003e
91#define PPC_INST_LDARX 0x7c0000a8 92#define PPC_INST_LDARX 0x7c0000a8
@@ -201,6 +202,7 @@
201#define __PPC_MB(s) (((s) & 0x1f) << 6) 202#define __PPC_MB(s) (((s) & 0x1f) << 6)
202#define __PPC_ME(s) (((s) & 0x1f) << 1) 203#define __PPC_ME(s) (((s) & 0x1f) << 1)
203#define __PPC_BI(s) (((s) & 0x1f) << 16) 204#define __PPC_BI(s) (((s) & 0x1f) << 16)
205#define __PPC_CT(t) (((t) & 0x0f) << 21)
204 206
205/* 207/*
206 * Only use the larx hint bit on 64bit CPUs. e500v1/v2 based CPUs will treat a 208 * Only use the larx hint bit on 64bit CPUs. e500v1/v2 based CPUs will treat a
@@ -263,6 +265,8 @@
263 __PPC_RS(t) | __PPC_RA0(a) | __PPC_RB(b)) 265 __PPC_RS(t) | __PPC_RA0(a) | __PPC_RB(b))
264#define PPC_SLBFEE_DOT(t, b) stringify_in_c(.long PPC_INST_SLBFEE | \ 266#define PPC_SLBFEE_DOT(t, b) stringify_in_c(.long PPC_INST_SLBFEE | \
265 __PPC_RT(t) | __PPC_RB(b)) 267 __PPC_RT(t) | __PPC_RB(b))
268#define PPC_ICBT(c,a,b) stringify_in_c(.long PPC_INST_ICBT | \
269 __PPC_CT(c) | __PPC_RA0(a) | __PPC_RB(b))
266/* PASemi instructions */ 270/* PASemi instructions */
267#define LBZCIX(t,a,b) stringify_in_c(.long PPC_INST_LBZCIX | \ 271#define LBZCIX(t,a,b) stringify_in_c(.long PPC_INST_LBZCIX | \
268 __PPC_RT(t) | __PPC_RA(a) | __PPC_RB(b)) 272 __PPC_RT(t) | __PPC_RA(a) | __PPC_RB(b))
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index b5c91901e384..99c92d5363e4 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -58,6 +58,22 @@ static inline int of_node_to_nid(struct device_node *device) { return 0; }
58 58
59extern void of_instantiate_rtc(void); 59extern void of_instantiate_rtc(void);
60 60
61/* The of_drconf_cell struct defines the layout of the LMB array
62 * specified in the device tree property
63 * ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory
64 */
65struct of_drconf_cell {
66 u64 base_addr;
67 u32 drc_index;
68 u32 reserved;
69 u32 aa_index;
70 u32 flags;
71};
72
73#define DRCONF_MEM_ASSIGNED 0x00000008
74#define DRCONF_MEM_AI_INVALID 0x00000040
75#define DRCONF_MEM_RESERVED 0x00000080
76
61/* These includes are put at the bottom because they may contain things 77/* These includes are put at the bottom because they may contain things
62 * that are overridden by this file. Ideally they shouldn't be included 78 * that are overridden by this file. Ideally they shouldn't be included
63 * by this file, but there are a bunch of .c files that currently depend 79 * by this file, but there are a bunch of .c files that currently depend
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index 229571a49391..32b9bfa0c9bd 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/arch/powerpc/include/asm/qe.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved. 2 * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
3 * 3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com> 4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com> 5 * Li Yang <leoli@freescale.com>
diff --git a/arch/powerpc/include/asm/qe_ic.h b/arch/powerpc/include/asm/qe_ic.h
index f706164b0bd0..25784cc959a0 100644
--- a/arch/powerpc/include/asm/qe_ic.h
+++ b/arch/powerpc/include/asm/qe_ic.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved. 2 * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
3 * 3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com> 4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com> 5 * Li Yang <leoli@freescale.com>
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 97d37278ea2d..3d5c9dc8917a 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -249,6 +249,8 @@
249#define LPCR_RMLS 0x1C000000 /* impl dependent rmo limit sel */ 249#define LPCR_RMLS 0x1C000000 /* impl dependent rmo limit sel */
250#define LPCR_RMLS_SH (63-37) 250#define LPCR_RMLS_SH (63-37)
251#define LPCR_ILE 0x02000000 /* !HV irqs set MSR:LE */ 251#define LPCR_ILE 0x02000000 /* !HV irqs set MSR:LE */
252#define LPCR_AIL_0 0x00000000 /* MMU off exception offset 0x0 */
253#define LPCR_AIL_3 0x01800000 /* MMU on exception offset 0xc00...4xxx */
252#define LPCR_PECE 0x00007000 /* powersave exit cause enable */ 254#define LPCR_PECE 0x00007000 /* powersave exit cause enable */
253#define LPCR_PECE0 0x00004000 /* ext. exceptions can cause exit */ 255#define LPCR_PECE0 0x00004000 /* ext. exceptions can cause exit */
254#define LPCR_PECE1 0x00002000 /* decrementer can cause exit */ 256#define LPCR_PECE1 0x00002000 /* decrementer can cause exit */
@@ -1030,6 +1032,7 @@
1030#define PVR_970MP 0x0044 1032#define PVR_970MP 0x0044
1031#define PVR_970GX 0x0045 1033#define PVR_970GX 0x0045
1032#define PVR_POWER7p 0x004A 1034#define PVR_POWER7p 0x004A
1035#define PVR_POWER8 0x004B
1033#define PVR_BE 0x0070 1036#define PVR_BE 0x0070
1034#define PVR_PA6T 0x0090 1037#define PVR_PA6T 0x0090
1035 1038
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 557cff845dee..aef00c675905 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -353,8 +353,13 @@ static inline int page_is_rtas_user_buf(unsigned long pfn)
353 return 1; 353 return 1;
354 return 0; 354 return 0;
355} 355}
356
357/* Not the best place to put pSeries_coalesce_init, will be fixed when we
358 * move some of the rtas suspend-me stuff to pseries */
359extern void pSeries_coalesce_init(void);
356#else 360#else
357static inline int page_is_rtas_user_buf(unsigned long pfn) { return 0;} 361static inline int page_is_rtas_user_buf(unsigned long pfn) { return 0;}
362static inline void pSeries_coalesce_init(void) { }
358#endif 363#endif
359 364
360extern int call_rtas(const char *, int, int, unsigned long *, ...); 365extern 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
index 000000000000..d3ca85529b8b
--- /dev/null
+++ b/arch/powerpc/include/asm/setup.h
@@ -0,0 +1,29 @@
1#ifndef _ASM_POWERPC_SETUP_H
2#define _ASM_POWERPC_SETUP_H
3
4#include <uapi/asm/setup.h>
5
6#ifndef __ASSEMBLY__
7extern void ppc_printk_progress(char *s, unsigned short hex);
8
9extern unsigned int rtas_data;
10extern int mem_init_done; /* set on boot once kmalloc can be called */
11extern int init_bootmem_done; /* set once bootmem is available */
12extern unsigned long long memory_limit;
13extern unsigned long klimit;
14extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
15
16struct device_node;
17extern void note_scsi_host(struct device_node *, void *);
18
19/* Used in very early kernel initialization. */
20extern unsigned long reloc_offset(void);
21extern unsigned long add_reloc_offset(unsigned long);
22extern void reloc_got2(unsigned long);
23
24#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
25
26#endif /* !__ASSEMBLY__ */
27
28#endif /* _ASM_POWERPC_SETUP_H */
29
diff --git a/arch/powerpc/include/asm/ucc.h b/arch/powerpc/include/asm/ucc.h
index 46b09ba6bead..6927ac26516e 100644
--- a/arch/powerpc/include/asm/ucc.h
+++ b/arch/powerpc/include/asm/ucc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved. 2 * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
3 * 3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com> 4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com> 5 * Li Yang <leoli@freescale.com>
diff --git a/arch/powerpc/include/asm/ucc_fast.h b/arch/powerpc/include/asm/ucc_fast.h
index 4644c840e2fa..72ea9bab07df 100644
--- a/arch/powerpc/include/asm/ucc_fast.h
+++ b/arch/powerpc/include/asm/ucc_fast.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Internal header file for UCC FAST unit routines. 2 * Internal header file for UCC FAST unit routines.
3 * 3 *
4 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved. 4 * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
5 * 5 *
6 * Authors: Shlomi Gridish <gridish@freescale.com> 6 * Authors: Shlomi Gridish <gridish@freescale.com>
7 * Li Yang <leoli@freescale.com> 7 * Li Yang <leoli@freescale.com>
diff --git a/arch/powerpc/include/asm/ucc_slow.h b/arch/powerpc/include/asm/ucc_slow.h
index cf131ffdb8d1..c44131e68e11 100644
--- a/arch/powerpc/include/asm/ucc_slow.h
+++ b/arch/powerpc/include/asm/ucc_slow.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved. 2 * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
3 * 3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com> 4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com> 5 * Li Yang <leoli@freescale.com>
diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/udbg.h
index b3038817b8dc..5a7510e9d09d 100644
--- a/arch/powerpc/include/asm/udbg.h
+++ b/arch/powerpc/include/asm/udbg.h
@@ -21,7 +21,6 @@ extern int (*udbg_getc_poll)(void);
21 21
22extern void udbg_puts(const char *s); 22extern void udbg_puts(const char *s);
23extern int udbg_write(const char *s, int n); 23extern int udbg_write(const char *s, int n);
24extern int udbg_read(char *buf, int buflen);
25 24
26extern void register_early_udbg_console(void); 25extern void register_early_udbg_console(void);
27extern void udbg_printf(const char *fmt, ...) 26extern void udbg_printf(const char *fmt, ...)
diff --git a/arch/powerpc/include/uapi/asm/setup.h b/arch/powerpc/include/uapi/asm/setup.h
index 8b9a306260b2..552df83f1a49 100644
--- a/arch/powerpc/include/uapi/asm/setup.h
+++ b/arch/powerpc/include/uapi/asm/setup.h
@@ -1,32 +1 @@
1#ifndef _ASM_POWERPC_SETUP_H
2#define _ASM_POWERPC_SETUP_H
3
4#include <asm-generic/setup.h> #include <asm-generic/setup.h>
5
6#ifndef __ASSEMBLY__
7extern void ppc_printk_progress(char *s, unsigned short hex);
8
9extern unsigned int rtas_data;
10extern int mem_init_done; /* set on boot once kmalloc can be called */
11extern int init_bootmem_done; /* set once bootmem is available */
12extern unsigned long long memory_limit;
13extern unsigned long klimit;
14extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
15
16extern void via_cuda_init(void);
17extern void read_rtc_time(void);
18extern void pmac_find_display(void);
19
20struct device_node;
21extern void note_scsi_host(struct device_node *, void *);
22
23/* Used in very early kernel initialization. */
24extern unsigned long reloc_offset(void);
25extern unsigned long add_reloc_offset(unsigned long);
26extern void reloc_got2(unsigned long);
27
28#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
29
30#endif /* !__ASSEMBLY__ */
31
32#endif /* _ASM_POWERPC_SETUP_H */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index cde12f8a4ebc..8f619342f14c 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -38,7 +38,7 @@ obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
38 paca.o nvram_64.o firmware.o 38 paca.o nvram_64.o firmware.o
39obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 39obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
40obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o 40obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o
41obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power7.o 41obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o
42obj64-$(CONFIG_RELOCATABLE) += reloc_64.o 42obj64-$(CONFIG_RELOCATABLE) += reloc_64.o
43obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o 43obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o
44obj-$(CONFIG_PPC_A2) += cpu_setup_a2.o 44obj-$(CONFIG_PPC_A2) += cpu_setup_a2.o
diff --git a/arch/powerpc/kernel/cpu_setup_power7.S b/arch/powerpc/kernel/cpu_setup_power.S
index 76797c5105d6..57cf14065aec 100644
--- a/arch/powerpc/kernel/cpu_setup_power7.S
+++ b/arch/powerpc/kernel/cpu_setup_power.S
@@ -27,6 +27,7 @@ _GLOBAL(__setup_cpu_power7)
27 beqlr 27 beqlr
28 li r0,0 28 li r0,0
29 mtspr SPRN_LPID,r0 29 mtspr SPRN_LPID,r0
30 mfspr r3,SPRN_LPCR
30 bl __init_LPCR 31 bl __init_LPCR
31 bl __init_TLB 32 bl __init_TLB
32 mtlr r11 33 mtlr r11
@@ -39,6 +40,35 @@ _GLOBAL(__restore_cpu_power7)
39 beqlr 40 beqlr
40 li r0,0 41 li r0,0
41 mtspr SPRN_LPID,r0 42 mtspr SPRN_LPID,r0
43 mfspr r3,SPRN_LPCR
44 bl __init_LPCR
45 bl __init_TLB
46 mtlr r11
47 blr
48
49_GLOBAL(__setup_cpu_power8)
50 mflr r11
51 bl __init_hvmode_206
52 mtlr r11
53 beqlr
54 li r0,0
55 mtspr SPRN_LPID,r0
56 mfspr r3,SPRN_LPCR
57 oris r3, r3, LPCR_AIL_3@h
58 bl __init_LPCR
59 bl __init_TLB
60 mtlr r11
61 blr
62
63_GLOBAL(__restore_cpu_power8)
64 mflr r11
65 mfmsr r3
66 rldicl. r0,r3,4,63
67 beqlr
68 li r0,0
69 mtspr SPRN_LPID,r0
70 mfspr r3,SPRN_LPCR
71 oris r3, r3, LPCR_AIL_3@h
42 bl __init_LPCR 72 bl __init_LPCR
43 bl __init_TLB 73 bl __init_TLB
44 mtlr r11 74 mtlr r11
@@ -57,6 +87,7 @@ __init_hvmode_206:
57 87
58__init_LPCR: 88__init_LPCR:
59 /* Setup a sane LPCR: 89 /* Setup a sane LPCR:
90 * Called with initial LPCR in R3
60 * 91 *
61 * LPES = 0b01 (HSRR0/1 used for 0x500) 92 * LPES = 0b01 (HSRR0/1 used for 0x500)
62 * PECE = 0b111 93 * PECE = 0b111
@@ -67,7 +98,6 @@ __init_LPCR:
67 * 98 *
68 * Other bits untouched for now 99 * Other bits untouched for now
69 */ 100 */
70 mfspr r3,SPRN_LPCR
71 li r5,1 101 li r5,1
72 rldimi r3,r5, LPCR_LPES_SH, 64-LPCR_LPES_SH-2 102 rldimi r3,r5, LPCR_LPES_SH, 64-LPCR_LPES_SH-2
73 ori r3,r3,(LPCR_PECE0|LPCR_PECE1|LPCR_PECE2) 103 ori r3,r3,(LPCR_PECE0|LPCR_PECE1|LPCR_PECE2)
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 0514c21f138b..75a3d71b895d 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -68,6 +68,8 @@ extern void __restore_cpu_pa6t(void);
68extern void __restore_cpu_ppc970(void); 68extern void __restore_cpu_ppc970(void);
69extern void __setup_cpu_power7(unsigned long offset, struct cpu_spec* spec); 69extern void __setup_cpu_power7(unsigned long offset, struct cpu_spec* spec);
70extern void __restore_cpu_power7(void); 70extern void __restore_cpu_power7(void);
71extern void __setup_cpu_power8(unsigned long offset, struct cpu_spec* spec);
72extern void __restore_cpu_power8(void);
71extern void __restore_cpu_a2(void); 73extern void __restore_cpu_a2(void);
72#endif /* CONFIG_PPC64 */ 74#endif /* CONFIG_PPC64 */
73#if defined(CONFIG_E500) 75#if defined(CONFIG_E500)
@@ -94,6 +96,10 @@ extern void __restore_cpu_e5500(void);
94 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \ 96 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
95 PPC_FEATURE_TRUE_LE | \ 97 PPC_FEATURE_TRUE_LE | \
96 PPC_FEATURE_PSERIES_PERFMON_COMPAT) 98 PPC_FEATURE_PSERIES_PERFMON_COMPAT)
99#define COMMON_USER_POWER8 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_06 |\
100 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
101 PPC_FEATURE_TRUE_LE | \
102 PPC_FEATURE_PSERIES_PERFMON_COMPAT)
97#define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\ 103#define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
98 PPC_FEATURE_TRUE_LE | \ 104 PPC_FEATURE_TRUE_LE | \
99 PPC_FEATURE_HAS_ALTIVEC_COMP) 105 PPC_FEATURE_HAS_ALTIVEC_COMP)
@@ -429,6 +435,21 @@ static struct cpu_spec __initdata cpu_specs[] = {
429 .cpu_restore = __restore_cpu_power7, 435 .cpu_restore = __restore_cpu_power7,
430 .platform = "power7", 436 .platform = "power7",
431 }, 437 },
438 { /* 2.07-compliant processor, i.e. Power8 "architected" mode */
439 .pvr_mask = 0xffffffff,
440 .pvr_value = 0x0f000004,
441 .cpu_name = "POWER8 (architected)",
442 .cpu_features = CPU_FTRS_POWER8,
443 .cpu_user_features = COMMON_USER_POWER8,
444 .mmu_features = MMU_FTRS_POWER8,
445 .icache_bsize = 128,
446 .dcache_bsize = 128,
447 .oprofile_type = PPC_OPROFILE_POWER4,
448 .oprofile_cpu_type = "ppc64/ibm-compat-v1",
449 .cpu_setup = __setup_cpu_power8,
450 .cpu_restore = __restore_cpu_power8,
451 .platform = "power8",
452 },
432 { /* Power7 */ 453 { /* Power7 */
433 .pvr_mask = 0xffff0000, 454 .pvr_mask = 0xffff0000,
434 .pvr_value = 0x003f0000, 455 .pvr_value = 0x003f0000,
@@ -463,6 +484,23 @@ static struct cpu_spec __initdata cpu_specs[] = {
463 .cpu_restore = __restore_cpu_power7, 484 .cpu_restore = __restore_cpu_power7,
464 .platform = "power7+", 485 .platform = "power7+",
465 }, 486 },
487 { /* Power8 */
488 .pvr_mask = 0xffff0000,
489 .pvr_value = 0x004b0000,
490 .cpu_name = "POWER8 (raw)",
491 .cpu_features = CPU_FTRS_POWER8,
492 .cpu_user_features = COMMON_USER_POWER8,
493 .mmu_features = MMU_FTRS_POWER8,
494 .icache_bsize = 128,
495 .dcache_bsize = 128,
496 .num_pmcs = 6,
497 .pmc_type = PPC_PMC_IBM,
498 .oprofile_cpu_type = "ppc64/power8",
499 .oprofile_type = PPC_OPROFILE_POWER4,
500 .cpu_setup = __setup_cpu_power8,
501 .cpu_restore = __restore_cpu_power8,
502 .platform = "power8",
503 },
466 { /* Cell Broadband Engine */ 504 { /* Cell Broadband Engine */
467 .pvr_mask = 0xffff0000, 505 .pvr_mask = 0xffff0000,
468 .pvr_value = 0x00700000, 506 .pvr_value = 0x00700000,
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index e9a906c27234..b310a0573625 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -373,6 +373,8 @@ _GLOBAL(ret_from_fork)
373_GLOBAL(ret_from_kernel_thread) 373_GLOBAL(ret_from_kernel_thread)
374 bl .schedule_tail 374 bl .schedule_tail
375 REST_NVGPRS(r1) 375 REST_NVGPRS(r1)
376 li r3,0
377 std r3,0(r1)
376 ld r14, 0(r14) 378 ld r14, 0(r14)
377 mtlr r14 379 mtlr r14
378 mr r3,r15 380 mr r3,r15
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 10b658ad65e1..4665e82fa377 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -19,12 +19,76 @@
19/* 19/*
20 * We layout physical memory as follows: 20 * We layout physical memory as follows:
21 * 0x0000 - 0x00ff : Secondary processor spin code 21 * 0x0000 - 0x00ff : Secondary processor spin code
22 * 0x0100 - 0x2fff : pSeries Interrupt prologs 22 * 0x0100 - 0x17ff : pSeries Interrupt prologs
23 * 0x3000 - 0x5fff : interrupt support common interrupt prologs 23 * 0x1800 - 0x4000 : interrupt support common interrupt prologs
24 * 0x6000 - 0x6fff : Initial (CPU0) segment table 24 * 0x4000 - 0x5fff : pSeries interrupts with IR=1,DR=1
25 * 0x6000 - 0x6fff : more interrupt support including for IR=1,DR=1
25 * 0x7000 - 0x7fff : FWNMI data area 26 * 0x7000 - 0x7fff : FWNMI data area
26 * 0x8000 - : Early init and support code 27 * 0x8000 - 0x8fff : Initial (CPU0) segment table
28 * 0x9000 - : Early init and support code
27 */ 29 */
30 /* Syscall routine is used twice, in reloc-off and reloc-on paths */
31#define SYSCALL_PSERIES_1 \
32BEGIN_FTR_SECTION \
33 cmpdi r0,0x1ebe ; \
34 beq- 1f ; \
35END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \
36 mr r9,r13 ; \
37 GET_PACA(r13) ; \
38 mfspr r11,SPRN_SRR0 ; \
390:
40
41#define SYSCALL_PSERIES_2_RFID \
42 mfspr r12,SPRN_SRR1 ; \
43 ld r10,PACAKBASE(r13) ; \
44 LOAD_HANDLER(r10, system_call_entry) ; \
45 mtspr SPRN_SRR0,r10 ; \
46 ld r10,PACAKMSR(r13) ; \
47 mtspr SPRN_SRR1,r10 ; \
48 rfid ; \
49 b . ; /* prevent speculative execution */
50
51#define SYSCALL_PSERIES_3 \
52 /* Fast LE/BE switch system call */ \
531: mfspr r12,SPRN_SRR1 ; \
54 xori r12,r12,MSR_LE ; \
55 mtspr SPRN_SRR1,r12 ; \
56 rfid ; /* return to userspace */ \
57 b . ; \
582: mfspr r12,SPRN_SRR1 ; \
59 andi. r12,r12,MSR_PR ; \
60 bne 0b ; \
61 mtspr SPRN_SRR0,r3 ; \
62 mtspr SPRN_SRR1,r4 ; \
63 mtspr SPRN_SDR1,r5 ; \
64 rfid ; \
65 b . ; /* prevent speculative execution */
66
67#if defined(CONFIG_RELOCATABLE)
68 /*
69 * We can't branch directly; in the direct case we use LR
70 * and system_call_entry restores LR. (We thus need to move
71 * LR to r10 in the RFID case too.)
72 */
73#define SYSCALL_PSERIES_2_DIRECT \
74 mflr r10 ; \
75 ld r12,PACAKBASE(r13) ; \
76 LOAD_HANDLER(r12, system_call_entry_direct) ; \
77 mtlr r12 ; \
78 mfspr r12,SPRN_SRR1 ; \
79 /* Re-use of r13... No spare regs to do this */ \
80 li r13,MSR_RI ; \
81 mtmsrd r13,1 ; \
82 GET_PACA(r13) ; /* get r13 back */ \
83 blr ;
84#else
85 /* We can branch directly */
86#define SYSCALL_PSERIES_2_DIRECT \
87 mfspr r12,SPRN_SRR1 ; \
88 li r10,MSR_RI ; \
89 mtmsrd r10,1 ; /* Set RI (EE=0) */ \
90 b system_call_entry_direct ;
91#endif
28 92
29/* 93/*
30 * This is the start of the interrupt handlers for pSeries 94 * This is the start of the interrupt handlers for pSeries
@@ -207,31 +271,11 @@ system_call_pSeries:
207 KVMTEST(0xc00) 271 KVMTEST(0xc00)
208 GET_SCRATCH0(r13) 272 GET_SCRATCH0(r13)
209#endif 273#endif
210BEGIN_FTR_SECTION 274 SYSCALL_PSERIES_1
211 cmpdi r0,0x1ebe 275 SYSCALL_PSERIES_2_RFID
212 beq- 1f 276 SYSCALL_PSERIES_3
213END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
214 mr r9,r13
215 GET_PACA(r13)
216 mfspr r11,SPRN_SRR0
217 mfspr r12,SPRN_SRR1
218 ld r10,PACAKBASE(r13)
219 LOAD_HANDLER(r10, system_call_entry)
220 mtspr SPRN_SRR0,r10
221 ld r10,PACAKMSR(r13)
222 mtspr SPRN_SRR1,r10
223 rfid
224 b . /* prevent speculative execution */
225
226 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xc00) 277 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xc00)
227 278
228/* Fast LE/BE switch system call */
2291: mfspr r12,SPRN_SRR1
230 xori r12,r12,MSR_LE
231 mtspr SPRN_SRR1,r12
232 rfid /* return to userspace */
233 b .
234
235 STD_EXCEPTION_PSERIES(0xd00, 0xd00, single_step) 279 STD_EXCEPTION_PSERIES(0xd00, 0xd00, single_step)
236 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xd00) 280 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xd00)
237 281
@@ -276,7 +320,7 @@ vsx_unavailable_pSeries_1:
276 KVM_HANDLER_PR_SKIP(PACA_EXGEN, EXC_STD, 0x1300) 320 KVM_HANDLER_PR_SKIP(PACA_EXGEN, EXC_STD, 0x1300)
277 321
278 . = 0x1500 322 . = 0x1500
279 .global denorm_Hypervisor 323 .global denorm_exception_hv
280denorm_exception_hv: 324denorm_exception_hv:
281 HMT_MEDIUM 325 HMT_MEDIUM
282 mtspr SPRN_SPRG_HSCRATCH0,r13 326 mtspr SPRN_SPRG_HSCRATCH0,r13
@@ -311,12 +355,14 @@ denorm_exception_hv:
311#ifdef CONFIG_CBE_RAS 355#ifdef CONFIG_CBE_RAS
312 STD_EXCEPTION_HV(0x1800, 0x1802, cbe_thermal) 356 STD_EXCEPTION_HV(0x1800, 0x1802, cbe_thermal)
313 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1802) 357 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1802)
358#else
359 . = 0x1800
314#endif /* CONFIG_CBE_RAS */ 360#endif /* CONFIG_CBE_RAS */
315 361
316 . = 0x3000
317 362
318/*** Out of line interrupts support ***/ 363/*** Out of line interrupts support ***/
319 364
365 .align 7
320 /* moved from 0x200 */ 366 /* moved from 0x200 */
321machine_check_pSeries: 367machine_check_pSeries:
322 .globl machine_check_fwnmi 368 .globl machine_check_fwnmi
@@ -575,16 +621,12 @@ slb_miss_user_pseries:
575 b . /* prevent spec. execution */ 621 b . /* prevent spec. execution */
576#endif /* __DISABLED__ */ 622#endif /* __DISABLED__ */
577 623
578 .align 7
579 .globl __end_interrupts
580__end_interrupts:
581
582/* 624/*
583 * Code from here down to __end_handlers is invoked from the 625 * Code from here down to __end_handlers is invoked from the
584 * exception prologs above. Because the prologs assemble the 626 * exception prologs above. Because the prologs assemble the
585 * addresses of these handlers using the LOAD_HANDLER macro, 627 * addresses of these handlers using the LOAD_HANDLER macro,
586 * which uses an addi instruction, these handlers must be in 628 * which uses an ori instruction, these handlers must be in
587 * the first 32k of the kernel image. 629 * the first 64k of the kernel image.
588 */ 630 */
589 631
590/*** Common interrupt handlers ***/ 632/*** Common interrupt handlers ***/
@@ -613,8 +655,8 @@ machine_check_common:
613 STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception) 655 STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception)
614 STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception) 656 STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception)
615 STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception) 657 STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception)
616 STD_EXCEPTION_COMMON(0xe40, emulation_assist, .program_check_exception) 658 STD_EXCEPTION_COMMON(0xe40, emulation_assist, .program_check_exception)
617 STD_EXCEPTION_COMMON(0xe60, hmi_exception, .unknown_exception) 659 STD_EXCEPTION_COMMON(0xe60, hmi_exception, .unknown_exception)
618 STD_EXCEPTION_COMMON_ASYNC(0xf00, performance_monitor, .performance_monitor_exception) 660 STD_EXCEPTION_COMMON_ASYNC(0xf00, performance_monitor, .performance_monitor_exception)
619 STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception) 661 STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception)
620 STD_EXCEPTION_COMMON(0x1502, denorm, .unknown_exception) 662 STD_EXCEPTION_COMMON(0x1502, denorm, .unknown_exception)
@@ -629,7 +671,158 @@ machine_check_common:
629 STD_EXCEPTION_COMMON(0x1800, cbe_thermal, .cbe_thermal_exception) 671 STD_EXCEPTION_COMMON(0x1800, cbe_thermal, .cbe_thermal_exception)
630#endif /* CONFIG_CBE_RAS */ 672#endif /* CONFIG_CBE_RAS */
631 673
674 /*
675 * Relocation-on interrupts: A subset of the interrupts can be delivered
676 * with IR=1/DR=1, if AIL==2 and MSR.HV won't be changed by delivering
677 * it. Addresses are the same as the original interrupt addresses, but
678 * offset by 0xc000000000004000.
679 * It's impossible to receive interrupts below 0x300 via this mechanism.
680 * KVM: None of these traps are from the guest ; anything that escalated
681 * to HV=1 from HV=0 is delivered via real mode handlers.
682 */
683
684 /*
685 * This uses the standard macro, since the original 0x300 vector
686 * only has extra guff for STAB-based processors -- which never
687 * come here.
688 */
689 STD_RELON_EXCEPTION_PSERIES(0x4300, 0x300, data_access)
690 . = 0x4380
691 .globl data_access_slb_relon_pSeries
692data_access_slb_relon_pSeries:
693 HMT_MEDIUM
694 SET_SCRATCH0(r13)
695 EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x380)
696 std r3,PACA_EXSLB+EX_R3(r13)
697 mfspr r3,SPRN_DAR
698 mfspr r12,SPRN_SRR1
699#ifndef CONFIG_RELOCATABLE
700 b .slb_miss_realmode
701#else
702 /*
703 * We can't just use a direct branch to .slb_miss_realmode
704 * because the distance from here to there depends on where
705 * the kernel ends up being put.
706 */
707 mfctr r11
708 ld r10,PACAKBASE(r13)
709 LOAD_HANDLER(r10, .slb_miss_realmode)
710 mtctr r10
711 bctr
712#endif
713
714 STD_RELON_EXCEPTION_PSERIES(0x4400, 0x400, instruction_access)
715 . = 0x4480
716 .globl instruction_access_slb_relon_pSeries
717instruction_access_slb_relon_pSeries:
718 HMT_MEDIUM
719 SET_SCRATCH0(r13)
720 EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x480)
721 std r3,PACA_EXSLB+EX_R3(r13)
722 mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */
723 mfspr r12,SPRN_SRR1
724#ifndef CONFIG_RELOCATABLE
725 b .slb_miss_realmode
726#else
727 mfctr r11
728 ld r10,PACAKBASE(r13)
729 LOAD_HANDLER(r10, .slb_miss_realmode)
730 mtctr r10
731 bctr
732#endif
733
734 . = 0x4500
735 .globl hardware_interrupt_relon_pSeries;
736 .globl hardware_interrupt_relon_hv;
737hardware_interrupt_relon_pSeries:
738hardware_interrupt_relon_hv:
739 BEGIN_FTR_SECTION
740 _MASKABLE_RELON_EXCEPTION_PSERIES(0x502, hardware_interrupt, EXC_HV, SOFTEN_TEST_HV)
741 FTR_SECTION_ELSE
742 _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt, EXC_STD, SOFTEN_TEST_PR)
743 ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_206)
744 STD_RELON_EXCEPTION_PSERIES(0x4600, 0x600, alignment)
745 STD_RELON_EXCEPTION_PSERIES(0x4700, 0x700, program_check)
746 STD_RELON_EXCEPTION_PSERIES(0x4800, 0x800, fp_unavailable)
747 MASKABLE_RELON_EXCEPTION_PSERIES(0x4900, 0x900, decrementer)
748 STD_RELON_EXCEPTION_HV(0x4980, 0x982, hdecrementer)
749 STD_RELON_EXCEPTION_PSERIES(0x4b00, 0xb00, trap_0b)
750
751 . = 0x4c00
752 .globl system_call_relon_pSeries
753system_call_relon_pSeries:
754 HMT_MEDIUM
755 SYSCALL_PSERIES_1
756 SYSCALL_PSERIES_2_DIRECT
757 SYSCALL_PSERIES_3
758
759 STD_RELON_EXCEPTION_PSERIES(0x4d00, 0xd00, single_step)
760
761 . = 0x4e00
762 b h_data_storage_relon_hv
763
764 . = 0x4e20
765 b h_instr_storage_relon_hv
766
767 . = 0x4e40
768 b emulation_assist_relon_hv
769
770 . = 0x4e50
771 b hmi_exception_relon_hv
772
773 . = 0x4e60
774 b hmi_exception_relon_hv
775
776 /* For when we support the doorbell interrupt:
777 STD_RELON_EXCEPTION_HYPERVISOR(0x4e80, 0xe80, doorbell_hyper)
778 */
779
780performance_monitor_relon_pSeries_1:
781 . = 0x4f00
782 b performance_monitor_relon_pSeries
783
784altivec_unavailable_relon_pSeries_1:
785 . = 0x4f20
786 b altivec_unavailable_relon_pSeries
787
788vsx_unavailable_relon_pSeries_1:
789 . = 0x4f40
790 b vsx_unavailable_relon_pSeries
791
792#ifdef CONFIG_CBE_RAS
793 STD_RELON_EXCEPTION_HV(0x5200, 0x1202, cbe_system_error)
794#endif /* CONFIG_CBE_RAS */
795 STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint)
796#ifdef CONFIG_PPC_DENORMALISATION
797 . = 0x5500
798 b denorm_exception_hv
799#endif
800#ifdef CONFIG_CBE_RAS
801 STD_RELON_EXCEPTION_HV(0x5600, 0x1602, cbe_maintenance)
802#else
803#ifdef CONFIG_HVC_SCOM
804 STD_RELON_EXCEPTION_HV(0x5600, 0x1600, maintence_interrupt)
805 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1600)
806#endif /* CONFIG_HVC_SCOM */
807#endif /* CONFIG_CBE_RAS */
808 STD_RELON_EXCEPTION_PSERIES(0x5700, 0x1700, altivec_assist)
809#ifdef CONFIG_CBE_RAS
810 STD_RELON_EXCEPTION_HV(0x5800, 0x1802, cbe_thermal)
811#endif /* CONFIG_CBE_RAS */
812
813 /* Other future vectors */
632 .align 7 814 .align 7
815 .globl __end_interrupts
816__end_interrupts:
817
818 .align 7
819system_call_entry_direct:
820#if defined(CONFIG_RELOCATABLE)
821 /* The first level prologue may have used LR to get here, saving
822 * orig in r10. To save hacking/ifdeffing common code, restore here.
823 */
824 mtlr r10
825#endif
633system_call_entry: 826system_call_entry:
634 b system_call_common 827 b system_call_common
635 828
@@ -714,21 +907,21 @@ data_access_common:
714 ld r3,PACA_EXGEN+EX_DAR(r13) 907 ld r3,PACA_EXGEN+EX_DAR(r13)
715 lwz r4,PACA_EXGEN+EX_DSISR(r13) 908 lwz r4,PACA_EXGEN+EX_DSISR(r13)
716 li r5,0x300 909 li r5,0x300
717 b .do_hash_page /* Try to handle as hpte fault */ 910 b .do_hash_page /* Try to handle as hpte fault */
718 911
719 .align 7 912 .align 7
720 .globl h_data_storage_common 913 .globl h_data_storage_common
721h_data_storage_common: 914h_data_storage_common:
722 mfspr r10,SPRN_HDAR 915 mfspr r10,SPRN_HDAR
723 std r10,PACA_EXGEN+EX_DAR(r13) 916 std r10,PACA_EXGEN+EX_DAR(r13)
724 mfspr r10,SPRN_HDSISR 917 mfspr r10,SPRN_HDSISR
725 stw r10,PACA_EXGEN+EX_DSISR(r13) 918 stw r10,PACA_EXGEN+EX_DSISR(r13)
726 EXCEPTION_PROLOG_COMMON(0xe00, PACA_EXGEN) 919 EXCEPTION_PROLOG_COMMON(0xe00, PACA_EXGEN)
727 bl .save_nvgprs 920 bl .save_nvgprs
728 DISABLE_INTS 921 DISABLE_INTS
729 addi r3,r1,STACK_FRAME_OVERHEAD 922 addi r3,r1,STACK_FRAME_OVERHEAD
730 bl .unknown_exception 923 bl .unknown_exception
731 b .ret_from_except 924 b .ret_from_except
732 925
733 .align 7 926 .align 7
734 .globl instruction_access_common 927 .globl instruction_access_common
@@ -741,7 +934,7 @@ instruction_access_common:
741 li r5,0x400 934 li r5,0x400
742 b .do_hash_page /* Try to handle as hpte fault */ 935 b .do_hash_page /* Try to handle as hpte fault */
743 936
744 STD_EXCEPTION_COMMON(0xe20, h_instr_storage, .unknown_exception) 937 STD_EXCEPTION_COMMON(0xe20, h_instr_storage, .unknown_exception)
745 938
746/* 939/*
747 * Here is the common SLB miss user that is used when going to virtual 940 * Here is the common SLB miss user that is used when going to virtual
@@ -1152,6 +1345,21 @@ _GLOBAL(do_stab_bolted)
1152 rfid 1345 rfid
1153 b . /* prevent speculative execution */ 1346 b . /* prevent speculative execution */
1154 1347
1348
1349 /* Equivalents to the above handlers for relocation-on interrupt vectors */
1350 STD_RELON_EXCEPTION_HV(., 0xe00, h_data_storage)
1351 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe00)
1352 STD_RELON_EXCEPTION_HV(., 0xe20, h_instr_storage)
1353 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe20)
1354 STD_RELON_EXCEPTION_HV(., 0xe40, emulation_assist)
1355 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe40)
1356 STD_RELON_EXCEPTION_HV(., 0xe60, hmi_exception)
1357 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe60)
1358
1359 STD_RELON_EXCEPTION_PSERIES(., 0xf00, performance_monitor)
1360 STD_RELON_EXCEPTION_PSERIES(., 0xf20, altivec_unavailable)
1361 STD_RELON_EXCEPTION_PSERIES(., 0xf40, vsx_unavailable)
1362
1155#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) 1363#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
1156/* 1364/*
1157 * Data area reserved for FWNMI option. 1365 * Data area reserved for FWNMI option.
@@ -1164,7 +1372,7 @@ fwnmi_data_area:
1164 /* pseries and powernv need to keep the whole page from 1372 /* pseries and powernv need to keep the whole page from
1165 * 0x7000 to 0x8000 free for use by the firmware 1373 * 0x7000 to 0x8000 free for use by the firmware
1166 */ 1374 */
1167 . = 0x8000 1375 . = 0x8000
1168#endif /* defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) */ 1376#endif /* defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) */
1169 1377
1170/* Space for CPU0's segment table */ 1378/* Space for CPU0's segment table */
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 58bddee8e1e8..116f0868695b 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -422,7 +422,7 @@ _STATIC(__after_prom_start)
422 tovirt(r6,r6) /* on booke, we already run at PAGE_OFFSET */ 422 tovirt(r6,r6) /* on booke, we already run at PAGE_OFFSET */
423#endif 423#endif
424 424
425#ifdef CONFIG_CRASH_DUMP 425#ifdef CONFIG_RELOCATABLE
426/* 426/*
427 * Check if the kernel has to be running as relocatable kernel based on the 427 * Check if the kernel has to be running as relocatable kernel based on the
428 * variable __run_at_load, if it is set the kernel is treated as relocatable 428 * variable __run_at_load, if it is set the kernel is treated as relocatable
@@ -432,7 +432,8 @@ _STATIC(__after_prom_start)
432 cmplwi cr0,r7,1 432 cmplwi cr0,r7,1
433 bne 3f 433 bne 3f
434 434
435 li r5,__end_interrupts - _stext /* just copy interrupts */ 435 /* just copy interrupts */
436 LOAD_REG_IMMEDIATE(r5, __end_interrupts - _stext)
436 b 5f 437 b 5f
4373: 4383:
438#endif 439#endif
@@ -703,6 +704,7 @@ _INIT_STATIC(start_here_multiplatform)
703 704
704#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL 705#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL
705 /* Setup OPAL entry */ 706 /* Setup OPAL entry */
707 LOAD_REG_ADDR(r11, opal)
706 std r28,0(r11); 708 std r28,0(r11);
707 std r29,8(r11); 709 std r29,8(r11);
708#endif 710#endif
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index 2099d9a879e8..ea78761aa169 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -55,9 +55,6 @@ __setup("powersave=off", powersave_off);
55 */ 55 */
56void cpu_idle(void) 56void cpu_idle(void)
57{ 57{
58 if (ppc_md.idle_loop)
59 ppc_md.idle_loop(); /* doesn't return */
60
61 set_thread_flag(TIF_POLLING_NRFLAG); 58 set_thread_flag(TIF_POLLING_NRFLAG);
62 while (1) { 59 while (1) {
63 tick_nohz_idle_enter(); 60 tick_nohz_idle_enter();
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 8226c6cb348a..c862fd716fe3 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -656,7 +656,7 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
656 struct iommu_pool *p; 656 struct iommu_pool *p;
657 657
658 /* number of bytes needed for the bitmap */ 658 /* number of bytes needed for the bitmap */
659 sz = (tbl->it_size + 7) >> 3; 659 sz = BITS_TO_LONGS(tbl->it_size) * sizeof(unsigned long);
660 660
661 page = alloc_pages_node(nid, GFP_ATOMIC, get_order(sz)); 661 page = alloc_pages_node(nid, GFP_ATOMIC, get_order(sz));
662 if (!page) 662 if (!page)
@@ -708,7 +708,7 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
708 708
709void iommu_free_table(struct iommu_table *tbl, const char *node_name) 709void iommu_free_table(struct iommu_table *tbl, const char *node_name)
710{ 710{
711 unsigned long bitmap_sz, i; 711 unsigned long bitmap_sz;
712 unsigned int order; 712 unsigned int order;
713 713
714 if (!tbl || !tbl->it_map) { 714 if (!tbl || !tbl->it_map) {
@@ -718,17 +718,11 @@ void iommu_free_table(struct iommu_table *tbl, const char *node_name)
718 } 718 }
719 719
720 /* verify that table contains no entries */ 720 /* verify that table contains no entries */
721 /* it_size is in entries, and we're examining 64 at a time */ 721 if (!bitmap_empty(tbl->it_map, tbl->it_size))
722 for (i = 0; i < (tbl->it_size/64); i++) { 722 pr_warn("%s: Unexpected TCEs for %s\n", __func__, node_name);
723 if (tbl->it_map[i] != 0) {
724 printk(KERN_WARNING "%s: Unexpected TCEs for %s\n",
725 __func__, node_name);
726 break;
727 }
728 }
729 723
730 /* calculate bitmap size in bytes */ 724 /* calculate bitmap size in bytes */
731 bitmap_sz = (tbl->it_size + 7) / 8; 725 bitmap_sz = BITS_TO_LONGS(tbl->it_size) * sizeof(unsigned long);
732 726
733 /* free bitmap */ 727 /* free bitmap */
734 order = get_order(bitmap_sz); 728 order = get_order(bitmap_sz);
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index fa9f6c72f557..e1ec57e87b3b 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -218,23 +218,23 @@ static void __init export_crashk_values(struct device_node *node)
218 * be sure what's in them, so remove them. */ 218 * be sure what's in them, so remove them. */
219 prop = of_find_property(node, "linux,crashkernel-base", NULL); 219 prop = of_find_property(node, "linux,crashkernel-base", NULL);
220 if (prop) 220 if (prop)
221 prom_remove_property(node, prop); 221 of_remove_property(node, prop);
222 222
223 prop = of_find_property(node, "linux,crashkernel-size", NULL); 223 prop = of_find_property(node, "linux,crashkernel-size", NULL);
224 if (prop) 224 if (prop)
225 prom_remove_property(node, prop); 225 of_remove_property(node, prop);
226 226
227 if (crashk_res.start != 0) { 227 if (crashk_res.start != 0) {
228 prom_add_property(node, &crashk_base_prop); 228 of_add_property(node, &crashk_base_prop);
229 crashk_size = resource_size(&crashk_res); 229 crashk_size = resource_size(&crashk_res);
230 prom_add_property(node, &crashk_size_prop); 230 of_add_property(node, &crashk_size_prop);
231 } 231 }
232 232
233 /* 233 /*
234 * memory_limit is required by the kexec-tools to limit the 234 * memory_limit is required by the kexec-tools to limit the
235 * crash regions to the actual memory used. 235 * crash regions to the actual memory used.
236 */ 236 */
237 prom_update_property(node, &memory_limit_prop); 237 of_update_property(node, &memory_limit_prop);
238} 238}
239 239
240static int __init kexec_setup(void) 240static int __init kexec_setup(void)
@@ -249,11 +249,11 @@ static int __init kexec_setup(void)
249 /* remove any stale properties so ours can be found */ 249 /* remove any stale properties so ours can be found */
250 prop = of_find_property(node, kernel_end_prop.name, NULL); 250 prop = of_find_property(node, kernel_end_prop.name, NULL);
251 if (prop) 251 if (prop)
252 prom_remove_property(node, prop); 252 of_remove_property(node, prop);
253 253
254 /* information needed by userspace when using default_machine_kexec */ 254 /* information needed by userspace when using default_machine_kexec */
255 kernel_end = __pa(_end); 255 kernel_end = __pa(_end);
256 prom_add_property(node, &kernel_end_prop); 256 of_add_property(node, &kernel_end_prop);
257 257
258 export_crashk_values(node); 258 export_crashk_values(node);
259 259
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index d7f609086a99..7206701b1ff1 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -389,14 +389,14 @@ static int __init export_htab_values(void)
389 /* remove any stale propertys so ours can be found */ 389 /* remove any stale propertys so ours can be found */
390 prop = of_find_property(node, htab_base_prop.name, NULL); 390 prop = of_find_property(node, htab_base_prop.name, NULL);
391 if (prop) 391 if (prop)
392 prom_remove_property(node, prop); 392 of_remove_property(node, prop);
393 prop = of_find_property(node, htab_size_prop.name, NULL); 393 prop = of_find_property(node, htab_size_prop.name, NULL);
394 if (prop) 394 if (prop)
395 prom_remove_property(node, prop); 395 of_remove_property(node, prop);
396 396
397 htab_base = __pa(htab_address); 397 htab_base = __pa(htab_address);
398 prom_add_property(node, &htab_base_prop); 398 of_add_property(node, &htab_base_prop);
399 prom_add_property(node, &htab_size_prop); 399 of_add_property(node, &htab_size_prop);
400 400
401 of_node_put(node); 401 of_node_put(node);
402 return 0; 402 return 0;
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 4b06ec5a502e..64f526a321f5 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -208,7 +208,7 @@ pci_create_OF_bus_map(void)
208 of_prop->name = "pci-OF-bus-map"; 208 of_prop->name = "pci-OF-bus-map";
209 of_prop->length = 256; 209 of_prop->length = 256;
210 of_prop->value = &of_prop[1]; 210 of_prop->value = &of_prop[1];
211 prom_add_property(dn, of_prop); 211 of_add_property(dn, of_prop);
212 of_node_put(dn); 212 of_node_put(dn);
213 } 213 }
214} 214}
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 37725e86651e..8b6f7a99cce2 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -32,6 +32,7 @@
32#include <linux/debugfs.h> 32#include <linux/debugfs.h>
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/memblock.h> 34#include <linux/memblock.h>
35#include <linux/of.h>
35 36
36#include <asm/prom.h> 37#include <asm/prom.h>
37#include <asm/rtas.h> 38#include <asm/rtas.h>
@@ -49,11 +50,11 @@
49#include <asm/btext.h> 50#include <asm/btext.h>
50#include <asm/sections.h> 51#include <asm/sections.h>
51#include <asm/machdep.h> 52#include <asm/machdep.h>
52#include <asm/pSeries_reconfig.h>
53#include <asm/pci-bridge.h> 53#include <asm/pci-bridge.h>
54#include <asm/kexec.h> 54#include <asm/kexec.h>
55#include <asm/opal.h> 55#include <asm/opal.h>
56#include <asm/fadump.h> 56#include <asm/fadump.h>
57#include <asm/debug.h>
57 58
58#include <mm/mmu_decl.h> 59#include <mm/mmu_decl.h>
59 60
@@ -802,7 +803,7 @@ static int prom_reconfig_notifier(struct notifier_block *nb,
802 int err; 803 int err;
803 804
804 switch (action) { 805 switch (action) {
805 case PSERIES_RECONFIG_ADD: 806 case OF_RECONFIG_ATTACH_NODE:
806 err = of_finish_dynamic_node(node); 807 err = of_finish_dynamic_node(node);
807 if (err < 0) 808 if (err < 0)
808 printk(KERN_ERR "finish_node returned %d\n", err); 809 printk(KERN_ERR "finish_node returned %d\n", err);
@@ -821,7 +822,7 @@ static struct notifier_block prom_reconfig_nb = {
821 822
822static int __init prom_reconfig_setup(void) 823static int __init prom_reconfig_setup(void)
823{ 824{
824 return pSeries_reconfig_notifier_register(&prom_reconfig_nb); 825 return of_reconfig_notifier_register(&prom_reconfig_nb);
825} 826}
826__initcall(prom_reconfig_setup); 827__initcall(prom_reconfig_setup);
827#endif 828#endif
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index cb6c123722a2..779f34049a56 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -671,6 +671,7 @@ static void __init early_cmdline_parse(void)
671#define OV1_PPC_2_04 0x08 /* set if we support PowerPC 2.04 */ 671#define OV1_PPC_2_04 0x08 /* set if we support PowerPC 2.04 */
672#define OV1_PPC_2_05 0x04 /* set if we support PowerPC 2.05 */ 672#define OV1_PPC_2_05 0x04 /* set if we support PowerPC 2.05 */
673#define OV1_PPC_2_06 0x02 /* set if we support PowerPC 2.06 */ 673#define OV1_PPC_2_06 0x02 /* set if we support PowerPC 2.06 */
674#define OV1_PPC_2_07 0x01 /* set if we support PowerPC 2.07 */
674 675
675/* Option vector 2: Open Firmware options supported */ 676/* Option vector 2: Open Firmware options supported */
676#define OV2_REAL_MODE 0x20 /* set if we want OF in real mode */ 677#define OV2_REAL_MODE 0x20 /* set if we want OF in real mode */
@@ -707,6 +708,7 @@ static void __init early_cmdline_parse(void)
707#define OV5_PFO_HW_RNG 0x80 /* PFO Random Number Generator */ 708#define OV5_PFO_HW_RNG 0x80 /* PFO Random Number Generator */
708#define OV5_PFO_HW_842 0x40 /* PFO Compression Accelerator */ 709#define OV5_PFO_HW_842 0x40 /* PFO Compression Accelerator */
709#define OV5_PFO_HW_ENCR 0x20 /* PFO Encryption Accelerator */ 710#define OV5_PFO_HW_ENCR 0x20 /* PFO Encryption Accelerator */
711#define OV5_SUB_PROCESSORS 0x01 /* 1,2,or 4 Sub-Processors supported */
710 712
711/* Option Vector 6: IBM PAPR hints */ 713/* Option Vector 6: IBM PAPR hints */
712#define OV6_LINUX 0x02 /* Linux is our OS */ 714#define OV6_LINUX 0x02 /* Linux is our OS */
@@ -719,6 +721,8 @@ static unsigned char ibm_architecture_vec[] = {
719 W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */ 721 W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */
720 W(0xffff0000), W(0x003e0000), /* POWER6 */ 722 W(0xffff0000), W(0x003e0000), /* POWER6 */
721 W(0xffff0000), W(0x003f0000), /* POWER7 */ 723 W(0xffff0000), W(0x003f0000), /* POWER7 */
724 W(0xffff0000), W(0x004b0000), /* POWER8 */
725 W(0xffffffff), W(0x0f000004), /* all 2.07-compliant */
722 W(0xffffffff), W(0x0f000003), /* all 2.06-compliant */ 726 W(0xffffffff), W(0x0f000003), /* all 2.06-compliant */
723 W(0xffffffff), W(0x0f000002), /* all 2.05-compliant */ 727 W(0xffffffff), W(0x0f000002), /* all 2.05-compliant */
724 W(0xfffffffe), W(0x0f000001), /* all 2.04-compliant and earlier */ 728 W(0xfffffffe), W(0x0f000001), /* all 2.04-compliant and earlier */
@@ -728,7 +732,7 @@ static unsigned char ibm_architecture_vec[] = {
728 3 - 2, /* length */ 732 3 - 2, /* length */
729 0, /* don't ignore, don't halt */ 733 0, /* don't ignore, don't halt */
730 OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 | 734 OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 |
731 OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06, 735 OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06 | OV1_PPC_2_07,
732 736
733 /* option vector 2: Open Firmware options supported */ 737 /* option vector 2: Open Firmware options supported */
734 34 - 2, /* length */ 738 34 - 2, /* length */
@@ -755,7 +759,7 @@ static unsigned char ibm_architecture_vec[] = {
755 OV4_MIN_ENT_CAP, /* minimum VP entitled capacity */ 759 OV4_MIN_ENT_CAP, /* minimum VP entitled capacity */
756 760
757 /* option vector 5: PAPR/OF options */ 761 /* option vector 5: PAPR/OF options */
758 18 - 2, /* length */ 762 19 - 2, /* length */
759 0, /* don't ignore, don't halt */ 763 0, /* don't ignore, don't halt */
760 OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES | OV5_DRCONF_MEMORY | 764 OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES | OV5_DRCONF_MEMORY |
761 OV5_DONATE_DEDICATE_CPU | OV5_MSI, 765 OV5_DONATE_DEDICATE_CPU | OV5_MSI,
@@ -769,13 +773,14 @@ static unsigned char ibm_architecture_vec[] = {
769 * must match by the macro below. Update the definition if 773 * must match by the macro below. Update the definition if
770 * the structure layout changes. 774 * the structure layout changes.
771 */ 775 */
772#define IBM_ARCH_VEC_NRCORES_OFFSET 101 776#define IBM_ARCH_VEC_NRCORES_OFFSET 117
773 W(NR_CPUS), /* number of cores supported */ 777 W(NR_CPUS), /* number of cores supported */
774 0, 778 0,
775 0, 779 0,
776 0, 780 0,
777 0, 781 0,
778 OV5_PFO_HW_RNG | OV5_PFO_HW_ENCR | OV5_PFO_HW_842, 782 OV5_PFO_HW_RNG | OV5_PFO_HW_ENCR | OV5_PFO_HW_842,
783 OV5_SUB_PROCESSORS,
779 /* option vector 6: IBM PAPR hints */ 784 /* option vector 6: IBM PAPR hints */
780 4 - 2, /* length */ 785 4 - 2, /* length */
781 0, 786 0,
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 79d8e56470df..c4970004d44d 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -952,6 +952,10 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
952 arch_bp_generic_fields(data & 952 arch_bp_generic_fields(data &
953 (DABR_DATA_WRITE | DABR_DATA_READ), 953 (DABR_DATA_WRITE | DABR_DATA_READ),
954 &attr.bp_type); 954 &attr.bp_type);
955
956 /* Enable breakpoint */
957 attr.disabled = false;
958
955 ret = modify_user_hw_breakpoint(bp, &attr); 959 ret = modify_user_hw_breakpoint(bp, &attr);
956 if (ret) { 960 if (ret) {
957 ptrace_put_breakpoints(task); 961 ptrace_put_breakpoints(task);
@@ -1037,7 +1041,7 @@ void ptrace_disable(struct task_struct *child)
1037} 1041}
1038 1042
1039#ifdef CONFIG_PPC_ADV_DEBUG_REGS 1043#ifdef CONFIG_PPC_ADV_DEBUG_REGS
1040static long set_intruction_bp(struct task_struct *child, 1044static long set_instruction_bp(struct task_struct *child,
1041 struct ppc_hw_breakpoint *bp_info) 1045 struct ppc_hw_breakpoint *bp_info)
1042{ 1046{
1043 int slot; 1047 int slot;
@@ -1338,6 +1342,12 @@ static int set_dac_range(struct task_struct *child,
1338static long ppc_set_hwdebug(struct task_struct *child, 1342static long ppc_set_hwdebug(struct task_struct *child,
1339 struct ppc_hw_breakpoint *bp_info) 1343 struct ppc_hw_breakpoint *bp_info)
1340{ 1344{
1345#ifdef CONFIG_HAVE_HW_BREAKPOINT
1346 int len = 0;
1347 struct thread_struct *thread = &(child->thread);
1348 struct perf_event *bp;
1349 struct perf_event_attr attr;
1350#endif /* CONFIG_HAVE_HW_BREAKPOINT */
1341#ifndef CONFIG_PPC_ADV_DEBUG_REGS 1351#ifndef CONFIG_PPC_ADV_DEBUG_REGS
1342 unsigned long dabr; 1352 unsigned long dabr;
1343#endif 1353#endif
@@ -1365,7 +1375,7 @@ static long ppc_set_hwdebug(struct task_struct *child,
1365 if ((bp_info->trigger_type != PPC_BREAKPOINT_TRIGGER_EXECUTE) || 1375 if ((bp_info->trigger_type != PPC_BREAKPOINT_TRIGGER_EXECUTE) ||
1366 (bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE)) 1376 (bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE))
1367 return -EINVAL; 1377 return -EINVAL;
1368 return set_intruction_bp(child, bp_info); 1378 return set_instruction_bp(child, bp_info);
1369 } 1379 }
1370 if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_EXACT) 1380 if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_EXACT)
1371 return set_dac(child, bp_info); 1381 return set_dac(child, bp_info);
@@ -1381,13 +1391,9 @@ static long ppc_set_hwdebug(struct task_struct *child,
1381 */ 1391 */
1382 if ((bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_RW) == 0 || 1392 if ((bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_RW) == 0 ||
1383 (bp_info->trigger_type & ~PPC_BREAKPOINT_TRIGGER_RW) != 0 || 1393 (bp_info->trigger_type & ~PPC_BREAKPOINT_TRIGGER_RW) != 0 ||
1384 bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT ||
1385 bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE) 1394 bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE)
1386 return -EINVAL; 1395 return -EINVAL;
1387 1396
1388 if (child->thread.dabr)
1389 return -ENOSPC;
1390
1391 if ((unsigned long)bp_info->addr >= TASK_SIZE) 1397 if ((unsigned long)bp_info->addr >= TASK_SIZE)
1392 return -EIO; 1398 return -EIO;
1393 1399
@@ -1397,6 +1403,50 @@ static long ppc_set_hwdebug(struct task_struct *child,
1397 dabr |= DABR_DATA_READ; 1403 dabr |= DABR_DATA_READ;
1398 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE) 1404 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE)
1399 dabr |= DABR_DATA_WRITE; 1405 dabr |= DABR_DATA_WRITE;
1406#ifdef CONFIG_HAVE_HW_BREAKPOINT
1407 if (ptrace_get_breakpoints(child) < 0)
1408 return -ESRCH;
1409
1410 /*
1411 * Check if the request is for 'range' breakpoints. We can
1412 * support it if range < 8 bytes.
1413 */
1414 if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE) {
1415 len = bp_info->addr2 - bp_info->addr;
1416 } else if (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT) {
1417 ptrace_put_breakpoints(child);
1418 return -EINVAL;
1419 }
1420 bp = thread->ptrace_bps[0];
1421 if (bp) {
1422 ptrace_put_breakpoints(child);
1423 return -ENOSPC;
1424 }
1425
1426 /* Create a new breakpoint request if one doesn't exist already */
1427 hw_breakpoint_init(&attr);
1428 attr.bp_addr = (unsigned long)bp_info->addr & ~HW_BREAKPOINT_ALIGN;
1429 attr.bp_len = len;
1430 arch_bp_generic_fields(dabr & (DABR_DATA_WRITE | DABR_DATA_READ),
1431 &attr.bp_type);
1432
1433 thread->ptrace_bps[0] = bp = register_user_hw_breakpoint(&attr,
1434 ptrace_triggered, NULL, child);
1435 if (IS_ERR(bp)) {
1436 thread->ptrace_bps[0] = NULL;
1437 ptrace_put_breakpoints(child);
1438 return PTR_ERR(bp);
1439 }
1440
1441 ptrace_put_breakpoints(child);
1442 return 1;
1443#endif /* CONFIG_HAVE_HW_BREAKPOINT */
1444
1445 if (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT)
1446 return -EINVAL;
1447
1448 if (child->thread.dabr)
1449 return -ENOSPC;
1400 1450
1401 child->thread.dabr = dabr; 1451 child->thread.dabr = dabr;
1402 child->thread.dabrx = DABRX_ALL; 1452 child->thread.dabrx = DABRX_ALL;
@@ -1405,8 +1455,13 @@ static long ppc_set_hwdebug(struct task_struct *child,
1405#endif /* !CONFIG_PPC_ADV_DEBUG_DVCS */ 1455#endif /* !CONFIG_PPC_ADV_DEBUG_DVCS */
1406} 1456}
1407 1457
1408static long ppc_del_hwdebug(struct task_struct *child, long addr, long data) 1458static long ppc_del_hwdebug(struct task_struct *child, long data)
1409{ 1459{
1460#ifdef CONFIG_HAVE_HW_BREAKPOINT
1461 int ret = 0;
1462 struct thread_struct *thread = &(child->thread);
1463 struct perf_event *bp;
1464#endif /* CONFIG_HAVE_HW_BREAKPOINT */
1410#ifdef CONFIG_PPC_ADV_DEBUG_REGS 1465#ifdef CONFIG_PPC_ADV_DEBUG_REGS
1411 int rc; 1466 int rc;
1412 1467
@@ -1426,10 +1481,25 @@ static long ppc_del_hwdebug(struct task_struct *child, long addr, long data)
1426#else 1481#else
1427 if (data != 1) 1482 if (data != 1)
1428 return -EINVAL; 1483 return -EINVAL;
1484
1485#ifdef CONFIG_HAVE_HW_BREAKPOINT
1486 if (ptrace_get_breakpoints(child) < 0)
1487 return -ESRCH;
1488
1489 bp = thread->ptrace_bps[0];
1490 if (bp) {
1491 unregister_hw_breakpoint(bp);
1492 thread->ptrace_bps[0] = NULL;
1493 } else
1494 ret = -ENOENT;
1495 ptrace_put_breakpoints(child);
1496 return ret;
1497#else /* CONFIG_HAVE_HW_BREAKPOINT */
1429 if (child->thread.dabr == 0) 1498 if (child->thread.dabr == 0)
1430 return -ENOENT; 1499 return -ENOENT;
1431 1500
1432 child->thread.dabr = 0; 1501 child->thread.dabr = 0;
1502#endif /* CONFIG_HAVE_HW_BREAKPOINT */
1433 1503
1434 return 0; 1504 return 0;
1435#endif 1505#endif
@@ -1536,7 +1606,11 @@ long arch_ptrace(struct task_struct *child, long request,
1536 dbginfo.data_bp_alignment = 4; 1606 dbginfo.data_bp_alignment = 4;
1537#endif 1607#endif
1538 dbginfo.sizeof_condition = 0; 1608 dbginfo.sizeof_condition = 0;
1609#ifdef CONFIG_HAVE_HW_BREAKPOINT
1610 dbginfo.features = PPC_DEBUG_FEATURE_DATA_BP_RANGE;
1611#else
1539 dbginfo.features = 0; 1612 dbginfo.features = 0;
1613#endif /* CONFIG_HAVE_HW_BREAKPOINT */
1540#endif /* CONFIG_PPC_ADV_DEBUG_REGS */ 1614#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
1541 1615
1542 if (!access_ok(VERIFY_WRITE, datavp, 1616 if (!access_ok(VERIFY_WRITE, datavp,
@@ -1563,7 +1637,7 @@ long arch_ptrace(struct task_struct *child, long request,
1563 } 1637 }
1564 1638
1565 case PPC_PTRACE_DELHWDEBUG: { 1639 case PPC_PTRACE_DELHWDEBUG: {
1566 ret = ppc_del_hwdebug(child, addr, data); 1640 ret = ppc_del_hwdebug(child, data);
1567 break; 1641 break;
1568 } 1642 }
1569 1643
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index fcec38241f79..1fd6e7b2f390 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -42,7 +42,6 @@
42#include <asm/time.h> 42#include <asm/time.h>
43#include <asm/mmu.h> 43#include <asm/mmu.h>
44#include <asm/topology.h> 44#include <asm/topology.h>
45#include <asm/pSeries_reconfig.h>
46 45
47struct rtas_t rtas = { 46struct rtas_t rtas = {
48 .lock = __ARCH_SPIN_LOCK_UNLOCKED 47 .lock = __ARCH_SPIN_LOCK_UNLOCKED
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 20b0120db0c3..8329190312c1 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -650,10 +650,8 @@ static int initialize_flash_pde_data(const char *rtas_call_name,
650 int token; 650 int token;
651 651
652 dp->data = kzalloc(buf_size, GFP_KERNEL); 652 dp->data = kzalloc(buf_size, GFP_KERNEL);
653 if (dp->data == NULL) { 653 if (dp->data == NULL)
654 remove_flash_pde(dp);
655 return -ENOMEM; 654 return -ENOMEM;
656 }
657 655
658 /* 656 /*
659 * This code assumes that the status int is the first member of the 657 * This code assumes that the status int is the first member of the
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index efb6a41b3131..6da881b35dac 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -601,6 +601,11 @@ void __init setup_arch(char **cmdline_p)
601 601
602 kvm_linear_init(); 602 kvm_linear_init();
603 603
604 /* Interrupt code needs to be 64K-aligned */
605 if ((unsigned long)_stext & 0xffff)
606 panic("Kernelbase not 64K-aligned (0x%lx)!\n",
607 (unsigned long)_stext);
608
604 ppc64_boot_msg(0x15, "Setup Done"); 609 ppc64_boot_msg(0x15, "Setup Done");
605} 610}
606 611
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index c39c1ca77f46..f9748498fe58 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -122,29 +122,6 @@ int udbg_write(const char *s, int n)
122 return n - remain; 122 return n - remain;
123} 123}
124 124
125int udbg_read(char *buf, int buflen)
126{
127 char *p = buf;
128 int i, c;
129
130 if (!udbg_getc)
131 return 0;
132
133 for (i = 0; i < buflen; ++i) {
134 do {
135 c = udbg_getc();
136 if (c == -1 && i == 0)
137 return -1;
138
139 } while (c == 0x11 || c == 0x13);
140 if (c == 0 || c == -1)
141 break;
142 *p++ = c;
143 }
144
145 return i;
146}
147
148#define UDBG_BUFSIZE 256 125#define UDBG_BUFSIZE 256
149void udbg_printf(const char *fmt, ...) 126void udbg_printf(const char *fmt, ...)
150{ 127{
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 59213cfaeca9..bba87ca2b4d7 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -399,18 +399,6 @@ static unsigned long read_n_cells(int n, const unsigned int **buf)
399 return result; 399 return result;
400} 400}
401 401
402struct of_drconf_cell {
403 u64 base_addr;
404 u32 drc_index;
405 u32 reserved;
406 u32 aa_index;
407 u32 flags;
408};
409
410#define DRCONF_MEM_ASSIGNED 0x00000008
411#define DRCONF_MEM_AI_INVALID 0x00000040
412#define DRCONF_MEM_RESERVED 0x00000080
413
414/* 402/*
415 * Read the next memblock list entry from the ibm,dynamic-memory property 403 * Read the next memblock list entry from the ibm,dynamic-memory property
416 * and return the information in the provided of_drconf_cell structure. 404 * and return the information in the provided of_drconf_cell structure.
diff --git a/arch/powerpc/mm/tlb_nohash_low.S b/arch/powerpc/mm/tlb_nohash_low.S
index fab919fd1384..626ad081639f 100644
--- a/arch/powerpc/mm/tlb_nohash_low.S
+++ b/arch/powerpc/mm/tlb_nohash_low.S
@@ -191,12 +191,6 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_47x)
191#ifdef CONFIG_PPC_47x 191#ifdef CONFIG_PPC_47x
192 192
193/* 193/*
194 * 47x variant of icbt
195 */
196# define ICBT(CT,RA,RB) \
197 .long 0x7c00002c | ((CT) << 21) | ((RA) << 16) | ((RB) << 11)
198
199/*
200 * _tlbivax_bcast is only on 47x. We don't bother doing a runtime 194 * _tlbivax_bcast is only on 47x. We don't bother doing a runtime
201 * check though, it will blow up soon enough if we mistakenly try 195 * check though, it will blow up soon enough if we mistakenly try
202 * to use it on a 440. 196 * to use it on a 440.
@@ -208,8 +202,7 @@ _GLOBAL(_tlbivax_bcast)
208 wrteei 0 202 wrteei 0
209 mtspr SPRN_MMUCR,r5 203 mtspr SPRN_MMUCR,r5
210 isync 204 isync
211/* tlbivax 0,r3 - use .long to avoid binutils deps */ 205 PPC_TLBIVAX(0, R3)
212 .long 0x7c000624 | (r3 << 11)
213 isync 206 isync
214 eieio 207 eieio
215 tlbsync 208 tlbsync
@@ -227,11 +220,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_476_DD2)
227 bl 2f 220 bl 2f
2282: mflr r6 2212: mflr r6
229 li r7,32 222 li r7,32
230 ICBT(0,r6,r7) /* touch next cache line */ 223 PPC_ICBT(0,R6,R7) /* touch next cache line */
231 add r6,r6,r7 224 add r6,r6,r7
232 ICBT(0,r6,r7) /* touch next cache line */ 225 PPC_ICBT(0,R6,R7) /* touch next cache line */
233 add r6,r6,r7 226 add r6,r6,r7
234 ICBT(0,r6,r7) /* touch next cache line */ 227 PPC_ICBT(0,R6,R7) /* touch next cache line */
235 sync 228 sync
236 nop 229 nop
237 nop 230 nop
diff --git a/arch/powerpc/perf/power7-pmu.c b/arch/powerpc/perf/power7-pmu.c
index 441af08edf43..2ee01e38d5e2 100644
--- a/arch/powerpc/perf/power7-pmu.c
+++ b/arch/powerpc/perf/power7-pmu.c
@@ -54,8 +54,10 @@
54 * Layout of constraint bits: 54 * Layout of constraint bits:
55 * 6666555555555544444444443333333333222222222211111111110000000000 55 * 6666555555555544444444443333333333222222222211111111110000000000
56 * 3210987654321098765432109876543210987654321098765432109876543210 56 * 3210987654321098765432109876543210987654321098765432109876543210
57 * [ ><><><><><><> 57 * < >< ><><><><><><>
58 * NC P6P5P4P3P2P1 58 * L2 NC P6P5P4P3P2P1
59 *
60 * L2 - 16-18 - Required L2SEL value (select field)
59 * 61 *
60 * NC - number of counters 62 * NC - number of counters
61 * 15: NC error 0x8000 63 * 15: NC error 0x8000
@@ -72,7 +74,7 @@
72static int power7_get_constraint(u64 event, unsigned long *maskp, 74static int power7_get_constraint(u64 event, unsigned long *maskp,
73 unsigned long *valp) 75 unsigned long *valp)
74{ 76{
75 int pmc, sh; 77 int pmc, sh, unit;
76 unsigned long mask = 0, value = 0; 78 unsigned long mask = 0, value = 0;
77 79
78 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; 80 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK;
@@ -90,6 +92,15 @@ static int power7_get_constraint(u64 event, unsigned long *maskp,
90 mask |= 0x8000; 92 mask |= 0x8000;
91 value |= 0x1000; 93 value |= 0x1000;
92 } 94 }
95
96 unit = (event >> PM_UNIT_SH) & PM_UNIT_MSK;
97 if (unit == 6) {
98 /* L2SEL must be identical across events */
99 int l2sel = (event >> PM_L2SEL_SH) & PM_L2SEL_MSK;
100 mask |= 0x7 << 16;
101 value |= l2sel << 16;
102 }
103
93 *maskp = mask; 104 *maskp = mask;
94 *valp = value; 105 *valp = value;
95 return 0; 106 return 0;
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig
index b62508b113db..c16999802ecf 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -2,7 +2,6 @@ config PPC_MPC512x
2 bool "512x-based boards" 2 bool "512x-based boards"
3 depends on 6xx 3 depends on 6xx
4 select FSL_SOC 4 select FSL_SOC
5 select FB_FSL_DIU
6 select IPIC 5 select IPIC
7 select PPC_CLOCK 6 select PPC_CLOCK
8 select PPC_PCI_CHOICE 7 select PPC_PCI_CHOICE
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c
index dcef6ade48e1..0a134e0469ef 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -42,7 +42,10 @@ static void __init mpc5121_ads_setup_arch(void)
42 for_each_compatible_node(np, "pci", "fsl,mpc5121-pci") 42 for_each_compatible_node(np, "pci", "fsl,mpc5121-pci")
43 mpc83xx_add_bridge(np); 43 mpc83xx_add_bridge(np);
44#endif 44#endif
45
46#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
45 mpc512x_setup_diu(); 47 mpc512x_setup_diu();
48#endif
46} 49}
47 50
48static void __init mpc5121_ads_init_IRQ(void) 51static void __init mpc5121_ads_init_IRQ(void)
diff --git a/arch/powerpc/platforms/512x/mpc512x.h b/arch/powerpc/platforms/512x/mpc512x.h
index 1ab6d11d0b19..c32b399eb952 100644
--- a/arch/powerpc/platforms/512x/mpc512x.h
+++ b/arch/powerpc/platforms/512x/mpc512x.h
@@ -16,6 +16,13 @@ extern void __init mpc512x_init(void);
16extern int __init mpc5121_clk_init(void); 16extern int __init mpc5121_clk_init(void);
17void __init mpc512x_declare_of_platform_devices(void); 17void __init mpc512x_declare_of_platform_devices(void);
18extern void mpc512x_restart(char *cmd); 18extern void mpc512x_restart(char *cmd);
19extern void mpc512x_init_diu(void); 19
20extern void mpc512x_setup_diu(void); 20#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
21void mpc512x_init_diu(void);
22void mpc512x_setup_diu(void);
23#else
24#define mpc512x_init_diu NULL
25#define mpc512x_setup_diu NULL
26#endif
27
21#endif /* __MPC512X_H__ */ 28#endif /* __MPC512X_H__ */
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index 1650e090ef3a..35f14fda108a 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -58,6 +58,8 @@ void mpc512x_restart(char *cmd)
58 ; 58 ;
59} 59}
60 60
61#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
62
61struct fsl_diu_shared_fb { 63struct fsl_diu_shared_fb {
62 u8 gamma[0x300]; /* 32-bit aligned! */ 64 u8 gamma[0x300]; /* 32-bit aligned! */
63 struct diu_ad ad0; /* 32-bit aligned! */ 65 struct diu_ad ad0; /* 32-bit aligned! */
@@ -66,25 +68,6 @@ struct fsl_diu_shared_fb {
66 bool in_use; 68 bool in_use;
67}; 69};
68 70
69u32 mpc512x_get_pixel_format(enum fsl_diu_monitor_port port,
70 unsigned int bits_per_pixel)
71{
72 switch (bits_per_pixel) {
73 case 32:
74 return 0x88883316;
75 case 24:
76 return 0x88082219;
77 case 16:
78 return 0x65053118;
79 }
80 return 0x00000400;
81}
82
83void mpc512x_set_gamma_table(enum fsl_diu_monitor_port port,
84 char *gamma_table_base)
85{
86}
87
88void mpc512x_set_monitor_port(enum fsl_diu_monitor_port port) 71void mpc512x_set_monitor_port(enum fsl_diu_monitor_port port)
89{ 72{
90} 73}
@@ -320,14 +303,14 @@ void __init mpc512x_setup_diu(void)
320 } 303 }
321 } 304 }
322 305
323 diu_ops.get_pixel_format = mpc512x_get_pixel_format;
324 diu_ops.set_gamma_table = mpc512x_set_gamma_table;
325 diu_ops.set_monitor_port = mpc512x_set_monitor_port; 306 diu_ops.set_monitor_port = mpc512x_set_monitor_port;
326 diu_ops.set_pixel_clock = mpc512x_set_pixel_clock; 307 diu_ops.set_pixel_clock = mpc512x_set_pixel_clock;
327 diu_ops.valid_monitor_port = mpc512x_valid_monitor_port; 308 diu_ops.valid_monitor_port = mpc512x_valid_monitor_port;
328 diu_ops.release_bootmem = mpc512x_release_bootmem; 309 diu_ops.release_bootmem = mpc512x_release_bootmem;
329} 310}
330 311
312#endif
313
331void __init mpc512x_init_IRQ(void) 314void __init mpc512x_init_IRQ(void)
332{ 315{
333 struct device_node *np; 316 struct device_node *np;
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 448d862bcf3d..1843bc932011 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -4,7 +4,7 @@
4 * Written by: Grant Likely <grant.likely@secretlab.ca> 4 * Written by: Grant Likely <grant.likely@secretlab.ca>
5 * 5 *
6 * Copyright (C) Secret Lab Technologies Ltd. 2006. All rights reserved. 6 * Copyright (C) Secret Lab Technologies Ltd. 2006. All rights reserved.
7 * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. 7 * Copyright 2006 Freescale Semiconductor, Inc. All rights reserved.
8 * 8 *
9 * Description: 9 * Description:
10 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
diff --git a/arch/powerpc/platforms/52xx/mpc5200_simple.c b/arch/powerpc/platforms/52xx/mpc5200_simple.c
index 9cf36020cf0d..792a301a0bf0 100644
--- a/arch/powerpc/platforms/52xx/mpc5200_simple.c
+++ b/arch/powerpc/platforms/52xx/mpc5200_simple.c
@@ -50,6 +50,7 @@ static void __init mpc5200_simple_setup_arch(void)
50 50
51/* list of the supported boards */ 51/* list of the supported boards */
52static const char *board[] __initdata = { 52static const char *board[] __initdata = {
53 "anonymous,a3m071",
53 "anonymous,a4m072", 54 "anonymous,a4m072",
54 "anon,charon", 55 "anon,charon",
55 "ifm,o2d", 56 "ifm,o2d",
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
index 2351f9e0fb6f..16150fa430f9 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -578,18 +578,4 @@ static struct platform_driver mpc52xx_lpbfifo_driver = {
578 .probe = mpc52xx_lpbfifo_probe, 578 .probe = mpc52xx_lpbfifo_probe,
579 .remove = __devexit_p(mpc52xx_lpbfifo_remove), 579 .remove = __devexit_p(mpc52xx_lpbfifo_remove),
580}; 580};
581 581module_platform_driver(mpc52xx_lpbfifo_driver);
582/***********************************************************************
583 * Module init/exit
584 */
585static int __init mpc52xx_lpbfifo_init(void)
586{
587 return platform_driver_register(&mpc52xx_lpbfifo_driver);
588}
589module_init(mpc52xx_lpbfifo_init);
590
591static void __exit mpc52xx_lpbfifo_exit(void)
592{
593 platform_driver_unregister(&mpc52xx_lpbfifo_driver);
594}
595module_exit(mpc52xx_lpbfifo_exit);
diff --git a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
index 328d221fd1c0..74861a7fb807 100644
--- a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
+++ b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
@@ -16,7 +16,6 @@
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/bootmem.h>
20#include <linux/slab.h> 19#include <linux/slab.h>
21 20
22#include <asm/io.h> 21#include <asm/io.h>
@@ -149,7 +148,7 @@ int __init pq2ads_pci_init_irq(void)
149 priv->regs = of_iomap(np, 0); 148 priv->regs = of_iomap(np, 0);
150 if (!priv->regs) { 149 if (!priv->regs) {
151 printk(KERN_ERR "Cannot map PCI PIC registers.\n"); 150 printk(KERN_ERR "Cannot map PCI PIC registers.\n");
152 goto out_free_bootmem; 151 goto out_free_kmalloc;
153 } 152 }
154 153
155 /* mask all PCI interrupts */ 154 /* mask all PCI interrupts */
@@ -171,9 +170,8 @@ int __init pq2ads_pci_init_irq(void)
171 170
172out_unmap_regs: 171out_unmap_regs:
173 iounmap(priv->regs); 172 iounmap(priv->regs);
174out_free_bootmem: 173out_free_kmalloc:
175 free_bootmem((unsigned long)priv, 174 kfree(priv);
176 sizeof(struct pq2ads_pci_pic));
177 of_node_put(np); 175 of_node_put(np);
178out_unmap_irq: 176out_unmap_irq:
179 irq_dispose_mapping(irq); 177 irq_dispose_mapping(irq);
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index d440435e055c..8d762203eeff 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. 2 * Copyright 2006 Freescale Semiconductor, Inc. All rights reserved.
3 * 3 *
4 * Description: 4 * Description:
5 * MPC832xE MDS board specific routines. 5 * MPC832xE MDS board specific routines.
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index 1b1f6c8a1a12..1a26d2f83401 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. 2 * Copyright 2006 Freescale Semiconductor, Inc. All rights reserved.
3 * 3 *
4 * Author: Li Yang <LeoLi@freescale.com> 4 * Author: Li Yang <LeoLi@freescale.com>
5 * Yin Olivia <Hong-hua.Yin@freescale.com> 5 * Yin Olivia <Hong-hua.Yin@freescale.com>
diff --git a/arch/powerpc/platforms/83xx/mpc836x_rdk.c b/arch/powerpc/platforms/83xx/mpc836x_rdk.c
index f8769d713d61..b63b42d11d6c 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_rdk.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_rdk.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * MPC8360E-RDK board file. 2 * MPC8360E-RDK board file.
3 * 3 *
4 * Copyright (c) 2006 Freescale Semicondutor, Inc. 4 * Copyright (c) 2006 Freescale Semiconductor, Inc.
5 * Copyright (c) 2007-2008 MontaVista Software, Inc. 5 * Copyright (c) 2007-2008 MontaVista Software, Inc.
6 * 6 *
7 * Author: Anton Vorontsov <avorontsov@ru.mvista.com> 7 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
diff --git a/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
index eca1f0960fff..9813c81e8e5b 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/powerpc/platforms/83xx/mpc837x_rdb.c 2 * arch/powerpc/platforms/83xx/mpc837x_rdb.c
3 * 3 *
4 * Copyright (C) 2007 Freescale Semicondutor, Inc. All rights reserved. 4 * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
5 * 5 *
6 * MPC837x RDB board specific routines 6 * MPC837x RDB board specific routines
7 * 7 *
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 8498f7323470..bd12588fa252 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006-2010, 2012 Freescale Semicondutor, Inc. 2 * Copyright (C) 2006-2010, 2012 Freescale Semiconductor, Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Author: Andy Fleming <afleming@freescale.com> 5 * Author: Andy Fleming <afleming@freescale.com>
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index 848a3e98e1c1..7328b8d74129 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -249,7 +249,7 @@ static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port)
249 goto exit; 249 goto exit;
250 } 250 }
251 251
252 iprop = of_get_property(law_node, "fsl,num-laws", 0); 252 iprop = of_get_property(law_node, "fsl,num-laws", NULL);
253 if (!iprop) { 253 if (!iprop) {
254 pr_err("p1022ds: LAW node is missing fsl,num-laws property\n"); 254 pr_err("p1022ds: LAW node is missing fsl,num-laws property\n");
255 goto exit; 255 goto exit;
@@ -539,7 +539,7 @@ static void __init p1022_ds_setup_arch(void)
539 }; 539 };
540 540
541 /* 541 /*
542 * prom_update_property() is called before 542 * of_update_property() is called before
543 * kmalloc() is available, so the 'new' object 543 * kmalloc() is available, so the 'new' object
544 * should be allocated in the global area. 544 * should be allocated in the global area.
545 * The easiest way is to do that is to 545 * The easiest way is to do that is to
@@ -548,7 +548,7 @@ static void __init p1022_ds_setup_arch(void)
548 */ 548 */
549 pr_info("p1022ds: disabling %s node", 549 pr_info("p1022ds: disabling %s node",
550 np2->full_name); 550 np2->full_name);
551 prom_update_property(np2, &nor_status); 551 of_update_property(np2, &nor_status);
552 of_node_put(np2); 552 of_node_put(np2);
553 } 553 }
554 554
@@ -564,7 +564,7 @@ static void __init p1022_ds_setup_arch(void)
564 564
565 pr_info("p1022ds: disabling %s node", 565 pr_info("p1022ds: disabling %s node",
566 np2->full_name); 566 np2->full_name);
567 prom_update_property(np2, &nand_status); 567 of_update_property(np2, &nand_status);
568 of_node_put(np2); 568 of_node_put(np2);
569 } 569 }
570 570
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index 6fcfa12e5c56..148c2f2d9780 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -128,6 +128,19 @@ static void __cpuinit smp_85xx_mach_cpu_die(void)
128} 128}
129#endif 129#endif
130 130
131static inline void flush_spin_table(void *spin_table)
132{
133 flush_dcache_range((ulong)spin_table,
134 (ulong)spin_table + sizeof(struct epapr_spin_table));
135}
136
137static inline u32 read_spin_table_addr_l(void *spin_table)
138{
139 flush_dcache_range((ulong)spin_table,
140 (ulong)spin_table + sizeof(struct epapr_spin_table));
141 return in_be32(&((struct epapr_spin_table *)spin_table)->addr_l);
142}
143
131static int __cpuinit smp_85xx_kick_cpu(int nr) 144static int __cpuinit smp_85xx_kick_cpu(int nr)
132{ 145{
133 unsigned long flags; 146 unsigned long flags;
@@ -161,8 +174,8 @@ static int __cpuinit smp_85xx_kick_cpu(int nr)
161 174
162 /* Map the spin table */ 175 /* Map the spin table */
163 if (ioremappable) 176 if (ioremappable)
164 spin_table = ioremap(*cpu_rel_addr, 177 spin_table = ioremap_prot(*cpu_rel_addr,
165 sizeof(struct epapr_spin_table)); 178 sizeof(struct epapr_spin_table), _PAGE_COHERENT);
166 else 179 else
167 spin_table = phys_to_virt(*cpu_rel_addr); 180 spin_table = phys_to_virt(*cpu_rel_addr);
168 181
@@ -173,7 +186,16 @@ static int __cpuinit smp_85xx_kick_cpu(int nr)
173 generic_set_cpu_up(nr); 186 generic_set_cpu_up(nr);
174 187
175 if (system_state == SYSTEM_RUNNING) { 188 if (system_state == SYSTEM_RUNNING) {
189 /*
190 * To keep it compatible with old boot program which uses
191 * cache-inhibit spin table, we need to flush the cache
192 * before accessing spin table to invalidate any staled data.
193 * We also need to flush the cache after writing to spin
194 * table to push data out.
195 */
196 flush_spin_table(spin_table);
176 out_be32(&spin_table->addr_l, 0); 197 out_be32(&spin_table->addr_l, 0);
198 flush_spin_table(spin_table);
177 199
178 /* 200 /*
179 * We don't set the BPTR register here since it already points 201 * We don't set the BPTR register here since it already points
@@ -181,9 +203,14 @@ static int __cpuinit smp_85xx_kick_cpu(int nr)
181 */ 203 */
182 mpic_reset_core(hw_cpu); 204 mpic_reset_core(hw_cpu);
183 205
184 /* wait until core is ready... */ 206 /*
185 if (!spin_event_timeout(in_be32(&spin_table->addr_l) == 1, 207 * wait until core is ready...
186 10000, 100)) { 208 * We need to invalidate the stale data, in case the boot
209 * loader uses a cache-inhibited spin table.
210 */
211 if (!spin_event_timeout(
212 read_spin_table_addr_l(spin_table) == 1,
213 10000, 100)) {
187 pr_err("%s: timeout waiting for core %d to reset\n", 214 pr_err("%s: timeout waiting for core %d to reset\n",
188 __func__, hw_cpu); 215 __func__, hw_cpu);
189 ret = -ENOENT; 216 ret = -ENOENT;
@@ -194,12 +221,10 @@ static int __cpuinit smp_85xx_kick_cpu(int nr)
194 __secondary_hold_acknowledge = -1; 221 __secondary_hold_acknowledge = -1;
195 } 222 }
196#endif 223#endif
224 flush_spin_table(spin_table);
197 out_be32(&spin_table->pir, hw_cpu); 225 out_be32(&spin_table->pir, hw_cpu);
198 out_be32(&spin_table->addr_l, __pa(__early_start)); 226 out_be32(&spin_table->addr_l, __pa(__early_start));
199 227 flush_spin_table(spin_table);
200 if (!ioremappable)
201 flush_dcache_range((ulong)spin_table,
202 (ulong)spin_table + sizeof(struct epapr_spin_table));
203 228
204 /* Wait a bit for the CPU to ack. */ 229 /* Wait a bit for the CPU to ack. */
205 if (!spin_event_timeout(__secondary_hold_acknowledge == hw_cpu, 230 if (!spin_event_timeout(__secondary_hold_acknowledge == hw_cpu,
@@ -213,13 +238,11 @@ out:
213#else 238#else
214 smp_generic_kick_cpu(nr); 239 smp_generic_kick_cpu(nr);
215 240
241 flush_spin_table(spin_table);
216 out_be32(&spin_table->pir, hw_cpu); 242 out_be32(&spin_table->pir, hw_cpu);
217 out_be64((u64 *)(&spin_table->addr_h), 243 out_be64((u64 *)(&spin_table->addr_h),
218 __pa((u64)*((unsigned long long *)generic_secondary_smp_init))); 244 __pa((u64)*((unsigned long long *)generic_secondary_smp_init)));
219 245 flush_spin_table(spin_table);
220 if (!ioremappable)
221 flush_dcache_range((ulong)spin_table,
222 (ulong)spin_table + sizeof(struct epapr_spin_table));
223#endif 246#endif
224 247
225 local_irq_restore(flags); 248 local_irq_restore(flags);
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index a817398a56da..04d9d317f741 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -353,5 +353,7 @@ define_machine(mpc86xx_hpcd) {
353 .time_init = mpc86xx_time_init, 353 .time_init = mpc86xx_time_init,
354 .calibrate_decr = generic_calibrate_decr, 354 .calibrate_decr = generic_calibrate_decr,
355 .progress = udbg_progress, 355 .progress = udbg_progress,
356#ifdef CONFIG_PCI
356 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 357 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
358#endif
357}; 359};
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index 64171198535c..311b804353b1 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -55,6 +55,7 @@ static unsigned int low_freq;
55static unsigned int hi_freq; 55static unsigned int hi_freq;
56static unsigned int cur_freq; 56static unsigned int cur_freq;
57static unsigned int sleep_freq; 57static unsigned int sleep_freq;
58static unsigned long transition_latency;
58 59
59/* 60/*
60 * Different models uses different mechanisms to switch the frequency 61 * Different models uses different mechanisms to switch the frequency
@@ -403,7 +404,7 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
403 if (policy->cpu != 0) 404 if (policy->cpu != 0)
404 return -ENODEV; 405 return -ENODEV;
405 406
406 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 407 policy->cpuinfo.transition_latency = transition_latency;
407 policy->cur = cur_freq; 408 policy->cur = cur_freq;
408 409
409 cpufreq_frequency_table_get_attr(pmac_cpu_freqs, policy->cpu); 410 cpufreq_frequency_table_get_attr(pmac_cpu_freqs, policy->cpu);
@@ -658,12 +659,14 @@ static int __init pmac_cpufreq_setup(void)
658 if (!value) 659 if (!value)
659 goto out; 660 goto out;
660 cur_freq = (*value) / 1000; 661 cur_freq = (*value) / 1000;
662 transition_latency = CPUFREQ_ETERNAL;
661 663
662 /* Check for 7447A based MacRISC3 */ 664 /* Check for 7447A based MacRISC3 */
663 if (of_machine_is_compatible("MacRISC3") && 665 if (of_machine_is_compatible("MacRISC3") &&
664 of_get_property(cpunode, "dynamic-power-step", NULL) && 666 of_get_property(cpunode, "dynamic-power-step", NULL) &&
665 PVR_VER(mfspr(SPRN_PVR)) == 0x8003) { 667 PVR_VER(mfspr(SPRN_PVR)) == 0x8003) {
666 pmac_cpufreq_init_7447A(cpunode); 668 pmac_cpufreq_init_7447A(cpunode);
669 transition_latency = 8000000;
667 /* Check for other MacRISC3 machines */ 670 /* Check for other MacRISC3 machines */
668 } else if (of_machine_is_compatible("PowerBook3,4") || 671 } else if (of_machine_is_compatible("PowerBook3,4") ||
669 of_machine_is_compatible("PowerBook3,5") || 672 of_machine_is_compatible("PowerBook3,5") ||
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 471aa3ccd9fd..53d052e95cfc 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -34,24 +34,12 @@
34#include "powernv.h" 34#include "powernv.h"
35#include "pci.h" 35#include "pci.h"
36 36
37static int __pe_printk(const char *level, const struct pnv_ioda_pe *pe,
38 struct va_format *vaf)
39{
40 char pfix[32];
41
42 if (pe->pdev)
43 strlcpy(pfix, dev_name(&pe->pdev->dev), sizeof(pfix));
44 else
45 sprintf(pfix, "%04x:%02x ",
46 pci_domain_nr(pe->pbus), pe->pbus->number);
47 return printk("pci %s%s: [PE# %.3d] %pV", level, pfix, pe->pe_number, vaf);
48}
49
50#define define_pe_printk_level(func, kern_level) \ 37#define define_pe_printk_level(func, kern_level) \
51static int func(const struct pnv_ioda_pe *pe, const char *fmt, ...) \ 38static int func(const struct pnv_ioda_pe *pe, const char *fmt, ...) \
52{ \ 39{ \
53 struct va_format vaf; \ 40 struct va_format vaf; \
54 va_list args; \ 41 va_list args; \
42 char pfix[32]; \
55 int r; \ 43 int r; \
56 \ 44 \
57 va_start(args, fmt); \ 45 va_start(args, fmt); \
@@ -59,7 +47,16 @@ static int func(const struct pnv_ioda_pe *pe, const char *fmt, ...) \
59 vaf.fmt = fmt; \ 47 vaf.fmt = fmt; \
60 vaf.va = &args; \ 48 vaf.va = &args; \
61 \ 49 \
62 r = __pe_printk(kern_level, pe, &vaf); \ 50 if (pe->pdev) \
51 strlcpy(pfix, dev_name(&pe->pdev->dev), \
52 sizeof(pfix)); \
53 else \
54 sprintf(pfix, "%04x:%02x ", \
55 pci_domain_nr(pe->pbus), \
56 pe->pbus->number); \
57 r = printk(kern_level "pci %s: [PE# %.3d] %pV", \
58 pfix, pe->pe_number, &vaf); \
59 \
63 va_end(args); \ 60 va_end(args); \
64 \ 61 \
65 return r; \ 62 return r; \
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index 56d26bc4fd41..09787139834d 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -280,13 +280,13 @@ static void os_area_set_property(struct device_node *node,
280 280
281 if (tmp) { 281 if (tmp) {
282 pr_debug("%s:%d found %s\n", __func__, __LINE__, prop->name); 282 pr_debug("%s:%d found %s\n", __func__, __LINE__, prop->name);
283 prom_remove_property(node, tmp); 283 of_remove_property(node, tmp);
284 } 284 }
285 285
286 result = prom_add_property(node, prop); 286 result = of_add_property(node, prop);
287 287
288 if (result) 288 if (result)
289 pr_debug("%s:%d prom_set_property failed\n", __func__, 289 pr_debug("%s:%d of_set_property failed\n", __func__,
290 __LINE__); 290 __LINE__);
291} 291}
292 292
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 0f1b706506ed..a1a7b9a67ffd 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -13,17 +13,16 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/kref.h> 14#include <linux/kref.h>
15#include <linux/notifier.h> 15#include <linux/notifier.h>
16#include <linux/proc_fs.h>
17#include <linux/spinlock.h> 16#include <linux/spinlock.h>
18#include <linux/cpu.h> 17#include <linux/cpu.h>
19#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/of.h>
20#include "offline_states.h" 20#include "offline_states.h"
21 21
22#include <asm/prom.h> 22#include <asm/prom.h>
23#include <asm/machdep.h> 23#include <asm/machdep.h>
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/rtas.h> 25#include <asm/rtas.h>
26#include <asm/pSeries_reconfig.h>
27 26
28struct cc_workarea { 27struct cc_workarea {
29 u32 drc_index; 28 u32 drc_index;
@@ -255,9 +254,6 @@ static struct device_node *derive_parent(const char *path)
255 254
256int dlpar_attach_node(struct device_node *dn) 255int dlpar_attach_node(struct device_node *dn)
257{ 256{
258#ifdef CONFIG_PROC_DEVICETREE
259 struct proc_dir_entry *ent;
260#endif
261 int rc; 257 int rc;
262 258
263 of_node_set_flag(dn, OF_DYNAMIC); 259 of_node_set_flag(dn, OF_DYNAMIC);
@@ -266,44 +262,26 @@ int dlpar_attach_node(struct device_node *dn)
266 if (!dn->parent) 262 if (!dn->parent)
267 return -ENOMEM; 263 return -ENOMEM;
268 264
269 rc = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, dn); 265 rc = of_attach_node(dn);
270 if (rc) { 266 if (rc) {
271 printk(KERN_ERR "Failed to add device node %s\n", 267 printk(KERN_ERR "Failed to add device node %s\n",
272 dn->full_name); 268 dn->full_name);
273 return rc; 269 return rc;
274 } 270 }
275 271
276 of_attach_node(dn);
277
278#ifdef CONFIG_PROC_DEVICETREE
279 ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
280 if (ent)
281 proc_device_tree_add_node(dn, ent);
282#endif
283
284 of_node_put(dn->parent); 272 of_node_put(dn->parent);
285 return 0; 273 return 0;
286} 274}
287 275
288int dlpar_detach_node(struct device_node *dn) 276int dlpar_detach_node(struct device_node *dn)
289{ 277{
290#ifdef CONFIG_PROC_DEVICETREE 278 int rc;
291 struct device_node *parent = dn->parent;
292 struct property *prop = dn->properties;
293
294 while (prop) {
295 remove_proc_entry(prop->name, dn->pde);
296 prop = prop->next;
297 }
298 279
299 if (dn->pde) 280 rc = of_detach_node(dn);
300 remove_proc_entry(dn->pde->name, parent->pde); 281 if (rc)
301#endif 282 return rc;
302 283
303 pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, dn);
304 of_detach_node(dn);
305 of_node_put(dn); /* Must decrement the refcount */ 284 of_node_put(dn); /* Must decrement the refcount */
306
307 return 0; 285 return 0;
308} 286}
309 287
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index 0b0eff0cce35..7b56118f531c 100644
--- a/arch/powerpc/platforms/pseries/firmware.c
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -56,6 +56,7 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = {
56 {FW_FEATURE_MULTITCE, "hcall-multi-tce"}, 56 {FW_FEATURE_MULTITCE, "hcall-multi-tce"},
57 {FW_FEATURE_SPLPAR, "hcall-splpar"}, 57 {FW_FEATURE_SPLPAR, "hcall-splpar"},
58 {FW_FEATURE_VPHN, "hcall-vphn"}, 58 {FW_FEATURE_VPHN, "hcall-vphn"},
59 {FW_FEATURE_SET_MODE, "hcall-set-mode"},
59}; 60};
60 61
61/* Build up the firmware features bitmask using the contents of 62/* Build up the firmware features bitmask using the contents of
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 64c97d8ac0c5..a38956269fbf 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -23,12 +23,12 @@
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/sched.h> /* for idle_task_exit */ 24#include <linux/sched.h> /* for idle_task_exit */
25#include <linux/cpu.h> 25#include <linux/cpu.h>
26#include <linux/of.h>
26#include <asm/prom.h> 27#include <asm/prom.h>
27#include <asm/rtas.h> 28#include <asm/rtas.h>
28#include <asm/firmware.h> 29#include <asm/firmware.h>
29#include <asm/machdep.h> 30#include <asm/machdep.h>
30#include <asm/vdso_datapage.h> 31#include <asm/vdso_datapage.h>
31#include <asm/pSeries_reconfig.h>
32#include <asm/xics.h> 32#include <asm/xics.h>
33#include "plpar_wrappers.h" 33#include "plpar_wrappers.h"
34#include "offline_states.h" 34#include "offline_states.h"
@@ -333,10 +333,10 @@ static int pseries_smp_notifier(struct notifier_block *nb,
333 int err = 0; 333 int err = 0;
334 334
335 switch (action) { 335 switch (action) {
336 case PSERIES_RECONFIG_ADD: 336 case OF_RECONFIG_ATTACH_NODE:
337 err = pseries_add_processor(node); 337 err = pseries_add_processor(node);
338 break; 338 break;
339 case PSERIES_RECONFIG_REMOVE: 339 case OF_RECONFIG_DETACH_NODE:
340 pseries_remove_processor(node); 340 pseries_remove_processor(node);
341 break; 341 break;
342 } 342 }
@@ -399,7 +399,7 @@ static int __init pseries_cpu_hotplug_init(void)
399 399
400 /* Processors can be added/removed only on LPAR */ 400 /* Processors can be added/removed only on LPAR */
401 if (firmware_has_feature(FW_FEATURE_LPAR)) { 401 if (firmware_has_feature(FW_FEATURE_LPAR)) {
402 pSeries_reconfig_notifier_register(&pseries_smp_nb); 402 of_reconfig_notifier_register(&pseries_smp_nb);
403 cpu_maps_update_begin(); 403 cpu_maps_update_begin();
404 if (cede_offline_enabled && parse_cede_parameters() == 0) { 404 if (cede_offline_enabled && parse_cede_parameters() == 0) {
405 default_offline_state = CPU_STATE_INACTIVE; 405 default_offline_state = CPU_STATE_INACTIVE;
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index ecdb0a6b3171..2372c609fa2b 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -16,7 +16,6 @@
16 16
17#include <asm/firmware.h> 17#include <asm/firmware.h>
18#include <asm/machdep.h> 18#include <asm/machdep.h>
19#include <asm/pSeries_reconfig.h>
20#include <asm/sparsemem.h> 19#include <asm/sparsemem.h>
21 20
22static unsigned long get_memblock_size(void) 21static unsigned long get_memblock_size(void)
@@ -187,42 +186,69 @@ static int pseries_add_memory(struct device_node *np)
187 return (ret < 0) ? -EINVAL : 0; 186 return (ret < 0) ? -EINVAL : 0;
188} 187}
189 188
190static int pseries_drconf_memory(unsigned long *base, unsigned int action) 189static int pseries_update_drconf_memory(struct of_prop_reconfig *pr)
191{ 190{
191 struct of_drconf_cell *new_drmem, *old_drmem;
192 unsigned long memblock_size; 192 unsigned long memblock_size;
193 int rc; 193 u32 entries;
194 u32 *p;
195 int i, rc = -EINVAL;
194 196
195 memblock_size = get_memblock_size(); 197 memblock_size = get_memblock_size();
196 if (!memblock_size) 198 if (!memblock_size)
197 return -EINVAL; 199 return -EINVAL;
198 200
199 if (action == PSERIES_DRCONF_MEM_ADD) { 201 p = (u32 *)of_get_property(pr->dn, "ibm,dynamic-memory", NULL);
200 rc = memblock_add(*base, memblock_size); 202 if (!p)
201 rc = (rc < 0) ? -EINVAL : 0; 203 return -EINVAL;
202 } else if (action == PSERIES_DRCONF_MEM_REMOVE) { 204
203 rc = pseries_remove_memblock(*base, memblock_size); 205 /* The first int of the property is the number of lmb's described
204 } else { 206 * by the property. This is followed by an array of of_drconf_cell
205 rc = -EINVAL; 207 * entries. Get the niumber of entries and skip to the array of
208 * of_drconf_cell's.
209 */
210 entries = *p++;
211 old_drmem = (struct of_drconf_cell *)p;
212
213 p = (u32 *)pr->prop->value;
214 p++;
215 new_drmem = (struct of_drconf_cell *)p;
216
217 for (i = 0; i < entries; i++) {
218 if ((old_drmem[i].flags & DRCONF_MEM_ASSIGNED) &&
219 (!(new_drmem[i].flags & DRCONF_MEM_ASSIGNED))) {
220 rc = pseries_remove_memblock(old_drmem[i].base_addr,
221 memblock_size);
222 break;
223 } else if ((!(old_drmem[i].flags & DRCONF_MEM_ASSIGNED)) &&
224 (new_drmem[i].flags & DRCONF_MEM_ASSIGNED)) {
225 rc = memblock_add(old_drmem[i].base_addr,
226 memblock_size);
227 rc = (rc < 0) ? -EINVAL : 0;
228 break;
229 }
206 } 230 }
207 231
208 return rc; 232 return rc;
209} 233}
210 234
211static int pseries_memory_notifier(struct notifier_block *nb, 235static int pseries_memory_notifier(struct notifier_block *nb,
212 unsigned long action, void *node) 236 unsigned long action, void *node)
213{ 237{
238 struct of_prop_reconfig *pr;
214 int err = 0; 239 int err = 0;
215 240
216 switch (action) { 241 switch (action) {
217 case PSERIES_RECONFIG_ADD: 242 case OF_RECONFIG_ATTACH_NODE:
218 err = pseries_add_memory(node); 243 err = pseries_add_memory(node);
219 break; 244 break;
220 case PSERIES_RECONFIG_REMOVE: 245 case OF_RECONFIG_DETACH_NODE:
221 err = pseries_remove_memory(node); 246 err = pseries_remove_memory(node);
222 break; 247 break;
223 case PSERIES_DRCONF_MEM_ADD: 248 case OF_RECONFIG_UPDATE_PROPERTY:
224 case PSERIES_DRCONF_MEM_REMOVE: 249 pr = (struct of_prop_reconfig *)node;
225 err = pseries_drconf_memory(node, action); 250 if (!strcmp(pr->prop->name, "ibm,dynamic-memory"))
251 err = pseries_update_drconf_memory(pr);
226 break; 252 break;
227 } 253 }
228 return notifier_from_errno(err); 254 return notifier_from_errno(err);
@@ -235,7 +261,7 @@ static struct notifier_block pseries_mem_nb = {
235static int __init pseries_memory_hotplug_init(void) 261static int __init pseries_memory_hotplug_init(void)
236{ 262{
237 if (firmware_has_feature(FW_FEATURE_LPAR)) 263 if (firmware_has_feature(FW_FEATURE_LPAR))
238 pSeries_reconfig_notifier_register(&pseries_mem_nb); 264 of_reconfig_notifier_register(&pseries_mem_nb);
239 265
240 return 0; 266 return 0;
241} 267}
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 6153eea27ce7..e2685badb5db 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -36,13 +36,13 @@
36#include <linux/dma-mapping.h> 36#include <linux/dma-mapping.h>
37#include <linux/crash_dump.h> 37#include <linux/crash_dump.h>
38#include <linux/memory.h> 38#include <linux/memory.h>
39#include <linux/of.h>
39#include <asm/io.h> 40#include <asm/io.h>
40#include <asm/prom.h> 41#include <asm/prom.h>
41#include <asm/rtas.h> 42#include <asm/rtas.h>
42#include <asm/iommu.h> 43#include <asm/iommu.h>
43#include <asm/pci-bridge.h> 44#include <asm/pci-bridge.h>
44#include <asm/machdep.h> 45#include <asm/machdep.h>
45#include <asm/pSeries_reconfig.h>
46#include <asm/firmware.h> 46#include <asm/firmware.h>
47#include <asm/tce.h> 47#include <asm/tce.h>
48#include <asm/ppc-pci.h> 48#include <asm/ppc-pci.h>
@@ -760,7 +760,7 @@ static void remove_ddw(struct device_node *np)
760 __remove_ddw(np, ddw_avail, liobn); 760 __remove_ddw(np, ddw_avail, liobn);
761 761
762delprop: 762delprop:
763 ret = prom_remove_property(np, win64); 763 ret = of_remove_property(np, win64);
764 if (ret) 764 if (ret)
765 pr_warning("%s: failed to remove direct window property: %d\n", 765 pr_warning("%s: failed to remove direct window property: %d\n",
766 np->full_name, ret); 766 np->full_name, ret);
@@ -1070,7 +1070,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
1070 goto out_free_window; 1070 goto out_free_window;
1071 } 1071 }
1072 1072
1073 ret = prom_add_property(pdn, win64); 1073 ret = of_add_property(pdn, win64);
1074 if (ret) { 1074 if (ret) {
1075 dev_err(&dev->dev, "unable to add dma window property for %s: %d", 1075 dev_err(&dev->dev, "unable to add dma window property for %s: %d",
1076 pdn->full_name, ret); 1076 pdn->full_name, ret);
@@ -1294,7 +1294,7 @@ static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long acti
1294 struct direct_window *window; 1294 struct direct_window *window;
1295 1295
1296 switch (action) { 1296 switch (action) {
1297 case PSERIES_RECONFIG_REMOVE: 1297 case OF_RECONFIG_DETACH_NODE:
1298 if (pci && pci->iommu_table) 1298 if (pci && pci->iommu_table)
1299 iommu_free_table(pci->iommu_table, np->full_name); 1299 iommu_free_table(pci->iommu_table, np->full_name);
1300 1300
@@ -1357,7 +1357,7 @@ void iommu_init_early_pSeries(void)
1357 } 1357 }
1358 1358
1359 1359
1360 pSeries_reconfig_notifier_register(&iommu_reconfig_nb); 1360 of_reconfig_notifier_register(&iommu_reconfig_nb);
1361 register_memory_notifier(&iommu_mem_nb); 1361 register_memory_notifier(&iommu_mem_nb);
1362 1362
1363 set_pci_dma_ops(&dma_iommu_ops); 1363 set_pci_dma_ops(&dma_iommu_ops);
diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index dd30b12edfe4..6573808cc5f3 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -116,7 +116,7 @@ static int update_dt_property(struct device_node *dn, struct property **prop,
116 } 116 }
117 117
118 if (!more) { 118 if (!more) {
119 prom_update_property(dn, new_prop); 119 of_update_property(dn, new_prop);
120 new_prop = NULL; 120 new_prop = NULL;
121 } 121 }
122 122
@@ -172,7 +172,7 @@ static int update_dt_node(u32 phandle)
172 172
173 case 0x80000000: 173 case 0x80000000:
174 prop = of_find_property(dn, prop_name, NULL); 174 prop = of_find_property(dn, prop_name, NULL);
175 prom_remove_property(dn, prop); 175 of_remove_property(dn, prop);
176 prop = NULL; 176 prop = NULL;
177 break; 177 break;
178 178
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index 13e8cc43adf7..e6cc34a67053 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -273,4 +273,35 @@ static inline long plpar_put_term_char(unsigned long termno, unsigned long len,
273 lbuf[1]); 273 lbuf[1]);
274} 274}
275 275
276/* Set various resource mode parameters */
277static inline long plpar_set_mode(unsigned long mflags, unsigned long resource,
278 unsigned long value1, unsigned long value2)
279{
280 return plpar_hcall_norets(H_SET_MODE, mflags, resource, value1, value2);
281}
282
283/*
284 * Enable relocation on exceptions on this partition
285 *
286 * Note: this call has a partition wide scope and can take a while to complete.
287 * If it returns H_LONG_BUSY_* it should be retried periodically until it
288 * returns H_SUCCESS.
289 */
290static inline long enable_reloc_on_exceptions(void)
291{
292 /* mflags = 3: Exceptions at 0xC000000000004000 */
293 return plpar_set_mode(3, 3, 0, 0);
294}
295
296/*
297 * Disable relocation on exceptions on this partition
298 *
299 * Note: this call has a partition wide scope and can take a while to complete.
300 * If it returns H_LONG_BUSY_* it should be retried periodically until it
301 * returns H_SUCCESS.
302 */
303static inline long disable_reloc_on_exceptions(void) {
304 return plpar_set_mode(0, 3, 0, 0);
305}
306
276#endif /* _PSERIES_PLPAR_WRAPPERS_H */ 307#endif /* _PSERIES_PLPAR_WRAPPERS_H */
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 2f4668136b20..d6491bd481d0 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -16,55 +16,13 @@
16#include <linux/notifier.h> 16#include <linux/notifier.h>
17#include <linux/proc_fs.h> 17#include <linux/proc_fs.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/of.h>
19 20
20#include <asm/prom.h> 21#include <asm/prom.h>
21#include <asm/machdep.h> 22#include <asm/machdep.h>
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
23#include <asm/pSeries_reconfig.h>
24#include <asm/mmu.h> 24#include <asm/mmu.h>
25 25
26
27
28/*
29 * Routines for "runtime" addition and removal of device tree nodes.
30 */
31#ifdef CONFIG_PROC_DEVICETREE
32/*
33 * Add a node to /proc/device-tree.
34 */
35static void add_node_proc_entries(struct device_node *np)
36{
37 struct proc_dir_entry *ent;
38
39 ent = proc_mkdir(strrchr(np->full_name, '/') + 1, np->parent->pde);
40 if (ent)
41 proc_device_tree_add_node(np, ent);
42}
43
44static void remove_node_proc_entries(struct device_node *np)
45{
46 struct property *pp = np->properties;
47 struct device_node *parent = np->parent;
48
49 while (pp) {
50 remove_proc_entry(pp->name, np->pde);
51 pp = pp->next;
52 }
53 if (np->pde)
54 remove_proc_entry(np->pde->name, parent->pde);
55}
56#else /* !CONFIG_PROC_DEVICETREE */
57static void add_node_proc_entries(struct device_node *np)
58{
59 return;
60}
61
62static void remove_node_proc_entries(struct device_node *np)
63{
64 return;
65}
66#endif /* CONFIG_PROC_DEVICETREE */
67
68/** 26/**
69 * derive_parent - basically like dirname(1) 27 * derive_parent - basically like dirname(1)
70 * @path: the full_name of a node to be added to the tree 28 * @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)
97 return parent; 55 return parent;
98} 56}
99 57
100static BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain);
101
102int pSeries_reconfig_notifier_register(struct notifier_block *nb)
103{
104 return blocking_notifier_chain_register(&pSeries_reconfig_chain, nb);
105}
106EXPORT_SYMBOL_GPL(pSeries_reconfig_notifier_register);
107
108void pSeries_reconfig_notifier_unregister(struct notifier_block *nb)
109{
110 blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb);
111}
112EXPORT_SYMBOL_GPL(pSeries_reconfig_notifier_unregister);
113
114int pSeries_reconfig_notify(unsigned long action, void *p)
115{
116 int err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
117 action, p);
118
119 return notifier_to_errno(err);
120}
121
122static int pSeries_reconfig_add_node(const char *path, struct property *proplist) 58static int pSeries_reconfig_add_node(const char *path, struct property *proplist)
123{ 59{
124 struct device_node *np; 60 struct device_node *np;
@@ -142,16 +78,12 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
142 goto out_err; 78 goto out_err;
143 } 79 }
144 80
145 err = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, np); 81 err = of_attach_node(np);
146 if (err) { 82 if (err) {
147 printk(KERN_ERR "Failed to add device node %s\n", path); 83 printk(KERN_ERR "Failed to add device node %s\n", path);
148 goto out_err; 84 goto out_err;
149 } 85 }
150 86
151 of_attach_node(np);
152
153 add_node_proc_entries(np);
154
155 of_node_put(np->parent); 87 of_node_put(np->parent);
156 88
157 return 0; 89 return 0;
@@ -179,11 +111,7 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
179 return -EBUSY; 111 return -EBUSY;
180 } 112 }
181 113
182 remove_node_proc_entries(np);
183
184 pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, np);
185 of_detach_node(np); 114 of_detach_node(np);
186
187 of_node_put(parent); 115 of_node_put(parent);
188 of_node_put(np); /* Must decrement the refcount */ 116 of_node_put(np); /* Must decrement the refcount */
189 return 0; 117 return 0;
@@ -397,7 +325,7 @@ static int do_add_property(char *buf, size_t bufsize)
397 if (!prop) 325 if (!prop)
398 return -ENOMEM; 326 return -ENOMEM;
399 327
400 prom_add_property(np, prop); 328 of_add_property(np, prop);
401 329
402 return 0; 330 return 0;
403} 331}
@@ -421,16 +349,15 @@ static int do_remove_property(char *buf, size_t bufsize)
421 349
422 prop = of_find_property(np, buf, NULL); 350 prop = of_find_property(np, buf, NULL);
423 351
424 return prom_remove_property(np, prop); 352 return of_remove_property(np, prop);
425} 353}
426 354
427static int do_update_property(char *buf, size_t bufsize) 355static int do_update_property(char *buf, size_t bufsize)
428{ 356{
429 struct device_node *np; 357 struct device_node *np;
430 struct pSeries_reconfig_prop_update upd_value;
431 unsigned char *value; 358 unsigned char *value;
432 char *name, *end, *next_prop; 359 char *name, *end, *next_prop;
433 int rc, length; 360 int length;
434 struct property *newprop; 361 struct property *newprop;
435 buf = parse_node(buf, bufsize, &np); 362 buf = parse_node(buf, bufsize, &np);
436 end = buf + bufsize; 363 end = buf + bufsize;
@@ -452,41 +379,7 @@ static int do_update_property(char *buf, size_t bufsize)
452 if (!strcmp(name, "slb-size") || !strcmp(name, "ibm,slb-size")) 379 if (!strcmp(name, "slb-size") || !strcmp(name, "ibm,slb-size"))
453 slb_set_size(*(int *)value); 380 slb_set_size(*(int *)value);
454 381
455 upd_value.node = np; 382 return of_update_property(np, newprop);
456 upd_value.property = newprop;
457 pSeries_reconfig_notify(PSERIES_UPDATE_PROPERTY, &upd_value);
458
459 rc = prom_update_property(np, newprop);
460 if (rc)
461 return rc;
462
463 /* For memory under the ibm,dynamic-reconfiguration-memory node
464 * of the device tree, adding and removing memory is just an update
465 * to the ibm,dynamic-memory property instead of adding/removing a
466 * memory node in the device tree. For these cases we still need to
467 * involve the notifier chain.
468 */
469 if (!strcmp(name, "ibm,dynamic-memory")) {
470 int action;
471
472 next_prop = parse_next_property(next_prop, end, &name,
473 &length, &value);
474 if (!next_prop)
475 return -EINVAL;
476
477 if (!strcmp(name, "add"))
478 action = PSERIES_DRCONF_MEM_ADD;
479 else
480 action = PSERIES_DRCONF_MEM_REMOVE;
481
482 rc = pSeries_reconfig_notify(action, value);
483 if (rc) {
484 prom_update_property(np, newprop);
485 return rc;
486 }
487 }
488
489 return 0;
490} 383}
491 384
492/** 385/**
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index e3cb7ae61658..ca55882465d6 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -40,6 +40,8 @@
40#include <linux/seq_file.h> 40#include <linux/seq_file.h>
41#include <linux/root_dev.h> 41#include <linux/root_dev.h>
42#include <linux/cpuidle.h> 42#include <linux/cpuidle.h>
43#include <linux/of.h>
44#include <linux/kexec.h>
43 45
44#include <asm/mmu.h> 46#include <asm/mmu.h>
45#include <asm/processor.h> 47#include <asm/processor.h>
@@ -63,7 +65,6 @@
63#include <asm/smp.h> 65#include <asm/smp.h>
64#include <asm/firmware.h> 66#include <asm/firmware.h>
65#include <asm/eeh.h> 67#include <asm/eeh.h>
66#include <asm/pSeries_reconfig.h>
67 68
68#include "plpar_wrappers.h" 69#include "plpar_wrappers.h"
69#include "pseries.h" 70#include "pseries.h"
@@ -258,7 +259,7 @@ static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long act
258 int err = NOTIFY_OK; 259 int err = NOTIFY_OK;
259 260
260 switch (action) { 261 switch (action) {
261 case PSERIES_RECONFIG_ADD: 262 case OF_RECONFIG_ATTACH_NODE:
262 pci = np->parent->data; 263 pci = np->parent->data;
263 if (pci) { 264 if (pci) {
264 update_dn_pci_info(np, pci->phb); 265 update_dn_pci_info(np, pci->phb);
@@ -367,6 +368,65 @@ static void pSeries_idle(void)
367 } 368 }
368} 369}
369 370
371/*
372 * Enable relocation on during exceptions. This has partition wide scope and
373 * may take a while to complete, if it takes longer than one second we will
374 * just give up rather than wasting any more time on this - if that turns out
375 * to ever be a problem in practice we can move this into a kernel thread to
376 * finish off the process later in boot.
377 */
378static int __init pSeries_enable_reloc_on_exc(void)
379{
380 long rc;
381 unsigned int delay, total_delay = 0;
382
383 while (1) {
384 rc = enable_reloc_on_exceptions();
385 if (!H_IS_LONG_BUSY(rc))
386 return rc;
387
388 delay = get_longbusy_msecs(rc);
389 total_delay += delay;
390 if (total_delay > 1000) {
391 pr_warn("Warning: Giving up waiting to enable "
392 "relocation on exceptions (%u msec)!\n",
393 total_delay);
394 return rc;
395 }
396
397 mdelay(delay);
398 }
399}
400
401#ifdef CONFIG_KEXEC
402static long pSeries_disable_reloc_on_exc(void)
403{
404 long rc;
405
406 while (1) {
407 rc = disable_reloc_on_exceptions();
408 if (!H_IS_LONG_BUSY(rc))
409 return rc;
410 mdelay(get_longbusy_msecs(rc));
411 }
412}
413
414static void pSeries_machine_kexec(struct kimage *image)
415{
416 long rc;
417
418 if (firmware_has_feature(FW_FEATURE_SET_MODE) &&
419 (image->type != KEXEC_TYPE_CRASH)) {
420 rc = pSeries_disable_reloc_on_exc();
421 if (rc != H_SUCCESS)
422 pr_warning("Warning: Failed to disable relocation on "
423 "exceptions: %ld\n", rc);
424 }
425
426 default_machine_kexec(image);
427}
428#endif
429
370static void __init pSeries_setup_arch(void) 430static void __init pSeries_setup_arch(void)
371{ 431{
372 panic_timeout = 10; 432 panic_timeout = 10;
@@ -389,7 +449,7 @@ static void __init pSeries_setup_arch(void)
389 /* Find and initialize PCI host bridges */ 449 /* Find and initialize PCI host bridges */
390 init_pci_config_tokens(); 450 init_pci_config_tokens();
391 find_and_init_phbs(); 451 find_and_init_phbs();
392 pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb); 452 of_reconfig_notifier_register(&pci_dn_reconfig_nb);
393 453
394 pSeries_nvram_init(); 454 pSeries_nvram_init();
395 455
@@ -402,6 +462,14 @@ static void __init pSeries_setup_arch(void)
402 ppc_md.enable_pmcs = pseries_lpar_enable_pmcs; 462 ppc_md.enable_pmcs = pseries_lpar_enable_pmcs;
403 else 463 else
404 ppc_md.enable_pmcs = power4_enable_pmcs; 464 ppc_md.enable_pmcs = power4_enable_pmcs;
465
466 if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
467 long rc;
468 if ((rc = pSeries_enable_reloc_on_exc()) != H_SUCCESS) {
469 pr_warn("Unable to enable relocation on exceptions: "
470 "%ld\n", rc);
471 }
472 }
405} 473}
406 474
407static int __init pSeries_init_panel(void) 475static int __init pSeries_init_panel(void)
@@ -659,4 +727,7 @@ define_machine(pseries) {
659 .progress = rtas_progress, 727 .progress = rtas_progress,
660 .system_reset_exception = pSeries_system_reset_exception, 728 .system_reset_exception = pSeries_system_reset_exception,
661 .machine_check_exception = pSeries_machine_check_exception, 729 .machine_check_exception = pSeries_machine_check_exception,
730#ifdef CONFIG_KEXEC
731 .machine_kexec = pSeries_machine_kexec,
732#endif
662}; 733};
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 71706bc34a0d..9fc0a4941908 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -38,7 +38,6 @@
38#include <asm/cputable.h> 38#include <asm/cputable.h>
39#include <asm/firmware.h> 39#include <asm/firmware.h>
40#include <asm/rtas.h> 40#include <asm/rtas.h>
41#include <asm/pSeries_reconfig.h>
42#include <asm/mpic.h> 41#include <asm/mpic.h>
43#include <asm/vdso_datapage.h> 42#include <asm/vdso_datapage.h>
44#include <asm/cputhreads.h> 43#include <asm/cputhreads.h>
diff --git a/arch/powerpc/sysdev/fsl_gtm.c b/arch/powerpc/sysdev/fsl_gtm.c
index 02cf1e7e77fc..0eb871cc3437 100644
--- a/arch/powerpc/sysdev/fsl_gtm.c
+++ b/arch/powerpc/sysdev/fsl_gtm.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Freescale General-purpose Timers Module 2 * Freescale General-purpose Timers Module
3 * 3 *
4 * Copyright (c) Freescale Semicondutor, Inc. 2006. 4 * Copyright (c) Freescale Semiconductor, Inc. 2006.
5 * Shlomi Gridish <gridish@freescale.com> 5 * Shlomi Gridish <gridish@freescale.com>
6 * Jerry Huang <Chang-Ming.Huang@freescale.com> 6 * Jerry Huang <Chang-Ming.Huang@freescale.com>
7 * Copyright (c) MontaVista Software, Inc. 2008. 7 * Copyright (c) MontaVista Software, Inc. 2008.
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 01b62a62c635..5ba325bff3a2 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -89,7 +89,7 @@ static int fsl_pci_dma_set_mask(struct device *dev, u64 dma_mask)
89 return 0; 89 return 0;
90} 90}
91 91
92static int __init setup_one_atmu(struct ccsr_pci __iomem *pci, 92static int setup_one_atmu(struct ccsr_pci __iomem *pci,
93 unsigned int index, const struct resource *res, 93 unsigned int index, const struct resource *res,
94 resource_size_t offset) 94 resource_size_t offset)
95{ 95{
@@ -126,7 +126,7 @@ static int __init setup_one_atmu(struct ccsr_pci __iomem *pci,
126} 126}
127 127
128/* atmu setup for fsl pci/pcie controller */ 128/* atmu setup for fsl pci/pcie controller */
129static void __init setup_pci_atmu(struct pci_controller *hose, 129static void setup_pci_atmu(struct pci_controller *hose,
130 struct resource *rsrc) 130 struct resource *rsrc)
131{ 131{
132 struct ccsr_pci __iomem *pci; 132 struct ccsr_pci __iomem *pci;
@@ -902,9 +902,42 @@ static int __devinit fsl_pci_probe(struct platform_device *pdev)
902 return 0; 902 return 0;
903} 903}
904 904
905#ifdef CONFIG_PM
906static int fsl_pci_resume(struct device *dev)
907{
908 struct pci_controller *hose;
909 struct resource pci_rsrc;
910
911 hose = pci_find_hose_for_OF_device(dev->of_node);
912 if (!hose)
913 return -ENODEV;
914
915 if (of_address_to_resource(dev->of_node, 0, &pci_rsrc)) {
916 dev_err(dev, "Get pci register base failed.");
917 return -ENODEV;
918 }
919
920 setup_pci_atmu(hose, &pci_rsrc);
921
922 return 0;
923}
924
925static const struct dev_pm_ops pci_pm_ops = {
926 .resume = fsl_pci_resume,
927};
928
929#define PCI_PM_OPS (&pci_pm_ops)
930
931#else
932
933#define PCI_PM_OPS NULL
934
935#endif
936
905static struct platform_driver fsl_pci_driver = { 937static struct platform_driver fsl_pci_driver = {
906 .driver = { 938 .driver = {
907 .name = "fsl-pci", 939 .name = "fsl-pci",
940 .pm = PCI_PM_OPS,
908 .of_match_table = pci_ids, 941 .of_match_table = pci_ids,
909 }, 942 },
910 .probe = fsl_pci_probe, 943 .probe = fsl_pci_probe,
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c
index 8f0465422b1e..5aaf86c03893 100644
--- a/arch/powerpc/sysdev/pmi.c
+++ b/arch/powerpc/sysdev/pmi.c
@@ -214,18 +214,7 @@ static struct platform_driver pmi_of_platform_driver = {
214 .of_match_table = pmi_match, 214 .of_match_table = pmi_match,
215 }, 215 },
216}; 216};
217 217module_platform_driver(pmi_of_platform_driver);
218static int __init pmi_module_init(void)
219{
220 return platform_driver_register(&pmi_of_platform_driver);
221}
222module_init(pmi_module_init);
223
224static void __exit pmi_module_exit(void)
225{
226 platform_driver_unregister(&pmi_of_platform_driver);
227}
228module_exit(pmi_module_exit);
229 218
230int pmi_send_message(pmi_message_t msg) 219int pmi_send_message(pmi_message_t msg)
231{ 220{
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index b04367529729..238a07b97f2c 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006-2010 Freescale Semicondutor, Inc. All rights reserved. 2 * Copyright (C) 2006-2010 Freescale Semiconductor, Inc. All rights reserved.
3 * 3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com> 4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com> 5 * Li Yang <leoli@freescale.com>
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index 2fba6ef2f95e..b2b87c30e266 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/powerpc/sysdev/qe_lib/qe_ic.c 2 * arch/powerpc/sysdev/qe_lib/qe_ic.c
3 * 3 *
4 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved. 4 * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
5 * 5 *
6 * Author: Li Yang <leoli@freescale.com> 6 * Author: Li Yang <leoli@freescale.com>
7 * Based on code from Shlomi Gridish <gridish@freescale.com> 7 * Based on code from Shlomi Gridish <gridish@freescale.com>
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.h b/arch/powerpc/sysdev/qe_lib/qe_ic.h
index c327872ed35c..efef7ab9b753 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.h
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * QUICC ENGINE Interrupt Controller Header 4 * QUICC ENGINE Interrupt Controller Header
5 * 5 *
6 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved. 6 * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
7 * 7 *
8 * Author: Li Yang <leoli@freescale.com> 8 * Author: Li Yang <leoli@freescale.com>
9 * Based on code from Shlomi Gridish <gridish@freescale.com> 9 * Based on code from Shlomi Gridish <gridish@freescale.com>
diff --git a/arch/powerpc/sysdev/qe_lib/qe_io.c b/arch/powerpc/sysdev/qe_lib/qe_io.c
index fd1a6c3b1721..a88807b3dd57 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_io.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_io.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * QE Parallel I/O ports configuration routines 4 * QE Parallel I/O ports configuration routines
5 * 5 *
6 * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. 6 * Copyright 2006 Freescale Semiconductor, Inc. All rights reserved.
7 * 7 *
8 * Author: Li Yang <LeoLi@freescale.com> 8 * Author: Li Yang <LeoLi@freescale.com>
9 * Based on code from Shlomi Gridish <gridish@freescale.com> 9 * Based on code from Shlomi Gridish <gridish@freescale.com>
diff --git a/arch/powerpc/sysdev/qe_lib/ucc.c b/arch/powerpc/sysdev/qe_lib/ucc.c
index 04677505f20f..134b07d29435 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * QE UCC API Set - UCC specific routines implementations. 4 * QE UCC API Set - UCC specific routines implementations.
5 * 5 *
6 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved. 6 * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
7 * 7 *
8 * Authors: Shlomi Gridish <gridish@freescale.com> 8 * Authors: Shlomi Gridish <gridish@freescale.com>
9 * Li Yang <leoli@freescale.com> 9 * Li Yang <leoli@freescale.com>
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_fast.c b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
index fba02440d122..cceb2e366738 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_fast.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved. 2 * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
3 * 3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com> 4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com> 5 * Li Yang <leoli@freescale.com>
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_slow.c b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
index 524c0ead941d..1c062f48f1ac 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_slow.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved. 2 * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
3 * 3 *
4 * Authors: Shlomi Gridish <gridish@freescale.com> 4 * Authors: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com> 5 * Li Yang <leoli@freescale.com>
diff --git a/arch/powerpc/sysdev/qe_lib/usb.c b/arch/powerpc/sysdev/qe_lib/usb.c
index 9162828f5da7..27f23bd15eb6 100644
--- a/arch/powerpc/sysdev/qe_lib/usb.c
+++ b/arch/powerpc/sysdev/qe_lib/usb.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * QE USB routines 2 * QE USB routines
3 * 3 *
4 * Copyright (c) Freescale Semicondutor, Inc. 2006. 4 * Copyright 2006 Freescale Semiconductor, Inc.
5 * Shlomi Gridish <gridish@freescale.com> 5 * Shlomi Gridish <gridish@freescale.com>
6 * Jerry Huang <Chang-Ming.Huang@freescale.com> 6 * Jerry Huang <Chang-Ming.Huang@freescale.com>
7 * Copyright (c) MontaVista Software, Inc. 2008. 7 * Copyright (c) MontaVista Software, Inc. 2008.
diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
index c168c54e3c40..b49fdbd15808 100644
--- a/arch/powerpc/xmon/Makefile
+++ b/arch/powerpc/xmon/Makefile
@@ -6,7 +6,7 @@ GCOV_PROFILE := n
6 6
7ccflags-$(CONFIG_PPC64) := -mno-minimal-toc 7ccflags-$(CONFIG_PPC64) := -mno-minimal-toc
8 8
9obj-y += xmon.o start.o nonstdio.o 9obj-y += xmon.o nonstdio.o
10 10
11ifdef CONFIG_XMON_DISASSEMBLY 11ifdef CONFIG_XMON_DISASSEMBLY
12obj-y += ppc-dis.o ppc-opc.o 12obj-y += ppc-dis.o ppc-opc.o
diff --git a/arch/powerpc/xmon/nonstdio.c b/arch/powerpc/xmon/nonstdio.c
index bfac84fbe780..bce3dcfe5058 100644
--- a/arch/powerpc/xmon/nonstdio.c
+++ b/arch/powerpc/xmon/nonstdio.c
@@ -7,9 +7,23 @@
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 */ 8 */
9#include <linux/string.h> 9#include <linux/string.h>
10#include <asm/udbg.h>
10#include <asm/time.h> 11#include <asm/time.h>
11#include "nonstdio.h" 12#include "nonstdio.h"
12 13
14
15static int xmon_write(const void *ptr, int nb)
16{
17 return udbg_write(ptr, nb);
18}
19
20static int xmon_readchar(void)
21{
22 if (udbg_getc)
23 return udbg_getc();
24 return -1;
25}
26
13int xmon_putchar(int c) 27int xmon_putchar(int c)
14{ 28{
15 char ch = c; 29 char ch = c;
@@ -23,34 +37,7 @@ static char line[256];
23static char *lineptr; 37static char *lineptr;
24static int lineleft; 38static int lineleft;
25 39
26int xmon_expect(const char *str, unsigned long timeout) 40static int xmon_getchar(void)
27{
28 int c;
29 unsigned long t0;
30
31 /* assume 25MHz default timebase if tb_ticks_per_sec not set yet */
32 timeout *= tb_ticks_per_sec? tb_ticks_per_sec: 25000000;
33 t0 = get_tbl();
34 do {
35 lineptr = line;
36 for (;;) {
37 c = xmon_read_poll();
38 if (c == -1) {
39 if (get_tbl() - t0 > timeout)
40 return 0;
41 continue;
42 }
43 if (c == '\n')
44 break;
45 if (c != '\r' && lineptr < &line[sizeof(line) - 1])
46 *lineptr++ = c;
47 }
48 *lineptr = 0;
49 } while (strstr(line, str) == NULL);
50 return 1;
51}
52
53int xmon_getchar(void)
54{ 41{
55 int c; 42 int c;
56 43
@@ -124,13 +111,19 @@ char *xmon_gets(char *str, int nb)
124void xmon_printf(const char *format, ...) 111void xmon_printf(const char *format, ...)
125{ 112{
126 va_list args; 113 va_list args;
127 int n;
128 static char xmon_outbuf[1024]; 114 static char xmon_outbuf[1024];
115 int rc, n;
129 116
130 va_start(args, format); 117 va_start(args, format);
131 n = vsnprintf(xmon_outbuf, sizeof(xmon_outbuf), format, args); 118 n = vsnprintf(xmon_outbuf, sizeof(xmon_outbuf), format, args);
132 va_end(args); 119 va_end(args);
133 xmon_write(xmon_outbuf, n); 120
121 rc = xmon_write(xmon_outbuf, n);
122
123 if (n && rc == 0) {
124 /* No udbg hooks, fallback to printk() - dangerous */
125 printk(xmon_outbuf);
126 }
134} 127}
135 128
136void xmon_puts(const char *str) 129void xmon_puts(const char *str)
diff --git a/arch/powerpc/xmon/nonstdio.h b/arch/powerpc/xmon/nonstdio.h
index 23dd95f4599c..18a51ded4ffd 100644
--- a/arch/powerpc/xmon/nonstdio.h
+++ b/arch/powerpc/xmon/nonstdio.h
@@ -4,12 +4,6 @@
4#define putchar xmon_putchar 4#define putchar xmon_putchar
5 5
6extern int xmon_putchar(int c); 6extern int xmon_putchar(int c);
7extern int xmon_getchar(void);
8extern void xmon_puts(const char *); 7extern void xmon_puts(const char *);
9extern char *xmon_gets(char *, int); 8extern char *xmon_gets(char *, int);
10extern void xmon_printf(const char *, ...); 9extern void xmon_printf(const char *, ...);
11extern void xmon_map_scc(void);
12extern int xmon_expect(const char *str, unsigned long timeout);
13extern int xmon_write(const void *ptr, int nb);
14extern int xmon_readchar(void);
15extern int xmon_read_poll(void);
diff --git a/arch/powerpc/xmon/start.c b/arch/powerpc/xmon/start.c
deleted file mode 100644
index 8864de2af382..000000000000
--- a/arch/powerpc/xmon/start.c
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Copyright (C) 1996 Paul Mackerras.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <asm/machdep.h>
10#include <asm/udbg.h>
11#include "nonstdio.h"
12
13void xmon_map_scc(void)
14{
15}
16
17int xmon_write(const void *ptr, int nb)
18{
19 return udbg_write(ptr, nb);
20}
21
22int xmon_readchar(void)
23{
24 if (udbg_getc)
25 return udbg_getc();
26 return -1;
27}
28
29int xmon_read_poll(void)
30{
31 if (udbg_getc_poll)
32 return udbg_getc_poll();
33 return -1;
34}
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 3a56a639a92e..1f8d2f10a432 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -52,9 +52,6 @@
52#include "nonstdio.h" 52#include "nonstdio.h"
53#include "dis-asm.h" 53#include "dis-asm.h"
54 54
55#define scanhex xmon_scanhex
56#define skipbl xmon_skipbl
57
58#ifdef CONFIG_SMP 55#ifdef CONFIG_SMP
59static cpumask_t cpus_in_xmon = CPU_MASK_NONE; 56static cpumask_t cpus_in_xmon = CPU_MASK_NONE;
60static unsigned long xmon_taken = 1; 57static unsigned long xmon_taken = 1;
@@ -169,12 +166,8 @@ extern void xmon_leave(void);
169 166
170#ifdef CONFIG_PPC64 167#ifdef CONFIG_PPC64
171#define REG "%.16lx" 168#define REG "%.16lx"
172#define REGS_PER_LINE 4
173#define LAST_VOLATILE 13
174#else 169#else
175#define REG "%.8lx" 170#define REG "%.8lx"
176#define REGS_PER_LINE 8
177#define LAST_VOLATILE 12
178#endif 171#endif
179 172
180#define GETWORD(v) (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3]) 173#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,
1288 catch_memory_errors = 0; 1281 catch_memory_errors = 0;
1289} 1282}
1290 1283
1291static int xmon_depth_to_print = 64;
1292
1293#define LRSAVE_OFFSET (STACK_FRAME_LR_SAVE * sizeof(unsigned long)) 1284#define LRSAVE_OFFSET (STACK_FRAME_LR_SAVE * sizeof(unsigned long))
1294#define MARKER_OFFSET (STACK_FRAME_MARKER * sizeof(unsigned long)) 1285#define MARKER_OFFSET (STACK_FRAME_MARKER * sizeof(unsigned long))
1295 1286
1296#ifdef __powerpc64__
1297#define REGS_OFFSET 0x70
1298#else
1299#define REGS_OFFSET 16
1300#endif
1301
1302static void xmon_show_stack(unsigned long sp, unsigned long lr, 1287static void xmon_show_stack(unsigned long sp, unsigned long lr,
1303 unsigned long pc) 1288 unsigned long pc)
1304{ 1289{
1290 int max_to_print = 64;
1305 unsigned long ip; 1291 unsigned long ip;
1306 unsigned long newsp; 1292 unsigned long newsp;
1307 unsigned long marker; 1293 unsigned long marker;
1308 int count = 0;
1309 struct pt_regs regs; 1294 struct pt_regs regs;
1310 1295
1311 do { 1296 while (max_to_print--) {
1312 if (sp < PAGE_OFFSET) { 1297 if (sp < PAGE_OFFSET) {
1313 if (sp != 0) 1298 if (sp != 0)
1314 printf("SP (%lx) is in userspace\n", sp); 1299 printf("SP (%lx) is in userspace\n", sp);
@@ -1362,10 +1347,10 @@ static void xmon_show_stack(unsigned long sp, unsigned long lr,
1362 an exception frame. */ 1347 an exception frame. */
1363 if (mread(sp + MARKER_OFFSET, &marker, sizeof(unsigned long)) 1348 if (mread(sp + MARKER_OFFSET, &marker, sizeof(unsigned long))
1364 && marker == STACK_FRAME_REGS_MARKER) { 1349 && marker == STACK_FRAME_REGS_MARKER) {
1365 if (mread(sp + REGS_OFFSET, &regs, sizeof(regs)) 1350 if (mread(sp + STACK_FRAME_OVERHEAD, &regs, sizeof(regs))
1366 != sizeof(regs)) { 1351 != sizeof(regs)) {
1367 printf("Couldn't read registers at %lx\n", 1352 printf("Couldn't read registers at %lx\n",
1368 sp + REGS_OFFSET); 1353 sp + STACK_FRAME_OVERHEAD);
1369 break; 1354 break;
1370 } 1355 }
1371 printf("--- Exception: %lx %s at ", regs.trap, 1356 printf("--- Exception: %lx %s at ", regs.trap,
@@ -1379,7 +1364,7 @@ static void xmon_show_stack(unsigned long sp, unsigned long lr,
1379 break; 1364 break;
1380 1365
1381 sp = newsp; 1366 sp = newsp;
1382 } while (count++ < xmon_depth_to_print); 1367 }
1383} 1368}
1384 1369
1385static void backtrace(struct pt_regs *excp) 1370static void backtrace(struct pt_regs *excp)
@@ -2943,7 +2928,6 @@ static void xmon_init(int enable)
2943 __debugger_dabr_match = NULL; 2928 __debugger_dabr_match = NULL;
2944 __debugger_fault_handler = NULL; 2929 __debugger_fault_handler = NULL;
2945 } 2930 }
2946 xmon_map_scc();
2947} 2931}
2948 2932
2949#ifdef CONFIG_MAGIC_SYSRQ 2933#ifdef CONFIG_MAGIC_SYSRQ