svn commit: r299097 - in head: share/man/man4 sys/conf sys/dev/bhnd/bhndb sys/dev/bwn sys/modules sys/modules/bwn_pci

Adrian Chadd adrian at FreeBSD.org
Wed May 4 23:38:29 UTC 2016


Author: adrian
Date: Wed May  4 23:38:27 2016
New Revision: 299097
URL: https://svnweb.freebsd.org/changeset/base/299097

Log:
  [bwn] [bhnd] initial support for using bhnd for if_bwn devices.
  
  This is an initial work in progress to use the replacement bhnd
  bus code for devices which support it.
  
  * Add manpage updates for bhnd, bhndb, siba
  * Add kernel options for bhnd, bhndbus, etc
  * Add initial support in if_bwn_pci / if_bwn_mac for using bhnd
    as the bus transport for suppoted NICs
  * if_bwn_pci will eventually be the PCI bus glue to interface to bwn,
    which will use the right backend bus to attach to, versus direct
    nexus/bhnd attachments (as found in embedded broadcom devices.)
  
  The PCI glue defaults to probing at a lower level than the bwn glue,
  so bwn should still attach as per normal without a boot time tunable set.
  
  It's also not fully fleshed out - the bwn probe/attach code needs to be
  broken out into platform and bus specific things (just like ath, ath_pci,
  ath_ahb) before we can shift the driver over to using this.
  
  Tested:
  
  * BCM4311, STA mode
  * BCM4312, STA mode
  
  Submitted by:	Landon Fuller <landonf at landonf.org>
  Differential Revision:	https://reviews.freebsd.org/D6191

Added:
  head/share/man/man4/bcma.4   (contents, props changed)
  head/share/man/man4/bhnd.4   (contents, props changed)
  head/share/man/man4/bhndb.4   (contents, props changed)
  head/sys/dev/bwn/bwn_mac.c   (contents, props changed)
  head/sys/dev/bwn/if_bwn.c.c   (contents, props changed)
  head/sys/dev/bwn/if_bwn_pci.c   (contents, props changed)
  head/sys/dev/bwn/if_bwn_pcivar.h   (contents, props changed)
  head/sys/modules/bwn_pci/
  head/sys/modules/bwn_pci/Makefile   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/share/man/man4/siba.4
  head/sys/conf/files
  head/sys/dev/bhnd/bhndb/bhndb.c
  head/sys/dev/bhnd/bhndb/bhndb_pci.c
  head/sys/dev/bhnd/bhndb/bhndb_subr.c
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/bwn/if_bwn_debug.h
  head/sys/modules/Makefile

Modified: head/share/man/man4/Makefile
==============================================================================
--- head/share/man/man4/Makefile	Wed May  4 23:32:57 2016	(r299096)
+++ head/share/man/man4/Makefile	Wed May  4 23:38:27 2016	(r299097)
@@ -71,9 +71,12 @@ MAN=	aac.4 \
 	axe.4 \
 	axge.4 \
 	bce.4 \
+	bcma.4 \
 	bfe.4 \
 	bge.4 \
 	${_bhyve.4} \
+	bhnd.4 \
+	bhndb.4 \
 	bktr.4 \
 	blackhole.4 \
 	bpf.4 \

Added: head/share/man/man4/bcma.4
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man4/bcma.4	Wed May  4 23:38:27 2016	(r299097)
@@ -0,0 +1,78 @@
+.\" Copyright (c) 2015 Landon Fuller
+.\" Copyright (c) 2010 Weongyo Jeong
+.\" 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 December 8, 2015
+.Dt BCMA 4
+.Os
+.Sh NAME
+.Nm bcma
+.Nd Broadcom AMBA Backplane 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 bhnd"
+.Cd "device bcma"
+.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
+bcma_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides
+.Xr bhnd 4
+support for devices using the ARM AMBA-based backplane architecture found
+in later Broadcom Home Networking Division's (HND) wireless chipsets and
+embedded systems.
+.Pp
+A common interconnect connects all of the backplane's functional
+blocks. These functional blocks, known as cores, use the ARM AMBA AXI or
+APB interface to communicate with devices attached to the interconnect.
+.Pp
+The IP cores used in
+.Xr siba 4
+devices were adapted by Broadcom for compatibility with the new
+interconnect.
+.Sh SEE ALSO
+.Xr bcma 4 ,
+.Xr bhnd 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 11.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Landon Fuller Aq Mt landon at landonf.org .

Added: head/share/man/man4/bhnd.4
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man4/bhnd.4	Wed May  4 23:38:27 2016	(r299097)
@@ -0,0 +1,83 @@
+.\" Copyright (c) 2015 Landon Fuller
+.\" 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 December 8, 2015
+.Dt BHND 4
+.Os
+.Sh NAME
+.Nm bhnd
+.Nd Broadcom Home Networking Division interconnect bus
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device bhnd"
+.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
+bhnd_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides a unified kernel bus interface to the on-chip
+interconnects used in Broadcom Home Networking Division (HND)
+devices.
+.Pp
+The Broadcom HND device family consists of SoCs (System On a Chip)
+and host-connected chipsets based on a common library of Broadcom IP
+cores connected via an internal hardware bus architecture. Drivers
+for these cores are implemented against the unified
+.Nm
+interface.
+.Pp
+The Sonic Inc. Silicon Backplane used in earlier HND devices is supported
+by the
+.Xr siba 4
+BHND driver.
+.Pp
+The ARM AMBA-based interconnect used in later HND devices is supported by
+the
+.Xr bcma 4
+BHND driver.
+.Sh SEE ALSO
+.Xr bhndb 4 ,
+.Xr bcma 4 ,
+.Xr siba 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 11.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Landon Fuller Aq Mt landon at landonf.org .

Added: head/share/man/man4/bhndb.4
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man4/bhndb.4	Wed May  4 23:38:27 2016	(r299097)
@@ -0,0 +1,72 @@
+.\" Copyright (c) 2015 Landon Fuller
+.\" 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 December 8, 2015
+.Dt BHNDB 4
+.Os
+.Sh NAME
+.Nm bhndb
+.Nd Broadcom Home Networking Division interconnect bridge 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 bhnd"
+.Cd "device bhndb"
+.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
+bhndb_load="YES"
+bhndb_pci_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports
+.Xr bhnd 4
+host bridge cores such as those used by Broadcom HND PCI,
+PCMCIA, and SDIO network adapters.
+.Sh SEE ALSO
+.Xr bhnd 4
+.Xr bwn 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 11.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Landon Fuller Aq Mt landon at landonf.org .
+.Sh CAVEATS
+The
+.Nm
+driver does not currently support PCMCIA or SDIO devices.

Modified: head/share/man/man4/siba.4
==============================================================================
--- head/share/man/man4/siba.4	Wed May  4 23:32:57 2016	(r299096)
+++ head/share/man/man4/siba.4	Wed May  4 23:38:27 2016	(r299097)
@@ -34,6 +34,7 @@
 To compile this driver into the kernel,
 place the following lines in your kernel configuration file:
 .Bd -ragged -offset indent
+.Cd "device bhnd"
 .Cd "device siba"
 .Ed
 .Pp
@@ -46,20 +47,17 @@ siba_load="YES"
 .Sh DESCRIPTION
 The
 .Nm
-driver supports the Sonic Inc. Silicon Backplane, the interblock
-communications architecture that can be found in most Broadcom
-wireless NICs.
+driver provides
+.Xr bhnd 4
+support for devices based on the Sonic Inc. Silicon Backplane, an
+interblock communications architecture found in earlier Broadcom Home
+Networking Division wireless chipsets and embedded systems.
 .Pp
-A bus connects all of the Silicon Backplane's functional blocks.
-These functional blocks, known as cores, use the Open Core Protocol
+A common interconnect connects all of the Silicon Backplane's functional
+blocks. These functional blocks, known as cores, use the Open Core Protocol
 (OCP) interface to communicate with agents attached to the Silicon
 Backplane.
 .Pp
-Each NIC uses a chip from the same chip family.
-Each member of the family contains a different set of cores, but
-shares basic architectural features such as address space definition,
-interrupt and error architecture, and backplane register definitions.
-.Pp
 Each core can have an initiator agent that passes read and write
 requests onto the system backplane and a target agent that returns
 responses to those requests.
@@ -67,22 +65,29 @@ Not all cores contain both an initiator 
 Initiator agents are present in cores that contain
 host interfaces (PCI, PCMCIA), embedded processors (MIPS),
 or DMA processors associated with communications cores.
-.Pp
-All cores other than PCMCIA have a target agent.
 .Sh SEE ALSO
-.Xr bwn 4
+.Xr bcma 4 ,
+.Xr bhnd 4
 .Sh HISTORY
 The
 .Nm
 device driver first appeared in
 .Fx 8.0 .
+The driver was rewritten for
+.Fx 11.0 .
+to support the common Broadcom
+.Xr bhnd 4
+bus interface.
 .Sh AUTHORS
 .An -nosplit
 The
 .Nm
-driver was written by
+driver was originally written by
 .An Bruce M. Simpson Aq Mt bms at FreeBSD.org
 and
 .An Weongyo Jeong Aq Mt weongyo at FreeBSD.org .
-.Sh CAVEATS
-Host mode is not supported at this moment.
+
+The driver was rewritten for
+.Fx 11.0 .
+by
+.An Landon Fuller Aq Mt landon at landonf.org .

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Wed May  4 23:32:57 2016	(r299096)
+++ head/sys/conf/files	Wed May  4 23:38:27 2016	(r299097)
@@ -1109,9 +1109,34 @@ dev/ath/ath_rate/sample/sample.c	optiona
 dev/ath/ath_dfs/null/dfs_null.c	optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 #
-dev/bce/if_bce.c		optional bce
-dev/bfe/if_bfe.c		optional bfe
-dev/bge/if_bge.c		optional bge
+dev/bce/if_bce.c			optional bce
+dev/bfe/if_bfe.c			optional bfe
+dev/bge/if_bge.c			optional bge
+dev/bhnd/bhnd.c				optional bhndbus | bhnd
+dev/bhnd/bhnd_subr.c			optional bhndbus | bhnd
+dev/bhnd/bhnd_bus_if.m			optional bhndbus | bhnd
+dev/bhnd/bhndb/bhndb.c			optional bhndbus | bhndb
+dev/bhnd/bhndb/bhndb_bus_if.m		optional bhndbus | bhndb
+dev/bhnd/bhndb/bhndb_hwdata.c		optional bhndbus | bhndb
+dev/bhnd/bhndb/bhndb_if.m		optional bhndbus | bhndb
+dev/bhnd/bhndb/bhndb_pci.c		optional bhndbus pci | bhndb pci
+dev/bhnd/bhndb/bhndb_pci_hwdata.c 	optional bhndbus pci | bhndb pci
+dev/bhnd/bhndb/bhndb_subr.c		optional bhndbus pci | bhndb
+dev/bhnd/bcma/bcma.c			optional bhndbus | bcma
+dev/bhnd/bcma/bcma_bhndb.c		optional bhndbus | bcma bhndb
+dev/bhnd/bcma/bcma_erom.c		optional bhndbus | bcma
+dev/bhnd/bcma/bcma_subr.c		optional bhndbus | bcma
+dev/bhnd/cores/chipc/chipc.c		optional bhndbus | bhnd
+dev/bhnd/cores/chipc/bhnd_chipc_if.m	optional bhndbus | bhnd
+dev/bhnd/cores/pci/bhnd_pci.c		optional bhndbus pci | bhnd pci
+dev/bhnd/cores/pci/bhnd_pci_hostb.c	optional bhndbus pci | bhndb pci
+dev/bhnd/cores/pci/bhnd_pcib.c		optional bhnd_pcib bhnd pci
+dev/bhnd/nvram/bhnd_nvram_if.m		optional bhndbus | bhnd
+dev/bhnd/siba/siba.c			optional bhndbus | siba
+dev/bhnd/siba/siba_bhndb.c		optional bhndbus | siba bhndb
+dev/bhnd/siba/siba_nexus.c		optional siba_nexus siba
+dev/bhnd/siba/siba_subr.c		optional bhndbus | siba
+#
 dev/bktr/bktr_audio.c		optional bktr pci
 dev/bktr/bktr_card.c		optional bktr pci
 dev/bktr/bktr_core.c		optional bktr pci
@@ -1132,10 +1157,12 @@ dev/bwi/if_bwi_pci.c		optional bwi pci
 # XXX Work around clang warning, until maintainer approves fix.
 dev/bwn/if_bwn.c		optional bwn siba_bwn \
 	compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
+dev/bwn/if_bwn_pci.c		optional bwn pci bhnd | bwn pci bhndbus
 dev/bwn/if_bwn_phy_g.c		optional bwn siba_bwn \
 	compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
 dev/bwn/if_bwn_phy_lp.c		optional bwn siba_bwn \
 	compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
+dev/bwn/bwn_mac.c		optional bwn bhnd | bwn bhndbus
 dev/cardbus/cardbus.c		optional cardbus
 dev/cardbus/cardbus_cis.c	optional cardbus
 dev/cardbus/cardbus_device.c	optional cardbus
@@ -2400,11 +2427,11 @@ dev/si/si3_t225.c		optional si
 dev/si/si_eisa.c		optional si eisa
 dev/si/si_isa.c			optional si isa
 dev/si/si_pci.c			optional si pci
-dev/siba/siba.c			optional siba
+dev/siba/siba.c			optional siba !bhnd !bhndbus
 dev/siba/siba_bwn.c		optional siba_bwn pci
-dev/siba/siba_cc.c		optional siba
+dev/siba/siba_cc.c		optional siba !bhnd !bhndbus
 dev/siba/siba_core.c		optional siba | siba_bwn pci
-dev/siba/siba_pcib.c		optional siba pci
+dev/siba/siba_pcib.c		optional siba pci !bhnd !bhndbus
 dev/siis/siis.c			optional siis pci
 dev/sis/if_sis.c		optional sis pci
 dev/sk/if_sk.c			optional sk pci

Modified: head/sys/dev/bhnd/bhndb/bhndb.c
==============================================================================
--- head/sys/dev/bhnd/bhndb/bhndb.c	Wed May  4 23:32:57 2016	(r299096)
+++ head/sys/dev/bhnd/bhndb/bhndb.c	Wed May  4 23:38:27 2016	(r299097)
@@ -536,8 +536,7 @@ bhndb_attach(device_t dev, bhnd_devclass
 	}
 
 	/* Attach our bridged bus device */
-	sc->bus_dev = BUS_ADD_CHILD(dev, 0, devclass_get_name(bhnd_devclass),
-	    -1);
+	sc->bus_dev = BUS_ADD_CHILD(dev, 0, "bhnd", -1);
 	if (sc->bus_dev == NULL) {
 		error = ENXIO;
 		goto failed;

Modified: head/sys/dev/bhnd/bhndb/bhndb_pci.c
==============================================================================
--- head/sys/dev/bhnd/bhndb/bhndb_pci.c	Wed May  4 23:32:57 2016	(r299096)
+++ head/sys/dev/bhnd/bhndb/bhndb_pci.c	Wed May  4 23:38:27 2016	(r299097)
@@ -464,6 +464,7 @@ DEFINE_CLASS_1(bhndb, bhndb_pci_driver, 
     sizeof(struct bhndb_pci_softc), bhndb_driver);
 
 MODULE_VERSION(bhndb_pci, 1);
-MODULE_DEPEND(bhndb_pci, bhnd_pci, 1, 1, 1);
+MODULE_DEPEND(bhndb_pci, bhnd_pci_hostb, 1, 1, 1);
 MODULE_DEPEND(bhndb_pci, pci, 1, 1, 1);
 MODULE_DEPEND(bhndb_pci, bhndb, 1, 1, 1);
+MODULE_DEPEND(bhndb_pci, bhnd, 1, 1, 1);

Modified: head/sys/dev/bhnd/bhndb/bhndb_subr.c
==============================================================================
--- head/sys/dev/bhnd/bhndb/bhndb_subr.c	Wed May  4 23:32:57 2016	(r299096)
+++ head/sys/dev/bhnd/bhndb/bhndb_subr.c	Wed May  4 23:38:27 2016	(r299097)
@@ -52,8 +52,7 @@ bhndb_attach_bridge(device_t parent, dev
 {
 	int error;
 
-	*bhndb = device_add_child(parent, devclass_get_name(bhndb_devclass),
-	    unit);
+	*bhndb = device_add_child(parent, "bhndb", unit);
 	if (*bhndb == NULL)
 		return (ENXIO);
 

Added: head/sys/dev/bwn/bwn_mac.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/bwn/bwn_mac.c	Wed May  4 23:38:27 2016	(r299097)
@@ -0,0 +1,141 @@
+/*-
+ * Copyright (c) 2015 Landon Fuller <landon at landonf.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$");
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/systm.h>
+
+#include <machine/bus.h>
+#include <sys/rman.h>
+#include <machine/resource.h>
+
+#include <dev/bhnd/bhnd.h>
+#include <dev/bhnd/bhnd_ids.h>
+
+static const struct resource_spec bwn_rspec[] = {
+	{ SYS_RES_MEMORY,	0,	RF_ACTIVE },
+	{ -1, -1, 0 }
+};
+
+#define	RSPEC_LEN	(sizeof(bwn_rspec)/sizeof(bwn_rspec[0]))
+
+struct bwn_softc {
+	struct resource_spec	rspec[RSPEC_LEN];
+	struct bhnd_resource	*res[RSPEC_LEN-1];
+};
+
+static const struct bwn_device {
+	uint16_t	 vendor;
+	uint16_t	 device;
+} bwn_devices[] = {
+	{ BHND_MFGID_BCM,	BHND_COREID_D11 },
+	{ BHND_MFGID_INVALID,	BHND_COREID_INVALID }
+};
+
+static int
+bwn_probe(device_t dev)
+{
+	const struct bwn_device	*id;
+
+	for (id = bwn_devices; id->device != BHND_COREID_INVALID; id++)
+	{
+		if (bhnd_get_vendor(dev) == id->vendor &&
+		    bhnd_get_device(dev) == id->device)
+		{
+			device_set_desc(dev, bhnd_get_device_name(dev));
+			return (BUS_PROBE_DEFAULT);
+		}
+	}
+
+	return (ENXIO);
+}
+
+static int
+bwn_attach(device_t dev)
+{
+	struct bwn_softc	*sc;
+	struct bhnd_resource	*r;
+	int			 error;
+
+	sc = device_get_softc(dev);
+
+	memcpy(sc->rspec, bwn_rspec, sizeof(bwn_rspec));
+	if ((error = bhnd_alloc_resources(dev, sc->rspec, sc->res)))
+		return (error);
+
+	// XXX TODO
+	r = sc->res[0];
+	device_printf(dev, "got rid=%d res=%p\n", sc->rspec[0].rid, r);
+
+	return (0);
+}
+
+static int
+bwn_detach(device_t dev)
+{
+	struct bwn_softc	*sc;
+
+	sc = device_get_softc(dev);
+	bhnd_release_resources(dev, sc->rspec, sc->res);
+
+	return (0);
+}
+
+static int
+bwn_suspend(device_t dev)
+{
+	return (0);
+}
+
+static int
+bwn_resume(device_t dev)
+{
+	return (0);
+}
+
+static device_method_t bwn_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe,		bwn_probe),
+	DEVMETHOD(device_attach,	bwn_attach),
+	DEVMETHOD(device_detach,	bwn_detach),
+	DEVMETHOD(device_suspend,	bwn_suspend),
+	DEVMETHOD(device_resume,	bwn_resume),
+	DEVMETHOD_END
+};
+
+static devclass_t bwn_devclass;
+
+DEFINE_CLASS_0(bwn, bwn_driver, bwn_methods, sizeof(struct bwn_softc));
+DRIVER_MODULE(bwn_mac, bhnd, bwn_driver, bwn_devclass, 0, 0);
+MODULE_DEPEND(bwn_mac, bhnd, 1, 1, 1);
+MODULE_VERSION(bwn_mac, 1);

Modified: head/sys/dev/bwn/if_bwn.c
==============================================================================
--- head/sys/dev/bwn/if_bwn.c	Wed May  4 23:32:57 2016	(r299096)
+++ head/sys/dev/bwn/if_bwn.c	Wed May  4 23:38:27 2016	(r299097)
@@ -6879,3 +6879,4 @@ MODULE_DEPEND(bwn, siba_bwn, 1, 1, 1);
 MODULE_DEPEND(bwn, wlan, 1, 1, 1);		/* 802.11 media layer */
 MODULE_DEPEND(bwn, firmware, 1, 1, 1);		/* firmware support */
 MODULE_DEPEND(bwn, wlan_amrr, 1, 1, 1);
+MODULE_VERSION(bwn, 1);

Added: head/sys/dev/bwn/if_bwn.c.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/bwn/if_bwn.c.c	Wed May  4 23:38:27 2016	(r299097)
@@ -0,0 +1,6881 @@
+/*-
+ * Copyright (c) 2009-2010 Weongyo Jeong <weongyo at 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/kernel.h>
+#include <sys/malloc.h>
+#include <sys/module.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_var.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_phy.h>
+#include <net80211/ieee80211_ratectl.h>
+
+#include <dev/bwn/if_bwnreg.h>
+#include <dev/bwn/if_bwnvar.h>
+
+#include <dev/bwn/if_bwn_debug.h>
+#include <dev/bwn/if_bwn_misc.h>
+#include <dev/bwn/if_bwn_phy_g.h>
+#include <dev/bwn/if_bwn_phy_lp.h>
+
+static 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_RWTUN, &bwn_debug, 0,
+    "Broadcom debugging printfs");
+#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 void	bwn_attach_pre(struct bwn_softc *);
+static int	bwn_attach_post(struct bwn_softc *);
+static void	bwn_sprom_bugfixes(device_t);
+static int	bwn_init(struct bwn_softc *);
+static void	bwn_parent(struct ieee80211com *);
+static void	bwn_start(struct bwn_softc *);
+static int	bwn_transmit(struct ieee80211com *, struct mbuf *);
+static int	bwn_attach_core(struct bwn_mac *);
+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 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_updateslot(struct ieee80211com *);
+static void	bwn_update_promisc(struct ieee80211com *);
+static void	bwn_wme_init(struct bwn_mac *);
+static int	bwn_wme_update(struct ieee80211com *);
+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_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, enum ieee80211_opmode, 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 *);
+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_bt_disable(struct bwn_mac *);
+static int	bwn_chip_init(struct bwn_mac *);
+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_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 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 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 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 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_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_sysctl_node(struct bwn_softc *);
+
+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 },

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-head mailing list