Date: Wed, 20 May 2009 21:34:01 +0000 (UTC) From: Kip Macy <kmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r192480 - in user/kmacy/ZFS_MFC: lib/libc/net lib/libpmc release/doc/en_US.ISO8859-1/errata share/man/man4 share/man/man9 sys sys/amd64/amd64 sys/arm/arm sys/contrib/pf sys/dev/age sys/... Message-ID: <200905202134.n4KLY1on044536@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kmacy Date: Wed May 20 21:34:01 2009 New Revision: 192480 URL: http://svn.freebsd.org/changeset/base/192480 Log: MF_RELENG_7 192158:192478 bring up to date before merging back Modified: user/kmacy/ZFS_MFC/lib/libc/net/sourcefilter.c user/kmacy/ZFS_MFC/lib/libpmc/ (props changed) user/kmacy/ZFS_MFC/lib/libpmc/pmc.h user/kmacy/ZFS_MFC/lib/libpmc/pmclog.h user/kmacy/ZFS_MFC/release/doc/en_US.ISO8859-1/errata/article.sgml user/kmacy/ZFS_MFC/share/man/man4/ (props changed) user/kmacy/ZFS_MFC/share/man/man4/hifn.4 user/kmacy/ZFS_MFC/share/man/man4/igb.4 (props changed) user/kmacy/ZFS_MFC/share/man/man4/ubsec.4 user/kmacy/ZFS_MFC/share/man/man9/ (props changed) user/kmacy/ZFS_MFC/share/man/man9/sbuf.9 user/kmacy/ZFS_MFC/sys/ (props changed) user/kmacy/ZFS_MFC/sys/amd64/amd64/intr_machdep.c user/kmacy/ZFS_MFC/sys/arm/arm/intr.c user/kmacy/ZFS_MFC/sys/contrib/pf/ (props changed) user/kmacy/ZFS_MFC/sys/dev/age/if_age.c user/kmacy/ZFS_MFC/sys/dev/age/if_agereg.h user/kmacy/ZFS_MFC/sys/dev/ale/if_ale.c user/kmacy/ZFS_MFC/sys/dev/ata/ata-chipset.c user/kmacy/ZFS_MFC/sys/dev/ata/ata-pci.h user/kmacy/ZFS_MFC/sys/dev/ath/ath_hal/ (props changed) user/kmacy/ZFS_MFC/sys/dev/bce/if_bce.c user/kmacy/ZFS_MFC/sys/dev/bce/if_bcereg.h user/kmacy/ZFS_MFC/sys/dev/bge/if_bge.c user/kmacy/ZFS_MFC/sys/dev/ciss/ciss.c user/kmacy/ZFS_MFC/sys/dev/cxgb/ (props changed) user/kmacy/ZFS_MFC/sys/dev/pci/pcireg.h user/kmacy/ZFS_MFC/sys/dev/sk/if_sk.c user/kmacy/ZFS_MFC/sys/dev/uart/uart_dev_ns8250.c user/kmacy/ZFS_MFC/sys/fs/devfs/devfs_vnops.c user/kmacy/ZFS_MFC/sys/i386/i386/intr_machdep.c user/kmacy/ZFS_MFC/sys/ia64/ia64/interrupt.c user/kmacy/ZFS_MFC/sys/kern/kern_cpuset.c user/kmacy/ZFS_MFC/sys/kern/kern_intr.c user/kmacy/ZFS_MFC/sys/kern/kern_malloc.c user/kmacy/ZFS_MFC/sys/kern/kern_osd.c user/kmacy/ZFS_MFC/sys/net/if_vlan.c user/kmacy/ZFS_MFC/sys/netgraph/netflow/ng_netflow.c user/kmacy/ZFS_MFC/sys/netinet/ip_fw2.c user/kmacy/ZFS_MFC/sys/powerpc/powerpc/intr_machdep.c user/kmacy/ZFS_MFC/sys/sparc64/sparc64/intr_machdep.c user/kmacy/ZFS_MFC/sys/sun4v/sun4v/intr_machdep.c user/kmacy/ZFS_MFC/sys/sys/_null.h user/kmacy/ZFS_MFC/sys/sys/cpuset.h user/kmacy/ZFS_MFC/sys/sys/interrupt.h user/kmacy/ZFS_MFC/sys/sys/namei.h user/kmacy/ZFS_MFC/sys/ufs/ufs/ufs_extern.h user/kmacy/ZFS_MFC/sys/ufs/ufs/ufs_lookup.c user/kmacy/ZFS_MFC/sys/ufs/ufs/ufs_vnops.c user/kmacy/ZFS_MFC/usr.bin/cpuset/ (props changed) user/kmacy/ZFS_MFC/usr.bin/cpuset/cpuset.1 user/kmacy/ZFS_MFC/usr.bin/cpuset/cpuset.c user/kmacy/ZFS_MFC/usr.sbin/pciconf/ (props changed) user/kmacy/ZFS_MFC/usr.sbin/pciconf/cap.c Modified: user/kmacy/ZFS_MFC/lib/libc/net/sourcefilter.c ============================================================================== --- user/kmacy/ZFS_MFC/lib/libc/net/sourcefilter.c Wed May 20 21:31:47 2009 (r192479) +++ user/kmacy/ZFS_MFC/lib/libc/net/sourcefilter.c Wed May 20 21:34:01 2009 (r192480) @@ -1,6 +1,6 @@ /*- - * Copyright (c) 2007 Bruce M. Simpson. - * All rights reserved + * Copyright (c) 2007-2009 Bruce Simpson. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,21 +10,18 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of Bruce M. Simpson nor the names of other - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY BRUCE M. SIMPSON AND AFFILIATES - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BRUCE M. SIMPSON OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include <sys/cdefs.h> @@ -340,7 +337,7 @@ getsourcefilter(int s, uint32_t interfac { struct __msfilterreq msfr; sockunion_t *psu; - int err, level, optlen, optname; + int err, level, nsrcs, optlen, optname; if (interface == 0 || group == NULL || numsrc == NULL || fmode == NULL) { @@ -348,6 +345,7 @@ getsourcefilter(int s, uint32_t interfac return (-1); } + nsrcs = *numsrc; *numsrc = 0; *fmode = 0; @@ -385,7 +383,7 @@ getsourcefilter(int s, uint32_t interfac memset(&msfr, 0, optlen); msfr.msfr_ifindex = interface; msfr.msfr_fmode = 0; - msfr.msfr_nsrcs = *numsrc; + msfr.msfr_nsrcs = nsrcs; memcpy(&msfr.msfr_group, &psu->ss, psu->ss.ss_len); /* Modified: user/kmacy/ZFS_MFC/lib/libpmc/pmc.h ============================================================================== --- user/kmacy/ZFS_MFC/lib/libpmc/pmc.h Wed May 20 21:31:47 2009 (r192479) +++ user/kmacy/ZFS_MFC/lib/libpmc/pmc.h Wed May 20 21:34:01 2009 (r192480) @@ -29,6 +29,7 @@ #ifndef _PMC_H_ #define _PMC_H_ +#include <sys/cdefs.h> #include <sys/pmc.h> /* @@ -68,6 +69,7 @@ struct pmc_pmcinfo { * Prototypes */ +__BEGIN_DECLS int pmc_allocate(const char *_ctrspec, enum pmc_mode _mode, uint32_t _flags, int _cpu, pmc_id_t *_pmcid); int pmc_attach(pmc_id_t _pmcid, pid_t _pid); @@ -105,5 +107,6 @@ const char *pmc_name_of_state(enum pmc_s int pmc_event_names_of_class(enum pmc_class _cl, const char ***_eventnames, int *_nevents); +__END_DECLS #endif Modified: user/kmacy/ZFS_MFC/lib/libpmc/pmclog.h ============================================================================== --- user/kmacy/ZFS_MFC/lib/libpmc/pmclog.h Wed May 20 21:31:47 2009 (r192479) +++ user/kmacy/ZFS_MFC/lib/libpmc/pmclog.h Wed May 20 21:34:01 2009 (r192480) @@ -29,6 +29,7 @@ #ifndef _PMCLOG_H_ #define _PMCLOG_H_ +#include <sys/cdefs.h> #include <sys/pmclog.h> enum pmclog_state { @@ -145,10 +146,12 @@ struct pmclog_ev { #define PMCLOG_FD_NONE (-1) +__BEGIN_DECLS void *pmclog_open(int _fd); int pmclog_feed(void *_cookie, char *_data, int _len); int pmclog_read(void *_cookie, struct pmclog_ev *_ev); void pmclog_close(void *_cookie); +__END_DECLS #endif Modified: user/kmacy/ZFS_MFC/release/doc/en_US.ISO8859-1/errata/article.sgml ============================================================================== --- user/kmacy/ZFS_MFC/release/doc/en_US.ISO8859-1/errata/article.sgml Wed May 20 21:31:47 2009 (r192479) +++ user/kmacy/ZFS_MFC/release/doc/en_US.ISO8859-1/errata/article.sgml Wed May 20 21:34:01 2009 (r192480) @@ -183,6 +183,15 @@ Errata Notice to fix this problem is planned after the release.</para> + <para>[20090507] A bug was found in the &man.fxp.4; driver. This + would cause poor TCP performance when TSO is enabled, and the + receiver has a smaller MSS than the interface MTU setting. To + workaround this issue, one can disable TSO by using + &man.ifconfig.8; <option>-tso</option> parameter (per interface + basis) or setting <varname>net.inet.tcp.tso</varname> to + <literal>0</literal> (globally on the system). An Errata Notice + to fix this problem is planned after the release.</para> + <sect1 id="late-news"> <title>Late-Breaking News and Corrections</title> @@ -190,5 +199,10 @@ &man.malloc.3; implementation and threading library has been committed to the <literal>RELENG_7</literal> branch for public testing.</para> + + <para>[20090507] A patch to solve the bug in the &man.fxp.4; + driver that caused poor TCP performance has been committed to + the <literal>RELENG_7</literal> branch for public + testing.</para> </sect1> </article> Modified: user/kmacy/ZFS_MFC/share/man/man4/hifn.4 ============================================================================== --- user/kmacy/ZFS_MFC/share/man/man4/hifn.4 Wed May 20 21:31:47 2009 (r192479) +++ user/kmacy/ZFS_MFC/share/man/man4/hifn.4 Wed May 20 21:34:01 2009 (r192480) @@ -11,8 +11,6 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED Modified: user/kmacy/ZFS_MFC/share/man/man4/ubsec.4 ============================================================================== --- user/kmacy/ZFS_MFC/share/man/man4/ubsec.4 Wed May 20 21:31:47 2009 (r192479) +++ user/kmacy/ZFS_MFC/share/man/man4/ubsec.4 Wed May 20 21:34:01 2009 (r192480) @@ -1,4 +1,4 @@ -.\" $OpenBSD: ubsec.4,v 1.18 2002/09/26 07:55:41 miod Exp $ +.\" $OpenBSD: ubsec.4,v 1.25 2003/08/12 19:42:46 jason Exp $ .\" .\" Copyright (c) 2000 Jason L. Wright (jason@thought.net) .\" All rights reserved. @@ -11,11 +11,6 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by Jason L. Wright -.\" 4. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -31,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 1, 2006 +.Dd May 16, 2009 .Dt UBSEC 4 .Os .Sh NAME @@ -84,7 +79,7 @@ driver supports cards containing any of .It Bluesteel 5501 The original chipset, no longer made. This extremely rare unit -was not very fast, lacked a RNG, and had a number of other bugs. +was not very fast, lacked an RNG, and had a number of other bugs. .It Bluesteel 5601 A faster and fixed version of the original, with a random number unit and large number engine added. @@ -98,6 +93,7 @@ Faster version of Bluesteel 5601. 64 bit version of the chip, and significantly more advanced. .It Broadcom BCM5821 Faster version of the BCM5820. +This is the chip found on the Sun Crypto Accelerator 1000. .It Broadcom BCM5822 Faster version of the BCM5820. .It Broadcom BCM5823 Modified: user/kmacy/ZFS_MFC/share/man/man9/sbuf.9 ============================================================================== --- user/kmacy/ZFS_MFC/share/man/man9/sbuf.9 Wed May 20 21:31:47 2009 (r192479) +++ user/kmacy/ZFS_MFC/share/man/man9/sbuf.9 Wed May 20 21:34:01 2009 (r192480) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2000 Poul Henning Kamp and Dag-Erling Coïdan Smørgrav +.\" Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Coïdan Smørgrav .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,12 +25,13 @@ .\" .\" $FreeBSD$ .\" -.Dd July 9, 2004 +.Dd May 17, 2009 .Dt SBUF 9 .Os .Sh NAME .Nm sbuf , .Nm sbuf_new , +.Nm sbuf_new_auto , .Nm sbuf_clear , .Nm sbuf_setpos , .Nm sbuf_bcat , @@ -55,6 +56,8 @@ .In sys/sbuf.h .Ft struct sbuf * .Fn sbuf_new "struct sbuf *s" "char *buf" "int length" "int flags" +.Ft struct sbuf * +.Fn sbuf_new_auto .Ft void .Fn sbuf_clear "struct sbuf *s" .Ft int @@ -148,6 +151,19 @@ The result of accessing that array direc sbuf is undefined. .Pp The +.Fn sbuf_new_auto +function is a shortcut for creating a completely dynamic +.Nm . +It is the equivalent of calling +.Fn sbuf_new +with values +.Dv NULL , +.Dv NULL , +.Dv 0 , +and +.Dv SBUF_AUTOEXTEND . +.Pp +The .Fn sbuf_delete function clears the .Fa sbuf Modified: user/kmacy/ZFS_MFC/sys/amd64/amd64/intr_machdep.c ============================================================================== --- user/kmacy/ZFS_MFC/sys/amd64/amd64/intr_machdep.c Wed May 20 21:31:47 2009 (r192479) +++ user/kmacy/ZFS_MFC/sys/amd64/amd64/intr_machdep.c Wed May 20 21:34:01 2009 (r192480) @@ -77,12 +77,6 @@ static struct sx intr_table_lock; static struct mtx intrcnt_lock; static STAILQ_HEAD(, pic) pics; -#ifdef INTR_FILTER -static void intr_eoi_src(void *arg); -static void intr_disab_eoi_src(void *arg); -static void intr_event_stray(void *cookie); -#endif - #ifdef SMP static int assign_cpu; @@ -90,6 +84,7 @@ static void intr_assign_next_cpu(struct #endif static int intr_assign_cpu(void *arg, u_char cpu); +static void intr_disable_src(void *arg); static void intr_init(void *__dummy); static int intr_pic_registered(struct pic *pic); static void intrcnt_setname(const char *name, int index); @@ -144,16 +139,10 @@ intr_register_source(struct intsrc *isrc vector = isrc->is_pic->pic_vector(isrc); if (interrupt_sources[vector] != NULL) return (EEXIST); -#ifdef INTR_FILTER - error = intr_event_create(&isrc->is_event, isrc, 0, - (mask_fn)isrc->is_pic->pic_enable_source, - intr_eoi_src, intr_disab_eoi_src, intr_assign_cpu, "irq%d:", + error = intr_event_create(&isrc->is_event, isrc, 0, vector, + intr_disable_src, (mask_fn)isrc->is_pic->pic_enable_source, + (mask_fn)isrc->is_pic->pic_eoi_source, intr_assign_cpu, "irq%d:", vector); -#else - error = intr_event_create(&isrc->is_event, isrc, 0, - (mask_fn)isrc->is_pic->pic_enable_source, intr_assign_cpu, "irq%d:", - vector); -#endif if (error) return (error); sx_xlock(&intr_table_lock); @@ -237,84 +226,21 @@ intr_config_intr(int vector, enum intr_t return (isrc->is_pic->pic_config_intr(isrc, trig, pol)); } -#ifdef INTR_FILTER -void -intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame) -{ - struct thread *td; - struct intr_event *ie; - int vector; - - 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; - - 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)); -} - -static void -intr_eoi_src(void *arg) -{ - struct intsrc *isrc; - - isrc = arg; - isrc->is_pic->pic_eoi_source(isrc); -} - -static void -intr_disab_eoi_src(void *arg) +intr_disable_src(void *arg) { struct intsrc *isrc; isrc = arg; isrc->is_pic->pic_disable_source(isrc, PIC_EOI); } -#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; + struct thread *td; + int vector; td = curthread; @@ -341,7 +267,7 @@ intr_execute_handlers(struct intsrc *isr * 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) @@ -350,60 +276,8 @@ intr_execute_handlers(struct intsrc *isr 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) Modified: user/kmacy/ZFS_MFC/sys/arm/arm/intr.c ============================================================================== --- user/kmacy/ZFS_MFC/sys/arm/arm/intr.c Wed May 20 21:31:47 2009 (r192479) +++ user/kmacy/ZFS_MFC/sys/arm/arm/intr.c Wed May 20 21:34:01 2009 (r192480) @@ -50,6 +50,8 @@ __FBSDID("$FreeBSD$"); #include <machine/intr.h> #include <machine/cpu.h> +typedef void (*mask_fn)(void *); + static struct intr_event *intr_events[NIRQ]; static int intrcnt_tab[NIRQ]; static int intrcnt_index = 0; @@ -57,27 +59,6 @@ static int last_printed = 0; void arm_handler_execute(struct trapframe *, int); -#ifdef INTR_FILTER -static void -intr_disab_eoi_src(void *arg) -{ - uintptr_t nb; - - nb = (uintptr_t)arg; - arm_mask_irq(nb); -} - -static void -intr_eoi_src(void *arg) -{ - uintptr_t nb; - - nb = (uintptr_t)arg; - arm_unmask_irq(nb); -} - -#endif - void arm_setup_irqhandler(const char *name, driver_filter_t *filt, void (*hand)(void*), void *arg, int irq, int flags, void **cookiep) @@ -89,14 +70,9 @@ arm_setup_irqhandler(const char *name, d return; event = intr_events[irq]; if (event == NULL) { -#ifdef INTR_FILTER - error = intr_event_create(&event, (void *)irq, 0, - (void (*)(void *))arm_unmask_irq, intr_eoi_src, - intr_disab_eoi_src, NULL, "intr%d:", irq); -#else - error = intr_event_create(&event, (void *)irq, 0, - (void (*)(void *))arm_unmask_irq, NULL, "intr%d:", irq); -#endif + error = intr_event_create(&event, (void *)irq, 0, irq, + (mask_fn)arm_mask_irq, (mask_fn)arm_unmask_irq, + NULL, NULL, "intr%d:", irq); if (error) return; intr_events[irq] = event; @@ -130,57 +106,17 @@ arm_handler_execute(struct trapframe *fr { 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--; } Modified: user/kmacy/ZFS_MFC/sys/dev/age/if_age.c ============================================================================== --- user/kmacy/ZFS_MFC/sys/dev/age/if_age.c Wed May 20 21:31:47 2009 (r192479) +++ user/kmacy/ZFS_MFC/sys/dev/age/if_age.c Wed May 20 21:34:01 2009 (r192480) @@ -106,8 +106,6 @@ static int age_miibus_writereg(device_t, static void age_miibus_statchg(device_t); static void age_mediastatus(struct ifnet *, struct ifmediareq *); static int age_mediachange(struct ifnet *); -static int age_read_vpd_word(struct age_softc *, uint32_t, uint32_t, - uint32_t *); static int age_probe(device_t); static void age_get_macaddr(struct age_softc *); static void age_phy_reset(struct age_softc *); @@ -321,29 +319,6 @@ age_mediachange(struct ifnet *ifp) } static int -age_read_vpd_word(struct age_softc *sc, uint32_t vpdc, uint32_t offset, - uint32_t *word) -{ - int i; - - pci_write_config(sc->age_dev, vpdc + PCIR_VPD_ADDR, offset, 2); - for (i = AGE_TIMEOUT; i > 0; i--) { - DELAY(10); - if ((pci_read_config(sc->age_dev, vpdc + PCIR_VPD_ADDR, 2) & - 0x8000) == 0x8000) - break; - } - if (i == 0) { - device_printf(sc->age_dev, "VPD read timeout!\n"); - *word = 0; - return (ETIMEDOUT); - } - - *word = pci_read_config(sc->age_dev, vpdc + PCIR_VPD_DATA, 4); - return (0); -} - -static int age_probe(device_t dev) { struct age_dev *sp; @@ -368,8 +343,8 @@ age_probe(device_t dev) static void age_get_macaddr(struct age_softc *sc) { - uint32_t ea[2], off, reg, word; - int vpd_error, match, vpdc; + uint32_t ea[2], reg; + int i, vpdc; reg = CSR_READ_4(sc, AGE_SPI_CTRL); if ((reg & SPI_VPD_ENB) != 0) { @@ -378,123 +353,114 @@ age_get_macaddr(struct age_softc *sc) CSR_WRITE_4(sc, AGE_SPI_CTRL, reg); } - vpd_error = 0; - ea[0] = ea[1] = 0; - if ((vpd_error = pci_find_extcap(sc->age_dev, PCIY_VPD, &vpdc)) == 0) { + if (pci_find_extcap(sc->age_dev, PCIY_VPD, &vpdc) == 0) { /* - * PCI VPD capability exists, but it seems that it's - * not in the standard form as stated in PCI VPD - * specification such that driver could not use - * pci_get_vpd_readonly(9) with keyword 'NA'. - * Search VPD data starting at address 0x0100. The data - * should be used as initializers to set AGE_PAR0, - * AGE_PAR1 register including other PCI configuration - * registers. + * PCI VPD capability found, let TWSI reload EEPROM. + * This will set ethernet address of controller. */ - word = 0; - match = 0; - reg = 0; - for (off = AGE_VPD_REG_CONF_START; off < AGE_VPD_REG_CONF_END; - off += sizeof(uint32_t)) { - vpd_error = age_read_vpd_word(sc, vpdc, off, &word); - if (vpd_error != 0) - break; - if (match != 0) { - switch (reg) { - case AGE_PAR0: - ea[0] = word; - break; - case AGE_PAR1: - ea[1] = word; - break; - default: - break; - } - match = 0; - } else if ((word & 0xFF) == AGE_VPD_REG_CONF_SIG) { - match = 1; - reg = word >> 16; - } else + CSR_WRITE_4(sc, AGE_TWSI_CTRL, CSR_READ_4(sc, AGE_TWSI_CTRL) | + TWSI_CTRL_SW_LD_START); + for (i = 100; i > 0; i--) { + DELAY(1000); + reg = CSR_READ_4(sc, AGE_TWSI_CTRL); + if ((reg & TWSI_CTRL_SW_LD_START) == 0) break; } - if (off >= AGE_VPD_REG_CONF_END) - vpd_error = ENOENT; - if (vpd_error == 0) { - /* - * Don't blindly trust ethernet address obtained - * from VPD. Check whether ethernet address is - * valid one. Otherwise fall-back to reading - * PAR register. - */ - ea[1] &= 0xFFFF; - if ((ea[0] == 0 && ea[1] == 0) || - (ea[0] == 0xFFFFFFFF && ea[1] == 0xFFFF)) { - if (bootverbose) - device_printf(sc->age_dev, - "invalid ethernet address " - "returned from VPD.\n"); - vpd_error = EINVAL; - } - } - if (vpd_error != 0 && (bootverbose)) - device_printf(sc->age_dev, "VPD access failure!\n"); + if (i == 0) + device_printf(sc->age_dev, + "reloading EEPROM timeout!\n"); } else { if (bootverbose) device_printf(sc->age_dev, "PCI VPD capability not found!\n"); } - /* - * It seems that L1 also provides a way to extract ethernet - * address via SPI flash interface. Because SPI flash memory - * device of different vendors vary in their instruction - * codes for read ID instruction, it's very hard to get - * instructions codes without detailed information for the - * flash memory device used on ethernet controller. To simplify - * code, just read AGE_PAR0/AGE_PAR1 register to get ethernet - * address which is supposed to be set by hardware during - * power on reset. - */ - if (vpd_error != 0) { - /* - * VPD is mapped to SPI flash memory or BIOS set it. - */ - ea[0] = CSR_READ_4(sc, AGE_PAR0); - ea[1] = CSR_READ_4(sc, AGE_PAR1); - } - - ea[1] &= 0xFFFF; - if ((ea[0] == 0 && ea[1] == 0) || - (ea[0] == 0xFFFFFFFF && ea[1] == 0xFFFF)) { - device_printf(sc->age_dev, - "generating fake ethernet address.\n"); - ea[0] = arc4random(); - /* Set OUI to ASUSTek COMPUTER INC. */ - sc->age_eaddr[0] = 0x00; - sc->age_eaddr[1] = 0x1B; - sc->age_eaddr[2] = 0xFC; - sc->age_eaddr[3] = (ea[0] >> 16) & 0xFF; - sc->age_eaddr[4] = (ea[0] >> 8) & 0xFF; - sc->age_eaddr[5] = (ea[0] >> 0) & 0xFF; - } else { - sc->age_eaddr[0] = (ea[1] >> 8) & 0xFF; - sc->age_eaddr[1] = (ea[1] >> 0) & 0xFF; - sc->age_eaddr[2] = (ea[0] >> 24) & 0xFF; - sc->age_eaddr[3] = (ea[0] >> 16) & 0xFF; - sc->age_eaddr[4] = (ea[0] >> 8) & 0xFF; - sc->age_eaddr[5] = (ea[0] >> 0) & 0xFF; - } + ea[0] = CSR_READ_4(sc, AGE_PAR0); + ea[1] = CSR_READ_4(sc, AGE_PAR1); + sc->age_eaddr[0] = (ea[1] >> 8) & 0xFF; + sc->age_eaddr[1] = (ea[1] >> 0) & 0xFF; + sc->age_eaddr[2] = (ea[0] >> 24) & 0xFF; + sc->age_eaddr[3] = (ea[0] >> 16) & 0xFF; + sc->age_eaddr[4] = (ea[0] >> 8) & 0xFF; + sc->age_eaddr[5] = (ea[0] >> 0) & 0xFF; } static void age_phy_reset(struct age_softc *sc) { + uint16_t reg, pn; + int i, linkup; /* Reset PHY. */ CSR_WRITE_4(sc, AGE_GPHY_CTRL, GPHY_CTRL_RST); - DELAY(1000); + DELAY(2000); CSR_WRITE_4(sc, AGE_GPHY_CTRL, GPHY_CTRL_CLR); - DELAY(1000); + DELAY(2000); + +#define ATPHY_DBG_ADDR 0x1D +#define ATPHY_DBG_DATA 0x1E +#define ATPHY_CDTC 0x16 +#define PHY_CDTC_ENB 0x0001 +#define PHY_CDTC_POFF 8 +#define ATPHY_CDTS 0x1C +#define PHY_CDTS_STAT_OK 0x0000 +#define PHY_CDTS_STAT_SHORT 0x0100 +#define PHY_CDTS_STAT_OPEN 0x0200 +#define PHY_CDTS_STAT_INVAL 0x0300 +#define PHY_CDTS_STAT_MASK 0x0300 + + /* Check power saving mode. Magic from Linux. */ + age_miibus_writereg(sc->age_dev, sc->age_phyaddr, MII_BMCR, BMCR_RESET); + for (linkup = 0, pn = 0; pn < 4; pn++) { + age_miibus_writereg(sc->age_dev, sc->age_phyaddr, ATPHY_CDTC, + (pn << PHY_CDTC_POFF) | PHY_CDTC_ENB); + for (i = 200; i > 0; i--) { + DELAY(1000); + reg = age_miibus_readreg(sc->age_dev, sc->age_phyaddr, + ATPHY_CDTC); + if ((reg & PHY_CDTC_ENB) == 0) + break; + } + DELAY(1000); + reg = age_miibus_readreg(sc->age_dev, sc->age_phyaddr, + ATPHY_CDTS); + if ((reg & PHY_CDTS_STAT_MASK) != PHY_CDTS_STAT_OPEN) { + linkup++; + break; + } + } + age_miibus_writereg(sc->age_dev, sc->age_phyaddr, MII_BMCR, + BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG); + if (linkup == 0) { + age_miibus_writereg(sc->age_dev, sc->age_phyaddr, + ATPHY_DBG_ADDR, 0); + age_miibus_writereg(sc->age_dev, sc->age_phyaddr, + ATPHY_DBG_DATA, 0x124E); + age_miibus_writereg(sc->age_dev, sc->age_phyaddr, + ATPHY_DBG_ADDR, 1); + reg = age_miibus_readreg(sc->age_dev, sc->age_phyaddr, + ATPHY_DBG_DATA); + age_miibus_writereg(sc->age_dev, sc->age_phyaddr, + ATPHY_DBG_DATA, reg | 0x03); + /* XXX */ + DELAY(1500 * 1000); + age_miibus_writereg(sc->age_dev, sc->age_phyaddr, + ATPHY_DBG_ADDR, 0); + age_miibus_writereg(sc->age_dev, sc->age_phyaddr, + ATPHY_DBG_DATA, 0x024E); + } + +#undef ATPHY_DBG_ADDR +#undef ATPHY_DBG_DATA +#undef ATPHY_CDTC +#undef PHY_CDTC_ENB +#undef PHY_CDTC_POFF +#undef ATPHY_CDTS +#undef PHY_CDTS_STAT_OK +#undef PHY_CDTS_STAT_SHORT +#undef PHY_CDTS_STAT_OPEN +#undef PHY_CDTS_STAT_INVAL +#undef PHY_CDTS_STAT_MASK } static int @@ -539,7 +505,8 @@ age_attach(device_t dev) sc->age_chip_rev = CSR_READ_4(sc, AGE_MASTER_CFG) >> MASTER_CHIP_REV_SHIFT; if (bootverbose) { - device_printf(dev, "PCI device revision : 0x%04x\n", sc->age_rev); + device_printf(dev, "PCI device revision : 0x%04x\n", + sc->age_rev); device_printf(dev, "Chip id/revision : 0x%04x\n", sc->age_chip_rev); } @@ -1369,7 +1336,7 @@ age_setwol(struct age_softc *sc) AGE_LOCK_ASSERT(sc); - if (pci_find_extcap(sc->age_dev, PCIY_PMG, &pmc) == 0) { + if (pci_find_extcap(sc->age_dev, PCIY_PMG, &pmc) != 0) { CSR_WRITE_4(sc, AGE_WOL_CFG, 0); /* * No PME capability, PHY power down. @@ -1524,6 +1491,9 @@ age_resume(device_t dev) cmd &= ~0x0400; pci_write_config(sc->age_dev, PCIR_COMMAND, cmd, 2); } + AGE_UNLOCK(sc); + age_phy_reset(sc); + AGE_LOCK(sc); ifp = sc->age_ifp; if ((ifp->if_flags & IFF_UP) != 0) age_init_locked(sc); @@ -2544,14 +2514,8 @@ age_reset(struct age_softc *sc) int i; CSR_WRITE_4(sc, AGE_MASTER_CFG, MASTER_RESET); - for (i = AGE_RESET_TIMEOUT; i > 0; i--) { - DELAY(1); - if ((CSR_READ_4(sc, AGE_MASTER_CFG) & MASTER_RESET) == 0) - break; - } - if (i == 0) - device_printf(sc->age_dev, "master reset timeout!\n"); - + CSR_READ_4(sc, AGE_MASTER_CFG); + DELAY(1000); for (i = AGE_RESET_TIMEOUT; i > 0; i--) { if ((reg = CSR_READ_4(sc, AGE_IDLE_STATUS)) == 0) break; Modified: user/kmacy/ZFS_MFC/sys/dev/age/if_agereg.h ============================================================================== --- user/kmacy/ZFS_MFC/sys/dev/age/if_agereg.h Wed May 20 21:31:47 2009 (r192479) +++ user/kmacy/ZFS_MFC/sys/dev/age/if_agereg.h Wed May 20 21:34:01 2009 (r192480) @@ -91,6 +91,9 @@ #define AGE_SPI_OP_READ 0x217 /* 8bits */ #define AGE_TWSI_CTRL 0x218 +#define TWSI_CTRL_SW_LD_START 0x00000800 +#define TWSI_CTRL_HW_LD_START 0x00001000 +#define TWSI_CTRL_LD_EXIST 0x00400000 #define AGE_DEV_MISC_CTRL 0x21C Modified: user/kmacy/ZFS_MFC/sys/dev/ale/if_ale.c ============================================================================== --- user/kmacy/ZFS_MFC/sys/dev/ale/if_ale.c Wed May 20 21:31:47 2009 (r192479) +++ user/kmacy/ZFS_MFC/sys/dev/ale/if_ale.c Wed May 20 21:34:01 2009 (r192480) @@ -1543,20 +1543,11 @@ ale_resume(device_t dev) struct ale_softc *sc; struct ifnet *ifp; int pmc; - uint16_t cmd, pmstat; + uint16_t pmstat; sc = device_get_softc(dev); ALE_LOCK(sc); - /* - * Clear INTx emulation disable for hardwares that - * is set in resume event. From Linux. - */ - cmd = pci_read_config(sc->ale_dev, PCIR_COMMAND, 2); - if ((cmd & 0x0400) != 0) { - cmd &= ~0x0400; - pci_write_config(sc->ale_dev, PCIR_COMMAND, cmd, 2); - } if (pci_find_extcap(sc->ale_dev, PCIY_PMG, &pmc) == 0) { /* Disable PME and clear PME status. */ pmstat = pci_read_config(sc->ale_dev, Modified: user/kmacy/ZFS_MFC/sys/dev/ata/ata-chipset.c ============================================================================== --- user/kmacy/ZFS_MFC/sys/dev/ata/ata-chipset.c Wed May 20 21:31:47 2009 (r192479) +++ user/kmacy/ZFS_MFC/sys/dev/ata/ata-chipset.c Wed May 20 21:34:01 2009 (r192480) @@ -50,6 +50,12 @@ __FBSDID("$FreeBSD$"); #include <dev/ata/ata-pci.h> #include <ata_if.h> +struct ata_serialize { + struct mtx locked_mtx; + int locked_ch; + int restart_ch; +}; + /* local prototypes */ /* ata-chipset.c */ static int ata_generic_chipinit(device_t dev); @@ -186,6 +192,7 @@ static struct ata_chip_id *ata_match_chi static struct ata_chip_id *ata_find_chip(device_t dev, struct ata_chip_id *index, int slot); static int ata_setup_interrupt(device_t dev); static int ata_serialize(device_t dev, int flags); +static void ata_serialize_init(struct ata_serialize *serial); static void ata_print_cable(device_t dev, u_int8_t *who); static int ata_atapi(device_t dev); static int ata_check_80pin(device_t dev, int mode); @@ -919,6 +926,7 @@ static int ata_acard_chipinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); + struct ata_serialize *serial; if (ata_setup_interrupt(dev)) return ENXIO; @@ -927,6 +935,10 @@ ata_acard_chipinit(device_t dev) if (ctlr->chip->cfg1 == ATPOLD) { ctlr->setmode = ata_acard_850_setmode; ctlr->locking = ata_serialize; + serial = malloc(sizeof(struct ata_serialize), + M_TEMP, M_WAITOK | M_ZERO); + ata_serialize_init(serial); + ctlr->chipset_data = serial; } else ctlr->setmode = ata_acard_86X_setmode; @@ -3461,7 +3473,7 @@ ata_promise_chipinit(device_t dev) mtx_init(&hpkt->mtx, "ATA promise HPKT lock", NULL, MTX_DEF); TAILQ_INIT(&hpkt->queue); hpkt->busy = 0; - device_set_ivars(dev, hpkt); + ctlr->chipset_data = hpkt; ctlr->allocate = ata_promise_mio_allocate; ctlr->reset = ata_promise_mio_reset; ctlr->dmainit = ata_promise_mio_dmainit; @@ -3908,7 +3920,7 @@ ata_promise_mio_reset(device_t dev) case PRSX4X: /* softreset channel ATA module */ - hpktp = device_get_ivars(ctlr->dev); + hpktp = ctlr->chipset_data; ATA_OUTL(ctlr->r_res2, 0xc0260 + (ch->unit << 7), ch->unit + 1); ata_udelay(1000); ATA_OUTL(ctlr->r_res2, 0xc0260 + (ch->unit << 7), @@ -4247,7 +4259,7 @@ ata_promise_apkt(u_int8_t *bytep, struct static void ata_promise_queue_hpkt(struct ata_pci_controller *ctlr, u_int32_t hpkt) { - struct ata_promise_sx4 *hpktp = device_get_ivars(ctlr->dev); + struct ata_promise_sx4 *hpktp = ctlr->chipset_data; mtx_lock(&hpktp->mtx); if (hpktp->busy) { @@ -4266,7 +4278,7 @@ ata_promise_queue_hpkt(struct ata_pci_co static void ata_promise_next_hpkt(struct ata_pci_controller *ctlr) { - struct ata_promise_sx4 *hpktp = device_get_ivars(ctlr->dev); + struct ata_promise_sx4 *hpktp = ctlr->chipset_data; struct host_packet *hp; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905202134.n4KLY1on044536>