freebsd-dev/sys
Landon J. Fuller 8d14ca9c99 Introduce bwn(4) support for the bhnd(4) bus.
Currently, bwn(4) relies on the siba_bwn(4) bus driver to provide support
for the on-chip SSB interconnect found in Broadcom's older PCI(e) Wi-Fi
adapters. Non-PCI Wi-Fi adapters, as well as the newer BCMA interconnect
found in post-2009 Broadcom Wi-Fi hardware, are not supported by
siba_bwn(4).

The bhnd(4) bus driver (also used by the FreeBSD/MIPS Broadcom port)
provides a unified kernel interface to a superset of the hardware supported
by siba_bwn; by attaching bwn(4) via bhnd(4), we can support both modern
PCI(e) Wi-Fi devices based on the BCMA backplane interconnect, as well as
Broadcom MIPS WiSoCs that include a D11 MAC core directly attached to their
SSB or BCMA backplane.

This diff introduces opt-in bwn(4) support for bhnd(4) by providing:

 - A small bwn(4) driver subclass, if_bwn_bhnd, that attaches via
   bhnd(4) instead of siba_bwn(4).
 - A bhndb(4)-based PCI host bridge driver, if_bwn_pci, that optionally
   probes at a higher priority than the siba_bwn(4) PCI driver.
 - A set of compatibility shims that perform translation of bwn(4)'s
   siba_bwn function calls into their bhnd(9) API equivalents when bwn(4)
   is attached via a bhnd(4) bus parent. When bwn(4) is attached via
   siba_bwn(4), all siba_bwn function calls are simply passed through to
   their original implementations.

To test bwn(4) with bhnd(4), place the following lines in loader.conf(5):

  hw.bwn_pci.preferred="1"

  if_bwn_pci_load="YES
  bwn_v4_ucode_load="YES"
  bwn_v4_lp_ucode_load="YES"

To verify that bwn(4) is using bhnd(4), you can check dmesg:

  bwn0: <Broadcom 802.11 MAC/PHY/Radio, rev 15> ... on bhnd0

... or devinfo(8):

pcib2
  pci2
    bwn_pci0
      bhndb0
        bhnd0
          bwn0
          ...

bwn(4)/bhnd(4) has been tested for regressions with most chipsets currently
supported by bwn(4), including:

  - BCM4312
  - BCM4318
  - BCM4321

With minimal changes to the DMA code (not included in this commit), I was
also able to test support for newer BCMA devices by bringing up basic
working Wi-Fi on two previously unsupported, BCMA-based N-PHY chipsets:

  - BCM43224
  - BCM43225

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation & Plausible Labs
Differential Revision:	https://reviews.freebsd.org/D13041
2017-12-02 02:21:27 +00:00
..
amd64 It's time to retire AHC_REG_PRETTY_PRINT and AHD_REG_PRETTY_PRINT from 2017-11-29 23:41:49 +00:00
arm a10_gpio: Add support for more modern pin configuration 2017-12-01 20:51:08 +00:00
arm64 Port cloudabi32.ko to FreeBSD/arm64. 2017-11-30 17:58:48 +00:00
bsm sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
cam sys/cam: further adoption of SPDX licensing ID tags. 2017-11-27 15:12:43 +00:00
cddl Fix all warnings related to geli and ZFS support on x86. 2017-12-02 00:07:37 +00:00
compat Disable vim syntax highlighting. 2017-11-28 18:23:17 +00:00
conf Introduce bwn(4) support for the bhnd(4) bus. 2017-12-02 02:21:27 +00:00
contrib Switch the default firmware for npe(4) from the QOS_VLAN one to the 2017-11-24 15:48:17 +00:00
crypto sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
ddb SPDX: oops .. not from CMU. 2017-11-30 15:58:38 +00:00
dev Introduce bwn(4) support for the bhnd(4) bus. 2017-12-02 02:21:27 +00:00
dts
fs r326394 is calling malloc with M_WAITOK under a lock, revert for now 2017-11-30 14:06:54 +00:00
gdb sys/gdb: further adoption of SPDX licensing ID tags. 2017-11-27 15:16:59 +00:00
geom We don't need both _STAND and _STANDALONE. There's more places that 2017-12-02 00:07:09 +00:00
gnu Introduce bwn(4) support for the bhnd(4) bus. 2017-12-02 02:21:27 +00:00
i386 SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
isa sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
kern Plug a name cache lock leak. 2017-12-01 22:51:02 +00:00
kgssapi sys/kgssapi: general adoption of SPDX licensing ID tags. 2017-11-27 15:49:00 +00:00
libkern sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
mips SPDX: Consider code from Carnegie-Mellon University. 2017-11-30 15:48:35 +00:00
modules Introduce bwn(4) support for the bhnd(4) bus. 2017-12-02 02:21:27 +00:00
net Add support for SIOCGIFXMEDIA to iflib 2017-12-01 17:58:20 +00:00
net80211 sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
netgraph sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
netinet sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
netinet6 sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
netipsec Do better cleaning in key_destroy() for VIMAGE case. 2017-12-01 09:59:42 +00:00
netpfil SPDX: Fix some cases wrongly attributed to MIT. 2017-11-30 15:10:11 +00:00
netsmb sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
nfs sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
nfsclient sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
nfsserver sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
nlm sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
ofed sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
opencrypto We don't need both _STAND and _STANDALONE. There's more places that 2017-12-02 00:07:09 +00:00
powerpc Override memattr for mmap on the Freescale DIU driver 2017-12-02 01:42:07 +00:00
riscv SPDX: Consider code from Carnegie-Mellon University. 2017-11-30 15:48:35 +00:00
rpc sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
security sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
sparc64 SPDX: Consider code from Carnegie-Mellon University. 2017-11-30 15:48:35 +00:00
sys We don't need both _STAND and _STANDALONE. There's more places that 2017-12-02 00:07:09 +00:00
teken sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
tests
tools sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
ufs sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
vm Add comment for vm_map_find_min(). 2017-12-01 10:53:08 +00:00
x86 SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
xdr sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
xen sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
Makefile