ar9300_freebsd.c revision 252233
1/*
2 * Copyright (c) 2012, 2013 Adrian Chadd <adrian@FreeBSD.org>.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include "opt_ah.h"
18
19#include "ah.h"
20#include "ah_internal.h"
21#include "ah_devid.h"
22#include "ah_desc.h"
23
24#include "ar9300.h"
25#include "ar9300reg.h"
26#include "ar9300phy.h"
27#include "ar9300desc.h"
28
29#include "ar9300_freebsd.h"
30
31#include "ar9300_stub.h"
32#include "ar9300_stub_funcs.h"
33
34#define FIX_NOISE_FLOOR     1
35#define NEXT_TBTT_NOW      5
36static HAL_BOOL ar9300ClrMulticastFilterIndex(struct ath_hal *ah, uint32_t ix);
37static HAL_BOOL ar9300SetMulticastFilterIndex(struct ath_hal *ah, uint32_t ix);
38
39static void
40ar9300SetChainMasks(struct ath_hal *ah, uint32_t tx_chainmask,
41    uint32_t rx_chainmask)
42{
43
44	AH9300(ah)->ah_tx_chainmask =
45	    tx_chainmask & AH_PRIVATE(ah)->ah_caps.halTxChainMask;
46	AH9300(ah)->ah_rx_chainmask =
47	    rx_chainmask & AH_PRIVATE(ah)->ah_caps.halRxChainMask;
48}
49
50static u_int
51ar9300GetSlotTime(struct ath_hal *ah)
52{
53	u_int clks = OS_REG_READ(ah, AR_D_GBL_IFS_SLOT) & 0xffff;
54	return (ath_hal_mac_usec(ah, clks));	/* convert from system clocks */
55}
56
57static HAL_BOOL
58ar9300_freebsd_set_tx_power_limit(struct ath_hal *ah, uint32_t limit)
59{
60	return (ar9300_set_tx_power_limit(ah, limit, 0, 0));
61}
62
63
64void
65ar9300_attach_freebsd_ops(struct ath_hal *ah)
66{
67
68	/* stub everything first */
69	ar9300_set_stub_functions(ah);
70
71	/* Global functions */
72	ah->ah_detach		= ar9300_detach;
73	ah->ah_getRateTable		= ar9300_get_rate_table;
74
75	/* Reset functions */
76	ah->ah_reset		= ar9300_reset_freebsd;
77	ah->ah_phyDisable		= ar9300_phy_disable;
78	ah->ah_disable		= ar9300_disable;
79	ah->ah_configPCIE		= ar9300_config_pcie_freebsd;
80//	ah->ah_disablePCIE		= ar9300_disable_pcie_phy;
81	ah->ah_setPCUConfig		= ar9300_set_pcu_config;
82	// perCalibration
83	ah->ah_perCalibrationN	= ar9300_per_calibration_freebsd;
84	ah->ah_resetCalValid	= ar9300_reset_cal_valid_freebsd;
85	ah->ah_setTxPowerLimit	= ar9300_freebsd_set_tx_power_limit;
86	ah->ah_getChanNoise		= ath_hal_getChanNoise;
87
88	/* Transmit functions */
89	ah->ah_setupTxQueue		= ar9300_setup_tx_queue;
90	ah->ah_setTxQueueProps	= ar9300_set_tx_queue_props;
91	ah->ah_getTxQueueProps	= ar9300_get_tx_queue_props;
92	ah->ah_releaseTxQueue	= ar9300_release_tx_queue;
93	ah->ah_resetTxQueue		= ar9300_reset_tx_queue;
94	ah->ah_getTxDP		= ar9300_get_tx_dp;
95	ah->ah_setTxDP		= ar9300_set_tx_dp;
96	ah->ah_numTxPending		= ar9300_num_tx_pending;
97	ah->ah_startTxDma		= ar9300_start_tx_dma;
98	ah->ah_stopTxDma		= ar9300_stop_tx_dma_freebsd;
99	ah->ah_setupTxDesc		= ar9300_freebsd_setup_tx_desc;
100	ah->ah_setupXTxDesc		= ar9300_freebsd_setup_x_tx_desc;
101	ah->ah_fillTxDesc		= ar9300_freebsd_fill_tx_desc;
102	ah->ah_procTxDesc		= ar9300_freebsd_proc_tx_desc;
103	ah->ah_getTxIntrQueue	= ar9300_get_tx_intr_queue;
104	// reqTxIntrDesc
105	ah->ah_getTxCompletionRates	= ar9300_freebsd_get_tx_completion_rates;
106	ah->ah_setTxDescLink	= ar9300_set_desc_link;
107	ah->ah_getTxDescLink	= ar9300_freebsd_get_desc_link;
108	ah->ah_getTxDescLinkPtr	= ar9300_get_desc_link_ptr;
109	ah->ah_setupTxStatusRing	= ar9300_setup_tx_status_ring;
110	ah->ah_getTxRawTxDesc	 = ar9300_get_raw_tx_desc;
111	ah->ah_updateTxTrigLevel	= ar9300_update_tx_trig_level;
112
113	/* RX functions */
114	ah->ah_getRxDP		= ar9300_get_rx_dp;
115	ah->ah_setRxDP		= ar9300_set_rx_dp;
116	ah->ah_enableReceive	= ar9300_enable_receive;
117	ah->ah_stopDmaReceive	= ar9300_stop_dma_receive_freebsd;
118	ah->ah_startPcuReceive	= ar9300_start_pcu_receive_freebsd;
119	ah->ah_stopPcuReceive	= ar9300_stop_pcu_receive;
120	ah->ah_setMulticastFilter	= ar9300_set_multicast_filter;
121	ah->ah_setMulticastFilterIndex = ar9300SetMulticastFilterIndex;
122	ah->ah_clrMulticastFilterIndex = ar9300ClrMulticastFilterIndex;
123	ah->ah_getRxFilter		= ar9300_get_rx_filter;
124	ah->ah_setRxFilter		= ar9300_set_rx_filter;
125	/* setupRxDesc */
126	ah->ah_procRxDesc		= ar9300_proc_rx_desc_freebsd;
127	ah->ah_rxMonitor		= ar9300_ani_rxmonitor_freebsd;
128	ah->ah_aniPoll		= ar9300_ani_poll_freebsd;
129	ah->ah_procMibEvent		= ar9300_process_mib_intr;
130
131	/* Misc functions */
132	ah->ah_getCapability	= ar9300_get_capability;
133	ah->ah_setCapability	= ar9300_set_capability;
134	ah->ah_getDiagState		= ar9300_get_diag_state;
135	ah->ah_getMacAddress	= ar9300_get_mac_address;
136	ah->ah_setMacAddress	= ar9300_set_mac_address;
137	ah->ah_getBssIdMask		= ar9300_get_bss_id_mask;
138	ah->ah_setBssIdMask		= ar9300_set_bss_id_mask;
139	ah->ah_setRegulatoryDomain	= ar9300_set_regulatory_domain;
140	ah->ah_setLedState		= ar9300_set_led_state;
141	ah->ah_writeAssocid		= ar9300_write_associd;
142	ah->ah_gpioCfgInput		= ar9300_gpio_cfg_input;
143	ah->ah_gpioCfgOutput	= ar9300_gpio_cfg_output;
144	ah->ah_gpioGet		= ar9300_gpio_get;
145	ah->ah_gpioSet		= ar9300_gpio_set;
146	ah->ah_gpioSetIntr		= ar9300_gpio_set_intr;
147	/* polarity */
148	/* mask */
149	ah->ah_getTsf32		= ar9300_get_tsf32;
150	ah->ah_getTsf64		= ar9300_get_tsf64;
151	ah->ah_resetTsf		= ar9300_reset_tsf;
152	ah->ah_detectCardPresent	= ar9300_detect_card_present;
153	// ah->ah_updateMibCounters	= ar9300_update_mib_counters;
154	ah->ah_getRfGain		= ar9300_get_rfgain;
155	ah->ah_getDefAntenna	= ar9300_get_def_antenna;
156	ah->ah_setDefAntenna	= ar9300_set_def_antenna;
157	// ah->ah_getAntennaSwitch	= ar9300_get_antenna_switch;
158	// ah->ah_setAntennaSwitch	= ar9300_set_antenna_switch;
159	// ah->ah_setSifsTime		= ar9300_set_sifs_time;
160	// ah->ah_getSifsTime		= ar9300_get_sifs_time;
161	ah->ah_setSlotTime		= ar9300_set_slot_time;
162	ah->ah_getSlotTime		= ar9300GetSlotTime;
163	ah->ah_getAckTimeout	= ar9300_get_ack_timeout;
164	ah->ah_setAckTimeout	= ar9300_set_ack_timeout;
165	// XXX ack/ctsrate
166	// XXX CTS timeout
167	// XXX decompmask
168	// coverageclass
169	ah->ah_setQuiet		= ar9300_set_quiet;
170	ah->ah_getMibCycleCounts	= ar9300_freebsd_get_mib_cycle_counts;
171
172	/* DFS functions */
173	ah->ah_enableDfs		= ar9300_enable_dfs;
174	ah->ah_getDfsThresh		= ar9300_get_dfs_thresh;
175	ah->ah_getDfsDefaultThresh	= ar9300_freebsd_get_dfs_default_thresh;
176	// procradarevent
177	ah->ah_isFastClockEnabled	= ar9300_is_fast_clock_enabled;
178	ah->ah_get11nExtBusy	= ar9300_get_11n_ext_busy;
179
180	/* Key cache functions */
181	ah->ah_getKeyCacheSize	= ar9300_get_key_cache_size;
182	ah->ah_resetKeyCacheEntry	= ar9300_reset_key_cache_entry;
183	ah->ah_isKeyCacheEntryValid	= ar9300_is_key_cache_entry_valid;
184	ah->ah_setKeyCacheEntry	= ar9300_set_key_cache_entry;
185	ah->ah_setKeyCacheEntryMac	= ar9300_set_key_cache_entry_mac;
186
187	/* Power management functions */
188	ah->ah_setPowerMode		= ar9300_set_power_mode;
189	ah->ah_getPowerMode		= ar9300_get_power_mode;
190
191	/* Beacon functions */
192	/* ah_setBeaconTimers */
193	ah->ah_beaconInit		= ar9300_freebsd_beacon_init;
194	/* ah_setBeaconTimers */
195	ah->ah_setStationBeaconTimers = ar9300_set_sta_beacon_timers;
196	/* ah_resetStationBeaconTimers */
197	/* ah_getNextTBTT */
198
199	/* Interrupt functions */
200	ah->ah_isInterruptPending	= ar9300_is_interrupt_pending;
201	ah->ah_getPendingInterrupts	= ar9300_get_pending_interrupts_freebsd;
202	ah->ah_getInterrupts =	ar9300_get_interrupts;
203	ah->ah_setInterrupts =	ar9300_set_interrupts_freebsd;
204
205	/* Regulatory/internal functions */
206	//    AH_PRIVATE(ah)->ah_getNfAdjust = ar9300_get_nf_adjust;
207	AH_PRIVATE(ah)->ah_eepromRead = ar9300_eeprom_read_word;
208	//    AH_PRIVATE(ah)->ah_getChipPowerLimits = ar9300_get_chip_power_limits;
209	AH_PRIVATE(ah)->ah_getWirelessModes = ar9300_get_wireless_modes;
210	AH_PRIVATE(ah)->ah_getChannelEdges = ar9300_get_channel_edges;
211
212	AH_PRIVATE(ah)->ah_eepromRead = ar9300_eeprom_read_word;
213	/* XXX ah_eeprom */
214	/* XXX ah_eeversion */
215	/* XXX ah_eepromDetach */
216	/* XXX ah_eepromGet */
217	AH_PRIVATE(ah)->ah_eepromGet = ar9300_eeprom_get_freebsd;
218	/* XXX ah_eepromSet */
219	/* XXX ah_getSpurChan */
220	/* XXX ah_eepromDiag */
221
222	/* 802.11n functions */
223	ah->ah_chainTxDesc = ar9300_freebsd_chain_tx_desc;
224	ah->ah_setupFirstTxDesc= ar9300_freebsd_setup_first_tx_desc;
225	ah->ah_setupLastTxDesc = ar9300_freebsd_setup_last_tx_desc;
226	ah->ah_set11nRateScenario = ar9300_freebsd_set_11n_rate_scenario;
227	ah->ah_set11nTxDesc = ar9300_freebsd_setup_11n_desc;
228	ah->ah_set11nAggrFirst = ar9300_set_11n_aggr_first;
229	ah->ah_set11nAggrMiddle = ar9300_set_11n_aggr_middle;
230	ah->ah_set11nAggrLast = ar9300_set_11n_aggr_last;
231	ah->ah_clr11nAggr = ar9300_clr_11n_aggr;
232	ah->ah_set11nBurstDuration = ar9300_set_11n_burst_duration;
233	/* ah_get11nExtBusy */
234	ah->ah_set11nMac2040 = ar9300_set_11n_mac2040;
235	ah->ah_setChainMasks = ar9300SetChainMasks;
236	/* ah_get11nRxClear */
237	/* ah_set11nRxClear */
238
239	/* bluetooth coexistence functions */
240	ah->ah_btCoexSetInfo		= ar9300_set_bt_coex_info;
241	ah->ah_btCoexSetConfig		= ar9300_bt_coex_config;
242	ah->ah_btCoexSetQcuThresh	= ar9300_bt_coex_set_qcu_thresh;
243	ah->ah_btCoexSetWeights		= ar9300_bt_coex_set_weights;
244	ah->ah_btCoexSetBmissThresh	= ar9300_bt_coex_setup_bmiss_thresh;
245	ah->ah_btCoexSetParameter	= ar9300_bt_coex_set_parameter;
246	ah->ah_btCoexDisable		= ar9300_bt_coex_disable;
247	ah->ah_btCoexEnable		= ar9300_bt_coex_enable;
248
249	/* LNA diversity functions */
250	ah->ah_divLnaConfGet = ar9300_ant_div_comb_get_config;
251	ah->ah_divLnaConfSet = ar9300_ant_div_comb_set_config;
252
253	/* Setup HAL configuration defaults */
254	ah->ah_config.ath_hal_ant_ctrl_comm2g_switch_enable = 0x000bbb88;
255}
256
257HAL_BOOL
258ar9300_reset_freebsd(struct ath_hal *ah, HAL_OPMODE opmode,
259    struct ieee80211_channel *chan, HAL_BOOL bChannelChange,
260    HAL_STATUS *status)
261{
262	HAL_BOOL r;
263	HAL_HT_MACMODE macmode;
264	struct ath_hal_private  *ap  = AH_PRIVATE(ah);
265
266	macmode =
267	    IEEE80211_IS_CHAN_HT40(chan) ?
268	        HAL_HT_MACMODE_2040 : HAL_HT_MACMODE_20;
269
270	r = ar9300_reset(ah, opmode, chan, macmode,
271	    ap->ah_caps.halTxChainMask,
272	    ap->ah_caps.halRxChainMask,
273	    HAL_HT_EXTPROTSPACING_20, /* always 20Mhz channel spacing */
274	    bChannelChange,
275	    status,
276	    AH_FALSE);       /* XXX should really extend ath_hal_reset() */
277
278	return (r);
279}
280
281void
282ar9300_config_pcie_freebsd(struct ath_hal *ah, HAL_BOOL restore,
283    HAL_BOOL powerOff)
284{
285
286	ar9300_config_pci_power_save(ah, restore ? 1 : 0, powerOff ? 1 : 0);
287}
288
289/*
290 * This is a copy from ar9300_eeprom_get(), purely because the FreeBSD
291 * API is very silly and inconsistent.
292 *
293 * The AR93xx HAL doesn't call the eepromGetFlag() function, so this
294 * only occurs for FreeBSD code.
295 *
296 * When I fix this particular API, I'll undo this.
297 */
298HAL_STATUS
299ar9300_eeprom_get_freebsd(struct ath_hal *ah, int param, void *val)
300{
301
302	switch (param) {
303	case AR_EEP_FSTCLK_5G:
304		return HAL_OK;
305	default:
306		ath_hal_printf(ah, "%s: called, param=%d\n",
307		    __func__, param);
308		return HAL_EIO;
309	}
310}
311
312HAL_BOOL
313ar9300_stop_tx_dma_freebsd(struct ath_hal *ah, u_int q)
314{
315
316	return ar9300_stop_tx_dma(ah, q, 1000);
317}
318
319void
320ar9300_ani_poll_freebsd(struct ath_hal *ah,
321    const struct ieee80211_channel *chan)
322{
323
324	HAL_NODE_STATS stats;
325	HAL_ANISTATS anistats;
326
327	OS_MEMZERO(&stats, sizeof(stats));
328	OS_MEMZERO(&anistats, sizeof(anistats));
329
330	ar9300_ani_ar_poll(ah, &stats, chan, &anistats);
331}
332
333/*
334 * Setup the configuration parameters in the style the AR9300 HAL
335 * wants.
336 */
337void
338ar9300_config_defaults_freebsd(struct ath_hal *ah)
339{
340
341	ah->ah_config.ath_hal_enable_ani = AH_TRUE;
342}
343
344HAL_BOOL
345ar9300_stop_dma_receive_freebsd(struct ath_hal *ah)
346{
347
348	return ar9300_stop_dma_receive(ah, 1000);
349}
350
351HAL_BOOL
352ar9300_get_pending_interrupts_freebsd(struct ath_hal *ah, HAL_INT *masked)
353{
354
355	/* Non-MSI, so no MSI vector; and 'nortc' = 0 */
356	return ar9300_get_pending_interrupts(ah, masked, HAL_INT_LINE, 0, 0);
357}
358
359HAL_INT
360ar9300_set_interrupts_freebsd(struct ath_hal *ah, HAL_INT ints)
361{
362
363	/* nortc = 0 */
364	return ar9300_set_interrupts(ah, ints, 0);
365}
366
367HAL_BOOL
368ar9300_per_calibration_freebsd(struct ath_hal *ah,
369    struct ieee80211_channel *chan, u_int rxchainmask, HAL_BOOL long_cal,
370    HAL_BOOL *isCalDone)
371{
372	/* XXX fake scheduled calibrations for now */
373	u_int32_t sched_cals = 0xfffffff;
374
375	return ar9300_calibration(ah, chan,
376	    AH_PRIVATE(ah)->ah_caps.halRxChainMask,
377	    long_cal,
378	    isCalDone,
379	    0,			/* is_scan */
380	    &sched_cals);
381}
382
383HAL_BOOL
384ar9300_reset_cal_valid_freebsd(struct ath_hal *ah,
385    const struct ieee80211_channel *chan)
386{
387
388	HAL_BOOL is_cal_done = AH_TRUE;
389
390	ar9300_reset_cal_valid(ah, chan, &is_cal_done, 0xffffffff);
391	return (is_cal_done);
392}
393
394
395void
396ar9300_start_pcu_receive_freebsd(struct ath_hal *ah)
397{
398
399	/* is_scanning flag == NULL */
400	ar9300_start_pcu_receive(ah, AH_FALSE);
401}
402
403/*
404 * FreeBSD will just pass in the descriptor value as 'pa'.
405 * The Atheros HAL treats 'pa' as the physical address of the RX
406 * descriptor and 'bufaddr' as the physical address of the RX buffer.
407 * I'm not sure why they didn't collapse them - the AR9300 RX descriptor
408 * routine doesn't check 'pa'.
409 */
410HAL_STATUS
411ar9300_proc_rx_desc_freebsd(struct ath_hal *ah, struct ath_desc *ds,
412    uint32_t pa, struct ath_desc *ds_next, uint64_t tsf,
413    struct ath_rx_status *rxs)
414{
415
416	return (ar9300_proc_rx_desc_fast(ah, ds, 0, ds_next, rxs,
417	    (void *) ds));
418}
419
420void
421ar9300_ani_rxmonitor_freebsd(struct ath_hal *ah, const HAL_NODE_STATS *stats,
422    const struct ieee80211_channel *chan)
423{
424
425}
426
427void
428ar9300_freebsd_get_desc_link(struct ath_hal *ah, void *ds, uint32_t *link)
429{
430	struct ar9300_txc *ads = AR9300TXC(ds);
431
432	(*link) = ads->ds_link;
433}
434
435/*
436 * TX descriptor field setting wrappers - eek.
437 */
438
439
440HAL_BOOL
441ar9300_freebsd_setup_tx_desc(struct ath_hal *ah, struct ath_desc *ds,
442    u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, u_int txPower,
443    u_int txRate0, u_int txTries0, u_int keyIx, u_int antMode, u_int flags,
444    u_int rtsctsRate, u_int rtsCtsDuration, u_int compicvLen,
445    u_int compivLen, u_int comp)
446{
447	struct ath_hal_9300 *ahp = AH9300(ah);
448
449	HAL_KEY_TYPE keyType = 0;	/* XXX No padding */
450
451	if (keyIx != HAL_TXKEYIX_INVALID)
452		keyType = ahp->ah_keytype[keyIx];
453
454	/* XXX bounds check keyix */
455	ar9300_set_11n_tx_desc(ah, ds, pktLen, type, txPower, keyIx,
456	    keyType, flags);
457
458	return AH_TRUE;
459}
460
461HAL_BOOL
462ar9300_freebsd_setup_x_tx_desc(struct ath_hal *ah, struct ath_desc *ds,
463    u_int txRate1, u_int txTries1,
464    u_int txRate2, u_int txTries2,
465    u_int txRate3, u_int txTries3)
466{
467
468	ath_hal_printf(ah, "%s: called, 0x%x/%d, 0x%x/%d, 0x%x/%d\n",
469	    __func__,
470	    txRate1, txTries1,
471	    txRate2, txTries2,
472	    txRate3, txTries3);
473
474	/* XXX should only be called during probe */
475	return (AH_TRUE);
476}
477
478HAL_BOOL
479ar9300_freebsd_fill_tx_desc(struct ath_hal *ah, struct ath_desc *ds,
480    HAL_DMA_ADDR *bufListPtr, uint32_t *segLenPtr, u_int descId, u_int qid,
481    HAL_BOOL firstSeg, HAL_BOOL lastSeg,
482    const struct ath_desc *ds0)
483{
484	HAL_KEY_TYPE keyType = 0;
485	const struct ar9300_txc *ads = AR9300TXC_CONST(ds0);
486
487	/*
488	 * FreeBSD's HAL doesn't pass the keytype to fill_tx_desc();
489	 * it's copied as part of the descriptor chaining.
490	 *
491	 * So, extract it from ds0.
492	 */
493	keyType = MS(ads->ds_ctl17, AR_encr_type);
494
495	return ar9300_fill_tx_desc(ah, ds, bufListPtr, segLenPtr, descId,
496	    qid, keyType, firstSeg, lastSeg, ds0);
497}
498
499HAL_BOOL
500ar9300_freebsd_get_tx_completion_rates(struct ath_hal *ah,
501    const struct ath_desc *ds0, int *rates, int *tries)
502{
503
504	ath_hal_printf(ah, "%s: called\n", __func__);
505	return AH_FALSE;	/* XXX for now */
506}
507
508
509/*
510 * 802.11n TX descriptor wrappers
511 */
512void
513ar9300_freebsd_set_11n_rate_scenario(struct ath_hal *ah, struct ath_desc *ds,
514    u_int durUpdateEn, u_int rtsctsRate, HAL_11N_RATE_SERIES series[],
515    u_int nseries, u_int flags)
516{
517
518	/* lastds=NULL, rtscts_duration is 0, smart antenna is 0 */
519	ar9300_set_11n_rate_scenario(ah, (void *) ds, (void *)ds, durUpdateEn,
520	    rtsctsRate, 0, series, nseries, flags, 0);
521}
522
523/* chaintxdesc */
524HAL_BOOL
525ar9300_freebsd_chain_tx_desc(struct ath_hal *ah, struct ath_desc *ds,
526    HAL_DMA_ADDR *bufLenList, uint32_t *segLenList,
527    u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, u_int keyIx,
528    HAL_CIPHER cipher, uint8_t numDelims,
529    HAL_BOOL firstSeg, HAL_BOOL lastSeg, HAL_BOOL lastAggr)
530{
531
532	ath_hal_printf(ah, "%s: called\n", __func__);
533	return AH_FALSE;
534}
535
536/* setupfirsttxdesc */
537HAL_BOOL
538ar9300_freebsd_setup_first_tx_desc(struct ath_hal *ah, struct ath_desc *ds,
539    u_int aggrLen, u_int flags, u_int txPower, u_int txRate0,
540    u_int txTries0, u_int antMode, u_int rtsctsRate, u_int rtsctsDuration)
541{
542
543	ath_hal_printf(ah, "%s: called\n", __func__);
544	return AH_FALSE;
545}
546
547/* setuplasttxdesc */
548/*
549 * This gets called but for now let's not log anything;
550 * it's only used to update the rate control information.
551 */
552HAL_BOOL
553ar9300_freebsd_setup_last_tx_desc(struct ath_hal *ah, struct ath_desc *ds,
554    const struct ath_desc *ds0)
555{
556
557//	ath_hal_printf(ah, "%s: called\n", __func__);
558	return AH_FALSE;
559}
560
561void
562ar9300_freebsd_setup_11n_desc(struct ath_hal *ah, void *ds, u_int pktLen,
563    HAL_PKT_TYPE type, u_int txPower, u_int keyIx, u_int flags)
564{
565	ath_hal_printf(ah, "%s: called\n", __func__);
566#if 0
567	struct ath_hal_9300 *ahp = AH9300(ah);
568
569	HAL_KEY_TYPE keyType = 0;	/* XXX No padding */
570
571	if (keyIx != HAL_TXKEYIX_INVALID)
572		keyType = ahp->ah_keytype[keyIx];
573
574	/* XXX bounds check keyix */
575	ar9300_set_11n_tx_desc(ah, ds, pktLen, type, txPower, keyIx,
576	    keyType, flags);
577#endif
578}
579
580HAL_STATUS
581ar9300_freebsd_proc_tx_desc(struct ath_hal *ah, struct ath_desc *ds,
582    struct ath_tx_status *ts)
583{
584
585	return ar9300_proc_tx_desc(ah, ts);
586}
587
588void
589ar9300_freebsd_beacon_init(struct ath_hal *ah, uint32_t next_beacon,
590    uint32_t beacon_period)
591{
592
593	ar9300_beacon_init(ah, AH_PRIVATE(ah)->ah_opmode,
594	    next_beacon, beacon_period);
595}
596
597HAL_BOOL
598ar9300_freebsd_get_mib_cycle_counts(struct ath_hal *ah,
599    HAL_SURVEY_SAMPLE *hs)
600
601{
602
603	return (AH_FALSE);
604}
605
606HAL_BOOL
607ar9300_freebsd_get_dfs_default_thresh(struct ath_hal *ah,
608    HAL_PHYERR_PARAM *pe)
609{
610
611	/* XXX not yet */
612
613	return (AH_FALSE);
614}
615
616/*
617 * Clear multicast filter by index - from FreeBSD ar5212_recv.c
618 */
619static HAL_BOOL
620ar9300ClrMulticastFilterIndex(struct ath_hal *ah, uint32_t ix)
621{
622	uint32_t val;
623
624	if (ix >= 64)
625		return (AH_FALSE);
626	if (ix >= 32) {
627		val = OS_REG_READ(ah, AR_MCAST_FIL1);
628		OS_REG_WRITE(ah, AR_MCAST_FIL1, (val &~ (1<<(ix-32))));
629	} else {
630		val = OS_REG_READ(ah, AR_MCAST_FIL0);
631		OS_REG_WRITE(ah, AR_MCAST_FIL0, (val &~ (1<<ix)));
632	}
633	return AH_TRUE;
634}
635
636/*
637 * Set multicast filter by index - from FreeBSD ar5212_recv.c
638 */
639static HAL_BOOL
640ar9300SetMulticastFilterIndex(struct ath_hal *ah, uint32_t ix)
641{
642	uint32_t val;
643
644	if (ix >= 64)
645		return (AH_FALSE);
646	if (ix >= 32) {
647		val = OS_REG_READ(ah, AR_MCAST_FIL1);
648		OS_REG_WRITE(ah, AR_MCAST_FIL1, (val | (1<<(ix-32))));
649	} else {
650		val = OS_REG_READ(ah, AR_MCAST_FIL0);
651		OS_REG_WRITE(ah, AR_MCAST_FIL0, (val | (1<<ix)));
652	}
653	return (AH_TRUE);
654}
655
656/*
657 * RF attach stubs
658 */
659
660static HAL_BOOL
661rf9330_attach(struct ath_hal *ah, HAL_STATUS *status)
662{
663
664	(*status) = HAL_EINVAL;
665	return (AH_FALSE);
666}
667
668static HAL_BOOL
669rf9330_probe(struct ath_hal *ah)
670{
671	return (AH_FALSE);
672}
673
674AH_RF(RF9330, rf9330_probe, rf9330_attach);
675
676