PERFORCE change 139431 for review
John Baldwin
jhb at FreeBSD.org
Sat Apr 5 21:14:25 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=139431
Change 139431 by jhb at jhb_mutex on 2008/04/05 21:13:40
IFC @139430
Affected files ...
.. //depot/projects/smpng/sys/amd64/amd64/intr_machdep.c#31 integrate
.. //depot/projects/smpng/sys/arm/arm/intr.c#18 integrate
.. //depot/projects/smpng/sys/conf/Makefile.arm#30 integrate
.. //depot/projects/smpng/sys/conf/options#149 integrate
.. //depot/projects/smpng/sys/dev/acpica/Osd/OsdSynch.c#21 integrate
.. //depot/projects/smpng/sys/dev/asmc/asmc.c#2 integrate
.. //depot/projects/smpng/sys/dev/de/if_de.c#6 integrate
.. //depot/projects/smpng/sys/dev/mii/ip1000phy.c#3 integrate
.. //depot/projects/smpng/sys/dev/mii/ip1000phyreg.h#2 integrate
.. //depot/projects/smpng/sys/dev/mii/miidevs#28 integrate
.. //depot/projects/smpng/sys/i386/i386/intr_machdep.c#31 integrate
.. //depot/projects/smpng/sys/ia64/ia64/interrupt.c#41 integrate
.. //depot/projects/smpng/sys/kern/kern_intr.c#93 integrate
.. //depot/projects/smpng/sys/powerpc/powerpc/intr_machdep.c#15 integrate
.. //depot/projects/smpng/sys/sparc64/sparc64/intr_machdep.c#29 integrate
.. //depot/projects/smpng/sys/sun4v/sun4v/intr_machdep.c#9 integrate
.. //depot/projects/smpng/sys/sys/interrupt.h#25 integrate
.. //depot/projects/smpng/sys/vm/vm_phys.c#4 integrate
Differences ...
==== //depot/projects/smpng/sys/amd64/amd64/intr_machdep.c#31 (text+ko) ====
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/amd64/amd64/intr_machdep.c,v 1.39 2008/03/17 22:42:00 jhb Exp $
+ * $FreeBSD: src/sys/amd64/amd64/intr_machdep.c,v 1.40 2008/04/05 19:58:28 jhb Exp $
*/
/*
@@ -85,9 +85,6 @@
static int intr_assign_cpu(void *arg, u_char cpu);
static void intr_disable_src(void *arg);
-#ifdef INTR_FILTER
-static void intr_event_stray(void *cookie);
-#endif
static void intr_init(void *__dummy);
static int intr_pic_registered(struct pic *pic);
static void intrcnt_setname(const char *name, int index);
@@ -238,12 +235,11 @@
isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
}
-#ifdef INTR_FILTER
void
intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
{
+ struct intr_event *ie;
struct thread *td;
- struct intr_event *ie;
int vector;
td = curthread;
@@ -267,64 +263,11 @@
if (vector == 0)
clkintr_pending = 1;
- if (intr_event_handle(ie, frame) != 0)
- intr_event_stray(isrc);
-}
-
-static void
-intr_event_stray(void *cookie)
-{
- struct intsrc *isrc;
-
- isrc = cookie;
/*
* For stray interrupts, mask and EOI the source, bump the
* stray count, and log the condition.
*/
- isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
- (*isrc->is_straycount)++;
- if (*isrc->is_straycount < MAX_STRAY_LOG)
- log(LOG_ERR, "stray irq%d\n", isrc->is_pic->pic_vector(isrc));
- else if (*isrc->is_straycount == MAX_STRAY_LOG)
- log(LOG_CRIT,
- "too many stray irq %d's: not logging anymore\n",
- isrc->is_pic->pic_vector(isrc));
-}
-#else
-void
-intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
-{
- struct thread *td;
- struct intr_event *ie;
- struct intr_handler *ih;
- int error, vector, thread, ret;
-
- td = curthread;
-
- /*
- * We count software interrupts when we process them. The
- * code here follows previous practice, but there's an
- * argument for counting hardware interrupts when they're
- * processed too.
- */
- (*isrc->is_count)++;
- PCPU_INC(cnt.v_intr);
-
- ie = isrc->is_event;
-
- /*
- * XXX: We assume that IRQ 0 is only used for the ISA timer
- * device (clk).
- */
- vector = isrc->is_pic->pic_vector(isrc);
- if (vector == 0)
- clkintr_pending = 1;
-
- /*
- * For stray interrupts, mask and EOI the source, bump the
- * stray count, and log the condition.
- */
- if (ie == NULL || TAILQ_EMPTY(&ie->ie_handlers)) {
+ if (intr_event_handle(ie, frame) != 0) {
isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
(*isrc->is_straycount)++;
if (*isrc->is_straycount < MAX_STRAY_LOG)
@@ -333,60 +276,8 @@
log(LOG_CRIT,
"too many stray irq %d's: not logging anymore\n",
vector);
- return;
}
-
- /*
- * Execute fast interrupt handlers directly.
- * To support clock handlers, if a handler registers
- * with a NULL argument, then we pass it a pointer to
- * a trapframe as its argument.
- */
- td->td_intr_nesting_level++;
- ret = 0;
- thread = 0;
- critical_enter();
- TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
- if (ih->ih_filter == NULL) {
- thread = 1;
- continue;
- }
- CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__,
- ih->ih_filter, ih->ih_argument == NULL ? frame :
- ih->ih_argument, ih->ih_name);
- if (ih->ih_argument == NULL)
- ret = ih->ih_filter(frame);
- else
- ret = ih->ih_filter(ih->ih_argument);
- /*
- * Wrapper handler special case: see
- * i386/intr_machdep.c::intr_execute_handlers()
- */
- if (!thread) {
- if (ret == FILTER_SCHEDULE_THREAD)
- thread = 1;
- }
- }
-
- /*
- * If there are any threaded handlers that need to run,
- * mask the source as well as sending it an EOI. Otherwise,
- * just send it an EOI but leave it unmasked.
- */
- if (thread)
- isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
- else
- isrc->is_pic->pic_eoi_source(isrc);
-
- /* Schedule the ithread if needed. */
- if (thread) {
- error = intr_event_schedule_thread(ie);
- KASSERT(error == 0, ("bad stray interrupt"));
- }
- critical_exit();
- td->td_intr_nesting_level--;
}
-#endif
void
intr_resume(void)
==== //depot/projects/smpng/sys/arm/arm/intr.c#18 (text+ko) ====
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/arm/intr.c,v 1.19 2008/03/17 22:42:00 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/arm/intr.c,v 1.20 2008/04/05 19:58:28 jhb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/syslog.h>
@@ -72,7 +72,7 @@
if (event == NULL) {
error = intr_event_create(&event, (void *)irq, 0,
(mask_fn)arm_mask_irq, (mask_fn)arm_unmask_irq,
- (mask_fn)arm_unmask_irq, NULL, "intr%d:", irq);
+ NULL, NULL, "intr%d:", irq);
if (error)
return;
intr_events[irq] = event;
@@ -106,57 +106,17 @@
{
struct intr_event *event;
struct thread *td = curthread;
-#ifdef INTR_FILTER
int i;
-#else
- int i, thread, ret;
- struct intr_handler *ih;
-#endif
PCPU_INC(cnt.v_intr);
td->td_intr_nesting_level++;
while ((i = arm_get_next_irq()) != -1) {
-#ifndef INTR_FILTER
- arm_mask_irq(i);
-#endif
intrcnt[intrcnt_tab[i]]++;
event = intr_events[i];
- if (!event || TAILQ_EMPTY(&event->ie_handlers)) {
-#ifdef INTR_FILTER
+ if (intr_event_handle(event, frame) != 0) {
+ /* XXX: Log stray IRQs */
arm_mask_irq(i);
-#endif
- continue;
- }
-
-#ifdef INTR_FILTER
- intr_event_handle(event, frame);
- /* XXX: Log stray IRQs */
-#else
- /* Execute fast handlers. */
- ret = 0;
- thread = 0;
- TAILQ_FOREACH(ih, &event->ie_handlers, ih_next) {
- if (ih->ih_filter == NULL)
- thread = 1;
- else
- ret = ih->ih_filter(ih->ih_argument ?
- ih->ih_argument : frame);
- /*
- * Wrapper handler special case: see
- * i386/intr_machdep.c::intr_execute_handlers()
- */
- if (!thread) {
- if (ret == FILTER_SCHEDULE_THREAD)
- thread = 1;
- }
}
-
- /* Schedule thread if needed. */
- if (thread)
- intr_event_schedule_thread(event);
- else
- arm_unmask_irq(i);
-#endif
}
td->td_intr_nesting_level--;
}
==== //depot/projects/smpng/sys/conf/Makefile.arm#30 (text+ko) ====
@@ -1,7 +1,7 @@
# Makefile.arm -- with config changes.
# Copyright 1990 W. Jolitz
# from: @(#)Makefile.i386 7.1 5/10/91
-# $FreeBSD: src/sys/conf/Makefile.arm,v 1.37 2008/04/04 17:35:24 raj Exp $
+# $FreeBSD: src/sys/conf/Makefile.arm,v 1.38 2008/04/04 19:33:09 imp Exp $
#
# Makefile for FreeBSD
#
@@ -40,6 +40,10 @@
CC += -mbig-endian
SYSTEM_LD += -EB
LD += -EB
+.else
+CC += -mlittle-endian
+SYSTEM_LD += -EL
+LD += -EL
.endif
==== //depot/projects/smpng/sys/conf/options#149 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options,v 1.623 2008/03/28 17:58:54 marcel Exp $
+# $FreeBSD: src/sys/conf/options,v 1.624 2008/04/05 20:13:14 jhb Exp $
#
# On the handling of kernel options
#
@@ -760,7 +760,7 @@
XFS
# Interrupt filtering
-INTR_FILTER opt_global.h
+INTR_FILTER
#Disable code to dispatch tcp offloading
TCP_OFFLOAD_DISABLE opt_inet.h
==== //depot/projects/smpng/sys/dev/acpica/Osd/OsdSynch.c#21 (text+ko) ====
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/Osd/OsdSynch.c,v 1.32 2007/03/26 23:04:02 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/Osd/OsdSynch.c,v 1.33 2008/04/05 14:21:01 takawata Exp $");
#include <contrib/dev/acpica/acpi.h>
@@ -346,7 +346,7 @@
snprintf(h->name, sizeof(h->name), "acpi subsystem HW lock");
else
snprintf(h->name, sizeof(h->name), "acpi subsys %p", OutHandle);
- mtx_init(&h->lock, h->name, NULL, MTX_DEF);
+ mtx_init(&h->lock, h->name, NULL, MTX_DEF|MTX_RECURSE);
*OutHandle = (ACPI_SPINLOCK)h;
return (AE_OK);
}
==== //depot/projects/smpng/sys/dev/asmc/asmc.c#2 (text+ko) ====
@@ -33,7 +33,9 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/asmc/asmc.c,v 1.2 2007/11/22 23:38:24 rpaulo Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/asmc/asmc.c,v 1.3 2008/04/05 20:13:15 jhb Exp $");
+
+#include "opt_intr_filter.h"
#include <sys/param.h>
#include <sys/bus.h>
==== //depot/projects/smpng/sys/dev/de/if_de.c#6 (text) ====
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/de/if_de.c,v 1.183 2007/06/07 00:28:47 yongari Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/de/if_de.c,v 1.184 2008/04/05 17:24:44 jhb Exp $");
#define TULIP_HDR_DATA
@@ -4053,7 +4053,8 @@
/*
* bounce a copy to the bpf listener, if any.
*/
- BPF_MTAP(sc->tulip_ifp, m);
+ if (!(sc->tulip_flags & TULIP_DEVICEPROBE))
+ BPF_MTAP(sc->tulip_ifp, m);
/*
* The descriptors have been filled in. Now get ready
@@ -4437,13 +4438,16 @@
ifmedia_init(&sc->tulip_ifmedia, 0,
tulip_ifmedia_change,
tulip_ifmedia_status);
- sc->tulip_flags &= ~TULIP_DEVICEPROBE;
tulip_ifmedia_add(sc);
tulip_reset(sc);
TULIP_UNLOCK(sc);
ether_ifattach(sc->tulip_ifp, sc->tulip_enaddr);
+
+ TULIP_LOCK(sc);
+ sc->tulip_flags &= ~TULIP_DEVICEPROBE;
+ TULIP_UNLOCK(sc);
}
/* Release memory for a single descriptor ring. */
==== //depot/projects/smpng/sys/dev/mii/ip1000phy.c#3 (text+ko) ====
@@ -27,10 +27,10 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/mii/ip1000phy.c,v 1.2 2006/12/02 15:32:33 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/mii/ip1000phy.c,v 1.3 2008/04/05 00:52:07 yongari Exp $");
/*
- * Driver for the IC Plus IP1000A 10/100/1000 PHY.
+ * Driver for the IC Plus IP1000A/IP1001 10/100/1000 PHY.
*/
#include <sys/param.h>
@@ -57,6 +57,12 @@
static int ip1000phy_probe(device_t);
static int ip1000phy_attach(device_t);
+struct ip1000phy_softc {
+ struct mii_softc mii_sc;
+ int model;
+ int revision;
+};
+
static device_method_t ip1000phy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, ip1000phy_probe),
@@ -82,6 +88,7 @@
static const struct mii_phydesc ip1000phys[] = {
MII_PHY_DESC(ICPLUS, IP1000A),
+ MII_PHY_DESC(ICPLUS, IP1001),
MII_PHY_END
};
@@ -95,11 +102,13 @@
static int
ip1000phy_attach(device_t dev)
{
+ struct ip1000phy_softc *isc;
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
- sc = device_get_softc(dev);
+ isc = device_get_softc(dev);
+ sc = &isc->mii_sc;
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
mii = device_get_softc(sc->mii_dev);
@@ -114,6 +123,9 @@
mii->mii_instance++;
+ isc->model = MII_MODEL(ma->mii_id2);
+ isc->revision = MII_REV(ma->mii_id2);
+
device_printf(dev, " ");
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
@@ -302,10 +314,13 @@
static void
ip1000phy_status(struct mii_softc *sc)
{
+ struct ip1000phy_softc *isc;
struct mii_data *mii = sc->mii_pdata;
uint32_t bmsr, bmcr, stat;
uint32_t ar, lpar;
+ isc = (struct ip1000phy_softc *)sc;
+
mii->mii_media_status = IFM_AVALID;
mii->mii_media_active = IFM_ETHER;
@@ -326,25 +341,44 @@
}
}
- stat = PHY_READ(sc, STGE_PhyCtrl);
- switch (PC_LinkSpeed(stat)) {
- case PC_LinkSpeed_Down:
- mii->mii_media_active |= IFM_NONE;
- return;
- case PC_LinkSpeed_10:
- mii->mii_media_active |= IFM_10_T;
- break;
- case PC_LinkSpeed_100:
- mii->mii_media_active |= IFM_100_TX;
- break;
- case PC_LinkSpeed_1000:
- mii->mii_media_active |= IFM_1000_T;
- break;
+ if (isc->model == MII_MODEL_ICPLUS_IP1001) {
+ stat = PHY_READ(sc, IP1000PHY_LSR);
+ switch (stat & IP1000PHY_LSR_SPEED_MASK) {
+ case IP1000PHY_LSR_SPEED_10:
+ mii->mii_media_active |= IFM_10_T;
+ break;
+ case IP1000PHY_LSR_SPEED_100:
+ mii->mii_media_active |= IFM_100_TX;
+ break;
+ case IP1000PHY_LSR_SPEED_1000:
+ mii->mii_media_active |= IFM_1000_T;
+ break;
+ }
+ if ((stat & IP1000PHY_LSR_FULL_DUPLEX) != 0)
+ mii->mii_media_active |= IFM_FDX;
+ else
+ mii->mii_media_active |= IFM_HDX;
+ } else {
+ stat = PHY_READ(sc, STGE_PhyCtrl);
+ switch (PC_LinkSpeed(stat)) {
+ case PC_LinkSpeed_Down:
+ mii->mii_media_active |= IFM_NONE;
+ return;
+ case PC_LinkSpeed_10:
+ mii->mii_media_active |= IFM_10_T;
+ break;
+ case PC_LinkSpeed_100:
+ mii->mii_media_active |= IFM_100_TX;
+ break;
+ case PC_LinkSpeed_1000:
+ mii->mii_media_active |= IFM_1000_T;
+ break;
+ }
+ if ((stat & PC_PhyDuplexStatus) != 0)
+ mii->mii_media_active |= IFM_FDX;
+ else
+ mii->mii_media_active |= IFM_HDX;
}
- if ((stat & PC_PhyDuplexStatus) != 0)
- mii->mii_media_active |= IFM_FDX;
- else
- mii->mii_media_active |= IFM_HDX;
ar = PHY_READ(sc, IP1000PHY_MII_ANAR);
lpar = PHY_READ(sc, IP1000PHY_MII_ANLPAR);
@@ -410,10 +444,12 @@
static void
ip1000phy_reset(struct mii_softc *sc)
{
+ struct ip1000phy_softc *isc;
struct stge_softc *stge_sc;
struct mii_data *mii;
uint32_t reg;
+ isc = (struct ip1000phy_softc *)sc;
mii_phy_reset(sc);
/* clear autoneg/full-duplex as we don't want it after reset */
@@ -426,7 +462,8 @@
* XXX There should be more general way to pass PHY specific
* data via mii interface.
*/
- if (strcmp(mii->mii_ifp->if_dname, "stge") == 0) {
+ if (isc->model == MII_MODEL_ICPLUS_IP1000A &&
+ strcmp(mii->mii_ifp->if_dname, "stge") == 0) {
stge_sc = mii->mii_ifp->if_softc;
if (stge_sc->sc_rev >= 0x40 && stge_sc->sc_rev <= 0x4e)
ip1000phy_load_dspcode(sc);
==== //depot/projects/smpng/sys/dev/mii/ip1000phyreg.h#2 (text+ko) ====
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/dev/mii/ip1000phyreg.h,v 1.1 2006/07/25 00:16:09 yongari Exp $
+ * $FreeBSD: src/sys/dev/mii/ip1000phyreg.h,v 1.2 2008/04/05 00:52:07 yongari Exp $
*/
#ifndef _DEV_MII_IP1000PHYREG_H_
@@ -138,4 +138,49 @@
#define IP1000PHY_EXTSTS_1000X 0x4000
#define IP1000PHY_EXTSTS_1000X_FDX 0x8000
+/* PHY specific control & status register. IP1001 only. */
+#define IP1000PHY_SCSR 0x10
+#define IP1000PHY_SCSR_RXPHASE_SEL 0x0001
+#define IP1000PHY_SCSR_TXPHASE_SEL 0x0002
+#define IP1000PHY_SCSR_REPEATOR_MODE 0x0004
+#define IP1000PHY_SCSR_RESERVED1_DEF 0x0008
+#define IP1000PHY_SCSR_RXCLK_DRV_MASK 0x0060
+#define IP1000PHY_SCSR_RXCLK_DRV_DEF 0x0040
+#define IP1000PHY_SCSR_RXD_DRV_MASK 0x0180
+#define IP1000PHY_SCSR_RXD_DRV_DEF 0x0100
+#define IP1000PHY_SCSR_JABBER_ENB 0x0200
+#define IP1000PHY_SCSR_HEART_BEAT_ENB 0x0400
+#define IP1000PHY_SCSR_DOWNSHIFT_ENB 0x0800
+#define IP1000PHY_SCSR_RESERVED2_DEF 0x1000
+#define IP1000PHY_SCSR_LED_DRV_4MA 0x0000
+#define IP1000PHY_SCSR_LED_DRV_8MA 0x2000
+#define IP1000PHY_SCSR_LED_MODE_MASK 0xC000
+#define IP1000PHY_SCSR_LED_MODE_DEF 0x0000
+
+/* PHY link status register. IP1001 only. */
+#define IP1000PHY_LSR 0x11
+#define IP1000PHY_LSR_JABBER_DET 0x0200
+#define IP1000PHY_LSR_APS_SLEEP 0x0400
+#define IP1000PHY_LSR_MDIX 0x0800
+#define IP1000PHY_LSR_FULL_DUPLEX 0x1000
+#define IP1000PHY_LSR_SPEED_10 0x0000
+#define IP1000PHY_LSR_SPEED_100 0x2000
+#define IP1000PHY_LSR_SPEED_1000 0x4000
+#define IP1000PHY_LSR_SPEED_MASK 0x6000
+#define IP1000PHY_LSR_LINKUP 0x8000
+
+/* PHY specific control register 2. IP1001 only. */
+#define IP1000PHY_SCR
+#define IP1000PHY_SCR_SEW_RATE_MASK 0x0003
+#define IP1000PHY_SCR_SEW_RATE_DEF 0x0003
+#define IP1000PHY_SCR_AUTO_XOVER 0x0004
+#define IP1000PHY_SCR_SPEED_10_100_ENB 0x0040
+#define IP1000PHY_SCR_FIFO_LATENCY_2 0x0000
+#define IP1000PHY_SCR_FIFO_LATENCY_3 0x0080
+#define IP1000PHY_SCR_FIFO_LATENCY_4 0x0100
+#define IP1000PHY_SCR_FIFO_LATENCY_5 0x0180
+#define IP1000PHY_SCR_MDIX_ENB 0x0200
+#define IP1000PHY_SCR_RESERVED_DEF 0x0400
+#define IP1000PHY_SCR_APS_ON 0x0800
+
#endif /* _DEV_MII_IP1000PHYREG_H_ */
==== //depot/projects/smpng/sys/dev/mii/miidevs#28 (text+ko) ====
@@ -1,4 +1,4 @@
-$FreeBSD: src/sys/dev/mii/miidevs,v 1.51 2008/03/06 21:42:48 jhb Exp $
+$FreeBSD: src/sys/dev/mii/miidevs,v 1.52 2008/04/05 00:52:07 yongari Exp $
/*$NetBSD: miidevs,v 1.6 1999/05/14 11:37:30 drochner Exp $*/
/*-
@@ -159,6 +159,7 @@
/* IC Plus Corp. PHYs */
model ICPLUS IP101 0x0005 IC Plus 10/100 PHY
model ICPLUS IP1000A 0x0008 IC Plus 10/100/1000 media interface
+model ICPLUS IP1001 0x0019 IC Plus IP1001 10/100/1000 media interface
/* Intel PHYs */
model xxINTEL I82553AB 0x0000 i83553 10/100 media interface
==== //depot/projects/smpng/sys/i386/i386/intr_machdep.c#31 (text+ko) ====
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/i386/i386/intr_machdep.c,v 1.34 2008/03/17 22:42:00 jhb Exp $
+ * $FreeBSD: src/sys/i386/i386/intr_machdep.c,v 1.35 2008/04/05 19:58:29 jhb Exp $
*/
/*
@@ -76,9 +76,6 @@
static int intr_assign_cpu(void *arg, u_char cpu);
static void intr_disable_src(void *arg);
-#ifdef INTR_FILTER
-static void intr_event_stray(void *cookie);
-#endif
static void intr_init(void *__dummy);
static int intr_pic_registered(struct pic *pic);
static void intrcnt_setname(const char *name, int index);
@@ -229,12 +226,11 @@
isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
}
-#ifdef INTR_FILTER
void
intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
{
+ struct intr_event *ie;
struct thread *td;
- struct intr_event *ie;
int vector;
td = curthread;
@@ -258,64 +254,11 @@
if (vector == 0)
clkintr_pending = 1;
- if (intr_event_handle(ie, frame) != 0)
- intr_event_stray(isrc);
-}
-
-static void
-intr_event_stray(void *cookie)
-{
- struct intsrc *isrc;
-
- isrc = cookie;
/*
* For stray interrupts, mask and EOI the source, bump the
* stray count, and log the condition.
*/
- isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
- (*isrc->is_straycount)++;
- if (*isrc->is_straycount < MAX_STRAY_LOG)
- log(LOG_ERR, "stray irq%d\n", isrc->is_pic->pic_vector(isrc));
- else if (*isrc->is_straycount == MAX_STRAY_LOG)
- log(LOG_CRIT,
- "too many stray irq %d's: not logging anymore\n",
- isrc->is_pic->pic_vector(isrc));
-}
-#else
-void
-intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
-{
- struct thread *td;
- struct intr_event *ie;
- struct intr_handler *ih;
- int error, vector, thread, ret;
-
- td = curthread;
-
- /*
- * We count software interrupts when we process them. The
- * code here follows previous practice, but there's an
- * argument for counting hardware interrupts when they're
- * processed too.
- */
- (*isrc->is_count)++;
- PCPU_INC(cnt.v_intr);
-
- ie = isrc->is_event;
-
- /*
- * XXX: We assume that IRQ 0 is only used for the ISA timer
- * device (clk).
- */
- vector = isrc->is_pic->pic_vector(isrc);
- if (vector == 0)
- clkintr_pending = 1;
-
- /*
- * For stray interrupts, mask and EOI the source, bump the
- * stray count, and log the condition.
- */
- if (ie == NULL || TAILQ_EMPTY(&ie->ie_handlers)) {
+ if (intr_event_handle(ie, frame) != 0) {
isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
(*isrc->is_straycount)++;
if (*isrc->is_straycount < MAX_STRAY_LOG)
@@ -324,70 +267,8 @@
log(LOG_CRIT,
"too many stray irq %d's: not logging anymore\n",
vector);
- return;
- }
-
- /*
- * Execute fast interrupt handlers directly.
- * To support clock handlers, if a handler registers
- * with a NULL argument, then we pass it a pointer to
- * a trapframe as its argument.
- */
- td->td_intr_nesting_level++;
- ret = 0;
- thread = 0;
- critical_enter();
- TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
- if (ih->ih_filter == NULL) {
- thread = 1;
- continue;
- }
- CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__,
- ih->ih_filter, ih->ih_argument == NULL ? frame :
- ih->ih_argument, ih->ih_name);
- if (ih->ih_argument == NULL)
- ret = ih->ih_filter(frame);
- else
- ret = ih->ih_filter(ih->ih_argument);
- /*
- * Wrapper handler special handling:
- *
- * in some particular cases (like pccard and pccbb),
- * the _real_ device handler is wrapped in a couple of
- * functions - a filter wrapper and an ithread wrapper.
- * In this case (and just in this case), the filter wrapper
- * could ask the system to schedule the ithread and mask
- * the interrupt source if the wrapped handler is composed
- * of just an ithread handler.
- *
- * TODO: write a generic wrapper to avoid people rolling
- * their own
- */
- if (!thread) {
- if (ret == FILTER_SCHEDULE_THREAD)
- thread = 1;
- }
}
-
- /*
- * If there are any threaded handlers that need to run,
- * mask the source as well as sending it an EOI. Otherwise,
- * just send it an EOI but leave it unmasked.
- */
- if (thread)
- isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
- else
- isrc->is_pic->pic_eoi_source(isrc);
-
- /* Schedule the ithread if needed. */
- if (thread) {
- error = intr_event_schedule_thread(ie);
- KASSERT(error == 0, ("bad stray interrupt"));
- }
- critical_exit();
- td->td_intr_nesting_level--;
}
-#endif
void
intr_resume(void)
==== //depot/projects/smpng/sys/ia64/ia64/interrupt.c#41 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/ia64/ia64/interrupt.c,v 1.64 2008/03/17 22:42:01 jhb Exp $ */
+/* $FreeBSD: src/sys/ia64/ia64/interrupt.c,v 1.65 2008/04/05 19:58:29 jhb Exp $ */
/* $NetBSD: interrupt.c,v 1.23 1998/02/24 07:38:01 thorpej Exp $ */
/*-
@@ -385,10 +385,6 @@
{
struct ia64_intr *i;
struct intr_event *ie; /* our interrupt event */
-#ifndef INTR_FILTER
- struct intr_handler *ih;
- int error, thread, ret;
-#endif
/*
* Find the interrupt thread for this vector.
@@ -401,52 +397,14 @@
ie = i->event;
KASSERT(ie != NULL, ("%s: interrupt without event", __func__));
-#ifdef INTR_FILTER
if (intr_event_handle(ie, frame) != 0) {
+ /*
+ * XXX: The pre-INTR_FILTER code didn't mask stray
+ * interrupts.
+ */
ia64_intr_mask((void *)(uintptr_t)vector);
log(LOG_ERR, "stray irq%u\n", i->irq);
}
-#else
- /*
- * As an optimization, if an event has no handlers, don't
- * schedule it to run.
- */
- if (TAILQ_EMPTY(&ie->ie_handlers))
- return;
-
- /*
- * Execute all fast interrupt handlers directly without Giant. Note
- * that this means that any fast interrupt handler must be MP safe.
- */
- ret = 0;
- thread = 0;
- critical_enter();
- TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
- if (ih->ih_filter == NULL) {
- thread = 1;
- continue;
- }
- CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__,
- ih->ih_filter, ih->ih_argument, ih->ih_name);
- ret = ih->ih_filter(ih->ih_argument);
- /*
- * Wrapper handler special case: see
- * i386/intr_machdep.c::intr_execute_handlers()
- */
- if (!thread) {
- if (ret == FILTER_SCHEDULE_THREAD)
- thread = 1;
- }
- }
-
- if (thread) {
- ia64_intr_mask((void *)(uintptr_t)vector);
- error = intr_event_schedule_thread(ie);
- KASSERT(error == 0, ("%s: impossible stray", __func__));
- } else
- ia64_intr_eoi((void *)(uintptr_t)vector);
- critical_exit();
-#endif
}
#ifdef DDB
==== //depot/projects/smpng/sys/kern/kern_intr.c#93 (text+ko) ====
@@ -25,9 +25,10 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_intr.c,v 1.159 2008/04/04 01:03:23 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_intr.c,v 1.161 2008/04/05 20:13:15 jhb Exp $");
#include "opt_ddb.h"
+#include "opt_intr_filter.h"
#include <sys/param.h>
#include <sys/bus.h>
@@ -94,9 +95,14 @@
static void intr_event_update(struct intr_event *ie);
#ifdef INTR_FILTER
+static int intr_event_schedule_thread(struct intr_event *ie,
+ struct intr_thread *ithd);
+static int intr_filter_loop(struct intr_event *ie,
+ struct trapframe *frame, struct intr_thread **ithd);
static struct intr_thread *ithread_create(const char *name,
struct intr_handler *ih);
#else
+static int intr_event_schedule_thread(struct intr_event *ie);
static struct intr_thread *ithread_create(const char *name);
#endif
static void ithread_destroy(struct intr_thread *ithread);
@@ -239,8 +245,9 @@
int
intr_event_create(struct intr_event **event, void *source,int flags,
- void (*disable)(void *), void (*enable)(void *), void (*eoi)(void *),
- int (*assign_cpu)(void *, u_char), const char *fmt, ...)
+ void (*pre_ithread)(void *), void (*post_ithread)(void *),
+ void (*post_filter)(void *), int (*assign_cpu)(void *, u_char),
+ const char *fmt, ...)
{
struct intr_event *ie;
va_list ap;
@@ -250,9 +257,9 @@
return (EINVAL);
ie = malloc(sizeof(struct intr_event), M_ITHREAD, M_WAITOK | M_ZERO);
ie->ie_source = source;
- ie->ie_disable = disable;
- ie->ie_enable = enable;
- ie->ie_eoi = eoi;
+ ie->ie_pre_ithread = pre_ithread;
+ ie->ie_post_ithread = post_ithread;
+ ie->ie_post_filter = post_filter;
ie->ie_assign_cpu = assign_cpu;
ie->ie_flags = flags;
ie->ie_cpu = NOCPU;
@@ -675,7 +682,7 @@
return (0);
}
-int
+static int
intr_event_schedule_thread(struct intr_event *ie)
{
struct intr_entropy entropy;
@@ -832,7 +839,7 @@
return (0);
}
-int
+static int
intr_event_schedule_thread(struct intr_event *ie, struct intr_thread *it)
{
struct intr_entropy entropy;
@@ -1084,8 +1091,8 @@
* Now that all the handlers have had a chance to run, reenable
* the interrupt source.
*/
- if (ie->ie_enable != NULL)
- ie->ie_enable(ie->ie_source);
+ if (ie->ie_post_ithread != NULL)
+ ie->ie_post_ithread(ie->ie_source);
}
#ifndef INTR_FILTER
@@ -1172,6 +1179,90 @@
thread_unlock(td);
}
}
+
+/*
+ * Main interrupt handling body.
+ *
+ * Input:
+ * o ie: the event connected to this interrupt.
+ * o frame: some archs (i.e. i386) pass a frame to some.
+ * handlers as their main argument.
+ * Return value:
+ * o 0: everything ok.
+ * o EINVAL: stray interrupt.
+ */
+int
+intr_event_handle(struct intr_event *ie, struct trapframe *frame)
+{
+ struct intr_handler *ih;
+ struct thread *td;
+ int error, ret, thread;
+
+ td = curthread;
+
+ /* An interrupt with no event or handlers is a stray interrupt. */
+ if (ie == NULL || TAILQ_EMPTY(&ie->ie_handlers))
+ return (EINVAL);
+
+ /*
+ * Execute fast interrupt handlers directly.
+ * To support clock handlers, if a handler registers
+ * with a NULL argument, then we pass it a pointer to
+ * a trapframe as its argument.
+ */
+ td->td_intr_nesting_level++;
+ thread = 0;
+ ret = 0;
+ critical_enter();
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list