-/* $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.
struct gsckbc_softc {
struct pckbc_softc sc_pckbc;
- int sc_irq;
void *sc_ih;
int sc_type;
};
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;
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");
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;
}
}
-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
*/
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;
-/* $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 $ */
/*
#include <dev/ic/i8042reg.h>
#include <dev/ic/pckbcvar.h>
-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
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));
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;
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;
- }
-}
-/* $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)
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
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) {
}
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. */
-}
-/* $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 $ */
/*
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;
-/* $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 $ */
/*
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 {
-/* $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 $ */
/*
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)
{
}
}
- sc->intr_establish = pckbc_isa_intr_establish;
-
if (pckbc_is_console(iot, IO_KBD)) {
t = &pckbc_consdata;
pckbc_console_attached = 1;
/* 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 */
-}