/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2008 Weongyo Jeong
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
* redistribution must be conditioned upon including a substantially
* similar Disclaimer requirement for further binary redistribution.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <sys/sysmacros.h>
#include <sys/mac_provider.h>
#include <sys/mac_wifi.h>
#include <sys/net80211.h>
#define USBDRV_MINOR_VER 0
#include "urtw_reg.h"
#include "urtw_var.h"
/*
* device operations
*/
/*
* Module Loading Data & Entry Points
*/
&mod_driverops, /* Type of module. This one is a driver */
"RTL8187L/B driver v1.2", /* short description */
&urtw_dev_ops /* driver specific ops */
};
(void *)&urtw_modldrv,
};
static int urtw_m_start(void *);
static void urtw_m_stop(void *);
static int urtw_m_promisc(void *, boolean_t);
static int urtw_m_unicst(void *, const uint8_t *);
static int urtw_m_setprop(void *, const char *, mac_prop_id_t,
uint_t, const void *);
static int urtw_m_getprop(void *, const char *, mac_prop_id_t,
uint_t, void *);
static void urtw_m_propinfo(void *, const char *, mac_prop_id_t,
NULL,
NULL,
NULL,
NULL,
};
static int urtw_rx_start(struct urtw_softc *);
/*
* Supported rates for 802.11b/g modes (in 500Kbps unit).
*/
{ 4, { 2, 4, 11, 22 } };
{ 12, { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 } };
struct usb_devno {
uint16_t v;
uint16_t p;
};
/*
*/
static struct urtw_type {
} urtw_devs[] = {
#define URTW_DEV_RTL8187(v, p) \
#define URTW_DEV_RTL8187B(v, p) \
/* Realtek RTL8187 devices. */
/* Realtek RTL8187B devices. */
};
/*
* given as an argument.
*/
struct urtw_type *
{
while (nentries-- > 0) {
}
return (NULL);
}
struct urtw_pair {
};
struct urtw_pair_idx {
};
{ 0xf0, 0x32, 0 }, { 0xf1, 0x32, 0 }, { 0xf2, 0x00, 0 },
{ 0xf3, 0x00, 0 }, { 0xf4, 0x32, 0 }, { 0xf5, 0x43, 0 },
{ 0xf6, 0x00, 0 }, { 0xf7, 0x00, 0 }, { 0xf8, 0x46, 0 },
{ 0xf9, 0xa4, 0 }, { 0xfa, 0x00, 0 }, { 0xfb, 0x00, 0 },
{ 0xfc, 0x96, 0 }, { 0xfd, 0xa4, 0 }, { 0xfe, 0x00, 0 },
{ 0xff, 0x00, 0 },
{ 0x58, 0x4b, 1 }, { 0x59, 0x00, 1 }, { 0x5a, 0x4b, 1 },
{ 0x5b, 0x00, 1 }, { 0x60, 0x4b, 1 }, { 0x61, 0x09, 1 },
{ 0x62, 0x4b, 1 }, { 0x63, 0x09, 1 }, { 0xce, 0x0f, 1 },
{ 0xcf, 0x00, 1 }, { 0xe0, 0xff, 1 }, { 0xe1, 0x0f, 1 },
{ 0xe2, 0x00, 1 }, { 0xf0, 0x4e, 1 }, { 0xf1, 0x01, 1 },
{ 0xf2, 0x02, 1 }, { 0xf3, 0x03, 1 }, { 0xf4, 0x04, 1 },
{ 0xf5, 0x05, 1 }, { 0xf6, 0x06, 1 }, { 0xf7, 0x07, 1 },
{ 0xf8, 0x08, 1 },
{ 0x4e, 0x00, 2 }, { 0x0c, 0x04, 2 }, { 0x21, 0x61, 2 },
{ 0x22, 0x68, 2 }, { 0x23, 0x6f, 2 }, { 0x24, 0x76, 2 },
{ 0x25, 0x7d, 2 }, { 0x26, 0x84, 2 }, { 0x27, 0x8d, 2 },
{ 0x4d, 0x08, 2 }, { 0x50, 0x05, 2 }, { 0x51, 0xf5, 2 },
{ 0x52, 0x04, 2 }, { 0x53, 0xa0, 2 }, { 0x54, 0x1f, 2 },
{ 0x55, 0x23, 2 }, { 0x56, 0x45, 2 }, { 0x57, 0x67, 2 },
{ 0x58, 0x08, 2 }, { 0x59, 0x08, 2 }, { 0x5a, 0x08, 2 },
{ 0x5b, 0x08, 2 }, { 0x60, 0x08, 2 }, { 0x61, 0x08, 2 },
{ 0x62, 0x08, 2 }, { 0x63, 0x08, 2 }, { 0x64, 0xcf, 2 },
{ 0x72, 0x56, 2 }, { 0x73, 0x9a, 2 },
{ 0x34, 0xf0, 0 }, { 0x35, 0x0f, 0 }, { 0x5b, 0x40, 0 },
{ 0x84, 0x88, 0 }, { 0x85, 0x24, 0 }, { 0x88, 0x54, 0 },
{ 0x8b, 0xb8, 0 }, { 0x8c, 0x07, 0 }, { 0x8d, 0x00, 0 },
{ 0x94, 0x1b, 0 }, { 0x95, 0x12, 0 }, { 0x96, 0x00, 0 },
{ 0x97, 0x06, 0 }, { 0x9d, 0x1a, 0 }, { 0x9f, 0x10, 0 },
{ 0xb4, 0x22, 0 }, { 0xbe, 0x80, 0 }, { 0xdb, 0x00, 0 },
{ 0xee, 0x00, 0 }, { 0x91, 0x03, 0 },
{ 0x4c, 0x00, 2 }, { 0x9f, 0x00, 3 }, { 0x8c, 0x01, 0 },
{ 0x8d, 0x10, 0 }, { 0x8e, 0x08, 0 }, { 0x8f, 0x00, 0 }
};
0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9d, 0x9c, 0x9b,
0x9a, 0x99, 0x98, 0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90,
0x8f, 0x8e, 0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86, 0x85,
0x84, 0x83, 0x82, 0x81, 0x80, 0x3f, 0x3e, 0x3d, 0x3c, 0x3b, 0x3a,
0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f,
0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24,
0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19,
0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e,
0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03,
0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
};
0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57,
0x55, 0x53, 0x51, 0x4f, 0x4d, 0x4b, 0x49, 0x47,
0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x39, 0x37,
0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27,
0x25, 0x23, 0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17,
0x15, 0x13, 0x11, 0x0f, 0x0d, 0x0b, 0x09, 0x07,
0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2a,
0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d,
0x2d, 0x2d, 0x2d, 0x2e, 0x2e, 0x2e, 0x2e, 0x2f,
0x2f, 0x2f, 0x30, 0x30, 0x31, 0x31, 0x31, 0x31,
0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31
};
0x10, 0x0d, 0x01, 0x00, 0x14, 0xfb, 0xfb, 0x60,
0x00, 0x60, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00,
0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0xa8, 0x26,
0x32, 0x33, 0x07, 0xa5, 0x6f, 0x55, 0xc8, 0xb3,
0x0a, 0xe1, 0x2c, 0x8a, 0x86, 0x83, 0x34, 0x0f,
0x4f, 0x24, 0x6f, 0xc2, 0x6b, 0x40, 0x80, 0x00,
0xc0, 0xc1, 0x58, 0xf1, 0x00, 0xe4, 0x90, 0x3e,
0x6d, 0x3c, 0xfb, 0x07
};
0x0000, /* dummy channel 0 */
0x085c, /* 1 */
0x08dc, /* 2 */
0x095c, /* 3 */
0x09dc, /* 4 */
0x0a5c, /* 5 */
0x0adc, /* 6 */
0x0b5c, /* 7 */
0x0bdc, /* 8 */
0x0c5c, /* 9 */
0x0cdc, /* 10 */
0x0d5c, /* 11 */
0x0ddc, /* 12 */
0x0e5c, /* 13 */
0x0f72, /* 14 */
};
0x23, 0x88, 0x7c, 0xa5, /* -82dbm */
0x23, 0x88, 0x7c, 0xb5, /* -82dbm */
0x23, 0x88, 0x7c, 0xc5, /* -82dbm */
0x33, 0x80, 0x79, 0xc5, /* -78dbm */
0x43, 0x78, 0x76, 0xc5, /* -74dbm */
0x53, 0x60, 0x73, 0xc5, /* -70dbm */
0x63, 0x58, 0x70, 0xc5, /* -66dbm */
};
{ 0x00, 0x0067 }, { 0x01, 0x0fe0 }, { 0x02, 0x044d }, { 0x03, 0x0441 },
{ 0x04, 0x0486 }, { 0x05, 0x0bc0 }, { 0x06, 0x0ae6 }, { 0x07, 0x082a },
{ 0x08, 0x001f }, { 0x09, 0x0334 }, { 0x0a, 0x0fd4 }, { 0x0b, 0x0391 },
{ 0x0c, 0x0050 }, { 0x0d, 0x06db }, { 0x0e, 0x0029 }, { 0x0f, 0x0914 },
};
{ 0x00, 0x01 }, { 0x01, 0x02 }, { 0x02, 0x42 }, { 0x03, 0x00 },
{ 0x04, 0x00 }, { 0x05, 0x00 }, { 0x06, 0x40 }, { 0x07, 0x00 },
{ 0x08, 0x40 }, { 0x09, 0xfe }, { 0x0a, 0x09 }, { 0x0b, 0x80 },
{ 0x0c, 0x01 }, { 0x0e, 0xd3 }, { 0x0f, 0x38 }, { 0x10, 0x84 },
{ 0x11, 0x06 }, { 0x12, 0x20 }, { 0x13, 0x20 }, { 0x14, 0x00 },
{ 0x15, 0x40 }, { 0x16, 0x00 }, { 0x17, 0x40 }, { 0x18, 0xef },
{ 0x19, 0x19 }, { 0x1a, 0x20 }, { 0x1b, 0x76 }, { 0x1c, 0x04 },
{ 0x1e, 0x95 }, { 0x1f, 0x75 }, { 0x20, 0x1f }, { 0x21, 0x27 },
{ 0x22, 0x16 }, { 0x24, 0x46 }, { 0x25, 0x20 }, { 0x26, 0x90 },
{ 0x27, 0x88 }
};
{ 0x00, 0x98 }, { 0x03, 0x20 }, { 0x04, 0x7e }, { 0x05, 0x12 },
{ 0x06, 0xfc }, { 0x07, 0x78 }, { 0x08, 0x2e }, { 0x10, 0x9b },
{ 0x11, 0x88 }, { 0x12, 0x47 }, { 0x13, 0xd0 }, { 0x19, 0x00 },
{ 0x1a, 0xa0 }, { 0x1b, 0x08 }, { 0x40, 0x86 }, { 0x41, 0x8d },
{ 0x42, 0x15 }, { 0x43, 0x18 }, { 0x44, 0x1f }, { 0x45, 0x1e },
{ 0x46, 0x1a }, { 0x47, 0x15 }, { 0x48, 0x10 }, { 0x49, 0x0a },
{ 0x4a, 0x05 }, { 0x4b, 0x02 }, { 0x4c, 0x05 }
};
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07b0, 0x07b1, 0x07b2, 0x07b3,
0x07b4, 0x07b5, 0x07b8, 0x07b9, 0x07ba, 0x07bb, 0x07bb
};
0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd,
};
0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e
};
0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02,
0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02,
0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02,
0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02,
0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03,
0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03
};
0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00,
0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00,
0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00,
0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00,
0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00,
0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00
};
0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4
};
0x23, 0x15, 0xa5, /* -82-1dbm */
0x23, 0x15, 0xb5, /* -82-2dbm */
0x23, 0x15, 0xc5, /* -82-3dbm */
0x33, 0x15, 0xc5, /* -78dbm */
0x43, 0x15, 0xc5, /* -74dbm */
0x53, 0x15, 0xc5, /* -70dbm */
0x63, 0x15, 0xc5, /* -66dbm */
};
{ 0x00, 0x02bf }, { 0x01, 0x0ee0 }, { 0x02, 0x044d }, { 0x03, 0x0441 },
{ 0x04, 0x08c3 }, { 0x05, 0x0c72 }, { 0x06, 0x00e6 }, { 0x07, 0x082a },
{ 0x08, 0x003f }, { 0x09, 0x0335 }, { 0x0a, 0x09d4 }, { 0x0b, 0x07bb },
{ 0x0c, 0x0850 }, { 0x0d, 0x0cdf }, { 0x0e, 0x002b }, { 0x0f, 0x0114 }
};
{ 0x00, 0x01 }, { 0x01, 0x02 }, { 0x02, 0x42 }, { 0x03, 0x00 },
{ 0x04, 0x00 }, { 0x05, 0x00 }, { 0x06, 0x40 }, { 0x07, 0x00 },
{ 0x08, 0x40 }, { 0x09, 0xfe }, { 0x0a, 0x08 }, { 0x0b, 0x80 },
{ 0x0c, 0x01 }, { 0x0d, 0x43 }, { 0x0e, 0xd3 }, { 0x0f, 0x38 },
{ 0x10, 0x84 }, { 0x11, 0x07 }, { 0x12, 0x20 }, { 0x13, 0x20 },
{ 0x14, 0x00 }, { 0x15, 0x40 }, { 0x16, 0x00 }, { 0x17, 0x40 },
{ 0x18, 0xef }, { 0x19, 0x19 }, { 0x1a, 0x20 }, { 0x1b, 0x15 },
{ 0x1c, 0x04 }, { 0x1d, 0xc5 }, { 0x1e, 0x95 }, { 0x1f, 0x75 },
{ 0x20, 0x1f }, { 0x21, 0x17 }, { 0x22, 0x16 }, { 0x23, 0x80 },
{ 0x24, 0x46 }, { 0x25, 0x00 }, { 0x26, 0x90 }, { 0x27, 0x88 }
};
{ 0x00, 0x98 }, { 0x03, 0x20 }, { 0x04, 0x7e }, { 0x05, 0x12 },
{ 0x06, 0xfc }, { 0x07, 0x78 }, { 0x08, 0x2e }, { 0x09, 0x11 },
{ 0x0a, 0x17 }, { 0x0b, 0x11 }, { 0x10, 0x9b }, { 0x11, 0x88 },
{ 0x12, 0x47 }, { 0x13, 0xd0 }, { 0x19, 0x00 }, { 0x1a, 0xa0 },
{ 0x1b, 0x08 }, { 0x1d, 0x00 }, { 0x40, 0x86 }, { 0x41, 0x9d },
{ 0x42, 0x15 }, { 0x43, 0x18 }, { 0x44, 0x36 }, { 0x45, 0x35 },
{ 0x46, 0x2e }, { 0x47, 0x25 }, { 0x48, 0x1c }, { 0x49, 0x12 },
{ 0x4a, 0x09 }, { 0x4b, 0x04 }, { 0x4c, 0x05 }
};
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
};
0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
};
0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04,
0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03,
0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03,
0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03
};
0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00,
0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00,
0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00,
0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00
};
{ 0x00, 0x00b7 }, { 0x01, 0x0ee0 }, { 0x02, 0x044d }, { 0x03, 0x0441 },
{ 0x04, 0x08c3 }, { 0x05, 0x0c72 }, { 0x06, 0x00e6 }, { 0x07, 0x082a },
{ 0x08, 0x003f }, { 0x09, 0x0335 }, { 0x0a, 0x09d4 }, { 0x0b, 0x07bb },
{ 0x0c, 0x0850 }, { 0x0d, 0x0cdf }, { 0x0e, 0x002b }, { 0x0f, 0x0114 },
{ 0x00, 0x01b7 }
};
{ 2, 0 }, { 4, 1 }, { 11, 2 }, { 12, 4 }, { 18, 5 },
{ 22, 3 }, { 24, 6 }, { 36, 7 }, { 48, 8 }, { 72, 9 },
{ 96, 10 }, { 108, 11 }
};
static int urtw_8187_init(void *);
static void urtw_stop(struct urtw_softc *);
static int urtw_set_channel(struct urtw_softc *);
static void
static int
static usbd_status
static usbd_status
static usbd_status
static usbd_status
static usbd_status
static usbd_status
int);
uint32_t *);
static usbd_status
static void urtw_close_pipes(struct urtw_softc *);
static void urtw_led_launch(void *);
static void urtw_8187b_update_wmm(struct urtw_softc *);
static int urtw_8187b_init(void *);
static void urtw_8225v2_b_config_mac(struct urtw_softc *);
static void urtw_8225v2_b_init_rfe(struct urtw_softc *);
static void urtw_8225v2_b_set_txpwrlvl(struct urtw_softc *, int);
#ifdef DEBUG
static void
{
return;
}
}
#define URTW8187_DBG(l, x) do {\
if ((l) & urtw8187_dbg_flags) \
urtw8187_dbg x;\
} while (0)
#else
#define URTW8187_DBG(l, x)
#endif
static usbd_status
{
goto fail;
if (error != 0)
goto fail;
switch (rev & URTW_EPROM_CID_MASK) {
case URTW_EPROM_CID_ALPHA0:
break;
break;
case URTW_EPROM_CID_HW_LED:
break;
case URTW_EPROM_CID_RSVD0:
case URTW_EPROM_CID_RSVD1:
default:
break;
}
fail:
return (error);
}
static usbd_status
{
if (mp == 0) {
return (-1);
}
if (error != USB_SUCCESS) {
"urtw_8225_write_s16: could not set regs:"
}
if (mp)
return (error);
}
static usbd_status
{
int i;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
o1 &= ~0xf;
o1 | URTW_BB_HOST_BANG_EN, 0))
goto fail;
DELAY(5);
goto fail;
DELAY(5);
goto fail;
DELAY(2);
goto fail;
DELAY(2);
goto fail;
DELAY(2);
if (i == 2)
break;
goto fail;
DELAY(2);
goto fail;
DELAY(2);
goto fail;
DELAY(1);
}
goto fail;
DELAY(2);
goto fail;
DELAY(2);
o1 | URTW_BB_HOST_BANG_RW, 0))
goto fail;
DELAY(2);
mask = 0x800;
o1 | URTW_BB_HOST_BANG_RW, 0))
goto fail;
DELAY(2);
goto fail;
DELAY(2);
goto fail;
DELAY(2);
goto fail;
DELAY(2);
goto fail;
o1 | URTW_BB_HOST_BANG_RW, 0))
goto fail;
DELAY(2);
}
URTW_BB_HOST_BANG_RW, 0))
goto fail;
DELAY(2);
goto fail;
goto fail;
fail:
return (error);
}
static void
urtw_delay_ms(int t)
{
DELAY(t * 1000);
}
static usbd_status
{
goto fail;
d80 &= 0xfff3;
goto fail;
goto fail;
d84 &= 0xfff0;
d82 | 0x0007, 0))
goto fail;
d84 | 0x0007, 0))
goto fail;
d80 | URTW_BB_HOST_BANG_EN, 0))
goto fail;
urtw_delay_ms(2);
goto fail;
if (error != 0)
goto fail;
d80 | URTW_BB_HOST_BANG_EN, 0))
goto fail;
d80 | URTW_BB_HOST_BANG_EN, 0))
goto fail;
urtw_delay_ms(2);
fail:
return (error);
}
static usbd_status
{
*ret = 1;
goto fail;
goto fail;
goto fail;
urtw_delay_ms(300);
goto fail;
if (error != 0)
goto fail;
if (data != 0x588)
*ret = 0;
else {
if (error != 0)
goto fail;
if (data != 0x700)
*ret = 0;
}
fail:
return (error);
}
static usbd_status
{
int ret;
if (error != 0) {
return (-1);
}
switch (data & 0xff) {
if (error != 0) {
"8225 version check failed\n"));
goto fail;
}
if (ret == 0) {
"8225 detected\n"));
} else {
"8225 v2 detected\n"));
}
break;
default:
goto fail;
}
} else {
"8225 v2 [b] detected\n"));
}
return (0);
fail:
return (-1);
}
static usbd_status
{
int i, j;
if (error != 0)
goto fail;
for (i = 1, j = 0; i < 6; i += 2, j++) {
if (error != 0)
goto fail;
}
for (i = 1, j = 0; i < 4; i += 2, j++) {
if (error != 0)
goto fail;
}
for (i = 1, j = 0; i < 4; i += 2, j++) {
&data);
if (error != 0)
goto fail;
}
} else {
/* Channel 11. */
if (error != 0)
goto fail;
/* Channel 12. */
if (error != 0)
goto fail;
/* Channel 13, 14. */
if (error != 0)
goto fail;
}
fail:
return (error);
}
static usbd_status
{
uint8_t *m = 0;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
"MAC: %x:%x:%x:%x:%x:%x\n",
m[0], m[1], m[2], m[3], m[4], m[5]));
fail:
return (error);
}
static usbd_status
{
int addrlen, i;
/* NB: make sure the buffer is initialized */
*data = 0;
/* enable EPROM programming */
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
addrlen = 8;
} else {
addrlen = 6;
}
if (error != 0)
goto fail;
if (error != 0)
goto fail;
for (i = 0; i < 16; i++) {
if (error != 0)
goto fail;
if (error != 0)
goto fail;
}
if (error != 0)
goto fail;
if (error != 0)
goto fail;
/* now disable EPROM programming */
fail:
return (error);
}
static usbd_status
{
return (error);
}
static usbd_status
{
int i = 0;
for (i = 0; i < buflen; i++) {
if (error != 0)
goto fail;
if (error != 0)
goto fail;
}
fail:
return (error);
}
static usbd_status
{
goto fail;
if (bit != 0)
data | URTW_EPROM_WRITEBIT, 0);
else
data & ~URTW_EPROM_WRITEBIT, 0);
fail:
return (error);
}
static usbd_status
{
/* masking */
goto fail;
goto fail;
/* unmasking */
goto fail;
fail:
return (error);
}
static usbd_status
{
goto fail;
if (able == URTW_EPROM_ENABLE)
data | URTW_EPROM_CS, 0);
else
data & ~URTW_EPROM_CS, 0);
fail:
return (error);
}
static usbd_status
{
if (error != USB_SUCCESS) {
"urtw_read8_c: get regs req failed :"
return (error);
}
if (mp)
return (error);
}
static usbd_status
{
if (error != USB_SUCCESS) {
"urtw_read8e: get regs req failed :"
return (error);
}
if (mp) {
}
return (error);
}
static usbd_status
{
if (error != USB_SUCCESS) {
"urtw_read16_c: get regs req failed :"
" cr:%s(%d), cf:(%x)\n",
return (error);
}
if (mp) {
}
return (error);
}
static usbd_status
{
if (error != USB_SUCCESS) {
"urtw_read32_c: get regs req failed :"
return (error);
}
if (mp) {
}
return (error);
}
static usbd_status
{
int error;
return (-1);
}
if (error != USB_SUCCESS) {
"urtw_write8_c: could not set regs:"
}
if (mp)
return (error);
}
static usbd_status
{
int error;
return (-1);
}
if (error != USB_SUCCESS) {
"urtw_write8e: could not set regs:"
"cr:%s(%d), cf:(%x)\n",
}
if (mp)
return (error);
}
static usbd_status
{
int error;
return (-1);
}
if (error != USB_SUCCESS) {
"urtw_write16_c: could not set regs:"
"cr:%s(%d), cf:(%x)\n",
}
if (mp)
return (error);
}
static usbd_status
{
int error;
return (-1);
}
if (error != USB_SUCCESS) {
"urtw_write32_c: could not set regs:"
"cr:%s(%d), cf:(%x)\n",
}
if (mp)
return (error);
}
static usbd_status
{
goto fail;
fail:
return (error);
}
static usbd_status
{
if (error)
goto fail;
goto fail;
data | URTW_CONFIG3_ANAPARAM_WRITE, 0))
goto fail;
goto fail;
goto fail;
data & ~URTW_CONFIG3_ANAPARAM_WRITE, 0))
goto fail;
if (error)
goto fail;
fail:
return (error);
}
static usbd_status
{
if (error)
goto fail;
goto fail;
data | URTW_CONFIG3_ANAPARAM_WRITE, 0))
goto fail;
goto fail;
goto fail;
data & ~URTW_CONFIG3_ANAPARAM_WRITE, 0))
goto fail;
if (error)
goto fail;
fail:
return (error);
}
static usbd_status
{
return (error);
}
static usbd_status
{
if (error)
goto fail;
if (error)
goto fail;
if (error)
goto fail;
urtw_delay_ms(50);
if (error != 0)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
urtw_delay_ms(50);
goto fail;
goto fail;
urtw_delay_ms(50);
goto fail;
if (data & URTW_CMD_RST) {
goto fail;
}
if (error)
goto fail;
urtw_delay_ms(50);
if (error)
goto fail;
if (error)
goto fail;
fail:
return (error);
}
static usbd_status
{
if (type == URTW_LED_GPIO) {
switch (sc->sc_gpio_ledpin) {
case URTW_LED_PIN_GPIO0:
break;
default:
sc->sc_gpio_ledpin);
/* never reach */
}
} else {
/* never reach */
}
return (0);
}
static usbd_status
{
if (type == URTW_LED_GPIO) {
switch (sc->sc_gpio_ledpin) {
case URTW_LED_PIN_GPIO0:
break;
default:
sc->sc_gpio_ledpin);
/* never reach */
}
} else {
/* never reach */
}
sc->sc_gpio_ledon = 0;
return (0);
}
static usbd_status
{
"urtw_led_mode0: mode = %d\n", mode));
switch (mode) {
case URTW_LED_CTL_POWER_ON:
break;
case URTW_LED_CTL_TX:
return (0);
break;
case URTW_LED_CTL_LINK:
break;
default:
/* never reach */
}
switch (sc->sc_gpio_ledstate) {
case URTW_LED_ON:
if (sc->sc_gpio_ledinprogress != 0)
break;
break;
case URTW_LED_BLINK_NORMAL:
if (sc->sc_gpio_ledinprogress != 0)
break;
"urtw_led_mode0: restart led timer\n"));
(void *)sc,
sc->sc_gpio_ledinprogress = 0;
}
break;
case URTW_LED_POWER_ON_BLINK:
urtw_delay_ms(100);
break;
default:
"urtw_led_mode0: unknown LED status 0x%x",
sc->sc_gpio_ledstate));
}
return (0);
}
static usbd_status
{
return (USBD_INVAL);
}
static usbd_status
{
return (USBD_INVAL);
}
static usbd_status
{
return (USBD_INVAL);
}
static usbd_status
{
"urtw_led_blink: gpio_blinkstate %d\n",
sc->sc_gpio_blinkstate));
else
sc->sc_gpio_blinktime--;
if (sc->sc_gpio_blinktime == 0)
ing = 1;
else {
ing = 1;
}
if (ing == 1) {
sc->sc_gpio_ledon == 0)
sc->sc_gpio_blinktime = 0;
sc->sc_gpio_ledinprogress = 0;
return (0);
}
switch (sc->sc_gpio_ledstate) {
case URTW_LED_BLINK_NORMAL:
"URTW_LED_BLINK_NORMAL\n"));
return (1);
default:
}
return (0);
}
static usbd_status
{
switch (sc->sc_strategy) {
case URTW_SW_LED_MODE0:
break;
case URTW_SW_LED_MODE1:
break;
case URTW_SW_LED_MODE2:
break;
case URTW_SW_LED_MODE3:
break;
default:
/* never reach */
return (-1);
}
return (error);
}
static usbd_status
{
goto fail;
data &= ~URTW_MSR_LINK_MASK;
/* Should always be set. */
if (nstate == IEEE80211_S_RUN) {
case IEEE80211_M_STA:
case IEEE80211_M_MONITOR:
break;
case IEEE80211_M_IBSS:
break;
case IEEE80211_M_HOSTAP:
break;
default:
return (-1);
}
} else
fail:
return (error);
}
static uint16_t
{
#define N(a) (sizeof (a) / sizeof ((a)[0]))
int i;
for (i = 0; i < N(urtw_ratetable); i++) {
return (urtw_ratetable[i].val);
}
return (3);
#undef N
}
static uint16_t
{
#define N(a) (sizeof (a) / sizeof ((a)[0]))
int i;
for (i = 0; i < N(urtw_ratetable); i++) {
return (urtw_ratetable[i].reg);
}
return (0);
#undef N
}
static usbd_status
{
min_rr_rate << URTW_RESP_MIN_RATE_SHIFT, 0))
goto fail;
goto fail;
data &= ~URTW_BRSR_MBR_8185;
for (i = 0; i <= basic_rate; i++)
data |= (1 << i);
fail:
return (error);
}
static usbd_status
{
return (error);
}
static usbd_status
{
goto fail;
}
a = URTW_MAX_RX_DMA_2048;
b = 0x80000000;
fail:
return (error);
}
static usbd_status
{
int i;
for (i = 0; i < URTW_RX_DATA_LIST_COUNT; i++) {
if (urtw_rx_start(sc) != 0) {
return (USB_FAILURE);
}
}
if (error != 0)
goto fail;
goto fail;
fail:
return (error);
}
void
{
data8 &= ~(URTW_CW_CONF_PERPACKET_CW |
data &= ~URTW_TX_SWPLCPLEN;
data |= URTW_TX_NOICV;
} else {
}
}
static int
{
int i;
if (error)
goto fail;
/* for led */
if (error != 0)
goto fail;
if (error)
goto fail;
/* applying MAC address again. */
for (i = 0; i < IEEE80211_ADDR_LEN; i++)
if (error)
goto fail;
if (error)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
sc->sc_tx_low_queued = 0;
sc->sc_tx_normal_queued = 0;
if (error != 0)
goto fail;
if (error == 0) {
CE_CONT, "urtw_8187_init: succesfully done\n"));
return (error);
}
fail:
return (EIO);
}
static usbd_status
{
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
urtw_delay_ms(100);
fail:
return (error);
}
static usbd_status
{
return (error);
}
static usbd_status
{
goto fail;
goto fail;
goto fail;
/*
* Delay removed from 8185 to 8187.
* usbd_delay_ms(sc->sc_udev, 1);
*/
fail:
return (error);
}
static usbd_status
{
}
static usbd_status
{
}
static usbd_status
{
goto fail;
goto fail;
goto fail;
fail:
return (error);
}
static usbd_status
{
cck_pwrlvl_max = 11;
ofdm_pwrlvl_min = 10;
/* CCK power setting */
goto fail;
for (i = 0; i < 8; i++) {
goto fail;
}
urtw_delay_ms(1);
/* OFDM power setting */
if (error)
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
urtw_delay_ms(1);
fail:
return (error);
}
static usbd_status
{
urtw_delay_ms(1);
return (error);
}
static usbd_status
{
#define N(a) (sizeof (a) / sizeof ((a)[0]))
int i;
if (error)
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
urtw_delay_ms(100);
for (i = 0; i < N(urtw_8225_rf_part1); i++) {
urtw_8225_rf_part1[i].val))
goto fail;
urtw_delay_ms(1);
}
urtw_delay_ms(50);
goto fail;
urtw_delay_ms(50);
goto fail;
urtw_delay_ms(50);
goto fail;
for (i = 0; i < 95; i++) {
goto fail;
goto fail;
}
goto fail;
goto fail;
for (i = 0; i < 128; i++) {
urtw_8225_agc[i]))
goto fail;
urtw_delay_ms(1);
(uint8_t)i + 0x80))
goto fail;
urtw_delay_ms(1);
}
for (i = 0; i < N(urtw_8225_rf_part2); i++) {
urtw_8225_rf_part2[i].val))
goto fail;
urtw_delay_ms(1);
}
if (error)
goto fail;
for (i = 0; i < N(urtw_8225_rf_part3); i++) {
urtw_8225_rf_part3[i].val))
goto fail;
urtw_delay_ms(1);
}
goto fail;
goto fail;
goto fail;
urtw_delay_ms(1);
goto fail;
urtw_delay_ms(1);
/* TX ant A, 0x0 for B */
goto fail;
goto fail;
fail:
return (error);
#undef N
}
static usbd_status
{
#define IEEE80211_CHAN_G \
goto fail;
goto fail;
urtw_delay_ms(10);
goto fail;
goto fail;
else
goto fail;
if (gset) {
/* for G */
goto fail;
goto fail;
} else {
/* for B */
goto fail;
goto fail;
}
fail:
return (error);
}
static usbd_status
{
return (-1);
goto fail;
else
goto fail;
goto fail;
fail:
return (error);
}
static void
{
}
static int
{
}
/* ARGSUSED */
static void
{
"urtw_rxeof failed! %d, mp %p\n",
goto fail;
}
/* 4 dword and 4 byte CRC */
else
/* 5 dword and 4 byte CRC */
goto fail;
}
/* XXX correct? */
if (!urtw_isbmode(rate)) {
} else {
}
} else {
if (rssi >= 95)
rssi = 95;
"urtw_rxeof: rssi %u\n", rssi));
}
== IEEE80211_FC0_TYPE_DATA) {
"urtw_rxeof: update sc_currate to %u\n",
sc->sc_currate));
}
/* send the frame to the 802.11 layer */
/* node is no longer needed */
fail:
(void) urtw_rx_start(sc);
}
static usbd_status
{
/* XXX for A? */
goto fail;
urtw_delay_ms(1);
urtw_delay_ms(1);
goto fail;
urtw_delay_ms(1);
goto fail;
urtw_delay_ms(1);
fail:
return (error);
}
static usbd_status
{
int i;
/* CCK power setting */
for (i = 0; i < 8; i++) {
cck_pwrtable[i]))
goto fail;
}
goto fail;
urtw_delay_ms(1);
/* OFDM power setting */
if (error)
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
urtw_delay_ms(1);
fail:
return (error);
}
static usbd_status
{
#define N(a) (sizeof (a)/ sizeof ((a)[0]))
int i;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
urtw_delay_ms(500);
for (i = 0; i < N(urtw_8225v2_rf_part1); i++) {
urtw_8225v2_rf_part1[i].val))
goto fail;
urtw_delay_ms(1);
}
urtw_delay_ms(100);
goto fail;
for (i = 0; i < 95; i++) {
goto fail;
urtw_delay_ms(1);
goto fail;
urtw_delay_ms(1);
}
goto fail;
urtw_delay_ms(1);
goto fail;
urtw_delay_ms(1);
goto fail;
urtw_delay_ms(1);
goto fail;
urtw_delay_ms(100);
goto fail;
urtw_delay_ms(100);
goto fail;
if (data32 != 0xe6) {
error = (-1);
goto fail;
}
if (!(data32 & 0x80)) {
goto fail;
urtw_delay_ms(200);
goto fail;
urtw_delay_ms(100);
goto fail;
if (!(data32 & 0x80))
}
urtw_delay_ms(200);
goto fail;
for (i = 0; i < 128; i++) {
urtw_8225_agc[i]))
goto fail;
urtw_delay_ms(1);
(uint8_t)i + 0x80))
goto fail;
urtw_delay_ms(1);
}
urtw_delay_ms(1);
for (i = 0; i < N(urtw_8225v2_rf_part2); i++) {
urtw_8225v2_rf_part2[i].val))
goto fail;
urtw_delay_ms(1);
}
if (error)
goto fail;
for (i = 0; i < N(urtw_8225v2_rf_part3); i++) {
urtw_8225v2_rf_part3[i].val))
goto fail;
urtw_delay_ms(1);
}
goto fail;
goto fail;
goto fail;
urtw_delay_ms(1);
goto fail;
urtw_delay_ms(1);
/* TX ant A, 0x0 for B */
goto fail;
goto fail;
fail:
return (error);
#undef N
}
static usbd_status
{
goto fail;
goto fail;
urtw_delay_ms(10);
goto fail;
goto fail;
} else
goto fail;
if (gset) {
/* for G */
goto fail;
goto fail;
goto fail;
} else {
/* for B */
goto fail;
goto fail;
goto fail;
}
fail:
return (error);
}
static int
{
goto fail;
data | URTW_TX_LOOPBACK_MAC, 0))
goto fail;
if (error)
goto fail;
urtw_delay_ms(20);
data | URTW_TX_LOOPBACK_NONE, 0);
fail:
return (error);
}
/* ARGSUSED */
static void
{
"urtw_txeof_low(): cr:%s(%d), flags:0x%x, tx_queued:%d",
sc->sc_tx_low_queued));
goto fail;
}
if (sc->sc_need_sched) {
sc->sc_need_sched = 0;
}
fail:
sc->sc_tx_low_queued--;
}
/* ARGSUSED */
static void
{
"urtw_txeof_normal(): cr:%s(%d), flags:0x%x, tx_queued:%d",
goto fail;
}
if (sc->sc_need_sched) {
sc->sc_need_sched = 0;
}
fail:
}
static int
{
int rate;
else
rate = 0;
return (rate & IEEE80211_RATE_VAL);
}
void
{
sifs = 0xa;
if (IEEE80211_IS_CHAN_G(c))
slot = 0x9;
else
slot = 0x14;
ecwmin = 3;
ecwmax = 7;
}
{
if (error)
goto fail;
data & ~URTW_CONFIG3_ANAPARAM_WRITE, 0);
if (error)
goto fail;
urtw_delay_ms(100);
if (data & URTW_CMD_RST) {
goto fail;
}
fail:
return (error);
}
static int
{
int i;
if (error)
goto fail;
if (error != 0)
goto fail;
/* Applying MAC address again. */
if (error)
goto fail;
for (i = 0; i < IEEE80211_ADDR_LEN; i++)
ic->ic_macaddr[i], 0);
if (error)
goto fail;
if (error)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
if (error != 0)
goto fail;
sc->sc_tx_low_queued = 0;
sc->sc_tx_normal_queued = 0;
if (error != 0)
goto fail;
if (error == 0) {
CE_CONT, "urtw_8187b_init: done\n"));
return (error);
}
fail:
return (EIO);
}
void
{
int i;
/ sizeof ((urtw_8187b_regtbl)[0]);
for (i = 0; i < nitems; i++) {
}
}
void
{
urtw_delay_ms(100);
}
{
sifs = 0xa;
if (IEEE80211_IS_CHAN_G(c)) {
slot = 0x9;
difs = 0x1c;
eifs = 0x5b;
} else {
slot = 0x14;
difs = 0x32;
eifs = 0x5b;
}
return (0);
}
{
int i, nitems;
/* Set up ACK rate, retry limit, TX AGC, TX antenna. */
/* Auto rate fallback control. */
if (error)
goto fail;
if (error)
goto fail;
if (error)
goto fail;
data | URTW_CONFIG3_ANAPARAM_WRITE, 0);
if (error)
goto fail;
for (i = 0; i < nitems; i++) {
urtw_8225v2_b_rf[i].val);
}
for (i = 0; i < nitems; i++) {
}
urtw_delay_ms(10);
urtw_delay_ms(10);
urtw_delay_ms(10);
for (i = 0; i < nitems; i++) {
}
for (i = 0; i < nitems; i++) {
}
(void) urtw_8225v2_b_update_chan(sc);
fail:
return (error);
}
static usbd_status
{
int error = 0;
if (error)
goto fail;
/*
* Delay removed from 8185 to 8187.
* usbd_delay_ms(sc->sc_udev, 10);
*/
if (error)
goto fail;
if (error)
goto fail;
if (error)
goto fail;
fail:
return (error);
}
void
{
int i;
cck_pwrlvl_min = 0;
cck_pwrlvl_max = 15;
ofdm_pwrlvl_min = 2;
ofdm_pwrlvl_max = 17;
} else {
cck_pwrlvl_min = 7;
cck_pwrlvl_max = 22;
ofdm_pwrlvl_min = 10;
ofdm_pwrlvl_max = 25;
}
/* CCK power setting */
cck_pwrtable += 8;
if (cck_pwrlvl > 11)
cck_pwrtable += 16;
} else {
cck_pwrtable += 8;
cck_pwrtable += 16;
if (cck_pwrlvl > 17)
cck_pwrtable += 24;
}
for (i = 0; i < 8; i++) {
}
/*
* Delay removed from 8185 to 8187.
* usbd_delay_ms(sc->sc_udev, 1);
*/
/* OFDM power setting */
if (ofdm_pwrlvl <= 11) {
} else {
}
} else {
if (ofdm_pwrlvl <= 11) {
} else if (ofdm_pwrlvl <= 17) {
} else {
}
}
/*
* Delay removed from 8185 to 8187.
* usbd_delay_ms(sc->sc_udev, 1);
*/
}
static int
{
struct ieee80211_key *k;
if (URTW_IS_SUSPENDING(sc)) {
err = 0;
goto failed;
}
"urtw_send(): no TX buffer!\n"));
sc->sc_tx_nobuf++;
goto failed;
}
if (m == NULL) {
goto failed;
}
}
goto failed;
}
if ((type & IEEE80211_FC0_TYPE_MASK) ==
}
k = ieee80211_crypto_encap(ic, m);
if (k == NULL) {
goto failed;
}
/* packet header may have moved, reset our local pointer */
}
else
xferlen += 1;
/* XXX sc_preamble_mode is always 2. */
/* RTS rate - 10 means we use a basic rate. */
/*
* XXX currently TX rate control depends on the rate value of
* RX descriptor because I don't know how to we can control TX rate
* in more smart way. Please fix me you find a thing.
*/
} else
buf[3] = 0;
} else {
}
"sending frame len=%u rate=%u xfer len=%u\n",
if (!err) {
} else {
}
if ((mp) &&
err == DDI_SUCCESS)) {
}
if (m) freemsg(m);
(err != 0)) {
}
return (err);
}
static void
{
if (URTW_IS_NOT_RUNNING(sc)) {
sc->sc_scan_id = 0;
return;
}
(void) ieee80211_next_scan(ic);
}
sc->sc_scan_id = 0;
}
static void
{
int error = 0;
URTW_IS_SUSPENDING(sc)) {
"failed process LED strategy 0x%x, run?%d",
sc->sc_gpio_ledinprogress = 0;
return;
}
if (error) {
"try again led launch"));
} else {
"exit led launch"));
}
}
static int
{
int error = 0;
if (sc->sc_scan_id != 0) {
sc->sc_scan_id = 0;
}
switch (nstate) {
case IEEE80211_S_INIT:
arg));
break;
break;
case IEEE80211_S_SCAN:
"-> IEEE80211_S_SCAN...arg(%d)...[%d]\n",
if (error) {
break;
}
break;
case IEEE80211_S_AUTH:
"-> IEEE80211_S_AUTH ...arg(%d), chan (%d)\n", arg,
if (error) {
}
break;
case IEEE80211_S_ASSOC:
"-> IEEE80211_S_ASSOC ...arg(%d), chan (%d)\n", arg,
if (error) {
}
break;
case IEEE80211_S_RUN:
"-> IEEE80211_S_RUN ...arg(%d), chan (%d)\n",
if (error) {
goto fail;
}
/* setting bssid. */
break;
}
fail:
if (error) {
"-> newstate error...arg(%d)\n", error));
return (EIO);
}
return (error);
}
static void
{
}
}
}
}
static int
{
int err;
return (USB_SUCCESS);
skip = 2;
}
"urtw_open_pipes(): %x low priority pipe open failed\n",
err));
goto fail;
}
"urtw_open_pipes(): %x failed to open high tx pipe\n",
err));
goto fail;
}
"urtw_open_pipes(): %x failed to open rx pipe\n", err));
goto fail;
}
return (USB_SUCCESS);
fail:
return (USB_FAILURE);
}
static int
{
int err;
"urtw_tx_start(): failed to allocate req"));
return (-1);
}
req->bulk_completion_reason = 0;
req->bulk_cb_flags = 0;
if ((err = usb_pipe_bulk_xfer(
!= USB_SUCCESS) {
"urtw_tx_start: failed to do tx xfer, %d", err));
return (EIO);
}
if (priority) {
} else {
sc->sc_tx_low_queued++;
}
return (0);
}
static int
{
int err;
"urtw_rx_start(): failed to allocate req"));
return (-1);
}
req->bulk_timeout = 0;
req->bulk_completion_reason = 0;
req->bulk_cb_flags = 0;
if (err != USB_SUCCESS) {
"urtw_rx_start: failed to do rx xfer, %d", err));
return (-1);
}
return (0);
}
static int
{
if (URTW_IS_RUNNING(sc)) {
}
return (DDI_SUCCESS);
}
static int
{
int error = 0;
return (DDI_FAILURE);
"urtw_online()\n"));
if (URTW_IS_PLUGIN_ONLINE(sc)) {
if (!error) {
}
}
}
static mblk_t *
{
URTW_IS_SUSPENDING(sc)) {
return (NULL);
}
break;
}
}
return (mp);
}
static int
{
int error = 0;
return (error);
}
static void
{
"urtw_m_stop()\n"));
}
/*ARGSUSED*/
static int
{
return (ENOTSUP);
}
/*ARGSUSED*/
static int
{
return (ENOTSUP);
}
/*ARGSUSED*/
static int
{
return (0);
}
static int
{
int err = 0;
return (err);
}
static void
{
}
static int
{
int err;
if (err) {
"urtw: setprop failed\n"));
return (err);
}
}
err = 0;
}
return (err);
}
static void
{
int err;
if (err) {
CE_CONT, "urtw: dev init failed\n"));
return;
}
}
}
}
static int
{
switch (stat) {
case MAC_STAT_IFSPEED:
break;
case MAC_STAT_NOXMTBUF:
break;
case MAC_STAT_NORCVBUF:
break;
case MAC_STAT_IERRORS:
break;
case MAC_STAT_RBYTES:
break;
case MAC_STAT_IPACKETS:
break;
case MAC_STAT_OBYTES:
break;
case MAC_STAT_OPACKETS:
break;
case MAC_STAT_OERRORS:
break;
case WIFI_STAT_TX_FRAGS:
case WIFI_STAT_MCAST_TX:
case WIFI_STAT_TX_FAILED:
case WIFI_STAT_TX_RETRANS:
case WIFI_STAT_RTS_SUCCESS:
case WIFI_STAT_RTS_FAILURE:
case WIFI_STAT_ACK_FAILURE:
case WIFI_STAT_RX_FRAGS:
case WIFI_STAT_MCAST_RX:
case WIFI_STAT_FCS_ERRORS:
case WIFI_STAT_WEP_ERRORS:
case WIFI_STAT_RX_DUPS:
default:
return (ENOTSUP);
}
return (0);
}
static void
{
if (URTW_IS_NOT_RUNNING(sc)) {
return;
}
case IEEE80211_S_AUTH:
case IEEE80211_S_ASSOC:
"urtw: watchdog begin\n"));
} else
break;
}
}
static int
{
struct urtw_type *e = 0;
switch (cmd) {
case DDI_ATTACH:
break;
case DDI_RESUME:
if (URTW_IS_PLUGIN_ONLINE(sc)) {
if (error == 0) {
}
}
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
goto fail1;
}
USB_PARSE_LVL_ALL, 0) != USB_SUCCESS) {
goto fail2;
}
if (e == NULL) {
goto fail2;
}
switch (data) {
case URTW_TX_HWREV_8187_D:
urtw_name = "RTL8187 rev. D";
break;
case URTW_TX_HWREV_8187B_D:
/*
* Detect Realtek RTL8187B devices that use
* USB IDs of RTL8187.
*/
urtw_name = "RTL8187B rev. B (early)";
break;
default:
urtw_name = "RTL8187 rev. B (default)";
break;
}
} else {
/* RTL8187B hwrev register. */
switch (data8) {
case URTW_8187B_HWREV_8187B_B:
urtw_name = "RTL8187B rev. B";
break;
case URTW_8187B_HWREV_8187B_D:
urtw_name = "RTL8187B rev. D";
break;
case URTW_8187B_HWREV_8187B_E:
urtw_name = "RTL8187B rev. E";
break;
default:
urtw_name = "RTL8187B rev. B (default)";
break;
}
}
"urtw_attach: actual device is %s\n", urtw_name));
} else {
}
goto fail3;
"urtw_attach: eprom is 93C56\n"));
else
"urtw_attach: eprom is 93C46\n"));
if (error != 0)
goto fail3;
if (error != 0)
goto fail3;
if (error != 0)
goto fail3;
if (error != 0)
goto fail3;
/* XXX for what? */
IEEE80211_C_TXPMGT | /* tx power management */
IEEE80211_C_SHPREAMBLE | /* short preamble supported */
IEEE80211_C_SHSLOT; /* short slot time supported */
/* set supported .11b and .11g rates */
/* set supported .11b and .11g channels (1 through 11) */
for (i = 1; i <= 11; i++) {
}
/* register WPA door */
/* override state transition machine */
ic->ic_def_txkey = 0;
/*
* Provide initial settings for the WiFi plugin; whenever this
* information changes, we need to call mac_plugindata_update()
*/
"MAC version alloc failed\n"));
goto fail4;
}
if (error != 0) {
goto fail4;
}
urtw_reconnect) != USB_SUCCESS) {
goto fail5;
}
/*
* Create minor node of type DDI_NT_NET_WIFI
*/
"urtw", instance);
if (error != DDI_SUCCESS)
/*
* Notify link is down now
*/
"urtw_attach: successfully.\n"));
return (DDI_SUCCESS);
return (DDI_FAILURE);
}
static int
{
CE_CONT, "urtw_detach()\n"));
switch (cmd) {
case DDI_DETACH:
break;
case DDI_SUSPEND:
if (URTW_IS_RUNNING(sc)) {
}
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
return (DDI_FAILURE);
/*
* Unregister from the MAC layer subsystem
*/
return (DDI_SUCCESS);
}
int
{
}
int
_init(void)
{
int status;
sizeof (struct urtw_softc), 1);
if (status != 0)
return (status);
if (status != 0) {
}
return (status);
}
int
_fini(void)
{
int status;
if (status == 0) {
}
return (status);
}