184f7a9b9Shx147065 /* 219b23afcShx147065 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 384f7a9b9Shx147065 * Use is subject to license terms. 484f7a9b9Shx147065 */ 584f7a9b9Shx147065 684f7a9b9Shx147065 /* 784f7a9b9Shx147065 * Copyright (c) 2006 884f7a9b9Shx147065 * Damien Bergamini <damien.bergamini@free.fr> 984f7a9b9Shx147065 * 1084f7a9b9Shx147065 * Permission to use, copy, modify, and distribute this software for any 1184f7a9b9Shx147065 * purpose with or without fee is hereby granted, provided that the above 1284f7a9b9Shx147065 * copyright notice and this permission notice appear in all copies. 1384f7a9b9Shx147065 * 1484f7a9b9Shx147065 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 1584f7a9b9Shx147065 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1684f7a9b9Shx147065 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1784f7a9b9Shx147065 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1884f7a9b9Shx147065 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1984f7a9b9Shx147065 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 2084f7a9b9Shx147065 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 2184f7a9b9Shx147065 */ 2284f7a9b9Shx147065 2384f7a9b9Shx147065 #ifndef _WPIREG_H_ 2484f7a9b9Shx147065 #define _WPIREG_H_ 2584f7a9b9Shx147065 2684f7a9b9Shx147065 #ifdef __cplusplus 2784f7a9b9Shx147065 extern "C" { 2884f7a9b9Shx147065 #endif 2984f7a9b9Shx147065 3084f7a9b9Shx147065 #define WPI_TX_RING_COUNT 256 3184f7a9b9Shx147065 #define WPI_SVC_RING_COUNT 256 3284f7a9b9Shx147065 #define WPI_CMD_RING_COUNT 256 3384f7a9b9Shx147065 #define WPI_RX_RING_COUNT 64 3484f7a9b9Shx147065 3584f7a9b9Shx147065 /* 3684f7a9b9Shx147065 * Rings must be aligned on a four 4K-pages boundary. 3784f7a9b9Shx147065 * I had a hard time figuring this out. 3884f7a9b9Shx147065 */ 3984f7a9b9Shx147065 #define WPI_RING_DMA_ALIGN 0x4000 4084f7a9b9Shx147065 4184f7a9b9Shx147065 /* 4284f7a9b9Shx147065 * maximum scatter/gather 4384f7a9b9Shx147065 */ 4484f7a9b9Shx147065 #define WPI_MAX_SCATTER 4 4584f7a9b9Shx147065 4684f7a9b9Shx147065 /* 4784f7a9b9Shx147065 * Control and status registers. 4884f7a9b9Shx147065 */ 4984f7a9b9Shx147065 #define WPI_HWCONFIG 0x000 5084f7a9b9Shx147065 #define WPI_INTR 0x008 5184f7a9b9Shx147065 #define WPI_MASK 0x00c 5284f7a9b9Shx147065 #define WPI_INTR_STATUS 0x010 5384f7a9b9Shx147065 #define WPI_GPIO_STATUS 0x018 5484f7a9b9Shx147065 #define WPI_RESET 0x020 5584f7a9b9Shx147065 #define WPI_GPIO_CTL 0x024 5684f7a9b9Shx147065 #define WPI_EEPROM_CTL 0x02c 5784f7a9b9Shx147065 #define WPI_EEPROM_STATUS 0x030 5884f7a9b9Shx147065 #define WPI_UCODE_CLR 0x05c 5984f7a9b9Shx147065 #define WPI_TEMPERATURE 0x060 6084f7a9b9Shx147065 #define WPI_CHICKEN 0x100 6184f7a9b9Shx147065 #define WPI_PLL_CTL 0x20c 6284f7a9b9Shx147065 #define WPI_FW_TARGET 0x410 6384f7a9b9Shx147065 #define WPI_WRITE_MEM_ADDR 0x444 6484f7a9b9Shx147065 #define WPI_READ_MEM_ADDR 0x448 6584f7a9b9Shx147065 #define WPI_WRITE_MEM_DATA 0x44c 6684f7a9b9Shx147065 #define WPI_READ_MEM_DATA 0x450 6784f7a9b9Shx147065 #define WPI_TX_WIDX 0x460 6884f7a9b9Shx147065 #define WPI_TX_CTL(qid) (0x940 + (qid) * 8) 6984f7a9b9Shx147065 #define WPI_TX_BASE(qid) (0x944 + (qid) * 8) 7084f7a9b9Shx147065 #define WPI_TX_DESC(qid) (0x980 + (qid) * 80) 7184f7a9b9Shx147065 #define WPI_RX_CONFIG 0xc00 7284f7a9b9Shx147065 #define WPI_RX_BASE 0xc04 7384f7a9b9Shx147065 #define WPI_RX_WIDX 0xc20 7484f7a9b9Shx147065 #define WPI_RX_RIDX_PTR 0xc24 7584f7a9b9Shx147065 #define WPI_RX_CTL 0xcc0 7684f7a9b9Shx147065 #define WPI_RX_STATUS 0xcc4 7784f7a9b9Shx147065 #define WPI_TX_CONFIG(qid) (0xd00 + (qid) * 32) 7884f7a9b9Shx147065 #define WPI_TX_CREDIT(qid) (0xd04 + (qid) * 32) 7984f7a9b9Shx147065 #define WPI_TX_STATE(qid) (0xd08 + (qid) * 32) 8084f7a9b9Shx147065 #define WPI_TX_BASE_PTR 0xe80 8184f7a9b9Shx147065 #define WPI_MSG_CONFIG 0xe88 8284f7a9b9Shx147065 #define WPI_TX_STATUS 0xe90 8384f7a9b9Shx147065 8484f7a9b9Shx147065 8584f7a9b9Shx147065 /* 8684f7a9b9Shx147065 * NIC internal memory offsets. 8784f7a9b9Shx147065 */ 8884f7a9b9Shx147065 #define WPI_MEM_MODE 0x2e00 8984f7a9b9Shx147065 #define WPI_MEM_RA 0x2e04 9084f7a9b9Shx147065 #define WPI_MEM_TXCFG 0x2e10 9184f7a9b9Shx147065 #define WPI_MEM_MAGIC4 0x2e14 9284f7a9b9Shx147065 #define WPI_MEM_MAGIC5 0x2e20 9384f7a9b9Shx147065 #define WPI_MEM_BYPASS1 0x2e2c 9484f7a9b9Shx147065 #define WPI_MEM_BYPASS2 0x2e30 9584f7a9b9Shx147065 #define WPI_MEM_CLOCK1 0x3004 9684f7a9b9Shx147065 #define WPI_MEM_CLOCK2 0x3008 9784f7a9b9Shx147065 #define WPI_MEM_POWER 0x300c 9884f7a9b9Shx147065 #define WPI_MEM_PCIDEV 0x3010 9984f7a9b9Shx147065 #define WPI_MEM_UCODE_CTL 0x3400 10084f7a9b9Shx147065 #define WPI_MEM_UCODE_SRC 0x3404 10184f7a9b9Shx147065 #define WPI_MEM_UCODE_DST 0x3408 10284f7a9b9Shx147065 #define WPI_MEM_UCODE_SIZE 0x340c 10384f7a9b9Shx147065 #define WPI_MEM_UCODE_BASE 0x3800 10484f7a9b9Shx147065 10584f7a9b9Shx147065 10684f7a9b9Shx147065 /* 10784f7a9b9Shx147065 * possible flags for register WPI_HWCONFIG 10884f7a9b9Shx147065 */ 10984f7a9b9Shx147065 #define WPI_HW_ALM_MB (1 << 8) 11084f7a9b9Shx147065 #define WPI_HW_ALM_MM (1 << 9) 11184f7a9b9Shx147065 #define WPI_HW_SKU_MRC (1 << 10) 11284f7a9b9Shx147065 #define WPI_HW_REV_D (1 << 11) 11384f7a9b9Shx147065 #define WPI_HW_TYPE_B (1 << 12) 11484f7a9b9Shx147065 11584f7a9b9Shx147065 /* 11684f7a9b9Shx147065 * possible flags for registers WPI_READ_MEM_ADDR/WPI_WRITE_MEM_ADDR 11784f7a9b9Shx147065 */ 11884f7a9b9Shx147065 #define WPI_MEM_4 ((sizeof (uint32_t) - 1) << 24) 11984f7a9b9Shx147065 12084f7a9b9Shx147065 /* 12184f7a9b9Shx147065 * possible values for WPI_FW_TARGET 12284f7a9b9Shx147065 */ 12384f7a9b9Shx147065 #define WPI_FW_TEXT 0x00000000 12484f7a9b9Shx147065 #define WPI_FW_DATA 0x00800000 12584f7a9b9Shx147065 12684f7a9b9Shx147065 /* 12784f7a9b9Shx147065 * possible flags for WPI_GPIO_STATUS 12884f7a9b9Shx147065 */ 12984f7a9b9Shx147065 #define WPI_POWERED (1 << 9) 13084f7a9b9Shx147065 13184f7a9b9Shx147065 /* 13284f7a9b9Shx147065 * possible flags for register WPI_RESET 13384f7a9b9Shx147065 */ 13484f7a9b9Shx147065 #define WPI_NEVO_RESET (1 << 0) 13584f7a9b9Shx147065 #define WPI_SW_RESET (1 << 7) 13684f7a9b9Shx147065 #define WPI_MASTER_DISABLED (1 << 8) 13784f7a9b9Shx147065 #define WPI_STOP_MASTER (1 << 9) 13884f7a9b9Shx147065 13984f7a9b9Shx147065 /* 14084f7a9b9Shx147065 * possible flags for register WPI_GPIO_CTL 14184f7a9b9Shx147065 */ 14284f7a9b9Shx147065 #define WPI_GPIO_CLOCK (1 << 0) 14384f7a9b9Shx147065 #define WPI_GPIO_INIT (1 << 2) 14484f7a9b9Shx147065 #define WPI_GPIO_MAC (1 << 3) 14584f7a9b9Shx147065 #define WPI_GPIO_SLEEP (1 << 4) 14684f7a9b9Shx147065 #define WPI_GPIO_PWR_STATUS 0x07000000 14784f7a9b9Shx147065 #define WPI_GPIO_PWR_SLEEP (4 << 24) 14819b23afcShx147065 #define WPI_GPIO_HW_RF_KILL (1 << 27) 14984f7a9b9Shx147065 15084f7a9b9Shx147065 /* 15184f7a9b9Shx147065 * possible flags for register WPI_CHICKEN 15284f7a9b9Shx147065 */ 15384f7a9b9Shx147065 #define WPI_CHICKEN_RXNOLOS (1 << 23) 15484f7a9b9Shx147065 15584f7a9b9Shx147065 /* 15684f7a9b9Shx147065 * possible flags for register WPI_PLL_CTL 15784f7a9b9Shx147065 */ 15884f7a9b9Shx147065 #define WPI_PLL_INIT (1 << 24) 15984f7a9b9Shx147065 16084f7a9b9Shx147065 /* 16184f7a9b9Shx147065 * possible flags for register WPI_UCODE_CLR 16284f7a9b9Shx147065 */ 16384f7a9b9Shx147065 #define WPI_RADIO_OFF (1 << 1) 16484f7a9b9Shx147065 #define WPI_DISABLE_CMD (1 << 2) 16584f7a9b9Shx147065 16684f7a9b9Shx147065 /* 16784f7a9b9Shx147065 * possible flags for WPI_RX_STATUS 16884f7a9b9Shx147065 */ 16984f7a9b9Shx147065 #define WPI_RX_IDLE (1 << 24) 17084f7a9b9Shx147065 17184f7a9b9Shx147065 /* 17284f7a9b9Shx147065 * possible flags for register WPI_UC_CTL 17384f7a9b9Shx147065 */ 17484f7a9b9Shx147065 #define WPI_UC_RUN (1 << 30) 17584f7a9b9Shx147065 17684f7a9b9Shx147065 /* 17784f7a9b9Shx147065 * possible flags for register WPI_INTR_CSR 17884f7a9b9Shx147065 */ 17984f7a9b9Shx147065 #define WPI_ALIVE_INTR (1 << 0) 18084f7a9b9Shx147065 #define WPI_WAKEUP_INTR (1 << 1) 181bb5141e1Shx147065 #define WPI_RX_SWINT (1 << 3) 18219b23afcShx147065 #define WPI_RF_KILL (1 << 7) 18384f7a9b9Shx147065 #define WPI_SW_ERROR (1 << 25) 18484f7a9b9Shx147065 #define WPI_TX_INTR (1 << 27) 18584f7a9b9Shx147065 #define WPI_HW_ERROR (1 << 29) 18684f7a9b9Shx147065 #define WPI_RX_INTR (((uint32_t)1) << 31) 18784f7a9b9Shx147065 18884f7a9b9Shx147065 #define WPI_INTR_MASK \ 18984f7a9b9Shx147065 (WPI_SW_ERROR | WPI_HW_ERROR | WPI_TX_INTR | WPI_RX_INTR | \ 19084f7a9b9Shx147065 WPI_ALIVE_INTR | WPI_WAKEUP_INTR) 19184f7a9b9Shx147065 19284f7a9b9Shx147065 /* 19384f7a9b9Shx147065 * possible flags for register WPI_TX_STATUS 19484f7a9b9Shx147065 */ 19584f7a9b9Shx147065 #define WPI_TX_IDLE(qid) (1 << ((qid) + 24) | 1 << ((qid) + 16)) 19684f7a9b9Shx147065 19784f7a9b9Shx147065 /* 19884f7a9b9Shx147065 * possible flags for register WPI_EEPROM_CTL 19984f7a9b9Shx147065 */ 20084f7a9b9Shx147065 #define WPI_EEPROM_READY (1 << 0) 20184f7a9b9Shx147065 20284f7a9b9Shx147065 /* 20384f7a9b9Shx147065 * possible flags for register WPI_EEPROM_STATUS 20484f7a9b9Shx147065 */ 20584f7a9b9Shx147065 #define WPI_EEPROM_VERSION 0x00000007 20684f7a9b9Shx147065 #define WPI_EEPROM_LOCKED 0x00000180 20784f7a9b9Shx147065 20884f7a9b9Shx147065 20984f7a9b9Shx147065 typedef struct wpi_shared { 21084f7a9b9Shx147065 uint32_t txbase[8]; 21184f7a9b9Shx147065 uint32_t next; 21284f7a9b9Shx147065 uint32_t reserved[2]; 21384f7a9b9Shx147065 } wpi_shared_t; 21484f7a9b9Shx147065 21584f7a9b9Shx147065 #define WPI_MAX_SEG_LEN 65520 21684f7a9b9Shx147065 typedef struct wpi_tx_desc { 21784f7a9b9Shx147065 uint32_t flags; 21884f7a9b9Shx147065 #define WPI_PAD32(x) (roundup(x, 4) - (x)) 21984f7a9b9Shx147065 22084f7a9b9Shx147065 struct { 22184f7a9b9Shx147065 uint32_t addr; 22284f7a9b9Shx147065 uint32_t len; 22384f7a9b9Shx147065 } segs[WPI_MAX_SCATTER]; 22484f7a9b9Shx147065 uint8_t reserved[28]; 22584f7a9b9Shx147065 } wpi_tx_desc_t; 22684f7a9b9Shx147065 22784f7a9b9Shx147065 typedef struct wpi_tx_stat { 22884f7a9b9Shx147065 uint8_t nrts; 22984f7a9b9Shx147065 uint8_t ntries; 23084f7a9b9Shx147065 uint8_t nkill; 23184f7a9b9Shx147065 uint8_t rate; 23284f7a9b9Shx147065 uint32_t duration; 23384f7a9b9Shx147065 uint32_t status; 23484f7a9b9Shx147065 } wpi_tx_stat_t; 23584f7a9b9Shx147065 23684f7a9b9Shx147065 typedef struct wpi_rx_desc { 23784f7a9b9Shx147065 uint32_t len; 23884f7a9b9Shx147065 uint8_t type; 23984f7a9b9Shx147065 #define WPI_UC_READY 1 24084f7a9b9Shx147065 #define WPI_RX_DONE 27 24184f7a9b9Shx147065 #define WPI_TX_DONE 28 24284f7a9b9Shx147065 #define WPI_START_SCAN 130 24384f7a9b9Shx147065 #define WPI_START_RESULT 131 24484f7a9b9Shx147065 #define WPI_STOP_SCAN 132 24584f7a9b9Shx147065 #define WPI_STATE_CHANGED 161 24684f7a9b9Shx147065 24784f7a9b9Shx147065 uint8_t flags; 24884f7a9b9Shx147065 uint8_t idx; 24984f7a9b9Shx147065 uint8_t qid; 25084f7a9b9Shx147065 } wpi_rx_desc_t; 25184f7a9b9Shx147065 25284f7a9b9Shx147065 typedef struct wpi_rx_stat { 25384f7a9b9Shx147065 uint8_t len; 25484f7a9b9Shx147065 #define WPI_STAT_MAXLEN 20 25584f7a9b9Shx147065 25684f7a9b9Shx147065 uint8_t id; 25784f7a9b9Shx147065 uint8_t rssi; /* received signal strength */ 25884f7a9b9Shx147065 #define WPI_RSSI_OFFSET 95 25984f7a9b9Shx147065 26084f7a9b9Shx147065 uint8_t agc; /* access gain control */ 26184f7a9b9Shx147065 uint16_t signal; 26284f7a9b9Shx147065 uint16_t noise; 26384f7a9b9Shx147065 } wpi_rx_stat_t; 26484f7a9b9Shx147065 26584f7a9b9Shx147065 typedef struct wpi_rx_head { 26684f7a9b9Shx147065 uint16_t chan; 26784f7a9b9Shx147065 uint16_t flags; 26884f7a9b9Shx147065 uint8_t reserved; 26984f7a9b9Shx147065 uint8_t rate; 27084f7a9b9Shx147065 uint16_t len; 27184f7a9b9Shx147065 } wpi_rx_head_t; 27284f7a9b9Shx147065 27384f7a9b9Shx147065 typedef struct wpi_rx_tail { 27484f7a9b9Shx147065 uint32_t flags; 27584f7a9b9Shx147065 #define WPI_RX_NO_CRC_ERR (1 << 0) 27684f7a9b9Shx147065 #define WPI_RX_NO_OVFL_ERR (1 << 1) 27784f7a9b9Shx147065 #define WPI_RX_NOERROR (WPI_RX_NO_CRC_ERR | WPI_RX_NO_OVFL_ERR) 27884f7a9b9Shx147065 27984f7a9b9Shx147065 uint64_t tstamp; 28084f7a9b9Shx147065 uint32_t tbeacon; 28184f7a9b9Shx147065 } wpi_rx_tail_t; 28284f7a9b9Shx147065 28384f7a9b9Shx147065 typedef struct wpi_tx_cmd { 28484f7a9b9Shx147065 uint8_t code; 28584f7a9b9Shx147065 #define WPI_CMD_CONFIGURE 16 28684f7a9b9Shx147065 #define WPI_CMD_ASSOCIATE 17 28784f7a9b9Shx147065 #define WPI_CMD_SET_WME 19 28884f7a9b9Shx147065 #define WPI_CMD_TSF 20 28984f7a9b9Shx147065 #define WPI_CMD_ADD_NODE 24 29084f7a9b9Shx147065 #define WPI_CMD_TX_DATA 28 29184f7a9b9Shx147065 #define WPI_CMD_MRR_SETUP 71 29284f7a9b9Shx147065 #define WPI_CMD_SET_LED 72 29384f7a9b9Shx147065 #define WPI_CMD_SET_POWER_MODE 119 29484f7a9b9Shx147065 #define WPI_CMD_SCAN 128 29584f7a9b9Shx147065 #define WPI_CMD_SET_BEACON 145 29684f7a9b9Shx147065 #define WPI_CMD_BLUETOOTH 155 29784f7a9b9Shx147065 #define WPI_CMD_TXPOWER 176 29884f7a9b9Shx147065 29984f7a9b9Shx147065 uint8_t flags; 30084f7a9b9Shx147065 uint8_t idx; 30184f7a9b9Shx147065 uint8_t qid; 30284f7a9b9Shx147065 uint8_t data[124]; 30384f7a9b9Shx147065 } wpi_tx_cmd_t; 30484f7a9b9Shx147065 30584f7a9b9Shx147065 /* 30684f7a9b9Shx147065 * structure for WPI_CMD_CONFIGURE 30784f7a9b9Shx147065 */ 30884f7a9b9Shx147065 typedef struct wpi_config { 30984f7a9b9Shx147065 uint8_t myaddr[IEEE80211_ADDR_LEN]; 31084f7a9b9Shx147065 uint16_t reserved1; 31184f7a9b9Shx147065 uint8_t bssid[IEEE80211_ADDR_LEN]; 31284f7a9b9Shx147065 uint16_t reserved2; 31384f7a9b9Shx147065 uint32_t reserved3[2]; 31484f7a9b9Shx147065 uint8_t mode; 31584f7a9b9Shx147065 #define WPI_MODE_HOSTAP 1 31684f7a9b9Shx147065 #define WPI_MODE_STA 3 31784f7a9b9Shx147065 #define WPI_MODE_IBSS 4 31884f7a9b9Shx147065 #define WPI_MODE_MONITOR 6 31984f7a9b9Shx147065 32084f7a9b9Shx147065 uint8_t reserved4[3]; 32184f7a9b9Shx147065 uint8_t ofdm_mask; 32284f7a9b9Shx147065 uint8_t cck_mask; 32384f7a9b9Shx147065 uint16_t state; 32484f7a9b9Shx147065 #define WPI_CONFIG_ASSOCIATED 4 32584f7a9b9Shx147065 32684f7a9b9Shx147065 uint32_t flags; 32784f7a9b9Shx147065 #define WPI_CONFIG_24GHZ (1 << 0) 32884f7a9b9Shx147065 #define WPI_CONFIG_CCK (1 << 1) 32984f7a9b9Shx147065 #define WPI_CONFIG_AUTO (1 << 2) 33084f7a9b9Shx147065 #define WPI_CONFIG_SHSLOT (1 << 4) 33184f7a9b9Shx147065 #define WPI_CONFIG_SHPREAMBLE (1 << 5) 33284f7a9b9Shx147065 #define WPI_CONFIG_NODIVERSITY (1 << 7) 33384f7a9b9Shx147065 #define WPI_CONFIG_ANTENNA_A (1 << 8) 33484f7a9b9Shx147065 #define WPI_CONFIG_ANTENNA_B (1 << 9) 33584f7a9b9Shx147065 #define WPI_CONFIG_TSF (1 << 15) 33684f7a9b9Shx147065 33784f7a9b9Shx147065 uint32_t filter; 33884f7a9b9Shx147065 #define WPI_FILTER_PROMISC (1 << 0) 33984f7a9b9Shx147065 #define WPI_FILTER_CTL (1 << 1) 34084f7a9b9Shx147065 #define WPI_FILTER_MULTICAST (1 << 2) 3413a1a8936Szf162725 #define WPI_FILTER_NODECRYPTUNI (1 << 3) 3423a1a8936Szf162725 #define WPI_FILTER_NODECRYPTMUL (1 << 4) 34384f7a9b9Shx147065 #define WPI_FILTER_BSS (1 << 5) 34484f7a9b9Shx147065 #define WPI_FILTER_BEACON (1 << 6) 34584f7a9b9Shx147065 34684f7a9b9Shx147065 uint8_t chan; 34784f7a9b9Shx147065 uint8_t reserved6[3]; 34884f7a9b9Shx147065 } wpi_config_t; 34984f7a9b9Shx147065 35084f7a9b9Shx147065 /* 35184f7a9b9Shx147065 * structure for command WPI_CMD_ASSOCIATE 35284f7a9b9Shx147065 */ 35384f7a9b9Shx147065 typedef struct wpi_assoc { 35484f7a9b9Shx147065 uint32_t flags; 35584f7a9b9Shx147065 uint32_t filter; 35684f7a9b9Shx147065 uint8_t ofdm_mask; 35784f7a9b9Shx147065 uint8_t cck_mask; 35884f7a9b9Shx147065 uint16_t reserved; 35984f7a9b9Shx147065 } wpi_assoc_t; 36084f7a9b9Shx147065 36184f7a9b9Shx147065 /* 36284f7a9b9Shx147065 * structure for command WPI_CMD_SET_WME 36384f7a9b9Shx147065 */ 36484f7a9b9Shx147065 typedef struct wpi_wme_setup { 36584f7a9b9Shx147065 uint32_t flags; 36684f7a9b9Shx147065 struct { 36784f7a9b9Shx147065 uint16_t cwmin; 36884f7a9b9Shx147065 uint16_t cwmax; 36984f7a9b9Shx147065 uint8_t aifsn; 37084f7a9b9Shx147065 uint8_t reserved; 37184f7a9b9Shx147065 uint16_t txop; 37284f7a9b9Shx147065 } ac[WME_NUM_AC]; 37384f7a9b9Shx147065 } wpi_wme_setup_t; 37484f7a9b9Shx147065 37584f7a9b9Shx147065 /* 37684f7a9b9Shx147065 * structure for command WPI_CMD_TSF 37784f7a9b9Shx147065 */ 37884f7a9b9Shx147065 typedef struct wpi_cmd_tsf { 37984f7a9b9Shx147065 uint64_t tstamp; 38084f7a9b9Shx147065 uint16_t bintval; 38184f7a9b9Shx147065 uint16_t atim; 38284f7a9b9Shx147065 uint32_t binitval; 38384f7a9b9Shx147065 uint16_t lintval; 38484f7a9b9Shx147065 uint16_t reserved; 38584f7a9b9Shx147065 } wpi_cmd_tsf_t; 38684f7a9b9Shx147065 38784f7a9b9Shx147065 /* 38884f7a9b9Shx147065 * structure for WPI_CMD_ADD_NODE 38984f7a9b9Shx147065 */ 39084f7a9b9Shx147065 typedef struct wpi_node { 39184f7a9b9Shx147065 uint8_t control; 39284f7a9b9Shx147065 #define WPI_NODE_UPDATE (1 << 0) 39384f7a9b9Shx147065 39484f7a9b9Shx147065 uint8_t reserved1[3]; 39584f7a9b9Shx147065 uint8_t bssid[IEEE80211_ADDR_LEN]; 39684f7a9b9Shx147065 uint16_t reserved2; 39784f7a9b9Shx147065 uint8_t id; 39884f7a9b9Shx147065 #define WPI_ID_BSS 0 39984f7a9b9Shx147065 #define WPI_ID_BROADCAST 24 40084f7a9b9Shx147065 40184f7a9b9Shx147065 uint8_t sta_mask; 40284f7a9b9Shx147065 uint16_t reserved3; 40384f7a9b9Shx147065 uint16_t key_flags; 40484f7a9b9Shx147065 uint8_t tkip; 40584f7a9b9Shx147065 uint8_t reserved4; 40684f7a9b9Shx147065 uint16_t ttak[5]; 4073a1a8936Szf162725 uint8_t keyp; 4083a1a8936Szf162725 uint8_t reserved5; 40984f7a9b9Shx147065 uint8_t key[16]; 41084f7a9b9Shx147065 uint32_t flags; 41184f7a9b9Shx147065 uint32_t mask; 41284f7a9b9Shx147065 uint16_t tid; 41384f7a9b9Shx147065 uint8_t rate; 41484f7a9b9Shx147065 uint8_t reserved6; 41584f7a9b9Shx147065 uint8_t add_imm; 41684f7a9b9Shx147065 uint8_t del_imm; 41784f7a9b9Shx147065 uint16_t add_imm_start; 41884f7a9b9Shx147065 } wpi_node_t; 41984f7a9b9Shx147065 42084f7a9b9Shx147065 /* 42184f7a9b9Shx147065 * structure for command WPI_CMD_TX_DATA 42284f7a9b9Shx147065 */ 42384f7a9b9Shx147065 typedef struct wpi_cmd_data { 42484f7a9b9Shx147065 uint16_t len; 42584f7a9b9Shx147065 uint16_t lnext; 42684f7a9b9Shx147065 uint32_t flags; 42784f7a9b9Shx147065 #define WPI_TX_NEED_RTS (1 << 1) 42884f7a9b9Shx147065 #define WPI_TX_NEED_ACK (1 << 3) 42984f7a9b9Shx147065 #define WPI_TX_FULL_TXOP (1 << 7) 43084f7a9b9Shx147065 #define WPI_TX_BT_DISABLE (1 << 12) 43184f7a9b9Shx147065 #define WPI_TX_AUTO_SEQ (1 << 13) 43284f7a9b9Shx147065 #define WPI_TX_INSERT_TSTAMP (1 << 16) 43384f7a9b9Shx147065 #define WPI_TX_CALIBRATION (1 << 17) 43484f7a9b9Shx147065 43584f7a9b9Shx147065 uint8_t rate; 43684f7a9b9Shx147065 uint8_t id; 43784f7a9b9Shx147065 uint8_t tid; 43884f7a9b9Shx147065 uint8_t security; 43984f7a9b9Shx147065 uint8_t key[16]; 44084f7a9b9Shx147065 uint8_t tkip[8]; 44184f7a9b9Shx147065 uint32_t fnext; 44284f7a9b9Shx147065 uint32_t lifetime; 44384f7a9b9Shx147065 uint8_t ofdm_mask; 44484f7a9b9Shx147065 uint8_t cck_mask; 44584f7a9b9Shx147065 uint8_t rts_ntries; 44684f7a9b9Shx147065 uint8_t data_ntries; 44784f7a9b9Shx147065 uint16_t timeout; 44884f7a9b9Shx147065 uint16_t txop; 44984f7a9b9Shx147065 } wpi_cmd_data_t; 45084f7a9b9Shx147065 45184f7a9b9Shx147065 /* 45284f7a9b9Shx147065 * structure for command WPI_CMD_SET_BEACON 45384f7a9b9Shx147065 */ 45484f7a9b9Shx147065 typedef struct wpi_cmd_beacon { 45584f7a9b9Shx147065 uint16_t len; 45684f7a9b9Shx147065 uint16_t reserved1; 45784f7a9b9Shx147065 uint32_t flags; /* same as wpi_cmd_data */ 45884f7a9b9Shx147065 uint8_t rate; 45984f7a9b9Shx147065 uint8_t id; 46084f7a9b9Shx147065 uint8_t reserved2[30]; 46184f7a9b9Shx147065 uint32_t lifetime; 46284f7a9b9Shx147065 uint8_t ofdm_mask; 46384f7a9b9Shx147065 uint8_t cck_mask; 46484f7a9b9Shx147065 uint16_t reserved3[3]; 46584f7a9b9Shx147065 uint16_t tim; 46684f7a9b9Shx147065 uint8_t timsz; 46784f7a9b9Shx147065 uint8_t reserved4; 46884f7a9b9Shx147065 struct ieee80211_frame wh; 46984f7a9b9Shx147065 } wpi_cmd_beacon_t; 47084f7a9b9Shx147065 47184f7a9b9Shx147065 /* 47284f7a9b9Shx147065 * structure for WPI_CMD_MRR_SETUP 47384f7a9b9Shx147065 */ 47484f7a9b9Shx147065 typedef struct wpi_mrr_setup { 47584f7a9b9Shx147065 uint32_t which; 47684f7a9b9Shx147065 #define WPI_MRR_CTL 0 47784f7a9b9Shx147065 #define WPI_MRR_DATA 1 47884f7a9b9Shx147065 47984f7a9b9Shx147065 struct { 48084f7a9b9Shx147065 uint8_t signal; 48184f7a9b9Shx147065 uint8_t flags; 48284f7a9b9Shx147065 uint8_t ntries; 48384f7a9b9Shx147065 uint8_t next; 48484f7a9b9Shx147065 #define WPI_OFDM6 0 48584f7a9b9Shx147065 #define WPI_OFDM54 7 48684f7a9b9Shx147065 #define WPI_CCK1 8 48784f7a9b9Shx147065 #define WPI_CCK11 11 48884f7a9b9Shx147065 48984f7a9b9Shx147065 } rates[WPI_CCK11 + 1]; 49084f7a9b9Shx147065 } wpi_mrr_setup_t; 49184f7a9b9Shx147065 49284f7a9b9Shx147065 /* 49384f7a9b9Shx147065 * structure for WPI_CMD_SET_LED 49484f7a9b9Shx147065 */ 49584f7a9b9Shx147065 typedef struct wpi_cmd_led { 49684f7a9b9Shx147065 uint32_t unit; /* multiplier (in usecs) */ 49784f7a9b9Shx147065 uint8_t which; 49884f7a9b9Shx147065 #define WPI_LED_ACTIVITY 1 49984f7a9b9Shx147065 #define WPI_LED_LINK 2 50084f7a9b9Shx147065 50184f7a9b9Shx147065 uint8_t off; 50284f7a9b9Shx147065 uint8_t on; 50384f7a9b9Shx147065 uint8_t reserved; 50484f7a9b9Shx147065 } wpi_cmd_led_t; 50584f7a9b9Shx147065 50684f7a9b9Shx147065 /* 50784f7a9b9Shx147065 * structure for WPI_CMD_SET_POWER_MODE 50884f7a9b9Shx147065 */ 50984f7a9b9Shx147065 typedef struct wpi_power { 51084f7a9b9Shx147065 uint32_t flags; 51184f7a9b9Shx147065 uint32_t rx_timeout; 51284f7a9b9Shx147065 uint32_t tx_timeout; 51384f7a9b9Shx147065 uint32_t sleep[5]; 51484f7a9b9Shx147065 } wpi_power_t; 51584f7a9b9Shx147065 51684f7a9b9Shx147065 /* 51784f7a9b9Shx147065 * structure for command WPI_CMD_SCAN 51884f7a9b9Shx147065 */ 51984f7a9b9Shx147065 typedef struct wpi_scan_hdr { 52084f7a9b9Shx147065 uint8_t len; 52184f7a9b9Shx147065 uint8_t first; 52284f7a9b9Shx147065 uint8_t reserved1; 52384f7a9b9Shx147065 uint8_t nchan; 52484f7a9b9Shx147065 uint16_t quiet; 52584f7a9b9Shx147065 uint16_t threshold; 52684f7a9b9Shx147065 uint32_t reserved2[3]; 52784f7a9b9Shx147065 uint32_t filter; 52884f7a9b9Shx147065 uint32_t reserved3; 52984f7a9b9Shx147065 uint16_t pbrlen; 53084f7a9b9Shx147065 uint16_t reserved4; 53184f7a9b9Shx147065 uint32_t magic1; 53284f7a9b9Shx147065 uint8_t rate; 53384f7a9b9Shx147065 uint8_t id; 53484f7a9b9Shx147065 uint16_t reserved5; 53584f7a9b9Shx147065 uint32_t reserved6[7]; 53684f7a9b9Shx147065 uint32_t mask; 53784f7a9b9Shx147065 uint32_t reserved7[2]; 53884f7a9b9Shx147065 uint8_t reserved8; 53984f7a9b9Shx147065 uint8_t esslen; 54084f7a9b9Shx147065 uint8_t essid[134]; 54184f7a9b9Shx147065 54284f7a9b9Shx147065 /* followed by probe request body */ 54384f7a9b9Shx147065 /* followed by nchan x wpi_scan_chan */ 54484f7a9b9Shx147065 } wpi_scan_hdr_t; 54584f7a9b9Shx147065 54684f7a9b9Shx147065 typedef struct wpi_scan_chan { 54784f7a9b9Shx147065 uint8_t flags; 54884f7a9b9Shx147065 uint8_t chan; 54984f7a9b9Shx147065 uint16_t magic; /* XXX */ 55084f7a9b9Shx147065 uint16_t active; /* dwell time */ 55184f7a9b9Shx147065 uint16_t passive; /* dwell time */ 55284f7a9b9Shx147065 } wpi_scan_chan_t; 55384f7a9b9Shx147065 55484f7a9b9Shx147065 /* 55584f7a9b9Shx147065 * structure for WPI_CMD_BLUETOOTH 55684f7a9b9Shx147065 */ 55784f7a9b9Shx147065 typedef struct wpi_bluetooth { 55884f7a9b9Shx147065 uint8_t flags; 55984f7a9b9Shx147065 uint8_t lead; 56084f7a9b9Shx147065 uint8_t kill; 56184f7a9b9Shx147065 uint8_t reserved; 56284f7a9b9Shx147065 uint32_t ack; 56384f7a9b9Shx147065 uint32_t cts; 56484f7a9b9Shx147065 } wpi_bluetooth_t; 56584f7a9b9Shx147065 56684f7a9b9Shx147065 /* 56784f7a9b9Shx147065 * structure for command WPI_CMD_TXPOWER 56884f7a9b9Shx147065 */ 56984f7a9b9Shx147065 typedef struct wpi_txpower { 57084f7a9b9Shx147065 uint32_t reserved1; 57184f7a9b9Shx147065 uint16_t pwr1[14]; 57284f7a9b9Shx147065 uint32_t reserved2[2]; 57384f7a9b9Shx147065 uint16_t pwr2[14]; 57484f7a9b9Shx147065 uint32_t reserved3[2]; 57584f7a9b9Shx147065 } wpi_txpower_t; 57684f7a9b9Shx147065 57784f7a9b9Shx147065 57884f7a9b9Shx147065 /* 57984f7a9b9Shx147065 * firmware image header 58084f7a9b9Shx147065 */ 58184f7a9b9Shx147065 typedef struct wpi_firmware_hdr { 58284f7a9b9Shx147065 uint32_t version; 58384f7a9b9Shx147065 uint32_t textsz; 58484f7a9b9Shx147065 uint32_t datasz; 58584f7a9b9Shx147065 uint32_t bootsz; 58684f7a9b9Shx147065 } wpi_firmware_hdr_t; 58784f7a9b9Shx147065 58884f7a9b9Shx147065 /* 58984f7a9b9Shx147065 * structure for WPI_UC_READY notification 59084f7a9b9Shx147065 */ 59184f7a9b9Shx147065 typedef struct wpi_ucode_info { 59284f7a9b9Shx147065 uint32_t version; 59384f7a9b9Shx147065 uint8_t revision[8]; 59484f7a9b9Shx147065 uint8_t type; 59584f7a9b9Shx147065 uint8_t subtype; 59684f7a9b9Shx147065 uint16_t reserved; 59784f7a9b9Shx147065 uint32_t logptr; 59884f7a9b9Shx147065 uint32_t errorptr; 59984f7a9b9Shx147065 uint32_t timestamp; 60084f7a9b9Shx147065 uint32_t valid; 60184f7a9b9Shx147065 } wpi_ucode_info_t; 60284f7a9b9Shx147065 60384f7a9b9Shx147065 /* 60484f7a9b9Shx147065 * structure for WPI_START_SCAN notification 60584f7a9b9Shx147065 */ 60684f7a9b9Shx147065 typedef struct wpi_start_scan { 60784f7a9b9Shx147065 uint64_t tstamp; 60884f7a9b9Shx147065 uint32_t tbeacon; 60984f7a9b9Shx147065 uint8_t chan; 61084f7a9b9Shx147065 uint8_t band; 61184f7a9b9Shx147065 uint16_t reserved; 61284f7a9b9Shx147065 uint32_t status; 61384f7a9b9Shx147065 } wpi_start_scan_t; 61484f7a9b9Shx147065 615*626dff79Spengcheng chen - Sun Microsystems - Beijing China /* 616*626dff79Spengcheng chen - Sun Microsystems - Beijing China * structure for WPI_STOP_SCAN notification 617*626dff79Spengcheng chen - Sun Microsystems - Beijing China */ 618*626dff79Spengcheng chen - Sun Microsystems - Beijing China typedef struct wpi_stop_scan { 619*626dff79Spengcheng chen - Sun Microsystems - Beijing China uint8_t nchan; 620*626dff79Spengcheng chen - Sun Microsystems - Beijing China uint8_t status; 621*626dff79Spengcheng chen - Sun Microsystems - Beijing China uint8_t reserved; 622*626dff79Spengcheng chen - Sun Microsystems - Beijing China uint8_t chan; 623*626dff79Spengcheng chen - Sun Microsystems - Beijing China uint64_t tsf; 624*626dff79Spengcheng chen - Sun Microsystems - Beijing China } wpi_stop_scan_t; 62584f7a9b9Shx147065 62684f7a9b9Shx147065 #define WPI_EEPROM_MAC 0x015 62784f7a9b9Shx147065 #define WPI_EEPROM_REVISION 0x035 62884f7a9b9Shx147065 #define WPI_EEPROM_CAPABILITIES 0x045 62984f7a9b9Shx147065 #define WPI_EEPROM_TYPE 0x04a 63084f7a9b9Shx147065 #define WPI_EEPROM_PWR1 0x1ae 63184f7a9b9Shx147065 #define WPI_EEPROM_PWR2 0x1bc 63284f7a9b9Shx147065 63384f7a9b9Shx147065 #define WPI_READ(sc, reg) \ 63484f7a9b9Shx147065 ddi_get32((sc)->sc_handle, (uint32_t *)((sc)->sc_base + (reg))) 63584f7a9b9Shx147065 63684f7a9b9Shx147065 #define WPI_WRITE(sc, reg, val) \ 63784f7a9b9Shx147065 ddi_put32((sc)->sc_handle, (uint32_t *)((sc)->sc_base + (reg)), (val)) 63884f7a9b9Shx147065 63984f7a9b9Shx147065 #define WPI_WRITE_REGION_4(sc, offset, datap, count) { \ 64084f7a9b9Shx147065 uint32_t *p = (datap); \ 64184f7a9b9Shx147065 uint32_t s = (offset); \ 64284f7a9b9Shx147065 uint32_t c = (count); \ 64384f7a9b9Shx147065 while (--c > 0) { \ 64484f7a9b9Shx147065 ddi_put32((sc)->sc_handle, \ 64584f7a9b9Shx147065 (uint32_t *)((sc)->sc_base + s), *p); \ 64684f7a9b9Shx147065 p++; \ 64784f7a9b9Shx147065 s += 4; \ 64884f7a9b9Shx147065 } \ 64984f7a9b9Shx147065 } 65084f7a9b9Shx147065 65184f7a9b9Shx147065 #ifdef __cplusplus 65284f7a9b9Shx147065 } 65384f7a9b9Shx147065 #endif 65484f7a9b9Shx147065 65584f7a9b9Shx147065 #endif /* _WPIREG_H_ */ 656