Home | History | Annotate | Line # | Download | only in pci
if_ipwreg.h revision 1.1.1.2
      1  1.1.1.2  skrll /*      $FreeBSD: src/sys/dev/ipw/if_ipwreg.h,v 1.1 2005/04/18 18:47:36 damien Exp $	*/
      2      1.1  lukem 
      3      1.1  lukem /*-
      4  1.1.1.2  skrll  * Copyright (c) 2004, 2005
      5      1.1  lukem  *      Damien Bergamini <damien.bergamini (at) free.fr>. All rights reserved.
      6      1.1  lukem  *
      7      1.1  lukem  * Redistribution and use in source and binary forms, with or without
      8      1.1  lukem  * modification, are permitted provided that the following conditions
      9      1.1  lukem  * are met:
     10      1.1  lukem  * 1. Redistributions of source code must retain the above copyright
     11      1.1  lukem  *    notice unmodified, this list of conditions, and the following
     12      1.1  lukem  *    disclaimer.
     13      1.1  lukem  * 2. Redistributions in binary form must reproduce the above copyright
     14      1.1  lukem  *    notice, this list of conditions and the following disclaimer in the
     15      1.1  lukem  *    documentation and/or other materials provided with the distribution.
     16      1.1  lukem  *
     17      1.1  lukem  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     18      1.1  lukem  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     19      1.1  lukem  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     20      1.1  lukem  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     21      1.1  lukem  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     22      1.1  lukem  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     23      1.1  lukem  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     24      1.1  lukem  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     25      1.1  lukem  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     26      1.1  lukem  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     27      1.1  lukem  * SUCH DAMAGE.
     28      1.1  lukem  */
     29      1.1  lukem 
     30  1.1.1.2  skrll #define IPW_NTBD	128
     31      1.1  lukem #define IPW_TBD_SZ	(IPW_NTBD * sizeof (struct ipw_bd))
     32      1.1  lukem #define IPW_NDATA	(IPW_NTBD / 2)
     33  1.1.1.2  skrll #define IPW_NRBD	128
     34      1.1  lukem #define IPW_RBD_SZ	(IPW_NRBD * sizeof (struct ipw_bd))
     35      1.1  lukem #define IPW_STATUS_SZ	(IPW_NRBD * sizeof (struct ipw_status))
     36      1.1  lukem 
     37      1.1  lukem #define IPW_CSR_INTR		0x0008
     38      1.1  lukem #define IPW_CSR_INTR_MASK	0x000c
     39      1.1  lukem #define IPW_CSR_INDIRECT_ADDR	0x0010
     40      1.1  lukem #define IPW_CSR_INDIRECT_DATA	0x0014
     41      1.1  lukem #define IPW_CSR_AUTOINC_ADDR	0x0018
     42      1.1  lukem #define IPW_CSR_AUTOINC_DATA	0x001c
     43      1.1  lukem #define IPW_CSR_RST		0x0020
     44      1.1  lukem #define IPW_CSR_CTL		0x0024
     45      1.1  lukem #define IPW_CSR_IO		0x0030
     46  1.1.1.2  skrll #define IPW_CSR_TX_BASE		0x0200
     47  1.1.1.2  skrll #define IPW_CSR_TX_SIZE		0x0204
     48  1.1.1.2  skrll #define IPW_CSR_RX_BASE		0x0240
     49  1.1.1.2  skrll #define IPW_CSR_STATUS_BASE	0x0244
     50  1.1.1.2  skrll #define IPW_CSR_RX_SIZE		0x0248
     51  1.1.1.2  skrll #define IPW_CSR_TX_READ		0x0280
     52  1.1.1.2  skrll #define IPW_CSR_RX_READ		0x02a0
     53      1.1  lukem #define IPW_CSR_TABLE1_BASE	0x0380
     54      1.1  lukem #define IPW_CSR_TABLE2_BASE	0x0384
     55  1.1.1.2  skrll #define IPW_CSR_TX_WRITE	0x0f80
     56  1.1.1.2  skrll #define IPW_CSR_RX_WRITE	0x0fa0
     57      1.1  lukem 
     58  1.1.1.2  skrll /* possible flags for register IPW_CSR_INTR */
     59      1.1  lukem #define IPW_INTR_TX_TRANSFER	0x00000001
     60      1.1  lukem #define IPW_INTR_RX_TRANSFER	0x00000002
     61      1.1  lukem #define IPW_INTR_STATUS_CHANGE	0x00000010
     62      1.1  lukem #define IPW_INTR_COMMAND_DONE	0x00010000
     63      1.1  lukem #define IPW_INTR_FW_INIT_DONE	0x01000000
     64      1.1  lukem #define IPW_INTR_FATAL_ERROR	0x40000000
     65      1.1  lukem #define IPW_INTR_PARITY_ERROR	0x80000000
     66      1.1  lukem 
     67      1.1  lukem #define IPW_INTR_MASK							\
     68      1.1  lukem 	(IPW_INTR_TX_TRANSFER | IPW_INTR_RX_TRANSFER |			\
     69      1.1  lukem 	 IPW_INTR_STATUS_CHANGE | IPW_INTR_COMMAND_DONE |		\
     70      1.1  lukem 	 IPW_INTR_FW_INIT_DONE | IPW_INTR_FATAL_ERROR |			\
     71      1.1  lukem 	 IPW_INTR_PARITY_ERROR)
     72      1.1  lukem 
     73      1.1  lukem /* possible flags for register IPW_CSR_RST */
     74      1.1  lukem #define IPW_RST_PRINCETON_RESET	0x00000001
     75      1.1  lukem #define IPW_RST_SW_RESET	0x00000080
     76      1.1  lukem #define IPW_RST_MASTER_DISABLED	0x00000100
     77      1.1  lukem #define IPW_RST_STOP_MASTER	0x00000200
     78      1.1  lukem 
     79      1.1  lukem /* possible flags for register IPW_CSR_CTL */
     80      1.1  lukem #define IPW_CTL_CLOCK_READY	0x00000001
     81      1.1  lukem #define IPW_CTL_ALLOW_STANDBY	0x00000002
     82  1.1.1.2  skrll #define IPW_CTL_INIT		0x00000004
     83      1.1  lukem 
     84      1.1  lukem /* possible flags for register IPW_CSR_IO */
     85      1.1  lukem #define IPW_IO_GPIO1_ENABLE	0x00000008
     86      1.1  lukem #define IPW_IO_GPIO1_MASK	0x0000000c
     87      1.1  lukem #define IPW_IO_GPIO3_MASK	0x000000c0
     88      1.1  lukem #define IPW_IO_LED_OFF		0x00002000
     89      1.1  lukem #define IPW_IO_RADIO_DISABLED	0x00010000
     90      1.1  lukem 
     91      1.1  lukem #define IPW_STATE_ASSOCIATED		0x0004
     92      1.1  lukem #define IPW_STATE_ASSOCIATION_LOST	0x0008
     93      1.1  lukem #define IPW_STATE_SCAN_COMPLETE		0x0020
     94      1.1  lukem #define IPW_STATE_RADIO_DISABLED	0x0100
     95      1.1  lukem #define IPW_STATE_DISABLED		0x0200
     96      1.1  lukem #define IPW_STATE_SCANNING		0x0800
     97      1.1  lukem 
     98      1.1  lukem /* table1 offsets */
     99      1.1  lukem #define IPW_INFO_LOCK			480
    100  1.1.1.2  skrll #define IPW_INFO_APS_CNT		604
    101  1.1.1.2  skrll #define IPW_INFO_APS_BASE		608
    102      1.1  lukem #define IPW_INFO_CARD_DISABLED		628
    103      1.1  lukem #define IPW_INFO_CURRENT_CHANNEL	756
    104      1.1  lukem #define IPW_INFO_CURRENT_TX_RATE	768
    105      1.1  lukem 
    106      1.1  lukem /* table2 offsets */
    107      1.1  lukem #define IPW_INFO_CURRENT_SSID	48
    108      1.1  lukem #define IPW_INFO_CURRENT_BSSID	112
    109      1.1  lukem 
    110  1.1.1.2  skrll /* supported rates */
    111  1.1.1.2  skrll #define IPW_RATE_DS1	1
    112  1.1.1.2  skrll #define IPW_RATE_DS2	2
    113  1.1.1.2  skrll #define IPW_RATE_DS5	4
    114  1.1.1.2  skrll #define IPW_RATE_DS11	8
    115  1.1.1.2  skrll 
    116      1.1  lukem /* firmware binary image header */
    117  1.1.1.2  skrll struct ipw_firmware_hdr {
    118      1.1  lukem 	u_int32_t	version;
    119  1.1.1.2  skrll 	u_int32_t	main_size;	/* firmware size */
    120  1.1.1.2  skrll 	u_int32_t	ucode_size;	/* microcode size */
    121  1.1.1.2  skrll } __packed;
    122      1.1  lukem 
    123      1.1  lukem /* buffer descriptor */
    124      1.1  lukem struct ipw_bd {
    125      1.1  lukem 	u_int32_t	physaddr;
    126      1.1  lukem 	u_int32_t	len;
    127      1.1  lukem 	u_int8_t	flags;
    128      1.1  lukem #define IPW_BD_FLAG_TX_FRAME_802_3		0x00
    129      1.1  lukem #define IPW_BD_FLAG_TX_NOT_LAST_FRAGMENT	0x01
    130      1.1  lukem #define IPW_BD_FLAG_TX_FRAME_COMMAND		0x02
    131      1.1  lukem #define IPW_BD_FLAG_TX_FRAME_802_11		0x04
    132      1.1  lukem #define IPW_BD_FLAG_TX_LAST_FRAGMENT		0x08
    133      1.1  lukem 	u_int8_t	nfrag;	/* number of fragments */
    134      1.1  lukem 	u_int8_t	reserved[6];
    135  1.1.1.2  skrll } __packed;
    136      1.1  lukem 
    137      1.1  lukem /* status */
    138      1.1  lukem struct ipw_status {
    139      1.1  lukem 	u_int32_t	len;
    140      1.1  lukem 	u_int16_t	code;
    141      1.1  lukem #define IPW_STATUS_CODE_COMMAND		0
    142      1.1  lukem #define IPW_STATUS_CODE_NEWSTATE	1
    143      1.1  lukem #define IPW_STATUS_CODE_DATA_802_11	2
    144      1.1  lukem #define IPW_STATUS_CODE_DATA_802_3	3
    145      1.1  lukem #define IPW_STATUS_CODE_NOTIFICATION	4
    146      1.1  lukem 	u_int8_t	flags;
    147      1.1  lukem #define IPW_STATUS_FLAG_DECRYPTED	0x01
    148      1.1  lukem #define IPW_STATUS_FLAG_WEP_ENCRYPTED	0x02
    149      1.1  lukem 	u_int8_t	rssi;	/* received signal strength indicator */
    150  1.1.1.2  skrll } __packed;
    151      1.1  lukem 
    152      1.1  lukem /* data header */
    153      1.1  lukem struct ipw_hdr {
    154      1.1  lukem 	u_int32_t	type;
    155      1.1  lukem #define IPW_HDR_TYPE_SEND	33
    156      1.1  lukem 	u_int32_t	subtype;
    157      1.1  lukem 	u_int8_t	encrypted;
    158      1.1  lukem 	u_int8_t	encrypt;
    159      1.1  lukem 	u_int8_t	keyidx;
    160      1.1  lukem 	u_int8_t	keysz;
    161      1.1  lukem 	u_int8_t	key[IEEE80211_KEYBUF_SIZE];
    162      1.1  lukem 	u_int8_t	reserved[10];
    163      1.1  lukem 	u_int8_t	src_addr[IEEE80211_ADDR_LEN];
    164      1.1  lukem 	u_int8_t	dst_addr[IEEE80211_ADDR_LEN];
    165      1.1  lukem 	u_int16_t	fragmentsz;
    166  1.1.1.2  skrll } __packed;
    167      1.1  lukem 
    168      1.1  lukem /* command */
    169      1.1  lukem struct ipw_cmd {
    170      1.1  lukem 	u_int32_t	type;
    171  1.1.1.2  skrll #define IPW_CMD_ENABLE				2
    172      1.1  lukem #define IPW_CMD_SET_CONFIGURATION		6
    173      1.1  lukem #define IPW_CMD_SET_ESSID			8
    174      1.1  lukem #define IPW_CMD_SET_MANDATORY_BSSID		9
    175      1.1  lukem #define IPW_CMD_SET_MAC_ADDRESS			11
    176      1.1  lukem #define IPW_CMD_SET_MODE			12
    177      1.1  lukem #define IPW_CMD_SET_CHANNEL			14
    178      1.1  lukem #define IPW_CMD_SET_RTS_THRESHOLD		15
    179      1.1  lukem #define IPW_CMD_SET_FRAG_THRESHOLD		16
    180      1.1  lukem #define IPW_CMD_SET_POWER_MODE			17
    181      1.1  lukem #define IPW_CMD_SET_TX_RATES			18
    182      1.1  lukem #define IPW_CMD_SET_BASIC_TX_RATES		19
    183      1.1  lukem #define IPW_CMD_SET_WEP_KEY			20
    184      1.1  lukem #define IPW_CMD_SET_WEP_KEY_INDEX		25
    185      1.1  lukem #define IPW_CMD_SET_WEP_FLAGS			26
    186      1.1  lukem #define IPW_CMD_ADD_MULTICAST			27
    187      1.1  lukem #define IPW_CMD_SET_BEACON_INTERVAL		29
    188      1.1  lukem #define IPW_CMD_SET_TX_POWER_INDEX		36
    189      1.1  lukem #define IPW_CMD_BROADCAST_SCAN			43
    190      1.1  lukem #define IPW_CMD_DISABLE				44
    191      1.1  lukem #define IPW_CMD_SET_DESIRED_BSSID		45
    192      1.1  lukem #define IPW_CMD_SET_SCAN_OPTIONS		46
    193      1.1  lukem #define IPW_CMD_PREPARE_POWER_DOWN		58
    194      1.1  lukem #define IPW_CMD_DISABLE_PHY			61
    195      1.1  lukem #define IPW_CMD_SET_SECURITY_INFORMATION	67
    196  1.1.1.2  skrll #define IPW_CMD_SET_WPA_IE			69
    197      1.1  lukem 	u_int32_t	subtype;
    198      1.1  lukem 	u_int32_t	seq;
    199      1.1  lukem 	u_int32_t	len;
    200      1.1  lukem 	u_int8_t	data[400];
    201      1.1  lukem 	u_int32_t	status;
    202      1.1  lukem 	u_int8_t	reserved[68];
    203  1.1.1.2  skrll } __packed;
    204      1.1  lukem 
    205      1.1  lukem /* possible values for command IPW_CMD_SET_POWER_MODE */
    206      1.1  lukem #define IPW_POWER_MODE_CAM	0
    207      1.1  lukem #define IPW_POWER_AUTOMATIC	6
    208      1.1  lukem 
    209      1.1  lukem /* possible values for command IPW_CMD_SET_MODE */
    210      1.1  lukem #define IPW_MODE_BSS		0
    211      1.1  lukem #define IPW_MODE_IBSS		1
    212      1.1  lukem #define IPW_MODE_MONITOR	2
    213      1.1  lukem 
    214  1.1.1.2  skrll /* possible flags for command IPW_CMD_SET_WEP_FLAGS */
    215  1.1.1.2  skrll #define IPW_WEPON	0x8
    216  1.1.1.2  skrll 
    217      1.1  lukem /* structure for command IPW_CMD_SET_WEP_KEY */
    218      1.1  lukem struct ipw_wep_key {
    219      1.1  lukem 	u_int8_t	idx;
    220      1.1  lukem 	u_int8_t	len;
    221      1.1  lukem 	u_int8_t	key[13];
    222  1.1.1.2  skrll } __packed;
    223      1.1  lukem 
    224      1.1  lukem /* structure for command IPW_CMD_SET_SECURITY_INFORMATION */
    225      1.1  lukem struct ipw_security {
    226      1.1  lukem 	u_int32_t	ciphers;
    227      1.1  lukem #define IPW_CIPHER_NONE		0x00000001
    228      1.1  lukem #define IPW_CIPHER_WEP40	0x00000002
    229  1.1.1.2  skrll #define IPW_CIPHER_TKIP		0x00000004
    230  1.1.1.2  skrll #define IPW_CIPHER_CCMP		0x00000010
    231      1.1  lukem #define IPW_CIPHER_WEP104	0x00000020
    232  1.1.1.2  skrll #define IPW_CIPHER_CKIP		0x00000040
    233  1.1.1.2  skrll 	u_int16_t	reserved1;
    234      1.1  lukem 	u_int8_t	authmode;
    235      1.1  lukem #define IPW_AUTH_OPEN	0
    236      1.1  lukem #define IPW_AUTH_SHARED	1
    237  1.1.1.2  skrll 	u_int16_t	reserved2;
    238  1.1.1.2  skrll } __packed;
    239      1.1  lukem 
    240      1.1  lukem /* structure for command IPW_CMD_SET_SCAN_OPTIONS */
    241      1.1  lukem struct ipw_scan_options {
    242      1.1  lukem 	u_int32_t	flags;
    243      1.1  lukem #define IPW_SCAN_DO_NOT_ASSOCIATE	0x00000001
    244      1.1  lukem #define IPW_SCAN_PASSIVE		0x00000008
    245      1.1  lukem 	u_int32_t	channels;
    246  1.1.1.2  skrll } __packed;
    247      1.1  lukem 
    248      1.1  lukem /* structure for command IPW_CMD_SET_CONFIGURATION */
    249      1.1  lukem struct ipw_configuration {
    250      1.1  lukem 	u_int32_t	flags;
    251      1.1  lukem #define IPW_CFG_PROMISCUOUS	0x00000004
    252  1.1.1.2  skrll #define IPW_CFG_PREAMBLE_AUTO	0x00000010
    253      1.1  lukem #define IPW_CFG_IBSS_AUTO_START	0x00000020
    254      1.1  lukem #define IPW_CFG_802_1x_ENABLE	0x00004000
    255      1.1  lukem #define IPW_CFG_BSS_MASK	0x00008000
    256      1.1  lukem #define IPW_CFG_IBSS_MASK	0x00010000
    257  1.1.1.2  skrll 	u_int32_t	bss_chan;
    258      1.1  lukem 	u_int32_t	ibss_chan;
    259  1.1.1.2  skrll } __packed;
    260  1.1.1.2  skrll 
    261  1.1.1.2  skrll /* structure for command IPW_CMD_SET_WPA_IE */
    262  1.1.1.2  skrll struct ipw_wpa_ie {
    263  1.1.1.2  skrll 	u_int16_t	mask;
    264  1.1.1.2  skrll 	u_int16_t	capinfo;
    265  1.1.1.2  skrll 	u_int16_t	lintval;
    266  1.1.1.2  skrll 	u_int8_t	bssid[IEEE80211_ADDR_LEN];
    267  1.1.1.2  skrll 	u_int32_t	len;
    268  1.1.1.2  skrll 	struct ieee80211_ie_wpa	ie;
    269  1.1.1.2  skrll } __packed;
    270  1.1.1.2  skrll 
    271  1.1.1.2  skrll /* element in AP table */
    272  1.1.1.2  skrll struct ipw_node {
    273  1.1.1.2  skrll 	u_int32_t	reserved1[2];
    274  1.1.1.2  skrll 	u_int8_t	bssid[IEEE80211_ADDR_LEN];
    275  1.1.1.2  skrll 	u_int8_t	chan;
    276  1.1.1.2  skrll 	u_int8_t	rates;
    277  1.1.1.2  skrll 	u_int16_t	reserved2;
    278  1.1.1.2  skrll 	u_int16_t	capinfo;
    279  1.1.1.2  skrll 	u_int16_t	reserved3;
    280  1.1.1.2  skrll 	u_int16_t	intval;
    281  1.1.1.2  skrll 	u_int8_t	reserved4[28];
    282  1.1.1.2  skrll 	u_int8_t	essid[IEEE80211_NWID_LEN];
    283  1.1.1.2  skrll 	u_int16_t	reserved5;
    284  1.1.1.2  skrll 	u_int8_t	esslen;
    285  1.1.1.2  skrll 	u_int8_t	reserved6[7];
    286  1.1.1.2  skrll 	u_int8_t	rssi;
    287  1.1.1.2  skrll } __packed;
    288  1.1.1.2  skrll 
    289  1.1.1.2  skrll /* EEPROM = Electrically Erasable Programmable Read-Only Memory */
    290  1.1.1.2  skrll 
    291  1.1.1.2  skrll #define IPW_MEM_EEPROM_CTL	0x00300040
    292  1.1.1.2  skrll 
    293  1.1.1.2  skrll #define IPW_EEPROM_RADIO	0x11
    294  1.1.1.2  skrll #define IPW_EEPROM_MAC		0x21
    295  1.1.1.2  skrll #define IPW_EEPROM_CHANNEL_LIST	0x37
    296  1.1.1.2  skrll 
    297  1.1.1.2  skrll #define IPW_EEPROM_DELAY	1	/* minimum hold time (microsecond) */
    298  1.1.1.2  skrll 
    299  1.1.1.2  skrll #define IPW_EEPROM_C	(1 << 0)	/* Serial Clock */
    300  1.1.1.2  skrll #define IPW_EEPROM_S	(1 << 1)	/* Chip Select */
    301  1.1.1.2  skrll #define IPW_EEPROM_D	(1 << 2)	/* Serial data input */
    302  1.1.1.2  skrll #define IPW_EEPROM_Q	(1 << 4)	/* Serial data output */
    303  1.1.1.2  skrll 
    304  1.1.1.2  skrll #define IPW_EEPROM_SHIFT_D	2
    305  1.1.1.2  skrll #define IPW_EEPROM_SHIFT_Q	4
    306      1.1  lukem 
    307      1.1  lukem /*
    308      1.1  lukem  * control and status registers access macros
    309      1.1  lukem  */
    310      1.1  lukem #define CSR_READ_1(sc, reg)						\
    311  1.1.1.2  skrll 	bus_space_read_1((sc)->sc_st, (sc)->sc_sh, (reg))
    312      1.1  lukem 
    313      1.1  lukem #define CSR_READ_2(sc, reg)						\
    314  1.1.1.2  skrll 	bus_space_read_2((sc)->sc_st, (sc)->sc_sh, (reg))
    315      1.1  lukem 
    316      1.1  lukem #define CSR_READ_4(sc, reg)						\
    317  1.1.1.2  skrll 	bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg))
    318      1.1  lukem 
    319      1.1  lukem #define CSR_WRITE_1(sc, reg, val)					\
    320  1.1.1.2  skrll 	bus_space_write_1((sc)->sc_st, (sc)->sc_sh, (reg), (val))
    321      1.1  lukem 
    322      1.1  lukem #define CSR_WRITE_2(sc, reg, val)					\
    323  1.1.1.2  skrll 	bus_space_write_2((sc)->sc_st, (sc)->sc_sh, (reg), (val))
    324      1.1  lukem 
    325      1.1  lukem #define CSR_WRITE_4(sc, reg, val)					\
    326  1.1.1.2  skrll 	bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val))
    327      1.1  lukem 
    328      1.1  lukem #define CSR_WRITE_MULTI_1(sc, reg, buf, len)				\
    329      1.1  lukem 	bus_space_write_multi_1((sc)->sc_st, (sc)->sc_sh, (reg), 	\
    330  1.1.1.2  skrll 	    (buf), (len))
    331      1.1  lukem 
    332      1.1  lukem /*
    333      1.1  lukem  * indirect memory space access macros
    334      1.1  lukem  */
    335      1.1  lukem #define MEM_WRITE_1(sc, addr, val) do {					\
    336      1.1  lukem 	CSR_WRITE_4((sc), IPW_CSR_INDIRECT_ADDR, (addr));		\
    337      1.1  lukem 	CSR_WRITE_1((sc), IPW_CSR_INDIRECT_DATA, (val));		\
    338      1.1  lukem } while (/* CONSTCOND */0)
    339      1.1  lukem 
    340      1.1  lukem #define MEM_WRITE_2(sc, addr, val) do {					\
    341      1.1  lukem 	CSR_WRITE_4((sc), IPW_CSR_INDIRECT_ADDR, (addr));		\
    342      1.1  lukem 	CSR_WRITE_2((sc), IPW_CSR_INDIRECT_DATA, (val));		\
    343      1.1  lukem } while (/* CONSTCOND */0)
    344      1.1  lukem 
    345      1.1  lukem #define MEM_WRITE_4(sc, addr, val) do {					\
    346      1.1  lukem 	CSR_WRITE_4((sc), IPW_CSR_INDIRECT_ADDR, (addr));		\
    347      1.1  lukem 	CSR_WRITE_4((sc), IPW_CSR_INDIRECT_DATA, (val));		\
    348      1.1  lukem } while (/* CONSTCOND */0)
    349      1.1  lukem 
    350      1.1  lukem #define MEM_WRITE_MULTI_1(sc, addr, buf, len) do {			\
    351      1.1  lukem 	CSR_WRITE_4((sc), IPW_CSR_INDIRECT_ADDR, (addr));		\
    352      1.1  lukem 	CSR_WRITE_MULTI_1((sc), IPW_CSR_INDIRECT_DATA, (buf), (len));	\
    353      1.1  lukem } while (/* CONSTCOND */0)
    354  1.1.1.2  skrll 
    355  1.1.1.2  skrll /*
    356  1.1.1.2  skrll  * EEPROM access macro
    357  1.1.1.2  skrll  */
    358  1.1.1.2  skrll #define IPW_EEPROM_CTL(sc, val) do {					\
    359  1.1.1.2  skrll 	MEM_WRITE_4((sc), IPW_MEM_EEPROM_CTL, (val));			\
    360  1.1.1.2  skrll 	DELAY(IPW_EEPROM_DELAY);					\
    361  1.1.1.2  skrll } while (0)
    362