svn commit: r326454 - in head/sys: conf dev/bwn gnu/dev/bwn/phy_n modules/bwn modules/bwn_pci
Landon J. Fuller
landonf at FreeBSD.org
Sat Dec 2 02:21:30 UTC 2017
Author: landonf
Date: Sat Dec 2 02:21:27 2017
New Revision: 326454
URL: https://svnweb.freebsd.org/changeset/base/326454
Log:
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
Added:
head/sys/dev/bwn/if_bwn_bhnd.c (contents, props changed)
head/sys/dev/bwn/if_bwn_siba.c (contents, props changed)
head/sys/dev/bwn/if_bwn_siba.h (contents, props changed)
head/sys/dev/bwn/if_bwn_siba_compat.c (contents, props changed)
head/sys/dev/bwn/if_bwn_siba_compat.h (contents, props changed)
Deleted:
head/sys/dev/bwn/bwn_mac.c
Modified:
head/sys/conf/files
head/sys/conf/options
head/sys/dev/bwn/if_bwn.c
head/sys/dev/bwn/if_bwn_pci.c
head/sys/dev/bwn/if_bwn_pcivar.h
head/sys/dev/bwn/if_bwn_phy_common.c
head/sys/dev/bwn/if_bwn_phy_g.c
head/sys/dev/bwn/if_bwn_phy_lp.c
head/sys/dev/bwn/if_bwn_phy_n.c
head/sys/dev/bwn/if_bwn_util.c
head/sys/dev/bwn/if_bwnvar.h
head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c
head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c
head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2055.c
head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2056.c
head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c
head/sys/modules/bwn/Makefile
head/sys/modules/bwn_pci/Makefile
Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files Sat Dec 2 01:42:07 2017 (r326453)
+++ head/sys/conf/files Sat Dec 2 02:21:27 2017 (r326454)
@@ -1312,15 +1312,17 @@ dev/bwi/if_bwi_pci.c optional bwi pci
# XXX Work around clang warnings, 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
+dev/bwn/if_bwn_bhnd.c optional bwn bhnd
+dev/bwn/if_bwn_pci.c optional bwn pci bhnd bhndb
dev/bwn/if_bwn_phy_common.c optional bwn siba_bwn
dev/bwn/if_bwn_phy_g.c optional bwn siba_bwn \
compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED} ${NO_WCONSTANT_CONVERSION}"
dev/bwn/if_bwn_phy_lp.c optional bwn siba_bwn \
compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
dev/bwn/if_bwn_phy_n.c optional bwn siba_bwn
+dev/bwn/if_bwn_siba.c optional bwn siba_bwn
+dev/bwn/if_bwn_siba_compat.c optional bwn bhnd !bwn_use_siba
dev/bwn/if_bwn_util.c optional bwn siba_bwn
-dev/bwn/bwn_mac.c optional bwn bhnd
dev/cardbus/cardbus.c optional cardbus
dev/cardbus/cardbus_cis.c optional cardbus
dev/cardbus/cardbus_device.c optional cardbus
Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options Sat Dec 2 01:42:07 2017 (r326453)
+++ head/sys/conf/options Sat Dec 2 02:21:27 2017 (r326454)
@@ -850,6 +850,7 @@ BWI_DEBUG_VERBOSE opt_bwi.h
# options for the Brodacom BCM43xx driver (bwn)
BWN_DEBUG opt_bwn.h
BWN_GPL_PHY opt_bwn.h
+BWN_USE_SIBA opt_bwn.h
# Options for the SIBA driver
SIBA_DEBUG opt_siba.h
Modified: head/sys/dev/bwn/if_bwn.c
==============================================================================
--- head/sys/dev/bwn/if_bwn.c Sat Dec 2 01:42:07 2017 (r326453)
+++ head/sys/dev/bwn/if_bwn.c Sat Dec 2 02:21:27 2017 (r326454)
@@ -67,9 +67,6 @@ __FBSDID("$FreeBSD$");
#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>
@@ -77,6 +74,8 @@ __FBSDID("$FreeBSD$");
#include <net80211/ieee80211_phy.h>
#include <net80211/ieee80211_ratectl.h>
+#include <dev/bwn/if_bwn_siba.h>
+
#include <dev/bwn/if_bwnreg.h>
#include <dev/bwn/if_bwnvar.h>
@@ -498,11 +497,31 @@ static const struct siba_devid bwn_devs[] = {
SIBA_DEV(BROADCOM, 80211, 16, "Revision 16")
};
+static const struct bwn_bus_ops *
+bwn_get_bus_ops(device_t dev)
+{
+#if BWN_USE_SIBA
+ return (NULL);
+#else
+ devclass_t bus_cls;
+
+ bus_cls = device_get_devclass(device_get_parent(dev));
+ if (bus_cls == devclass_find("bhnd"))
+ return (&bwn_bhnd_bus_ops);
+ else
+ return (&bwn_siba_bus_ops);
+#endif
+}
+
static int
bwn_probe(device_t dev)
{
- int i;
+ struct bwn_softc *sc;
+ int i;
+ sc = device_get_softc(dev);
+ sc->sc_bus_ops = bwn_get_bus_ops(dev);
+
for (i = 0; i < nitems(bwn_devs); i++) {
if (siba_get_vendor(dev) == bwn_devs[i].sd_vendor &&
siba_get_device(dev) == bwn_devs[i].sd_device &&
@@ -513,7 +532,7 @@ bwn_probe(device_t dev)
return (ENXIO);
}
-static int
+int
bwn_attach(device_t dev)
{
struct bwn_mac *mac;
@@ -525,6 +544,13 @@ bwn_attach(device_t dev)
sc->sc_debug = bwn_debug;
#endif
+ sc->sc_bus_ops = bwn_get_bus_ops(dev);
+ if ((error = BWN_BUS_OPS_ATTACH(dev))) {
+ device_printf(sc->sc_dev,
+ "bus-specific initialization failed (%d)\n", error);
+ return (error);
+ }
+
if ((sc->sc_flags & BWN_FLAG_ATTACHED) == 0) {
bwn_attach_pre(sc);
bwn_sprom_bugfixes(dev);
@@ -631,6 +657,7 @@ fail1:
if (msic == BWN_MSI_MESSAGES && bwn_msi_disable == 0)
pci_release_msi(dev);
fail0:
+ BWN_BUS_OPS_DETACH(dev);
free(mac, M_DEVBUF);
return (error);
}
@@ -716,7 +743,7 @@ bwn_phy_detach(struct bwn_mac *mac)
mac->mac_phy.detach(mac);
}
-static int
+int
bwn_detach(device_t dev)
{
struct bwn_softc *sc = device_get_softc(dev);
@@ -756,6 +783,7 @@ bwn_detach(device_t dev)
mbufq_drain(&sc->sc_snd);
bwn_release_firmware(mac);
BWN_LOCK_DESTROY(sc);
+ BWN_BUS_OPS_DETACH(dev);
return (0);
}
@@ -1153,36 +1181,30 @@ bwn_attach_core(struct bwn_mac *mac)
{
struct bwn_softc *sc = mac->mac_sc;
int error, have_bg = 0, have_a = 0;
+ uint32_t high;
KASSERT(siba_get_revid(sc->sc_dev) >= 5,
("unsupported revision %d", siba_get_revid(sc->sc_dev)));
- if (bwn_is_bus_siba(mac)) {
- uint32_t high;
+ siba_powerup(sc->sc_dev, 0);
+ high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH);
+ have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0;
+ have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0;
+ if (high & BWN_TGSHIGH_DUALPHY) {
+ have_bg = 1;
+ have_a = 1;
+ }
- siba_powerup(sc->sc_dev, 0);
- high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH);
- have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0;
- have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0;
- if (high & BWN_TGSHIGH_DUALPHY) {
- have_bg = 1;
- have_a = 1;
- }
#if 0
- device_printf(sc->sc_dev, "%s: high=0x%08x, have_a=%d, have_bg=%d,"
- " deviceid=0x%04x, siba_deviceid=0x%04x\n",
- __func__,
- high,
- have_a,
- have_bg,
- siba_get_pci_device(sc->sc_dev),
- siba_get_chipid(sc->sc_dev));
+ device_printf(sc->sc_dev, "%s: high=0x%08x, have_a=%d, have_bg=%d,"
+ " deviceid=0x%04x, siba_deviceid=0x%04x\n",
+ __func__,
+ high,
+ have_a,
+ have_bg,
+ siba_get_pci_device(sc->sc_dev),
+ siba_get_chipid(sc->sc_dev));
#endif
- } else {
- device_printf(sc->sc_dev, "%s: not siba; bailing\n", __func__);
- error = ENXIO;
- goto fail;
- }
/*
* Guess at whether it has A-PHY or G-PHY.
@@ -1339,8 +1361,6 @@ fail:
/*
* Reset - SIBA.
- *
- * XXX TODO: implement BCMA version!
*/
void
bwn_reset_core(struct bwn_mac *mac, int g_mode)
@@ -2267,7 +2287,6 @@ bwn_chip_init(struct bwn_mac *mac)
bwn_mac_phy_clock_set(mac, true);
/* SIBA powerup */
- /* XXX TODO: BCMA powerup */
BWN_WRITE_2(mac, BWN_POWERUP_DELAY, siba_get_cc_powerdelay(sc->sc_dev));
return (error);
}
@@ -4717,10 +4736,10 @@ bwn_rf_turnoff(struct bwn_mac *mac)
}
/*
- * SSB PHY reset.
+ * PHY reset.
*/
static void
-bwn_phy_reset_siba(struct bwn_mac *mac)
+bwn_phy_reset(struct bwn_mac *mac)
{
struct bwn_softc *sc = mac->mac_sc;
@@ -4733,17 +4752,6 @@ bwn_phy_reset_siba(struct bwn_mac *mac)
DELAY(1000);
}
-static void
-bwn_phy_reset(struct bwn_mac *mac)
-{
-
- if (bwn_is_bus_siba(mac)) {
- bwn_phy_reset_siba(mac);
- } else {
- BWN_ERRPRINTF(mac->mac_sc, "%s: unknown bus!\n", __func__);
- }
-}
-
static int
bwn_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
{
@@ -7471,7 +7479,7 @@ static device_method_t bwn_methods[] = {
DEVMETHOD(device_resume, bwn_resume),
DEVMETHOD_END
};
-static driver_t bwn_driver = {
+driver_t bwn_driver = {
"bwn",
bwn_methods,
sizeof(struct bwn_softc)
@@ -7479,6 +7487,7 @@ static driver_t bwn_driver = {
static devclass_t bwn_devclass;
DRIVER_MODULE(bwn, siba_bwn, bwn_driver, bwn_devclass, 0, 0);
MODULE_DEPEND(bwn, siba_bwn, 1, 1, 1);
+MODULE_DEPEND(bwn, gpiobus, 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);
Added: head/sys/dev/bwn/if_bwn_bhnd.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/sys/dev/bwn/if_bwn_bhnd.c Sat Dec 2 02:21:27 2017 (r326454)
@@ -0,0 +1,107 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2016 Landon Fuller <landonf at FreeBSD.org>
+ * Copyright (c) 2017 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Landon Fuller
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/systm.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+
+#include <machine/bus.h>
+#include <sys/rman.h>
+#include <machine/resource.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 <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/bhnd/bhnd.h>
+#include <dev/bhnd/bhnd_ids.h>
+
+#include "if_bwnvar.h"
+
+/* Supported device identifiers */
+static const struct bhnd_device bwn_devices[] = {
+ {{
+ BHND_MATCH_CORE (BHND_MFGID_BCM, BHND_COREID_D11),
+ BHND_MATCH_CORE_REV (HWREV_RANGE(5, 16))
+ }},
+
+ BHND_DEVICE_END
+};
+
+static int
+bwn_bhnd_probe(device_t dev)
+{
+ const struct bhnd_device *id;
+
+ id = bhnd_device_lookup(dev, bwn_devices, sizeof(bwn_devices[0]));
+ if (id == NULL)
+ return (ENXIO);
+
+ bhnd_set_default_core_desc(dev);
+ return (BUS_PROBE_DEFAULT);
+}
+
+static device_method_t bwn_bhnd_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, bwn_bhnd_probe),
+
+ DEVMETHOD_END
+};
+
+static devclass_t bwn_devclass;
+
+DEFINE_CLASS_1(bwn, bwn_bhnd_driver, bwn_bhnd_methods, sizeof(struct bwn_softc),
+ bwn_driver);
+
+DRIVER_MODULE(bwn_bhnd, bhnd, bwn_bhnd_driver, bwn_devclass, 0, 0);
+MODULE_DEPEND(bwn_bhnd, bhnd, 1, 1, 1);
+MODULE_VERSION(bwn_bhnd, 1);
Modified: head/sys/dev/bwn/if_bwn_pci.c
==============================================================================
--- head/sys/dev/bwn/if_bwn_pci.c Sat Dec 2 01:42:07 2017 (r326453)
+++ head/sys/dev/bwn/if_bwn_pci.c Sat Dec 2 02:21:27 2017 (r326454)
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2015-2016 Landon Fuller <landonf at FreeBSD.org>
* All rights reserved.
*
@@ -6,25 +8,22 @@
* 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.
+ * 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.
*
- * 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.
+ * 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.
*/
#include <sys/cdefs.h>
@@ -61,17 +60,8 @@ 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),
@@ -88,7 +78,7 @@ static const struct bwn_pci_device siba_devices[] = {
BWN_QUIRK_USBH_UNPOPULATED),
BWN_BCM_DEV(BCM4321_D11N2G, "BCM4321 802.11n 2GHz",
BWN_QUIRK_USBH_UNPOPULATED),
- BWN_BCM_DEV(BCM4321_D11N2G, "BCM4321 802.11n 5GHz",
+ BWN_BCM_DEV(BCM4321_D11N5G, "BCM4321 802.11n 5GHz",
BWN_QUIRK_UNTESTED|BWN_QUIRK_USBH_UNPOPULATED),
BWN_BCM_DEV(BCM4322_D11N, "BCM4322 802.11n Dual-Band", 0),
@@ -107,6 +97,7 @@ 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),
+ BWN_BCM_DEV(BCM43224_D11N, "BCM43224 802.11n Dual-Band", 0),
BWN_BCM_DEV(BCM43225_D11N2G, "BCM43225 802.11n 2GHz", 0),
{ 0, 0, NULL, 0}
@@ -210,7 +201,12 @@ bwn_pci_attach(device_t dev)
static int
bwn_pci_detach(device_t dev)
{
- return (bus_generic_detach(dev));
+ int error;
+
+ if ((error = bus_generic_detach(dev)))
+ return (error);
+
+ return (device_delete_children(dev));
}
static void
@@ -297,11 +293,14 @@ static device_method_t bwn_pci_methods[] = {
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);
+DEFINE_CLASS_0(bwn_pci, bwn_pci_driver, bwn_pci_methods,
+ sizeof(struct bwn_pci_softc));
+DRIVER_MODULE_ORDERED(bwn_pci, pci, bwn_pci_driver, bwn_pci_devclass, NULL,
+ NULL, SI_ORDER_ANY);
DRIVER_MODULE(bhndb, bwn_pci, bhndb_pci_driver, bhndb_devclass, NULL, NULL);
MODULE_DEPEND(bwn_pci, bwn, 1, 1, 1);
+MODULE_DEPEND(bwn_pci, bhnd, 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);
Modified: head/sys/dev/bwn/if_bwn_pcivar.h
==============================================================================
--- head/sys/dev/bwn/if_bwn_pcivar.h Sat Dec 2 01:42:07 2017 (r326453)
+++ head/sys/dev/bwn/if_bwn_pcivar.h Sat Dec 2 02:21:27 2017 (r326454)
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2015-2016 Landon Fuller <landonf at FreeBSD.org>
* All rights reserved.
*
@@ -6,25 +8,22 @@
* 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.
+ * 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.
*
- * 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.
+ * 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$
*/
Modified: head/sys/dev/bwn/if_bwn_phy_common.c
==============================================================================
--- head/sys/dev/bwn/if_bwn_phy_common.c Sat Dec 2 01:42:07 2017 (r326453)
+++ head/sys/dev/bwn/if_bwn_phy_common.c Sat Dec 2 02:21:27 2017 (r326454)
@@ -66,9 +66,6 @@ __FBSDID("$FreeBSD$");
#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>
@@ -76,6 +73,8 @@ __FBSDID("$FreeBSD$");
#include <net80211/ieee80211_phy.h>
#include <net80211/ieee80211_ratectl.h>
+#include <dev/bwn/if_bwn_siba.h>
+
#include <dev/bwn/if_bwnreg.h>
#include <dev/bwn/if_bwnvar.h>
@@ -149,17 +148,12 @@ bwn_phy_force_clock(struct bwn_mac *mac, int force)
/* XXX Only for N, HT and AC PHYs */
- /* XXX bhnd bus */
- if (bwn_is_bus_siba(mac)) {
- tmp = siba_read_4(sc->sc_dev, SIBA_TGSLOW);
- if (force)
- tmp |= SIBA_TGSLOW_FGC;
- else
- tmp &= ~SIBA_TGSLOW_FGC;
- siba_write_4(sc->sc_dev, SIBA_TGSLOW, tmp);
- } else {
- BWN_ERRPRINTF(sc, "%s: unknown bus!\n", __func__);
- }
+ tmp = siba_read_4(sc->sc_dev, SIBA_TGSLOW);
+ if (force)
+ tmp |= SIBA_TGSLOW_FGC;
+ else
+ tmp &= ~SIBA_TGSLOW_FGC;
+ siba_write_4(sc->sc_dev, SIBA_TGSLOW, tmp);
}
int
@@ -184,17 +178,12 @@ bwn_mac_phy_clock_set(struct bwn_mac *mac, int enabled
struct bwn_softc *sc = mac->mac_sc;
uint32_t val;
- /* XXX bhnd bus */
- if (bwn_is_bus_siba(mac)) {
- val = siba_read_4(sc->sc_dev, SIBA_TGSLOW);
- if (enabled)
- val |= BWN_TGSLOW_MACPHYCLKEN;
- else
- val &= ~BWN_TGSLOW_MACPHYCLKEN;
- siba_write_4(sc->sc_dev, SIBA_TGSLOW, val);
- } else {
- BWN_ERRPRINTF(sc, "%s: unknown bus!\n", __func__);
- }
+ val = siba_read_4(sc->sc_dev, SIBA_TGSLOW);
+ if (enabled)
+ val |= BWN_TGSLOW_MACPHYCLKEN;
+ else
+ val &= ~BWN_TGSLOW_MACPHYCLKEN;
+ siba_write_4(sc->sc_dev, SIBA_TGSLOW, val);
}
/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacCorePllReset */
@@ -203,13 +192,8 @@ bwn_wireless_core_phy_pll_reset(struct bwn_mac *mac)
{
struct bwn_softc *sc = mac->mac_sc;
- /* XXX bhnd bus */
- if (bwn_is_bus_siba(mac)) {
- siba_cc_write32(sc->sc_dev, SIBA_CC_CHIPCTL_ADDR, 0);
- siba_cc_mask32(sc->sc_dev, SIBA_CC_CHIPCTL_DATA, ~0x4);
- siba_cc_set32(sc->sc_dev, SIBA_CC_CHIPCTL_DATA, 0x4);
- siba_cc_mask32(sc->sc_dev, SIBA_CC_CHIPCTL_DATA, ~0x4);
- } else {
- BWN_ERRPRINTF(sc, "%s: unknown bus!\n", __func__);
- }
+ siba_cc_write32(sc->sc_dev, SIBA_CC_CHIPCTL_ADDR, 0);
+ siba_cc_mask32(sc->sc_dev, SIBA_CC_CHIPCTL_DATA, ~0x4);
+ siba_cc_set32(sc->sc_dev, SIBA_CC_CHIPCTL_DATA, 0x4);
+ siba_cc_mask32(sc->sc_dev, SIBA_CC_CHIPCTL_DATA, ~0x4);
}
Modified: head/sys/dev/bwn/if_bwn_phy_g.c
==============================================================================
--- head/sys/dev/bwn/if_bwn_phy_g.c Sat Dec 2 01:42:07 2017 (r326453)
+++ head/sys/dev/bwn/if_bwn_phy_g.c Sat Dec 2 02:21:27 2017 (r326454)
@@ -65,15 +65,14 @@ __FBSDID("$FreeBSD$");
#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_bwn_siba.h>
#include <dev/bwn/if_bwnreg.h>
#include <dev/bwn/if_bwnvar.h>
Modified: head/sys/dev/bwn/if_bwn_phy_lp.c
==============================================================================
--- head/sys/dev/bwn/if_bwn_phy_lp.c Sat Dec 2 01:42:07 2017 (r326453)
+++ head/sys/dev/bwn/if_bwn_phy_lp.c Sat Dec 2 02:21:27 2017 (r326454)
@@ -65,15 +65,14 @@ __FBSDID("$FreeBSD$");
#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_bwn_siba.h>
#include <dev/bwn/if_bwnreg.h>
#include <dev/bwn/if_bwnvar.h>
Modified: head/sys/dev/bwn/if_bwn_phy_n.c
==============================================================================
--- head/sys/dev/bwn/if_bwn_phy_n.c Sat Dec 2 01:42:07 2017 (r326453)
+++ head/sys/dev/bwn/if_bwn_phy_n.c Sat Dec 2 02:21:27 2017 (r326454)
@@ -65,15 +65,14 @@ __FBSDID("$FreeBSD$");
#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_bwn_siba.h>
#include <dev/bwn/if_bwnreg.h>
#include <dev/bwn/if_bwnvar.h>
Added: head/sys/dev/bwn/if_bwn_siba.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/sys/dev/bwn/if_bwn_siba.c Sat Dec 2 02:21:27 2017 (r326454)
@@ -0,0 +1,171 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2016 Landon Fuller <landonf 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.
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/systm.h>
+
+#include <machine/bus.h>
+#include <sys/rman.h>
+#include <machine/resource.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+
+#define BWN_USE_SIBA 1
+#include "if_bwn_siba.h"
+
+/** Legacy siba(4) bus operations */
+
+static int
+bwn_siba_bus_ops_init(device_t dev)
+{
+ return (0);
+}
+
+static void
+bwn_siba_bus_ops_fini(device_t dev)
+{
+}
+
+const struct bwn_bus_ops bwn_siba_bus_ops = {
+ .init = bwn_siba_bus_ops_init,
+ .fini = bwn_siba_bus_ops_fini,
+ .pci_find_cap = pci_find_cap,
+ .pci_alloc_msi = pci_alloc_msi,
+ .pci_release_msi = pci_release_msi,
+ .pci_msi_count = pci_msi_count,
+ .get_vendor = siba_get_vendor,
+ .get_device = siba_get_device,
+ .get_revid = siba_get_revid,
+ .get_pci_vendor = siba_get_pci_vendor,
+ .get_pci_device = siba_get_pci_device,
+ .get_pci_subvendor = siba_get_pci_subvendor,
+ .get_pci_subdevice = siba_get_pci_subdevice,
+ .get_pci_revid = siba_get_pci_revid,
+ .get_chipid = siba_get_chipid,
+ .get_chiprev = siba_get_chiprev,
+ .get_chippkg = siba_get_chippkg,
+ .get_type = siba_get_type,
+ .get_cc_pmufreq = siba_get_cc_pmufreq,
+ .get_cc_caps = siba_get_cc_caps,
+ .get_cc_powerdelay = siba_get_cc_powerdelay,
+ .get_pcicore_revid = siba_get_pcicore_revid,
+ .sprom_get_rev = siba_sprom_get_rev,
+ .sprom_get_mac_80211bg = siba_sprom_get_mac_80211bg,
+ .sprom_get_mac_80211a = siba_sprom_get_mac_80211a,
+ .sprom_get_brev = siba_sprom_get_brev,
+ .sprom_get_ccode = siba_sprom_get_ccode,
+ .sprom_get_ant_a = siba_sprom_get_ant_a,
+ .sprom_get_ant_bg = siba_sprom_get_ant_bg,
+ .sprom_get_pa0b0 = siba_sprom_get_pa0b0,
+ .sprom_get_pa0b1 = siba_sprom_get_pa0b1,
+ .sprom_get_pa0b2 = siba_sprom_get_pa0b2,
+ .sprom_get_gpio0 = siba_sprom_get_gpio0,
+ .sprom_get_gpio1 = siba_sprom_get_gpio1,
+ .sprom_get_gpio2 = siba_sprom_get_gpio2,
+ .sprom_get_gpio3 = siba_sprom_get_gpio3,
+ .sprom_get_maxpwr_bg = siba_sprom_get_maxpwr_bg,
+ .sprom_set_maxpwr_bg = siba_sprom_set_maxpwr_bg,
+ .sprom_get_rxpo2g = siba_sprom_get_rxpo2g,
+ .sprom_get_rxpo5g = siba_sprom_get_rxpo5g,
+ .sprom_get_tssi_bg = siba_sprom_get_tssi_bg,
+ .sprom_get_tri2g = siba_sprom_get_tri2g,
+ .sprom_get_tri5gl = siba_sprom_get_tri5gl,
+ .sprom_get_tri5g = siba_sprom_get_tri5g,
+ .sprom_get_tri5gh = siba_sprom_get_tri5gh,
+ .sprom_get_rssisav2g = siba_sprom_get_rssisav2g,
+ .sprom_get_rssismc2g = siba_sprom_get_rssismc2g,
+ .sprom_get_rssismf2g = siba_sprom_get_rssismf2g,
+ .sprom_get_bxa2g = siba_sprom_get_bxa2g,
+ .sprom_get_rssisav5g = siba_sprom_get_rssisav5g,
+ .sprom_get_rssismc5g = siba_sprom_get_rssismc5g,
+ .sprom_get_rssismf5g = siba_sprom_get_rssismf5g,
+ .sprom_get_bxa5g = siba_sprom_get_bxa5g,
+ .sprom_get_cck2gpo = siba_sprom_get_cck2gpo,
+ .sprom_get_ofdm2gpo = siba_sprom_get_ofdm2gpo,
+ .sprom_get_ofdm5glpo = siba_sprom_get_ofdm5glpo,
+ .sprom_get_ofdm5gpo = siba_sprom_get_ofdm5gpo,
+ .sprom_get_ofdm5ghpo = siba_sprom_get_ofdm5ghpo,
+ .sprom_get_bf_lo = siba_sprom_get_bf_lo,
+ .sprom_set_bf_lo = siba_sprom_set_bf_lo,
+ .sprom_get_bf_hi = siba_sprom_get_bf_hi,
+ .sprom_get_bf2_lo = siba_sprom_get_bf2_lo,
+ .sprom_get_bf2_hi = siba_sprom_get_bf2_hi,
+ .sprom_get_fem_2ghz_tssipos = siba_sprom_get_fem_2ghz_tssipos,
+ .sprom_get_fem_2ghz_extpa_gain = siba_sprom_get_fem_2ghz_extpa_gain,
+ .sprom_get_fem_2ghz_pdet_range = siba_sprom_get_fem_2ghz_pdet_range,
+ .sprom_get_fem_2ghz_tr_iso = siba_sprom_get_fem_2ghz_tr_iso,
+ .sprom_get_fem_2ghz_antswlut = siba_sprom_get_fem_2ghz_antswlut,
+ .sprom_get_fem_5ghz_extpa_gain = siba_sprom_get_fem_5ghz_extpa_gain,
+ .sprom_get_fem_5ghz_pdet_range = siba_sprom_get_fem_5ghz_pdet_range,
+ .sprom_get_fem_5ghz_antswlut = siba_sprom_get_fem_5ghz_antswlut,
+ .sprom_get_txpid_2g_0 = siba_sprom_get_txpid_2g_0,
+ .sprom_get_txpid_2g_1 = siba_sprom_get_txpid_2g_1,
+ .sprom_get_txpid_5gl_0 = siba_sprom_get_txpid_5gl_0,
+ .sprom_get_txpid_5gl_1 = siba_sprom_get_txpid_5gl_1,
+ .sprom_get_txpid_5g_0 = siba_sprom_get_txpid_5g_0,
+ .sprom_get_txpid_5g_1 = siba_sprom_get_txpid_5g_1,
+ .sprom_get_txpid_5gh_0 = siba_sprom_get_txpid_5gh_0,
+ .sprom_get_txpid_5gh_1 = siba_sprom_get_txpid_5gh_1,
+ .sprom_get_stbcpo = siba_sprom_get_stbcpo,
+ .sprom_get_cddpo = siba_sprom_get_cddpo,
+ .powerup = siba_powerup,
+ .powerdown = siba_powerdown,
+ .read_2 = siba_read_2,
+ .write_2 = siba_write_2,
+ .read_4 = siba_read_4,
+ .write_4 = siba_write_4,
+ .dev_up = siba_dev_up,
+ .dev_down = siba_dev_down,
+ .dev_isup = siba_dev_isup,
+ .pcicore_intr = siba_pcicore_intr,
+ .dma_translation = siba_dma_translation,
+ .read_multi_2 = siba_read_multi_2,
+ .read_multi_4 = siba_read_multi_4,
+ .write_multi_2 = siba_write_multi_2,
+ .write_multi_4 = siba_write_multi_4,
+ .barrier = siba_barrier,
+ .cc_pmu_set_ldovolt = siba_cc_pmu_set_ldovolt,
+ .cc_pmu_set_ldoparef = siba_cc_pmu_set_ldoparef,
+ .gpio_set = siba_gpio_set,
+ .gpio_get = siba_gpio_get,
+ .fix_imcfglobug = siba_fix_imcfglobug,
+ .sprom_get_core_power_info = siba_sprom_get_core_power_info,
+ .sprom_get_mcs2gpo = siba_sprom_get_mcs2gpo,
+ .sprom_get_mcs5glpo = siba_sprom_get_mcs5glpo,
+ .sprom_get_mcs5gpo = siba_sprom_get_mcs5gpo,
+ .sprom_get_mcs5ghpo = siba_sprom_get_mcs5ghpo,
+ .pmu_spuravoid_pllupdate = siba_pmu_spuravoid_pllupdate,
+ .cc_set32 = siba_cc_set32,
+ .cc_mask32 = siba_cc_mask32,
+ .cc_write32 = siba_cc_write32,
+};
Added: head/sys/dev/bwn/if_bwn_siba.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/sys/dev/bwn/if_bwn_siba.h Sat Dec 2 02:21:27 2017 (r326454)
@@ -0,0 +1,491 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2016 Landon J. Fuller <landonf at FreeBSD.org>.
+ * Copyright (c) 2007 Bruce M. Simpson.
+ * 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$
+ */
+
+#ifndef _IF_BWN_SIBA_H_
+#define _IF_BWN_SIBA_H_
+
+/** If true, expose legacy siba_pci headers directly. Otherwise,
+ * we expose our siba/bhnd compatibility shims. */
+#ifndef BWN_USE_SIBA
+#define BWN_USE_SIBA 0
+#endif
+
+struct bwn_softc;
+struct siba_sprom_core_pwr_info;
+
+/*
+ * Legacy siba(4) bus API compatibility shims.
+ */
+struct bwn_bus_ops {
+ /* bus-specific initialization/finalization */
+ int (*init)(device_t);
+ void (*fini)(device_t);
+
+ /* compatibility shims */
+ int (*pci_find_cap)(device_t, int, int *);
+ int (*pci_alloc_msi)(device_t, int *);
+ int (*pci_release_msi)(device_t);
+ int (*pci_msi_count)(device_t);
+ uint16_t (*get_vendor)(device_t);
+ uint16_t (*get_device)(device_t);
+ uint8_t (*get_revid)(device_t);
+ uint16_t (*get_pci_vendor)(device_t);
+ uint16_t (*get_pci_device)(device_t);
+ uint16_t (*get_pci_subvendor)(device_t);
+ uint16_t (*get_pci_subdevice)(device_t);
+ uint8_t (*get_pci_revid)(device_t);
+ uint16_t (*get_chipid)(device_t);
+ uint16_t (*get_chiprev)(device_t);
+ uint8_t (*get_chippkg)(device_t);
+ enum siba_type (*get_type)(device_t);
+ uint32_t (*get_cc_pmufreq)(device_t);
+ uint32_t (*get_cc_caps)(device_t);
+ uint16_t (*get_cc_powerdelay)(device_t);
+ uint8_t (*get_pcicore_revid)(device_t);
+ uint8_t (*sprom_get_rev)(device_t);
+ uint8_t *(*sprom_get_mac_80211bg)(device_t);
+ uint8_t *(*sprom_get_mac_80211a)(device_t);
+ uint8_t (*sprom_get_brev)(device_t);
+ uint8_t (*sprom_get_ccode)(device_t);
+ uint8_t (*sprom_get_ant_a)(device_t);
+ uint8_t (*sprom_get_ant_bg)(device_t);
+ uint16_t (*sprom_get_pa0b0)(device_t);
+ uint16_t (*sprom_get_pa0b1)(device_t);
+ uint16_t (*sprom_get_pa0b2)(device_t);
+ uint8_t (*sprom_get_gpio0)(device_t);
+ uint8_t (*sprom_get_gpio1)(device_t);
+ uint8_t (*sprom_get_gpio2)(device_t);
+ uint8_t (*sprom_get_gpio3)(device_t);
+ uint16_t (*sprom_get_maxpwr_bg)(device_t);
+ void (*sprom_set_maxpwr_bg)(device_t, uint16_t);
+ uint8_t (*sprom_get_rxpo2g)(device_t);
+ uint8_t (*sprom_get_rxpo5g)(device_t);
+ uint8_t (*sprom_get_tssi_bg)(device_t);
+ uint8_t (*sprom_get_tri2g)(device_t);
+ uint8_t (*sprom_get_tri5gl)(device_t);
+ uint8_t (*sprom_get_tri5g)(device_t);
+ uint8_t (*sprom_get_tri5gh)(device_t);
+ uint8_t (*sprom_get_rssisav2g)(device_t);
+ uint8_t (*sprom_get_rssismc2g)(device_t);
+ uint8_t (*sprom_get_rssismf2g)(device_t);
+ uint8_t (*sprom_get_bxa2g)(device_t);
+ uint8_t (*sprom_get_rssisav5g)(device_t);
+ uint8_t (*sprom_get_rssismc5g)(device_t);
+ uint8_t (*sprom_get_rssismf5g)(device_t);
+ uint8_t (*sprom_get_bxa5g)(device_t);
+ uint16_t (*sprom_get_cck2gpo)(device_t);
+ uint32_t (*sprom_get_ofdm2gpo)(device_t);
+ uint32_t (*sprom_get_ofdm5glpo)(device_t);
+ uint32_t (*sprom_get_ofdm5gpo)(device_t);
+ uint32_t (*sprom_get_ofdm5ghpo)(device_t);
+ uint16_t (*sprom_get_bf_lo)(device_t);
+ void (*sprom_set_bf_lo)(device_t, uint16_t);
+ uint16_t (*sprom_get_bf_hi)(device_t);
+ uint16_t (*sprom_get_bf2_lo)(device_t);
+ uint16_t (*sprom_get_bf2_hi)(device_t);
+ uint8_t (*sprom_get_fem_2ghz_tssipos)(device_t);
+ uint8_t (*sprom_get_fem_2ghz_extpa_gain)(device_t);
+ uint8_t (*sprom_get_fem_2ghz_pdet_range)(device_t);
+ uint8_t (*sprom_get_fem_2ghz_tr_iso)(device_t);
+ uint8_t (*sprom_get_fem_2ghz_antswlut)(device_t);
+ uint8_t (*sprom_get_fem_5ghz_extpa_gain)(device_t);
+ uint8_t (*sprom_get_fem_5ghz_pdet_range)(device_t);
+ uint8_t (*sprom_get_fem_5ghz_antswlut)(device_t);
+ uint8_t (*sprom_get_txpid_2g_0)(device_t);
+ uint8_t (*sprom_get_txpid_2g_1)(device_t);
+ uint8_t (*sprom_get_txpid_5gl_0)(device_t);
+ uint8_t (*sprom_get_txpid_5gl_1)(device_t);
+ uint8_t (*sprom_get_txpid_5g_0)(device_t);
+ uint8_t (*sprom_get_txpid_5g_1)(device_t);
+ uint8_t (*sprom_get_txpid_5gh_0)(device_t);
+ uint8_t (*sprom_get_txpid_5gh_1)(device_t);
+ uint16_t (*sprom_get_stbcpo)(device_t);
+ uint16_t (*sprom_get_cddpo)(device_t);
+ void (*powerup)(device_t, int);
+ int (*powerdown)(device_t);
+ uint16_t (*read_2)(device_t, uint16_t);
+ void (*write_2)(device_t, uint16_t, uint16_t);
+ uint32_t (*read_4)(device_t, uint16_t);
+ void (*write_4)(device_t, uint16_t, uint32_t);
+ void (*dev_up)(device_t, uint32_t);
+ void (*dev_down)(device_t, uint32_t);
+ int (*dev_isup)(device_t);
+ void (*pcicore_intr)(device_t);
+ uint32_t (*dma_translation)(device_t);
+ void (*read_multi_2)(device_t, void *, size_t, uint16_t);
+ void (*read_multi_4)(device_t, void *, size_t, uint16_t);
+ void (*write_multi_2)(device_t, const void *, size_t, uint16_t);
+ void (*write_multi_4)(device_t, const void *, size_t, uint16_t);
+ void (*barrier)(device_t, int);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list