diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2010-05-11 17:59:40 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2010-05-11 17:59:40 +0000 |
commit | 5953f681a255638abfd7e4c5b3b3a9c0aaad210d (patch) | |
tree | f2448f996a17199f208ca4d978ecadf90e107111 /sys | |
parent | 1bcc1e240634a6747ccec8faa3183ebb64963b5c (diff) |
various AR9003 fixes (found during code inspection):
- the ROM deviceCap field is now 8 bits (instead of 16), so the number
of entries in the key cache is always 0; just use the default value.
- AR_CR_RXE is equal to 0 on AR9003.
- do not use ``m'' unititialized in ar9003_rx_process.
- if an Rx descriptor is not valid (bad signature), skip it instead of
leaving it at the head of the FIFO.
- update the Rx software descriptor with new virtual and physical address
of Rx descritor when mapping a new buffer.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/ar9003.c | 10 | ||||
-rw-r--r-- | sys/dev/ic/ar9380.c | 12 | ||||
-rw-r--r-- | sys/dev/ic/ar9380reg.h | 5 |
3 files changed, 12 insertions, 15 deletions
diff --git a/sys/dev/ic/ar9003.c b/sys/dev/ic/ar9003.c index cbeacc966d3..0b682f3dba2 100644 --- a/sys/dev/ic/ar9003.c +++ b/sys/dev/ic/ar9003.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9003.c,v 1.1 2010/05/10 17:44:21 damien Exp $ */ +/* $OpenBSD: ar9003.c,v 1.2 2010/05/11 17:59:39 damien Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -723,7 +723,7 @@ ar9003_rx_enable(struct athn_softc *sc) } } /* Enable Rx. */ - AR_WRITE(sc, AR_CR, AR_CR_RXE); + AR_WRITE(sc, AR_CR, 0); } #if NBPFILTER > 0 @@ -816,14 +816,14 @@ ar9003_rx_process(struct athn_softc *sc, int qid) bus_dmamap_sync(sc->sc_dmat, bf->bf_map, 0, bf->bf_map->dm_mapsize, BUS_DMASYNC_POSTREAD); - ds = mtod(m, struct ar_rx_status *); + ds = mtod(bf->bf_m, struct ar_rx_status *); if (!(ds->ds_status1 & AR_RXS1_DONE)) return (EBUSY); /* Check that it is a valid Rx status descriptor. */ if ((ds->ds_info & (AR_RXI_DESC_ID_M | AR_RXI_DESC_TX | AR_RXI_CTRL_STAT)) != SM(AR_RXI_DESC_ID, AR_VENDOR_ATHEROS)) - return (0); + goto skip; if (!(ds->ds_status11 & AR_RXS11_FRAME_OK)) { if (ds->ds_status11 & AR_RXS11_CRC_ERR) @@ -881,6 +881,8 @@ ar9003_rx_process(struct athn_softc *sc, int qid) ifp->if_ierrors++; goto skip; } + bf->bf_desc = mtod(m1, struct ar_rx_status *); + bf->bf_daddr = bf->bf_map->dm_segs[0].ds_addr; bus_dmamap_sync(sc->sc_dmat, bf->bf_map, 0, bf->bf_map->dm_mapsize, BUS_DMASYNC_PREREAD); diff --git a/sys/dev/ic/ar9380.c b/sys/dev/ic/ar9380.c index d1f7f293187..b743f71cc13 100644 --- a/sys/dev/ic/ar9380.c +++ b/sys/dev/ic/ar9380.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9380.c,v 1.1 2010/05/10 17:44:21 damien Exp $ */ +/* $OpenBSD: ar9380.c,v 1.2 2010/05/11 17:59:39 damien Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -123,7 +123,7 @@ ar9380_setup(struct athn_softc *sc) struct ieee80211com *ic = &sc->sc_ic; struct ar9380_eeprom *eep = sc->eep; struct ar9380_base_eep_hdr *base = &eep->baseEepHeader; - uint8_t kc_entries_log, type; + uint8_t type; if (base->opFlags & AR_OPFLAGS_11A) sc->flags |= ATHN_FLAG_11A; @@ -142,10 +142,8 @@ ar9380_setup(struct athn_softc *sc) sc->rfsilent_pin = base->wlanDisableGpio; } - /* Get the number of HW key cache entries. */ - kc_entries_log = MS(base->deviceCap, AR_EEP_DEVCAP_KC_ENTRIES); - sc->kc_entries = (kc_entries_log != 0) ? - 1 << kc_entries_log : AR_KEYTABLE_SIZE; + /* Set the number of HW key cache entries. */ + sc->kc_entries = AR_KEYTABLE_SIZE; sc->txchainmask = MS(base->txrxMask, AR_EEP_TX_MASK); sc->rxchainmask = MS(base->txrxMask, AR_EEP_RX_MASK); @@ -515,7 +513,7 @@ ar9380_set_txpower(struct athn_softc *sc, struct ieee80211_channel *c, } else { /* Get OFDM target powers. */ ar9003_get_lg_tpow(sc, c, AR_CTL_11A, - eep->calTargetFbin2G, eep->calTargetPower5G, + eep->calTargetFbin5G, eep->calTargetPower5G, AR9380_NUM_5G_20_TARGET_POWERS, tpow_ofdm); #ifndef IEEE80211_NO_HT diff --git a/sys/dev/ic/ar9380reg.h b/sys/dev/ic/ar9380reg.h index 99fb11366e6..cbae09a01fd 100644 --- a/sys/dev/ic/ar9380reg.h +++ b/sys/dev/ic/ar9380reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9380reg.h,v 1.3 2010/05/11 17:45:54 damien Exp $ */ +/* $OpenBSD: ar9380reg.h,v 1.4 2010/05/11 17:59:39 damien Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -80,9 +80,6 @@ struct ar9380_base_eep_hdr { uint8_t blueToothOptions; uint8_t deviceCap; -#define AR_EEP_DEVCAP_KC_ENTRIES_M 0xf000 -#define AR_EEP_DEVCAP_KC_ENTRIES_S 12 - uint8_t deviceType; int8_t pwrTableOffset; uint8_t params_for_tuning_caps[2]; |