xref: /dflybsd-src/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.h (revision a20e5e5100e71be018e157de86834f5dc77186c3)
1b7d5e03cSMatthew Dillon #ifndef	__AR9300_FREEBSD_INC_H__
2b7d5e03cSMatthew Dillon #define	__AR9300_FREEBSD_INC_H__
3b7d5e03cSMatthew Dillon 
4b7d5e03cSMatthew Dillon /*
5b7d5e03cSMatthew Dillon  * Define some configuration entries for the AR9300 HAL, so #if entries
6b7d5e03cSMatthew Dillon  * don't have to be removed.
7b7d5e03cSMatthew Dillon  */
8b7d5e03cSMatthew Dillon #define ATH_DRIVER_SIM          0       /* SIM */
9b7d5e03cSMatthew Dillon #define ATH_WOW                 0       /* Wake on Wireless */
10b7d5e03cSMatthew Dillon #define ATH_SUPPORT_MCI         1       /* MCI btcoex */
11b7d5e03cSMatthew Dillon #define ATH_SUPPORT_AIC         0       /* XXX to do with btcoex? */
12b7d5e03cSMatthew Dillon #define AH_NEED_TX_DATA_SWAP    0       /* TX descriptor swap? */
13b7d5e03cSMatthew Dillon #define AH_NEED_RX_DATA_SWAP    0       /* TX descriptor swap? */
14b7d5e03cSMatthew Dillon #define ATH_SUPPORT_WIRESHARK   0       /* Radiotap HAL code */
15b7d5e03cSMatthew Dillon #define AH_SUPPORT_WRITE_EEPROM 0       /* EEPROM write support */
16b7d5e03cSMatthew Dillon #define ATH_SUPPORT_WAPI        0       /* China WAPI support */
17b7d5e03cSMatthew Dillon #define ATH_ANT_DIV_COMB        1       /* Antenna combining */
18b7d5e03cSMatthew Dillon #define ATH_SUPPORT_RAW_ADC_CAPTURE     0       /* Raw ADC capture support */
19b7d5e03cSMatthew Dillon #define ATH_TRAFFIC_FAST_RECOVER        0       /* XXX not sure yet */
20*a20e5e51SMatthew Dillon #define ATH_SUPPORT_SPECTRAL    1       /* Spectral scan support */
21b7d5e03cSMatthew Dillon #define ATH_BT_COEX             1       /* Enable BT Coex code */
22b7d5e03cSMatthew Dillon #define ATH_PCIE_ERROR_MONITOR  0       /* ??? */
23b7d5e03cSMatthew Dillon #define ATH_SUPPORT_CRDC        0       /* ??? */
24b7d5e03cSMatthew Dillon #define ATH_LOW_POWER_ENABLE    0       /* ??? */
25b7d5e03cSMatthew Dillon #define ATH_SUPPORT_VOW_DCS     0       /* Video over wireless dynamic channel select */
26b7d5e03cSMatthew Dillon #define REMOVE_PKT_LOG          1
27b7d5e03cSMatthew Dillon #define ATH_VC_MODE_PROXY_STA   0       /* Azimuth + proxysta? */
28b7d5e03cSMatthew Dillon #define ATH_GEN_RANDOMNESS      0
29b7d5e03cSMatthew Dillon #define __PKT_SERIOUS_ERRORS__  0
30b7d5e03cSMatthew Dillon #define HAL_INTR_REFCOUNT_DISABLE       1       /* XXX wha? And atomics in the HAL!? */
31b7d5e03cSMatthew Dillon #define UMAC_SUPPORT_SMARTANTENNA       0       /* sigh.. */
32b7d5e03cSMatthew Dillon #define ATH_SMARTANTENNA_DISABLE_JTAG   0
33b7d5e03cSMatthew Dillon #define ATH_SUPPORT_WIRESHARK           0
34b7d5e03cSMatthew Dillon #define ATH_SUPPORT_WIFIPOS     0
35b7d5e03cSMatthew Dillon #define ATH_SUPPORT_PAPRD       1
36b7d5e03cSMatthew Dillon #define ATH_SUPPORT_TxBF        0
37b7d5e03cSMatthew Dillon #define AH_PRIVATE_DIAG         1
38*a20e5e51SMatthew Dillon #define ATH_SUPPORT_KEYPLUMB_WAR 0
39b7d5e03cSMatthew Dillon 
40b7d5e03cSMatthew Dillon /* XXX need to reverify these; they came in with qcamain */
41b7d5e03cSMatthew Dillon #define ATH_SUPPORT_FAST_CC 0
42b7d5e03cSMatthew Dillon #define ATH_SUPPORT_RADIO_RETENTION 0
43b7d5e03cSMatthew Dillon #define ATH_SUPPORT_CAL_REUSE 0
44b7d5e03cSMatthew Dillon 
45b7d5e03cSMatthew Dillon #define ATH_WOW_OFFLOAD 0
46b7d5e03cSMatthew Dillon 
47b7d5e03cSMatthew Dillon #define HAL_NO_INTERSPERSED_READS
48b7d5e03cSMatthew Dillon 
49b7d5e03cSMatthew Dillon /* Required or things will probe/attach, but not work right */
50b7d5e03cSMatthew Dillon #define	AH_SUPPORT_OSPREY		1
51b7d5e03cSMatthew Dillon #define	AH_SUPPORT_POSEIDON		1
52b7d5e03cSMatthew Dillon #define	AH_SUPPORT_AR9300		1
53b7d5e03cSMatthew Dillon 
54*a20e5e51SMatthew Dillon /* These are the embedded boards */
55b7d5e03cSMatthew Dillon #ifdef	AH_SUPPORT_AR9330
56b7d5e03cSMatthew Dillon #define AH_SUPPORT_HORNET		1
57b7d5e03cSMatthew Dillon #endif	/* AH_SUPPORT_AR9330 */
58b7d5e03cSMatthew Dillon #ifdef	AH_SUPPORT_AR9340
59b7d5e03cSMatthew Dillon #define AH_SUPPORT_WASP			1
60b7d5e03cSMatthew Dillon #endif	/* AH_SUPPORT_AR9340 */
61848b370cSMatthew Dillon #ifdef	AH_SUPPORT_QCA9550
62848b370cSMatthew Dillon #define AH_SUPPORT_SCORPION             1
63848b370cSMatthew Dillon #endif	/* AH_SUPPORT_QCA9550 */
64*a20e5e51SMatthew Dillon #ifdef	AH_SUPPORT_QCA9530
65*a20e5e51SMatthew Dillon #define	AH_SUPPORT_HONEYBEE		1
66*a20e5e51SMatthew Dillon #endif	/* AH_SUPPORT_QCA9530 */
67b7d5e03cSMatthew Dillon #define FIX_NOISE_FLOOR                 1
68b7d5e03cSMatthew Dillon 
69b7d5e03cSMatthew Dillon /* XXX this needs to be removed! No atomics in the HAL! */
70b7d5e03cSMatthew Dillon typedef int os_atomic_t;                /* XXX shouldn't do atomics here! */
71b7d5e03cSMatthew Dillon #define OS_ATOMIC_INC(a)        (*a)++
72b7d5e03cSMatthew Dillon #define OS_ATOMIC_DEC(a)        (*a)--
73b7d5e03cSMatthew Dillon 
74b7d5e03cSMatthew Dillon /*
75b7d5e03cSMatthew Dillon  * HAL definitions which aren't necessarily for public consumption (yet).
76b7d5e03cSMatthew Dillon  */
77b7d5e03cSMatthew Dillon 
78b7d5e03cSMatthew Dillon enum {
79b7d5e03cSMatthew Dillon 	HAL_TRUE_CHIP = 1,
80b7d5e03cSMatthew Dillon 	HAL_MAC_TO_MAC_EMU,
81b7d5e03cSMatthew Dillon 	HAL_MAC_BB_EMU,
82b7d5e03cSMatthew Dillon };
83b7d5e03cSMatthew Dillon 
84b7d5e03cSMatthew Dillon /* HAL_KEY_TYPE */
85b7d5e03cSMatthew Dillon enum {
86b7d5e03cSMatthew Dillon 	HAL_KEY_PROXY_STA_MASK = 0x10,
87b7d5e03cSMatthew Dillon };
88b7d5e03cSMatthew Dillon 
89b7d5e03cSMatthew Dillon typedef enum {
90b7d5e03cSMatthew Dillon 	HAL_SMPS_DEFAULT = 0,
91b7d5e03cSMatthew Dillon 	HAL_SMPS_SW_CTRL_LOW_PWR,       /* Software control, low power setting */
92b7d5e03cSMatthew Dillon 	HAL_SMPS_SW_CTRL_HIGH_PWR,      /* Software control, high power setting */
93b7d5e03cSMatthew Dillon 	HAL_SMPS_HW_CTRL                /* Hardware Control */
94b7d5e03cSMatthew Dillon } HAL_SMPS_MODE;
95b7d5e03cSMatthew Dillon 
96b7d5e03cSMatthew Dillon /*
97b7d5e03cSMatthew Dillon  * Green Tx, Based on different RSSI of Received Beacon thresholds,
98b7d5e03cSMatthew Dillon  * using different tx power by modified register tx power related values.
99b7d5e03cSMatthew Dillon  * The thresholds are decided by system team.
100b7d5e03cSMatthew Dillon  */
101b7d5e03cSMatthew Dillon #define	GreenTX_thres1	56	/* in dB */
102b7d5e03cSMatthew Dillon #define	GreenTX_thres2	36	/* in dB */
103b7d5e03cSMatthew Dillon 
104b7d5e03cSMatthew Dillon typedef enum {
105b7d5e03cSMatthew Dillon 	HAL_RSSI_TX_POWER_NONE		= 0,
106b7d5e03cSMatthew Dillon 	HAL_RSSI_TX_POWER_SHORT		= 1,	/* short range, reduce OB/DB bias current and disable PAL */
107b7d5e03cSMatthew Dillon 	HAL_RSSI_TX_POWER_MIDDLE	= 2,	/* middle range, reduce OB/DB bias current and PAL is enabled */
108b7d5e03cSMatthew Dillon 	HAL_RSSI_TX_POWER_LONG		= 3,	/* long range, orig. OB/DB bias current and PAL is enabled */
109b7d5e03cSMatthew Dillon } HAL_RSSI_TX_POWER;
110b7d5e03cSMatthew Dillon 
111b7d5e03cSMatthew Dillon struct  dfs_pulse {
112b7d5e03cSMatthew Dillon 	u_int32_t	rp_numpulses    ;       /* Num of pulses in radar burst */
113b7d5e03cSMatthew Dillon 	u_int32_t	rp_pulsedur;            /* Duration of each pulse in usecs */
114b7d5e03cSMatthew Dillon 	u_int32_t	rp_pulsefreq;           /* Frequency of pulses in burst */
115b7d5e03cSMatthew Dillon 	u_int32_t	rp_max_pulsefreq;       /* Frequency of pulses in burst */
116b7d5e03cSMatthew Dillon 	u_int32_t	rp_patterntype;         /* fixed or variable pattern type*/
117b7d5e03cSMatthew Dillon 	u_int32_t	rp_pulsevar;            /* Time variation of pulse duration for
118b7d5e03cSMatthew Dillon 							  matched filter (single-sided) in usecs */
119b7d5e03cSMatthew Dillon 	u_int32_t	rp_threshold;           /* Threshold for MF output to indicate
120b7d5e03cSMatthew Dillon 							  radar match */
121b7d5e03cSMatthew Dillon 	u_int32_t	rp_mindur;              /* Min pulse duration to be considered for
122b7d5e03cSMatthew Dillon 							  this pulse type */
123b7d5e03cSMatthew Dillon 	u_int32_t	rp_maxdur;              /* Max pusle duration to be considered for
124b7d5e03cSMatthew Dillon 							  this pulse type */
125b7d5e03cSMatthew Dillon 	u_int32_t	rp_rssithresh;          /* Minimum rssi to be considered a radar pulse */
126b7d5e03cSMatthew Dillon 	u_int32_t	rp_meanoffset;          /* Offset for timing adjustment */
127b7d5e03cSMatthew Dillon 	int32_t		rp_rssimargin;          /* rssi threshold margin. In Turbo Mode HW reports rssi 3dBm */
128b7d5e03cSMatthew Dillon 						       /* lower than in non TURBO mode.
129b7d5e03cSMatthew Dillon 							  This will be used to offset that diff.*/
130b7d5e03cSMatthew Dillon 	u_int32_t	rp_ignore_pri_window;
131b7d5e03cSMatthew Dillon 	u_int32_t	rp_pulseid;             /* Unique ID for identifying filter */
132b7d5e03cSMatthew Dillon };
133b7d5e03cSMatthew Dillon 
134b7d5e03cSMatthew Dillon struct  dfs_staggered_pulse {
135b7d5e03cSMatthew Dillon        u_int32_t       rp_numpulses;           /* Num of pulses in radar burst */
136b7d5e03cSMatthew Dillon        u_int32_t       rp_pulsedur;            /* Duration of each pulse in usecs */
137b7d5e03cSMatthew Dillon        u_int32_t       rp_min_pulsefreq;       /* Frequency of pulses in burst */
138b7d5e03cSMatthew Dillon        u_int32_t       rp_max_pulsefreq;       /* Frequency of pulses in burst */
139b7d5e03cSMatthew Dillon        u_int32_t       rp_patterntype;         /* fixed or variable pattern type*/
140b7d5e03cSMatthew Dillon        u_int32_t       rp_pulsevar;            /* Time variation of pulse duration for
141b7d5e03cSMatthew Dillon                                                    matched filter (single-sided) in usecs */
142b7d5e03cSMatthew Dillon        u_int32_t       rp_threshold;           /* Thershold for MF output to indicateC
143b7d5e03cSMatthew Dillon                                                   radar match */
144b7d5e03cSMatthew Dillon        u_int32_t       rp_mindur;              /* Min pulse duration to be considered for
145b7d5e03cSMatthew Dillon                                                   this pulse type */
146b7d5e03cSMatthew Dillon        u_int32_t       rp_maxdur;              /* Max pusle duration to be considered for
147b7d5e03cSMatthew Dillon                                                   this pulse type */
148b7d5e03cSMatthew Dillon        u_int32_t       rp_rssithresh;          /* Minimum rssi to be considered a radar pulse */
149b7d5e03cSMatthew Dillon        u_int32_t       rp_meanoffset;          /* Offset for timing adjustment */
150b7d5e03cSMatthew Dillon        int32_t         rp_rssimargin;          /* rssi threshold margin. In Turbo Mode HW reports rssi 3dBm */
151b7d5e03cSMatthew Dillon                                                /* lower than in non TURBO mode. This will be used to offset that diff.*/
152b7d5e03cSMatthew Dillon        u_int32_t       rp_pulseid;             /* Unique ID for identifying filter */
153b7d5e03cSMatthew Dillon        };
154b7d5e03cSMatthew Dillon 
155b7d5e03cSMatthew Dillon struct dfs_bin5pulse {
156b7d5e03cSMatthew Dillon         u_int32_t       b5_threshold;          /* Number of bin5 pulses to indicate detection */
157b7d5e03cSMatthew Dillon         u_int32_t       b5_mindur;             /* Min duration for a bin5 pulse */
158b7d5e03cSMatthew Dillon         u_int32_t       b5_maxdur;             /* Max duration for a bin5 pulse */
159b7d5e03cSMatthew Dillon         u_int32_t       b5_timewindow;         /* Window over which to count bin5 pulses */
160b7d5e03cSMatthew Dillon         u_int32_t       b5_rssithresh;         /* Min rssi to be considered a pulse */
161b7d5e03cSMatthew Dillon         u_int32_t       b5_rssimargin;         /* rssi threshold margin. In Turbo Mode HW reports rssi 3dB */
162b7d5e03cSMatthew Dillon };
163b7d5e03cSMatthew Dillon 
164b7d5e03cSMatthew Dillon #if 0
165b7d5e03cSMatthew Dillon /* SPECTRAL SCAN defines begin */
166b7d5e03cSMatthew Dillon typedef struct {
167b7d5e03cSMatthew Dillon         u_int16_t       ss_fft_period;  /* Skip interval for FFT reports */
168b7d5e03cSMatthew Dillon         u_int16_t       ss_period;      /* Spectral scan period */
169b7d5e03cSMatthew Dillon         u_int16_t       ss_count;       /* # of reports to return from ss_active */
170b7d5e03cSMatthew Dillon         u_int16_t       ss_short_report;/* Set to report ony 1 set of FFT results */
171b7d5e03cSMatthew Dillon         u_int8_t        radar_bin_thresh_sel;
172b7d5e03cSMatthew Dillon         u_int16_t       ss_spectral_pri;                /* are we doing a noise power cal ? */
173b7d5e03cSMatthew Dillon         int8_t          ss_nf_cal[AH_MAX_CHAINS*2];     /* nf calibrated values for ctl+ext from eeprom */
174b7d5e03cSMatthew Dillon         int8_t          ss_nf_pwr[AH_MAX_CHAINS*2];     /* nf pwr values for ctl+ext from eeprom */
175b7d5e03cSMatthew Dillon         int32_t         ss_nf_temp_data;                /* temperature data taken during nf scan */
176b7d5e03cSMatthew Dillon } HAL_SPECTRAL_PARAM;
177b7d5e03cSMatthew Dillon #define HAL_SPECTRAL_PARAM_NOVAL        0xFFFF
178b7d5e03cSMatthew Dillon #define HAL_SPECTRAL_PARAM_ENABLE       0x8000  /* Enable/Disable if applicable */
179b7d5e03cSMatthew Dillon #endif
180b7d5e03cSMatthew Dillon 
181b7d5e03cSMatthew Dillon /*
182b7d5e03cSMatthew Dillon  * Noise power data definitions
183b7d5e03cSMatthew Dillon  * units are: 4 x dBm - NOISE_PWR_DATA_OFFSET (e.g. -25 = (-25/4 - 90) = -96.25 dBm)
184b7d5e03cSMatthew Dillon  * range (for 6 signed bits) is (-32 to 31) + offset => -122dBm to -59dBm
185b7d5e03cSMatthew Dillon  * resolution (2 bits) is 0.25dBm
186b7d5e03cSMatthew Dillon  */
187b7d5e03cSMatthew Dillon #define NOISE_PWR_DATA_OFFSET           -90 /* dbm - all pwr report data is represented offset by this */
188b7d5e03cSMatthew Dillon #define INT_2_NOISE_PWR_DBM(_p)         (((_p) - NOISE_PWR_DATA_OFFSET) << 2)
189b7d5e03cSMatthew Dillon #define NOISE_PWR_DBM_2_INT(_p)         ((((_p) + 3) >> 2) + NOISE_PWR_DATA_OFFSET)
190b7d5e03cSMatthew Dillon #define NOISE_PWR_DBM_2_DEC(_p)         (((-(_p)) & 3) * 25)
191b7d5e03cSMatthew Dillon #define N2DBM(_x,_y)                    ((((_x) - NOISE_PWR_DATA_OFFSET) << 2) - (_y)/25)
192b7d5e03cSMatthew Dillon /* SPECTRAL SCAN defines end */
193b7d5e03cSMatthew Dillon 
194b7d5e03cSMatthew Dillon typedef struct halvowstats {
195b7d5e03cSMatthew Dillon     u_int32_t   tx_frame_count;
196b7d5e03cSMatthew Dillon     u_int32_t   rx_frame_count;
197b7d5e03cSMatthew Dillon     u_int32_t   rx_clear_count;
198b7d5e03cSMatthew Dillon     u_int32_t   cycle_count;
199b7d5e03cSMatthew Dillon     u_int32_t   ext_cycle_count;
200b7d5e03cSMatthew Dillon } HAL_VOWSTATS;
201b7d5e03cSMatthew Dillon 
202b7d5e03cSMatthew Dillon #define HAL_BT_COEX_FLAG_LOW_ACK_PWR        0x00000001
203b7d5e03cSMatthew Dillon #define HAL_BT_COEX_FLAG_LOWER_TX_PWR       0x00000002
204b7d5e03cSMatthew Dillon #define HAL_BT_COEX_FLAG_ANT_DIV_ALLOW      0x00000004    /* Check Rx Diversity is allowed */
205b7d5e03cSMatthew Dillon #define HAL_BT_COEX_FLAG_ANT_DIV_ENABLE     0x00000008    /* Check Diversity is on or off */
206b7d5e03cSMatthew Dillon #define HAL_BT_COEX_FLAG_MCI_MAX_TX_PWR     0x00000010
207b7d5e03cSMatthew Dillon #define HAL_BT_COEX_FLAG_MCI_FTP_STOMP_RX   0x00000020
208b7d5e03cSMatthew Dillon 
209b7d5e03cSMatthew Dillon /*
210b7d5e03cSMatthew Dillon  * Weight table configurations.
211b7d5e03cSMatthew Dillon  */
212b7d5e03cSMatthew Dillon #define AR9300_BT_WGHT                     0xcccc4444
213b7d5e03cSMatthew Dillon #define AR9300_STOMP_ALL_WLAN_WGHT0        0xfffffff0
214b7d5e03cSMatthew Dillon #define AR9300_STOMP_ALL_WLAN_WGHT1        0xfffffff0
215b7d5e03cSMatthew Dillon #define AR9300_STOMP_LOW_WLAN_WGHT0        0x88888880
216b7d5e03cSMatthew Dillon #define AR9300_STOMP_LOW_WLAN_WGHT1        0x88888880
217b7d5e03cSMatthew Dillon #define AR9300_STOMP_NONE_WLAN_WGHT0       0x00000000
218b7d5e03cSMatthew Dillon #define AR9300_STOMP_NONE_WLAN_WGHT1       0x00000000
219b7d5e03cSMatthew Dillon #define AR9300_STOMP_ALL_FORCE_WLAN_WGHT0  0xffffffff   // Stomp BT even when WLAN is idle
220b7d5e03cSMatthew Dillon #define AR9300_STOMP_ALL_FORCE_WLAN_WGHT1  0xffffffff
221b7d5e03cSMatthew Dillon #define AR9300_STOMP_LOW_FORCE_WLAN_WGHT0  0x88888888   // Stomp BT even when WLAN is idle
222b7d5e03cSMatthew Dillon #define AR9300_STOMP_LOW_FORCE_WLAN_WGHT1  0x88888888
223b7d5e03cSMatthew Dillon 
224b7d5e03cSMatthew Dillon #define JUPITER_STOMP_ALL_WLAN_WGHT0       0x01017d01
225b7d5e03cSMatthew Dillon #define JUPITER_STOMP_ALL_WLAN_WGHT1       0x41414101
226b7d5e03cSMatthew Dillon #define JUPITER_STOMP_ALL_WLAN_WGHT2       0x41414101
227b7d5e03cSMatthew Dillon #define JUPITER_STOMP_ALL_WLAN_WGHT3       0x41414141
228b7d5e03cSMatthew Dillon #define JUPITER_STOMP_LOW_WLAN_WGHT0       0x01017d01
229b7d5e03cSMatthew Dillon #define JUPITER_STOMP_LOW_WLAN_WGHT1       0x3b3b3b01
230b7d5e03cSMatthew Dillon #define JUPITER_STOMP_LOW_WLAN_WGHT2       0x3b3b3b01
231b7d5e03cSMatthew Dillon #define JUPITER_STOMP_LOW_WLAN_WGHT3       0x3b3b3b3b
232b7d5e03cSMatthew Dillon #define JUPITER_STOMP_LOW_FTP_WLAN_WGHT0   0x01017d01
233b7d5e03cSMatthew Dillon #define JUPITER_STOMP_LOW_FTP_WLAN_WGHT1   0x013b0101
234b7d5e03cSMatthew Dillon #define JUPITER_STOMP_LOW_FTP_WLAN_WGHT2   0x3b3b0101
235b7d5e03cSMatthew Dillon #define JUPITER_STOMP_LOW_FTP_WLAN_WGHT3   0x3b3b013b
236b7d5e03cSMatthew Dillon #define JUPITER_STOMP_NONE_WLAN_WGHT0      0x01017d01
237b7d5e03cSMatthew Dillon #define JUPITER_STOMP_NONE_WLAN_WGHT1      0x01010101
238b7d5e03cSMatthew Dillon #define JUPITER_STOMP_NONE_WLAN_WGHT2      0x01010101
239b7d5e03cSMatthew Dillon #define JUPITER_STOMP_NONE_WLAN_WGHT3      0x01010101
240b7d5e03cSMatthew Dillon #define JUPITER_STOMP_ALL_FORCE_WLAN_WGHT0 0x01017d7d
241b7d5e03cSMatthew Dillon #define JUPITER_STOMP_ALL_FORCE_WLAN_WGHT1 0x7d7d7d01
242b7d5e03cSMatthew Dillon #define JUPITER_STOMP_ALL_FORCE_WLAN_WGHT2 0x7d7d7d7d
243b7d5e03cSMatthew Dillon #define JUPITER_STOMP_ALL_FORCE_WLAN_WGHT3 0x7d7d7d7d
244b7d5e03cSMatthew Dillon #define JUPITER_STOMP_LOW_FORCE_WLAN_WGHT0 0x01013b3b
245b7d5e03cSMatthew Dillon #define JUPITER_STOMP_LOW_FORCE_WLAN_WGHT1 0x3b3b3b01
246b7d5e03cSMatthew Dillon #define JUPITER_STOMP_LOW_FORCE_WLAN_WGHT2 0x3b3b3b3b
247b7d5e03cSMatthew Dillon #define JUPITER_STOMP_LOW_FORCE_WLAN_WGHT3 0x3b3b3b3b
248b7d5e03cSMatthew Dillon 
249b7d5e03cSMatthew Dillon #define MCI_CONCUR_TX_WLAN_WGHT1_MASK      0xff000000
250b7d5e03cSMatthew Dillon #define MCI_CONCUR_TX_WLAN_WGHT1_MASK_S    24
251b7d5e03cSMatthew Dillon #define MCI_CONCUR_TX_WLAN_WGHT2_MASK      0x00ff0000
252b7d5e03cSMatthew Dillon #define MCI_CONCUR_TX_WLAN_WGHT2_MASK_S    16
253b7d5e03cSMatthew Dillon #define MCI_CONCUR_TX_WLAN_WGHT3_MASK      0x000000ff
254b7d5e03cSMatthew Dillon #define MCI_CONCUR_TX_WLAN_WGHT3_MASK_S    0
255b7d5e03cSMatthew Dillon #define MCI_CONCUR_TX_WLAN_WGHT3_MASK2     0x00ff0000
256b7d5e03cSMatthew Dillon #define MCI_CONCUR_TX_WLAN_WGHT3_MASK2_S   16
257b7d5e03cSMatthew Dillon 
258b7d5e03cSMatthew Dillon #define MCI_QUERY_BT_VERSION_VERBOSE            0
259b7d5e03cSMatthew Dillon #define MCI_LINKID_INDEX_MGMT_PENDING           1
260b7d5e03cSMatthew Dillon 
261b7d5e03cSMatthew Dillon #define HAL_MCI_FLAG_DISABLE_TIMESTAMP      0x00000001      /* Disable time stamp */
262b7d5e03cSMatthew Dillon 
263b7d5e03cSMatthew Dillon typedef enum mci_message_header {
264b7d5e03cSMatthew Dillon     MCI_LNA_CTRL     = 0x10,        /* len = 0 */
265b7d5e03cSMatthew Dillon     MCI_CONT_NACK    = 0x20,        /* len = 0 */
266b7d5e03cSMatthew Dillon     MCI_CONT_INFO    = 0x30,        /* len = 4 */
267b7d5e03cSMatthew Dillon     MCI_CONT_RST     = 0x40,        /* len = 0 */
268b7d5e03cSMatthew Dillon     MCI_SCHD_INFO    = 0x50,        /* len = 16 */
269b7d5e03cSMatthew Dillon     MCI_CPU_INT      = 0x60,        /* len = 4 */
270b7d5e03cSMatthew Dillon     MCI_SYS_WAKING   = 0x70,        /* len = 0 */
271b7d5e03cSMatthew Dillon     MCI_GPM          = 0x80,        /* len = 16 */
272b7d5e03cSMatthew Dillon     MCI_LNA_INFO     = 0x90,        /* len = 1 */
273b7d5e03cSMatthew Dillon     MCI_LNA_STATE    = 0x94,
274b7d5e03cSMatthew Dillon     MCI_LNA_TAKE     = 0x98,
275b7d5e03cSMatthew Dillon     MCI_LNA_TRANS    = 0x9c,
276b7d5e03cSMatthew Dillon     MCI_SYS_SLEEPING = 0xa0,        /* len = 0 */
277b7d5e03cSMatthew Dillon     MCI_REQ_WAKE     = 0xc0,        /* len = 0 */
278b7d5e03cSMatthew Dillon     MCI_DEBUG_16     = 0xfe,        /* len = 2 */
279b7d5e03cSMatthew Dillon     MCI_REMOTE_RESET = 0xff         /* len = 16 */
280b7d5e03cSMatthew Dillon } MCI_MESSAGE_HEADER;
281b7d5e03cSMatthew Dillon 
282b7d5e03cSMatthew Dillon /* Default remote BT device MCI COEX version */
283b7d5e03cSMatthew Dillon #define MCI_GPM_COEX_MAJOR_VERSION_DEFAULT  3
284b7d5e03cSMatthew Dillon #define MCI_GPM_COEX_MINOR_VERSION_DEFAULT  0
285b7d5e03cSMatthew Dillon /* Local WLAN MCI COEX version */
286b7d5e03cSMatthew Dillon #define MCI_GPM_COEX_MAJOR_VERSION_WLAN     3
287b7d5e03cSMatthew Dillon #define MCI_GPM_COEX_MINOR_VERSION_WLAN     0
288b7d5e03cSMatthew Dillon 
289b7d5e03cSMatthew Dillon typedef enum mci_gpm_subtype {
290b7d5e03cSMatthew Dillon     MCI_GPM_BT_CAL_REQ      = 0,
291b7d5e03cSMatthew Dillon     MCI_GPM_BT_CAL_GRANT    = 1,
292b7d5e03cSMatthew Dillon     MCI_GPM_BT_CAL_DONE     = 2,
293b7d5e03cSMatthew Dillon     MCI_GPM_WLAN_CAL_REQ    = 3,
294b7d5e03cSMatthew Dillon     MCI_GPM_WLAN_CAL_GRANT  = 4,
295b7d5e03cSMatthew Dillon     MCI_GPM_WLAN_CAL_DONE   = 5,
296b7d5e03cSMatthew Dillon     MCI_GPM_COEX_AGENT      = 0x0C,
297b7d5e03cSMatthew Dillon     MCI_GPM_RSVD_PATTERN    = 0xFE,
298b7d5e03cSMatthew Dillon     MCI_GPM_RSVD_PATTERN32  = 0xFEFEFEFE,
299b7d5e03cSMatthew Dillon     MCI_GPM_BT_DEBUG        = 0xFF
300b7d5e03cSMatthew Dillon } MCI_GPM_SUBTYPE_T;
301b7d5e03cSMatthew Dillon 
302b7d5e03cSMatthew Dillon typedef enum mci_gpm_coex_opcode {
303b7d5e03cSMatthew Dillon     MCI_GPM_COEX_VERSION_QUERY      = 0,
304b7d5e03cSMatthew Dillon     MCI_GPM_COEX_VERSION_RESPONSE   = 1,
305b7d5e03cSMatthew Dillon     MCI_GPM_COEX_STATUS_QUERY       = 2,
306b7d5e03cSMatthew Dillon     MCI_GPM_COEX_HALT_BT_GPM        = 3,
307b7d5e03cSMatthew Dillon     MCI_GPM_COEX_WLAN_CHANNELS      = 4,
308b7d5e03cSMatthew Dillon     MCI_GPM_COEX_BT_PROFILE_INFO    = 5,
309b7d5e03cSMatthew Dillon     MCI_GPM_COEX_BT_STATUS_UPDATE   = 6,
310b7d5e03cSMatthew Dillon     MCI_GPM_COEX_BT_UPDATE_FLAGS    = 7
311b7d5e03cSMatthew Dillon } MCI_GPM_COEX_OPCODE_T;
312b7d5e03cSMatthew Dillon 
313b7d5e03cSMatthew Dillon typedef enum mci_gpm_coex_query_type {
314b7d5e03cSMatthew Dillon     /* WLAN information */
315b7d5e03cSMatthew Dillon     MCI_GPM_COEX_QUERY_WLAN_ALL_INFO    = 0x01,
316b7d5e03cSMatthew Dillon     /* BT information */
317b7d5e03cSMatthew Dillon     MCI_GPM_COEX_QUERY_BT_ALL_INFO      = 0x01,
318b7d5e03cSMatthew Dillon     MCI_GPM_COEX_QUERY_BT_TOPOLOGY      = 0x02,
319b7d5e03cSMatthew Dillon     MCI_GPM_COEX_QUERY_BT_DEBUG         = 0x04
320b7d5e03cSMatthew Dillon } MCI_GPM_COEX_QUERY_TYPE_T;
321b7d5e03cSMatthew Dillon 
322b7d5e03cSMatthew Dillon typedef enum mci_gpm_coex_halt_bt_gpm {
323b7d5e03cSMatthew Dillon     MCI_GPM_COEX_BT_GPM_UNHALT      = 0,
324b7d5e03cSMatthew Dillon     MCI_GPM_COEX_BT_GPM_HALT        = 1
325b7d5e03cSMatthew Dillon } MCI_GPM_COEX_HALT_BT_GPM_T;
326b7d5e03cSMatthew Dillon 
327b7d5e03cSMatthew Dillon typedef enum mci_gpm_coex_profile_type {
328b7d5e03cSMatthew Dillon     MCI_GPM_COEX_PROFILE_UNKNOWN    = 0,
329b7d5e03cSMatthew Dillon     MCI_GPM_COEX_PROFILE_RFCOMM     = 1,
330b7d5e03cSMatthew Dillon     MCI_GPM_COEX_PROFILE_A2DP       = 2,
331b7d5e03cSMatthew Dillon     MCI_GPM_COEX_PROFILE_HID        = 3,
332b7d5e03cSMatthew Dillon     MCI_GPM_COEX_PROFILE_BNEP       = 4,
333b7d5e03cSMatthew Dillon     MCI_GPM_COEX_PROFILE_VOICE      = 5,
334b7d5e03cSMatthew Dillon     MCI_GPM_COEX_PROFILE_MAX
335b7d5e03cSMatthew Dillon } MCI_GPM_COEX_PROFILE_TYPE_T;
336b7d5e03cSMatthew Dillon 
337b7d5e03cSMatthew Dillon typedef enum mci_gpm_coex_profile_state {
338b7d5e03cSMatthew Dillon     MCI_GPM_COEX_PROFILE_STATE_END      = 0,
339b7d5e03cSMatthew Dillon     MCI_GPM_COEX_PROFILE_STATE_START    = 1
340b7d5e03cSMatthew Dillon } MCI_GPM_COEX_PROFILE_STATE_T;
341b7d5e03cSMatthew Dillon 
342b7d5e03cSMatthew Dillon typedef enum mci_gpm_coex_profile_role {
343b7d5e03cSMatthew Dillon     MCI_GPM_COEX_PROFILE_SLAVE      = 0,
344b7d5e03cSMatthew Dillon     MCI_GPM_COEX_PROFILE_MASTER     = 1
345b7d5e03cSMatthew Dillon } MCI_GPM_COEX_PROFILE_ROLE_T;
346b7d5e03cSMatthew Dillon 
347b7d5e03cSMatthew Dillon typedef enum mci_gpm_coex_bt_status_type {
348b7d5e03cSMatthew Dillon     MCI_GPM_COEX_BT_NONLINK_STATUS  = 0,
349b7d5e03cSMatthew Dillon     MCI_GPM_COEX_BT_LINK_STATUS     = 1
350b7d5e03cSMatthew Dillon } MCI_GPM_COEX_BT_STATUS_TYPE_T;
351b7d5e03cSMatthew Dillon 
352b7d5e03cSMatthew Dillon typedef enum mci_gpm_coex_bt_status_state {
353b7d5e03cSMatthew Dillon     MCI_GPM_COEX_BT_NORMAL_STATUS   = 0,
354b7d5e03cSMatthew Dillon     MCI_GPM_COEX_BT_CRITICAL_STATUS = 1
355b7d5e03cSMatthew Dillon } MCI_GPM_COEX_BT_STATUS_STATE_T;
356b7d5e03cSMatthew Dillon 
357b7d5e03cSMatthew Dillon #define MCI_GPM_INVALID_PROFILE_HANDLE  0xff
358b7d5e03cSMatthew Dillon 
359b7d5e03cSMatthew Dillon typedef enum mci_gpm_coex_bt_updata_flags_op {
360b7d5e03cSMatthew Dillon     MCI_GPM_COEX_BT_FLAGS_READ          = 0x00,
361b7d5e03cSMatthew Dillon     MCI_GPM_COEX_BT_FLAGS_SET           = 0x01,
362b7d5e03cSMatthew Dillon     MCI_GPM_COEX_BT_FLAGS_CLEAR         = 0x02
363b7d5e03cSMatthew Dillon } MCI_GPM_COEX_BT_FLAGS_OP_T;
364b7d5e03cSMatthew Dillon 
365b7d5e03cSMatthew Dillon /* MCI GPM/Coex opcode/type definitions */
366b7d5e03cSMatthew Dillon enum {
367b7d5e03cSMatthew Dillon     MCI_GPM_COEX_W_GPM_PAYLOAD      = 1,
368b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_GPM_TYPE         = 4,
369b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_GPM_OPCODE       = 5,
370b7d5e03cSMatthew Dillon     /* MCI_GPM_WLAN_CAL_REQ, MCI_GPM_WLAN_CAL_DONE */
371b7d5e03cSMatthew Dillon     MCI_GPM_WLAN_CAL_W_SEQUENCE     = 2,
372b7d5e03cSMatthew Dillon     /* MCI_GPM_COEX_VERSION_QUERY */
373b7d5e03cSMatthew Dillon     /* MCI_GPM_COEX_VERSION_RESPONSE */
374b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_MAJOR_VERSION    = 6,
375b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_MINOR_VERSION    = 7,
376b7d5e03cSMatthew Dillon     /* MCI_GPM_COEX_STATUS_QUERY */
377b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_BT_BITMAP        = 6,
378b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_WLAN_BITMAP      = 7,
379b7d5e03cSMatthew Dillon     /* MCI_GPM_COEX_HALT_BT_GPM */
380b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_HALT_STATE       = 6,
381b7d5e03cSMatthew Dillon     /* MCI_GPM_COEX_WLAN_CHANNELS */
382b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_CHANNEL_MAP      = 6,
383b7d5e03cSMatthew Dillon     /* MCI_GPM_COEX_BT_PROFILE_INFO */
384b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_PROFILE_TYPE     = 6,
385b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_PROFILE_LINKID   = 7,
386b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_PROFILE_STATE    = 8,
387b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_PROFILE_ROLE     = 9,
388b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_PROFILE_RATE     = 10,
389b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_PROFILE_VOTYPE   = 11,
390b7d5e03cSMatthew Dillon     MCI_GPM_COEX_H_PROFILE_T        = 12,
391b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_PROFILE_W        = 14,
392b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_PROFILE_A        = 15,
393b7d5e03cSMatthew Dillon     /* MCI_GPM_COEX_BT_STATUS_UPDATE */
394b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_STATUS_TYPE      = 6,
395b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_STATUS_LINKID    = 7,
396b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_STATUS_STATE     = 8,
397b7d5e03cSMatthew Dillon     /* MCI_GPM_COEX_BT_UPDATE_FLAGS */
398b7d5e03cSMatthew Dillon     MCI_GPM_COEX_B_BT_FLAGS_OP      = 10,
399b7d5e03cSMatthew Dillon     MCI_GPM_COEX_W_BT_FLAGS         = 6
400b7d5e03cSMatthew Dillon };
401b7d5e03cSMatthew Dillon 
402b7d5e03cSMatthew Dillon #define MCI_GPM_RECYCLE(_p_gpm) \
403b7d5e03cSMatthew Dillon     {                           \
404b7d5e03cSMatthew Dillon         *(((u_int32_t *)(_p_gpm)) + MCI_GPM_COEX_W_GPM_PAYLOAD) = MCI_GPM_RSVD_PATTERN32; \
405b7d5e03cSMatthew Dillon     }
406b7d5e03cSMatthew Dillon #define MCI_GPM_TYPE(_p_gpm)    \
407b7d5e03cSMatthew Dillon     (*(((u_int8_t *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_TYPE) & 0xff)
408b7d5e03cSMatthew Dillon #define MCI_GPM_OPCODE(_p_gpm)  \
409b7d5e03cSMatthew Dillon     (*(((u_int8_t *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_OPCODE) & 0xff)
410b7d5e03cSMatthew Dillon 
411b7d5e03cSMatthew Dillon #define MCI_GPM_SET_CAL_TYPE(_p_gpm, _cal_type)             \
412b7d5e03cSMatthew Dillon     {                                                       \
413b7d5e03cSMatthew Dillon         *(((u_int8_t *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_TYPE) = (_cal_type) & 0xff; \
414b7d5e03cSMatthew Dillon     }
415b7d5e03cSMatthew Dillon #define MCI_GPM_SET_TYPE_OPCODE(_p_gpm, _type, _opcode)     \
416b7d5e03cSMatthew Dillon     {                                                       \
417b7d5e03cSMatthew Dillon         *(((u_int8_t *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_TYPE) = (_type) & 0xff;     \
418b7d5e03cSMatthew Dillon         *(((u_int8_t *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_OPCODE) = (_opcode) & 0xff;   \
419b7d5e03cSMatthew Dillon     }
420b7d5e03cSMatthew Dillon #define MCI_GPM_IS_CAL_TYPE(_type) ((_type) <= MCI_GPM_WLAN_CAL_DONE)
421b7d5e03cSMatthew Dillon 
422b7d5e03cSMatthew Dillon #define MCI_NUM_BT_CHANNELS     79
423b7d5e03cSMatthew Dillon 
424b7d5e03cSMatthew Dillon #define MCI_GPM_SET_CHANNEL_BIT(_p_gpm, _bt_chan)                   \
425b7d5e03cSMatthew Dillon     {                                                               \
426b7d5e03cSMatthew Dillon         if (_bt_chan < MCI_NUM_BT_CHANNELS) {                       \
427b7d5e03cSMatthew Dillon             *(((u_int8_t *)(_p_gpm)) + MCI_GPM_COEX_B_CHANNEL_MAP + \
428b7d5e03cSMatthew Dillon                 (_bt_chan / 8)) |= 1 << (_bt_chan & 7);             \
429b7d5e03cSMatthew Dillon         }                                                           \
430b7d5e03cSMatthew Dillon     }
431b7d5e03cSMatthew Dillon 
432b7d5e03cSMatthew Dillon #define MCI_GPM_CLR_CHANNEL_BIT(_p_gpm, _bt_chan)                   \
433b7d5e03cSMatthew Dillon     {                                                               \
434b7d5e03cSMatthew Dillon         if (_bt_chan < MCI_NUM_BT_CHANNELS) {                       \
435b7d5e03cSMatthew Dillon             *(((u_int8_t *)(_p_gpm)) + MCI_GPM_COEX_B_CHANNEL_MAP + \
436b7d5e03cSMatthew Dillon                 (_bt_chan / 8)) &= ~(1 << (_bt_chan & 7));          \
437b7d5e03cSMatthew Dillon         }                                                           \
438b7d5e03cSMatthew Dillon     }
439b7d5e03cSMatthew Dillon 
440b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_SW_MSG_DONE            0x00000001
441b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_CPU_INT_MSG            0x00000002
442b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_CHKSUM_FAIL         0x00000004
443b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_INVALID_HDR         0x00000008
444b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_HW_MSG_FAIL         0x00000010
445b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_SW_MSG_FAIL         0x00000020
446b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_TX_HW_MSG_FAIL         0x00000080
447b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_TX_SW_MSG_FAIL         0x00000100
448b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG                 0x00000200
449b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_REMOTE_SLEEP_UPDATE    0x00000400
450b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_CONT_INFO_TIMEOUT      0x80000000
451b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_MSG_FAIL_MASK ( HAL_MCI_INTERRUPT_RX_HW_MSG_FAIL | \
452b7d5e03cSMatthew Dillon                                           HAL_MCI_INTERRUPT_RX_SW_MSG_FAIL | \
453b7d5e03cSMatthew Dillon                                           HAL_MCI_INTERRUPT_TX_HW_MSG_FAIL | \
454b7d5e03cSMatthew Dillon                                           HAL_MCI_INTERRUPT_TX_SW_MSG_FAIL )
455b7d5e03cSMatthew Dillon 
456b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG_REMOTE_RESET    0x00000001
457b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG_LNA_CONTROL     0x00000002
458b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG_CONT_NACK       0x00000004
459b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG_CONT_INFO       0x00000008
460b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG_CONT_RST        0x00000010
461b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG_SCHD_INFO       0x00000020
462b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG_CPU_INT         0x00000040
463b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG_GPM             0x00000100
464b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG_LNA_INFO        0x00000200
465b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG_SYS_SLEEPING    0x00000400
466b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG_SYS_WAKING      0x00000800
467b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG_REQ_WAKE        0x00001000
468b7d5e03cSMatthew Dillon #define HAL_MCI_INTERRUPT_RX_MSG_MONITOR         (HAL_MCI_INTERRUPT_RX_MSG_LNA_CONTROL | \
469b7d5e03cSMatthew Dillon                                                   HAL_MCI_INTERRUPT_RX_MSG_LNA_INFO    | \
470b7d5e03cSMatthew Dillon                                                   HAL_MCI_INTERRUPT_RX_MSG_CONT_NACK   | \
471b7d5e03cSMatthew Dillon                                                   HAL_MCI_INTERRUPT_RX_MSG_CONT_INFO   | \
472b7d5e03cSMatthew Dillon                                                   HAL_MCI_INTERRUPT_RX_MSG_CONT_RST)
473b7d5e03cSMatthew Dillon 
474b7d5e03cSMatthew Dillon typedef enum mci_bt_state {
475b7d5e03cSMatthew Dillon     MCI_BT_SLEEP,
476b7d5e03cSMatthew Dillon     MCI_BT_AWAKE,
477b7d5e03cSMatthew Dillon     MCI_BT_CAL_START,
478b7d5e03cSMatthew Dillon     MCI_BT_CAL
479b7d5e03cSMatthew Dillon } MCI_BT_STATE_T;
480b7d5e03cSMatthew Dillon 
481b7d5e03cSMatthew Dillon /* Type of state query */
482b7d5e03cSMatthew Dillon typedef enum mci_state_type {
483b7d5e03cSMatthew Dillon     HAL_MCI_STATE_ENABLE,
484b7d5e03cSMatthew Dillon     HAL_MCI_STATE_INIT_GPM_OFFSET,
485b7d5e03cSMatthew Dillon     HAL_MCI_STATE_NEXT_GPM_OFFSET,
486b7d5e03cSMatthew Dillon     HAL_MCI_STATE_LAST_GPM_OFFSET,
487b7d5e03cSMatthew Dillon     HAL_MCI_STATE_BT,
488b7d5e03cSMatthew Dillon     HAL_MCI_STATE_SET_BT_SLEEP,
489b7d5e03cSMatthew Dillon     HAL_MCI_STATE_SET_BT_AWAKE,
490b7d5e03cSMatthew Dillon     HAL_MCI_STATE_SET_BT_CAL_START,
491b7d5e03cSMatthew Dillon     HAL_MCI_STATE_SET_BT_CAL,
492b7d5e03cSMatthew Dillon     HAL_MCI_STATE_LAST_SCHD_MSG_OFFSET,
493b7d5e03cSMatthew Dillon     HAL_MCI_STATE_REMOTE_SLEEP,
494b7d5e03cSMatthew Dillon     HAL_MCI_STATE_CONT_RSSI_POWER,
495b7d5e03cSMatthew Dillon     HAL_MCI_STATE_CONT_PRIORITY,
496b7d5e03cSMatthew Dillon     HAL_MCI_STATE_CONT_TXRX,
497b7d5e03cSMatthew Dillon     HAL_MCI_STATE_RESET_REQ_WAKE,
498b7d5e03cSMatthew Dillon     HAL_MCI_STATE_SEND_WLAN_COEX_VERSION,
499b7d5e03cSMatthew Dillon     HAL_MCI_STATE_SET_BT_COEX_VERSION,
500b7d5e03cSMatthew Dillon     HAL_MCI_STATE_SEND_WLAN_CHANNELS,
501b7d5e03cSMatthew Dillon     HAL_MCI_STATE_SEND_VERSION_QUERY,
502b7d5e03cSMatthew Dillon     HAL_MCI_STATE_SEND_STATUS_QUERY,
503b7d5e03cSMatthew Dillon     HAL_MCI_STATE_NEED_FLUSH_BT_INFO,
504b7d5e03cSMatthew Dillon     HAL_MCI_STATE_SET_CONCUR_TX_PRI,
505b7d5e03cSMatthew Dillon     HAL_MCI_STATE_RECOVER_RX,
506b7d5e03cSMatthew Dillon     HAL_MCI_STATE_NEED_FTP_STOMP,
507b7d5e03cSMatthew Dillon     HAL_MCI_STATE_NEED_TUNING,
508b7d5e03cSMatthew Dillon     HAL_MCI_STATE_SHARED_CHAIN_CONCUR_TX,
509b7d5e03cSMatthew Dillon     HAL_MCI_STATE_DEBUG,
510b7d5e03cSMatthew Dillon     HAL_MCI_STATE_MAX
511b7d5e03cSMatthew Dillon } HAL_MCI_STATE_TYPE;
512b7d5e03cSMatthew Dillon 
513b7d5e03cSMatthew Dillon #define HAL_MCI_STATE_DEBUG_REQ_BT_DEBUG    1
514b7d5e03cSMatthew Dillon 
515b7d5e03cSMatthew Dillon #define HAL_MCI_BT_MCI_FLAGS_UPDATE_CORR          0x00000002
516b7d5e03cSMatthew Dillon #define HAL_MCI_BT_MCI_FLAGS_UPDATE_HDR           0x00000004
517b7d5e03cSMatthew Dillon #define HAL_MCI_BT_MCI_FLAGS_UPDATE_PLD           0x00000008
518b7d5e03cSMatthew Dillon #define HAL_MCI_BT_MCI_FLAGS_LNA_CTRL             0x00000010
519b7d5e03cSMatthew Dillon #define HAL_MCI_BT_MCI_FLAGS_DEBUG                0x00000020
520b7d5e03cSMatthew Dillon #define HAL_MCI_BT_MCI_FLAGS_SCHED_MSG            0x00000040
521b7d5e03cSMatthew Dillon #define HAL_MCI_BT_MCI_FLAGS_CONT_MSG             0x00000080
522b7d5e03cSMatthew Dillon #define HAL_MCI_BT_MCI_FLAGS_COEX_GPM             0x00000100
523b7d5e03cSMatthew Dillon #define HAL_MCI_BT_MCI_FLAGS_CPU_INT_MSG          0x00000200
524b7d5e03cSMatthew Dillon #define HAL_MCI_BT_MCI_FLAGS_MCI_MODE             0x00000400
525b7d5e03cSMatthew Dillon #define HAL_MCI_BT_MCI_FLAGS_EGRET_MODE           0x00000800
526b7d5e03cSMatthew Dillon #define HAL_MCI_BT_MCI_FLAGS_JUPITER_MODE         0x00001000
527b7d5e03cSMatthew Dillon #define HAL_MCI_BT_MCI_FLAGS_OTHER                0x00010000
528b7d5e03cSMatthew Dillon 
529b7d5e03cSMatthew Dillon #define HAL_MCI_DEFAULT_BT_MCI_FLAGS        0x00011dde
530b7d5e03cSMatthew Dillon /*
531b7d5e03cSMatthew Dillon     HAL_MCI_BT_MCI_FLAGS_UPDATE_CORR  = 1
532b7d5e03cSMatthew Dillon     HAL_MCI_BT_MCI_FLAGS_UPDATE_HDR   = 1
533b7d5e03cSMatthew Dillon     HAL_MCI_BT_MCI_FLAGS_UPDATE_PLD   = 1
534b7d5e03cSMatthew Dillon     HAL_MCI_BT_MCI_FLAGS_LNA_CTRL     = 1
535b7d5e03cSMatthew Dillon     HAL_MCI_BT_MCI_FLAGS_DEBUG        = 0
536b7d5e03cSMatthew Dillon     HAL_MCI_BT_MCI_FLAGS_SCHED_MSG    = 1
537b7d5e03cSMatthew Dillon     HAL_MCI_BT_MCI_FLAGS_CONT_MSG     = 1
538b7d5e03cSMatthew Dillon     HAL_MCI_BT_MCI_FLAGS_COEX_GPM     = 1
539b7d5e03cSMatthew Dillon     HAL_MCI_BT_MCI_FLAGS_CPU_INT_MSG  = 0
540b7d5e03cSMatthew Dillon     HAL_MCI_BT_MCI_FLAGS_MCI_MODE     = 1
541b7d5e03cSMatthew Dillon     HAL_MCI_BT_MCI_FLAGS_EGRET_MODE   = 1
542b7d5e03cSMatthew Dillon     HAL_MCI_BT_MCI_FLAGS_JUPITER_MODE = 1
543b7d5e03cSMatthew Dillon     HAL_MCI_BT_MCI_FLAGS_OTHER        = 1
544b7d5e03cSMatthew Dillon */
545b7d5e03cSMatthew Dillon 
546b7d5e03cSMatthew Dillon #define HAL_MCI_TOGGLE_BT_MCI_FLAGS \
547b7d5e03cSMatthew Dillon     (   HAL_MCI_BT_MCI_FLAGS_UPDATE_CORR    |   \
548b7d5e03cSMatthew Dillon         HAL_MCI_BT_MCI_FLAGS_UPDATE_HDR     |   \
549b7d5e03cSMatthew Dillon         HAL_MCI_BT_MCI_FLAGS_UPDATE_PLD     |   \
550b7d5e03cSMatthew Dillon         HAL_MCI_BT_MCI_FLAGS_MCI_MODE   )
551b7d5e03cSMatthew Dillon 
552b7d5e03cSMatthew Dillon #define HAL_MCI_2G_FLAGS_CLEAR_MASK         0x00000000
553b7d5e03cSMatthew Dillon #define HAL_MCI_2G_FLAGS_SET_MASK           HAL_MCI_TOGGLE_BT_MCI_FLAGS
554b7d5e03cSMatthew Dillon #define HAL_MCI_2G_FLAGS                    HAL_MCI_DEFAULT_BT_MCI_FLAGS
555b7d5e03cSMatthew Dillon 
556b7d5e03cSMatthew Dillon #define HAL_MCI_5G_FLAGS_CLEAR_MASK         HAL_MCI_TOGGLE_BT_MCI_FLAGS
557b7d5e03cSMatthew Dillon #define HAL_MCI_5G_FLAGS_SET_MASK           0x00000000
558b7d5e03cSMatthew Dillon #define HAL_MCI_5G_FLAGS                    (HAL_MCI_DEFAULT_BT_MCI_FLAGS & \
559b7d5e03cSMatthew Dillon                                             ~HAL_MCI_TOGGLE_BT_MCI_FLAGS)
560b7d5e03cSMatthew Dillon 
561b7d5e03cSMatthew Dillon #define HAL_MCI_GPM_NOMORE  0
562b7d5e03cSMatthew Dillon #define HAL_MCI_GPM_MORE    1
563b7d5e03cSMatthew Dillon #define HAL_MCI_GPM_INVALID 0xffffffff
564b7d5e03cSMatthew Dillon 
565b7d5e03cSMatthew Dillon #define ATH_AIC_MAX_BT_CHANNEL          79
566b7d5e03cSMatthew Dillon 
567b7d5e03cSMatthew Dillon /*
568b7d5e03cSMatthew Dillon  * Default value for Jupiter   is 0x00002201
569b7d5e03cSMatthew Dillon  * Default value for Aphrodite is 0x00002282
570b7d5e03cSMatthew Dillon  */
571b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_CONCUR_TX            0x00000003
572b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_MCI_OBS_MCI          0x00000004
573b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_MCI_OBS_TXRX         0x00000008
574b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_MCI_OBS_BT           0x00000010
575b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_DISABLE_MCI_CAL      0x00000020
576b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_DISABLE_OSLA         0x00000040
577b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_DISABLE_FTP_STOMP    0x00000080
578b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_AGGR_THRESH          0x00000700
579b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_AGGR_THRESH_S        8
580b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_DISABLE_AGGR_THRESH  0x00000800
581b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_CLK_DIV              0x00003000
582b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_CLK_DIV_S            12
583b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_DISABLE_TUNING       0x00004000
584b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_MCI_WEIGHT_DBG       0x40000000
585b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_DISABLE_MCI          0x80000000
586b7d5e03cSMatthew Dillon 
587b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_MCI_OBS_MASK     ( ATH_MCI_CONFIG_MCI_OBS_MCI | \
588b7d5e03cSMatthew Dillon                                           ATH_MCI_CONFIG_MCI_OBS_TXRX | \
589b7d5e03cSMatthew Dillon                                           ATH_MCI_CONFIG_MCI_OBS_BT )
590b7d5e03cSMatthew Dillon #define ATH_MCI_CONFIG_MCI_OBS_GPIO     0x0000002F
591b7d5e03cSMatthew Dillon 
592b7d5e03cSMatthew Dillon #define ATH_MCI_CONCUR_TX_SHARED_CHN    0x01
593b7d5e03cSMatthew Dillon #define ATH_MCI_CONCUR_TX_UNSHARED_CHN  0x02
594b7d5e03cSMatthew Dillon #define ATH_MCI_CONCUR_TX_DEBUG         0x03
595b7d5e03cSMatthew Dillon 
596b7d5e03cSMatthew Dillon /*
597b7d5e03cSMatthew Dillon  * The values below come from the system team test result.
598b7d5e03cSMatthew Dillon  * For Jupiter, BT tx power level is from 0(-20dBm) to 6(4dBm).
599b7d5e03cSMatthew Dillon  * Lowest WLAN tx power would be in bit[23:16] of dword 1.
600b7d5e03cSMatthew Dillon  */
601b7d5e03cSMatthew Dillon static const u_int32_t mci_concur_tx_max_pwr[4][8] =
602b7d5e03cSMatthew Dillon     { /* No limit */
603b7d5e03cSMatthew Dillon       {0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f,
604b7d5e03cSMatthew Dillon        0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f},
605b7d5e03cSMatthew Dillon       /* 11G */
606b7d5e03cSMatthew Dillon       {0x16161616, 0x12121516, 0x12121212, 0x12121212,
607b7d5e03cSMatthew Dillon        0x12121212, 0x12121212, 0x12121212, 0x7f121212},
608b7d5e03cSMatthew Dillon       /* HT20 */
609b7d5e03cSMatthew Dillon       {0x15151515, 0x14141515, 0x14141414, 0x14141414,
610b7d5e03cSMatthew Dillon        0x14141414, 0x14141414, 0x14141414, 0x7f141414},
611b7d5e03cSMatthew Dillon       /* HT40 */
612b7d5e03cSMatthew Dillon       {0x10101010, 0x10101010, 0x10101010, 0x10101010,
613b7d5e03cSMatthew Dillon        0x10101010, 0x10101010, 0x10101010, 0x7f101010}};
614b7d5e03cSMatthew Dillon #define ATH_MCI_CONCUR_TX_LOWEST_PWR_MASK     0x00ff0000
615b7d5e03cSMatthew Dillon #define ATH_MCI_CONCUR_TX_LOWEST_PWR_MASK_S   16
616b7d5e03cSMatthew Dillon 
617b7d5e03cSMatthew Dillon #endif	/* __AR9300_FREEBSD_INC_H__ */
618