1
0
Files
Greg Kroah-Hartman ef1453a447 Merge 4.9.137 into android-4.9
Changes in 4.9.137
	bcache: fix miss key refill->end in writeback
	hwmon: (pmbus) Fix page count auto-detection.
	jffs2: free jffs2_sb_info through jffs2_kill_sb()
	pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges
	ipmi: Fix timer race with module unload
	parisc: Fix address in HPMC IVA
	parisc: Fix map_pages() to not overwrite existing pte entries
	ALSA: hda - Add quirk for ASUS G751 laptop
	ALSA: hda - Fix headphone pin config for ASUS G751
	ALSA: hda - Add mic quirk for the Lenovo G50-30 (17aa:3905)
	ALSA: ca0106: Disable IZD on SB0570 DAC to fix audio pops
	x86/speculation: Enable cross-hyperthread spectre v2 STIBP mitigation
	x86/corruption-check: Fix panic in memory_corruption_check() when boot option without value is provided
	x86/speculation: Support Enhanced IBRS on future CPUs
	bpf: do not blindly change rlimit in reuseport net selftest
	Revert "perf tools: Fix PMU term format max value calculation"
	xfrm: policy: use hlist rcu variants on insert
	sparc: Fix single-pcr perf event counter management.
	sparc64: Make proc_id signed.
	sched/fair: Fix the min_vruntime update logic in dequeue_entity()
	perf cpu_map: Align cpu map synthesized events properly.
	x86/fpu: Remove second definition of fpu in __fpu__restore_sig()
	net: qla3xxx: Remove overflowing shift statement
	selftests: ftrace: Add synthetic event syntax testcase
	i2c: rcar: cleanup DMA for all kinds of failure
	locking/lockdep: Fix debug_locks off performance problem
	ataflop: fix error handling during setup
	swim: fix cleanup on setup error
	tun: Consistently configure generic netdev params via rtnetlink
	s390/sthyi: Fix machine name validity indication
	hwmon: (pwm-fan) Set fan speed to 0 on suspend
	perf tools: Free temporary 'sys' string in read_event_files()
	perf tools: Cleanup trace-event-info 'tdata' leak
	perf strbuf: Match va_{add,copy} with va_end
	mmc: sdhci-pci-o2micro: Add quirk for O2 Micro dev 0x8620 rev 0x01
	iwlwifi: pcie: avoid empty free RB queue
	x86/olpc: Indicate that legacy PC XO-1 platform should not register RTC
	cpufreq: dt: Try freeing static OPPs only if we have added them
	Bluetooth: btbcm: Add entry for BCM4335C0 UART bluetooth
	x86: boot: Fix EFI stub alignment
	pinctrl: qcom: spmi-mpp: Fix err handling of pmic_mpp_set_mux
	brcmfmac: fix for proper support of 160MHz bandwidth
	kprobes: Return error if we fail to reuse kprobe instead of BUG_ON()
	ACPI / LPSS: Add alternative ACPI HIDs for Cherry Trail DMA controllers
	pinctrl: qcom: spmi-mpp: Fix drive strength setting
	pinctrl: spmi-mpp: Fix pmic_mpp_config_get() to be compliant
	pinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() to be compliant
	ixgbevf: VF2VF TCP RSS
	ath10k: schedule hardware restart if WMI command times out
	cgroup, netclassid: add a preemption point to write_classid
	scsi: esp_scsi: Track residual for PIO transfers
	scsi: megaraid_sas: fix a missing-check bug
	RDMA/core: Do not expose unsupported counters
	IB/ipoib: Clear IPCB before icmp_send
	tpm: suppress transmit cmd error logs when TPM 1.2 is disabled/deactivated
	VMCI: Resource wildcard match fixed
	usb: gadget: udc: atmel: handle at91sam9rl PMC
	ext4: fix argument checking in EXT4_IOC_MOVE_EXT
	MD: fix invalid stored role for a disk
	PCI/MSI: Warn and return error if driver enables MSI/MSI-X twice
	coresight: etb10: Fix handling of perf mode
	crypto: caam - fix implicit casts in endianness helpers
	usb: chipidea: Prevent unbalanced IRQ disable
	driver/dma/ioat: Call del_timer_sync() without holding prep_lock
	uio: ensure class is registered before devices
	scsi: lpfc: Correct soft lockup when running mds diagnostics
	signal: Always deliver the kernel's SIGKILL and SIGSTOP to a pid namespace init
	dmaengine: dma-jz4780: Return error if not probed from DT
	ALSA: hda: Check the non-cached stream buffers more explicitly
	ARM: dts: exynos: Remove "cooling-{min|max}-level" for CPU nodes
	arm: dts: exynos: Add missing cooling device properties for CPUs
	ARM: dts: exynos: Convert exynos5250.dtsi to opp-v2 bindings
	ARM: dts: exynos: Mark 1 GHz CPU OPP as suspend OPP on Exynos5250
	xen-swiotlb: use actually allocated size on check physical continuous
	tpm: Restore functionality to xen vtpm driver.
	xen/blkfront: avoid NULL blkfront_info dereference on device removal
	xen: fix race in xen_qlock_wait()
	xen: make xen_qlock_wait() nestable
	libertas: don't set URB_ZERO_PACKET on IN USB transfer
	usbip:vudc: BUG kmalloc-2048 (Not tainted): Poison overwritten
	iwlwifi: mvm: check return value of rs_rate_from_ucode_rate()
	net/ipv4: defensive cipso option parsing
	libnvdimm: Hold reference on parent while scheduling async init
	ASoC: intel: skylake: Add missing break in skl_tplg_get_token()
	jbd2: fix use after free in jbd2_log_do_checkpoint()
	gfs2_meta: ->mount() can get NULL dev_name
	ext4: initialize retries variable in ext4_da_write_inline_data_begin()
	ext4: propagate error from dquot_initialize() in EXT4_IOC_FSSETXATTR
	HID: hiddev: fix potential Spectre v1
	EDAC, {i7core,sb,skx}_edac: Fix uncorrected error counting
	EDAC, skx_edac: Fix logical channel intermediate decoding
	PCI: Add Device IDs for Intel GPU "spurious interrupt" quirk
	signal/GenWQE: Fix sending of SIGKILL
	crypto: lrw - Fix out-of bounds access on counter overflow
	crypto: tcrypt - fix ghash-generic speed test
	ima: fix showing large 'violations' or 'runtime_measurements_count'
	hugetlbfs: dirty pages as they are added to pagecache
	kbuild: fix kernel/bounds.c 'W=1' warning
	iio: ad5064: Fix regulator handling
	iio: adc: imx25-gcq: Fix leak of device_node in mx25_gcq_setup_cfgs()
	iio: adc: at91: fix acking DRDY irq on simple conversions
	iio: adc: at91: fix wrong channel number in triggered buffer mode
	w1: omap-hdq: fix missing bus unregister at removal
	smb3: allow stats which track session and share reconnects to be reset
	smb3: do not attempt cifs operation in smb3 query info error path
	smb3: on kerberos mount if server doesn't specify auth type use krb5
	printk: Fix panic caused by passing log_buf_len to command line
	genirq: Fix race on spurious interrupt detection
	NFSv4.1: Fix the r/wsize checking
	nfsd: Fix an Oops in free_session()
	lockd: fix access beyond unterminated strings in prints
	dm ioctl: harden copy_params()'s copy_from_user() from malicious users
	powerpc/msi: Fix compile error on mpc83xx
	MIPS: OCTEON: fix out of bounds array access on CN68XX
	TC: Set DMA masks for devices
	media: v4l2-tpg: fix kernel oops when enabling HFLIP and OSD
	kgdboc: Passing ekgdboc to command line causes panic
	xen: fix xen_qlock_wait()
	media: em28xx: use a default format if TRY_FMT fails
	media: tvp5150: avoid going past array on v4l2_querymenu()
	media: em28xx: fix input name for Terratec AV 350
	media: em28xx: make v4l2-compliance happier by starting sequence on zero
	arm64: lse: remove -fcall-used-x0 flag
	rpmsg: smd: fix memory leak on channel create
	Cramfs: fix abad comparison when wrap-arounds occur
	arm64: dts: stratix10: Correct System Manager register size
	soc/tegra: pmc: Fix child-node lookup
	btrfs: Handle owner mismatch gracefully when walking up tree
	btrfs: locking: Add extra check in btrfs_init_new_buffer() to avoid deadlock
	btrfs: fix error handling in free_log_tree
	btrfs: iterate all devices during trim, instead of fs_devices::alloc_list
	btrfs: don't attempt to trim devices that don't support it
	btrfs: wait on caching when putting the bg cache
	btrfs: reset max_extent_size on clear in a bitmap
	btrfs: make sure we create all new block groups
	Btrfs: fix wrong dentries after fsync of file that got its parent replaced
	btrfs: qgroup: Dirty all qgroups before rescan
	Btrfs: fix null pointer dereference on compressed write path error
	btrfs: set max_extent_size properly
	MD: fix invalid stored role for a disk - try2
	Linux 4.9.137

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2019-02-11 22:53:25 +03:00

256 lines
8.1 KiB
C

/*
* Copyright (c) 2010 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _BRCMU_WIFI_H_
#define _BRCMU_WIFI_H_
#include <linux/if_ether.h> /* for ETH_ALEN */
#include <linux/ieee80211.h> /* for WLAN_PMKID_LEN */
/*
* A chanspec (u16) holds the channel number, band, bandwidth and control
* sideband
*/
/* channel defines */
#define CH_UPPER_SB 0x01
#define CH_LOWER_SB 0x02
#define CH_EWA_VALID 0x04
#define CH_70MHZ_APART 14
#define CH_50MHZ_APART 10
#define CH_30MHZ_APART 6
#define CH_20MHZ_APART 4
#define CH_10MHZ_APART 2
#define CH_5MHZ_APART 1 /* 2G band channels are 5 Mhz apart */
#define CH_MIN_2G_CHANNEL 1
#define CH_MAX_2G_CHANNEL 14 /* Max channel in 2G band */
#define CH_MIN_5G_CHANNEL 34
/* bandstate array indices */
#define BAND_2G_INDEX 0 /* wlc->bandstate[x] index */
#define BAND_5G_INDEX 1 /* wlc->bandstate[x] index */
/*
* max # supported channels. The max channel no is 216, this is that + 1
* rounded up to a multiple of NBBY (8). DO NOT MAKE it > 255: channels are
* u8's all over
*/
#define MAXCHANNEL 224
#define WL_CHANSPEC_CHAN_MASK 0x00ff
#define WL_CHANSPEC_CHAN_SHIFT 0
#define WL_CHANSPEC_CTL_SB_MASK 0x0300
#define WL_CHANSPEC_CTL_SB_SHIFT 8
#define WL_CHANSPEC_CTL_SB_LOWER 0x0100
#define WL_CHANSPEC_CTL_SB_UPPER 0x0200
#define WL_CHANSPEC_CTL_SB_NONE 0x0300
#define WL_CHANSPEC_BW_MASK 0x0C00
#define WL_CHANSPEC_BW_SHIFT 10
#define WL_CHANSPEC_BW_10 0x0400
#define WL_CHANSPEC_BW_20 0x0800
#define WL_CHANSPEC_BW_40 0x0C00
#define WL_CHANSPEC_BW_80 0x2000
#define WL_CHANSPEC_BAND_MASK 0xf000
#define WL_CHANSPEC_BAND_SHIFT 12
#define WL_CHANSPEC_BAND_5G 0x1000
#define WL_CHANSPEC_BAND_2G 0x2000
#define INVCHANSPEC 255
#define WL_CHAN_VALID_HW (1 << 0) /* valid with current HW */
#define WL_CHAN_VALID_SW (1 << 1) /* valid with country sett. */
#define WL_CHAN_BAND_5G (1 << 2) /* 5GHz-band channel */
#define WL_CHAN_RADAR (1 << 3) /* radar sensitive channel */
#define WL_CHAN_INACTIVE (1 << 4) /* inactive due to radar */
#define WL_CHAN_PASSIVE (1 << 5) /* channel in passive mode */
#define WL_CHAN_RESTRICTED (1 << 6) /* restricted use channel */
/* values for band specific 40MHz capabilities */
#define WLC_N_BW_20ALL 0
#define WLC_N_BW_40ALL 1
#define WLC_N_BW_20IN2G_40IN5G 2
#define WLC_BW_20MHZ_BIT BIT(0)
#define WLC_BW_40MHZ_BIT BIT(1)
#define WLC_BW_80MHZ_BIT BIT(2)
#define WLC_BW_160MHZ_BIT BIT(3)
/* Bandwidth capabilities */
#define WLC_BW_CAP_20MHZ (WLC_BW_20MHZ_BIT)
#define WLC_BW_CAP_40MHZ (WLC_BW_40MHZ_BIT|WLC_BW_20MHZ_BIT)
#define WLC_BW_CAP_80MHZ (WLC_BW_80MHZ_BIT|WLC_BW_40MHZ_BIT| \
WLC_BW_20MHZ_BIT)
#define WLC_BW_CAP_160MHZ (WLC_BW_160MHZ_BIT|WLC_BW_80MHZ_BIT| \
WLC_BW_40MHZ_BIT|WLC_BW_20MHZ_BIT)
#define WLC_BW_CAP_UNRESTRICTED 0xFF
/* band types */
#define WLC_BAND_AUTO 0 /* auto-select */
#define WLC_BAND_5G 1 /* 5 Ghz */
#define WLC_BAND_2G 2 /* 2.4 Ghz */
#define WLC_BAND_ALL 3 /* all bands */
#define CHSPEC_CHANNEL(chspec) ((u8)((chspec) & WL_CHANSPEC_CHAN_MASK))
#define CHSPEC_BAND(chspec) ((chspec) & WL_CHANSPEC_BAND_MASK)
#define CHSPEC_CTL_SB(chspec) ((chspec) & WL_CHANSPEC_CTL_SB_MASK)
#define CHSPEC_BW(chspec) ((chspec) & WL_CHANSPEC_BW_MASK)
#define CHSPEC_IS10(chspec) \
(((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_10)
#define CHSPEC_IS20(chspec) \
(((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_20)
#define CHSPEC_IS40(chspec) \
(((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_40)
#define CHSPEC_IS80(chspec) \
(((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_80)
#define CHSPEC_IS5G(chspec) \
(((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_5G)
#define CHSPEC_IS2G(chspec) \
(((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_2G)
#define CHSPEC_SB_NONE(chspec) \
(((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_NONE)
#define CHSPEC_SB_UPPER(chspec) \
(((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_UPPER)
#define CHSPEC_SB_LOWER(chspec) \
(((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_LOWER)
#define CHSPEC_CTL_CHAN(chspec) \
((CHSPEC_SB_LOWER(chspec)) ? \
(lower_20_sb(((chspec) & WL_CHANSPEC_CHAN_MASK))) : \
(upper_20_sb(((chspec) & WL_CHANSPEC_CHAN_MASK))))
#define CHSPEC2BAND(chspec) (CHSPEC_IS5G(chspec) ? BRCM_BAND_5G : BRCM_BAND_2G)
#define CHANSPEC_STR_LEN 8
static inline int lower_20_sb(int channel)
{
return channel > CH_10MHZ_APART ? (channel - CH_10MHZ_APART) : 0;
}
static inline int upper_20_sb(int channel)
{
return (channel < (MAXCHANNEL - CH_10MHZ_APART)) ?
channel + CH_10MHZ_APART : 0;
}
static inline int chspec_bandunit(u16 chspec)
{
return CHSPEC_IS5G(chspec) ? BAND_5G_INDEX : BAND_2G_INDEX;
}
static inline u16 ch20mhz_chspec(int channel)
{
u16 rc = channel <= CH_MAX_2G_CHANNEL ?
WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G;
return (u16)((u16)channel | WL_CHANSPEC_BW_20 |
WL_CHANSPEC_CTL_SB_NONE | rc);
}
static inline int next_20mhz_chan(int channel)
{
return channel < (MAXCHANNEL - CH_20MHZ_APART) ?
channel + CH_20MHZ_APART : 0;
}
/* defined rate in 500kbps */
#define BRCM_MAXRATE 108 /* in 500kbps units */
#define BRCM_RATE_1M 2 /* in 500kbps units */
#define BRCM_RATE_2M 4 /* in 500kbps units */
#define BRCM_RATE_5M5 11 /* in 500kbps units */
#define BRCM_RATE_11M 22 /* in 500kbps units */
#define BRCM_RATE_6M 12 /* in 500kbps units */
#define BRCM_RATE_9M 18 /* in 500kbps units */
#define BRCM_RATE_12M 24 /* in 500kbps units */
#define BRCM_RATE_18M 36 /* in 500kbps units */
#define BRCM_RATE_24M 48 /* in 500kbps units */
#define BRCM_RATE_36M 72 /* in 500kbps units */
#define BRCM_RATE_48M 96 /* in 500kbps units */
#define BRCM_RATE_54M 108 /* in 500kbps units */
#define BRCM_2G_25MHZ_OFFSET 5 /* 2.4GHz band channel offset */
#define MCSSET_LEN 16
static inline bool ac_bitmap_tst(u8 bitmap, int prec)
{
return (bitmap & (1 << (prec))) != 0;
}
/* Enumerate crypto algorithms */
#define CRYPTO_ALGO_OFF 0
#define CRYPTO_ALGO_WEP1 1
#define CRYPTO_ALGO_TKIP 2
#define CRYPTO_ALGO_WEP128 3
#define CRYPTO_ALGO_AES_CCM 4
#define CRYPTO_ALGO_AES_RESERVED1 5
#define CRYPTO_ALGO_AES_RESERVED2 6
#define CRYPTO_ALGO_NALG 7
/* wireless security bitvec */
#define WEP_ENABLED 0x0001
#define TKIP_ENABLED 0x0002
#define AES_ENABLED 0x0004
#define WSEC_SWFLAG 0x0008
/* to go into transition mode without setting wep */
#define SES_OW_ENABLED 0x0040
/* MFP */
#define MFP_CAPABLE 0x0200
#define MFP_REQUIRED 0x0400
/* WPA authentication mode bitvec */
#define WPA_AUTH_DISABLED 0x0000 /* Legacy (i.e., non-WPA) */
#define WPA_AUTH_NONE 0x0001 /* none (IBSS) */
#define WPA_AUTH_UNSPECIFIED 0x0002 /* over 802.1x */
#define WPA_AUTH_PSK 0x0004 /* Pre-shared key */
#define WPA_AUTH_RESERVED1 0x0008
#define WPA_AUTH_RESERVED2 0x0010
#define WPA2_AUTH_RESERVED1 0x0020
#define WPA2_AUTH_UNSPECIFIED 0x0040 /* over 802.1x */
#define WPA2_AUTH_PSK 0x0080 /* Pre-shared key */
#define WPA2_AUTH_RESERVED3 0x0200
#define WPA2_AUTH_RESERVED4 0x0400
#define WPA2_AUTH_RESERVED5 0x0800
#define WPA2_AUTH_1X_SHA256 0x1000 /* 1X with SHA256 key derivation */
#define WPA2_AUTH_PSK_SHA256 0x8000 /* PSK with SHA256 key derivation */
#define DOT11_DEFAULT_RTS_LEN 2347
#define DOT11_DEFAULT_FRAG_LEN 2346
#define DOT11_ICV_AES_LEN 8
#define DOT11_QOS_LEN 2
#define DOT11_IV_MAX_LEN 8
#define DOT11_A4_HDR_LEN 30
#define HT_CAP_RX_STBC_NO 0x0
#define HT_CAP_RX_STBC_ONE_STREAM 0x1
#endif /* _BRCMU_WIFI_H_ */