aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-09-08 01:45:47 -0400
committerLen Brown <len.brown@intel.com>2005-09-08 01:45:47 -0400
commit64e47488c913ac704d465a6af86a26786d1412a5 (patch)
treed3b0148592963dcde26e4bb35ddfec8b1eaf8e23 /arch/ppc64
parent4a35a46bf1cda4737c428380d1db5d15e2590d18 (diff)
parentcaf39e87cc1182f7dae84eefc43ca14d54c78ef9 (diff)
Merge linux-2.6 with linux-acpi-2.6
Diffstat (limited to 'arch/ppc64')
-rw-r--r--arch/ppc64/Kconfig4
-rw-r--r--arch/ppc64/Kconfig.debug9
-rw-r--r--arch/ppc64/Makefile2
-rw-r--r--arch/ppc64/kernel/Makefile8
-rw-r--r--arch/ppc64/kernel/btext.c1
-rw-r--r--arch/ppc64/kernel/cputable.c90
-rw-r--r--arch/ppc64/kernel/entry.S11
-rw-r--r--arch/ppc64/kernel/head.S9
-rw-r--r--arch/ppc64/kernel/kprobes.c40
-rw-r--r--arch/ppc64/kernel/lparcfg.c2
-rw-r--r--arch/ppc64/kernel/maple_setup.c3
-rw-r--r--arch/ppc64/kernel/misc.S6
-rw-r--r--arch/ppc64/kernel/pSeries_lpar.c22
-rw-r--r--arch/ppc64/kernel/pSeries_reconfig.c2
-rw-r--r--arch/ppc64/kernel/pSeries_setup.c7
-rw-r--r--arch/ppc64/kernel/pacaData.c1
-rw-r--r--arch/ppc64/kernel/pmac_setup.c19
-rw-r--r--arch/ppc64/kernel/prom.c1
-rw-r--r--arch/ppc64/kernel/prom_init.c1
-rw-r--r--arch/ppc64/kernel/rtasd.c10
-rw-r--r--arch/ppc64/kernel/rtc.c7
-rw-r--r--arch/ppc64/kernel/scanlog.c17
-rw-r--r--arch/ppc64/kernel/setup.c44
-rw-r--r--arch/ppc64/kernel/sys_ppc32.c31
-rw-r--r--arch/ppc64/kernel/sysfs.c48
-rw-r--r--arch/ppc64/kernel/time.c8
-rw-r--r--arch/ppc64/kernel/traps.c5
-rw-r--r--arch/ppc64/kernel/udbg.c300
-rw-r--r--arch/ppc64/kernel/udbg_16550.c123
-rw-r--r--arch/ppc64/kernel/udbg_scc.c136
-rw-r--r--arch/ppc64/kernel/vmlinux.lds.S1
-rw-r--r--arch/ppc64/mm/fault.c5
-rw-r--r--arch/ppc64/mm/hugetlbpage.c6
-rw-r--r--arch/ppc64/mm/init.c28
-rw-r--r--arch/ppc64/mm/numa.c43
-rw-r--r--arch/ppc64/mm/slb.c4
-rw-r--r--arch/ppc64/oprofile/common.c58
-rw-r--r--arch/ppc64/oprofile/op_impl.h108
-rw-r--r--arch/ppc64/oprofile/op_model_power4.c12
-rw-r--r--arch/ppc64/oprofile/op_model_rs64.c3
-rw-r--r--arch/ppc64/xmon/start.c4
41 files changed, 594 insertions, 645 deletions
diff --git a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
index 13b262f10216..deca68ad644a 100644
--- a/arch/ppc64/Kconfig
+++ b/arch/ppc64/Kconfig
@@ -44,6 +44,10 @@ config SCHED_NO_NO_OMIT_FRAME_POINTER
44 bool 44 bool
45 default y 45 default y
46 46
47config ARCH_MAY_HAVE_PC_FDC
48 bool
49 default y
50
47# We optimistically allocate largepages from the VM, so make the limit 51# We optimistically allocate largepages from the VM, so make the limit
48# large enough (16MB). This badly named config option is actually 52# large enough (16MB). This badly named config option is actually
49# max order + 1 53# max order + 1
diff --git a/arch/ppc64/Kconfig.debug b/arch/ppc64/Kconfig.debug
index 46b1ce58da3b..f16a5030527b 100644
--- a/arch/ppc64/Kconfig.debug
+++ b/arch/ppc64/Kconfig.debug
@@ -41,10 +41,19 @@ config XMON
41 help 41 help
42 Include in-kernel hooks for the xmon kernel monitor/debugger. 42 Include in-kernel hooks for the xmon kernel monitor/debugger.
43 Unless you are intending to debug the kernel, say N here. 43 Unless you are intending to debug the kernel, say N here.
44 Make sure to enable also CONFIG_BOOTX_TEXT on Macs. Otherwise
45 nothing will appear on the screen (xmon writes directly to the
46 framebuffer memory).
47 The cmdline option 'xmon' or 'xmon=early' will drop into xmon very
48 early during boot. 'xmon=on' will just enable the xmon debugger hooks.
49 'xmon=off' will disable the debugger hooks if CONFIG_XMON_DEFAULT is set.
44 50
45config XMON_DEFAULT 51config XMON_DEFAULT
46 bool "Enable xmon by default" 52 bool "Enable xmon by default"
47 depends on XMON 53 depends on XMON
54 help
55 xmon is normally disabled unless booted with 'xmon=on'.
56 Use 'xmon=off' to disable xmon init during runtime.
48 57
49config PPCDBG 58config PPCDBG
50 bool "Include PPCDBG realtime debugging" 59 bool "Include PPCDBG realtime debugging"
diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile
index 6350cce82efb..8189953a372c 100644
--- a/arch/ppc64/Makefile
+++ b/arch/ppc64/Makefile
@@ -49,7 +49,7 @@ NM := $(NM) --synthetic
49 49
50endif 50endif
51 51
52CHECKFLAGS += -m64 -D__powerpc__ 52CHECKFLAGS += -m64 -D__powerpc__ -D__powerpc64__
53 53
54LDFLAGS := -m elf64ppc 54LDFLAGS := -m elf64ppc
55LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD) 55LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
diff --git a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile
index f4b3bfcc109d..ae60eb1193c6 100644
--- a/arch/ppc64/kernel/Makefile
+++ b/arch/ppc64/kernel/Makefile
@@ -31,7 +31,7 @@ obj-$(CONFIG_PPC_MULTIPLATFORM) += nvram.o i8259.o prom_init.o prom.o
31 31
32obj-$(CONFIG_PPC_PSERIES) += pSeries_pci.o pSeries_lpar.o pSeries_hvCall.o \ 32obj-$(CONFIG_PPC_PSERIES) += pSeries_pci.o pSeries_lpar.o pSeries_hvCall.o \
33 pSeries_nvram.o rtasd.o ras.o pSeries_reconfig.o \ 33 pSeries_nvram.o rtasd.o ras.o pSeries_reconfig.o \
34 pSeries_setup.o pSeries_iommu.o 34 pSeries_setup.o pSeries_iommu.o udbg_16550.o
35 35
36obj-$(CONFIG_PPC_BPA) += bpa_setup.o bpa_iommu.o bpa_nvram.o \ 36obj-$(CONFIG_PPC_BPA) += bpa_setup.o bpa_iommu.o bpa_nvram.o \
37 bpa_iic.o spider-pic.o 37 bpa_iic.o spider-pic.o
@@ -58,9 +58,11 @@ obj-$(CONFIG_XICS) += xics.o
58obj-$(CONFIG_MPIC) += mpic.o 58obj-$(CONFIG_MPIC) += mpic.o
59 59
60obj-$(CONFIG_PPC_PMAC) += pmac_setup.o pmac_feature.o pmac_pci.o \ 60obj-$(CONFIG_PPC_PMAC) += pmac_setup.o pmac_feature.o pmac_pci.o \
61 pmac_time.o pmac_nvram.o pmac_low_i2c.o 61 pmac_time.o pmac_nvram.o pmac_low_i2c.o \
62 udbg_scc.o
62 63
63obj-$(CONFIG_PPC_MAPLE) += maple_setup.o maple_pci.o maple_time.o 64obj-$(CONFIG_PPC_MAPLE) += maple_setup.o maple_pci.o maple_time.o \
65 udbg_16550.o
64 66
65obj-$(CONFIG_U3_DART) += u3_iommu.o 67obj-$(CONFIG_U3_DART) += u3_iommu.o
66 68
diff --git a/arch/ppc64/kernel/btext.c b/arch/ppc64/kernel/btext.c
index c53f079e9b77..b6fbfbe9032d 100644
--- a/arch/ppc64/kernel/btext.c
+++ b/arch/ppc64/kernel/btext.c
@@ -7,7 +7,6 @@
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/string.h> 8#include <linux/string.h>
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/version.h>
11 10
12#include <asm/sections.h> 11#include <asm/sections.h>
13#include <asm/prom.h> 12#include <asm/prom.h>
diff --git a/arch/ppc64/kernel/cputable.c b/arch/ppc64/kernel/cputable.c
index 4847f2ac8c9f..8831a28c3c4e 100644
--- a/arch/ppc64/kernel/cputable.c
+++ b/arch/ppc64/kernel/cputable.c
@@ -19,6 +19,7 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/module.h> 20#include <linux/module.h>
21 21
22#include <asm/oprofile_impl.h>
22#include <asm/cputable.h> 23#include <asm/cputable.h>
23 24
24struct cpu_spec* cur_cpu_spec = NULL; 25struct cpu_spec* cur_cpu_spec = NULL;
@@ -54,24 +55,32 @@ struct cpu_spec cpu_specs[] = {
54 .pvr_value = 0x00400000, 55 .pvr_value = 0x00400000,
55 .cpu_name = "POWER3 (630)", 56 .cpu_name = "POWER3 (630)",
56 .cpu_features = CPU_FTR_SPLIT_ID_CACHE | 57 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
57 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | 58 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR,
58 CPU_FTR_PMC8,
59 .cpu_user_features = COMMON_USER_PPC64, 59 .cpu_user_features = COMMON_USER_PPC64,
60 .icache_bsize = 128, 60 .icache_bsize = 128,
61 .dcache_bsize = 128, 61 .dcache_bsize = 128,
62 .num_pmcs = 8,
62 .cpu_setup = __setup_cpu_power3, 63 .cpu_setup = __setup_cpu_power3,
64#ifdef CONFIG_OPROFILE
65 .oprofile_cpu_type = "ppc64/power3",
66 .oprofile_model = &op_model_rs64,
67#endif
63 }, 68 },
64 { /* Power3+ */ 69 { /* Power3+ */
65 .pvr_mask = 0xffff0000, 70 .pvr_mask = 0xffff0000,
66 .pvr_value = 0x00410000, 71 .pvr_value = 0x00410000,
67 .cpu_name = "POWER3 (630+)", 72 .cpu_name = "POWER3 (630+)",
68 .cpu_features = CPU_FTR_SPLIT_ID_CACHE | 73 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
69 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | 74 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR,
70 CPU_FTR_PMC8,
71 .cpu_user_features = COMMON_USER_PPC64, 75 .cpu_user_features = COMMON_USER_PPC64,
72 .icache_bsize = 128, 76 .icache_bsize = 128,
73 .dcache_bsize = 128, 77 .dcache_bsize = 128,
78 .num_pmcs = 8,
74 .cpu_setup = __setup_cpu_power3, 79 .cpu_setup = __setup_cpu_power3,
80#ifdef CONFIG_OPROFILE
81 .oprofile_cpu_type = "ppc64/power3",
82 .oprofile_model = &op_model_rs64,
83#endif
75 }, 84 },
76 { /* Northstar */ 85 { /* Northstar */
77 .pvr_mask = 0xffff0000, 86 .pvr_mask = 0xffff0000,
@@ -79,11 +88,16 @@ struct cpu_spec cpu_specs[] = {
79 .cpu_name = "RS64-II (northstar)", 88 .cpu_name = "RS64-II (northstar)",
80 .cpu_features = CPU_FTR_SPLIT_ID_CACHE | 89 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
81 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | 90 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
82 CPU_FTR_PMC8 | CPU_FTR_MMCRA | CPU_FTR_CTRL, 91 CPU_FTR_MMCRA | CPU_FTR_CTRL,
83 .cpu_user_features = COMMON_USER_PPC64, 92 .cpu_user_features = COMMON_USER_PPC64,
84 .icache_bsize = 128, 93 .icache_bsize = 128,
85 .dcache_bsize = 128, 94 .dcache_bsize = 128,
95 .num_pmcs = 8,
86 .cpu_setup = __setup_cpu_power3, 96 .cpu_setup = __setup_cpu_power3,
97#ifdef CONFIG_OPROFILE
98 .oprofile_cpu_type = "ppc64/rs64",
99 .oprofile_model = &op_model_rs64,
100#endif
87 }, 101 },
88 { /* Pulsar */ 102 { /* Pulsar */
89 .pvr_mask = 0xffff0000, 103 .pvr_mask = 0xffff0000,
@@ -91,11 +105,16 @@ struct cpu_spec cpu_specs[] = {
91 .cpu_name = "RS64-III (pulsar)", 105 .cpu_name = "RS64-III (pulsar)",
92 .cpu_features = CPU_FTR_SPLIT_ID_CACHE | 106 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
93 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | 107 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
94 CPU_FTR_PMC8 | CPU_FTR_MMCRA | CPU_FTR_CTRL, 108 CPU_FTR_MMCRA | CPU_FTR_CTRL,
95 .cpu_user_features = COMMON_USER_PPC64, 109 .cpu_user_features = COMMON_USER_PPC64,
96 .icache_bsize = 128, 110 .icache_bsize = 128,
97 .dcache_bsize = 128, 111 .dcache_bsize = 128,
112 .num_pmcs = 8,
98 .cpu_setup = __setup_cpu_power3, 113 .cpu_setup = __setup_cpu_power3,
114#ifdef CONFIG_OPROFILE
115 .oprofile_cpu_type = "ppc64/rs64",
116 .oprofile_model = &op_model_rs64,
117#endif
99 }, 118 },
100 { /* I-star */ 119 { /* I-star */
101 .pvr_mask = 0xffff0000, 120 .pvr_mask = 0xffff0000,
@@ -103,11 +122,16 @@ struct cpu_spec cpu_specs[] = {
103 .cpu_name = "RS64-III (icestar)", 122 .cpu_name = "RS64-III (icestar)",
104 .cpu_features = CPU_FTR_SPLIT_ID_CACHE | 123 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
105 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | 124 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
106 CPU_FTR_PMC8 | CPU_FTR_MMCRA | CPU_FTR_CTRL, 125 CPU_FTR_MMCRA | CPU_FTR_CTRL,
107 .cpu_user_features = COMMON_USER_PPC64, 126 .cpu_user_features = COMMON_USER_PPC64,
108 .icache_bsize = 128, 127 .icache_bsize = 128,
109 .dcache_bsize = 128, 128 .dcache_bsize = 128,
129 .num_pmcs = 8,
110 .cpu_setup = __setup_cpu_power3, 130 .cpu_setup = __setup_cpu_power3,
131#ifdef CONFIG_OPROFILE
132 .oprofile_cpu_type = "ppc64/rs64",
133 .oprofile_model = &op_model_rs64,
134#endif
111 }, 135 },
112 { /* S-star */ 136 { /* S-star */
113 .pvr_mask = 0xffff0000, 137 .pvr_mask = 0xffff0000,
@@ -115,11 +139,16 @@ struct cpu_spec cpu_specs[] = {
115 .cpu_name = "RS64-IV (sstar)", 139 .cpu_name = "RS64-IV (sstar)",
116 .cpu_features = CPU_FTR_SPLIT_ID_CACHE | 140 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
117 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | 141 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
118 CPU_FTR_PMC8 | CPU_FTR_MMCRA | CPU_FTR_CTRL, 142 CPU_FTR_MMCRA | CPU_FTR_CTRL,
119 .cpu_user_features = COMMON_USER_PPC64, 143 .cpu_user_features = COMMON_USER_PPC64,
120 .icache_bsize = 128, 144 .icache_bsize = 128,
121 .dcache_bsize = 128, 145 .dcache_bsize = 128,
146 .num_pmcs = 8,
122 .cpu_setup = __setup_cpu_power3, 147 .cpu_setup = __setup_cpu_power3,
148#ifdef CONFIG_OPROFILE
149 .oprofile_cpu_type = "ppc64/rs64",
150 .oprofile_model = &op_model_rs64,
151#endif
123 }, 152 },
124 { /* Power4 */ 153 { /* Power4 */
125 .pvr_mask = 0xffff0000, 154 .pvr_mask = 0xffff0000,
@@ -127,11 +156,16 @@ struct cpu_spec cpu_specs[] = {
127 .cpu_name = "POWER4 (gp)", 156 .cpu_name = "POWER4 (gp)",
128 .cpu_features = CPU_FTR_SPLIT_ID_CACHE | 157 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
129 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 158 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
130 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_PMC8 | CPU_FTR_MMCRA, 159 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA,
131 .cpu_user_features = COMMON_USER_PPC64, 160 .cpu_user_features = COMMON_USER_PPC64,
132 .icache_bsize = 128, 161 .icache_bsize = 128,
133 .dcache_bsize = 128, 162 .dcache_bsize = 128,
163 .num_pmcs = 8,
134 .cpu_setup = __setup_cpu_power4, 164 .cpu_setup = __setup_cpu_power4,
165#ifdef CONFIG_OPROFILE
166 .oprofile_cpu_type = "ppc64/power4",
167 .oprofile_model = &op_model_rs64,
168#endif
135 }, 169 },
136 { /* Power4+ */ 170 { /* Power4+ */
137 .pvr_mask = 0xffff0000, 171 .pvr_mask = 0xffff0000,
@@ -139,11 +173,16 @@ struct cpu_spec cpu_specs[] = {
139 .cpu_name = "POWER4+ (gq)", 173 .cpu_name = "POWER4+ (gq)",
140 .cpu_features = CPU_FTR_SPLIT_ID_CACHE | 174 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
141 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 175 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
142 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_PMC8 | CPU_FTR_MMCRA, 176 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA,
143 .cpu_user_features = COMMON_USER_PPC64, 177 .cpu_user_features = COMMON_USER_PPC64,
144 .icache_bsize = 128, 178 .icache_bsize = 128,
145 .dcache_bsize = 128, 179 .dcache_bsize = 128,
180 .num_pmcs = 8,
146 .cpu_setup = __setup_cpu_power4, 181 .cpu_setup = __setup_cpu_power4,
182#ifdef CONFIG_OPROFILE
183 .oprofile_cpu_type = "ppc64/power4",
184 .oprofile_model = &op_model_power4,
185#endif
147 }, 186 },
148 { /* PPC970 */ 187 { /* PPC970 */
149 .pvr_mask = 0xffff0000, 188 .pvr_mask = 0xffff0000,
@@ -152,12 +191,17 @@ struct cpu_spec cpu_specs[] = {
152 .cpu_features = CPU_FTR_SPLIT_ID_CACHE | 191 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
153 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 192 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
154 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP | 193 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
155 CPU_FTR_CAN_NAP | CPU_FTR_PMC8 | CPU_FTR_MMCRA, 194 CPU_FTR_CAN_NAP | CPU_FTR_MMCRA,
156 .cpu_user_features = COMMON_USER_PPC64 | 195 .cpu_user_features = COMMON_USER_PPC64 |
157 PPC_FEATURE_HAS_ALTIVEC_COMP, 196 PPC_FEATURE_HAS_ALTIVEC_COMP,
158 .icache_bsize = 128, 197 .icache_bsize = 128,
159 .dcache_bsize = 128, 198 .dcache_bsize = 128,
199 .num_pmcs = 8,
160 .cpu_setup = __setup_cpu_ppc970, 200 .cpu_setup = __setup_cpu_ppc970,
201#ifdef CONFIG_OPROFILE
202 .oprofile_cpu_type = "ppc64/970",
203 .oprofile_model = &op_model_power4,
204#endif
161 }, 205 },
162 { /* PPC970FX */ 206 { /* PPC970FX */
163 .pvr_mask = 0xffff0000, 207 .pvr_mask = 0xffff0000,
@@ -166,12 +210,17 @@ struct cpu_spec cpu_specs[] = {
166 .cpu_features = CPU_FTR_SPLIT_ID_CACHE | 210 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
167 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 211 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
168 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP | 212 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
169 CPU_FTR_CAN_NAP | CPU_FTR_PMC8 | CPU_FTR_MMCRA, 213 CPU_FTR_CAN_NAP | CPU_FTR_MMCRA,
170 .cpu_user_features = COMMON_USER_PPC64 | 214 .cpu_user_features = COMMON_USER_PPC64 |
171 PPC_FEATURE_HAS_ALTIVEC_COMP, 215 PPC_FEATURE_HAS_ALTIVEC_COMP,
172 .icache_bsize = 128, 216 .icache_bsize = 128,
173 .dcache_bsize = 128, 217 .dcache_bsize = 128,
218 .num_pmcs = 8,
174 .cpu_setup = __setup_cpu_ppc970, 219 .cpu_setup = __setup_cpu_ppc970,
220#ifdef CONFIG_OPROFILE
221 .oprofile_cpu_type = "ppc64/970",
222 .oprofile_model = &op_model_power4,
223#endif
175 }, 224 },
176 { /* PPC970MP */ 225 { /* PPC970MP */
177 .pvr_mask = 0xffff0000, 226 .pvr_mask = 0xffff0000,
@@ -180,12 +229,16 @@ struct cpu_spec cpu_specs[] = {
180 .cpu_features = CPU_FTR_SPLIT_ID_CACHE | 229 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
181 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 230 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
182 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP | 231 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
183 CPU_FTR_CAN_NAP | CPU_FTR_PMC8 | CPU_FTR_MMCRA, 232 CPU_FTR_CAN_NAP | CPU_FTR_MMCRA,
184 .cpu_user_features = COMMON_USER_PPC64 | 233 .cpu_user_features = COMMON_USER_PPC64 |
185 PPC_FEATURE_HAS_ALTIVEC_COMP, 234 PPC_FEATURE_HAS_ALTIVEC_COMP,
186 .icache_bsize = 128, 235 .icache_bsize = 128,
187 .dcache_bsize = 128, 236 .dcache_bsize = 128,
188 .cpu_setup = __setup_cpu_ppc970, 237 .cpu_setup = __setup_cpu_ppc970,
238#ifdef CONFIG_OPROFILE
239 .oprofile_cpu_type = "ppc64/970",
240 .oprofile_model = &op_model_power4,
241#endif
189 }, 242 },
190 { /* Power5 */ 243 { /* Power5 */
191 .pvr_mask = 0xffff0000, 244 .pvr_mask = 0xffff0000,
@@ -199,7 +252,12 @@ struct cpu_spec cpu_specs[] = {
199 .cpu_user_features = COMMON_USER_PPC64, 252 .cpu_user_features = COMMON_USER_PPC64,
200 .icache_bsize = 128, 253 .icache_bsize = 128,
201 .dcache_bsize = 128, 254 .dcache_bsize = 128,
255 .num_pmcs = 6,
202 .cpu_setup = __setup_cpu_power4, 256 .cpu_setup = __setup_cpu_power4,
257#ifdef CONFIG_OPROFILE
258 .oprofile_cpu_type = "ppc64/power5",
259 .oprofile_model = &op_model_power4,
260#endif
203 }, 261 },
204 { /* Power5 */ 262 { /* Power5 */
205 .pvr_mask = 0xffff0000, 263 .pvr_mask = 0xffff0000,
@@ -213,7 +271,12 @@ struct cpu_spec cpu_specs[] = {
213 .cpu_user_features = COMMON_USER_PPC64, 271 .cpu_user_features = COMMON_USER_PPC64,
214 .icache_bsize = 128, 272 .icache_bsize = 128,
215 .dcache_bsize = 128, 273 .dcache_bsize = 128,
274 .num_pmcs = 6,
216 .cpu_setup = __setup_cpu_power4, 275 .cpu_setup = __setup_cpu_power4,
276#ifdef CONFIG_OPROFILE
277 .oprofile_cpu_type = "ppc64/power5",
278 .oprofile_model = &op_model_power4,
279#endif
217 }, 280 },
218 { /* BE DD1.x */ 281 { /* BE DD1.x */
219 .pvr_mask = 0xffff0000, 282 .pvr_mask = 0xffff0000,
@@ -239,6 +302,7 @@ struct cpu_spec cpu_specs[] = {
239 .cpu_user_features = COMMON_USER_PPC64, 302 .cpu_user_features = COMMON_USER_PPC64,
240 .icache_bsize = 128, 303 .icache_bsize = 128,
241 .dcache_bsize = 128, 304 .dcache_bsize = 128,
305 .num_pmcs = 6,
242 .cpu_setup = __setup_cpu_power4, 306 .cpu_setup = __setup_cpu_power4,
243 } 307 }
244}; 308};
diff --git a/arch/ppc64/kernel/entry.S b/arch/ppc64/kernel/entry.S
index b61572eb2a71..bf99b4a92f20 100644
--- a/arch/ppc64/kernel/entry.S
+++ b/arch/ppc64/kernel/entry.S
@@ -400,15 +400,14 @@ BEGIN_FTR_SECTION
400 cmpd cr1,r6,r9 /* or is new ESID the same as current ESID? */ 400 cmpd cr1,r6,r9 /* or is new ESID the same as current ESID? */
401 cror eq,4*cr1+eq,eq 401 cror eq,4*cr1+eq,eq
402 beq 2f /* if yes, don't slbie it */ 402 beq 2f /* if yes, don't slbie it */
403 oris r0,r6,0x0800 /* set C (class) bit */
404 403
405 /* Bolt in the new stack SLB entry */ 404 /* Bolt in the new stack SLB entry */
406 ld r7,KSP_VSID(r4) /* Get new stack's VSID */ 405 ld r7,KSP_VSID(r4) /* Get new stack's VSID */
407 oris r6,r6,(SLB_ESID_V)@h 406 oris r0,r6,(SLB_ESID_V)@h
408 ori r6,r6,(SLB_NUM_BOLTED-1)@l 407 ori r0,r0,(SLB_NUM_BOLTED-1)@l
409 slbie r0 408 slbie r6
410 slbie r0 /* Workaround POWER5 < DD2.1 issue */ 409 slbie r6 /* Workaround POWER5 < DD2.1 issue */
411 slbmte r7,r6 410 slbmte r7,r0
412 isync 411 isync
413 412
4142: 4132:
diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
index 036959775623..b436206e317d 100644
--- a/arch/ppc64/kernel/head.S
+++ b/arch/ppc64/kernel/head.S
@@ -1646,8 +1646,9 @@ _GLOBAL(__secondary_start)
1646#else 1646#else
1647 /* set the ASR */ 1647 /* set the ASR */
1648 ld r3,systemcfg@got(r2) /* r3 = ptr to systemcfg */ 1648 ld r3,systemcfg@got(r2) /* r3 = ptr to systemcfg */
1649 ld r3,0(r3)
1649 lwz r3,PLATFORM(r3) /* r3 = platform flags */ 1650 lwz r3,PLATFORM(r3) /* r3 = platform flags */
1650 cmpldi r3,PLATFORM_PSERIES_LPAR 1651 andi. r3,r3,PLATFORM_LPAR /* Test if bit 0 is set (LPAR bit) */
1651 bne 98f 1652 bne 98f
1652 mfspr r3,PVR 1653 mfspr r3,PVR
1653 srwi r3,r3,16 1654 srwi r3,r3,16
@@ -1809,8 +1810,9 @@ _STATIC(start_here_multiplatform)
1809 ld r3,PACASTABREAL(r13) 1810 ld r3,PACASTABREAL(r13)
1810 ori r4,r3,1 /* turn on valid bit */ 1811 ori r4,r3,1 /* turn on valid bit */
1811 ld r3,systemcfg@got(r2) /* r3 = ptr to systemcfg */ 1812 ld r3,systemcfg@got(r2) /* r3 = ptr to systemcfg */
1813 ld r3,0(r3)
1812 lwz r3,PLATFORM(r3) /* r3 = platform flags */ 1814 lwz r3,PLATFORM(r3) /* r3 = platform flags */
1813 cmpldi r3,PLATFORM_PSERIES_LPAR 1815 andi. r3,r3,PLATFORM_LPAR /* Test if bit 0 is set (LPAR bit) */
1814 bne 98f 1816 bne 98f
1815 mfspr r3,PVR 1817 mfspr r3,PVR
1816 srwi r3,r3,16 1818 srwi r3,r3,16
@@ -1828,9 +1830,10 @@ _STATIC(start_here_multiplatform)
182899: 183099:
1829 /* Set SDR1 (hash table pointer) */ 1831 /* Set SDR1 (hash table pointer) */
1830 ld r3,systemcfg@got(r2) /* r3 = ptr to systemcfg */ 1832 ld r3,systemcfg@got(r2) /* r3 = ptr to systemcfg */
1833 ld r3,0(r3)
1831 lwz r3,PLATFORM(r3) /* r3 = platform flags */ 1834 lwz r3,PLATFORM(r3) /* r3 = platform flags */
1832 /* Test if bit 0 is set (LPAR bit) */ 1835 /* Test if bit 0 is set (LPAR bit) */
1833 andi. r3,r3,0x1 1836 andi. r3,r3,PLATFORM_LPAR
1834 bne 98f 1837 bne 98f
1835 LOADADDR(r6,_SDR1) /* Only if NOT LPAR */ 1838 LOADADDR(r6,_SDR1) /* Only if NOT LPAR */
1836 sub r6,r6,r26 1839 sub r6,r6,r26
diff --git a/arch/ppc64/kernel/kprobes.c b/arch/ppc64/kernel/kprobes.c
index a3d519518fb8..7e80d49c589a 100644
--- a/arch/ppc64/kernel/kprobes.c
+++ b/arch/ppc64/kernel/kprobes.c
@@ -44,7 +44,7 @@ static struct kprobe *kprobe_prev;
44static unsigned long kprobe_status_prev, kprobe_saved_msr_prev; 44static unsigned long kprobe_status_prev, kprobe_saved_msr_prev;
45static struct pt_regs jprobe_saved_regs; 45static struct pt_regs jprobe_saved_regs;
46 46
47int arch_prepare_kprobe(struct kprobe *p) 47int __kprobes arch_prepare_kprobe(struct kprobe *p)
48{ 48{
49 int ret = 0; 49 int ret = 0;
50 kprobe_opcode_t insn = *p->addr; 50 kprobe_opcode_t insn = *p->addr;
@@ -68,27 +68,27 @@ int arch_prepare_kprobe(struct kprobe *p)
68 return ret; 68 return ret;
69} 69}
70 70
71void arch_copy_kprobe(struct kprobe *p) 71void __kprobes arch_copy_kprobe(struct kprobe *p)
72{ 72{
73 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); 73 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
74 p->opcode = *p->addr; 74 p->opcode = *p->addr;
75} 75}
76 76
77void arch_arm_kprobe(struct kprobe *p) 77void __kprobes arch_arm_kprobe(struct kprobe *p)
78{ 78{
79 *p->addr = BREAKPOINT_INSTRUCTION; 79 *p->addr = BREAKPOINT_INSTRUCTION;
80 flush_icache_range((unsigned long) p->addr, 80 flush_icache_range((unsigned long) p->addr,
81 (unsigned long) p->addr + sizeof(kprobe_opcode_t)); 81 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
82} 82}
83 83
84void arch_disarm_kprobe(struct kprobe *p) 84void __kprobes arch_disarm_kprobe(struct kprobe *p)
85{ 85{
86 *p->addr = p->opcode; 86 *p->addr = p->opcode;
87 flush_icache_range((unsigned long) p->addr, 87 flush_icache_range((unsigned long) p->addr,
88 (unsigned long) p->addr + sizeof(kprobe_opcode_t)); 88 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
89} 89}
90 90
91void arch_remove_kprobe(struct kprobe *p) 91void __kprobes arch_remove_kprobe(struct kprobe *p)
92{ 92{
93 up(&kprobe_mutex); 93 up(&kprobe_mutex);
94 free_insn_slot(p->ainsn.insn); 94 free_insn_slot(p->ainsn.insn);
@@ -102,7 +102,7 @@ static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
102 regs->msr |= MSR_SE; 102 regs->msr |= MSR_SE;
103 103
104 /* single step inline if it is a trap variant */ 104 /* single step inline if it is a trap variant */
105 if (IS_TW(insn) || IS_TD(insn) || IS_TWI(insn) || IS_TDI(insn)) 105 if (is_trap(insn))
106 regs->nip = (unsigned long)p->addr; 106 regs->nip = (unsigned long)p->addr;
107 else 107 else
108 regs->nip = (unsigned long)p->ainsn.insn; 108 regs->nip = (unsigned long)p->ainsn.insn;
@@ -122,7 +122,8 @@ static inline void restore_previous_kprobe(void)
122 kprobe_saved_msr = kprobe_saved_msr_prev; 122 kprobe_saved_msr = kprobe_saved_msr_prev;
123} 123}
124 124
125void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs) 125void __kprobes arch_prepare_kretprobe(struct kretprobe *rp,
126 struct pt_regs *regs)
126{ 127{
127 struct kretprobe_instance *ri; 128 struct kretprobe_instance *ri;
128 129
@@ -151,7 +152,9 @@ static inline int kprobe_handler(struct pt_regs *regs)
151 Disarm the probe we just hit, and ignore it. */ 152 Disarm the probe we just hit, and ignore it. */
152 p = get_kprobe(addr); 153 p = get_kprobe(addr);
153 if (p) { 154 if (p) {
154 if (kprobe_status == KPROBE_HIT_SS) { 155 kprobe_opcode_t insn = *p->ainsn.insn;
156 if (kprobe_status == KPROBE_HIT_SS &&
157 is_trap(insn)) {
155 regs->msr &= ~MSR_SE; 158 regs->msr &= ~MSR_SE;
156 regs->msr |= kprobe_saved_msr; 159 regs->msr |= kprobe_saved_msr;
157 unlock_kprobes(); 160 unlock_kprobes();
@@ -191,8 +194,7 @@ static inline int kprobe_handler(struct pt_regs *regs)
191 * trap variant, it could belong to someone else 194 * trap variant, it could belong to someone else
192 */ 195 */
193 kprobe_opcode_t cur_insn = *addr; 196 kprobe_opcode_t cur_insn = *addr;
194 if (IS_TW(cur_insn) || IS_TD(cur_insn) || 197 if (is_trap(cur_insn))
195 IS_TWI(cur_insn) || IS_TDI(cur_insn))
196 goto no_kprobe; 198 goto no_kprobe;
197 /* 199 /*
198 * The breakpoint instruction was removed right 200 * The breakpoint instruction was removed right
@@ -244,7 +246,7 @@ void kretprobe_trampoline_holder(void)
244/* 246/*
245 * Called when the probe at kretprobe trampoline is hit 247 * Called when the probe at kretprobe trampoline is hit
246 */ 248 */
247int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 249int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
248{ 250{
249 struct kretprobe_instance *ri = NULL; 251 struct kretprobe_instance *ri = NULL;
250 struct hlist_head *head; 252 struct hlist_head *head;
@@ -308,7 +310,7 @@ int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
308 * single-stepped a copy of the instruction. The address of this 310 * single-stepped a copy of the instruction. The address of this
309 * copy is p->ainsn.insn. 311 * copy is p->ainsn.insn.
310 */ 312 */
311static void resume_execution(struct kprobe *p, struct pt_regs *regs) 313static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
312{ 314{
313 int ret; 315 int ret;
314 unsigned int insn = *p->ainsn.insn; 316 unsigned int insn = *p->ainsn.insn;
@@ -373,8 +375,8 @@ static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
373/* 375/*
374 * Wrapper routine to for handling exceptions. 376 * Wrapper routine to for handling exceptions.
375 */ 377 */
376int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, 378int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
377 void *data) 379 unsigned long val, void *data)
378{ 380{
379 struct die_args *args = (struct die_args *)data; 381 struct die_args *args = (struct die_args *)data;
380 int ret = NOTIFY_DONE; 382 int ret = NOTIFY_DONE;
@@ -402,11 +404,11 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val,
402 default: 404 default:
403 break; 405 break;
404 } 406 }
405 preempt_enable(); 407 preempt_enable_no_resched();
406 return ret; 408 return ret;
407} 409}
408 410
409int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) 411int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
410{ 412{
411 struct jprobe *jp = container_of(p, struct jprobe, kp); 413 struct jprobe *jp = container_of(p, struct jprobe, kp);
412 414
@@ -419,16 +421,16 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
419 return 1; 421 return 1;
420} 422}
421 423
422void jprobe_return(void) 424void __kprobes jprobe_return(void)
423{ 425{
424 asm volatile("trap" ::: "memory"); 426 asm volatile("trap" ::: "memory");
425} 427}
426 428
427void jprobe_return_end(void) 429void __kprobes jprobe_return_end(void)
428{ 430{
429}; 431};
430 432
431int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) 433int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
432{ 434{
433 /* 435 /*
434 * FIXME - we should ideally be validating that we got here 'cos 436 * FIXME - we should ideally be validating that we got here 'cos
diff --git a/arch/ppc64/kernel/lparcfg.c b/arch/ppc64/kernel/lparcfg.c
index edad361a8db0..cae19bbd5acd 100644
--- a/arch/ppc64/kernel/lparcfg.c
+++ b/arch/ppc64/kernel/lparcfg.c
@@ -569,7 +569,7 @@ struct file_operations lparcfg_fops = {
569int __init lparcfg_init(void) 569int __init lparcfg_init(void)
570{ 570{
571 struct proc_dir_entry *ent; 571 struct proc_dir_entry *ent;
572 mode_t mode = S_IRUSR; 572 mode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
573 573
574 /* Allow writing if we have FW_FEATURE_SPLPAR */ 574 /* Allow writing if we have FW_FEATURE_SPLPAR */
575 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 575 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
diff --git a/arch/ppc64/kernel/maple_setup.c b/arch/ppc64/kernel/maple_setup.c
index bb55b5a56910..fc0567498a3a 100644
--- a/arch/ppc64/kernel/maple_setup.c
+++ b/arch/ppc64/kernel/maple_setup.c
@@ -207,9 +207,6 @@ static void __init maple_init_early(void)
207 comport = (void *)ioremap(physport, 16); 207 comport = (void *)ioremap(physport, 16);
208 udbg_init_uart(comport, default_speed); 208 udbg_init_uart(comport, default_speed);
209 209
210 ppc_md.udbg_putc = udbg_putc;
211 ppc_md.udbg_getc = udbg_getc;
212 ppc_md.udbg_getc_poll = udbg_getc_poll;
213 DBG("Hello World !\n"); 210 DBG("Hello World !\n");
214 } 211 }
215 212
diff --git a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
index 474df0a862bf..6d860c1d9fa0 100644
--- a/arch/ppc64/kernel/misc.S
+++ b/arch/ppc64/kernel/misc.S
@@ -183,7 +183,7 @@ PPC64_CACHES:
183 * flush all bytes from start through stop-1 inclusive 183 * flush all bytes from start through stop-1 inclusive
184 */ 184 */
185 185
186_GLOBAL(__flush_icache_range) 186_KPROBE(__flush_icache_range)
187 187
188/* 188/*
189 * Flush the data cache to memory 189 * Flush the data cache to memory
@@ -223,7 +223,7 @@ _GLOBAL(__flush_icache_range)
223 bdnz 2b 223 bdnz 2b
224 isync 224 isync
225 blr 225 blr
226 226 .previous .text
227/* 227/*
228 * Like above, but only do the D-cache. 228 * Like above, but only do the D-cache.
229 * 229 *
@@ -957,7 +957,7 @@ _GLOBAL(sys_call_table32)
957 .llong .ppc_fork 957 .llong .ppc_fork
958 .llong .sys_read 958 .llong .sys_read
959 .llong .sys_write 959 .llong .sys_write
960 .llong .sys32_open /* 5 */ 960 .llong .compat_sys_open /* 5 */
961 .llong .sys_close 961 .llong .sys_close
962 .llong .sys32_waitpid 962 .llong .sys32_waitpid
963 .llong .sys32_creat 963 .llong .sys32_creat
diff --git a/arch/ppc64/kernel/pSeries_lpar.c b/arch/ppc64/kernel/pSeries_lpar.c
index 0a3ddc9227c5..a6de83f2078f 100644
--- a/arch/ppc64/kernel/pSeries_lpar.c
+++ b/arch/ppc64/kernel/pSeries_lpar.c
@@ -192,9 +192,9 @@ static unsigned char udbg_getcLP(void)
192void udbg_init_debug_lpar(void) 192void udbg_init_debug_lpar(void)
193{ 193{
194 vtermno = 0; 194 vtermno = 0;
195 ppc_md.udbg_putc = udbg_putcLP; 195 udbg_putc = udbg_putcLP;
196 ppc_md.udbg_getc = udbg_getcLP; 196 udbg_getc = udbg_getcLP;
197 ppc_md.udbg_getc_poll = udbg_getc_pollLP; 197 udbg_getc_poll = udbg_getc_pollLP;
198} 198}
199 199
200/* returns 0 if couldn't find or use /chosen/stdout as console */ 200/* returns 0 if couldn't find or use /chosen/stdout as console */
@@ -227,18 +227,18 @@ int find_udbg_vterm(void)
227 termno = (u32 *)get_property(stdout_node, "reg", NULL); 227 termno = (u32 *)get_property(stdout_node, "reg", NULL);
228 if (termno) { 228 if (termno) {
229 vtermno = termno[0]; 229 vtermno = termno[0];
230 ppc_md.udbg_putc = udbg_putcLP; 230 udbg_putc = udbg_putcLP;
231 ppc_md.udbg_getc = udbg_getcLP; 231 udbg_getc = udbg_getcLP;
232 ppc_md.udbg_getc_poll = udbg_getc_pollLP; 232 udbg_getc_poll = udbg_getc_pollLP;
233 found = 1; 233 found = 1;
234 } 234 }
235 } else if (device_is_compatible(stdout_node, "hvterm-protocol")) { 235 } else if (device_is_compatible(stdout_node, "hvterm-protocol")) {
236 termno = (u32 *)get_property(stdout_node, "reg", NULL); 236 termno = (u32 *)get_property(stdout_node, "reg", NULL);
237 if (termno) { 237 if (termno) {
238 vtermno = termno[0]; 238 vtermno = termno[0];
239 ppc_md.udbg_putc = udbg_hvsi_putc; 239 udbg_putc = udbg_hvsi_putc;
240 ppc_md.udbg_getc = udbg_hvsi_getc; 240 udbg_getc = udbg_hvsi_getc;
241 ppc_md.udbg_getc_poll = udbg_hvsi_getc_poll; 241 udbg_getc_poll = udbg_hvsi_getc_poll;
242 found = 1; 242 found = 1;
243 } 243 }
244 } 244 }
@@ -266,6 +266,10 @@ void vpa_init(int cpu)
266 266
267 /* Register the Virtual Processor Area (VPA) */ 267 /* Register the Virtual Processor Area (VPA) */
268 flags = 1UL << (63 - 18); 268 flags = 1UL << (63 - 18);
269
270 if (cpu_has_feature(CPU_FTR_ALTIVEC))
271 paca[cpu].lppaca.vmxregs_in_use = 1;
272
269 ret = register_vpa(flags, hwcpu, __pa(vpa)); 273 ret = register_vpa(flags, hwcpu, __pa(vpa));
270 274
271 if (ret) 275 if (ret)
diff --git a/arch/ppc64/kernel/pSeries_reconfig.c b/arch/ppc64/kernel/pSeries_reconfig.c
index dc2a69d412a2..58c61219d08e 100644
--- a/arch/ppc64/kernel/pSeries_reconfig.c
+++ b/arch/ppc64/kernel/pSeries_reconfig.c
@@ -111,7 +111,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
111 struct device_node *np; 111 struct device_node *np;
112 int err = -ENOMEM; 112 int err = -ENOMEM;
113 113
114 np = kcalloc(1, sizeof(*np), GFP_KERNEL); 114 np = kzalloc(sizeof(*np), GFP_KERNEL);
115 if (!np) 115 if (!np)
116 goto out_err; 116 goto out_err;
117 117
diff --git a/arch/ppc64/kernel/pSeries_setup.c b/arch/ppc64/kernel/pSeries_setup.c
index f0f0630cf07c..9490b6c5b173 100644
--- a/arch/ppc64/kernel/pSeries_setup.c
+++ b/arch/ppc64/kernel/pSeries_setup.c
@@ -37,7 +37,7 @@
37#include <linux/ioport.h> 37#include <linux/ioport.h>
38#include <linux/console.h> 38#include <linux/console.h>
39#include <linux/pci.h> 39#include <linux/pci.h>
40#include <linux/version.h> 40#include <linux/utsname.h>
41#include <linux/adb.h> 41#include <linux/adb.h>
42#include <linux/module.h> 42#include <linux/module.h>
43#include <linux/delay.h> 43#include <linux/delay.h>
@@ -272,7 +272,7 @@ static int __init pSeries_init_panel(void)
272{ 272{
273 /* Manually leave the kernel version on the panel. */ 273 /* Manually leave the kernel version on the panel. */
274 ppc_md.progress("Linux ppc64\n", 0); 274 ppc_md.progress("Linux ppc64\n", 0);
275 ppc_md.progress(UTS_RELEASE, 0); 275 ppc_md.progress(system_utsname.version, 0);
276 276
277 return 0; 277 return 0;
278} 278}
@@ -397,9 +397,6 @@ static void __init pSeries_init_early(void)
397 comport = (void *)ioremap(physport, 16); 397 comport = (void *)ioremap(physport, 16);
398 udbg_init_uart(comport, default_speed); 398 udbg_init_uart(comport, default_speed);
399 399
400 ppc_md.udbg_putc = udbg_putc;
401 ppc_md.udbg_getc = udbg_getc;
402 ppc_md.udbg_getc_poll = udbg_getc_poll;
403 DBG("Hello World !\n"); 400 DBG("Hello World !\n");
404 } 401 }
405 402
diff --git a/arch/ppc64/kernel/pacaData.c b/arch/ppc64/kernel/pacaData.c
index 6182a2cd90a5..33a2d8db3f21 100644
--- a/arch/ppc64/kernel/pacaData.c
+++ b/arch/ppc64/kernel/pacaData.c
@@ -59,6 +59,7 @@ extern unsigned long __toc_start;
59 .fpregs_in_use = 1, \ 59 .fpregs_in_use = 1, \
60 .end_of_quantum = 0xfffffffffffffffful, \ 60 .end_of_quantum = 0xfffffffffffffffful, \
61 .slb_count = 64, \ 61 .slb_count = 64, \
62 .vmxregs_in_use = 0, \
62 }, \ 63 }, \
63 64
64#ifdef CONFIG_PPC_ISERIES 65#ifdef CONFIG_PPC_ISERIES
diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c
index 8ff86a766cdf..e7f695dcd8c8 100644
--- a/arch/ppc64/kernel/pmac_setup.c
+++ b/arch/ppc64/kernel/pmac_setup.c
@@ -274,16 +274,6 @@ static void __pmac pmac_halt(void)
274} 274}
275 275
276#ifdef CONFIG_BOOTX_TEXT 276#ifdef CONFIG_BOOTX_TEXT
277static int dummy_getc_poll(void)
278{
279 return -1;
280}
281
282static unsigned char dummy_getc(void)
283{
284 return 0;
285}
286
287static void btext_putc(unsigned char c) 277static void btext_putc(unsigned char c)
288{ 278{
289 btext_drawchar(c); 279 btext_drawchar(c);
@@ -342,16 +332,13 @@ static void __init pmac_init_early(void)
342 sccdbg = 1; 332 sccdbg = 1;
343 udbg_init_scc(NULL); 333 udbg_init_scc(NULL);
344 } 334 }
345
346 else {
347#ifdef CONFIG_BOOTX_TEXT 335#ifdef CONFIG_BOOTX_TEXT
336 else {
348 init_boot_display(); 337 init_boot_display();
349 338
350 ppc_md.udbg_putc = btext_putc; 339 udbg_putc = btext_putc;
351 ppc_md.udbg_getc = dummy_getc;
352 ppc_md.udbg_getc_poll = dummy_getc_poll;
353#endif /* CONFIG_BOOTX_TEXT */
354 } 340 }
341#endif /* CONFIG_BOOTX_TEXT */
355 342
356 /* Setup interrupt mapping options */ 343 /* Setup interrupt mapping options */
357 ppc64_interrupt_controller = IC_OPEN_PIC; 344 ppc64_interrupt_controller = IC_OPEN_PIC;
diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
index b21848826791..6ad5a8467f87 100644
--- a/arch/ppc64/kernel/prom.c
+++ b/arch/ppc64/kernel/prom.c
@@ -22,7 +22,6 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/string.h> 23#include <linux/string.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/version.h>
26#include <linux/threads.h> 25#include <linux/threads.h>
27#include <linux/spinlock.h> 26#include <linux/spinlock.h>
28#include <linux/types.h> 27#include <linux/types.h>
diff --git a/arch/ppc64/kernel/prom_init.c b/arch/ppc64/kernel/prom_init.c
index 122283a1d39a..9979919cdf92 100644
--- a/arch/ppc64/kernel/prom_init.c
+++ b/arch/ppc64/kernel/prom_init.c
@@ -22,7 +22,6 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/string.h> 23#include <linux/string.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/version.h>
26#include <linux/threads.h> 25#include <linux/threads.h>
27#include <linux/spinlock.h> 26#include <linux/spinlock.h>
28#include <linux/types.h> 27#include <linux/types.h>
diff --git a/arch/ppc64/kernel/rtasd.c b/arch/ppc64/kernel/rtasd.c
index b0c3b829fe47..e26b0420b6dd 100644
--- a/arch/ppc64/kernel/rtasd.c
+++ b/arch/ppc64/kernel/rtasd.c
@@ -19,6 +19,7 @@
19#include <linux/vmalloc.h> 19#include <linux/vmalloc.h>
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/cpu.h> 21#include <linux/cpu.h>
22#include <linux/delay.h>
22 23
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24#include <asm/io.h> 25#include <asm/io.h>
@@ -412,8 +413,7 @@ static void do_event_scan_all_cpus(long delay)
412 413
413 /* Drop hotplug lock, and sleep for the specified delay */ 414 /* Drop hotplug lock, and sleep for the specified delay */
414 unlock_cpu_hotplug(); 415 unlock_cpu_hotplug();
415 set_current_state(TASK_INTERRUPTIBLE); 416 msleep_interruptible(delay);
416 schedule_timeout(delay);
417 lock_cpu_hotplug(); 417 lock_cpu_hotplug();
418 418
419 cpu = next_cpu(cpu, cpu_online_map); 419 cpu = next_cpu(cpu, cpu_online_map);
@@ -442,7 +442,7 @@ static int rtasd(void *unused)
442 442
443 printk(KERN_INFO "RTAS daemon started\n"); 443 printk(KERN_INFO "RTAS daemon started\n");
444 444
445 DEBUG("will sleep for %d jiffies\n", (HZ*60/rtas_event_scan_rate) / 2); 445 DEBUG("will sleep for %d milliseconds\n", (30000/rtas_event_scan_rate));
446 446
447 /* See if we have any error stored in NVRAM */ 447 /* See if we have any error stored in NVRAM */
448 memset(logdata, 0, rtas_error_log_max); 448 memset(logdata, 0, rtas_error_log_max);
@@ -459,7 +459,7 @@ static int rtasd(void *unused)
459 } 459 }
460 460
461 /* First pass. */ 461 /* First pass. */
462 do_event_scan_all_cpus(HZ); 462 do_event_scan_all_cpus(1000);
463 463
464 if (surveillance_timeout != -1) { 464 if (surveillance_timeout != -1) {
465 DEBUG("enabling surveillance\n"); 465 DEBUG("enabling surveillance\n");
@@ -471,7 +471,7 @@ static int rtasd(void *unused)
471 * machines have problems if we call event-scan too 471 * machines have problems if we call event-scan too
472 * quickly. */ 472 * quickly. */
473 for (;;) 473 for (;;)
474 do_event_scan_all_cpus((HZ*60/rtas_event_scan_rate) / 2); 474 do_event_scan_all_cpus(30000/rtas_event_scan_rate);
475 475
476error: 476error:
477 /* Should delete proc entries */ 477 /* Should delete proc entries */
diff --git a/arch/ppc64/kernel/rtc.c b/arch/ppc64/kernel/rtc.c
index d729fefa0df5..6ff52bc61325 100644
--- a/arch/ppc64/kernel/rtc.c
+++ b/arch/ppc64/kernel/rtc.c
@@ -35,6 +35,7 @@
35#include <linux/spinlock.h> 35#include <linux/spinlock.h>
36#include <linux/bcd.h> 36#include <linux/bcd.h>
37#include <linux/interrupt.h> 37#include <linux/interrupt.h>
38#include <linux/delay.h>
38 39
39#include <asm/io.h> 40#include <asm/io.h>
40#include <asm/uaccess.h> 41#include <asm/uaccess.h>
@@ -351,8 +352,7 @@ void rtas_get_rtc_time(struct rtc_time *rtc_tm)
351 return; /* delay not allowed */ 352 return; /* delay not allowed */
352 } 353 }
353 wait_time = rtas_extended_busy_delay_time(error); 354 wait_time = rtas_extended_busy_delay_time(error);
354 set_current_state(TASK_INTERRUPTIBLE); 355 msleep_interruptible(wait_time);
355 schedule_timeout(wait_time);
356 error = RTAS_CLOCK_BUSY; 356 error = RTAS_CLOCK_BUSY;
357 } 357 }
358 } while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb)); 358 } while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb));
@@ -386,8 +386,7 @@ int rtas_set_rtc_time(struct rtc_time *tm)
386 if (in_interrupt()) 386 if (in_interrupt())
387 return 1; /* probably decrementer */ 387 return 1; /* probably decrementer */
388 wait_time = rtas_extended_busy_delay_time(error); 388 wait_time = rtas_extended_busy_delay_time(error);
389 set_current_state(TASK_INTERRUPTIBLE); 389 msleep_interruptible(wait_time);
390 schedule_timeout(wait_time);
391 error = RTAS_CLOCK_BUSY; 390 error = RTAS_CLOCK_BUSY;
392 } 391 }
393 } while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb)); 392 } while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb));
diff --git a/arch/ppc64/kernel/scanlog.c b/arch/ppc64/kernel/scanlog.c
index 4d70736619c7..215bf8900304 100644
--- a/arch/ppc64/kernel/scanlog.c
+++ b/arch/ppc64/kernel/scanlog.c
@@ -25,6 +25,7 @@
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/proc_fs.h> 26#include <linux/proc_fs.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/delay.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <asm/rtas.h> 30#include <asm/rtas.h>
30#include <asm/prom.h> 31#include <asm/prom.h>
@@ -77,7 +78,7 @@ static ssize_t scanlog_read(struct file *file, char __user *buf,
77 return -EFAULT; 78 return -EFAULT;
78 79
79 for (;;) { 80 for (;;) {
80 wait_time = HZ/2; /* default wait if no data */ 81 wait_time = 500; /* default wait if no data */
81 spin_lock(&rtas_data_buf_lock); 82 spin_lock(&rtas_data_buf_lock);
82 memcpy(rtas_data_buf, data, RTAS_DATA_BUF_SIZE); 83 memcpy(rtas_data_buf, data, RTAS_DATA_BUF_SIZE);
83 status = rtas_call(ibm_scan_log_dump, 2, 1, NULL, 84 status = rtas_call(ibm_scan_log_dump, 2, 1, NULL,
@@ -107,24 +108,14 @@ static ssize_t scanlog_read(struct file *file, char __user *buf,
107 break; 108 break;
108 default: 109 default:
109 if (status > 9900 && status <= 9905) { 110 if (status > 9900 && status <= 9905) {
110 /* No data. RTAS is hinting at a delay required 111 wait_time = rtas_extended_busy_delay_time(status);
111 * between 1-100000 milliseconds
112 */
113 int ms = 1;
114 for (; status > 9900; status--)
115 ms = ms * 10;
116 /* Use microseconds for reasonable accuracy */
117 ms *= 1000;
118 wait_time = ms / (1000000/HZ); /* round down is fine */
119 /* Fall through to sleep */
120 } else { 112 } else {
121 printk(KERN_ERR "scanlog: unknown error from rtas: %d\n", status); 113 printk(KERN_ERR "scanlog: unknown error from rtas: %d\n", status);
122 return -EIO; 114 return -EIO;
123 } 115 }
124 } 116 }
125 /* Apparently no data yet. Wait and try again. */ 117 /* Apparently no data yet. Wait and try again. */
126 set_current_state(TASK_INTERRUPTIBLE); 118 msleep_interruptible(wait_time);
127 schedule_timeout(wait_time);
128 } 119 }
129 /*NOTREACHED*/ 120 /*NOTREACHED*/
130} 121}
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
index ee3b20de2e7a..d0bb68af0ea4 100644
--- a/arch/ppc64/kernel/setup.c
+++ b/arch/ppc64/kernel/setup.c
@@ -25,7 +25,7 @@
25#include <linux/seq_file.h> 25#include <linux/seq_file.h>
26#include <linux/ioport.h> 26#include <linux/ioport.h>
27#include <linux/console.h> 27#include <linux/console.h>
28#include <linux/version.h> 28#include <linux/utsname.h>
29#include <linux/tty.h> 29#include <linux/tty.h>
30#include <linux/root_dev.h> 30#include <linux/root_dev.h>
31#include <linux/notifier.h> 31#include <linux/notifier.h>
@@ -89,7 +89,7 @@ extern void udbg_init_maple_realmode(void);
89#define EARLY_DEBUG_INIT() udbg_init_maple_realmode() 89#define EARLY_DEBUG_INIT() udbg_init_maple_realmode()
90#define EARLY_DEBUG_INIT() udbg_init_pmac_realmode() 90#define EARLY_DEBUG_INIT() udbg_init_pmac_realmode()
91#define EARLY_DEBUG_INIT() \ 91#define EARLY_DEBUG_INIT() \
92 do { ppc_md.udbg_putc = call_rtas_display_status_delay; } while(0) 92 do { udbg_putc = call_rtas_display_status_delay; } while(0)
93#endif 93#endif
94 94
95/* extern void *stab; */ 95/* extern void *stab; */
@@ -108,7 +108,6 @@ int boot_cpuid = 0;
108int boot_cpuid_phys = 0; 108int boot_cpuid_phys = 0;
109dev_t boot_dev; 109dev_t boot_dev;
110u64 ppc64_pft_size; 110u64 ppc64_pft_size;
111u64 ppc64_debug_switch;
112 111
113struct ppc64_caches ppc64_caches; 112struct ppc64_caches ppc64_caches;
114EXPORT_SYMBOL_GPL(ppc64_caches); 113EXPORT_SYMBOL_GPL(ppc64_caches);
@@ -154,34 +153,6 @@ struct screen_info screen_info = {
154 .orig_video_points = 16 153 .orig_video_points = 16
155}; 154};
156 155
157/*
158 * Initialize the PPCDBG state. Called before relocation has been enabled.
159 */
160void __init ppcdbg_initialize(void)
161{
162 ppc64_debug_switch = PPC_DEBUG_DEFAULT; /* | PPCDBG_BUSWALK | */
163 /* PPCDBG_PHBINIT | PPCDBG_MM | PPCDBG_MMINIT | PPCDBG_TCEINIT | PPCDBG_TCE */;
164}
165
166/*
167 * Early boot console based on udbg
168 */
169static struct console udbg_console = {
170 .name = "udbg",
171 .write = udbg_console_write,
172 .flags = CON_PRINTBUFFER,
173 .index = -1,
174};
175static int early_console_initialized;
176
177void __init disable_early_printk(void)
178{
179 if (!early_console_initialized)
180 return;
181 unregister_console(&udbg_console);
182 early_console_initialized = 0;
183}
184
185#if defined(CONFIG_PPC_MULTIPLATFORM) && defined(CONFIG_SMP) 156#if defined(CONFIG_PPC_MULTIPLATFORM) && defined(CONFIG_SMP)
186 157
187static int smt_enabled_cmdline; 158static int smt_enabled_cmdline;
@@ -425,12 +396,6 @@ void __init early_setup(unsigned long dt_ptr)
425 } 396 }
426 ppc_md = **mach; 397 ppc_md = **mach;
427 398
428 /* our udbg callbacks got overriden by the above, let's put them
429 * back in. Ultimately, I want those things to be split from the
430 * main ppc_md
431 */
432 EARLY_DEBUG_INIT();
433
434 DBG("Found, Initializing memory management...\n"); 399 DBG("Found, Initializing memory management...\n");
435 400
436 /* 401 /*
@@ -636,8 +601,7 @@ void __init setup_system(void)
636 /* 601 /*
637 * Register early console 602 * Register early console
638 */ 603 */
639 early_console_initialized = 1; 604 register_early_udbg_console();
640 register_console(&udbg_console);
641 605
642 /* Save unparsed command line copy for /proc/cmdline */ 606 /* Save unparsed command line copy for /proc/cmdline */
643 strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); 607 strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
@@ -657,7 +621,7 @@ void __init setup_system(void)
657 smp_release_cpus(); 621 smp_release_cpus();
658#endif /* defined(CONFIG_SMP) && !defined(CONFIG_PPC_ISERIES) */ 622#endif /* defined(CONFIG_SMP) && !defined(CONFIG_PPC_ISERIES) */
659 623
660 printk("Starting Linux PPC64 %s\n", UTS_RELEASE); 624 printk("Starting Linux PPC64 %s\n", system_utsname.version);
661 625
662 printk("-----------------------------------------------------\n"); 626 printk("-----------------------------------------------------\n");
663 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); 627 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size);
diff --git a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
index 206619080e66..214914a95a50 100644
--- a/arch/ppc64/kernel/sys_ppc32.c
+++ b/arch/ppc64/kernel/sys_ppc32.c
@@ -867,37 +867,6 @@ off_t ppc32_lseek(unsigned int fd, u32 offset, unsigned int origin)
867 return sys_lseek(fd, (int)offset, origin); 867 return sys_lseek(fd, (int)offset, origin);
868} 868}
869 869
870/*
871 * This is just a version for 32-bit applications which does
872 * not force O_LARGEFILE on.
873 */
874asmlinkage long sys32_open(const char __user * filename, int flags, int mode)
875{
876 char * tmp;
877 int fd, error;
878
879 tmp = getname(filename);
880 fd = PTR_ERR(tmp);
881 if (!IS_ERR(tmp)) {
882 fd = get_unused_fd();
883 if (fd >= 0) {
884 struct file * f = filp_open(tmp, flags, mode);
885 error = PTR_ERR(f);
886 if (IS_ERR(f))
887 goto out_error;
888 fd_install(fd, f);
889 }
890out:
891 putname(tmp);
892 }
893 return fd;
894
895out_error:
896 put_unused_fd(fd);
897 fd = error;
898 goto out;
899}
900
901/* Note: it is necessary to treat bufsiz as an unsigned int, 870/* Note: it is necessary to treat bufsiz as an unsigned int,
902 * with the corresponding cast to a signed int to insure that the 871 * with the corresponding cast to a signed int to insure that the
903 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 872 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
diff --git a/arch/ppc64/kernel/sysfs.c b/arch/ppc64/kernel/sysfs.c
index f311ee7c0070..6654b350979c 100644
--- a/arch/ppc64/kernel/sysfs.c
+++ b/arch/ppc64/kernel/sysfs.c
@@ -215,18 +215,23 @@ static void register_cpu_online(unsigned int cpu)
215 if (cpu_has_feature(CPU_FTR_MMCRA)) 215 if (cpu_has_feature(CPU_FTR_MMCRA))
216 sysdev_create_file(s, &attr_mmcra); 216 sysdev_create_file(s, &attr_mmcra);
217 217
218 sysdev_create_file(s, &attr_pmc1); 218 if (cur_cpu_spec->num_pmcs >= 1)
219 sysdev_create_file(s, &attr_pmc2); 219 sysdev_create_file(s, &attr_pmc1);
220 sysdev_create_file(s, &attr_pmc3); 220 if (cur_cpu_spec->num_pmcs >= 2)
221 sysdev_create_file(s, &attr_pmc4); 221 sysdev_create_file(s, &attr_pmc2);
222 sysdev_create_file(s, &attr_pmc5); 222 if (cur_cpu_spec->num_pmcs >= 3)
223 sysdev_create_file(s, &attr_pmc6); 223 sysdev_create_file(s, &attr_pmc3);
224 224 if (cur_cpu_spec->num_pmcs >= 4)
225 if (cpu_has_feature(CPU_FTR_PMC8)) { 225 sysdev_create_file(s, &attr_pmc4);
226 if (cur_cpu_spec->num_pmcs >= 5)
227 sysdev_create_file(s, &attr_pmc5);
228 if (cur_cpu_spec->num_pmcs >= 6)
229 sysdev_create_file(s, &attr_pmc6);
230 if (cur_cpu_spec->num_pmcs >= 7)
226 sysdev_create_file(s, &attr_pmc7); 231 sysdev_create_file(s, &attr_pmc7);
232 if (cur_cpu_spec->num_pmcs >= 8)
227 sysdev_create_file(s, &attr_pmc8); 233 sysdev_create_file(s, &attr_pmc8);
228 } 234
229
230 if (cpu_has_feature(CPU_FTR_SMT)) 235 if (cpu_has_feature(CPU_FTR_SMT))
231 sysdev_create_file(s, &attr_purr); 236 sysdev_create_file(s, &attr_purr);
232} 237}
@@ -252,17 +257,22 @@ static void unregister_cpu_online(unsigned int cpu)
252 if (cpu_has_feature(CPU_FTR_MMCRA)) 257 if (cpu_has_feature(CPU_FTR_MMCRA))
253 sysdev_remove_file(s, &attr_mmcra); 258 sysdev_remove_file(s, &attr_mmcra);
254 259
255 sysdev_remove_file(s, &attr_pmc1); 260 if (cur_cpu_spec->num_pmcs >= 1)
256 sysdev_remove_file(s, &attr_pmc2); 261 sysdev_remove_file(s, &attr_pmc1);
257 sysdev_remove_file(s, &attr_pmc3); 262 if (cur_cpu_spec->num_pmcs >= 2)
258 sysdev_remove_file(s, &attr_pmc4); 263 sysdev_remove_file(s, &attr_pmc2);
259 sysdev_remove_file(s, &attr_pmc5); 264 if (cur_cpu_spec->num_pmcs >= 3)
260 sysdev_remove_file(s, &attr_pmc6); 265 sysdev_remove_file(s, &attr_pmc3);
261 266 if (cur_cpu_spec->num_pmcs >= 4)
262 if (cpu_has_feature(CPU_FTR_PMC8)) { 267 sysdev_remove_file(s, &attr_pmc4);
268 if (cur_cpu_spec->num_pmcs >= 5)
269 sysdev_remove_file(s, &attr_pmc5);
270 if (cur_cpu_spec->num_pmcs >= 6)
271 sysdev_remove_file(s, &attr_pmc6);
272 if (cur_cpu_spec->num_pmcs >= 7)
263 sysdev_remove_file(s, &attr_pmc7); 273 sysdev_remove_file(s, &attr_pmc7);
274 if (cur_cpu_spec->num_pmcs >= 8)
264 sysdev_remove_file(s, &attr_pmc8); 275 sysdev_remove_file(s, &attr_pmc8);
265 }
266 276
267 if (cpu_has_feature(CPU_FTR_SMT)) 277 if (cpu_has_feature(CPU_FTR_SMT))
268 sysdev_remove_file(s, &attr_purr); 278 sysdev_remove_file(s, &attr_purr);
diff --git a/arch/ppc64/kernel/time.c b/arch/ppc64/kernel/time.c
index 1696e1b05bb9..9939c206afa4 100644
--- a/arch/ppc64/kernel/time.c
+++ b/arch/ppc64/kernel/time.c
@@ -51,7 +51,6 @@
51#include <linux/cpu.h> 51#include <linux/cpu.h>
52#include <linux/security.h> 52#include <linux/security.h>
53 53
54#include <asm/segment.h>
55#include <asm/io.h> 54#include <asm/io.h>
56#include <asm/processor.h> 55#include <asm/processor.h>
57#include <asm/nvram.h> 56#include <asm/nvram.h>
@@ -129,7 +128,7 @@ static __inline__ void timer_check_rtc(void)
129 * We should have an rtc call that only sets the minutes and 128 * We should have an rtc call that only sets the minutes and
130 * seconds like on Intel to avoid problems with non UTC clocks. 129 * seconds like on Intel to avoid problems with non UTC clocks.
131 */ 130 */
132 if ( (time_status & STA_UNSYNC) == 0 && 131 if (ntp_synced() &&
133 xtime.tv_sec - last_rtc_update >= 659 && 132 xtime.tv_sec - last_rtc_update >= 659 &&
134 abs((xtime.tv_nsec/1000) - (1000000-1000000/HZ)) < 500000/HZ && 133 abs((xtime.tv_nsec/1000) - (1000000-1000000/HZ)) < 500000/HZ &&
135 jiffies - wall_jiffies == 1) { 134 jiffies - wall_jiffies == 1) {
@@ -436,10 +435,7 @@ int do_settimeofday(struct timespec *tv)
436 */ 435 */
437 last_rtc_update = new_sec - 658; 436 last_rtc_update = new_sec - 658;
438 437
439 time_adjust = 0; /* stop active adjtime() */ 438 ntp_clear();
440 time_status |= STA_UNSYNC;
441 time_maxerror = NTP_PHASE_LIMIT;
442 time_esterror = NTP_PHASE_LIMIT;
443 439
444 delta_xsec = mulhdu( (tb_last_stamp-do_gtod.varp->tb_orig_stamp), 440 delta_xsec = mulhdu( (tb_last_stamp-do_gtod.varp->tb_orig_stamp),
445 do_gtod.varp->tb_to_xs ); 441 do_gtod.varp->tb_to_xs );
diff --git a/arch/ppc64/kernel/traps.c b/arch/ppc64/kernel/traps.c
index a8d5e83ee89f..7467ae508e6e 100644
--- a/arch/ppc64/kernel/traps.c
+++ b/arch/ppc64/kernel/traps.c
@@ -30,6 +30,7 @@
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/kprobes.h>
33#include <asm/kdebug.h> 34#include <asm/kdebug.h>
34 35
35#include <asm/pgtable.h> 36#include <asm/pgtable.h>
@@ -220,7 +221,7 @@ void instruction_breakpoint_exception(struct pt_regs *regs)
220 _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip); 221 _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
221} 222}
222 223
223void single_step_exception(struct pt_regs *regs) 224void __kprobes single_step_exception(struct pt_regs *regs)
224{ 225{
225 regs->msr &= ~MSR_SE; /* Turn off 'trace' bit */ 226 regs->msr &= ~MSR_SE; /* Turn off 'trace' bit */
226 227
@@ -398,7 +399,7 @@ check_bug_trap(struct pt_regs *regs)
398 return 0; 399 return 0;
399} 400}
400 401
401void program_check_exception(struct pt_regs *regs) 402void __kprobes program_check_exception(struct pt_regs *regs)
402{ 403{
403 if (debugger_fault_handler(regs)) 404 if (debugger_fault_handler(regs))
404 return; 405 return;
diff --git a/arch/ppc64/kernel/udbg.c b/arch/ppc64/kernel/udbg.c
index c0da45540f0f..ed6766e21f5a 100644
--- a/arch/ppc64/kernel/udbg.c
+++ b/arch/ppc64/kernel/udbg.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * NS16550 Serial Port (uart) debugging stuff. 2 * polling mode stateless debugging stuff, originally for NS16550 Serial Ports
3 * 3 *
4 * c 2001 PPC 64 Team, IBM Corp 4 * c 2001 PPC 64 Team, IBM Corp
5 * 5 *
@@ -13,249 +13,24 @@
13#define WANT_PPCDBG_TAB /* Only defined here */ 13#define WANT_PPCDBG_TAB /* Only defined here */
14#include <linux/config.h> 14#include <linux/config.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/sched.h>
17#include <linux/console.h>
16#include <asm/ppcdebug.h> 18#include <asm/ppcdebug.h>
17#include <asm/processor.h> 19#include <asm/processor.h>
18#include <asm/uaccess.h>
19#include <asm/machdep.h>
20#include <asm/io.h>
21#include <asm/prom.h>
22#include <asm/pmac_feature.h>
23 20
24extern u8 real_readb(volatile u8 __iomem *addr); 21void (*udbg_putc)(unsigned char c);
25extern void real_writeb(u8 data, volatile u8 __iomem *addr); 22unsigned char (*udbg_getc)(void);
26 23int (*udbg_getc_poll)(void);
27struct NS16550 {
28 /* this struct must be packed */
29 unsigned char rbr; /* 0 */
30 unsigned char ier; /* 1 */
31 unsigned char fcr; /* 2 */
32 unsigned char lcr; /* 3 */
33 unsigned char mcr; /* 4 */
34 unsigned char lsr; /* 5 */
35 unsigned char msr; /* 6 */
36 unsigned char scr; /* 7 */
37};
38
39#define thr rbr
40#define iir fcr
41#define dll rbr
42#define dlm ier
43#define dlab lcr
44
45#define LSR_DR 0x01 /* Data ready */
46#define LSR_OE 0x02 /* Overrun */
47#define LSR_PE 0x04 /* Parity error */
48#define LSR_FE 0x08 /* Framing error */
49#define LSR_BI 0x10 /* Break */
50#define LSR_THRE 0x20 /* Xmit holding register empty */
51#define LSR_TEMT 0x40 /* Xmitter empty */
52#define LSR_ERR 0x80 /* Error */
53
54static volatile struct NS16550 __iomem *udbg_comport;
55
56void udbg_init_uart(void __iomem *comport, unsigned int speed)
57{
58 u16 dll = speed ? (115200 / speed) : 12;
59
60 if (comport) {
61 udbg_comport = (struct NS16550 __iomem *)comport;
62 out_8(&udbg_comport->lcr, 0x00);
63 out_8(&udbg_comport->ier, 0xff);
64 out_8(&udbg_comport->ier, 0x00);
65 out_8(&udbg_comport->lcr, 0x80); /* Access baud rate */
66 out_8(&udbg_comport->dll, dll & 0xff); /* 1 = 115200, 2 = 57600,
67 3 = 38400, 12 = 9600 baud */
68 out_8(&udbg_comport->dlm, dll >> 8); /* dll >> 8 which should be zero
69 for fast rates; */
70 out_8(&udbg_comport->lcr, 0x03); /* 8 data, 1 stop, no parity */
71 out_8(&udbg_comport->mcr, 0x03); /* RTS/DTR */
72 out_8(&udbg_comport->fcr ,0x07); /* Clear & enable FIFOs */
73 }
74}
75
76#ifdef CONFIG_PPC_PMAC
77
78#define SCC_TXRDY 4
79#define SCC_RXRDY 1
80
81static volatile u8 __iomem *sccc;
82static volatile u8 __iomem *sccd;
83
84static unsigned char scc_inittab[] = {
85 13, 0, /* set baud rate divisor */
86 12, 0,
87 14, 1, /* baud rate gen enable, src=rtxc */
88 11, 0x50, /* clocks = br gen */
89 5, 0xea, /* tx 8 bits, assert DTR & RTS */
90 4, 0x46, /* x16 clock, 1 stop */
91 3, 0xc1, /* rx enable, 8 bits */
92};
93
94void udbg_init_scc(struct device_node *np)
95{
96 u32 *reg;
97 unsigned long addr;
98 int i, x;
99
100 if (np == NULL)
101 np = of_find_node_by_name(NULL, "escc");
102 if (np == NULL || np->parent == NULL)
103 return;
104
105 udbg_printf("found SCC...\n");
106 /* Get address within mac-io ASIC */
107 reg = (u32 *)get_property(np, "reg", NULL);
108 if (reg == NULL)
109 return;
110 addr = reg[0];
111 udbg_printf("local addr: %lx\n", addr);
112 /* Get address of mac-io PCI itself */
113 reg = (u32 *)get_property(np->parent, "assigned-addresses", NULL);
114 if (reg == NULL)
115 return;
116 addr += reg[2];
117 udbg_printf("final addr: %lx\n", addr);
118
119 /* Setup for 57600 8N1 */
120 addr += 0x20;
121 sccc = (volatile u8 * __iomem) ioremap(addr & PAGE_MASK, PAGE_SIZE) ;
122 sccc += addr & ~PAGE_MASK;
123 sccd = sccc + 0x10;
124
125 udbg_printf("ioremap result sccc: %p\n", sccc);
126 mb();
127
128 for (i = 20000; i != 0; --i)
129 x = in_8(sccc);
130 out_8(sccc, 0x09); /* reset A or B side */
131 out_8(sccc, 0xc0);
132 for (i = 0; i < sizeof(scc_inittab); ++i)
133 out_8(sccc, scc_inittab[i]);
134
135 ppc_md.udbg_putc = udbg_putc;
136 ppc_md.udbg_getc = udbg_getc;
137 ppc_md.udbg_getc_poll = udbg_getc_poll;
138
139 udbg_puts("Hello World !\n");
140}
141
142#endif /* CONFIG_PPC_PMAC */
143
144#ifdef CONFIG_PPC_PMAC
145static void udbg_real_putc(unsigned char c)
146{
147 while ((real_readb(sccc) & SCC_TXRDY) == 0)
148 ;
149 real_writeb(c, sccd);
150 if (c == '\n')
151 udbg_real_putc('\r');
152}
153
154void udbg_init_pmac_realmode(void)
155{
156 sccc = (volatile u8 __iomem *)0x80013020ul;
157 sccd = (volatile u8 __iomem *)0x80013030ul;
158
159 ppc_md.udbg_putc = udbg_real_putc;
160 ppc_md.udbg_getc = NULL;
161 ppc_md.udbg_getc_poll = NULL;
162}
163#endif /* CONFIG_PPC_PMAC */
164
165#ifdef CONFIG_PPC_MAPLE
166void udbg_maple_real_putc(unsigned char c)
167{
168 if (udbg_comport) {
169 while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
170 /* wait for idle */;
171 real_writeb(c, &udbg_comport->thr); eieio();
172 if (c == '\n') {
173 /* Also put a CR. This is for convenience. */
174 while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
175 /* wait for idle */;
176 real_writeb('\r', &udbg_comport->thr); eieio();
177 }
178 }
179}
180
181void udbg_init_maple_realmode(void)
182{
183 udbg_comport = (volatile struct NS16550 __iomem *)0xf40003f8;
184
185 ppc_md.udbg_putc = udbg_maple_real_putc;
186 ppc_md.udbg_getc = NULL;
187 ppc_md.udbg_getc_poll = NULL;
188}
189#endif /* CONFIG_PPC_MAPLE */
190
191void udbg_putc(unsigned char c)
192{
193 if (udbg_comport) {
194 while ((in_8(&udbg_comport->lsr) & LSR_THRE) == 0)
195 /* wait for idle */;
196 out_8(&udbg_comport->thr, c);
197 if (c == '\n') {
198 /* Also put a CR. This is for convenience. */
199 while ((in_8(&udbg_comport->lsr) & LSR_THRE) == 0)
200 /* wait for idle */;
201 out_8(&udbg_comport->thr, '\r');
202 }
203 }
204#ifdef CONFIG_PPC_PMAC
205 else if (sccc) {
206 while ((in_8(sccc) & SCC_TXRDY) == 0)
207 ;
208 out_8(sccd, c);
209 if (c == '\n')
210 udbg_putc('\r');
211 }
212#endif /* CONFIG_PPC_PMAC */
213}
214
215int udbg_getc_poll(void)
216{
217 if (udbg_comport) {
218 if ((in_8(&udbg_comport->lsr) & LSR_DR) != 0)
219 return in_8(&udbg_comport->rbr);
220 else
221 return -1;
222 }
223#ifdef CONFIG_PPC_PMAC
224 else if (sccc) {
225 if ((in_8(sccc) & SCC_RXRDY) != 0)
226 return in_8(sccd);
227 else
228 return -1;
229 }
230#endif /* CONFIG_PPC_PMAC */
231 return -1;
232}
233
234unsigned char udbg_getc(void)
235{
236 if (udbg_comport) {
237 while ((in_8(&udbg_comport->lsr) & LSR_DR) == 0)
238 /* wait for char */;
239 return in_8(&udbg_comport->rbr);
240 }
241#ifdef CONFIG_PPC_PMAC
242 else if (sccc) {
243 while ((in_8(sccc) & SCC_RXRDY) == 0)
244 ;
245 return in_8(sccd);
246 }
247#endif /* CONFIG_PPC_PMAC */
248 return 0;
249}
250 24
25/* udbg library, used by xmon et al */
251void udbg_puts(const char *s) 26void udbg_puts(const char *s)
252{ 27{
253 if (ppc_md.udbg_putc) { 28 if (udbg_putc) {
254 char c; 29 char c;
255 30
256 if (s && *s != '\0') { 31 if (s && *s != '\0') {
257 while ((c = *s++) != '\0') 32 while ((c = *s++) != '\0')
258 ppc_md.udbg_putc(c); 33 udbg_putc(c);
259 } 34 }
260 } 35 }
261#if 0 36#if 0
@@ -270,12 +45,12 @@ int udbg_write(const char *s, int n)
270 int remain = n; 45 int remain = n;
271 char c; 46 char c;
272 47
273 if (!ppc_md.udbg_putc) 48 if (!udbg_putc)
274 return 0; 49 return 0;
275 50
276 if (s && *s != '\0') { 51 if (s && *s != '\0') {
277 while (((c = *s++) != '\0') && (remain-- > 0)) { 52 while (((c = *s++) != '\0') && (remain-- > 0)) {
278 ppc_md.udbg_putc(c); 53 udbg_putc(c);
279 } 54 }
280 } 55 }
281 56
@@ -287,12 +62,12 @@ int udbg_read(char *buf, int buflen)
287 char c, *p = buf; 62 char c, *p = buf;
288 int i; 63 int i;
289 64
290 if (!ppc_md.udbg_getc) 65 if (!udbg_getc)
291 return 0; 66 return 0;
292 67
293 for (i = 0; i < buflen; ++i) { 68 for (i = 0; i < buflen; ++i) {
294 do { 69 do {
295 c = ppc_md.udbg_getc(); 70 c = udbg_getc();
296 } while (c == 0x11 || c == 0x13); 71 } while (c == 0x11 || c == 0x13);
297 if (c == 0) 72 if (c == 0)
298 break; 73 break;
@@ -302,11 +77,6 @@ int udbg_read(char *buf, int buflen)
302 return i; 77 return i;
303} 78}
304 79
305void udbg_console_write(struct console *con, const char *s, unsigned int n)
306{
307 udbg_write(s, n);
308}
309
310#define UDBG_BUFSIZE 256 80#define UDBG_BUFSIZE 256
311void udbg_printf(const char *fmt, ...) 81void udbg_printf(const char *fmt, ...)
312{ 82{
@@ -319,6 +89,10 @@ void udbg_printf(const char *fmt, ...)
319 va_end(args); 89 va_end(args);
320} 90}
321 91
92/* PPCDBG stuff */
93
94u64 ppc64_debug_switch;
95
322/* Special print used by PPCDBG() macro */ 96/* Special print used by PPCDBG() macro */
323void udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...) 97void udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...)
324{ 98{
@@ -358,3 +132,43 @@ unsigned long udbg_ifdebug(unsigned long flags)
358{ 132{
359 return (flags & ppc64_debug_switch); 133 return (flags & ppc64_debug_switch);
360} 134}
135
136/*
137 * Initialize the PPCDBG state. Called before relocation has been enabled.
138 */
139void __init ppcdbg_initialize(void)
140{
141 ppc64_debug_switch = PPC_DEBUG_DEFAULT; /* | PPCDBG_BUSWALK | */
142 /* PPCDBG_PHBINIT | PPCDBG_MM | PPCDBG_MMINIT | PPCDBG_TCEINIT | PPCDBG_TCE */;
143}
144
145/*
146 * Early boot console based on udbg
147 */
148static void udbg_console_write(struct console *con, const char *s,
149 unsigned int n)
150{
151 udbg_write(s, n);
152}
153
154static struct console udbg_console = {
155 .name = "udbg",
156 .write = udbg_console_write,
157 .flags = CON_PRINTBUFFER,
158 .index = -1,
159};
160
161void __init disable_early_printk(void)
162{
163 unregister_console(&udbg_console);
164}
165
166/* called by setup_system */
167void register_early_udbg_console(void)
168{
169 register_console(&udbg_console);
170}
171
172#if 0 /* if you want to use this as a regular output console */
173console_initcall(register_udbg_console);
174#endif
diff --git a/arch/ppc64/kernel/udbg_16550.c b/arch/ppc64/kernel/udbg_16550.c
new file mode 100644
index 000000000000..9313574ab935
--- /dev/null
+++ b/arch/ppc64/kernel/udbg_16550.c
@@ -0,0 +1,123 @@
1/*
2 * udbg for for NS16550 compatable serial ports
3 *
4 * Copyright (C) 2001-2005 PPC 64 Team, IBM Corp
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#include <linux/config.h>
12#include <linux/types.h>
13#include <asm/udbg.h>
14#include <asm/io.h>
15
16extern u8 real_readb(volatile u8 __iomem *addr);
17extern void real_writeb(u8 data, volatile u8 __iomem *addr);
18
19struct NS16550 {
20 /* this struct must be packed */
21 unsigned char rbr; /* 0 */
22 unsigned char ier; /* 1 */
23 unsigned char fcr; /* 2 */
24 unsigned char lcr; /* 3 */
25 unsigned char mcr; /* 4 */
26 unsigned char lsr; /* 5 */
27 unsigned char msr; /* 6 */
28 unsigned char scr; /* 7 */
29};
30
31#define thr rbr
32#define iir fcr
33#define dll rbr
34#define dlm ier
35#define dlab lcr
36
37#define LSR_DR 0x01 /* Data ready */
38#define LSR_OE 0x02 /* Overrun */
39#define LSR_PE 0x04 /* Parity error */
40#define LSR_FE 0x08 /* Framing error */
41#define LSR_BI 0x10 /* Break */
42#define LSR_THRE 0x20 /* Xmit holding register empty */
43#define LSR_TEMT 0x40 /* Xmitter empty */
44#define LSR_ERR 0x80 /* Error */
45
46static volatile struct NS16550 __iomem *udbg_comport;
47
48static void udbg_550_putc(unsigned char c)
49{
50 if (udbg_comport) {
51 while ((in_8(&udbg_comport->lsr) & LSR_THRE) == 0)
52 /* wait for idle */;
53 out_8(&udbg_comport->thr, c);
54 if (c == '\n')
55 udbg_550_putc('\r');
56 }
57}
58
59static int udbg_550_getc_poll(void)
60{
61 if (udbg_comport) {
62 if ((in_8(&udbg_comport->lsr) & LSR_DR) != 0)
63 return in_8(&udbg_comport->rbr);
64 else
65 return -1;
66 }
67 return -1;
68}
69
70static unsigned char udbg_550_getc(void)
71{
72 if (udbg_comport) {
73 while ((in_8(&udbg_comport->lsr) & LSR_DR) == 0)
74 /* wait for char */;
75 return in_8(&udbg_comport->rbr);
76 }
77 return 0;
78}
79
80void udbg_init_uart(void __iomem *comport, unsigned int speed)
81{
82 u16 dll = speed ? (115200 / speed) : 12;
83
84 if (comport) {
85 udbg_comport = (struct NS16550 __iomem *)comport;
86 out_8(&udbg_comport->lcr, 0x00);
87 out_8(&udbg_comport->ier, 0xff);
88 out_8(&udbg_comport->ier, 0x00);
89 out_8(&udbg_comport->lcr, 0x80); /* Access baud rate */
90 out_8(&udbg_comport->dll, dll & 0xff); /* 1 = 115200, 2 = 57600,
91 3 = 38400, 12 = 9600 baud */
92 out_8(&udbg_comport->dlm, dll >> 8); /* dll >> 8 which should be zero
93 for fast rates; */
94 out_8(&udbg_comport->lcr, 0x03); /* 8 data, 1 stop, no parity */
95 out_8(&udbg_comport->mcr, 0x03); /* RTS/DTR */
96 out_8(&udbg_comport->fcr ,0x07); /* Clear & enable FIFOs */
97 udbg_putc = udbg_550_putc;
98 udbg_getc = udbg_550_getc;
99 udbg_getc_poll = udbg_550_getc_poll;
100 }
101}
102
103#ifdef CONFIG_PPC_MAPLE
104void udbg_maple_real_putc(unsigned char c)
105{
106 if (udbg_comport) {
107 while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
108 /* wait for idle */;
109 real_writeb(c, &udbg_comport->thr); eieio();
110 if (c == '\n')
111 udbg_maple_real_putc('\r');
112 }
113}
114
115void udbg_init_maple_realmode(void)
116{
117 udbg_comport = (volatile struct NS16550 __iomem *)0xf40003f8;
118
119 udbg_putc = udbg_maple_real_putc;
120 udbg_getc = NULL;
121 udbg_getc_poll = NULL;
122}
123#endif /* CONFIG_PPC_MAPLE */
diff --git a/arch/ppc64/kernel/udbg_scc.c b/arch/ppc64/kernel/udbg_scc.c
new file mode 100644
index 000000000000..c47fd6c63531
--- /dev/null
+++ b/arch/ppc64/kernel/udbg_scc.c
@@ -0,0 +1,136 @@
1/*
2 * udbg for for zilog scc ports as found on Apple PowerMacs
3 *
4 * Copyright (C) 2001-2005 PPC 64 Team, IBM Corp
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#include <linux/config.h>
12#include <linux/types.h>
13#include <asm/udbg.h>
14#include <asm/processor.h>
15#include <asm/naca.h>
16#include <asm/io.h>
17#include <asm/prom.h>
18#include <asm/pmac_feature.h>
19
20extern u8 real_readb(volatile u8 __iomem *addr);
21extern void real_writeb(u8 data, volatile u8 __iomem *addr);
22
23#define SCC_TXRDY 4
24#define SCC_RXRDY 1
25
26static volatile u8 __iomem *sccc;
27static volatile u8 __iomem *sccd;
28
29static void udbg_scc_putc(unsigned char c)
30{
31 if (sccc) {
32 while ((in_8(sccc) & SCC_TXRDY) == 0)
33 ;
34 out_8(sccd, c);
35 if (c == '\n')
36 udbg_scc_putc('\r');
37 }
38}
39
40static int udbg_scc_getc_poll(void)
41{
42 if (sccc) {
43 if ((in_8(sccc) & SCC_RXRDY) != 0)
44 return in_8(sccd);
45 else
46 return -1;
47 }
48 return -1;
49}
50
51static unsigned char udbg_scc_getc(void)
52{
53 if (sccc) {
54 while ((in_8(sccc) & SCC_RXRDY) == 0)
55 ;
56 return in_8(sccd);
57 }
58 return 0;
59}
60
61static unsigned char scc_inittab[] = {
62 13, 0, /* set baud rate divisor */
63 12, 0,
64 14, 1, /* baud rate gen enable, src=rtxc */
65 11, 0x50, /* clocks = br gen */
66 5, 0xea, /* tx 8 bits, assert DTR & RTS */
67 4, 0x46, /* x16 clock, 1 stop */
68 3, 0xc1, /* rx enable, 8 bits */
69};
70
71void udbg_init_scc(struct device_node *np)
72{
73 u32 *reg;
74 unsigned long addr;
75 int i, x;
76
77 if (np == NULL)
78 np = of_find_node_by_name(NULL, "escc");
79 if (np == NULL || np->parent == NULL)
80 return;
81
82 udbg_printf("found SCC...\n");
83 /* Get address within mac-io ASIC */
84 reg = (u32 *)get_property(np, "reg", NULL);
85 if (reg == NULL)
86 return;
87 addr = reg[0];
88 udbg_printf("local addr: %lx\n", addr);
89 /* Get address of mac-io PCI itself */
90 reg = (u32 *)get_property(np->parent, "assigned-addresses", NULL);
91 if (reg == NULL)
92 return;
93 addr += reg[2];
94 udbg_printf("final addr: %lx\n", addr);
95
96 /* Setup for 57600 8N1 */
97 addr += 0x20;
98 sccc = (volatile u8 * __iomem) ioremap(addr & PAGE_MASK, PAGE_SIZE) ;
99 sccc += addr & ~PAGE_MASK;
100 sccd = sccc + 0x10;
101
102 udbg_printf("ioremap result sccc: %p\n", sccc);
103 mb();
104
105 for (i = 20000; i != 0; --i)
106 x = in_8(sccc);
107 out_8(sccc, 0x09); /* reset A or B side */
108 out_8(sccc, 0xc0);
109 for (i = 0; i < sizeof(scc_inittab); ++i)
110 out_8(sccc, scc_inittab[i]);
111
112 udbg_putc = udbg_scc_putc;
113 udbg_getc = udbg_scc_getc;
114 udbg_getc_poll = udbg_scc_getc_poll;
115
116 udbg_puts("Hello World !\n");
117}
118
119static void udbg_real_scc_putc(unsigned char c)
120{
121 while ((real_readb(sccc) & SCC_TXRDY) == 0)
122 ;
123 real_writeb(c, sccd);
124 if (c == '\n')
125 udbg_real_scc_putc('\r');
126}
127
128void udbg_init_pmac_realmode(void)
129{
130 sccc = (volatile u8 __iomem *)0x80013020ul;
131 sccd = (volatile u8 __iomem *)0x80013030ul;
132
133 udbg_putc = udbg_real_scc_putc;
134 udbg_getc = NULL;
135 udbg_getc_poll = NULL;
136}
diff --git a/arch/ppc64/kernel/vmlinux.lds.S b/arch/ppc64/kernel/vmlinux.lds.S
index 4103cc13f8d6..0306510bc4ff 100644
--- a/arch/ppc64/kernel/vmlinux.lds.S
+++ b/arch/ppc64/kernel/vmlinux.lds.S
@@ -15,6 +15,7 @@ SECTIONS
15 *(.text .text.*) 15 *(.text .text.*)
16 SCHED_TEXT 16 SCHED_TEXT
17 LOCK_TEXT 17 LOCK_TEXT
18 KPROBES_TEXT
18 *(.fixup) 19 *(.fixup)
19 . = ALIGN(4096); 20 . = ALIGN(4096);
20 _etext = .; 21 _etext = .;
diff --git a/arch/ppc64/mm/fault.c b/arch/ppc64/mm/fault.c
index 20b0f37e8bf8..772f0714a5b7 100644
--- a/arch/ppc64/mm/fault.c
+++ b/arch/ppc64/mm/fault.c
@@ -29,6 +29,7 @@
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/smp_lock.h> 30#include <linux/smp_lock.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/kprobes.h>
32 33
33#include <asm/page.h> 34#include <asm/page.h>
34#include <asm/pgtable.h> 35#include <asm/pgtable.h>
@@ -84,8 +85,8 @@ static int store_updates_sp(struct pt_regs *regs)
84 * The return value is 0 if the fault was handled, or the signal 85 * The return value is 0 if the fault was handled, or the signal
85 * number if this is a kernel fault that can't be handled here. 86 * number if this is a kernel fault that can't be handled here.
86 */ 87 */
87int do_page_fault(struct pt_regs *regs, unsigned long address, 88int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
88 unsigned long error_code) 89 unsigned long error_code)
89{ 90{
90 struct vm_area_struct * vma; 91 struct vm_area_struct * vma;
91 struct mm_struct *mm = current->mm; 92 struct mm_struct *mm = current->mm;
diff --git a/arch/ppc64/mm/hugetlbpage.c b/arch/ppc64/mm/hugetlbpage.c
index e7833c80eb68..338771ec70d7 100644
--- a/arch/ppc64/mm/hugetlbpage.c
+++ b/arch/ppc64/mm/hugetlbpage.c
@@ -144,7 +144,8 @@ static void flush_low_segments(void *parm)
144 for (i = 0; i < NUM_LOW_AREAS; i++) { 144 for (i = 0; i < NUM_LOW_AREAS; i++) {
145 if (! (areas & (1U << i))) 145 if (! (areas & (1U << i)))
146 continue; 146 continue;
147 asm volatile("slbie %0" : : "r" (i << SID_SHIFT)); 147 asm volatile("slbie %0"
148 : : "r" ((i << SID_SHIFT) | SLBIE_C));
148 } 149 }
149 150
150 asm volatile("isync" : : : "memory"); 151 asm volatile("isync" : : : "memory");
@@ -164,7 +165,8 @@ static void flush_high_segments(void *parm)
164 continue; 165 continue;
165 for (j = 0; j < (1UL << (HTLB_AREA_SHIFT-SID_SHIFT)); j++) 166 for (j = 0; j < (1UL << (HTLB_AREA_SHIFT-SID_SHIFT)); j++)
166 asm volatile("slbie %0" 167 asm volatile("slbie %0"
167 :: "r" ((i << HTLB_AREA_SHIFT) + (j << SID_SHIFT))); 168 :: "r" (((i << HTLB_AREA_SHIFT)
169 + (j << SID_SHIFT)) | SLBIE_C));
168 } 170 }
169 171
170 asm volatile("isync" : : : "memory"); 172 asm volatile("isync" : : : "memory");
diff --git a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c
index c02dc9809ca5..a14ab87df491 100644
--- a/arch/ppc64/mm/init.c
+++ b/arch/ppc64/mm/init.c
@@ -392,6 +392,7 @@ void free_initmem(void)
392 392
393 addr = (unsigned long)__init_begin; 393 addr = (unsigned long)__init_begin;
394 for (; addr < (unsigned long)__init_end; addr += PAGE_SIZE) { 394 for (; addr < (unsigned long)__init_end; addr += PAGE_SIZE) {
395 memset((void *)addr, 0xcc, PAGE_SIZE);
395 ClearPageReserved(virt_to_page(addr)); 396 ClearPageReserved(virt_to_page(addr));
396 set_page_count(virt_to_page(addr), 1); 397 set_page_count(virt_to_page(addr), 1);
397 free_page(addr); 398 free_page(addr);
@@ -552,27 +553,18 @@ void __init do_init_bootmem(void)
552 /* Add all physical memory to the bootmem map, mark each area 553 /* Add all physical memory to the bootmem map, mark each area
553 * present. 554 * present.
554 */ 555 */
555 for (i=0; i < lmb.memory.cnt; i++) { 556 for (i=0; i < lmb.memory.cnt; i++)
556 unsigned long base, size; 557 free_bootmem(lmb_start_pfn(&lmb.memory, i),
557 unsigned long start_pfn, end_pfn; 558 lmb_size_bytes(&lmb.memory, i));
558
559 base = lmb.memory.region[i].base;
560 size = lmb.memory.region[i].size;
561
562 start_pfn = base >> PAGE_SHIFT;
563 end_pfn = start_pfn + (size >> PAGE_SHIFT);
564 memory_present(0, start_pfn, end_pfn);
565
566 free_bootmem(base, size);
567 }
568 559
569 /* reserve the sections we're already using */ 560 /* reserve the sections we're already using */
570 for (i=0; i < lmb.reserved.cnt; i++) { 561 for (i=0; i < lmb.reserved.cnt; i++)
571 unsigned long base = lmb.reserved.region[i].base; 562 reserve_bootmem(lmb_start_pfn(&lmb.reserved, i),
572 unsigned long size = lmb.reserved.region[i].size; 563 lmb_size_bytes(&lmb.reserved, i));
573 564
574 reserve_bootmem(base, size); 565 for (i=0; i < lmb.memory.cnt; i++)
575 } 566 memory_present(0, lmb_start_pfn(&lmb.memory, i),
567 lmb_end_pfn(&lmb.memory, i));
576} 568}
577 569
578/* 570/*
diff --git a/arch/ppc64/mm/numa.c b/arch/ppc64/mm/numa.c
index c3116f0d788c..cb864b8f2750 100644
--- a/arch/ppc64/mm/numa.c
+++ b/arch/ppc64/mm/numa.c
@@ -440,8 +440,6 @@ new_range:
440 for (i = start ; i < (start+size); i += MEMORY_INCREMENT) 440 for (i = start ; i < (start+size); i += MEMORY_INCREMENT)
441 numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = 441 numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] =
442 numa_domain; 442 numa_domain;
443 memory_present(numa_domain, start >> PAGE_SHIFT,
444 (start + size) >> PAGE_SHIFT);
445 443
446 if (--ranges) 444 if (--ranges)
447 goto new_range; 445 goto new_range;
@@ -483,7 +481,6 @@ static void __init setup_nonnuma(void)
483 481
484 for (i = 0 ; i < top_of_ram; i += MEMORY_INCREMENT) 482 for (i = 0 ; i < top_of_ram; i += MEMORY_INCREMENT)
485 numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = 0; 483 numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = 0;
486 memory_present(0, 0, init_node_data[0].node_end_pfn);
487} 484}
488 485
489static void __init dump_numa_topology(void) 486static void __init dump_numa_topology(void)
@@ -695,6 +692,46 @@ new_range:
695 size); 692 size);
696 } 693 }
697 } 694 }
695 /*
696 * This loop may look famaliar, but we have to do it again
697 * after marking our reserved memory to mark memory present
698 * for sparsemem.
699 */
700 addr_cells = get_mem_addr_cells();
701 size_cells = get_mem_size_cells();
702 memory = NULL;
703 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
704 unsigned long mem_start, mem_size;
705 int numa_domain, ranges;
706 unsigned int *memcell_buf;
707 unsigned int len;
708
709 memcell_buf = (unsigned int *)get_property(memory, "reg", &len);
710 if (!memcell_buf || len <= 0)
711 continue;
712
713 ranges = memory->n_addrs; /* ranges in cell */
714new_range2:
715 mem_start = read_n_cells(addr_cells, &memcell_buf);
716 mem_size = read_n_cells(size_cells, &memcell_buf);
717 if (numa_enabled) {
718 numa_domain = of_node_numa_domain(memory);
719 if (numa_domain >= MAX_NUMNODES)
720 numa_domain = 0;
721 } else
722 numa_domain = 0;
723
724 if (numa_domain != nid)
725 continue;
726
727 mem_size = numa_enforce_memory_limit(mem_start, mem_size);
728 memory_present(numa_domain, mem_start >> PAGE_SHIFT,
729 (mem_start + mem_size) >> PAGE_SHIFT);
730
731 if (--ranges) /* process all ranges in cell */
732 goto new_range2;
733 }
734
698 } 735 }
699} 736}
700 737
diff --git a/arch/ppc64/mm/slb.c b/arch/ppc64/mm/slb.c
index 244150a0bc18..0473953f6a37 100644
--- a/arch/ppc64/mm/slb.c
+++ b/arch/ppc64/mm/slb.c
@@ -87,8 +87,8 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
87 int i; 87 int i;
88 asm volatile("isync" : : : "memory"); 88 asm volatile("isync" : : : "memory");
89 for (i = 0; i < offset; i++) { 89 for (i = 0; i < offset; i++) {
90 esid_data = (unsigned long)get_paca()->slb_cache[i] 90 esid_data = ((unsigned long)get_paca()->slb_cache[i]
91 << SID_SHIFT; 91 << SID_SHIFT) | SLBIE_C;
92 asm volatile("slbie %0" : : "r" (esid_data)); 92 asm volatile("slbie %0" : : "r" (esid_data));
93 } 93 }
94 asm volatile("isync" : : : "memory"); 94 asm volatile("isync" : : : "memory");
diff --git a/arch/ppc64/oprofile/common.c b/arch/ppc64/oprofile/common.c
index 4acd1a424933..e5f572710aa0 100644
--- a/arch/ppc64/oprofile/common.c
+++ b/arch/ppc64/oprofile/common.c
@@ -16,11 +16,9 @@
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/system.h> 17#include <asm/system.h>
18#include <asm/pmc.h> 18#include <asm/pmc.h>
19#include <asm/cputable.h>
20#include <asm/oprofile_impl.h>
19 21
20#include "op_impl.h"
21
22extern struct op_ppc64_model op_model_rs64;
23extern struct op_ppc64_model op_model_power4;
24static struct op_ppc64_model *model; 22static struct op_ppc64_model *model;
25 23
26static struct op_counter_config ctr[OP_MAX_COUNTER]; 24static struct op_counter_config ctr[OP_MAX_COUNTER];
@@ -123,53 +121,13 @@ static int op_ppc64_create_files(struct super_block *sb, struct dentry *root)
123 121
124int __init oprofile_arch_init(struct oprofile_operations *ops) 122int __init oprofile_arch_init(struct oprofile_operations *ops)
125{ 123{
126 unsigned int pvr; 124 if (!cur_cpu_spec->oprofile_model || !cur_cpu_spec->oprofile_cpu_type)
127 125 return -ENODEV;
128 pvr = mfspr(SPRN_PVR); 126
129 127 model = cur_cpu_spec->oprofile_model;
130 switch (PVR_VER(pvr)) { 128 model->num_counters = cur_cpu_spec->num_pmcs;
131 case PV_630:
132 case PV_630p:
133 model = &op_model_rs64;
134 model->num_counters = 8;
135 ops->cpu_type = "ppc64/power3";
136 break;
137
138 case PV_NORTHSTAR:
139 case PV_PULSAR:
140 case PV_ICESTAR:
141 case PV_SSTAR:
142 model = &op_model_rs64;
143 model->num_counters = 8;
144 ops->cpu_type = "ppc64/rs64";
145 break;
146
147 case PV_POWER4:
148 case PV_POWER4p:
149 model = &op_model_power4;
150 model->num_counters = 8;
151 ops->cpu_type = "ppc64/power4";
152 break;
153
154 case PV_970:
155 case PV_970FX:
156 case PV_970MP:
157 model = &op_model_power4;
158 model->num_counters = 8;
159 ops->cpu_type = "ppc64/970";
160 break;
161
162 case PV_POWER5:
163 case PV_POWER5p:
164 model = &op_model_power4;
165 model->num_counters = 6;
166 ops->cpu_type = "ppc64/power5";
167 break;
168
169 default:
170 return -ENODEV;
171 }
172 129
130 ops->cpu_type = cur_cpu_spec->oprofile_cpu_type;
173 ops->create_files = op_ppc64_create_files; 131 ops->create_files = op_ppc64_create_files;
174 ops->setup = op_ppc64_setup; 132 ops->setup = op_ppc64_setup;
175 ops->shutdown = op_ppc64_shutdown; 133 ops->shutdown = op_ppc64_shutdown;
diff --git a/arch/ppc64/oprofile/op_impl.h b/arch/ppc64/oprofile/op_impl.h
deleted file mode 100644
index 7fa7eaabc035..000000000000
--- a/arch/ppc64/oprofile/op_impl.h
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
3 *
4 * Based on alpha version.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef OP_IMPL_H
13#define OP_IMPL_H 1
14
15#define OP_MAX_COUNTER 8
16
17/* Per-counter configuration as set via oprofilefs. */
18struct op_counter_config {
19 unsigned long valid;
20 unsigned long enabled;
21 unsigned long event;
22 unsigned long count;
23 unsigned long kernel;
24 /* We dont support per counter user/kernel selection */
25 unsigned long user;
26 unsigned long unit_mask;
27};
28
29/* System-wide configuration as set via oprofilefs. */
30struct op_system_config {
31 unsigned long mmcr0;
32 unsigned long mmcr1;
33 unsigned long mmcra;
34 unsigned long enable_kernel;
35 unsigned long enable_user;
36 unsigned long backtrace_spinlocks;
37};
38
39/* Per-arch configuration */
40struct op_ppc64_model {
41 void (*reg_setup) (struct op_counter_config *,
42 struct op_system_config *,
43 int num_counters);
44 void (*cpu_setup) (void *);
45 void (*start) (struct op_counter_config *);
46 void (*stop) (void);
47 void (*handle_interrupt) (struct pt_regs *,
48 struct op_counter_config *);
49 int num_counters;
50};
51
52static inline unsigned int ctr_read(unsigned int i)
53{
54 switch(i) {
55 case 0:
56 return mfspr(SPRN_PMC1);
57 case 1:
58 return mfspr(SPRN_PMC2);
59 case 2:
60 return mfspr(SPRN_PMC3);
61 case 3:
62 return mfspr(SPRN_PMC4);
63 case 4:
64 return mfspr(SPRN_PMC5);
65 case 5:
66 return mfspr(SPRN_PMC6);
67 case 6:
68 return mfspr(SPRN_PMC7);
69 case 7:
70 return mfspr(SPRN_PMC8);
71 default:
72 return 0;
73 }
74}
75
76static inline void ctr_write(unsigned int i, unsigned int val)
77{
78 switch(i) {
79 case 0:
80 mtspr(SPRN_PMC1, val);
81 break;
82 case 1:
83 mtspr(SPRN_PMC2, val);
84 break;
85 case 2:
86 mtspr(SPRN_PMC3, val);
87 break;
88 case 3:
89 mtspr(SPRN_PMC4, val);
90 break;
91 case 4:
92 mtspr(SPRN_PMC5, val);
93 break;
94 case 5:
95 mtspr(SPRN_PMC6, val);
96 break;
97 case 6:
98 mtspr(SPRN_PMC7, val);
99 break;
100 case 7:
101 mtspr(SPRN_PMC8, val);
102 break;
103 default:
104 break;
105 }
106}
107
108#endif
diff --git a/arch/ppc64/oprofile/op_model_power4.c b/arch/ppc64/oprofile/op_model_power4.c
index 3d103d66870d..32b2bb5625fe 100644
--- a/arch/ppc64/oprofile/op_model_power4.c
+++ b/arch/ppc64/oprofile/op_model_power4.c
@@ -16,14 +16,12 @@
16#include <asm/cputable.h> 16#include <asm/cputable.h>
17#include <asm/systemcfg.h> 17#include <asm/systemcfg.h>
18#include <asm/rtas.h> 18#include <asm/rtas.h>
19#include <asm/oprofile_impl.h>
19 20
20#define dbg(args...) 21#define dbg(args...)
21 22
22#include "op_impl.h"
23
24static unsigned long reset_value[OP_MAX_COUNTER]; 23static unsigned long reset_value[OP_MAX_COUNTER];
25 24
26static int num_counters;
27static int oprofile_running; 25static int oprofile_running;
28static int mmcra_has_sihv; 26static int mmcra_has_sihv;
29 27
@@ -45,8 +43,6 @@ static void power4_reg_setup(struct op_counter_config *ctr,
45{ 43{
46 int i; 44 int i;
47 45
48 num_counters = num_ctrs;
49
50 /* 46 /*
51 * SIHV / SIPR bits are only implemented on POWER4+ (GQ) and above. 47 * SIHV / SIPR bits are only implemented on POWER4+ (GQ) and above.
52 * However we disable it on all POWER4 until we verify it works 48 * However we disable it on all POWER4 until we verify it works
@@ -68,7 +64,7 @@ static void power4_reg_setup(struct op_counter_config *ctr,
68 64
69 backtrace_spinlocks = sys->backtrace_spinlocks; 65 backtrace_spinlocks = sys->backtrace_spinlocks;
70 66
71 for (i = 0; i < num_counters; ++i) 67 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i)
72 reset_value[i] = 0x80000000UL - ctr[i].count; 68 reset_value[i] = 0x80000000UL - ctr[i].count;
73 69
74 /* setup user and kernel profiling */ 70 /* setup user and kernel profiling */
@@ -121,7 +117,7 @@ static void power4_start(struct op_counter_config *ctr)
121 /* set the PMM bit (see comment below) */ 117 /* set the PMM bit (see comment below) */
122 mtmsrd(mfmsr() | MSR_PMM); 118 mtmsrd(mfmsr() | MSR_PMM);
123 119
124 for (i = 0; i < num_counters; ++i) { 120 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) {
125 if (ctr[i].enabled) { 121 if (ctr[i].enabled) {
126 ctr_write(i, reset_value[i]); 122 ctr_write(i, reset_value[i]);
127 } else { 123 } else {
@@ -272,7 +268,7 @@ static void power4_handle_interrupt(struct pt_regs *regs,
272 /* set the PMM bit (see comment below) */ 268 /* set the PMM bit (see comment below) */
273 mtmsrd(mfmsr() | MSR_PMM); 269 mtmsrd(mfmsr() | MSR_PMM);
274 270
275 for (i = 0; i < num_counters; ++i) { 271 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) {
276 val = ctr_read(i); 272 val = ctr_read(i);
277 if (val < 0) { 273 if (val < 0) {
278 if (oprofile_running && ctr[i].enabled) { 274 if (oprofile_running && ctr[i].enabled) {
diff --git a/arch/ppc64/oprofile/op_model_rs64.c b/arch/ppc64/oprofile/op_model_rs64.c
index bcec506c266a..08c5b333f5c4 100644
--- a/arch/ppc64/oprofile/op_model_rs64.c
+++ b/arch/ppc64/oprofile/op_model_rs64.c
@@ -14,11 +14,10 @@
14#include <asm/system.h> 14#include <asm/system.h>
15#include <asm/processor.h> 15#include <asm/processor.h>
16#include <asm/cputable.h> 16#include <asm/cputable.h>
17#include <asm/oprofile_impl.h>
17 18
18#define dbg(args...) 19#define dbg(args...)
19 20
20#include "op_impl.h"
21
22static void ctrl_write(unsigned int i, unsigned int val) 21static void ctrl_write(unsigned int i, unsigned int val)
23{ 22{
24 unsigned int tmp = 0; 23 unsigned int tmp = 0;
diff --git a/arch/ppc64/xmon/start.c b/arch/ppc64/xmon/start.c
index f86b584acd76..e50c158191e1 100644
--- a/arch/ppc64/xmon/start.c
+++ b/arch/ppc64/xmon/start.c
@@ -61,7 +61,9 @@ xmon_read(void *handle, void *ptr, int nb)
61int 61int
62xmon_read_poll(void) 62xmon_read_poll(void)
63{ 63{
64 return udbg_getc_poll(); 64 if (udbg_getc_poll)
65 return udbg_getc_poll();
66 return -1;
65} 67}
66 68
67FILE *xmon_stdin; 69FILE *xmon_stdin;