Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/vax Add CPU_INFO_INTERATOR/FOREACH support.
details: https://anonhg.NetBSD.org/src/rev/e253de9e10e3
branches: trunk
changeset: 559534:e253de9e10e3
user: matt <matt%NetBSD.org@localhost>
date: Fri Mar 19 20:17:51 2004 +0000
description:
Add CPU_INFO_INTERATOR/FOREACH support.
diffstat:
sys/arch/vax/include/cpu.h | 10 +++++++++-
sys/arch/vax/vax/multicpu.c | 14 ++++++++------
sys/arch/vax/vax/pmap.c | 5 +++--
3 files changed, 20 insertions(+), 9 deletions(-)
diffs (107 lines):
diff -r e9bc10712379 -r e253de9e10e3 sys/arch/vax/include/cpu.h
--- a/sys/arch/vax/include/cpu.h Fri Mar 19 20:15:21 2004 +0000
+++ b/sys/arch/vax/include/cpu.h Fri Mar 19 20:17:51 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.68 2004/01/22 01:24:10 matt Exp $ */
+/* $NetBSD: cpu.h,v 1.69 2004/03/19 20:17:51 matt Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden
@@ -55,6 +55,7 @@
#ifdef _KERNEL
#include <sys/cdefs.h>
+#include <sys/queue.h>
#include <sys/device.h>
#include <sys/lock.h>
#include <sys/sched.h>
@@ -147,6 +148,7 @@
int ci_flags; /* See below */
long ci_ipimsgs; /* Sent IPI bits */
struct trapframe *ci_ddb_regs; /* Used by DDB */
+ SIMPLEQ_ENTRY(cpu_info) ci_next; /* next cpu_info */
#endif
};
#define CI_MASTERCPU 1 /* Set if master CPU */
@@ -180,6 +182,12 @@
#if defined(MULTIPROCESSOR)
#define CPU_IS_PRIMARY(ci) ((ci)->ci_flags & CI_MASTERCPU)
+#define CPU_INFO_ITERATOR int
+#define CPU_INFO_FOREACH(cii, ci) cii = 0, ci = SIMPLEQ_FIRST(&cpus); \
+ ci != NULL; \
+ ci = SIMPLEQ_NEXT(ci, ci_next)
+
+extern SIMPLEQ_HEAD(cpu_info_qh, cpu_info) cpus;
extern char tramp;
#endif
diff -r e9bc10712379 -r e253de9e10e3 sys/arch/vax/vax/multicpu.c
--- a/sys/arch/vax/vax/multicpu.c Fri Mar 19 20:15:21 2004 +0000
+++ b/sys/arch/vax/vax/multicpu.c Fri Mar 19 20:17:51 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: multicpu.c,v 1.15 2003/07/15 02:15:05 lukem Exp $ */
+/* $NetBSD: multicpu.c,v 1.16 2004/03/19 20:17:51 matt Exp $ */
/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: multicpu.c,v 1.15 2003/07/15 02:15:05 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: multicpu.c,v 1.16 2004/03/19 20:17:51 matt Exp $");
#include "opt_multiprocessor.h"
@@ -66,6 +66,7 @@
SIMPLEQ_HEAD(, cpuq) cpuq = SIMPLEQ_HEAD_INITIALIZER(cpuq);
extern long avail_start, avail_end, proc0paddr;
+struct cpu_info_qh cpus = SIMPLEQ_HEAD_INITIALIZER(cpus);
void
cpu_boot_secondary_processors()
@@ -124,11 +125,12 @@
ci = &sc->sc_ci;
ci->ci_dev = dev;
ci->ci_exit = scratch;
- (u_long)ci->ci_pcb = (u_long)pcb & ~KERNBASE;
+ ci->ci_pcb = (void *)((intptr_t)pcb & ~KERNBASE);
ci->ci_istack = istackbase + PAGE_SIZE;
- pcb->KSP = (u_long)pcb + USPACE; /* Idle kernel stack */
- pcb->SSP = (u_long)ci;
- pcb->PC = (u_long)slaverun + 2;
+ SIMPLEQ_INSERT_TAIL(&cpus, ci, ci_next);
+ pcb->KSP = (uintptr_t)pcb + USPACE; /* Idle kernel stack */
+ pcb->SSP = (uintptr_t)ci;
+ pcb->PC = (uintptr_t)slaverun + 2;
pcb->PSL = 0;
cq = malloc(sizeof(*cq), M_TEMP, M_NOWAIT);
diff -r e9bc10712379 -r e253de9e10e3 sys/arch/vax/vax/pmap.c
--- a/sys/arch/vax/vax/pmap.c Fri Mar 19 20:15:21 2004 +0000
+++ b/sys/arch/vax/vax/pmap.c Fri Mar 19 20:17:51 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.133 2004/02/13 11:36:20 wiz Exp $ */
+/* $NetBSD: pmap.c,v 1.134 2004/03/19 20:17:51 matt Exp $ */
/*
* Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.133 2004/02/13 11:36:20 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.134 2004/03/19 20:17:51 matt Exp $");
#include "opt_ddb.h"
#include "opt_cputype.h"
@@ -396,6 +396,7 @@
curcpu()->ci_dev = (void *)(pcb->SSP + sizeof(struct cpu_info));
#if defined(MULTIPROCESSOR)
curcpu()->ci_flags = CI_MASTERCPU|CI_RUNNING;
+ SIMPLEQ_FIRST(&cpus) = curcpu();
#endif
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
simple_lock_init(&pvtable_lock);
Home |
Main Index |
Thread Index |
Old Index