diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-10-01 20:19:20 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-10-01 20:19:20 +0000 |
commit | 2f170aacf72c46c917cdfe67ac32e89d65edf81d (patch) | |
tree | 1dc5956ddab9243ed357fece1a6b970c972f9953 /sys/arch/macppc | |
parent | 6c8d318a056e70f92a487ab483553d455ad77e55 (diff) |
Generic soft interrupts for macppc. Tested by mk@, deraadt@
ok miod@
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r-- | sys/arch/macppc/dev/macintr.c | 22 | ||||
-rw-r--r-- | sys/arch/macppc/dev/openpic.c | 36 | ||||
-rw-r--r-- | sys/arch/macppc/dev/zs.c | 17 | ||||
-rw-r--r-- | sys/arch/macppc/include/z8530var.h | 13 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/autoconf.c | 6 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/clock.c | 4 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/machdep.c | 35 |
7 files changed, 46 insertions, 87 deletions
diff --git a/sys/arch/macppc/dev/macintr.c b/sys/arch/macppc/dev/macintr.c index f0f38b0a962..c73e45c0d9b 100644 --- a/sys/arch/macppc/dev/macintr.c +++ b/sys/arch/macppc/dev/macintr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macintr.c,v 1.38 2009/08/22 02:54:50 mk Exp $ */ +/* $OpenBSD: macintr.c,v 1.39 2009/10/01 20:19:18 kettenis Exp $ */ /*- * Copyright (c) 1995 Per Fogelstrom @@ -374,7 +374,7 @@ intr_calculatemasks() for (irq = 0; irq < ICU_LEN; irq++) if (m_intrlevel[irq] & (1 << level)) irqs |= 1 << irq; - imask[level] = irqs | SINT_MASK; + imask[level] = irqs | SINT_ALLMASK; } /* @@ -387,7 +387,7 @@ intr_calculatemasks() imask[IPL_NET] |= imask[IPL_BIO]; imask[IPL_TTY] |= imask[IPL_NET]; imask[IPL_VM] |= imask[IPL_TTY]; - imask[IPL_CLOCK] |= imask[IPL_VM] | SPL_CLOCK; + imask[IPL_CLOCK] |= imask[IPL_VM] | SPL_CLOCKMASK; /* * These are pseudo-levels. @@ -400,7 +400,7 @@ intr_calculatemasks() register int irqs = 1 << irq; for (q = m_intrhand[irq]; q; q = q->ih_next) irqs |= imask[q->ih_level]; - m_intrmask[irq] = irqs | SINT_MASK; + m_intrmask[irq] = irqs | SINT_ALLMASK; } /* Lastly, determine which IRQs are actually in use. */ @@ -579,23 +579,17 @@ mac_intr_do_pending_int() do { if((ci->ci_ipending & SINT_CLOCK) & ~pcpl) { ci->ci_ipending &= ~SINT_CLOCK; - softclock(); + softintr_dispatch(SI_SOFTCLOCK); } if((ci->ci_ipending & SINT_NET) & ~pcpl) { - extern int netisr; - int pisr; - ci->ci_ipending &= ~SINT_NET; - while ((pisr = netisr) != 0) { - atomic_clearbits_int(&netisr, pisr); - softnet(pisr); - } + softintr_dispatch(SI_SOFTNET); } if((ci->ci_ipending & SINT_TTY) & ~pcpl) { ci->ci_ipending &= ~SINT_TTY; - softtty(); + softintr_dispatch(SI_SOFTTTY); } - } while ((ci->ci_ipending & SINT_MASK) & ~pcpl); + } while ((ci->ci_ipending & SINT_ALLMASK) & ~pcpl); ci->ci_ipending &= pcpl; ci->ci_cpl = pcpl; /* Don't use splx... we are here already! */ ppc_intr_enable(s); diff --git a/sys/arch/macppc/dev/openpic.c b/sys/arch/macppc/dev/openpic.c index ca863b97c3e..2fc2070031c 100644 --- a/sys/arch/macppc/dev/openpic.c +++ b/sys/arch/macppc/dev/openpic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openpic.c,v 1.57 2009/09/15 21:02:24 kettenis Exp $ */ +/* $OpenBSD: openpic.c,v 1.58 2009/10/01 20:19:18 kettenis Exp $ */ /*- * Copyright (c) 1995 Per Fogelstrom @@ -71,8 +71,8 @@ static int mapirq(int irq); int openpic_prog_button(void *arg); void openpic_enable_irq_mask(int irq_mask); -#define HWIRQ_MAX 27 -#define HWIRQ_MASK 0x0fffffff +#define HWIRQ_MAX (31 - (SI_NQUEUES + 1)) +#define HWIRQ_MASK (0xffffffff >> (SI_NQUEUES + 1)) /* IRQ vector used for inter-processor interrupts. */ #define IPI_VECTOR_NOP 64 @@ -414,9 +414,9 @@ openpic_calc_mask() for (i = IPL_NONE; i <= IPL_HIGH; i++) { if (i > IPL_NONE) - imask[i] |= SINT_MASK; + imask[i] |= SINT_ALLMASK; if (i >= IPL_CLOCK) - imask[i] |= SPL_CLOCK; + imask[i] |= SPL_CLOCKMASK; } imask[IPL_HIGH] = 0xffffffff; } @@ -492,7 +492,7 @@ openpic_do_pending_int() if (pripending == 0) continue; irq = 31 - cntlzw(pripending); - ci->ci_ipending &= ~(1L << irq); + ci->ci_ipending &= ~(1 << irq); ci->ci_cpl = imask[o_intrmaxlvl[o_hwirq[irq]]]; openpic_enable_irq_mask(~ci->ci_cpl); ih = o_intrhand[irq]; @@ -512,7 +512,7 @@ openpic_do_pending_int() hwpend = ci->ci_ipending & ~pcpl;/* Catch new pendings */ hwpend &= HWIRQ_MASK; } - ci->ci_cpl = pcpl | SINT_MASK; + ci->ci_cpl = pcpl | SINT_ALLMASK; openpic_enable_irq_mask(~ci->ci_cpl); atomic_clearbits_int(&ci->ci_iactive, CI_IACTIVE_PROCESSING_HARD); @@ -537,25 +537,19 @@ openpic_do_pending_softint(int pcpl) ci->ci_cpl = SINT_CLOCK|SINT_NET|SINT_TTY; ppc_intr_enable(1); KERNEL_LOCK(); - softclock(); + softintr_dispatch(SI_SOFTCLOCK); KERNEL_UNLOCK(); ppc_intr_disable(); continue; } if((ci->ci_ipending & SINT_NET) & ~pcpl) { - extern int netisr; - int pisr; - ci->ci_ipending &= ~SINT_NET; ci->ci_cpl = SINT_NET|SINT_TTY; - while ((pisr = netisr) != 0) { - atomic_clearbits_int(&netisr, pisr); - ppc_intr_enable(1); - KERNEL_LOCK(); - softnet(pisr); - KERNEL_UNLOCK(); - ppc_intr_disable(); - } + ppc_intr_enable(1); + KERNEL_LOCK(); + softintr_dispatch(SI_SOFTNET); + KERNEL_UNLOCK(); + ppc_intr_disable(); continue; } if((ci->ci_ipending & SINT_TTY) & ~pcpl) { @@ -563,12 +557,12 @@ openpic_do_pending_softint(int pcpl) ci->ci_cpl = SINT_TTY; ppc_intr_enable(1); KERNEL_LOCK(); - softtty(); + softintr_dispatch(SI_SOFTTTY); KERNEL_UNLOCK(); ppc_intr_disable(); continue; } - } while ((ci->ci_ipending & SINT_MASK) & ~pcpl); + } while ((ci->ci_ipending & SINT_ALLMASK) & ~pcpl); ci->ci_cpl = pcpl; /* Don't use splx... we are here already! */ atomic_clearbits_int(&ci->ci_iactive, CI_IACTIVE_PROCESSING_SOFT); diff --git a/sys/arch/macppc/dev/zs.c b/sys/arch/macppc/dev/zs.c index 317992a7e22..0cfbb93f9f3 100644 --- a/sys/arch/macppc/dev/zs.c +++ b/sys/arch/macppc/dev/zs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zs.c,v 1.17 2008/08/19 07:59:19 kettenis Exp $ */ +/* $OpenBSD: zs.c,v 1.18 2009/10/01 20:19:18 kettenis Exp $ */ /* $NetBSD: zs.c,v 1.17 2001/06/19 13:42:15 wiz Exp $ */ /* @@ -170,7 +170,7 @@ struct cfattach zsc_ca = { extern struct cfdriver zsc_cd; int zshard(void *); -int zssoft(void *); +void zssoft(void *); #ifdef ZS_TXDMA int zs_txdma_int(void *); #endif @@ -393,6 +393,9 @@ zsc_attach(struct device *parent, struct device *self, void *aux) mac_intr_establish(parent, intr[1][1], IST_LEVEL, IPL_TTY, zs_txdma_int, (void *)1, "zsdma1"); #endif + zsc->zsc_softintr = softintr_establish(IPL_SOFTTTY, zssoft, zsc); + if (zsc->zsc_softintr == NULL) + panic("zsattach: could not establish soft interrupt"); /* * Set the master interrupt enable and interrupt vector. @@ -476,8 +479,7 @@ zshard(void *arg) /* We are at splzs here, so no need to lock. */ if (zssoftpending == 0) { zssoftpending = 1; - /* XXX setsoftserial(); */ - setsofttty(); /* UGLY HACK!!! */ + softintr_schedule(zsc->zsc_softintr); } } } @@ -487,7 +489,7 @@ zshard(void *arg) /* * Similar scheme as for zshard (look at all of them) */ -int +void zssoft(arg) void *arg; { @@ -496,7 +498,7 @@ zssoft(arg) /* This is not the only ISR on this IPL. */ if (zssoftpending == 0) - return (0); + return; /* * The soft intr. bit will be set by zshard only if @@ -510,7 +512,6 @@ zssoft(arg) continue; (void) zsc_intr_soft(zsc); } - return (1); } #ifdef ZS_TXDMA @@ -534,7 +535,7 @@ zs_txdma_int(arg) if (cs->cs_softreq) { if (zssoftpending == 0) { zssoftpending = 1; - setsoftserial(); + softintr_schedule(zsc->zsc_softintr); } } return 1; diff --git a/sys/arch/macppc/include/z8530var.h b/sys/arch/macppc/include/z8530var.h index d40606c739d..f778e7e56e9 100644 --- a/sys/arch/macppc/include/z8530var.h +++ b/sys/arch/macppc/include/z8530var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: z8530var.h,v 1.7 2008/06/13 00:31:09 krw Exp $ */ +/* $OpenBSD: z8530var.h,v 1.8 2009/10/01 20:19:18 kettenis Exp $ */ /* $NetBSD: z8530var.h,v 1.5 2002/03/17 19:40:45 atatat Exp $ */ /* @@ -92,12 +92,13 @@ struct xzs_chanstate { }; struct zsc_softc { - struct device zsc_dev; /* required first: base device */ - struct zs_chanstate *zsc_cs[2]; /* channel A and B soft state */ + struct device zsc_dev; /* base device */ + struct zs_chanstate *zsc_cs[2]; /* channel A and B soft state */ /* Machine-dependent part follows... */ - struct xzs_chanstate xzsc_xcs_store[2]; - dbdma_regmap_t *zsc_txdmareg[2]; - dbdma_command_t *zsc_txdmacmd[2]; + void *zsc_softintr; + struct xzs_chanstate xzsc_xcs_store[2]; + dbdma_regmap_t *zsc_txdmareg[2]; + dbdma_command_t *zsc_txdmacmd[2]; /* XXX tx only, for now */ }; diff --git a/sys/arch/macppc/macppc/autoconf.c b/sys/arch/macppc/macppc/autoconf.c index c5fff86d81a..cd083d973bb 100644 --- a/sys/arch/macppc/macppc/autoconf.c +++ b/sys/arch/macppc/macppc/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.37 2009/08/29 11:41:32 miod Exp $ */ +/* $OpenBSD: autoconf.c,v 1.38 2009/10/01 20:19:18 kettenis Exp $ */ /* * Copyright (c) 1996, 1997 Per Fogelstrom * Copyright (c) 1995 Theo de Raadt @@ -37,7 +37,7 @@ * from: Utah Hdr: autoconf.c 1.31 91/01/21 * * from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93 - * $Id: autoconf.c,v 1.37 2009/08/29 11:41:32 miod Exp $ + * $Id: autoconf.c,v 1.38 2009/10/01 20:19:18 kettenis Exp $ */ /* @@ -93,6 +93,8 @@ cpu_configure() (void)splhigh(); /* To be really sure.. */ calc_delayconst(); + softintr_init(); + if (config_rootfound("mainbus", "mainbus") == 0) panic("no mainbus found"); (void)spl0(); diff --git a/sys/arch/macppc/macppc/clock.c b/sys/arch/macppc/macppc/clock.c index c0dc55a3d3d..bab7bca11f6 100644 --- a/sys/arch/macppc/macppc/clock.c +++ b/sys/arch/macppc/macppc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.29 2009/06/09 01:12:38 deraadt Exp $ */ +/* $OpenBSD: clock.c,v 1.30 2009/10/01 20:19:18 kettenis Exp $ */ /* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */ /* @@ -225,7 +225,7 @@ decr_intr(struct clockframe *frame) */ ppc_mtdec(nextevent - tb); - if (ci->ci_cpl & SPL_CLOCK) { + if (ci->ci_cpl & SPL_CLOCKMASK) { ci->ci_statspending += nstats; } else { KERNEL_LOCK(); diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index fb070245b49..1350c9ed053 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.114 2009/08/22 02:54:50 mk Exp $ */ +/* $OpenBSD: machdep.c,v 1.115 2009/10/01 20:19:19 kettenis Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -54,8 +54,6 @@ #include <uvm/uvm_extern.h> -#include <net/netisr.h> - #include <dev/cons.h> #include <machine/bat.h> @@ -830,37 +828,6 @@ dumpsys() int imask[IPL_NUM]; -/* - * this is a hack interface to allow zs to work better until - * a true soft interrupt mechanism is created. - */ -#include "zstty.h" -#if NZSTTY > 0 - extern void zssoft(void *); -#endif -void -softtty() -{ -#if NZSTTY > 0 - zssoft(0); -#endif -} - -int netisr; - -/* - * Soft networking interrupts. - */ -void -softnet(int isr) -{ -#define DONETISR(flag, func) \ - if (isr & (1 << flag))\ - func(); - -#include <net/netisr_dispatch.h> -} - int lcsplx(int ipl) { |