MI softintr(9)'fy. Tested by bouyer@.
See also: http://mail-index.netbsd.org/port-next68k/2007/03/06/0000.html
This commit is contained in:
parent
ab9a36c548
commit
0d7a1d1146
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files.next68k,v 1.36 2005/12/11 12:18:25 christos Exp $
|
||||
# $NetBSD: files.next68k,v 1.37 2007/03/08 16:37:43 tsutsui Exp $
|
||||
|
||||
# next68k-specific configuration info
|
||||
|
||||
@ -37,6 +37,7 @@ file arch/m68k/m68k/db_memrw.c ddb | kgdb
|
||||
file arch/m68k/m68k/kgdb_machdep.c kgdb
|
||||
file arch/m68k/m68k/pmap_motorola.c
|
||||
file arch/m68k/m68k/procfs_machdep.c procfs
|
||||
file arch/m68k/m68k/softintr.c
|
||||
file arch/m68k/m68k/sys_machdep.c
|
||||
file arch/m68k/m68k/vm_machdep.c
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: zs.c,v 1.27 2005/12/11 12:18:25 christos Exp $ */
|
||||
/* $NetBSD: zs.c,v 1.28 2007/03/08 16:37:43 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -50,7 +50,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.27 2005/12/11 12:18:25 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.28 2007/03/08 16:37:43 tsutsui Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
@ -176,7 +176,6 @@ static int zs_attached;
|
||||
|
||||
/* Interrupt handlers. */
|
||||
static int zshard(void *);
|
||||
static void zssoft(void *);
|
||||
|
||||
static int zs_get_speed(struct zs_chanstate *);
|
||||
|
||||
@ -209,7 +208,7 @@ zs_attach(struct device *parent, struct device *self, void *aux)
|
||||
struct zsc_attach_args zsc_args;
|
||||
volatile struct zschan *zc;
|
||||
struct zs_chanstate *cs;
|
||||
int s, channel, sir;
|
||||
int s, channel;
|
||||
|
||||
zs_attached = 1;
|
||||
|
||||
@ -275,13 +274,10 @@ zs_attach(struct device *parent, struct device *self, void *aux)
|
||||
}
|
||||
|
||||
isrlink_autovec(zshard, NULL, NEXT_I_IPL(NEXT_I_SCC), 0, NULL);
|
||||
zsc->zsc_softintr_cookie = softintr_establish(IPL_SOFTSERIAL,
|
||||
(void (*)(void *))zsc_intr_soft, zsc);
|
||||
INTR_ENABLE(NEXT_I_SCC);
|
||||
|
||||
sir = allocate_sir(zssoft, zsc);
|
||||
if (sir != SIR_SERIAL) {
|
||||
panic("Unexpected zssoft sir");
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the master interrupt enable and interrupt vector.
|
||||
* (common to both channels, do it on A)
|
||||
@ -319,12 +315,12 @@ static int
|
||||
zshard(void *arg)
|
||||
{
|
||||
struct zsc_softc *zsc;
|
||||
int unit, rr3, rval, softreq;
|
||||
int unit, rr3, rval;
|
||||
|
||||
if (!INTR_OCCURRED(NEXT_I_SCC))
|
||||
return 0;
|
||||
|
||||
rval = softreq = 0;
|
||||
rval = 0;
|
||||
for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) {
|
||||
zsc = zsc_cd.cd_devs[unit];
|
||||
if (zsc == NULL)
|
||||
@ -335,52 +331,14 @@ zshard(void *arg)
|
||||
rval |= rr3;
|
||||
zsc->zsc_intrcnt.ev_count++;
|
||||
}
|
||||
softreq |= zsc->zsc_cs[0]->cs_softreq;
|
||||
softreq |= zsc->zsc_cs[1]->cs_softreq;
|
||||
/* We are at splzs here, so no need to lock. */
|
||||
if (zsc->zsc_cs[0]->cs_softreq || zsc->zsc_cs[1]->cs_softreq)
|
||||
softintr_schedule(zsc->zsc_softintr_cookie);
|
||||
}
|
||||
|
||||
/* We are at splzs here, so no need to lock. */
|
||||
if (softreq && (zssoftpending == 0)) {
|
||||
zssoftpending = 1;
|
||||
setsoftserial();
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Similar scheme as for zshard (look at all of them)
|
||||
*/
|
||||
static void
|
||||
zssoft(void *arg)
|
||||
{
|
||||
struct zsc_softc *zsc;
|
||||
int s, unit;
|
||||
|
||||
/* This is not the only ISR on this IPL. */
|
||||
if (zssoftpending == 0)
|
||||
panic("zssoft not pending");
|
||||
|
||||
/*
|
||||
* The soft intr. bit will be set by zshard only if
|
||||
* the variable zssoftpending is zero. The order of
|
||||
* these next two statements prevents our clearing
|
||||
* the soft intr bit just after zshard has set it.
|
||||
*/
|
||||
/* ienab_bic(IE_ZSSOFT); */
|
||||
zssoftpending = 0;
|
||||
|
||||
/* Make sure we call the tty layer at spltty. */
|
||||
s = spltty();
|
||||
for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) {
|
||||
zsc = zsc_cd.cd_devs[unit];
|
||||
if (zsc == NULL)
|
||||
continue;
|
||||
(void)zsc_intr_soft(zsc);
|
||||
}
|
||||
splx(s);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Compute the current baud rate given a ZS channel.
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: intr.h,v 1.17 2007/02/16 02:53:49 ad Exp $ */
|
||||
/* $NetBSD: intr.h,v 1.18 2007/03/08 16:37:43 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Scott Reynolds
|
||||
@ -42,72 +42,60 @@
|
||||
/* watch out for side effects */
|
||||
#define splx(s) ((s) & PSL_IPL ? _spl(s) : spl0())
|
||||
|
||||
#define splsoft() splraise1()
|
||||
#define splsoftnet() splsoft()
|
||||
#define splsoftclock() splsoft()
|
||||
#define splsoftserial() splsoft()
|
||||
#define splbio() splraise3()
|
||||
#define splnet() splraise3()
|
||||
#define spltty() splraise3()
|
||||
#define splserial() splraise5()
|
||||
#define splvm() splraise6()
|
||||
#define splclock() splraise3() /* ??? */
|
||||
#define splstatclock() splclock()
|
||||
#define splhigh() spl7()
|
||||
#define splsched() spl7()
|
||||
#define spllock() spl7()
|
||||
|
||||
#define spldma() splraise6()
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
#define IPL_HIGH (PSL_S|PSL_IPL7)
|
||||
#define IPL_SERIAL (PSL_S|PSL_IPL5)
|
||||
#define IPL_SCHED (PSL_S|PSL_IPL7)
|
||||
#define IPL_LOCK (PSL_S|PSL_IPL7)
|
||||
#define IPL_CLOCK (PSL_S|PSL_IPL3)
|
||||
#define IPL_STATCLOCK IPL_CLOCK
|
||||
#define IPL_VM (PSL_S|PSL_IPL6)
|
||||
#define IPL_TTY (PSL_S|PSL_IPL3)
|
||||
#define IPL_BIO (PSL_S|PSL_IPL3)
|
||||
#define IPL_NET (PSL_S|PSL_IPL3)
|
||||
#define IPL_SOFTNET (PSL_S|PSL_IPL2)
|
||||
#define IPL_SOFTCLOCK (PSL_S|PSL_IPL1)
|
||||
#define IPL_NONE 0
|
||||
#define IPL_SOFTCLOCK 1
|
||||
#define IPL_SOFTNET 2
|
||||
#define IPL_SOFTSERIAL 3
|
||||
#define IPL_SOFT 4
|
||||
#define IPL_BIO 5
|
||||
#define IPL_NET 6
|
||||
#define IPL_TTY 7
|
||||
#define IPL_SERIAL 8
|
||||
#define IPL_VM 9
|
||||
#define IPL_CLOCK 10
|
||||
#define IPL_STATCLOCK IPL_CLOCK
|
||||
#define IPL_HIGH 11
|
||||
#define IPL_LOCK IPL_HIGH
|
||||
#define IPL_SCHED IPL_HIGH
|
||||
#define NIPL 12
|
||||
|
||||
typedef int ipl_t;
|
||||
typedef struct {
|
||||
ipl_t _ipl;
|
||||
ipl_t _psl;
|
||||
} ipl_cookie_t;
|
||||
|
||||
static inline ipl_cookie_t
|
||||
makeiplcookie(ipl_t ipl)
|
||||
{
|
||||
extern const int ipl2psl_table[NIPL];
|
||||
|
||||
return (ipl_cookie_t){._ipl = ipl};
|
||||
}
|
||||
ipl_cookie_t makeiplcookie(ipl_t);
|
||||
|
||||
static inline int
|
||||
splraiseipl(ipl_cookie_t icookie)
|
||||
{
|
||||
|
||||
return _splraise(icookie._ipl);
|
||||
return _splraise(icookie._psl);
|
||||
}
|
||||
|
||||
#include <sys/spl.h>
|
||||
|
||||
#define spldma() _splraise(PSL_S|PSL_IPL6)
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
/*
|
||||
* simulated software interrupt register
|
||||
*/
|
||||
extern volatile u_int8_t ssir;
|
||||
|
||||
#define SIR_NET 0x01
|
||||
#define SIR_CLOCK 0x02
|
||||
#define SIR_SERIAL 0x04
|
||||
#define SIR_DTMGR 0x08
|
||||
#define SIR_ADB 0x10
|
||||
|
||||
#define siron(mask) \
|
||||
__asm volatile ( "orb %1,%0" : "=m" (ssir) : "i" (mask))
|
||||
#define siroff(mask) \
|
||||
__asm volatile ( "andb %1,%0" : "=m" (ssir) : "ir" (~(mask)));
|
||||
|
||||
#define setsoftnet() siron(SIR_NET)
|
||||
#define setsoftclock() siron(SIR_CLOCK)
|
||||
#define setsoftserial() siron(SIR_SERIAL)
|
||||
#define setsoftdtmgr() siron(SIR_DTMGR)
|
||||
#define setsoftadb() siron(SIR_ADB)
|
||||
|
||||
extern u_long allocate_sir(void (*)(void *),void *);
|
||||
extern void init_sir(void);
|
||||
|
||||
/* locore.s */
|
||||
int spl0(void);
|
||||
|
||||
@ -118,6 +106,8 @@ extern volatile u_long *intrmask;
|
||||
#define INTR_DISABLE(x) (*intrmask &= (~NEXT_I_BIT(x)))
|
||||
#define INTR_OCCURRED(x) (*intrstat & NEXT_I_BIT(x))
|
||||
|
||||
#include <m68k/softintr.h>
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* _NEXT68K_INTR_H_ */
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* $NetBSD: types.h,v 1.2 2006/09/11 15:07:50 gdamore Exp $ */
|
||||
/* $NetBSD: types.h,v 1.3 2007/03/08 16:37:43 tsutsui Exp $ */
|
||||
|
||||
#include <m68k/types.h>
|
||||
|
||||
#define __HAVE_TIMECOUNTER
|
||||
#define __HAVE_GENERIC_TODR
|
||||
#define __HAVE_GENERIC_SOFT_INTERRUPTS
|
||||
#define __HAVE_GENERIC_TODR
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: z8530var.h,v 1.5 2005/12/11 12:18:25 christos Exp $ */
|
||||
/* $NetBSD: z8530var.h,v 1.6 2007/03/08 16:37:43 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -50,6 +50,7 @@ struct zsc_softc {
|
||||
/* Machine-dependent part follows... */
|
||||
struct evcnt zsc_intrcnt; /* count interrupts */
|
||||
struct zs_chanstate zsc_cs_store[2];
|
||||
void *zsc_softintr_cookie;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.18 2005/12/11 12:18:29 christos Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.19 2007/03/08 16:37:43 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
@ -85,7 +85,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.18 2005/12/11 12:18:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.19 2007/03/08 16:37:43 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -159,7 +159,7 @@ cpu_configure(void)
|
||||
|
||||
INTR_SETMASK(0);
|
||||
|
||||
init_sir();
|
||||
softintr_init();
|
||||
|
||||
if (config_rootfound("mainbus", NULL) == NULL)
|
||||
panic("autoconfig failed, no root");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: isr.c,v 1.22 2005/12/11 12:18:29 christos Exp $ */
|
||||
/* $NetBSD: isr.c,v 1.23 2007/03/08 16:37:44 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* This file was taken from mvme68k/mvme68k/isr.c
|
||||
@ -48,7 +48,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.22 2005/12/11 12:18:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.23 2007/03/08 16:37:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -386,36 +386,6 @@ isrdispatch_vectored(int ipl, struct clockframe *frame)
|
||||
isr->isr_evcnt->ev_count++;
|
||||
}
|
||||
|
||||
/*
|
||||
* netisr junk...
|
||||
* should use an array of chars instead of
|
||||
* a bitmask to avoid atomicity locking issues.
|
||||
*/
|
||||
|
||||
void
|
||||
netintr(void)
|
||||
{
|
||||
int n, s;
|
||||
|
||||
s = splhigh();
|
||||
n = netisr;
|
||||
netisr = 0;
|
||||
splx(s);
|
||||
|
||||
#define DONETISR(bit, fn) do { \
|
||||
if (n & (1 << bit)) \
|
||||
fn(); \
|
||||
} while (0)
|
||||
|
||||
s = splsoftnet();
|
||||
|
||||
#include <net/netisr_dispatch.h>
|
||||
|
||||
#undef DONETISR
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
@ -425,3 +395,25 @@ spurintr(void *arg)
|
||||
return (1);
|
||||
}
|
||||
#endif
|
||||
|
||||
const int ipl2psl_table[NIPL] = {
|
||||
[IPL_NONE] = PSL_IPL0,
|
||||
[IPL_SOFTCLOCK] = PSL_IPL1,
|
||||
[IPL_SOFTNET] = PSL_IPL1,
|
||||
[IPL_SOFTSERIAL] = PSL_IPL1,
|
||||
[IPL_SOFT] = PSL_IPL1,
|
||||
[IPL_BIO] = PSL_IPL3,
|
||||
[IPL_NET] = PSL_IPL3,
|
||||
[IPL_TTY] = PSL_IPL3,
|
||||
[IPL_SERIAL] = PSL_IPL5,
|
||||
[IPL_VM] = PSL_IPL6,
|
||||
[IPL_CLOCK] = PSL_IPL3, /* ??? */
|
||||
[IPL_HIGH] = PSL_IPL7,
|
||||
};
|
||||
|
||||
ipl_cookie_t
|
||||
makeiplcookie(ipl_t ipl)
|
||||
{
|
||||
|
||||
return (ipl_cookie_t){._psl = ipl2psl_table[ipl] | PSL_S};
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.45 2005/12/11 12:18:29 christos Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.46 2007/03/08 16:37:44 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Darrin B. Jewell
|
||||
@ -1018,8 +1018,6 @@ Lintrhand_exit:
|
||||
* necessitating a stack cleanup.
|
||||
*/
|
||||
|
||||
BSS(ssir,1)
|
||||
|
||||
ASENTRY_NOPROFILE(rei)
|
||||
tstl _C_LABEL(astpending) | AST pending?
|
||||
jeq Lchksir | no, go check for SIR
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap.c,v 1.64 2007/03/04 06:00:27 christos Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.65 2007/03/08 16:37:44 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* This file was taken from mvme68k/mvme68k/trap.c
|
||||
@ -84,7 +84,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.64 2007/03/04 06:00:27 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.65 2007/03/08 16:37:44 tsutsui Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_execfmt.h"
|
||||
@ -220,12 +220,6 @@ int mmupid = -1;
|
||||
#define MDB_ISPID(p) ((p) == mmupid)
|
||||
#endif
|
||||
|
||||
|
||||
#define NSIR 32
|
||||
void (*sir_routines[NSIR])(void *);
|
||||
void *sir_args[NSIR];
|
||||
int next_sir;
|
||||
|
||||
/*
|
||||
* trap and syscall both need the following work done before returning
|
||||
* to user mode.
|
||||
@ -315,7 +309,6 @@ trap(int type, unsigned code, unsigned v, struct frame frame)
|
||||
ksiginfo_t ksi;
|
||||
int s;
|
||||
u_quad_t sticks = 0 /* XXX initialiser works around compiler bug */;
|
||||
int bit;
|
||||
static int panicking = 0;
|
||||
|
||||
uvmexp.traps++;
|
||||
@ -585,13 +578,9 @@ trap(int type, unsigned code, unsigned v, struct frame frame)
|
||||
|
||||
case T_SSIR: /* software interrupt */
|
||||
case T_SSIR|T_USER:
|
||||
while ((bit = ffs(ssir))) {
|
||||
--bit;
|
||||
ssir &= ~(1 << bit);
|
||||
uvmexp.softs++;
|
||||
if (sir_routines[bit])
|
||||
sir_routines[bit](sir_args[bit]);
|
||||
}
|
||||
|
||||
softintr_dispatch();
|
||||
|
||||
/*
|
||||
* If this was not an AST trap, we are all done.
|
||||
*/
|
||||
@ -1039,29 +1028,3 @@ dumpwb(int num, u_short s, u_int a, u_int d)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allocation routines for software interrupts.
|
||||
*/
|
||||
u_long
|
||||
allocate_sir(void (*proc)(void *), void *arg)
|
||||
{
|
||||
int bit;
|
||||
|
||||
if( next_sir >= NSIR )
|
||||
panic("allocate_sir: none left");
|
||||
bit = next_sir++;
|
||||
sir_routines[bit] = proc;
|
||||
sir_args[bit] = arg;
|
||||
return (1 << bit);
|
||||
}
|
||||
|
||||
void
|
||||
init_sir(void)
|
||||
{
|
||||
extern void netintr(void);
|
||||
|
||||
sir_routines[0] = (void (*)(void *))netintr;
|
||||
sir_routines[1] = softclock;
|
||||
next_sir = 2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user