wpi.c revision 3a1a8936dac0ebe7e956fa122b0b0d15e62d4108
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * Use is subject to license terms.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * Copyright (c) 2006
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * Damien Bergamini <damien.bergamini@free.fr>
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * Permission to use, copy, modify, and distribute this software for any
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * purpose with or without fee is hereby granted, provided that the above
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * copyright notice and this permission notice appear in all copies.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx#pragma ident "%Z%%M% %I% %E% SMI"
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx#define WPI_DBG(x) \
43439c96b8398c01c375889c79bed72d78fb4c39hx/* DMA attributes for a shared page */
43439c96b8398c01c375889c79bed72d78fb4c39hx 0, /* lowest usable address */
cdc64593cc1046229f4ac4daf5ead688b5efe6ebxinghua wen - Sun Microsystems - Beijing China 1, /* granularity */
cdc64593cc1046229f4ac4daf5ead688b5efe6ebxinghua wen - Sun Microsystems - Beijing China 0, /* flags (reserved) */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx/* DMA attributes for a ring descriptor */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx 0, /* lowest usable address */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx 0, /* flags (reserved) */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx/* DMA attributes for a tx cmd */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx 0, /* lowest usable address */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx 0, /* flags (reserved) */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx/* DMA attributes for a rx buffer */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx 0, /* lowest usable address */
cdc64593cc1046229f4ac4daf5ead688b5efe6ebxinghua wen - Sun Microsystems - Beijing China 0xffffffffU, /* maximum transfer */
cdc64593cc1046229f4ac4daf5ead688b5efe6ebxinghua wen - Sun Microsystems - Beijing China 0xffffffffU, /* maximum segment length */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx 0, /* flags (reserved) */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * DMA attributes for a tx buffer.
c533a883a71cff9ff32df1c53c31201e1cbf371fhx * the maximum number of segments is 4 for the hardware.
cdc64593cc1046229f4ac4daf5ead688b5efe6ebxinghua wen - Sun Microsystems - Beijing China * now all the wifi drivers put the whole frame in a single
cdc64593cc1046229f4ac4daf5ead688b5efe6ebxinghua wen - Sun Microsystems - Beijing China * descriptor, so we define the maximum number of segments 4,
cdc64593cc1046229f4ac4daf5ead688b5efe6ebxinghua wen - Sun Microsystems - Beijing China * just the same as the rx_buffer. we consider leverage the HW
cdc64593cc1046229f4ac4daf5ead688b5efe6ebxinghua wen - Sun Microsystems - Beijing China * ability in the future, that is why we don't define rx and tx
cdc64593cc1046229f4ac4daf5ead688b5efe6ebxinghua wen - Sun Microsystems - Beijing China * buffer_dma_attr as the same.
cdc64593cc1046229f4ac4daf5ead688b5efe6ebxinghua wen - Sun Microsystems - Beijing Chinastatic ddi_dma_attr_t tx_buffer_dma_attr = {
c50ced99bb75273dc8c4c36876d2e8f59a64f4b1pengcheng chen - Sun Microsystems - Beijing China 0, /* lowest usable address */
cdc64593cc1046229f4ac4daf5ead688b5efe6ebxinghua wen - Sun Microsystems - Beijing China 1, /* alignment in bytes */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx 0, /* flags (reserved) */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx/* DMA attributes for a load firmware */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx 0, /* lowest usable address */
cdc64593cc1046229f4ac4daf5ead688b5efe6ebxinghua wen - Sun Microsystems - Beijing China 0, /* flags (reserved) */
c533a883a71cff9ff32df1c53c31201e1cbf371fhx/* regs access attributes */
const uint32_t *, int);
wpi_rx_data_t *);
wpi_rx_data_t *);
_init(void)
int status;
return (status);
return (status);
_fini(void)
int status;
return (status);
NULL,
#ifdef DEBUG
goto attach_fail1;
goto attach_fail1;
goto attach_fail2;
goto attach_fail2;
goto attach_fail3;
goto attach_fail4;
goto attach_fail5;
goto attach_fail6;
goto attach_fail7;
goto attach_fail8;
goto attach_fail9;
goto attach_fail9;
return (DDI_SUCCESS);
return (err);
int err;
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;
fail:
return (err);
goto fail;
return (err);
fail:
return (err);
goto fail;
for (i = 0; i < WPI_RX_RING_COUNT; i++) {
goto fail;
return (err);
fail:
return (err);
int ntries;
#ifdef DEBUG
for (i = 0; i < WPI_RX_RING_COUNT; i++) {
qid));
goto fail;
qid));
goto fail;
goto fail;
for (i = 0; i < count; i++) {
goto fail;
return (err);
fail:
return (err);
int i, ntries;
#ifdef DEBUG
goto fail;
goto fail;
goto fail;
goto fail;
return (err);
fail:
return (err);
static ieee80211_node_t *
switch (nstate) {
case IEEE80211_S_SCAN:
return (err);
return (WPI_SUCCESS);
case IEEE80211_S_AUTH:
return (err);
case IEEE80211_S_RUN:
return (err);
case IEEE80211_S_INIT:
case IEEE80211_S_ASSOC:
int err;
case IEEE80211_CIPHER_WEP:
case IEEE80211_CIPHER_TKIP:
case IEEE80211_CIPHER_AES_CCM:
int ntries;
static uint32_t
static uint16_t
int ntries;
const char *ucode;
int size;
return (EINVAL);
size);
return (WPI_SUCCESS);
const char *fw;
int size;
return (err);
/* ring->desc[ring->cur] = LE_32(data->dma_data.cookie.dmac_address); */
#ifdef WPI_BPF
#ifndef WPI_CURRENT
#ifdef DEBUG
if (mp) {
static uint_t
return (DDI_INTR_UNCLAIMED);
case WPI_RX_DONE:
case WPI_TX_DONE:
case WPI_UC_READY:
case WPI_STATE_CHANGED:
case WPI_START_SCAN:
case WPI_STOP_SCAN:
return (DDI_INTR_CLAIMED);
static uint_t
uint32_t r;
return (DDI_INTR_UNCLAIMED);
return (DDI_INTR_CLAIMED);
return (DDI_INTR_CLAIMED);
if (r & WPI_RX_INTR) {
return (DDI_INTR_CLAIMED);
static uint8_t
switch (rate) {
static mblk_t *
return (NULL);
return (mp);
struct ieee80211_key *k;
goto exit;
goto exit;
freemsg(m);
goto exit;
if (k == NULL) {
freemsg(m);
goto exit;
#ifdef DEBUG
#ifdef WPI_BPF
#ifndef WPI_CURRENT
freemsg(m);
exit:
return (err);
int 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 (WPI_SUCCESS);
int err;
return (err);
int err;
goto fail;
return (WPI_SUCCESS);
fail:
return (err);
return (WPI_SUCCESS);
return (WPI_SUCCESS);
timeout++;
timeout = 0;
if (async)
return (WPI_SUCCESS);
return (WPI_SUCCESS);
return (WPI_FAIL);
int i, err;
return (err);
return (err);
return (WPI_SUCCESS);
int err;
return (err);
return (err);
return (err);
return (WPI_SUCCESS);
#ifdef WPI_BLUE_COEXISTENCE
int err;
return (err);
return (err);
#ifdef WPI_BLUE_COEXISTENCE
sizeof (bluetooth), 0);
return (err);
case IEEE80211_M_STA:
case IEEE80211_M_IBSS:
case IEEE80211_M_AHDEMO:
case IEEE80211_M_HOSTAP:
case IEEE80211_M_MONITOR:
sizeof (wpi_config_t), 0);
return (err);
return (err);
return (WPI_SUCCESS);
int ntries;
int ntries;
return (ETIMEDOUT);
return (WPI_SUCCESS);
int ntries;
return (ETIMEDOUT);
return (EIO);
return (WPI_SUCCESS);
goto fail1;
goto fail1;
goto fail1;
goto fail1;
if (err) {
goto fail1;
return (WPI_SUCCESS);
return (err);
int ac;
int need_change = 0;