-/* $OpenBSD: lunaws.c,v 1.12 2016/06/05 20:02:36 bru Exp $ */
+/* $OpenBSD: lunaws.c,v 1.13 2017/06/04 13:48:13 aoyama Exp $ */
/* $NetBSD: lunaws.c,v 1.6 2002/03/17 19:40:42 atatat Exp $ */
/*-
};
#endif
-void wsintr(int);
+void wsintr(void *);
int wsmatch(struct device *, void *, void *);
void wsattach(struct device *, struct device *, void *);
wsattach(struct device *parent, struct device *self, void *aux)
{
struct ws_softc *sc = (struct ws_softc *)self;
- struct sio_softc *scp = (struct sio_softc *)parent;
+ struct sio_softc *siosc = (struct sio_softc *)parent;
struct sio_attach_args *args = aux;
+ int channel = args->channel;
struct wskbddev_attach_args a;
- sc->sc_ctl = (struct sioreg *)scp->scp_ctl + 1;
- bcopy(ch1_regs, sc->sc_wr, sizeof(ch1_regs));
- scp->scp_intr[1] = wsintr;
+ sc->sc_ctl = &siosc->sc_ctl[channel];
+ memcpy(sc->sc_wr, ch1_regs, sizeof(ch1_regs));
+ siosc->sc_intrhand[channel].ih_func = wsintr;
+ siosc->sc_intrhand[channel].ih_arg = sc;
setsioreg(sc->sc_ctl, WR0, sc->sc_wr[WR0]);
setsioreg(sc->sc_ctl, WR4, sc->sc_wr[WR4]);
/*ARGSUSED*/
void
-wsintr(int chan)
+wsintr(void *arg)
{
- struct ws_softc *sc = ws_cd.cd_devs[0];
+ struct ws_softc *sc = arg;
struct sioreg *sio = sc->sc_ctl;
u_int code;
int rr;
-/* $OpenBSD: sio.c,v 1.5 2014/06/07 11:55:35 aoyama Exp $ */
+/* $OpenBSD: sio.c,v 1.6 2017/06/04 13:48:13 aoyama Exp $ */
/* $NetBSD: sio.c,v 1.1 2000/01/05 08:48:55 nisimura Exp $ */
/*-
NULL, "sio", DV_DULL, 0
};
-void nullintr(int);
+void nullintr(void *);
int xsiointr(void *);
int
printf(": 7201a\n");
- sc->scp_ctl = (caddr_t)ma->ma_addr;
- sc->scp_intr[0] = sc->scp_intr[1] = nullintr;
+ sc->sc_ctl = (void *)ma->ma_addr;
for (channel = 0; channel < 2; channel++) {
+ sc->sc_intrhand[channel].ih_func = nullintr;
sio_args.channel = channel;
sio_args.hwflags = (channel == sysconsole);
config_found(self, (void *)&sio_args, sio_print);
{
struct sio_softc *sc = arg;
- (*sc->scp_intr[0])(0); /* 0: ttya system serial port */
- (*sc->scp_intr[1])(1); /* 1: keyboard and mouse */
+ /* channel 0: ttya system serial port */
+ (*sc->sc_intrhand[0].ih_func)(sc->sc_intrhand[0].ih_arg);
+
+ /* channel 1: keyboard and mouse */
+ (*sc->sc_intrhand[1].ih_func)(sc->sc_intrhand[1].ih_arg);
+
return 1;
}
-void nullintr(int v)
+void
+nullintr(void *arg)
{
}
-/* $OpenBSD: siotty.c,v 1.18 2017/04/30 16:45:45 mpi Exp $ */
+/* $OpenBSD: siotty.c,v 1.19 2017/06/04 13:48:13 aoyama Exp $ */
/* $NetBSD: siotty.c,v 1.9 2002/03/17 19:40:43 atatat Exp $ */
/*-
cdev_decl(sio);
void siostart(struct tty *);
int sioparam(struct tty *, struct termios *);
-void siottyintr(int);
+void siottyintr(void *);
int siomctl(struct siotty_softc *, int, int);
int siotty_match(struct device *, void *, void *);
void
siotty_attach(struct device *parent, struct device *self, void *aux)
{
- struct sio_softc *scp = (void *)parent;
+ struct sio_softc *siosc = (void *)parent;
struct siotty_softc *sc = (void *)self;
struct sio_attach_args *args = aux;
+ int channel;
- sc->sc_ctl = (struct sioreg *)scp->scp_ctl + args->channel;
- bcopy(ch0_regs, sc->sc_wr, sizeof(ch0_regs));
- scp->scp_intr[args->channel] = siottyintr;
+ channel = args->channel;
+ sc->sc_ctl = &siosc->sc_ctl[channel];
+ memcpy(sc->sc_wr, ch0_regs, sizeof(ch0_regs));
+ siosc->sc_intrhand[channel].ih_func = siottyintr;
+ siosc->sc_intrhand[channel].ih_arg = sc;
if (args->hwflags == 1) {
printf(" (console)");
/*-------------------- low level routine --------------------*/
void
-siottyintr(int chan)
+siottyintr(void *arg)
{
struct siotty_softc *sc;
struct sioreg *sio;
unsigned int code;
int rr;
- if (chan >= siotty_cd.cd_ndevs)
- return;
- sc = siotty_cd.cd_devs[chan];
+ sc = (struct siotty_softc *)arg;
tp = sc->sc_tty;
sio = sc->sc_ctl;
rr = getsiocsr(sio);
-/* $OpenBSD: siovar.h,v 1.2 2008/06/26 05:42:11 ray Exp $ */
+/* $OpenBSD: siovar.h,v 1.3 2017/06/04 13:48:13 aoyama Exp $ */
/* $NetBSD: siovar.h,v 1.1 2000/01/05 08:48:55 nisimura Exp $ */
/*-
* POSSIBILITY OF SUCH DAMAGE.
*/
-struct sio_softc {
- struct device scp_dev;
- caddr_t scp_ctl;
- void (*scp_intr[2])(int);
-};
-
struct sio_attach_args {
int channel;
int hwflags;
#define sio_stat sio_cmd
};
+struct sio_softc {
+ struct device sc_dev;
+ struct sioreg *sc_ctl;
+ struct {
+ void (*ih_func)(void *);
+ void *ih_arg;
+ } sc_intrhand[2];
+};
+
int getsiocsr(struct sioreg *);
void setsioreg(struct sioreg *, int, int);