Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147759069
D6191.id15860.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
32 KB
Referenced Files
None
Subscribers
None
D6191.id15860.diff
View Options
Index: share/man/man4/Makefile
===================================================================
--- share/man/man4/Makefile
+++ share/man/man4/Makefile
@@ -71,9 +71,12 @@
axe.4 \
axge.4 \
bce.4 \
+ bcma.4 \
bfe.4 \
bge.4 \
${_bhyve.4} \
+ bhnd.4 \
+ bhndb.4 \
bktr.4 \
blackhole.4 \
bpf.4 \
Index: share/man/man4/bcma.4
===================================================================
--- share/man/man4/bcma.4
+++ share/man/man4/bcma.4
@@ -1,3 +1,4 @@
+.\" Copyright (c) 2015 Landon Fuller
.\" Copyright (c) 2010 Weongyo Jeong
.\" All rights reserved.
.\"
@@ -24,65 +25,54 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 8, 2010
-.Dt SIBA 4
+.Dd December 8, 2015
+.Dt BCMA 4
.Os
.Sh NAME
-.Nm siba
-.Nd Sonic Inc. Silicon Backplane driver
+.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 siba"
+.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
-siba_load="YES"
+bcma_load="YES"
.Ed
.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 using the ARM AMBA-based backplane architecture found
+in later Broadcom Home Networking Division's (HND) 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
-(OCP) interface to communicate with agents attached to the Silicon
-Backplane.
+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
-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.
-Not all cores contain both an initiator and a target agent.
-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.
+The IP cores used in
+.Xr siba 4
+devices were adapted by Broadcom for compatibility with the new
+interconnect.
.Sh SEE ALSO
-.Xr bwn 4
+.Xr bcma 4 ,
+.Xr bhnd 4
.Sh HISTORY
The
.Nm
device driver first appeared in
-.Fx 8.0 .
+.Fx 11.0 .
.Sh AUTHORS
.An -nosplit
The
.Nm
driver was written by
-.An Bruce M. Simpson Aq Mt bms@FreeBSD.org
-and
-.An Weongyo Jeong Aq Mt weongyo@FreeBSD.org .
-.Sh CAVEATS
-Host mode is not supported at this moment.
+.An Landon Fuller Aq Mt landon@landonf.org .
Index: share/man/man4/bhnd.4
===================================================================
--- share/man/man4/bhnd.4
+++ share/man/man4/bhnd.4
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2010 Weongyo Jeong
+.\" Copyright (c) 2015 Landon Fuller
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -24,65 +24,60 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 8, 2010
-.Dt SIBA 4
+.Dd December 8, 2015
+.Dt BHND 4
.Os
.Sh NAME
-.Nm siba
-.Nd Sonic Inc. Silicon Backplane driver
+.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 siba"
+.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
-siba_load="YES"
+bhnd_load="YES"
.Ed
.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 a unified kernel bus interface to the on-chip
+interconnects used in Broadcom Home Networking Division (HND)
+devices.
.Pp
-A bus 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.
+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
-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.
-Not all cores contain both an initiator and a target agent.
-Initiator agents are present in cores that contain
-host interfaces (PCI, PCMCIA), embedded processors (MIPS),
-or DMA processors associated with communications cores.
+The Sonic Inc. Silicon Backplane used in earlier HND devices is supported
+by the
+.Xr siba 4
+BHND driver.
.Pp
-All cores other than PCMCIA have a target agent.
+The ARM AMBA-based interconnect used in later HND devices is supported by
+the
+.Xr bcma 4
+BHND driver.
.Sh SEE ALSO
-.Xr bwn 4
+.Xr bhndb 4 ,
+.Xr bcma 4 ,
+.Xr siba 4
.Sh HISTORY
The
.Nm
device driver first appeared in
-.Fx 8.0 .
+.Fx 11.0 .
.Sh AUTHORS
.An -nosplit
The
.Nm
driver was written by
-.An Bruce M. Simpson Aq Mt bms@FreeBSD.org
-and
-.An Weongyo Jeong Aq Mt weongyo@FreeBSD.org .
-.Sh CAVEATS
-Host mode is not supported at this moment.
+.An Landon Fuller Aq Mt landon@landonf.org .
Index: share/man/man4/bhndb.4
===================================================================
--- share/man/man4/bhndb.4
+++ share/man/man4/bhndb.4
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2010 Weongyo Jeong
+.\" Copyright (c) 2015 Landon Fuller
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -24,65 +24,49 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 8, 2010
-.Dt SIBA 4
+.Dd December 8, 2015
+.Dt BHNDB 4
.Os
.Sh NAME
-.Nm siba
-.Nd Sonic Inc. Silicon Backplane driver
+.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 siba"
+.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
-siba_load="YES"
+bhndb_load="YES"
+bhndb_pci_load="YES"
.Ed
.Sh DESCRIPTION
The
.Nm
-driver supports the Sonic Inc. Silicon Backplane, the interblock
-communications architecture that can be found in most Broadcom
-wireless NICs.
-.Pp
-A bus 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.
-Not all cores contain both an initiator and a target agent.
-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.
+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 8.0 .
+.Fx 11.0 .
.Sh AUTHORS
.An -nosplit
The
.Nm
driver was written by
-.An Bruce M. Simpson Aq Mt bms@FreeBSD.org
-and
-.An Weongyo Jeong Aq Mt weongyo@FreeBSD.org .
+.An Landon Fuller Aq Mt landon@landonf.org .
.Sh CAVEATS
-Host mode is not supported at this moment.
+The
+.Nm
+driver does not currently support PCMCIA or SDIO devices.
Index: share/man/man4/siba.4
===================================================================
--- share/man/man4/siba.4
+++ share/man/man4/siba.4
@@ -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 @@
.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 @@
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@FreeBSD.org
and
.An Weongyo Jeong Aq Mt weongyo@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@landonf.org .
Index: sys/conf/files
===================================================================
--- sys/conf/files
+++ sys/conf/files
@@ -1109,9 +1109,34 @@
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 @@
# 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/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
Index: sys/dev/bhnd/bhndb/bhndb.c
===================================================================
--- sys/dev/bhnd/bhndb/bhndb.c
+++ sys/dev/bhnd/bhndb/bhndb.c
@@ -536,8 +536,7 @@
}
/* 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;
Index: sys/dev/bhnd/bhndb/bhndb_pci.c
===================================================================
--- sys/dev/bhnd/bhndb/bhndb_pci.c
+++ sys/dev/bhnd/bhndb/bhndb_pci.c
@@ -464,6 +464,7 @@
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);
Index: sys/dev/bhnd/bhndb/bhndb_subr.c
===================================================================
--- sys/dev/bhnd/bhndb/bhndb_subr.c
+++ sys/dev/bhnd/bhndb/bhndb_subr.c
@@ -52,8 +52,7 @@
{
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);
Index: sys/dev/bwn/bwn_mac.c
===================================================================
--- /dev/null
+++ sys/dev/bwn/bwn_mac.c
@@ -0,0 +1,141 @@
+/*-
+ * Copyright (c) 2015 Landon Fuller <landon@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_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);
Index: sys/dev/bwn/if_bwn.c
===================================================================
--- sys/dev/bwn/if_bwn.c
+++ sys/dev/bwn/if_bwn.c
@@ -6886,3 +6886,4 @@
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);
Index: sys/dev/bwn/if_bwn_pci.c
===================================================================
--- /dev/null
+++ sys/dev/bwn/if_bwn_pci.c
@@ -0,0 +1,288 @@
+/*-
+ * Copyright (c) 2015 Landon Fuller <landon@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/bus.h>
+#include <sys/module.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+
+#include <dev/bhnd/bhndb/bhndb_pcivar.h>
+#include <dev/bhnd/bhndb/bhndb_pci_hwdata.h>
+
+#include <dev/bhnd/bhnd_ids.h>
+
+#include "bhndb_bus_if.h"
+
+#include "if_bwn_pcivar.h"
+
+/* If non-zero, enable attachment of BWN_QUIRK_UNTESTED devices */
+static int attach_untested = 0;
+TUNABLE_INT("hw.bwn_pci.attach_untested", &attach_untested);
+
+/* If non-zero, probe at a higher priority than the stable if_bwn driver. */
+static int prefer_new_driver = 0;
+TUNABLE_INT("hw.bwn_pci.preferred", &prefer_new_driver);
+
+/* SIBA Devices */
+static const struct bwn_pci_device siba_devices[] = {
+ BWN_BCM_DEV(BCM4301, "BCM4301 802.11b",
+ BWN_QUIRK_ENET_HW_UNPOPULATED),
+
+ BWN_BCM_DEV(BCM4306, "BCM4306 802.11b/g", 0),
+ BWN_BCM_DEV(BCM4306_D11G, "BCM4306 802.11g", 0),
+ BWN_BCM_DEV(BCM4306_D11A, "BCM4306 802.11a",
+ BWN_QUIRK_WLAN_DUALCORE),
+ BWN_BCM_DEV(BCM4306_D11DUAL, "BCM4306 802.11a/b",
+ BWN_QUIRK_WLAN_DUALCORE),
+ BWN_BCM_DEV(BCM4306_D11G_ID2, "BCM4306 802.11g", 0),
+
+ BWN_BCM_DEV(BCM4307, "BCM4307 802.11b", 0),
+
+ BWN_BCM_DEV(BCM4311_D11G, "BCM4311 802.11b/g", 0),
+ BWN_BCM_DEV(BCM4311_D11DUAL, "BCM4311 802.11a/b/g", 0),
+ BWN_BCM_DEV(BCM4311_D11A, "BCM4311 802.11a",
+ BWN_QUIRK_UNTESTED|BWN_QUIRK_WLAN_DUALCORE),
+
+ BWN_BCM_DEV(BCM4318_D11G, "BCM4318 802.11b/g", 0),
+ BWN_BCM_DEV(BCM4318_D11DUAL, "BCM4318 802.11a/b/g", 0),
+ BWN_BCM_DEV(BCM4318_D11A, "BCM4318 802.11a",
+ BWN_QUIRK_UNTESTED|BWN_QUIRK_WLAN_DUALCORE),
+
+ BWN_BCM_DEV(BCM4321_D11N, "BCM4321 802.11n Dual-Band", 0),
+ BWN_BCM_DEV(BCM4321_D11N2G, "BCM4321 802.11n 2GHz", 0),
+ BWN_BCM_DEV(BCM4321_D11N2G, "BCM4321 802.11n 5GHz",
+ BWN_QUIRK_UNTESTED),
+
+ BWN_BCM_DEV(BCM4322_D11N, "BCM4322 802.11n Dual-Band", 0),
+ BWN_BCM_DEV(BCM4322_D11N2G, "BCM4322 802.11n 2GHz",
+ BWN_QUIRK_UNTESTED),
+ BWN_BCM_DEV(BCM4322_D11N5G, "BCM4322 802.11n 5GHz",
+ BWN_QUIRK_UNTESTED),
+
+ BWN_BCM_DEV(BCM4328_D11G, "BCM4328/4312 802.11g", 0),
+
+ { 0, 0, NULL, 0 }
+};
+
+/** BCMA Devices */
+static const struct bwn_pci_device bcma_devices[] = {
+ BWN_BCM_DEV(BCM4331_D11N, "BCM4331 802.11n Dual-Band", 0),
+ BWN_BCM_DEV(BCM4331_D11N2G, "BCM4331 802.11n 2GHz", 0),
+ BWN_BCM_DEV(BCM4331_D11N5G, "BCM4331 802.11n 5GHz", 0),
+
+ { 0, 0, NULL, 0}
+};
+
+/** Device configuration table */
+static const struct bwn_pci_devcfg bwn_pci_devcfgs[] = {
+ /* SIBA devices */
+ {
+ .bridge_hwcfg = &bhndb_pci_siba_generic_hwcfg,
+ .bridge_hwtable = bhndb_pci_generic_hw_table,
+ .devices = siba_devices
+ },
+ /* BCMA devices */
+ {
+ .bridge_hwcfg = &bhndb_pci_bcma_generic_hwcfg,
+ .bridge_hwtable = bhndb_pci_generic_hw_table,
+ .devices = bcma_devices
+ },
+ { NULL, NULL, NULL }
+};
+
+/** Search the device configuration table for an entry matching @p dev. */
+static int
+bwn_pci_find_devcfg(device_t dev, const struct bwn_pci_devcfg **cfg,
+ const struct bwn_pci_device **device)
+{
+ const struct bwn_pci_devcfg *dvc;
+ const struct bwn_pci_device *dv;
+
+ for (dvc = bwn_pci_devcfgs; dvc->devices != NULL; dvc++) {
+ for (dv = dvc->devices; dv->device != 0; dv++) {
+ if (pci_get_vendor(dev) == dv->vendor &&
+ pci_get_device(dev) == dv->device)
+ {
+ if (cfg != NULL)
+ *cfg = dvc;
+
+ if (device != NULL)
+ *device = dv;
+
+ return (0);
+ }
+ }
+ }
+
+ return (ENOENT);
+}
+
+static int
+bwn_pci_probe(device_t dev)
+{
+ const struct bwn_pci_device *ident;
+
+ if (bwn_pci_find_devcfg(dev, NULL, &ident))
+ return (ENXIO);
+
+ /* Skip untested devices */
+ if (ident->quirks & BWN_QUIRK_UNTESTED && !attach_untested)
+ return (ENXIO);
+
+ device_set_desc(dev, ident->desc);
+
+ /* Until this driver is complete, require explicit opt-in before
+ * superceding if_bwn/siba_bwn. */
+ if (prefer_new_driver)
+ return (BUS_PROBE_DEFAULT+1);
+ else
+ return (BUS_PROBE_LOW_PRIORITY);
+
+ // return (BUS_PROBE_DEFAULT);
+}
+
+static int
+bwn_pci_attach(device_t dev)
+{
+ struct bwn_pci_softc *sc;
+ const struct bwn_pci_device *ident;
+ int error;
+
+ sc = device_get_softc(dev);
+ sc->dev = dev;
+
+ /* Find our hardware config */
+ if (bwn_pci_find_devcfg(dev, &sc->devcfg, &ident))
+ return (ENXIO);
+
+ /* Save quirk flags */
+ sc->quirks = ident->quirks;
+
+ /* Attach bridge device */
+ if ((error = bhndb_attach_bridge(dev, &sc->bhndb_dev, -1)))
+ return (ENXIO);
+
+ /* Success */
+ return (0);
+}
+
+static int
+bwn_pci_detach(device_t dev)
+{
+ return (bus_generic_detach(dev));
+}
+
+static void
+bwn_pci_probe_nomatch(device_t dev, device_t child)
+{
+ const char *name;
+
+ name = device_get_name(child);
+ if (name == NULL)
+ name = "unknown device";
+
+ device_printf(dev, "<%s> (no driver attached)\n", name);
+}
+
+static const struct bhndb_hwcfg *
+bwn_pci_get_generic_hwcfg(device_t dev, device_t child)
+{
+ struct bwn_pci_softc *sc = device_get_softc(dev);
+ return (sc->devcfg->bridge_hwcfg);
+}
+
+static const struct bhndb_hw *
+bwn_pci_get_bhndb_hwtable(device_t dev, device_t child)
+{
+ struct bwn_pci_softc *sc = device_get_softc(dev);
+ return (sc->devcfg->bridge_hwtable);
+}
+
+static bool
+bwn_pci_is_core_disabled(device_t dev, device_t child,
+ struct bhnd_core_info *core)
+{
+ struct bwn_pci_softc *sc;
+
+ sc = device_get_softc(dev);
+
+ switch (bhnd_core_class(core)) {
+ case BHND_DEVCLASS_WLAN:
+ if (core->unit > 0 && !(sc->quirks & BWN_QUIRK_WLAN_DUALCORE))
+ return (true);
+
+ return (false);
+
+ case BHND_DEVCLASS_ENET:
+ case BHND_DEVCLASS_ENET_MAC:
+ case BHND_DEVCLASS_ENET_PHY:
+ return ((sc->quirks & BWN_QUIRK_ENET_HW_UNPOPULATED) != 0);
+
+ default:
+ return (false);
+ }
+}
+
+static device_method_t bwn_pci_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, bwn_pci_probe),
+ DEVMETHOD(device_attach, bwn_pci_attach),
+ DEVMETHOD(device_detach, bwn_pci_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+
+ /* Bus interface */
+ DEVMETHOD(bus_probe_nomatch, bwn_pci_probe_nomatch),
+
+ /* BHNDB_BUS Interface */
+ DEVMETHOD(bhndb_bus_get_generic_hwcfg, bwn_pci_get_generic_hwcfg),
+ DEVMETHOD(bhndb_bus_get_hardware_table, bwn_pci_get_bhndb_hwtable),
+ DEVMETHOD(bhndb_bus_is_core_disabled, bwn_pci_is_core_disabled),
+
+ DEVMETHOD_END
+};
+
+static devclass_t bwn_pci_devclass;
+
+DEFINE_CLASS_0(bwn_pci, bwn_pci_driver, bwn_pci_methods, sizeof(struct bwn_pci_softc));
+DRIVER_MODULE(bwn_pci, pci, bwn_pci_driver, bwn_pci_devclass, NULL, NULL);
+DRIVER_MODULE(bhndb, bwn_pci, bhndb_pci_driver, bhndb_devclass, NULL, NULL);
+
+MODULE_DEPEND(bwn_pci, bwn, 1, 1, 1);
+MODULE_DEPEND(bwn_pci, bhndb, 1, 1, 1);
+MODULE_DEPEND(bwn_pci, bhndb_pci, 1, 1, 1);
+MODULE_DEPEND(bwn_pci, bcma_bhndb, 1, 1, 1);
+MODULE_DEPEND(bwn_pci, siba_bhndb, 1, 1, 1);
Index: sys/dev/bwn/if_bwn_pcivar.h
===================================================================
--- /dev/null
+++ sys/dev/bwn/if_bwn_pcivar.h
@@ -0,0 +1,93 @@
+/*-
+ * Copyright (c) 2015 Landon Fuller <landon@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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _IF_BWN_PCIVAR_H_
+#define _IF_BWN_PCIVAR_H_
+
+struct bwn_pci_devcfg;
+
+/** bwn_pci per-instance state. */
+struct bwn_pci_softc {
+ device_t dev; /**< device */
+ device_t bhndb_dev; /**< bhnd bridge device */
+ const struct bwn_pci_devcfg *devcfg; /**< bwn device config */
+ uint32_t quirks; /**< quirk flags */
+};
+
+/* bwn device quirks */
+enum {
+ /** No quirks */
+ BWN_QUIRK_NONE = 0,
+
+ /**
+ * This model/revision has not been tested and may not work.
+ */
+ BWN_QUIRK_UNTESTED = 1<<0,
+
+ /**
+ * Early dual-band devices did not support accessing multiple PHYs
+ * from a single WLAN core, and instead used seperate 2GHz and 5GHz
+ * WLAN cores.
+ *
+ * However, not all cards with two WLAN cores are fully populated;
+ * we must whitelist the boards on which a second WLAN core is actually
+ * usable.
+ */
+ BWN_QUIRK_WLAN_DUALCORE = 1<<1,
+
+ /**
+ * Some early devices shipped with unconnected ethernet cores; set
+ * this quirk to treat these cores as unpopulated.
+ */
+ BWN_QUIRK_ENET_HW_UNPOPULATED = 1<<2,
+};
+
+/* PCI device descriptor */
+struct bwn_pci_device {
+ uint16_t vendor;
+ uint16_t device;
+ const char *desc;
+ uint32_t quirks;
+};
+
+
+#define BWN_BCM_DEV(_devid, _desc, _quirks) \
+ { PCI_VENDOR_BROADCOM, PCI_DEVID_ ## _devid, \
+ "Broadcom " _desc " Wireless", _quirks }
+
+/* Supported device table */
+struct bwn_pci_devcfg {
+ const struct bhndb_hwcfg *bridge_hwcfg;
+ const struct bhndb_hw *bridge_hwtable;
+ const struct bwn_pci_device *devices;
+};
+
+#endif /* _IF_BWN_PCIVAR_H_ */
\ No newline at end of file
Index: sys/modules/Makefile
===================================================================
--- sys/modules/Makefile
+++ sys/modules/Makefile
@@ -51,6 +51,7 @@
${_bce} \
bfe \
bge \
+ bhnd \
${_bxe} \
${_bios} \
${_bktr} \
@@ -58,6 +59,7 @@
bridgestp \
bwi \
bwn \
+ bwn_pci \
cam \
${_canbepm} \
${_canbus} \
Index: sys/modules/bwn_pci/Makefile
===================================================================
--- /dev/null
+++ sys/modules/bwn_pci/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../dev/bwn
+
+KMOD= if_bwn_pci
+SRCS= if_bwn_pci.c bwn_mac.c
+SRCS+= device_if.h bus_if.h pci_if.h \
+ bhnd_bus_if.h bhndb_bus_if.h \
+ bhndb_if.h
+
+.include <bsd.kmod.mk>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 14, 11:15 AM (20 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29667133
Default Alt Text
D6191.id15860.diff (32 KB)
Attached To
Mode
D6191: Integrate bhnd(4) and bhnd-based if_bwn_pci.
Attached
Detach File
Event Timeline
Log In to Comment