mrg does not like me (ab)using dv_unit ;-)

Redo previous by just counting cpu instances, just like sparc does.
This commit is contained in:
martin 2006-09-14 09:00:14 +00:00
parent 8e5eebeeb2
commit 65c4655dde
1 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.49 2006/09/14 08:31:09 martin Exp $ */
/* $NetBSD: cpu.c,v 1.50 2006/09/14 09:00:14 martin Exp $ */
/*
* Copyright (c) 1996
@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.49 2006/09/14 08:31:09 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.50 2006/09/14 09:00:14 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -77,11 +77,12 @@ struct cacheinfo cacheinfo;
/* Linked list of all CPUs in system. */
int sparc_ncpus = 0;
struct cpu_info *cpus = NULL;
static int cpu_instance;
volatile cpuset_t cpus_active;/* set of active cpus */
struct cpu_bootargs *cpu_args; /* allocated very early in pmap_bootstrap. */
static struct cpu_info *alloc_cpuinfo(u_int, int);
static struct cpu_info *alloc_cpuinfo(u_int);
/* The following are used externally (sysctl_hw). */
char machine[] = MACHINE; /* from <machine/param.h> */
@ -102,7 +103,7 @@ extern struct cfdriver cpu_cd;
#define IU_VERS(v) ((((uint64_t)(v)) & VER_MASK) >> VER_MASK_SHIFT)
struct cpu_info *
alloc_cpuinfo(u_int cpu_node, int cpuno)
alloc_cpuinfo(u_int cpu_node)
{
paddr_t pa0, pa;
vaddr_t va, va0;
@ -146,7 +147,7 @@ alloc_cpuinfo(u_int cpu_node, int cpuno)
*/
cpi->ci_next = NULL;
cpi->ci_curlwp = NULL;
cpi->ci_number = cpuno;
cpi->ci_number = cpu_instance++;
cpi->ci_cpuid = portid;
cpi->ci_upaid = portid;
cpi->ci_fplwp = NULL;
@ -327,7 +328,7 @@ cpu_attach(struct device *parent, struct device *dev, void *aux)
* Allocate cpu_info structure if needed and save cache information
* in there.
*/
ci = alloc_cpuinfo((u_int)node, dev->dv_unit);
ci = alloc_cpuinfo((u_int)node);
printf("%s: upa id %d\n", dev->dv_xname, ci->ci_upaid);
}