xref: /onnv-gate/usr/src/uts/common/io/wpi/wpireg.h (revision 7865:597819f481f4)
14128Shx147065 /*
26062Shx147065  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
34128Shx147065  * Use is subject to license terms.
44128Shx147065  */
54128Shx147065 
64128Shx147065 /*
74128Shx147065  * Copyright (c) 2006
84128Shx147065  *	Damien Bergamini <damien.bergamini@free.fr>
94128Shx147065  *
104128Shx147065  * Permission to use, copy, modify, and distribute this software for any
114128Shx147065  * purpose with or without fee is hereby granted, provided that the above
124128Shx147065  * copyright notice and this permission notice appear in all copies.
134128Shx147065  *
144128Shx147065  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
154128Shx147065  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
164128Shx147065  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
174128Shx147065  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
184128Shx147065  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
194128Shx147065  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
204128Shx147065  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
214128Shx147065  */
224128Shx147065 
234128Shx147065 #ifndef	_WPIREG_H_
244128Shx147065 #define	_WPIREG_H_
254128Shx147065 
264128Shx147065 #ifdef	__cplusplus
274128Shx147065 extern "C" {
284128Shx147065 #endif
294128Shx147065 
304128Shx147065 #define	WPI_TX_RING_COUNT	256
314128Shx147065 #define	WPI_SVC_RING_COUNT	256
324128Shx147065 #define	WPI_CMD_RING_COUNT	256
334128Shx147065 #define	WPI_RX_RING_COUNT	64
344128Shx147065 
354128Shx147065 /*
364128Shx147065  * Rings must be aligned on a four 4K-pages boundary.
374128Shx147065  * I had a hard time figuring this out.
384128Shx147065  */
394128Shx147065 #define	WPI_RING_DMA_ALIGN	0x4000
404128Shx147065 
414128Shx147065 /*
424128Shx147065  * maximum scatter/gather
434128Shx147065  */
444128Shx147065 #define	WPI_MAX_SCATTER	4
454128Shx147065 
464128Shx147065 /*
474128Shx147065  * Control and status registers.
484128Shx147065  */
494128Shx147065 #define	WPI_HWCONFIG		0x000
504128Shx147065 #define	WPI_INTR		0x008
514128Shx147065 #define	WPI_MASK		0x00c
524128Shx147065 #define	WPI_INTR_STATUS		0x010
534128Shx147065 #define	WPI_GPIO_STATUS		0x018
544128Shx147065 #define	WPI_RESET		0x020
554128Shx147065 #define	WPI_GPIO_CTL		0x024
564128Shx147065 #define	WPI_EEPROM_CTL		0x02c
574128Shx147065 #define	WPI_EEPROM_STATUS	0x030
584128Shx147065 #define	WPI_UCODE_CLR		0x05c
594128Shx147065 #define	WPI_TEMPERATURE		0x060
604128Shx147065 #define	WPI_CHICKEN		0x100
614128Shx147065 #define	WPI_PLL_CTL		0x20c
624128Shx147065 #define	WPI_FW_TARGET		0x410
634128Shx147065 #define	WPI_WRITE_MEM_ADDR  	0x444
644128Shx147065 #define	WPI_READ_MEM_ADDR   	0x448
654128Shx147065 #define	WPI_WRITE_MEM_DATA  	0x44c
664128Shx147065 #define	WPI_READ_MEM_DATA   	0x450
674128Shx147065 #define	WPI_TX_WIDX		0x460
684128Shx147065 #define	WPI_TX_CTL(qid)		(0x940 + (qid) * 8)
694128Shx147065 #define	WPI_TX_BASE(qid)	(0x944 + (qid) * 8)
704128Shx147065 #define	WPI_TX_DESC(qid)	(0x980 + (qid) * 80)
714128Shx147065 #define	WPI_RX_CONFIG		0xc00
724128Shx147065 #define	WPI_RX_BASE		0xc04
734128Shx147065 #define	WPI_RX_WIDX		0xc20
744128Shx147065 #define	WPI_RX_RIDX_PTR		0xc24
754128Shx147065 #define	WPI_RX_CTL		0xcc0
764128Shx147065 #define	WPI_RX_STATUS		0xcc4
774128Shx147065 #define	WPI_TX_CONFIG(qid)	(0xd00 + (qid) * 32)
784128Shx147065 #define	WPI_TX_CREDIT(qid)	(0xd04 + (qid) * 32)
794128Shx147065 #define	WPI_TX_STATE(qid)	(0xd08 + (qid) * 32)
804128Shx147065 #define	WPI_TX_BASE_PTR		0xe80
814128Shx147065 #define	WPI_MSG_CONFIG		0xe88
824128Shx147065 #define	WPI_TX_STATUS		0xe90
834128Shx147065 
844128Shx147065 
854128Shx147065 /*
864128Shx147065  * NIC internal memory offsets.
874128Shx147065  */
884128Shx147065 #define	WPI_MEM_MODE		0x2e00
894128Shx147065 #define	WPI_MEM_RA		0x2e04
904128Shx147065 #define	WPI_MEM_TXCFG		0x2e10
914128Shx147065 #define	WPI_MEM_MAGIC4		0x2e14
924128Shx147065 #define	WPI_MEM_MAGIC5		0x2e20
934128Shx147065 #define	WPI_MEM_BYPASS1		0x2e2c
944128Shx147065 #define	WPI_MEM_BYPASS2		0x2e30
954128Shx147065 #define	WPI_MEM_CLOCK1		0x3004
964128Shx147065 #define	WPI_MEM_CLOCK2		0x3008
974128Shx147065 #define	WPI_MEM_POWER		0x300c
984128Shx147065 #define	WPI_MEM_PCIDEV		0x3010
994128Shx147065 #define	WPI_MEM_UCODE_CTL	0x3400
1004128Shx147065 #define	WPI_MEM_UCODE_SRC	0x3404
1014128Shx147065 #define	WPI_MEM_UCODE_DST	0x3408
1024128Shx147065 #define	WPI_MEM_UCODE_SIZE	0x340c
1034128Shx147065 #define	WPI_MEM_UCODE_BASE	0x3800
1044128Shx147065 
1054128Shx147065 
1064128Shx147065 /*
1074128Shx147065  * possible flags for register WPI_HWCONFIG
1084128Shx147065  */
1094128Shx147065 #define	WPI_HW_ALM_MB	(1 << 8)
1104128Shx147065 #define	WPI_HW_ALM_MM	(1 << 9)
1114128Shx147065 #define	WPI_HW_SKU_MRC	(1 << 10)
1124128Shx147065 #define	WPI_HW_REV_D	(1 << 11)
1134128Shx147065 #define	WPI_HW_TYPE_B	(1 << 12)
1144128Shx147065 
1154128Shx147065 /*
1164128Shx147065  * possible flags for registers WPI_READ_MEM_ADDR/WPI_WRITE_MEM_ADDR
1174128Shx147065  */
1184128Shx147065 #define	WPI_MEM_4	((sizeof (uint32_t) - 1) << 24)
1194128Shx147065 
1204128Shx147065 /*
1214128Shx147065  * possible values for WPI_FW_TARGET
1224128Shx147065  */
1234128Shx147065 #define	WPI_FW_TEXT	0x00000000
1244128Shx147065 #define	WPI_FW_DATA	0x00800000
1254128Shx147065 
1264128Shx147065 /*
1274128Shx147065  * possible flags for WPI_GPIO_STATUS
1284128Shx147065  */
1294128Shx147065 #define	WPI_POWERED		(1 << 9)
1304128Shx147065 
1314128Shx147065 /*
1324128Shx147065  * possible flags for register WPI_RESET
1334128Shx147065  */
1344128Shx147065 #define	WPI_NEVO_RESET		(1 << 0)
1354128Shx147065 #define	WPI_SW_RESET		(1 << 7)
1364128Shx147065 #define	WPI_MASTER_DISABLED	(1 << 8)
1374128Shx147065 #define	WPI_STOP_MASTER		(1 << 9)
1384128Shx147065 
1394128Shx147065 /*
1404128Shx147065  * possible flags for register WPI_GPIO_CTL
1414128Shx147065  */
1424128Shx147065 #define	WPI_GPIO_CLOCK		(1 << 0)
1434128Shx147065 #define	WPI_GPIO_INIT		(1 << 2)
1444128Shx147065 #define	WPI_GPIO_MAC		(1 << 3)
1454128Shx147065 #define	WPI_GPIO_SLEEP		(1 << 4)
1464128Shx147065 #define	WPI_GPIO_PWR_STATUS	0x07000000
1474128Shx147065 #define	WPI_GPIO_PWR_SLEEP	(4 << 24)
1486062Shx147065 #define	WPI_GPIO_HW_RF_KILL	(1 << 27)
1494128Shx147065 
1504128Shx147065 /*
1514128Shx147065  * possible flags for register WPI_CHICKEN
1524128Shx147065  */
1534128Shx147065 #define	WPI_CHICKEN_RXNOLOS	(1 << 23)
1544128Shx147065 
1554128Shx147065 /*
1564128Shx147065  * possible flags for register WPI_PLL_CTL
1574128Shx147065  */
1584128Shx147065 #define	WPI_PLL_INIT		(1 << 24)
1594128Shx147065 
1604128Shx147065 /*
1614128Shx147065  * possible flags for register WPI_UCODE_CLR
1624128Shx147065  */
1634128Shx147065 #define	WPI_RADIO_OFF		(1 << 1)
1644128Shx147065 #define	WPI_DISABLE_CMD		(1 << 2)
1654128Shx147065 
1664128Shx147065 /*
1674128Shx147065  * possible flags for WPI_RX_STATUS
1684128Shx147065  */
1694128Shx147065 #define	WPI_RX_IDLE	(1 << 24)
1704128Shx147065 
1714128Shx147065 /*
1724128Shx147065  * possible flags for register WPI_UC_CTL
1734128Shx147065  */
1744128Shx147065 #define	WPI_UC_RUN	(1 << 30)
1754128Shx147065 
1764128Shx147065 /*
1774128Shx147065  * possible flags for register WPI_INTR_CSR
1784128Shx147065  */
1794128Shx147065 #define	WPI_ALIVE_INTR	(1 << 0)
1804128Shx147065 #define	WPI_WAKEUP_INTR	(1 << 1)
1815453Shx147065 #define	WPI_RX_SWINT	(1 << 3)
1826062Shx147065 #define	WPI_RF_KILL	(1 << 7)
1834128Shx147065 #define	WPI_SW_ERROR	(1 << 25)
1844128Shx147065 #define	WPI_TX_INTR	(1 << 27)
1854128Shx147065 #define	WPI_HW_ERROR	(1 << 29)
1864128Shx147065 #define	WPI_RX_INTR	(((uint32_t)1) << 31)
1874128Shx147065 
1884128Shx147065 #define	WPI_INTR_MASK							\
1894128Shx147065 	(WPI_SW_ERROR | WPI_HW_ERROR | WPI_TX_INTR | WPI_RX_INTR |	\
1904128Shx147065 	WPI_ALIVE_INTR | WPI_WAKEUP_INTR)
1914128Shx147065 
1924128Shx147065 /*
1934128Shx147065  * possible flags for register WPI_TX_STATUS
1944128Shx147065  */
1954128Shx147065 #define	WPI_TX_IDLE(qid)	(1 << ((qid) + 24) | 1 << ((qid) + 16))
1964128Shx147065 
1974128Shx147065 /*
1984128Shx147065  * possible flags for register WPI_EEPROM_CTL
1994128Shx147065  */
2004128Shx147065 #define	WPI_EEPROM_READY	(1 << 0)
2014128Shx147065 
2024128Shx147065 /*
2034128Shx147065  * possible flags for register WPI_EEPROM_STATUS
2044128Shx147065  */
2054128Shx147065 #define	WPI_EEPROM_VERSION	0x00000007
2064128Shx147065 #define	WPI_EEPROM_LOCKED	0x00000180
2074128Shx147065 
2084128Shx147065 
2094128Shx147065 typedef struct wpi_shared {
2104128Shx147065 	uint32_t	txbase[8];
2114128Shx147065 	uint32_t	next;
2124128Shx147065 	uint32_t	reserved[2];
2134128Shx147065 } wpi_shared_t;
2144128Shx147065 
2154128Shx147065 #define	WPI_MAX_SEG_LEN	65520
2164128Shx147065 typedef struct wpi_tx_desc {
2174128Shx147065 	uint32_t	flags;
2184128Shx147065 #define	WPI_PAD32(x)	(roundup(x, 4) - (x))
2194128Shx147065 
2204128Shx147065 	struct {
2214128Shx147065 		uint32_t	addr;
2224128Shx147065 		uint32_t	len;
2234128Shx147065 	} segs[WPI_MAX_SCATTER];
2244128Shx147065 	uint8_t		reserved[28];
2254128Shx147065 } wpi_tx_desc_t;
2264128Shx147065 
2274128Shx147065 typedef struct wpi_tx_stat {
2284128Shx147065 	uint8_t		nrts;
2294128Shx147065 	uint8_t		ntries;
2304128Shx147065 	uint8_t		nkill;
2314128Shx147065 	uint8_t		rate;
2324128Shx147065 	uint32_t	duration;
2334128Shx147065 	uint32_t	status;
2344128Shx147065 } wpi_tx_stat_t;
2354128Shx147065 
2364128Shx147065 typedef struct wpi_rx_desc {
2374128Shx147065 	uint32_t	len;
2384128Shx147065 	uint8_t		type;
2394128Shx147065 #define	WPI_UC_READY		  1
2404128Shx147065 #define	WPI_RX_DONE		 27
2414128Shx147065 #define	WPI_TX_DONE		 28
2424128Shx147065 #define	WPI_START_SCAN		130
2434128Shx147065 #define	WPI_START_RESULT	131
2444128Shx147065 #define	WPI_STOP_SCAN		132
2454128Shx147065 #define	WPI_STATE_CHANGED	161
2464128Shx147065 
2474128Shx147065 	uint8_t		flags;
2484128Shx147065 	uint8_t		idx;
2494128Shx147065 	uint8_t		qid;
2504128Shx147065 } wpi_rx_desc_t;
2514128Shx147065 
2524128Shx147065 typedef struct wpi_rx_stat {
2534128Shx147065 	uint8_t		len;
2544128Shx147065 #define	WPI_STAT_MAXLEN	20
2554128Shx147065 
2564128Shx147065 	uint8_t		id;
2574128Shx147065 	uint8_t		rssi;	/* received signal strength */
2584128Shx147065 #define	WPI_RSSI_OFFSET	95
2594128Shx147065 
2604128Shx147065 	uint8_t		agc;	/* access gain control */
2614128Shx147065 	uint16_t	signal;
2624128Shx147065 	uint16_t	noise;
2634128Shx147065 } wpi_rx_stat_t;
2644128Shx147065 
2654128Shx147065 typedef struct wpi_rx_head {
2664128Shx147065 	uint16_t	chan;
2674128Shx147065 	uint16_t	flags;
2684128Shx147065 	uint8_t		reserved;
2694128Shx147065 	uint8_t		rate;
2704128Shx147065 	uint16_t	len;
2714128Shx147065 } wpi_rx_head_t;
2724128Shx147065 
2734128Shx147065 typedef struct wpi_rx_tail {
2744128Shx147065 	uint32_t	flags;
2754128Shx147065 #define	WPI_RX_NO_CRC_ERR	(1 << 0)
2764128Shx147065 #define	WPI_RX_NO_OVFL_ERR	(1 << 1)
2774128Shx147065 #define	WPI_RX_NOERROR		(WPI_RX_NO_CRC_ERR | WPI_RX_NO_OVFL_ERR)
2784128Shx147065 
2794128Shx147065 	uint64_t	tstamp;
2804128Shx147065 	uint32_t	tbeacon;
2814128Shx147065 } wpi_rx_tail_t;
2824128Shx147065 
2834128Shx147065 typedef struct wpi_tx_cmd {
2844128Shx147065 	uint8_t	code;
2854128Shx147065 #define	WPI_CMD_CONFIGURE	 16
2864128Shx147065 #define	WPI_CMD_ASSOCIATE	 17
2874128Shx147065 #define	WPI_CMD_SET_WME		 19
2884128Shx147065 #define	WPI_CMD_TSF		 20
2894128Shx147065 #define	WPI_CMD_ADD_NODE	 24
2904128Shx147065 #define	WPI_CMD_TX_DATA		 28
2914128Shx147065 #define	WPI_CMD_MRR_SETUP	 71
2924128Shx147065 #define	WPI_CMD_SET_LED		 72
2934128Shx147065 #define	WPI_CMD_SET_POWER_MODE	119
2944128Shx147065 #define	WPI_CMD_SCAN		128
2954128Shx147065 #define	WPI_CMD_SET_BEACON	145
2964128Shx147065 #define	WPI_CMD_BLUETOOTH	155
2974128Shx147065 #define	WPI_CMD_TXPOWER		176
2984128Shx147065 
2994128Shx147065 	uint8_t	flags;
3004128Shx147065 	uint8_t	idx;
3014128Shx147065 	uint8_t	qid;
3024128Shx147065 	uint8_t	data[124];
3034128Shx147065 } wpi_tx_cmd_t;
3044128Shx147065 
3054128Shx147065 /*
3064128Shx147065  * structure for WPI_CMD_CONFIGURE
3074128Shx147065  */
3084128Shx147065 typedef struct wpi_config {
3094128Shx147065 	uint8_t		myaddr[IEEE80211_ADDR_LEN];
3104128Shx147065 	uint16_t	reserved1;
3114128Shx147065 	uint8_t		bssid[IEEE80211_ADDR_LEN];
3124128Shx147065 	uint16_t	reserved2;
3134128Shx147065 	uint32_t	reserved3[2];
3144128Shx147065 	uint8_t		mode;
3154128Shx147065 #define	WPI_MODE_HOSTAP		1
3164128Shx147065 #define	WPI_MODE_STA		3
3174128Shx147065 #define	WPI_MODE_IBSS		4
3184128Shx147065 #define	WPI_MODE_MONITOR	6
3194128Shx147065 
3204128Shx147065 	uint8_t		reserved4[3];
3214128Shx147065 	uint8_t		ofdm_mask;
3224128Shx147065 	uint8_t		cck_mask;
3234128Shx147065 	uint16_t	state;
3244128Shx147065 #define	WPI_CONFIG_ASSOCIATED	4
3254128Shx147065 
3264128Shx147065 	uint32_t	flags;
3274128Shx147065 #define	WPI_CONFIG_24GHZ	(1 << 0)
3284128Shx147065 #define	WPI_CONFIG_CCK		(1 << 1)
3294128Shx147065 #define	WPI_CONFIG_AUTO		(1 << 2)
3304128Shx147065 #define	WPI_CONFIG_SHSLOT	(1 << 4)
3314128Shx147065 #define	WPI_CONFIG_SHPREAMBLE	(1 << 5)
3324128Shx147065 #define	WPI_CONFIG_NODIVERSITY	(1 << 7)
3334128Shx147065 #define	WPI_CONFIG_ANTENNA_A	(1 << 8)
3344128Shx147065 #define	WPI_CONFIG_ANTENNA_B	(1 << 9)
3354128Shx147065 #define	WPI_CONFIG_TSF		(1 << 15)
3364128Shx147065 
3374128Shx147065 	uint32_t	filter;
3384128Shx147065 #define	WPI_FILTER_PROMISC	(1 << 0)
3394128Shx147065 #define	WPI_FILTER_CTL		(1 << 1)
3404128Shx147065 #define	WPI_FILTER_MULTICAST	(1 << 2)
3415296Szf162725 #define	WPI_FILTER_NODECRYPTUNI	(1 << 3)
3425296Szf162725 #define	WPI_FILTER_NODECRYPTMUL	(1 << 4)
3434128Shx147065 #define	WPI_FILTER_BSS		(1 << 5)
3444128Shx147065 #define	WPI_FILTER_BEACON	(1 << 6)
3454128Shx147065 
3464128Shx147065 	uint8_t		chan;
3474128Shx147065 	uint8_t		reserved6[3];
3484128Shx147065 } wpi_config_t;
3494128Shx147065 
3504128Shx147065 /*
3514128Shx147065  * structure for command WPI_CMD_ASSOCIATE
3524128Shx147065  */
3534128Shx147065 typedef struct wpi_assoc {
3544128Shx147065 	uint32_t	flags;
3554128Shx147065 	uint32_t	filter;
3564128Shx147065 	uint8_t		ofdm_mask;
3574128Shx147065 	uint8_t		cck_mask;
3584128Shx147065 	uint16_t	reserved;
3594128Shx147065 } wpi_assoc_t;
3604128Shx147065 
3614128Shx147065 /*
3624128Shx147065  * structure for command WPI_CMD_SET_WME
3634128Shx147065  */
3644128Shx147065 typedef struct wpi_wme_setup {
3654128Shx147065 	uint32_t	flags;
3664128Shx147065 	struct {
3674128Shx147065 		uint16_t	cwmin;
3684128Shx147065 		uint16_t	cwmax;
3694128Shx147065 		uint8_t		aifsn;
3704128Shx147065 		uint8_t		reserved;
3714128Shx147065 		uint16_t	txop;
3724128Shx147065 	} ac[WME_NUM_AC];
3734128Shx147065 } wpi_wme_setup_t;
3744128Shx147065 
3754128Shx147065 /*
3764128Shx147065  * structure for command WPI_CMD_TSF
3774128Shx147065  */
3784128Shx147065 typedef struct wpi_cmd_tsf {
3794128Shx147065 	uint64_t	tstamp;
3804128Shx147065 	uint16_t	bintval;
3814128Shx147065 	uint16_t	atim;
3824128Shx147065 	uint32_t	binitval;
3834128Shx147065 	uint16_t	lintval;
3844128Shx147065 	uint16_t	reserved;
3854128Shx147065 } wpi_cmd_tsf_t;
3864128Shx147065 
3874128Shx147065 /*
3884128Shx147065  * structure for WPI_CMD_ADD_NODE
3894128Shx147065  */
3904128Shx147065 typedef struct wpi_node {
3914128Shx147065 	uint8_t		control;
3924128Shx147065 #define	WPI_NODE_UPDATE	(1 << 0)
3934128Shx147065 
3944128Shx147065 	uint8_t		reserved1[3];
3954128Shx147065 	uint8_t		bssid[IEEE80211_ADDR_LEN];
3964128Shx147065 	uint16_t	reserved2;
3974128Shx147065 	uint8_t		id;
3984128Shx147065 #define	WPI_ID_BSS		0
3994128Shx147065 #define	WPI_ID_BROADCAST	24
4004128Shx147065 
4014128Shx147065 	uint8_t		sta_mask;
4024128Shx147065 	uint16_t	reserved3;
4034128Shx147065 	uint16_t	key_flags;
4044128Shx147065 	uint8_t		tkip;
4054128Shx147065 	uint8_t		reserved4;
4064128Shx147065 	uint16_t	ttak[5];
4075296Szf162725 	uint8_t		keyp;
4085296Szf162725 	uint8_t		reserved5;
4094128Shx147065 	uint8_t		key[16];
4104128Shx147065 	uint32_t	flags;
4114128Shx147065 	uint32_t	mask;
4124128Shx147065 	uint16_t	tid;
4134128Shx147065 	uint8_t		rate;
4144128Shx147065 	uint8_t		reserved6;
4154128Shx147065 	uint8_t		add_imm;
4164128Shx147065 	uint8_t		del_imm;
4174128Shx147065 	uint16_t	add_imm_start;
4184128Shx147065 } wpi_node_t;
4194128Shx147065 
4204128Shx147065 /*
4214128Shx147065  * structure for command WPI_CMD_TX_DATA
4224128Shx147065  */
4234128Shx147065 typedef struct wpi_cmd_data {
4244128Shx147065 	uint16_t	len;
4254128Shx147065 	uint16_t	lnext;
4264128Shx147065 	uint32_t	flags;
4274128Shx147065 #define	WPI_TX_NEED_RTS		(1 <<  1)
4284128Shx147065 #define	WPI_TX_NEED_ACK		(1 <<  3)
4294128Shx147065 #define	WPI_TX_FULL_TXOP	(1 <<  7)
4304128Shx147065 #define	WPI_TX_BT_DISABLE	(1 << 12)
4314128Shx147065 #define	WPI_TX_AUTO_SEQ		(1 << 13)
4324128Shx147065 #define	WPI_TX_INSERT_TSTAMP	(1 << 16)
4334128Shx147065 #define	WPI_TX_CALIBRATION	(1 << 17)
4344128Shx147065 
4354128Shx147065 	uint8_t		rate;
4364128Shx147065 	uint8_t		id;
4374128Shx147065 	uint8_t		tid;
4384128Shx147065 	uint8_t		security;
4394128Shx147065 	uint8_t		key[16];
4404128Shx147065 	uint8_t		tkip[8];
4414128Shx147065 	uint32_t	fnext;
4424128Shx147065 	uint32_t	lifetime;
4434128Shx147065 	uint8_t		ofdm_mask;
4444128Shx147065 	uint8_t		cck_mask;
4454128Shx147065 	uint8_t		rts_ntries;
4464128Shx147065 	uint8_t		data_ntries;
4474128Shx147065 	uint16_t	timeout;
4484128Shx147065 	uint16_t	txop;
4494128Shx147065 } wpi_cmd_data_t;
4504128Shx147065 
4514128Shx147065 /*
4524128Shx147065  * structure for command WPI_CMD_SET_BEACON
4534128Shx147065  */
4544128Shx147065 typedef struct wpi_cmd_beacon {
4554128Shx147065 	uint16_t	len;
4564128Shx147065 	uint16_t	reserved1;
4574128Shx147065 	uint32_t	flags;	/* same as wpi_cmd_data */
4584128Shx147065 	uint8_t		rate;
4594128Shx147065 	uint8_t		id;
4604128Shx147065 	uint8_t		reserved2[30];
4614128Shx147065 	uint32_t	lifetime;
4624128Shx147065 	uint8_t		ofdm_mask;
4634128Shx147065 	uint8_t		cck_mask;
4644128Shx147065 	uint16_t	reserved3[3];
4654128Shx147065 	uint16_t	tim;
4664128Shx147065 	uint8_t		timsz;
4674128Shx147065 	uint8_t		reserved4;
4684128Shx147065 	struct		ieee80211_frame wh;
4694128Shx147065 } wpi_cmd_beacon_t;
4704128Shx147065 
4714128Shx147065 /*
4724128Shx147065  * structure for WPI_CMD_MRR_SETUP
4734128Shx147065  */
4744128Shx147065 typedef struct wpi_mrr_setup {
4754128Shx147065 	uint32_t	which;
4764128Shx147065 #define	WPI_MRR_CTL	0
4774128Shx147065 #define	WPI_MRR_DATA	1
4784128Shx147065 
4794128Shx147065 	struct {
4804128Shx147065 		uint8_t	signal;
4814128Shx147065 		uint8_t	flags;
4824128Shx147065 		uint8_t	ntries;
4834128Shx147065 		uint8_t	next;
4844128Shx147065 #define	WPI_OFDM6	0
4854128Shx147065 #define	WPI_OFDM54	7
4864128Shx147065 #define	WPI_CCK1	8
4874128Shx147065 #define	WPI_CCK11	11
4884128Shx147065 
4894128Shx147065 	} rates[WPI_CCK11 + 1];
4904128Shx147065 } wpi_mrr_setup_t;
4914128Shx147065 
4924128Shx147065 /*
4934128Shx147065  * structure for WPI_CMD_SET_LED
4944128Shx147065  */
4954128Shx147065 typedef struct wpi_cmd_led {
4964128Shx147065 	uint32_t	unit;	/* multiplier (in usecs) */
4974128Shx147065 	uint8_t		which;
4984128Shx147065 #define	WPI_LED_ACTIVITY	1
4994128Shx147065 #define	WPI_LED_LINK		2
5004128Shx147065 
5014128Shx147065 	uint8_t		off;
5024128Shx147065 	uint8_t		on;
5034128Shx147065 	uint8_t		reserved;
5044128Shx147065 } wpi_cmd_led_t;
5054128Shx147065 
5064128Shx147065 /*
5074128Shx147065  * structure for WPI_CMD_SET_POWER_MODE
5084128Shx147065  */
5094128Shx147065 typedef struct wpi_power {
5104128Shx147065 	uint32_t	flags;
5114128Shx147065 	uint32_t	rx_timeout;
5124128Shx147065 	uint32_t	tx_timeout;
5134128Shx147065 	uint32_t	sleep[5];
5144128Shx147065 } wpi_power_t;
5154128Shx147065 
5164128Shx147065 /*
5174128Shx147065  * structure for command WPI_CMD_SCAN
5184128Shx147065  */
5194128Shx147065 typedef struct wpi_scan_hdr {
5204128Shx147065 	uint8_t		len;
5214128Shx147065 	uint8_t		first;
5224128Shx147065 	uint8_t		reserved1;
5234128Shx147065 	uint8_t		nchan;
5244128Shx147065 	uint16_t	quiet;
5254128Shx147065 	uint16_t	threshold;
5264128Shx147065 	uint32_t	reserved2[3];
5274128Shx147065 	uint32_t	filter;
5284128Shx147065 	uint32_t	reserved3;
5294128Shx147065 	uint16_t	pbrlen;
5304128Shx147065 	uint16_t	reserved4;
5314128Shx147065 	uint32_t	magic1;
5324128Shx147065 	uint8_t		rate;
5334128Shx147065 	uint8_t		id;
5344128Shx147065 	uint16_t	reserved5;
5354128Shx147065 	uint32_t	reserved6[7];
5364128Shx147065 	uint32_t	mask;
5374128Shx147065 	uint32_t	reserved7[2];
5384128Shx147065 	uint8_t		reserved8;
5394128Shx147065 	uint8_t		esslen;
5404128Shx147065 	uint8_t		essid[134];
5414128Shx147065 
5424128Shx147065 	/* followed by probe request body */
5434128Shx147065 	/* followed by nchan x wpi_scan_chan */
5444128Shx147065 } wpi_scan_hdr_t;
5454128Shx147065 
5464128Shx147065 typedef struct wpi_scan_chan {
5474128Shx147065 	uint8_t		flags;
5484128Shx147065 	uint8_t		chan;
5494128Shx147065 	uint16_t	magic;		/* XXX */
5504128Shx147065 	uint16_t	active;		/* dwell time */
5514128Shx147065 	uint16_t	passive;	/* dwell time */
5524128Shx147065 } wpi_scan_chan_t;
5534128Shx147065 
5544128Shx147065 /*
5554128Shx147065  * structure for WPI_CMD_BLUETOOTH
5564128Shx147065  */
5574128Shx147065 typedef struct wpi_bluetooth {
5584128Shx147065 	uint8_t		flags;
5594128Shx147065 	uint8_t		lead;
5604128Shx147065 	uint8_t		kill;
5614128Shx147065 	uint8_t		reserved;
5624128Shx147065 	uint32_t	ack;
5634128Shx147065 	uint32_t	cts;
5644128Shx147065 } wpi_bluetooth_t;
5654128Shx147065 
5664128Shx147065 /*
5674128Shx147065  * structure for command WPI_CMD_TXPOWER
5684128Shx147065  */
5694128Shx147065 typedef struct wpi_txpower {
5704128Shx147065 	uint32_t	reserved1;
5714128Shx147065 	uint16_t	pwr1[14];
5724128Shx147065 	uint32_t	reserved2[2];
5734128Shx147065 	uint16_t	pwr2[14];
5744128Shx147065 	uint32_t	reserved3[2];
5754128Shx147065 } wpi_txpower_t;
5764128Shx147065 
5774128Shx147065 
5784128Shx147065 /*
5794128Shx147065  * firmware image header
5804128Shx147065  */
5814128Shx147065 typedef struct wpi_firmware_hdr {
5824128Shx147065 	uint32_t	version;
5834128Shx147065 	uint32_t	textsz;
5844128Shx147065 	uint32_t	datasz;
5854128Shx147065 	uint32_t	bootsz;
5864128Shx147065 } wpi_firmware_hdr_t;
5874128Shx147065 
5884128Shx147065 /*
5894128Shx147065  * structure for WPI_UC_READY notification
5904128Shx147065  */
5914128Shx147065 typedef struct wpi_ucode_info {
5924128Shx147065 	uint32_t	version;
5934128Shx147065 	uint8_t		revision[8];
5944128Shx147065 	uint8_t		type;
5954128Shx147065 	uint8_t		subtype;
5964128Shx147065 	uint16_t	reserved;
5974128Shx147065 	uint32_t	logptr;
5984128Shx147065 	uint32_t	errorptr;
5994128Shx147065 	uint32_t	timestamp;
6004128Shx147065 	uint32_t	valid;
6014128Shx147065 } wpi_ucode_info_t;
6024128Shx147065 
6034128Shx147065 /*
6044128Shx147065  * structure for WPI_START_SCAN notification
6054128Shx147065  */
6064128Shx147065 typedef struct wpi_start_scan {
6074128Shx147065 	uint64_t	tstamp;
6084128Shx147065 	uint32_t	tbeacon;
6094128Shx147065 	uint8_t		chan;
6104128Shx147065 	uint8_t		band;
6114128Shx147065 	uint16_t	reserved;
6124128Shx147065 	uint32_t	status;
6134128Shx147065 } wpi_start_scan_t;
6144128Shx147065 
615*7865SPengcheng.Chen@Sun.COM /*
616*7865SPengcheng.Chen@Sun.COM  * structure for WPI_STOP_SCAN notification
617*7865SPengcheng.Chen@Sun.COM  */
618*7865SPengcheng.Chen@Sun.COM typedef struct wpi_stop_scan {
619*7865SPengcheng.Chen@Sun.COM 	uint8_t		nchan;
620*7865SPengcheng.Chen@Sun.COM 	uint8_t		status;
621*7865SPengcheng.Chen@Sun.COM 	uint8_t		reserved;
622*7865SPengcheng.Chen@Sun.COM 	uint8_t		chan;
623*7865SPengcheng.Chen@Sun.COM 	uint64_t	tsf;
624*7865SPengcheng.Chen@Sun.COM } wpi_stop_scan_t;
6254128Shx147065 
6264128Shx147065 #define	WPI_EEPROM_MAC		0x015
6274128Shx147065 #define	WPI_EEPROM_REVISION	0x035
6284128Shx147065 #define	WPI_EEPROM_CAPABILITIES	0x045
6294128Shx147065 #define	WPI_EEPROM_TYPE		0x04a
6304128Shx147065 #define	WPI_EEPROM_PWR1		0x1ae
6314128Shx147065 #define	WPI_EEPROM_PWR2		0x1bc
6324128Shx147065 
6334128Shx147065 #define	WPI_READ(sc, reg)						\
6344128Shx147065 	ddi_get32((sc)->sc_handle, (uint32_t *)((sc)->sc_base + (reg)))
6354128Shx147065 
6364128Shx147065 #define	WPI_WRITE(sc, reg, val)						\
6374128Shx147065 	ddi_put32((sc)->sc_handle, (uint32_t *)((sc)->sc_base + (reg)), (val))
6384128Shx147065 
6394128Shx147065 #define	WPI_WRITE_REGION_4(sc, offset, datap, count) {			\
6404128Shx147065 	uint32_t *p = (datap);						\
6414128Shx147065 	uint32_t s = (offset);						\
6424128Shx147065 	uint32_t c = (count);						\
6434128Shx147065 	while (--c > 0) {						\
6444128Shx147065 		ddi_put32((sc)->sc_handle,				\
6454128Shx147065 		    (uint32_t *)((sc)->sc_base + s), *p);		\
6464128Shx147065 		p++;							\
6474128Shx147065 		s += 4;							\
6484128Shx147065 	}								\
6494128Shx147065 }
6504128Shx147065 
6514128Shx147065 #ifdef __cplusplus
6524128Shx147065 }
6534128Shx147065 #endif
6544128Shx147065 
6554128Shx147065 #endif /* _WPIREG_H_ */
656