2 * Copyright (c) 2014 Qualcomm Atheros, Inc.
3 * Copyright (c) 2016 Adrian Chadd <adrian@FreeBSD.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer,
11 * without modification.
12 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
13 * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
14 * redistribution must be conditioned upon including a substantially
15 * similar Disclaimer requirement for further binary redistribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
21 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
23 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
26 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGES.
32 #include <sys/cdefs.h>
33 __FBSDID("$FreeBSD$");
36 * This implements the MCI bluetooth coexistence handling.
42 #include <sys/param.h>
43 #include <sys/systm.h>
44 #include <sys/sysctl.h>
45 #include <sys/kernel.h>
47 #include <sys/malloc.h>
48 #include <sys/mutex.h>
49 #include <sys/errno.h>
51 #include <machine/bus.h>
52 #include <machine/resource.h>
56 #include <sys/socket.h>
59 #include <net/if_var.h>
60 #include <net/if_media.h>
61 #include <net/if_arp.h>
62 #include <net/ethernet.h> /* XXX for ether_sprintf */
64 #include <net80211/ieee80211_var.h>
69 #include <netinet/in.h>
70 #include <netinet/if_ether.h>
73 #include <dev/ath/if_athvar.h>
74 #include <dev/ath/if_ath_debug.h>
75 #include <dev/ath/if_ath_descdma.h>
76 #include <dev/ath/if_ath_btcoex.h>
78 #include <dev/ath/if_ath_btcoex_mci.h>
80 MALLOC_DECLARE(M_ATHDEV);
82 #define ATH_MCI_GPM_MAX_ENTRY 16
83 #define ATH_MCI_GPM_BUF_SIZE (ATH_MCI_GPM_MAX_ENTRY * 16)
84 #define ATH_MCI_SCHED_BUF_SIZE (16 * 16) /* 16 entries, 4 dword each */
86 static void ath_btcoex_mci_update_wlan_channels(struct ath_softc *sc);
89 ath_btcoex_mci_attach(struct ath_softc *sc)
93 buflen = ATH_MCI_GPM_BUF_SIZE + ATH_MCI_SCHED_BUF_SIZE;
94 error = ath_descdma_alloc_desc(sc, &sc->sc_btcoex.buf, NULL,
95 "MCI bufs", buflen, 1);
97 device_printf(sc->sc_dev, "%s: failed to alloc MCI RAM\n",
102 /* Yes, we're going to do bluetooth MCI coex */
103 sc->sc_btcoex_mci = 1;
105 /* Initialise the wlan channel mapping */
106 sc->sc_btcoex.wlan_channels[0] = 0x00000000;
107 sc->sc_btcoex.wlan_channels[1] = 0xffffffff;
108 sc->sc_btcoex.wlan_channels[2] = 0xffffffff;
109 sc->sc_btcoex.wlan_channels[3] = 0x7fffffff;
112 * Ok, so the API is a bit odd. It assumes sched_addr is
113 * after gpm_addr, and it does math to figure out the right
116 * So, set gpm_addr to buf, sched_addr to gpm_addr + ATH_MCI_GPM_BUF_SIZE,
117 * the HAL call with do (gpm_buf + (sched_addr - gpm_addr)) to
118 * set sched_buf, and we're "golden".
120 * Note, it passes in 'len' here (gpm_len) as
121 * ATH_MCI_GPM_BUF_SIZE >> 4. My guess is that it's 16
122 * bytes per entry and we're storing 16 entries.
124 sc->sc_btcoex.gpm_buf = (void *) sc->sc_btcoex.buf.dd_desc;
125 sc->sc_btcoex.sched_buf = sc->sc_btcoex.gpm_buf +
126 ATH_MCI_GPM_BUF_SIZE;
128 sc->sc_btcoex.gpm_paddr = sc->sc_btcoex.buf.dd_desc_paddr;
129 sc->sc_btcoex.sched_paddr = sc->sc_btcoex.gpm_paddr +
130 ATH_MCI_GPM_BUF_SIZE;
132 /* memset the gpm buffer with MCI_GPM_RSVD_PATTERN */
133 memset(sc->sc_btcoex.gpm_buf, 0xfe, buflen);
136 * This is an unfortunate x86'ism in the HAL - the
137 * HAL code expects the passed in buffer to be
138 * coherent, and doesn't implement /any/ kind
139 * of buffer sync operations at all.
141 * So, this code will only work on dma coherent buffers
142 * and will behave poorly on non-coherent systems.
143 * Fixing this would require some HAL surgery so it
144 * actually /did/ the buffer flushing as appropriate.
146 ath_hal_btcoex_mci_setup(sc->sc_ah,
147 sc->sc_btcoex.gpm_paddr,
148 sc->sc_btcoex.gpm_buf,
149 ATH_MCI_GPM_BUF_SIZE >> 4,
150 sc->sc_btcoex.sched_paddr);
156 * Detach btcoex from the given interface
159 ath_btcoex_mci_detach(struct ath_softc *sc)
162 ath_hal_btcoex_mci_detach(sc->sc_ah);
163 ath_descdma_cleanup(sc, &sc->sc_btcoex.buf, NULL);
168 * Configure or disable bluetooth coexistence on the given channel.
170 * For MCI, we just use the top-level enable/disable flag, and
171 * then the MCI reset / channel update path will configure things
172 * appropriately based on the current band.
175 ath_btcoex_mci_enable(struct ath_softc *sc,
176 const struct ieee80211_channel *chan)
180 * Always reconfigure stomp-all for now, so wlan wins.
182 * The default weights still don't allow beacons to win,
183 * so unless you set net.wlan.X.bmiss_max to something higher,
184 * net80211 will disconnect you during a HCI INQUIRY command.
186 * The longer-term solution is to dynamically adjust whether
187 * bmiss happens based on bluetooth requirements, and look at
188 * making the individual stomp bits configurable.
190 ath_hal_btcoex_set_weights(sc->sc_ah, HAL_BT_COEX_STOMP_ALL);
193 * update wlan channels so the firmware knows what channels it
196 ath_btcoex_mci_update_wlan_channels(sc);
202 * XXX TODO: turn into general btcoex, and then make this
203 * the MCI specific bits.
206 ath_btcoex_mci_event(struct ath_softc *sc, ATH_BT_COEX_EVENT nevent,
210 if (! sc->sc_btcoex_mci)
214 * Check whether we need to flush our local profile cache.
215 * If we do, then at (XXX TODO) we should flush our state,
216 * then wait for the MCI response with the updated profile list.
218 if (ath_hal_btcoex_mci_state(sc->sc_ah,
219 HAL_MCI_STATE_NEED_FLUSH_BT_INFO, NULL) != 0) {
222 if (ath_hal_btcoex_mci_state(sc->sc_ah,
223 HAL_MCI_STATE_ENABLE, NULL) != 0) {
224 DPRINTF(sc, ATH_DEBUG_BTCOEX,
225 "(MCI) Flush BT profile\n");
227 * XXX TODO: flush profile state on the ath(4)
228 * driver side; subsequent messages will come
229 * through with the current list of active
232 ath_hal_btcoex_mci_state(sc->sc_ah,
233 HAL_MCI_STATE_NEED_FLUSH_BT_INFO, &data);
234 ath_hal_btcoex_mci_state(sc->sc_ah,
235 HAL_MCI_STATE_SEND_STATUS_QUERY, NULL);
238 if (nevent == ATH_COEX_EVENT_BT_NOOP) {
239 DPRINTF(sc, ATH_DEBUG_BTCOEX, "(MCI) BT_NOOP\n");
245 ath_btcoex_mci_send_gpm(struct ath_softc *sc, uint32_t *payload)
248 ath_hal_btcoex_mci_send_message(sc->sc_ah, MCI_GPM, 0, payload, 16,
253 * This starts a BT calibration. It requires a chip reset.
256 ath_btcoex_mci_bt_cal_do(struct ath_softc *sc, int tx_timeout, int rx_timeout)
259 device_printf(sc->sc_dev, "%s: TODO!\n", __func__);
264 ath_btcoex_mci_cal_msg(struct ath_softc *sc, uint8_t opcode,
267 uint32_t payload[4] = {0, 0, 0, 0};
270 case MCI_GPM_BT_CAL_REQ:
271 DPRINTF(sc, ATH_DEBUG_BTCOEX, "(MCI) receive BT_CAL_REQ\n");
272 if (ath_hal_btcoex_mci_state(sc->sc_ah, HAL_MCI_STATE_BT,
273 NULL) == MCI_BT_AWAKE) {
274 ath_hal_btcoex_mci_state(sc->sc_ah,
275 HAL_MCI_STATE_SET_BT_CAL_START, NULL);
276 ath_btcoex_mci_bt_cal_do(sc, 1000, 1000);
278 DPRINTF(sc, ATH_DEBUG_BTCOEX,
279 "(MCI) State mismatches: %d\n",
280 ath_hal_btcoex_mci_state(sc->sc_ah,
281 HAL_MCI_STATE_BT, NULL));
284 case MCI_GPM_BT_CAL_DONE:
285 DPRINTF(sc, ATH_DEBUG_BTCOEX, "(MCI) receive BT_CAL_DONE\n");
286 if (ath_hal_btcoex_mci_state(sc->sc_ah, HAL_MCI_STATE_BT,
287 NULL) == MCI_BT_CAL) {
288 DPRINTF(sc, ATH_DEBUG_BTCOEX,
289 "(MCI) ERROR ILLEGAL!\n");
291 DPRINTF(sc, ATH_DEBUG_BTCOEX,
292 "(MCI) BT not in CAL state.\n");
295 case MCI_GPM_BT_CAL_GRANT:
296 DPRINTF(sc, ATH_DEBUG_BTCOEX, "(MCI) receive BT_CAL_GRANT\n");
297 /* Send WLAN_CAL_DONE for now */
298 DPRINTF(sc, ATH_DEBUG_BTCOEX, "(MCI) Send WLAN_CAL_DONE\n");
299 MCI_GPM_SET_CAL_TYPE(payload, MCI_GPM_WLAN_CAL_DONE);
300 ath_btcoex_mci_send_gpm(sc, &payload[0]);
303 DPRINTF(sc, ATH_DEBUG_BTCOEX,
304 "(MCI) Unknown GPM CAL message.\n");
310 * Update the bluetooth channel map.
312 * This map tells the bluetooth device which bluetooth channels
313 * are available for data.
315 * For 5GHz, all channels are available.
316 * For 2GHz, the current wifi channel range is blocked out,
317 * and the rest are available.
319 * This narrows which frequencies are used by the device when
320 * it initiates a transfer, thus hopefully reducing the chances
321 * of collisions (both hopefully on the current device and
322 * other devices in the same channel.)
325 ath_btcoex_mci_update_wlan_channels(struct ath_softc *sc)
327 struct ieee80211com *ic = &sc->sc_ic;
328 struct ieee80211_channel *chan = ic->ic_curchan;
329 uint32_t channel_info[4] =
330 { 0x00000000, 0xffffffff, 0xffffffff, 0x7fffffff };
331 int32_t wl_chan, bt_chan, bt_start = 0, bt_end = 79;
333 /* BT channel frequency is 2402 + k, k = 0 ~ 78 */
334 if (IEEE80211_IS_CHAN_2GHZ(chan)) {
335 wl_chan = chan->ic_freq - 2402;
336 if (IEEE80211_IS_CHAN_HT40U(chan)) {
337 bt_start = wl_chan - 10;
338 bt_end = wl_chan + 30;
339 } else if (IEEE80211_IS_CHAN_HT40D(chan)) {
340 bt_start = wl_chan - 30;
341 bt_end = wl_chan + 10;
344 bt_start = wl_chan - 10;
345 bt_end = wl_chan + 10;
354 if (bt_end > MCI_NUM_BT_CHANNELS) {
355 bt_end = MCI_NUM_BT_CHANNELS;
357 DPRINTF(sc, ATH_DEBUG_BTCOEX, "(MCI) WLAN use channel %d\n",
359 DPRINTF(sc, ATH_DEBUG_BTCOEX,
360 "(MCI) mask BT channel %d - %d\n", bt_start, bt_end);
361 for (bt_chan = bt_start; bt_chan < bt_end; bt_chan++) {
362 MCI_GPM_CLR_CHANNEL_BIT(&channel_info[0], bt_chan);
365 DPRINTF(sc, ATH_DEBUG_BTCOEX,
366 "(MCI) WLAN not use any 2G channel, unmask all for BT\n");
368 ath_hal_btcoex_mci_state(sc->sc_ah, HAL_MCI_STATE_SEND_WLAN_CHANNELS,
373 ath_btcoex_mci_coex_msg(struct ath_softc *sc, uint8_t opcode,
382 case MCI_GPM_COEX_VERSION_QUERY:
383 DPRINTF(sc, ATH_DEBUG_BTCOEX,
384 "(MCI) Recv GPM COEX Version Query.\n");
385 version = ath_hal_btcoex_mci_state(sc->sc_ah,
386 HAL_MCI_STATE_SEND_WLAN_COEX_VERSION, NULL);
389 case MCI_GPM_COEX_VERSION_RESPONSE:
390 DPRINTF(sc, ATH_DEBUG_BTCOEX,
391 "(MCI) Recv GPM COEX Version Response.\n");
392 major = *(rx_payload + MCI_GPM_COEX_B_MAJOR_VERSION);
393 minor = *(rx_payload + MCI_GPM_COEX_B_MINOR_VERSION);
394 DPRINTF(sc, ATH_DEBUG_BTCOEX,
395 "(MCI) BT Coex version: %d.%d\n", major, minor);
396 version = (major << 8) + minor;
397 version = ath_hal_btcoex_mci_state(sc->sc_ah,
398 HAL_MCI_STATE_SET_BT_COEX_VERSION, &version);
401 case MCI_GPM_COEX_STATUS_QUERY:
402 DPRINTF(sc, ATH_DEBUG_BTCOEX,
403 "(MCI) Recv GPM COEX Status Query = 0x%02x.\n",
404 *(rx_payload + MCI_GPM_COEX_B_WLAN_BITMAP));
405 ath_hal_btcoex_mci_state(sc->sc_ah,
406 HAL_MCI_STATE_SEND_WLAN_CHANNELS, NULL);
409 case MCI_GPM_COEX_BT_PROFILE_INFO:
411 * XXX TODO: here is where we'd parse active profile
412 * info and make driver/stack choices as appropriate.
414 DPRINTF(sc, ATH_DEBUG_BTCOEX,
415 "(MCI) TODO: Recv GPM COEX BT_Profile_Info.\n");
418 case MCI_GPM_COEX_BT_STATUS_UPDATE:
419 seq_num = *((uint32_t *)(rx_payload + 12));
420 DPRINTF(sc, ATH_DEBUG_BTCOEX,
421 "(MCI) Recv GPM COEX BT_Status_Update: SEQ=%d\n",
426 DPRINTF(sc, ATH_DEBUG_BTCOEX,
427 "(MCI) Unknown GPM COEX message = 0x%02x\n", opcode);
433 ath_btcoex_mci_intr(struct ath_softc *sc)
435 uint32_t mciInt, mciIntRxMsg;
436 uint32_t offset, subtype, opcode;
438 uint32_t more_data = HAL_MCI_GPM_MORE;
440 bool skip_gpm = false;
442 DPRINTF(sc, ATH_DEBUG_BTCOEX, "%s: called\n", __func__);
444 ath_hal_btcoex_mci_get_interrupt(sc->sc_ah, &mciInt, &mciIntRxMsg);
446 if (ath_hal_btcoex_mci_state(sc->sc_ah, HAL_MCI_STATE_ENABLE,
448 ath_hal_btcoex_mci_state(sc->sc_ah,
449 HAL_MCI_STATE_INIT_GPM_OFFSET, NULL);
450 DPRINTF(sc, ATH_DEBUG_BTCOEX,
451 "(MCI) INTR but MCI_disabled\n");
452 DPRINTF(sc, ATH_DEBUG_BTCOEX,
453 "(MCI) MCI interrupt: mciInt = 0x%x, mciIntRxMsg = 0x%x\n",
454 mciInt, mciIntRxMsg);
458 if (mciIntRxMsg & HAL_MCI_INTERRUPT_RX_MSG_REQ_WAKE) {
459 uint32_t payload4[4] = { 0xffffffff, 0xffffffff, 0xffffffff,
463 * The following REMOTE_RESET and SYS_WAKING used to sent
464 * only when BT wake up. Now they are always sent, as a
465 * recovery method to reset BT MCI's RX alignment.
467 DPRINTF(sc, ATH_DEBUG_BTCOEX,
468 "(MCI) 1. INTR Send REMOTE_RESET\n");
469 ath_hal_btcoex_mci_send_message(sc->sc_ah,
470 MCI_REMOTE_RESET, 0, payload4, 16, AH_TRUE, AH_FALSE);
471 DPRINTF(sc, ATH_DEBUG_BTCOEX,
472 "(MCI) 1. INTR Send SYS_WAKING\n");
473 ath_hal_btcoex_mci_send_message(sc->sc_ah,
474 MCI_SYS_WAKING, 0, NULL, 0, AH_TRUE, AH_FALSE);
476 mciIntRxMsg &= ~HAL_MCI_INTERRUPT_RX_MSG_REQ_WAKE;
477 ath_hal_btcoex_mci_state(sc->sc_ah,
478 HAL_MCI_STATE_RESET_REQ_WAKE, NULL);
480 /* always do this for recovery and 2G/5G toggling and LNA_TRANS */
481 DPRINTF(sc, ATH_DEBUG_BTCOEX,
482 "(MCI) 1. Set BT state to AWAKE.\n");
483 ath_hal_btcoex_mci_state(sc->sc_ah,
484 HAL_MCI_STATE_SET_BT_AWAKE, NULL);
487 /* Processing SYS_WAKING/SYS_SLEEPING */
488 if (mciIntRxMsg & HAL_MCI_INTERRUPT_RX_MSG_SYS_WAKING) {
489 mciIntRxMsg &= ~HAL_MCI_INTERRUPT_RX_MSG_SYS_WAKING;
490 if (ath_hal_btcoex_mci_state(sc->sc_ah, HAL_MCI_STATE_BT,
491 NULL) == MCI_BT_SLEEP) {
492 if (ath_hal_btcoex_mci_state(sc->sc_ah,
493 HAL_MCI_STATE_REMOTE_SLEEP, NULL) == MCI_BT_SLEEP) {
494 DPRINTF(sc, ATH_DEBUG_BTCOEX,
495 "(MCI) 2. BT stays in SLEEP mode.\n");
497 DPRINTF(sc, ATH_DEBUG_BTCOEX,
498 "(MCI) 2. Set BT state to AWAKE.\n");
499 ath_hal_btcoex_mci_state(sc->sc_ah,
500 HAL_MCI_STATE_SET_BT_AWAKE, NULL);
503 DPRINTF(sc, ATH_DEBUG_BTCOEX,
504 "(MCI) 2. BT stays in AWAKE mode.\n");
508 if (mciIntRxMsg & HAL_MCI_INTERRUPT_RX_MSG_SYS_SLEEPING) {
509 mciIntRxMsg &= ~HAL_MCI_INTERRUPT_RX_MSG_SYS_SLEEPING;
510 if (ath_hal_btcoex_mci_state(sc->sc_ah, HAL_MCI_STATE_BT,
511 NULL) == MCI_BT_AWAKE) {
512 if (ath_hal_btcoex_mci_state(sc->sc_ah,
513 HAL_MCI_STATE_REMOTE_SLEEP, NULL) == MCI_BT_AWAKE) {
514 DPRINTF(sc, ATH_DEBUG_BTCOEX,
515 "(MCI) 3. BT stays in AWAKE mode.\n");
517 DPRINTF(sc, ATH_DEBUG_BTCOEX,
518 "(MCI) 3. Set BT state to SLEEP.\n");
519 ath_hal_btcoex_mci_state(sc->sc_ah,
520 HAL_MCI_STATE_SET_BT_SLEEP, NULL);
523 DPRINTF(sc, ATH_DEBUG_BTCOEX,
524 "(MCI) 3. BT stays in SLEEP mode.\n");
529 * Recover from out-of-order / wrong-offset GPM messages.
531 if ((mciInt & HAL_MCI_INTERRUPT_RX_INVALID_HDR) ||
532 (mciInt & HAL_MCI_INTERRUPT_CONT_INFO_TIMEOUT)) {
533 DPRINTF(sc, ATH_DEBUG_BTCOEX,
534 "(MCI) MCI RX broken, skip GPM messages\n");
535 ath_hal_btcoex_mci_state(sc->sc_ah,
536 HAL_MCI_STATE_RECOVER_RX, NULL);
540 if (mciIntRxMsg & HAL_MCI_INTERRUPT_RX_MSG_SCHD_INFO) {
541 mciIntRxMsg &= ~HAL_MCI_INTERRUPT_RX_MSG_SCHD_INFO;
542 offset = ath_hal_btcoex_mci_state(sc->sc_ah,
543 HAL_MCI_STATE_LAST_SCHD_MSG_OFFSET, NULL);
547 * Parse GPM messages.
549 if (mciIntRxMsg & HAL_MCI_INTERRUPT_RX_MSG_GPM) {
550 mciIntRxMsg &= ~HAL_MCI_INTERRUPT_RX_MSG_GPM;
552 while (more_data == HAL_MCI_GPM_MORE) {
553 pGpm = (void *) sc->sc_btcoex.gpm_buf;
554 offset = ath_hal_btcoex_mci_state(sc->sc_ah,
555 HAL_MCI_STATE_NEXT_GPM_OFFSET, &more_data);
557 if (offset == HAL_MCI_GPM_INVALID)
559 pGpm += (offset >> 2);
561 * The first DWORD is a timer.
562 * The real data starts from the second DWORD.
564 subtype = MCI_GPM_TYPE(pGpm);
565 opcode = MCI_GPM_OPCODE(pGpm);
568 if (MCI_GPM_IS_CAL_TYPE(subtype)) {
569 ath_btcoex_mci_cal_msg(sc, subtype,
573 case MCI_GPM_COEX_AGENT:
574 ath_btcoex_mci_coex_msg(sc,
575 opcode, (uint8_t*) pGpm);
577 case MCI_GPM_BT_DEBUG:
578 device_printf(sc->sc_dev,
579 "(MCI) TODO: GPM_BT_DEBUG!\n");
582 DPRINTF(sc, ATH_DEBUG_BTCOEX,
583 "(MCI) Unknown GPM message.\n");
588 MCI_GPM_RECYCLE(pGpm);
593 * This is monitoring/management information messages, so the driver
594 * layer can hook in and dynamically adjust things like aggregation
595 * size, expected bluetooth/wifi traffic throughput, etc.
597 * None of that is done right now; it just passes off the values
598 * to the HAL so it can update its internal state as appropriate.
599 * This code just prints out the values for debugging purposes.
601 if (mciIntRxMsg & HAL_MCI_INTERRUPT_RX_MSG_MONITOR) {
602 if (mciIntRxMsg & HAL_MCI_INTERRUPT_RX_MSG_LNA_CONTROL) {
603 mciIntRxMsg &= ~HAL_MCI_INTERRUPT_RX_MSG_LNA_CONTROL;
604 DPRINTF(sc, ATH_DEBUG_BTCOEX, "(MCI) LNA_CONTROL\n");
606 if (mciIntRxMsg & HAL_MCI_INTERRUPT_RX_MSG_LNA_INFO) {
607 mciIntRxMsg &= ~HAL_MCI_INTERRUPT_RX_MSG_LNA_INFO;
608 DPRINTF(sc, ATH_DEBUG_BTCOEX, "(MCI) LNA_INFO\n");
610 if (mciIntRxMsg & HAL_MCI_INTERRUPT_RX_MSG_CONT_INFO) {
611 value_dbm = ath_hal_btcoex_mci_state(sc->sc_ah,
612 HAL_MCI_STATE_CONT_RSSI_POWER, NULL);
614 mciIntRxMsg &= ~HAL_MCI_INTERRUPT_RX_MSG_CONT_INFO;
615 if (ath_hal_btcoex_mci_state(sc->sc_ah,
616 HAL_MCI_STATE_CONT_TXRX, NULL)) {
617 DPRINTF(sc, ATH_DEBUG_BTCOEX,
618 "(MCI) CONT_INFO: (tx) pri = %d, pwr = %d dBm\n",
619 ath_hal_btcoex_mci_state(sc->sc_ah,
620 HAL_MCI_STATE_CONT_PRIORITY, NULL),
623 DPRINTF(sc, ATH_DEBUG_BTCOEX,
624 "(MCI) CONT_INFO: (rx) pri = %d, rssi = %d dBm\n",
625 ath_hal_btcoex_mci_state(sc->sc_ah,
626 HAL_MCI_STATE_CONT_PRIORITY, NULL),
630 if (mciIntRxMsg & HAL_MCI_INTERRUPT_RX_MSG_CONT_NACK) {
631 mciIntRxMsg &= ~HAL_MCI_INTERRUPT_RX_MSG_CONT_NACK;
632 DPRINTF(sc, ATH_DEBUG_BTCOEX, "(MCI) CONT_NACK\n");
634 if (mciIntRxMsg & HAL_MCI_INTERRUPT_RX_MSG_CONT_RST) {
635 mciIntRxMsg &= ~HAL_MCI_INTERRUPT_RX_MSG_CONT_RST;
636 DPRINTF(sc, ATH_DEBUG_BTCOEX, "(MCI) CONT_RST\n");
641 * Recover the state engine if we hit an invalid header/timeout.
642 * This is the final part of GPT out-of-sync recovery.
644 if ((mciInt & HAL_MCI_INTERRUPT_RX_INVALID_HDR) ||
645 (mciInt & HAL_MCI_INTERRUPT_CONT_INFO_TIMEOUT)) {
646 ath_btcoex_mci_event(sc, ATH_COEX_EVENT_BT_NOOP, NULL);
647 mciInt &= ~(HAL_MCI_INTERRUPT_RX_INVALID_HDR |
648 HAL_MCI_INTERRUPT_CONT_INFO_TIMEOUT);
651 if (mciIntRxMsg & 0xfffffffe) {
652 DPRINTF(sc, ATH_DEBUG_BTCOEX,
653 "(MCI) Not processed IntRxMsg = 0x%x\n", mciIntRxMsg);