static void wpi_reset_rx_ring(struct wpi_softc *);
static void wpi_free_rx_ring(struct wpi_softc *);
static int wpi_alloc_tx_ring(struct wpi_softc *, struct wpi_tx_ring *,
- int);
+ uint8_t);
static void wpi_update_tx_ring(struct wpi_softc *, struct wpi_tx_ring *);
static void wpi_update_tx_ring_ps(struct wpi_softc *,
struct wpi_tx_ring *);
static int wpi_read_eeprom(struct wpi_softc *,
uint8_t macaddr[IEEE80211_ADDR_LEN]);
static uint32_t wpi_eeprom_channel_flags(struct wpi_eeprom_chan *);
-static void wpi_read_eeprom_band(struct wpi_softc *, int);
-static int wpi_read_eeprom_channels(struct wpi_softc *, int);
+static void wpi_read_eeprom_band(struct wpi_softc *, uint8_t);
+static int wpi_read_eeprom_channels(struct wpi_softc *, uint8_t);
static struct wpi_eeprom_chan *wpi_find_eeprom_channel(struct wpi_softc *,
struct ieee80211_channel *);
static int wpi_setregdomain(struct ieee80211com *,
struct ieee80211_regdomain *, int,
struct ieee80211_channel[]);
-static int wpi_read_eeprom_group(struct wpi_softc *, int);
-static int wpi_add_node_entry_adhoc(struct wpi_softc *);
+static int wpi_read_eeprom_group(struct wpi_softc *, uint8_t);
static struct ieee80211_node *wpi_node_alloc(struct ieee80211vap *,
const uint8_t mac[IEEE80211_ADDR_LEN]);
static void wpi_node_free(struct ieee80211_node *);
static void wpi_scan_timeout(void *);
static void wpi_tx_timeout(void *);
static void wpi_parent(struct ieee80211com *);
-static int wpi_cmd(struct wpi_softc *, int, const void *, size_t, int);
+static int wpi_cmd(struct wpi_softc *, uint8_t, const void *, uint16_t,
+ int);
static int wpi_mrr_setup(struct wpi_softc *);
static int wpi_add_node(struct wpi_softc *, struct ieee80211_node *);
static int wpi_add_broadcast_node(struct wpi_softc *, int);
static int wpi_key_delete(struct ieee80211vap *,
const struct ieee80211_key *);
static int wpi_post_alive(struct wpi_softc *);
-static int wpi_load_bootcode(struct wpi_softc *, const uint8_t *, int);
+static int wpi_load_bootcode(struct wpi_softc *, const uint8_t *,
+ uint32_t);
static int wpi_load_firmware(struct wpi_softc *);
static int wpi_read_firmware(struct wpi_softc *);
static void wpi_unload_firmware(struct wpi_softc *);
{
struct wpi_softc *sc = (struct wpi_softc *)device_get_softc(dev);
struct ieee80211com *ic;
- int i, error, rid;
+ uint8_t i;
+ int error, rid;
#ifdef WPI_DEBUG
int supportsa = 1;
const struct wpi_ident *ident;
sc->sc_st = rman_get_bustag(sc->mem);
sc->sc_sh = rman_get_bushandle(sc->mem);
- i = 1;
- rid = 0;
- if (pci_alloc_msi(dev, &i) == 0)
+ rid = 1;
+ if (pci_alloc_msi(dev, &rid) == 0)
rid = 1;
+ else
+ rid = 0;
/* Install interrupt handler. */
sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE |
(rid != 0 ? 0 : RF_SHAREABLE));
{
struct wpi_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
- int qid;
+ uint8_t qid;
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__);
static __inline void
wpi_prph_write_region_4(struct wpi_softc *sc, uint32_t addr,
- const uint32_t *data, int count)
+ const uint32_t *data, uint32_t count)
{
- for (; count > 0; count--, data++, addr += 4)
+ for (; count != 0; count--, data++, addr += 4)
wpi_prph_write(sc, addr, *data);
}
}
static int
-wpi_alloc_tx_ring(struct wpi_softc *sc, struct wpi_tx_ring *ring, int qid)
+wpi_alloc_tx_ring(struct wpi_softc *sc, struct wpi_tx_ring *ring, uint8_t qid)
{
bus_addr_t paddr;
bus_size_t size;
if ((error = res) != 0) \
goto fail; \
} while (0)
- int error, i;
+ uint8_t i;
+ int error;
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__);
}
static void
-wpi_read_eeprom_band(struct wpi_softc *sc, int n)
+wpi_read_eeprom_band(struct wpi_softc *sc, uint8_t n)
{
struct ieee80211com *ic = &sc->sc_ic;
struct wpi_eeprom_chan *channels = sc->eeprom_channels[n];
const struct wpi_chan_band *band = &wpi_bands[n];
struct ieee80211_channel *c;
- uint8_t chan;
- int i, nflags;
+ uint32_t nflags;
+ uint8_t chan, i;
for (i = 0; i < band->nchan; i++) {
if (!(channels[i].flags & WPI_EEPROM_CHAN_VALID)) {
* band and update net80211 with what we find.
*/
static int
-wpi_read_eeprom_channels(struct wpi_softc *sc, int n)
+wpi_read_eeprom_channels(struct wpi_softc *sc, uint8_t n)
{
struct ieee80211com *ic = &sc->sc_ic;
const struct wpi_chan_band *band = &wpi_bands[n];
}
static int
-wpi_read_eeprom_group(struct wpi_softc *sc, int n)
+wpi_read_eeprom_group(struct wpi_softc *sc, uint8_t n)
{
struct wpi_power_group *group = &sc->groups[n];
struct wpi_eeprom_group rgroup;
return 0;
}
-static int
+static __inline uint8_t
wpi_add_node_entry_adhoc(struct wpi_softc *sc)
{
- int newid = WPI_ID_IBSS_MIN;
+ uint8_t newid = WPI_ID_IBSS_MIN;
for (; newid <= WPI_ID_IBSS_MAX; newid++) {
if ((sc->nodesmsk & (1 << newid)) == 0) {
return WPI_ID_UNDEFINED;
}
-static __inline int
+static __inline uint8_t
wpi_add_node_entry_sta(struct wpi_softc *sc)
{
sc->nodesmsk |= 1 << WPI_ID_BSS;
struct wpi_tx_ring *ring;
struct mbuf *m1;
bus_dma_segment_t *seg, segs[WPI_MAX_SCATTER];
- int error, i, hdrlen, nsegs, totlen, pad;
+ uint8_t pad;
+ uint16_t hdrlen;
+ int error, i, nsegs, totlen;
WPI_TXQ_LOCK(sc);
struct wpi_buf tx_data;
struct wpi_cmd_data *tx = (struct wpi_cmd_data *)&tx_data.data;
uint32_t flags;
- uint16_t qos;
- uint8_t tid, type;
- int ac, error, swcrypt, rate, ismcast, totlen;
+ uint16_t ac, qos;
+ uint8_t tid, type, rate;
+ int error, swcrypt, ismcast, totlen;
wh = mtod(m, struct ieee80211_frame *);
type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
struct wpi_buf tx_data;
struct wpi_cmd_data *tx = (struct wpi_cmd_data *)&tx_data.data;
uint32_t flags;
- uint8_t type;
- int ac, rate, swcrypt, totlen;
+ uint8_t ac, type, rate;
+ int swcrypt, totlen;
wh = mtod(m, struct ieee80211_frame *);
type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
}
static __inline int
-wpi_tx_ring_is_full(struct wpi_softc *sc, int ac)
+wpi_tx_ring_is_full(struct wpi_softc *sc, uint16_t ac)
{
struct wpi_tx_ring *ring = &sc->txq[ac];
int retval;
{
struct ieee80211com *ic = ni->ni_ic;
struct wpi_softc *sc = ic->ic_softc;
- int ac, error = 0;
+ uint16_t ac;
+ int error = 0;
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__);
{
struct wpi_softc *sc = ic->ic_softc;
struct ieee80211_node *ni;
- int ac, error;
+ uint16_t ac;
+ int error;
WPI_TX_LOCK(sc);
DPRINTF(sc, WPI_DEBUG_XMIT, "%s: called\n", __func__);
* Send a command to the firmware.
*/
static int
-wpi_cmd(struct wpi_softc *sc, int code, const void *buf, size_t size,
+wpi_cmd(struct wpi_softc *sc, uint8_t code, const void *buf, uint16_t size,
int async)
{
struct wpi_tx_ring *ring = &sc->txq[WPI_CMD_QUEUE_NUM];
struct wpi_tx_cmd *cmd;
struct mbuf *m;
bus_addr_t paddr;
- int totlen, error;
+ uint16_t totlen;
+ int error;
WPI_TXQ_LOCK(sc);
if (async == 0)
WPI_LOCK_ASSERT(sc);
- DPRINTF(sc, WPI_DEBUG_CMD, "%s: cmd %s size %zu async %d\n",
+ DPRINTF(sc, WPI_DEBUG_CMD, "%s: cmd %s size %u async %d\n",
__func__, wpi_cmd_str(code), size, async);
desc = &ring->desc[ring->cur];
{
struct ieee80211com *ic = &sc->sc_ic;
struct wpi_mrr_setup mrr;
- int i, error;
+ uint8_t i;
+ int error;
/* CCK rates (not used with 802.11a). */
for (i = WPI_RIDX_CCK1; i <= WPI_RIDX_CCK11; i++) {
{
struct wpi_pmgt_cmd cmd;
const struct wpi_pmgt *pmgt;
- uint32_t max, skip_dtim;
- uint32_t reg;
+ uint32_t max, reg;
+ uint8_t skip_dtim;
int i;
DPRINTF(sc, WPI_DEBUG_PWRSAVE,
{
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
- int bintval = 0;
+ uint16_t bintval = 0;
/* bintval is in TU (1.024mS) */
if (vap != NULL)
struct wpi_scan_chan *chan;
struct ieee80211_frame *wh;
struct ieee80211_rateset *rs;
- uint16_t dwell_active, dwell_passive;
- uint8_t *buf, *frm;
- int bgscan, bintval, buflen, error, i, nssid;
+ uint16_t bintval, buflen, dwell_active, dwell_passive;
+ uint8_t *buf, *frm, i, nssid;
+ int bgscan, error;
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__);
* the NIC internal memory (no DMA transfer).
*/
static int
-wpi_load_bootcode(struct wpi_softc *sc, const uint8_t *ucode, int size)
+wpi_load_bootcode(struct wpi_softc *sc, const uint8_t *ucode, uint32_t size)
{
int error, ntries;
static int
wpi_hw_init(struct wpi_softc *sc)
{
- int chnl, ntries, error;
+ uint8_t chnl;
+ int ntries, error;
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__);
static void
wpi_hw_stop(struct wpi_softc *sc)
{
- int chnl, qid, ntries;
+ uint8_t chnl, qid;
+ int ntries;
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_DOING, __func__);