diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-06-22 02:34:02 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-24 02:15:17 -0400 |
commit | 07f8e5f358a0b7240f1dad6b3819f2fd1103f159 (patch) | |
tree | 5976cc05de92f27a9cc12a3db31ced5311ac3769 /arch/sparc64 | |
parent | 6d307724cb6a6b8466cad4fdf13d8a409bc2433f (diff) |
[SPARC64]: Convert cpu_find_by_*() interface to in-kernel PROM device tree.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/kernel/devices.c | 118 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_sabre.c | 9 | ||||
-rw-r--r-- | arch/sparc64/kernel/smp.c | 41 | ||||
-rw-r--r-- | arch/sparc64/kernel/time.c | 16 | ||||
-rw-r--r-- | arch/sparc64/kernel/traps.c | 18 |
5 files changed, 101 insertions, 101 deletions
diff --git a/arch/sparc64/kernel/devices.c b/arch/sparc64/kernel/devices.c index 136f872a8a57..389301c95cb2 100644 --- a/arch/sparc64/kernel/devices.c +++ b/arch/sparc64/kernel/devices.c | |||
@@ -133,38 +133,44 @@ static const char *cpu_mid_prop(void) | |||
133 | return "portid"; | 133 | return "portid"; |
134 | } | 134 | } |
135 | 135 | ||
136 | static int get_cpu_mid(int prom_node) | 136 | static int get_cpu_mid(struct device_node *dp) |
137 | { | 137 | { |
138 | struct property *prop; | ||
139 | |||
138 | if (tlb_type == hypervisor) { | 140 | if (tlb_type == hypervisor) { |
139 | struct linux_prom64_registers reg; | 141 | struct linux_prom64_registers *reg; |
142 | int len; | ||
140 | 143 | ||
141 | if (prom_getproplen(prom_node, "cpuid") == 4) | 144 | prop = of_find_property(dp, "cpuid", &len); |
142 | return prom_getintdefault(prom_node, "cpuid", 0); | 145 | if (prop && len == 4) |
146 | return *(int *) prop->value; | ||
143 | 147 | ||
144 | prom_getproperty(prom_node, "reg", (char *) ®, sizeof(reg)); | 148 | prop = of_find_property(dp, "reg", NULL); |
145 | return (reg.phys_addr >> 32) & 0x0fffffffUL; | 149 | reg = prop->value; |
150 | return (reg[0].phys_addr >> 32) & 0x0fffffffUL; | ||
146 | } else { | 151 | } else { |
147 | const char *prop_name = cpu_mid_prop(); | 152 | const char *prop_name = cpu_mid_prop(); |
148 | 153 | ||
149 | return prom_getintdefault(prom_node, prop_name, 0); | 154 | prop = of_find_property(dp, prop_name, NULL); |
155 | if (prop) | ||
156 | return *(int *) prop->value; | ||
157 | return 0; | ||
150 | } | 158 | } |
151 | } | 159 | } |
152 | 160 | ||
153 | static int check_cpu_node(int nd, int *cur_inst, | 161 | static int check_cpu_node(struct device_node *dp, int *cur_inst, |
154 | int (*compare)(int, int, void *), void *compare_arg, | 162 | int (*compare)(struct device_node *, int, void *), |
155 | int *prom_node, int *mid) | 163 | void *compare_arg, |
164 | struct device_node **dev_node, int *mid) | ||
156 | { | 165 | { |
157 | char node_str[128]; | 166 | if (strcmp(dp->type, "cpu")) |
158 | |||
159 | prom_getstring(nd, "device_type", node_str, sizeof(node_str)); | ||
160 | if (strcmp(node_str, "cpu")) | ||
161 | return -ENODEV; | 167 | return -ENODEV; |
162 | 168 | ||
163 | if (!compare(nd, *cur_inst, compare_arg)) { | 169 | if (!compare(dp, *cur_inst, compare_arg)) { |
164 | if (prom_node) | 170 | if (dev_node) |
165 | *prom_node = nd; | 171 | *dev_node = dp; |
166 | if (mid) | 172 | if (mid) |
167 | *mid = get_cpu_mid(nd); | 173 | *mid = get_cpu_mid(dp); |
168 | return 0; | 174 | return 0; |
169 | } | 175 | } |
170 | 176 | ||
@@ -173,25 +179,18 @@ static int check_cpu_node(int nd, int *cur_inst, | |||
173 | return -ENODEV; | 179 | return -ENODEV; |
174 | } | 180 | } |
175 | 181 | ||
176 | static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg, | 182 | static int __cpu_find_by(int (*compare)(struct device_node *, int, void *), |
177 | int *prom_node, int *mid) | 183 | void *compare_arg, |
184 | struct device_node **dev_node, int *mid) | ||
178 | { | 185 | { |
179 | int nd, cur_inst, err; | 186 | struct device_node *dp; |
187 | int cur_inst; | ||
180 | 188 | ||
181 | nd = prom_root_node; | ||
182 | cur_inst = 0; | 189 | cur_inst = 0; |
183 | 190 | for_each_node_by_type(dp, "cpu") { | |
184 | err = check_cpu_node(nd, &cur_inst, | 191 | int err = check_cpu_node(dp, &cur_inst, |
185 | compare, compare_arg, | 192 | compare, compare_arg, |
186 | prom_node, mid); | 193 | dev_node, mid); |
187 | if (err == 0) | ||
188 | return 0; | ||
189 | |||
190 | nd = prom_getchild(nd); | ||
191 | while ((nd = prom_getsibling(nd)) != 0) { | ||
192 | err = check_cpu_node(nd, &cur_inst, | ||
193 | compare, compare_arg, | ||
194 | prom_node, mid); | ||
195 | if (err == 0) | 194 | if (err == 0) |
196 | return 0; | 195 | return 0; |
197 | } | 196 | } |
@@ -199,7 +198,7 @@ static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg, | |||
199 | return -ENODEV; | 198 | return -ENODEV; |
200 | } | 199 | } |
201 | 200 | ||
202 | static int cpu_instance_compare(int nd, int instance, void *_arg) | 201 | static int cpu_instance_compare(struct device_node *dp, int instance, void *_arg) |
203 | { | 202 | { |
204 | int desired_instance = (int) (long) _arg; | 203 | int desired_instance = (int) (long) _arg; |
205 | 204 | ||
@@ -208,27 +207,27 @@ static int cpu_instance_compare(int nd, int instance, void *_arg) | |||
208 | return -ENODEV; | 207 | return -ENODEV; |
209 | } | 208 | } |
210 | 209 | ||
211 | int cpu_find_by_instance(int instance, int *prom_node, int *mid) | 210 | int cpu_find_by_instance(int instance, struct device_node **dev_node, int *mid) |
212 | { | 211 | { |
213 | return __cpu_find_by(cpu_instance_compare, (void *)(long)instance, | 212 | return __cpu_find_by(cpu_instance_compare, (void *)(long)instance, |
214 | prom_node, mid); | 213 | dev_node, mid); |
215 | } | 214 | } |
216 | 215 | ||
217 | static int cpu_mid_compare(int nd, int instance, void *_arg) | 216 | static int cpu_mid_compare(struct device_node *dp, int instance, void *_arg) |
218 | { | 217 | { |
219 | int desired_mid = (int) (long) _arg; | 218 | int desired_mid = (int) (long) _arg; |
220 | int this_mid; | 219 | int this_mid; |
221 | 220 | ||
222 | this_mid = get_cpu_mid(nd); | 221 | this_mid = get_cpu_mid(dp); |
223 | if (this_mid == desired_mid) | 222 | if (this_mid == desired_mid) |
224 | return 0; | 223 | return 0; |
225 | return -ENODEV; | 224 | return -ENODEV; |
226 | } | 225 | } |
227 | 226 | ||
228 | int cpu_find_by_mid(int mid, int *prom_node) | 227 | int cpu_find_by_mid(int mid, struct device_node **dev_node) |
229 | { | 228 | { |
230 | return __cpu_find_by(cpu_mid_compare, (void *)(long)mid, | 229 | return __cpu_find_by(cpu_mid_compare, (void *)(long)mid, |
231 | prom_node, NULL); | 230 | dev_node, NULL); |
232 | } | 231 | } |
233 | 232 | ||
234 | void __init device_scan(void) | 233 | void __init device_scan(void) |
@@ -240,50 +239,47 @@ void __init device_scan(void) | |||
240 | 239 | ||
241 | #ifndef CONFIG_SMP | 240 | #ifndef CONFIG_SMP |
242 | { | 241 | { |
243 | int err, cpu_node, def; | 242 | struct device_node *dp; |
243 | int err, def; | ||
244 | 244 | ||
245 | err = cpu_find_by_instance(0, &cpu_node, NULL); | 245 | err = cpu_find_by_instance(0, &dp, NULL); |
246 | if (err) { | 246 | if (err) { |
247 | prom_printf("No cpu nodes, cannot continue\n"); | 247 | prom_printf("No cpu nodes, cannot continue\n"); |
248 | prom_halt(); | 248 | prom_halt(); |
249 | } | 249 | } |
250 | cpu_data(0).clock_tick = prom_getintdefault(cpu_node, | 250 | cpu_data(0).clock_tick = |
251 | "clock-frequency", | 251 | of_getintprop_default(dp, "clock-frequency", 0); |
252 | 0); | ||
253 | 252 | ||
254 | def = ((tlb_type == hypervisor) ? | 253 | def = ((tlb_type == hypervisor) ? |
255 | (8 * 1024) : | 254 | (8 * 1024) : |
256 | (16 * 1024)); | 255 | (16 * 1024)); |
257 | cpu_data(0).dcache_size = prom_getintdefault(cpu_node, | 256 | cpu_data(0).dcache_size = of_getintprop_default(dp, |
258 | "dcache-size", | 257 | "dcache-size", |
259 | def); | 258 | def); |
260 | 259 | ||
261 | def = 32; | 260 | def = 32; |
262 | cpu_data(0).dcache_line_size = | 261 | cpu_data(0).dcache_line_size = |
263 | prom_getintdefault(cpu_node, "dcache-line-size", | 262 | of_getintprop_default(dp, "dcache-line-size", def); |
264 | def); | ||
265 | 263 | ||
266 | def = 16 * 1024; | 264 | def = 16 * 1024; |
267 | cpu_data(0).icache_size = prom_getintdefault(cpu_node, | 265 | cpu_data(0).icache_size = of_getintprop_default(dp, |
268 | "icache-size", | 266 | "icache-size", |
269 | def); | 267 | def); |
270 | 268 | ||
271 | def = 32; | 269 | def = 32; |
272 | cpu_data(0).icache_line_size = | 270 | cpu_data(0).icache_line_size = |
273 | prom_getintdefault(cpu_node, "icache-line-size", | 271 | of_getintprop_default(dp, "icache-line-size", def); |
274 | def); | ||
275 | 272 | ||
276 | def = ((tlb_type == hypervisor) ? | 273 | def = ((tlb_type == hypervisor) ? |
277 | (3 * 1024 * 1024) : | 274 | (3 * 1024 * 1024) : |
278 | (4 * 1024 * 1024)); | 275 | (4 * 1024 * 1024)); |
279 | cpu_data(0).ecache_size = prom_getintdefault(cpu_node, | 276 | cpu_data(0).ecache_size = of_getintprop_default(dp, |
280 | "ecache-size", | 277 | "ecache-size", |
281 | def); | 278 | def); |
282 | 279 | ||
283 | def = 64; | 280 | def = 64; |
284 | cpu_data(0).ecache_line_size = | 281 | cpu_data(0).ecache_line_size = |
285 | prom_getintdefault(cpu_node, "ecache-line-size", | 282 | of_getintprop_default(dp, "ecache-line-size", def); |
286 | def); | ||
287 | printk("CPU[0]: Caches " | 283 | printk("CPU[0]: Caches " |
288 | "D[sz(%d):line_sz(%d)] " | 284 | "D[sz(%d):line_sz(%d)] " |
289 | "I[sz(%d):line_sz(%d)] " | 285 | "I[sz(%d):line_sz(%d)] " |
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c index 91d1aa44efc1..4ce7b4620c09 100644 --- a/arch/sparc64/kernel/pci_sabre.c +++ b/arch/sparc64/kernel/pci_sabre.c | |||
@@ -1455,16 +1455,13 @@ void sabre_init(struct device_node *dp, char *model_name) | |||
1455 | hummingbird_p = 1; | 1455 | hummingbird_p = 1; |
1456 | } | 1456 | } |
1457 | if (!hummingbird_p) { | 1457 | if (!hummingbird_p) { |
1458 | char compat[64]; | 1458 | struct device_node *dp; |
1459 | int cpu_node; | ||
1460 | 1459 | ||
1461 | /* Of course, Sun has to encode things a thousand | 1460 | /* Of course, Sun has to encode things a thousand |
1462 | * different ways, inconsistently. | 1461 | * different ways, inconsistently. |
1463 | */ | 1462 | */ |
1464 | cpu_find_by_instance(0, &cpu_node, NULL); | 1463 | cpu_find_by_instance(0, &dp, NULL); |
1465 | if (prom_getproperty(cpu_node, "name", | 1464 | if (!strcmp(dp->name, "SUNW,UltraSPARC-IIe")) |
1466 | compat, sizeof(compat)) > 0 && | ||
1467 | !strcmp(compat, "SUNW,UltraSPARC-IIe")) | ||
1468 | hummingbird_p = 1; | 1465 | hummingbird_p = 1; |
1469 | } | 1466 | } |
1470 | } | 1467 | } |
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index f03d52d0b88d..f62bf3a2de1a 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <asm/starfire.h> | 39 | #include <asm/starfire.h> |
40 | #include <asm/tlb.h> | 40 | #include <asm/tlb.h> |
41 | #include <asm/sections.h> | 41 | #include <asm/sections.h> |
42 | #include <asm/prom.h> | ||
42 | 43 | ||
43 | extern void calibrate_delay(void); | 44 | extern void calibrate_delay(void); |
44 | 45 | ||
@@ -76,41 +77,42 @@ void smp_bogo(struct seq_file *m) | |||
76 | 77 | ||
77 | void __init smp_store_cpu_info(int id) | 78 | void __init smp_store_cpu_info(int id) |
78 | { | 79 | { |
79 | int cpu_node, def; | 80 | struct device_node *dp; |
81 | int def; | ||
80 | 82 | ||
81 | /* multiplier and counter set by | 83 | /* multiplier and counter set by |
82 | smp_setup_percpu_timer() */ | 84 | smp_setup_percpu_timer() */ |
83 | cpu_data(id).udelay_val = loops_per_jiffy; | 85 | cpu_data(id).udelay_val = loops_per_jiffy; |
84 | 86 | ||
85 | cpu_find_by_mid(id, &cpu_node); | 87 | cpu_find_by_mid(id, &dp); |
86 | cpu_data(id).clock_tick = prom_getintdefault(cpu_node, | 88 | cpu_data(id).clock_tick = |
87 | "clock-frequency", 0); | 89 | of_getintprop_default(dp, "clock-frequency", 0); |
88 | 90 | ||
89 | def = ((tlb_type == hypervisor) ? (8 * 1024) : (16 * 1024)); | 91 | def = ((tlb_type == hypervisor) ? (8 * 1024) : (16 * 1024)); |
90 | cpu_data(id).dcache_size = prom_getintdefault(cpu_node, "dcache-size", | 92 | cpu_data(id).dcache_size = |
91 | def); | 93 | of_getintprop_default(dp, "dcache-size", def); |
92 | 94 | ||
93 | def = 32; | 95 | def = 32; |
94 | cpu_data(id).dcache_line_size = | 96 | cpu_data(id).dcache_line_size = |
95 | prom_getintdefault(cpu_node, "dcache-line-size", def); | 97 | of_getintprop_default(dp, "dcache-line-size", def); |
96 | 98 | ||
97 | def = 16 * 1024; | 99 | def = 16 * 1024; |
98 | cpu_data(id).icache_size = prom_getintdefault(cpu_node, "icache-size", | 100 | cpu_data(id).icache_size = |
99 | def); | 101 | of_getintprop_default(dp, "icache-size", def); |
100 | 102 | ||
101 | def = 32; | 103 | def = 32; |
102 | cpu_data(id).icache_line_size = | 104 | cpu_data(id).icache_line_size = |
103 | prom_getintdefault(cpu_node, "icache-line-size", def); | 105 | of_getintprop_default(dp, "icache-line-size", def); |
104 | 106 | ||
105 | def = ((tlb_type == hypervisor) ? | 107 | def = ((tlb_type == hypervisor) ? |
106 | (3 * 1024 * 1024) : | 108 | (3 * 1024 * 1024) : |
107 | (4 * 1024 * 1024)); | 109 | (4 * 1024 * 1024)); |
108 | cpu_data(id).ecache_size = prom_getintdefault(cpu_node, "ecache-size", | 110 | cpu_data(id).ecache_size = |
109 | def); | 111 | of_getintprop_default(dp, "ecache-size", def); |
110 | 112 | ||
111 | def = 64; | 113 | def = 64; |
112 | cpu_data(id).ecache_line_size = | 114 | cpu_data(id).ecache_line_size = |
113 | prom_getintdefault(cpu_node, "ecache-line-size", def); | 115 | of_getintprop_default(dp, "ecache-line-size", def); |
114 | 116 | ||
115 | printk("CPU[%d]: Caches " | 117 | printk("CPU[%d]: Caches " |
116 | "D[sz(%d):line_sz(%d)] " | 118 | "D[sz(%d):line_sz(%d)] " |
@@ -342,10 +344,10 @@ static int __devinit smp_boot_one_cpu(unsigned int cpu) | |||
342 | 344 | ||
343 | prom_startcpu_cpuid(cpu, entry, cookie); | 345 | prom_startcpu_cpuid(cpu, entry, cookie); |
344 | } else { | 346 | } else { |
345 | int cpu_node; | 347 | struct device_node *dp; |
346 | 348 | ||
347 | cpu_find_by_mid(cpu, &cpu_node); | 349 | cpu_find_by_mid(cpu, &dp); |
348 | prom_startcpu(cpu_node, entry, cookie); | 350 | prom_startcpu(dp->node, entry, cookie); |
349 | } | 351 | } |
350 | 352 | ||
351 | for (timeout = 0; timeout < 5000000; timeout++) { | 353 | for (timeout = 0; timeout < 5000000; timeout++) { |
@@ -1289,7 +1291,8 @@ int setup_profiling_timer(unsigned int multiplier) | |||
1289 | 1291 | ||
1290 | static void __init smp_tune_scheduling(void) | 1292 | static void __init smp_tune_scheduling(void) |
1291 | { | 1293 | { |
1292 | int instance, node; | 1294 | struct device_node *dp; |
1295 | int instance; | ||
1293 | unsigned int def, smallest = ~0U; | 1296 | unsigned int def, smallest = ~0U; |
1294 | 1297 | ||
1295 | def = ((tlb_type == hypervisor) ? | 1298 | def = ((tlb_type == hypervisor) ? |
@@ -1297,10 +1300,10 @@ static void __init smp_tune_scheduling(void) | |||
1297 | (4 * 1024 * 1024)); | 1300 | (4 * 1024 * 1024)); |
1298 | 1301 | ||
1299 | instance = 0; | 1302 | instance = 0; |
1300 | while (!cpu_find_by_instance(instance, &node, NULL)) { | 1303 | while (!cpu_find_by_instance(instance, &dp, NULL)) { |
1301 | unsigned int val; | 1304 | unsigned int val; |
1302 | 1305 | ||
1303 | val = prom_getintdefault(node, "ecache-size", def); | 1306 | val = of_getintprop_default(dp, "ecache-size", def); |
1304 | if (val < smallest) | 1307 | if (val < smallest) |
1305 | smallest = val; | 1308 | smallest = val; |
1306 | 1309 | ||
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c index 0f00a99927e9..aa5438a4fd50 100644 --- a/arch/sparc64/kernel/time.c +++ b/arch/sparc64/kernel/time.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <asm/sections.h> | 48 | #include <asm/sections.h> |
49 | #include <asm/cpudata.h> | 49 | #include <asm/cpudata.h> |
50 | #include <asm/uaccess.h> | 50 | #include <asm/uaccess.h> |
51 | #include <asm/prom.h> | ||
51 | 52 | ||
52 | DEFINE_SPINLOCK(mostek_lock); | 53 | DEFINE_SPINLOCK(mostek_lock); |
53 | DEFINE_SPINLOCK(rtc_lock); | 54 | DEFINE_SPINLOCK(rtc_lock); |
@@ -983,12 +984,14 @@ try_isa_clock: | |||
983 | /* This is gets the master TICK_INT timer going. */ | 984 | /* This is gets the master TICK_INT timer going. */ |
984 | static unsigned long sparc64_init_timers(void) | 985 | static unsigned long sparc64_init_timers(void) |
985 | { | 986 | { |
987 | struct device_node *dp; | ||
988 | struct property *prop; | ||
986 | unsigned long clock; | 989 | unsigned long clock; |
987 | int node; | ||
988 | #ifdef CONFIG_SMP | 990 | #ifdef CONFIG_SMP |
989 | extern void smp_tick_init(void); | 991 | extern void smp_tick_init(void); |
990 | #endif | 992 | #endif |
991 | 993 | ||
994 | dp = of_find_node_by_path("/"); | ||
992 | if (tlb_type == spitfire) { | 995 | if (tlb_type == spitfire) { |
993 | unsigned long ver, manuf, impl; | 996 | unsigned long ver, manuf, impl; |
994 | 997 | ||
@@ -999,18 +1002,17 @@ static unsigned long sparc64_init_timers(void) | |||
999 | if (manuf == 0x17 && impl == 0x13) { | 1002 | if (manuf == 0x17 && impl == 0x13) { |
1000 | /* Hummingbird, aka Ultra-IIe */ | 1003 | /* Hummingbird, aka Ultra-IIe */ |
1001 | tick_ops = &hbtick_operations; | 1004 | tick_ops = &hbtick_operations; |
1002 | node = prom_root_node; | 1005 | prop = of_find_property(dp, "stick-frequency", NULL); |
1003 | clock = prom_getint(node, "stick-frequency"); | ||
1004 | } else { | 1006 | } else { |
1005 | tick_ops = &tick_operations; | 1007 | tick_ops = &tick_operations; |
1006 | cpu_find_by_instance(0, &node, NULL); | 1008 | cpu_find_by_instance(0, &dp, NULL); |
1007 | clock = prom_getint(node, "clock-frequency"); | 1009 | prop = of_find_property(dp, "clock-frequency", NULL); |
1008 | } | 1010 | } |
1009 | } else { | 1011 | } else { |
1010 | tick_ops = &stick_operations; | 1012 | tick_ops = &stick_operations; |
1011 | node = prom_root_node; | 1013 | prop = of_find_property(dp, "stick-frequency", NULL); |
1012 | clock = prom_getint(node, "stick-frequency"); | ||
1013 | } | 1014 | } |
1015 | clock = *(unsigned int *) prop->value; | ||
1014 | timer_tick_offset = clock / HZ; | 1016 | timer_tick_offset = clock / HZ; |
1015 | 1017 | ||
1016 | #ifdef CONFIG_SMP | 1018 | #ifdef CONFIG_SMP |
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index 5059cbd4feee..1ff34b019f3f 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #ifdef CONFIG_KMOD | 42 | #ifdef CONFIG_KMOD |
43 | #include <linux/kmod.h> | 43 | #include <linux/kmod.h> |
44 | #endif | 44 | #endif |
45 | #include <asm/prom.h> | ||
45 | 46 | ||
46 | ATOMIC_NOTIFIER_HEAD(sparc64die_chain); | 47 | ATOMIC_NOTIFIER_HEAD(sparc64die_chain); |
47 | 48 | ||
@@ -807,7 +808,8 @@ extern unsigned int cheetah_deferred_trap_vector[], cheetah_deferred_trap_vector | |||
807 | void __init cheetah_ecache_flush_init(void) | 808 | void __init cheetah_ecache_flush_init(void) |
808 | { | 809 | { |
809 | unsigned long largest_size, smallest_linesize, order, ver; | 810 | unsigned long largest_size, smallest_linesize, order, ver; |
810 | int node, i, instance; | 811 | struct device_node *dp; |
812 | int i, instance, sz; | ||
811 | 813 | ||
812 | /* Scan all cpu device tree nodes, note two values: | 814 | /* Scan all cpu device tree nodes, note two values: |
813 | * 1) largest E-cache size | 815 | * 1) largest E-cache size |
@@ -817,14 +819,14 @@ void __init cheetah_ecache_flush_init(void) | |||
817 | smallest_linesize = ~0UL; | 819 | smallest_linesize = ~0UL; |
818 | 820 | ||
819 | instance = 0; | 821 | instance = 0; |
820 | while (!cpu_find_by_instance(instance, &node, NULL)) { | 822 | while (!cpu_find_by_instance(instance, &dp, NULL)) { |
821 | unsigned long val; | 823 | unsigned long val; |
822 | 824 | ||
823 | val = prom_getintdefault(node, "ecache-size", | 825 | val = of_getintprop_default(dp, "ecache-size", |
824 | (2 * 1024 * 1024)); | 826 | (2 * 1024 * 1024)); |
825 | if (val > largest_size) | 827 | if (val > largest_size) |
826 | largest_size = val; | 828 | largest_size = val; |
827 | val = prom_getintdefault(node, "ecache-line-size", 64); | 829 | val = of_getintprop_default(dp, "ecache-line-size", 64); |
828 | if (val < smallest_linesize) | 830 | if (val < smallest_linesize) |
829 | smallest_linesize = val; | 831 | smallest_linesize = val; |
830 | instance++; | 832 | instance++; |
@@ -849,16 +851,16 @@ void __init cheetah_ecache_flush_init(void) | |||
849 | } | 851 | } |
850 | 852 | ||
851 | /* Now allocate error trap reporting scoreboard. */ | 853 | /* Now allocate error trap reporting scoreboard. */ |
852 | node = NR_CPUS * (2 * sizeof(struct cheetah_err_info)); | 854 | sz = NR_CPUS * (2 * sizeof(struct cheetah_err_info)); |
853 | for (order = 0; order < MAX_ORDER; order++) { | 855 | for (order = 0; order < MAX_ORDER; order++) { |
854 | if ((PAGE_SIZE << order) >= node) | 856 | if ((PAGE_SIZE << order) >= sz) |
855 | break; | 857 | break; |
856 | } | 858 | } |
857 | cheetah_error_log = (struct cheetah_err_info *) | 859 | cheetah_error_log = (struct cheetah_err_info *) |
858 | __get_free_pages(GFP_KERNEL, order); | 860 | __get_free_pages(GFP_KERNEL, order); |
859 | if (!cheetah_error_log) { | 861 | if (!cheetah_error_log) { |
860 | prom_printf("cheetah_ecache_flush_init: Failed to allocate " | 862 | prom_printf("cheetah_ecache_flush_init: Failed to allocate " |
861 | "error logging scoreboard (%d bytes).\n", node); | 863 | "error logging scoreboard (%d bytes).\n", sz); |
862 | prom_halt(); | 864 | prom_halt(); |
863 | } | 865 | } |
864 | memset(cheetah_error_log, 0, PAGE_SIZE << order); | 866 | memset(cheetah_error_log, 0, PAGE_SIZE << order); |