marvell88w8363: Sync with FreeBSD 11.1.

Untested, but the changes are mostly adapations to the new KPIs.
This commit is contained in:
Augustin Cavalier
2018-07-17 20:05:35 -04:00
parent 5f64721b30
commit f329739cdc
10 changed files with 372 additions and 589 deletions
@@ -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 marvell88w8363 ;
SubInclude HAIKU_TOP src add-ons kernel drivers network wlan wavelanwifi ;
# FreeBSD 11.1 drivers
@@ -12,6 +11,7 @@ SubInclude HAIKU_TOP src add-ons kernel drivers network wlan iprowifi2100 ;
SubInclude HAIKU_TOP src add-ons kernel drivers network wlan iprowifi3945 ;
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 ;
# FreeBSD 11.2 drivers
@@ -1,17 +1,15 @@
SubDir HAIKU_TOP src add-ons kernel drivers network wlan marvell88w8363 ;
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 ;
## TODO once all driver are updated to their FreeBSD 8 version this define
## can be omitted
SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 __FreeBSD_version__=8
_XOPEN_SOURCE ]
-Wno-format
-Wno-unused
SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1
_XOPEN_SOURCE ]
-Wno-format
-Wno-unused
-Wno-uninitialized ;
UseHeaders [ FDirName $(SUBDIR) ] : true ;
@@ -24,8 +22,8 @@ KernelAddon marvell88w8363 :
mwlhal.c
glue.c
:
libfreebsd_wlan.a
libfreebsd_network.a
libfreebsd11_wlan.a
libfreebsd11_network.a
;
HAIKU_WIFI_FIRMWARE_PACKAGE on marvell88w8363 = "" ;
File diff suppressed because it is too large Load Diff
@@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#ifdef __FreeBSD__
__FBSDID("$FreeBSD$");
__FBSDID("$FreeBSD: releng/11.1/sys/dev/mwl/if_mwl_pci.c 287197 2015-08-27 08:56:39Z glebius $");
#endif
/*
@@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/mutex.h>
#include <sys/errno.h>
@@ -52,9 +54,11 @@ __FBSDID("$FreeBSD$");
#include <sys/socket.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_media.h>
#include <net/if_arp.h>
#include <net/route.h>
#include <net80211/ieee80211_var.h>
@@ -175,9 +179,9 @@ mwl_pci_attach(device_t dev)
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
NULL, NULL, /* filter, filterarg */
BUS_SPACE_MAXADDR, /* maxsize */
BUS_SPACE_MAXSIZE, /* maxsize */
MWL_TXDESC, /* nsegments */
BUS_SPACE_MAXADDR, /* maxsegsize */
BUS_SPACE_MAXSIZE, /* maxsegsize */
0, /* flags */
NULL, /* lockfunc */
NULL, /* lockarg */
@@ -27,7 +27,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
* $FreeBSD$
* $FreeBSD: releng/11.1/sys/dev/mwl/if_mwlioctl.h 193240 2009-06-01 18:07:01Z sam $
*/
/*
@@ -27,7 +27,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
* $FreeBSD$
* $FreeBSD: releng/11.1/sys/dev/mwl/if_mwlvar.h 298955 2016-05-03 03:41:25Z pfg $
*/
/*
@@ -37,6 +37,7 @@
#define _DEV_MWL_MVVAR_H
#include <sys/endian.h>
#include <sys/bus.h>
#include <net80211/ieee80211_radiotap.h>
#include <dev/mwl/mwlhal.h>
#include <dev/mwl/mwlreg.h>
@@ -64,9 +65,9 @@
#define MWL_TXDESC 1 /* max tx descriptors/segments */
#endif
#ifndef MWL_AGGR_SIZE
#define MWL_AGGR_SIZE 3839 /* max tx agregation size */
#define MWL_AGGR_SIZE 3839 /* max tx aggregation size */
#endif
#define MWL_AGEINTERVAL 1 /* poke f/w every sec to age q's */
#define MWL_AGEINTERVAL 1 /* poke f/w every sec to age q's */
#define MWL_MAXSTAID 64 /* max of 64 stations */
/*
@@ -178,7 +179,7 @@ typedef STAILQ_HEAD(, mwl_rxbuf) mwl_rxbufhead;
* to identify which BA stream to use (assigning the h/w q to
* the TxPriority field of the descriptor).
*
* NB: Each station may have at most MWL_MAXBA streams at one time.
* NB: Each station may have at most MWL_MAXBA streams at one time.
*/
struct mwl_bastate {
uint16_t qos; /* QoS ctl for BA stream */
@@ -187,10 +188,10 @@ struct mwl_bastate {
};
static __inline__ void
mwl_bastream_setup(struct mwl_bastate *bas, int ac, int txq)
mwl_bastream_setup(struct mwl_bastate *bas, int tid, int txq)
{
bas->txq = txq;
bas->qos = htole16(WME_AC_TO_TID(ac) | IEEE80211_QOS_ACKPOLICY_BA);
bas->qos = htole16(tid | IEEE80211_QOS_ACKPOLICY_BA);
}
static __inline__ void
@@ -244,7 +245,8 @@ struct mwl_vap {
#define MWL_VAP_CONST(vap) ((const struct mwl_vap *)(vap))
struct mwl_softc {
struct ifnet *sc_ifp; /* interface common */
struct ieee80211com sc_ic;
struct mbufq sc_snd;
struct mwl_stats sc_stats; /* interface statistics */
int sc_debug;
device_t sc_dev;
@@ -257,7 +259,8 @@ struct mwl_softc {
struct taskqueue *sc_tq; /* private task queue */
struct callout sc_watchdog;
int sc_tx_timer;
unsigned int sc_invalid : 1, /* disable hardware accesses */
unsigned int sc_running : 1,
sc_invalid : 1, /* disable hardware accesses */
sc_recvsetup:1, /* recv setup */
sc_csapending:1,/* 11h channel switch pending */
sc_radarena : 1,/* radar detection enabled */
@@ -27,7 +27,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
* $FreeBSD$
* $FreeBSD: releng/11.1/sys/dev/mwl/mwldiag.h 193240 2009-06-01 18:07:01Z sam $
*/
#ifndef _MWL_DIAG_H_
@@ -27,11 +27,11 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
* $FreeBSD$
* $FreeBSD: releng/11.1/sys/dev/mwl/mwlhal.c 300077 2016-05-17 20:53:56Z avos $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/lock.h>
@@ -309,21 +309,14 @@ mwl_hal_attach(device_t dev, uint16_t devid,
NULL, /* lockarg */
&mh->mh_dmat);
if (error != 0) {
device_printf(dev, "unable to allocate memory for cmd buffer, "
device_printf(dev, "unable to allocate memory for cmd tag, "
"error %u\n", error);
goto fail0;
}
/* allocate descriptors */
error = bus_dmamap_create(mh->mh_dmat, BUS_DMA_NOWAIT, &mh->mh_dmamap);
if (error != 0) {
device_printf(dev, "unable to create dmamap for cmd buffers, "
"error %u\n", error);
goto fail0;
}
error = bus_dmamem_alloc(mh->mh_dmat, (void**) &mh->mh_cmdbuf,
BUS_DMA_NOWAIT | BUS_DMA_COHERENT,
BUS_DMA_NOWAIT | BUS_DMA_COHERENT,
&mh->mh_dmamap);
if (error != 0) {
device_printf(dev, "unable to allocate memory for cmd buffer, "
@@ -365,9 +358,8 @@ mwl_hal_attach(device_t dev, uint16_t devid,
fail2:
bus_dmamem_free(mh->mh_dmat, mh->mh_cmdbuf, mh->mh_dmamap);
fail1:
bus_dmamap_destroy(mh->mh_dmat, mh->mh_dmamap);
fail0:
bus_dma_tag_destroy(mh->mh_dmat);
fail0:
mtx_destroy(&mh->mh_mtx);
free(mh, M_DEVBUF);
return NULL;
@@ -379,7 +371,6 @@ mwl_hal_detach(struct mwl_hal *mh0)
struct mwl_hal_priv *mh = MWLPRIV(mh0);
bus_dmamem_free(mh->mh_dmat, mh->mh_cmdbuf, mh->mh_dmamap);
bus_dmamap_destroy(mh->mh_dmat, mh->mh_dmamap);
bus_dma_tag_destroy(mh->mh_dmat);
mtx_destroy(&mh->mh_mtx);
free(mh, M_DEVBUF);
@@ -850,7 +841,7 @@ mwl_hal_setradardetection(struct mwl_hal *mh0, MWL_HAL_RADAR action)
retval = mwlExecuteCmd(mh, HostCmd_CMD_802_11H_DETECT_RADAR);
MWL_HAL_UNLOCK(mh);
return retval;
}
}
/*
* Convert public channel flags definition to a
@@ -1000,7 +991,7 @@ mwl_hal_settxrate(struct mwl_hal_vap *vap, MWL_HAL_TXRATE_HANDLING handling,
n++;
}
pCmd->EntryCount = htole32(n);
} else
} else
pCmd->Action = htole32(HostCmd_ACT_NOT_USE_FIXED_RATE);
retval = mwlExecuteCmd(mh, HostCmd_CMD_SET_FIXED_RATE);
@@ -1400,7 +1391,7 @@ bastream_check_available(struct mwl_hal_vap *vap, int qid,
_VCMD_SETUP(vap, pCmd, HostCmd_FW_BASTREAM, HostCmd_CMD_BASTREAM);
pCmd->ActionType = htole32(BaCheckCreateStream);
pCmd->BaInfo.CreateParams.BarThrs = htole32(63);
pCmd->BaInfo.CreateParams.WindowSize = htole32(64);
pCmd->BaInfo.CreateParams.WindowSize = htole32(64);
pCmd->BaInfo.CreateParams.IdleThrs = htole32(0x22000);
IEEE80211_ADDR_COPY(&pCmd->BaInfo.CreateParams.PeerMacAddr[0], Macaddr);
pCmd->BaInfo.CreateParams.DialogToken = 10;
@@ -1460,7 +1451,7 @@ mwl_hal_bastream_alloc(struct mwl_hal_vap *vap, int ba_policy,
sp->setup = 0;
sp->ba_policy = ba_policy;
MWL_HAL_UNLOCK(mh);
return sp != NULL ? &sp->public : NULL;
return &sp->public;
}
const MWL_HAL_BASTREAM *
@@ -1584,7 +1575,7 @@ mwl_hal_bastream_get_seqno(struct mwl_hal *mh0,
*pseqno = le16toh(pCmd->SeqNo);
MWL_HAL_UNLOCK(mh);
return retval;
}
}
int
mwl_hal_getwatchdogbitmap(struct mwl_hal *mh0, uint8_t bitmap[1])
@@ -1626,7 +1617,7 @@ mwl_hal_setaggampduratemode(struct mwl_hal *mh0, int mode, int threshold)
pCmd->Threshold = htole32(threshold);
retval = mwlExecuteCmd(mh, HostCmd_CMD_AMPDU_RETRY_RATEDROP_MODE);
MWL_HAL_UNLOCK(mh);
MWL_HAL_UNLOCK(mh);
return retval;
}
@@ -1643,7 +1634,7 @@ mwl_hal_getaggampduratemode(struct mwl_hal *mh0, int *mode, int *threshold)
pCmd->Action = htole16(0);
retval = mwlExecuteCmd(mh, HostCmd_CMD_AMPDU_RETRY_RATEDROP_MODE);
MWL_HAL_UNLOCK(mh);
MWL_HAL_UNLOCK(mh);
*mode = le32toh(pCmd->Option);
*threshold = le32toh(pCmd->Threshold);
return retval;
@@ -1665,7 +1656,7 @@ mwl_hal_setcfend(struct mwl_hal *mh0, int ena)
pCmd->Enable = htole32(ena);
retval = mwlExecuteCmd(mh, HostCmd_CMD_CFEND_ENABLE);
MWL_HAL_UNLOCK(mh);
MWL_HAL_UNLOCK(mh);
return retval;
}
@@ -1701,7 +1692,7 @@ cvtPeerInfo(PeerInfo_t *to, const MWL_HAL_PEERINFO *from)
/* XXX station id must be in [0..63] */
int
mwl_hal_newstation(struct mwl_hal_vap *vap,
const uint8_t addr[IEEE80211_ADDR_LEN], uint16_t aid, uint16_t sid,
const uint8_t addr[IEEE80211_ADDR_LEN], uint16_t aid, uint16_t sid,
const MWL_HAL_PEERINFO *peer, int isQosSta, int wmeInfo)
{
struct mwl_hal_priv *mh = MWLVAP(vap);
@@ -2022,7 +2013,7 @@ mwlGetCalTable(struct mwl_hal_priv *mh, uint8_t annex, uint8_t index)
pCmd->calTbl[0] != annex && annex != 0 && annex != 255)
retval = EIO;
return retval;
}
}
/*
* Calculate the max tx power from the channel's cal data.
@@ -2227,7 +2218,7 @@ mwl_hal_GetBeacon(struct mwl_hal *mh0, uint8_t *pBcn, uint16_t *pLen)
}
MWL_HAL_UNLOCK(mh);
return retval;
}
}
int
mwl_hal_SetRifs(struct mwl_hal *mh0, uint8_t QNum)
@@ -2439,9 +2430,9 @@ mwlExecuteCmd(struct mwl_hal_priv *mh, unsigned short cmd)
/*
* Firmware download support.
*/
#define FW_DOWNLOAD_BLOCK_SIZE 256
#define FW_DOWNLOAD_BLOCK_SIZE 256
#define FW_CHECK_USECS (5*1000) /* 5ms */
#define FW_MAX_NUM_CHECKS 200
#define FW_MAX_NUM_CHECKS 200
#if 0
/* XXX read f/w from file */
@@ -27,7 +27,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
* $FreeBSD$
* $FreeBSD: releng/11.1/sys/dev/mwl/mwlhal.h 298915 2016-05-02 04:15:15Z adrian $
*/
#ifndef _MWL_HAL_H_
@@ -71,15 +71,13 @@ enum {
MWL_WME_AC_VO = 3, /* voice access category */
};
struct device;
struct mwl_hal {
bus_space_handle_t mh_ioh; /* BAR 1 copied from softc */
bus_space_tag_t mh_iot;
uint32_t mh_imask; /* interrupt mask */
/* remainder is opaque to driver */
};
struct mwl_hal *mwl_hal_attach(struct device *dev, uint16_t devid,
struct mwl_hal *mwl_hal_attach(device_t dev, uint16_t devid,
bus_space_handle_t ioh, bus_space_tag_t iot, bus_dma_tag_t tag);
void mwl_hal_detach(struct mwl_hal *);
@@ -27,7 +27,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
* $FreeBSD$
* $FreeBSD: releng/11.1/sys/dev/mwl/mwlreg.h 195171 2009-06-29 18:42:54Z sam $
*/
/*