FreeBSD kernel ATH device code
ar5211_attach.c
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: ISC
3 *
4 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
5 * Copyright (c) 2002-2006 Atheros Communications, Inc.
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 *
19 * $FreeBSD$
20 */
21#include "opt_ah.h"
22
23#include "ah.h"
24#include "ah_internal.h"
25#include "ah_devid.h"
26
27#include "ar5211/ar5211.h"
28#include "ar5211/ar5211reg.h"
29#include "ar5211/ar5211phy.h"
30
31#include "ah_eeprom_v3.h"
32
33static HAL_BOOL ar5211GetChannelEdges(struct ath_hal *ah,
34 uint16_t flags, uint16_t *low, uint16_t *high);
36 struct ieee80211_channel *chan);
37
38static void ar5211ConfigPCIE(struct ath_hal *ah, HAL_BOOL restore,
39 HAL_BOOL power_off);
40static void ar5211DisablePCIE(struct ath_hal *ah);
41
42static const struct ath_hal_private ar5211hal = {{
43 .ah_magic = AR5211_MAGIC,
44
45 .ah_getRateTable = ar5211GetRateTable,
46 .ah_detach = ar5211Detach,
47
48 /* Reset Functions */
49 .ah_reset = ar5211Reset,
50 .ah_phyDisable = ar5211PhyDisable,
51 .ah_disable = ar5211Disable,
52 .ah_configPCIE = ar5211ConfigPCIE,
53 .ah_disablePCIE = ar5211DisablePCIE,
54 .ah_setPCUConfig = ar5211SetPCUConfig,
55 .ah_perCalibration = ar5211PerCalibration,
56 .ah_perCalibrationN = ar5211PerCalibrationN,
57 .ah_resetCalValid = ar5211ResetCalValid,
58 .ah_setTxPowerLimit = ar5211SetTxPowerLimit,
59 .ah_getChanNoise = ath_hal_getChanNoise,
60
61 /* Transmit functions */
62 .ah_updateTxTrigLevel = ar5211UpdateTxTrigLevel,
63 .ah_setupTxQueue = ar5211SetupTxQueue,
64 .ah_setTxQueueProps = ar5211SetTxQueueProps,
65 .ah_getTxQueueProps = ar5211GetTxQueueProps,
66 .ah_releaseTxQueue = ar5211ReleaseTxQueue,
67 .ah_resetTxQueue = ar5211ResetTxQueue,
68 .ah_getTxDP = ar5211GetTxDP,
69 .ah_setTxDP = ar5211SetTxDP,
70 .ah_numTxPending = ar5211NumTxPending,
71 .ah_startTxDma = ar5211StartTxDma,
72 .ah_stopTxDma = ar5211StopTxDma,
73 .ah_setupTxDesc = ar5211SetupTxDesc,
74 .ah_setupXTxDesc = ar5211SetupXTxDesc,
75 .ah_fillTxDesc = ar5211FillTxDesc,
76 .ah_procTxDesc = ar5211ProcTxDesc,
77 .ah_getTxIntrQueue = ar5211GetTxIntrQueue,
78 .ah_reqTxIntrDesc = ar5211IntrReqTxDesc,
79 .ah_getTxCompletionRates = ar5211GetTxCompletionRates,
80 .ah_setTxDescLink = ar5211SetTxDescLink,
81 .ah_getTxDescLink = ar5211GetTxDescLink,
82 .ah_getTxDescLinkPtr = ar5211GetTxDescLinkPtr,
83
84 /* RX Functions */
85 .ah_getRxDP = ar5211GetRxDP,
86 .ah_setRxDP = ar5211SetRxDP,
87 .ah_enableReceive = ar5211EnableReceive,
88 .ah_stopDmaReceive = ar5211StopDmaReceive,
89 .ah_startPcuReceive = ar5211StartPcuReceive,
90 .ah_stopPcuReceive = ar5211StopPcuReceive,
91 .ah_setMulticastFilter = ar5211SetMulticastFilter,
92 .ah_setMulticastFilterIndex = ar5211SetMulticastFilterIndex,
93 .ah_clrMulticastFilterIndex = ar5211ClrMulticastFilterIndex,
94 .ah_getRxFilter = ar5211GetRxFilter,
95 .ah_setRxFilter = ar5211SetRxFilter,
96 .ah_setupRxDesc = ar5211SetupRxDesc,
97 .ah_procRxDesc = ar5211ProcRxDesc,
98 .ah_rxMonitor = ar5211RxMonitor,
99 .ah_aniPoll = ar5211AniPoll,
100 .ah_procMibEvent = ar5211MibEvent,
101
102 /* Misc Functions */
103 .ah_getCapability = ar5211GetCapability,
104 .ah_setCapability = ar5211SetCapability,
105 .ah_getDiagState = ar5211GetDiagState,
106 .ah_getMacAddress = ar5211GetMacAddress,
107 .ah_setMacAddress = ar5211SetMacAddress,
108 .ah_getBssIdMask = ar5211GetBssIdMask,
109 .ah_setBssIdMask = ar5211SetBssIdMask,
110 .ah_setRegulatoryDomain = ar5211SetRegulatoryDomain,
111 .ah_setLedState = ar5211SetLedState,
112 .ah_writeAssocid = ar5211WriteAssocid,
113 .ah_gpioCfgInput = ar5211GpioCfgInput,
114 .ah_gpioCfgOutput = ar5211GpioCfgOutput,
115 .ah_gpioGet = ar5211GpioGet,
116 .ah_gpioSet = ar5211GpioSet,
117 .ah_gpioSetIntr = ar5211GpioSetIntr,
118 .ah_getTsf32 = ar5211GetTsf32,
119 .ah_getTsf64 = ar5211GetTsf64,
120 .ah_resetTsf = ar5211ResetTsf,
121 .ah_detectCardPresent = ar5211DetectCardPresent,
122 .ah_updateMibCounters = ar5211UpdateMibCounters,
123 .ah_getRfGain = ar5211GetRfgain,
124 .ah_getDefAntenna = ar5211GetDefAntenna,
125 .ah_setDefAntenna = ar5211SetDefAntenna,
126 .ah_getAntennaSwitch = ar5211GetAntennaSwitch,
127 .ah_setAntennaSwitch = ar5211SetAntennaSwitch,
128 .ah_setSifsTime = ar5211SetSifsTime,
129 .ah_getSifsTime = ar5211GetSifsTime,
130 .ah_setSlotTime = ar5211SetSlotTime,
131 .ah_getSlotTime = ar5211GetSlotTime,
132 .ah_setAckTimeout = ar5211SetAckTimeout,
133 .ah_getAckTimeout = ar5211GetAckTimeout,
134 .ah_setAckCTSRate = ar5211SetAckCTSRate,
135 .ah_getAckCTSRate = ar5211GetAckCTSRate,
136 .ah_setCTSTimeout = ar5211SetCTSTimeout,
137 .ah_getCTSTimeout = ar5211GetCTSTimeout,
138 .ah_setDecompMask = ar5211SetDecompMask,
139 .ah_setCoverageClass = ar5211SetCoverageClass,
140 .ah_setQuiet = ar5211SetQuiet,
141 .ah_get11nExtBusy = ar5211Get11nExtBusy,
142 .ah_getMibCycleCounts = ar5211GetMibCycleCounts,
143 .ah_setChainMasks = ar5211SetChainMasks,
144 .ah_enableDfs = ar5211EnableDfs,
145 .ah_getDfsThresh = ar5211GetDfsThresh,
146 /* XXX procRadarEvent */
147 /* XXX isFastClockEnabled */
148 .ah_setNav = ar5211SetNav,
149 .ah_getNav = ar5211GetNav,
150
151 /* Key Cache Functions */
152 .ah_getKeyCacheSize = ar5211GetKeyCacheSize,
153 .ah_resetKeyCacheEntry = ar5211ResetKeyCacheEntry,
154 .ah_isKeyCacheEntryValid = ar5211IsKeyCacheEntryValid,
155 .ah_setKeyCacheEntry = ar5211SetKeyCacheEntry,
156 .ah_setKeyCacheEntryMac = ar5211SetKeyCacheEntryMac,
157
158 /* Power Management Functions */
159 .ah_setPowerMode = ar5211SetPowerMode,
160 .ah_getPowerMode = ar5211GetPowerMode,
161
162 /* Beacon Functions */
163 .ah_setBeaconTimers = ar5211SetBeaconTimers,
164 .ah_beaconInit = ar5211BeaconInit,
165 .ah_setStationBeaconTimers = ar5211SetStaBeaconTimers,
166 .ah_resetStationBeaconTimers = ar5211ResetStaBeaconTimers,
167 .ah_getNextTBTT = ar5211GetNextTBTT,
168
169 /* Interrupt Functions */
170 .ah_isInterruptPending = ar5211IsInterruptPending,
171 .ah_getPendingInterrupts = ar5211GetPendingInterrupts,
172 .ah_getInterrupts = ar5211GetInterrupts,
173 .ah_setInterrupts = ar5211SetInterrupts },
174
175 .ah_getChannelEdges = ar5211GetChannelEdges,
176 .ah_getWirelessModes = ar5211GetWirelessModes,
177 .ah_eepromRead = ar5211EepromRead,
178#ifdef AH_SUPPORT_WRITE_EEPROM
179 .ah_eepromWrite = ar5211EepromWrite,
180#endif
181 .ah_getChipPowerLimits = ar5211GetChipPowerLimits,
182};
183
184static HAL_BOOL ar5211ChipTest(struct ath_hal *);
185static HAL_BOOL ar5211FillCapabilityInfo(struct ath_hal *ah);
186
187/*
188 * Return the revsion id for the radio chip. This
189 * fetched via the PHY.
190 */
191static uint32_t
193{
194 uint32_t val;
195 int i;
196
197 OS_REG_WRITE(ah, (AR_PHY_BASE + (0x34 << 2)), 0x00001c16);
198 for (i = 0; i < 8; i++)
199 OS_REG_WRITE(ah, (AR_PHY_BASE + (0x20 << 2)), 0x00010000);
200 val = (OS_REG_READ(ah, AR_PHY_BASE + (256 << 2)) >> 24) & 0xff;
201 val = ((val & 0xf0) >> 4) | ((val & 0x0f) << 4);
202 return ath_hal_reverseBits(val, 8);
203}
204
205/*
206 * Attach for an AR5211 part.
207 */
208static struct ath_hal *
209ar5211Attach(uint16_t devid, HAL_SOFTC sc,
210 HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata,
212{
213#define N(a) (sizeof(a)/sizeof(a[0]))
214 struct ath_hal_5211 *ahp;
215 struct ath_hal *ah;
216 uint32_t val;
217 uint16_t eeval;
218 HAL_STATUS ecode;
219
220 HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
221 __func__, sc, (void*) st, (void*) sh);
222
223 /* NB: memory is returned zero'd */
224 ahp = ath_hal_malloc(sizeof (struct ath_hal_5211));
225 if (ahp == AH_NULL) {
227 "%s: cannot allocate memory for state block\n", __func__);
228 ecode = HAL_ENOMEM;
229 goto bad;
230 }
231 ah = &ahp->ah_priv.h;
232 /* set initial values */
233 OS_MEMCPY(&ahp->ah_priv, &ar5211hal, sizeof(struct ath_hal_private));
234 ah->ah_sc = sc;
235 ah->ah_st = st;
236 ah->ah_sh = sh;
237
238 ah->ah_devid = devid; /* NB: for AH_DEBUG_ALQ */
239 AH_PRIVATE(ah)->ah_devid = devid;
240 AH_PRIVATE(ah)->ah_subvendorid = 0; /* XXX */
241
242 AH_PRIVATE(ah)->ah_powerLimit = MAX_RATE_POWER;
243 AH_PRIVATE(ah)->ah_tpScale = HAL_TP_SCALE_MAX; /* no scaling */
244
246 ahp->ah_staId1Defaults = 0;
248 ahp->ah_sifstime = (u_int) -1;
249 ahp->ah_slottime = (u_int) -1;
250 ahp->ah_acktimeout = (u_int) -1;
251 ahp->ah_ctstimeout = (u_int) -1;
252
253 if (!ar5211ChipReset(ah, AH_NULL)) { /* reset chip */
254 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: chip reset failed\n", __func__);
255 ecode = HAL_EIO;
256 goto bad;
257 }
258 if (AH_PRIVATE(ah)->ah_devid == AR5211_FPGA11B) {
259 /* set it back to OFDM mode to be able to read analog rev id */
262 OS_DELAY(1000);
263 }
264
265 /* Read Revisions from Chips */
266 val = OS_REG_READ(ah, AR_SREV) & AR_SREV_ID_M;
267 AH_PRIVATE(ah)->ah_macVersion = val >> AR_SREV_ID_S;
268 AH_PRIVATE(ah)->ah_macRev = val & AR_SREV_REVISION_M;
269
273 "%s: Mac Chip Rev 0x%x is not supported by this driver\n",
274 __func__, AH_PRIVATE(ah)->ah_macVersion);
275 ecode = HAL_ENOTSUPP;
276 goto bad;
277 }
278
279 AH_PRIVATE(ah)->ah_phyRev = OS_REG_READ(ah, AR_PHY_CHIP_ID);
280
281 if (!ar5211ChipTest(ah)) {
282 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: hardware self-test failed\n",
283 __func__);
284 ecode = HAL_ESELFTEST;
285 goto bad;
286 }
287
288 /* Set correct Baseband to analog shift setting to access analog chips. */
290 OS_REG_WRITE(ah, AR_PHY_BASE, 0x00000007);
291 } else {
292 OS_REG_WRITE(ah, AR_PHY_BASE, 0x00000047);
293 }
294 OS_DELAY(2000);
295
296 /* Read Radio Chip Rev Extract */
297 AH_PRIVATE(ah)->ah_analog5GhzRev = ar5211GetRadioRev(ah);
298 if ((AH_PRIVATE(ah)->ah_analog5GhzRev & 0xf0) != RAD5_SREV_MAJOR) {
300 "%s: 5G Radio Chip Rev 0x%02X is not supported by this "
301 "driver\n", __func__, AH_PRIVATE(ah)->ah_analog5GhzRev);
302 ecode = HAL_ENOTSUPP;
303 goto bad;
304 }
305
308 if (val != AR_PCICFG_EEPROM_SIZE_16K) {
309 HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unsupported EEPROM size "
310 "%u (0x%x) found\n", __func__, val, val);
311 ecode = HAL_EESIZE;
312 goto bad;
313 }
314 ecode = ath_hal_legacyEepromAttach(ah);
315 if (ecode != HAL_OK) {
316 goto bad;
317 }
318
319 /* If Bmode and AR5211, verify 2.4 analog exists */
322 /* Set correct Baseband to analog shift setting to access analog chips. */
323 OS_REG_WRITE(ah, AR_PHY_BASE, 0x00004007);
324 OS_DELAY(2000);
325 AH_PRIVATE(ah)->ah_analog2GhzRev = ar5211GetRadioRev(ah);
326
327 /* Set baseband for 5GHz chip */
328 OS_REG_WRITE(ah, AR_PHY_BASE, 0x00000007);
329 OS_DELAY(2000);
330 if ((AH_PRIVATE(ah)->ah_analog2GhzRev & 0xF0) != RAD2_SREV_MAJOR) {
332 "%s: 2G Radio Chip Rev 0x%x is not supported by "
333 "this driver\n", __func__,
335 ecode = HAL_ENOTSUPP;
336 goto bad;
337 }
338 } else {
340 }
341
342 ecode = ath_hal_eepromGet(ah, AR_EEP_REGDMN_0, &eeval);
343 if (ecode != HAL_OK) {
345 "%s: cannot read regulatory domain from EEPROM\n",
346 __func__);
347 goto bad;
348 }
349 AH_PRIVATE(ah)->ah_currentRD = eeval;
350 AH_PRIVATE(ah)->ah_getNfAdjust = ar5211GetNfAdjust;
351
352 /*
353 * Got everything we need now to setup the capabilities.
354 */
355 (void) ar5211FillCapabilityInfo(ah);
356
357 /* Initialize gain ladder thermal calibration structure */
359
361 if (ecode != HAL_OK) {
363 "%s: error getting mac address from EEPROM\n", __func__);
364 goto bad;
365 }
366
367 HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s: return\n", __func__);
368
369 return ah;
370bad:
371 if (ahp)
372 ar5211Detach((struct ath_hal *) ahp);
373 if (status)
374 *status = ecode;
375 return AH_NULL;
376#undef N
377}
378
379void
381{
382 HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s:\n", __func__);
383
384 HALASSERT(ah != AH_NULL);
386
388 ath_hal_free(ah);
389}
390
391static HAL_BOOL
393{
394 uint32_t regAddr[2] = { AR_STA_ID0, AR_PHY_BASE+(8 << 2) };
395 uint32_t regHold[2];
396 uint32_t patternData[4] =
397 { 0x55555555, 0xaaaaaaaa, 0x66666666, 0x99999999 };
398 int i, j;
399
400 /* Test PHY & MAC registers */
401 for (i = 0; i < 2; i++) {
402 uint32_t addr = regAddr[i];
403 uint32_t wrData, rdData;
404
405 regHold[i] = OS_REG_READ(ah, addr);
406 for (j = 0; j < 0x100; j++) {
407 wrData = (j << 16) | j;
408 OS_REG_WRITE(ah, addr, wrData);
409 rdData = OS_REG_READ(ah, addr);
410 if (rdData != wrData) {
412"%s: address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n",
413 __func__, addr, wrData, rdData);
414 return AH_FALSE;
415 }
416 }
417 for (j = 0; j < 4; j++) {
418 wrData = patternData[j];
419 OS_REG_WRITE(ah, addr, wrData);
420 rdData = OS_REG_READ(ah, addr);
421 if (wrData != rdData) {
423"%s: address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n",
424 __func__, addr, wrData, rdData);
425 return AH_FALSE;
426 }
427 }
428 OS_REG_WRITE(ah, regAddr[i], regHold[i]);
429 }
430 OS_DELAY(100);
431 return AH_TRUE;
432}
433
434/*
435 * Store the channel edges for the requested operational mode
436 */
437static HAL_BOOL
439 uint16_t flags, uint16_t *low, uint16_t *high)
440{
441 if (flags & IEEE80211_CHAN_5GHZ) {
442 *low = 4920;
443 *high = 6100;
444 return AH_TRUE;
445 }
446 if (flags & IEEE80211_CHAN_2GHZ &&
448 *low = 2312;
449 *high = 2732;
450 return AH_TRUE;
451 }
452 return AH_FALSE;
453}
454
455static HAL_BOOL
456ar5211GetChipPowerLimits(struct ath_hal *ah, struct ieee80211_channel *chan)
457{
458 /* XXX fill in, this is just a placeholder */
460 "%s: no min/max power for %u/0x%x\n",
461 __func__, chan->ic_freq, chan->ic_flags);
462 chan->ic_maxpower = MAX_RATE_POWER;
463 chan->ic_minpower = 0;
464 return AH_TRUE;
465}
466
467static void
468ar5211ConfigPCIE(struct ath_hal *ah, HAL_BOOL restore, HAL_BOOL power_off)
469{
470}
471
472static void
474{
475}
476
477/*
478 * Fill all software cached or static hardware state information.
479 */
480static HAL_BOOL
482{
483 struct ath_hal_private *ahpriv = AH_PRIVATE(ah);
484 HAL_CAPABILITIES *pCap = &ahpriv->ah_caps;
485
486 /* Construct wireless mode from EEPROM */
487 pCap->halWirelessModes = 0;
492 }
495
496 pCap->halLow2GhzChan = 2312;
497 pCap->halHigh2GhzChan = 2732;
498 pCap->halLow5GhzChan = 4920;
499 pCap->halHigh5GhzChan = 6100;
500
503 pCap->halPSPollBroken = AH_TRUE;
504 pCap->halVEOLSupport = AH_TRUE;
505 pCap->halNumMRRetries = 1; /* No hardware MRR support */
506 pCap->halNumTxMaps = 1; /* Single TX ptr per descr */
507
509 pCap->halKeyCacheSize = 128;
510
511 /* XXX not needed */
514
515 /*
516 * RSSI uses the combined field; some 11n NICs may use
517 * the control chain RSSI.
518 */
520
523 /* NB: enabled by default */
524 ahpriv->ah_rfkillEnabled = AH_TRUE;
526 }
527
528 pCap->halRxTstampPrecision = 13;
529 pCap->halTxTstampPrecision = 16;
531 | HAL_INT_RX
532 | HAL_INT_TX
536 ;
537
540
541 /* XXX might be ok w/ some chip revs */
542 ahpriv->ah_rxornIsFatal = AH_TRUE;
543 return AH_TRUE;
544}
545
546static const char*
547ar5211Probe(uint16_t vendorid, uint16_t devid)
548{
549 if (vendorid == ATHEROS_VENDOR_ID) {
550 if (devid == AR5211_DEVID || devid == AR5311_DEVID ||
551 devid == AR5211_DEFAULT)
552 return "Atheros 5211";
553 if (devid == AR5211_FPGA11B)
554 return "Atheros 5211 (FPGA)";
555 }
556 return AH_NULL;
557}
uint32_t ath_hal_reverseBits(uint32_t val, uint32_t n)
Definition: ah.c:333
int16_t ath_hal_getChanNoise(struct ath_hal *ah, const struct ieee80211_channel *chan)
Definition: ah.c:1158
HAL_STATUS
Definition: ah.h:71
@ HAL_EIO
Definition: ah.h:75
@ HAL_ESELFTEST
Definition: ah.h:86
@ HAL_ENOTSUPP
Definition: ah.h:85
@ HAL_OK
Definition: ah.h:72
@ HAL_ENOMEM
Definition: ah.h:74
@ HAL_EESIZE
Definition: ah.h:82
@ HAL_MODE_TURBO
Definition: ah.h:658
@ HAL_MODE_11A
Definition: ah.h:657
@ HAL_MODE_11B
Definition: ah.h:659
#define HAL_NUM_TX_QUEUES
Definition: ah.h:251
@ HAL_ANT_VARIABLE
Definition: ah.h:759
@ HAL_INT_BNR
Definition: ah.h:493
@ HAL_INT_TIM
Definition: ah.h:494
@ HAL_INT_COMMON
Definition: ah.h:514
@ HAL_INT_FATAL
Definition: ah.h:505
@ HAL_INT_TX
Definition: ah.h:481
@ HAL_INT_RX
Definition: ah.h:473
HAL_BOOL
Definition: ah.h:93
@ AH_FALSE
Definition: ah.h:94
@ AH_TRUE
Definition: ah.h:95
@ HAL_DEBUG_ANY
Definition: ah_debug.h:62
@ HAL_DEBUG_ATTACH
Definition: ah_debug.h:30
#define AR5211_DEFAULT
Definition: ah_devid.h:40
#define AR5211_DEVID
Definition: ah_devid.h:42
#define AR5311_DEVID
Definition: ah_devid.h:41
#define AR5211_FPGA11B
Definition: ah_devid.h:44
#define ATHEROS_VENDOR_ID
Definition: ah_devid.h:25
HAL_STATUS ath_hal_legacyEepromAttach(struct ath_hal *ah)
#define MAX_RATE_POWER
Definition: ah_eeprom.h:163
@ AR_EEP_MACADDR
Definition: ah_eeprom.h:77
@ AR_EEP_BMODE
Definition: ah_eeprom.h:71
@ AR_EEP_REGDMN_0
Definition: ah_eeprom.h:86
@ AR_EEP_RFKILL
Definition: ah_eeprom.h:69
@ AR_EEP_RFSILENT
Definition: ah_eeprom.h:90
@ AR_EEP_TURBO5DISABLE
Definition: ah_eeprom.h:73
@ AR_EEP_AMODE
Definition: ah_eeprom.h:70
@ HAL_TP_SCALE_MAX
Definition: ah_internal.h:67
#define ath_hal_eepromSet(_ah, _param, _val)
Definition: ah_internal.h:488
#define ath_hal_eepromGet(_ah, _param, _val)
Definition: ah_internal.h:486
#define AH_PRIVATE(_ah)
Definition: ah_internal.h:442
void * ath_hal_malloc(size_t)
#define AH_NULL
Definition: ah_internal.h:28
#define HALASSERT(_x)
Definition: ah_internal.h:683
#define HALDEBUG(_ah, __m,...)
Definition: ah_internal.h:658
#define ath_hal_eepromGetFlag(_ah, _param)
Definition: ah_internal.h:490
#define ath_hal_eepromDetach(_ah)
Definition: ah_internal.h:482
void ath_hal_free(void *p)
Definition: ah_osdep.c:116
#define OS_DELAY(_n)
Definition: ah_osdep.h:69
bus_space_tag_t HAL_BUS_TAG
Definition: ah_osdep.h:50
#define OS_REG_WRITE(_ah, _reg, _val)
Definition: ah_osdep.h:139
void * HAL_SOFTC
Definition: ah_osdep.h:49
bus_space_handle_t HAL_BUS_HANDLE
Definition: ah_osdep.h:51
#define OS_MEMCPY(_d, _s, _n)
Definition: ah_osdep.h:73
#define OS_REG_READ(_ah, _reg)
Definition: ah_osdep.h:140
#define INIT_RSSI_THR
Definition: ar5210.h:84
#define AR_PHY_BASE
Definition: ar5210phy.h:29
#define AR_STA_ID0
Definition: ar5210reg.h:70
#define AR_SREV
Definition: ar5210reg.h:63
#define AR_PCICFG
Definition: ar5210reg.h:59
HAL_BOOL ar5211GetTxCompletionRates(struct ath_hal *ah, const struct ath_desc *ds0, int *rates, int *tries)
Definition: ar5211_xmit.c:674
HAL_BOOL ar5211ResetTxQueue(struct ath_hal *ah, u_int q)
Definition: ar5211_xmit.c:234
HAL_BOOL ar5211GpioSet(struct ath_hal *, uint32_t gpio, uint32_t val)
Definition: ar5211_misc.c:233
void ar5211SetRxDP(struct ath_hal *, uint32_t rxdp, HAL_RX_QUEUE)
Definition: ar5211_recv.c:46
HAL_BOOL ar5211FillTxDesc(struct ath_hal *, struct ath_desc *, HAL_DMA_ADDR *bufAddrList, uint32_t *segLenList, u_int descId, u_int qcuId, HAL_BOOL firstSeg, HAL_BOOL lastSeg, const struct ath_desc *ds0)
Definition: ar5211_xmit.c:580
void ar5211SetCoverageClass(struct ath_hal *, uint8_t, int)
Definition: ar5211_misc.c:555
u_int ar5211GetAckCTSRate(struct ath_hal *)
Definition: ar5211_misc.c:501
u_int ar5211GetNav(struct ath_hal *ah)
Definition: ar5211_misc.c:741
HAL_BOOL ar5211SetTxPowerLimit(struct ath_hal *, uint32_t limit)
void ar5211SetChainMasks(struct ath_hal *ah, uint32_t, uint32_t)
Definition: ar5211_misc.c:722
HAL_BOOL ar5211SetSifsTime(struct ath_hal *, u_int)
Definition: ar5211_misc.c:425
HAL_BOOL ar5211SetMulticastFilterIndex(struct ath_hal *, uint32_t)
Definition: ar5211_recv.c:140
HAL_BOOL ar5211SetMacAddress(struct ath_hal *ah, const uint8_t *)
Definition: ar5211_misc.c:44
HAL_BOOL ar5211GpioCfgOutput(struct ath_hal *, uint32_t gpio, HAL_GPIO_MUX_TYPE)
Definition: ar5211_misc.c:197
HAL_BOOL ar5211SetupRxDesc(struct ath_hal *, struct ath_desc *, uint32_t, u_int flags)
Definition: ar5211_recv.c:180
void ar5211IntrReqTxDesc(struct ath_hal *ah, struct ath_desc *)
Definition: ar5211_xmit.c:572
void ar5211GetBssIdMask(struct ath_hal *, uint8_t *)
Definition: ar5211_misc.c:53
HAL_BOOL ar5211EepromWrite(struct ath_hal *, u_int off, uint16_t data)
void ar5211SetStaBeaconTimers(struct ath_hal *, const HAL_BEACON_STATE *)
HAL_BOOL ar5211UpdateTxTrigLevel(struct ath_hal *, HAL_BOOL)
Definition: ar5211_xmit.c:40
HAL_RFGAIN ar5211GetRfgain(struct ath_hal *)
void ar5211GpioSetIntr(struct ath_hal *, u_int, uint32_t ilevel)
Definition: ar5211_misc.c:266
const HAL_RATE_TABLE * ar5211GetRateTable(struct ath_hal *, u_int mode)
Definition: ar5211_phy.c:85
HAL_BOOL ar5211SetRegulatoryDomain(struct ath_hal *, uint16_t, HAL_STATUS *)
Definition: ar5211_misc.c:101
void ar5211WriteAssocid(struct ath_hal *, const uint8_t *bssid, uint16_t assocId)
Definition: ar5211_misc.c:315
uint64_t ar5211GetNextTBTT(struct ath_hal *)
Definition: ar5211_beacon.c:38
HAL_BOOL ar5211ChipReset(struct ath_hal *, const struct ieee80211_channel *)
Definition: ar5211_reset.c:596
HAL_STATUS ar5211SetQuiet(struct ath_hal *, uint32_t, uint32_t, uint32_t, HAL_QUIET_FLAG)
Definition: ar5211_misc.c:560
u_int ar5211GetWirelessModes(struct ath_hal *)
Definition: ar5211_misc.c:143
uint32_t ar5211GetTxDP(struct ath_hal *, u_int)
Definition: ar5211_xmit.c:404
HAL_BOOL ar5211ReleaseTxQueue(struct ath_hal *ah, u_int q)
Definition: ar5211_xmit.c:200
int16_t ar5211GetNfAdjust(struct ath_hal *, const HAL_CHANNEL_INTERNAL *)
HAL_BOOL ar5211PerCalibrationN(struct ath_hal *ah, struct ieee80211_channel *chan, u_int chainMask, HAL_BOOL longCal, HAL_BOOL *isCalDone)
Definition: ar5211_reset.c:643
HAL_BOOL ar5211SetTxDP(struct ath_hal *, u_int, uint32_t txdp)
Definition: ar5211_xmit.c:414
u_int ar5211GetKeyCacheSize(struct ath_hal *)
u_int ar5211GetSlotTime(struct ath_hal *)
Definition: ar5211_misc.c:468
void ar5211EnableDfs(struct ath_hal *, HAL_PHYERR_PARAM *)
Definition: ar5211_misc.c:728
void ar5211GetTxDescLink(struct ath_hal *ah, void *ds, uint32_t *link)
Definition: ar5211_xmit.c:688
void ar5211EnableReceive(struct ath_hal *)
Definition: ar5211_recv.c:58
uint64_t ar5211GetTsf64(struct ath_hal *)
Definition: ar5211_misc.c:330
HAL_BOOL ar5211GetPendingInterrupts(struct ath_hal *, HAL_INT *)
void ar5211SetBeaconTimers(struct ath_hal *, const HAL_BEACON_TIMERS *)
Definition: ar5211_beacon.c:49
HAL_INT ar5211GetInterrupts(struct ath_hal *)
HAL_ANT_SETTING ar5211GetAntennaSwitch(struct ath_hal *)
Definition: ar5211_misc.c:613
uint32_t ar5211NumTxPending(struct ath_hal *, u_int qnum)
Definition: ar5211_xmit.c:455
#define AR5211_MAGIC
Definition: ar5211.h:26
HAL_BOOL ar5211SetCapability(struct ath_hal *, HAL_CAPABILITY_TYPE, uint32_t, uint32_t, HAL_STATUS *)
Definition: ar5211_misc.c:651
HAL_STATUS ar5211ProcTxDesc(struct ath_hal *, struct ath_desc *, struct ath_tx_status *)
Definition: ar5211_xmit.c:621
HAL_BOOL ar5211SetupXTxDesc(struct ath_hal *, struct ath_desc *, u_int txRate1, u_int txRetries1, u_int txRate2, u_int txRetries2, u_int txRate3, u_int txRetries3)
Definition: ar5211_xmit.c:559
void ar5211SetMulticastFilter(struct ath_hal *, uint32_t filter0, uint32_t filter1)
Definition: ar5211_recv.c:110
HAL_BOOL ar5211SetAckTimeout(struct ath_hal *, u_int)
Definition: ar5211_misc.c:475
void ar5211AniPoll(struct ath_hal *, const struct ieee80211_channel *)
Definition: ar5211_misc.c:576
HAL_BOOL ar5211Disable(struct ath_hal *)
Definition: ar5211_reset.c:572
void ar5211GetTxIntrQueue(struct ath_hal *ah, uint32_t *)
Definition: ar5211_xmit.c:665
HAL_BOOL ar5211StartTxDma(struct ath_hal *, u_int)
Definition: ar5211_xmit.c:434
HAL_STATUS ar5211GetCapability(struct ath_hal *, HAL_CAPABILITY_TYPE, uint32_t, uint32_t *)
Definition: ar5211_misc.c:631
HAL_BOOL ar5211StopDmaReceive(struct ath_hal *)
Definition: ar5211_recv.c:67
HAL_BOOL ar5211IsInterruptPending(struct ath_hal *)
uint32_t ar5211GetRxFilter(struct ath_hal *)
Definition: ar5211_recv.c:160
uint32_t ar5211GetTsf32(struct ath_hal *)
Definition: ar5211_misc.c:358
void ar5211GetDfsThresh(struct ath_hal *, HAL_PHYERR_PARAM *)
Definition: ar5211_misc.c:733
HAL_POWER_MODE ar5211GetPowerMode(struct ath_hal *)
Definition: ar5211_power.c:138
HAL_BOOL ar5211SetCTSTimeout(struct ath_hal *, u_int)
Definition: ar5211_misc.c:522
void ar5211BeaconInit(struct ath_hal *, uint32_t, uint32_t)
Definition: ar5211_beacon.c:66
HAL_BOOL ar5211SetBssIdMask(struct ath_hal *, const uint8_t *)
Definition: ar5211_misc.c:61
void ar5211GetTxDescLinkPtr(struct ath_hal *ah, void *ds, uint32_t **linkptr)
Definition: ar5211_xmit.c:696
uint32_t ar5211Get11nExtBusy(struct ath_hal *)
Definition: ar5211_misc.c:706
HAL_BOOL ar5211PhyDisable(struct ath_hal *)
Definition: ar5211_reset.c:563
void ar5211InitializeGainValues(struct ath_hal *)
void ar5211ResetStaBeaconTimers(struct ath_hal *)
void ar5211UpdateMibCounters(struct ath_hal *, HAL_MIB_STATS *)
Definition: ar5211_misc.c:415
u_int ar5211GetAckTimeout(struct ath_hal *)
Definition: ar5211_misc.c:494
int ar5211SetupTxQueue(struct ath_hal *ah, HAL_TX_QUEUE type, const HAL_TXQ_INFO *qInfo)
Definition: ar5211_xmit.c:114
void ar5211SetLedState(struct ath_hal *, HAL_LED_STATE)
Definition: ar5211_misc.c:289
HAL_BOOL ar5211StopTxDma(struct ath_hal *, u_int)
Definition: ar5211_xmit.c:477
void ar5211StopPcuReceive(struct ath_hal *)
Definition: ar5211_recv.c:99
HAL_BOOL ar5211SetAntennaSwitch(struct ath_hal *, HAL_ANT_SETTING)
Definition: ar5211_misc.c:619
u_int ar5211GetSifsTime(struct ath_hal *)
Definition: ar5211_misc.c:443
HAL_BOOL ar5211GetMibCycleCounts(struct ath_hal *, HAL_SURVEY_SAMPLE *)
Definition: ar5211_misc.c:715
HAL_BOOL ar5211ResetKeyCacheEntry(struct ath_hal *, uint16_t entry)
HAL_STATUS ar5211ProcRxDesc(struct ath_hal *, struct ath_desc *, uint32_t, struct ath_desc *, uint64_t, struct ath_rx_status *)
Definition: ar5211_recv.c:208
HAL_BOOL ar5211ResetCalValid(struct ath_hal *ah, const struct ieee80211_channel *)
Definition: ar5211_reset.c:743
HAL_BOOL ar5211SetupTxDesc(struct ath_hal *, struct ath_desc *, u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, u_int txPower, u_int txRate0, u_int txTries0, u_int keyIx, u_int antMode, u_int flags, u_int rtsctsRate, u_int rtsctsDuration, u_int compicvLen, u_int compivLen, u_int comp)
Definition: ar5211_xmit.c:511
u_int ar5211GetCTSTimeout(struct ath_hal *)
Definition: ar5211_misc.c:541
HAL_BOOL ar5211SetSlotTime(struct ath_hal *, u_int)
Definition: ar5211_misc.c:450
uint32_t ar5211GpioGet(struct ath_hal *, uint32_t gpio)
Definition: ar5211_misc.c:251
void ar5211GetMacAddress(struct ath_hal *, uint8_t *)
Definition: ar5211_misc.c:36
void ar5211SetRxFilter(struct ath_hal *, uint32_t)
Definition: ar5211_recv.c:169
HAL_BOOL ar5211SetTxQueueProps(struct ath_hal *ah, int q, const HAL_TXQ_INFO *qInfo)
Definition: ar5211_xmit.c:82
u_int ar5211GetDefAntenna(struct ath_hal *)
Definition: ar5211_misc.c:601
HAL_BOOL ar5211SetPowerMode(struct ath_hal *, uint32_t powerRequest, int setChip)
HAL_BOOL ar5211GetDiagState(struct ath_hal *ah, int request, const void *args, uint32_t argsize, void **result, uint32_t *resultsize)
Definition: ar5211_misc.c:675
HAL_BOOL ar5211GetTxQueueProps(struct ath_hal *ah, int q, HAL_TXQ_INFO *qInfo)
Definition: ar5211_xmit.c:98
HAL_BOOL ar5211SetKeyCacheEntryMac(struct ath_hal *, uint16_t, const uint8_t *)
HAL_BOOL ar5211Reset(struct ath_hal *, HAL_OPMODE, struct ieee80211_channel *, HAL_BOOL bChannelChange, HAL_RESET_TYPE, HAL_STATUS *)
Definition: ar5211_reset.c:157
HAL_BOOL ar5211GpioCfgInput(struct ath_hal *, uint32_t gpio)
Definition: ar5211_misc.c:215
void ar5211SetNav(struct ath_hal *ah, u_int)
Definition: ar5211_misc.c:753
void ar5211SetTxDescLink(struct ath_hal *ah, void *ds, uint32_t link)
Definition: ar5211_xmit.c:680
uint32_t ar5211GetRxDP(struct ath_hal *, HAL_RX_QUEUE)
Definition: ar5211_recv.c:35
HAL_BOOL ar5211IsKeyCacheEntryValid(struct ath_hal *, uint16_t)
void ar5211StartPcuReceive(struct ath_hal *, HAL_BOOL)
Definition: ar5211_recv.c:89
void ar5211ResetTsf(struct ath_hal *)
Definition: ar5211_misc.c:367
void ar5211MibEvent(struct ath_hal *, const HAL_NODE_STATS *)
Definition: ar5211_misc.c:587
HAL_BOOL ar5211EepromRead(struct ath_hal *, u_int off, uint16_t *data)
Definition: ar5211_misc.c:70
void ar5211RxMonitor(struct ath_hal *, const HAL_NODE_STATS *, const struct ieee80211_channel *)
Definition: ar5211_misc.c:581
HAL_BOOL ar5211DetectCardPresent(struct ath_hal *)
Definition: ar5211_misc.c:394
void ar5211SetPCUConfig(struct ath_hal *)
HAL_BOOL ar5211SetDecompMask(struct ath_hal *, uint16_t, int)
Definition: ar5211_misc.c:548
HAL_BOOL ar5211ClrMulticastFilterIndex(struct ath_hal *, uint32_t)
Definition: ar5211_recv.c:120
void ar5211SetDefAntenna(struct ath_hal *ah, u_int antenna)
Definition: ar5211_misc.c:607
HAL_BOOL ar5211SetAckCTSRate(struct ath_hal *, u_int)
Definition: ar5211_misc.c:507
HAL_INT ar5211SetInterrupts(struct ath_hal *, HAL_INT ints)
HAL_BOOL ar5211SetKeyCacheEntry(struct ath_hal *, uint16_t entry, const HAL_KEYVAL *, const uint8_t *mac, int xorKey)
HAL_BOOL ar5211PerCalibration(struct ath_hal *, struct ieee80211_channel *, HAL_BOOL *)
Definition: ar5211_reset.c:736
static void ar5211DisablePCIE(struct ath_hal *ah)
static uint32_t ar5211GetRadioRev(struct ath_hal *ah)
static void ar5211ConfigPCIE(struct ath_hal *ah, HAL_BOOL restore, HAL_BOOL power_off)
AH_CHIP(AR5211, ar5211Probe, ar5211Attach)
static const struct ath_hal_private ar5211hal
Definition: ar5211_attach.c:42
static const char * ar5211Probe(uint16_t vendorid, uint16_t devid)
static HAL_BOOL ar5211GetChannelEdges(struct ath_hal *ah, uint16_t flags, uint16_t *low, uint16_t *high)
void ar5211Detach(struct ath_hal *ah)
static HAL_BOOL ar5211GetChipPowerLimits(struct ath_hal *ah, struct ieee80211_channel *chan)
static HAL_BOOL ar5211FillCapabilityInfo(struct ath_hal *ah)
static struct ath_hal * ar5211Attach(uint16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st, HAL_BUS_HANDLE sh, uint16_t *eepromdata, HAL_OPS_CONFIG *ah_config, HAL_STATUS *status)
static HAL_BOOL ar5211ChipTest(struct ath_hal *)
#define AR_PHY_PLL_CTL
Definition: ar5211phy.h:46
#define AR5211_PHY_MODE_OFDM
Definition: ar5211phy.h:90
#define AR_PHY_CHIP_ID
Definition: ar5211phy.h:36
#define AR5211_PHY_MODE
Definition: ar5211phy.h:89
#define AR_PHY_PLL_CTL_44
Definition: ar5211phy.h:47
#define AR_SREV_REVISION_M
Definition: ar5211reg.h:712
#define AR_PCICFG_EEPROM_SIZE_M
Definition: ar5211reg.h:644
#define AR_PCICFG_EEPROM_SIZE_16K
Definition: ar5211reg.h:710
#define AR_SREV_ID_S
Definition: ar5211reg.h:711
#define AR_PCICFG_EEPROM_SIZE_S
Definition: ar5211reg.h:645
#define AR_SREV_ID_M
Definition: ar5211reg.h:709
#define RAD2_SREV_MAJOR
Definition: ar5211reg.h:731
#define AR_SREV_VERSION_OAHU
Definition: ar5211reg.h:725
#define RAD5_SREV_MAJOR
Definition: ar5211reg.h:729
#define AR_SREV_VERSION_MAUI_2
Definition: ar5211reg.h:723
uint32_t halChanSpreadSupport
Definition: ah_internal.h:223
uint32_t halRfSilentSupport
Definition: ah_internal.h:247
uint16_t halLow5GhzChan
Definition: ah_internal.h:298
uint32_t halUseCombinedRadarRssi
Definition: ah_internal.h:262
uint32_t halIntrMask
Definition: ah_internal.h:308
uint16_t halHigh5GhzChan
Definition: ah_internal.h:298
uint16_t halLow2GhzChan
Definition: ah_internal.h:299
uint16_t halKeyCacheSize
Definition: ah_internal.h:297
uint32_t halVEOLSupport
Definition: ah_internal.h:239
uint16_t halTotalQueues
Definition: ah_internal.h:296
uint16_t halHigh2GhzChan
Definition: ah_internal.h:299
uint32_t halWirelessModes
Definition: ah_internal.h:295
uint32_t halChanHalfRate
Definition: ah_internal.h:243
uint32_t halHasRxSelfLinkedTail
Definition: ah_internal.h:269
uint32_t halChanQuarterRate
Definition: ah_internal.h:244
uint32_t halPSPollBroken
Definition: ah_internal.h:238
uint32_t hal4kbSplitTransSupport
Definition: ah_internal.h:268
uint32_t halSleepAfterBeaconBroken
Definition: ah_internal.h:224
uint32_t ah_rssiThr
Definition: ar5211.h:131
u_int ah_slottime
Definition: ar5211.h:134
u_int ah_sifstime
Definition: ar5211.h:133
u_int ah_acktimeout
Definition: ar5211.h:135
u_int ah_ctstimeout
Definition: ar5211.h:136
uint8_t ah_macaddr[IEEE80211_ADDR_LEN]
Definition: ar5211.h:111
HAL_ANT_SETTING ah_diversityControl
Definition: ar5211.h:124
struct ath_hal_private ah_priv
Definition: ar5211.h:107
uint32_t ah_staId1Defaults
Definition: ar5211.h:129
HAL_CAPABILITIES ah_caps
Definition: ah_internal.h:402
struct ath_hal h
Definition: ah_internal.h:358
HAL_BOOL ah_rfkillEnabled
Definition: ah_internal.h:426
uint16_t ah_rfsilent
Definition: ah_internal.h:425
Definition: ah.h:1219
uint32_t ah_macVersion
Definition: ah.h:1228
HAL_BUS_TAG ah_st
Definition: ah.h:1224
uint16_t ah_devid
Definition: ah.h:1221
uint32_t ah_magic
Definition: ah.h:1220
HAL_BUS_HANDLE ah_sh
Definition: ah.h:1225
HAL_OPS_CONFIG ah_config
Definition: ah.h:1243
uint16_t ah_analog2GhzRev
Definition: ah.h:1233
HAL_SOFTC ah_sc
Definition: ah.h:1223
uint16_t ah_analog5GhzRev
Definition: ah.h:1232