iwh.c revision 09539a3c2da6fef054f5306232ef0480de261eab
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Use is subject to license terms.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Copyright (c) 2008, Intel Corporation
fa9e4066f08beec538e775443c5be79dd423fcabahrens * All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Copyright (c) 2006
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Copyright (c) 2007
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Damien Bergamini <damien.bergamini@free.fr>
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Permission to use, copy, modify, and distribute this software for any
fa9e4066f08beec538e775443c5be79dd423fcabahrens * purpose with or without fee is hereby granted, provided that the above
fa9e4066f08beec538e775443c5be79dd423fcabahrens * copyright notice and this permission notice appear in all copies.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
fa9e4066f08beec538e775443c5be79dd423fcabahrens * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
fa9e4066f08beec538e775443c5be79dd423fcabahrens * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
fa9e4066f08beec538e775443c5be79dd423fcabahrens * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
fa9e4066f08beec538e775443c5be79dd423fcabahrens * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
fa9e4066f08beec538e775443c5be79dd423fcabahrens * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
fa9e4066f08beec538e775443c5be79dd423fcabahrens * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Intel(R) WiFi Link 5100/5300 Driver
fa9e4066f08beec538e775443c5be79dd423fcabahrens * if want to see debug message of a given section,
fa9e4066f08beec538e775443c5be79dd423fcabahrens * please set this flag to one of above values
fa9e4066f08beec538e775443c5be79dd423fcabahrens * ucode will be compiled into driver image
fa9e4066f08beec538e775443c5be79dd423fcabahrens * DMA attributes for a shared page
fa9e4066f08beec538e775443c5be79dd423fcabahrens 0, /* lowest usable address */
fa9e4066f08beec538e775443c5be79dd423fcabahrens 0, /* flags (reserved) */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * DMA attributes for a keep warm DRAM descriptor
fa9e4066f08beec538e775443c5be79dd423fcabahrens 0, /* lowest usable address */
fa9e4066f08beec538e775443c5be79dd423fcabahrens 0, /* flags (reserved) */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * DMA attributes for a ring descriptor
fa9e4066f08beec538e775443c5be79dd423fcabahrens 0, /* lowest usable address */
fa9e4066f08beec538e775443c5be79dd423fcabahrens 0, /* flags (reserved) */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * DMA attributes for a cmd
fa9e4066f08beec538e775443c5be79dd423fcabahrens 0, /* lowest usable address */
fa9e4066f08beec538e775443c5be79dd423fcabahrens 0, /* flags (reserved) */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * DMA attributes for a rx buffer
fa9e4066f08beec538e775443c5be79dd423fcabahrens 0, /* lowest usable address */
fa9e4066f08beec538e775443c5be79dd423fcabahrens 0, /* flags (reserved) */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * DMA attributes for a tx buffer.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * the maximum number of segments is 4 for the hardware.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * now all the wifi drivers put the whole frame in a single
fa9e4066f08beec538e775443c5be79dd423fcabahrens * descriptor, so we define the maximum number of segments 1,
fa9e4066f08beec538e775443c5be79dd423fcabahrens * just the same as the rx_buffer. we consider leverage the HW
fa9e4066f08beec538e775443c5be79dd423fcabahrens * ability in the future, that is why we don't define rx and tx
static int iwh_m_start(void *);
static void iwh_m_stop(void *);
_init(void)
int status;
return (status);
return (status);
_fini(void)
int status;
return (status);
NULL,
NULL,
NULL,
#ifdef DEBUG
int intr_type;
int intr_count;
int intr_actual;
switch (cmd) {
case DDI_ATTACH:
case DDI_RESUME:
return (DDI_SUCCESS);
goto attach_fail1;
goto attach_fail1;
goto attach_fail2;
goto attach_fail3;
goto attach_fail4;
goto attach_fail4;
goto attach_fail5;
goto attach_fail6;
goto attach_fail7;
goto attach_fail8;
goto attach_fail9;
if (err != 0) {
goto attach_fail9;
goto attach_fail9;
goto attach_fail9;
goto attach_fail10;
goto attach_fail12;
goto attach_fail13;
goto attach_fail14;
goto attach_fail15;
goto attach_fail15;
return (DDI_SUCCESS);
return (err);
int err;
switch (cmd) {
case DDI_DETACH:
case DDI_SUSPEND:
return (DDI_SUCCESS);
return (DDI_FAILURE);
return (DDI_FAILURE);
return (err);
return (DDI_SUCCESS);
int err;
return (DDI_FAILURE);
return (DDI_FAILURE);
return (DDI_FAILURE);
return (DDI_SUCCESS);
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
fail:
return (err);
#ifdef DEBUG
goto fail;
#ifdef DEBUG
return (err);
fail:
return (err);
#ifdef DEBUG
goto fail;
#ifdef DEBUG
return (err);
fail:
return (err);
#ifdef DEBUG
goto fail;
#ifdef DEBUG
for (i = 0; i < RX_QUEUE_SIZE; i++) {
goto fail;
#ifdef DEBUG
return (err);
fail:
return (err);
#ifdef DEBUG
for (i = 0; i < RX_QUEUE_SIZE; i++) {
#ifdef DEBUG
goto fail;
#ifdef DEBUG
goto fail;
#ifdef DEBUG
goto fail;
for (i = 0; i < TFD_QUEUE_SIZE_MAX; i++) {
goto fail;
#ifdef DEBUG
return (err);
fail:
return (err);
for (i = 0; i < IWH_NUM_QUEUES; i++) {
if (IWH_CMD_QUEUE_NUM == i) {
goto fail;
goto fail;
goto fail;
return (err);
fail:
return (err);
int i = IWH_NUM_QUEUES;
static ieee80211_node_t *
switch (nstate) {
case IEEE80211_S_SCAN:
switch (ostate) {
case IEEE80211_S_INIT:
return (err);
return (err);
case IEEE80211_S_SCAN:
return (err);
case IEEE80211_S_AUTH:
return (err);
case IEEE80211_S_RUN:
return (err);
return (err);
case IEEE80211_S_INIT:
case IEEE80211_S_ASSOC:
#ifdef DEBUG
static uint32_t
int err;
return (err);
return (IWH_FAIL);
return (err);
return (IWH_FAIL);
return (err);
int err;
return (err);
return (IWH_FAIL);
return (err);
return (IWH_FAIL);
return (err);
sizeof (iwh_rx_phy_res_t));
#ifdef DEBUG
int16_t t;
#ifdef DEBUG
if (mp) {
#ifdef DEBUG
sizeof (struct iwh_init_alive_resp));
sizeof (struct iwh_alive_resp));
static uint_t
return (DDI_INTR_UNCLAIMED);
case REPLY_RX_PHY_CMD:
case REPLY_RX_MPDU_CMD:
case REPLY_TX:
case REPLY_ALIVE:
case CARD_STATE_NOTIFICATION:
case SCAN_START_NOTIFICATION:
case STATISTICS_NOTIFICATION:
return (DDI_INTR_CLAIMED);
static uint_t
return (DDI_INTR_UNCLAIMED);
return (DDI_INTR_UNCLAIMED);
return (DDI_INTR_CLAIMED);
return (DDI_INTR_CLAIMED);
#ifdef DEBUG
if (r & BIT_INT_RF_KILL) {
if (r & BIT_INT_FH_TX) {
#ifdef DEBUG
if (r & BIT_INT_ALIVE) {
return (DDI_INTR_CLAIMED);
static uint8_t
switch (rate) {
ret = 0;
return (ret);
static mblk_t *
return (NULL);
return (NULL);
return (mp);
goto exit;
goto exit;
goto exit;
freemsg(m);
goto exit;
if (NULL == k) {
freemsg(m);
goto exit;
#ifdef DEBUG
freemsg(m);
exit:
return (err);
int err;
int err = 0;
return (err);
int err;
wldp_buf);
err = 0;
return (err);
switch (stat) {
case MAC_STAT_IFSPEED:
case MAC_STAT_NOXMTBUF:
case MAC_STAT_NORCVBUF:
case MAC_STAT_IERRORS:
case MAC_STAT_RBYTES:
case MAC_STAT_IPACKETS:
case MAC_STAT_OBYTES:
case MAC_STAT_OPACKETS:
case MAC_STAT_OERRORS:
case WIFI_STAT_TX_FAILED:
case WIFI_STAT_TX_RETRANS:
case WIFI_STAT_FCS_ERRORS:
case WIFI_STAT_WEP_ERRORS:
case WIFI_STAT_TX_FRAGS:
case WIFI_STAT_MCAST_TX:
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_RX_DUPS:
return (ENOTSUP);
return (IWH_SUCCESS);
int err;
return (IWH_SUCCESS);
return (IWH_SUCCESS);
int err;
goto fail;
return (IWH_SUCCESS);
fail:
return (err);
return (IWH_SUCCESS);
return (IWH_SUCCESS);
#ifdef DEBUG
int times = 0;
if (!err) {
timeout++;
timeout = 0;
if (async) {
return (IWH_SUCCESS);
return (IWH_SUCCESS);
return (IWH_FAIL);
int i, err;
return (err);
return (err);
return (err);
for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) {
return (err);
return (IWH_SUCCESS);
essid));
return (IWH_SUCCESS);
int i, err;
sizeof (powertable), 0);
return (err);
sizeof (bt), 0);
return (err);
case IEEE80211_M_STA:
case IEEE80211_M_IBSS:
case IEEE80211_M_AHDEMO:
case IEEE80211_M_HOSTAP:
case IEEE80211_M_MONITOR:
sizeof (iwh_rxon_cmd_t), 0);
return (err);
return (err);
return (err);
return (err);
for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) {
sizeof (link_quality), 0);
return (err);
return (IWH_SUCCESS);
return (DDI_FAILURE);
#ifdef DEBUG
iwh_dbg_flags = 0;
return (DDI_SUCCESS);
#ifdef DEBUG
return (IWH_SUCCESS);
return (ETIMEDOUT);
return (IWH_FAIL);
return (IWH_SUCCESS);
return (IWH_SUCCESS);
return (IWH_FAIL);
int i, rr;
return (IWH_FAIL);
if (rr != 0) {
return (IWH_FAIL);
return (IWH_FAIL);
return (IWH_SUCCESS);
int n, err;
return (IWH_FAIL);
return (IWH_FAIL);
return (IWH_FAIL);
return (IWH_FAIL);
return (IWH_FAIL);
return (IWH_FAIL);
if (err) {
return (IWH_FAIL);
return (IWH_SUCCESS);
for (i = 0; i < IWH_NUM_QUEUES; i++) {
int need_change = 0;
static uint8_t *
case INDIRECT_GENERAL:
case INDIRECT_HOST:
case INDIRECT_REGULATORY:
case INDIRECT_CALIBRATION:
case INDIRECT_PROCESS_ADJST:
case INDIRECT_OTHERS:
temp = 0;
return (IWH_SUCCESS);
uint32_t i;
for (i = 0; i < IWH_NUM_QUEUES; i++) {
IWH_SCD_CONTEXT_QUEUE_OFFSET(i), 0);
sizeof (uint32_t),
((SCD_FRAME_LIMIT <<
(i << IWH_SCD_QUEUE_STTS_REG_POS_TXF) |
return (rv);
return (rv);
return (IWH_SUCCESS);
case PHY_CALIBRATE_LO_CMD:
case PHY_CALIBRATE_TX_IQ_CMD:
int i, err;
return (err);
return (IWH_SUCCESS);
return (IWH_FAIL);
return (IWH_SUCCESS);