29 #include <linux/sched.h>
30 #include <linux/wait.h>
139 if (trans->
cfg->base_params->shadow_reg_enable) {
154 "Rx queue requesting wakeup,"
155 " GP1 = 0x%x\n", reg);
176 spin_unlock_irqrestore(&q->
lock, flags);
218 while ((iwl_rx_queue_space(rxq) > 0) && (rxq->
free_count)) {
234 spin_unlock_irqrestore(&rxq->
lock, flags);
245 spin_unlock_irqrestore(&rxq->
lock, flags);
271 if (list_empty(&rxq->
rx_used)) {
272 spin_unlock_irqrestore(&rxq->
lock, flags);
275 spin_unlock_irqrestore(&rxq->
lock, flags);
293 IWL_CRIT(trans,
"Failed to alloc_pages with %s."
294 "Only %u free buffers remaining.\n",
296 "GFP_ATOMIC" :
"GFP_KERNEL",
306 if (list_empty(&rxq->
rx_used)) {
307 spin_unlock_irqrestore(&rxq->
lock, flags);
315 spin_unlock_irqrestore(&rxq->
lock, flags);
328 spin_unlock_irqrestore(&rxq->
lock, flags);
342 spin_unlock_irqrestore(&rxq->
lock, flags);
362 iwl_rx_queue_restock(trans);
363 spin_unlock_irqrestore(&trans_pcie->
irq_lock, flags);
366 static void iwl_rx_replenish_now(
struct iwl_trans *trans)
370 iwl_rx_queue_restock(trans);
381 static void iwl_rx_handle_rxbuf(
struct iwl_trans *trans,
388 bool page_stolen =
false;
406 ._page_stolen =
false,
417 trans_pcie_get_cmd_string(trans_pcie, pkt->
hdr.cmd),
422 trace_iwlwifi_dev_rx(trans->
dev, pkt, len);
445 cmd_index = get_cmd_index(&txq->
q, index);
449 ent = &txq->
entries[cmd_index];
456 err = iwl_op_mode_rx(trans->
op_mode, &rxcb, cmd);
477 IWL_WARN(trans,
"Claim null rxb?\n");
514 spin_unlock_irqrestore(&rxq->
lock, flags);
524 static void iwl_rx_handle(
struct iwl_trans *trans)
558 iwl_rx_handle_rxbuf(trans, rxb);
567 iwl_rx_replenish_now(trans);
576 iwl_rx_replenish_now(trans);
578 iwl_rx_queue_restock(trans);
584 static void iwl_irq_handle_error(
struct iwl_trans *trans)
587 if (trans->
cfg->internal_wimax_coex &&
596 iwl_op_mode_wimax_active(trans->
op_mode);
604 iwl_op_mode_nic_error(trans->
op_mode);
616 #ifdef CONFIG_IWLWIFI_DEBUG
636 inta = trans_pcie->
inta;
638 #ifdef CONFIG_IWLWIFI_DEBUG
648 trans_pcie->
inta = 0;
650 spin_unlock_irqrestore(&trans_pcie->
irq_lock, flags);
654 IWL_ERR(trans,
"Hardware error detected. Restarting.\n");
657 iwl_disable_interrupts(trans);
660 iwl_irq_handle_error(trans);
667 #ifdef CONFIG_IWLWIFI_DEBUG
672 "the frame/frames.\n");
690 hw_rfkill = iwl_is_rfkill_set(trans);
691 IWL_WARN(trans,
"RF_KILL bit toggled to %s.\n",
692 hw_rfkill ?
"disable radio" :
"enable radio");
696 iwl_op_mode_hw_rf_kill(trans->
op_mode, hw_rfkill);
703 IWL_ERR(trans,
"Microcode CT kill error detected.\n");
710 IWL_ERR(trans,
"Microcode SW error detected. "
711 " Restarting 0x%X.\n", inta);
713 iwl_irq_handle_error(trans);
721 for (i = 0; i < trans->
cfg->base_params->num_of_queues; i++)
723 &trans_pcie->
txq[i]);
744 CSR_INT, CSR_INT_BIT_RX_PERIODIC);
761 iwl_rx_handle(trans);
788 if (inta & ~handled) {
789 IWL_ERR(trans,
"Unhandled INTA bits 0x%08x\n", inta & ~handled);
794 IWL_WARN(trans,
"Disabled INTA bits 0x%08x were pending\n",
801 iwl_enable_interrupts(trans);
803 else if (handled & CSR_INT_BIT_RF_KILL)
804 iwl_enable_rfkill_int(trans);
815 #define ICT_SIZE (1 << ICT_SHIFT)
816 #define ICT_COUNT (ICT_SIZE / sizeof(u32))
882 iwl_disable_interrupts(trans);
897 iwl_enable_interrupts(trans);
898 spin_unlock_irqrestore(&trans_pcie->
irq_lock, flags);
909 spin_unlock_irqrestore(&trans_pcie->
irq_lock, flags);
918 #ifdef CONFIG_IWLWIFI_DEBUG
924 trace_iwlwifi_dev_irq(trans->
dev);
934 inta = iwl_read32(trans,
CSR_INT);
944 if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) {
947 IWL_WARN(trans,
"HARDWARE GONE?? INTA == 0x%08x\n", inta);
951 #ifdef CONFIG_IWLWIFI_DEBUG
952 if (iwl_have_debug_level(IWL_DL_ISR)) {
955 "fh 0x%08x\n", inta, inta_mask, inta_fh);
965 iwl_enable_interrupts(trans);
972 iwl_enable_interrupts(trans);
1006 spin_unlock_irqrestore(&trans_pcie->
irq_lock, flags);
1010 trace_iwlwifi_dev_irq(trans->
dev);
1026 trace_iwlwifi_dev_ict_read(trans->
dev, trans_pcie->
ict_index, read);
1045 trace_iwlwifi_dev_ict_read(trans->
dev, trans_pcie->
ict_index,
1050 if (val == 0xffffffff)
1063 inta = (0xff &
val) | ((0xff00 & val) << 16);
1064 IWL_DEBUG_ISR(trans,
"ISR inta 0x%08x, enabled 0x%08x ict 0x%08x\n",
1065 inta, inta_mask, val);
1074 !trans_pcie->
inta) {
1079 iwl_enable_interrupts(trans);
1082 spin_unlock_irqrestore(&trans_pcie->
irq_lock, flags);
1091 iwl_enable_interrupts(trans);
1093 spin_unlock_irqrestore(&trans_pcie->
irq_lock, flags);