aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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/lparcfg.c2
-rw-r--r--arch/ppc64/kernel/maple_setup.c3
-rw-r--r--arch/ppc64/kernel/pSeries_lpar.c18
-rw-r--r--arch/ppc64/kernel/pSeries_setup.c7
-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/setup.c44
-rw-r--r--arch/ppc64/kernel/sysfs.c48
-rw-r--r--arch/ppc64/kernel/time.c1
-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/mm/hugetlbpage.c6
-rw-r--r--arch/ppc64/mm/init.c1
-rw-r--r--arch/ppc64/mm/slb.c4
-rw-r--r--arch/ppc64/oprofile/common.c58
-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
-rw-r--r--include/asm-powerpc/bugs.h18
-rw-r--r--include/asm-powerpc/mc146818rtc.h (renamed from include/asm-ppc64/mc146818rtc.h)10
-rw-r--r--include/asm-powerpc/mman.h (renamed from include/asm-ppc64/mman.h)6
-rw-r--r--include/asm-powerpc/module.h77
-rw-r--r--include/asm-powerpc/sembuf.h (renamed from include/asm-ppc64/sembuf.h)31
-rw-r--r--include/asm-powerpc/shmbuf.h (renamed from include/asm-ppc64/shmbuf.h)42
-rw-r--r--include/asm-powerpc/siginfo.h (renamed from include/asm-ppc64/siginfo.h)12
-rw-r--r--include/asm-powerpc/socket.h (renamed from include/asm-ppc64/socket.h)12
-rw-r--r--include/asm-powerpc/sockios.h (renamed from include/asm-ppc64/sockios.h)6
-rw-r--r--include/asm-powerpc/termbits.h (renamed from include/asm-ppc64/termbits.h)8
-rw-r--r--include/asm-powerpc/termios.h (renamed from include/asm-ppc64/termios.h)7
-rw-r--r--include/asm-ppc/bugs.h6
-rw-r--r--include/asm-ppc/mc146818rtc.h31
-rw-r--r--include/asm-ppc/mman.h44
-rw-r--r--include/asm-ppc/module.h44
-rw-r--r--include/asm-ppc/pmac_feature.h1
-rw-r--r--include/asm-ppc/sembuf.h19
-rw-r--r--include/asm-ppc/shmbuf.h37
-rw-r--r--include/asm-ppc/siginfo.h6
-rw-r--r--include/asm-ppc/socket.h58
-rw-r--r--include/asm-ppc/sockios.h17
-rw-r--r--include/asm-ppc/termbits.h185
-rw-r--r--include/asm-ppc/termios.h232
-rw-r--r--include/asm-ppc64/bugs.h12
-rw-r--r--include/asm-ppc64/cputable.h12
-rw-r--r--include/asm-ppc64/machdep.h5
-rw-r--r--include/asm-ppc64/mmu.h6
-rw-r--r--include/asm-ppc64/module.h36
-rw-r--r--include/asm-ppc64/oprofile_impl.h (renamed from arch/ppc64/oprofile/op_impl.h)3
-rw-r--r--include/asm-ppc64/system.h19
-rw-r--r--include/asm-ppc64/udbg.h27
56 files changed, 699 insertions, 1240 deletions
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/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/pSeries_lpar.c b/arch/ppc64/kernel/pSeries_lpar.c
index a1d5fdfea4a8..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 }
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/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/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/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..91ef95ccda4f 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>
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/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 b3b1e9c1770a..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);
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_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;
diff --git a/include/asm-powerpc/bugs.h b/include/asm-powerpc/bugs.h
new file mode 100644
index 000000000000..310187d0e33a
--- /dev/null
+++ b/include/asm-powerpc/bugs.h
@@ -0,0 +1,18 @@
1#ifndef _POWERPC_BUGS_H
2#define _POWERPC_BUGS_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11/*
12 * This file is included by 'init/main.c' to check for
13 * architecture-dependent bugs.
14 */
15
16extern void check_bugs(void);
17
18#endif /* _POWERPC_BUGS_H */
diff --git a/include/asm-ppc64/mc146818rtc.h b/include/asm-powerpc/mc146818rtc.h
index f713e1bbb533..a5619a2a1393 100644
--- a/include/asm-ppc64/mc146818rtc.h
+++ b/include/asm-powerpc/mc146818rtc.h
@@ -1,3 +1,6 @@
1#ifndef _POWERPC_MC146818RTC_H
2#define _POWERPC_MC146818RTC_H
3
1/* 4/*
2 * Machine dependent access functions for RTC registers. 5 * Machine dependent access functions for RTC registers.
3 * 6 *
@@ -6,8 +9,8 @@
6 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
8 */ 11 */
9#ifndef __ASM_PPC64_MC146818RTC_H 12
10#define __ASM_PPC64_MC146818RTC_H 13#ifdef __KERNEL__
11 14
12#include <asm/io.h> 15#include <asm/io.h>
13 16
@@ -29,4 +32,5 @@ outb_p((addr),RTC_PORT(0)); \
29outb_p((val),RTC_PORT(1)); \ 32outb_p((val),RTC_PORT(1)); \
30}) 33})
31 34
32#endif /* __ASM_PPC64_MC146818RTC_H */ 35#endif /* __KERNEL__ */
36#endif /* _POWERPC_MC146818RTC_H */
diff --git a/include/asm-ppc64/mman.h b/include/asm-powerpc/mman.h
index d4f93446a52c..f2d55988d749 100644
--- a/include/asm-ppc64/mman.h
+++ b/include/asm-powerpc/mman.h
@@ -1,5 +1,5 @@
1#ifndef __PPC64_MMAN_H__ 1#ifndef _POWERPC_MMAN_H
2#define __PPC64_MMAN_H__ 2#define _POWERPC_MMAN_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -49,4 +49,4 @@
49#define MAP_ANON MAP_ANONYMOUS 49#define MAP_ANON MAP_ANONYMOUS
50#define MAP_FILE 0 50#define MAP_FILE 0
51 51
52#endif /* __PPC64_MMAN_H__ */ 52#endif /* _POWERPC_MMAN_H */
diff --git a/include/asm-powerpc/module.h b/include/asm-powerpc/module.h
new file mode 100644
index 000000000000..4438f4fd6524
--- /dev/null
+++ b/include/asm-powerpc/module.h
@@ -0,0 +1,77 @@
1#ifndef _POWERPC_MODULE_H
2#define _POWERPC_MODULE_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include <linux/list.h>
12#include <asm/bug.h>
13
14
15#ifndef __powerpc64__
16/*
17 * Thanks to Paul M for explaining this.
18 *
19 * PPC can only do rel jumps += 32MB, and often the kernel and other
20 * modules are furthur away than this. So, we jump to a table of
21 * trampolines attached to the module (the Procedure Linkage Table)
22 * whenever that happens.
23 */
24
25struct ppc_plt_entry {
26 /* 16 byte jump instruction sequence (4 instructions) */
27 unsigned int jump[4];
28};
29#endif /* __powerpc64__ */
30
31
32struct mod_arch_specific {
33#ifdef __powerpc64__
34 unsigned int stubs_section; /* Index of stubs section in module */
35 unsigned int toc_section; /* What section is the TOC? */
36#else
37 /* Indices of PLT sections within module. */
38 unsigned int core_plt_section;
39 unsigned int init_plt_section;
40#endif
41
42 /* List of BUG addresses, source line numbers and filenames */
43 struct list_head bug_list;
44 struct bug_entry *bug_table;
45 unsigned int num_bugs;
46};
47
48extern struct bug_entry *module_find_bug(unsigned long bugaddr);
49
50/*
51 * Select ELF headers.
52 * Make empty section for module_frob_arch_sections to expand.
53 */
54
55#ifdef __powerpc64__
56# define Elf_Shdr Elf64_Shdr
57# define Elf_Sym Elf64_Sym
58# define Elf_Ehdr Elf64_Ehdr
59# ifdef MODULE
60 asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
61# endif
62#else
63# define Elf_Shdr Elf32_Shdr
64# define Elf_Sym Elf32_Sym
65# define Elf_Ehdr Elf32_Ehdr
66# ifdef MODULE
67 asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
68 asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
69# endif /* MODULE */
70#endif
71
72
73struct exception_table_entry;
74void sort_ex_table(struct exception_table_entry *start,
75 struct exception_table_entry *finish);
76
77#endif /* _POWERPC_MODULE_H */
diff --git a/include/asm-ppc64/sembuf.h b/include/asm-powerpc/sembuf.h
index 172e59000767..c98fc18fe805 100644
--- a/include/asm-ppc64/sembuf.h
+++ b/include/asm-powerpc/sembuf.h
@@ -1,27 +1,36 @@
1#ifndef _PPC64_SEMBUF_H 1#ifndef _POWERPC_SEMBUF_H
2#define _PPC64_SEMBUF_H 2#define _POWERPC_SEMBUF_H
3 3
4/* 4/*
5 * The semid64_ds structure for PPC architecture.
6 *
7 *
8 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License 6 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 7 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
9 */
10
11/*
12 * The semid64_ds structure for PPC architecture.
13 * Note extra padding because this structure is passed back and forth
14 * between kernel and user space.
12 * 15 *
13 * Pad space is left for: 16 * Pad space is left for:
14 * - 2 miscellaneous 64-bit values 17 * - 64-bit time_t to solve y2038 problem
18 * - 2 miscellaneous 32-bit values
15 */ 19 */
16 20
17struct semid64_ds { 21struct semid64_ds {
18 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 22 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
23#ifndef __powerpc64__
24 unsigned long __unused1;
25#endif
19 __kernel_time_t sem_otime; /* last semop time */ 26 __kernel_time_t sem_otime; /* last semop time */
27#ifndef __powerpc64__
28 unsigned long __unused2;
29#endif
20 __kernel_time_t sem_ctime; /* last change time */ 30 __kernel_time_t sem_ctime; /* last change time */
21 unsigned long sem_nsems; /* no. of semaphores in array */ 31 unsigned long sem_nsems; /* no. of semaphores in array */
22 32 unsigned long __unused3;
23 unsigned long __unused1; 33 unsigned long __unused4;
24 unsigned long __unused2;
25}; 34};
26 35
27#endif /* _PPC64_SEMBUF_H */ 36#endif /* _POWERPC_SEMBUF_H */
diff --git a/include/asm-ppc64/shmbuf.h b/include/asm-powerpc/shmbuf.h
index 02e99d6ec925..29632db3b178 100644
--- a/include/asm-ppc64/shmbuf.h
+++ b/include/asm-powerpc/shmbuf.h
@@ -1,31 +1,47 @@
1#ifndef _PPC64_SHMBUF_H 1#ifndef _POWERPC_SHMBUF_H
2#define _PPC64_SHMBUF_H 2#define _POWERPC_SHMBUF_H
3 3
4/* 4/*
5 * The shmid64_ds structure for PPC64 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 2 miscellaneous 64-bit values
11 *
12 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 6 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 7 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
16 */ 9 */
17 10
11/*
12 * The shmid64_ds structure for PPC architecture.
13 *
14 * Note extra padding because this structure is passed back and forth
15 * between kernel and user space.
16 *
17 * Pad space is left for:
18 * - 64-bit time_t to solve y2038 problem
19 * - 2 miscellaneous 32-bit values
20 */
21
18struct shmid64_ds { 22struct shmid64_ds {
19 struct ipc64_perm shm_perm; /* operation perms */ 23 struct ipc64_perm shm_perm; /* operation perms */
24#ifndef __power64__
25 unsigned long __unused1;
26#endif
20 __kernel_time_t shm_atime; /* last attach time */ 27 __kernel_time_t shm_atime; /* last attach time */
28#ifndef __power64__
29 unsigned long __unused2;
30#endif
21 __kernel_time_t shm_dtime; /* last detach time */ 31 __kernel_time_t shm_dtime; /* last detach time */
32#ifndef __power64__
33 unsigned long __unused3;
34#endif
22 __kernel_time_t shm_ctime; /* last change time */ 35 __kernel_time_t shm_ctime; /* last change time */
36#ifndef __power64__
37 unsigned long __unused4;
38#endif
23 size_t shm_segsz; /* size of segment (bytes) */ 39 size_t shm_segsz; /* size of segment (bytes) */
24 __kernel_pid_t shm_cpid; /* pid of creator */ 40 __kernel_pid_t shm_cpid; /* pid of creator */
25 __kernel_pid_t shm_lpid; /* pid of last operator */ 41 __kernel_pid_t shm_lpid; /* pid of last operator */
26 unsigned long shm_nattch; /* no. of current attaches */ 42 unsigned long shm_nattch; /* no. of current attaches */
27 unsigned long __unused1; 43 unsigned long __unused5;
28 unsigned long __unused2; 44 unsigned long __unused6;
29}; 45};
30 46
31struct shminfo64 { 47struct shminfo64 {
@@ -40,4 +56,4 @@ struct shminfo64 {
40 unsigned long __unused4; 56 unsigned long __unused4;
41}; 57};
42 58
43#endif /* _PPC64_SHMBUF_H */ 59#endif /* _POWERPC_SHMBUF_H */
diff --git a/include/asm-ppc64/siginfo.h b/include/asm-powerpc/siginfo.h
index 3a7c23dcb5aa..ae70b8010b19 100644
--- a/include/asm-ppc64/siginfo.h
+++ b/include/asm-powerpc/siginfo.h
@@ -1,5 +1,5 @@
1#ifndef _PPC64_SIGINFO_H 1#ifndef _POWERPC_SIGINFO_H
2#define _PPC64_SIGINFO_H 2#define _POWERPC_SIGINFO_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -8,9 +8,11 @@
8 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
9 */ 9 */
10 10
11#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) 11#ifdef __powerpc64__
12#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3) 12# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
13# define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
14#endif
13 15
14#include <asm-generic/siginfo.h> 16#include <asm-generic/siginfo.h>
15 17
16#endif /* _PPC64_SIGINFO_H */ 18#endif /* _POWERPC_SIGINFO_H */
diff --git a/include/asm-ppc64/socket.h b/include/asm-powerpc/socket.h
index 9e1af8eb2d96..51a0cf5ee9f0 100644
--- a/include/asm-ppc64/socket.h
+++ b/include/asm-powerpc/socket.h
@@ -1,5 +1,5 @@
1#ifndef _ASM_SOCKET_H 1#ifndef _POWERPC_SOCKET_H
2#define _ASM_SOCKET_H 2#define _POWERPC_SOCKET_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -10,7 +10,7 @@
10 10
11#include <asm/sockios.h> 11#include <asm/sockios.h>
12 12
13/* For setsockoptions(2) */ 13/* For setsockopt(2) */
14#define SOL_SOCKET 1 14#define SOL_SOCKET 1
15 15
16#define SO_DEBUG 1 16#define SO_DEBUG 1
@@ -52,8 +52,8 @@
52#define SO_TIMESTAMP 29 52#define SO_TIMESTAMP 29
53#define SCM_TIMESTAMP SO_TIMESTAMP 53#define SCM_TIMESTAMP SO_TIMESTAMP
54 54
55#define SO_ACCEPTCONN 30 55#define SO_ACCEPTCONN 30
56 56
57#define SO_PEERSEC 31 57#define SO_PEERSEC 31
58 58
59#endif /* _ASM_SOCKET_H */ 59#endif /* _POWERPC_SOCKET_H */
diff --git a/include/asm-ppc64/sockios.h b/include/asm-powerpc/sockios.h
index 6bd1a22af4f6..ef7ff664167e 100644
--- a/include/asm-ppc64/sockios.h
+++ b/include/asm-powerpc/sockios.h
@@ -1,5 +1,5 @@
1#ifndef _ASM_PPC64_SOCKIOS_H 1#ifndef _POWERPC_SOCKIOS_H
2#define _ASM_PPC64_SOCKIOS_H 2#define _POWERPC_SOCKIOS_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -16,4 +16,4 @@
16#define SIOCATMARK 0x8905 16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp */ 17#define SIOCGSTAMP 0x8906 /* Get stamp */
18 18
19#endif /* _ASM_PPC64_SOCKIOS_H */ 19#endif /* _POWERPC_SOCKIOS_H */
diff --git a/include/asm-ppc64/termbits.h b/include/asm-powerpc/termbits.h
index d1a2bee10cef..2c5bf85a8c3c 100644
--- a/include/asm-ppc64/termbits.h
+++ b/include/asm-powerpc/termbits.h
@@ -1,5 +1,5 @@
1#ifndef _PPC64_TERMBITS_H 1#ifndef _POWERPC_TERMBITS_H
2#define _PPC64_TERMBITS_H 2#define _POWERPC_TERMBITS_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -8,8 +8,6 @@
8 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
9 */ 9 */
10 10
11#include <linux/posix_types.h>
12
13typedef unsigned char cc_t; 11typedef unsigned char cc_t;
14typedef unsigned int speed_t; 12typedef unsigned int speed_t;
15typedef unsigned int tcflag_t; 13typedef unsigned int tcflag_t;
@@ -190,4 +188,4 @@ struct termios {
190#define TCSADRAIN 1 188#define TCSADRAIN 1
191#define TCSAFLUSH 2 189#define TCSAFLUSH 2
192 190
193#endif /* _PPC64_TERMBITS_H */ 191#endif /* _POWERPC_TERMBITS_H */
diff --git a/include/asm-ppc64/termios.h b/include/asm-powerpc/termios.h
index 02c3d283aa62..237533bb0e9f 100644
--- a/include/asm-ppc64/termios.h
+++ b/include/asm-powerpc/termios.h
@@ -1,5 +1,5 @@
1#ifndef _PPC64_TERMIOS_H 1#ifndef _POWERPC_TERMIOS_H
2#define _PPC64_TERMIOS_H 2#define _POWERPC_TERMIOS_H
3 3
4/* 4/*
5 * Liberally adapted from alpha/termios.h. In particular, the c_cc[] 5 * Liberally adapted from alpha/termios.h. In particular, the c_cc[]
@@ -87,6 +87,7 @@ struct termio {
87#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ 87#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
88#define N_HDLC 13 /* synchronous HDLC */ 88#define N_HDLC 13 /* synchronous HDLC */
89#define N_SYNC_PPP 14 89#define N_SYNC_PPP 14
90#define N_HCI 15 /* Bluetooth HCI UART */
90 91
91#ifdef __KERNEL__ 92#ifdef __KERNEL__
92/* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */ 93/* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */
@@ -232,4 +233,4 @@ struct termio {
232 233
233#endif /* __KERNEL__ */ 234#endif /* __KERNEL__ */
234 235
235#endif /* _PPC64_TERMIOS_H */ 236#endif /* _POWERPC_TERMIOS_H */
diff --git a/include/asm-ppc/bugs.h b/include/asm-ppc/bugs.h
deleted file mode 100644
index 8dce1e290fd0..000000000000
--- a/include/asm-ppc/bugs.h
+++ /dev/null
@@ -1,6 +0,0 @@
1/*
2 * This file is included by 'init/main.c'
3 */
4
5extern void
6check_bugs(void);
diff --git a/include/asm-ppc/mc146818rtc.h b/include/asm-ppc/mc146818rtc.h
deleted file mode 100644
index 227018b2fef8..000000000000
--- a/include/asm-ppc/mc146818rtc.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Machine dependent access functions for RTC registers.
3 */
4#ifdef __KERNEL__
5#ifndef __ASM_PPC_MC146818RTC_H
6#define __ASM_PPC_MC146818RTC_H
7
8#include <asm/io.h>
9
10#ifndef RTC_PORT
11#define RTC_PORT(x) (0x70 + (x))
12#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */
13#endif
14
15/*
16 * The yet supported machines all access the RTC index register via
17 * an ISA port access but the way to access the date register differs ...
18 */
19#define CMOS_READ(addr) ({ \
20outb_p((addr),RTC_PORT(0)); \
21inb_p(RTC_PORT(1)); \
22})
23#define CMOS_WRITE(val, addr) ({ \
24outb_p((addr),RTC_PORT(0)); \
25outb_p((val),RTC_PORT(1)); \
26})
27
28#define RTC_IRQ 8
29
30#endif /* __ASM_PPC_MC146818RTC_H */
31#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/mman.h b/include/asm-ppc/mman.h
deleted file mode 100644
index 5fd19fd4936c..000000000000
--- a/include/asm-ppc/mman.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef __PPC_MMAN_H__
2#define __PPC_MMAN_H__
3
4#define PROT_READ 0x1 /* page can be read */
5#define PROT_WRITE 0x2 /* page can be written */
6#define PROT_EXEC 0x4 /* page can be executed */
7#define PROT_SEM 0x8 /* page may be used for atomic ops */
8#define PROT_NONE 0x0 /* page can not be accessed */
9#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
10#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
11
12#define MAP_SHARED 0x01 /* Share changes */
13#define MAP_PRIVATE 0x02 /* Changes are private */
14#define MAP_TYPE 0x0f /* Mask for type of mapping */
15#define MAP_FIXED 0x10 /* Interpret addr exactly */
16#define MAP_ANONYMOUS 0x20 /* don't use a file */
17#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */
18#define MAP_NORESERVE 0x40 /* don't reserve swap pages */
19#define MAP_LOCKED 0x80
20
21#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
22#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
23#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
24#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
25#define MAP_NONBLOCK 0x10000 /* do not block on IO */
26
27#define MS_ASYNC 1 /* sync memory asynchronously */
28#define MS_INVALIDATE 2 /* invalidate the caches */
29#define MS_SYNC 4 /* synchronous memory sync */
30
31#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */
32#define MCL_FUTURE 0x4000 /* lock all additions to address space */
33
34#define MADV_NORMAL 0x0 /* default page-in behavior */
35#define MADV_RANDOM 0x1 /* page-in minimum required */
36#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
37#define MADV_WILLNEED 0x3 /* pre-fault pages */
38#define MADV_DONTNEED 0x4 /* discard these pages */
39
40/* compatibility flags */
41#define MAP_ANON MAP_ANONYMOUS
42#define MAP_FILE 0
43
44#endif /* __PPC_MMAN_H__ */
diff --git a/include/asm-ppc/module.h b/include/asm-ppc/module.h
deleted file mode 100644
index fb63492562b0..000000000000
--- a/include/asm-ppc/module.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef _ASM_PPC_MODULE_H
2#define _ASM_PPC_MODULE_H
3/* Module stuff for PPC. (C) 2001 Rusty Russell */
4
5#include <linux/list.h>
6#include <asm/bug.h>
7
8/* Thanks to Paul M for explaining this.
9
10 PPC can only do rel jumps += 32MB, and often the kernel and other
11 modules are furthur away than this. So, we jump to a table of
12 trampolines attached to the module (the Procedure Linkage Table)
13 whenever that happens.
14*/
15
16struct ppc_plt_entry
17{
18 /* 16 byte jump instruction sequence (4 instructions) */
19 unsigned int jump[4];
20};
21
22struct mod_arch_specific
23{
24 /* Indices of PLT sections within module. */
25 unsigned int core_plt_section, init_plt_section;
26
27 /* List of BUG addresses, source line numbers and filenames */
28 struct list_head bug_list;
29 struct bug_entry *bug_table;
30 unsigned int num_bugs;
31};
32
33extern struct bug_entry *module_find_bug(unsigned long bugaddr);
34
35#define Elf_Shdr Elf32_Shdr
36#define Elf_Sym Elf32_Sym
37#define Elf_Ehdr Elf32_Ehdr
38
39/* Make empty sections for module_frob_arch_sections to expand. */
40#ifdef MODULE
41asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
42asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
43#endif
44#endif /* _ASM_PPC_MODULE_H */
diff --git a/include/asm-ppc/pmac_feature.h b/include/asm-ppc/pmac_feature.h
index 8beb162873f4..e9683bcff19b 100644
--- a/include/asm-ppc/pmac_feature.h
+++ b/include/asm-ppc/pmac_feature.h
@@ -32,6 +32,7 @@
32#define __PPC_ASM_PMAC_FEATURE_H 32#define __PPC_ASM_PMAC_FEATURE_H
33 33
34#include <asm/macio.h> 34#include <asm/macio.h>
35#include <asm/machdep.h>
35 36
36/* 37/*
37 * Known Mac motherboard models 38 * Known Mac motherboard models
diff --git a/include/asm-ppc/sembuf.h b/include/asm-ppc/sembuf.h
deleted file mode 100644
index 883f682f85b8..000000000000
--- a/include/asm-ppc/sembuf.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _PPC_SEMBUF_H
2#define _PPC_SEMBUF_H
3
4/*
5 * The semid64_ds structure for PPC architecture.
6 */
7
8struct semid64_ds {
9 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
10 unsigned int __unused1;
11 __kernel_time_t sem_otime; /* last semop time */
12 unsigned int __unused2;
13 __kernel_time_t sem_ctime; /* last change time */
14 unsigned long sem_nsems; /* no. of semaphores in array */
15 unsigned long __unused3;
16 unsigned long __unused4;
17};
18
19#endif /* _PPC_SEMBUF_H */
diff --git a/include/asm-ppc/shmbuf.h b/include/asm-ppc/shmbuf.h
deleted file mode 100644
index 7ac0bd38cbd8..000000000000
--- a/include/asm-ppc/shmbuf.h
+++ /dev/null
@@ -1,37 +0,0 @@
1#ifndef _PPC_SHMBUF_H
2#define _PPC_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for PPC architecture.
6 */
7
8struct shmid64_ds {
9 struct ipc64_perm shm_perm; /* operation perms */
10 unsigned int __unused1;
11 __kernel_time_t shm_atime; /* last attach time */
12 unsigned int __unused2;
13 __kernel_time_t shm_dtime; /* last detach time */
14 unsigned int __unused3;
15 __kernel_time_t shm_ctime; /* last change time */
16 unsigned int __unused4;
17 size_t shm_segsz; /* size of segment (bytes) */
18 __kernel_pid_t shm_cpid; /* pid of creator */
19 __kernel_pid_t shm_lpid; /* pid of last operator */
20 unsigned long shm_nattch; /* no. of current attaches */
21 unsigned long __unused5;
22 unsigned long __unused6;
23};
24
25struct shminfo64 {
26 unsigned long shmmax;
27 unsigned long shmmin;
28 unsigned long shmmni;
29 unsigned long shmseg;
30 unsigned long shmall;
31 unsigned long __unused1;
32 unsigned long __unused2;
33 unsigned long __unused3;
34 unsigned long __unused4;
35};
36
37#endif /* _PPC_SHMBUF_H */
diff --git a/include/asm-ppc/siginfo.h b/include/asm-ppc/siginfo.h
deleted file mode 100644
index 4b9435bb9049..000000000000
--- a/include/asm-ppc/siginfo.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _PPC_SIGINFO_H
2#define _PPC_SIGINFO_H
3
4#include <asm-generic/siginfo.h>
5
6#endif
diff --git a/include/asm-ppc/socket.h b/include/asm-ppc/socket.h
deleted file mode 100644
index 296e1a3469d0..000000000000
--- a/include/asm-ppc/socket.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _ASM_SOCKET_H
2#define _ASM_SOCKET_H
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */
11
12/* For setsockopt(2) */
13#define SOL_SOCKET 1
14
15#define SO_DEBUG 1
16#define SO_REUSEADDR 2
17#define SO_TYPE 3
18#define SO_ERROR 4
19#define SO_DONTROUTE 5
20#define SO_BROADCAST 6
21#define SO_SNDBUF 7
22#define SO_RCVBUF 8
23#define SO_SNDBUFFORCE 32
24#define SO_RCVBUFFORCE 33
25#define SO_KEEPALIVE 9
26#define SO_OOBINLINE 10
27#define SO_NO_CHECK 11
28#define SO_PRIORITY 12
29#define SO_LINGER 13
30#define SO_BSDCOMPAT 14
31/* To add :#define SO_REUSEPORT 15 */
32#define SO_RCVLOWAT 16
33#define SO_SNDLOWAT 17
34#define SO_RCVTIMEO 18
35#define SO_SNDTIMEO 19
36#define SO_PASSCRED 20
37#define SO_PEERCRED 21
38
39/* Security levels - as per NRL IPv6 - don't actually do anything */
40#define SO_SECURITY_AUTHENTICATION 22
41#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
42#define SO_SECURITY_ENCRYPTION_NETWORK 24
43
44#define SO_BINDTODEVICE 25
45
46/* Socket filtering */
47#define SO_ATTACH_FILTER 26
48#define SO_DETACH_FILTER 27
49
50#define SO_PEERNAME 28
51#define SO_TIMESTAMP 29
52#define SCM_TIMESTAMP SO_TIMESTAMP
53
54#define SO_ACCEPTCONN 30
55
56#define SO_PEERSEC 31
57
58#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-ppc/sockios.h b/include/asm-ppc/sockios.h
deleted file mode 100644
index 385aedc55ceb..000000000000
--- a/include/asm-ppc/sockios.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _ASM_PPC_SOCKIOS_H
2#define _ASM_PPC_SOCKIOS_H
3
4#if 0 /* These are defined this way on Alpha - maybe later. */
5/* Socket-level I/O control calls. */
6
7#define FIOGETOWN _IOR('f', 123, int)
8#define FIOSETOWN _IOW('f', 124, int)
9
10#define SIOCATMARK _IOR('s', 7, int)
11#define SIOCSPGRP _IOW('s', 8, pid_t)
12#define SIOCGPGRP _IOR('s', 9, pid_t)
13
14#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */
15#endif
16
17#endif /* _ASM_PPC_SOCKIOS_H */
diff --git a/include/asm-ppc/termbits.h b/include/asm-ppc/termbits.h
deleted file mode 100644
index c343fb7bdfed..000000000000
--- a/include/asm-ppc/termbits.h
+++ /dev/null
@@ -1,185 +0,0 @@
1#ifndef _PPC_TERMBITS_H
2#define _PPC_TERMBITS_H
3
4typedef unsigned char cc_t;
5typedef unsigned int speed_t;
6typedef unsigned int tcflag_t;
7
8/*
9 * termios type and macro definitions. Be careful about adding stuff
10 * to this file since it's used in GNU libc and there are strict rules
11 * concerning namespace pollution.
12 */
13
14#define NCCS 19
15struct termios {
16 tcflag_t c_iflag; /* input mode flags */
17 tcflag_t c_oflag; /* output mode flags */
18 tcflag_t c_cflag; /* control mode flags */
19 tcflag_t c_lflag; /* local mode flags */
20 cc_t c_cc[NCCS]; /* control characters */
21 cc_t c_line; /* line discipline (== c_cc[19]) */
22 speed_t c_ispeed; /* input speed */
23 speed_t c_ospeed; /* output speed */
24};
25
26/* c_cc characters */
27#define VINTR 0
28#define VQUIT 1
29#define VERASE 2
30#define VKILL 3
31#define VEOF 4
32#define VMIN 5
33#define VEOL 6
34#define VTIME 7
35#define VEOL2 8
36#define VSWTC 9
37
38#define VWERASE 10
39#define VREPRINT 11
40#define VSUSP 12
41#define VSTART 13
42#define VSTOP 14
43#define VLNEXT 15
44#define VDISCARD 16
45
46/* c_iflag bits */
47#define IGNBRK 0000001
48#define BRKINT 0000002
49#define IGNPAR 0000004
50#define PARMRK 0000010
51#define INPCK 0000020
52#define ISTRIP 0000040
53#define INLCR 0000100
54#define IGNCR 0000200
55#define ICRNL 0000400
56#define IXON 0001000
57#define IXOFF 0002000
58#define IXANY 0004000
59#define IUCLC 0010000
60#define IMAXBEL 0020000
61#define IUTF8 0040000
62
63/* c_oflag bits */
64#define OPOST 0000001
65#define ONLCR 0000002
66#define OLCUC 0000004
67
68#define OCRNL 0000010
69#define ONOCR 0000020
70#define ONLRET 0000040
71
72#define OFILL 00000100
73#define OFDEL 00000200
74#define NLDLY 00001400
75#define NL0 00000000
76#define NL1 00000400
77#define NL2 00001000
78#define NL3 00001400
79#define TABDLY 00006000
80#define TAB0 00000000
81#define TAB1 00002000
82#define TAB2 00004000
83#define TAB3 00006000
84#define XTABS 00006000 /* required by POSIX to == TAB3 */
85#define CRDLY 00030000
86#define CR0 00000000
87#define CR1 00010000
88#define CR2 00020000
89#define CR3 00030000
90#define FFDLY 00040000
91#define FF0 00000000
92#define FF1 00040000
93#define BSDLY 00100000
94#define BS0 00000000
95#define BS1 00100000
96#define VTDLY 00200000
97#define VT0 00000000
98#define VT1 00200000
99
100/* c_cflag bit meaning */
101#define CBAUD 0000377
102#define B0 0000000 /* hang up */
103#define B50 0000001
104#define B75 0000002
105#define B110 0000003
106#define B134 0000004
107#define B150 0000005
108#define B200 0000006
109#define B300 0000007
110#define B600 0000010
111#define B1200 0000011
112#define B1800 0000012
113#define B2400 0000013
114#define B4800 0000014
115#define B9600 0000015
116#define B19200 0000016
117#define B38400 0000017
118#define EXTA B19200
119#define EXTB B38400
120#define CBAUDEX 0000000
121#define B57600 00020
122#define B115200 00021
123#define B230400 00022
124#define B460800 00023
125#define B500000 00024
126#define B576000 00025
127#define B921600 00026
128#define B1000000 00027
129#define B1152000 00030
130#define B1500000 00031
131#define B2000000 00032
132#define B2500000 00033
133#define B3000000 00034
134#define B3500000 00035
135#define B4000000 00036
136
137#define CSIZE 00001400
138#define CS5 00000000
139#define CS6 00000400
140#define CS7 00001000
141#define CS8 00001400
142
143#define CSTOPB 00002000
144#define CREAD 00004000
145#define PARENB 00010000
146#define PARODD 00020000
147#define HUPCL 00040000
148
149#define CLOCAL 00100000
150#define CRTSCTS 020000000000 /* flow control */
151
152/* c_lflag bits */
153#define ISIG 0x00000080
154#define ICANON 0x00000100
155#define XCASE 0x00004000
156#define ECHO 0x00000008
157#define ECHOE 0x00000002
158#define ECHOK 0x00000004
159#define ECHONL 0x00000010
160#define NOFLSH 0x80000000
161#define TOSTOP 0x00400000
162#define ECHOCTL 0x00000040
163#define ECHOPRT 0x00000020
164#define ECHOKE 0x00000001
165#define FLUSHO 0x00800000
166#define PENDIN 0x20000000
167#define IEXTEN 0x00000400
168
169/* Values for the ACTION argument to `tcflow'. */
170#define TCOOFF 0
171#define TCOON 1
172#define TCIOFF 2
173#define TCION 3
174
175/* Values for the QUEUE_SELECTOR argument to `tcflush'. */
176#define TCIFLUSH 0
177#define TCOFLUSH 1
178#define TCIOFLUSH 2
179
180/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */
181#define TCSANOW 0
182#define TCSADRAIN 1
183#define TCSAFLUSH 2
184
185#endif /* _PPC_TERMBITS_H */
diff --git a/include/asm-ppc/termios.h b/include/asm-ppc/termios.h
deleted file mode 100644
index 97c6287a6cba..000000000000
--- a/include/asm-ppc/termios.h
+++ /dev/null
@@ -1,232 +0,0 @@
1#ifndef _PPC_TERMIOS_H
2#define _PPC_TERMIOS_H
3
4/*
5 * Liberally adapted from alpha/termios.h. In particular, the c_cc[]
6 * fields have been reordered so that termio & termios share the
7 * common subset in the same order (for brain dead programs that don't
8 * know or care about the differences).
9 */
10
11#include <asm/ioctls.h>
12#include <asm/termbits.h>
13
14struct sgttyb {
15 char sg_ispeed;
16 char sg_ospeed;
17 char sg_erase;
18 char sg_kill;
19 short sg_flags;
20};
21
22struct tchars {
23 char t_intrc;
24 char t_quitc;
25 char t_startc;
26 char t_stopc;
27 char t_eofc;
28 char t_brkc;
29};
30
31struct ltchars {
32 char t_suspc;
33 char t_dsuspc;
34 char t_rprntc;
35 char t_flushc;
36 char t_werasc;
37 char t_lnextc;
38};
39
40#define FIOCLEX _IO('f', 1)
41#define FIONCLEX _IO('f', 2)
42#define FIOASYNC _IOW('f', 125, int)
43#define FIONBIO _IOW('f', 126, int)
44#define FIONREAD _IOR('f', 127, int)
45#define TIOCINQ FIONREAD
46#define FIOQSIZE _IOR('f', 128, loff_t)
47
48#define TIOCGETP _IOR('t', 8, struct sgttyb)
49#define TIOCSETP _IOW('t', 9, struct sgttyb)
50#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */
51
52#define TIOCSETC _IOW('t', 17, struct tchars)
53#define TIOCGETC _IOR('t', 18, struct tchars)
54#define TCGETS _IOR('t', 19, struct termios)
55#define TCSETS _IOW('t', 20, struct termios)
56#define TCSETSW _IOW('t', 21, struct termios)
57#define TCSETSF _IOW('t', 22, struct termios)
58
59#define TCGETA _IOR('t', 23, struct termio)
60#define TCSETA _IOW('t', 24, struct termio)
61#define TCSETAW _IOW('t', 25, struct termio)
62#define TCSETAF _IOW('t', 28, struct termio)
63
64#define TCSBRK _IO('t', 29)
65#define TCXONC _IO('t', 30)
66#define TCFLSH _IO('t', 31)
67
68#define TIOCSWINSZ _IOW('t', 103, struct winsize)
69#define TIOCGWINSZ _IOR('t', 104, struct winsize)
70#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
71#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
72#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
73
74#define TIOCGLTC _IOR('t', 116, struct ltchars)
75#define TIOCSLTC _IOW('t', 117, struct ltchars)
76#define TIOCSPGRP _IOW('t', 118, int)
77#define TIOCGPGRP _IOR('t', 119, int)
78
79#define TIOCEXCL 0x540C
80#define TIOCNXCL 0x540D
81#define TIOCSCTTY 0x540E
82
83#define TIOCSTI 0x5412
84#define TIOCMGET 0x5415
85#define TIOCMBIS 0x5416
86#define TIOCMBIC 0x5417
87#define TIOCMSET 0x5418
88#define TIOCGSOFTCAR 0x5419
89#define TIOCSSOFTCAR 0x541A
90#define TIOCLINUX 0x541C
91#define TIOCCONS 0x541D
92#define TIOCGSERIAL 0x541E
93#define TIOCSSERIAL 0x541F
94#define TIOCPKT 0x5420
95
96#define TIOCNOTTY 0x5422
97#define TIOCSETD 0x5423
98#define TIOCGETD 0x5424
99#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
100
101#define TIOCSERCONFIG 0x5453
102#define TIOCSERGWILD 0x5454
103#define TIOCSERSWILD 0x5455
104#define TIOCGLCKTRMIOS 0x5456
105#define TIOCSLCKTRMIOS 0x5457
106#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
107#define TIOCSERGETLSR 0x5459 /* Get line status register */
108#define TIOCSERGETMULTI 0x545A /* Get multiport config */
109#define TIOCSERSETMULTI 0x545B /* Set multiport config */
110
111#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
112#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
113
114/* Used for packet mode */
115#define TIOCPKT_DATA 0
116#define TIOCPKT_FLUSHREAD 1
117#define TIOCPKT_FLUSHWRITE 2
118#define TIOCPKT_STOP 4
119#define TIOCPKT_START 8
120#define TIOCPKT_NOSTOP 16
121#define TIOCPKT_DOSTOP 32
122
123struct winsize {
124 unsigned short ws_row;
125 unsigned short ws_col;
126 unsigned short ws_xpixel;
127 unsigned short ws_ypixel;
128};
129
130#define NCC 10
131struct termio {
132 unsigned short c_iflag; /* input mode flags */
133 unsigned short c_oflag; /* output mode flags */
134 unsigned short c_cflag; /* control mode flags */
135 unsigned short c_lflag; /* local mode flags */
136 unsigned char c_line; /* line discipline */
137 unsigned char c_cc[NCC]; /* control characters */
138};
139
140/* c_cc characters */
141#define _VINTR 0
142#define _VQUIT 1
143#define _VERASE 2
144#define _VKILL 3
145#define _VEOF 4
146#define _VMIN 5
147#define _VEOL 6
148#define _VTIME 7
149#define _VEOL2 8
150#define _VSWTC 9
151
152#ifdef __KERNEL__
153/* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */
154#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025"
155#endif /* __KERNEL__ */
156
157/* modem lines */
158#define TIOCM_LE 0x001
159#define TIOCM_DTR 0x002
160#define TIOCM_RTS 0x004
161#define TIOCM_ST 0x008
162#define TIOCM_SR 0x010
163#define TIOCM_CTS 0x020
164#define TIOCM_CAR 0x040
165#define TIOCM_RNG 0x080
166#define TIOCM_DSR 0x100
167#define TIOCM_CD TIOCM_CAR
168#define TIOCM_RI TIOCM_RNG
169#define TIOCM_OUT1 0x2000
170#define TIOCM_OUT2 0x4000
171#define TIOCM_LOOP 0x8000
172
173/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
174#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
175
176/* line disciplines */
177#define N_TTY 0
178#define N_SLIP 1
179#define N_MOUSE 2
180#define N_PPP 3
181#define N_STRIP 4
182#define N_AX25 5
183#define N_X25 6 /* X.25 async */
184#define N_6PACK 7
185#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
186#define N_R3964 9 /* Reserved for Simatic R3964 module */
187#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
188#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
189#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
190#define N_HDLC 13 /* synchronous HDLC */
191#define N_SYNC_PPP 14
192#define N_HCI 15 /* Bluetooth HCI UART */
193
194#ifdef __KERNEL__
195
196/*
197 * Translate a "termio" structure into a "termios". Ugh.
198 */
199#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
200 unsigned short __tmp; \
201 get_user(__tmp,&(termio)->x); \
202 (termios)->x = (0xffff0000 & (termios)->x) | __tmp; \
203}
204
205#define user_termio_to_kernel_termios(termios, termio) \
206({ \
207 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
208 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
209 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
210 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
211 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
212})
213
214/*
215 * Translate a "termios" structure into a "termio". Ugh.
216 */
217#define kernel_termios_to_user_termio(termio, termios) \
218({ \
219 put_user((termios)->c_iflag, &(termio)->c_iflag); \
220 put_user((termios)->c_oflag, &(termio)->c_oflag); \
221 put_user((termios)->c_cflag, &(termio)->c_cflag); \
222 put_user((termios)->c_lflag, &(termio)->c_lflag); \
223 put_user((termios)->c_line, &(termio)->c_line); \
224 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
225})
226
227#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
228#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
229
230#endif /* __KERNEL__ */
231
232#endif /* _PPC_TERMIOS_H */
diff --git a/include/asm-ppc64/bugs.h b/include/asm-ppc64/bugs.h
deleted file mode 100644
index 861074b3cf71..000000000000
--- a/include/asm-ppc64/bugs.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/*
2 * This file is included by 'init/main.c' to check for architecture-dependent
3 * bugs.
4 *
5 */
6#ifndef _ASM_PPC64_BUGS_H
7#define _ASM_PPC64_BUGS_H
8
9static void check_bugs(void) {
10}
11
12#endif /* _ASM_PPC64_BUGS_H */
diff --git a/include/asm-ppc64/cputable.h b/include/asm-ppc64/cputable.h
index ae6cf3830108..acc9b4d6c168 100644
--- a/include/asm-ppc64/cputable.h
+++ b/include/asm-ppc64/cputable.h
@@ -36,6 +36,7 @@
36 * via the mkdefs mechanism. 36 * via the mkdefs mechanism.
37 */ 37 */
38struct cpu_spec; 38struct cpu_spec;
39struct op_ppc64_model;
39 40
40typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); 41typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec);
41 42
@@ -52,10 +53,19 @@ struct cpu_spec {
52 unsigned int icache_bsize; 53 unsigned int icache_bsize;
53 unsigned int dcache_bsize; 54 unsigned int dcache_bsize;
54 55
56 /* number of performance monitor counters */
57 unsigned int num_pmcs;
58
55 /* this is called to initialize various CPU bits like L1 cache, 59 /* this is called to initialize various CPU bits like L1 cache,
56 * BHT, SPD, etc... from head.S before branching to identify_machine 60 * BHT, SPD, etc... from head.S before branching to identify_machine
57 */ 61 */
58 cpu_setup_t cpu_setup; 62 cpu_setup_t cpu_setup;
63
64 /* Used by oprofile userspace to select the right counters */
65 char *oprofile_cpu_type;
66
67 /* Processor specific oprofile operations */
68 struct op_ppc64_model *oprofile_model;
59}; 69};
60 70
61extern struct cpu_spec cpu_specs[]; 71extern struct cpu_spec cpu_specs[];
@@ -95,7 +105,7 @@ static inline unsigned long cpu_has_feature(unsigned long feature)
95#define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000001000000000) 105#define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000001000000000)
96#define CPU_FTR_IABR ASM_CONST(0x0000002000000000) 106#define CPU_FTR_IABR ASM_CONST(0x0000002000000000)
97#define CPU_FTR_MMCRA ASM_CONST(0x0000004000000000) 107#define CPU_FTR_MMCRA ASM_CONST(0x0000004000000000)
98#define CPU_FTR_PMC8 ASM_CONST(0x0000008000000000) 108/* unused ASM_CONST(0x0000008000000000) */
99#define CPU_FTR_SMT ASM_CONST(0x0000010000000000) 109#define CPU_FTR_SMT ASM_CONST(0x0000010000000000)
100#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000) 110#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000)
101#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) 111#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000)
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h
index ff2c9287d3b6..9a1ef4427ed2 100644
--- a/include/asm-ppc64/machdep.h
+++ b/include/asm-ppc64/machdep.h
@@ -103,11 +103,6 @@ struct machdep_calls {
103 103
104 void (*progress)(char *, unsigned short); 104 void (*progress)(char *, unsigned short);
105 105
106 /* Debug interface. Low level I/O to some terminal device */
107 void (*udbg_putc)(unsigned char c);
108 unsigned char (*udbg_getc)(void);
109 int (*udbg_getc_poll)(void);
110
111 /* Interface for platform error logging */ 106 /* Interface for platform error logging */
112 void (*log_error)(char *buf, unsigned int err_type, int fatal); 107 void (*log_error)(char *buf, unsigned int err_type, int fatal);
113 108
diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h
index ad36bb28de29..7bc42eb087ad 100644
--- a/include/asm-ppc64/mmu.h
+++ b/include/asm-ppc64/mmu.h
@@ -54,8 +54,10 @@ extern char initial_stab[];
54#define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */ 54#define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */
55#define SLB_VSID_LS ASM_CONST(0x0000000000000070) /* size of largepage */ 55#define SLB_VSID_LS ASM_CONST(0x0000000000000070) /* size of largepage */
56 56
57#define SLB_VSID_KERNEL (SLB_VSID_KP|SLB_VSID_C) 57#define SLB_VSID_KERNEL (SLB_VSID_KP)
58#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS) 58#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS|SLB_VSID_C)
59
60#define SLBIE_C (0x08000000)
59 61
60/* 62/*
61 * Hash table 63 * Hash table
diff --git a/include/asm-ppc64/module.h b/include/asm-ppc64/module.h
deleted file mode 100644
index 0581607826e8..000000000000
--- a/include/asm-ppc64/module.h
+++ /dev/null
@@ -1,36 +0,0 @@
1#ifndef _ASM_PPC64_MODULE_H
2#define _ASM_PPC64_MODULE_H
3
4#include <linux/list.h>
5#include <asm/bug.h>
6
7struct mod_arch_specific
8{
9 /* Index of stubs section within module. */
10 unsigned int stubs_section;
11
12 /* What section is the TOC? */
13 unsigned int toc_section;
14
15 /* List of BUG addresses, source line numbers and filenames */
16 struct list_head bug_list;
17 struct bug_entry *bug_table;
18 unsigned int num_bugs;
19};
20
21extern struct bug_entry *module_find_bug(unsigned long bugaddr);
22
23#define Elf_Shdr Elf64_Shdr
24#define Elf_Sym Elf64_Sym
25#define Elf_Ehdr Elf64_Ehdr
26
27/* Make empty section for module_frob_arch_sections to expand. */
28#ifdef MODULE
29asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
30#endif
31
32struct exception_table_entry;
33void sort_ex_table(struct exception_table_entry *start,
34 struct exception_table_entry *finish);
35
36#endif /* _ASM_PPC64_MODULE_H */
diff --git a/arch/ppc64/oprofile/op_impl.h b/include/asm-ppc64/oprofile_impl.h
index 7fa7eaabc035..b04f1dfb1421 100644
--- a/arch/ppc64/oprofile/op_impl.h
+++ b/include/asm-ppc64/oprofile_impl.h
@@ -49,6 +49,9 @@ struct op_ppc64_model {
49 int num_counters; 49 int num_counters;
50}; 50};
51 51
52extern struct op_ppc64_model op_model_rs64;
53extern struct op_ppc64_model op_model_power4;
54
52static inline unsigned int ctr_read(unsigned int i) 55static inline unsigned int ctr_read(unsigned int i)
53{ 56{
54 switch(i) { 57 switch(i) {
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h
index b9e1835351e9..c0396428cc3c 100644
--- a/include/asm-ppc64/system.h
+++ b/include/asm-ppc64/system.h
@@ -158,7 +158,7 @@ static inline int __is_processor(unsigned long pv)
158 * is more like most of the other architectures. 158 * is more like most of the other architectures.
159 */ 159 */
160static __inline__ unsigned long 160static __inline__ unsigned long
161__xchg_u32(volatile int *m, unsigned long val) 161__xchg_u32(volatile unsigned int *m, unsigned long val)
162{ 162{
163 unsigned long dummy; 163 unsigned long dummy;
164 164
@@ -200,7 +200,7 @@ __xchg_u64(volatile long *m, unsigned long val)
200extern void __xchg_called_with_bad_pointer(void); 200extern void __xchg_called_with_bad_pointer(void);
201 201
202static __inline__ unsigned long 202static __inline__ unsigned long
203__xchg(volatile void *ptr, unsigned long x, int size) 203__xchg(volatile void *ptr, unsigned long x, unsigned int size)
204{ 204{
205 switch (size) { 205 switch (size) {
206 case 4: 206 case 4:
@@ -223,7 +223,7 @@ __xchg(volatile void *ptr, unsigned long x, int size)
223#define __HAVE_ARCH_CMPXCHG 1 223#define __HAVE_ARCH_CMPXCHG 1
224 224
225static __inline__ unsigned long 225static __inline__ unsigned long
226__cmpxchg_u32(volatile int *p, int old, int new) 226__cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new)
227{ 227{
228 unsigned int prev; 228 unsigned int prev;
229 229
@@ -271,7 +271,8 @@ __cmpxchg_u64(volatile long *p, unsigned long old, unsigned long new)
271extern void __cmpxchg_called_with_bad_pointer(void); 271extern void __cmpxchg_called_with_bad_pointer(void);
272 272
273static __inline__ unsigned long 273static __inline__ unsigned long
274__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) 274__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new,
275 unsigned int size)
275{ 276{
276 switch (size) { 277 switch (size) {
277 case 4: 278 case 4:
@@ -283,13 +284,9 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
283 return old; 284 return old;
284} 285}
285 286
286#define cmpxchg(ptr,o,n) \ 287#define cmpxchg(ptr,o,n)\
287 ({ \ 288 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\
288 __typeof__(*(ptr)) _o_ = (o); \ 289 (unsigned long)(n),sizeof(*(ptr))))
289 __typeof__(*(ptr)) _n_ = (n); \
290 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
291 (unsigned long)_n_, sizeof(*(ptr))); \
292 })
293 290
294/* 291/*
295 * We handle most unaligned accesses in hardware. On the other hand 292 * We handle most unaligned accesses in hardware. On the other hand
diff --git a/include/asm-ppc64/udbg.h b/include/asm-ppc64/udbg.h
index a6e04d014b2b..c786604aef02 100644
--- a/include/asm-ppc64/udbg.h
+++ b/include/asm-ppc64/udbg.h
@@ -2,6 +2,7 @@
2#define __UDBG_HDR 2#define __UDBG_HDR
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/init.h>
5 6
6/* 7/*
7 * c 2001 PPC 64 Team, IBM Corp 8 * c 2001 PPC 64 Team, IBM Corp
@@ -12,17 +13,19 @@
12 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
13 */ 14 */
14 15
15void udbg_init_uart(void __iomem *comport, unsigned int speed); 16extern void (*udbg_putc)(unsigned char c);
16void udbg_putc(unsigned char c); 17extern unsigned char (*udbg_getc)(void);
17unsigned char udbg_getc(void); 18extern int (*udbg_getc_poll)(void);
18int udbg_getc_poll(void);
19void udbg_puts(const char *s);
20int udbg_write(const char *s, int n);
21int udbg_read(char *buf, int buflen);
22struct console;
23void udbg_console_write(struct console *con, const char *s, unsigned int n);
24void udbg_printf(const char *fmt, ...);
25void udbg_ppcdbg(unsigned long flags, const char *fmt, ...);
26unsigned long udbg_ifdebug(unsigned long flags);
27 19
20extern void udbg_puts(const char *s);
21extern int udbg_write(const char *s, int n);
22extern int udbg_read(char *buf, int buflen);
23
24extern void register_early_udbg_console(void);
25extern void udbg_printf(const char *fmt, ...);
26extern void udbg_ppcdbg(unsigned long flags, const char *fmt, ...);
27extern unsigned long udbg_ifdebug(unsigned long flags);
28extern void __init ppcdbg_initialize(void);
29
30extern void udbg_init_uart(void __iomem *comport, unsigned int speed);
28#endif 31#endif