Move cpu_info and related info into <machine/cpu.h>, and implement the

other MP API components discussed on tech-smp.
This commit is contained in:
thorpej 1999-08-10 23:35:43 +00:00
parent 213802d0d3
commit 6be04b7f5c
13 changed files with 111 additions and 131 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat_13_machdep.c,v 1.4 1999/02/23 03:20:00 thorpej Exp $ */
/* $NetBSD: compat_13_machdep.c,v 1.5 1999/08/10 23:35:43 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.4 1999/02/23 03:20:00 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.5 1999/08/10 23:35:43 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -44,8 +44,6 @@ __KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.4 1999/02/23 03:20:00 thorpe
#include <machine/reg.h>
#include <machine/alpha.h>
#include <alpha/alpha/cpuvar.h>
/*
* System call to cleanup state after a signal
* has been taken. Reset signal mask and

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.37 1999/07/06 21:44:11 thorpej Exp $ */
/* $NetBSD: cpu.c,v 1.38 1999/08/10 23:35:43 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -66,7 +66,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.37 1999/07/06 21:44:11 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.38 1999/08/10 23:35:43 thorpej Exp $");
#include "opt_multiprocessor.h"
@ -84,8 +84,6 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.37 1999/07/06 21:44:11 thorpej Exp $");
#include <machine/prom.h>
#include <machine/alpha.h>
#include <alpha/alpha/cpuvar.h>
#if defined(MULTIPROCESSOR)
#include <sys/malloc.h>
#include <sys/kthread.h>

View File

@ -1,83 +0,0 @@
/* $NetBSD: cpuvar.h,v 1.4 1999/02/23 03:20:01 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ALPHA_ALPHA_CPUVAR_H_
#define _ALPHA_ALPHA_CPUVAR_H_
#include <sys/lock.h>
#define CPUF_PRIMARY 0x00000001 /* CPU is primary CPU */
struct cpu_info {
struct proc *ci_curproc; /* current owner of the processor */
struct proc *ci_fpcurproc; /* current owner of the FPU */
paddr_t ci_curpcb; /* PA of current HW context */
struct simplelock ci_slock; /* spin lock */
u_long ci_cpuid; /* CPU ID */
struct proc *ci_idle_thread; /* our idle thread */
u_long ci_flags; /* flags; see below */
u_long ci_ipis; /* interprocessor interrupts pending */
struct device *ci_dev; /* pointer to our device */
};
#ifdef _KERNEL
#ifndef _LKM
#include "opt_multiprocessor.h"
#endif
#ifdef MULTIPROCESSOR
extern unsigned long cpus_running;
extern struct cpu_info cpu_info[];
/*
* Map per-cpu variables to the cpu_info structure.
* XXX alpha_pal_whami() might be expensive, here!
*/
#define curproc cpu_info[alpha_pal_whami()].ci_curproc
#define fpcurproc cpu_info[alpha_pal_whami()].ci_fpcurproc
#define curpcb cpu_info[alpha_pal_whami()].ci_curpcb
#else
extern struct proc *fpcurproc; /* current owner of FPU */
extern paddr_t curpcb; /* PA of current HW context */
#endif /* MULTIPROCESSOR */
#endif /* _KERNEL */
#endif /* _ALPHA_ALPHA_CPUVAR_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: genassym.c,v 1.23 1999/07/01 20:11:39 thorpej Exp $ */
/* $NetBSD: genassym.c,v 1.24 1999/08/10 23:35:43 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@ -62,7 +62,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__RCSID("$NetBSD: genassym.c,v 1.23 1999/07/01 20:11:39 thorpej Exp $");
__RCSID("$NetBSD: genassym.c,v 1.24 1999/08/10 23:35:43 thorpej Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -80,8 +80,6 @@ __RCSID("$NetBSD: genassym.c,v 1.23 1999/07/01 20:11:39 thorpej Exp $");
#include <machine/rpb.h>
#include <machine/vmparam.h>
#include <alpha/alpha/cpuvar.h>
#include <vm/vm.h>
/* Note: Avoid /usr/include for cross compilation! */
@ -216,6 +214,7 @@ struct nv assyms[] = {
def1(SYS___sigreturn14),
def1(SYS_exit),
#if defined(MULTIPROCESSOR)
/* CPU info */
def1(ALPHA_MAXPROCS),
def(SIZEOF_CPU_INFO, sizeof(struct cpu_info)),
@ -223,6 +222,7 @@ struct nv assyms[] = {
off(CPU_INFO_FPCURPROC, struct cpu_info, ci_fpcurproc),
off(CPU_INFO_CURPCB, struct cpu_info, ci_curpcb),
off(CPU_INFO_IDLE_THREAD, struct cpu_info, ci_idle_thread),
#endif
};
int nassyms = sizeof(assyms)/sizeof(assyms[0]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: interrupt.c,v 1.39 1999/03/24 05:50:50 mrg Exp $ */
/* $NetBSD: interrupt.c,v 1.40 1999/08/10 23:35:43 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -36,7 +36,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.39 1999/03/24 05:50:50 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.40 1999/08/10 23:35:43 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -59,7 +59,6 @@ __KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.39 1999/03/24 05:50:50 mrg Exp $");
#if defined(MULTIPROCESSOR)
#include <sys/device.h>
#include <alpha/alpha/cpuvar.h>
#endif
static u_int schedclk2;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ipifuncs.c,v 1.5 1999/02/24 19:17:09 thorpej Exp $ */
/* $NetBSD: ipifuncs.c,v 1.6 1999/08/10 23:35:44 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -39,7 +39,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.5 1999/02/24 19:17:09 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.6 1999/08/10 23:35:44 thorpej Exp $");
/*
* Interprocessor interrupt handlers.
@ -56,8 +56,6 @@ __KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.5 1999/02/24 19:17:09 thorpej Exp $")
#include <machine/intr.h>
#include <machine/rpb.h>
#include <alpha/alpha/cpuvar.h>
void alpha_ipi_halt __P((void));
void alpha_ipi_tbia __P((void));
void alpha_ipi_tbiap __P((void));

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.178 1999/08/10 18:53:03 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.179 1999/08/10 23:35:44 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -80,7 +80,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.178 1999/08/10 18:53:03 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.179 1999/08/10 23:35:44 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -125,8 +125,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.178 1999/08/10 18:53:03 thorpej Exp $"
#include <machine/conf.h>
#include <machine/ieeefp.h>
#include <alpha/alpha/cpuvar.h>
#include <net/netisr.h>
#include <net/if.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.107 1999/07/28 23:23:46 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.108 1999/08/10 23:35:44 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -155,7 +155,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.107 1999/07/28 23:23:46 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.108 1999/08/10 23:35:44 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -179,10 +179,6 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.107 1999/07/28 23:23:46 thorpej Exp $");
#include <machine/rpb.h>
#endif
#if defined(MULTIPROCESSOR)
#include <alpha/alpha/cpuvar.h>
#endif
#ifdef DEBUG
#define PDB_FOLLOW 0x0001
#define PDB_INIT 0x0002

View File

@ -1,4 +1,4 @@
/* $NetBSD: process_machdep.c,v 1.12 1999/02/23 03:20:03 thorpej Exp $ */
/* $NetBSD: process_machdep.c,v 1.13 1999/08/10 23:35:45 thorpej Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
@ -54,7 +54,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.12 1999/02/23 03:20:03 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.13 1999/08/10 23:35:45 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -64,12 +64,11 @@ __KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.12 1999/02/23 03:20:03 thorpej
#include <sys/vnode.h>
#include <sys/ptrace.h>
#include <machine/cpu.h>
#include <machine/reg.h>
#include <machine/frame.h>
#include <machine/alpha.h>
#include <alpha/alpha/cpuvar.h>
#define process_frame(p) ((p)->p_md.md_tf)
#define process_pcb(p) (&(p)->p_addr->u_pcb)
#define process_fpframe(p) (&(process_pcb(p)->pcb_fp))

View File

@ -1,4 +1,4 @@
/* $NetBSD: prom.c,v 1.37 1999/07/11 22:37:12 ross Exp $ */
/* $NetBSD: prom.c,v 1.38 1999/08/10 23:35:45 thorpej Exp $ */
/*
* Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University
@ -27,7 +27,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.37 1999/07/11 22:37:12 ross Exp $");
__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.38 1999/08/10 23:35:45 thorpej Exp $");
#include "opt_multiprocessor.h"
@ -38,13 +38,12 @@ __KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.37 1999/07/11 22:37:12 ross Exp $");
#include <sys/proc.h>
#include <sys/user.h>
#include <machine/cpu.h>
#include <machine/rpb.h>
#include <machine/alpha.h>
#define ENABLEPROM
#include <machine/prom.h>
#include <alpha/alpha/cpuvar.h>
#include <dev/cons.h>
/* XXX this is to fake out the console routines, while booting. */

View File

@ -1,4 +1,41 @@
/* $NetBSD: cpu.h,v 1.31 1999/08/10 21:08:05 thorpej Exp $ */
/* $NetBSD: cpu.h,v 1.32 1999/08/10 23:35:46 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1988 University of Utah.
@ -45,12 +82,59 @@
#ifndef _ALPHA_CPU_H_
#define _ALPHA_CPU_H_
#if defined(_KERNEL) && !defined(_LKM)
#include "opt_multiprocessor.h"
#endif
/*
* Exported definitions unique to Alpha cpu support.
*/
#include <machine/frame.h>
#if defined(MULTIPROCESSOR)
#include <sys/lock.h> /* will also get LOCKDEBUG */
struct cpu_info {
/*
* Public members.
*/
struct proc *ci_curproc; /* current owner of the processor */
struct simplelock ci_slock; /* lock on this data structure */
cpuid_t ci_cpuid; /* our CPU ID */
#if defined(DIAGNOSTIC) || defined(LOCKDEBUG)
u_long ci_spin_locks; /* # of spin locks held */
u_long ci_simple_locks; /* # of simple locks held */
#endif
/*
* Private members.
*/
struct proc *ci_fpcurproc; /* current owner of the FPU */
paddr_t ci_curpcb; /* PA of current HW PCB */
struct proc *ci_idle_thread; /* our idle thread */
u_long ci_flags; /* flags; see below */
u_long ci_ipis; /* interprocessor interrupts pending */
struct device *ci_dev; /* pointer to our device */
};
#define CPUF_PRIMARY 0x01 /* CPU is primary CPU */
#define CPUF_PRESENT 0x02 /* CPU is present */
#define CPUF_RUNNING 0x04 /* CPU is running */
extern u_long cpus_running;
extern struct cpu_info cpu_info[];
#define curcpu() (&cpu_info[cpu_number()])
#define fpcurproc curcpu()->ci_fpcurproc
#define curpcb curcpu()->ci_curpcb
#else
extern struct proc *fpcurproc; /* current owner of FPU */
extern paddr_t curpcb; /* PA of current HW context */
#endif /* MULTIPROCESSOR */
/*
* definitions of cpu-dependent requirements
* referenced in generic code

View File

@ -1,4 +1,4 @@
/* $NetBSD: proc.h,v 1.4 1999/02/23 03:20:04 thorpej Exp $ */
/* $NetBSD: proc.h,v 1.5 1999/08/10 23:35:47 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -27,11 +27,6 @@
* rights to redistribute these changes.
*/
#ifdef _KERNEL
/* For `curproc' multiprocessor glue. */
#include <alpha/alpha/cpuvar.h>
#endif /* _KERNEL */
/*
* Machine-dependent part of the proc struct for the Alpha.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: tlsb.c,v 1.18 1999/04/10 01:21:38 cgd Exp $ */
/* $NetBSD: tlsb.c,v 1.19 1999/08/10 23:35:47 thorpej Exp $ */
/*
* Copyright (c) 1997 by Matthew Jacob
* NASA AMES Research Center.
@ -39,7 +39,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tlsb.c,v 1.18 1999/04/10 01:21:38 cgd Exp $");
__KERNEL_RCSID(0, "$NetBSD: tlsb.c,v 1.19 1999/08/10 23:35:47 thorpej Exp $");
#include "opt_multiprocessor.h"
@ -49,12 +49,11 @@ __KERNEL_RCSID(0, "$NetBSD: tlsb.c,v 1.18 1999/04/10 01:21:38 cgd Exp $");
#include <sys/malloc.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/rpb.h>
#include <machine/pte.h>
#include <machine/alpha.h>
#include <alpha/alpha/cpuvar.h>
#include <alpha/tlsb/tlsbreg.h>
#include <alpha/tlsb/tlsbvar.h>