From aa1b4c6045c27b9ead7300b437c4d80e009ee789 Mon Sep 17 00:00:00 2001 From: scottr Date: Sat, 25 Apr 1998 21:27:40 +0000 Subject: [PATCH] Garbage collect the second (slot number) parameter to NuBus interrupt handlers. (Only slot_ignore() and slot_noint() need this, and we already have a place to put this information.) Adjust add_nubus_intr() so that if the client_data arg is specified as NULL, pass the slot number as client_data to the interrupt handler. --- sys/arch/mac68k/dev/grf_mv.c | 62 ++++++++++++----------------- sys/arch/mac68k/dev/if_ae_nubus.c | 12 +++--- sys/arch/mac68k/dev/if_sn.c | 5 +-- sys/arch/mac68k/include/viareg.h | 4 +- sys/arch/mac68k/mac68k/via.c | 44 +++++++++++--------- sys/arch/mac68k/nubus/grf_nubus.c | 62 ++++++++++++----------------- sys/arch/mac68k/nubus/if_ae_nubus.c | 12 +++--- 7 files changed, 90 insertions(+), 111 deletions(-) diff --git a/sys/arch/mac68k/dev/grf_mv.c b/sys/arch/mac68k/dev/grf_mv.c index 4050e17d09c3..32d8e5b1feec 100644 --- a/sys/arch/mac68k/dev/grf_mv.c +++ b/sys/arch/mac68k/dev/grf_mv.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf_mv.c,v 1.40 1998/04/24 01:58:44 briggs Exp $ */ +/* $NetBSD: grf_mv.c,v 1.41 1998/04/25 21:27:40 scottr Exp $ */ /* * Copyright (c) 1995 Allen Briggs. All rights reserved. @@ -52,19 +52,19 @@ static void load_image_data __P((caddr_t data, struct image_data *image)); -static void grfmv_intr_generic_write1 __P((void *vsc, int slot)); -static void grfmv_intr_generic_write4 __P((void *vsc, int slot)); -static void grfmv_intr_generic_or4 __P((void *vsc, int slot)); +static void grfmv_intr_generic_write1 __P((void *vsc)); +static void grfmv_intr_generic_write4 __P((void *vsc)); +static void grfmv_intr_generic_or4 __P((void *vsc)); -static void grfmv_intr_cb264 __P((void *vsc, int slot)); -static void grfmv_intr_cb364 __P((void *vsc, int slot)); -static void grfmv_intr_cmax __P((void *vsc, int slot)); -static void grfmv_intr_cti __P((void *vsc, int slot)); -static void grfmv_intr_radius __P((void *vsc, int slot)); -static void grfmv_intr_radius24 __P((void *vsc, int slot)); -static void grfmv_intr_supermacgfx __P((void *vsc, int slot)); -static void grfmv_intr_lapis __P((void *vsc, int slot)); -static void grfmv_intr_formac __P((void *vsc, int slot)); +static void grfmv_intr_cb264 __P((void *vsc)); +static void grfmv_intr_cb364 __P((void *vsc)); +static void grfmv_intr_cmax __P((void *vsc)); +static void grfmv_intr_cti __P((void *vsc)); +static void grfmv_intr_radius __P((void *vsc)); +static void grfmv_intr_radius24 __P((void *vsc)); +static void grfmv_intr_supermacgfx __P((void *vsc)); +static void grfmv_intr_lapis __P((void *vsc)); +static void grfmv_intr_formac __P((void *vsc)); static int grfmv_mode __P((struct grf_softc *gp, int cmd, void *arg)); static caddr_t grfmv_phys __P((struct grf_softc *gp)); @@ -343,9 +343,8 @@ grfmv_phys(gp) */ /*ARGSUSED*/ static void -grfmv_intr_generic_write1(vsc, slot) +grfmv_intr_generic_write1(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; @@ -360,9 +359,8 @@ grfmv_intr_generic_write1(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_generic_write4(vsc, slot) +grfmv_intr_generic_write4(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; @@ -377,9 +375,8 @@ grfmv_intr_generic_write4(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_generic_or4(vsc, slot) +grfmv_intr_generic_or4(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; unsigned long scratch; @@ -394,9 +391,8 @@ grfmv_intr_generic_or4(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_radius(vsc, slot) +grfmv_intr_radius(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; u_int8_t c; @@ -420,9 +416,8 @@ grfmv_intr_radius(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_radius24(vsc, slot) +grfmv_intr_radius24(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; u_int8_t c; @@ -444,9 +439,8 @@ grfmv_intr_radius24(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_cti(vsc, slot) +grfmv_intr_cti(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; u_int8_t c; @@ -460,9 +454,8 @@ grfmv_intr_cti(vsc, slot) /*ARGSUSED*/ static void -grfmv_intr_cb264(vsc, slot) +grfmv_intr_cb264(vsc) void *vsc; - int slot; { struct grfbus_softc *sc; volatile char *slotbase; @@ -515,9 +508,8 @@ grfmv_intr_cb264(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_cb364(vsc, slot) +grfmv_intr_cb364(vsc) void *vsc; - int slot; { struct grfbus_softc *sc; volatile char *slotbase; @@ -604,9 +596,8 @@ grfmv_intr_cb364(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_supermacgfx(vsc, slot) +grfmv_intr_supermacgfx(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; u_int8_t dummy; @@ -619,9 +610,8 @@ grfmv_intr_supermacgfx(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_cmax(vsc, slot) +grfmv_intr_cmax(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; u_int32_t dummy; @@ -636,9 +626,8 @@ grfmv_intr_cmax(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_lapis(vsc, slot) +grfmv_intr_lapis(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; @@ -651,9 +640,8 @@ grfmv_intr_lapis(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_formac(vsc, slot) +grfmv_intr_formac(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; u_int8_t dummy; diff --git a/sys/arch/mac68k/dev/if_ae_nubus.c b/sys/arch/mac68k/dev/if_ae_nubus.c index afbbe15440f7..5e0985b16d5a 100644 --- a/sys/arch/mac68k/dev/if_ae_nubus.c +++ b/sys/arch/mac68k/dev/if_ae_nubus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ae_nubus.c,v 1.24 1997/11/02 00:29:59 thorpej Exp $ */ +/* $NetBSD: if_ae_nubus.c,v 1.25 1998/04/25 21:27:40 scottr Exp $ */ /* * Copyright (C) 1997 Scott Reynolds @@ -71,7 +71,7 @@ static int ae_nb_get_enaddr __P((bus_space_tag_t, bus_space_handle_t, static void ae_nb_watchdog __P((struct ifnet *)); #endif -void ae_nubus_intr __P((void *, int)); +void ae_nubus_intr __P((void *)); struct cfattach ae_nubus_ca = { sizeof(struct dp8390_softc), ae_nubus_match, ae_nubus_attach @@ -361,15 +361,13 @@ ae_nubus_attach(parent, self, aux) add_nubus_intr(na->slot, ae_nubus_intr, sc); } -/* ARGSUSED */ void -ae_nubus_intr(arg, slot) +ae_nubus_intr(arg) void *arg; - int slot; { struct dp8390_softc *sc = (struct dp8390_softc *)arg; - (void) dp8390_intr(sc); + (void)dp8390_intr(sc); } static int @@ -467,7 +465,7 @@ ae_nb_watchdog(ifp) * sometimes. This kludges around that by calling the handler * by hand if the watchdog is activated. -- XXX (akb) */ - (*via2itab[1])((void *) 1); + (*via2itab[1])((void *)1); log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); ++ifp->if_oerrors; diff --git a/sys/arch/mac68k/dev/if_sn.c b/sys/arch/mac68k/dev/if_sn.c index 5efd213eec8e..fcd89bb0dfe4 100644 --- a/sys/arch/mac68k/dev/if_sn.c +++ b/sys/arch/mac68k/dev/if_sn.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_sn.c,v 1.17 1998/01/12 19:22:10 thorpej Exp $ */ +/* $NetBSD: if_sn.c,v 1.18 1998/04/25 21:27:40 scottr Exp $ */ /* * National Semiconductor DP8393X SONIC Driver @@ -860,9 +860,8 @@ initialise_rra(sc) } void -snintr(arg, slot) +snintr(arg) void *arg; - int slot; { struct sn_softc *sc = (struct sn_softc *)arg; int isr; diff --git a/sys/arch/mac68k/include/viareg.h b/sys/arch/mac68k/include/viareg.h index 4d2080aa213f..99025d422d09 100644 --- a/sys/arch/mac68k/include/viareg.h +++ b/sys/arch/mac68k/include/viareg.h @@ -1,4 +1,4 @@ -/* $NetBSD: viareg.h,v 1.7 1997/09/10 04:38:47 scottr Exp $ */ +/* $NetBSD: viareg.h,v 1.8 1998/04/25 21:27:40 scottr Exp $ */ /*- * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, @@ -194,7 +194,7 @@ void via_init __P((void)); int rbv_vidstatus __P((void)); void via_shutdown __P((void)); void via_set_modem __P((int)); -int add_nubus_intr __P((int, void (*) __P((void *, int)), void *)); +int add_nubus_intr __P((int, void (*) __P((void *)), void *)); void enable_nubus_intr __P((void)); void via1_register_irq __P((int, void (*)(void *), void *)); void via2_register_irq __P((int, void (*)(void *), void *)); diff --git a/sys/arch/mac68k/mac68k/via.c b/sys/arch/mac68k/mac68k/via.c index 0647aa343876..b59c213130dd 100644 --- a/sys/arch/mac68k/mac68k/via.c +++ b/sys/arch/mac68k/mac68k/via.c @@ -1,4 +1,4 @@ -/* $NetBSD: via.c,v 1.62 1997/09/10 04:38:48 scottr Exp $ */ +/* $NetBSD: via.c,v 1.63 1998/04/25 21:27:40 scottr Exp $ */ /*- * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, @@ -48,8 +48,8 @@ static void via1_noint __P((void *)); static void via2_noint __P((void *)); -static void slot_ignore __P((void *, int)); -static void slot_noint __P((void *, int)); +static void slot_ignore __P((void *)); +static void slot_noint __P((void *)); void mrg_adbintr __P((void *)); void mrg_pmintr __P((void *)); void rtclock_intr __P((void *)); @@ -96,7 +96,7 @@ void (*real_via2_intr) __P((struct frame *)); * as a slot 15 interrupt; this slot is quite fictitious in real-world * Macs. See also GMFH, pp. 165-167, and "Monster, Loch Ness." */ -void (*slotitab[7]) __P((void *, int)) = { +void (*slotitab[7]) __P((void *)) = { slot_noint, slot_noint, slot_noint, @@ -107,8 +107,13 @@ void (*slotitab[7]) __P((void *, int)) = { }; void *slotptab[7] = { - (void *) 0, (void *) 1, (void *) 2, (void *) 3, - (void *) 4, (void *) 5, (void *) 6 + (void *)0, + (void *)1, + (void *)2, + (void *)3, + (void *)4, + (void *)5, + (void *)6 }; void @@ -297,7 +302,7 @@ oss_intr(fp) bitnum = 0; do { if (intbits & mask) { - (*slotitab[bitnum])(slotptab[bitnum], bitnum+9); + (*slotitab[bitnum])(slotptab[bitnum]); via2_reg(rIFR) = mask; } mask <<= 1; @@ -323,7 +328,7 @@ static int nubus_intr_mask = 0; int add_nubus_intr(slot, func, client_data) int slot; - void (*func) __P((void *, int)); + void (*func) __P((void *)); void *client_data; { int s; @@ -339,10 +344,13 @@ add_nubus_intr(slot, func, client_data) s = splhigh(); - slotitab[slot-9] = func; - slotptab[slot-9] = client_data; + slotitab[slot - 9] = func; + if (client_data == NULL) + slotptab[slot - 9] = (void *)(slot - 9); + else + slotptab[slot - 9] = client_data; - nubus_intr_mask |= (1 << (slot-9)); + nubus_intr_mask |= (1 << (slot - 9)); splx(s); @@ -374,7 +382,7 @@ via2_nubus_intr(bitarg) mask = (1 << i); do { if (intbits & mask) - (*slotitab[i])(slotptab[i], i+9); + (*slotitab[i])(slotptab[i]); i--; mask >>= 1; } while (mask); @@ -395,7 +403,7 @@ rbv_nubus_intr(bitarg) mask = (1 << i); do { if (intbits & mask) - (*slotitab[i])(slotptab[i], i+9); + (*slotitab[i])(slotptab[i]); i--; mask >>= 1; } while (mask); @@ -404,11 +412,10 @@ rbv_nubus_intr(bitarg) } static void -slot_ignore(client_data, slot) +slot_ignore(client_data) void *client_data; - int slot; { - register int mask = (1 << (slot-9)); + int mask = (1 << (int)client_data); if (VIA2 == VIA2OFF) { via2_reg(vDirA) |= mask; @@ -419,10 +426,11 @@ slot_ignore(client_data, slot) } static void -slot_noint(client_data, slot) +slot_noint(client_data) void *client_data; - int slot; { + int slot = (int)client_data + 9; + printf("slot_noint() slot %x\n", slot); } diff --git a/sys/arch/mac68k/nubus/grf_nubus.c b/sys/arch/mac68k/nubus/grf_nubus.c index 3bf9d15344eb..242e719f4eee 100644 --- a/sys/arch/mac68k/nubus/grf_nubus.c +++ b/sys/arch/mac68k/nubus/grf_nubus.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf_nubus.c,v 1.40 1998/04/24 01:58:44 briggs Exp $ */ +/* $NetBSD: grf_nubus.c,v 1.41 1998/04/25 21:27:40 scottr Exp $ */ /* * Copyright (c) 1995 Allen Briggs. All rights reserved. @@ -52,19 +52,19 @@ static void load_image_data __P((caddr_t data, struct image_data *image)); -static void grfmv_intr_generic_write1 __P((void *vsc, int slot)); -static void grfmv_intr_generic_write4 __P((void *vsc, int slot)); -static void grfmv_intr_generic_or4 __P((void *vsc, int slot)); +static void grfmv_intr_generic_write1 __P((void *vsc)); +static void grfmv_intr_generic_write4 __P((void *vsc)); +static void grfmv_intr_generic_or4 __P((void *vsc)); -static void grfmv_intr_cb264 __P((void *vsc, int slot)); -static void grfmv_intr_cb364 __P((void *vsc, int slot)); -static void grfmv_intr_cmax __P((void *vsc, int slot)); -static void grfmv_intr_cti __P((void *vsc, int slot)); -static void grfmv_intr_radius __P((void *vsc, int slot)); -static void grfmv_intr_radius24 __P((void *vsc, int slot)); -static void grfmv_intr_supermacgfx __P((void *vsc, int slot)); -static void grfmv_intr_lapis __P((void *vsc, int slot)); -static void grfmv_intr_formac __P((void *vsc, int slot)); +static void grfmv_intr_cb264 __P((void *vsc)); +static void grfmv_intr_cb364 __P((void *vsc)); +static void grfmv_intr_cmax __P((void *vsc)); +static void grfmv_intr_cti __P((void *vsc)); +static void grfmv_intr_radius __P((void *vsc)); +static void grfmv_intr_radius24 __P((void *vsc)); +static void grfmv_intr_supermacgfx __P((void *vsc)); +static void grfmv_intr_lapis __P((void *vsc)); +static void grfmv_intr_formac __P((void *vsc)); static int grfmv_mode __P((struct grf_softc *gp, int cmd, void *arg)); static caddr_t grfmv_phys __P((struct grf_softc *gp)); @@ -343,9 +343,8 @@ grfmv_phys(gp) */ /*ARGSUSED*/ static void -grfmv_intr_generic_write1(vsc, slot) +grfmv_intr_generic_write1(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; @@ -360,9 +359,8 @@ grfmv_intr_generic_write1(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_generic_write4(vsc, slot) +grfmv_intr_generic_write4(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; @@ -377,9 +375,8 @@ grfmv_intr_generic_write4(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_generic_or4(vsc, slot) +grfmv_intr_generic_or4(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; unsigned long scratch; @@ -394,9 +391,8 @@ grfmv_intr_generic_or4(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_radius(vsc, slot) +grfmv_intr_radius(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; u_int8_t c; @@ -420,9 +416,8 @@ grfmv_intr_radius(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_radius24(vsc, slot) +grfmv_intr_radius24(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; u_int8_t c; @@ -444,9 +439,8 @@ grfmv_intr_radius24(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_cti(vsc, slot) +grfmv_intr_cti(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; u_int8_t c; @@ -460,9 +454,8 @@ grfmv_intr_cti(vsc, slot) /*ARGSUSED*/ static void -grfmv_intr_cb264(vsc, slot) +grfmv_intr_cb264(vsc) void *vsc; - int slot; { struct grfbus_softc *sc; volatile char *slotbase; @@ -515,9 +508,8 @@ grfmv_intr_cb264(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_cb364(vsc, slot) +grfmv_intr_cb364(vsc) void *vsc; - int slot; { struct grfbus_softc *sc; volatile char *slotbase; @@ -604,9 +596,8 @@ grfmv_intr_cb364(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_supermacgfx(vsc, slot) +grfmv_intr_supermacgfx(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; u_int8_t dummy; @@ -619,9 +610,8 @@ grfmv_intr_supermacgfx(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_cmax(vsc, slot) +grfmv_intr_cmax(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; u_int32_t dummy; @@ -636,9 +626,8 @@ grfmv_intr_cmax(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_lapis(vsc, slot) +grfmv_intr_lapis(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; @@ -651,9 +640,8 @@ grfmv_intr_lapis(vsc, slot) */ /*ARGSUSED*/ static void -grfmv_intr_formac(vsc, slot) +grfmv_intr_formac(vsc) void *vsc; - int slot; { struct grfbus_softc *sc = (struct grfbus_softc *)vsc; u_int8_t dummy; diff --git a/sys/arch/mac68k/nubus/if_ae_nubus.c b/sys/arch/mac68k/nubus/if_ae_nubus.c index afbbe15440f7..5e0985b16d5a 100644 --- a/sys/arch/mac68k/nubus/if_ae_nubus.c +++ b/sys/arch/mac68k/nubus/if_ae_nubus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ae_nubus.c,v 1.24 1997/11/02 00:29:59 thorpej Exp $ */ +/* $NetBSD: if_ae_nubus.c,v 1.25 1998/04/25 21:27:40 scottr Exp $ */ /* * Copyright (C) 1997 Scott Reynolds @@ -71,7 +71,7 @@ static int ae_nb_get_enaddr __P((bus_space_tag_t, bus_space_handle_t, static void ae_nb_watchdog __P((struct ifnet *)); #endif -void ae_nubus_intr __P((void *, int)); +void ae_nubus_intr __P((void *)); struct cfattach ae_nubus_ca = { sizeof(struct dp8390_softc), ae_nubus_match, ae_nubus_attach @@ -361,15 +361,13 @@ ae_nubus_attach(parent, self, aux) add_nubus_intr(na->slot, ae_nubus_intr, sc); } -/* ARGSUSED */ void -ae_nubus_intr(arg, slot) +ae_nubus_intr(arg) void *arg; - int slot; { struct dp8390_softc *sc = (struct dp8390_softc *)arg; - (void) dp8390_intr(sc); + (void)dp8390_intr(sc); } static int @@ -467,7 +465,7 @@ ae_nb_watchdog(ifp) * sometimes. This kludges around that by calling the handler * by hand if the watchdog is activated. -- XXX (akb) */ - (*via2itab[1])((void *) 1); + (*via2itab[1])((void *)1); log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); ++ifp->if_oerrors;