1 /*
2  * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
3  * Copyright (c) 2002-2008 Atheros Communications, Inc.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  *
17  * $FreeBSD: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c 235972 2012-05-25 05:01:27Z adrian $
18  */
19 #include "opt_ah.h"
20 
21 #include "ah.h"
22 #include "ah_internal.h"
23 #include "ah_devid.h"
24 
25 #include "ar9300/ar9300.h"
26 #include "ar9300/ar9300reg.h"
27 #include "ar9300/ar9300phy.h"
28 
29 #include "ar9300/ar9300_stub.h"
30 #include "ar9300/ar9300_stub_funcs.h"
31 
32 void
33 ar9300_set_stub_functions(struct ath_hal *ah)
34 {
35 
36 //	ath_hal_printf(ah, "%s: setting stub functions\n", __func__);
37 
38 	ah->ah_getRateTable		= ar9300_Stub_GetRateTable;
39 //	ah->ah_detach			= ar9300_Stub_detach;
40 
41 	/* Reset Functions */
42 	ah->ah_reset			= ar9300_Stub_Reset;
43 	ah->ah_phyDisable		= ar9300_Stub_PhyDisable;
44 	ah->ah_disable			= ar9300_Stub_Disable;
45 	ah->ah_configPCIE		= ar9300_Stub_ConfigPCIE;
46 	ah->ah_disablePCIE		= ar9300_Stub_DisablePCIE;
47 	ah->ah_setPCUConfig		= ar9300_Stub_SetPCUConfig;
48 	ah->ah_perCalibration		= ar9300_Stub_PerCalibration;
49 	ah->ah_perCalibrationN		= ar9300_Stub_PerCalibrationN;
50 	ah->ah_resetCalValid		= ar9300_Stub_ResetCalValid;
51 	ah->ah_setTxPowerLimit		= ar9300_Stub_SetTxPowerLimit;
52 	ah->ah_getChanNoise		= ath_hal_getChanNoise;
53 
54 	/* Transmit functions */
55 	ah->ah_updateTxTrigLevel	= ar9300_Stub_UpdateTxTrigLevel;
56 	ah->ah_setupTxQueue		= ar9300_Stub_SetupTxQueue;
57 	ah->ah_setTxQueueProps		= ar9300_Stub_SetTxQueueProps;
58 	ah->ah_getTxQueueProps		= ar9300_Stub_GetTxQueueProps;
59 	ah->ah_releaseTxQueue		= ar9300_Stub_ReleaseTxQueue;
60 	ah->ah_resetTxQueue		= ar9300_Stub_ResetTxQueue;
61 	ah->ah_getTxDP			= ar9300_Stub_GetTxDP;
62 	ah->ah_setTxDP			= ar9300_Stub_SetTxDP;
63 	ah->ah_numTxPending		= ar9300_Stub_NumTxPending;
64 	ah->ah_startTxDma		= ar9300_Stub_StartTxDma;
65 	ah->ah_stopTxDma		= ar9300_Stub_StopTxDma;
66 	ah->ah_setupTxDesc		= ar9300_Stub_SetupTxDesc;
67 	ah->ah_setupXTxDesc		= ar9300_Stub_SetupXTxDesc;
68 	ah->ah_fillTxDesc		= ar9300_Stub_FillTxDesc;
69 	ah->ah_procTxDesc		= ar9300_Stub_ProcTxDesc;
70 	ah->ah_getTxIntrQueue		= ar9300_Stub_GetTxIntrQueue;
71 	ah->ah_reqTxIntrDesc 		= ar9300_Stub_IntrReqTxDesc;
72 	ah->ah_getTxCompletionRates	= ar9300_Stub_GetTxCompletionRates;
73 
74 	/* RX Functions */
75 	ah->ah_getRxDP			= ar9300_Stub_GetRxDP;
76 	ah->ah_setRxDP			= ar9300_Stub_SetRxDP;
77 	ah->ah_enableReceive		= ar9300_Stub_EnableReceive;
78 	ah->ah_stopDmaReceive		= ar9300_Stub_StopDmaReceive;
79 	ah->ah_startPcuReceive		= ar9300_Stub_StartPcuReceive;
80 	ah->ah_stopPcuReceive		= ar9300_Stub_StopPcuReceive;
81 	ah->ah_setMulticastFilter	= ar9300_Stub_SetMulticastFilter;
82 	ah->ah_setMulticastFilterIndex	= ar9300_Stub_SetMulticastFilterIndex;
83 	ah->ah_clrMulticastFilterIndex	= ar9300_Stub_ClrMulticastFilterIndex;
84 	ah->ah_getRxFilter		= ar9300_Stub_GetRxFilter;
85 	ah->ah_setRxFilter		= ar9300_Stub_SetRxFilter;
86 	ah->ah_setupRxDesc		= ar9300_Stub_SetupRxDesc;
87 	ah->ah_procRxDesc		= ar9300_Stub_ProcRxDesc;
88 	ah->ah_rxMonitor		= ar9300_Stub_RxMonitor;
89 	ah->ah_aniPoll			= ar9300_Stub_AniPoll;
90 	ah->ah_procMibEvent		= ar9300_Stub_ProcessMibIntr;
91 
92 	/* Misc Functions */
93 	ah->ah_getCapability		= ar9300_Stub_GetCapability;
94 	ah->ah_setCapability		= ar9300_Stub_SetCapability;
95 	ah->ah_getDiagState		= ar9300_Stub_GetDiagState;
96 	ah->ah_getMacAddress		= ar9300_Stub_GetMacAddress;
97 	ah->ah_setMacAddress		= ar9300_Stub_SetMacAddress;
98 	ah->ah_getBssIdMask		= ar9300_Stub_GetBssIdMask;
99 	ah->ah_setBssIdMask		= ar9300_Stub_SetBssIdMask;
100 	ah->ah_setRegulatoryDomain	= ar9300_Stub_SetRegulatoryDomain;
101 	ah->ah_setLedState		= ar9300_Stub_SetLedState;
102 	ah->ah_writeAssocid		= ar9300_Stub_WriteAssocid;
103 	ah->ah_gpioCfgInput		= ar9300_Stub_GpioCfgInput;
104 	ah->ah_gpioCfgOutput		= ar9300_Stub_GpioCfgOutput;
105 	ah->ah_gpioGet			= ar9300_Stub_GpioGet;
106 	ah->ah_gpioSet			= ar9300_Stub_GpioSet;
107 	ah->ah_gpioSetIntr		= ar9300_Stub_GpioSetIntr;
108 	ah->ah_getTsf32			= ar9300_Stub_GetTsf32;
109 	ah->ah_getTsf64			= ar9300_Stub_GetTsf64;
110 	ah->ah_resetTsf			= ar9300_Stub_ResetTsf;
111 	ah->ah_detectCardPresent	= ar9300_Stub_DetectCardPresent;
112 	ah->ah_updateMibCounters	= ar9300_Stub_UpdateMibCounters;
113 	ah->ah_getRfGain		= ar9300_Stub_GetRfgain;
114 	ah->ah_getDefAntenna		= ar9300_Stub_GetDefAntenna;
115 	ah->ah_setDefAntenna		= ar9300_Stub_SetDefAntenna;
116 	ah->ah_getAntennaSwitch		= ar9300_Stub_GetAntennaSwitch;
117 	ah->ah_setAntennaSwitch		= ar9300_Stub_SetAntennaSwitch;
118 	ah->ah_setSifsTime		= ar9300_Stub_SetSifsTime;
119 	ah->ah_getSifsTime		= ar9300_Stub_GetSifsTime;
120 	ah->ah_setSlotTime		= ar9300_Stub_SetSlotTime;
121 	ah->ah_getSlotTime		= ar9300_Stub_GetSlotTime;
122 	ah->ah_setAckTimeout		= ar9300_Stub_SetAckTimeout;
123 	ah->ah_getAckTimeout		= ar9300_Stub_GetAckTimeout;
124 	ah->ah_setAckCTSRate		= ar9300_Stub_SetAckCTSRate;
125 	ah->ah_getAckCTSRate		= ar9300_Stub_GetAckCTSRate;
126 	ah->ah_setCTSTimeout		= ar9300_Stub_SetCTSTimeout;
127 	ah->ah_getCTSTimeout		= ar9300_Stub_GetCTSTimeout;
128 	ah->ah_setDecompMask		= ar9300_Stub_SetDecompMask;
129 	ah->ah_setCoverageClass		= ar9300_Stub_SetCoverageClass;
130 	ah->ah_setQuiet			= ar9300_Stub_SetQuiet;
131 	ah->ah_getMibCycleCounts	= ar9300_Stub_GetMibCycleCounts;
132 
133 	/* DFS Functions */
134 	ah->ah_enableDfs		= ar9300_Stub_EnableDfs;
135 	ah->ah_getDfsThresh		= ar9300_Stub_GetDfsThresh;
136 	ah->ah_procRadarEvent		= ar9300_Stub_ProcessRadarEvent;
137 	ah->ah_isFastClockEnabled	= ar9300_Stub_IsFastClockEnabled;
138 	ah->ah_get11nExtBusy		= ar9300_Stub_Get11nExtBusy;
139 
140 	/* Key Cache Functions */
141 	ah->ah_getKeyCacheSize		= ar9300_Stub_GetKeyCacheSize;
142 	ah->ah_resetKeyCacheEntry	= ar9300_Stub_ResetKeyCacheEntry;
143 	ah->ah_isKeyCacheEntryValid	= ar9300_Stub_IsKeyCacheEntryValid;
144 	ah->ah_setKeyCacheEntry		= ar9300_Stub_SetKeyCacheEntry;
145 	ah->ah_setKeyCacheEntryMac	= ar9300_Stub_SetKeyCacheEntryMac;
146 
147 	/* Power Management Functions */
148 	ah->ah_setPowerMode		= ar9300_Stub_SetPowerMode;
149 	ah->ah_getPowerMode		= ar9300_Stub_GetPowerMode;
150 
151 	/* Beacon Functions */
152 	ah->ah_setBeaconTimers		= ar9300_Stub_SetBeaconTimers;
153 	ah->ah_beaconInit		= ar9300_Stub_BeaconInit;
154 	ah->ah_setStationBeaconTimers	= ar9300_Stub_SetStaBeaconTimers;
155 	ah->ah_resetStationBeaconTimers	= ar9300_Stub_ResetStaBeaconTimers;
156 	ah->ah_getNextTBTT		= ar9300_Stub_GetNextTBTT;
157 
158 	/* Interrupt Functions */
159 	ah->ah_isInterruptPending	= ar9300_Stub_IsInterruptPending;
160 	ah->ah_getPendingInterrupts	= ar9300_Stub_GetPendingInterrupts;
161 	ah->ah_getInterrupts		= ar9300_Stub_GetInterrupts;
162 	ah->ah_setInterrupts		= ar9300_Stub_SetInterrupts;
163 
164 	AH_PRIVATE(ah)->ah_getChannelEdges		= ar9300_Stub_GetChannelEdges;
165 	AH_PRIVATE(ah)->ah_getWirelessModes		= ar9300_Stub_GetWirelessModes;
166 	AH_PRIVATE(ah)->ah_eepromRead		= ar9300_Stub_EepromRead;
167 #ifdef AH_SUPPORT_WRITE_EEPROM
168 	AH_PRIVATE(ah)->ah_eepromWrite		= ar9300_Stub_EepromWrite;
169 #endif
170 	AH_PRIVATE(ah)->ah_getChipPowerLimits	= ar9300_Stub_GetChipPowerLimits;
171 }
172