Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef017beb authored by Helge Deller's avatar Helge Deller Committed by Kyle McMartin
Browse files

parisc: Replace NR_CPUS in parisc code



parisc: Replace most arrays sized by NR_CPUS with percpu variables.

Signed-off-by: default avatarHelge Deller <deller@gmx.de>
Signed-off-by: default avatarKyle McMartin <kyle@mcmartin.ca>
parent 7f2347a4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <asm/ptrace.h>
#include <asm/types.h>
#include <asm/system.h>
#include <asm/percpu.h>
#endif /* __ASSEMBLY__ */

#define KERNEL_STACK_SIZE 	(4*PAGE_SIZE)
@@ -109,8 +110,7 @@ struct cpuinfo_parisc {
};

extern struct system_cpuinfo_parisc boot_cpu_data;
extern struct cpuinfo_parisc cpu_data[NR_CPUS];
#define current_cpu_data cpu_data[smp_processor_id()]
DECLARE_PER_CPU(struct cpuinfo_parisc, cpu_data);

#define CPU_HVERSION ((boot_cpu_data.hversion >> 4) & 0x0FFF)

+5 −4
Original line number Diff line number Diff line
@@ -298,7 +298,7 @@ unsigned long txn_affinity_addr(unsigned int irq, int cpu)
	irq_desc[irq].affinity = cpumask_of_cpu(cpu);
#endif

	return cpu_data[cpu].txn_addr;
	return per_cpu(cpu_data, cpu).txn_addr;
}


@@ -309,7 +309,8 @@ unsigned long txn_alloc_addr(unsigned int virt_irq)
	next_cpu++; /* assign to "next" CPU we want this bugger on */

	/* validate entry */
	while ((next_cpu < NR_CPUS) && (!cpu_data[next_cpu].txn_addr || 
	while ((next_cpu < NR_CPUS) &&
		(!per_cpu(cpu_data, next_cpu).txn_addr ||
		 !cpu_online(next_cpu)))
		next_cpu++;

@@ -359,7 +360,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)
		printk(KERN_DEBUG "redirecting irq %d from CPU %d to %d\n",
		       irq, smp_processor_id(), cpu);
		gsc_writel(irq + CPU_IRQ_BASE,
			   cpu_data[cpu].hpa);
			   per_cpu(cpu_data, cpu).hpa);
		goto set_out;
	}
#endif
+2 −2
Original line number Diff line number Diff line
@@ -541,9 +541,9 @@ static int __init perf_init(void)
	spin_lock_init(&perf_lock);

	/* TODO: this only lets us access the first cpu.. what to do for SMP? */
	cpu_device = cpu_data[0].dev;
	cpu_device = per_cpu(cpu_data, 0).dev;
	printk("Performance monitoring counters enabled for %s\n",
		cpu_data[0].dev->name);
		per_cpu(cpu_data, 0).dev->name);

	return 0;
}
+35 −33
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 *    Initial setup-routines for HP 9000 based hardware.
 *
 *    Copyright (C) 1991, 1992, 1995  Linus Torvalds
 *    Modifications for PA-RISC (C) 1999 Helge Deller <deller@gmx.de>
 *    Modifications for PA-RISC (C) 1999-2008 Helge Deller <deller@gmx.de>
 *    Modifications copyright 1999 SuSE GmbH (Philipp Rumpf)
 *    Modifications copyright 2000 Martin K. Petersen <mkp@mkp.net>
 *    Modifications copyright 2000 Philipp Rumpf <prumpf@tux.org>
@@ -46,7 +46,7 @@
struct system_cpuinfo_parisc boot_cpu_data __read_mostly;
EXPORT_SYMBOL(boot_cpu_data);

struct cpuinfo_parisc cpu_data[NR_CPUS] __read_mostly;
DEFINE_PER_CPU(struct cpuinfo_parisc, cpu_data);

extern int update_cr16_clocksource(void);	/* from time.c */

@@ -68,6 +68,23 @@ extern int update_cr16_clocksource(void); /* from time.c */
** The initialization of OS data structures is the same (done below).
*/

/**
 * init_cpu_profiler - enable/setup per cpu profiling hooks.
 * @cpunum: The processor instance.
 *
 * FIXME: doesn't do much yet...
 */
static void __cpuinit
init_percpu_prof(unsigned long cpunum)
{
	struct cpuinfo_parisc *p;

	p = &per_cpu(cpu_data, cpunum);
	p->prof_counter = 1;
	p->prof_multiplier = 1;
}


/**
 * processor_probe - Determine if processor driver should claim this device.
 * @dev: The device which has been found.
@@ -147,7 +164,7 @@ static int __cpuinit processor_probe(struct parisc_device *dev)
	}
#endif

	p = &cpu_data[cpuid];
	p = &per_cpu(cpu_data, cpuid);
	boot_cpu_data.cpu_count++;

	/* initialize counters - CPU 0 gets it_value set in time_init() */
@@ -164,10 +181,7 @@ static int __cpuinit processor_probe(struct parisc_device *dev)
	** FIXME: review if any other initialization is clobbered
	**	  for boot_cpu by the above memset().
	*/

	/* stolen from init_percpu_prof() */
	cpu_data[cpuid].prof_counter = 1;
	cpu_data[cpuid].prof_multiplier = 1;
	init_percpu_prof(cpuid);
#endif

	/*
@@ -261,19 +275,6 @@ void __init collect_boot_cpu_data(void)
}


/**
 * init_cpu_profiler - enable/setup per cpu profiling hooks.
 * @cpunum: The processor instance.
 *
 * FIXME: doesn't do much yet...
 */
static inline void __init
init_percpu_prof(int cpunum)
{
	cpu_data[cpunum].prof_counter = 1;
	cpu_data[cpunum].prof_multiplier = 1;
}


/**
 * init_per_cpu - Handle individual processor initializations.
@@ -293,7 +294,7 @@ init_percpu_prof(int cpunum)
 *
 * o Enable CPU profiling hooks.
 */
int __init init_per_cpu(int cpunum)
int __cpuinit init_per_cpu(int cpunum)
{
	int ret;
	struct pdc_coproc_cfg coproc_cfg;
@@ -307,8 +308,8 @@ int __init init_per_cpu(int cpunum)
		/* FWIW, FP rev/model is a more accurate way to determine
		** CPU type. CPU rev/model has some ambiguous cases.
		*/
		cpu_data[cpunum].fp_rev = coproc_cfg.revision;
		cpu_data[cpunum].fp_model = coproc_cfg.model;
		per_cpu(cpu_data, cpunum).fp_rev = coproc_cfg.revision;
		per_cpu(cpu_data, cpunum).fp_model = coproc_cfg.model;

		printk(KERN_INFO  "FP[%d] enabled: Rev %ld Model %ld\n",
			cpunum, coproc_cfg.revision, coproc_cfg.model);
@@ -344,16 +345,17 @@ int __init init_per_cpu(int cpunum)
int
show_cpuinfo (struct seq_file *m, void *v)
{
	int	n;
	unsigned long cpu;

	for(n=0; n<boot_cpu_data.cpu_count; n++) {
	for_each_online_cpu(cpu) {
		const struct cpuinfo_parisc *cpuinfo = &per_cpu(cpu_data, cpu);
#ifdef CONFIG_SMP
		if (0 == cpu_data[n].hpa)
		if (0 == cpuinfo->hpa)
			continue;
#endif
		seq_printf(m, "processor\t: %d\n"
		seq_printf(m, "processor\t: %lu\n"
				"cpu family\t: PA-RISC %s\n",
				 n, boot_cpu_data.family_name);
				 cpu, boot_cpu_data.family_name);

		seq_printf(m, "cpu\t\t: %s\n",  boot_cpu_data.cpu_name );

@@ -365,8 +367,8 @@ show_cpuinfo (struct seq_file *m, void *v)
		seq_printf(m, "model\t\t: %s\n"
				"model name\t: %s\n",
				 boot_cpu_data.pdc.sys_model_name,
				 cpu_data[n].dev ? 
				 cpu_data[n].dev->name : "Unknown" );
				 cpuinfo->dev ?
				 cpuinfo->dev->name : "Unknown");

		seq_printf(m, "hversion\t: 0x%08x\n"
			        "sversion\t: 0x%08x\n",
@@ -377,8 +379,8 @@ show_cpuinfo (struct seq_file *m, void *v)
		show_cache_info(m);

		seq_printf(m, "bogomips\t: %lu.%02lu\n",
			     cpu_data[n].loops_per_jiffy / (500000 / HZ),
			     (cpu_data[n].loops_per_jiffy / (5000 / HZ)) % 100);
			     cpuinfo->loops_per_jiffy / (500000 / HZ),
			     (cpuinfo->loops_per_jiffy / (5000 / HZ)) % 100);

		seq_printf(m, "software id\t: %ld\n\n",
				boot_cpu_data.pdc.model.sw_id);
+3 −3
Original line number Diff line number Diff line
@@ -316,7 +316,7 @@ static int __init parisc_init(void)
	
	processor_init();
	printk(KERN_INFO "CPU(s): %d x %s at %d.%06d MHz\n",
			boot_cpu_data.cpu_count,
			num_present_cpus(),
			boot_cpu_data.cpu_name,
			boot_cpu_data.cpu_hz / 1000000,
			boot_cpu_data.cpu_hz % 1000000	);
@@ -382,8 +382,8 @@ void start_parisc(void)
	if (ret >= 0 && coproc_cfg.ccr_functional) {
		mtctl(coproc_cfg.ccr_functional, 10);

		cpu_data[cpunum].fp_rev = coproc_cfg.revision;
		cpu_data[cpunum].fp_model = coproc_cfg.model;
		per_cpu(cpu_data, cpunum).fp_rev = coproc_cfg.revision;
		per_cpu(cpu_data, cpunum).fp_model = coproc_cfg.model;

		asm volatile ("fstd	%fr0,8(%sp)");
	} else {
Loading