From: miod Date: Sun, 24 May 2015 10:57:47 +0000 (+0000) Subject: Follow the recent pckbc@isa changes and always establish all the necessary X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bd4a265ca37f66e6b2476d412abc25deb6ba2fdf;p=openbsd Follow the recent pckbc@isa changes and always establish all the necessary interrupts at pckbc attach time, and get rid of the `intr_establish' pckbc callback. Tested on hppa (gsckbc) and sgi (pckbc@hpc); not tested on sparc64 (pckbc@ebus) but this attachment was already behaving this way and its intr_establish callback was an empty function. --- diff --git a/sys/arch/hppa/gsc/gsckbc.c b/sys/arch/hppa/gsc/gsckbc.c index b8eff13e8a8..f55119e10cf 100644 --- a/sys/arch/hppa/gsc/gsckbc.c +++ b/sys/arch/hppa/gsc/gsckbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gsckbc.c,v 1.18 2014/10/31 10:29:33 jsg Exp $ */ +/* $OpenBSD: gsckbc.c,v 1.19 2015/05/24 10:57:47 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -98,7 +98,6 @@ void gsckbc_attach(struct device *, struct device *, void *); struct gsckbc_softc { struct pckbc_softc sc_pckbc; - int sc_irq; void *sc_ih; int sc_type; }; @@ -111,8 +110,6 @@ struct cfdriver gsckbc_cd = { NULL, "gsckbc", DV_DULL }; -void gsckbc_intr_establish(struct pckbc_softc *, pckbc_slot_t); - /* descriptor for one device command */ struct pckbc_devcmd { TAILQ_ENTRY(pckbc_devcmd) next; @@ -367,7 +364,6 @@ gsckbc_attach(struct device *parent, struct device *self, void *aux) int ident; iot = ga->ga_ca.ca_iot; - gsc->sc_irq = ga->ga_ca.ca_irq; if (bus_space_map(iot, ga->ga_ca.ca_hpa, KBMAPSIZE, 0, &ioh)) panic("gsckbc_attach: couldn't map port"); @@ -385,9 +381,15 @@ gsckbc_attach(struct device *parent, struct device *self, void *aux) return; } - printf("\n"); + gsc->sc_ih = gsc_intr_establish((struct gsc_softc *)parent, + ga->ga_ca.ca_irq, IPL_TTY, gsckbcintr, sc, sc->sc_dv.dv_xname); + if (gsc->sc_ih == NULL) { + printf(": can't establish interrupt\n"); + bus_space_unmap(iot, ioh, KBMAPSIZE); + return; + } - sc->intr_establish = gsckbc_intr_establish; + printf("\n"); t = malloc(sizeof(*t), M_DEVBUF, M_WAITOK | M_ZERO); t->t_iot = iot; @@ -418,15 +420,6 @@ gsckbc_attach(struct device *parent, struct device *self, void *aux) } } -void -gsckbc_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot) -{ - struct gsckbc_softc *gsc = (void *)sc; - - gsc->sc_ih = gsc_intr_establish((struct gsc_softc *)sc->sc_dv.dv_parent, - gsc->sc_irq, IPL_TTY, gsckbcintr, sc, sc->sc_dv.dv_xname); -} - /* * pckbc-like interfaces */ @@ -976,8 +969,6 @@ pckbc_set_inputhandler(self, slot, func, arg, name) if (slot >= PCKBC_NSLOTS) panic("pckbc_set_inputhandler: bad slot %d", slot); - (*sc->intr_establish)(sc, slot); - sc->inputhandler[slot] = func; sc->inputarg[slot] = arg; sc->subname[slot] = name; diff --git a/sys/arch/sgi/hpc/pckbc_hpc.c b/sys/arch/sgi/hpc/pckbc_hpc.c index 1964833a576..4140ee3d08a 100644 --- a/sys/arch/sgi/hpc/pckbc_hpc.c +++ b/sys/arch/sgi/hpc/pckbc_hpc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbc_hpc.c,v 1.3 2015/05/04 09:33:45 mpi Exp $ */ +/* $OpenBSD: pckbc_hpc.c,v 1.4 2015/05/24 10:57:47 miod Exp $ */ /* $NetBSD: pckbc_hpc.c,v 1.9 2008/03/15 13:23:24 cube Exp $ */ /* @@ -48,19 +48,11 @@ #include #include -struct pckbc_hpc_softc { - struct pckbc_softc sc_pckbc; - - int sc_irq; - int sc_hasintr; -}; - int pckbc_hpc_match(struct device *, void *, void *); void pckbc_hpc_attach(struct device *, struct device *, void *); -void pckbc_hpc_intr_establish(struct pckbc_softc *, pckbc_slot_t); const struct cfattach pckbc_hpc_ca = { - sizeof(struct pckbc_hpc_softc), pckbc_hpc_match, pckbc_hpc_attach + sizeof(struct pckbc_softc), pckbc_hpc_match, pckbc_hpc_attach }; int @@ -82,15 +74,17 @@ pckbc_hpc_match(struct device *parent, void *vcf, void *aux) void pckbc_hpc_attach(struct device *parent, struct device * self, void *aux) { - struct pckbc_hpc_softc *msc = (struct pckbc_hpc_softc *)self; - struct pckbc_softc *sc = &msc->sc_pckbc; + struct pckbc_softc *sc = (struct pckbc_softc *)self; struct hpc_attach_args *haa = aux; struct pckbc_internal *t = NULL; bus_space_handle_t ioh_d, ioh_c; int console; - msc->sc_irq = haa->ha_irq; - msc->sc_hasintr = 0; + if (hpc_intr_establish(haa->ha_irq, IPL_TTY, pckbcintr, sc, + sc->sc_dv.dv_xname) == NULL) { + printf(": unable to establish interrupt\n"); + return; + } console = pckbc_is_console(haa->ha_st, XKPHYS_TO_PHYS(haa->ha_sh + haa->ha_devoff + 3)); @@ -114,8 +108,6 @@ pckbc_hpc_attach(struct device *parent, struct device * self, void *aux) t->t_ioh_d = ioh_d; } - sc->intr_establish = pckbc_hpc_intr_establish; - t->t_cmdbyte = KC8_CPU; t->t_sc = sc; sc->id = t; @@ -123,19 +115,3 @@ pckbc_hpc_attach(struct device *parent, struct device * self, void *aux) printf("\n"); pckbc_attach(sc, 0); } - -void -pckbc_hpc_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot) -{ - struct pckbc_hpc_softc *msc = (struct pckbc_hpc_softc *)sc; - - if (msc->sc_hasintr) - return; - - if (hpc_intr_establish(msc->sc_irq, IPL_TTY, pckbcintr, sc, - sc->sc_dv.dv_xname) == NULL) { - printf(": unable to establish interrupt"); - } else { - msc->sc_hasintr = 1; - } -} diff --git a/sys/arch/sparc64/dev/pckbc_ebus.c b/sys/arch/sparc64/dev/pckbc_ebus.c index 264afe043f8..4814ca75d5a 100644 --- a/sys/arch/sparc64/dev/pckbc_ebus.c +++ b/sys/arch/sparc64/dev/pckbc_ebus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbc_ebus.c,v 1.12 2010/11/23 04:07:55 shadchin Exp $ */ +/* $OpenBSD: pckbc_ebus.c,v 1.13 2015/05/24 10:57:47 miod Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -70,7 +70,6 @@ struct cfattach pckbc_ebus_ca = { sizeof(struct pckbc_ebus_softc), pckbc_ebus_match, pckbc_ebus_attach }; -void pckbc_ebus_intr_establish(struct pckbc_softc *, pckbc_slot_t); int pckbc_ebus_is_console(struct pckbc_ebus_softc *); int @@ -158,8 +157,6 @@ pckbc_ebus_attach(parent, self, aux) t->t_flags = flags; } - psc->intr_establish = pckbc_ebus_intr_establish; - sc->sc_irq[0] = bus_intr_establish(sc->sc_iot, ea->ea_intrs[0], IPL_TTY, 0, pckbcintr, psc, self->dv_xname); if (sc->sc_irq[0] == NULL) { @@ -211,11 +208,3 @@ pckbc_ebus_is_console(sc) } return (0); } - -void -pckbc_ebus_intr_establish(psc, slot) - struct pckbc_softc *psc; - pckbc_slot_t slot; -{ - /* Nothing to do, interrupts were mapped in attach. */ -} diff --git a/sys/dev/ic/pckbc.c b/sys/dev/ic/pckbc.c index ed34dd35ecb..e68738a3a06 100644 --- a/sys/dev/ic/pckbc.c +++ b/sys/dev/ic/pckbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbc.c,v 1.48 2015/05/05 16:27:20 shadchin Exp $ */ +/* $OpenBSD: pckbc.c,v 1.49 2015/05/24 10:57:47 miod Exp $ */ /* $NetBSD: pckbc.c,v 1.5 2000/06/09 04:58:35 soda Exp $ */ /* @@ -949,8 +949,6 @@ pckbc_set_inputhandler(pckbc_tag_t self, pckbc_slot_t slot, pckbc_inputfcn func, if (slot >= PCKBC_NSLOTS) panic("pckbc_set_inputhandler: bad slot %d", slot); - (*sc->intr_establish)(sc, slot); - sc->inputhandler[slot] = func; sc->inputarg[slot] = arg; sc->subname[slot] = name; diff --git a/sys/dev/ic/pckbcvar.h b/sys/dev/ic/pckbcvar.h index 00717f211e5..8adc5d97be7 100644 --- a/sys/dev/ic/pckbcvar.h +++ b/sys/dev/ic/pckbcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbcvar.h,v 1.14 2013/05/23 18:29:51 tobias Exp $ */ +/* $OpenBSD: pckbcvar.h,v 1.15 2015/05/24 10:57:47 miod Exp $ */ /* $NetBSD: pckbcvar.h,v 1.4 2000/06/09 04:58:35 soda Exp $ */ /* @@ -76,8 +76,6 @@ struct pckbc_softc { pckbc_inputfcn inputhandler[PCKBC_NSLOTS]; void *inputarg[PCKBC_NSLOTS]; char *subname[PCKBC_NSLOTS]; - - void (*intr_establish)(struct pckbc_softc *, pckbc_slot_t); }; struct pckbc_attach_args { diff --git a/sys/dev/isa/pckbc_isa.c b/sys/dev/isa/pckbc_isa.c index 43730a77c49..cce10af0ac2 100644 --- a/sys/dev/isa/pckbc_isa.c +++ b/sys/dev/isa/pckbc_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbc_isa.c,v 1.17 2015/05/21 19:32:29 miod Exp $ */ +/* $OpenBSD: pckbc_isa.c,v 1.18 2015/05/24 10:57:47 miod Exp $ */ /* $NetBSD: pckbc_isa.c,v 1.2 2000/03/23 07:01:35 thorpej Exp $ */ /* @@ -48,8 +48,6 @@ const struct cfattach pckbc_isa_ca = { NULL, pckbc_isa_activate }; -void pckbc_isa_intr_establish(struct pckbc_softc *, pckbc_slot_t); - int pckbc_isa_match(struct device *parent, void *match, void *aux) { @@ -150,8 +148,6 @@ pckbc_isa_attach(struct device *parent, struct device *self, void *aux) } } - sc->intr_establish = pckbc_isa_intr_establish; - if (pckbc_is_console(iot, IO_KBD)) { t = &pckbc_consdata; pckbc_console_attached = 1; @@ -175,9 +171,3 @@ pckbc_isa_attach(struct device *parent, struct device *self, void *aux) /* Finish off the attach. */ pckbc_attach(sc, cf->cf_flags); } - -void -pckbc_isa_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot) -{ - /* done in attach */ -}