wavelanwifi: Sync with FreeBSD 11.1.

Untested. Requires the previous commit.
This commit is contained in:
Augustin Cavalier 2018-07-17 23:38:24 -04:00
parent d97a05f774
commit 4aff6a8a2b
10 changed files with 406 additions and 302 deletions

View File

@ -2,7 +2,6 @@ SubDir HAIKU_TOP src add-ons kernel drivers network wlan ;
# FreeBSD 9.3 drivers
SubInclude HAIKU_TOP src add-ons kernel drivers network wlan broadcom43xx ;
SubInclude HAIKU_TOP src add-ons kernel drivers network wlan wavelanwifi ;
# FreeBSD 11.1 drivers
SubInclude HAIKU_TOP src add-ons kernel drivers network wlan aironetwifi ;
@ -13,6 +12,7 @@ SubInclude HAIKU_TOP src add-ons kernel drivers network wlan iprowifi4965 ;
SubInclude HAIKU_TOP src add-ons kernel drivers network wlan marvell88w8335 ;
SubInclude HAIKU_TOP src add-ons kernel drivers network wlan marvell88w8363 ;
SubInclude HAIKU_TOP src add-ons kernel drivers network wlan ralinkwifi ;
SubInclude HAIKU_TOP src add-ons kernel drivers network wlan wavelanwifi ;
# FreeBSD 11.2 drivers
SubInclude HAIKU_TOP src add-ons kernel drivers network wlan idualwifi7260 ;

View File

@ -1,8 +1,8 @@
SubDir HAIKU_TOP src add-ons kernel drivers network wlan wavelanwifi ;
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ]
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd11_network compat ]
: true ;
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_wlan ] : true ;
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd11_wlan ] : true ;
UsePrivateHeaders net system ;
UsePrivateKernelHeaders ;
@ -10,9 +10,9 @@ UsePrivateKernelHeaders ;
Includes [ FGristFiles kernel_c++_structs.h ]
: <src!system!kernel>kernel_c++_struct_sizes.h ;
SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ]
-Wno-format
-Wno-unused
SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ]
-Wno-format
-Wno-unused
-Wno-uninitialized ;
UseHeaders [ FDirName $(SUBDIR) ] : true ;
@ -24,6 +24,6 @@ KernelAddon wavelanwifi :
if_wi_pci.c
glue.c
:
libfreebsd_wlan.a
libfreebsd_network.a
libfreebsd11_wlan.a
libfreebsd11_network.a
;

View File

@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
* $FreeBSD: releng/11.1/sys/dev/wi/if_wavelan_ieee.h 298955 2016-05-03 03:41:25Z pfg $
*/
#ifndef _IF_WAVELAN_IEEE_H
@ -431,7 +431,7 @@ struct wi_apinfo {
*/
/*
* standard hermes recieve frame used by wavelan/prism2 cards
* standard hermes receive frame used by wavelan/prism2 cards
*/
struct wi_rx_frame {
/*

View File

@ -0,0 +1,145 @@
/*-
* Copyright (c) 2013 Justin Hibbits
* All rights reserved.
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Bill Paul.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
* 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.
*/
/*
* Lucent WaveLAN/IEEE 802.11 MacIO attachment for FreeBSD.
*
* Based on the PCMCIA driver
* Written by Bill Paul <wpaul@ctr.columbia.edu>
* Electrical Engineering Department
* Columbia University, New York City
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/11.1/sys/dev/wi/if_wi_macio.c 287197 2015-08-27 08:56:39Z glebius $");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <machine/resource.h>
#include <sys/rman.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/openfirm.h>
#include <machine/ofw_machdep.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/ethernet.h>
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/if_types.h>
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211_radiotap.h>
#include <dev/wi/if_wavelan_ieee.h>
#include <dev/wi/if_wireg.h>
#include <dev/wi/if_wivar.h>
#include <powerpc/powermac/maciovar.h>
static int wi_macio_probe(device_t);
static int wi_macio_attach(device_t);
static device_method_t wi_macio_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, wi_macio_probe),
DEVMETHOD(device_attach, wi_macio_attach),
DEVMETHOD(device_detach, wi_detach),
DEVMETHOD(device_shutdown, wi_shutdown),
{ 0, 0 }
};
static driver_t wi_macio_driver = {
"wi",
wi_macio_methods,
sizeof(struct wi_softc)
};
DRIVER_MODULE(wi, macio, wi_macio_driver, wi_devclass, 0, 0);
MODULE_DEPEND(wi, wlan, 1, 1, 1);
static int
wi_macio_probe(device_t dev)
{
const char *name, *compat;
/* Make sure we're a network driver */
name = ofw_bus_get_name(dev);
if (name == NULL)
return (ENXIO);
if (strcmp(name, "radio") != 0) {
return ENXIO;
}
compat = ofw_bus_get_compat(dev);
if (strcmp(compat, "wireless") != 0) {
return ENXIO;
}
device_set_desc(dev, "Apple Airport");
return 0;
}
static int
wi_macio_attach(device_t dev)
{
struct wi_softc *sc;
int error;
sc = device_get_softc(dev);
sc->wi_gone = 0;
sc->wi_bus_type = 0;
error = wi_alloc(dev, 0);
if (error == 0) {
macio_enable_wireless(device_get_parent(dev), 1);
/* Make sure interrupts are disabled. */
CSR_WRITE_2(sc, WI_INT_EN, 0);
CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
error = wi_attach(dev);
if (error != 0)
wi_free(dev);
}
return error;
}

View File

@ -39,12 +39,14 @@
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
__FBSDID("$FreeBSD: releng/11.1/sys/dev/wi/if_wi_pccard.c 292079 2015-12-11 05:27:56Z imp $");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/socket.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/module.h>
#include <sys/bus.h>
@ -62,7 +64,6 @@ __FBSDID("$FreeBSD$");
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211_radiotap.h>
#define PCCARD_API_LEVEL 6
#include <dev/pccard/pccardvar.h>
#include <dev/pccard/pccard_cis.h>
@ -152,6 +153,7 @@ static const struct pccard_product wi_pccard_products[] = {
PCMCIA_CARD(TDK, LAK_CD011WL),
{ NULL }
};
PCCARD_PNP_INFO(wi_pccard_products);
static int
wi_pccard_probe(device_t dev)

View File

@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
* $FreeBSD: releng/11.1/sys/dev/wi/if_wi_pci.c 315483 2017-03-18 13:58:25Z kevlo $
*/
/*
@ -42,6 +42,7 @@
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/socket.h>
#include <sys/systm.h>
#include <sys/module.h>
@ -55,6 +56,7 @@
#include <dev/pci/pcivar.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_arp.h>
#include <net/ethernet.h>
#include <net/if_media.h>
@ -237,7 +239,9 @@ wi_pci_suspend(device_t dev)
{
struct wi_softc *sc = device_get_softc(dev);
WI_LOCK(sc);
wi_stop(sc, 1);
WI_UNLOCK(sc);
return (0);
}
@ -246,16 +250,15 @@ static int
wi_pci_resume(device_t dev)
{
struct wi_softc *sc = device_get_softc(dev);
struct ifnet *ifp = sc->sc_ifp;
struct ieee80211com *ic = &sc->sc_ic;
if (sc->wi_bus_type != WI_BUS_PCI_NATIVE)
WI_LOCK(sc);
if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) {
WI_UNLOCK(sc);
return (0);
if (ifp->if_flags & IFF_UP) {
ifp->if_init(ifp->if_softc);
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
ifp->if_start(ifp);
}
if (ic->ic_nrunning > 0)
wi_init(sc);
WI_UNLOCK(sc);
return (0);
}

View File

@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
* $FreeBSD: releng/11.1/sys/dev/wi/if_wireg.h 298955 2016-05-03 03:41:25Z pfg $
*/
#define WI_DELAY 5
@ -157,7 +157,7 @@
* - Lucent has created a library called HCF (Hardware Control Functions)
* though which it wants developers to interact with the card. The HCF
* is needlessly complex, ill conceived and badly documented. Actually,
* the comments in the HCP code itself aren't bad, but the publically
* the comments in the HCP code itself aren't bad, but the publicly
* available manual that comes with it is awful, probably due largely to
* the fact that it has been emasculated in order to hide information
* that Lucent wants to keep proprietary. The purpose of the HCF seems
@ -295,7 +295,7 @@
#define WI_EV_CMD 0x0010 /* command completed */
#define WI_EV_ALLOC 0x0008 /* async alloc/reclaim completed */
#define WI_EV_TX_EXC 0x0004 /* async xmit completed with failure */
#define WI_EV_TX 0x0002 /* async xmit completed succesfully */
#define WI_EV_TX 0x0002 /* async xmit completed successfully */
#define WI_EV_RX 0x0001 /* async rx completed */
/* Host software registers */

View File

@ -31,7 +31,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
* $FreeBSD: releng/11.1/sys/dev/wi/if_wivar.h 300238 2016-05-19 22:14:35Z avos $
*/
/*
@ -58,17 +58,17 @@
struct wi_vap {
struct ieee80211vap wv_vap;
struct ieee80211_beacon_offsets wv_bo;
void (*wv_recv_mgmt)(struct ieee80211_node *, struct mbuf *,
int, int, int);
int, const struct ieee80211_rx_stats *rxs, int, int);
int (*wv_newstate)(struct ieee80211vap *,
enum ieee80211_state, int);
};
#define WI_VAP(vap) ((struct wi_vap *)(vap))
struct wi_softc {
struct ifnet *sc_ifp;
struct ieee80211com sc_ic;
struct mbufq sc_snd;
device_t sc_dev;
struct mtx sc_mtx;
struct callout sc_watchdog;
@ -107,7 +107,6 @@ struct wi_softc {
int wi_cmd_count;
int sc_flags;
int sc_if_flags;
int sc_bap_id;
int sc_bap_off;
@ -115,6 +114,7 @@ struct wi_softc {
u_int16_t sc_portnum;
u_int16_t sc_encryption;
u_int16_t sc_monitor_port;
u_int16_t sc_chanmask;
/* RSSI interpretation */
u_int16_t sc_min_rssi; /* clamp sc_min_rssi < RSSI */
@ -152,6 +152,8 @@ struct wi_softc {
#define WI_FLAGS_HAS_ROAMING 0x0020
#define WI_FLAGS_HAS_FRAGTHR 0x0200
#define WI_FLAGS_HAS_DBMADJUST 0x0400
#define WI_FLAGS_RUNNING 0x0800
#define WI_FLAGS_PROMISC 0x1000
struct wi_card_ident {
u_int16_t card_id;
@ -180,7 +182,7 @@ int wi_shutdown(device_t);
int wi_alloc(device_t, int);
void wi_free(device_t);
extern devclass_t wi_devclass;
void wi_init(void *);
void wi_intr(void *);
int wi_mgmt_xmit(struct wi_softc *, caddr_t, int);
void wi_stop(struct wi_softc *, int);
void wi_init(struct wi_softc *);

View File

@ -30,9 +30,8 @@ int
HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
{
struct wi_softc* sc = (struct wi_softc*)device_get_softc(dev);
struct ifnet* ifp = sc->sc_ifp;
if (sc->wi_gone || !sc->sc_enabled || (ifp->if_flags & IFF_UP) == 0) {
if (sc->wi_gone || !sc->sc_enabled || (sc->sc_flags & WI_FLAGS_RUNNING) == 0) {
CSR_WRITE_2(sc, WI_INT_EN, 0);
CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
return 0;