The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/rtwn/rtl8188e/pci/r88ee_rx.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2017 Farhan Khan <khanzf@gmail.com>
    3  *
    4  * Permission to use, copy, modify, and 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 <sys/cdefs.h>
   18 __FBSDID("$FreeBSD$");
   19 
   20 #include "opt_wlan.h"
   21 
   22 #include <sys/param.h>
   23 #include <sys/lock.h>
   24 #include <sys/mutex.h>
   25 #include <sys/mbuf.h>
   26 #include <sys/kernel.h>
   27 #include <sys/socket.h>
   28 #include <sys/systm.h>
   29 #include <sys/malloc.h>
   30 #include <sys/queue.h>
   31 #include <sys/taskqueue.h>
   32 #include <sys/bus.h>
   33 #include <sys/endian.h>
   34 #include <sys/linker.h>
   35 
   36 #include <machine/bus.h>
   37 #include <machine/resource.h>
   38 #include <sys/rman.h>
   39 
   40 #include <net/if.h>
   41 #include <net/ethernet.h>
   42 #include <net/if_media.h>
   43 
   44 #include <net80211/ieee80211_var.h>
   45 #include <net80211/ieee80211_radiotap.h>
   46 
   47 #include <dev/rtwn/if_rtwnvar.h>
   48 #include <dev/rtwn/if_rtwn_debug.h>
   49 
   50 #include <dev/rtwn/pci/rtwn_pci_var.h>
   51 
   52 #include <dev/rtwn/rtl8188e/pci/r88ee.h>
   53 #include <dev/rtwn/rtl8188e/pci/r88ee_reg.h>
   54 
   55 int
   56 r88ee_get_intr_status(struct rtwn_pci_softc *pc, int *rings)
   57 {
   58         struct rtwn_softc *sc = &pc->pc_sc;
   59         uint32_t status, status_ex;
   60         int ret;
   61 
   62         *rings = 0;
   63         status = rtwn_read_4(sc, R88E_HISR);
   64         status_ex = rtwn_read_4(sc, R88E_HISRE);
   65         RTWN_DPRINTF(sc, RTWN_DEBUG_INTR, "%s: HISR %08X, HISRE %08X\n",
   66             __func__, status, status_ex);
   67         if ((status == 0 || status == 0xffffffff) &&
   68             (status_ex == 0 || status_ex == 0xffffffff))
   69                 return (0);
   70 
   71         /* Disable interrupts */
   72         rtwn_write_4(sc, R88E_HIMR, 0);
   73         rtwn_write_4(sc, R88E_HIMRE, 0);
   74 
   75         /* Ack interrupts */
   76         rtwn_write_4(sc, R88E_HISR, status);
   77         rtwn_write_4(sc, R88E_HISRE, status_ex);
   78 
   79         if (status & R88E_HIMR_HIGHDOK)
   80                 *rings |= (1 << RTWN_PCI_HIGH_QUEUE);
   81         if (status & R88E_HIMR_MGNTDOK)
   82                 *rings |= (1 << RTWN_PCI_MGNT_QUEUE);
   83         if (status & R88E_HIMR_BKDOK)
   84                 *rings |= (1 << RTWN_PCI_BK_QUEUE);
   85         if (status & R88E_HIMR_BEDOK)
   86                 *rings |= (1 << RTWN_PCI_BE_QUEUE);
   87         if (status & R88E_HIMR_VIDOK)
   88                 *rings |= (1 << RTWN_PCI_VI_QUEUE);
   89         if (status & R88E_HIMR_VODOK)
   90                 *rings |= (1 << RTWN_PCI_VO_QUEUE);
   91 
   92         ret = 0;
   93         if (status_ex & R88E_HIMRE_RXERR)
   94                 ret |= RTWN_PCI_INTR_RX_ERROR;
   95         if (status_ex & R88E_HIMRE_RXFOVW)
   96                 ret |= RTWN_PCI_INTR_RX_OVERFLOW;
   97         if (status & R88E_HIMR_RDU)
   98                 ret |= RTWN_PCI_INTR_RX_DESC_UNAVAIL;
   99         if (status & R88E_HIMR_ROK)
  100                 ret |= RTWN_PCI_INTR_RX_DONE;
  101         if (status_ex & R88E_HIMRE_TXERR)
  102                 ret |= RTWN_PCI_INTR_TX_ERROR;
  103         if (status_ex & R88E_HIMRE_TXFOVW)
  104                 ret |= RTWN_PCI_INTR_TX_OVERFLOW;
  105         if (status & R88E_HIMR_TXRPT)
  106                 ret |= RTWN_PCI_INTR_TX_REPORT;
  107         if (status & R88E_HIMR_PSTIMEOUT)
  108                 ret |= RTWN_PCI_INTR_PS_TIMEOUT;
  109 
  110         return (ret);
  111 }
  112 
  113 #define R88E_INT_ENABLE (R88E_HIMR_ROK | R88E_HIMR_RDU | R88E_HIMR_VODOK | \
  114                          R88E_HIMR_VIDOK | R88E_HIMR_BEDOK | \
  115                          R88E_HIMR_BKDOK | R88E_HIMR_MGNTDOK | \
  116                          R88E_HIMR_HIGHDOK | R88E_HIMR_TXRPT)
  117 
  118 #define R88E_INT_ENABLE_EX      (R88E_HIMRE_RXFOVW | R88E_HIMRE_RXERR)
  119 
  120 void
  121 r88ee_enable_intr(struct rtwn_pci_softc *pc)
  122 {
  123         struct rtwn_softc *sc = &pc->pc_sc;
  124 
  125         /* Enable interrupts */
  126         rtwn_write_4(sc, R88E_HIMR, R88E_INT_ENABLE);
  127         rtwn_write_4(sc, R88E_HIMRE, R88E_INT_ENABLE_EX);
  128 }
  129 
  130 void
  131 r88ee_start_xfers(struct rtwn_softc *sc)
  132 {
  133         /* Clear pending interrupts. */
  134         rtwn_write_4(sc, R88E_HISR, 0xffffffff);
  135         rtwn_write_4(sc, R88E_HISRE, 0xffffffff);
  136 
  137         /* Enable interrupts. */
  138         rtwn_write_4(sc, R88E_HIMR, R88E_INT_ENABLE);
  139         rtwn_write_4(sc, R88E_HIMRE, R88E_INT_ENABLE_EX);
  140 }
  141 
  142 #undef R88E_INT_ENABLE
  143 #undef R88E_INT_ENABLE_EX

Cache object: 298fbca9f5c76486d653f2efabeaeb60


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.