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/ic/wivar.h

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 /*      $NetBSD: wivar.h,v 1.61 2007/12/25 18:33:39 perry Exp $ */
    2 
    3 /*
    4  * Copyright (c) 1997, 1998, 1999
    5  *      Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. All advertising materials mentioning features or use of this software
   16  *    must display the following acknowledgement:
   17  *      This product includes software developed by Bill Paul.
   18  * 4. Neither the name of the author nor the names of any co-contributors
   19  *    may be used to endorse or promote products derived from this software
   20  *    without specific prior written permission.
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
   23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   25  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
   26  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
   32  * THE POSSIBILITY OF SUCH DAMAGE.
   33  */
   34 
   35 /* Radio capture format for Prism. */
   36 
   37 #define WI_RX_RADIOTAP_PRESENT  ((1 << IEEE80211_RADIOTAP_FLAGS) | \
   38                                  (1 << IEEE80211_RADIOTAP_RATE) | \
   39                                  (1 << IEEE80211_RADIOTAP_CHANNEL) | \
   40                                  (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \
   41                                  (1 << IEEE80211_RADIOTAP_DB_ANTNOISE))
   42 
   43 struct wi_rx_radiotap_header {
   44         struct ieee80211_radiotap_header        wr_ihdr;
   45         u_int8_t                                wr_flags;
   46         u_int8_t                                wr_rate;
   47         u_int16_t                               wr_chan_freq;
   48         u_int16_t                               wr_chan_flags;
   49         int8_t                                  wr_antsignal;
   50         int8_t                                  wr_antnoise;
   51 } __packed;
   52 
   53 #define WI_TX_RADIOTAP_PRESENT  ((1 << IEEE80211_RADIOTAP_FLAGS) | \
   54                                  (1 << IEEE80211_RADIOTAP_RATE) | \
   55                                  (1 << IEEE80211_RADIOTAP_CHANNEL))
   56 
   57 struct wi_tx_radiotap_header {
   58         struct ieee80211_radiotap_header        wt_ihdr;
   59         u_int8_t                                wt_flags;
   60         u_int8_t                                wt_rate;
   61         u_int16_t                               wt_chan_freq;
   62         u_int16_t                               wt_chan_flags;
   63 } __packed;
   64 
   65 struct wi_rssdesc {
   66         struct ieee80211_rssdesc        rd_desc;
   67         SLIST_ENTRY(wi_rssdesc)         rd_next;
   68 };
   69 
   70 typedef SLIST_HEAD(,wi_rssdesc) wi_rssdescq_t;
   71 
   72 /*
   73  * FreeBSD driver ported to NetBSD by Bill Sommerfeld in the back of the
   74  * Oslo IETF plenary meeting.
   75  */
   76 struct wi_softc {
   77         struct device           sc_dev;
   78         struct ethercom         sc_ec;
   79         struct ieee80211com     sc_ic;
   80         u_int32_t               sc_ic_flags;    /* backup of ic->ic_flags */
   81         void                    *sc_ih;         /* interrupt handler */
   82         int                     (*sc_enable)(struct wi_softc *);
   83         void                    (*sc_disable)(struct wi_softc *);
   84         void                    (*sc_reset)(struct wi_softc *);
   85 
   86         int                     (*sc_newstate)(struct ieee80211com *,
   87                                     enum ieee80211_state, int);
   88         void                    (*sc_set_tim)(struct ieee80211_node *, int);
   89 
   90         int                     sc_attached;
   91         int                     sc_enabled;
   92         int                     sc_invalid;
   93         int                     sc_firmware_type;
   94 #define WI_NOTYPE       0
   95 #define WI_LUCENT       1
   96 #define WI_INTERSIL     2
   97 #define WI_SYMBOL       3
   98         int                     sc_pri_firmware_ver;    /* Primary firm vers */
   99         int                     sc_sta_firmware_ver;    /* Station firm vers */
  100         int                     sc_pci;                 /* attach to PCI-Bus */
  101 
  102         bus_space_tag_t         sc_iot;                 /* bus cookie */
  103         bus_space_handle_t      sc_ioh;                 /* bus i/o handle */
  104 
  105         void *                  sc_drvbpf;
  106         int                     sc_flags;
  107         int                     sc_bap_id;
  108         int                     sc_bap_off;
  109 
  110         u_int16_t               sc_portnum;
  111 
  112         /* RSSI interpretation */
  113         u_int16_t               sc_dbm_offset;  /* dBm ~ RSSI - sc_dbm_offset */
  114         u_int16_t               sc_max_datalen;
  115         u_int16_t               sc_frag_thresh;
  116         u_int16_t               sc_rts_thresh;
  117         u_int16_t               sc_system_scale;
  118         u_int16_t               sc_tx_rate;
  119         u_int16_t               sc_cnfauthmode;
  120         u_int16_t               sc_roaming_mode;
  121         u_int16_t               sc_microwave_oven;
  122 
  123         int                     sc_nodelen;
  124         char                    sc_nodename[IEEE80211_NWID_LEN];
  125 
  126         int                     sc_buflen;
  127 #define WI_NTXBUF       3
  128 #define WI_NTXRSS       10
  129         struct {
  130                 int                             d_fid;
  131         }                       sc_txd[WI_NTXBUF];
  132         int                     sc_txalloc;     /* next FID to allocate */
  133         int                     sc_txalloced;   /* FIDs currently allocated */
  134         int                     sc_txqueue;     /* next FID to queue */
  135         int                     sc_txqueued;    /* FIDs currently queued */
  136         int                     sc_txstart;     /* next FID to start */
  137         int                     sc_txstarted;   /* FIDs currently started */
  138         int                     sc_txcmds;
  139 
  140         int                     sc_status;
  141 
  142         struct wi_rssdesc       sc_rssd[WI_NTXRSS];
  143         wi_rssdescq_t           sc_rssdfree;
  144         int                     sc_tx_timer;
  145         int                     sc_scan_timer;
  146         int                     sc_syn_timer;
  147 
  148         struct wi_counters      sc_stats;
  149         u_int16_t               sc_ibss_port;
  150 
  151         struct wi_apinfo        sc_aps[MAXAPINFO];
  152         int                     sc_naps;
  153 
  154         struct timeval          sc_last_syn;
  155         int                     sc_false_syns;
  156         int                     sc_alt_retry;
  157 
  158         union {
  159                 struct wi_rx_radiotap_header    tap;
  160                 u_int8_t                        pad[64];
  161         } sc_rxtapu;
  162         union {
  163                 struct wi_tx_radiotap_header    tap;
  164                 u_int8_t                        pad[64];
  165         } sc_txtapu;
  166         u_int16_t               sc_txbuf[IEEE80211_MAX_LEN/2];
  167         /* number of transmissions pending at each data rate */
  168         u_int8_t                sc_txpending[IEEE80211_RATE_MAXSIZE];
  169         struct callout          sc_rssadapt_ch;
  170 };
  171 
  172 #define sc_if           sc_ec.ec_if
  173 #define sc_rxtap        sc_rxtapu.tap
  174 #define sc_txtap        sc_txtapu.tap
  175 
  176 struct wi_node {
  177         struct ieee80211_node           wn_node;
  178         struct ieee80211_rssadapt       wn_rssadapt;
  179 };
  180 
  181 /* maximum false change-of-BSSID indications per second */
  182 #define WI_MAX_FALSE_SYNS               10
  183 
  184 #define WI_PRISM_DBM_OFFSET     100     /* XXX */
  185 
  186 #define WI_LUCENT_DBM_OFFSET    149
  187 
  188 #define WI_SCAN_INQWAIT                 3       /* wait sec before inquire */
  189 #define WI_SCAN_WAIT                    5       /* maximum scan wait */
  190 
  191 /* Values for wi_flags. */
  192 #define WI_FLAGS_ATTACHED               0x0001
  193 #define WI_FLAGS_INITIALIZED            0x0002
  194 #define WI_FLAGS_OUTRANGE               0x0004
  195 #define WI_FLAGS_RSSADAPTSTA            0x0008
  196 #define WI_FLAGS_HAS_MOR                0x0010
  197 #define WI_FLAGS_HAS_ROAMING            0x0020
  198 #define WI_FLAGS_HAS_DIVERSITY          0x0040
  199 #define WI_FLAGS_HAS_SYSSCALE           0x0080
  200 #define WI_FLAGS_BUG_AUTOINC            0x0100
  201 #define WI_FLAGS_HAS_FRAGTHR            0x0200
  202 #define WI_FLAGS_HAS_DBMADJUST          0x0400
  203 #define WI_FLAGS_WEP_VALID              0x0800
  204 
  205 struct wi_card_ident {
  206         u_int16_t       card_id;
  207         const char      *card_name;
  208         u_int8_t        firm_type;
  209 };
  210 
  211 /*
  212  * register space access macros
  213  */
  214 #ifdef WI_AT_BIGENDIAN_BUS_HACK
  215         /*
  216          * XXX - ugly hack for sparc bus_space_* macro deficiencies:
  217          *       assume the bus we are accessing is big endian.
  218          */
  219 
  220 #define CSR_WRITE_4(sc, reg, val)       \
  221         bus_space_write_4(sc->sc_iot, sc->sc_ioh,       \
  222                         (sc->sc_pci? reg * 2: reg) , htole32(val))
  223 #define CSR_WRITE_2(sc, reg, val)       \
  224         bus_space_write_2(sc->sc_iot, sc->sc_ioh,       \
  225                         (sc->sc_pci? reg * 2: reg), htole16(val))
  226 #define CSR_WRITE_1(sc, reg, val)       \
  227         bus_space_write_1(sc->sc_iot, sc->sc_ioh,       \
  228                         (sc->sc_pci? reg * 2: reg), val)
  229 
  230 #define CSR_READ_4(sc, reg)             \
  231         le32toh(bus_space_read_4(sc->sc_iot, sc->sc_ioh,        \
  232                         (sc->sc_pci? reg * 2: reg)))
  233 #define CSR_READ_2(sc, reg)             \
  234         le16toh(bus_space_read_2(sc->sc_iot, sc->sc_ioh,        \
  235                         (sc->sc_pci? reg * 2: reg)))
  236 #define CSR_READ_1(sc, reg)             \
  237         bus_space_read_1(sc->sc_iot, sc->sc_ioh,        \
  238                         (sc->sc_pci? reg * 2: reg))
  239 
  240 #else
  241 
  242 #define CSR_WRITE_4(sc, reg, val)       \
  243         bus_space_write_4(sc->sc_iot, sc->sc_ioh,       \
  244                         (sc->sc_pci? reg * 2: reg) , val)
  245 #define CSR_WRITE_2(sc, reg, val)       \
  246         bus_space_write_2(sc->sc_iot, sc->sc_ioh,       \
  247                         (sc->sc_pci? reg * 2: reg), val)
  248 #define CSR_WRITE_1(sc, reg, val)       \
  249         bus_space_write_1(sc->sc_iot, sc->sc_ioh,       \
  250                         (sc->sc_pci? reg * 2: reg), val)
  251 
  252 #define CSR_READ_4(sc, reg)             \
  253         bus_space_read_4(sc->sc_iot, sc->sc_ioh,        \
  254                         (sc->sc_pci? reg * 2: reg))
  255 #define CSR_READ_2(sc, reg)             \
  256         bus_space_read_2(sc->sc_iot, sc->sc_ioh,        \
  257                         (sc->sc_pci? reg * 2: reg))
  258 #define CSR_READ_1(sc, reg)             \
  259         bus_space_read_1(sc->sc_iot, sc->sc_ioh,        \
  260                         (sc->sc_pci? reg * 2: reg))
  261 #endif
  262 
  263 #ifndef __BUS_SPACE_HAS_STREAM_METHODS
  264 #define bus_space_write_stream_2        bus_space_write_2
  265 #define bus_space_write_multi_stream_2  bus_space_write_multi_2
  266 #define bus_space_read_stream_2         bus_space_read_2
  267 #define bus_space_read_multi_stream_2           bus_space_read_multi_2
  268 #endif
  269 
  270 #define CSR_WRITE_STREAM_2(sc, reg, val)        \
  271         bus_space_write_stream_2(sc->sc_iot, sc->sc_ioh,        \
  272                         (sc->sc_pci? reg * 2: reg), val)
  273 #define CSR_WRITE_MULTI_STREAM_2(sc, reg, val, count)   \
  274         bus_space_write_multi_stream_2(sc->sc_iot, sc->sc_ioh,  \
  275                         (sc->sc_pci? reg * 2: reg), val, count)
  276 #define CSR_READ_STREAM_2(sc, reg)              \
  277         bus_space_read_stream_2(sc->sc_iot, sc->sc_ioh, \
  278                         (sc->sc_pci? reg * 2: reg))
  279 #define CSR_READ_MULTI_STREAM_2(sc, reg, buf, count)            \
  280         bus_space_read_multi_stream_2(sc->sc_iot, sc->sc_ioh,   \
  281                         (sc->sc_pci? reg * 2: reg), buf, count)
  282 
  283 
  284 int     wi_attach(struct wi_softc *, const u_int8_t *);
  285 int     wi_detach(struct wi_softc *);
  286 int     wi_activate(struct device *, enum devact);
  287 int     wi_intr(void *arg);

Cache object: e0ffeee73318ecf605d8fe18af67c447


[ 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.