summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKanoj Sarcar <kanoj@engr.sgi.com>2000-06-02 02:54:57 +0000
committerKanoj Sarcar <kanoj@engr.sgi.com>2000-06-02 02:54:57 +0000
commitc3ca47d82249494d78411059037a21b1f5601a70 (patch)
treed60153710eadf42bcb98e3726872356722e4cf97
parenta916eb8bd34f611c149dc6d15addfb158dda2333 (diff)
Most of the kernel arrays/data structures and low level procedures
now accept the kernel assigned cpuid (instead of the prom assigned id) as input/index. The only exception is the early boot up code.
-rw-r--r--arch/mips64/sgi-ip27/ip27-init.c39
-rw-r--r--arch/mips64/sgi-ip27/ip27-irq.c12
-rw-r--r--arch/mips64/sgi-ip27/ip27-nmi.c4
-rw-r--r--include/asm-mips64/sn/addrs.h2
-rw-r--r--include/asm-mips64/sn/sn_private.h4
5 files changed, 31 insertions, 30 deletions
diff --git a/arch/mips64/sgi-ip27/ip27-init.c b/arch/mips64/sgi-ip27/ip27-init.c
index 044a891e2..533e96054 100644
--- a/arch/mips64/sgi-ip27/ip27-init.c
+++ b/arch/mips64/sgi-ip27/ip27-init.c
@@ -160,17 +160,22 @@ cpuid_t cpu_node_probe(cpumask_t *boot_cpumask, int *numnodes)
return(highest + 1);
}
-void alloc_cpupda(int i)
+/*
+ * Takes as first input the PROM assigned cpu id, and the kernel
+ * assigned cpu id as the second.
+ */
+static void alloc_cpupda(cpuid_t cpu, int cpunum)
{
cnodeid_t node;
nasid_t nasid;
- node = get_cpu_cnode(i);
+ node = get_cpu_cnode(cpu);
nasid = COMPACT_TO_NASID_NODEID(node);
- cputonasid(i) = nasid;
- cputocnode(i) = node;
- cputoslice(i) = get_cpu_slice(i);
+ cputonasid(cpunum) = nasid;
+ cputocnode(cpunum) = node;
+ cputoslice(cpunum) = get_cpu_slice(cpu);
+ cpu_data[cpunum].p_cpuid = cpu;
}
int cpu_enabled(cpuid_t cpu)
@@ -180,15 +185,6 @@ int cpu_enabled(cpuid_t cpu)
return (CPUMASK_TSTB(boot_cpumask, cpu) != 0);
}
-void initpdas(void)
-{
- cpuid_t i;
-
- for (i = 0; i < maxcpus; i++)
- if (cpu_enabled(i))
- alloc_cpupda(i);
-}
-
void mlreset (void)
{
int i;
@@ -202,7 +198,6 @@ void mlreset (void)
CPUMASK_CLRALL(boot_cpumask);
maxcpus = cpu_node_probe(&boot_cpumask, &numnodes);
printk("Discovered %d cpus on %d nodes\n", maxcpus, numnodes);
- initpdas();
gen_region_mask(&region_mask, numnodes);
CNODEMASK_CLRALL(hub_init_mask);
@@ -320,7 +315,7 @@ void per_cpu_init(void)
extern void install_cpu_nmi_handler(int slice);
extern void load_mmu(void);
static int is_slave = 0;
- cpuid_t cpu = getcpuid();
+ int cpu = smp_processor_id();
cnodeid_t cnode = get_compact_nodeid();
current_cpu_data.asid_cache = ASID_FIRST_VERSION;
@@ -333,7 +328,7 @@ void per_cpu_init(void)
if (smp_processor_id()) /* master can't do this early, no kmalloc */
install_cpuintr(cpu);
/* Install our NMI handler if symmon hasn't installed one. */
- install_cpu_nmi_handler(cputoslice(smp_processor_id()));
+ install_cpu_nmi_handler(cputoslice(cpu));
#if 0
install_tlbintr(cpu);
#endif
@@ -400,13 +395,13 @@ void cboot(void)
void allowboot(void)
{
int num_cpus = 0;
- cpuid_t cpu;
+ cpuid_t cpu, mycpuid = getcpuid();
cnodeid_t cnode;
extern void bootstrap(void);
sn_mp_setup();
/* Master has already done per_cpu_init() */
- install_cpuintr(getcpuid());
+ install_cpuintr(smp_processor_id());
#if 0
bte_lateinit();
ecc_init();
@@ -415,7 +410,8 @@ void allowboot(void)
boot_barrier = boot_cpumask;
/* Launch slaves. */
for (cpu = 0; cpu < maxcpus; cpu++) {
- if (cpu == smp_processor_id()) {
+ if (cpu == mycpuid) {
+ alloc_cpupda(cpu, num_cpus);
num_cpus++;
/* We're already started, clear our bit */
CPUMASK_CLRB(boot_barrier, cpu);
@@ -434,6 +430,7 @@ void allowboot(void)
p = init_task.prev_task;
sprintf(p->comm, "%s%d", "Idle", num_cpus);
init_tasks[num_cpus] = p;
+ alloc_cpupda(cpu, num_cpus);
p->processor = num_cpus;
p->has_cpu = 1; /* we schedule the first task manually */
del_from_runqueue(p);
@@ -449,7 +446,7 @@ void allowboot(void)
* created idle process, gp to the proc struct
* (so that current-> works).
*/
- LAUNCH_SLAVE(cputonasid(cpu), cputoslice(cpu),
+ LAUNCH_SLAVE(cputonasid(num_cpus),cputoslice(num_cpus),
(launch_proc_t)bootstrap, 0,
(void *)((unsigned long)p+KERNEL_STACK_SIZE - 32),
(void *)p);
diff --git a/arch/mips64/sgi-ip27/ip27-irq.c b/arch/mips64/sgi-ip27/ip27-irq.c
index d1c38430c..6b148bca7 100644
--- a/arch/mips64/sgi-ip27/ip27-irq.c
+++ b/arch/mips64/sgi-ip27/ip27-irq.c
@@ -65,8 +65,8 @@ irq_cpustat_t irq_stat [NR_CPUS];
extern asmlinkage void ip27_irq(void);
extern int irq_to_bus[], irq_to_slot[], bus_to_cpu[];
int (*irq_cannonicalize)(int irq);
-int intr_connect_level(cpuid_t cpu, int bit);
-int intr_disconnect_level(cpuid_t cpu, int bit);
+int intr_connect_level(int cpu, int bit);
+int intr_disconnect_level(int cpu, int bit);
unsigned int local_bh_count[NR_CPUS];
unsigned int local_irq_count[NR_CPUS];
@@ -615,7 +615,7 @@ static hub_intmasks_t *intr_get_ptrs(cpuid_t cpu, int bit, int *new_bit,
return hub_intmasks;
}
-int intr_connect_level(cpuid_t cpu, int bit)
+int intr_connect_level(int cpu, int bit)
{
int ip;
int slice = cputoslice(cpu);
@@ -641,7 +641,7 @@ int intr_connect_level(cpuid_t cpu, int bit)
return(0);
}
-int intr_disconnect_level(cpuid_t cpu, int bit)
+int intr_disconnect_level(int cpu, int bit)
{
int ip;
int slice = cputoslice(cpu);
@@ -668,7 +668,7 @@ void handle_resched_intr(int irq, void *dev_id, struct pt_regs *regs)
/* Nothing, the return from intr will work for us */
}
-void install_cpuintr(cpuid_t cpu)
+void install_cpuintr(int cpu)
{
int irq;
extern void smp_call_function_interrupt(void);
@@ -711,7 +711,7 @@ void install_cpuintr(cpuid_t cpu)
#endif /* CONFIG_SMP */
}
-void install_tlbintr(cpuid_t cpu)
+void install_tlbintr(int cpu)
{
int intr_bit = N_INTPEND_BITS + TLB_INTR_A + cputoslice(cpu);
diff --git a/arch/mips64/sgi-ip27/ip27-nmi.c b/arch/mips64/sgi-ip27/ip27-nmi.c
index 3511c62e7..baf8d70fa 100644
--- a/arch/mips64/sgi-ip27/ip27-nmi.c
+++ b/arch/mips64/sgi-ip27/ip27-nmi.c
@@ -145,6 +145,10 @@ cont_nmi_dump(void)
cpu = CNODE_TO_CPU_BASE(node);
for (n=0; n < CNODE_NUM_CPUS(node); cpu++, n++) {
CPUMASK_SETB(nmied_cpus, cpu);
+ /*
+ * cputonasid, cputoslice
+ * needs kernel cpuid
+ */
SEND_NMI((cputonasid(cpu)), (cputoslice(cpu)));
}
}
diff --git a/include/asm-mips64/sn/addrs.h b/include/asm-mips64/sn/addrs.h
index 225adb30c..ab7719a3d 100644
--- a/include/asm-mips64/sn/addrs.h
+++ b/include/asm-mips64/sn/addrs.h
@@ -145,7 +145,7 @@
#define UALIAS_FLIP_BASE UALIAS_BASE
#define UALIAS_FLIP_SIZE 0x20000
#define UALIAS_FLIP_BIT 0x10000
-#define UALIAS_FLIP_ADDR(_x) (cputoslice(getcpuid()) ? \
+#define UALIAS_FLIP_ADDR(_x) (cputoslice(smp_processor_id()) ? \
(_x) ^ UALIAS_FLIP_BIT : (_x))
#define LBOOT_BASE (HSPEC_BASE + 0x10000000)
diff --git a/include/asm-mips64/sn/sn_private.h b/include/asm-mips64/sn/sn_private.h
index 08d31c90b..bb84f16b8 100644
--- a/include/asm-mips64/sn/sn_private.h
+++ b/include/asm-mips64/sn/sn_private.h
@@ -2,5 +2,5 @@ extern cnodeid_t get_compact_nodeid(void);
extern void hub_rtc_init(cnodeid_t);
extern void cpu_time_init(void);
extern void per_cpu_init(void);
-extern void install_cpuintr(cpuid_t cpu);
-extern void install_tlbintr(cpuid_t cpu);
+extern void install_cpuintr(int cpu);
+extern void install_tlbintr(int cpu);