33 * Initial setup-routines for HP 9000 based hardware.
44 *
55 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
6- * Modifications for PA-RISC (C) 1999 Helge Deller <deller@gmx.de>
6+ * Modifications for PA-RISC (C) 1999-2008 Helge Deller <deller@gmx.de>
77 * Modifications copyright 1999 SuSE GmbH (Philipp Rumpf)
88 * Modifications copyright 2000 Martin K. Petersen <mkp@mkp.net>
99 * Modifications copyright 2000 Philipp Rumpf <prumpf@tux.org>
4646struct system_cpuinfo_parisc boot_cpu_data __read_mostly ;
4747EXPORT_SYMBOL (boot_cpu_data );
4848
49- struct cpuinfo_parisc cpu_data [ NR_CPUS ] __read_mostly ;
49+ DEFINE_PER_CPU ( struct cpuinfo_parisc , cpu_data ) ;
5050
5151extern int update_cr16_clocksource (void ); /* from time.c */
5252
@@ -68,6 +68,23 @@ extern int update_cr16_clocksource(void); /* from time.c */
6868** The initialization of OS data structures is the same (done below).
6969*/
7070
71+ /**
72+ * init_cpu_profiler - enable/setup per cpu profiling hooks.
73+ * @cpunum: The processor instance.
74+ *
75+ * FIXME: doesn't do much yet...
76+ */
77+ static void __cpuinit
78+ init_percpu_prof (unsigned long cpunum )
79+ {
80+ struct cpuinfo_parisc * p ;
81+
82+ p = & per_cpu (cpu_data , cpunum );
83+ p -> prof_counter = 1 ;
84+ p -> prof_multiplier = 1 ;
85+ }
86+
87+
7188/**
7289 * processor_probe - Determine if processor driver should claim this device.
7390 * @dev: The device which has been found.
@@ -147,7 +164,7 @@ static int __cpuinit processor_probe(struct parisc_device *dev)
147164 }
148165#endif
149166
150- p = & cpu_data [ cpuid ] ;
167+ p = & per_cpu ( cpu_data , cpuid ) ;
151168 boot_cpu_data .cpu_count ++ ;
152169
153170 /* initialize counters - CPU 0 gets it_value set in time_init() */
@@ -162,12 +179,9 @@ static int __cpuinit processor_probe(struct parisc_device *dev)
162179#ifdef CONFIG_SMP
163180 /*
164181 ** FIXME: review if any other initialization is clobbered
165- ** for boot_cpu by the above memset().
182+ ** for boot_cpu by the above memset().
166183 */
167-
168- /* stolen from init_percpu_prof() */
169- cpu_data [cpuid ].prof_counter = 1 ;
170- cpu_data [cpuid ].prof_multiplier = 1 ;
184+ init_percpu_prof (cpuid );
171185#endif
172186
173187 /*
@@ -261,19 +275,6 @@ void __init collect_boot_cpu_data(void)
261275}
262276
263277
264- /**
265- * init_cpu_profiler - enable/setup per cpu profiling hooks.
266- * @cpunum: The processor instance.
267- *
268- * FIXME: doesn't do much yet...
269- */
270- static inline void __init
271- init_percpu_prof (int cpunum )
272- {
273- cpu_data [cpunum ].prof_counter = 1 ;
274- cpu_data [cpunum ].prof_multiplier = 1 ;
275- }
276-
277278
278279/**
279280 * init_per_cpu - Handle individual processor initializations.
@@ -293,7 +294,7 @@ init_percpu_prof(int cpunum)
293294 *
294295 * o Enable CPU profiling hooks.
295296 */
296- int __init init_per_cpu (int cpunum )
297+ int __cpuinit init_per_cpu (int cpunum )
297298{
298299 int ret ;
299300 struct pdc_coproc_cfg coproc_cfg ;
@@ -307,8 +308,8 @@ int __init init_per_cpu(int cpunum)
307308 /* FWIW, FP rev/model is a more accurate way to determine
308309 ** CPU type. CPU rev/model has some ambiguous cases.
309310 */
310- cpu_data [ cpunum ] .fp_rev = coproc_cfg .revision ;
311- cpu_data [ cpunum ] .fp_model = coproc_cfg .model ;
311+ per_cpu ( cpu_data , cpunum ) .fp_rev = coproc_cfg .revision ;
312+ per_cpu ( cpu_data , cpunum ) .fp_model = coproc_cfg .model ;
312313
313314 printk (KERN_INFO "FP[%d] enabled: Rev %ld Model %ld\n" ,
314315 cpunum , coproc_cfg .revision , coproc_cfg .model );
@@ -344,16 +345,17 @@ int __init init_per_cpu(int cpunum)
344345int
345346show_cpuinfo (struct seq_file * m , void * v )
346347{
347- int n ;
348+ unsigned long cpu ;
348349
349- for (n = 0 ; n < boot_cpu_data .cpu_count ; n ++ ) {
350+ for_each_online_cpu (cpu ) {
351+ const struct cpuinfo_parisc * cpuinfo = & per_cpu (cpu_data , cpu );
350352#ifdef CONFIG_SMP
351- if (0 == cpu_data [ n ]. hpa )
353+ if (0 == cpuinfo -> hpa )
352354 continue ;
353355#endif
354- seq_printf (m , "processor\t: %d \n"
356+ seq_printf (m , "processor\t: %lu \n"
355357 "cpu family\t: PA-RISC %s\n" ,
356- n , boot_cpu_data .family_name );
358+ cpu , boot_cpu_data .family_name );
357359
358360 seq_printf (m , "cpu\t\t: %s\n" , boot_cpu_data .cpu_name );
359361
@@ -365,8 +367,8 @@ show_cpuinfo (struct seq_file *m, void *v)
365367 seq_printf (m , "model\t\t: %s\n"
366368 "model name\t: %s\n" ,
367369 boot_cpu_data .pdc .sys_model_name ,
368- cpu_data [ n ]. dev ?
369- cpu_data [ n ]. dev -> name : "Unknown" );
370+ cpuinfo -> dev ?
371+ cpuinfo -> dev -> name : "Unknown" );
370372
371373 seq_printf (m , "hversion\t: 0x%08x\n"
372374 "sversion\t: 0x%08x\n" ,
@@ -377,8 +379,8 @@ show_cpuinfo (struct seq_file *m, void *v)
377379 show_cache_info (m );
378380
379381 seq_printf (m , "bogomips\t: %lu.%02lu\n" ,
380- cpu_data [ n ]. loops_per_jiffy / (500000 / HZ ),
381- (cpu_data [ n ]. loops_per_jiffy / (5000 / HZ )) % 100 );
382+ cpuinfo -> loops_per_jiffy / (500000 / HZ ),
383+ (cpuinfo -> loops_per_jiffy / (5000 / HZ )) % 100 );
382384
383385 seq_printf (m , "software id\t: %ld\n\n" ,
384386 boot_cpu_data .pdc .model .sw_id );
0 commit comments