13737Shx147065 /* 2*11101SMikore.Li@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 33737Shx147065 * Use is subject to license terms. 43737Shx147065 */ 53737Shx147065 63737Shx147065 /* 73737Shx147065 * Copyright (c) 1997, 1998, 1999 83737Shx147065 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 93737Shx147065 * 103737Shx147065 * Redistribution and use in source and binary forms, with or without 113737Shx147065 * modification, are permitted provided that the following conditions 123737Shx147065 * are met: 133737Shx147065 * 1. Redistributions of source code must retain the above copyright 143737Shx147065 * notice, this list of conditions and the following disclaimer. 153737Shx147065 * 2. Redistributions in binary form must reproduce the above copyright 163737Shx147065 * notice, this list of conditions and the following disclaimer in the 173737Shx147065 * documentation and/or other materials provided with the distribution. 183737Shx147065 * 3. All advertising materials mentioning features or use of this software 193737Shx147065 * must display the following acknowledgement: 203737Shx147065 * This product includes software developed by Bill Paul. 213737Shx147065 * 4. Neither the name of the author nor the names of any co-contributors 223737Shx147065 * may be used to endorse or promote products derived from this software 233737Shx147065 * without specific prior written permission. 243737Shx147065 * 253737Shx147065 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 263737Shx147065 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 273737Shx147065 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 283737Shx147065 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 293737Shx147065 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 303737Shx147065 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 313737Shx147065 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 323737Shx147065 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 333737Shx147065 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 343737Shx147065 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 353737Shx147065 * THE POSSIBILITY OF SUCH DAMAGE. 363737Shx147065 */ 373737Shx147065 383737Shx147065 393737Shx147065 #ifndef _SYS_PCAN_H 403737Shx147065 #define _SYS_PCAN_H 413737Shx147065 423737Shx147065 #ifdef __cplusplus 433737Shx147065 extern "C" { 443737Shx147065 #endif 453737Shx147065 463737Shx147065 #define AN_TIMEOUT 600000 473737Shx147065 483737Shx147065 /* 493737Shx147065 * Size of Aironet I/O space. 503737Shx147065 */ 513737Shx147065 #define AN_IOSIZ 0x40 523737Shx147065 533737Shx147065 #define PCAN_DEVICE_PCI 0x100 543737Shx147065 #define PCAN_DEVICE_PCCARD 0x200 553737Shx147065 563737Shx147065 /* 573737Shx147065 * Hermes register definitions and what little I know about them. 583737Shx147065 */ 593737Shx147065 603737Shx147065 /* 613737Shx147065 * Hermes command/status registers. 623737Shx147065 */ 633737Shx147065 #define AN_COMMAND(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x00 : 0x00) 643737Shx147065 #define AN_PARAM0(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x04 : 0x02) 653737Shx147065 #define AN_PARAM1(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x08 : 0x04) 663737Shx147065 #define AN_PARAM2(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x0c : 0x06) 673737Shx147065 #define AN_STATUS(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x10 : 0x08) 683737Shx147065 #define AN_RESP0(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x14 : 0x0A) 693737Shx147065 #define AN_RESP1(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x18 : 0x0C) 703737Shx147065 #define AN_RESP2(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x1c : 0x0E) 713737Shx147065 #define AN_LINKSTAT(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x20 : 0x10) 723737Shx147065 733737Shx147065 /* 743737Shx147065 * Command register 753737Shx147065 */ 763737Shx147065 #define AN_CMD_BUSY 0x8000 /* busy bit */ 773737Shx147065 #define AN_CMD_NO_ACK 0x0080 /* don't acknowledge command */ 783737Shx147065 #define AN_CMD_CODE_MASK 0x003F 793737Shx147065 #define AN_CMD_QUAL_MASK 0x7F00 803737Shx147065 813737Shx147065 /* 823737Shx147065 * Command codes 833737Shx147065 */ 843737Shx147065 #define AN_CMD_NOOP 0x0000 /* no-op */ 853737Shx147065 #define AN_CMD_ENABLE 0x0001 /* enable */ 863737Shx147065 #define AN_CMD_DISABLE 0x0002 /* disable */ 873737Shx147065 #define AN_CMD_FORCE_SYNCLOSS 0x0003 /* force loss of sync */ 883737Shx147065 #define AN_CMD_FW_RESTART 0x0004 /* firmware resrart */ 893737Shx147065 #define AN_CMD_HOST_SLEEP 0x0005 903737Shx147065 #define AN_CMD_MAGIC_PKT 0x0006 913737Shx147065 #define AN_CMD_READCFG 0x0008 923737Shx147065 #define AN_CMD_ALLOC_MEM 0x000A /* allocate NIC memory */ 933737Shx147065 #define AN_CMD_TX 0x000B /* transmit */ 943737Shx147065 #define AN_CMD_DEALLOC_MEM 0x000C 953737Shx147065 #define AN_CMD_NOOP2 0x0010 963737Shx147065 #define AN_CMD_ALLOC_DESC 0x0020 973737Shx147065 #define AN_CMD_ACCESS 0x0021 983737Shx147065 #define AN_CMD_ALLOC_BUF 0x0028 993737Shx147065 #define AN_CMD_PSP_NODES 0x0030 1003737Shx147065 #define AN_CMD_SET_PHYREG 0x003E 1013737Shx147065 #define AN_CMD_TX_TEST 0x003F 1023737Shx147065 #define AN_CMD_SLEEP 0x0085 1033737Shx147065 #define AN_CMD_SCAN 0x0103 1043737Shx147065 #define AN_CMD_SAVECFG 0x0108 1053737Shx147065 1063737Shx147065 /* 1073737Shx147065 * Reclaim qualifier bit, applicable to the 1083737Shx147065 * TX command. 1093737Shx147065 */ 1103737Shx147065 #define AN_RECLAIM 0x0100 /* reclaim NIC memory */ 1113737Shx147065 1123737Shx147065 /* 1133737Shx147065 * MPI 350 DMA descriptor information 1143737Shx147065 */ 1153737Shx147065 #define AN_DESCRIPTOR_TX 0x01 1163737Shx147065 #define AN_DESCRIPTOR_RX 0x02 1173737Shx147065 #define AN_DESCRIPTOR_TXCMP 0x04 1183737Shx147065 #define AN_DESCRIPTOR_HOSTWRITE 0x08 1193737Shx147065 #define AN_DESCRIPTOR_HOSTREAD 0x10 1203737Shx147065 #define AN_DESCRIPTOR_HOSTRW 0x20 1213737Shx147065 1223737Shx147065 #define AN_MAX_RX_DESC 1 1233737Shx147065 #define AN_MAX_TX_DESC 1 1243737Shx147065 #define AN_HOSTBUFSIZ 1840 1253737Shx147065 1263737Shx147065 /* 1273737Shx147065 * dma descriptor definition for miniPci card. 1283737Shx147065 * the miniPci card only works on x86. 1293737Shx147065 */ 1303737Shx147065 struct an_card_rid_desc 1313737Shx147065 { 1323737Shx147065 uint32_t an_rid:16; 1333737Shx147065 uint32_t an_len:15; 1343737Shx147065 uint32_t an_valid:1; 1353737Shx147065 uint64_t an_phys; 1363737Shx147065 }; 1373737Shx147065 1383737Shx147065 struct an_card_rx_desc 1393737Shx147065 { 1403737Shx147065 uint32_t an_ctrl:15; 1413737Shx147065 uint32_t an_done:1; 1423737Shx147065 uint32_t an_len:15; 1433737Shx147065 uint32_t an_valid:1; 1443737Shx147065 uint64_t an_phys; 1453737Shx147065 }; 1463737Shx147065 1473737Shx147065 struct an_card_tx_desc 1483737Shx147065 { 1493737Shx147065 uint32_t an_offset:15; 1503737Shx147065 uint32_t an_eoc:1; 1513737Shx147065 uint32_t an_len:15; 1523737Shx147065 uint32_t an_valid:1; 1533737Shx147065 uint64_t an_phys; 1543737Shx147065 }; 1553737Shx147065 1563737Shx147065 #define AN_MAX_DATALEN 4096 1573737Shx147065 #define AN_RID_BUFFER_SIZE AN_MAX_DATALEN 1583737Shx147065 #define AN_RX_BUFFER_SIZE AN_HOSTBUFSIZ 1593737Shx147065 #define AN_TX_BUFFER_SIZE AN_HOSTBUFSIZ 1603737Shx147065 #define AN_HOST_DESC_OFFSET 0x800 1613737Shx147065 #define AN_RX_DESC_OFFSET (AN_HOST_DESC_OFFSET + \ 1623737Shx147065 sizeof (struct an_card_rid_desc)) 1633737Shx147065 #define AN_TX_DESC_OFFSET (AN_RX_DESC_OFFSET + \ 1643737Shx147065 (AN_MAX_RX_DESC * sizeof (struct an_card_rx_desc))) 1653737Shx147065 1663737Shx147065 /* 1673737Shx147065 * ACCESS command qualifier bits. 1683737Shx147065 */ 1693737Shx147065 #define AN_ACCESS_READ 0x0000 1703737Shx147065 #define AN_ACCESS_WRITE 0x0100 1713737Shx147065 1723737Shx147065 /* 1733737Shx147065 * PROGRAM command qualifier bits. 1743737Shx147065 */ 1753737Shx147065 #define AN_PROGRAM_DISABLE 0x0000 1763737Shx147065 #define AN_PROGRAM_ENABLE_RAM 0x0100 1773737Shx147065 #define AN_PROGRAM_ENABLE_NVRAM 0x0200 1783737Shx147065 #define AN_PROGRAM_NVRAM 0x0300 1793737Shx147065 1803737Shx147065 /* 1813737Shx147065 * Status register values 1823737Shx147065 */ 1833737Shx147065 #define AN_STAT_CMD_CODE 0x003F 1843737Shx147065 #define AN_STAT_CMD_RESULT 0x7F00 1853737Shx147065 1863737Shx147065 /* 1873737Shx147065 * Linkstat register 1883737Shx147065 */ 1893737Shx147065 #define AN_LINKSTAT_ASSOCIATED 0x0400 1903737Shx147065 #define AN_LINKSTAT_AUTHFAIL 0x0300 1913737Shx147065 #define AN_LINKSTAT_ASSOC_FAIL 0x8400 /* (low byte is reason code) */ 1923737Shx147065 #define AN_LINKSTAT_DISASSOC 0x8200 /* (low byte is reason code) */ 1933737Shx147065 #define AN_LINKSTAT_DEAUTH 0x8100 /* (low byte is reason code) */ 1943737Shx147065 #define AN_LINKSTAT_SYNCLOST_TSF 0x8004 1953737Shx147065 #define AN_LINKSTAT_SYNCLOST_HOSTREQ 0x8003 1963737Shx147065 #define AN_LINKSTAT_SYNCLOST_AVGRETRY 0x8002 1973737Shx147065 #define AN_LINKSTAT_SYNCLOST_MAXRETRY 0x8001 1983737Shx147065 #define AN_LINKSTAT_SYNCLOST_MISSBEACON 0x8000 1993737Shx147065 2003737Shx147065 /* 2013737Shx147065 * Link stat low byte reason code 2023737Shx147065 */ 2033737Shx147065 #define AN_LINKSTAT_RC_RESERVED 0 /* Reserved return code */ 2043737Shx147065 #define AN_LINKSTAT_RC_NOREASON 1 /* Unspecified reason */ 2053737Shx147065 #define AN_LINKSTAT_RC_AUTHINV 2 /* Prev auth invalid */ 2063737Shx147065 #define AN_LINKSTAT_RC_DEAUTH 3 /* Deauth due sender leaving */ 2073737Shx147065 #define AN_LINKSTAT_RC_NOACT 4 /* Disassociated due inactivity */ 2083737Shx147065 #define AN_LINKSTAT_RC_MAXLOAD 5 /* Disassociated due 2many stations */ 2093737Shx147065 /* 2103737Shx147065 * Class 2 frame received from non-Authenticated station 2113737Shx147065 */ 2123737Shx147065 #define AN_LINKSTAT_RC_BADCLASS2 6 2133737Shx147065 /* 2143737Shx147065 * Class 3 frame received from non-Associated station 2153737Shx147065 */ 2163737Shx147065 #define AN_LINKSTAT_RC_BADCLASS3 7 2173737Shx147065 /* 2183737Shx147065 * Disassociated because sending station is leaving BSS 2193737Shx147065 */ 2203737Shx147065 #define AN_LINKSTAT_RC_STATLEAVE 8 2213737Shx147065 /* 2223737Shx147065 * Station requesting (Re)Association not Authenticated w/responding station 2233737Shx147065 */ 2243737Shx147065 #define AN_LINKSTAT_RC_NOAUTH 9 2253737Shx147065 2263737Shx147065 /* 2273737Shx147065 * memory handle management registers 2283737Shx147065 */ 2293737Shx147065 #define AN_RX_FID 0x20 2303737Shx147065 #define AN_ALLOC_FID 0x22 2313737Shx147065 #define AN_TX_CMP_FID(p) \ 2323737Shx147065 (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x1a : 0x24) 2333737Shx147065 2343737Shx147065 #define AN_INVALID_FID 0xffff /* invalid fid value */ 2353737Shx147065 2363737Shx147065 /* 2373737Shx147065 * Buffer Access Path (BAP) registers. 2383737Shx147065 * These are I/O channels. I believe you can use each one for 2393737Shx147065 * any desired purpose independently of the other. In general 2403737Shx147065 * though, we use BAP1 for reading and writing LTV records and 2413737Shx147065 * reading received data frames, and BAP0 for writing transmit 2423737Shx147065 * frames. This is a convention though, not a rule. 2433737Shx147065 */ 2443737Shx147065 #define AN_SEL0 0x18 2453737Shx147065 #define AN_SEL1 0x1A 2463737Shx147065 #define AN_OFF0 0x1C 2473737Shx147065 #define AN_OFF1 0x1E 2483737Shx147065 #define AN_DATA0 0x36 2493737Shx147065 #define AN_DATA1 0x38 2503737Shx147065 #define AN_BAP0 AN_DATA0 2513737Shx147065 #define AN_BAP1 AN_DATA1 2523737Shx147065 2533737Shx147065 #define AN_OFF_BUSY 0x8000 2543737Shx147065 #define AN_OFF_ERR 0x4000 2553737Shx147065 #define AN_OFF_DONE 0x2000 2563737Shx147065 #define AN_OFF_DATAOFF 0x0FFF 2573737Shx147065 2583737Shx147065 /* 2593737Shx147065 * Event registers 2603737Shx147065 */ 2613737Shx147065 #define AN_EVENT_STAT(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x60 : 0x30) 2623737Shx147065 /* 2633737Shx147065 * Interrupt enable/disable 2643737Shx147065 */ 2653737Shx147065 #define AN_INT_EN(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x64 : 0x32) 2663737Shx147065 #define AN_EVENT_ACK(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x68 : 0x34) 2673737Shx147065 2683737Shx147065 /* 2693737Shx147065 * Events - AN_EVENT_ACK register only 2703737Shx147065 */ 2713737Shx147065 #define AN_EV_CLR_STUCK_BUSY 0x4000 /* clear stuck busy bit */ 2723737Shx147065 #define AN_EV_WAKEREQUEST 0x2000 /* awaken from PSP mode */ 2733737Shx147065 /* Events shared by all 3 event regs: */ 2743737Shx147065 #define AN_EV_MIC 0x1000 /* Message Integrity Check */ 2753737Shx147065 #define AN_EV_AWAKE 0x0100 /* station woke up from PSP mode */ 2763737Shx147065 #define AN_EV_LINKSTAT 0x0080 /* link status available */ 2773737Shx147065 #define AN_EV_CMD 0x0010 /* command completed */ 2783737Shx147065 #define AN_EV_ALLOC 0x0008 /* async alloc/reclaim completed */ 2793737Shx147065 #define AN_EV_TX_EXC 0x0004 /* async xmit completed with failure */ 2803737Shx147065 #define AN_EV_TX 0x0002 /* async xmit completed succesfully */ 2813737Shx147065 #define AN_EV_RX 0x0001 /* async rx completed */ 2823737Shx147065 #define AN_EV_TX_CPY 0x0400 2833737Shx147065 2843737Shx147065 #define AN_EV_ALL 0xffff /* all events */ 2853737Shx147065 #define AN_INTRS(p) \ 2863737Shx147065 (p->pcan_device_type == PCAN_DEVICE_PCI ? \ 2873737Shx147065 (AN_EV_RX|AN_EV_TX|AN_EV_TX_EXC|AN_EV_ALLOC|AN_EV_LINKSTAT|AN_EV_MIC \ 2883737Shx147065 |AN_EV_TX_CPY) : \ 2893737Shx147065 (AN_EV_RX|AN_EV_TX|AN_EV_TX_EXC|AN_EV_ALLOC|AN_EV_LINKSTAT|AN_EV_MIC)) 2903737Shx147065 2913737Shx147065 /* 2923737Shx147065 * Host software registers 2933737Shx147065 */ 2943737Shx147065 #define AN_SW0(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x50 : 0x28) 2953737Shx147065 #define AN_SW1(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x54 : 0x2A) 2963737Shx147065 #define AN_SW2(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x58 : 0x2C) 2973737Shx147065 #define AN_SW3(p) (p->pcan_device_type == PCAN_DEVICE_PCI ? 0x5c : 0x2E) 2983737Shx147065 2993737Shx147065 #define AN_CNTL 0x14 3003737Shx147065 3013737Shx147065 #define AN_CNTL_AUX_ENA 0xC000 3023737Shx147065 #define AN_CNTL_AUX_ENA_STAT 0xC000 3033737Shx147065 #define AN_CNTL_AUX_DIS_STAT 0x0000 3043737Shx147065 #define AN_CNTL_AUX_ENA_CNTL 0x8000 3053737Shx147065 #define AN_CNTL_AUX_DIS_CNTL 0x4000 3063737Shx147065 3073737Shx147065 #define AN_AUX_PAGE 0x3A 3083737Shx147065 #define AN_AUX_OFFSET 0x3C 3093737Shx147065 #define AN_AUX_DATA 0x3E 3103737Shx147065 3113737Shx147065 struct an_ltv_gen { 3123737Shx147065 uint16_t an_len; 3133737Shx147065 uint16_t an_type; 3143737Shx147065 uint16_t an_val; 3153737Shx147065 }; 3163737Shx147065 3173737Shx147065 /* 3183737Shx147065 * General configuration information. 3193737Shx147065 */ 3203737Shx147065 #define AN_RID_GENCONFIG 0xFF10 3213737Shx147065 struct an_ltv_genconfig { 3223737Shx147065 uint16_t an_len; /* 0x00 */ 3233737Shx147065 uint16_t an_opmode; /* 0x02 */ 3243737Shx147065 uint16_t an_rxmode; /* 0x04 */ 3253737Shx147065 uint16_t an_fragthresh; /* 0x06 */ 3263737Shx147065 uint16_t an_rtsthresh; /* 0x08 */ 3273737Shx147065 uint8_t an_macaddr[6]; /* 0x0A */ 3283737Shx147065 uint8_t an_rates[8]; /* 0x10 */ 3293737Shx147065 uint16_t an_shortretry_limit; /* 0x18 */ 3303737Shx147065 uint16_t an_longretry_limit; /* 0x1A */ 3313737Shx147065 uint16_t an_tx_msdu_lifetime; /* 0x1C */ 3323737Shx147065 uint16_t an_rx_msdu_lifetime; /* 0x1E */ 3333737Shx147065 uint16_t an_stationary; /* 0x20 */ 3343737Shx147065 uint16_t an_ordering; /* 0x22 */ 3353737Shx147065 uint16_t an_devtype; /* 0x24 */ 3363737Shx147065 uint16_t an_rsvd0[5]; /* 0x26 */ 3373737Shx147065 /* 3383737Shx147065 * Scanning associating. 3393737Shx147065 */ 3403737Shx147065 uint16_t an_scanmode; /* 0x30 */ 3413737Shx147065 uint16_t an_probedelay; /* 0x32 */ 3423737Shx147065 uint16_t an_probe_energy_timeout; /* 0x34 */ 3433737Shx147065 uint16_t an_probe_response_timeout; /* 0x36 */ 3443737Shx147065 uint16_t an_beacon_listen_timeout; /* 0x38 */ 3453737Shx147065 uint16_t an_ibss_join_net_timeout; /* 0x3A */ 3463737Shx147065 uint16_t an_auth_timeout; /* 0x3C */ 3473737Shx147065 uint16_t an_authtype; /* 0x3E */ 3483737Shx147065 uint16_t an_assoc_timeout; /* 0x40 */ 3493737Shx147065 uint16_t an_specified_ap_timeout; /* 0x42 */ 3503737Shx147065 uint16_t an_offline_scan_interval; /* 0x44 */ 3513737Shx147065 uint16_t an_offline_scan_duration; /* 0x46 */ 3523737Shx147065 uint16_t an_link_loss_delay; /* 0x48 */ 3533737Shx147065 uint16_t an_max_beacon_lost_time; /* 0x4A */ 3543737Shx147065 uint16_t an_refresh_interval; /* 0x4C */ 3553737Shx147065 uint16_t an_rsvd1; /* 0x4E */ 3563737Shx147065 /* 3573737Shx147065 * Power save operation 3583737Shx147065 */ 3593737Shx147065 uint16_t an_psave_mode; /* 0x50 */ 3603737Shx147065 uint16_t an_sleep_for_dtims; /* 0x52 */ 3613737Shx147065 uint16_t an_listen_interval; /* 0x54 */ 3623737Shx147065 uint16_t an_fast_listen_interval; /* 0x56 */ 3633737Shx147065 uint16_t an_listen_decay; /* 0x58 */ 3643737Shx147065 uint16_t an_fast_listen_decay; /* 0x5A */ 3653737Shx147065 uint16_t an_rsvd2[2]; /* 0x5C */ 3663737Shx147065 /* 3673737Shx147065 * Ad-hoc (or AP) operation. 3683737Shx147065 */ 3693737Shx147065 uint16_t an_beacon_period; /* 0x60 */ 3703737Shx147065 uint16_t an_atim_duration; /* 0x62 */ 3713737Shx147065 uint16_t an_rsvd3; /* 0x64 */ 3723737Shx147065 uint16_t an_ds_channel; /* 0x66 */ 3733737Shx147065 uint16_t an_rsvd4; /* 0x68 */ 3743737Shx147065 uint16_t an_dtim_period; /* 0x6A */ 3753737Shx147065 uint16_t an_rsvd5[2]; /* 0x6C */ 3763737Shx147065 /* 3773737Shx147065 * Radio operation. 3783737Shx147065 */ 3793737Shx147065 uint16_t an_radiotype; /* 0x70 */ 3803737Shx147065 uint16_t an_diversity; /* 0x72 */ 3813737Shx147065 uint16_t an_tx_power; /* 0x74 */ 3823737Shx147065 uint16_t an_rss_thresh; /* 0x76 */ 3833737Shx147065 uint16_t an_rsvd6[4]; /* 0x78 */ 3843737Shx147065 /* 3853737Shx147065 * Aironet extensions. 3863737Shx147065 */ 3873737Shx147065 uint8_t an_nodename[16]; /* 0x80 */ 3883737Shx147065 uint16_t an_arl_thresh; /* 0x90 */ 3893737Shx147065 uint16_t an_arl_decay; /* 0x92 */ 3903737Shx147065 uint16_t an_arl_delay; /* 0x94 */ 3913737Shx147065 uint8_t an_rsvd7; /* 0x96 */ 3923737Shx147065 uint8_t an_rsvd8; /* 0x97 */ 3933737Shx147065 uint8_t an_magic_packet_action; /* 0x98 */ 3943737Shx147065 uint8_t an_magic_packet_ctl; /* 0x99 */ 3953737Shx147065 uint16_t an_auto_wake; /* 0x9A */ 3963737Shx147065 uint16_t an_pad[20]; 3973737Shx147065 }; 3983737Shx147065 3993737Shx147065 #define AN_OPMODE_IBSS_ADHOC 0x0000 4003737Shx147065 #define AN_OPMODE_INFR_STATION 0x0001 4013737Shx147065 #define AN_OPMODE_AP 0x0002 4023737Shx147065 #define AN_OPMODE_AP_REPEATER 0x0003 4033737Shx147065 #define AN_OPMODE_UNMODIFIED_PAYLOAD 0x0100 4043737Shx147065 #define AN_OPMODE_AIRONET_EXTENSIONS 0x0200 4053737Shx147065 #define AN_OPMODE_AP_EXTENSIONS 0x0400 4063737Shx147065 4073737Shx147065 #define AN_RXMODE_BC_MC_ADDR 0x0000 4083737Shx147065 #define AN_RXMODE_BC_ADDR 0x0001 4093737Shx147065 #define AN_RXMODE_ADDR 0x0002 4103737Shx147065 #define AN_RXMODE_80211_MONITOR_CURBSS 0x0003 4113737Shx147065 #define AN_RXMODE_80211_MONITOR_ANYBSS 0x0004 4123737Shx147065 #define AN_RXMODE_LAN_MONITOR_CURBSS 0x0005 4133737Shx147065 #define AN_RXMODE_NO_8023_HEADER 0x0100 4143737Shx147065 #define AN_RXMODE_USE_8023_HEADER 0x0000 4153737Shx147065 4163737Shx147065 #define AN_RATE_1MBPS 0x0002 4173737Shx147065 #define AN_RATE_2MBPS 0x0004 4183737Shx147065 #define AN_RATE_5_5MBPS 0x000B 4193737Shx147065 #define AN_RATE_11MBPS 0x0016 4203737Shx147065 4213737Shx147065 #define AN_DEVTYPE_PC4500 0x0065 4223737Shx147065 #define AN_DEVTYPE_PC4800 0x006D 4233737Shx147065 4243737Shx147065 #define AN_SCANMODE_ACTIVE 0x0000 4253737Shx147065 #define AN_SCANMODE_PASSIVE 0x0001 4263737Shx147065 #define AN_SCANMODE_AIRONET_ACTIVE 0x0002 4273737Shx147065 4283737Shx147065 #define AN_AUTHTYPE_NONE 0x0000 4293737Shx147065 #define AN_AUTHTYPE_OPEN 0x0001 4303737Shx147065 #define AN_AUTHTYPE_SHAREDKEY 0x0002 4313737Shx147065 #define AN_AUTHTYPE_EXCLUDE_UNENCRYPTED 0x0004 4323737Shx147065 #define AN_AUTHTYPE_ENABLEWEP 0x0100 4333737Shx147065 #define AN_AUTHTYPE_ALLOW_UNENCRYPTED 0x0200 4343737Shx147065 4353737Shx147065 #define AN_PSAVE_NONE 0x0000 4363737Shx147065 #define AN_PSAVE_CAM 0x0001 4373737Shx147065 #define AN_PSAVE_PSP 0x0002 4383737Shx147065 #define AN_PSAVE_PSP_CAM 0x0003 4393737Shx147065 4403737Shx147065 #define AN_RADIOTYPE_80211_FH 0x0001 4413737Shx147065 #define AN_RADIOTYPE_80211_DS 0x0002 4423737Shx147065 #define AN_RADIOTYPE_LM2000_DS 0x0004 4433737Shx147065 4443737Shx147065 #define AN_DIVERSITY_FACTORY_DEFAULT 0x0000 4453737Shx147065 #define AN_DIVERSITY_ANTENNA_1_ONLY 0x0001 4463737Shx147065 #define AN_DIVERSITY_ANTENNA_2_ONLY 0x0002 4473737Shx147065 #define AN_DIVERSITY_ANTENNA_1_AND_2 0x0003 4483737Shx147065 4493737Shx147065 #define AN_TXPOWER_FACTORY_DEFAULT 0x0000 4503737Shx147065 #define AN_TXPOWER_50MW 50 4513737Shx147065 #define AN_TXPOWER_100MW 100 4523737Shx147065 #define AN_TXPOWER_250MW 250 4533737Shx147065 4543737Shx147065 /* 4553737Shx147065 * Valid SSID list. You can specify up to three SSIDs denoting 4563737Shx147065 * the service sets that you want to join. The first SSID always 4573737Shx147065 * defaults to "tsunami" which is a handy way to detect the 4583737Shx147065 * card. 4593737Shx147065 */ 4603737Shx147065 #define AN_RID_SSIDLIST 0xFF11 4613737Shx147065 struct an_ltv_ssidlist { 4623737Shx147065 uint16_t an_len; 4633737Shx147065 uint16_t an_ssid1_len; 4643737Shx147065 char an_ssid1[32]; 4653737Shx147065 uint16_t an_ssid2_len; 4663737Shx147065 char an_ssid2[32]; 4673737Shx147065 uint16_t an_ssid3_len; 4683737Shx147065 char an_ssid3[32]; 4693737Shx147065 uint8_t an_pad[748]; 4703737Shx147065 }; 4713737Shx147065 4723737Shx147065 #define AN_DEF_SSID_LEN 7 4733737Shx147065 #define AN_DEF_SSID "tsunami" 4743737Shx147065 4753737Shx147065 /* 4763737Shx147065 * Valid AP list. 4773737Shx147065 */ 4783737Shx147065 #define AN_RID_APLIST 0xFF12 4793737Shx147065 struct an_ltv_aplist { 4803737Shx147065 uint16_t an_len; 4813737Shx147065 uint8_t an_ap1[6]; 4823737Shx147065 uint8_t an_ap2[6]; 4833737Shx147065 uint8_t an_ap3[6]; 4843737Shx147065 uint8_t an_ap4[6]; 4853737Shx147065 }; 4863737Shx147065 4873737Shx147065 /* 4883737Shx147065 * Driver name. 4893737Shx147065 */ 4903737Shx147065 #define AN_RID_DRVNAME 0xFF13 4913737Shx147065 struct an_ltv_drvname { 4923737Shx147065 uint16_t an_len; 4933737Shx147065 uint8_t an_drvname[16]; 4943737Shx147065 }; 4953737Shx147065 4963737Shx147065 /* 4973737Shx147065 * Frame encapsulation. 4983737Shx147065 */ 4993737Shx147065 #define AN_RID_ENCAP 0xFF14 5003737Shx147065 struct an_rid_encap { 5013737Shx147065 uint16_t an_len; 5023737Shx147065 uint16_t an_ethertype_default; 5033737Shx147065 uint16_t an_action_default; 5043737Shx147065 uint16_t an_ethertype0; 5053737Shx147065 uint16_t an_action0; 5063737Shx147065 uint16_t an_ethertype1; 5073737Shx147065 uint16_t an_action1; 5083737Shx147065 uint16_t an_ethertype2; 5093737Shx147065 uint16_t an_action2; 5103737Shx147065 uint16_t an_ethertype3; 5113737Shx147065 uint16_t an_action3; 5123737Shx147065 uint16_t an_ethertype4; 5133737Shx147065 uint16_t an_action4; 5143737Shx147065 uint16_t an_ethertype5; 5153737Shx147065 uint16_t an_action5; 5163737Shx147065 uint16_t an_ethertype6; 5173737Shx147065 uint16_t an_action6; 5183737Shx147065 }; 5193737Shx147065 5203737Shx147065 #define AN_ENCAP_ACTION_RX 0x0001 5213737Shx147065 #define AN_ENCAP_ACTION_TX 0x0002 5223737Shx147065 5233737Shx147065 #define AN_RXENCAP_NONE 0x0000 5243737Shx147065 #define AN_RXENCAP_RFC1024 0x0001 5253737Shx147065 5263737Shx147065 #define AN_TXENCAP_RFC1024 0x0000 5273737Shx147065 #define AN_TXENCAP_80211 0x0002 5283737Shx147065 5293737Shx147065 #define AN_RID_WEPKEY 0xFF15 5303737Shx147065 #define AN_RID_WEPKEY2 0xFF16 5313737Shx147065 struct an_ltv_wepkey { 5323737Shx147065 uint16_t an_len; 5333737Shx147065 uint16_t an_index; 5343737Shx147065 uint8_t an_macaddr[6]; 5353737Shx147065 uint16_t an_keylen; /* WEP40: 5, WEP128: 13 bytes */ 5363737Shx147065 uint8_t an_key[16]; /* key value */ 5373737Shx147065 }; 5383737Shx147065 5393737Shx147065 #define AN_RID_CRYPT 0xFF18 5403737Shx147065 struct an_ltv_crypt { 5413737Shx147065 uint16_t an_operation; /* 0: enable 1: disable */ 5423737Shx147065 uint8_t an_optionmask[2]; /* 1: WEP40 2: WEP128 */ 5433737Shx147065 uint8_t an_filler[8]; /* put struct 6 bytes longer */ 5443737Shx147065 }; 5453737Shx147065 5463737Shx147065 /* 5473737Shx147065 * Actual config, same structure as general config (read only). 5483737Shx147065 */ 5493737Shx147065 #define AN_RID_ACTUALCFG 0xFF20 5503737Shx147065 5513737Shx147065 /* 5523737Shx147065 * Card capabilities (read only). 5533737Shx147065 */ 5543737Shx147065 #define AN_RID_CAPABILITIES 0xFF00 5553737Shx147065 struct an_ltv_caps { 5563737Shx147065 uint16_t an_len; 5573737Shx147065 uint8_t an_oui[3]; /* 0x02 */ 5583737Shx147065 uint8_t an_pad0; /* 0x05 */ 5593737Shx147065 uint16_t an_prodnum; /* 0x06 */ 5603737Shx147065 uint8_t an_manufname[32]; /* 0x08 */ 5613737Shx147065 uint8_t an_prodname[16]; /* 0x28 */ 5623737Shx147065 uint8_t an_prodvers[8]; /* 0x38 */ 5633737Shx147065 uint8_t an_oemaddr[6]; /* 0x40 */ 5643737Shx147065 uint8_t an_aironetaddr[6]; /* 0x46 */ 5653737Shx147065 uint16_t an_radiotype; /* 0x4C */ 5663737Shx147065 uint16_t an_country; /* 0x4E */ 5673737Shx147065 uint8_t an_callid[6]; /* 0x50 */ 5683737Shx147065 uint8_t an_supported_rates[8]; /* 0x56 */ 5693737Shx147065 uint8_t an_rx_diversity; /* 0x5E */ 5703737Shx147065 uint8_t an_tx_diversity; /* 0x5F */ 5713737Shx147065 uint16_t an_tx_powerlevels[8]; /* 0x60 */ 5723737Shx147065 uint16_t an_hwver; /* 0x70 */ 5733737Shx147065 uint16_t an_hwcaps; /* 0x72 */ 5743737Shx147065 uint16_t an_temprange; /* 0x74 */ 5753737Shx147065 uint16_t an_fwrev; /* 0x76 */ 5763737Shx147065 uint16_t an_fwsubrev; /* 0x78 */ 5773737Shx147065 uint16_t an_interfacerev; /* 0x7A */ 5783737Shx147065 uint16_t an_softcap; /* 0x7C */ 5793737Shx147065 uint16_t an_bootblockrev; /* 0x7E */ 5803737Shx147065 uint16_t an_requiredhw; /* 0x80 */ 5813737Shx147065 uint16_t an_pad; 5823737Shx147065 }; 5833737Shx147065 5843737Shx147065 /* 5853737Shx147065 * Access point (read only) 5863737Shx147065 */ 5873737Shx147065 #define AN_RID_APINFO 0xFF01 5883737Shx147065 struct an_ltv_apinfo { 5893737Shx147065 uint16_t an_len; 5903737Shx147065 uint16_t an_tim_addr; 5913737Shx147065 uint16_t an_airo_addr; 5923737Shx147065 }; 5933737Shx147065 5943737Shx147065 /* 5953737Shx147065 * Radio info (read only). 5963737Shx147065 */ 5973737Shx147065 #define AN_RID_RADIOINFO 0xFF02 5983737Shx147065 struct an_ltv_radioinfo { 5993737Shx147065 uint16_t an_len; 6003737Shx147065 /* 6013737Shx147065 * some more fields here, waiting for freebsd code update. 6023737Shx147065 */ 6033737Shx147065 }; 6043737Shx147065 6053737Shx147065 /* 6063737Shx147065 * Status (read only). Note: the manual claims this RID is 108 bytes 6073737Shx147065 * long (0x6A is the last datum, which is 2 bytes long) however when 6083737Shx147065 * this RID is read from the NIC, it returns a length of 110. To be 6093737Shx147065 * on the safe side, this structure is padded with an extra 16-bit 6103737Shx147065 * word. (There is a misprint in the manual which says the macaddr 6113737Shx147065 * field is 8 bytes long.) 6123737Shx147065 * 6133737Shx147065 * Also, the channel_set and current_channel fields appear to be 6143737Shx147065 * reversed. Either that, or the hop_period field is unused. 6153737Shx147065 */ 6163737Shx147065 #define AN_RID_STATUS 0xFF50 6173737Shx147065 struct an_ltv_status { 6183737Shx147065 uint16_t an_len; 6193737Shx147065 uint8_t an_macaddr[6]; /* 0x02 */ 6203737Shx147065 uint16_t an_opmode; /* 0x08 */ 6213737Shx147065 uint16_t an_errcode; /* 0x0A */ 6223737Shx147065 uint16_t an_cur_signal_quality; /* 0x0C */ 6233737Shx147065 uint16_t an_ssidlen; /* 0x0E */ 6243737Shx147065 uint8_t an_ssid[32]; /* 0x10 */ 6253737Shx147065 uint8_t an_ap_name[16]; /* 0x30 */ 6263737Shx147065 uint8_t an_cur_bssid[6]; /* 0x40 */ 6273737Shx147065 uint8_t an_prev_bssid1[6]; /* 0x46 */ 6283737Shx147065 uint8_t an_prev_bssid2[6]; /* 0x4C */ 6293737Shx147065 uint8_t an_prev_bssid3[6]; /* 0x52 */ 6303737Shx147065 uint16_t an_beacon_period; /* 0x58 */ 6313737Shx147065 uint16_t an_dtim_period; /* 0x5A */ 6323737Shx147065 uint16_t an_atim_duration; /* 0x5C */ 6333737Shx147065 uint16_t an_hop_period; /* 0x5E */ 6343737Shx147065 uint16_t an_channel_set; /* 0x60 */ 6353737Shx147065 uint16_t an_cur_channel; /* 0x62 */ 6363737Shx147065 uint16_t an_hops_to_backbone; /* 0x64 */ 6373737Shx147065 uint16_t an_ap_total_load; /* 0x66 */ 6383737Shx147065 uint16_t an_our_generated_load; /* 0x68 */ 6393737Shx147065 uint16_t an_accumulated_arl; /* 0x6A */ 6403737Shx147065 uint16_t an_signale_quality; /* 0x6C */ 6413737Shx147065 uint16_t an_cur_tx_rate; /* 0x6E */ 6423737Shx147065 uint16_t an_ap_device; /* 0x70 */ 6433737Shx147065 uint16_t an_normallized_rssi; /* 0x72 */ 6443737Shx147065 uint16_t an_short_preamble; /* 0x74 */ 6453737Shx147065 uint8_t an_ap_ip_address[4]; /* 0x76 */ 6463737Shx147065 uint8_t an_noise_pct; /* 0x7A */ 6473737Shx147065 uint8_t an_noise_dbm; /* 0x7B */ 6483737Shx147065 uint8_t an_noise_average_pct; /* 0x7C */ 6493737Shx147065 uint8_t an_noise_average_dbm; /* 0x7D */ 6503737Shx147065 uint8_t an_noise_max_pct; /* 0x7E */ 6513737Shx147065 uint8_t an_noise_max_dbm; /* 0x7F */ 6523737Shx147065 uint16_t an_load; /* 0x80 */ 6533737Shx147065 uint8_t an_carrier[4]; /* 0x82 */ 6543737Shx147065 uint16_t an_assoc_status; /* 0x86 */ 6553737Shx147065 uint16_t an_pad; 6563737Shx147065 }; 6573737Shx147065 6583737Shx147065 #define AN_STATUS_OPMODE_CONFIGURED 0x0001 6593737Shx147065 #define AN_STATUS_OPMODE_MAC_ENABLED 0x0002 6603737Shx147065 #define AN_STATUS_OPMODE_RX_ENABLED 0x0004 6613737Shx147065 #define AN_STATUS_OPMODE_IN_SYNC 0x0010 6623737Shx147065 #define AN_STATUS_OPMODE_ASSOCIATED 0x0020 6633737Shx147065 #define AN_STATUS_OPMODE_ERROR 0x8000 6643737Shx147065 6653737Shx147065 6663737Shx147065 /* 6673737Shx147065 * Statistics 6683737Shx147065 */ 6693737Shx147065 #define AN_RID_16BITS_CUM 0xFF60 /* Cumulative 16-bit stats counters */ 6703737Shx147065 #define AN_RID_16BITS_DELTA 0xFF61 /* 16-bit stats (since last clear) */ 6713737Shx147065 #define AN_RID_16BITS_DELTACLR 0xFF62 /* 16-bit stats, clear on read */ 6723737Shx147065 #define AN_RID_32BITS_CUM 0xFF68 /* Cumulative 32-bit stats counters */ 6733737Shx147065 #define AN_RID_32BITS_DELTA 0xFF69 /* 32-bit stats (since last clear) */ 6743737Shx147065 #define AN_RID_32BITS_DELTACLR 0xFF6A /* 32-bit stats, clear on read */ 6753737Shx147065 6763737Shx147065 /* 6773737Shx147065 * Grrr. The manual says the statistics record is 384 bytes in length, 6783737Shx147065 * but the card says the record is 404 bytes. There's some padding left 6793737Shx147065 * at the end of this structure to account for any discrepancies. 6803737Shx147065 */ 6813737Shx147065 struct an_ltv_stats { 6823737Shx147065 uint16_t an_len; 6833737Shx147065 uint16_t an_rx_overruns; /* 0x02 */ 6843737Shx147065 uint16_t an_rx_plcp_csum_errs; /* 0x04 */ 6853737Shx147065 uint16_t an_rx_plcp_format_errs; /* 0x06 */ 6863737Shx147065 uint16_t an_rx_plcp_len_errs; /* 0x08 */ 6873737Shx147065 uint16_t an_rx_mac_crc_errs; /* 0x0A */ 6883737Shx147065 uint16_t an_rx_mac_crc_ok; /* 0x0C */ 6893737Shx147065 uint16_t an_rx_wep_errs; /* 0x0E */ 6903737Shx147065 uint16_t an_rx_wep_ok; /* 0x10 */ 6913737Shx147065 uint16_t an_retry_long; /* 0x12 */ 6923737Shx147065 uint16_t an_retry_short; /* 0x14 */ 6933737Shx147065 uint16_t an_retry_max; /* 0x16 */ 6943737Shx147065 uint16_t an_no_ack; /* 0x18 */ 6953737Shx147065 uint16_t an_no_cts; /* 0x1A */ 6963737Shx147065 uint16_t an_rx_ack_ok; /* 0x1C */ 6973737Shx147065 uint16_t an_rx_cts_ok; /* 0x1E */ 6983737Shx147065 uint16_t an_tx_ack_ok; /* 0x20 */ 6993737Shx147065 uint16_t an_tx_rts_ok; /* 0x22 */ 7003737Shx147065 uint16_t an_tx_cts_ok; /* 0x24 */ 7013737Shx147065 uint16_t an_tx_lmac_mcasts; /* 0x26 */ 7023737Shx147065 uint16_t an_tx_lmac_bcasts; /* 0x28 */ 7033737Shx147065 uint16_t an_tx_lmac_ucast_frags; /* 0x2A */ 7043737Shx147065 uint16_t an_tx_lmac_ucasts; /* 0x2C */ 7053737Shx147065 uint16_t an_tx_beacons; /* 0x2E */ 7063737Shx147065 uint16_t an_rx_beacons; /* 0x30 */ 7073737Shx147065 uint16_t an_tx_single_cols; /* 0x32 */ 7083737Shx147065 uint16_t an_tx_multi_cols; /* 0x34 */ 7093737Shx147065 uint16_t an_tx_defers_no; /* 0x36 */ 7103737Shx147065 uint16_t an_tx_defers_prot; /* 0x38 */ 7113737Shx147065 uint16_t an_tx_defers_energy; /* 0x3A */ 7123737Shx147065 uint16_t an_rx_dups; /* 0x3C */ 7133737Shx147065 uint16_t an_rx_partial; /* 0x3E */ 7143737Shx147065 uint16_t an_tx_too_old; /* 0x40 */ 7153737Shx147065 uint16_t an_rx_too_old; /* 0x42 */ 7163737Shx147065 uint16_t an_lostsync_max_retries; /* 0x44 */ 7173737Shx147065 uint16_t an_lostsync_missed_beacons; /* 0x46 */ 7183737Shx147065 uint16_t an_lostsync_arl_exceeded; /* 0x48 */ 7193737Shx147065 uint16_t an_lostsync_deauthed; /* 0x4A */ 7203737Shx147065 uint16_t an_lostsync_disassociated; /* 0x4C */ 7213737Shx147065 uint16_t an_lostsync_tsf_timing; /* 0x4E */ 7223737Shx147065 uint16_t an_tx_host_mcasts; /* 0x50 */ 7233737Shx147065 uint16_t an_tx_host_bcasts; /* 0x52 */ 7243737Shx147065 uint16_t an_tx_host_ucasts; /* 0x54 */ 7253737Shx147065 uint16_t an_tx_host_failed; /* 0x56 */ 7263737Shx147065 uint16_t an_rx_host_mcasts; /* 0x58 */ 7273737Shx147065 uint16_t an_rx_host_bcasts; /* 0x5A */ 7283737Shx147065 uint16_t an_rx_host_ucasts; /* 0x5C */ 7293737Shx147065 uint16_t an_rx_host_discarded; /* 0x5E */ 7303737Shx147065 uint16_t an_tx_hmac_mcasts; /* 0x60 */ 7313737Shx147065 uint16_t an_tx_hmac_bcasts; /* 0x62 */ 7323737Shx147065 uint16_t an_tx_hmac_ucasts; /* 0x64 */ 7333737Shx147065 uint16_t an_tx_hmac_failed; /* 0x66 */ 7343737Shx147065 uint16_t an_rx_hmac_mcasts; /* 0x68 */ 7353737Shx147065 uint16_t an_rx_hmac_bcasts; /* 0x6A */ 7363737Shx147065 uint16_t an_rx_hmac_ucasts; /* 0x6C */ 7373737Shx147065 uint16_t an_rx_hmac_discarded; /* 0x6E */ 7383737Shx147065 uint16_t an_tx_hmac_accepted; /* 0x70 */ 7393737Shx147065 uint16_t an_ssid_mismatches; /* 0x72 */ 7403737Shx147065 uint16_t an_ap_mismatches; /* 0x74 */ 7413737Shx147065 uint16_t an_rates_mismatches; /* 0x76 */ 7423737Shx147065 uint16_t an_auth_rejects; /* 0x78 */ 7433737Shx147065 uint16_t an_auth_timeouts; /* 0x7A */ 7443737Shx147065 uint16_t an_assoc_rejects; /* 0x7C */ 7453737Shx147065 uint16_t an_assoc_timeouts; /* 0x7E */ 7463737Shx147065 uint16_t an_reason_outside_table; /* 0x80 */ 7473737Shx147065 uint16_t an_reason1; /* 0x82 */ 7483737Shx147065 uint16_t an_reason2; /* 0x84 */ 7493737Shx147065 uint16_t an_reason3; /* 0x86 */ 7503737Shx147065 uint16_t an_reason4; /* 0x88 */ 7513737Shx147065 uint16_t an_reason5; /* 0x8A */ 7523737Shx147065 uint16_t an_reason6; /* 0x8C */ 7533737Shx147065 uint16_t an_reason7; /* 0x8E */ 7543737Shx147065 uint16_t an_reason8; /* 0x90 */ 7553737Shx147065 uint16_t an_reason9; /* 0x92 */ 7563737Shx147065 uint16_t an_reason10; /* 0x94 */ 7573737Shx147065 uint16_t an_reason11; /* 0x96 */ 7583737Shx147065 uint16_t an_reason12; /* 0x98 */ 7593737Shx147065 uint16_t an_reason13; /* 0x9A */ 7603737Shx147065 uint16_t an_reason14; /* 0x9C */ 7613737Shx147065 uint16_t an_reason15; /* 0x9E */ 7623737Shx147065 uint16_t an_reason16; /* 0xA0 */ 7633737Shx147065 uint16_t an_reason17; /* 0xA2 */ 7643737Shx147065 uint16_t an_reason18; /* 0xA4 */ 7653737Shx147065 uint16_t an_reason19; /* 0xA6 */ 7663737Shx147065 uint16_t an_rx_mgmt_pkts; /* 0xA8 */ 7673737Shx147065 uint16_t an_tx_mgmt_pkts; /* 0xAA */ 7683737Shx147065 uint16_t an_rx_refresh_pkts; /* 0xAC */ 7693737Shx147065 uint16_t an_tx_refresh_pkts; /* 0xAE */ 7703737Shx147065 uint16_t an_rx_poll_pkts; /* 0xB0 */ 7713737Shx147065 uint16_t an_tx_poll_pkts; /* 0xB2 */ 7723737Shx147065 uint16_t an_host_retries; /* 0xB4 */ 7733737Shx147065 uint16_t an_lostsync_hostreq; /* 0xB6 */ 7743737Shx147065 uint16_t an_host_tx_bytes; /* 0xB8 */ 7753737Shx147065 uint16_t an_host_rx_bytes; /* 0xBA */ 7763737Shx147065 uint16_t an_uptime_usecs; /* 0xBC */ 7773737Shx147065 uint16_t an_uptime_secs; /* 0xBE */ 7783737Shx147065 uint16_t an_lostsync_better_ap; /* 0xC0 */ 7793737Shx147065 uint16_t an_privacy_mismatch; /* 0xC2 */ 7803737Shx147065 uint16_t an_jammed; /* 0xC4 */ 7813737Shx147065 uint16_t an_rx_disc_wep_off; /* 0xC6 */ 7823737Shx147065 uint16_t an_phy_ele_mismatch; /* 0xC8 */ 7833737Shx147065 uint16_t an_leap_success; /* 0xCA */ 7843737Shx147065 uint16_t an_leap_failure; /* 0xCC */ 7853737Shx147065 uint16_t an_leap_timeouts; /* 0xCE */ 7863737Shx147065 uint16_t an_leap_keylen_fail; /* 0xD0 */ 7873737Shx147065 }; 7883737Shx147065 7893737Shx147065 #define AN_RID_ESSIDLIST_FIRST 0xFF72 7903737Shx147065 #define AN_RID_ESSIDLIST_NEXT 0xFF73 7913737Shx147065 7923737Shx147065 struct an_ltv_scanresult { 7933737Shx147065 uint16_t an_len; 7943737Shx147065 uint16_t an_index; 7953737Shx147065 uint16_t an_radiotype; 7963737Shx147065 uint8_t an_bssid[6]; 7974343Sgd78059 #ifdef _BIG_ENDIAN 7984343Sgd78059 uint8_t an_ssidlen; 7994343Sgd78059 uint8_t an_zero; 8004343Sgd78059 #else 8013737Shx147065 uint8_t an_zero; 8023737Shx147065 uint8_t an_ssidlen; 8034343Sgd78059 #endif 8043737Shx147065 char an_ssid[32]; 8053737Shx147065 uint16_t an_rssi; 8063737Shx147065 uint16_t an_cap; 8073737Shx147065 uint16_t an_beaconinterval; 8083737Shx147065 uint8_t an_rates[8]; 8093737Shx147065 struct { 8103737Shx147065 uint16_t dwell; 8113737Shx147065 uint8_t hopset; 8123737Shx147065 uint8_t hoppattern; 8133737Shx147065 uint8_t hopindex; 8143737Shx147065 uint8_t pad; 8153737Shx147065 } an_fh; 8163737Shx147065 uint16_t an_dschannel; 8173737Shx147065 uint16_t an_atimwindow; 8183737Shx147065 }; 8193737Shx147065 8203737Shx147065 /* 8213737Shx147065 * seconds after which the scan item ages 8223737Shx147065 */ 8233737Shx147065 #define AN_SCAN_TIMEOUT_MAX 30 8243737Shx147065 8253737Shx147065 /* 8263737Shx147065 * threshold of scan result items below which scan will run again. 8273737Shx147065 */ 8283737Shx147065 #define AN_SCAN_AGAIN_THRESHOLD 5 8293737Shx147065 8303737Shx147065 typedef struct an_scan_list { 8313737Shx147065 struct an_ltv_scanresult an_val; 8323737Shx147065 uint32_t an_timeout; 8333737Shx147065 list_node_t an_scan_node; 8343737Shx147065 } an_scan_list_t; 8353737Shx147065 8363737Shx147065 /* 8373737Shx147065 * Receive frame structure. 8383737Shx147065 */ 8393737Shx147065 typedef struct an_rxframe { 8403737Shx147065 uint32_t an_rx_time; /* 0x00 */ 8413737Shx147065 uint16_t an_rx_status; /* 0x04 */ 8423737Shx147065 uint16_t an_rx_payload_len; /* 0x06 */ 8433737Shx147065 uint8_t an_rsvd0; /* 0x08 */ 8443737Shx147065 uint8_t an_rx_signal_strength; /* 0x09 */ 8453737Shx147065 uint8_t an_rx_rate; /* 0x0A */ 8463737Shx147065 uint8_t an_rx_chan; /* 0x0B */ 8473737Shx147065 uint8_t an_rx_assoc_cnt; /* 0x0C */ 8483737Shx147065 uint8_t an_rsvd1[3]; /* 0x0D */ 8493737Shx147065 uint8_t an_plcp_hdr[4]; /* 0x10 */ 8503737Shx147065 uint16_t an_frame_ctl; /* 0x14 */ 8513737Shx147065 uint16_t an_duration; /* 0x16 */ 8523737Shx147065 uint8_t an_addr1[6]; /* 0x18 */ 8533737Shx147065 uint8_t an_addr2[6]; /* 0x1E */ 8543737Shx147065 uint8_t an_addr3[6]; /* 0x24 */ 8553737Shx147065 uint16_t an_seq_ctl; /* 0x2A */ 8563737Shx147065 uint8_t an_addr4[6]; /* 0x2C */ 8573737Shx147065 uint16_t an_gaplen; /* 0x32 */ 8583737Shx147065 } an_rxfrm_t; 8593737Shx147065 8603737Shx147065 #define AN_RXGAP_MAX 8 8613737Shx147065 8623737Shx147065 /* 8633737Shx147065 * Transmit frame structure. 8643737Shx147065 */ 8653737Shx147065 typedef struct an_txframe { 8663737Shx147065 uint32_t an_tx_sw; /* 0x00 */ 8673737Shx147065 uint16_t an_tx_status; /* 0x04 */ 8683737Shx147065 uint16_t an_tx_payload_len; /* 0x06 */ 8693737Shx147065 uint16_t an_tx_ctl; /* 0x08 */ 8703737Shx147065 uint16_t an_tx_assoc_id; /* 0x0A */ 8713737Shx147065 uint16_t an_tx_retry; /* 0x0C */ 8723737Shx147065 uint8_t an_tx_assoc_cnt; /* 0x0E */ 8733737Shx147065 uint8_t an_tx_rate; /* 0x0F */ 8743737Shx147065 uint8_t an_tx_max_long_retries; /* 0x10 */ 8753737Shx147065 uint8_t an_tx_max_short_retries; /* 0x11 */ 8763737Shx147065 uint8_t an_rsvd0[2]; /* 0x12 */ 8773737Shx147065 uint16_t an_frame_ctl; /* 0x14 */ 8783737Shx147065 uint16_t an_duration; /* 0x16 */ 8793737Shx147065 uint8_t an_addr1[6]; /* 0x18 */ 8803737Shx147065 uint8_t an_addr2[6]; /* 0x1E */ 8813737Shx147065 uint8_t an_addr3[6]; /* 0x24 */ 8823737Shx147065 uint16_t an_seq_ctl; /* 0x2A */ 8833737Shx147065 uint8_t an_addr4[6]; /* 0x2C */ 8843737Shx147065 uint16_t an_gaplen; /* 0x32 */ 8853737Shx147065 } an_txfrm_t; 8863737Shx147065 8873737Shx147065 typedef struct an_frame { 8883737Shx147065 union { 8893737Shx147065 an_rxfrm_t rxfrm; 8903737Shx147065 an_txfrm_t txfrm; 8913737Shx147065 } frm; 8923737Shx147065 } an_frm_t; 8933737Shx147065 8943737Shx147065 #define AN_TXSTAT_EXCESS_RETRY 0x0002 8953737Shx147065 #define AN_TXSTAT_LIFE_EXCEEDED 0x0004 8963737Shx147065 #define AN_TXSTAT_AID_FAIL 0x0008 8973737Shx147065 #define AN_TXSTAT_MAC_DISABLED 0x0010 8983737Shx147065 #define AN_TXSTAT_ASSOC_LOST 0x0020 8993737Shx147065 9003737Shx147065 #define AN_TXCTL_RSVD 0x0001 9013737Shx147065 #define AN_TXCTL_TXOK_INTR 0x0002 9023737Shx147065 #define AN_TXCTL_TXERR_INTR 0x0004 9033737Shx147065 #define AN_TXCTL_HEADER_TYPE 0x0008 9043737Shx147065 #define AN_TXCTL_PAYLOAD_TYPE 0x0010 9053737Shx147065 #define AN_TXCTL_NORELEASE 0x0020 9063737Shx147065 #define AN_TXCTL_NORETRIES 0x0040 9073737Shx147065 #define AN_TXCTL_CLEAR_AID 0x0080 9083737Shx147065 #define AN_TXCTL_STRICT_ORDER 0x0100 9093737Shx147065 #define AN_TXCTL_USE_RTS 0x0200 9103737Shx147065 9113737Shx147065 #define AN_HEADERTYPE_8023 0x0000 9123737Shx147065 #define AN_HEADERTYPE_80211 0x0008 9133737Shx147065 9143737Shx147065 #define AN_PAYLOADTYPE_ETHER 0x0000 9153737Shx147065 #define AN_PAYLOADTYPE_LLC 0x0010 9163737Shx147065 9173737Shx147065 typedef enum { 9183737Shx147065 ANC_RX_OVERRUNS, /* 0x04 */ 9193737Shx147065 ANC_RX_PLCP_CSUM_ERRS, /* 0x08 */ 9203737Shx147065 ANC_RX_PLCP_FORMAT_ERRS, /* 0x0c */ 9213737Shx147065 ANC_RX_PLCP_LEN_ERRS, /* 0x10 */ 9223737Shx147065 ANC_RX_MAC_CRC_ERRS, /* 0x14 */ 9233737Shx147065 ANC_RX_MAC_CRC_OK, /* 0x18 */ 9243737Shx147065 ANC_RX_WEP_ERRS, /* 0x1c */ 9253737Shx147065 ANC_RX_WEP_OK, /* 0x20 */ 9263737Shx147065 ANC_RETRY_LONG, /* 0x24 */ 9273737Shx147065 ANC_RETRY_SHORT, /* 0x28 */ 9283737Shx147065 ANC_RETRY_MAX, /* 0x2c */ 9293737Shx147065 ANC_NO_ACK, /* 0x30 */ 9303737Shx147065 ANC_NO_CTS, /* 0x34 */ 9313737Shx147065 ANC_RX_ACK_OK, /* 0x38 */ 9323737Shx147065 ANC_RX_CTS_OK, /* 0x3c */ 9333737Shx147065 ANC_TX_ACK_OK, /* 0x40 */ 9343737Shx147065 ANC_TX_RTS_OK, /* 0x44 */ 9353737Shx147065 ANC_TX_CTS_OK, /* 0x48 */ 9363737Shx147065 ANC_TX_LMAC_MCASTS, /* 0x4c */ 9373737Shx147065 ANC_TX_LMAC_BCASTS, /* 0x50 */ 9383737Shx147065 ANC_TX_LMAC_UCAST_FRAGS, /* 0x54 */ 9393737Shx147065 ANC_TX_LMAC_UCASTS, /* 0x58 */ 9403737Shx147065 ANC_TX_BEACONS, /* 0x5c */ 9413737Shx147065 ANC_RX_BEACONS, /* 0x60 */ 9423737Shx147065 ANC_TX_SINGLE_COLS, /* 0x64 */ 9433737Shx147065 ANC_TX_MULTI_COLS, /* 0x68 */ 9443737Shx147065 ANC_TX_DEFERS_NO, /* 0x6c */ 9453737Shx147065 ANC_TX_DEFERS_PROT, /* 0x70 */ 9463737Shx147065 ANC_TX_DEFERS_ENERGY, /* 0x74 */ 9473737Shx147065 ANC_RX_DUPS, /* 0x78 */ 9483737Shx147065 ANC_RX_PARTIAL, /* 0x7c */ 9493737Shx147065 ANC_TX_TOO_OLD, /* 0x80 */ 9503737Shx147065 ANC_RX_TOO_OLD, /* 0x84 */ 9513737Shx147065 ANC_LOSTSYNC_MAX_RETRIES, /* 0x88 */ 9523737Shx147065 ANC_LOSTSYNC_MISSED_BEACONS, /* 0x8c */ 9533737Shx147065 ANC_LOSTSYNC_ARL_EXCEEDED, /* 0x90 */ 9543737Shx147065 ANC_LOSTSYNC_DEAUTHED, /* 0x94 */ 9553737Shx147065 ANC_LOSTSYNC_DISASSOCIATED, /* 0x98 */ 9563737Shx147065 ANC_LOSTSYNC_TSF_TIMING, /* 0x9c */ 9573737Shx147065 ANC_TX_HOST_MCASTS, /* 0xa0 */ 9583737Shx147065 ANC_TX_HOST_BCASTS, /* 0xa4 */ 9593737Shx147065 ANC_TX_HOST_UCASTS, /* 0xa8 */ 9603737Shx147065 ANC_TX_HOST_FAILED, /* 0xac */ 9613737Shx147065 ANC_RX_HOST_MCASTS, /* 0xb0 */ 9623737Shx147065 ANC_RX_HOST_BCASTS, /* 0xb4 */ 9633737Shx147065 ANC_RX_HOST_UCASTS, /* 0xb8 */ 9643737Shx147065 ANC_RX_HOST_DISCARDED, /* 0xbc */ 9653737Shx147065 ANC_TX_HMAC_MCASTS, /* 0xc0 */ 9663737Shx147065 ANC_TX_HMAC_BCASTS, /* 0xc4 */ 9673737Shx147065 ANC_TX_HMAC_UCASTS, /* 0xc8 */ 9683737Shx147065 ANC_TX_HMAC_FAILED, /* 0xcc */ 9693737Shx147065 ANC_RX_HMAC_MCASTS, /* 0xd0 */ 9703737Shx147065 ANC_RX_HMAC_BCASTS, /* 0xd4 */ 9713737Shx147065 ANC_RX_HMAC_UCASTS, /* 0xd8 */ 9723737Shx147065 ANC_RX_HMAC_DISCARDED, /* 0xdc */ 9733737Shx147065 ANC_TX_HMAC_ACCEPTED, /* 0xe0 */ 9743737Shx147065 ANC_SSID_MISMATCHES, /* 0xe4 */ 9753737Shx147065 ANC_AP_MISMATCHES, /* 0xe8 */ 9763737Shx147065 ANC_RATES_MISMATCHES, /* 0xec */ 9773737Shx147065 ANC_AUTH_REJECTS, /* 0xf0 */ 9783737Shx147065 ANC_AUTH_TIMEOUTS, /* 0xf4 */ 9793737Shx147065 ANC_ASSOC_REJECTS, /* 0xf8 */ 9803737Shx147065 ANC_ASSOC_TIMEOUTS, /* 0xfc */ 9813737Shx147065 ANC_REASON_OUTSIDE_TABLE, /* 0x100 */ 9823737Shx147065 ANC_REASON1, /* 0x104 */ 9833737Shx147065 ANC_REASON2, /* 0x108 */ 9843737Shx147065 ANC_REASON3, /* 0x10c */ 9853737Shx147065 ANC_REASON4, /* 0x110 */ 9863737Shx147065 ANC_REASON5, /* 0x114 */ 9873737Shx147065 ANC_REASON6, /* 0x118 */ 9883737Shx147065 ANC_REASON7, /* 0x11c */ 9893737Shx147065 ANC_REASON8, /* 0x120 */ 9903737Shx147065 ANC_REASON9, /* 0x124 */ 9913737Shx147065 ANC_REASON10, /* 0x128 */ 9923737Shx147065 ANC_REASON11, /* 0x12c */ 9933737Shx147065 ANC_REASON12, /* 0x130 */ 9943737Shx147065 ANC_REASON13, /* 0x134 */ 9953737Shx147065 ANC_REASON14, /* 0x138 */ 9963737Shx147065 ANC_REASON15, /* 0x13c */ 9973737Shx147065 ANC_REASON16, /* 0x140 */ 9983737Shx147065 ANC_REASON17, /* 0x144 */ 9993737Shx147065 ANC_REASON18, /* 0x148 */ 10003737Shx147065 ANC_REASON19, /* 0x14c */ 10013737Shx147065 ANC_RX_MGMT_PKTS, /* 0x150 */ 10023737Shx147065 ANC_TX_MGMT_PKTS, /* 0x154 */ 10033737Shx147065 ANC_RX_REFRESH_PKTS, /* 0x158 */ 10043737Shx147065 ANC_TX_REFRESH_PKTS, /* 0x15c */ 10053737Shx147065 ANC_RX_POLL_PKTS, /* 0x160 */ 10063737Shx147065 ANC_TX_POLL_PKTS, /* 0x164 */ 10073737Shx147065 ANC_HOST_RETRIES, /* 0x168 */ 10083737Shx147065 ANC_LOSTSYNC_HOSTREQ, /* 0x16c */ 10093737Shx147065 ANC_HOST_TX_BYTES, /* 0x170 */ 10103737Shx147065 ANC_HOST_RX_BYTES, /* 0x174 */ 10113737Shx147065 ANC_UPTIME_USECS, /* 0x178 */ 10123737Shx147065 ANC_UPTIME_SECS, /* 0x17c */ 10133737Shx147065 ANC_LOSTSYNC_BETTER_AP, /* 0x180 */ 10143737Shx147065 ANC_PRIVACY_MISMATCH, /* 0x184 */ 10153737Shx147065 ANC_JAMMED, /* 0x188 */ 10163737Shx147065 ANC_RX_DISC_WEP_OFF, /* 0x18c */ 10173737Shx147065 ANC_PHY_ELE_MISMATCH, /* 0x190 */ 10183737Shx147065 ANC_LEAP_SUCCESS, /* 0x194 */ 10193737Shx147065 ANC_LEAP_FAILURE, /* 0x198 */ 10203737Shx147065 ANC_LEAP_TIMEOUTS, /* 0x19c */ 10213737Shx147065 ANC_LEAP_KEYLEN_FAIL, /* 0x1a0 */ 10223737Shx147065 ANC_STAT_CNT /* - keep it as the last entry */ 10233737Shx147065 } pcan_cntr_offset; 10243737Shx147065 10253737Shx147065 #define AN_TXCTL_80211 (AN_TXCTL_TXOK_INTR | AN_TXCTL_TXERR_INTR | \ 10263737Shx147065 AN_HEADERTYPE_80211 | AN_PAYLOADTYPE_LLC | AN_TXCTL_NORELEASE) 10273737Shx147065 10283737Shx147065 #define AN_TXCTL_8023 (AN_TXCTL_TXOK_INTR | AN_TXCTL_TXERR_INTR |\ 10293737Shx147065 AN_HEADERTYPE_8023 | AN_PAYLOADTYPE_ETHER | AN_TXCTL_NORELEASE) 10303737Shx147065 10313737Shx147065 #define AN_TXGAP_80211 6 10323737Shx147065 #define AN_TXGAP_8023 0 10333737Shx147065 10343737Shx147065 #define AN_NORMAL_RXMODE (AN_RXMODE_BC_MC_ADDR | \ 10353737Shx147065 AN_RXMODE_USE_8023_HEADER) 10363737Shx147065 #define AN_MONITOR_RXMODE (AN_RXMODE_LAN_MONITOR_CURBSS | \ 10373737Shx147065 AN_RXMODE_USE_8023_HEADER) 10383737Shx147065 struct an_802_3_hdr { 10393737Shx147065 uint16_t an_8023_status; 10403737Shx147065 uint16_t an_8023_payload_len; 10413737Shx147065 uint8_t an_8023_dst_addr[6]; 10423737Shx147065 uint8_t an_8023_src_addr[6]; 10433737Shx147065 uint16_t an_8023_dat[3]; /* SNAP header */ 10443737Shx147065 uint16_t an_8023_type; 10453737Shx147065 }; 10463737Shx147065 10473737Shx147065 typedef struct an_snap_hdr { 10483737Shx147065 uint16_t an_snap_dat[3]; /* SNAP header */ 10493737Shx147065 uint16_t an_snap_type; 10503737Shx147065 } pcan_snaphdr_t; 10513737Shx147065 10523737Shx147065 #define AN_TX_RING_CNT 4 10533737Shx147065 #define AN_TX_RING_MASK (4 - 1) 10543737Shx147065 #define AN_INC(x, y) (x) = (x + 1) % (y) 10553737Shx147065 10563737Shx147065 typedef struct an_tx_ring_data { 10573737Shx147065 uint16_t an_tx_fids[AN_TX_RING_CNT]; 10583737Shx147065 uint16_t an_tx_ring[AN_TX_RING_CNT]; 10593737Shx147065 int an_tx_prod; 10603737Shx147065 int an_tx_cons; 10613737Shx147065 kmutex_t an_tx_lock; /* for send only */ 10623737Shx147065 } pcan_txring_t; 10633737Shx147065 10643737Shx147065 #define AN_802_3_OFFSET 0x2E 10653737Shx147065 #define AN_802_11_OFFSET 0x44 10663737Shx147065 #define AN_802_11_OFFSET_RAW 0x3C 10673737Shx147065 10683737Shx147065 #define AN_STAT_BADCRC 0x0001 10693737Shx147065 #define AN_STAT_UNDECRYPTABLE 0x0002 10703737Shx147065 #define AN_STAT_ERRSTAT 0x0003 10713737Shx147065 #define AN_STAT_MAC_PORT 0x0700 10723737Shx147065 #define AN_STAT_1042 0x2000 /* RFC1042 encoded */ 10733737Shx147065 #define AN_STAT_TUNNEL 0x4000 /* Bridge-tunnel encoded */ 10743737Shx147065 #define AN_STAT_WMP_MSG 0x6000 /* WaveLAN-II management protocol */ 10753737Shx147065 #define AN_RXSTAT_MSG_TYPE 0xE000 10763737Shx147065 10773737Shx147065 #define AN_ENC_TX_802_3 0x00 10783737Shx147065 #define AN_ENC_TX_802_11 0x11 10793737Shx147065 #define AN_ENC_TX_E_II 0x0E 10803737Shx147065 10813737Shx147065 #define AN_ENC_TX_1042 0x00 10823737Shx147065 #define AN_ENC_TX_TUNNEL 0xF8 10833737Shx147065 10843737Shx147065 #define AN_TXCNTL_MACPORT 0x00FF 10853737Shx147065 #define AN_TXCNTL_STRUCTTYPE 0xFF00 10863737Shx147065 10873737Shx147065 /* 10883737Shx147065 * SNAP (sub-network access protocol) constants for transmission 10893737Shx147065 * of IP datagrams over IEEE 802 networks, taken from RFC1042. 10903737Shx147065 * We need these for the LLC/SNAP header fields in the TX/RX frame 10913737Shx147065 * structure. 10923737Shx147065 */ 10933737Shx147065 #define AN_SNAP_K1 0xaa /* assigned global SAP for SNAP */ 10943737Shx147065 #define AN_SNAP_K2 0x00 10953737Shx147065 #define AN_SNAP_CONTROL 0x03 /* unnumbered information format */ 10963737Shx147065 #define AN_SNAP_WORD0 (AN_SNAP_K1 | (AN_SNAP_K1 << 8)) 10973737Shx147065 #define AN_SNAP_WORD1 (AN_SNAP_K2 | (AN_SNAP_CONTROL << 8)) 10983737Shx147065 #define AN_SNAPHDR_LEN 0x6 10993737Shx147065 11003737Shx147065 #define AN_FTYPE_DATA 0x8 11013737Shx147065 #define ETH_HDRLEN (sizeof (struct ether_header)) /* 14 bytes */ 11023737Shx147065 #define MLEN(mp) ((mp)->b_wptr - (mp)->b_rptr) 11033737Shx147065 11043737Shx147065 typedef struct pcan_dma_info { 11053737Shx147065 ddi_dma_handle_t dma_handle; 11063737Shx147065 ddi_acc_handle_t dma_acc_handle; 11073737Shx147065 uint32_t dma_physaddr; 11083737Shx147065 caddr_t dma_virtaddr; 11093737Shx147065 uint_t ncookies; 11103737Shx147065 } pcan_dma_info_t; 11113737Shx147065 11123737Shx147065 #define PCAN_DMA_SYNC(hdl, len, flag) ((void) ddi_dma_sync(hdl, 0, len, (flag))) 11133737Shx147065 11143737Shx147065 /* 11153737Shx147065 * The macinfo is really used as the softstate structure. 11163737Shx147065 * 11173737Shx147065 * pcan_mh - mac_handle_t structure 11183737Shx147065 * pcan_cslock - lock for card services request. Used with pcan_cscv 11193737Shx147065 * pcan_cscv - condition variable to wait for card events 11203737Shx147065 * pcan_chdl - client handle, an uint32_t bit mask encoding for socket, 11213737Shx147065 * function, and client info. 11223737Shx147065 * See cs_priv.h MAKE_CLIENT_HANDLE. 11233737Shx147065 * pcan_log_sock - holds the logical to physical translation for this card. 11243737Shx147065 * Specifically has physical adapter and socket #. 11253737Shx147065 * Socket # is the same as part of the pcan_chdl encoding. 11263737Shx147065 * Physical adapter # is from card service socket impl. 11273737Shx147065 */ 11283737Shx147065 typedef struct pcan_macinfo { 11293737Shx147065 mac_handle_t pcan_mh; 11303737Shx147065 dev_info_t *pcan_dip; 11313737Shx147065 11323737Shx147065 kmutex_t pcan_cslock; /* for card services */ 11333737Shx147065 kcondvar_t pcan_cscv; /* for card services */ 11343737Shx147065 client_handle_t pcan_chdl; /* s,f,c encoding, cs_priv.h */ 11353737Shx147065 map_log_socket_t pcan_log_sock; /* logical/phys socket map */ 11363737Shx147065 int pcan_socket; /* socket number */ 11373737Shx147065 int pcan_config_hi; /* cfttbl index */ 11383737Shx147065 int pcan_config; /* default config index */ 11393737Shx147065 int pcan_vcc; /* vcc level */ 11403737Shx147065 int pcan_iodecode; /* # of address lines */ 11413737Shx147065 int pcan_usewep; 11423737Shx147065 int pcan_reset_delay; 11433737Shx147065 11443737Shx147065 caddr_t pcan_cfg_base; 11453737Shx147065 ddi_acc_handle_t pcan_cfg_handle; 11463737Shx147065 caddr_t pcan_bar0; 11473737Shx147065 ddi_acc_handle_t pcan_handle0; 11483737Shx147065 caddr_t pcan_bar1; 11493737Shx147065 ddi_acc_handle_t pcan_handle1; 11503737Shx147065 caddr_t pcan_bar2; 11513737Shx147065 ddi_acc_handle_t pcan_handle2; 11523737Shx147065 int pcan_device_type; /* pci or pcmcia card */ 11533737Shx147065 11543737Shx147065 uint8_t pcan_mac_addr[ETHERADDRL]; 11553737Shx147065 uint32_t pcan_flag; 11563737Shx147065 uint32_t pcan_reschedule_need; 11573737Shx147065 uint32_t glds_nocarrier; 11583737Shx147065 uint32_t glds_noxmtbuf; 11593737Shx147065 uint32_t glds_norcvbuf; 11603737Shx147065 uint32_t glds_intr; 11613737Shx147065 11623737Shx147065 pcan_dma_info_t pcan_cmd; 11633737Shx147065 pcan_dma_info_t pcan_rx[AN_MAX_RX_DESC]; 11643737Shx147065 pcan_dma_info_t pcan_tx[AN_MAX_TX_DESC]; 11653737Shx147065 11663737Shx147065 kmutex_t pcan_glock; /* generic lock */ 11673737Shx147065 kmutex_t pcan_scanlist_lock; /* scanlist lock */ 11683737Shx147065 pcan_txring_t pcan_txring; 11693737Shx147065 11703737Shx147065 struct an_ltv_ssidlist an_ssidlist; 11713737Shx147065 struct an_ltv_aplist an_aplist; 11723737Shx147065 struct an_ltv_caps an_caps; 11733737Shx147065 struct an_ltv_crypt an_crypt; 11743737Shx147065 struct an_ltv_wepkey an_wepkey[4]; 11753737Shx147065 struct an_ltv_scanresult an_scanresult[32]; 11763737Shx147065 uint16_t an_cur_wepkey; 11773737Shx147065 uint16_t an_scan_num; 11783737Shx147065 timeout_id_t an_scanlist_timeout_id; 11793737Shx147065 list_t an_scan_list; 11803737Shx147065 struct an_ltv_status an_status; 11813737Shx147065 struct an_ltv_genconfig an_config; 11823737Shx147065 struct an_ltv_genconfig an_actual_config; 11833737Shx147065 struct an_ltv_stats an_stats; 11843737Shx147065 uint64_t pcan_cntrs_s[ANC_STAT_CNT]; 11853737Shx147065 11863737Shx147065 ddi_acc_handle_t pcan_port; 11873737Shx147065 ddi_iblock_cookie_t pcan_ib_cookie; 11883737Shx147065 ddi_softintr_t pcan_softint_id; 11893737Shx147065 11903737Shx147065 ddi_softintr_t pcan_info_softint_id; 11913737Shx147065 uint32_t pcan_info_softint_pending; 11923737Shx147065 11933737Shx147065 timeout_id_t pcan_connect_timeout_id; 11943737Shx147065 timeout_id_t pcan_linkdown_timeout_id; 11953737Shx147065 int pcan_badrids_len; 11963737Shx147065 prop_1275_cell_t *pcan_badrids; 11973737Shx147065 } pcan_maci_t; 11983737Shx147065 11993737Shx147065 #define PCAN_IDENT_STRING modldrv.drv_linkinfo 12003737Shx147065 12013737Shx147065 #define HDL(pcan_p) ((pcan_p)->pcan_port) 12023737Shx147065 #define GLD3(pcan_p) ((pcan_p)->pcan_mh) 12033737Shx147065 #define DIP(pcan_p) ((pcan_p)->pcan_dip) 12043737Shx147065 12053737Shx147065 #define PCAN_CARD_INTREN 0x1 12063737Shx147065 #define PCAN_CARD_LINKUP 0x2 12073737Shx147065 #define PCAN_ATTACHED 0x4 12083737Shx147065 #define PCAN_CS_REGISTERED 0x8 12093737Shx147065 #define PCAN_ENABLED 0x10 12103737Shx147065 #define PCAN_CARD_SEND 0x20 12113737Shx147065 #define PCAN_CARD_READY 0x40 12123737Shx147065 #define PCAN_CARD_FAILED 0x80 1213*11101SMikore.Li@Sun.COM #define PCAN_PLUMBED 0x100 1214*11101SMikore.Li@Sun.COM #define PCAN_SUSPENDED 0x200 12153737Shx147065 12163737Shx147065 #define PCAN_STATE_IDLE 0x1 12173737Shx147065 12183737Shx147065 #define PCAN_NICMEM_SZ (2048) /* 80211MTU set as 1500, so 2k here */ 12193737Shx147065 12203737Shx147065 static int pcan_probe(dev_info_t *dip); 12213737Shx147065 static int pcan_attach(dev_info_t *dip, ddi_attach_cmd_t cmd); 12223737Shx147065 static int pcan_detach(dev_info_t *dip, ddi_detach_cmd_t cmd); 12233737Shx147065 12243737Shx147065 static int pcan_register_cs(dev_info_t *dip, pcan_maci_t *pcan_p); 12253737Shx147065 static void pcan_unregister_cs(pcan_maci_t *pcan_p); 12263737Shx147065 static void pcan_destroy_locks(pcan_maci_t *pcan_p); 12273737Shx147065 static void pcan_reset_backend(pcan_maci_t *pcan_p, int timeout); 12283737Shx147065 static uint32_t pcan_get_cap(pcan_maci_t *pcan_p); 12293737Shx147065 static int pcan_card_insert(pcan_maci_t *pcan_p); 12303737Shx147065 static int pcan_ev_hdlr(event_t ev, int pri, event_callback_args_t *arg); 12313737Shx147065 static void pcan_card_remove(pcan_maci_t *pcan_p); 12323737Shx147065 static int pcan_init_nicmem(pcan_maci_t *pcan_p); 1233*11101SMikore.Li@Sun.COM static void pcan_do_suspend(pcan_maci_t *pcan_p); 12343737Shx147065 12353737Shx147065 /* 12363737Shx147065 * high level device access primitives, glock must held before calling 12373737Shx147065 */ 12383737Shx147065 static uint16_t pcan_set_cmd0(pcan_maci_t *pcan_p, uint16_t cmd, uint16_t p0, 12393737Shx147065 uint16_t p1, uint16_t p2); 12403737Shx147065 static uint16_t pcan_set_cmd(pcan_maci_t *pcan_p, uint16_t cmd, uint16_t param); 12413737Shx147065 static uint16_t pcan_set_ch(pcan_maci_t *, uint16_t, uint16_t, uint16_t); 12423737Shx147065 static int pcan_init_dma_desc(pcan_maci_t *pcan_p); 12433737Shx147065 static int pcan_init_dma(dev_info_t *dip, pcan_maci_t *pcan_p); 12443737Shx147065 static void pcan_free_dma(pcan_maci_t *pcan_p); 12453737Shx147065 static uint16_t pcan_put_ltv(pcan_maci_t *pcan_p, uint16_t len, uint16_t type, 12463737Shx147065 uint16_t *val_p); 12473737Shx147065 static uint16_t pcan_get_ltv(pcan_maci_t *pcan_p, uint16_t len, uint16_t type, 12483737Shx147065 uint16_t *val_p); 12493737Shx147065 #define PCAN_READ_LTV 0 12503737Shx147065 #define PCAN_WRITE_LTV 1 12513737Shx147065 static uint16_t pcan_status_ltv(int rw, pcan_maci_t *pcan_p, 12523737Shx147065 struct an_ltv_status *status_p); 12533737Shx147065 static uint16_t pcan_cfg_ltv(int rw, pcan_maci_t *pcan_p, 12543737Shx147065 struct an_ltv_genconfig *cfg_p); 12553737Shx147065 static uint16_t pcan_cap_ltv(int rw, pcan_maci_t *pcan_p); 12563737Shx147065 static uint16_t pcan_ssid_ltv(int rw, pcan_maci_t *pcan_p); 12573737Shx147065 static uint16_t pcan_aplist_ltv(int rw, pcan_maci_t *pcan_p); 12583737Shx147065 static uint16_t pcan_scanresult_ltv(int rw, pcan_maci_t *pcan_p, uint16_t type, 12593737Shx147065 struct an_ltv_scanresult *scanresult_p); 12603737Shx147065 static uint16_t pcan_wepkey_ltv(int rw, pcan_maci_t *pcan_p); 12613737Shx147065 static uint16_t pcan_rdch0(pcan_maci_t *pcan_p, uint16_t type, uint16_t off, 12623737Shx147065 uint16_t *buf_p, int len, int order); 12633737Shx147065 static uint16_t pcan_wrch1(pcan_maci_t *pcan_p, uint16_t type, uint16_t off, 12643737Shx147065 uint16_t *buf_p, int len, int order); 12653737Shx147065 static int pcan_config_mac(pcan_maci_t *pcan_p); 12663737Shx147065 static void pcan_start_locked(pcan_maci_t *pcan_p); 12673737Shx147065 static void pcan_stop_locked(pcan_maci_t *pcan_p); 12683737Shx147065 static uint16_t pcan_alloc_nicmem(pcan_maci_t *pcan_p, uint16_t len, 12693737Shx147065 uint16_t *id_p); 12703737Shx147065 12713737Shx147065 /* 12723737Shx147065 * Required driver entry points for gld 12733737Shx147065 */ 12743737Shx147065 static int pcan_start(void *); 12753737Shx147065 static void pcan_stop(void *); 12763737Shx147065 static int pcan_saddr(void *, const uint8_t *); 12773737Shx147065 static mblk_t *pcan_tx(void *, mblk_t *); 12783737Shx147065 static int pcan_send(pcan_maci_t *, mblk_t *); 12793737Shx147065 static int pcian_send(pcan_maci_t *, mblk_t *); 12803737Shx147065 static int pcan_prom(void *, boolean_t); 12813737Shx147065 static int pcan_gstat(void *, uint_t, uint64_t *); 12823737Shx147065 static int pcan_sdmulti(void *, boolean_t, const uint8_t *); 12833737Shx147065 static void pcan_ioctl(void *, queue_t *, mblk_t *); 12843737Shx147065 12853737Shx147065 static uint_t pcan_intr(caddr_t arg); 12863737Shx147065 static uint_t pcan_intr_hi(caddr_t arg); 12873737Shx147065 static void pcan_rcv(pcan_maci_t *pcan_p); 12883737Shx147065 static void pcian_rcv(pcan_maci_t *pcan_p); 12893737Shx147065 static uint_t pcan_info_softint(caddr_t arg); 12903737Shx147065 static uint32_t pcan_txdone(pcan_maci_t *pcan_p, uint16_t err); 12913737Shx147065 static int pcan_getset(mblk_t *mp, pcan_maci_t *pcan_p, uint32_t cmd); 12923737Shx147065 static void pcan_wlan_ioctl(pcan_maci_t *pcan_p, queue_t *wq, 12933737Shx147065 mblk_t *mp, uint32_t cmd); 12943737Shx147065 static int pcan_loaddef(pcan_maci_t *pcan_p); 12953737Shx147065 12963737Shx147065 static void pcan_scanlist_timeout(void *); 12973737Shx147065 static void pcan_delete_scan_item(pcan_maci_t *, an_scan_list_t *); 12983737Shx147065 static int pcan_add_scan_item(pcan_maci_t *, struct an_ltv_scanresult); 12993737Shx147065 static void pcan_connect_timeout(void *arg); 13003737Shx147065 13013737Shx147065 #define RDCH0(h, t, o, bufp, l) pcan_rdch0(h, t, o, bufp, l, 1) 13023737Shx147065 #define WRCH1(h, t, o, bufp, l) pcan_wrch1(h, t, o, bufp, l, 1) 13033737Shx147065 #define RDPKT(h, t, o, bufp, l) pcan_rdch0(h, t, o, bufp, l, 0) 13043737Shx147065 #define WRPKT(h, t, o, bufp, l) pcan_wrch1(h, t, o, bufp, l, 0) 13053737Shx147065 13063737Shx147065 #define PCAN_READ(p, o, v) { \ 13073737Shx147065 if (p->pcan_device_type == PCAN_DEVICE_PCI) { \ 13083737Shx147065 uint16_t t = ddi_get16(p->pcan_handle0, \ 13093737Shx147065 (uint16_t *)(p->pcan_bar0 + o)); \ 13103737Shx147065 v = LE_16(t); \ 13113737Shx147065 } else { \ 13123737Shx147065 uint16_t t = csx_Get16(HDL(p), o); \ 13133737Shx147065 v = LE_16(t); \ 13143737Shx147065 }\ 13153737Shx147065 } 13163737Shx147065 #define PCAN_WRITE(p, o, v) { \ 13173737Shx147065 if (p->pcan_device_type == PCAN_DEVICE_PCI) { \ 13183737Shx147065 ddi_put16(p->pcan_handle0, \ 13193737Shx147065 (uint16_t *)(p->pcan_bar0 + o), LE_16(v)); \ 13203737Shx147065 } else { \ 13213737Shx147065 csx_Put16(HDL(p), o, LE_16(v)); \ 13223737Shx147065 }\ 13233737Shx147065 } 13243737Shx147065 #define PCAN_READ_P(p, o, v, h) { \ 13253737Shx147065 if (p->pcan_device_type == PCAN_DEVICE_PCI) { \ 13263737Shx147065 uint16_t t = ddi_get16(p->pcan_handle0, \ 13273737Shx147065 (uint16_t *)(p->pcan_bar0 + o)); \ 13283737Shx147065 *(v) = h ? LE_16(t) : t; \ 13293737Shx147065 } else { \ 13303737Shx147065 uint16_t t = csx_Get16(HDL(p), o); \ 13313737Shx147065 *(v) = h ? LE_16(t) : t; \ 13323737Shx147065 }\ 13333737Shx147065 } 13343737Shx147065 #define PCAN_WRITE_P(p, o, v, h) { \ 13353737Shx147065 if (p->pcan_device_type == PCAN_DEVICE_PCI) { \ 13363737Shx147065 ddi_put16(p->pcan_handle0, (uint16_t *)(p->pcan_bar0 + o), \ 13373737Shx147065 h ? LE_16(*(v)) : (*(v))); \ 13383737Shx147065 } else {\ 13393737Shx147065 csx_Put16(HDL(p), o, h ? LE_16(*(v)) : (*(v))); \ 13403737Shx147065 }\ 13413737Shx147065 } 13423737Shx147065 13433737Shx147065 #ifdef _BIG_ENDIAN 13443737Shx147065 #define PCAN_SWAP16(buf_p, len) { \ 13453737Shx147065 uint16_t pcan_swap_len = len; \ 13463737Shx147065 for (pcan_swap_len = (pcan_swap_len + 1) >> 1; pcan_swap_len; ) { \ 13473737Shx147065 uint16_t val; \ 13483737Shx147065 pcan_swap_len--; \ 13493737Shx147065 val = *((uint16_t *)(buf_p) + pcan_swap_len); \ 13503737Shx147065 *((uint16_t *)(buf_p) + pcan_swap_len) = LE_16(val); \ 13513737Shx147065 } \ 13523737Shx147065 } 13533737Shx147065 #define PCAN_SWAP16_BUF(buf_p) PCAN_SWAP16(buf_p, sizeof (buf_p)) 13543737Shx147065 #else /* _BIG_ENDIAN */ 13553737Shx147065 #define PCAN_SWAP16(buf_p, len) 13563737Shx147065 #define PCAN_SWAP16_BUF(buf_p) 13573737Shx147065 #endif /* _BIG_ENDIAN */ 13583737Shx147065 13593737Shx147065 #define PCAN_ENABLE_INTR(pcan_p) {\ 13603737Shx147065 PCAN_WRITE(pcan_p, AN_INT_EN(pcan_p), AN_INTRS(pcan_p));\ 13613737Shx147065 } 13623737Shx147065 #define PCAN_DISABLE_INTR(pcan_p) { \ 13633737Shx147065 PCAN_WRITE(pcan_p, AN_INT_EN(pcan_p), 0); \ 13643737Shx147065 } 13653737Shx147065 #define PCAN_DISABLE_INTR_CLEAR(pcan_p) { \ 13663737Shx147065 PCAN_WRITE(pcan_p, AN_INT_EN(pcan_p), 0); \ 13673737Shx147065 PCAN_WRITE(pcan_p, AN_EVENT_ACK(pcan_p), 0xffff);\ 13683737Shx147065 } 13693737Shx147065 13703737Shx147065 #define PCAN_AUX_PUT32(p, o, v)\ 13713737Shx147065 ddi_put32(p->pcan_handle2, (uint32_t *)(p->pcan_bar2 + o), v) 13723737Shx147065 #define PCAN_AUX_GET32(p, o, v) {\ 13733737Shx147065 v = ddi_get32(p->pcan_handle2, (uint32_t *)(p->pcan_bar2 + o));\ 13743737Shx147065 } 13753737Shx147065 13763737Shx147065 /* 13773737Shx147065 * 16-bit driver private status code 13783737Shx147065 */ 13793737Shx147065 #define PCAN_SUCCESS 0 13803737Shx147065 #define PCAN_FAIL 1 13813737Shx147065 #define PCAN_TIMEDOUT_CMD 0x10 13823737Shx147065 #define PCAN_TIMEDOUT_ACCESS 0x11 13833737Shx147065 #define PCAN_TIMEDOUT_TARGET 0x12 13843737Shx147065 #define PCAN_BADLEN 0x13 13853737Shx147065 #define PCAN_BADTYPE 0x14 13863737Shx147065 #define PCAN_TIMEDOUT_ALLOC 0x15 13873737Shx147065 13883737Shx147065 #define PCAN_STATUS_MAX 0xffff 13893737Shx147065 13903737Shx147065 #ifdef __cplusplus 13913737Shx147065 } 13923737Shx147065 #endif 13933737Shx147065 13943737Shx147065 #endif /* _SYS_PCAN_H */ 1395