Author: weongyo
Date: Tue Feb 16 01:44:14 2010
New Revision: 203945
URL: http://svn.freebsd.org/changeset/base/203945

Log:
  adds bwn(4) driver for supporting Broadcom BCM43xx chipsets.
  
    o uses v4 firmware instead of v3.  A port will be committed to create
      the bwn firmware module.
    o supports B/G and LP(low power) PHYs.
    o supports 32 / 64 bits DMA operations.
    o tested on big / little endian machines so should work on all
      architectures.
  
  It'd not connected to the build until the firmware port is committed.

Added:
  head/share/man/man4/bwn.4   (contents, props changed)
  head/sys/dev/bwn/
  head/sys/dev/bwn/if_bwn.c   (contents, props changed)
  head/sys/dev/bwn/if_bwnreg.h   (contents, props changed)
  head/sys/dev/bwn/if_bwnvar.h   (contents, props changed)
  head/sys/modules/bwn/
  head/sys/modules/bwn/Makefile   (contents, props changed)

Added: head/share/man/man4/bwn.4
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/bwn.4   Tue Feb 16 01:44:14 2010        (r203945)
@@ -0,0 +1,134 @@
+.\" Copyright (c) 2009 Christian Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 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.
+.\"
+.\" 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 15, 2010
+.Dt BWN 4
+.Os
+.Sh NAME
+.Nm bwn
+.Nd Broadcom BCM43xx IEEE 802.11b/g wireless network driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device siba_bwn"
+.Cd "device bwn"
+.Cd "device wlan"
+.Cd "device wlan_amrr"
+.Cd "device firmware"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_bwn_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Broadcom BCM43xx based
+PCI/CardBus network adapters.
+.Pp
+It supports
+.Cm station
+and
+.Cm monitor
+mode operation.
+Only one virtual interface may be configured at any time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+This driver requires firmware to be loaded before it will work.
+The
+.Pa ports/net/bwn-firmware-kmod
+port needs to be installed before
+.Xr ifconfig 8
+will work.
+.Sh HARDWARE
+The
+.Nm
+driver supports Broadcom BCM43xx based wireless devices, including:
+.Pp
+.Bl -column -compact "Apple Airport Extreme" "BCM4306" "Mini PCI" "a/b/g" 
-offset 6n
+.It Em "Card   Chip    Bus     Standard"
+.It "Apple Airport Extreme     BCM4306 PCI     b/g"
+.It "Apple Airport Extreme     BCM4318 PCI     b/g"
+.It "ASUS WL-138g      BCM4318 PCI     b/g"
+.It "Buffalo WLI-CB-G54S       BCM4318 CardBus b/g"
+.It "Buffalo WLI-PCI-G54S      BCM4306 PCI     b/g"
+.It "Compaq R4035 onboard      BCM4306 PCI     b/g"
+.It "Dell Wireless 1470        BCM4318 Mini PCI        b/g"
+.It "Dell Truemobile 1400      BCM4309 Mini PCI        b/g"
+.It "HP nx6125 BCM4319 PCI     b/g"
+.It "Linksys WPC54G Ver 3      BCM4318 CardBus b/g"
+.It "Linksys WPC54GS Ver 2     BCM4318 CardBus b/g"
+.It "TRENDnet TEW-401PCplus    BCM4306 CardBus b/g"
+.It "US Robotics 5411  BCM4318 CardBus b/g"
+.El
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Pp
+.Bd -literal -offset indent
+ifconfig wlan create wlandev bwn0 inet 192.168.0.20 \e
+    netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan create wlandev bwn0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev bwn0 ssid my_net \e
+        wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr cardbus 4 ,
+.Xr intro 4 ,
+.Xr pci 4 ,
+.Xr wlan 4 ,
+.Xr wlan_amrr 4 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Weongyo Jeong
+.Aq weon...@freebsd.org .
+.\".Sh BUGS
+.\"Some card based on the BCM4306 and BCM4309 chips do not work properly
+.\"on channel 1, 2 and 3.

Added: head/sys/dev/bwn/if_bwn.c
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/bwn/if_bwn.c   Tue Feb 16 01:44:14 2010        (r203945)
@@ -0,0 +1,14317 @@
+/*-
+ * Copyright (c) 2009-2010 Weongyo Jeong <weon...@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *    redistribution must be conditioned upon including a substantially
+ *    similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * The Broadcom Wireless LAN controller driver.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/kernel.h>
+#include <sys/endian.h>
+#include <sys/errno.h>
+#include <sys/firmware.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/bus.h>
+#include <sys/rman.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
+#include <net/if_arp.h>
+#include <net/if_dl.h>
+#include <net/if_llc.h>
+#include <net/if_media.h>
+#include <net/if_types.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+#include <dev/siba/siba_ids.h>
+#include <dev/siba/sibareg.h>
+#include <dev/siba/sibavar.h>
+
+#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_radiotap.h>
+#include <net80211/ieee80211_regdomain.h>
+#include <net80211/ieee80211_amrr.h>
+#include <net80211/ieee80211_phy.h>
+
+#include <dev/bwn/if_bwnreg.h>
+#include <dev/bwn/if_bwnvar.h>
+
+SYSCTL_NODE(_hw, OID_AUTO, bwn, CTLFLAG_RD, 0, "Broadcom driver parameters");
+
+/*
+ * Tunable & sysctl variables.
+ */
+
+#ifdef BWN_DEBUG
+static int bwn_debug = 0;
+SYSCTL_INT(_hw_bwn, OID_AUTO, debug, CTLFLAG_RW, &bwn_debug, 0,
+    "Broadcom debugging printfs");
+TUNABLE_INT("hw.bwn.debug", &bwn_debug);
+enum {
+       BWN_DEBUG_XMIT          = 0x00000001,   /* basic xmit operation */
+       BWN_DEBUG_RECV          = 0x00000002,   /* basic recv operation */
+       BWN_DEBUG_STATE         = 0x00000004,   /* 802.11 state transitions */
+       BWN_DEBUG_TXPOW         = 0x00000008,   /* tx power processing */
+       BWN_DEBUG_RESET         = 0x00000010,   /* reset processing */
+       BWN_DEBUG_OPS           = 0x00000020,   /* bwn_ops processing */
+       BWN_DEBUG_BEACON        = 0x00000040,   /* beacon handling */
+       BWN_DEBUG_WATCHDOG      = 0x00000080,   /* watchdog timeout */
+       BWN_DEBUG_INTR          = 0x00000100,   /* ISR */
+       BWN_DEBUG_CALIBRATE     = 0x00000200,   /* periodic calibration */
+       BWN_DEBUG_NODE          = 0x00000400,   /* node management */
+       BWN_DEBUG_LED           = 0x00000800,   /* led management */
+       BWN_DEBUG_CMD           = 0x00001000,   /* cmd submission */
+       BWN_DEBUG_LO            = 0x00002000,   /* LO */
+       BWN_DEBUG_FW            = 0x00004000,   /* firmware */
+       BWN_DEBUG_WME           = 0x00008000,   /* WME */
+       BWN_DEBUG_RF            = 0x00010000,   /* RF */
+       BWN_DEBUG_FATAL         = 0x80000000,   /* fatal errors */
+       BWN_DEBUG_ANY           = 0xffffffff
+};
+#define        DPRINTF(sc, m, fmt, ...) do {                   \
+       if (sc->sc_debug & (m))                         \
+               printf(fmt, __VA_ARGS__);               \
+} while (0)
+#else
+#define        DPRINTF(sc, m, fmt, ...) do { (void) sc; } while (0)
+#endif
+
+static int     bwn_bfp = 0;            /* use "Bad Frames Preemption" */
+SYSCTL_INT(_hw_bwn, OID_AUTO, bfp, CTLFLAG_RW, &bwn_bfp, 0,
+    "uses Bad Frames Preemption");
+static int     bwn_bluetooth = 1;
+SYSCTL_INT(_hw_bwn, OID_AUTO, bluetooth, CTLFLAG_RW, &bwn_bluetooth, 0,
+    "turns on Bluetooth Coexistence");
+static int     bwn_hwpctl = 0;
+SYSCTL_INT(_hw_bwn, OID_AUTO, hwpctl, CTLFLAG_RW, &bwn_hwpctl, 0,
+    "uses H/W power control");
+static int     bwn_msi_disable = 0;            /* MSI disabled  */
+TUNABLE_INT("hw.bwn.msi_disable", &bwn_msi_disable);
+static int     bwn_usedma = 1;
+SYSCTL_INT(_hw_bwn, OID_AUTO, usedma, CTLFLAG_RD, &bwn_usedma, 0,
+    "uses DMA");
+TUNABLE_INT("hw.bwn.usedma", &bwn_usedma);
+static int     bwn_wme = 1;
+SYSCTL_INT(_hw_bwn, OID_AUTO, wme, CTLFLAG_RW, &bwn_wme, 0,
+    "uses WME support");
+
+static int     bwn_attach_pre(struct bwn_softc *);
+static int     bwn_attach_post(struct bwn_softc *);
+static void    bwn_sprom_bugfixes(struct siba_softc *);
+static void    bwn_init(void *);
+static int     bwn_init_locked(struct bwn_softc *);
+static int     bwn_ioctl(struct ifnet *, u_long, caddr_t);
+static void    bwn_start(struct ifnet *);
+static int     bwn_attach_core(struct bwn_mac *);
+static void    bwn_reset_core(struct bwn_mac *, uint32_t);
+static int     bwn_phy_getinfo(struct bwn_mac *, int);
+static int     bwn_chiptest(struct bwn_mac *);
+static int     bwn_setup_channels(struct bwn_mac *, int, int);
+static int     bwn_phy_g_attach(struct bwn_mac *);
+static void    bwn_phy_g_detach(struct bwn_mac *);
+static void    bwn_phy_g_init_pre(struct bwn_mac *);
+static int     bwn_phy_g_prepare_hw(struct bwn_mac *);
+static int     bwn_phy_g_init(struct bwn_mac *);
+static void    bwn_phy_g_exit(struct bwn_mac *);
+static uint16_t        bwn_phy_g_read(struct bwn_mac *, uint16_t);
+static void    bwn_phy_g_write(struct bwn_mac *, uint16_t,
+                   uint16_t);
+static uint16_t        bwn_phy_g_rf_read(struct bwn_mac *, uint16_t);
+static void    bwn_phy_g_rf_write(struct bwn_mac *, uint16_t,
+                   uint16_t);
+static int     bwn_phy_g_hwpctl(struct bwn_mac *);
+static void    bwn_phy_g_rf_onoff(struct bwn_mac *, int);
+static int     bwn_phy_g_switch_channel(struct bwn_mac *, uint32_t);
+static uint32_t        bwn_phy_g_get_default_chan(struct bwn_mac *);
+static void    bwn_phy_g_set_antenna(struct bwn_mac *, int);
+static int     bwn_phy_g_im(struct bwn_mac *, int);
+static int     bwn_phy_g_recalc_txpwr(struct bwn_mac *, int);
+static void    bwn_phy_g_set_txpwr(struct bwn_mac *);
+static void    bwn_phy_g_task_15s(struct bwn_mac *);
+static void    bwn_phy_g_task_60s(struct bwn_mac *);
+static uint16_t        bwn_phy_g_txctl(struct bwn_mac *);
+static void    bwn_phy_switch_analog(struct bwn_mac *, int);
+static uint16_t        bwn_shm_read_2(struct bwn_mac *, uint16_t, uint16_t);
+static void    bwn_shm_write_2(struct bwn_mac *, uint16_t, uint16_t,
+                   uint16_t);
+static uint32_t        bwn_shm_read_4(struct bwn_mac *, uint16_t, uint16_t);
+static void    bwn_shm_write_4(struct bwn_mac *, uint16_t, uint16_t,
+                   uint32_t);
+static void    bwn_shm_ctlword(struct bwn_mac *, uint16_t,
+                   uint16_t);
+static void    bwn_addchannels(struct ieee80211_channel [], int, int *,
+                   const struct bwn_channelinfo *, int);
+static int     bwn_raw_xmit(struct ieee80211_node *, struct mbuf *,
+                   const struct ieee80211_bpf_params *);
+static void    bwn_newassoc(struct ieee80211_node *, int);
+static void    bwn_updateslot(struct ifnet *);
+static void    bwn_update_promisc(struct ifnet *);
+static void    bwn_wme_init(struct bwn_mac *);
+static int     bwn_wme_update(struct ieee80211com *);
+static struct ieee80211_node *bwn_node_alloc(struct ieee80211vap *,
+                   const uint8_t [IEEE80211_ADDR_LEN]);
+static void    bwn_wme_clear(struct bwn_softc *);
+static void    bwn_wme_load(struct bwn_mac *);
+static void    bwn_wme_loadparams(struct bwn_mac *,
+                   const struct wmeParams *, uint16_t);
+static void    bwn_node_cleanup(struct ieee80211_node *);
+static void    bwn_scan_start(struct ieee80211com *);
+static void    bwn_scan_end(struct ieee80211com *);
+static void    bwn_set_channel(struct ieee80211com *);
+static struct ieee80211vap *bwn_vap_create(struct ieee80211com *,
+                   const char [IFNAMSIZ], int, int,
+                   int, const uint8_t [IEEE80211_ADDR_LEN],
+                   const uint8_t [IEEE80211_ADDR_LEN]);
+static void    bwn_vap_delete(struct ieee80211vap *);
+static void    bwn_stop(struct bwn_softc *, int);
+static void    bwn_stop_locked(struct bwn_softc *, int);
+static int     bwn_core_init(struct bwn_mac *);
+static void    bwn_core_start(struct bwn_mac *);
+static void    bwn_core_exit(struct bwn_mac *);
+static void    bwn_fix_imcfglobug(struct bwn_mac *);
+static void    bwn_bt_disable(struct bwn_mac *);
+static int     bwn_chip_init(struct bwn_mac *);
+static uint64_t        bwn_hf_read(struct bwn_mac *);
+static void    bwn_hf_write(struct bwn_mac *, uint64_t);
+static void    bwn_set_txretry(struct bwn_mac *, int, int);
+static void    bwn_rate_init(struct bwn_mac *);
+static void    bwn_set_phytxctl(struct bwn_mac *);
+static void    bwn_spu_setdelay(struct bwn_mac *, int);
+static void    bwn_bt_enable(struct bwn_mac *);
+static void    bwn_set_macaddr(struct bwn_mac *);
+static void    bwn_crypt_init(struct bwn_mac *);
+static void    bwn_chip_exit(struct bwn_mac *);
+static int     bwn_fw_fillinfo(struct bwn_mac *);
+static int     bwn_fw_loaducode(struct bwn_mac *);
+static int     bwn_gpio_init(struct bwn_mac *);
+static int     bwn_fw_loadinitvals(struct bwn_mac *);
+static int     bwn_phy_init(struct bwn_mac *);
+static void    bwn_set_txantenna(struct bwn_mac *, int);
+static void    bwn_set_opmode(struct bwn_mac *);
+static void    bwn_gpio_cleanup(struct bwn_mac *);
+static void    bwn_rate_write(struct bwn_mac *, uint16_t, int);
+static uint8_t bwn_plcp_getcck(const uint8_t);
+static uint8_t bwn_plcp_getofdm(const uint8_t);
+static void    bwn_pio_init(struct bwn_mac *);
+static uint16_t        bwn_pio_idx2base(struct bwn_mac *, int);
+static void    bwn_pio_set_txqueue(struct bwn_mac *, struct bwn_pio_txqueue *,
+                   int);
+static void    bwn_pio_setupqueue_rx(struct bwn_mac *,
+                   struct bwn_pio_rxqueue *, int);
+static void    bwn_destroy_queue_tx(struct bwn_pio_txqueue *);
+static uint16_t        bwn_pio_read_2(struct bwn_mac *, struct bwn_pio_txqueue 
*,
+                   uint16_t);
+static void    bwn_pio_cancel_tx_packets(struct bwn_pio_txqueue *);
+static int     bwn_pio_rx(struct bwn_pio_rxqueue *);
+static uint8_t bwn_pio_rxeof(struct bwn_pio_rxqueue *);
+static void    bwn_pio_handle_txeof(struct bwn_mac *,
+                   const struct bwn_txstatus *);
+static uint16_t        bwn_pio_rx_read_2(struct bwn_pio_rxqueue *, uint16_t);
+static uint32_t        bwn_pio_rx_read_4(struct bwn_pio_rxqueue *, uint16_t);
+static void    bwn_pio_rx_write_2(struct bwn_pio_rxqueue *, uint16_t,
+                   uint16_t);
+static void    bwn_pio_rx_write_4(struct bwn_pio_rxqueue *, uint16_t,
+                   uint32_t);
+static int     bwn_pio_tx_start(struct bwn_mac *, struct ieee80211_node *,
+                   struct mbuf *);
+static struct bwn_pio_txqueue *bwn_pio_select(struct bwn_mac *, uint8_t);
+static uint32_t        bwn_pio_write_multi_4(struct bwn_mac *,
+                   struct bwn_pio_txqueue *, uint32_t, const void *, int);
+static void    bwn_pio_write_4(struct bwn_mac *, struct bwn_pio_txqueue *,
+                   uint16_t, uint32_t);
+static uint16_t        bwn_pio_write_multi_2(struct bwn_mac *,
+                   struct bwn_pio_txqueue *, uint16_t, const void *, int);
+static uint16_t        bwn_pio_write_mbuf_2(struct bwn_mac *,
+                   struct bwn_pio_txqueue *, uint16_t, struct mbuf *);
+static struct bwn_pio_txqueue *bwn_pio_parse_cookie(struct bwn_mac *,
+                   uint16_t, struct bwn_pio_txpkt **);
+static void    bwn_dma_init(struct bwn_mac *);
+static void    bwn_dma_rxdirectfifo(struct bwn_mac *, int, uint8_t);
+static int     bwn_dma_mask2type(uint64_t);
+static uint64_t        bwn_dma_mask(struct bwn_mac *);
+static uint16_t        bwn_dma_base(int, int);
+static void    bwn_dma_ringfree(struct bwn_dma_ring **);
+static void    bwn_dma_32_getdesc(struct bwn_dma_ring *,
+                   int, struct bwn_dmadesc_generic **,
+                   struct bwn_dmadesc_meta **);
+static void    bwn_dma_32_setdesc(struct bwn_dma_ring *,
+                   struct bwn_dmadesc_generic *, bus_addr_t, uint16_t, int,
+                   int, int);
+static void    bwn_dma_32_start_transfer(struct bwn_dma_ring *, int);
+static void    bwn_dma_32_suspend(struct bwn_dma_ring *);
+static void    bwn_dma_32_resume(struct bwn_dma_ring *);
+static int     bwn_dma_32_get_curslot(struct bwn_dma_ring *);
+static void    bwn_dma_32_set_curslot(struct bwn_dma_ring *, int);
+static void    bwn_dma_64_getdesc(struct bwn_dma_ring *,
+                   int, struct bwn_dmadesc_generic **,
+                   struct bwn_dmadesc_meta **);
+static void    bwn_dma_64_setdesc(struct bwn_dma_ring *,
+                   struct bwn_dmadesc_generic *, bus_addr_t, uint16_t, int,
+                   int, int);
+static void    bwn_dma_64_start_transfer(struct bwn_dma_ring *, int);
+static void    bwn_dma_64_suspend(struct bwn_dma_ring *);
+static void    bwn_dma_64_resume(struct bwn_dma_ring *);
+static int     bwn_dma_64_get_curslot(struct bwn_dma_ring *);
+static void    bwn_dma_64_set_curslot(struct bwn_dma_ring *, int);
+static int     bwn_dma_allocringmemory(struct bwn_dma_ring *);
+static void    bwn_dma_setup(struct bwn_dma_ring *);
+static void    bwn_dma_free_ringmemory(struct bwn_dma_ring *);
+static void    bwn_dma_cleanup(struct bwn_dma_ring *);
+static void    bwn_dma_free_descbufs(struct bwn_dma_ring *);
+static int     bwn_dma_tx_reset(struct bwn_mac *, uint16_t, int);
+static void    bwn_dma_rx(struct bwn_dma_ring *);
+static int     bwn_dma_rx_reset(struct bwn_mac *, uint16_t, int);
+static void    bwn_dma_free_descbuf(struct bwn_dma_ring *,
+                   struct bwn_dmadesc_meta *);
+static void    bwn_dma_set_redzone(struct bwn_dma_ring *, struct mbuf *);
+static int     bwn_dma_gettype(struct bwn_mac *);
+static void    bwn_dma_ring_addr(void *, bus_dma_segment_t *, int, int);
+static int     bwn_dma_freeslot(struct bwn_dma_ring *);
+static int     bwn_dma_nextslot(struct bwn_dma_ring *, int);
+static void    bwn_dma_rxeof(struct bwn_dma_ring *, int *);
+static int     bwn_dma_newbuf(struct bwn_dma_ring *,
+                   struct bwn_dmadesc_generic *, struct bwn_dmadesc_meta *,
+                   int);
+static void    bwn_dma_buf_addr(void *, bus_dma_segment_t *, int,
+                   bus_size_t, int);
+static uint8_t bwn_dma_check_redzone(struct bwn_dma_ring *, struct mbuf *);
+static void    bwn_dma_handle_txeof(struct bwn_mac *,
+                   const struct bwn_txstatus *);
+static int     bwn_dma_tx_start(struct bwn_mac *, struct ieee80211_node *,
+                   struct mbuf *);
+static int     bwn_dma_getslot(struct bwn_dma_ring *);
+static struct bwn_dma_ring *bwn_dma_select(struct bwn_mac *,
+                   uint8_t);
+static int     bwn_dma_attach(struct bwn_mac *);
+static struct bwn_dma_ring *bwn_dma_ringsetup(struct bwn_mac *,
+                   int, int, int);
+static struct bwn_dma_ring *bwn_dma_parse_cookie(struct bwn_mac *,
+                   const struct bwn_txstatus *, uint16_t, int *);
+static void    bwn_dma_free(struct bwn_mac *);
+static void    bwn_phy_g_init_sub(struct bwn_mac *);
+static uint8_t bwn_has_hwpctl(struct bwn_mac *);
+static void    bwn_phy_init_b5(struct bwn_mac *);
+static void    bwn_phy_init_b6(struct bwn_mac *);
+static void    bwn_phy_init_a(struct bwn_mac *);
+static void    bwn_loopback_calcgain(struct bwn_mac *);
+static uint16_t        bwn_rf_init_bcm2050(struct bwn_mac *);
+static void    bwn_lo_g_init(struct bwn_mac *);
+static void    bwn_lo_g_adjust(struct bwn_mac *);
+static void    bwn_lo_get_powervector(struct bwn_mac *);
+static struct bwn_lo_calib *bwn_lo_calibset(struct bwn_mac *,
+                   const struct bwn_bbatt *, const struct bwn_rfatt *);
+static void    bwn_lo_write(struct bwn_mac *, struct bwn_loctl *);
+static void    bwn_phy_hwpctl_init(struct bwn_mac *);
+static void    bwn_phy_g_switch_chan(struct bwn_mac *, int, uint8_t);
+static void    bwn_phy_g_set_txpwr_sub(struct bwn_mac *,
+                   const struct bwn_bbatt *, const struct bwn_rfatt *,
+                   uint8_t);
+static void    bwn_phy_g_set_bbatt(struct bwn_mac *, uint16_t);
+static uint16_t        bwn_rf_2050_rfoverval(struct bwn_mac *, uint16_t, 
uint32_t);
+static void    bwn_spu_workaround(struct bwn_mac *, uint8_t);
+static void    bwn_wa_init(struct bwn_mac *);
+static void    bwn_ofdmtab_write_2(struct bwn_mac *, uint16_t, uint16_t,
+                   uint16_t);
+static void    bwn_dummy_transmission(struct bwn_mac *, int, int);
+static void    bwn_ofdmtab_write_4(struct bwn_mac *, uint16_t, uint16_t,
+                   uint32_t);
+static void    bwn_gtab_write(struct bwn_mac *, uint16_t, uint16_t,
+                   uint16_t);
+static void    bwn_ram_write(struct bwn_mac *, uint16_t, uint32_t);
+static void    bwn_mac_suspend(struct bwn_mac *);
+static void    bwn_mac_enable(struct bwn_mac *);
+static void    bwn_psctl(struct bwn_mac *, uint32_t);
+static int16_t bwn_nrssi_read(struct bwn_mac *, uint16_t);
+static void    bwn_nrssi_offset(struct bwn_mac *);
+static void    bwn_nrssi_threshold(struct bwn_mac *);
+static void    bwn_nrssi_slope_11g(struct bwn_mac *);
+static void    bwn_set_all_gains(struct bwn_mac *, int16_t, int16_t,
+                   int16_t);
+static void    bwn_set_original_gains(struct bwn_mac *);
+static void    bwn_hwpctl_early_init(struct bwn_mac *);
+static void    bwn_hwpctl_init_gphy(struct bwn_mac *);
+static uint16_t        bwn_phy_g_chan2freq(uint8_t);
+static int     bwn_fw_gets(struct bwn_mac *, enum bwn_fwtype);
+static int     bwn_fw_get(struct bwn_mac *, enum bwn_fwtype,
+                   const char *, struct bwn_fwfile *);
+static void    bwn_release_firmware(struct bwn_mac *);
+static void    bwn_do_release_fw(struct bwn_fwfile *);
+static uint16_t        bwn_fwcaps_read(struct bwn_mac *);
+static int     bwn_fwinitvals_write(struct bwn_mac *,
+                   const struct bwn_fwinitvals *, size_t, size_t);
+static int     bwn_switch_channel(struct bwn_mac *, int);
+static uint16_t        bwn_ant2phy(int);
+static void    bwn_mac_write_bssid(struct bwn_mac *);
+static void    bwn_mac_setfilter(struct bwn_mac *, uint16_t,
+                   const uint8_t *);
+static void    bwn_key_dowrite(struct bwn_mac *, uint8_t, uint8_t,
+                   const uint8_t *, size_t, const uint8_t *);
+static void    bwn_key_macwrite(struct bwn_mac *, uint8_t,
+                   const uint8_t *);
+static void    bwn_key_write(struct bwn_mac *, uint8_t, uint8_t,
+                   const uint8_t *);
+static void    bwn_phy_exit(struct bwn_mac *);
+static void    bwn_core_stop(struct bwn_mac *);
+static int     bwn_switch_band(struct bwn_softc *,
+                   struct ieee80211_channel *);
+static void    bwn_phy_reset(struct bwn_mac *);
+static int     bwn_newstate(struct ieee80211vap *, enum ieee80211_state, int);
+static void    bwn_set_pretbtt(struct bwn_mac *);
+static int     bwn_intr(void *);
+static void    bwn_intrtask(void *, int);
+static void    bwn_restart(struct bwn_mac *, const char *);
+static void    bwn_intr_ucode_debug(struct bwn_mac *);
+static void    bwn_intr_tbtt_indication(struct bwn_mac *);
+static void    bwn_intr_atim_end(struct bwn_mac *);
+static void    bwn_intr_beacon(struct bwn_mac *);
+static void    bwn_intr_pmq(struct bwn_mac *);
+static void    bwn_intr_noise(struct bwn_mac *);
+static void    bwn_intr_txeof(struct bwn_mac *);
+static void    bwn_hwreset(void *, int);
+static void    bwn_handle_fwpanic(struct bwn_mac *);
+static void    bwn_load_beacon0(struct bwn_mac *);
+static void    bwn_load_beacon1(struct bwn_mac *);
+static uint32_t        bwn_jssi_read(struct bwn_mac *);
+static void    bwn_noise_gensample(struct bwn_mac *);
+static void    bwn_handle_txeof(struct bwn_mac *,
+                   const struct bwn_txstatus *);
+static void    bwn_rxeof(struct bwn_mac *, struct mbuf *, const void *);
+static void    bwn_phy_txpower_check(struct bwn_mac *, uint32_t);
+static void    bwn_start_locked(struct ifnet *);
+static int     bwn_tx_start(struct bwn_softc *, struct ieee80211_node *,
+                   struct mbuf *);
+static int     bwn_tx_isfull(struct bwn_softc *, struct mbuf *);
+static int     bwn_set_txhdr(struct bwn_mac *,
+                   struct ieee80211_node *, struct mbuf *, struct bwn_txhdr *,
+                   uint16_t);
+static void    bwn_plcp_genhdr(struct bwn_plcp4 *, const uint16_t,
+                   const uint8_t);
+static uint8_t bwn_antenna_sanitize(struct bwn_mac *, uint8_t);
+static uint8_t bwn_get_fbrate(uint8_t);
+static int     bwn_phy_shm_tssi_read(struct bwn_mac *, uint16_t);
+static void    bwn_phy_g_setatt(struct bwn_mac *, int *, int *);
+static void    bwn_phy_lock(struct bwn_mac *);
+static void    bwn_phy_unlock(struct bwn_mac *);
+static void    bwn_rf_lock(struct bwn_mac *);
+static void    bwn_rf_unlock(struct bwn_mac *);
+static void    bwn_txpwr(void *, int);
+static void    bwn_tasks(void *);
+static void    bwn_task_15s(struct bwn_mac *);
+static void    bwn_task_30s(struct bwn_mac *);
+static void    bwn_task_60s(struct bwn_mac *);
+static int     bwn_plcp_get_ofdmrate(struct bwn_mac *, struct bwn_plcp6 *,
+                   uint8_t);
+static int     bwn_plcp_get_cckrate(struct bwn_mac *, struct bwn_plcp6 *);
+static void    bwn_rx_radiotap(struct bwn_mac *, struct mbuf *,
+                   const struct bwn_rxhdr4 *, struct bwn_plcp6 *, int,
+                   int, int);
+static void    bwn_tsf_read(struct bwn_mac *, uint64_t *);
+static void    bwn_phy_g_dc_lookup_init(struct bwn_mac *, uint8_t);
+static void    bwn_set_slot_time(struct bwn_mac *, uint16_t);
+static void    bwn_watchdog(void *);
+static void    bwn_dma_stop(struct bwn_mac *);
+static void    bwn_pio_stop(struct bwn_mac *);
+static void    bwn_dma_ringstop(struct bwn_dma_ring **);
+static void    bwn_led_attach(struct bwn_mac *);
+static void    bwn_led_newstate(struct bwn_mac *, enum ieee80211_state);
+static void    bwn_led_event(struct bwn_mac *, int);
+static void    bwn_led_blink_start(struct bwn_mac *, int, int);
+static void    bwn_led_blink_next(void *);
+static void    bwn_led_blink_end(void *);
+static void    bwn_rfswitch(void *);
+static void    bwn_rf_turnon(struct bwn_mac *);
+static void    bwn_rf_turnoff(struct bwn_mac *);
+static void    bwn_phy_lp_init_pre(struct bwn_mac *);
+static int     bwn_phy_lp_init(struct bwn_mac *);
+static uint16_t        bwn_phy_lp_read(struct bwn_mac *, uint16_t);
+static void    bwn_phy_lp_write(struct bwn_mac *, uint16_t, uint16_t);
+static void    bwn_phy_lp_maskset(struct bwn_mac *, uint16_t, uint16_t,
+                   uint16_t);
+static uint16_t        bwn_phy_lp_rf_read(struct bwn_mac *, uint16_t);
+static void    bwn_phy_lp_rf_write(struct bwn_mac *, uint16_t, uint16_t);
+static void    bwn_phy_lp_rf_onoff(struct bwn_mac *, int);
+static int     bwn_phy_lp_switch_channel(struct bwn_mac *, uint32_t);
+static uint32_t        bwn_phy_lp_get_default_chan(struct bwn_mac *);
+static void    bwn_phy_lp_set_antenna(struct bwn_mac *, int);
+static void    bwn_phy_lp_task_60s(struct bwn_mac *);
+static void    bwn_phy_lp_readsprom(struct bwn_mac *);
+static void    bwn_phy_lp_bbinit(struct bwn_mac *);
+static void    bwn_phy_lp_txpctl_init(struct bwn_mac *);
+static void    bwn_phy_lp_calib(struct bwn_mac *);
+static void    bwn_phy_lp_switch_analog(struct bwn_mac *, int);
+static int     bwn_phy_lp_b2062_switch_channel(struct bwn_mac *, uint8_t);
+static int     bwn_phy_lp_b2063_switch_channel(struct bwn_mac *, uint8_t);
+static void    bwn_phy_lp_set_anafilter(struct bwn_mac *, uint8_t);
+static void    bwn_phy_lp_set_gaintbl(struct bwn_mac *, uint32_t);
+static void    bwn_phy_lp_digflt_save(struct bwn_mac *);
+static void    bwn_phy_lp_get_txpctlmode(struct bwn_mac *);
+static void    bwn_phy_lp_set_txpctlmode(struct bwn_mac *, uint8_t);
+static void    bwn_phy_lp_bugfix(struct bwn_mac *);
+static void    bwn_phy_lp_digflt_restore(struct bwn_mac *);
+static void    bwn_phy_lp_tblinit(struct bwn_mac *);
+static void    bwn_phy_lp_bbinit_r2(struct bwn_mac *);
+static void    bwn_phy_lp_bbinit_r01(struct bwn_mac *);
+static void    bwn_phy_lp_b2062_init(struct bwn_mac *);
+static void    bwn_phy_lp_b2063_init(struct bwn_mac *);
+static void    bwn_phy_lp_rxcal_r2(struct bwn_mac *);
+static void    bwn_phy_lp_rccal_r12(struct bwn_mac *);
+static void    bwn_phy_lp_set_rccap(struct bwn_mac *);
+static uint32_t        bwn_phy_lp_roundup(uint32_t, uint32_t, uint8_t);
+static void    bwn_phy_lp_b2062_reset_pllbias(struct bwn_mac *);
+static void    bwn_phy_lp_b2062_vco_calib(struct bwn_mac *);
+static void    bwn_tab_write_multi(struct bwn_mac *, uint32_t, int,
+                   const void *);
+static void    bwn_tab_read_multi(struct bwn_mac *, uint32_t, int, void *);
+static struct bwn_txgain
+               bwn_phy_lp_get_txgain(struct bwn_mac *);
+static uint8_t bwn_phy_lp_get_bbmult(struct bwn_mac *);
+static void    bwn_phy_lp_set_txgain(struct bwn_mac *, struct bwn_txgain *);
+static void    bwn_phy_lp_set_bbmult(struct bwn_mac *, uint8_t);
+static void    bwn_phy_lp_set_trsw_over(struct bwn_mac *, uint8_t, uint8_t);
+static void    bwn_phy_lp_set_rxgain(struct bwn_mac *, uint32_t);
+static void    bwn_phy_lp_set_deaf(struct bwn_mac *, uint8_t);
+static int     bwn_phy_lp_calc_rx_iq_comp(struct bwn_mac *, uint16_t);
+static void    bwn_phy_lp_clear_deaf(struct bwn_mac *, uint8_t);
+static void    bwn_phy_lp_tblinit_r01(struct bwn_mac *);
+static void    bwn_phy_lp_tblinit_r2(struct bwn_mac *);
+static void    bwn_phy_lp_tblinit_txgain(struct bwn_mac *);
+static void    bwn_tab_write(struct bwn_mac *, uint32_t, uint32_t);
+static void    bwn_phy_lp_b2062_tblinit(struct bwn_mac *);
+static void    bwn_phy_lp_b2063_tblinit(struct bwn_mac *);
+static int     bwn_phy_lp_loopback(struct bwn_mac *);
+static void    bwn_phy_lp_set_rxgain_idx(struct bwn_mac *, uint16_t);
+static void    bwn_phy_lp_ddfs_turnon(struct bwn_mac *, int, int, int, int,
+                   int);
+static uint8_t bwn_phy_lp_rx_iq_est(struct bwn_mac *, uint16_t, uint8_t,
+                   struct bwn_phy_lp_iq_est *);
+static void    bwn_phy_lp_ddfs_turnoff(struct bwn_mac *);
+static uint32_t        bwn_tab_read(struct bwn_mac *, uint32_t);
+static void    bwn_phy_lp_set_txgain_dac(struct bwn_mac *, uint16_t);
+static void    bwn_phy_lp_set_txgain_pa(struct bwn_mac *, uint16_t);
+static void    bwn_phy_lp_set_txgain_override(struct bwn_mac *);
+static uint16_t        bwn_phy_lp_get_pa_gain(struct bwn_mac *);
+static uint8_t bwn_nbits(int32_t);
+static void    bwn_phy_lp_gaintbl_write_multi(struct bwn_mac *, int, int,
+                   struct bwn_txgain_entry *);
+static void    bwn_phy_lp_gaintbl_write(struct bwn_mac *, int,
+                   struct bwn_txgain_entry);
+static void    bwn_phy_lp_gaintbl_write_r2(struct bwn_mac *, int,
+                   struct bwn_txgain_entry);
+static void    bwn_phy_lp_gaintbl_write_r01(struct bwn_mac *, int,
+                   struct bwn_txgain_entry);
+
+static struct resource_spec bwn_res_spec_legacy[] = {
+       { SYS_RES_IRQ,          0,              RF_ACTIVE | RF_SHAREABLE },
+       { -1,                   0,              0 }
+};
+
+static struct resource_spec bwn_res_spec_msi[] = {
+       { SYS_RES_IRQ,          1,              RF_ACTIVE },
+       { -1,                   0,              0 }
+};
+
+static const struct bwn_channelinfo bwn_chantable_bg = {
+       .channels = {
+               { 2412,  1, 30 }, { 2417,  2, 30 }, { 2422,  3, 30 },
+               { 2427,  4, 30 }, { 2432,  5, 30 }, { 2437,  6, 30 },
+               { 2442,  7, 30 }, { 2447,  8, 30 }, { 2452,  9, 30 },
+               { 2457, 10, 30 }, { 2462, 11, 30 }, { 2467, 12, 30 },
+               { 2472, 13, 30 }, { 2484, 14, 30 } },
+       .nchannels = 14
+};
+
+static const struct bwn_channelinfo bwn_chantable_a = {
+       .channels = {
+               { 5170,  34, 30 }, { 5180,  36, 30 }, { 5190,  38, 30 },
+               { 5200,  40, 30 }, { 5210,  42, 30 }, { 5220,  44, 30 },
+               { 5230,  46, 30 }, { 5240,  48, 30 }, { 5260,  52, 30 },
+               { 5280,  56, 30 }, { 5300,  60, 30 }, { 5320,  64, 30 },
+               { 5500, 100, 30 }, { 5520, 104, 30 }, { 5540, 108, 30 },
+               { 5560, 112, 30 }, { 5580, 116, 30 }, { 5600, 120, 30 },
+               { 5620, 124, 30 }, { 5640, 128, 30 }, { 5660, 132, 30 },
+               { 5680, 136, 30 }, { 5700, 140, 30 }, { 5745, 149, 30 },
+               { 5765, 153, 30 }, { 5785, 157, 30 }, { 5805, 161, 30 },
+               { 5825, 165, 30 }, { 5920, 184, 30 }, { 5940, 188, 30 },
+               { 5960, 192, 30 }, { 5980, 196, 30 }, { 6000, 200, 30 },
+               { 6020, 204, 30 }, { 6040, 208, 30 }, { 6060, 212, 30 },
+               { 6080, 216, 30 } },
+       .nchannels = 37
+};
+
+static const struct bwn_channelinfo bwn_chantable_n = {
+       .channels = {
+               { 5160,  32, 30 }, { 5170,  34, 30 }, { 5180,  36, 30 },
+               { 5190,  38, 30 }, { 5200,  40, 30 }, { 5210,  42, 30 },
+               { 5220,  44, 30 }, { 5230,  46, 30 }, { 5240,  48, 30 },
+               { 5250,  50, 30 }, { 5260,  52, 30 }, { 5270,  54, 30 },
+               { 5280,  56, 30 }, { 5290,  58, 30 }, { 5300,  60, 30 },
+               { 5310,  62, 30 }, { 5320,  64, 30 }, { 5330,  66, 30 },
+               { 5340,  68, 30 }, { 5350,  70, 30 }, { 5360,  72, 30 },
+               { 5370,  74, 30 }, { 5380,  76, 30 }, { 5390,  78, 30 },
+               { 5400,  80, 30 }, { 5410,  82, 30 }, { 5420,  84, 30 },
+               { 5430,  86, 30 }, { 5440,  88, 30 }, { 5450,  90, 30 },
+               { 5460,  92, 30 }, { 5470,  94, 30 }, { 5480,  96, 30 },
+               { 5490,  98, 30 }, { 5500, 100, 30 }, { 5510, 102, 30 },
+               { 5520, 104, 30 }, { 5530, 106, 30 }, { 5540, 108, 30 },
+               { 5550, 110, 30 }, { 5560, 112, 30 }, { 5570, 114, 30 },
+               { 5580, 116, 30 }, { 5590, 118, 30 }, { 5600, 120, 30 },
+               { 5610, 122, 30 }, { 5620, 124, 30 }, { 5630, 126, 30 },
+               { 5640, 128, 30 }, { 5650, 130, 30 }, { 5660, 132, 30 },
+               { 5670, 134, 30 }, { 5680, 136, 30 }, { 5690, 138, 30 },
+               { 5700, 140, 30 }, { 5710, 142, 30 }, { 5720, 144, 30 },
+               { 5725, 145, 30 }, { 5730, 146, 30 }, { 5735, 147, 30 },
+               { 5740, 148, 30 }, { 5745, 149, 30 }, { 5750, 150, 30 },
+               { 5755, 151, 30 }, { 5760, 152, 30 }, { 5765, 153, 30 },
+               { 5770, 154, 30 }, { 5775, 155, 30 }, { 5780, 156, 30 },
+               { 5785, 157, 30 }, { 5790, 158, 30 }, { 5795, 159, 30 },
+               { 5800, 160, 30 }, { 5805, 161, 30 }, { 5810, 162, 30 },
+               { 5815, 163, 30 }, { 5820, 164, 30 }, { 5825, 165, 30 },
+               { 5830, 166, 30 }, { 5840, 168, 30 }, { 5850, 170, 30 },
+               { 5860, 172, 30 }, { 5870, 174, 30 }, { 5880, 176, 30 },
+               { 5890, 178, 30 }, { 5900, 180, 30 }, { 5910, 182, 30 },
+               { 5920, 184, 30 }, { 5930, 186, 30 }, { 5940, 188, 30 },
+               { 5950, 190, 30 }, { 5960, 192, 30 }, { 5970, 194, 30 },
+               { 5980, 196, 30 }, { 5990, 198, 30 }, { 6000, 200, 30 },
+               { 6010, 202, 30 }, { 6020, 204, 30 }, { 6030, 206, 30 },
+               { 6040, 208, 30 }, { 6050, 210, 30 }, { 6060, 212, 30 },
+               { 6070, 214, 30 }, { 6080, 216, 30 }, { 6090, 218, 30 },
+               { 6100, 220, 30 }, { 6110, 222, 30 }, { 6120, 224, 30 },
+               { 6130, 226, 30 }, { 6140, 228, 30 } },
+       .nchannels = 110
+};
+
+static const uint8_t bwn_b2063_chantable_data[33][12] = {
+       { 0x6f, 0x3c, 0x3c, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
+       { 0x6f, 0x2c, 0x2c, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
+       { 0x6f, 0x1c, 0x1c, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
+       { 0x6e, 0x1c, 0x1c, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
+       { 0x6e, 0xc, 0xc, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
+       { 0x6a, 0xc, 0xc, 0, 0x2, 0x5, 0xd, 0xd, 0x77, 0x80, 0x20, 0 },
+       { 0x6a, 0xc, 0xc, 0, 0x1, 0x5, 0xd, 0xc, 0x77, 0x80, 0x20, 0 },
+       { 0x6a, 0xc, 0xc, 0, 0x1, 0x4, 0xc, 0xc, 0x77, 0x80, 0x20, 0 },
+       { 0x69, 0xc, 0xc, 0, 0x1, 0x4, 0xc, 0xc, 0x77, 0x70, 0x20, 0 },
+       { 0x69, 0xc, 0xc, 0, 0x1, 0x4, 0xb, 0xc, 0x77, 0x70, 0x20, 0 },
+       { 0x69, 0xc, 0xc, 0, 0, 0x4, 0xb, 0xb, 0x77, 0x60, 0x20, 0 },
+       { 0x69, 0xc, 0xc, 0, 0, 0x3, 0xa, 0xb, 0x77, 0x60, 0x20, 0 },
+       { 0x69, 0xc, 0xc, 0, 0, 0x3, 0xa, 0xa, 0x77, 0x60, 0x20, 0 },
+       { 0x68, 0xc, 0xc, 0, 0, 0x2, 0x9, 0x9, 0x77, 0x60, 0x20, 0 },
+       { 0x68, 0xc, 0xc, 0, 0, 0x1, 0x8, 0x8, 0x77, 0x50, 0x10, 0 },
+       { 0x67, 0xc, 0xc, 0, 0, 0, 0x8, 0x8, 0x77, 0x50, 0x10, 0 },
+       { 0x64, 0xc, 0xc, 0, 0, 0, 0x2, 0x1, 0x77, 0x20, 0, 0 },
+       { 0x64, 0xc, 0xc, 0, 0, 0, 0x1, 0x1, 0x77, 0x20, 0, 0 },
+       { 0x63, 0xc, 0xc, 0, 0, 0, 0x1, 0, 0x77, 0x10, 0, 0 },
+       { 0x63, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0x10, 0, 0 },
+       { 0x62, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0x10, 0, 0 },
+       { 0x62, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0, 0, 0 },
+       { 0x61, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0, 0, 0 },
+       { 0x60, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0, 0, 0 },
+       { 0x6e, 0xc, 0xc, 0, 0x9, 0xe, 0xf, 0xf, 0x77, 0xc0, 0x50, 0 },
+       { 0x6e, 0xc, 0xc, 0, 0x9, 0xd, 0xf, 0xf, 0x77, 0xb0, 0x50, 0 },
+       { 0x6e, 0xc, 0xc, 0, 0x8, 0xc, 0xf, 0xf, 0x77, 0xb0, 0x50, 0 },
+       { 0x6d, 0xc, 0xc, 0, 0x8, 0xc, 0xf, 0xf, 0x77, 0xa0, 0x40, 0 },
+       { 0x6d, 0xc, 0xc, 0, 0x8, 0xb, 0xf, 0xf, 0x77, 0xa0, 0x40, 0 },
+       { 0x6d, 0xc, 0xc, 0, 0x8, 0xa, 0xf, 0xf, 0x77, 0xa0, 0x40, 0 },
+       { 0x6c, 0xc, 0xc, 0, 0x7, 0x9, 0xf, 0xf, 0x77, 0x90, 0x40, 0 },
+       { 0x6c, 0xc, 0xc, 0, 0x6, 0x8, 0xf, 0xf, 0x77, 0x90, 0x40, 0 },
+       { 0x6c, 0xc, 0xc, 0, 0x5, 0x8, 0xf, 0xf, 0x77, 0x90, 0x40, 0 }
+};
+
+static const struct bwn_b206x_chan bwn_b2063_chantable[] = {
+       { 1, 2412, bwn_b2063_chantable_data[0] },
+       { 2, 2417, bwn_b2063_chantable_data[0] },
+       { 3, 2422, bwn_b2063_chantable_data[0] },
+       { 4, 2427, bwn_b2063_chantable_data[1] },
+       { 5, 2432, bwn_b2063_chantable_data[1] },
+       { 6, 2437, bwn_b2063_chantable_data[1] },
+       { 7, 2442, bwn_b2063_chantable_data[1] },
+       { 8, 2447, bwn_b2063_chantable_data[1] },
+       { 9, 2452, bwn_b2063_chantable_data[2] },
+       { 10, 2457, bwn_b2063_chantable_data[2] },
+       { 11, 2462, bwn_b2063_chantable_data[3] },
+       { 12, 2467, bwn_b2063_chantable_data[3] },
+       { 13, 2472, bwn_b2063_chantable_data[3] },
+       { 14, 2484, bwn_b2063_chantable_data[4] },
+       { 34, 5170, bwn_b2063_chantable_data[5] },
+       { 36, 5180, bwn_b2063_chantable_data[6] },
+       { 38, 5190, bwn_b2063_chantable_data[7] },
+       { 40, 5200, bwn_b2063_chantable_data[8] },
+       { 42, 5210, bwn_b2063_chantable_data[9] },
+       { 44, 5220, bwn_b2063_chantable_data[10] },
+       { 46, 5230, bwn_b2063_chantable_data[11] },
+       { 48, 5240, bwn_b2063_chantable_data[12] },
+       { 52, 5260, bwn_b2063_chantable_data[13] },
+       { 56, 5280, bwn_b2063_chantable_data[14] },
+       { 60, 5300, bwn_b2063_chantable_data[14] },
+       { 64, 5320, bwn_b2063_chantable_data[15] },
+       { 100, 5500, bwn_b2063_chantable_data[16] },
+       { 104, 5520, bwn_b2063_chantable_data[17] },
+       { 108, 5540, bwn_b2063_chantable_data[18] },
+       { 112, 5560, bwn_b2063_chantable_data[19] },
+       { 116, 5580, bwn_b2063_chantable_data[20] },
+       { 120, 5600, bwn_b2063_chantable_data[21] },
+       { 124, 5620, bwn_b2063_chantable_data[21] },
+       { 128, 5640, bwn_b2063_chantable_data[22] },
+       { 132, 5660, bwn_b2063_chantable_data[22] },
+       { 136, 5680, bwn_b2063_chantable_data[22] },
+       { 140, 5700, bwn_b2063_chantable_data[23] },
+       { 149, 5745, bwn_b2063_chantable_data[23] },
+       { 153, 5765, bwn_b2063_chantable_data[23] },
+       { 157, 5785, bwn_b2063_chantable_data[23] },
+       { 161, 5805, bwn_b2063_chantable_data[23] },
+       { 165, 5825, bwn_b2063_chantable_data[23] },
+       { 184, 4920, bwn_b2063_chantable_data[24] },
+       { 188, 4940, bwn_b2063_chantable_data[25] },
+       { 192, 4960, bwn_b2063_chantable_data[26] },
+       { 196, 4980, bwn_b2063_chantable_data[27] },
+       { 200, 5000, bwn_b2063_chantable_data[28] },
+       { 204, 5020, bwn_b2063_chantable_data[29] },
+       { 208, 5040, bwn_b2063_chantable_data[30] },
+       { 212, 5060, bwn_b2063_chantable_data[31] },
+       { 216, 5080, bwn_b2063_chantable_data[32] }
+};
+
+static const uint8_t bwn_b2062_chantable_data[22][12] = {
+       { 0xff, 0xff, 0xb5, 0x1b, 0x24, 0x32, 0x32, 0x88, 0x88, 0, 0, 0 },
+       { 0, 0x22, 0x20, 0x84, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+       { 0, 0x11, 0x10, 0x83, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+       { 0, 0, 0, 0x83, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+       { 0, 0x11, 0x20, 0x83, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+       { 0, 0x11, 0x10, 0x84, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+       { 0, 0x11, 0, 0x83, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+       { 0, 0, 0, 0x63, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+       { 0, 0, 0, 0x62, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+       { 0, 0, 0, 0x30, 0x3c, 0x77, 0x37, 0xff, 0x88, 0, 0, 0 },
+       { 0, 0, 0, 0x20, 0x3c, 0x77, 0x37, 0xff, 0x88, 0, 0, 0 },
+       { 0, 0, 0, 0x10, 0x3c, 0x77, 0x37, 0xff, 0x88, 0, 0, 0 },
+       { 0, 0, 0, 0, 0x3c, 0x77, 0x37, 0xff, 0x88, 0, 0, 0 },
+       { 0x55, 0x77, 0x90, 0xf7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+       { 0x44, 0x77, 0x80, 0xe7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+       { 0x44, 0x66, 0x80, 0xe7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+       { 0x33, 0x66, 0x70, 0xc7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+       { 0x22, 0x55, 0x60, 0xd7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+       { 0x22, 0x55, 0x60, 0xc7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+       { 0x22, 0x44, 0x50, 0xc7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+       { 0x11, 0x44, 0x50, 0xa5, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+       { 0, 0x44, 0x40, 0xb6, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 }
+};
+
+static const struct bwn_b206x_chan bwn_b2062_chantable[] = {
+       { 1, 2412, bwn_b2062_chantable_data[0] },
+       { 2, 2417, bwn_b2062_chantable_data[0] },
+       { 3, 2422, bwn_b2062_chantable_data[0] },
+       { 4, 2427, bwn_b2062_chantable_data[0] },
+       { 5, 2432, bwn_b2062_chantable_data[0] },
+       { 6, 2437, bwn_b2062_chantable_data[0] },
+       { 7, 2442, bwn_b2062_chantable_data[0] },
+       { 8, 2447, bwn_b2062_chantable_data[0] },
+       { 9, 2452, bwn_b2062_chantable_data[0] },
+       { 10, 2457, bwn_b2062_chantable_data[0] },
+       { 11, 2462, bwn_b2062_chantable_data[0] },
+       { 12, 2467, bwn_b2062_chantable_data[0] },
+       { 13, 2472, bwn_b2062_chantable_data[0] },
+       { 14, 2484, bwn_b2062_chantable_data[0] },
+       { 34, 5170, bwn_b2062_chantable_data[1] },
+       { 38, 5190, bwn_b2062_chantable_data[2] },
+       { 42, 5210, bwn_b2062_chantable_data[2] },
+       { 46, 5230, bwn_b2062_chantable_data[3] },
+       { 36, 5180, bwn_b2062_chantable_data[4] },
+       { 40, 5200, bwn_b2062_chantable_data[5] },
+       { 44, 5220, bwn_b2062_chantable_data[6] },
+       { 48, 5240, bwn_b2062_chantable_data[3] },
+       { 52, 5260, bwn_b2062_chantable_data[3] },
+       { 56, 5280, bwn_b2062_chantable_data[3] },
+       { 60, 5300, bwn_b2062_chantable_data[7] },
+       { 64, 5320, bwn_b2062_chantable_data[8] },
+       { 100, 5500, bwn_b2062_chantable_data[9] },
+       { 104, 5520, bwn_b2062_chantable_data[10] },
+       { 108, 5540, bwn_b2062_chantable_data[10] },
+       { 112, 5560, bwn_b2062_chantable_data[10] },
+       { 116, 5580, bwn_b2062_chantable_data[11] },
+       { 120, 5600, bwn_b2062_chantable_data[12] },
+       { 124, 5620, bwn_b2062_chantable_data[12] },
+       { 128, 5640, bwn_b2062_chantable_data[12] },
+       { 132, 5660, bwn_b2062_chantable_data[12] },
+       { 136, 5680, bwn_b2062_chantable_data[12] },
+       { 140, 5700, bwn_b2062_chantable_data[12] },
+       { 149, 5745, bwn_b2062_chantable_data[12] },
+       { 153, 5765, bwn_b2062_chantable_data[12] },
+       { 157, 5785, bwn_b2062_chantable_data[12] },
+       { 161, 5805, bwn_b2062_chantable_data[12] },
+       { 165, 5825, bwn_b2062_chantable_data[12] },
+       { 184, 4920, bwn_b2062_chantable_data[13] },
+       { 188, 4940, bwn_b2062_chantable_data[14] },
+       { 192, 4960, bwn_b2062_chantable_data[15] },
+       { 196, 4980, bwn_b2062_chantable_data[16] },
+       { 200, 5000, bwn_b2062_chantable_data[17] },
+       { 204, 5020, bwn_b2062_chantable_data[18] },
+       { 208, 5040, bwn_b2062_chantable_data[19] },
+       { 212, 5060, bwn_b2062_chantable_data[20] },
+       { 216, 5080, bwn_b2062_chantable_data[21] }
+};
+
+/* for LP PHY */
+static const struct bwn_rxcompco bwn_rxcompco_5354[] = {
+       {  1, -66, 15 }, {  2, -66, 15 }, {  3, -66, 15 }, {  4, -66, 15 },
+       {  5, -66, 15 }, {  6, -66, 15 }, {  7, -66, 14 }, {  8, -66, 14 },
+       {  9, -66, 14 }, { 10, -66, 14 }, { 11, -66, 14 }, { 12, -66, 13 },
+       { 13, -66, 13 }, { 14, -66, 13 },
+};
+
+/* for LP PHY */
+static const struct bwn_rxcompco bwn_rxcompco_r12[] = {
+       {   1, -64, 13 }, {   2, -64, 13 }, {   3, -64, 13 }, {   4, -64, 13 },
+       {   5, -64, 12 }, {   6, -64, 12 }, {   7, -64, 12 }, {   8, -64, 12 },
+       {   9, -64, 12 }, {  10, -64, 11 }, {  11, -64, 11 }, {  12, -64, 11 },
+       {  13, -64, 11 }, {  14, -64, 10 }, {  34, -62, 24 }, {  38, -62, 24 },
+       {  42, -62, 24 }, {  46, -62, 23 }, {  36, -62, 24 }, {  40, -62, 24 },
+       {  44, -62, 23 }, {  48, -62, 23 }, {  52, -62, 23 }, {  56, -62, 22 },
+       {  60, -62, 22 }, {  64, -62, 22 }, { 100, -62, 16 }, { 104, -62, 16 },
+       { 108, -62, 15 }, { 112, -62, 14 }, { 116, -62, 14 }, { 120, -62, 13 },
+       { 124, -62, 12 }, { 128, -62, 12 }, { 132, -62, 12 }, { 136, -62, 11 },
+       { 140, -62, 10 }, { 149, -61,  9 }, { 153, -61,  9 }, { 157, -61,  9 },
+       { 161, -61,  8 }, { 165, -61,  8 }, { 184, -62, 25 }, { 188, -62, 25 },
+       { 192, -62, 25 }, { 196, -62, 25 }, { 200, -62, 25 }, { 204, -62, 25 },
+       { 208, -62, 25 }, { 212, -62, 25 }, { 216, -62, 26 },
+};
+
+static const struct bwn_rxcompco bwn_rxcompco_r2 = { 0, -64, 0 };
+
+static const uint8_t bwn_tab_sigsq_tbl[] = {
+       0xde, 0xdc, 0xda, 0xd8, 0xd6, 0xd4, 0xd2, 0xcf, 0xcd,
+       0xca, 0xc7, 0xc4, 0xc1, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe,
+       0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0x00,
+       0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe,
+       0xbe, 0xbe, 0xbe, 0xbe, 0xc1, 0xc4, 0xc7, 0xca, 0xcd,
+       0xcf, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde,
+};
+
+static const uint8_t bwn_tab_pllfrac_tbl[] = {
+       0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80,
+       0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+};
+
+static const uint16_t bwn_tabl_iqlocal_tbl[] = {
+       0x0200, 0x0300, 0x0400, 0x0600, 0x0800, 0x0b00, 0x1000, 0x1001, 0x1002,
+       0x1003, 0x1004, 0x1005, 0x1006, 0x1007, 0x1707, 0x2007, 0x2d07, 0x4007,
+       0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+       0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0200, 0x0300, 0x0400, 0x0600,
+       0x0800, 0x0b00, 0x1000, 0x1001, 0x1002, 0x1003, 0x1004, 0x1005, 0x1006,
+       0x1007, 0x1707, 0x2007, 0x2d07, 0x4007, 0x0000, 0x0000, 0x0000, 0x0000,
+       0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+       0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+       0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+       0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4000, 0x0000, 0x0000,
+       0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+       0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+};
+
+static const uint16_t bwn_tab_noise_g1[] = BWN_TAB_NOISE_G1;
+static const uint16_t bwn_tab_noise_g2[] = BWN_TAB_NOISE_G2;
+static const uint16_t bwn_tab_noisescale_g1[] = BWN_TAB_NOISESCALE_G1;
+static const uint16_t bwn_tab_noisescale_g2[] = BWN_TAB_NOISESCALE_G2;
+static const uint16_t bwn_tab_noisescale_g3[] = BWN_TAB_NOISESCALE_G3;
+const uint8_t bwn_bitrev_table[256] = BWN_BITREV_TABLE;
+
+#define        VENDOR_LED_ACT(vendor)                          \
+{                                                      \
+       .vid = PCI_VENDOR_##vendor,                     \
+       .led_act = { BWN_VENDOR_LED_ACT_##vendor }      \
+}
+
+static const struct {
+       uint16_t        vid;
+       uint8_t         led_act[BWN_LED_MAX];

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to