From 49b511471346e04914e98b5acdf26558b55f77ac Mon Sep 17 00:00:00 2001 From: pk Date: Wed, 16 Sep 1998 13:36:23 +0000 Subject: [PATCH] Make all cpu info structures accessible through an array `cpus[_MAXNCPUS]'. --- sys/arch/sparc/sparc/cpu.c | 10 ++++++++-- sys/arch/sparc/sparc/cpuvar.h | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/arch/sparc/sparc/cpu.c b/sys/arch/sparc/sparc/cpu.c index 441aaa6edba6..4f42b38e9482 100644 --- a/sys/arch/sparc/sparc/cpu.c +++ b/sys/arch/sparc/sparc/cpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.68 1998/09/15 13:12:25 pk Exp $ */ +/* $NetBSD: cpu.c,v 1.69 1998/09/16 13:36:23 pk Exp $ */ /* * Copyright (c) 1996 @@ -91,7 +91,10 @@ struct cpu_softc { char machine[] = MACHINE; /* from */ char machine_arch[] = MACHINE_ARCH; /* from */ char cpu_model[100]; + int ncpu; +struct cpu_info *cpus[_MAXNCPU]; +#define CPU_MID2CPUNO(mid) ((mid) - 8) struct proc *fpproc; @@ -257,12 +260,15 @@ static struct cpu_softc *bootcpu; bootcpu = sc; cip = sc->sc_cpuinfo = (struct cpu_info *)CPUINFO_VA; cip->master = 1; + cpus[0] = cip; } else { cip = sc->sc_cpuinfo = alloc_cpuinfo(); } - if (mid != 0) + if (mid != 0) { printf(": mid %d", mid); + cpus[CPU_MID2CPUNO(mid)] = cip; + } cip->mid = mid; cip->node = node; diff --git a/sys/arch/sparc/sparc/cpuvar.h b/sys/arch/sparc/sparc/cpuvar.h index 515bd0d2a7ba..741e75c4feed 100644 --- a/sys/arch/sparc/sparc/cpuvar.h +++ b/sys/arch/sparc/sparc/cpuvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpuvar.h,v 1.10 1998/09/12 14:12:49 pk Exp $ */ +/* $NetBSD: cpuvar.h,v 1.11 1998/09/16 13:36:23 pk Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -278,6 +278,8 @@ void getcpuinfo __P((struct cpu_info *sc, int node)); void mmu_install_tables __P((struct cpu_info *)); void pmap_alloc_cpu __P((struct cpu_info *)); +extern struct cpu_info *cpus[]; + #define cpuinfo (*(struct cpu_info *)CPUINFO_VA) #endif /* _sparc_cpuvar_h */