marvell88w8363: Upgrade to FreeBSD 12.

This commit is contained in:
Augustin Cavalier
2019-01-10 17:39:03 -05:00
parent 0fc3af214b
commit a3cc4e1a5e
8 changed files with 51 additions and 42 deletions
@@ -1,4 +1,6 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
* Copyright (c) 2007-2008 Marvell Semiconductor, Inc.
* All rights reserved.
@@ -29,7 +31,7 @@
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/11.1/sys/dev/mwl/if_mwl.c 300241 2016-05-19 22:28:46Z avos $");
__FBSDID("$FreeBSD: releng/12.0/sys/dev/mwl/if_mwl.c 331797 2018-03-30 18:50:13Z brooks $");
/*
* Driver for the Marvell 88W8363 Wireless LAN controller.
@@ -1240,7 +1242,7 @@ mwl_reset_vap(struct ieee80211vap *vap, int state)
/*
* Reset the hardware w/o losing operational state.
* Used to to reset or reload hardware state for a vap.
* Used to reset or reload hardware state for a vap.
*/
static int
mwl_reset(struct ieee80211vap *vap, u_long cmd)
@@ -1532,7 +1534,7 @@ mwl_key_alloc(struct ieee80211vap *vap, struct ieee80211_key *k,
return 0;
}
/* give the caller what they requested */
*keyix = *rxkeyix = k - vap->iv_nw_keys;
*keyix = *rxkeyix = ieee80211_crypto_get_key_wepidx(vap, k);
} else {
/*
* Firmware handles key allocation.
@@ -2530,7 +2532,7 @@ mwl_ext_free(struct mbuf *m, void *data, void *arg)
struct mwl_softc *sc = arg;
/* XXX bounds check data */
mwl_putrxdma(sc, data);
mwl_putrxdma(sc, m->m_ext.ext_buf);
/*
* If we were previously blocked by a lack of rx dma buffers
* check if we now have enough to restart rx interrupt handling.
@@ -2750,7 +2752,7 @@ mwl_rx_proc(void *arg, int npending)
* buffer we just installed above.
*/
MEXTADD(m, data, MWL_AGGR_SIZE, mwl_ext_free,
data, sc, 0, EXT_NET_DRV);
data, sc, 0, EXT_NET_DRV);
m->m_data += off - hdrlen;
m->m_pkthdr.len = m->m_len = pktlen;
/* NB: dma buffer assumed read-only */
@@ -2894,11 +2896,15 @@ mwl_txq_update(struct mwl_softc *sc, int ac)
{
#define MWL_EXPONENT_TO_VALUE(v) ((1<<v)-1)
struct ieee80211com *ic = &sc->sc_ic;
struct chanAccParams chp;
struct mwl_txq *txq = sc->sc_ac2q[ac];
struct wmeParams *wmep = &ic->ic_wme.wme_chanParams.cap_wmeParams[ac];
struct wmeParams *wmep;
struct mwl_hal *mh = sc->sc_mh;
int aifs, cwmin, cwmax, txoplim;
ieee80211_wme_ic_getparams(ic, &chp);
wmep = &chp.cap_wmeParams[ac];
aifs = wmep->wmep_aifsn;
/* XXX in sta mode need to pass log values for cwmin/max */
cwmin = MWL_EXPONENT_TO_VALUE(wmep->wmep_logcwmin);
@@ -4747,8 +4753,8 @@ mwl_ioctl(struct ieee80211com *ic, u_long cmd, void *data)
* statistics. The alternative is to copy the data
* to a local structure.
*/
return (copyout(&sc->sc_stats,
ifr->ifr_data, sizeof (sc->sc_stats)));
return (copyout(&sc->sc_stats, ifr_data_get_ptr(ifr),
sizeof (sc->sc_stats)));
#ifdef MWL_DIAGAPI
case SIOCGMVDIAG:
/* XXX check privs */
@@ -1,4 +1,6 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
* Copyright (c) 2007-2009 Marvell Semiconductor, Inc.
* All rights reserved.
@@ -30,7 +32,7 @@
#include <sys/cdefs.h>
#ifdef __FreeBSD__
__FBSDID("$FreeBSD: releng/11.1/sys/dev/mwl/if_mwl_pci.c 287197 2015-08-27 08:56:39Z glebius $");
__FBSDID("$FreeBSD: releng/12.0/sys/dev/mwl/if_mwl_pci.c 326255 2017-11-27 14:52:40Z pfg $");
#endif
/*
@@ -1,4 +1,6 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
* Copyright (c) 2007-2009 Marvell Semiconductor, Inc.
* All rights reserved.
@@ -27,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
* $FreeBSD: releng/11.1/sys/dev/mwl/if_mwlioctl.h 193240 2009-06-01 18:07:01Z sam $
* $FreeBSD: releng/12.0/sys/dev/mwl/if_mwlioctl.h 326255 2017-11-27 14:52:40Z pfg $
*/
/*
@@ -1,4 +1,6 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
* Copyright (c) 2007-2009 Marvell Semiconductor, Inc.
* All rights reserved.
@@ -27,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
* $FreeBSD: releng/11.1/sys/dev/mwl/if_mwlvar.h 298955 2016-05-03 03:41:25Z pfg $
* $FreeBSD: releng/12.0/sys/dev/mwl/if_mwlvar.h 326255 2017-11-27 14:52:40Z pfg $
*/
/*
@@ -67,7 +69,7 @@
#ifndef MWL_AGGR_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 */
/*
@@ -179,7 +181,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 */
@@ -1,4 +1,6 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
* Copyright (c) 2007-2009 Marvell Semiconductor, Inc.
* All rights reserved.
@@ -27,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
* $FreeBSD: releng/11.1/sys/dev/mwl/mwldiag.h 193240 2009-06-01 18:07:01Z sam $
* $FreeBSD: releng/12.0/sys/dev/mwl/mwldiag.h 326255 2017-11-27 14:52:40Z pfg $
*/
#ifndef _MWL_DIAG_H_
@@ -1,4 +1,6 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
* Copyright (c) 2007-2009 Marvell Semiconductor, Inc.
* All rights reserved.
@@ -27,11 +29,11 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
* $FreeBSD: releng/11.1/sys/dev/mwl/mwlhal.c 300077 2016-05-17 20:53:56Z avos $
* $FreeBSD: releng/12.0/sys/dev/mwl/mwlhal.c 326255 2017-11-27 14:52:40Z pfg $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/lock.h>
@@ -316,7 +318,7 @@ mwl_hal_attach(device_t dev, uint16_t devid,
/* allocate descriptors */
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, "
@@ -619,22 +621,11 @@ mwl_hal_sethwdma(struct mwl_hal *mh0, const struct mwl_hal_txrxdma *dma)
pCmd->NumTxQueues = htole32(dma->maxNumWCB);
pCmd->TotalRxWcb = htole32(1); /* XXX */
pCmd->RxPdWrPtr = htole32(dma->rxDescRead);
#ifdef __HAIKU__
#ifdef MWL_HOST_PS_SUPPORT
pCmd->Flags = htole32(SET_HW_SPEC_HOSTFORM_BEACON
| SET_HW_SPEC_HOST_POWERSAVE
| SET_HW_SPEC_HOSTFORM_PROBERESP);
#else
pCmd->Flags = htole32(SET_HW_SPEC_HOSTFORM_BEACON
| SET_HW_SPEC_HOSTFORM_PROBERESP);
#endif
#else
pCmd->Flags = htole32(SET_HW_SPEC_HOSTFORM_BEACON
#ifdef MWL_HOST_PS_SUPPORT
| SET_HW_SPEC_HOST_POWERSAVE
#endif
| SET_HW_SPEC_HOSTFORM_PROBERESP);
#endif
/* disable multi-bss operation for A1-A4 parts */
if (mh->mh_revs.mh_macRev < 5)
pCmd->Flags |= htole32(SET_HW_SPEC_DISABLEMBSS);
@@ -841,7 +832,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
@@ -991,7 +982,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);
@@ -1391,7 +1382,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;
@@ -1575,7 +1566,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])
@@ -1617,7 +1608,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;
}
@@ -1634,7 +1625,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;
@@ -1656,7 +1647,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;
}
@@ -1692,7 +1683,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);
@@ -2013,7 +2004,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.
@@ -2218,7 +2209,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)
@@ -2430,9 +2421,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 */
@@ -1,4 +1,6 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
* Copyright (c) 2007-2009 Marvell Semiconductor, Inc.
* All rights reserved.
@@ -27,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
* $FreeBSD: releng/11.1/sys/dev/mwl/mwlhal.h 298915 2016-05-02 04:15:15Z adrian $
* $FreeBSD: releng/12.0/sys/dev/mwl/mwlhal.h 326255 2017-11-27 14:52:40Z pfg $
*/
#ifndef _MWL_HAL_H_
@@ -1,4 +1,6 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
* Copyright (c) 2007-2009 Marvell Semiconductor, Inc.
* All rights reserved.
@@ -27,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
* $FreeBSD: releng/11.1/sys/dev/mwl/mwlreg.h 195171 2009-06-29 18:42:54Z sam $
* $FreeBSD: releng/12.0/sys/dev/mwl/mwlreg.h 326255 2017-11-27 14:52:40Z pfg $
*/
/*