Add basic interprocessor interrupt sending and receiving code. Current
IPI functions: HALT, IMB, TBIA, TBIAP. XXX HALT is not yet implemented, it's just a stub.
This commit is contained in:
parent
78d445810b
commit
2c50ec242f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: interrupt.c,v 1.29 1998/09/24 23:28:17 thorpej Exp $ */
|
||||
/* $NetBSD: interrupt.c,v 1.30 1998/09/26 00:03:51 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.29 1998/09/24 23:28:17 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.30 1998/09/26 00:03:51 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -56,6 +56,11 @@ __KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.29 1998/09/24 23:28:17 thorpej Exp $
|
|||
#include <machine/frame.h>
|
||||
#include <machine/cpuconf.h>
|
||||
|
||||
#if defined(MULTIPROCESSOR)
|
||||
#include <sys/device.h>
|
||||
#include <alpha/alpha/cpuvar.h>
|
||||
#endif
|
||||
|
||||
#ifdef EVCNT_COUNTERS
|
||||
#include <sys/device.h>
|
||||
struct evcnt clock_intr_evcnt; /* event counter for clock intrs. */
|
||||
|
@ -72,13 +77,34 @@ interrupt(a0, a1, a2, framep)
|
|||
switch (a0) {
|
||||
case ALPHA_INTR_XPROC: /* interprocessor interrupt */
|
||||
#if defined(MULTIPROCESSOR)
|
||||
{
|
||||
struct cpu_softc *sc;
|
||||
u_long cpu_id = alpha_pal_whami();
|
||||
u_long pending_ipis, bit;
|
||||
|
||||
sc = cpus[cpu_id];
|
||||
#ifdef DIAGNOSTIC
|
||||
if (sc == NULL) {
|
||||
/* XXX panic? */
|
||||
printf("WARNING: no cpu_softc for ID %lu\n",
|
||||
cpu_id);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
pending_ipis = alpha_atomic_loadlatch_q(&sc->sc_ipis, 0);
|
||||
for (bit = 0; bit < ALPHA_NIPIS; bit++)
|
||||
if (pending_ipis & (1UL << bit))
|
||||
(*ipifuncs[bit])();
|
||||
|
||||
/*
|
||||
* Handle inter-console messages if we're the primary
|
||||
* CPU.
|
||||
*/
|
||||
if (alpha_pal_whami() == hwrpb->rpb_primary_cpu_id &&
|
||||
if (cpu_id == hwrpb->rpb_primary_cpu_id &&
|
||||
hwrpb->rpb_txrdy != 0)
|
||||
cpu_iccb_receive();
|
||||
}
|
||||
#else
|
||||
printf("WARNING: received interprocessor interrupt!\n");
|
||||
#endif /* MULTIPROCESSOR */
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
/* $NetBSD: ipifuncs.c,v 1.1 1998/09/26 00:03:52 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 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.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.1 1998/09/26 00:03:52 thorpej Exp $");
|
||||
|
||||
/*
|
||||
* Interprocessor interrupt handlers.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/alpha_cpu.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/rpb.h>
|
||||
|
||||
#include <alpha/alpha/cpuvar.h>
|
||||
|
||||
void alpha_ipi_halt __P((void));
|
||||
void alpha_ipi_imb __P((void));
|
||||
void alpha_ipi_tbia __P((void));
|
||||
void alpha_ipi_tbiap __P((void));
|
||||
|
||||
ipifunc_t ipifuncs[ALPHA_NIPIS] = {
|
||||
alpha_ipi_halt,
|
||||
alpha_ipi_imb,
|
||||
alpha_ipi_tbia,
|
||||
alpha_ipi_tbiap,
|
||||
};
|
||||
|
||||
/*
|
||||
* Send an interprocessor interrupt.
|
||||
*/
|
||||
void
|
||||
alpha_send_ipi(cpu_id, ipinum)
|
||||
u_long cpu_id, ipinum;
|
||||
{
|
||||
struct cpu_softc *sc;
|
||||
u_long ipimask;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (ipinum >= ALPHA_NIPIS)
|
||||
panic("alpha_sched_ipi: bogus ipinum");
|
||||
|
||||
if (cpu_id >= hwrpb->rpb_pcs_cnt || (sc = cpus[cpu_id]) == NULL)
|
||||
panic("alpha_sched_ipi: bogus cpu_id");
|
||||
#endif
|
||||
|
||||
ipimask = (1UL << ipinum);
|
||||
alpha_atomic_setbits_q(&sc->sc_ipis, ipimask);
|
||||
alpha_pal_wripir(cpu_id);
|
||||
}
|
||||
|
||||
void
|
||||
alpha_ipi_halt()
|
||||
{
|
||||
|
||||
/* XXX Implement me! */
|
||||
}
|
||||
|
||||
void
|
||||
alpha_ipi_imb()
|
||||
{
|
||||
|
||||
alpha_pal_imb();
|
||||
}
|
||||
|
||||
void
|
||||
alpha_ipi_tbia()
|
||||
{
|
||||
|
||||
ALPHA_TBIA();
|
||||
}
|
||||
|
||||
void
|
||||
alpha_ipi_tbiap()
|
||||
{
|
||||
|
||||
ALPHA_TBIAP();
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.alpha,v 1.91 1998/09/24 22:32:36 thorpej Exp $
|
||||
# $NetBSD: files.alpha,v 1.92 1998/09/26 00:03:52 thorpej Exp $
|
||||
#
|
||||
# alpha-specific configuration info
|
||||
|
||||
|
@ -387,6 +387,7 @@ file arch/alpha/alpha/clock.c
|
|||
file arch/alpha/alpha/conf.c
|
||||
file arch/alpha/alpha/cpuconf.c
|
||||
file arch/alpha/alpha/interrupt.c
|
||||
file arch/alpha/alpha/ipifuncs.c multiprocessor
|
||||
file arch/alpha/alpha/lock_machdep.c multiprocessor
|
||||
file arch/alpha/alpha/machdep.c
|
||||
file arch/alpha/alpha/mainbus.c
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: intr.h,v 1.17 1998/09/25 22:06:33 thorpej Exp $ */
|
||||
/* $NetBSD: intr.h,v 1.18 1998/09/26 00:03:52 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -90,6 +90,20 @@ extern u_int64_t ssir;
|
|||
#define setsoftclock() ssir |= SIR_CLOCK
|
||||
#define setsoftserial() ssir |= SIR_SERIAL
|
||||
|
||||
/*
|
||||
* Interprocessor interrupts.
|
||||
*/
|
||||
#define ALPHA_IPI_HALT 0UL /* halt processor */
|
||||
#define ALPHA_IPI_IMB 1UL /* perform an I-stream barrier */
|
||||
#define ALPHA_IPI_TBIA 2UL /* TBI all TB entries */
|
||||
#define ALPHA_IPI_TBIAP 3UL /* TBI all per-process TB entries */
|
||||
#define ALPHA_NIPIS 4UL /* must not exceed 64 */
|
||||
|
||||
typedef void (*ipifunc_t) __P((void));
|
||||
extern ipifunc_t ipifuncs[ALPHA_NIPIS];
|
||||
|
||||
void alpha_send_ipi __P((unsigned long, unsigned long));
|
||||
|
||||
/*
|
||||
* Alpha shared-interrupt-line common code.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue