It appears that MI code requires ci_cpuid to be the CPU number of the CPU

in question, whereas the ARM code was using it to hold the model
identification.  To fix this, rename:

ci_cpuid -> ci_arm_cpuid
ci_cputype -> ci_arm_cputype (for consistency)
ci_cpurev -> ci_arm_cpurev (ditto)
ci_cpunum -> ci_cpuid

This makes top(1) give correct CPU numbers in its "STATE" column (all 0 for
now).
This commit is contained in:
bjh21 2002-10-13 12:24:57 +00:00
parent bd4a91a822
commit 75248cc7a1
5 changed files with 24 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hydra.c,v 1.12 2002/10/12 21:06:46 bjh21 Exp $ */
/* $NetBSD: hydra.c,v 1.13 2002/10/13 12:24:57 bjh21 Exp $ */
/*-
* Copyright (c) 2002 Ben Harris
@ -29,7 +29,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: hydra.c,v 1.12 2002/10/12 21:06:46 bjh21 Exp $");
__KERNEL_RCSID(0, "$NetBSD: hydra.c,v 1.13 2002/10/13 12:24:57 bjh21 Exp $");
#include <sys/device.h>
#include <sys/systm.h>
@ -314,7 +314,7 @@ cpu_hydra_attach(struct device *parent, struct device *self, void *aux)
/* Set up a struct cpu_info for this CPU */
cpu_info[slave | HYDRA_ID_ISSLAVE] = &cpu->sc_cpuinfo;
cpu->sc_cpuinfo.ci_dev = &cpu->sc_dev;
cpu->sc_cpuinfo.ci_cpunum = slave | HYDRA_ID_ISSLAVE;
cpu->sc_cpuinfo.ci_cpuid = slave | HYDRA_ID_ISSLAVE;
if (cpu_alloc_idlepcb(&cpu->sc_cpuinfo) != 0) {
printf(": couldn't allocate idle PCB.\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.5 2002/10/12 21:06:46 bjh21 Exp $ */
/* $NetBSD: cpu.h,v 1.6 2002/10/13 12:24:57 bjh21 Exp $ */
/*-
* Copyright (c) 2002 Ben Harris
@ -34,7 +34,7 @@
void cpu_boot_secondary_processors(void);
#define MP_CPU_INFO_MEMBERS \
int ci_cpunum; \
cpuid_t ci_cpuid; \
struct proc *ci_curproc; \
struct pcb *ci_curpcb; \
struct pcb *ci_idlepcb;
@ -43,7 +43,7 @@ void cpu_boot_secondary_processors(void);
extern struct cpu_info *cpu_info[];
#define CPU_IS_PRIMARY(ci) ((ci)->ci_cpunum == 0)
#define CPU_IS_PRIMARY(ci) ((ci)->ci_cpuid == 0)
extern cpuid_t cpu_number(void);
#define curcpu() (cpu_info[cpu_number()])

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.43 2002/10/12 21:06:46 bjh21 Exp $ */
/* $NetBSD: cpu.c,v 1.44 2002/10/13 12:24:57 bjh21 Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe.
@ -45,7 +45,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.43 2002/10/12 21:06:46 bjh21 Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.44 2002/10/13 12:24:57 bjh21 Exp $");
#include <sys/systm.h>
#include <sys/malloc.h>
@ -86,19 +86,21 @@ cpu_attach(struct device *dv)
/* Get the cpu ID from coprocessor 15 */
curcpu()->ci_cpuid = cpu_id();
curcpu()->ci_cputype = curcpu()->ci_cpuid & CPU_ID_CPU_MASK;
curcpu()->ci_cpurev = curcpu()->ci_cpuid & CPU_ID_REVISION_MASK;
curcpu()->ci_arm_cpuid = cpu_id();
curcpu()->ci_arm_cputype = curcpu()->ci_arm_cpuid & CPU_ID_CPU_MASK;
curcpu()->ci_arm_cpurev =
curcpu()->ci_arm_cpuid & CPU_ID_REVISION_MASK;
identify_arm_cpu(dv, curcpu());
if (curcpu()->ci_cputype == CPU_ID_SA110 && curcpu()->ci_cpurev < 3) {
if (curcpu()->ci_arm_cputype == CPU_ID_SA110 &&
curcpu()->ci_arm_cpurev < 3) {
printf("%s: SA-110 with bugged STM^ instruction\n",
dv->dv_xname);
}
#ifdef CPU_ARM8
if ((curcpu()->ci_cpuid & CPU_ID_CPU_MASK) == CPU_ID_ARM810) {
if ((curcpu()->ci_arm_cpuid & CPU_ID_CPU_MASK) == CPU_ID_ARM810) {
int clock = arm8_clock_config(0, 0);
char *fclk;
printf("%s: ARM810 cp15=%02x", dv->dv_xname, clock);
@ -377,7 +379,7 @@ identify_arm_cpu(struct device *dv, struct cpu_info *ci)
enum cpu_class cpu_class;
int i;
cpuid = ci->ci_cpuid;
cpuid = ci->ci_arm_cpuid;
if (cpuid == 0) {
printf("Processor failed probe - no CPU ID\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: fault.c,v 1.24 2002/09/27 15:35:42 provos Exp $ */
/* $NetBSD: fault.c,v 1.25 2002/10/13 12:24:57 bjh21 Exp $ */
/*
* Copyright (c) 1994-1997 Mark Brinicombe.
@ -47,7 +47,7 @@
#include "opt_pmap_debug.h"
#include <sys/types.h>
__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.24 2002/09/27 15:35:42 provos Exp $");
__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.25 2002/10/13 12:24:57 bjh21 Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -645,7 +645,8 @@ prefetch_abort_handler(frame)
* There are bugs in the rev K SA110. This is a check for one
* of them.
*/
if (curcpu()->ci_cputype == CPU_ID_SA110 && curcpu()->ci_cpurev < 3) {
if (curcpu()->ci_arm_cputype == CPU_ID_SA110 &&
curcpu()->ci_arm_cpurev < 3) {
/* Always current pmap */
pt_entry_t *pte = vtopte((vaddr_t) fault_pc);
struct pmap *pmap = p->p_vmspace->vm_map.pmap;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.31 2002/10/12 21:06:47 bjh21 Exp $ */
/* $NetBSD: cpu.h,v 1.32 2002/10/13 12:24:58 bjh21 Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -203,9 +203,9 @@ struct cpu_info {
u_long ci_simple_locks; /* # of simple locks held */
#endif
struct device *ci_dev; /* Device corresponding to this CPU */
u_int32_t ci_cpuid; /* aggregate CPU id */
u_int32_t ci_cputype; /* CPU type */
u_int32_t ci_cpurev; /* CPU revision */
u_int32_t ci_arm_cpuid; /* aggregate CPU id */
u_int32_t ci_arm_cputype; /* CPU type */
u_int32_t ci_arm_cpurev; /* CPU revision */
u_int32_t ci_ctrl; /* The CPU control register */
struct evcnt ci_arm700bugcount;
#ifdef MULTIPROCESSOR