diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2004-08-17 19:40:46 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2004-08-17 19:40:46 +0000 |
commit | 00b964f056e6778f9f87ae85369114e9c7856ac8 (patch) | |
tree | d6b17bf15bab537d3b0a8816b3a7bbf0811ba3dc /sys/arch | |
parent | 81fa22969fd3f73843d53f29845f738008e94a26 (diff) |
Improved interrupt counters for arm: no spaces in the names,
return correct value for interrupt routines, fix some string overflows.
only count the interrupts we are interested in. ok miod@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm/footbridge/footbridge.c | 12 | ||||
-rw-r--r-- | sys/arch/arm/footbridge/footbridge_clock.c | 10 | ||||
-rw-r--r-- | sys/arch/arm/footbridge/footbridge_com.c | 6 | ||||
-rw-r--r-- | sys/arch/arm/footbridge/footbridge_intr.h | 3 | ||||
-rw-r--r-- | sys/arch/arm/footbridge/footbridge_irqhandler.c | 10 | ||||
-rw-r--r-- | sys/arch/arm/footbridge/footbridge_pci.c | 16 | ||||
-rw-r--r-- | sys/arch/arm/footbridge/isa/isa_machdep.c | 6 |
7 files changed, 26 insertions, 37 deletions
diff --git a/sys/arch/arm/footbridge/footbridge.c b/sys/arch/arm/footbridge/footbridge.c index 38a1197cffa..6fa0cfed203 100644 --- a/sys/arch/arm/footbridge/footbridge.c +++ b/sys/arch/arm/footbridge/footbridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: footbridge.c,v 1.3 2004/05/19 03:17:07 drahn Exp $ */ +/* $OpenBSD: footbridge.c,v 1.4 2004/08/17 19:40:45 drahn Exp $ */ /* $NetBSD: footbridge.c,v 1.7 2002/05/16 01:01:33 thorpej Exp $ */ /* @@ -194,13 +194,13 @@ footbridge_attach(parent, self, aux) sc->sc_serr_ih = footbridge_intr_claim(IRQ_SERR, IPL_HIGH, "serr", footbridge_intr, sc); sc->sc_sdram_par_ih = footbridge_intr_claim(IRQ_SDRAM_PARITY, IPL_HIGH, - "sdram parity", footbridge_intr, sc); + "sdram_parity", footbridge_intr, sc); sc->sc_data_par_ih = footbridge_intr_claim(IRQ_DATA_PARITY, IPL_HIGH, - "data parity", footbridge_intr, sc); + "data_parity", footbridge_intr, sc); sc->sc_master_abt_ih = footbridge_intr_claim(IRQ_MASTER_ABORT, IPL_HIGH, - "mast abt", footbridge_intr, sc); + "mast_abt", footbridge_intr, sc); sc->sc_target_abt_ih = footbridge_intr_claim(IRQ_TARGET_ABORT, IPL_HIGH, - "targ abt", footbridge_intr, sc); + "targ_abt", footbridge_intr, sc); sc->sc_parity_ih = footbridge_intr_claim(IRQ_PARITY, IPL_HIGH, "parity", footbridge_intr, sc); @@ -279,7 +279,7 @@ footbridge_intr(arg) bus_space_write_4(sc->sc_iot, sc->sc_ioh, PCI_COMMAND_STATUS_REG, ctrl | intr); } - return(0); + return(intr != 0); } /* End of footbridge.c */ diff --git a/sys/arch/arm/footbridge/footbridge_clock.c b/sys/arch/arm/footbridge/footbridge_clock.c index 89d6a58c23b..f8c42026ff4 100644 --- a/sys/arch/arm/footbridge/footbridge_clock.c +++ b/sys/arch/arm/footbridge/footbridge_clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: footbridge_clock.c,v 1.4 2004/06/03 23:20:07 deraadt Exp $ */ +/* $OpenBSD: footbridge_clock.c,v 1.5 2004/08/17 19:40:45 drahn Exp $ */ /* $NetBSD: footbridge_clock.c,v 1.17 2003/03/23 14:12:25 chris Exp $ */ /* @@ -146,7 +146,7 @@ clockhandler(aframe) extern int ticks; debugled(ticks); } - return(0); /* Pass the interrupt on down the chain */ + return(-1); /* Pass the interrupt on down the chain */ } /* @@ -206,7 +206,7 @@ statclockhandler(aframe) */ statclock(frame); - return(0); /* Pass the interrupt on down the chain */ + return(-1); /* Pass the interrupt on down the chain */ } static int @@ -301,7 +301,7 @@ cpu_initclocks() clock_sc->sc_clock_ticks_per_256us = ((((clock_sc->sc_clock_count * hz) / 1000) * 256) / 1000); clock_sc->sc_clockintr = footbridge_intr_claim(IRQ_TIMER_1, IPL_CLOCK, - "tmr1 hard clk", clockhandler, 0); + "tmr1_hard_clk", clockhandler, 0); if (clock_sc->sc_clockintr == NULL) panic("%s: Cannot install timer 1 interrupt handler", @@ -312,7 +312,7 @@ cpu_initclocks() /* Setup timer 2 and claim interrupt */ setstatclockrate(stathz); clock_sc->sc_statclockintr = footbridge_intr_claim(IRQ_TIMER_2, IPL_STATCLOCK, - "tmr2 stat clk", statclockhandler, 0); + "tmr2_stat_clk", statclockhandler, 0); if (clock_sc->sc_statclockintr == NULL) panic("%s: Cannot install timer 2 interrupt handler", clock_sc->sc_dev.dv_xname); diff --git a/sys/arch/arm/footbridge/footbridge_com.c b/sys/arch/arm/footbridge/footbridge_com.c index 79e9889131e..f55c0020535 100644 --- a/sys/arch/arm/footbridge/footbridge_com.c +++ b/sys/arch/arm/footbridge/footbridge_com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: footbridge_com.c,v 1.3 2004/05/19 03:17:07 drahn Exp $ */ +/* $OpenBSD: footbridge_com.c,v 1.4 2004/08/17 19:40:45 drahn Exp $ */ /* $NetBSD: footbridge_com.c,v 1.13 2003/03/23 14:12:25 chris Exp $ */ /*- @@ -221,7 +221,7 @@ fcom_attach(parent, self, aux) printf("\n"); sc->sc_ih = footbridge_intr_claim(sc->sc_rx_irq, IPL_SERIAL, - "serial rx", fcom_rxintr, sc); + "serial_rx", fcom_rxintr, sc); if (sc->sc_ih == NULL) panic("%s: Cannot install rx interrupt handler", sc->sc_dev.dv_xname); @@ -639,7 +639,7 @@ fcom_rxintr(arg) } } } while (1); - return(0); + return(1); } #if 0 diff --git a/sys/arch/arm/footbridge/footbridge_intr.h b/sys/arch/arm/footbridge/footbridge_intr.h index a3923222ff9..5aeb85abbdc 100644 --- a/sys/arch/arm/footbridge/footbridge_intr.h +++ b/sys/arch/arm/footbridge/footbridge_intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: footbridge_intr.h,v 1.2 2004/08/06 19:29:10 drahn Exp $ */ +/* $OpenBSD: footbridge_intr.h,v 1.3 2004/08/17 19:40:45 drahn Exp $ */ /* $NetBSD: footbridge_intr.h,v 1.4 2003/01/03 00:56:00 thorpej Exp $ */ /* @@ -208,7 +208,6 @@ struct intrq { int iq_mask; /* IRQs to mask while handling */ int iq_levels; /* IPL_*'s this IRQ has */ int iq_ist; /* share type */ - char iq_name[IRQNAMESIZE]; /* interrupt name */ }; #endif /* _LOCORE */ diff --git a/sys/arch/arm/footbridge/footbridge_irqhandler.c b/sys/arch/arm/footbridge/footbridge_irqhandler.c index fbe49e43551..1d4d6d3f9d3 100644 --- a/sys/arch/arm/footbridge/footbridge_irqhandler.c +++ b/sys/arch/arm/footbridge/footbridge_irqhandler.c @@ -1,4 +1,4 @@ -/* $OpenBSD: footbridge_irqhandler.c,v 1.3 2004/08/06 19:29:10 drahn Exp $ */ +/* $OpenBSD: footbridge_irqhandler.c,v 1.4 2004/08/17 19:40:45 drahn Exp $ */ /* $NetBSD: footbridge_irqhandler.c,v 1.9 2003/06/16 20:00:57 thorpej Exp $ */ /* @@ -310,8 +310,6 @@ footbridge_intr_init(void) for (i = 0; i < NIRQ; i++) { iq = &footbridge_intrq[i]; TAILQ_INIT(&iq->iq_list); - - snprintf(iq->iq_name, sizeof(iq->iq_name), "irq %d", i); } footbridge_intr_calculate_masks(); @@ -352,9 +350,9 @@ footbridge_intr_claim(int irq, int ipl, char *name, int (*func)(void *), void *a footbridge_intr_calculate_masks(); - /* detach the existing event counter and add the new name */ - evcount_attach(&ih->ih_count, name, (void *)&ih->ih_irq, - &evcount_intr); + if (name != NULL) + evcount_attach(&ih->ih_count, name, (void *)&ih->ih_irq, + &evcount_intr); restore_interrupts(oldirqstate); diff --git a/sys/arch/arm/footbridge/footbridge_pci.c b/sys/arch/arm/footbridge/footbridge_pci.c index ab4387ea0b5..44e2da82404 100644 --- a/sys/arch/arm/footbridge/footbridge_pci.c +++ b/sys/arch/arm/footbridge/footbridge_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: footbridge_pci.c,v 1.3 2004/08/06 19:29:10 drahn Exp $ */ +/* $OpenBSD: footbridge_pci.c,v 1.4 2004/08/17 19:40:45 drahn Exp $ */ /* $NetBSD: footbridge_pci.c,v 1.4 2001/09/05 16:17:35 matt Exp $ */ /* @@ -328,12 +328,13 @@ footbridge_pci_intr_map(pa, ihp) return(0); } + const char * footbridge_pci_intr_string(pcv, ih) void *pcv; pci_intr_handle_t ih; { - static char irqstr[8]; /* 4 + 2 + NULL + sanity */ + static char irqstr[32]; #ifdef PCI_DEBUG printf("footbridge_pci_intr_string(pcv=0x%p, ih=0x%lx)\n", pcv, ih); @@ -361,18 +362,12 @@ footbridge_pci_intr_establish(pcv, ih, level, func, arg, name) char *name; { void *intr; - int length; - char *string; #ifdef PCI_DEBUG printf("footbridge_pci_intr_establish(pcv=%p, ih=0x%lx, level=%d, func=%p, arg=%p)\n", pcv, ih, level, func, arg); #endif - /* Copy the interrupt string to a private buffer */ - length = strlen(footbridge_pci_intr_string(pcv, ih)); - string = malloc(length + 1, M_DEVBUF, M_WAITOK); - strlcpy(string, footbridge_pci_intr_string(pcv, ih), length); #if NISA > 0 /* * XXX the IDE driver will attach the interrupts in compat mode and @@ -383,10 +378,10 @@ footbridge_pci_intr_establish(pcv, ih, level, func, arg, name) */ if (ih >= 0x80 && ih <= 0x8d) { intr = isa_intr_establish(NULL, (ih & 0x0f), IST_EDGE, - level, func, arg, string); + level, func, arg, name); } else #endif - intr = footbridge_intr_claim(ih, level, string, func, arg); + intr = footbridge_intr_claim(ih, level, name, func, arg); return(intr); } @@ -400,7 +395,6 @@ footbridge_pci_intr_disestablish(pcv, cookie) printf("footbridge_pci_intr_disestablish(pcv=%p, cookie=0x%x)\n", pcv, cookie); #endif - /* XXXX Need to free the string */ footbridge_intr_disestablish(cookie); } diff --git a/sys/arch/arm/footbridge/isa/isa_machdep.c b/sys/arch/arm/footbridge/isa/isa_machdep.c index 95b2b077b19..cbbdae8a482 100644 --- a/sys/arch/arm/footbridge/isa/isa_machdep.c +++ b/sys/arch/arm/footbridge/isa/isa_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isa_machdep.c,v 1.3 2004/08/06 19:29:10 drahn Exp $ */ +/* $OpenBSD: isa_machdep.c,v 1.4 2004/08/17 19:40:45 drahn Exp $ */ /* $NetBSD: isa_machdep.c,v 1.4 2003/06/16 20:00:57 thorpej Exp $ */ /*- @@ -495,8 +495,6 @@ isa_intr_init(void) for (i = 0; i < ICU_LEN; i++) { iq = &isa_intrq[i]; TAILQ_INIT(&iq->iq_list); - - snprintf(iq->iq_name, sizeof(iq->iq_name), "irq %d", i); } isa_icu_init(); @@ -505,7 +503,7 @@ isa_intr_init(void) #ifndef ISA_FOOTBRIDGE_IRQ #warning Before using isa with footbridge you must define ISA_FOOTBRIDGE_IRQ #endif - isa_ih = footbridge_intr_claim(ISA_FOOTBRIDGE_IRQ, IPL_BIO, "isabus", + isa_ih = footbridge_intr_claim(ISA_FOOTBRIDGE_IRQ, IPL_BIO, NULL, isa_irqdispatch, NULL); } |