Add MI softintr(9) support for x68k with common m68k/softintr.c.
Tested by isaki@ and Yasushi Oshima. XXX: x68k/dev/com.c should be rewritten to use MI com(4).
This commit is contained in:
parent
a3be972973
commit
72c70a3609
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.x68k,v 1.61 2005/12/11 12:19:37 christos Exp $
|
||||
# $NetBSD: files.x68k,v 1.62 2007/03/04 02:08:08 tsutsui Exp $
|
||||
#
|
||||
# new style config file for x68k architecture
|
||||
#
|
||||
|
@ -39,6 +39,7 @@ file arch/m68k/m68k/cacheops.c
|
|||
file arch/m68k/m68k/db_memrw.c ddb
|
||||
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: kbd.c,v 1.26 2007/01/24 13:08:11 hubertf Exp $ */
|
||||
/* $NetBSD: kbd.c,v 1.27 2007/03/04 02:08:08 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.26 2007/01/24 13:08:11 hubertf Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.27 2007/03/04 02:08:08 tsutsui Exp $");
|
||||
|
||||
#include "ite.h"
|
||||
#include "bell.h"
|
||||
|
@ -67,11 +67,12 @@ struct kbd_softc {
|
|||
|
||||
int sc_event_mode; /* if true, collect events, else pass to ite */
|
||||
struct evvar sc_events; /* event queue state */
|
||||
void *sc_softintr_cookie;
|
||||
};
|
||||
|
||||
void kbdenable(int);
|
||||
int kbdintr (void *);
|
||||
void kbdsoftint(void);
|
||||
void kbdsoftint(void *);
|
||||
void kbd_bell(int);
|
||||
int kbdcngetc(void);
|
||||
void kbd_setLED(void);
|
||||
|
@ -113,8 +114,8 @@ kbdmatch(struct device *parent, struct cfdata *cf, void *aux)
|
|||
static void
|
||||
kbdattach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct kbd_softc *k = (void*) self;
|
||||
struct mfp_softc *mfp = (void*) parent;
|
||||
struct kbd_softc *sc = (void *)self;
|
||||
struct mfp_softc *mfp = (void *)parent;
|
||||
int s;
|
||||
|
||||
kbd_attached = 1;
|
||||
|
@ -122,11 +123,12 @@ kbdattach(struct device *parent, struct device *self, void *aux)
|
|||
s = spltty();
|
||||
|
||||
/* MFP interrupt #12 is for USART receive buffer full */
|
||||
intio_intr_establish(mfp->sc_intr + 12, "kbd", kbdintr, self);
|
||||
intio_intr_establish(mfp->sc_intr + 12, "kbd", kbdintr, sc);
|
||||
sc->sc_softintr_cookie = softintr_establish(IPL_SOFT, kbdsoftint, sc);
|
||||
|
||||
kbdenable(1);
|
||||
k->sc_event_mode = 0;
|
||||
k->sc_events.ev_io = 0;
|
||||
sc->sc_event_mode = 0;
|
||||
sc->sc_events.ev_io = 0;
|
||||
splx(s);
|
||||
|
||||
printf("\n");
|
||||
|
@ -318,7 +320,7 @@ int
|
|||
kbdintr(void *arg)
|
||||
{
|
||||
u_char c, st;
|
||||
struct kbd_softc *k = arg; /* XXX */
|
||||
struct kbd_softc *sc = arg;
|
||||
struct firm_event *fe;
|
||||
int put;
|
||||
|
||||
|
@ -331,9 +333,9 @@ kbdintr(void *arg)
|
|||
return 0; /* intr caused by an err -- no char received */
|
||||
|
||||
/* if not in event mode, deliver straight to ite to process key stroke */
|
||||
if (! k->sc_event_mode) {
|
||||
if (!sc->sc_event_mode) {
|
||||
kbdbuf[kbdputoff++ & KBDBUFMASK] = c;
|
||||
setsoftkbd();
|
||||
softintr_schedule(sc->sc_softintr_cookie);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -341,24 +343,24 @@ kbdintr(void *arg)
|
|||
event and put it in the queue. If the queue is full, the
|
||||
keystroke is lost (sorry!). */
|
||||
|
||||
put = k->sc_events.ev_put;
|
||||
fe = &k->sc_events.ev_q[put];
|
||||
put = sc->sc_events.ev_put;
|
||||
fe = &sc->sc_events.ev_q[put];
|
||||
put = (put + 1) % EV_QSIZE;
|
||||
if (put == k->sc_events.ev_get) {
|
||||
if (put == sc->sc_events.ev_get) {
|
||||
log(LOG_WARNING, "keyboard event queue overflow\n"); /* ??? */
|
||||
return 0;
|
||||
}
|
||||
fe->id = KEY_CODE(c);
|
||||
fe->value = KEY_UP(c) ? VKEY_UP : VKEY_DOWN;
|
||||
getmicrotime(&fe->time);
|
||||
k->sc_events.ev_put = put;
|
||||
EV_WAKEUP(&k->sc_events);
|
||||
sc->sc_events.ev_put = put;
|
||||
EV_WAKEUP(&sc->sc_events);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
kbdsoftint(void) /* what if ite is not configured? */
|
||||
kbdsoftint(void *arg) /* what if ite is not configured? */
|
||||
{
|
||||
int s;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: zs.c,v 1.29 2006/03/28 17:38:28 thorpej Exp $ */
|
||||
/* $NetBSD: zs.c,v 1.30 2007/03/04 02:08:08 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 Minoura Makoto
|
||||
|
@ -47,7 +47,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.29 2006/03/28 17:38:28 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.30 2007/03/04 02:08:08 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -139,7 +139,6 @@ CFATTACH_DECL(zsc, sizeof(struct zsc_softc),
|
|||
extern struct cfdriver zsc_cd;
|
||||
|
||||
static int zshard(void *);
|
||||
int zssoft(void *);
|
||||
static int zs_get_speed(struct zs_chanstate *);
|
||||
|
||||
|
||||
|
@ -277,6 +276,8 @@ zs_attach(struct device *parent, struct device *self, void *aux)
|
|||
*/
|
||||
if (intio_intr_establish(ia->ia_intr, "zs", zshard, zsc))
|
||||
panic("zs_attach: interrupt vector busy");
|
||||
zsc->zsc_softintr_cookie = softintr_establish(IPL_SOFTSERIAL,
|
||||
(void (*)(void *))zsc_intr_soft, zsc);
|
||||
/* XXX; evcnt_attach() ? */
|
||||
|
||||
/*
|
||||
|
@ -329,34 +330,11 @@ zshard(void *arg)
|
|||
|
||||
/* We are at splzs here, so no need to lock. */
|
||||
if (zsc->zsc_cs[0]->cs_softreq || zsc->zsc_cs[1]->cs_softreq)
|
||||
setsoftserial();
|
||||
softintr_schedule(zsc->zsc_softintr_cookie);
|
||||
|
||||
return (rval);
|
||||
}
|
||||
|
||||
/*
|
||||
* Shared among the all chips. We have to look at all of them.
|
||||
*/
|
||||
int
|
||||
zssoft(void *arg)
|
||||
{
|
||||
struct zsc_softc *zsc;
|
||||
int s, unit;
|
||||
|
||||
/* 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);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Compute the current baud rate given a ZS channel.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: intr.h,v 1.12 2007/02/16 02:53:51 ad Exp $ */
|
||||
/* $NetBSD: intr.h,v 1.13 2007/03/04 02:08:09 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -46,6 +46,21 @@
|
|||
/* spl0 requires checking for software interrupts */
|
||||
void spl0(void);
|
||||
|
||||
#define splsoft() splraise1()
|
||||
#define splsoftclock() splsoft()
|
||||
#define splsoftnet() splsoft()
|
||||
#define splsoftserial() splsoft()
|
||||
#define splbio() splraise3()
|
||||
#define splnet() splraise4()
|
||||
#define spltty() splraise4()
|
||||
#define splvm() splraise4()
|
||||
#define splserial() splraise5()
|
||||
#define splclock() splraise6()
|
||||
#define splstatclock() splclock()
|
||||
#define splhigh() spl7()
|
||||
#define splsched() spl7()
|
||||
#define spllock() spl7()
|
||||
|
||||
#define splnone() spl0()
|
||||
#define splzs() splraise5() /* disallow serial interrupts */
|
||||
|
||||
|
@ -53,54 +68,38 @@ void spl0(void);
|
|||
#define splx(s) ((s) & PSL_IPL ? _spl(s) : spl0())
|
||||
|
||||
#define IPL_NONE 0
|
||||
#define IPL_SOFTCLOCK (PSL_S|PSL_IPL1)
|
||||
#define IPL_SOFTNET (PSL_S|PSL_IPL1)
|
||||
#define IPL_BIO (PSL_S|PSL_IPL3)
|
||||
#define IPL_NET (PSL_S|PSL_IPL4)
|
||||
#define IPL_TTY (PSL_S|PSL_IPL4)
|
||||
#define IPL_VM (PSL_S|PSL_IPL4)
|
||||
#define IPL_CLOCK (PSL_S|PSL_IPL6)
|
||||
#define IPL_STATCLOCK (PSL_S|PSL_IPL6)
|
||||
#define IPL_SCHED (PSL_S|PSL_IPL7)
|
||||
#define IPL_HIGH (PSL_S|PSL_IPL7)
|
||||
#define IPL_LOCK (PSL_S|PSL_IPL7)
|
||||
#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_VM 8
|
||||
#define IPL_SERIAL 9
|
||||
#define IPL_CLOCK 10
|
||||
#define IPL_STATCLOCK IPL_CLOCK
|
||||
#define IPL_HIGH 11
|
||||
#define IPL_SCHED IPL_HIGH
|
||||
#define IPL_LOCK 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)
|
||||
{
|
||||
|
||||
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>
|
||||
|
||||
/*
|
||||
* simulated software interrupt register
|
||||
*/
|
||||
extern unsigned char ssir;
|
||||
|
||||
#define SIR_NET 0x1
|
||||
#define SIR_CLOCK 0x2
|
||||
#define SIR_SERIAL 0x4
|
||||
#define SIR_KBD 0x8
|
||||
|
||||
#define siroff(x) ssir &= ~(x)
|
||||
#define setsoftnet() ssir |= SIR_NET
|
||||
#define setsoftclock() ssir |= SIR_CLOCK
|
||||
#define setsoftserial() ssir |= SIR_SERIAL
|
||||
#define setsoftkbd() ssir |= SIR_KBD
|
||||
|
||||
#endif /* _KERNEL && ! _LOCORE */
|
||||
#endif
|
||||
|
||||
#include <m68k/softintr.h>
|
||||
|
||||
#endif /* !_X68K_INTR_H_ */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: types.h,v 1.11 2006/09/19 10:13:10 gdamore Exp $ */
|
||||
/* $NetBSD: types.h,v 1.12 2007/03/04 02:08:09 tsutsui Exp $ */
|
||||
|
||||
#ifndef _MACHINE_TYPES_H_
|
||||
#define _MACHINE_TYPES_H_
|
||||
|
@ -6,6 +6,7 @@
|
|||
#include <m68k/types.h>
|
||||
|
||||
#define __HAVE_DEVICE_REGISTER
|
||||
#define __HAVE_GENERIC_SOFT_INTERRUPTS
|
||||
#define __HAVE_GENERIC_TODR
|
||||
#define __HAVE_TIMECOUNTER
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: z8530var.h,v 1.6 2005/12/11 12:19:44 christos Exp $ */
|
||||
/* $NetBSD: z8530var.h,v 1.7 2007/03/04 02:08:09 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -138,6 +138,7 @@ struct zsc_softc {
|
|||
/* Machine-dependent part follows... */
|
||||
struct zs_chanstate zsc_cs_store[2];
|
||||
struct zsdevice *zsc_addr;
|
||||
void *zsc_softintr_cookie;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: autoconf.c,v 1.49 2006/11/24 22:04:24 wiz Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.50 2007/03/04 02:08:09 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Leo Weppelman
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.49 2006/11/24 22:04:24 wiz Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.50 2007/03/04 02:08:09 tsutsui Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "scsibus.h"
|
||||
|
@ -73,6 +73,8 @@ cpu_configure(void)
|
|||
{
|
||||
x68k_realconfig = 1;
|
||||
|
||||
softintr_init();
|
||||
|
||||
if (config_rootfound("mainbus", NULL) == NULL)
|
||||
panic("no mainbus found");
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.135 2007/02/22 06:49:34 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.136 2007/03/04 02:08:09 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
|
@ -77,7 +77,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.135 2007/02/22 06:49:34 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.136 2007/03/04 02:08:09 tsutsui Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
|
@ -903,30 +903,33 @@ badbaddr(volatile void *addr)
|
|||
return(0);
|
||||
}
|
||||
|
||||
void netintr(void);
|
||||
|
||||
void
|
||||
netintr(void)
|
||||
{
|
||||
|
||||
#define DONETISR(bit, fn) do { \
|
||||
if (netisr & (1 << bit)) { \
|
||||
netisr &= ~(1 << bit); \
|
||||
fn(); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#include <net/netisr_dispatch.h>
|
||||
|
||||
#undef DONETISR
|
||||
}
|
||||
|
||||
void
|
||||
intrhand(int sr)
|
||||
{
|
||||
printf("intrhand: unexpected sr 0x%x\n", sr);
|
||||
}
|
||||
|
||||
static const int ipl2psl_table[] = {
|
||||
[IPL_NONE] = PSL_IPL0,
|
||||
[IPL_SOFT] = PSL_IPL1,
|
||||
[IPL_SOFTCLOCK] = PSL_IPL1,
|
||||
[IPL_SOFTNET] = PSL_IPL1,
|
||||
[IPL_SOFTSERIAL] = PSL_IPL1,
|
||||
[IPL_BIO] = PSL_IPL3,
|
||||
[IPL_NET] = PSL_IPL4,
|
||||
[IPL_TTY] = PSL_IPL4,
|
||||
[IPL_VM] = PSL_IPL4,
|
||||
[IPL_CLOCK] = PSL_IPL6,
|
||||
[IPL_HIGH] = PSL_IPL7,
|
||||
};
|
||||
|
||||
ipl_cookie_t
|
||||
makeiplcookie(ipl_t ipl)
|
||||
{
|
||||
|
||||
return (ipl_cookie_t){._psl = ipl2psl_table[ipl] | PSL_S};
|
||||
}
|
||||
|
||||
#if (defined(DDB) || defined(DEBUG)) && !defined(PANICBUTTON)
|
||||
#define PANICBUTTON
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: trap.c,v 1.84 2007/02/22 06:49:34 thorpej Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.85 2007/03/04 02:08:09 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
|
@ -77,7 +77,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.84 2007/02/22 06:49:34 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.85 2007/03/04 02:08:09 tsutsui Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
|
@ -596,39 +596,9 @@ trap(int type, unsigned code, unsigned v, struct frame frame)
|
|||
|
||||
case T_SSIR: /* software interrupt */
|
||||
case T_SSIR|T_USER:
|
||||
if (ssir & SIR_NET) {
|
||||
void netintr(void);
|
||||
siroff(SIR_NET);
|
||||
uvmexp.softs++;
|
||||
netintr();
|
||||
}
|
||||
if (ssir & SIR_CLOCK) {
|
||||
siroff(SIR_CLOCK);
|
||||
uvmexp.softs++;
|
||||
softclock(NULL);
|
||||
}
|
||||
if (ssir & SIR_SERIAL) {
|
||||
#include "zsc.h"
|
||||
#if NZSC > 0
|
||||
void zssoft(int);
|
||||
#endif
|
||||
siroff(SIR_SERIAL);
|
||||
uvmexp.softs++;
|
||||
#if NZSC > 0
|
||||
zssoft(0);
|
||||
#endif
|
||||
}
|
||||
if (ssir & SIR_KBD) {
|
||||
#include "kbd.h"
|
||||
#if NKBD > 0
|
||||
void kbdsoftint(void);
|
||||
#endif
|
||||
siroff(SIR_KBD);
|
||||
uvmexp.softs++;
|
||||
#if NKBD > 0
|
||||
kbdsoftint();
|
||||
#endif
|
||||
}
|
||||
|
||||
softintr_dispatch();
|
||||
|
||||
/*
|
||||
* If this was not an AST trap, we are all done.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue