From owner-svn-src-projects@FreeBSD.ORG Sun May 8 14:56:03 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F16F1065670; Sun, 8 May 2011 14:56:03 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F283E8FC1A; Sun, 8 May 2011 14:56:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48Eu2GT051126; Sun, 8 May 2011 14:56:02 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48Eu2EA051112; Sun, 8 May 2011 14:56:02 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105081456.p48Eu2EA051112@svn.freebsd.org> From: Attilio Rao Date: Sun, 8 May 2011 14:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221664 - in projects/largeSMP: bin/sh contrib/top etc/rc.d sbin/dumpfs sbin/geom/class/eli sbin/growfs sbin/hastd sbin/tunefs share/mk sys/dev/ath/ath_hal sys/dev/ath/ath_hal/ar5416 sy... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 14:56:03 -0000 Author: attilio Date: Sun May 8 14:56:02 2011 New Revision: 221664 URL: http://svn.freebsd.org/changeset/base/221664 Log: MFC Added: projects/largeSMP/tools/regression/bin/sh/builtins/case5.0 - copied unchanged from r221663, head/tools/regression/bin/sh/builtins/case5.0 projects/largeSMP/tools/regression/bin/sh/expansion/trim8.0 - copied unchanged from r221663, head/tools/regression/bin/sh/expansion/trim8.0 Modified: projects/largeSMP/bin/sh/expand.c projects/largeSMP/bin/sh/sh.1 projects/largeSMP/etc/rc.d/nfsd projects/largeSMP/sbin/dumpfs/dumpfs.8 projects/largeSMP/sbin/geom/class/eli/geli.8 projects/largeSMP/sbin/growfs/growfs.8 projects/largeSMP/sbin/hastd/parse.y projects/largeSMP/sbin/tunefs/tunefs.8 projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v14.h projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416reg.h projects/largeSMP/sys/dev/iwn/if_iwn.c projects/largeSMP/sys/dev/iwn/if_iwnreg.h projects/largeSMP/sys/dev/iwn/if_iwnvar.h projects/largeSMP/sys/dev/usb/usb_device.c projects/largeSMP/sys/fs/nfsserver/nfs_nfsdkrpc.c projects/largeSMP/sys/fs/nfsserver/nfs_nfsdport.c projects/largeSMP/sys/geom/eli/g_eli.c projects/largeSMP/sys/geom/eli/g_eli.h projects/largeSMP/sys/geom/eli/g_eli_ctl.c projects/largeSMP/sys/geom/eli/g_eli_integrity.c projects/largeSMP/sys/geom/eli/g_eli_key_cache.c projects/largeSMP/sys/geom/part/g_part_apm.c projects/largeSMP/sys/geom/part/g_part_bsd.c projects/largeSMP/sys/geom/part/g_part_ebr.c projects/largeSMP/sys/geom/part/g_part_mbr.c projects/largeSMP/sys/geom/part/g_part_pc98.c projects/largeSMP/sys/geom/part/g_part_vtoc8.c projects/largeSMP/sys/netinet/sctp_auth.c projects/largeSMP/sys/netinet/sctp_auth.h projects/largeSMP/sys/netinet/sctp_indata.c projects/largeSMP/sys/netinet/sctp_input.c projects/largeSMP/sys/netinet/sctp_input.h projects/largeSMP/sys/netinet/sctp_output.c projects/largeSMP/sys/netinet/sctp_output.h projects/largeSMP/sys/netinet/sctp_pcb.c projects/largeSMP/sys/netinet/sctp_timer.c projects/largeSMP/sys/netinet/sctp_usrreq.c projects/largeSMP/sys/netinet/sctp_var.h projects/largeSMP/sys/netinet/sctputil.c projects/largeSMP/sys/sun4v/sun4v/mp_machdep.c projects/largeSMP/usr.sbin/jail/jail.8 Directory Properties: projects/largeSMP/ (props changed) projects/largeSMP/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/contrib/bind9/ (props changed) projects/largeSMP/contrib/binutils/ (props changed) projects/largeSMP/contrib/bzip2/ (props changed) projects/largeSMP/contrib/dialog/ (props changed) projects/largeSMP/contrib/ee/ (props changed) projects/largeSMP/contrib/expat/ (props changed) projects/largeSMP/contrib/file/ (props changed) projects/largeSMP/contrib/gcc/ (props changed) projects/largeSMP/contrib/gdb/ (props changed) projects/largeSMP/contrib/gdtoa/ (props changed) projects/largeSMP/contrib/gnu-sort/ (props changed) projects/largeSMP/contrib/groff/ (props changed) projects/largeSMP/contrib/less/ (props changed) projects/largeSMP/contrib/libpcap/ (props changed) projects/largeSMP/contrib/libstdc++/ (props changed) projects/largeSMP/contrib/llvm/ (props changed) projects/largeSMP/contrib/llvm/tools/clang/ (props changed) projects/largeSMP/contrib/ncurses/ (props changed) projects/largeSMP/contrib/netcat/ (props changed) projects/largeSMP/contrib/ntp/ (props changed) projects/largeSMP/contrib/one-true-awk/ (props changed) projects/largeSMP/contrib/openbsm/ (props changed) projects/largeSMP/contrib/openpam/ (props changed) projects/largeSMP/contrib/pf/ (props changed) projects/largeSMP/contrib/sendmail/ (props changed) projects/largeSMP/contrib/tcpdump/ (props changed) projects/largeSMP/contrib/tcsh/ (props changed) projects/largeSMP/contrib/top/ (props changed) projects/largeSMP/contrib/top/install-sh (props changed) projects/largeSMP/contrib/tzcode/stdtime/ (props changed) projects/largeSMP/contrib/tzcode/zic/ (props changed) projects/largeSMP/contrib/tzdata/ (props changed) projects/largeSMP/contrib/wpa/ (props changed) projects/largeSMP/contrib/xz/ (props changed) projects/largeSMP/crypto/openssh/ (props changed) projects/largeSMP/crypto/openssl/ (props changed) projects/largeSMP/gnu/lib/ (props changed) projects/largeSMP/gnu/usr.bin/binutils/ (props changed) projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed) projects/largeSMP/gnu/usr.bin/gdb/ (props changed) projects/largeSMP/lib/libc/ (props changed) projects/largeSMP/lib/libc/stdtime/ (props changed) projects/largeSMP/lib/libutil/ (props changed) projects/largeSMP/lib/libz/ (props changed) projects/largeSMP/sbin/ (props changed) projects/largeSMP/sbin/ipfw/ (props changed) projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed) projects/largeSMP/share/zoneinfo/ (props changed) projects/largeSMP/sys/ (props changed) projects/largeSMP/sys/amd64/include/xen/ (props changed) projects/largeSMP/sys/boot/ (props changed) projects/largeSMP/sys/boot/i386/efi/ (props changed) projects/largeSMP/sys/boot/ia64/efi/ (props changed) projects/largeSMP/sys/boot/ia64/ski/ (props changed) projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed) projects/largeSMP/sys/boot/powerpc/ofw/ (props changed) projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/sys/conf/ (props changed) projects/largeSMP/sys/contrib/dev/acpica/ (props changed) projects/largeSMP/sys/contrib/octeon-sdk/ (props changed) projects/largeSMP/sys/contrib/pf/ (props changed) projects/largeSMP/sys/contrib/x86emu/ (props changed) projects/largeSMP/usr.bin/calendar/ (props changed) projects/largeSMP/usr.bin/csup/ (props changed) projects/largeSMP/usr.bin/procstat/ (props changed) projects/largeSMP/usr.sbin/ndiscvt/ (props changed) projects/largeSMP/usr.sbin/zic/ (props changed) Modified: projects/largeSMP/bin/sh/expand.c ============================================================================== --- projects/largeSMP/bin/sh/expand.c Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/bin/sh/expand.c Sun May 8 14:56:02 2011 (r221664) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* * Routines to expand arguments to commands. We have to deal with @@ -111,16 +112,16 @@ static void addfname(char *); static struct strlist *expsort(struct strlist *); static struct strlist *msort(struct strlist *, int); static char *cvtnum(int, char *); -static int collate_range_cmp(int, int); +static int collate_range_cmp(wchar_t, wchar_t); static int -collate_range_cmp(int c1, int c2) +collate_range_cmp(wchar_t c1, wchar_t c2) { - static char s1[2], s2[2]; + static wchar_t s1[2], s2[2]; s1[0] = c1; s2[0] = c2; - return (strcoll(s1, s2)); + return (wcscoll(s1, s2)); } /* @@ -1377,6 +1378,23 @@ msort(struct strlist *list, int len) +static wchar_t +get_wc(const char **p) +{ + wchar_t c; + int chrlen; + + chrlen = mbtowc(&c, *p, 4); + if (chrlen == 0) + return 0; + else if (chrlen == -1) + c = 0; + else + *p += chrlen; + return c; +} + + /* * Returns true if the pattern matches the string. */ @@ -1386,6 +1404,7 @@ patmatch(const char *pattern, const char { const char *p, *q; char c; + wchar_t wc, wc2; p = pattern; q = string; @@ -1404,7 +1423,11 @@ patmatch(const char *pattern, const char case '?': if (squoted && *q == CTLESC) q++; - if (*q++ == '\0') + if (localeisutf8) + wc = get_wc(&q); + else + wc = *q++; + if (wc == '\0') return 0; break; case '*': @@ -1434,7 +1457,7 @@ patmatch(const char *pattern, const char case '[': { const char *endp; int invert, found; - char chr; + wchar_t chr; endp = p; if (*endp == '!' || *endp == '^') @@ -1455,8 +1478,11 @@ patmatch(const char *pattern, const char p++; } found = 0; - chr = *q++; - if (squoted && chr == CTLESC) + if (squoted && *q == CTLESC) + q++; + if (localeisutf8) + chr = get_wc(&q); + else chr = *q++; if (chr == '\0') return 0; @@ -1466,19 +1492,31 @@ patmatch(const char *pattern, const char continue; if (c == CTLESC) c = *p++; + if (localeisutf8 && c & 0x80) { + p--; + wc = get_wc(&p); + if (wc == 0) /* bad utf-8 */ + return 0; + } else + wc = c; if (*p == '-' && p[1] != ']') { p++; while (*p == CTLQUOTEMARK) p++; if (*p == CTLESC) p++; - if ( collate_range_cmp(chr, c) >= 0 - && collate_range_cmp(chr, *p) <= 0 + if (localeisutf8) { + wc2 = get_wc(&p); + if (wc2 == 0) /* bad utf-8 */ + return 0; + } else + wc2 = *p++; + if ( collate_range_cmp(chr, wc) >= 0 + && collate_range_cmp(chr, wc2) <= 0 ) found = 1; - p++; } else { - if (chr == c) + if (chr == wc) found = 1; } } while ((c = *p++) != ']'); Modified: projects/largeSMP/bin/sh/sh.1 ============================================================================== --- projects/largeSMP/bin/sh/sh.1 Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/bin/sh/sh.1 Sun May 8 14:56:02 2011 (r221664) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd May 5, 2011 +.Dd May 8, 2011 .Dt SH 1 .Os .Sh NAME @@ -2591,4 +2591,9 @@ was originally written by .Sh BUGS The .Nm -utility does not recognize multibyte characters. +utility does not recognize multibyte characters other than UTF-8. +Splitting using +.Va IFS +and the line editing library +.Xr editline 3 +do not recognize multibyte characters. Modified: projects/largeSMP/etc/rc.d/nfsd ============================================================================== --- projects/largeSMP/etc/rc.d/nfsd Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/etc/rc.d/nfsd Sun May 8 14:56:02 2011 (r221664) @@ -33,13 +33,13 @@ nfsd_precmd() else rc_flags="${nfs_server_flags}" - # Load the modules now, so that the vfs.newnfs sysctl + # Load the modules now, so that the vfs.nfsd sysctl # oids are available. load_kld nfsd if checkyesno nfs_reserved_port_only; then echo 'NFS on reserved port only=YES' - sysctl vfs.newnfs.nfs_privport=1 > /dev/null + sysctl vfs.nfsd.nfs_privport=1 > /dev/null fi if checkyesno nfsv4_server_enable; then @@ -52,7 +52,7 @@ nfsd_precmd() fi else echo 'NFSv4 is disabled' - sysctl vfs.newnfs.server_max_nfsvers=3 > /dev/null + sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null fi fi Modified: projects/largeSMP/sbin/dumpfs/dumpfs.8 ============================================================================== --- projects/largeSMP/sbin/dumpfs/dumpfs.8 Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sbin/dumpfs/dumpfs.8 Sun May 8 14:56:02 2011 (r221664) @@ -28,12 +28,12 @@ .\" @(#)dumpfs.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 28, 2009 +.Dd May 8, 2011 .Dt DUMPFS 8 .Os .Sh NAME .Nm dumpfs -.Nd dump file system information +.Nd dump UFS file system information .Sh SYNOPSIS .Nm .Op Fl f @@ -42,7 +42,7 @@ .Sh DESCRIPTION The .Nm -utility prints out the super block and cylinder group information +utility prints out the UFS super block and cylinder group information for the file system or special device specified, unless the .Fl f or Modified: projects/largeSMP/sbin/geom/class/eli/geli.8 ============================================================================== --- projects/largeSMP/sbin/geom/class/eli/geli.8 Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sbin/geom/class/eli/geli.8 Sun May 8 14:56:02 2011 (r221664) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2005-2010 Pawel Jakub Dawidek +.\" Copyright (c) 2005-2011 Pawel Jakub Dawidek .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -627,9 +627,13 @@ variables can be used to control the beh .Nm ELI GEOM class. The default value is shown next to each variable. -All variables can also be set in +Some variables can also be set in .Pa /boot/loader.conf . .Bl -tag -width indent +.It Va kern.geom.eli.version +Version number of the +.Nm ELI +GEOM class. .It Va kern.geom.eli.debug : No 0 Debug level of the .Nm ELI @@ -668,6 +672,22 @@ When set to 1, can speed-up crypto opera Batching allows to reduce number of interrupts by responding on a group of crypto requests with one interrupt. The crypto card and the driver has to support this feature. +.It Va kern.geom.eli.key_cache_limit : No 8192 +Specifies how many encryption keys to cache. +The default limit +.No ( 8192 +keys) will allow to cache all keys for 4TB provider with 512 bytes sectors and +will take around 1MB of memory. +.It Va kern.geom.eli.key_cache_hits +Reports how many times we were looking up a key and it was already in cache. +This sysctl is not updated for providers that need less keys than the limit +specified in +.Va kern.geom.eli.key_cache_limit . +.It Va kern.geom.eli.key_cache_misses +Reports how many times we were looking up a key and it was not in cache. +This sysctl is not updated for providers that need less keys than the limit +specified in +.Va kern.geom.eli.key_cache_limit . .El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. Modified: projects/largeSMP/sbin/growfs/growfs.8 ============================================================================== --- projects/largeSMP/sbin/growfs/growfs.8 Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sbin/growfs/growfs.8 Sun May 8 14:56:02 2011 (r221664) @@ -37,12 +37,12 @@ .\" $TSHeader: src/sbin/growfs/growfs.8,v 1.3 2000/12/12 19:31:00 tomsoft Exp $ .\" $FreeBSD$ .\" -.Dd September 8, 2000 +.Dd May 8, 2011 .Dt GROWFS 8 .Os .Sh NAME .Nm growfs -.Nd grow size of an existing ufs file system +.Nd grow size of an existing UFS file system .Sh SYNOPSIS .Nm .Op Fl Ny Modified: projects/largeSMP/sbin/hastd/parse.y ============================================================================== --- projects/largeSMP/sbin/hastd/parse.y Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sbin/hastd/parse.y Sun May 8 14:56:02 2011 (r221664) @@ -92,8 +92,10 @@ isitme(const char *name) * Now check if it matches first part of the host name. */ pos = strchr(buf, '.'); - if (pos != NULL && pos != buf && strncmp(buf, name, pos - buf) == 0) + if (pos != NULL && (size_t)(pos - buf) == strlen(name) && + strncmp(buf, name, pos - buf) == 0) { return (1); + } /* * At the end check if name is equal to our host's UUID. @@ -287,6 +289,7 @@ yy_config_free(struct hastd_config *conf %token FULLSYNC MEMSYNC ASYNC NONE CRC32 SHA256 HOLE LZF %token NUM STR OB CB +%type remote_str %type replication_type %type checksum_type %type compression_type @@ -794,7 +797,7 @@ resource_node_entry: source_statement ; -remote_statement: REMOTE STR +remote_statement: REMOTE remote_str { assert(depth == 2); if (mynode) { @@ -811,6 +814,12 @@ remote_statement: REMOTE STR } ; +remote_str: + NONE { $$ = strdup("none"); } + | + STR { } + ; + source_statement: SOURCE STR { assert(depth == 2); Modified: projects/largeSMP/sbin/tunefs/tunefs.8 ============================================================================== --- projects/largeSMP/sbin/tunefs/tunefs.8 Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sbin/tunefs/tunefs.8 Sun May 8 14:56:02 2011 (r221664) @@ -28,12 +28,12 @@ .\" @(#)tunefs.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd December 9, 2010 +.Dd May 8, 2011 .Dt TUNEFS 8 .Os .Sh NAME .Nm tunefs -.Nd tune up an existing file system +.Nd tune up an existing UFS file system .Sh SYNOPSIS .Nm .Op Fl A @@ -56,7 +56,7 @@ .Sh DESCRIPTION The .Nm -utility is designed to change the dynamic parameters of a file system +utility is designed to change the dynamic parameters of a UFS file system which affect the layout policies. The .Nm Modified: projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v14.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v14.h Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v14.h Sun May 8 14:56:02 2011 (r221664) @@ -95,10 +95,10 @@ #define AR5416_OPFLAGS_11A 0x01 #define AR5416_OPFLAGS_11G 0x02 -#define AR5416_OPFLAGS_5G_HT40 0x04 -#define AR5416_OPFLAGS_2G_HT40 0x08 -#define AR5416_OPFLAGS_5G_HT20 0x10 -#define AR5416_OPFLAGS_2G_HT20 0x20 +#define AR5416_OPFLAGS_N_5G_HT40 0x04 /* If set, disable 5G HT40 */ +#define AR5416_OPFLAGS_N_2G_HT40 0x08 +#define AR5416_OPFLAGS_N_5G_HT20 0x10 +#define AR5416_OPFLAGS_N_2G_HT20 0x20 /* RF silent fields in EEPROM */ #define EEP_RFSILENT_ENABLED 0x0001 /* enabled/disabled */ Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun May 8 14:56:02 2011 (r221664) @@ -286,6 +286,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO ar5416InitIMR(ah, opmode); ar5212SetCoverageClass(ah, AH_PRIVATE(ah)->ah_coverageClass, 1); ar5416InitQoS(ah); + /* This may override the AR_DIAG_SW register */ ar5416InitUserSettings(ah); /* @@ -520,7 +521,6 @@ ar5416InitBB(struct ath_hal *ah, const s /* Turn on PLL on 5416 */ HALDEBUG(ah, HAL_DEBUG_RESET, "%s %s channel\n", __func__, IEEE80211_IS_CHAN_5GHZ(chan) ? "5GHz" : "2GHz"); - AH5416(ah)->ah_initPLL(ah, chan); /* Activate the PHY (includes baseband activate and synthesizer on) */ OS_REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); @@ -673,6 +673,10 @@ ar5416ChipReset(struct ath_hal *ah, cons if (!ar5416SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE)) return AH_FALSE; +#ifdef notyet + ahp->ah_chipFullSleep = AH_FALSE; +#endif + AH5416(ah)->ah_initPLL(ah, chan); /* @@ -681,8 +685,7 @@ ar5416ChipReset(struct ath_hal *ah, cons * with an active radio can result in corrupted shifts to the * radio device. */ - if (chan != AH_NULL) - ar5416SetRfMode(ah, chan); + ar5416SetRfMode(ah, chan); return AH_TRUE; } @@ -1102,7 +1105,11 @@ ar5416Disable(struct ath_hal *ah) { if (!ar5212SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE)) return AH_FALSE; - return ar5416SetResetReg(ah, HAL_RESET_COLD); + if (! ar5416SetResetReg(ah, HAL_RESET_COLD)) + return AH_FALSE; + + AH5416(ah)->ah_initPLL(ah, AH_NULL); + return AH_TRUE; } /* @@ -1114,7 +1121,11 @@ ar5416Disable(struct ath_hal *ah) HAL_BOOL ar5416PhyDisable(struct ath_hal *ah) { - return ar5416SetResetReg(ah, HAL_RESET_WARM); + if (! ar5416SetResetReg(ah, HAL_RESET_WARM)) + return AH_FALSE; + + AH5416(ah)->ah_initPLL(ah, AH_NULL); + return AH_TRUE; } /* @@ -1277,34 +1288,52 @@ ar5416SetReset(struct ath_hal *ah, int t } } - AH5416(ah)->ah_initPLL(ah, AH_NULL); - return AH_TRUE; } void ar5416InitChainMasks(struct ath_hal *ah) { - if (AH5416(ah)->ah_rx_chainmask == 0x5 || - AH5416(ah)->ah_tx_chainmask == 0x5) - OS_REG_WRITE(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN); - /* Setup Chain Masks */ - OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, AH5416(ah)->ah_rx_chainmask); - OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, AH5416(ah)->ah_rx_chainmask); + int rx_chainmask = AH5416(ah)->ah_rx_chainmask; + + if (rx_chainmask) + OS_REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN); + + /* + * Workaround for OWL 1.0 calibration failure; enable multi-chain; + * then set true mask after calibration. + */ + if (IS_5416V1(ah) && (rx_chainmask == 0x5 || rx_chainmask == 0x3)) { + OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, 0x7); + OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, 0x7); + } else { + OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, AH5416(ah)->ah_rx_chainmask); + OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, AH5416(ah)->ah_rx_chainmask); + } OS_REG_WRITE(ah, AR_SELFGEN_MASK, AH5416(ah)->ah_tx_chainmask); + if (AH5416(ah)->ah_tx_chainmask == 0x5) + OS_REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN); + if (AR_SREV_HOWL(ah)) { OS_REG_WRITE(ah, AR_PHY_ANALOG_SWAP, OS_REG_READ(ah, AR_PHY_ANALOG_SWAP) | 0x00000001); } } +/* + * Work-around for Owl 1.0 calibration failure. + * + * ar5416InitChainMasks sets the RX chainmask to 0x7 if it's Owl 1.0 + * due to init calibration failures. ar5416RestoreChainMask restores + * these registers to the correct setting. + */ void ar5416RestoreChainMask(struct ath_hal *ah) { int rx_chainmask = AH5416(ah)->ah_rx_chainmask; - if ((rx_chainmask == 0x5) || (rx_chainmask == 0x3)) { + if (IS_5416V1(ah) && (rx_chainmask == 0x5 || rx_chainmask == 0x3)) { OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx_chainmask); OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx_chainmask); } @@ -2488,17 +2517,17 @@ ar5416OverrideIni(struct ath_hal *ah, co */ OS_REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); - if (AR_SREV_MERLIN_20_OR_LATER(ah)) { - val = OS_REG_READ(ah, AR_PCU_MISC_MODE2); + if (AR_SREV_MERLIN_10_OR_LATER(ah)) { + val = OS_REG_READ(ah, AR_PCU_MISC_MODE2); + val &= (~AR_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE); + if (!AR_SREV_9271(ah)) + val &= ~AR_PCU_MISC_MODE2_HWWAR1; - if (!AR_SREV_9271(ah)) - val &= ~AR_PCU_MISC_MODE2_HWWAR1; + if (AR_SREV_9287_11_OR_LATER(ah)) + val = val & (~AR_PCU_MISC_MODE2_HWWAR2); - if (AR_SREV_9287_11_OR_LATER(ah)) - val = val & (~AR_PCU_MISC_MODE2_HWWAR2); - - OS_REG_WRITE(ah, AR_PCU_MISC_MODE2, val); - } + OS_REG_WRITE(ah, AR_PCU_MISC_MODE2, val); + } /* * Disable RIFS search on some chips to avoid baseband Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416reg.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Sun May 8 14:56:02 2011 (r221664) @@ -535,6 +535,12 @@ #define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002 #define AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT 0x00000004 +/* + * This bit enables the Multicast search based on both MAC Address and Key ID. + * If bit is 0, then Multicast search is based on MAC address only. + * For Merlin and above only. + */ +#define AR_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE 0x00000040 #define AR_PCU_MISC_MODE2_HWWAR1 0x00100000 #define AR_PCU_MISC_MODE2_HWWAR2 0x02000000 Modified: projects/largeSMP/sys/dev/iwn/if_iwn.c ============================================================================== --- projects/largeSMP/sys/dev/iwn/if_iwn.c Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sys/dev/iwn/if_iwn.c Sun May 8 14:56:02 2011 (r221664) @@ -92,8 +92,10 @@ static const struct iwn_ident iwn_ident_ { 0x8086, 0x4229, "Intel(R) Wireless WiFi Link 4965" }, { 0x8086, 0x422b, "Intel(R) Centrino(R) Ultimate-N 6300" }, { 0x8086, 0x422c, "Intel(R) Centrino(R) Advanced-N 6200" }, + { 0x8086, 0x422d, "Intel(R) Wireless WiFi Link 4965" }, { 0x8086, 0x4230, "Intel(R) Wireless WiFi Link 4965" }, { 0x8086, 0x4232, "Intel(R) WiFi Link 5100" }, + { 0x8086, 0x4233, "Intel(R) Wireless WiFi Link 4965" }, { 0x8086, 0x4235, "Intel(R) Ultimate N WiFi Link 5300" }, { 0x8086, 0x4236, "Intel(R) Ultimate N WiFi Link 5300" }, { 0x8086, 0x4237, "Intel(R) WiFi Link 5100" }, @@ -152,9 +154,7 @@ static void iwn4965_print_power_group(st static void iwn5000_read_eeprom(struct iwn_softc *); static uint32_t iwn_eeprom_channel_flags(struct iwn_eeprom_chan *); static void iwn_read_eeprom_band(struct iwn_softc *, int); -#if 0 /* HT */ static void iwn_read_eeprom_ht40(struct iwn_softc *, int); -#endif static void iwn_read_eeprom_channels(struct iwn_softc *, int, uint32_t); static struct iwn_eeprom_chan *iwn_find_eeprom_channel(struct iwn_softc *, struct ieee80211_channel *); @@ -172,10 +172,8 @@ static void iwn_rx_phy(struct iwn_softc struct iwn_rx_data *); static void iwn_rx_done(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); -#if 0 /* HT */ static void iwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); -#endif static void iwn5000_rx_calib_results(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); static void iwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *, @@ -186,6 +184,7 @@ static void iwn5000_tx_done(struct iwn_s struct iwn_rx_data *); static void iwn_tx_done(struct iwn_softc *, struct iwn_rx_desc *, int, uint8_t); +static void iwn_ampdu_tx_done(struct iwn_softc *, int, int, int, void *); static void iwn_cmd_done(struct iwn_softc *, struct iwn_rx_desc *); static void iwn_notif_intr(struct iwn_softc *); static void iwn_wakeup_intr(struct iwn_softc *); @@ -199,7 +198,6 @@ static void iwn5000_update_sched(struct #ifdef notyet static void iwn5000_reset_sched(struct iwn_softc *, int, int); #endif -static uint8_t iwn_plcp_signal(int); static int iwn_tx_data(struct iwn_softc *, struct mbuf *, struct ieee80211_node *); static int iwn_tx_data_raw(struct iwn_softc *, struct mbuf *, @@ -252,24 +250,26 @@ static uint8_t *ieee80211_add_ssid(uint8 static int iwn_scan(struct iwn_softc *); static int iwn_auth(struct iwn_softc *, struct ieee80211vap *vap); static int iwn_run(struct iwn_softc *, struct ieee80211vap *vap); -#if 0 /* HT */ -static int iwn_ampdu_rx_start(struct ieee80211com *, - struct ieee80211_node *, uint8_t); -static void iwn_ampdu_rx_stop(struct ieee80211com *, - struct ieee80211_node *, uint8_t); +static int iwn_ampdu_rx_start(struct ieee80211_node *, + struct ieee80211_rx_ampdu *, int, int, int); +static void iwn_ampdu_rx_stop(struct ieee80211_node *, + struct ieee80211_rx_ampdu *); +static int iwn_addba_request(struct ieee80211_node *, + struct ieee80211_tx_ampdu *, int, int, int); +static int iwn_addba_response(struct ieee80211_node *, + struct ieee80211_tx_ampdu *, int, int, int); static int iwn_ampdu_tx_start(struct ieee80211com *, struct ieee80211_node *, uint8_t); -static void iwn_ampdu_tx_stop(struct ieee80211com *, - struct ieee80211_node *, uint8_t); +static void iwn_ampdu_tx_stop(struct ieee80211_node *, + struct ieee80211_tx_ampdu *); static void iwn4965_ampdu_tx_start(struct iwn_softc *, - struct ieee80211_node *, uint8_t, uint16_t); -static void iwn4965_ampdu_tx_stop(struct iwn_softc *, + struct ieee80211_node *, int, uint8_t, uint16_t); +static void iwn4965_ampdu_tx_stop(struct iwn_softc *, int, uint8_t, uint16_t); static void iwn5000_ampdu_tx_start(struct iwn_softc *, - struct ieee80211_node *, uint8_t, uint16_t); -static void iwn5000_ampdu_tx_stop(struct iwn_softc *, + struct ieee80211_node *, int, uint8_t, uint16_t); +static void iwn5000_ampdu_tx_stop(struct iwn_softc *, int, uint8_t, uint16_t); -#endif static int iwn5000_query_calibration(struct iwn_softc *); static int iwn5000_send_calibration(struct iwn_softc *); static int iwn5000_send_wimax_coex(struct iwn_softc *); @@ -550,21 +550,6 @@ iwn_attach(device_t dev) /* Clear pending interrupts. */ IWN_WRITE(sc, IWN_INT, 0xffffffff); - /* Count the number of available chains. */ - sc->ntxchains = - ((sc->txchainmask >> 2) & 1) + - ((sc->txchainmask >> 1) & 1) + - ((sc->txchainmask >> 0) & 1); - sc->nrxchains = - ((sc->rxchainmask >> 2) & 1) + - ((sc->rxchainmask >> 1) & 1) + - ((sc->rxchainmask >> 0) & 1); - if (bootverbose) { - device_printf(dev, "MIMO %dT%dR, %.4s, address %6D\n", - sc->ntxchains, sc->nrxchains, sc->eeprom_domain, - macaddr, ":"); - } - ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); if (ifp == NULL) { device_printf(dev, "can not allocate ifnet structure\n"); @@ -584,42 +569,13 @@ iwn_attach(device_t dev) | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_WPA | IEEE80211_C_SHPREAMBLE /* short preamble supported */ - | IEEE80211_C_BGSCAN /* background scanning */ #if 0 | IEEE80211_C_IBSS /* ibss/adhoc mode */ #endif | IEEE80211_C_WME /* WME */ ; -#if 0 /* HT */ - /* XXX disable until HT channel setup works */ - ic->ic_htcaps = - IEEE80211_HTCAP_SMPS_ENA /* SM PS mode enabled */ - | IEEE80211_HTCAP_CHWIDTH40 /* 40MHz channel width */ - | IEEE80211_HTCAP_SHORTGI20 /* short GI in 20MHz */ - | IEEE80211_HTCAP_SHORTGI40 /* short GI in 40MHz */ - | IEEE80211_HTCAP_RXSTBC_2STREAM/* 1-2 spatial streams */ - | IEEE80211_HTCAP_MAXAMSDU_3839 /* max A-MSDU length */ - /* s/w capabilities */ - | IEEE80211_HTC_HT /* HT operation */ - | IEEE80211_HTC_AMPDU /* tx A-MPDU */ - | IEEE80211_HTC_AMSDU /* tx A-MSDU */ - ; - - /* Set HT capabilities. */ - ic->ic_htcaps = -#if IWN_RBUF_SIZE == 8192 - IEEE80211_HTCAP_AMSDU7935 | -#endif - IEEE80211_HTCAP_CBW20_40 | - IEEE80211_HTCAP_SGI20 | - IEEE80211_HTCAP_SGI40; if (sc->hw_type != IWN_HW_REV_TYPE_4965) - ic->ic_htcaps |= IEEE80211_HTCAP_GF; - if (sc->hw_type == IWN_HW_REV_TYPE_6050) - ic->ic_htcaps |= IEEE80211_HTCAP_SMPS_DYN; - else - ic->ic_htcaps |= IEEE80211_HTCAP_SMPS_DIS; -#endif + ic->ic_caps |= IEEE80211_C_BGSCAN; /* background scanning */ /* Read MAC address, channels, etc from EEPROM. */ if ((error = iwn_read_eeprom(sc, macaddr)) != 0) { @@ -628,14 +584,45 @@ iwn_attach(device_t dev) goto fail; } -#if 0 /* HT */ - /* Set supported HT rates. */ - ic->ic_sup_mcs[0] = 0xff; - if (sc->nrxchains > 1) - ic->ic_sup_mcs[1] = 0xff; - if (sc->nrxchains > 2) - ic->ic_sup_mcs[2] = 0xff; + /* Count the number of available chains. */ + sc->ntxchains = + ((sc->txchainmask >> 2) & 1) + + ((sc->txchainmask >> 1) & 1) + + ((sc->txchainmask >> 0) & 1); + sc->nrxchains = + ((sc->rxchainmask >> 2) & 1) + + ((sc->rxchainmask >> 1) & 1) + + ((sc->rxchainmask >> 0) & 1); + if (bootverbose) { + device_printf(dev, "MIMO %dT%dR, %.4s, address %6D\n", + sc->ntxchains, sc->nrxchains, sc->eeprom_domain, + macaddr, ":"); + } + + if (sc->sc_flags & IWN_FLAG_HAS_11N) { + ic->ic_rxstream = sc->nrxchains; + ic->ic_txstream = sc->ntxchains; + ic->ic_htcaps = + IEEE80211_HTCAP_SMPS_OFF /* SMPS mode disabled */ + | IEEE80211_HTCAP_SHORTGI20 /* short GI in 20MHz */ +#ifdef notyet + | IEEE80211_HTCAP_CHWIDTH40 /* 40MHz channel width*/ + | IEEE80211_HTCAP_SHORTGI40 /* short GI in 40MHz */ + | IEEE80211_HTCAP_GREENFIELD +#if IWN_RBUF_SIZE == 8192 + | IEEE80211_HTCAP_MAXAMSDU_7935 /* max A-MSDU length */ +#else + | IEEE80211_HTCAP_MAXAMSDU_3839 /* max A-MSDU length */ +#endif +#endif + /* s/w capabilities */ + | IEEE80211_HTC_HT /* HT operation */ + | IEEE80211_HTC_AMPDU /* tx A-MPDU */ +#ifdef notyet + | IEEE80211_HTC_AMSDU /* tx A-MSDU */ #endif + ; + } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_softc = sc; @@ -652,12 +639,16 @@ iwn_attach(device_t dev) ic->ic_vap_delete = iwn_vap_delete; ic->ic_raw_xmit = iwn_raw_xmit; ic->ic_node_alloc = iwn_node_alloc; -#if 0 /* HT */ + sc->sc_ampdu_rx_start = ic->ic_ampdu_rx_start; ic->ic_ampdu_rx_start = iwn_ampdu_rx_start; + sc->sc_ampdu_rx_stop = ic->ic_ampdu_rx_stop; ic->ic_ampdu_rx_stop = iwn_ampdu_rx_stop; - ic->ic_ampdu_tx_start = iwn_ampdu_tx_start; - ic->ic_ampdu_tx_stop = iwn_ampdu_tx_stop; -#endif + sc->sc_addba_request = ic->ic_addba_request; + ic->ic_addba_request = iwn_addba_request; + sc->sc_addba_response = ic->ic_addba_response; + ic->ic_addba_response = iwn_addba_response; + sc->sc_addba_stop = ic->ic_addba_stop; + ic->ic_addba_stop = iwn_ampdu_tx_stop; ic->ic_newassoc = iwn_newassoc; ic->ic_wme.wme_update = iwn_updateedca; ic->ic_update_mcast = iwn_update_mcast; @@ -714,11 +705,10 @@ iwn4965_attach(struct iwn_softc *sc, uin ops->set_gains = iwn4965_set_gains; ops->add_node = iwn4965_add_node; ops->tx_done = iwn4965_tx_done; -#if 0 /* HT */ ops->ampdu_tx_start = iwn4965_ampdu_tx_start; ops->ampdu_tx_stop = iwn4965_ampdu_tx_stop; -#endif sc->ntxqs = IWN4965_NTXQUEUES; + sc->firstaggqueue = IWN4965_FIRSTAGGQUEUE; sc->ndmachnls = IWN4965_NDMACHNLS; sc->broadcast_id = IWN4965_ID_BROADCAST; sc->rxonsz = IWN4965_RXONSZ; @@ -753,11 +743,10 @@ iwn5000_attach(struct iwn_softc *sc, uin ops->set_gains = iwn5000_set_gains; ops->add_node = iwn5000_add_node; ops->tx_done = iwn5000_tx_done; -#if 0 /* HT */ ops->ampdu_tx_start = iwn5000_ampdu_tx_start; ops->ampdu_tx_stop = iwn5000_ampdu_tx_stop; -#endif sc->ntxqs = IWN5000_NTXQUEUES; + sc->firstaggqueue = IWN5000_FIRSTAGGQUEUE; sc->ndmachnls = IWN5000_NDMACHNLS; sc->broadcast_id = IWN5000_ID_BROADCAST; sc->rxonsz = IWN5000_RXONSZ; @@ -1489,13 +1478,6 @@ iwn_alloc_tx_ring(struct iwn_softc *sc, __func__, error); goto fail; } - /* - * We only use rings 0 through 4 (4 EDCA + cmd) so there is no need - * to allocate commands space for other rings. - * XXX Do we really need to allocate descriptors for other rings? - */ - if (qid > 4) - return 0; size = IWN_TX_RING_COUNT * sizeof (struct iwn_tx_cmd); error = iwn_dma_contig_alloc(sc, &ring->cmd_dma, (void **)&ring->cmd, @@ -1694,7 +1676,7 @@ iwn4965_read_eeprom(struct iwn_softc *sc iwn_read_prom_data(sc, IWN4965_EEPROM_DOMAIN, sc->eeprom_domain, 4); /* Read the list of authorized channels (20MHz ones only). */ - for (i = 0; i < 5; i++) { + for (i = 0; i < 7; i++) { addr = iwn4965_regulatory_bands[i]; iwn_read_eeprom_channels(sc, i, addr); } @@ -1781,8 +1763,11 @@ iwn5000_read_eeprom(struct iwn_softc *sc sc->eeprom_domain, 4); /* Read the list of authorized channels (20MHz ones only). */ - for (i = 0; i < 5; i++) { - addr = base + iwn5000_regulatory_bands[i]; + for (i = 0; i < 7; i++) { + if (sc->hw_type >= IWN_HW_REV_TYPE_6000) + addr = base + iwn6000_regulatory_bands[i]; + else + addr = base + iwn5000_regulatory_bands[i]; iwn_read_eeprom_channels(sc, i, addr); } @@ -1884,18 +1869,15 @@ iwn_read_eeprom_band(struct iwn_softc *s "add chan %d flags 0x%x maxpwr %d\n", chan, channels[i].flags, channels[i].maxpwr); -#if 0 /* HT */ - /* XXX no constraints on using HT20 */ - /* add HT20, HT40 added separately */ - c = &ic->ic_channels[ic->ic_nchans++]; - c[0] = c[-1]; - c->ic_flags |= IEEE80211_CHAN_HT20; - /* XXX NARROW =>'s 1/2 and 1/4 width? */ -#endif + if (sc->sc_flags & IWN_FLAG_HAS_11N) { + /* add HT20, HT40 added separately */ + c = &ic->ic_channels[ic->ic_nchans++]; + c[0] = c[-1]; + c->ic_flags |= IEEE80211_CHAN_HT20; + } } } -#if 0 /* HT */ static void iwn_read_eeprom_ht40(struct iwn_softc *sc, int n) { @@ -1904,55 +1886,59 @@ iwn_read_eeprom_ht40(struct iwn_softc *s struct iwn_eeprom_chan *channels = sc->eeprom_channels[n]; const struct iwn_chan_band *band = &iwn_bands[n]; struct ieee80211_channel *c, *cent, *extc; - int i; + uint8_t chan; + int i, nflags; + + if (!(sc->sc_flags & IWN_FLAG_HAS_11N)) + return; for (i = 0; i < band->nchan; i++) { - if (!(channels[i].flags & IWN_EEPROM_CHAN_VALID) || - !(channels[i].flags & IWN_EEPROM_CHAN_WIDE)) { + if (!(channels[i].flags & IWN_EEPROM_CHAN_VALID)) { DPRINTF(sc, IWN_DEBUG_RESET, "skip chan %d flags 0x%x maxpwr %d\n", band->chan[i], channels[i].flags, channels[i].maxpwr); continue; } + chan = band->chan[i]; + nflags = iwn_eeprom_channel_flags(&channels[i]); + /* * Each entry defines an HT40 channel pair; find the * center channel, then the extension channel above. */ - cent = ieee80211_find_channel_byieee(ic, band->chan[i], - band->flags & ~IEEE80211_CHAN_HT); + cent = ieee80211_find_channel_byieee(ic, chan, + (n == 5 ? IEEE80211_CHAN_G : IEEE80211_CHAN_A)); if (cent == NULL) { /* XXX shouldn't happen */ device_printf(sc->sc_dev, - "%s: no entry for channel %d\n", - __func__, band->chan[i]); + "%s: no entry for channel %d\n", __func__, chan); continue; } extc = ieee80211_find_channel(ic, cent->ic_freq+20, - band->flags & ~IEEE80211_CHAN_HT); + (n == 5 ? IEEE80211_CHAN_G : IEEE80211_CHAN_A)); if (extc == NULL) { DPRINTF(sc, IWN_DEBUG_RESET, - "skip chan %d, extension channel not found\n", - band->chan[i]); + "%s: skip chan %d, extension channel not found\n", + __func__, chan); continue; } DPRINTF(sc, IWN_DEBUG_RESET, "add ht40 chan %d flags 0x%x maxpwr %d\n", - band->chan[i], channels[i].flags, channels[i].maxpwr); + chan, channels[i].flags, channels[i].maxpwr); c = &ic->ic_channels[ic->ic_nchans++]; c[0] = cent[0]; c->ic_extieee = extc->ic_ieee; c->ic_flags &= ~IEEE80211_CHAN_HT; - c->ic_flags |= IEEE80211_CHAN_HT40U; + c->ic_flags |= IEEE80211_CHAN_HT40U | nflags; c = &ic->ic_channels[ic->ic_nchans++]; c[0] = extc[0]; c->ic_extieee = cent->ic_ieee; c->ic_flags &= ~IEEE80211_CHAN_HT; - c->ic_flags |= IEEE80211_CHAN_HT40D; + c->ic_flags |= IEEE80211_CHAN_HT40D | nflags; } } -#endif static void iwn_read_eeprom_channels(struct iwn_softc *sc, int n, uint32_t addr) @@ -1965,25 +1951,34 @@ iwn_read_eeprom_channels(struct iwn_soft if (n < 5) iwn_read_eeprom_band(sc, n); -#if 0 /* HT */ else iwn_read_eeprom_ht40(sc, n); -#endif ieee80211_sort_channels(ic->ic_channels, ic->ic_nchans); } static struct iwn_eeprom_chan * iwn_find_eeprom_channel(struct iwn_softc *sc, struct ieee80211_channel *c) { - int i, j; + int band, chan, i, j; - for (j = 0; j < 7; j++) { - for (i = 0; i < iwn_bands[j].nchan; i++) { - if (iwn_bands[j].chan[i] == c->ic_ieee) - return &sc->eeprom_channels[j][i]; + if (IEEE80211_IS_CHAN_HT40(c)) { + band = IEEE80211_IS_CHAN_5GHZ(c) ? 6 : 5; + if (IEEE80211_IS_CHAN_HT40D(c)) + chan = c->ic_extieee; + else + chan = c->ic_ieee; + for (i = 0; i < iwn_bands[band].nchan; i++) { + if (iwn_bands[band].chan[i] == chan) + return &sc->eeprom_channels[band][i]; + } + } else { + for (j = 0; j < 5; j++) { + for (i = 0; i < iwn_bands[j].nchan; i++) { + if (iwn_bands[j].chan[i] == c->ic_ieee) + return &sc->eeprom_channels[j][i]; + } } } - return NULL; } @@ -2020,18 +2015,22 @@ static void iwn_read_eeprom_enhinfo(struct iwn_softc *sc) { struct iwn_eeprom_enhinfo enhinfo[35]; + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211_channel *c; uint16_t val, base; int8_t maxpwr; - int i; + uint8_t flags; + int i, j; iwn_read_prom_data(sc, IWN5000_EEPROM_REG, &val, 2); base = le16toh(val); iwn_read_prom_data(sc, base + IWN6000_EEPROM_ENHINFO, enhinfo, sizeof enhinfo); - memset(sc->enh_maxpwr, 0, sizeof sc->enh_maxpwr); for (i = 0; i < nitems(enhinfo); i++) { - if (enhinfo[i].chan == 0 || enhinfo[i].reserved != 0) + flags = enhinfo[i].flags; + if (!(flags & IWN_ENHINFO_VALID)) continue; /* Skip invalid entries. */ maxpwr = 0; @@ -2045,11 +2044,34 @@ iwn_read_eeprom_enhinfo(struct iwn_softc maxpwr = MAX(maxpwr, enhinfo[i].mimo2); else if (sc->ntxchains == 3) maxpwr = MAX(maxpwr, enhinfo[i].mimo3); - maxpwr /= 2; /* Convert half-dBm to dBm. */ - DPRINTF(sc, IWN_DEBUG_RESET, "enhinfo %d, maxpwr=%d\n", i, - maxpwr); - sc->enh_maxpwr[i] = maxpwr; + for (j = 0; j < ic->ic_nchans; j++) { + c = &ic->ic_channels[j]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***