iwh.c revision faceed938d6ba7344a332694084d213905e93375
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2008, Intel Corporation
* All rights reserved.
*/
/*
* Copyright (c) 2006
* Copyright (c) 2007
* Damien Bergamini <damien.bergamini@free.fr>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Intel(R) WiFi Link 5100/5300 Driver
*/
#include <sys/byteorder.h>
#include <sys/ethernet.h>
#include <sys/mac_wifi.h>
#include <sys/net80211.h>
#include <sys/net80211_proto.h>
#include "iwh_calibration.h"
#include "iwh_hw.h"
#include "iwh_eeprom.h"
#include "iwh_var.h"
#include <inet/wifi_ioctl.h>
#ifdef DEBUG
#define IWH_DEBUG_80211 (1 << 0)
/*
* if want to see debug message of a given section,
* please set this flag to one of above values
*/
uint32_t iwh_dbg_flags = 0;
#define IWH_DBG(x) \
iwh_dbg x
#else
#define IWH_DBG(x)
#endif
static void *iwh_soft_state_p = NULL;
/*
* ucode will be compiled into driver image
*/
static uint8_t iwh_fw_bin [] = {
};
/*
* DMA attributes for a shared page
*/
static ddi_dma_attr_t sh_dma_attr = {
DMA_ATTR_V0, /* version of this structure */
0, /* lowest usable address */
0xffffffffU, /* highest usable address */
0xffffffffU, /* maximum DMAable byte count */
0x1000, /* alignment in bytes */
0x1000, /* burst sizes (any?) */
1, /* minimum transfer */
0xffffffffU, /* maximum transfer */
0xffffffffU, /* maximum segment length */
1, /* maximum number of segments */
1, /* granularity */
0, /* flags (reserved) */
};
/*
* DMA attributes for a keep warm DRAM descriptor
*/
static ddi_dma_attr_t kw_dma_attr = {
DMA_ATTR_V0, /* version of this structure */
0, /* lowest usable address */
0xffffffffU, /* highest usable address */
0xffffffffU, /* maximum DMAable byte count */
0x1000, /* alignment in bytes */
0x1000, /* burst sizes (any?) */
1, /* minimum transfer */
0xffffffffU, /* maximum transfer */
0xffffffffU, /* maximum segment length */
1, /* maximum number of segments */
1, /* granularity */
0, /* flags (reserved) */
};
/*
* DMA attributes for a ring descriptor
*/
static ddi_dma_attr_t ring_desc_dma_attr = {
DMA_ATTR_V0, /* version of this structure */
0, /* lowest usable address */
0xffffffffU, /* highest usable address */
0xffffffffU, /* maximum DMAable byte count */
0x100, /* alignment in bytes */
0x100, /* burst sizes (any?) */
1, /* minimum transfer */
0xffffffffU, /* maximum transfer */
0xffffffffU, /* maximum segment length */
1, /* maximum number of segments */
1, /* granularity */
0, /* flags (reserved) */
};
/*
* DMA attributes for a cmd
*/
static ddi_dma_attr_t cmd_dma_attr = {
DMA_ATTR_V0, /* version of this structure */
0, /* lowest usable address */
0xffffffffU, /* highest usable address */
0xffffffffU, /* maximum DMAable byte count */
4, /* alignment in bytes */
0x100, /* burst sizes (any?) */
1, /* minimum transfer */
0xffffffffU, /* maximum transfer */
0xffffffffU, /* maximum segment length */
1, /* maximum number of segments */
1, /* granularity */
0, /* flags (reserved) */
};
/*
* DMA attributes for a rx buffer
*/
static ddi_dma_attr_t rx_buffer_dma_attr = {
DMA_ATTR_V0, /* version of this structure */
0, /* lowest usable address */
0xffffffffU, /* highest usable address */
0xffffffffU, /* maximum DMAable byte count */
0x100, /* alignment in bytes */
0x100, /* burst sizes (any?) */
1, /* minimum transfer */
0xffffffffU, /* maximum transfer */
0xffffffffU, /* maximum segment length */
1, /* maximum number of segments */
1, /* granularity */
0, /* flags (reserved) */
};
/*
* DMA attributes for a tx buffer.
* the maximum number of segments is 4 for the hardware.
* now all the wifi drivers put the whole frame in a single
* descriptor, so we define the maximum number of segments 1,
* just the same as the rx_buffer. we consider leverage the HW
* ability in the future, that is why we don't define rx and tx
* buffer_dma_attr as the same.
*/
static ddi_dma_attr_t tx_buffer_dma_attr = {
DMA_ATTR_V0, /* version of this structure */
0, /* lowest usable address */
0xffffffffU, /* highest usable address */
0xffffffffU, /* maximum DMAable byte count */
4, /* alignment in bytes */
0x100, /* burst sizes (any?) */
1, /* minimum transfer */
0xffffffffU, /* maximum transfer */
0xffffffffU, /* maximum segment length */
1, /* maximum number of segments */
1, /* granularity */
0, /* flags (reserved) */
};
/*
* DMA attributes for text and data part in the firmware
*/
static ddi_dma_attr_t fw_dma_attr = {
DMA_ATTR_V0, /* version of this structure */
0, /* lowest usable address */
0xffffffffU, /* highest usable address */
0x7fffffff, /* maximum DMAable byte count */
0x10, /* alignment in bytes */
0x100, /* burst sizes (any?) */
1, /* minimum transfer */
0xffffffffU, /* maximum transfer */
0xffffffffU, /* maximum segment length */
1, /* maximum number of segments */
1, /* granularity */
0, /* flags (reserved) */
};
/*
* regs access attributes
*/
static ddi_device_acc_attr_t iwh_reg_accattr = {
};
/*
* DMA access attributes
*/
static ddi_device_acc_attr_t iwh_dma_accattr = {
};
static int iwh_ring_init(iwh_sc_t *);
static void iwh_ring_free(iwh_sc_t *);
static int iwh_alloc_shared(iwh_sc_t *);
static void iwh_free_shared(iwh_sc_t *);
static int iwh_alloc_kw(iwh_sc_t *);
static void iwh_free_kw(iwh_sc_t *);
static int iwh_alloc_fw_dma(iwh_sc_t *);
static void iwh_free_fw_dma(iwh_sc_t *);
static int iwh_alloc_rx_ring(iwh_sc_t *);
static void iwh_reset_rx_ring(iwh_sc_t *);
static void iwh_free_rx_ring(iwh_sc_t *);
int, int);
static void iwh_free_tx_ring(iwh_tx_ring_t *);
static void iwh_node_free(ieee80211_node_t *);
static void iwh_mac_access_enter(iwh_sc_t *);
static void iwh_mac_access_exit(iwh_sc_t *);
static int iwh_load_init_firmware(iwh_sc_t *);
static int iwh_load_run_firmware(iwh_sc_t *);
static int iwh_eep_load(iwh_sc_t *);
static void iwh_get_mac_from_eep(iwh_sc_t *);
static int iwh_eep_sem_down(iwh_sc_t *);
static void iwh_eep_sem_up(iwh_sc_t *);
static uint8_t iwh_rate_to_plcp(int);
static int iwh_hw_set_before_auth(iwh_sc_t *);
static int iwh_config(iwh_sc_t *);
static void iwh_stop_master(iwh_sc_t *);
static int iwh_power_up(iwh_sc_t *);
static int iwh_preinit(iwh_sc_t *);
static int iwh_quiesce(dev_info_t *t);
static void iwh_amrr_init(iwh_amrr_t *);
static void iwh_amrr_timeout(iwh_sc_t *);
static void iwh_amrr_ratectl(void *, ieee80211_node_t *);
static void iwh_release_calib_buffer(iwh_sc_t *);
static int iwh_init_common(iwh_sc_t *);
static int iwh_alive_common(iwh_sc_t *);
static int iwh_tx_power_table(iwh_sc_t *, int);
static void iwh_destroy_locks(iwh_sc_t *);
static void iwh_thread(iwh_sc_t *);
/*
* GLD specific operations
*/
static int iwh_m_start(void *);
static void iwh_m_stop(void *);
static int iwh_m_unicst(void *, const uint8_t *);
static int iwh_m_promisc(void *, boolean_t);
/*
* Supported rates for 802.11b/g modes (in 500Kbps unit).
* 11n support will be added later.
*/
static const struct ieee80211_rateset iwh_rateset_11b =
{ 4, { 2, 4, 11, 22 } };
static const struct ieee80211_rateset iwh_rateset_11g =
{ 12, { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 } };
/*
* For mfthread only
*/
extern pri_t minclsyspri;
#define DRV_NAME_SP "iwh"
/*
* Module Loading Data & Entry Points
*/
static struct modldrv iwh_modldrv = {
"Intel(R) ShirleyPeak driver(N)",
};
static struct modlinkage iwh_modlinkage = {
};
int
_init(void)
{
int status;
sizeof (iwh_sc_t), 1);
if (status != DDI_SUCCESS) {
return (status);
}
if (status != DDI_SUCCESS) {
}
return (status);
}
int
_fini(void)
{
int status;
if (DDI_SUCCESS == status) {
}
return (status);
}
int
{
}
/*
* Mac Call Back entries
*/
NULL,
};
#ifdef DEBUG
void
{
if (flags & iwh_dbg_flags) {
}
}
#endif
/*
* device operations
*/
int
{
char strbuf[32];
wifi_data_t wd = { 0 };
int intr_type;
int intr_count;
int intr_actual;
switch (cmd) {
case DDI_ATTACH:
break;
case DDI_RESUME:
}
return (DDI_SUCCESS);
default:
err = DDI_FAILURE;
goto attach_fail1;
}
if (err != DDI_SUCCESS) {
"failed to allocate soft state\n");
goto attach_fail1;
}
/*
* map configure space
*/
if (err != DDI_SUCCESS) {
"failed to map config spaces regs\n");
goto attach_fail2;
}
/*
* keep from disturbing C3 state of CPU
*/
}
/*
* determine the size of buffer for frame and command to ucode
*/
/*
* Map operating registers
*/
if (err != DDI_SUCCESS) {
"failed to map device regs\n");
goto attach_fail3;
}
/*
* this is used to differentiate type of hardware
*/
"fixed type interrupt is not supported\n");
goto attach_fail4;
}
"no fixed interrupts\n");
goto attach_fail4;
}
intr_count, &intr_actual, 0);
"ddi_intr_alloc() failed 0x%x\n", err);
goto attach_fail5;
}
if (err != DDI_SUCCESS) {
"ddi_intr_get_pri() failed 0x%x\n", err);
goto attach_fail6;
}
/*
* initialize the mfthread
*/
sc->sc_mf_thread_switch = 0;
/*
* Allocate shared buffer for communication between driver and ucode.
*/
if (err != DDI_SUCCESS) {
"failed to allocate shared page\n");
goto attach_fail7;
}
/*
* Allocate keep warm page.
*/
if (err != DDI_SUCCESS) {
"failed to allocate keep warm page\n");
goto attach_fail8;
}
/*
* Do some necessary hardware initializations.
*/
if (err != IWH_SUCCESS) {
"failed to initialize hardware\n");
goto attach_fail9;
}
/*
* get hardware configurations from eeprom
*/
if (err != 0) {
"failed to load eeprom\n");
goto attach_fail9;
}
goto attach_fail9;
}
/*
* get MAC address of this chipset
*/
/*
* calibration information from EEPROM
*/
/*
* initialize TX and RX ring buffers
*/
if (err != DDI_SUCCESS) {
"failed to allocate and initialize ring\n");
goto attach_fail9;
}
/*
* copy ucode to dma buffer
*/
if (err != DDI_SUCCESS) {
"failed to allocate firmware dma\n");
goto attach_fail10;
}
/*
* Initialize the wifi part, which will be used by
* 802.11 module
*/
/*
*/
/*
* set supported .11b and .11g rates
*/
/*
* set supported .11b and .11g channels (1 through 11)
*/
for (i = 1; i <= 11; i++) {
}
/*
* attach to 802.11 module
*/
/*
* different instance has different WPA door
*/
/*
* Override 80211 default routines
*/
/*
* initialize 802.11 module
*/
/*
* initialize default tx key
*/
ic->ic_def_txkey = 0;
if (err != DDI_SUCCESS) {
"add soft interrupt failed\n");
goto attach_fail12;
}
if (err != DDI_SUCCESS) {
"ddi_intr_add_handle() failed\n");
goto attach_fail13;
}
if (err != DDI_SUCCESS) {
"ddi_intr_enable() failed\n");
goto attach_fail14;
}
/*
* Initialize pointer to device specific functions
*/
/*
* create relation to GLD
*/
if (err != DDI_SUCCESS) {
"failed to do mac_alloc()\n");
goto attach_fail15;
}
/*
* Register the macp to mac
*/
if (err != DDI_SUCCESS) {
"failed to do mac_register()\n");
goto attach_fail15;
}
/*
* Create minor node of type DDI_NT_NET_WIFI
*/
if (err != DDI_SUCCESS)
"failed to do ddi_create_minor_node()\n");
/*
* Notify link is down now
*/
/*
* create the mf thread to handle the link status,
* recovery fatal error, etc.
*/
}
return (DDI_SUCCESS);
return (err);
}
int
{
int err;
switch (cmd) {
case DDI_DETACH:
break;
case DDI_SUSPEND:
}
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
if (err != DDI_SUCCESS)
return (err);
/*
* Destroy the mf_thread
*/
sc->sc_mf_thread_switch = 0;
break;
}
}
/*
* stop chipset
*/
DELAY(500000);
/*
* release buffer for calibration
*/
/*
* Unregiste from GLD
*/
/*
* detach from 80211 module
*/
return (DDI_SUCCESS);
}
/*
* destroy all locks
*/
static void
{
}
/*
* Allocate an area of memory and a DMA handle for accessing it
*/
static int
{
int err;
/*
* Allocate handle
*/
if (err != DDI_SUCCESS) {
return (DDI_FAILURE);
}
/*
* Allocate memory
*/
if (err != DDI_SUCCESS) {
return (DDI_FAILURE);
}
/*
* Bind the two together
*/
if (err != DDI_DMA_MAPPED) {
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
/*
* Free one allocated area of DMAable memory
*/
static void
{
}
}
}
}
/*
* copy ucode into dma buffers
*/
static int
{
int err = DDI_SUCCESS;
char *t;
/*
* firmware image layout:
* |HDR|<-TEXT->|<-DATA->|<-INIT_TEXT->|<-INIT_DATA->|<-BOOT->|
*/
/*
* copy text of runtime ucode
*/
&sc->sc_dma_fw_text);
if (err != DDI_SUCCESS) {
"failed to allocate text dma memory.\n");
goto fail;
}
/*
* copy data and bak-data of runtime ucode
*/
&sc->sc_dma_fw_data);
if (err != DDI_SUCCESS) {
"failed to allocate data dma memory\n");
goto fail;
}
&sc->sc_dma_fw_data_bak);
"size:%lx]\n",
if (err != DDI_SUCCESS) {
"failed to allocate data bakup dma memory\n");
goto fail;
}
/*
* copy text of init ucode
*/
"size:%lx]\n",
if (err != DDI_SUCCESS) {
"failed to allocate init text dma memory\n");
goto fail;
}
/*
* copy data of init ucode
*/
"size:%lx]\n",
if (err != DDI_SUCCESS) {
"failed to allocate init data dma memory\n");
goto fail;
}
fail:
return (err);
}
static void
{
}
/*
* Allocate a shared buffer between host and NIC.
*/
static int
{
#ifdef DEBUG
#endif
int err = DDI_SUCCESS;
/*
* must be aligned on a 4K-page boundary
*/
if (err != DDI_SUCCESS) {
goto fail;
}
#ifdef DEBUG
#endif
return (err);
fail:
return (err);
}
static void
{
}
/*
* Allocate a keep warm page.
*/
static int
{
#ifdef DEBUG
#endif
int err = DDI_SUCCESS;
/*
* must be aligned on a 4K-page boundary
*/
if (err != DDI_SUCCESS) {
goto fail;
}
#ifdef DEBUG
#endif
return (err);
fail:
return (err);
}
static void
{
}
/*
* initialize RX ring buffers
*/
static int
{
#ifdef DEBUG
#endif
int i, err = DDI_SUCCESS;
/*
* allocate RX description ring buffer
*/
if (err != DDI_SUCCESS) {
"failed\n"));
goto fail;
}
#ifdef DEBUG
#endif
/*
* Allocate Rx frame buffers.
*/
for (i = 0; i < RX_QUEUE_SIZE; i++) {
if (err != DDI_SUCCESS) {
"buf[%d] failed\n", i));
goto fail;
}
/*
* the physical address bit [8-36] are used,
* instead of bit [0-31] in 3945.
*/
}
#ifdef DEBUG
#endif
"size:%lx]\n",
return (err);
fail:
return (err);
}
/*
* disable RX ring
*/
static void
{
int n;
for (n = 0; n < 2000; n++) {
break;
}
DELAY(1000);
}
#ifdef DEBUG
if (2000 == n) {
}
#endif
}
static void
{
int i;
for (i = 0; i < RX_QUEUE_SIZE; i++) {
}
}
}
}
/*
* initialize TX ring buffers
*/
static int
{
#ifdef DEBUG
#endif
int i, err = DDI_SUCCESS;
/*
* allocate buffer for TX descriptor ring
*/
TFD_QUEUE_SIZE_MAX * sizeof (iwh_tx_desc_t),
if (err != DDI_SUCCESS) {
" failed\n", qid));
goto fail;
}
#ifdef DEBUG
#endif
/*
* allocate buffer for ucode command
*/
TFD_QUEUE_SIZE_MAX * sizeof (iwh_cmd_t),
if (err != DDI_SUCCESS) {
" failed\n", qid));
goto fail;
}
#ifdef DEBUG
#endif
/*
* Allocate Tx frame buffers.
*/
"tx data slots\n"));
goto fail;
}
for (i = 0; i < TFD_QUEUE_SIZE_MAX; i++) {
if (err != DDI_SUCCESS) {
"ring buf[%d] failed\n", i));
goto fail;
}
/* ((i % slots) * sizeof (iwh_cmd_t)); */
}
#ifdef DEBUG
#endif
"size:%lx]\n",
return (err);
fail:
sizeof (iwh_tx_data_t) * TFD_QUEUE_SIZE_MAX);
}
return (err);
}
/*
* disable TX ring
*/
static void
{
int i, n;
for (n = 0; n < 200; n++) {
break;
}
DELAY(10);
}
if (200 == n) {
}
/* by pass, if it's quiesce */
}
}
}
static void
{
int i;
}
}
}
}
}
}
/*
* initialize TX and RX ring
*/
static int
{
int i, err = DDI_SUCCESS;
for (i = 0; i < IWH_NUM_QUEUES; i++) {
if (IWH_CMD_QUEUE_NUM == i) {
continue;
}
i);
if (err != DDI_SUCCESS) {
goto fail;
}
}
/*
* initialize command queue
*/
if (err != DDI_SUCCESS) {
goto fail;
}
if (err != DDI_SUCCESS) {
goto fail;
}
return (err);
fail:
return (err);
}
static void
{
int i = IWH_NUM_QUEUES;
while (--i >= 0) {
}
}
/*
* allocate buffer for a node
*/
/*ARGSUSED*/
static ieee80211_node_t *
{
}
}
static void
{
}
}
/*
* change station's state. this function will be invoked by 80211 module
* when need to change staton's state.
*/
static int
{
int i, err = IWH_SUCCESS;
switch (nstate) {
case IEEE80211_S_SCAN:
switch (ostate) {
case IEEE80211_S_INIT:
{
/*
* clear association to receive beacons from
* all BSS'es
*/
sizeof (iwh_rxon_cmd_t), 1);
if (err != IWH_SUCCESS) {
"could not clear association\n");
return (err);
}
/* add broadcast node to send probe request */
sizeof (node), 1);
if (err != IWH_SUCCESS) {
"broadcast node\n");
return (err);
}
break;
}
case IEEE80211_S_SCAN:
/* step to next channel before actual FW scan */
"could not initiate scan\n");
}
return (err);
default:
break;
}
break;
case IEEE80211_S_AUTH:
if (ostate == IEEE80211_S_SCAN) {
}
/*
* reset state to handle reassociations correctly
*/
/*
* before sending authentication and association request frame,
* we need do something in the hardware, such as setting the
* channel same to the target AP...
*/
"could not send authentication request\n"));
return (err);
}
break;
case IEEE80211_S_RUN:
if (ostate == IEEE80211_S_SCAN) {
}
/* let LED blink when monitoring */
break;
}
/*
* update adapter's configuration
*/
"associate ID mismatch: expected %d, "
"got %d\n",
}
/*
* negotiated when associating
*/
}
}
}
" filter_flags %x\n",
sizeof (iwh_rxon_cmd_t), 1);
if (err != IWH_SUCCESS) {
"could not update configuration\n"));
return (err);
}
/*
* send tx power talbe command
*/
if (err != IWH_SUCCESS) {
"failed to set tx power table.\n");
return (err);
}
/*
* start automatic rate control
*/
/*
* set rate to some reasonable initial value
*/
while (i > 0 && IEEE80211_RATE(i) > 72) {
i--;
}
} else {
}
/*
* set LED on after associated
*/
break;
case IEEE80211_S_INIT:
if (ostate == IEEE80211_S_SCAN) {
}
/*
* set LED off after init
*/
break;
case IEEE80211_S_ASSOC:
if (ostate == IEEE80211_S_SCAN) {
}
break;
}
}
/*
* exclusive access to mac begin.
*/
static void
{
int n;
/* wait until we succeed */
for (n = 0; n < 1000; n++) {
break;
}
DELAY(10);
}
#ifdef DEBUG
if (1000 == n) {
}
#endif
}
/*
* exclusive access to mac end.
*/
static void
{
}
/*
* this function defined here for future use.
* static uint32_t
* iwh_mem_read(iwh_sc_t *sc, uint32_t addr)
* {
* IWH_WRITE(sc, HBUS_TARG_MEM_RADDR, addr);
* return (IWH_READ(sc, HBUS_TARG_MEM_RDAT));
* }
*/
/*
* write mac memory
*/
static void
{
}
/*
* read mac register
*/
static uint32_t
{
}
/*
* write mac register
*/
static void
{
}
/*
* steps of loading ucode:
* load init ucode=>init alive=>calibrate=>
* receive calibration result=>reinitialize NIC=>
* load runtime ucode=>runtime alive=>
* send calibration result=>running.
*/
static int
{
int err;
/*
* load init_text section of uCode to hardware
*/
if (err != IWH_SUCCESS) {
"failed to write init uCode.\n");
return (err);
}
/* wait loading init_text until completed or timeout */
break;
}
}
"timeout waiting for init uCode load.\n");
return (IWH_FAIL);
}
/*
* load init_data section of uCode to hardware
*/
if (err != IWH_SUCCESS) {
"failed to write init_data uCode.\n");
return (err);
}
/*
* wait loading init_data until completed or timeout
*/
break;
}
}
"timeout waiting for init_data uCode load.\n");
return (IWH_FAIL);
}
return (err);
}
static int
{
int err;
/*
* load init_text section of uCode to hardware
*/
if (err != IWH_SUCCESS) {
"failed to write run uCode.\n");
return (err);
}
/* wait loading run_text until completed or timeout */
break;
}
}
"timeout waiting for run uCode load.\n");
return (IWH_FAIL);
}
/*
* load run_data section of uCode to hardware
*/
if (err != IWH_SUCCESS) {
"failed to write run_data uCode.\n");
return (err);
}
/*
* wait loading run_data until completed or timeout
*/
break;
}
}
"timeout waiting for run_data uCode load.\n");
return (IWH_FAIL);
}
return (err);
}
/*
* this function will be invoked to receive phy information
* when a frame is received.
*/
static void
{
sizeof (iwh_rx_phy_res_t));
}
/*
* this function will be invoked to receive body of frame when
* a frame is received.
*/
static void
{
#ifdef DEBUG
#endif
struct ieee80211_frame *wh;
int16_t t;
struct iwh_rx_non_cfg_phy *phyinfo;
struct iwh_rx_mpdu_body_size *mpdu_size;
/*
* assuming not 11n here. cope with 11n in phase-II
*/
return;
}
/*
* convert dBm to percentage
*/
/ (75 * 75);
if (rssi > 100) {
rssi = 100;
}
if (rssi < 1) {
rssi = 1;
}
/*
* size of frame, not include FCS
*/
sizeof (struct iwh_rx_mpdu_body_size) + len);
"rate=%x chan=%d tstamp=%x non_cfg_phy_count=%x "
return;
}
/*
* discard Rx frames with bad CRC
*/
return;
}
wh = (struct ieee80211_frame *)
sc->sc_assoc_id));
}
#ifdef DEBUG
if (iwh_dbg_flags & IWH_DEBUG_RX) {
}
#endif
if (mp) {
/*
* send the frame to the 802.11 layer
*/
} else {
sc->sc_rx_nobuf++;
"iwh_rx_mpdu_intr(): alloc rx buf failed\n"));
}
/*
* release node reference
*/
}
/*
* process correlative affairs after a frame is sent.
*/
static void
{
sc->sc_tx_retries++;
sc->sc_tx_retries));
}
sc->sc_tx_timer = 0;
}
sc->sc_need_reschedule = 0;
}
}
/*
* inform a given command has been executed
*/
static void
{
return;
}
"qid=%x idx=%d flags=%x type=0x%x\n",
}
/*
* this function will be invoked when alive notification occur.
*/
static void
{
struct iwh_calib_cfg_cmd cmd;
struct iwh_alive_resp *ar =
/*
* the microcontroller is ready
*/
"microcode alive notification minor: %x major: %x type:"
" %x subtype: %x\n",
#ifdef DEBUG
"microcontroller initialization failed\n"));
}
#endif
/*
* determine if init alive or runtime alive.
*/
"initialization alive received.\n"));
sizeof (struct iwh_init_alive_resp));
/*
* necessary configuration to NIC
*/
if (rv != IWH_SUCCESS) {
"common alive process failed in init alive.\n");
return;
}
/*
* require ucode execute calibration
*/
if (rv != IWH_SUCCESS) {
"failed to send calibration configure command.\n");
return;
}
} else { /* runtime alive */
sizeof (struct iwh_alive_resp));
/*
* necessary configuration to NIC
*/
if (rv != IWH_SUCCESS) {
"common alive process failed in run alive.\n");
return;
}
/*
* send the result of local oscilator calibration to uCode.
*/
if (rv != IWH_SUCCESS) {
"failed to send local"
"oscilator calibration command.\n");
return;
}
DELAY(1000);
}
/*
* send the result of TX IQ calibration to uCode.
*/
if (rv != IWH_SUCCESS) {
"failed to send TX IQ"
"calibration command.\n");
return;
}
DELAY(1000);
}
/*
* sned the result of TX IQ perd calibration to uCode.
*/
if (rv != IWH_SUCCESS) {
"failed to send TX IQ perd"
"calibration command.\n");
return;
}
DELAY(1000);
}
}
}
/*
* deal with receiving frames, command response
* and all notifications from ucode.
*/
static uint_t
/* LINTED: argument unused in function: unused */
{
return (DDI_INTR_UNCLAIMED);
}
/*
* disable interrupts
*/
/*
* firmware has moved the index of the rx queue, driver get it,
* and deal with it.
*/
" cur = %d qid=%x idx=%d flags=%x type=%x len=%d\n",
/*
* a command other than a tx need to be replied
*/
}
case REPLY_RX_PHY_CMD:
break;
case REPLY_RX_MPDU_CMD:
break;
case REPLY_TX:
break;
case REPLY_ALIVE:
break;
case CARD_STATE_NOTIFICATION:
{
/*
* the radio button has to be pushed(OFF). It
* is considered as a hw error, the
* iwh_thread() tries to recover it after the
* button is pushed again(ON)
*/
"radio transmitter is off\n");
IEEE80211_S_INIT, -1);
}
break;
}
case SCAN_START_NOTIFICATION:
{
"scanning channel %d status %x\n",
break;
}
{
"completed channel %d (burst of %d) status %02x\n",
sc->sc_scan_pending++;
break;
}
case STATISTICS_NOTIFICATION:
{
/*
* handle statistics notification
*/
break;
}
break;
break;
}
}
/*
* driver dealt with what received in rx queue and tell the information
* to the firmware.
*/
/*
* re-enable interrupts
*/
sc->sc_rx_softint_pending = 0;
return (DDI_INTR_CLAIMED);
}
/*
* the handle of interrupt
*/
static uint_t
/* LINTED: argument unused in function: unused */
{
return (DDI_INTR_UNCLAIMED);
}
if (0 == r || 0xffffffff == r) {
return (DDI_INTR_UNCLAIMED);
}
/*
* disable interrupts
*/
/*
* ack interrupts
*/
return (DDI_INTR_CLAIMED);
}
if (r & (BIT_INT_SWERROR | BIT_INT_ERR)) {
return (DDI_INTR_CLAIMED);
}
#ifdef DEBUG
if (r & BIT_INT_RF_KILL) {
}
#endif
if ((r & (BIT_INT_FH_RX | BIT_INT_SW_RX)) ||
(rfh & FH_INT_RX_MASK)) {
}
if (r & BIT_INT_FH_TX) {
}
#ifdef DEBUG
if (r & BIT_INT_ALIVE) {
}
#endif
/*
* re-enable interrupts
*/
return (DDI_INTR_CLAIMED);
}
static uint8_t
iwh_rate_to_plcp(int rate)
{
switch (rate) {
/*
* CCK rates
*/
case 2:
ret = 0xa;
break;
case 4:
ret = 0x14;
break;
case 11:
ret = 0x37;
break;
case 22:
ret = 0x6e;
break;
/*
* OFDM rates
*/
case 12:
ret = 0xd;
break;
case 18:
ret = 0xf;
break;
case 24:
ret = 0x5;
break;
case 36:
ret = 0x7;
break;
case 48:
ret = 0x9;
break;
case 72:
ret = 0xb;
break;
case 96:
ret = 0x1;
break;
case 108:
ret = 0x3;
break;
default:
ret = 0;
break;
}
return (ret);
}
/*
* invoked by GLD send frames
*/
static mblk_t *
{
return (NULL);
}
return (NULL);
}
break;
}
}
return (mp);
}
/*
* send frames
*/
static int
{
struct ieee80211_frame *wh;
struct ieee80211_key *k = NULL;
if ((type & IEEE80211_FC0_TYPE_MASK) !=
}
goto exit;
}
if ((type & IEEE80211_FC0_TYPE_MASK) !=
}
sc->sc_tx_nobuf++;
goto exit;
}
hdrlen = sizeof (struct ieee80211_frame);
if (NULL == m) { /* can not alloc buf, drop this package */
"failed to allocate msgbuf\n");
err = IWH_SUCCESS;
goto exit;
}
}
/*
* determine send which AP or station in IBSS
*/
"failed to find tx node\n");
freemsg(m);
err = IWH_SUCCESS;
goto exit;
}
} else {
}
k = ieee80211_crypto_encap(ic, m);
if (NULL == k) {
freemsg(m);
err = IWH_SUCCESS;
goto exit;
}
/* packet header may have moved, reset our local pointer */
}
#ifdef DEBUG
if (iwh_dbg_flags & IWH_DEBUG_TX) {
}
#endif
/*
* pickup a rate
*/
/*
* mgmt frames are sent at 1M
*/
} else {
/*
* do it here for the software way rate control.
* later for rate scaling in hardware.
* maybe like the following, for management frame:
* tx->initial_rate_index = LINK_QUAL_MAX_RETRY_NUM - 1;
* for data frame:
* tx->tx_flags |= (LE_32(TX_CMD_FLG_STA_RATE_MSK));
* rate = in->in_rates.ir_rates[in->in_txrate];
* tx->initial_rate_index = 1;
*
* now the txrate is determined in tx cmd flags, set to the
* max value 54M for 11g and 11M for 11b.
*/
} else {
}
}
}
/*
* retrieve destination node's id
*/
} else {
}
/* tell h/w to set timestamp in probe responses */
}
} else {
}
} else {
}
}
tx->dram_lsb_ptr =
tx->dram_msb_ptr = 0;
tx->driver_txop = 0;
tx->next_frame_len = 0;
/*
* first segment includes the tx cmd plus the 802.11 header,
* the second includes the remaining of the 802.11 frame.
*/
"len1 = 0x%x, len2 = 0x%x val1 = 0x%x val2 = 0x%x",
/*
* kick ring
*/
}
freemsg(m);
/*
* release node reference
*/
if (0 == sc->sc_tx_timer) {
}
exit:
return (err);
}
/*
* invoked by GLD to deal with IOCTL affaires
*/
static void
{
int err;
/*
* This is special for the hidden AP connection.
* In any case, we should make sure only one 'scan'
* in the driver for a 'connect' CLI command. So
* when connecting to a hidden AP, the scan is just
* sent out to the air when we know the desired
* essid of the AP we want to connect.
*/
if (ic->ic_des_esslen) {
iwh_m_stop(sc);
(void) iwh_m_start(sc);
(void) ieee80211_new_state(ic,
IEEE80211_S_SCAN, -1);
}
}
}
}
/*
* invoked by GLD supply statistics NIC and driver
*/
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:
case WIFI_STAT_TX_FAILED:
break;
case WIFI_STAT_TX_RETRANS:
break;
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:
default:
return (ENOTSUP);
}
return (IWH_SUCCESS);
}
/*
* invoked by GLD to start or open NIC
*/
static int
iwh_m_start(void *arg)
{
int err;
if (err != IWH_SUCCESS) {
/*
* The hw init err(eg. RF is OFF). Return Success to make
* the 'plumb' succeed. The iwh_thread() tries to re-init
* background.
*/
return (IWH_SUCCESS);
}
return (IWH_SUCCESS);
}
/*
* invoked by GLD to stop or down NIC
*/
static void
iwh_m_stop(void *arg)
{
/*
* release buffer for calibration
*/
}
/*
* invoked by GLD to configure NIC
*/
static int
{
int err;
if (err != IWH_SUCCESS) {
"failed to configure device\n");
goto fail;
}
}
return (IWH_SUCCESS);
fail:
return (err);
}
static int
/* LINTED: argument unused in function: arg add m */
{
return (IWH_SUCCESS);
}
static int
/* LINTED: argument unused in function: arg on */
{
return (IWH_SUCCESS);
}
/*
* kernel thread to deal with exceptional situation
*/
static void
{
#ifdef DEBUG
int times = 0;
#endif
while (sc->sc_mf_thread_switch) {
if (tmp & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) {
} else {
}
/*
* If in SUSPEND or the RF is OFF, do nothing.
*/
continue;
}
/*
* recovery fatal error
*/
"iwh_thread(): "
"try to recover fatal hw error: %d\n", times++));
if (err != IWH_SUCCESS) {
n++;
if (n < 20) {
continue;
}
}
n = 0;
if (!err) {
}
}
}
"iwh_thread(): "
"wait for probe response\n"));
sc->sc_scan_pending--;
}
/*
* rate ctl
*/
clk = ddi_get_lbolt();
}
}
if (sc->sc_tx_timer) {
timeout++;
if (10 == timeout) {
sc->sc_tx_timer--;
if (0 == sc->sc_tx_timer) {
"iwh_thread(): try to recover from"
" 'send fail\n"));
}
timeout = 0;
}
}
}
}
/*
* Send a command to the ucode.
*/
static int
{
/*
* kick cmd ring XXX
*/
}
if (async) {
return (IWH_SUCCESS);
} else {
break;
}
}
return (IWH_SUCCESS);
} else {
return (IWH_FAIL);
}
}
}
/*
* require ucode seting led of NIC
*/
static void
{
}
/*
* necessary setting to NIC before authentication
*/
static int
{
struct ieee80211_rateset rs;
int i, err;
/*
* update adapter's configuration according
* the info of target AP
*/
} else { /* assume 802.11b/g */
}
} else {
}
} else {
}
"filter_flags %x cck %x ofdm %x"
" bssid:%02x:%02x:%02x:%02x:%02x:%2x\n",
sizeof (iwh_rxon_cmd_t), 1);
if (err != IWH_SUCCESS) {
return (err);
}
if (err != IWH_SUCCESS) {
"failed to set tx power table.\n");
return (err);
}
/*
* add default AP node
*/
node.station_flags = 0;
if (err != IWH_SUCCESS) {
"failed to add BSS node\n");
return (err);
}
/*
* TX_LINK_QUALITY cmd
*/
for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) {
} else {
rate = 2;
}
}
masks &= ~RATE_MCS_ANT_A_MSK;
link_quality.rate_n_flags[i] =
}
sizeof (link_quality), 1);
if (err != IWH_SUCCESS) {
"failed to config link quality table\n");
return (err);
}
return (IWH_SUCCESS);
}
/*
* Send a scan request(assembly scan cmd) to the firmware.
*/
static int
{
struct ieee80211_frame *wh;
struct ieee80211_rateset *rs;
enum ieee80211_phymode mode;
(0x2 << RXON_RX_CHAIN_FORCE_SEL_POS) |
(0x2 << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS));
if (ic->ic_des_esslen) {
ic->ic_des_esslen);
} else {
}
/*
* a probe request frame is required after the REPLY_SCAN_CMD
*/
/*
* essid IE
*/
essid));
}
*frm++ = IEEE80211_ELEMID_SSID;
/*
* supported rates IE
*/
*frm++ = IEEE80211_ELEMID_RATES;
if (nrates > IEEE80211_RATE_SIZE) {
}
/*
* supported xrates IE
*/
*frm++ = IEEE80211_ELEMID_XRATES;
}
/*
* optionnal IE (usually for wpa)
*/
}
/* setup length of probe request */
/*
* the attribute of the scan channels are required after the probe
* request frame.
*/
if (ic->ic_des_esslen) {
} else {
}
frm += sizeof (iwh_scan_chan_t);
}
/*
* maybe for cmd, filling the byte cnt table is not necessary.
* anyway, we fill it here.
*/
}
/*
* kick cmd ring
*/
return (IWH_SUCCESS);
}
/*
* configure NIC by using ucode commands after loading ucode.
*/
static int
{
int i, err;
/*
* set power mode. Disable power management at present, do it later
*/
sizeof (powertable), 0);
if (err != IWH_SUCCESS) {
"failed to set power mode\n");
return (err);
}
/*
* configure bt coexistence
*/
sizeof (bt), 0);
if (err != IWH_SUCCESS) {
"failed to configurate bt coexistence\n");
return (err);
}
/*
* configure rxon
*/
case IEEE80211_M_STA:
break;
case IEEE80211_M_IBSS:
case IEEE80211_M_AHDEMO:
break;
case IEEE80211_M_HOSTAP:
break;
case IEEE80211_M_MONITOR:
break;
}
/*
* set antenna
*/
(0x2 << RXON_RX_CHAIN_FORCE_SEL_POS) |
(0x2 << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS));
sizeof (iwh_rxon_cmd_t), 0);
if (err != IWH_SUCCESS) {
"failed to set configure command\n");
return (err);
}
/*
* remove all nodes in NIC
*/
if (err != IWH_SUCCESS) {
"failed to remove broadcast node in hardware.\n");
return (err);
}
/*
* configure TX pwoer table
*/
if (err != IWH_SUCCESS) {
"failed to set tx power table.\n");
return (err);
}
/*
* add broadcast node so that we can send broadcast frame
*/
node.station_flags = 0;
if (err != IWH_SUCCESS) {
"failed to add broadcast node\n");
return (err);
}
/*
* TX_LINK_QUALITY cmd
*/
for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) {
masks &= ~RATE_MCS_ANT_A_MSK;
}
sizeof (link_quality), 0);
if (err != IWH_SUCCESS) {
"failed to config link quality table\n");
return (err);
}
return (IWH_SUCCESS);
}
/*
* quiesce(9E) entry point.
* This function is called when the system is single-threaded at high
* PIL with preemption disabled. Therefore, this function must not be
* blocked.
* This function returns DDI_SUCCESS on success, or DDI_FAILURE on failure.
* DDI_FAILURE indicates an error condition and should almost never happen.
*/
static int
{
return (DDI_FAILURE);
#ifdef DEBUG
/* by pass any messages, if it's quiesce */
iwh_dbg_flags = 0;
#endif
/*
* No more blocking is allowed while we are in the
* quiesce(9E) entry point.
*/
/*
* Disable and mask all interrupts.
*/
return (DDI_SUCCESS);
}
static void
{
int n;
if ((tmp & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE) ==
return;
}
for (n = 0; n < 2000; n++) {
break;
}
DELAY(1000);
}
#ifdef DEBUG
if (2000 == n) {
"timeout waiting for master stop\n"));
}
#endif
}
static int
{
DELAY(5000);
return (IWH_SUCCESS);
}
/*
* hardware initialization
*/
static int
{
int n;
/*
* clear any pending interrupts
*/
/*
* wait for clock ready
*/
for (n = 0; n < 1000; n++) {
break;
}
DELAY(10);
}
if (1000 == n) {
return (ETIMEDOUT);
}
DELAY(20);
} else {
"radio configuration information in eeprom is wrong\n");
return (IWH_FAIL);
}
(void) iwh_power_up(sc);
}
vlink & ~2);
/*
* make sure power supply on each part of the hardware
*/
DELAY(5);
return (IWH_SUCCESS);
}
/*
* set up semphore flag to own EEPROM
*/
static int
{
return (IWH_SUCCESS);
}
DELAY(10000);
}
}
return (IWH_FAIL);
}
/*
* reset semphore flag to release EEPROM
*/
static void
{
tmp & (~CSR_HW_IF_CONFIG_REG_EEP_SEM));
}
/*
* This function read all infomation from eeprom
*/
static int
{
int i, rr;
/*
* read eeprom gp register in CSR
*/
if ((eep_gp & CSR_EEPROM_GP_VALID_MSK) ==
return (IWH_FAIL);
}
if (rr != 0) {
return (IWH_FAIL);
}
for (i = 0; i < 10; i++) {
if (rv & 1) {
break;
}
DELAY(10);
}
if (!(rv & 1)) {
"time out when read eeprome\n"));
return (IWH_FAIL);
}
}
return (IWH_SUCCESS);
}
/*
* initialize mac address in ieee80211com_t struct
*/
static void
{
}
/*
* main initialization function
*/
static int
{
int n, err;
/*
* release buffer for calibration
*/
if (err != IWH_SUCCESS) {
"failed to initialize chipset\n");
return (IWH_FAIL);
}
/*
* backup ucode data part for future use.
*/
for (n = 0; n < 2; n++) {
/* load firmware init segment into NIC */
if (err != IWH_SUCCESS) {
"failed to setup init firmware\n");
continue;
}
/*
* now press "execute" start running
*/
break;
}
if (2 == n) {
"failed to load init firmware\n");
return (IWH_FAIL);
}
break;
}
}
"failed to process init alive.\n");
return (IWH_FAIL);
}
/*
* stop chipset for initializing chipset again
*/
if (err != IWH_SUCCESS) {
"failed to initialize chipset\n");
return (IWH_FAIL);
}
for (n = 0; n < 2; n++) {
/*
* load firmware run segment into NIC
*/
if (err != IWH_SUCCESS) {
"failed to setup run firmware\n");
continue;
}
/*
* now press "execute" start running
*/
break;
}
if (2 == n) {
"failed to load run firmware\n");
return (IWH_FAIL);
}
break;
}
}
"failed to process runtime alive.\n");
return (IWH_FAIL);
}
/*
* at this point, the firmware is loaded OK, then config the hardware
* with the ucode API, including rxon, txpower, etc.
*/
if (err) {
"failed to configure device\n");
return (IWH_FAIL);
}
/*
* at this point, hardware may receive beacons :)
*/
return (IWH_SUCCESS);
}
/*
* stop or disable NIC
*/
static void
{
int i;
/* by pass if it's quiesced */
/*
* disable interrupts
*/
/*
* reset all Tx rings
*/
for (i = 0; i < IWH_NUM_QUEUES; i++) {
}
/*
* reset Rx ring
*/
DELAY(5);
sc->sc_tx_timer = 0;
/* by pass if it's quiesced */
}
/*
* Naive implementation of the Adaptive Multi Rate Retry algorithm:
* "IEEE 802.11 Rate Adaptation: A Practical Approach"
* Mathieu Lacage, Hossein Manshaei, Thierry Turletti
* INRIA Sophia - Projet Planete
*/
#define is_success(amrr) \
#define is_failure(amrr) \
#define is_min_rate(in) \
#define is_max_rate(in) \
#define increase_rate(in) \
#define decrease_rate(in) \
#define IWH_AMRR_MIN_SUCCESS_THRESHOLD 1
#define IWH_AMRR_MAX_SUCCESS_THRESHOLD 15
static void
{
}
static void
{
} else {
}
}
static void
/* LINTED: argument unused in function: arg */
{
int need_change = 0;
!is_max_rate(in)) {
"AMRR increasing rate %d (txcnt=%d retrycnt=%d)\n",
need_change = 1;
} else {
}
} else if (is_failure(amrr)) {
if (!is_min_rate(in)) {
if (amrr->success_threshold >
}
} else {
}
"AMRR decreasing rate %d (txcnt=%d retrycnt=%d)\n",
need_change = 1;
}
}
}
}
/*
* translate indirect address in eeprom to direct address
* in eeprom and return address of entry whos indirect address
* is indi_addr
*/
static uint8_t *
{
if (!(indi_addr & INDIRECT_ADDRESS)) {
}
switch (indi_addr & INDIRECT_TYPE_MSK) {
case INDIRECT_GENERAL:
break;
case INDIRECT_HOST:
break;
case INDIRECT_REGULATORY:
break;
case INDIRECT_CALIBRATION:
break;
case INDIRECT_PROCESS_ADJST:
break;
case INDIRECT_OTHERS:
break;
default:
temp = 0;
"incorrect indirect eeprom address.\n");
break;
}
}
/*
* loade a section of ucode into NIC
*/
static int
{
return (IWH_SUCCESS);
}
/*
* necessary setting during alive notification
*/
static int
{
uint32_t i;
/*
* initialize SCD related registers to make TX work.
*/
/*
* read sram address of data base.
*/
base += 4) {
}
base += 4) {
}
}
for (i = 0; i < IWH_NUM_QUEUES; i++) {
IWH_SCD_CONTEXT_QUEUE_OFFSET(i), 0);
sizeof (uint32_t),
((SCD_FRAME_LIMIT <<
}
SCD_TXFACT_REG_TXFIFO_MASK(0, 7));
/*
* queue 0-7 map to FIFO 0-7 and
* all queues work under FIFO mode(none-scheduler_ack)
*/
for (i = 0; i < 4; i++) {
(1 << IWH_SCD_QUEUE_STTS_REG_POS_ACTIVE) |
((3-i) << IWH_SCD_QUEUE_STTS_REG_POS_TXF) |
(1 << IWH_SCD_QUEUE_STTS_REG_POS_WSL) |
}
(1 << IWH_SCD_QUEUE_STTS_REG_POS_ACTIVE) |
(1 << IWH_SCD_QUEUE_STTS_REG_POS_WSL) |
for (i = 5; i < 7; i++) {
(1 << IWH_SCD_QUEUE_STTS_REG_POS_ACTIVE) |
(i << IWH_SCD_QUEUE_STTS_REG_POS_TXF) |
(1 << IWH_SCD_QUEUE_STTS_REG_POS_WSL) |
}
if (rv != IWH_SUCCESS) {
"failed to send wimax coexist command.\n");
return (rv);
}
if (rv != IWH_SUCCESS) {
"failed to send crystal frq calibration command.\n");
return (rv);
}
/*
* make sure crystal frequency calibration ready
* before next operations.
*/
DELAY(1000);
return (IWH_SUCCESS);
}
/*
* save results of calibration from ucode
*/
static void
{
/*
* ensure the size of buffer is not too big
*/
case PHY_CALIBRATE_LO_CMD:
}
"failed to allocate memory.\n");
return;
}
break;
case PHY_CALIBRATE_TX_IQ_CMD:
}
"failed to allocate memory.\n");
return;
}
break;
}
"failed to allocate memory.\n");
}
break;
default:
"incorrect calibration type.\n");
break;
}
}
/*
* configure TX pwoer table
*/
static int
{
int i, err;
for (i = 0; i < 24; i++) {
}
for (i = 0; i < 2; i++) {
}
if (err != IWH_SUCCESS) {
"failed to set tx power table.\n");
return (err);
}
return (IWH_SUCCESS);
}
static void
{
}
}
}
}
/*
* a section of intialization
*/
static int
{
(void) iwh_preinit(sc);
if (!(tmp & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) {
"radio transmitter is off\n");
return (IWH_FAIL);
}
/*
* init Rx ring
*/
/*
* init Tx rings
*/
/*
* keep warm page
*/
}
/*
* clear "radio off" and "disable command" bits
*/
/*
* clear any pending interrupts
*/
/*
* enable interrupts
*/
return (IWH_SUCCESS);
}