rt2860.c revision 860387ebc186ce5dc552b18d01f5124739a10eed
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy * Use is subject to license terms.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy * Copyright (c) 2007, 2008
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy * Damien Bergamini <damien.bergamini@free.fr>
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy * Permission to use, copy, modify, and distribute this software for any
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy * purpose with or without fee is hereby granted, provided that the above
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy * copyright notice and this permission notice appear in all copies.
#include "rt2860_reg.h"
#include "rt2860_var.h"
#ifdef DEBUG
#define RWN_DEBUG \
#define RWN_DEBUG
#include "fw-rt2860/rt2860.ucode"
} rt2860_def_mac[] = {
} rt2860_def_bbp[] = {
static const struct rfprog {
} rt2860_rf2850[] = {
struct rt2860_tx_ring *);
struct rt2860_tx_ring *);
struct rt2860_rx_ring *);
struct rt2860_rx_ring *);
const struct rt2860_rxwi *);
struct ieee80211_channel *);
static void rt2860_next_scan(void *);
struct rt2860_amrr_node *);
enum ieee80211_state, int);
(void *)&rwn_modldrv,
static int rt2860_m_start(void *);
static void rt2860_m_stop(void *);
NULL,
NULL,
NULL,
#ifdef DEBUG
switch (rev) {
static uint16_t
val = 0;
return (val);
static inline uint32_t
if (b4 < 0)
b4 = 0;
return (b32);
return (RT2860_SUCCESS);
int err;
goto fail1;
goto fail2;
goto fail3;
goto fail4;
return (DDI_SUCCESS);
return (err);
goto fail1;
return (DDI_SUCCESS);
return (err);
for (i = 0; i < RT2860_TX_RING_COUNT; i++) {
goto fail1;
for (i = 0; i < RT2860_RX_RING_COUNT; i++) {
return (DDI_SUCCESS);
return (err);
for (i = 0; i < RT2860_RX_RING_COUNT; i++)
int i, count;
for (i = 0; i < count; i++) {
goto fail1;
for (i = 0; i < RT2860_TX_POOL_COUNT; i++) {
goto fail2;
i * sizeof (struct rt2860_txwi);
return (DDI_SUCCESS);
return (err);
for (i = 0; i < RT2860_TX_POOL_COUNT; i++) {
static uint8_t
switch (rate) {
switch (rate) {
static uint16_t
return (txtime);
goto fail1;
goto fail1;
if (m == NULL) {
goto fail1;
goto fail2;
struct ieee80211_key *k;
if (k == NULL) {
goto fail3;
freemsg(m);
return (err);
int need_change = 0;
for (i = 0; i < IEEE80211_ADDR_LEN; i++)
int err;
switch (nstate) {
case IEEE80211_S_INIT:
case IEEE80211_S_SCAN:
case IEEE80211_S_AUTH:
case IEEE80211_S_ASSOC:
case IEEE80211_S_RUN:
return (err);
static uint8_t
return (rxchain);
sizeof (struct rt2860_txd),
int pktlen;
sizeof (struct rt2860_rxd),
goto skip;
goto skip;
goto skip;
skip:
sizeof (struct rt2860_rxd),
static uint_t
return (DDI_INTR_CLAIMED);
return (DDI_INTR_UNCLAIMED);
static uint_t
uint32_t r;
return (DDI_INTR_UNCLAIMED);
return (DDI_INTR_UNCLAIMED);
return (DDI_INTR_UNCLAIMED);
if (r & RT2860_TX_COHERENT)
if (r & RT2860_RX_COHERENT)
if (r & RT2860_MAC_INT_2) {
if (r & RT2860_TX_DONE_INT5) {
if (r & RT2860_RX_DONE_INT) {
if (r & RT2860_TX_DONE_INT4) {
if (r & RT2860_TX_DONE_INT3) {
if (r & RT2860_TX_DONE_INT2) {
if (r & RT2860_TX_DONE_INT1) {
if (r & RT2860_TX_DONE_INT0) {
if (r & RT2860_MAC_INT_0) {
if (r & RT2860_MAC_INT_3)
return (DDI_INTR_CLAIMED);
int ntries;
for (i = 0; i < size; i++) {
return (ETIMEDOUT);
int ntries;
return (EIO);
return (RT2860_SUCCESS);
static uint8_t
int ntries;
int ntries;
int i, ntries;
return (ETIMEDOUT);
int ntries;
if (IEEE80211_IS_CHAN_5GHZ(c)) {
group = 0;
return (err);
return (ETIMEDOUT);
for (i = 0; i < N(rt2860_def_mac); i++)
return (ETIMEDOUT);
return (err);
return (ETIMEDOUT);
return (ETIMEDOUT);
return (DDI_SUCCESS);
return (DDI_FAILURE);
#ifdef DEBUG
rt2860_dbg_flags = 0;
return (DDI_SUCCESS);
int qid;
int err;
goto fail1;
return (err);
return (err);
int err;
int err = 0;
return (err);
int err;
wldp_buf);
err = 0;
return (err);
static mblk_t *
return (NULL);
return (NULL);
DDI_SUCCESS) {
return (mp);
return (ENOTSUP);
return (ENOTSUP);
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);
switch (cmd) {
case DDI_ATTACH:
case DDI_RESUME:
return (DDI_SUCCESS);
return (DDI_FAILURE);
return (err);
goto fail1;
if (cachelsz == 0)
command);
goto fail2;
return (DDI_FAILURE);
goto fail3;
goto fail4;
goto fail5;
goto fail8;
goto fail7;
goto fail7;
goto fail9;
if (err != 0) {
goto fail9;
return (DDI_SUCCESS);
while (--qid >= 0)
return (err);
int qid;
switch (cmd) {
case DDI_DETACH:
case DDI_SUSPEND:
return (DDI_SUCCESS);
return (DDI_FAILURE);
return (DDI_FAILURE);
return (DDI_SUCCESS);
_init(void)
int status;
if (status != 0)
return (status);
if (status != 0) {
return (status);
_fini(void)
int status;
if (status == 0) {
return (status);