Date: Mon, 8 Dec 2008 17:54:17 GMT From: Ed Schouten <ed@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 154347 for review Message-ID: <200812081754.mB8HsHef097509@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=154347 Change 154347 by ed@ed_flippo on 2008/12/08 17:53:47 IFC. Affected files ... .. //depot/projects/mpsafetty/UPDATING#15 integrate .. //depot/projects/mpsafetty/lib/libarchive/test/main.c#3 integrate .. //depot/projects/mpsafetty/lib/libpmc/pmc.core.3#4 integrate .. //depot/projects/mpsafetty/share/man/man4/man4.powerpc/pmu.4#2 integrate .. //depot/projects/mpsafetty/sys/boot/forth/support.4th#2 integrate .. //depot/projects/mpsafetty/sys/compat/linprocfs/linprocfs.c#10 integrate .. //depot/projects/mpsafetty/sys/contrib/pf/net/pf_table.c#2 integrate .. //depot/projects/mpsafetty/sys/dev/ath/if_ath.c#9 integrate .. //depot/projects/mpsafetty/sys/dev/ath/if_athvar.h#7 integrate .. //depot/projects/mpsafetty/sys/dev/dc/if_dc.c#4 integrate .. //depot/projects/mpsafetty/sys/dev/dc/if_dcreg.h#3 integrate .. //depot/projects/mpsafetty/sys/dev/e1000/if_em.c#4 integrate .. //depot/projects/mpsafetty/sys/dev/fxp/if_fxp.c#4 integrate .. //depot/projects/mpsafetty/sys/dev/pccbb/pccbb.c#5 integrate .. //depot/projects/mpsafetty/sys/dev/pccbb/pccbb_pci.c#5 integrate .. //depot/projects/mpsafetty/sys/dev/re/if_re.c#7 integrate .. //depot/projects/mpsafetty/sys/fs/procfs/procfs_map.c#4 integrate .. //depot/projects/mpsafetty/sys/geom/geom_subr.c#3 integrate .. //depot/projects/mpsafetty/sys/kern/kern_proc.c#14 integrate .. //depot/projects/mpsafetty/sys/kern/subr_witness.c#12 integrate .. //depot/projects/mpsafetty/sys/kern/vfs_export.c#5 integrate .. //depot/projects/mpsafetty/sys/net/radix.c#2 integrate .. //depot/projects/mpsafetty/sys/net/radix.h#2 integrate .. //depot/projects/mpsafetty/sys/net/route.c#10 integrate .. //depot/projects/mpsafetty/sys/net/route.h#5 integrate .. //depot/projects/mpsafetty/sys/net/rtsock.c#7 integrate .. //depot/projects/mpsafetty/sys/netinet6/in6_rmx.c#7 integrate .. //depot/projects/mpsafetty/sys/netinet6/nd6_rtr.c#7 integrate .. //depot/projects/mpsafetty/sys/pci/if_rlreg.h#8 integrate .. //depot/projects/mpsafetty/sys/powerpc/conf/NOTES#2 integrate .. //depot/projects/mpsafetty/sys/powerpc/powermac/macgpio.c#2 integrate .. //depot/projects/mpsafetty/sys/powerpc/powermac/macgpiovar.h#2 integrate .. //depot/projects/mpsafetty/sys/powerpc/powermac/pmu.c#4 integrate .. //depot/projects/mpsafetty/sys/powerpc/powermac/pmuvar.h#2 integrate .. //depot/projects/mpsafetty/sys/ufs/ufs/ufs_quota.c#3 integrate .. //depot/projects/mpsafetty/tools/tools/ath/Makefile#2 integrate .. //depot/projects/mpsafetty/tools/tools/ath/Makefile.inc#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athdebug/Makefile#2 integrate .. //depot/projects/mpsafetty/tools/tools/ath/athkey/Makefile#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athkey/athkey.c#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athpow/Makefile#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athpow/athpow.c#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athprom/Makefile#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athprom/athprom.c#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athprom/eeprom-14#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athprom/eeprom-3#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athprom/eeprom-4#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athprom/eeprom-5#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athregs/Makefile#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athregs/dumpregs.c#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athregs/dumpregs.h#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athregs/dumpregs_5210.c#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athregs/dumpregs_5211.c#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athregs/dumpregs_5212.c#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athregs/dumpregs_5416.c#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/athstats/Makefile#3 integrate .. //depot/projects/mpsafetty/tools/tools/ath/common/ah_osdep.h#1 branch .. //depot/projects/mpsafetty/tools/tools/ath/common/diag.h#1 branch .. //depot/projects/mpsafetty/usr.sbin/syslogd/syslogd.8#3 integrate Differences ... ==== //depot/projects/mpsafetty/UPDATING#15 (text+ko) ==== @@ -38,11 +38,11 @@ and thereby the code size); consult ath_hal(4) for details. 20081121: - __FreeBSD_version 800054 adds memory barriers to - <machine/atomic.h>, new interfaces to ifnet to facilitate + __FreeBSD_version 800054 adds memory barriers to + <machine/atomic.h>, new interfaces to ifnet to facilitate multiple hardware transmit queues for cards that support them, and a lock-less ring-buffer implementation to - enable drivers to more efficiently manage queueing of + enable drivers to more efficiently manage queueing of packets. 20081117: @@ -287,11 +287,11 @@ be recompiled; this includes the hal and xorg-server ports. 20070928: - The caching daemon (cached) was renamed to nscd. nscd.conf - configuration file should be used instead of cached.conf and - nscd_enable, nscd_pidfile and nscd_flags options should be used - instead of cached_enable, cached_pidfile and cached_flags in - rc.conf. + The caching daemon (cached) was renamed to nscd. nscd.conf + configuration file should be used instead of cached.conf and + nscd_enable, nscd_pidfile and nscd_flags options should be used + instead of cached_enable, cached_pidfile and cached_flags in + rc.conf. 20070921: The getfacl(1) utility now prints owning user and group name @@ -299,7 +299,7 @@ This is the same behavior as getfacl(1) on Solaris and Linux. 20070704: - The new IPsec code is now compiled in using the IPSEC option. The + The new IPsec code is now compiled in using the IPSEC option. The IPSEC option now requires "device crypto" be defined in your kernel configuration. The FAST_IPSEC kernel option is now deprecated. @@ -602,10 +602,10 @@ If you have such a file, you need old utility to decrypt it. 20060709: - The interface version of the i4b kernel part has changed. So - after updating the kernel sources and compiling a new kernel, - the i4b user space tools in "/usr/src/usr.sbin/i4b" must also - be rebuilt, and vice versa. + The interface version of the i4b kernel part has changed. So + after updating the kernel sources and compiling a new kernel, + the i4b user space tools in "/usr/src/usr.sbin/i4b" must also + be rebuilt, and vice versa. 20060627: The XBOX kernel now defaults to the nfe(4) driver instead of @@ -1071,7 +1071,7 @@ <reboot into current> <do a "native" rebuild/install as described in the previous section> <maybe install compatibility libraries from ports/misc/compat*> - <reboot> + <reboot> To upgrade in-place from 5.x-stable to current @@ -1178,4 +1178,4 @@ Contact Warner Losh if you have any questions about your use of this document. -$FreeBSD: src/UPDATING,v 1.551 2008/12/01 23:09:58 sam Exp $ +$FreeBSD: src/UPDATING,v 1.552 2008/12/08 17:12:40 schweikh Exp $ ==== //depot/projects/mpsafetty/lib/libarchive/test/main.c#3 (text+ko) ==== @@ -45,7 +45,7 @@ #define EXTRA_DUMP(x) archive_error_string((struct archive *)(x)) #define EXTRA_VERSION archive_version() #define KNOWNREF "test_compat_gtar_1.tgz.uu" -__FBSDID("$FreeBSD: src/lib/libarchive/test/main.c,v 1.14 2008/08/31 07:06:02 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/main.c,v 1.15 2008/12/08 17:22:44 kientzle Exp $"); /* * "list.h" is simply created by "grep DEFINE_TEST"; it has @@ -897,6 +897,7 @@ time_t now; char *refdir_alloc = NULL; char *progname, *p; + char *tmp; char tmpdir[256]; char tmpdir_timestamp[256]; @@ -916,6 +917,17 @@ testprog = getenv(ENVBASE); #endif + if (getenv("TMPDIR") != NULL) + tmp = getenv("TMPDIR"); + else if (getenv("TMP") != NULL) + tmp = getenv("TMP"); + else if (getenv("TEMP") != NULL) + tmp = getenv("TEMP"); + else if (getenv("TEMPDIR") != NULL) + tmp = getenv("TEMPDIR"); + else + tmp = "/tmp"; + /* Allow -d to be controlled through the environment. */ if (getenv(ENVBASE "_DEBUG") != NULL) dump_on_failure = 1; @@ -976,7 +988,8 @@ strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp), "%Y-%m-%dT%H.%M.%S", localtime(&now)); - sprintf(tmpdir, "/tmp/%s.%s-%03d", progname, tmpdir_timestamp, i); + sprintf(tmpdir, "%s/%s.%s-%03d", tmp, progname, + tmpdir_timestamp, i); if (mkdir(tmpdir,0755) == 0) break; if (errno == EEXIST) ==== //depot/projects/mpsafetty/lib/libpmc/pmc.core.3#4 (text+ko) ==== @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $FreeBSD: src/lib/libpmc/pmc.core.3,v 1.6 2008/11/26 03:48:20 jkoshy Exp $ +.\" $FreeBSD: src/lib/libpmc/pmc.core.3,v 1.7 2008/12/08 12:28:48 jkoshy Exp $ .\" .Dd November 12, 2008 .Os @@ -730,6 +730,58 @@ .It Li interrupts Ta Li HW_Int_Rx .It Li unhalted-cycles Ta (unsupported) .El +.Sh PROCESSOR ERRATA +The following errata affect performance measurement on these +processors. +These errata are documented in +.Rs +.%T "Intel® CoreTM Duo Processor and Intel® CoreTM Solo Processor on 65 nm Process" +.%B "Specification Update" +.%N "Order Number 309222-017" +.%D July 2008 +.%Q "Intel Corporation" +.Re +.Bl -tag -width indent -compact +.It AE19 +Data prefetch performance monitoring events can only be enabled +on a single core. +.It AE25 +Performance monitoring counters that count external bus events +may report incorrect values after processor power state transitions. +.It AE28 +Performance monitoring events for retired floating point operations +(C1H) may not be accurate. +.It AE29 +DR3 address match on MOVD/MOVQ/MOVNTQ memory store +instruction may incorrectly increment performance monitoring count +for saturating simd instructions retired (Event CFH). +.It AE33 +Hardware prefetch performance monitoring events may be counted +inaccurately. +.It AE36 +The +.Li CPU_CLK_UNHALTED +performance monitoring event (Event 3CH) counts +clocks when the processor is in the C1/C2 processor power states. +.It AE39 +Certain performance monitoring counters related to bus, L2 cache +and power management are inaccurate. +.It AE51 +Performance monitoring events for retired instructions (Event C0H) may +not be accurate. +.It AE67 +Performance monitoring event +.Li FP_ASSIST +may not be accurate. +.It AE78 +Performance monitoring event for hardware prefetch requests (Event +4EH) and hardware prefetch request cache misses (Event 4FH) may not be +accurate. +.It AE82 +Performance monitoring event +.Li FP_MMX_TRANS_TO_MMX +may not count some transitions. +.El .Sh SEE ALSO .Xr pmc 3 , .Xr pmc.atom 3 , ==== //depot/projects/mpsafetty/share/man/man4/man4.powerpc/pmu.4#2 (text+ko) ==== @@ -23,7 +23,7 @@ .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man4/man4.powerpc/pmu.4,v 1.2 2008/12/07 06:34:50 nwhitehorn Exp $ +.\" $FreeBSD: src/share/man/man4/man4.powerpc/pmu.4,v 1.3 2008/12/08 02:37:08 nwhitehorn Exp $ .\" .Dd December 6, 2008 .Dt PMU 4 @@ -69,13 +69,32 @@ driver provides power management services in addition to an .Xr adb 4 interface. The following sysctls can be used to control the -power management behavior. +power management behavior and to examine current system power and +thermal conditions. .Bl -tag -width indent .It Va dev.pmu.%d.server_mode Restart after power failure behavior (1 causes system to reboot after power -cut, 0 causes system to remain off) +cut, 0 causes system to remain off). +.It Va dev.pmu.%d.batteries.%d.present +Indicates whether the relevant battery is inserted. +.It Va dev.pmu.%d.batteries.%d.charging +Indicates whether the battery is currently charging. +.It Va dev.pmu.%d.batteries.%d.charge +The current battery charge, in milliamp hours. +.It Va dev.pmu.%d.batteries.%d.maxcharge +The battery's self-reported maximum charge, in milliamp hours. +.It Va dev.pmu.%d.batteries.%d.rate +The current into the battery, in milliamps. While the battery is discharging, +this will be negative. +.It Va dev.pmu.%d.batteries.%d.voltage +Battery voltage, in millivolts. +.It Va dev.pmu.%d.batteries.%d.time +Estimated time until full battery charge (or discharge), in minutes. +.It Va dev.pmu.%d.batteries.%d.life +Current fraction of the battery's maximum charge, in percent. .Sh SEE ALSO -.Xr adb 4 +.Xr adb 4 , +.Xr acpi 4 .Sh HISTORY The .Nm ==== //depot/projects/mpsafetty/sys/boot/forth/support.4th#2 (text+ko) ==== @@ -22,7 +22,7 @@ \ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \ SUCH DAMAGE. \ -\ $FreeBSD: src/sys/boot/forth/support.4th,v 1.17 2007/12/19 17:06:32 ambrisko Exp $ +\ $FreeBSD: src/sys/boot/forth/support.4th,v 1.18 2008/12/07 19:42:20 luigi Exp $ \ Loader.rc support functions: \ @@ -288,6 +288,17 @@ : free-memory free if free_error throw then ; +: strget { var -- addr len } var .addr @ var .len @ ; + +\ assign addr len to variable. +: strset { addr len var -- } addr var .addr ! len var .len ! ; + +\ free memory and reset fields +: strfree { var -- } var .addr @ ?dup if free-memory 0 0 var strset then ; + +\ free old content, make a copy of the string and assign to variable +: string= { addr len var -- } var strfree addr len strdup var strset ; + \ Assignment data temporary storage string name_buffer @@ -712,19 +723,6 @@ module_loaderror_suffix suffix_type? ; -: set_conf_files - conf_files .addr @ ?dup if - free-memory - then - value_buffer .addr @ c@ [char] " = if - value_buffer .addr @ char+ value_buffer .len @ 2 chars - - else - value_buffer .addr @ value_buffer .len @ - then - strdup - conf_files .len ! conf_files .addr ! -; - : set_nextboot_conf nextboot_conf_file .addr @ ?dup if free-memory @@ -888,6 +886,11 @@ then ; +: set_conf_files + set_environment_variable + s" loader_conf_files" getenv conf_files string= +; + : set_nextboot_flag yes_value? to nextboot? ; @@ -1045,7 +1048,6 @@ \ Variables used for processing multiple conf files string current_file_name -variable current_conf_files \ Indicates if any conf file was succesfully read @@ -1053,18 +1055,10 @@ \ loader_conf_files processing support functions -: set_current_conf_files - conf_files .addr @ current_conf_files ! +: get_conf_files ( -- addr len ) \ put addr/len on stack, reset var + conf_files strget 0 0 conf_files strset ; -: get_conf_files - conf_files .addr @ conf_files .len @ strdup -; - -: recurse_on_conf_files? - current_conf_files @ conf_files .addr @ <> -; - : skip_leading_spaces { addr len pos -- addr len pos' } begin pos len = if addr len pos exit then @@ -1133,7 +1127,6 @@ \ Interface to loader_conf_files processing : include_conf_files - set_current_conf_files get_conf_files 0 begin get_next_file ?dup @@ -1141,7 +1134,7 @@ set_current_file_name ['] load_conf catch process_conf_errors - recurse_on_conf_files? if recurse then + conf_files .addr @ if recurse then repeat ; ==== //depot/projects/mpsafetty/sys/compat/linprocfs/linprocfs.c#10 (text+ko) ==== @@ -42,7 +42,7 @@ #include "opt_compat.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.128 2008/12/02 21:37:28 bz Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.130 2008/12/08 13:15:31 kib Exp $"); #include <sys/param.h> #include <sys/queue.h> @@ -273,8 +273,7 @@ /* XXX per-cpu vendor / class / model / id? */ } - sbuf_cat(sb, - "flags\t\t:"); + sbuf_cat(sb, "flags\t\t:"); if (!strcmp(cpu_vendor, "AuthenticAMD") && (class < 6)) { flags[16] = "fcmov"; @@ -876,10 +875,12 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) { vm_map_t map = &p->p_vmspace->vm_map; - vm_map_entry_t entry; + vm_map_entry_t entry, tmp_entry; vm_object_t obj, tobj, lobj; - vm_offset_t saved_end; + vm_offset_t e_start, e_end; vm_ooffset_t off = 0; + vm_prot_t e_prot; + unsigned int last_timestamp; char *name = "", *freename = NULL; ino_t ino; int ref_count, shadow_count, flags; @@ -905,7 +906,9 @@ freename = NULL; if (entry->eflags & MAP_ENTRY_IS_SUB_MAP) continue; - saved_end = entry->end; + e_prot = entry->protection; + e_start = entry->start; + e_end = entry->end; obj = entry->object.vm_object; for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { VM_OBJECT_LOCK(tobj); @@ -913,6 +916,8 @@ VM_OBJECT_UNLOCK(lobj); lobj = tobj; } + last_timestamp = map->timestamp; + vm_map_unlock_read(map); ino = 0; if (lobj) { off = IDX_TO_OFF(lobj->size); @@ -950,10 +955,10 @@ */ error = sbuf_printf(sb, "%08lx-%08lx %s%s%s%s %08lx %02x:%02x %lu%s%s\n", - (u_long)entry->start, (u_long)entry->end, - (entry->protection & VM_PROT_READ)?"r":"-", - (entry->protection & VM_PROT_WRITE)?"w":"-", - (entry->protection & VM_PROT_EXECUTE)?"x":"-", + (u_long)e_start, (u_long)e_end, + (e_prot & VM_PROT_READ)?"r":"-", + (e_prot & VM_PROT_WRITE)?"w":"-", + (e_prot & VM_PROT_EXECUTE)?"x":"-", "p", (u_long)off, 0, @@ -968,6 +973,16 @@ error = 0; break; } + vm_map_lock_read(map); + if (last_timestamp + 1 != map->timestamp) { + /* + * Look again for the entry because the map was + * modified while it was unlocked. Specifically, + * the entry may have been clipped, merged, or deleted. + */ + vm_map_lookup_entry(map, e_end - 1, &tmp_entry); + entry = tmp_entry; + } } vm_map_unlock_read(map); ==== //depot/projects/mpsafetty/sys/contrib/pf/net/pf_table.c#2 (text+ko) ==== @@ -35,7 +35,7 @@ #include "opt_inet6.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/contrib/pf/net/pf_table.c,v 1.9 2007/10/24 20:57:17 mlaier Exp $"); +__FBSDID("$FreeBSD: src/sys/contrib/pf/net/pf_table.c,v 1.10 2008/12/07 21:15:43 kmacy Exp $"); #endif #include <sys/param.h> @@ -43,6 +43,8 @@ #include <sys/socket.h> #include <sys/mbuf.h> #include <sys/kernel.h> +#include <sys/lock.h> +#include <sys/rwlock.h> #ifdef __FreeBSD__ #include <sys/malloc.h> #endif ==== //depot/projects/mpsafetty/sys/dev/ath/if_ath.c#9 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.221 2008/12/01 16:53:01 sam Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.223 2008/12/07 19:29:11 sam Exp $"); /* * Driver for the Atheros Wireless LAN controller. @@ -219,9 +219,15 @@ SYSCTL_DECL(_hw_ath); /* XXX validate sysctl values */ -static int ath_calinterval = 30; /* calibrate every 30 secs */ -SYSCTL_INT(_hw_ath, OID_AUTO, calibrate, CTLFLAG_RW, &ath_calinterval, - 0, "chip calibration interval (secs)"); +static int ath_longcalinterval = 30; /* long cals every 30 secs */ +SYSCTL_INT(_hw_ath, OID_AUTO, longcal, CTLFLAG_RW, &ath_longcalinterval, + 0, "long chip calibration interval (secs)"); +static int ath_shortcalinterval = 100; /* short cals every 100 ms */ +SYSCTL_INT(_hw_ath, OID_AUTO, shortcal, CTLFLAG_RW, &ath_shortcalinterval, + 0, "short chip calibration interval (msecs)"); +static int ath_resetcalinterval = 20*60; /* reset cal state 20 mins */ +SYSCTL_INT(_hw_ath, OID_AUTO, resetcal, CTLFLAG_RW, &ath_resetcalinterval, + 0, "reset chip calibration results (secs)"); static int ath_rxbuf = ATH_RXBUF; /* # rx buffers to allocate */ SYSCTL_INT(_hw_ath, OID_AUTO, rxbuf, CTLFLAG_RW, &ath_rxbuf, @@ -1433,8 +1439,9 @@ * state cached in the driver. */ sc->sc_diversity = ath_hal_getdiversity(ah); - sc->sc_calinterval = 1; - sc->sc_caltries = 0; + sc->sc_lastlongcal = 0; + sc->sc_resetcal = 1; + sc->sc_lastcalreset = 0; /* * Setup the hardware after reset: the key cache @@ -1566,8 +1573,6 @@ if_printf(ifp, "%s: unable to reset hardware; hal status %u\n", __func__, status); sc->sc_diversity = ath_hal_getdiversity(ah); - sc->sc_calinterval = 1; - sc->sc_caltries = 0; if (ath_startrecv(sc) != 0) /* restart recv */ if_printf(ifp, "%s: unable to start recv logic\n", __func__); /* @@ -5493,8 +5498,6 @@ } sc->sc_curchan = hchan; sc->sc_diversity = ath_hal_getdiversity(ah); - sc->sc_calinterval = 1; - sc->sc_caltries = 0; /* * Re-enable rx framework. @@ -5528,54 +5531,76 @@ { struct ath_softc *sc = arg; struct ath_hal *ah = sc->sc_ah; - HAL_BOOL iqCalDone; + struct ifnet *ifp = sc->sc_ifp; + HAL_BOOL longCal, isCalDone; + int nextcal; - sc->sc_stats.ast_per_cal++; - - if (ath_hal_getrfgain(ah) == HAL_RFGAIN_NEED_CHANGE) { + longCal = (ticks - sc->sc_lastlongcal >= ath_longcalinterval*hz); + if (longCal) { + sc->sc_stats.ast_per_cal++; + if (ath_hal_getrfgain(ah) == HAL_RFGAIN_NEED_CHANGE) { + /* + * Rfgain is out of bounds, reset the chip + * to load new gain values. + */ + DPRINTF(sc, ATH_DEBUG_CALIBRATE, + "%s: rfgain change\n", __func__); + sc->sc_stats.ast_per_rfgain++; + ath_reset(ifp); + } /* - * Rfgain is out of bounds, reset the chip - * to load new gain values. + * If this long cal is after an idle period, then + * reset the data collection state so we start fresh. */ - DPRINTF(sc, ATH_DEBUG_CALIBRATE, - "%s: rfgain change\n", __func__); - sc->sc_stats.ast_per_rfgain++; - ath_reset(sc->sc_ifp); + if (sc->sc_resetcal) { + (void) ath_hal_calreset(ah, &sc->sc_curchan); + sc->sc_lastcalreset = ticks; + sc->sc_resetcal = 0; + } } - if (!ath_hal_calibrate(ah, &sc->sc_curchan, &iqCalDone)) { + if (ath_hal_calibrateN(ah, &sc->sc_curchan, longCal, &isCalDone)) { + if (longCal) { + /* + * Calibrate noise floor data again in case of change. + */ + ath_hal_process_noisefloor(ah); + } + } else { DPRINTF(sc, ATH_DEBUG_ANY, "%s: calibration of channel %u failed\n", __func__, sc->sc_curchan.channel); sc->sc_stats.ast_per_calfail++; } - /* - * Calibrate noise floor data again in case of change. - */ - ath_hal_process_noisefloor(ah); - /* - * Poll more frequently when the IQ calibration is in - * progress to speedup loading the final settings. - * We temper this aggressive polling with an exponential - * back off after 4 tries up to ath_calinterval. - */ - if (iqCalDone || sc->sc_calinterval >= ath_calinterval) { - sc->sc_caltries = 0; - sc->sc_calinterval = ath_calinterval; - } else if (sc->sc_caltries > 4) { - sc->sc_caltries = 0; - sc->sc_calinterval <<= 1; - if (sc->sc_calinterval > ath_calinterval) - sc->sc_calinterval = ath_calinterval; + if (!isCalDone) { + /* + * Use a shorter interval to potentially collect multiple + * data samples required to complete calibration. Once + * we're told the work is done we drop back to a longer + * interval between requests. We're more aggressive doing + * work when operating as an AP to improve operation right + * after startup. + */ + nextcal = (1000*ath_shortcalinterval)/hz; + if (sc->sc_opmode != HAL_M_HOSTAP) + nextcal *= 10; + } else { + nextcal = ath_longcalinterval*hz; + sc->sc_lastlongcal = ticks; + if (sc->sc_lastcalreset == 0) + sc->sc_lastcalreset = sc->sc_lastlongcal; + else if (ticks - sc->sc_lastcalreset >= ath_resetcalinterval*hz) + sc->sc_resetcal = 1; /* setup reset next trip */ } - KASSERT(0 < sc->sc_calinterval && sc->sc_calinterval <= ath_calinterval, - ("bad calibration interval %u", sc->sc_calinterval)); - DPRINTF(sc, ATH_DEBUG_CALIBRATE, - "%s: next +%u (%siqCalDone tries %u)\n", __func__, - sc->sc_calinterval, iqCalDone ? "" : "!", sc->sc_caltries); - sc->sc_caltries++; - callout_reset(&sc->sc_cal_ch, sc->sc_calinterval * hz, - ath_calibrate, sc); + if (nextcal != 0) { + DPRINTF(sc, ATH_DEBUG_CALIBRATE, "%s: next +%u (%sisCalDone)\n", + __func__, nextcal, isCalDone ? "" : "!"); + callout_reset(&sc->sc_cal_ch, nextcal, ath_calibrate, sc); + } else { + DPRINTF(sc, ATH_DEBUG_CALIBRATE, "%s: calibration disabled\n", + __func__); + /* NB: don't rearm timer */ + } } static void @@ -5803,10 +5828,12 @@ * Finally, start any timers and the task q thread * (in case we didn't go through SCAN state). */ - if (sc->sc_calinterval != 0) { + if (ath_longcalinterval != 0) { /* start periodic recalibration timer */ - callout_reset(&sc->sc_cal_ch, sc->sc_calinterval * hz, - ath_calibrate, sc); + callout_reset(&sc->sc_cal_ch, 1, ath_calibrate, sc); + } else { + DPRINTF(sc, ATH_DEBUG_CALIBRATE, + "%s: calibration disabled\n", __func__); } taskqueue_unblock(sc->sc_tq); } else if (nstate == IEEE80211_S_INIT) { @@ -6885,7 +6912,7 @@ struct ieee80211com *ic = ifp->if_l2com; struct ath_hal *ah = sc->sc_ah; int error, ismcast, ismrr; - int hdrlen, pktlen, try0, txantenna; + int keyix, hdrlen, pktlen, try0, txantenna; u_int8_t rix, cix, txrate, ctsrate, rate1, rate2, rate3; struct ieee80211_frame *wh; u_int flags, ctsduration; @@ -6904,6 +6931,54 @@ /* XXX honor IEEE80211_BPF_DATAPAD */ pktlen = m0->m_pkthdr.len - (hdrlen & 3) + IEEE80211_CRC_LEN; + if (params->ibp_flags & IEEE80211_BPF_CRYPTO) { + const struct ieee80211_cipher *cip; + struct ieee80211_key *k; + + /* + * Construct the 802.11 header+trailer for an encrypted + * frame. The only reason this can fail is because of an + * unknown or unsupported cipher/key type. + */ + k = ieee80211_crypto_encap(ni, m0); + if (k == NULL) { + /* + * This can happen when the key is yanked after the + * frame was queued. Just discard the frame; the + * 802.11 layer counts failures and provides + * debugging/diagnostics. + */ + ath_freetx(m0); + return EIO; + } + /* + * Adjust the packet + header lengths for the crypto + * additions and calculate the h/w key index. When + * a s/w mic is done the frame will have had any mic + * added to it prior to entry so m0->m_pkthdr.len will + * account for it. Otherwise we need to add it to the + * packet length. + */ + cip = k->wk_cipher; + hdrlen += cip->ic_header; + pktlen += cip->ic_header + cip->ic_trailer; + /* NB: frags always have any TKIP MIC done in s/w */ + if ((k->wk_flags & IEEE80211_KEY_SWMIC) == 0) + pktlen += cip->ic_miclen; + keyix = k->wk_keyix; + + /* packet header may have moved, reset our local pointer */ + wh = mtod(m0, struct ieee80211_frame *); + } else if (ni->ni_ucastkey.wk_cipher == &ieee80211_cipher_none) { + /* + * Use station key cache slot, if assigned. + */ + keyix = ni->ni_ucastkey.wk_keyix; + if (keyix == IEEE80211_KEYIX_NONE) + keyix = HAL_TXKEYIX_INVALID; + } else + keyix = HAL_TXKEYIX_INVALID; + error = ath_tx_dmasetup(sc, bf, m0); if (error != 0) return error; @@ -6992,7 +7067,7 @@ , atype /* Atheros packet type */ , params->ibp_power /* txpower */ , txrate, try0 /* series 0 rate/tries */ - , HAL_TXKEYIX_INVALID /* key cache index */ + , keyix /* key cache index */ , txantenna /* antenna mode */ , flags /* flags */ , ctsrate /* rts/cts rate */ ==== //depot/projects/mpsafetty/sys/dev/ath/if_athvar.h#7 (text+ko) ==== @@ -26,7 +26,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGES. * - * $FreeBSD: src/sys/dev/ath/if_athvar.h,v 1.75 2008/12/01 16:53:01 sam Exp $ + * $FreeBSD: src/sys/dev/ath/if_athvar.h,v 1.76 2008/12/07 19:26:34 sam Exp $ */ /* @@ -248,7 +248,8 @@ sc_swbmiss : 1,/* sta mode using sw bmiss */ sc_stagbeacons:1,/* use staggered beacons */ sc_wmetkipmic:1,/* can do WME+TKIP MIC */ - sc_resume_up: 1;/* on resume, start all vaps */ + sc_resume_up: 1,/* on resume, start all vaps */ + sc_resetcal : 1;/* reset cal state next trip */ uint32_t sc_eerd; /* regdomain from EEPROM */ uint32_t sc_eecc; /* country code from EEPROM */ /* rate tables */ @@ -334,8 +335,8 @@ int sc_nbcnvaps; /* # vaps with beacons */ struct callout sc_cal_ch; /* callout handle for cals */ - int sc_calinterval; /* current polling interval */ - int sc_caltries; /* cals at current interval */ + int sc_lastlongcal; /* last long cal completed */ + int sc_lastcalreset;/* last cal reset done */ HAL_NODE_STATS sc_halstats; /* station-mode rssi stats */ }; @@ -438,6 +439,16 @@ ((*(_ah)->ah_setChannel)((_ah), (_chan))) #define ath_hal_calibrate(_ah, _chan, _iqcal) \ ((*(_ah)->ah_perCalibration)((_ah), (_chan), (_iqcal))) +#if HAL_ABI_VERSION >= 0x08111000 +#define ath_hal_calibrateN(_ah, _chan, _lcal, _isdone) \ + ((*(_ah)->ah_perCalibrationN)((_ah), (_chan), 0x1, (_lcal), (_isdone))) +#define ath_hal_calreset(_ah, _chan) \ + ((*(_ah)->ah_resetCalValid)((_ah), (_chan))) +#else +#define ath_hal_calibrateN(_ah, _chan, _lcal, _isdone) \ + ath_hal_calibrate(_ah, _chan, _isdone) +#define ath_hal_calreset(_ah, _chan) (0) +#endif #define ath_hal_setledstate(_ah, _state) \ ((*(_ah)->ah_setLedState)((_ah), (_state))) #define ath_hal_beaconinit(_ah, _nextb, _bperiod) \ ==== //depot/projects/mpsafetty/sys/dev/dc/if_dc.c#4 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/dc/if_dc.c,v 1.197 2008/08/29 20:31:41 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/dc/if_dc.c,v 1.198 2008/12/07 23:02:37 marius Exp $"); /* * DEC "tulip" clone ethernet driver. Supports the DEC/Intel 21143 @@ -607,15 +607,22 @@ static void dc_mii_writebit(struct dc_softc *sc, int bit) { + uint32_t reg; - if (bit) - CSR_WRITE_4(sc, DC_SIO, - DC_SIO_ROMCTL_WRITE | DC_SIO_MII_DATAOUT); - else - CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_WRITE); + reg = DC_SIO_ROMCTL_WRITE | (bit != 0 ? DC_SIO_MII_DATAOUT : 0); + CSR_WRITE_4(sc, DC_SIO, reg); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); - DC_SETBIT(sc, DC_SIO, DC_SIO_MII_CLK); - DC_CLRBIT(sc, DC_SIO, DC_SIO_MII_CLK); + CSR_WRITE_4(sc, DC_SIO, reg | DC_SIO_MII_CLK); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); + CSR_WRITE_4(sc, DC_SIO, reg); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); } /* @@ -624,11 +631,22 @@ static int dc_mii_readbit(struct dc_softc *sc) { + uint32_t reg; - CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_READ | DC_SIO_MII_DIR); - CSR_READ_4(sc, DC_SIO); - DC_SETBIT(sc, DC_SIO, DC_SIO_MII_CLK); - DC_CLRBIT(sc, DC_SIO, DC_SIO_MII_CLK); + reg = DC_SIO_ROMCTL_READ | DC_SIO_MII_DIR; + CSR_WRITE_4(sc, DC_SIO, reg); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); + (void)CSR_READ_4(sc, DC_SIO); + CSR_WRITE_4(sc, DC_SIO, reg | DC_SIO_MII_CLK); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); + CSR_WRITE_4(sc, DC_SIO, reg); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); if (CSR_READ_4(sc, DC_SIO) & DC_SIO_MII_DATAIN) return (1); @@ -644,6 +662,9 @@ int i; CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_WRITE); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); for (i = 0; i < 32; i++) dc_mii_writebit(sc, 1); @@ -667,15 +688,13 @@ static int dc_mii_readreg(struct dc_softc *sc, struct dc_mii_frame *frame) { - int i, ack; + int i; /* * Set up frame for RX. */ frame->mii_stdelim = DC_MII_STARTDELIM; frame->mii_opcode = DC_MII_READOP; - frame->mii_turnaround = 0; - frame->mii_data = 0; /* * Sync the PHYs. @@ -690,38 +709,28 @@ dc_mii_send(sc, frame->mii_phyaddr, 5); dc_mii_send(sc, frame->mii_regaddr, 5); -#ifdef notdef - /* Idle bit */ - dc_mii_writebit(sc, 1); - dc_mii_writebit(sc, 0); -#endif - - /* Check for ack. */ - ack = dc_mii_readbit(sc); - /* - * Now try reading data bits. If the ack failed, we still + * Now try reading data bits. If the turnaround failed, we still * need to clock through 16 cycles to keep the PHY(s) in sync. */ - if (ack) { + frame->mii_turnaround = dc_mii_readbit(sc); + if (frame->mii_turnaround != 0) { for (i = 0; i < 16; i++) dc_mii_readbit(sc); goto fail; } - for (i = 0x8000; i; i >>= 1) { - if (!ack) { - if (dc_mii_readbit(sc)) - frame->mii_data |= i; - } + if (dc_mii_readbit(sc)) + frame->mii_data |= i; } fail: + /* Clock the idle bits. */ dc_mii_writebit(sc, 0); dc_mii_writebit(sc, 0); - if (ack) + if (frame->mii_turnaround != 0) return (1); return (0); } @@ -736,7 +745,6 @@ /* * Set up frame for TX. */ - frame->mii_stdelim = DC_MII_STARTDELIM; frame->mii_opcode = DC_MII_WRITEOP; frame->mii_turnaround = DC_MII_TURNAROUND; @@ -753,7 +761,7 @@ dc_mii_send(sc, frame->mii_turnaround, 2); dc_mii_send(sc, frame->mii_data, 16); - /* Idle bit. */ + /* Clock the idle bits. */ dc_mii_writebit(sc, 0); dc_mii_writebit(sc, 0); >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812081754.mB8HsHef097509>