summaryrefslogtreecommitdiff
path: root/sys/arch/hppa/gsc
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-12-17 21:54:26 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-12-17 21:54:26 +0000
commit7f33aa2f59d67ead13e253a82b4241d038e46a5d (patch)
tree0d8e42d725d944bbed37154b421ab258da5a95e6 /sys/arch/hppa/gsc
parentc86b06b8c90928864da380972228aea593140be3 (diff)
real interrupts/spl framework.
tested on 712/* 715/100, 715/33 which main cpu/bus types. miod@ ok
Diffstat (limited to 'sys/arch/hppa/gsc')
-rw-r--r--sys/arch/hppa/gsc/gscbus.c92
-rw-r--r--sys/arch/hppa/gsc/gscbusvar.h12
2 files changed, 21 insertions, 83 deletions
diff --git a/sys/arch/hppa/gsc/gscbus.c b/sys/arch/hppa/gsc/gscbus.c
index 17f05725776..35e42354386 100644
--- a/sys/arch/hppa/gsc/gscbus.c
+++ b/sys/arch/hppa/gsc/gscbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gscbus.c,v 1.19 2002/03/14 01:26:31 millert Exp $ */
+/* $OpenBSD: gscbus.c,v 1.20 2002/12/17 21:54:25 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -134,13 +134,11 @@ gscattach(parent, self, aux)
struct device *self;
void *aux;
{
- register struct gsc_softc *sc = (struct gsc_softc *)self;
- register struct gsc_attach_args *ga = aux;
+ struct gsc_softc *sc = (struct gsc_softc *)self;
+ struct gsc_attach_args *ga = aux;
sc->sc_iot = ga->ga_iot;
sc->sc_ic = ga->ga_ic;
- sc->sc_intrmask = 0;
- bzero(sc->sc_intrvs, sizeof(sc->sc_intrvs));
#ifdef USELEDS
if (machine_ledaddr)
@@ -148,8 +146,9 @@ gscattach(parent, self, aux)
#endif
printf ("\n");
- sc->sc_ih = cpu_intr_establish(IPL_IO, ga->ga_irq,
- gsc_intr, sc, &sc->sc_dev);
+ sc->sc_ih = cpu_intr_establish(IPL_NESTED, ga->ga_irq,
+ gsc_intr, (void *)sc->sc_ic->gsc_base, &sc->sc_dev);
+
/* DMA guts */
sc->sc_dmatag._cookie = sc;
sc->sc_dmatag._dmamap_create = gsc_dmamap_create;
@@ -183,7 +182,6 @@ gscprint(aux, pnp)
return (UNCONF);
}
-
void *
gsc_intr_establish(sc, pri, irq, handler, arg, dv)
struct gsc_softc *sc;
@@ -193,29 +191,19 @@ gsc_intr_establish(sc, pri, irq, handler, arg, dv)
void *arg;
struct device *dv;
{
- register struct gscbus_intr *iv;
- register u_int32_t mask;
+ volatile u_int32_t *r = sc->sc_ic->gsc_base;
+ void *iv;
- mask = 1 << irq;
- if (sc->sc_intrmask & mask) {
+ if ((iv = cpu_intr_map(sc->sc_ih, pri, irq, handler, arg, dv)))
+ r[1] |= (1 << irq);
+ else {
#ifdef GSCDEBUG
printf("%s: attaching irq %d, already occupied\n",
sc->sc_dev.dv_xname, irq);
#endif
- return NULL;
}
- sc->sc_intrmask |= mask;
- iv = &sc->sc_intrvs[irq];
- iv->pri = pri;
- iv->handler = handler;
- iv->arg = arg;
- evcnt_attach(dv, dv->dv_xname, &iv->evcnt);
- (sc->sc_ic->gsc_intr_establish)(sc->sc_ic->gsc_dv, mask);
-#ifdef GSCDEBUG
- printf("gsc_intr_establish: mask=0x%08x irq=%d iv=%p\n", mask, irq, iv);
-#endif
- return &sc->sc_intrvs[irq];
+ return (iv);
}
void
@@ -223,61 +211,13 @@ gsc_intr_disestablish(sc, v)
struct gsc_softc *sc;
void *v;
{
- register u_int32_t mask;
-
- mask = 1 << (sc->sc_intrvs - (struct gscbus_intr *)v);
- sc->sc_intrmask &= ~mask;
- ((struct gscbus_intr *)v)->handler = NULL;
- /* evcnt_detach(); */
- (sc->sc_ic->gsc_intr_disestablish)(sc->sc_ic->gsc_dv, mask);
-}
-
-int
-gsc_intr(v)
- void *v;
-{
- register struct gsc_softc *sc = v;
- register struct gscbus_ic *ic = sc->sc_ic;
- register u_int32_t mask;
- int ret;
+#if notyet
+ volatile u_int32_t *r = sc->sc_ic->gsc_base;
-#ifdef GSCDEBUG_INTR
- printf("gsc_intr(%p)\n", v);
-#endif
- ret = 0;
- while ((mask = (ic->gsc_intr_check)(ic->gsc_dv))) {
- register int i;
- register struct gscbus_intr *iv;
+ r[1] &= ~(1 << irq);
- i = ffs(mask) - 1;
- iv = &sc->sc_intrvs[i];
-
-#ifdef GSCDEBUG_INTR
- printf("gsc_intr: got mask=0x%08x i=%d iv=%p\n", mask, i, iv);
-#endif
- if (iv->handler) {
- int s;
-#ifdef GSCDEBUG_INTR
- printf("gsc_intr: calling %p for irq %d\n", v, i);
+ cpu_intr_unmap(sc->sc_ih, v);
#endif
- iv->evcnt.ev_count++;
- s = splraise(iv->pri);
- ret = (iv->handler)(iv->arg);
- splx(s);
-#ifdef GSCDEBUG_INTR
- if (!ret)
- printf ("%s: can't handle interrupt\n",
- iv->evcnt.ev_name);
-#endif
- ret = 1;
- } else
- printf("%s: stray interrupt %d\n",
- sc->sc_dev.dv_xname, i);
-
- (ic->gsc_intr_ack)(ic->gsc_dv, 1 << i);
- }
-
- return ret;
}
int
diff --git a/sys/arch/hppa/gsc/gscbusvar.h b/sys/arch/hppa/gsc/gscbusvar.h
index b6721abe5b4..5f7bac54ba2 100644
--- a/sys/arch/hppa/gsc/gscbusvar.h
+++ b/sys/arch/hppa/gsc/gscbusvar.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: gscbusvar.h,v 1.7 2002/03/14 03:15:53 millert Exp $ */
+/* $OpenBSD: gscbusvar.h,v 1.8 2002/12/17 21:54:25 mickey Exp $ */
/*
- * Copyright (c) 1998 Michael Shalayeff
+ * Copyright (c) 1998-2002 Michael Shalayeff
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,11 +33,7 @@
struct gscbus_ic {
enum {gsc_unknown = 0, gsc_lasi, gsc_wax, gsc_asp} gsc_type;
void *gsc_dv;
-
- void (*gsc_intr_establish)(void *v, u_int32_t mask);
- void (*gsc_intr_disestablish)(void *v, u_int32_t mask);
- u_int32_t (*gsc_intr_check)(void *v);
- void (*gsc_intr_ack)(void *v, u_int32_t mask);
+ volatile void *gsc_base;
};
struct gsc_attach_args {
@@ -58,6 +54,8 @@ struct gscbus_intr {
int pri;
int (*handler)(void *);
void *arg;
+ void *softc;
+ void *cpuiv;
struct evcnt evcnt;
};