aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlegacy/iwl3945-base.c
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2011-10-24 09:41:30 -0400
committerStanislaw Gruszka <sgruszka@redhat.com>2011-11-15 05:16:58 -0500
commite2ebc8337d116acdc25469ec8547ae665f50a4c1 (patch)
treecf4401fdbf6dabbd2731d90e3105c1ebbf60f87d /drivers/net/wireless/iwlegacy/iwl3945-base.c
parentfee005e5dd82a43546c1b1beb187e82415360940 (diff)
iwlegacy: rename iwl to il
iwl_legacy prefix result in long function names, what cause that we have frequent line split and not readable code. Also iwl_foo symbols are duplicated in iwlwifi driver, what is annoying when editing kernel tree with cscope. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Diffstat (limited to 'drivers/net/wireless/iwlegacy/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlegacy/iwl3945-base.c1664
1 files changed, 832 insertions, 832 deletions
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index 7507819a25ad..d24937a0014a 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -89,7 +89,7 @@ MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
89MODULE_LICENSE("GPL"); 89MODULE_LICENSE("GPL");
90 90
91 /* module parameters */ 91 /* module parameters */
92struct iwl_mod_params iwl3945_mod_params = { 92struct il_mod_params il3945_mod_params = {
93 .sw_crypto = 1, 93 .sw_crypto = 1,
94 .restart_fw = 1, 94 .restart_fw = 1,
95 .disable_hw_scan = 1, 95 .disable_hw_scan = 1,
@@ -97,43 +97,43 @@ struct iwl_mod_params iwl3945_mod_params = {
97}; 97};
98 98
99/** 99/**
100 * iwl3945_get_antenna_flags - Get antenna flags for RXON command 100 * il3945_get_antenna_flags - Get antenna flags for RXON command
101 * @priv: eeprom and antenna fields are used to determine antenna flags 101 * @priv: eeprom and antenna fields are used to determine antenna flags
102 * 102 *
103 * priv->eeprom39 is used to determine if antenna AUX/MAIN are reversed 103 * priv->eeprom39 is used to determine if antenna AUX/MAIN are reversed
104 * iwl3945_mod_params.antenna specifies the antenna diversity mode: 104 * il3945_mod_params.antenna specifies the antenna diversity mode:
105 * 105 *
106 * IWL_ANTENNA_DIVERSITY - NIC selects best antenna by itself 106 * IL_ANTENNA_DIVERSITY - NIC selects best antenna by itself
107 * IWL_ANTENNA_MAIN - Force MAIN antenna 107 * IL_ANTENNA_MAIN - Force MAIN antenna
108 * IWL_ANTENNA_AUX - Force AUX antenna 108 * IL_ANTENNA_AUX - Force AUX antenna
109 */ 109 */
110__le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv) 110__le32 il3945_get_antenna_flags(const struct il_priv *priv)
111{ 111{
112 struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; 112 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom;
113 113
114 switch (iwl3945_mod_params.antenna) { 114 switch (il3945_mod_params.antenna) {
115 case IWL_ANTENNA_DIVERSITY: 115 case IL_ANTENNA_DIVERSITY:
116 return 0; 116 return 0;
117 117
118 case IWL_ANTENNA_MAIN: 118 case IL_ANTENNA_MAIN:
119 if (eeprom->antenna_switch_type) 119 if (eeprom->antenna_switch_type)
120 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK; 120 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK;
121 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK; 121 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK;
122 122
123 case IWL_ANTENNA_AUX: 123 case IL_ANTENNA_AUX:
124 if (eeprom->antenna_switch_type) 124 if (eeprom->antenna_switch_type)
125 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK; 125 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK;
126 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK; 126 return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK;
127 } 127 }
128 128
129 /* bad antenna selector value */ 129 /* bad antenna selector value */
130 IWL_ERR(priv, "Bad antenna selector value (0x%x)\n", 130 IL_ERR(priv, "Bad antenna selector value (0x%x)\n",
131 iwl3945_mod_params.antenna); 131 il3945_mod_params.antenna);
132 132
133 return 0; /* "diversity" is default if error */ 133 return 0; /* "diversity" is default if error */
134} 134}
135 135
136static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv, 136static int il3945_set_ccmp_dynamic_key_info(struct il_priv *priv,
137 struct ieee80211_key_conf *keyconf, 137 struct ieee80211_key_conf *keyconf,
138 u8 sta_id) 138 u8 sta_id)
139{ 139{
@@ -144,7 +144,7 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
144 key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); 144 key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK);
145 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); 145 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
146 146
147 if (sta_id == priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id) 147 if (sta_id == priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id)
148 key_flags |= STA_KEY_MULTICAST_MSK; 148 key_flags |= STA_KEY_MULTICAST_MSK;
149 149
150 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 150 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
@@ -163,7 +163,7 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
163 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) 163 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
164 == STA_KEY_FLG_NO_ENC) 164 == STA_KEY_FLG_NO_ENC)
165 priv->stations[sta_id].sta.key.key_offset = 165 priv->stations[sta_id].sta.key.key_offset =
166 iwl_legacy_get_free_ucode_key_index(priv); 166 il_get_free_ucode_key_index(priv);
167 /* else, we are overriding an existing key => no need to allocated room 167 /* else, we are overriding an existing key => no need to allocated room
168 * in uCode. */ 168 * in uCode. */
169 169
@@ -174,9 +174,9 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
174 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 174 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
175 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 175 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
176 176
177 IWL_DEBUG_INFO(priv, "hwcrypto: modify ucode station key info\n"); 177 IL_DEBUG_INFO(priv, "hwcrypto: modify ucode station key info\n");
178 178
179 ret = iwl_legacy_send_add_sta(priv, 179 ret = il_send_add_sta(priv,
180 &priv->stations[sta_id].sta, CMD_ASYNC); 180 &priv->stations[sta_id].sta, CMD_ASYNC);
181 181
182 spin_unlock_irqrestore(&priv->sta_lock, flags); 182 spin_unlock_irqrestore(&priv->sta_lock, flags);
@@ -184,40 +184,40 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
184 return ret; 184 return ret;
185} 185}
186 186
187static int iwl3945_set_tkip_dynamic_key_info(struct iwl_priv *priv, 187static int il3945_set_tkip_dynamic_key_info(struct il_priv *priv,
188 struct ieee80211_key_conf *keyconf, 188 struct ieee80211_key_conf *keyconf,
189 u8 sta_id) 189 u8 sta_id)
190{ 190{
191 return -EOPNOTSUPP; 191 return -EOPNOTSUPP;
192} 192}
193 193
194static int iwl3945_set_wep_dynamic_key_info(struct iwl_priv *priv, 194static int il3945_set_wep_dynamic_key_info(struct il_priv *priv,
195 struct ieee80211_key_conf *keyconf, 195 struct ieee80211_key_conf *keyconf,
196 u8 sta_id) 196 u8 sta_id)
197{ 197{
198 return -EOPNOTSUPP; 198 return -EOPNOTSUPP;
199} 199}
200 200
201static int iwl3945_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id) 201static int il3945_clear_sta_key_info(struct il_priv *priv, u8 sta_id)
202{ 202{
203 unsigned long flags; 203 unsigned long flags;
204 struct iwl_legacy_addsta_cmd sta_cmd; 204 struct il_addsta_cmd sta_cmd;
205 205
206 spin_lock_irqsave(&priv->sta_lock, flags); 206 spin_lock_irqsave(&priv->sta_lock, flags);
207 memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl_hw_key)); 207 memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct il_hw_key));
208 memset(&priv->stations[sta_id].sta.key, 0, 208 memset(&priv->stations[sta_id].sta.key, 0,
209 sizeof(struct iwl4965_keyinfo)); 209 sizeof(struct il4965_keyinfo));
210 priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; 210 priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC;
211 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 211 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
212 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 212 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
213 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_legacy_addsta_cmd)); 213 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct il_addsta_cmd));
214 spin_unlock_irqrestore(&priv->sta_lock, flags); 214 spin_unlock_irqrestore(&priv->sta_lock, flags);
215 215
216 IWL_DEBUG_INFO(priv, "hwcrypto: clear ucode station key info\n"); 216 IL_DEBUG_INFO(priv, "hwcrypto: clear ucode station key info\n");
217 return iwl_legacy_send_add_sta(priv, &sta_cmd, CMD_SYNC); 217 return il_send_add_sta(priv, &sta_cmd, CMD_SYNC);
218} 218}
219 219
220static int iwl3945_set_dynamic_key(struct iwl_priv *priv, 220static int il3945_set_dynamic_key(struct il_priv *priv,
221 struct ieee80211_key_conf *keyconf, u8 sta_id) 221 struct ieee80211_key_conf *keyconf, u8 sta_id)
222{ 222{
223 int ret = 0; 223 int ret = 0;
@@ -226,75 +226,75 @@ static int iwl3945_set_dynamic_key(struct iwl_priv *priv,
226 226
227 switch (keyconf->cipher) { 227 switch (keyconf->cipher) {
228 case WLAN_CIPHER_SUITE_CCMP: 228 case WLAN_CIPHER_SUITE_CCMP:
229 ret = iwl3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); 229 ret = il3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id);
230 break; 230 break;
231 case WLAN_CIPHER_SUITE_TKIP: 231 case WLAN_CIPHER_SUITE_TKIP:
232 ret = iwl3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id); 232 ret = il3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id);
233 break; 233 break;
234 case WLAN_CIPHER_SUITE_WEP40: 234 case WLAN_CIPHER_SUITE_WEP40:
235 case WLAN_CIPHER_SUITE_WEP104: 235 case WLAN_CIPHER_SUITE_WEP104:
236 ret = iwl3945_set_wep_dynamic_key_info(priv, keyconf, sta_id); 236 ret = il3945_set_wep_dynamic_key_info(priv, keyconf, sta_id);
237 break; 237 break;
238 default: 238 default:
239 IWL_ERR(priv, "Unknown alg: %s alg=%x\n", __func__, 239 IL_ERR(priv, "Unknown alg: %s alg=%x\n", __func__,
240 keyconf->cipher); 240 keyconf->cipher);
241 ret = -EINVAL; 241 ret = -EINVAL;
242 } 242 }
243 243
244 IWL_DEBUG_WEP(priv, "Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n", 244 IL_DEBUG_WEP(priv, "Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n",
245 keyconf->cipher, keyconf->keylen, keyconf->keyidx, 245 keyconf->cipher, keyconf->keylen, keyconf->keyidx,
246 sta_id, ret); 246 sta_id, ret);
247 247
248 return ret; 248 return ret;
249} 249}
250 250
251static int iwl3945_remove_static_key(struct iwl_priv *priv) 251static int il3945_remove_static_key(struct il_priv *priv)
252{ 252{
253 int ret = -EOPNOTSUPP; 253 int ret = -EOPNOTSUPP;
254 254
255 return ret; 255 return ret;
256} 256}
257 257
258static int iwl3945_set_static_key(struct iwl_priv *priv, 258static int il3945_set_static_key(struct il_priv *priv,
259 struct ieee80211_key_conf *key) 259 struct ieee80211_key_conf *key)
260{ 260{
261 if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || 261 if (key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
262 key->cipher == WLAN_CIPHER_SUITE_WEP104) 262 key->cipher == WLAN_CIPHER_SUITE_WEP104)
263 return -EOPNOTSUPP; 263 return -EOPNOTSUPP;
264 264
265 IWL_ERR(priv, "Static key invalid: cipher %x\n", key->cipher); 265 IL_ERR(priv, "Static key invalid: cipher %x\n", key->cipher);
266 return -EINVAL; 266 return -EINVAL;
267} 267}
268 268
269static void iwl3945_clear_free_frames(struct iwl_priv *priv) 269static void il3945_clear_free_frames(struct il_priv *priv)
270{ 270{
271 struct list_head *element; 271 struct list_head *element;
272 272
273 IWL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n", 273 IL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n",
274 priv->frames_count); 274 priv->frames_count);
275 275
276 while (!list_empty(&priv->free_frames)) { 276 while (!list_empty(&priv->free_frames)) {
277 element = priv->free_frames.next; 277 element = priv->free_frames.next;
278 list_del(element); 278 list_del(element);
279 kfree(list_entry(element, struct iwl3945_frame, list)); 279 kfree(list_entry(element, struct il3945_frame, list));
280 priv->frames_count--; 280 priv->frames_count--;
281 } 281 }
282 282
283 if (priv->frames_count) { 283 if (priv->frames_count) {
284 IWL_WARN(priv, "%d frames still in use. Did we lose one?\n", 284 IL_WARN(priv, "%d frames still in use. Did we lose one?\n",
285 priv->frames_count); 285 priv->frames_count);
286 priv->frames_count = 0; 286 priv->frames_count = 0;
287 } 287 }
288} 288}
289 289
290static struct iwl3945_frame *iwl3945_get_free_frame(struct iwl_priv *priv) 290static struct il3945_frame *il3945_get_free_frame(struct il_priv *priv)
291{ 291{
292 struct iwl3945_frame *frame; 292 struct il3945_frame *frame;
293 struct list_head *element; 293 struct list_head *element;
294 if (list_empty(&priv->free_frames)) { 294 if (list_empty(&priv->free_frames)) {
295 frame = kzalloc(sizeof(*frame), GFP_KERNEL); 295 frame = kzalloc(sizeof(*frame), GFP_KERNEL);
296 if (!frame) { 296 if (!frame) {
297 IWL_ERR(priv, "Could not allocate frame!\n"); 297 IL_ERR(priv, "Could not allocate frame!\n");
298 return NULL; 298 return NULL;
299 } 299 }
300 300
@@ -304,21 +304,21 @@ static struct iwl3945_frame *iwl3945_get_free_frame(struct iwl_priv *priv)
304 304
305 element = priv->free_frames.next; 305 element = priv->free_frames.next;
306 list_del(element); 306 list_del(element);
307 return list_entry(element, struct iwl3945_frame, list); 307 return list_entry(element, struct il3945_frame, list);
308} 308}
309 309
310static void iwl3945_free_frame(struct iwl_priv *priv, struct iwl3945_frame *frame) 310static void il3945_free_frame(struct il_priv *priv, struct il3945_frame *frame)
311{ 311{
312 memset(frame, 0, sizeof(*frame)); 312 memset(frame, 0, sizeof(*frame));
313 list_add(&frame->list, &priv->free_frames); 313 list_add(&frame->list, &priv->free_frames);
314} 314}
315 315
316unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, 316unsigned int il3945_fill_beacon_frame(struct il_priv *priv,
317 struct ieee80211_hdr *hdr, 317 struct ieee80211_hdr *hdr,
318 int left) 318 int left)
319{ 319{
320 320
321 if (!iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS) || !priv->beacon_skb) 321 if (!il_is_associated(priv, IL_RXON_CTX_BSS) || !priv->beacon_skb)
322 return 0; 322 return 0;
323 323
324 if (priv->beacon_skb->len > left) 324 if (priv->beacon_skb->len > left)
@@ -329,51 +329,51 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
329 return priv->beacon_skb->len; 329 return priv->beacon_skb->len;
330} 330}
331 331
332static int iwl3945_send_beacon_cmd(struct iwl_priv *priv) 332static int il3945_send_beacon_cmd(struct il_priv *priv)
333{ 333{
334 struct iwl3945_frame *frame; 334 struct il3945_frame *frame;
335 unsigned int frame_size; 335 unsigned int frame_size;
336 int rc; 336 int rc;
337 u8 rate; 337 u8 rate;
338 338
339 frame = iwl3945_get_free_frame(priv); 339 frame = il3945_get_free_frame(priv);
340 340
341 if (!frame) { 341 if (!frame) {
342 IWL_ERR(priv, "Could not obtain free frame buffer for beacon " 342 IL_ERR(priv, "Could not obtain free frame buffer for beacon "
343 "command.\n"); 343 "command.\n");
344 return -ENOMEM; 344 return -ENOMEM;
345 } 345 }
346 346
347 rate = iwl_legacy_get_lowest_plcp(priv, 347 rate = il_get_lowest_plcp(priv,
348 &priv->contexts[IWL_RXON_CTX_BSS]); 348 &priv->contexts[IL_RXON_CTX_BSS]);
349 349
350 frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate); 350 frame_size = il3945_hw_get_beacon_cmd(priv, frame, rate);
351 351
352 rc = iwl_legacy_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, 352 rc = il_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size,
353 &frame->u.cmd[0]); 353 &frame->u.cmd[0]);
354 354
355 iwl3945_free_frame(priv, frame); 355 il3945_free_frame(priv, frame);
356 356
357 return rc; 357 return rc;
358} 358}
359 359
360static void iwl3945_unset_hw_params(struct iwl_priv *priv) 360static void il3945_unset_hw_params(struct il_priv *priv)
361{ 361{
362 if (priv->_3945.shared_virt) 362 if (priv->_3945.shared_virt)
363 dma_free_coherent(&priv->pci_dev->dev, 363 dma_free_coherent(&priv->pci_dev->dev,
364 sizeof(struct iwl3945_shared), 364 sizeof(struct il3945_shared),
365 priv->_3945.shared_virt, 365 priv->_3945.shared_virt,
366 priv->_3945.shared_phys); 366 priv->_3945.shared_phys);
367} 367}
368 368
369static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, 369static void il3945_build_tx_cmd_hwcrypto(struct il_priv *priv,
370 struct ieee80211_tx_info *info, 370 struct ieee80211_tx_info *info,
371 struct iwl_device_cmd *cmd, 371 struct il_device_cmd *cmd,
372 struct sk_buff *skb_frag, 372 struct sk_buff *skb_frag,
373 int sta_id) 373 int sta_id)
374{ 374{
375 struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload; 375 struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload;
376 struct iwl_hw_key *keyinfo = &priv->stations[sta_id].keyinfo; 376 struct il_hw_key *keyinfo = &priv->stations[sta_id].keyinfo;
377 377
378 tx_cmd->sec_ctl = 0; 378 tx_cmd->sec_ctl = 0;
379 379
@@ -381,7 +381,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
381 case WLAN_CIPHER_SUITE_CCMP: 381 case WLAN_CIPHER_SUITE_CCMP:
382 tx_cmd->sec_ctl = TX_CMD_SEC_CCM; 382 tx_cmd->sec_ctl = TX_CMD_SEC_CCM;
383 memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen); 383 memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen);
384 IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); 384 IL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n");
385 break; 385 break;
386 386
387 case WLAN_CIPHER_SUITE_TKIP: 387 case WLAN_CIPHER_SUITE_TKIP:
@@ -396,12 +396,12 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
396 396
397 memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen); 397 memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen);
398 398
399 IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption " 399 IL_DEBUG_TX(priv, "Configuring packet for WEP encryption "
400 "with key %d\n", info->control.hw_key->hw_key_idx); 400 "with key %d\n", info->control.hw_key->hw_key_idx);
401 break; 401 break;
402 402
403 default: 403 default:
404 IWL_ERR(priv, "Unknown encode cipher %x\n", keyinfo->cipher); 404 IL_ERR(priv, "Unknown encode cipher %x\n", keyinfo->cipher);
405 break; 405 break;
406 } 406 }
407} 407}
@@ -409,12 +409,12 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
409/* 409/*
410 * handle build REPLY_TX command notification. 410 * handle build REPLY_TX command notification.
411 */ 411 */
412static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv, 412static void il3945_build_tx_cmd_basic(struct il_priv *priv,
413 struct iwl_device_cmd *cmd, 413 struct il_device_cmd *cmd,
414 struct ieee80211_tx_info *info, 414 struct ieee80211_tx_info *info,
415 struct ieee80211_hdr *hdr, u8 std_id) 415 struct ieee80211_hdr *hdr, u8 std_id)
416{ 416{
417 struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload; 417 struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload;
418 __le32 tx_flags = tx_cmd->tx_flags; 418 __le32 tx_flags = tx_cmd->tx_flags;
419 __le16 fc = hdr->frame_control; 419 __le16 fc = hdr->frame_control;
420 420
@@ -443,7 +443,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
443 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 443 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
444 } 444 }
445 445
446 iwl_legacy_tx_cmd_protection(priv, info, fc, &tx_flags); 446 il_tx_cmd_protection(priv, info, fc, &tx_flags);
447 447
448 tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); 448 tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK);
449 if (ieee80211_is_mgmt(fc)) { 449 if (ieee80211_is_mgmt(fc)) {
@@ -463,15 +463,15 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
463/* 463/*
464 * start REPLY_TX command process 464 * start REPLY_TX command process
465 */ 465 */
466static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) 466static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb)
467{ 467{
468 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 468 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
469 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 469 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
470 struct iwl3945_tx_cmd *tx_cmd; 470 struct il3945_tx_cmd *tx_cmd;
471 struct iwl_tx_queue *txq = NULL; 471 struct il_tx_queue *txq = NULL;
472 struct iwl_queue *q = NULL; 472 struct il_queue *q = NULL;
473 struct iwl_device_cmd *out_cmd; 473 struct il_device_cmd *out_cmd;
474 struct iwl_cmd_meta *out_meta; 474 struct il_cmd_meta *out_meta;
475 dma_addr_t phys_addr; 475 dma_addr_t phys_addr;
476 dma_addr_t txcmd_phys; 476 dma_addr_t txcmd_phys;
477 int txq_id = skb_get_queue_mapping(skb); 477 int txq_id = skb_get_queue_mapping(skb);
@@ -485,13 +485,13 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
485 unsigned long flags; 485 unsigned long flags;
486 486
487 spin_lock_irqsave(&priv->lock, flags); 487 spin_lock_irqsave(&priv->lock, flags);
488 if (iwl_legacy_is_rfkill(priv)) { 488 if (il_is_rfkill(priv)) {
489 IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); 489 IL_DEBUG_DROP(priv, "Dropping - RF KILL\n");
490 goto drop_unlock; 490 goto drop_unlock;
491 } 491 }
492 492
493 if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) == IWL_INVALID_RATE) { 493 if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) == IL_INVALID_RATE) {
494 IWL_ERR(priv, "ERROR: No TX rate available.\n"); 494 IL_ERR(priv, "ERROR: No TX rate available.\n");
495 goto drop_unlock; 495 goto drop_unlock;
496 } 496 }
497 497
@@ -502,11 +502,11 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
502 502
503#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 503#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
504 if (ieee80211_is_auth(fc)) 504 if (ieee80211_is_auth(fc))
505 IWL_DEBUG_TX(priv, "Sending AUTH frame\n"); 505 IL_DEBUG_TX(priv, "Sending AUTH frame\n");
506 else if (ieee80211_is_assoc_req(fc)) 506 else if (ieee80211_is_assoc_req(fc))
507 IWL_DEBUG_TX(priv, "Sending ASSOC frame\n"); 507 IL_DEBUG_TX(priv, "Sending ASSOC frame\n");
508 else if (ieee80211_is_reassoc_req(fc)) 508 else if (ieee80211_is_reassoc_req(fc))
509 IWL_DEBUG_TX(priv, "Sending REASSOC frame\n"); 509 IL_DEBUG_TX(priv, "Sending REASSOC frame\n");
510#endif 510#endif
511 511
512 spin_unlock_irqrestore(&priv->lock, flags); 512 spin_unlock_irqrestore(&priv->lock, flags);
@@ -514,16 +514,16 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
514 hdr_len = ieee80211_hdrlen(fc); 514 hdr_len = ieee80211_hdrlen(fc);
515 515
516 /* Find index into station table for destination station */ 516 /* Find index into station table for destination station */
517 sta_id = iwl_legacy_sta_id_or_broadcast( 517 sta_id = il_sta_id_or_broadcast(
518 priv, &priv->contexts[IWL_RXON_CTX_BSS], 518 priv, &priv->contexts[IL_RXON_CTX_BSS],
519 info->control.sta); 519 info->control.sta);
520 if (sta_id == IWL_INVALID_STATION) { 520 if (sta_id == IL_INVALID_STATION) {
521 IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", 521 IL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
522 hdr->addr1); 522 hdr->addr1);
523 goto drop; 523 goto drop;
524 } 524 }
525 525
526 IWL_DEBUG_RATE(priv, "station Id %d\n", sta_id); 526 IL_DEBUG_RATE(priv, "station Id %d\n", sta_id);
527 527
528 if (ieee80211_is_data_qos(fc)) { 528 if (ieee80211_is_data_qos(fc)) {
529 u8 *qc = ieee80211_get_qos_ctl(hdr); 529 u8 *qc = ieee80211_get_qos_ctl(hdr);
@@ -536,22 +536,22 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
536 txq = &priv->txq[txq_id]; 536 txq = &priv->txq[txq_id];
537 q = &txq->q; 537 q = &txq->q;
538 538
539 if ((iwl_legacy_queue_space(q) < q->high_mark)) 539 if ((il_queue_space(q) < q->high_mark))
540 goto drop; 540 goto drop;
541 541
542 spin_lock_irqsave(&priv->lock, flags); 542 spin_lock_irqsave(&priv->lock, flags);
543 543
544 idx = iwl_legacy_get_cmd_index(q, q->write_ptr, 0); 544 idx = il_get_cmd_index(q, q->write_ptr, 0);
545 545
546 /* Set up driver data for this TFD */ 546 /* Set up driver data for this TFD */
547 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); 547 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info));
548 txq->txb[q->write_ptr].skb = skb; 548 txq->txb[q->write_ptr].skb = skb;
549 txq->txb[q->write_ptr].ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 549 txq->txb[q->write_ptr].ctx = &priv->contexts[IL_RXON_CTX_BSS];
550 550
551 /* Init first empty entry in queue's array of Tx/cmd buffers */ 551 /* Init first empty entry in queue's array of Tx/cmd buffers */
552 out_cmd = txq->cmd[idx]; 552 out_cmd = txq->cmd[idx];
553 out_meta = &txq->meta[idx]; 553 out_meta = &txq->meta[idx];
554 tx_cmd = (struct iwl3945_tx_cmd *)out_cmd->cmd.payload; 554 tx_cmd = (struct il3945_tx_cmd *)out_cmd->cmd.payload;
555 memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); 555 memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr));
556 memset(tx_cmd, 0, sizeof(*tx_cmd)); 556 memset(tx_cmd, 0, sizeof(*tx_cmd));
557 557
@@ -570,20 +570,20 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
570 570
571 571
572 if (info->control.hw_key) 572 if (info->control.hw_key)
573 iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id); 573 il3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id);
574 574
575 /* TODO need this for burst mode later on */ 575 /* TODO need this for burst mode later on */
576 iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id); 576 il3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id);
577 577
578 /* set is_hcca to 0; it probably will never be implemented */ 578 /* set is_hcca to 0; it probably will never be implemented */
579 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0); 579 il3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0);
580 580
581 /* Total # bytes to be transmitted */ 581 /* Total # bytes to be transmitted */
582 len = (u16)skb->len; 582 len = (u16)skb->len;
583 tx_cmd->len = cpu_to_le16(len); 583 tx_cmd->len = cpu_to_le16(len);
584 584
585 iwl_legacy_dbg_log_tx_data_frame(priv, len, hdr); 585 il_dbg_log_tx_data_frame(priv, len, hdr);
586 iwl_legacy_update_stats(priv, true, fc, len); 586 il_update_stats(priv, true, fc, len);
587 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; 587 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
588 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; 588 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
589 589
@@ -594,11 +594,11 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
594 txq->need_update = 0; 594 txq->need_update = 0;
595 } 595 }
596 596
597 IWL_DEBUG_TX(priv, "sequence nr = 0X%x\n", 597 IL_DEBUG_TX(priv, "sequence nr = 0X%x\n",
598 le16_to_cpu(out_cmd->hdr.sequence)); 598 le16_to_cpu(out_cmd->hdr.sequence));
599 IWL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); 599 IL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags));
600 iwl_print_hex_dump(priv, IWL_DL_TX, tx_cmd, sizeof(*tx_cmd)); 600 il_print_hex_dump(priv, IL_DL_TX, tx_cmd, sizeof(*tx_cmd));
601 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, 601 il_print_hex_dump(priv, IL_DL_TX, (u8 *)tx_cmd->hdr,
602 ieee80211_hdrlen(fc)); 602 ieee80211_hdrlen(fc));
603 603
604 /* 604 /*
@@ -610,8 +610,8 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
610 * of the MAC header (device reads on dword boundaries). 610 * of the MAC header (device reads on dword boundaries).
611 * We'll tell device about this padding later. 611 * We'll tell device about this padding later.
612 */ 612 */
613 len = sizeof(struct iwl3945_tx_cmd) + 613 len = sizeof(struct il3945_tx_cmd) +
614 sizeof(struct iwl_cmd_header) + hdr_len; 614 sizeof(struct il_cmd_header) + hdr_len;
615 len = (len + 3) & ~3; 615 len = (len + 3) & ~3;
616 616
617 /* Physical address of this Tx command's header (not MAC header!), 617 /* Physical address of this Tx command's header (not MAC header!),
@@ -642,20 +642,20 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
642 642
643 643
644 /* Tell device the write index *just past* this latest filled TFD */ 644 /* Tell device the write index *just past* this latest filled TFD */
645 q->write_ptr = iwl_legacy_queue_inc_wrap(q->write_ptr, q->n_bd); 645 q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd);
646 iwl_legacy_txq_update_write_ptr(priv, txq); 646 il_txq_update_write_ptr(priv, txq);
647 spin_unlock_irqrestore(&priv->lock, flags); 647 spin_unlock_irqrestore(&priv->lock, flags);
648 648
649 if ((iwl_legacy_queue_space(q) < q->high_mark) 649 if ((il_queue_space(q) < q->high_mark)
650 && priv->mac80211_registered) { 650 && priv->mac80211_registered) {
651 if (wait_write_ptr) { 651 if (wait_write_ptr) {
652 spin_lock_irqsave(&priv->lock, flags); 652 spin_lock_irqsave(&priv->lock, flags);
653 txq->need_update = 1; 653 txq->need_update = 1;
654 iwl_legacy_txq_update_write_ptr(priv, txq); 654 il_txq_update_write_ptr(priv, txq);
655 spin_unlock_irqrestore(&priv->lock, flags); 655 spin_unlock_irqrestore(&priv->lock, flags);
656 } 656 }
657 657
658 iwl_legacy_stop_queue(priv, txq); 658 il_stop_queue(priv, txq);
659 } 659 }
660 660
661 return 0; 661 return 0;
@@ -666,13 +666,13 @@ drop:
666 return -1; 666 return -1;
667} 667}
668 668
669static int iwl3945_get_measurement(struct iwl_priv *priv, 669static int il3945_get_measurement(struct il_priv *priv,
670 struct ieee80211_measurement_params *params, 670 struct ieee80211_measurement_params *params,
671 u8 type) 671 u8 type)
672{ 672{
673 struct iwl_spectrum_cmd spectrum; 673 struct il_spectrum_cmd spectrum;
674 struct iwl_rx_packet *pkt; 674 struct il_rx_packet *pkt;
675 struct iwl_host_cmd cmd = { 675 struct il_host_cmd cmd = {
676 .id = REPLY_SPECTRUM_MEASUREMENT_CMD, 676 .id = REPLY_SPECTRUM_MEASUREMENT_CMD,
677 .data = (void *)&spectrum, 677 .data = (void *)&spectrum,
678 .flags = CMD_WANT_SKB, 678 .flags = CMD_WANT_SKB,
@@ -681,10 +681,10 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
681 int rc; 681 int rc;
682 int spectrum_resp_status; 682 int spectrum_resp_status;
683 int duration = le16_to_cpu(params->duration); 683 int duration = le16_to_cpu(params->duration);
684 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 684 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
685 685
686 if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) 686 if (il_is_associated(priv, IL_RXON_CTX_BSS))
687 add_time = iwl_legacy_usecs_to_beacons(priv, 687 add_time = il_usecs_to_beacons(priv,
688 le64_to_cpu(params->start_time) - priv->_3945.last_tsf, 688 le64_to_cpu(params->start_time) - priv->_3945.last_tsf,
689 le16_to_cpu(ctx->timing.beacon_interval)); 689 le16_to_cpu(ctx->timing.beacon_interval));
690 690
@@ -697,9 +697,9 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
697 cmd.len = sizeof(spectrum); 697 cmd.len = sizeof(spectrum);
698 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); 698 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len));
699 699
700 if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) 700 if (il_is_associated(priv, IL_RXON_CTX_BSS))
701 spectrum.start_time = 701 spectrum.start_time =
702 iwl_legacy_add_beacon_time(priv, 702 il_add_beacon_time(priv,
703 priv->_3945.last_beacon_time, add_time, 703 priv->_3945.last_beacon_time, add_time,
704 le16_to_cpu(ctx->timing.beacon_interval)); 704 le16_to_cpu(ctx->timing.beacon_interval));
705 else 705 else
@@ -712,13 +712,13 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
712 spectrum.flags |= RXON_FLG_BAND_24G_MSK | 712 spectrum.flags |= RXON_FLG_BAND_24G_MSK |
713 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; 713 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK;
714 714
715 rc = iwl_legacy_send_cmd_sync(priv, &cmd); 715 rc = il_send_cmd_sync(priv, &cmd);
716 if (rc) 716 if (rc)
717 return rc; 717 return rc;
718 718
719 pkt = (struct iwl_rx_packet *)cmd.reply_page; 719 pkt = (struct il_rx_packet *)cmd.reply_page;
720 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { 720 if (pkt->hdr.flags & IL_CMD_FAILED_MSK) {
721 IWL_ERR(priv, "Bad return from REPLY_RX_ON_ASSOC command\n"); 721 IL_ERR(priv, "Bad return from REPLY_RX_ON_ASSOC command\n");
722 rc = -EIO; 722 rc = -EIO;
723 } 723 }
724 724
@@ -726,7 +726,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
726 switch (spectrum_resp_status) { 726 switch (spectrum_resp_status) {
727 case 0: /* Command will be handled */ 727 case 0: /* Command will be handled */
728 if (pkt->u.spectrum.id != 0xff) { 728 if (pkt->u.spectrum.id != 0xff) {
729 IWL_DEBUG_INFO(priv, "Replaced existing measurement: %d\n", 729 IL_DEBUG_INFO(priv, "Replaced existing measurement: %d\n",
730 pkt->u.spectrum.id); 730 pkt->u.spectrum.id);
731 priv->measurement_status &= ~MEASUREMENT_READY; 731 priv->measurement_status &= ~MEASUREMENT_READY;
732 } 732 }
@@ -739,36 +739,36 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
739 break; 739 break;
740 } 740 }
741 741
742 iwl_legacy_free_pages(priv, cmd.reply_page); 742 il_free_pages(priv, cmd.reply_page);
743 743
744 return rc; 744 return rc;
745} 745}
746 746
747static void iwl3945_rx_reply_alive(struct iwl_priv *priv, 747static void il3945_rx_reply_alive(struct il_priv *priv,
748 struct iwl_rx_mem_buffer *rxb) 748 struct il_rx_mem_buffer *rxb)
749{ 749{
750 struct iwl_rx_packet *pkt = rxb_addr(rxb); 750 struct il_rx_packet *pkt = rxb_addr(rxb);
751 struct iwl_alive_resp *palive; 751 struct il_alive_resp *palive;
752 struct delayed_work *pwork; 752 struct delayed_work *pwork;
753 753
754 palive = &pkt->u.alive_frame; 754 palive = &pkt->u.alive_frame;
755 755
756 IWL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision " 756 IL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision "
757 "0x%01X 0x%01X\n", 757 "0x%01X 0x%01X\n",
758 palive->is_valid, palive->ver_type, 758 palive->is_valid, palive->ver_type,
759 palive->ver_subtype); 759 palive->ver_subtype);
760 760
761 if (palive->ver_subtype == INITIALIZE_SUBTYPE) { 761 if (palive->ver_subtype == INITIALIZE_SUBTYPE) {
762 IWL_DEBUG_INFO(priv, "Initialization Alive received.\n"); 762 IL_DEBUG_INFO(priv, "Initialization Alive received.\n");
763 memcpy(&priv->card_alive_init, &pkt->u.alive_frame, 763 memcpy(&priv->card_alive_init, &pkt->u.alive_frame,
764 sizeof(struct iwl_alive_resp)); 764 sizeof(struct il_alive_resp));
765 pwork = &priv->init_alive_start; 765 pwork = &priv->init_alive_start;
766 } else { 766 } else {
767 IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); 767 IL_DEBUG_INFO(priv, "Runtime Alive received.\n");
768 memcpy(&priv->card_alive, &pkt->u.alive_frame, 768 memcpy(&priv->card_alive, &pkt->u.alive_frame,
769 sizeof(struct iwl_alive_resp)); 769 sizeof(struct il_alive_resp));
770 pwork = &priv->alive_start; 770 pwork = &priv->alive_start;
771 iwl3945_disable_events(priv); 771 il3945_disable_events(priv);
772 } 772 }
773 773
774 /* We delay the ALIVE response by 5ms to 774 /* We delay the ALIVE response by 5ms to
@@ -777,28 +777,28 @@ static void iwl3945_rx_reply_alive(struct iwl_priv *priv,
777 queue_delayed_work(priv->workqueue, pwork, 777 queue_delayed_work(priv->workqueue, pwork,
778 msecs_to_jiffies(5)); 778 msecs_to_jiffies(5));
779 else 779 else
780 IWL_WARN(priv, "uCode did not respond OK.\n"); 780 IL_WARN(priv, "uCode did not respond OK.\n");
781} 781}
782 782
783static void iwl3945_rx_reply_add_sta(struct iwl_priv *priv, 783static void il3945_rx_reply_add_sta(struct il_priv *priv,
784 struct iwl_rx_mem_buffer *rxb) 784 struct il_rx_mem_buffer *rxb)
785{ 785{
786#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 786#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
787 struct iwl_rx_packet *pkt = rxb_addr(rxb); 787 struct il_rx_packet *pkt = rxb_addr(rxb);
788#endif 788#endif
789 789
790 IWL_DEBUG_RX(priv, "Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); 790 IL_DEBUG_RX(priv, "Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status);
791} 791}
792 792
793static void iwl3945_rx_beacon_notif(struct iwl_priv *priv, 793static void il3945_rx_beacon_notif(struct il_priv *priv,
794 struct iwl_rx_mem_buffer *rxb) 794 struct il_rx_mem_buffer *rxb)
795{ 795{
796 struct iwl_rx_packet *pkt = rxb_addr(rxb); 796 struct il_rx_packet *pkt = rxb_addr(rxb);
797 struct iwl3945_beacon_notif *beacon = &(pkt->u.beacon_status); 797 struct il3945_beacon_notif *beacon = &(pkt->u.beacon_status);
798#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 798#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
799 u8 rate = beacon->beacon_notify_hdr.rate; 799 u8 rate = beacon->beacon_notify_hdr.rate;
800 800
801 IWL_DEBUG_RX(priv, "beacon status %x retries %d iss %d " 801 IL_DEBUG_RX(priv, "beacon status %x retries %d iss %d "
802 "tsf %d %d rate %d\n", 802 "tsf %d %d rate %d\n",
803 le32_to_cpu(beacon->beacon_notify_hdr.status) & TX_STATUS_MSK, 803 le32_to_cpu(beacon->beacon_notify_hdr.status) & TX_STATUS_MSK,
804 beacon->beacon_notify_hdr.failure_frame, 804 beacon->beacon_notify_hdr.failure_frame,
@@ -813,18 +813,18 @@ static void iwl3945_rx_beacon_notif(struct iwl_priv *priv,
813 813
814/* Handle notification from uCode that card's power state is changing 814/* Handle notification from uCode that card's power state is changing
815 * due to software, hardware, or critical temperature RFKILL */ 815 * due to software, hardware, or critical temperature RFKILL */
816static void iwl3945_rx_card_state_notif(struct iwl_priv *priv, 816static void il3945_rx_card_state_notif(struct il_priv *priv,
817 struct iwl_rx_mem_buffer *rxb) 817 struct il_rx_mem_buffer *rxb)
818{ 818{
819 struct iwl_rx_packet *pkt = rxb_addr(rxb); 819 struct il_rx_packet *pkt = rxb_addr(rxb);
820 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); 820 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags);
821 unsigned long status = priv->status; 821 unsigned long status = priv->status;
822 822
823 IWL_WARN(priv, "Card state received: HW:%s SW:%s\n", 823 IL_WARN(priv, "Card state received: HW:%s SW:%s\n",
824 (flags & HW_CARD_DISABLED) ? "Kill" : "On", 824 (flags & HW_CARD_DISABLED) ? "Kill" : "On",
825 (flags & SW_CARD_DISABLED) ? "Kill" : "On"); 825 (flags & SW_CARD_DISABLED) ? "Kill" : "On");
826 826
827 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, 827 il_write32(priv, CSR_UCODE_DRV_GP1_SET,
828 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 828 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
829 829
830 if (flags & HW_CARD_DISABLED) 830 if (flags & HW_CARD_DISABLED)
@@ -833,7 +833,7 @@ static void iwl3945_rx_card_state_notif(struct iwl_priv *priv,
833 clear_bit(STATUS_RF_KILL_HW, &priv->status); 833 clear_bit(STATUS_RF_KILL_HW, &priv->status);
834 834
835 835
836 iwl_legacy_scan_cancel(priv); 836 il_scan_cancel(priv);
837 837
838 if ((test_bit(STATUS_RF_KILL_HW, &status) != 838 if ((test_bit(STATUS_RF_KILL_HW, &status) !=
839 test_bit(STATUS_RF_KILL_HW, &priv->status))) 839 test_bit(STATUS_RF_KILL_HW, &priv->status)))
@@ -844,7 +844,7 @@ static void iwl3945_rx_card_state_notif(struct iwl_priv *priv,
844} 844}
845 845
846/** 846/**
847 * iwl3945_setup_rx_handlers - Initialize Rx handler callbacks 847 * il3945_setup_rx_handlers - Initialize Rx handler callbacks
848 * 848 *
849 * Setup the RX handlers for each of the reply types sent from the uCode 849 * Setup the RX handlers for each of the reply types sent from the uCode
850 * to the host. 850 * to the host.
@@ -852,32 +852,32 @@ static void iwl3945_rx_card_state_notif(struct iwl_priv *priv,
852 * This function chains into the hardware specific files for them to setup 852 * This function chains into the hardware specific files for them to setup
853 * any hardware specific handlers as well. 853 * any hardware specific handlers as well.
854 */ 854 */
855static void iwl3945_setup_rx_handlers(struct iwl_priv *priv) 855static void il3945_setup_rx_handlers(struct il_priv *priv)
856{ 856{
857 priv->rx_handlers[REPLY_ALIVE] = iwl3945_rx_reply_alive; 857 priv->rx_handlers[REPLY_ALIVE] = il3945_rx_reply_alive;
858 priv->rx_handlers[REPLY_ADD_STA] = iwl3945_rx_reply_add_sta; 858 priv->rx_handlers[REPLY_ADD_STA] = il3945_rx_reply_add_sta;
859 priv->rx_handlers[REPLY_ERROR] = iwl_legacy_rx_reply_error; 859 priv->rx_handlers[REPLY_ERROR] = il_rx_reply_error;
860 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_legacy_rx_csa; 860 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa;
861 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = 861 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] =
862 iwl_legacy_rx_spectrum_measure_notif; 862 il_rx_spectrum_measure_notif;
863 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl_legacy_rx_pm_sleep_notif; 863 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif;
864 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = 864 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] =
865 iwl_legacy_rx_pm_debug_statistics_notif; 865 il_rx_pm_debug_statistics_notif;
866 priv->rx_handlers[BEACON_NOTIFICATION] = iwl3945_rx_beacon_notif; 866 priv->rx_handlers[BEACON_NOTIFICATION] = il3945_rx_beacon_notif;
867 867
868 /* 868 /*
869 * The same handler is used for both the REPLY to a discrete 869 * The same handler is used for both the REPLY to a discrete
870 * statistics request from the host as well as for the periodic 870 * statistics request from the host as well as for the periodic
871 * statistics notifications (after received beacons) from the uCode. 871 * statistics notifications (after received beacons) from the uCode.
872 */ 872 */
873 priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl3945_reply_statistics; 873 priv->rx_handlers[REPLY_STATISTICS_CMD] = il3945_reply_statistics;
874 priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl3945_hw_rx_statistics; 874 priv->rx_handlers[STATISTICS_NOTIFICATION] = il3945_hw_rx_statistics;
875 875
876 iwl_legacy_setup_rx_scan_handlers(priv); 876 il_setup_rx_scan_handlers(priv);
877 priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl3945_rx_card_state_notif; 877 priv->rx_handlers[CARD_STATE_NOTIFICATION] = il3945_rx_card_state_notif;
878 878
879 /* Set up hardware specific Rx handlers */ 879 /* Set up hardware specific Rx handlers */
880 iwl3945_hw_rx_handler_setup(priv); 880 il3945_hw_rx_handler_setup(priv);
881} 881}
882 882
883/************************** RX-FUNCTIONS ****************************/ 883/************************** RX-FUNCTIONS ****************************/
@@ -885,7 +885,7 @@ static void iwl3945_setup_rx_handlers(struct iwl_priv *priv)
885 * Rx theory of operation 885 * Rx theory of operation
886 * 886 *
887 * The host allocates 32 DMA target addresses and passes the host address 887 * The host allocates 32 DMA target addresses and passes the host address
888 * to the firmware at register IWL_RFDS_TABLE_LOWER + N * RFD_SIZE where N is 888 * to the firmware at register IL_RFDS_TABLE_LOWER + N * RFD_SIZE where N is
889 * 0 to 31 889 * 0 to 31
890 * 890 *
891 * Rx Queue Indexes 891 * Rx Queue Indexes
@@ -914,7 +914,7 @@ static void iwl3945_setup_rx_handlers(struct iwl_priv *priv)
914 * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When 914 * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When
915 * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled 915 * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled
916 * to replenish the iwl->rxq->rx_free. 916 * to replenish the iwl->rxq->rx_free.
917 * + In iwl3945_rx_replenish (scheduled) if 'processed' != 'read' then the 917 * + In il3945_rx_replenish (scheduled) if 'processed' != 'read' then the
918 * iwl->rxq is replenished and the READ INDEX is updated (updating the 918 * iwl->rxq is replenished and the READ INDEX is updated (updating the
919 * 'processed' and 'read' driver indexes as well) 919 * 'processed' and 'read' driver indexes as well)
920 * + A received packet is processed and handed to the kernel network stack, 920 * + A received packet is processed and handed to the kernel network stack,
@@ -927,34 +927,34 @@ static void iwl3945_setup_rx_handlers(struct iwl_priv *priv)
927 * 927 *
928 * Driver sequence: 928 * Driver sequence:
929 * 929 *
930 * iwl3945_rx_replenish() Replenishes rx_free list from rx_used, and calls 930 * il3945_rx_replenish() Replenishes rx_free list from rx_used, and calls
931 * iwl3945_rx_queue_restock 931 * il3945_rx_queue_restock
932 * iwl3945_rx_queue_restock() Moves available buffers from rx_free into Rx 932 * il3945_rx_queue_restock() Moves available buffers from rx_free into Rx
933 * queue, updates firmware pointers, and updates 933 * queue, updates firmware pointers, and updates
934 * the WRITE index. If insufficient rx_free buffers 934 * the WRITE index. If insufficient rx_free buffers
935 * are available, schedules iwl3945_rx_replenish 935 * are available, schedules il3945_rx_replenish
936 * 936 *
937 * -- enable interrupts -- 937 * -- enable interrupts --
938 * ISR - iwl3945_rx() Detach iwl_rx_mem_buffers from pool up to the 938 * ISR - il3945_rx() Detach il_rx_mem_buffers from pool up to the
939 * READ INDEX, detaching the SKB from the pool. 939 * READ INDEX, detaching the SKB from the pool.
940 * Moves the packet buffer from queue to rx_used. 940 * Moves the packet buffer from queue to rx_used.
941 * Calls iwl3945_rx_queue_restock to refill any empty 941 * Calls il3945_rx_queue_restock to refill any empty
942 * slots. 942 * slots.
943 * ... 943 * ...
944 * 944 *
945 */ 945 */
946 946
947/** 947/**
948 * iwl3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr 948 * il3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr
949 */ 949 */
950static inline __le32 iwl3945_dma_addr2rbd_ptr(struct iwl_priv *priv, 950static inline __le32 il3945_dma_addr2rbd_ptr(struct il_priv *priv,
951 dma_addr_t dma_addr) 951 dma_addr_t dma_addr)
952{ 952{
953 return cpu_to_le32((u32)dma_addr); 953 return cpu_to_le32((u32)dma_addr);
954} 954}
955 955
956/** 956/**
957 * iwl3945_rx_queue_restock - refill RX queue from pre-allocated pool 957 * il3945_rx_queue_restock - refill RX queue from pre-allocated pool
958 * 958 *
959 * If there are slots in the RX queue that need to be restocked, 959 * If there are slots in the RX queue that need to be restocked,
960 * and we have free pre-allocated buffers, fill the ranks as much 960 * and we have free pre-allocated buffers, fill the ranks as much
@@ -964,24 +964,24 @@ static inline __le32 iwl3945_dma_addr2rbd_ptr(struct iwl_priv *priv,
964 * also updates the memory address in the firmware to reference the new 964 * also updates the memory address in the firmware to reference the new
965 * target buffer. 965 * target buffer.
966 */ 966 */
967static void iwl3945_rx_queue_restock(struct iwl_priv *priv) 967static void il3945_rx_queue_restock(struct il_priv *priv)
968{ 968{
969 struct iwl_rx_queue *rxq = &priv->rxq; 969 struct il_rx_queue *rxq = &priv->rxq;
970 struct list_head *element; 970 struct list_head *element;
971 struct iwl_rx_mem_buffer *rxb; 971 struct il_rx_mem_buffer *rxb;
972 unsigned long flags; 972 unsigned long flags;
973 int write; 973 int write;
974 974
975 spin_lock_irqsave(&rxq->lock, flags); 975 spin_lock_irqsave(&rxq->lock, flags);
976 write = rxq->write & ~0x7; 976 write = rxq->write & ~0x7;
977 while ((iwl_legacy_rx_queue_space(rxq) > 0) && (rxq->free_count)) { 977 while ((il_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
978 /* Get next free Rx buffer, remove from free list */ 978 /* Get next free Rx buffer, remove from free list */
979 element = rxq->rx_free.next; 979 element = rxq->rx_free.next;
980 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 980 rxb = list_entry(element, struct il_rx_mem_buffer, list);
981 list_del(element); 981 list_del(element);
982 982
983 /* Point to Rx buffer via next RBD in circular buffer */ 983 /* Point to Rx buffer via next RBD in circular buffer */
984 rxq->bd[rxq->write] = iwl3945_dma_addr2rbd_ptr(priv, rxb->page_dma); 984 rxq->bd[rxq->write] = il3945_dma_addr2rbd_ptr(priv, rxb->page_dma);
985 rxq->queue[rxq->write] = rxb; 985 rxq->queue[rxq->write] = rxb;
986 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; 986 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK;
987 rxq->free_count--; 987 rxq->free_count--;
@@ -1000,23 +1000,23 @@ static void iwl3945_rx_queue_restock(struct iwl_priv *priv)
1000 spin_lock_irqsave(&rxq->lock, flags); 1000 spin_lock_irqsave(&rxq->lock, flags);
1001 rxq->need_update = 1; 1001 rxq->need_update = 1;
1002 spin_unlock_irqrestore(&rxq->lock, flags); 1002 spin_unlock_irqrestore(&rxq->lock, flags);
1003 iwl_legacy_rx_queue_update_write_ptr(priv, rxq); 1003 il_rx_queue_update_write_ptr(priv, rxq);
1004 } 1004 }
1005} 1005}
1006 1006
1007/** 1007/**
1008 * iwl3945_rx_replenish - Move all used packet from rx_used to rx_free 1008 * il3945_rx_replenish - Move all used packet from rx_used to rx_free
1009 * 1009 *
1010 * When moving to rx_free an SKB is allocated for the slot. 1010 * When moving to rx_free an SKB is allocated for the slot.
1011 * 1011 *
1012 * Also restock the Rx queue via iwl3945_rx_queue_restock. 1012 * Also restock the Rx queue via il3945_rx_queue_restock.
1013 * This is called as a scheduled work item (except for during initialization) 1013 * This is called as a scheduled work item (except for during initialization)
1014 */ 1014 */
1015static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority) 1015static void il3945_rx_allocate(struct il_priv *priv, gfp_t priority)
1016{ 1016{
1017 struct iwl_rx_queue *rxq = &priv->rxq; 1017 struct il_rx_queue *rxq = &priv->rxq;
1018 struct list_head *element; 1018 struct list_head *element;
1019 struct iwl_rx_mem_buffer *rxb; 1019 struct il_rx_mem_buffer *rxb;
1020 struct page *page; 1020 struct page *page;
1021 unsigned long flags; 1021 unsigned long flags;
1022 gfp_t gfp_mask = priority; 1022 gfp_t gfp_mask = priority;
@@ -1040,10 +1040,10 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1040 page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order); 1040 page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order);
1041 if (!page) { 1041 if (!page) {
1042 if (net_ratelimit()) 1042 if (net_ratelimit())
1043 IWL_DEBUG_INFO(priv, "Failed to allocate SKB buffer.\n"); 1043 IL_DEBUG_INFO(priv, "Failed to allocate SKB buffer.\n");
1044 if ((rxq->free_count <= RX_LOW_WATERMARK) && 1044 if ((rxq->free_count <= RX_LOW_WATERMARK) &&
1045 net_ratelimit()) 1045 net_ratelimit())
1046 IWL_CRIT(priv, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n", 1046 IL_CRIT(priv, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n",
1047 priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL", 1047 priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL",
1048 rxq->free_count); 1048 rxq->free_count);
1049 /* We don't reschedule replenish work here -- we will 1049 /* We don't reschedule replenish work here -- we will
@@ -1059,7 +1059,7 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1059 return; 1059 return;
1060 } 1060 }
1061 element = rxq->rx_used.next; 1061 element = rxq->rx_used.next;
1062 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 1062 rxb = list_entry(element, struct il_rx_mem_buffer, list);
1063 list_del(element); 1063 list_del(element);
1064 spin_unlock_irqrestore(&rxq->lock, flags); 1064 spin_unlock_irqrestore(&rxq->lock, flags);
1065 1065
@@ -1079,7 +1079,7 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1079 } 1079 }
1080} 1080}
1081 1081
1082void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 1082void il3945_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq)
1083{ 1083{
1084 unsigned long flags; 1084 unsigned long flags;
1085 int i; 1085 int i;
@@ -1094,7 +1094,7 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
1094 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, 1094 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
1095 PAGE_SIZE << priv->hw_params.rx_page_order, 1095 PAGE_SIZE << priv->hw_params.rx_page_order,
1096 PCI_DMA_FROMDEVICE); 1096 PCI_DMA_FROMDEVICE);
1097 __iwl_legacy_free_pages(priv, rxq->pool[i].page); 1097 __il_free_pages(priv, rxq->pool[i].page);
1098 rxq->pool[i].page = NULL; 1098 rxq->pool[i].page = NULL;
1099 } 1099 }
1100 list_add_tail(&rxq->pool[i].list, &rxq->rx_used); 1100 list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
@@ -1108,23 +1108,23 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
1108 spin_unlock_irqrestore(&rxq->lock, flags); 1108 spin_unlock_irqrestore(&rxq->lock, flags);
1109} 1109}
1110 1110
1111void iwl3945_rx_replenish(void *data) 1111void il3945_rx_replenish(void *data)
1112{ 1112{
1113 struct iwl_priv *priv = data; 1113 struct il_priv *priv = data;
1114 unsigned long flags; 1114 unsigned long flags;
1115 1115
1116 iwl3945_rx_allocate(priv, GFP_KERNEL); 1116 il3945_rx_allocate(priv, GFP_KERNEL);
1117 1117
1118 spin_lock_irqsave(&priv->lock, flags); 1118 spin_lock_irqsave(&priv->lock, flags);
1119 iwl3945_rx_queue_restock(priv); 1119 il3945_rx_queue_restock(priv);
1120 spin_unlock_irqrestore(&priv->lock, flags); 1120 spin_unlock_irqrestore(&priv->lock, flags);
1121} 1121}
1122 1122
1123static void iwl3945_rx_replenish_now(struct iwl_priv *priv) 1123static void il3945_rx_replenish_now(struct il_priv *priv)
1124{ 1124{
1125 iwl3945_rx_allocate(priv, GFP_ATOMIC); 1125 il3945_rx_allocate(priv, GFP_ATOMIC);
1126 1126
1127 iwl3945_rx_queue_restock(priv); 1127 il3945_rx_queue_restock(priv);
1128} 1128}
1129 1129
1130 1130
@@ -1133,7 +1133,7 @@ static void iwl3945_rx_replenish_now(struct iwl_priv *priv)
1133 * This free routine walks the list of POOL entries and if SKB is set to 1133 * This free routine walks the list of POOL entries and if SKB is set to
1134 * non NULL it is unmapped and freed 1134 * non NULL it is unmapped and freed
1135 */ 1135 */
1136static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 1136static void il3945_rx_queue_free(struct il_priv *priv, struct il_rx_queue *rxq)
1137{ 1137{
1138 int i; 1138 int i;
1139 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { 1139 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
@@ -1141,14 +1141,14 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx
1141 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, 1141 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
1142 PAGE_SIZE << priv->hw_params.rx_page_order, 1142 PAGE_SIZE << priv->hw_params.rx_page_order,
1143 PCI_DMA_FROMDEVICE); 1143 PCI_DMA_FROMDEVICE);
1144 __iwl_legacy_free_pages(priv, rxq->pool[i].page); 1144 __il_free_pages(priv, rxq->pool[i].page);
1145 rxq->pool[i].page = NULL; 1145 rxq->pool[i].page = NULL;
1146 } 1146 }
1147 } 1147 }
1148 1148
1149 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, 1149 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
1150 rxq->bd_dma); 1150 rxq->bd_dma);
1151 dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status), 1151 dma_free_coherent(&priv->pci_dev->dev, sizeof(struct il_rb_status),
1152 rxq->rb_stts, rxq->rb_stts_dma); 1152 rxq->rb_stts, rxq->rb_stts_dma);
1153 rxq->bd = NULL; 1153 rxq->bd = NULL;
1154 rxq->rb_stts = NULL; 1154 rxq->rb_stts = NULL;
@@ -1173,7 +1173,7 @@ static u8 ratio2dB[100] = {
1173/* Calculates a relative dB value from a ratio of linear 1173/* Calculates a relative dB value from a ratio of linear
1174 * (i.e. not dB) signal levels. 1174 * (i.e. not dB) signal levels.
1175 * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ 1175 * Conversion assumes that levels are voltages (20*log), not powers (10*log). */
1176int iwl3945_calc_db_from_ratio(int sig_ratio) 1176int il3945_calc_db_from_ratio(int sig_ratio)
1177{ 1177{
1178 /* 1000:1 or higher just report as 60 dB */ 1178 /* 1000:1 or higher just report as 60 dB */
1179 if (sig_ratio >= 1000) 1179 if (sig_ratio >= 1000)
@@ -1193,17 +1193,17 @@ int iwl3945_calc_db_from_ratio(int sig_ratio)
1193} 1193}
1194 1194
1195/** 1195/**
1196 * iwl3945_rx_handle - Main entry function for receiving responses from uCode 1196 * il3945_rx_handle - Main entry function for receiving responses from uCode
1197 * 1197 *
1198 * Uses the priv->rx_handlers callback function array to invoke 1198 * Uses the priv->rx_handlers callback function array to invoke
1199 * the appropriate handlers, including command responses, 1199 * the appropriate handlers, including command responses,
1200 * frame-received notifications, and other notifications. 1200 * frame-received notifications, and other notifications.
1201 */ 1201 */
1202static void iwl3945_rx_handle(struct iwl_priv *priv) 1202static void il3945_rx_handle(struct il_priv *priv)
1203{ 1203{
1204 struct iwl_rx_mem_buffer *rxb; 1204 struct il_rx_mem_buffer *rxb;
1205 struct iwl_rx_packet *pkt; 1205 struct il_rx_packet *pkt;
1206 struct iwl_rx_queue *rxq = &priv->rxq; 1206 struct il_rx_queue *rxq = &priv->rxq;
1207 u32 r, i; 1207 u32 r, i;
1208 int reclaim; 1208 int reclaim;
1209 unsigned long flags; 1209 unsigned long flags;
@@ -1225,7 +1225,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1225 fill_rx = 1; 1225 fill_rx = 1;
1226 /* Rx interrupt, but nothing sent from uCode */ 1226 /* Rx interrupt, but nothing sent from uCode */
1227 if (i == r) 1227 if (i == r)
1228 IWL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i); 1228 IL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i);
1229 1229
1230 while (i != r) { 1230 while (i != r) {
1231 int len; 1231 int len;
@@ -1259,17 +1259,17 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1259 1259
1260 /* Based on type of command response or notification, 1260 /* Based on type of command response or notification,
1261 * handle those that need handling via function in 1261 * handle those that need handling via function in
1262 * rx_handlers table. See iwl3945_setup_rx_handlers() */ 1262 * rx_handlers table. See il3945_setup_rx_handlers() */
1263 if (priv->rx_handlers[pkt->hdr.cmd]) { 1263 if (priv->rx_handlers[pkt->hdr.cmd]) {
1264 IWL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, i, 1264 IL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, i,
1265 iwl_legacy_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); 1265 il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd);
1266 priv->isr_stats.rx_handlers[pkt->hdr.cmd]++; 1266 priv->isr_stats.rx_handlers[pkt->hdr.cmd]++;
1267 priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); 1267 priv->rx_handlers[pkt->hdr.cmd] (priv, rxb);
1268 } else { 1268 } else {
1269 /* No handling needed */ 1269 /* No handling needed */
1270 IWL_DEBUG_RX(priv, 1270 IL_DEBUG_RX(priv,
1271 "r %d i %d No handler needed for %s, 0x%02x\n", 1271 "r %d i %d No handler needed for %s, 0x%02x\n",
1272 r, i, iwl_legacy_get_cmd_string(pkt->hdr.cmd), 1272 r, i, il_get_cmd_string(pkt->hdr.cmd),
1273 pkt->hdr.cmd); 1273 pkt->hdr.cmd);
1274 } 1274 }
1275 1275
@@ -1282,12 +1282,12 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1282 1282
1283 if (reclaim) { 1283 if (reclaim) {
1284 /* Invoke any callbacks, transfer the buffer to caller, 1284 /* Invoke any callbacks, transfer the buffer to caller,
1285 * and fire off the (possibly) blocking iwl_legacy_send_cmd() 1285 * and fire off the (possibly) blocking il_send_cmd()
1286 * as we reclaim the driver command queue */ 1286 * as we reclaim the driver command queue */
1287 if (rxb->page) 1287 if (rxb->page)
1288 iwl_legacy_tx_cmd_complete(priv, rxb); 1288 il_tx_cmd_complete(priv, rxb);
1289 else 1289 else
1290 IWL_WARN(priv, "Claim null rxb?\n"); 1290 IL_WARN(priv, "Claim null rxb?\n");
1291 } 1291 }
1292 1292
1293 /* Reuse the page if possible. For notification packets and 1293 /* Reuse the page if possible. For notification packets and
@@ -1312,7 +1312,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1312 count++; 1312 count++;
1313 if (count >= 8) { 1313 if (count >= 8) {
1314 rxq->read = i; 1314 rxq->read = i;
1315 iwl3945_rx_replenish_now(priv); 1315 il3945_rx_replenish_now(priv);
1316 count = 0; 1316 count = 0;
1317 } 1317 }
1318 } 1318 }
@@ -1321,20 +1321,20 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1321 /* Backtrack one entry */ 1321 /* Backtrack one entry */
1322 rxq->read = i; 1322 rxq->read = i;
1323 if (fill_rx) 1323 if (fill_rx)
1324 iwl3945_rx_replenish_now(priv); 1324 il3945_rx_replenish_now(priv);
1325 else 1325 else
1326 iwl3945_rx_queue_restock(priv); 1326 il3945_rx_queue_restock(priv);
1327} 1327}
1328 1328
1329/* call this function to flush any scheduled tasklet */ 1329/* call this function to flush any scheduled tasklet */
1330static inline void iwl3945_synchronize_irq(struct iwl_priv *priv) 1330static inline void il3945_synchronize_irq(struct il_priv *priv)
1331{ 1331{
1332 /* wait to make sure we flush pending tasklet*/ 1332 /* wait to make sure we flush pending tasklet*/
1333 synchronize_irq(priv->pci_dev->irq); 1333 synchronize_irq(priv->pci_dev->irq);
1334 tasklet_kill(&priv->irq_tasklet); 1334 tasklet_kill(&priv->irq_tasklet);
1335} 1335}
1336 1336
1337static const char *iwl3945_desc_lookup(int i) 1337static const char *il3945_desc_lookup(int i)
1338{ 1338{
1339 switch (i) { 1339 switch (i) {
1340 case 1: 1340 case 1:
@@ -1357,7 +1357,7 @@ static const char *iwl3945_desc_lookup(int i)
1357#define ERROR_START_OFFSET (1 * sizeof(u32)) 1357#define ERROR_START_OFFSET (1 * sizeof(u32))
1358#define ERROR_ELEM_SIZE (7 * sizeof(u32)) 1358#define ERROR_ELEM_SIZE (7 * sizeof(u32))
1359 1359
1360void iwl3945_dump_nic_error_log(struct iwl_priv *priv) 1360void il3945_dump_nic_error_log(struct il_priv *priv)
1361{ 1361{
1362 u32 i; 1362 u32 i;
1363 u32 desc, time, count, base, data1; 1363 u32 desc, time, count, base, data1;
@@ -1365,47 +1365,47 @@ void iwl3945_dump_nic_error_log(struct iwl_priv *priv)
1365 1365
1366 base = le32_to_cpu(priv->card_alive.error_event_table_ptr); 1366 base = le32_to_cpu(priv->card_alive.error_event_table_ptr);
1367 1367
1368 if (!iwl3945_hw_valid_rtc_data_addr(base)) { 1368 if (!il3945_hw_valid_rtc_data_addr(base)) {
1369 IWL_ERR(priv, "Not valid error log pointer 0x%08X\n", base); 1369 IL_ERR(priv, "Not valid error log pointer 0x%08X\n", base);
1370 return; 1370 return;
1371 } 1371 }
1372 1372
1373 1373
1374 count = iwl_legacy_read_targ_mem(priv, base); 1374 count = il_read_targ_mem(priv, base);
1375 1375
1376 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { 1376 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
1377 IWL_ERR(priv, "Start IWL Error Log Dump:\n"); 1377 IL_ERR(priv, "Start IWL Error Log Dump:\n");
1378 IWL_ERR(priv, "Status: 0x%08lX, count: %d\n", 1378 IL_ERR(priv, "Status: 0x%08lX, count: %d\n",
1379 priv->status, count); 1379 priv->status, count);
1380 } 1380 }
1381 1381
1382 IWL_ERR(priv, "Desc Time asrtPC blink2 " 1382 IL_ERR(priv, "Desc Time asrtPC blink2 "
1383 "ilink1 nmiPC Line\n"); 1383 "ilink1 nmiPC Line\n");
1384 for (i = ERROR_START_OFFSET; 1384 for (i = ERROR_START_OFFSET;
1385 i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET; 1385 i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET;
1386 i += ERROR_ELEM_SIZE) { 1386 i += ERROR_ELEM_SIZE) {
1387 desc = iwl_legacy_read_targ_mem(priv, base + i); 1387 desc = il_read_targ_mem(priv, base + i);
1388 time = 1388 time =
1389 iwl_legacy_read_targ_mem(priv, base + i + 1 * sizeof(u32)); 1389 il_read_targ_mem(priv, base + i + 1 * sizeof(u32));
1390 blink1 = 1390 blink1 =
1391 iwl_legacy_read_targ_mem(priv, base + i + 2 * sizeof(u32)); 1391 il_read_targ_mem(priv, base + i + 2 * sizeof(u32));
1392 blink2 = 1392 blink2 =
1393 iwl_legacy_read_targ_mem(priv, base + i + 3 * sizeof(u32)); 1393 il_read_targ_mem(priv, base + i + 3 * sizeof(u32));
1394 ilink1 = 1394 ilink1 =
1395 iwl_legacy_read_targ_mem(priv, base + i + 4 * sizeof(u32)); 1395 il_read_targ_mem(priv, base + i + 4 * sizeof(u32));
1396 ilink2 = 1396 ilink2 =
1397 iwl_legacy_read_targ_mem(priv, base + i + 5 * sizeof(u32)); 1397 il_read_targ_mem(priv, base + i + 5 * sizeof(u32));
1398 data1 = 1398 data1 =
1399 iwl_legacy_read_targ_mem(priv, base + i + 6 * sizeof(u32)); 1399 il_read_targ_mem(priv, base + i + 6 * sizeof(u32));
1400 1400
1401 IWL_ERR(priv, 1401 IL_ERR(priv,
1402 "%-13s (0x%X) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n", 1402 "%-13s (0x%X) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n",
1403 iwl3945_desc_lookup(desc), desc, time, blink1, blink2, 1403 il3945_desc_lookup(desc), desc, time, blink1, blink2,
1404 ilink1, ilink2, data1); 1404 ilink1, ilink2, data1);
1405 } 1405 }
1406} 1406}
1407 1407
1408static void iwl3945_irq_tasklet(struct iwl_priv *priv) 1408static void il3945_irq_tasklet(struct il_priv *priv)
1409{ 1409{
1410 u32 inta, handled = 0; 1410 u32 inta, handled = 0;
1411 u32 inta_fh; 1411 u32 inta_fh;
@@ -1419,20 +1419,20 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1419 /* Ack/clear/reset pending uCode interrupts. 1419 /* Ack/clear/reset pending uCode interrupts.
1420 * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, 1420 * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS,
1421 * and will clear only when CSR_FH_INT_STATUS gets cleared. */ 1421 * and will clear only when CSR_FH_INT_STATUS gets cleared. */
1422 inta = iwl_read32(priv, CSR_INT); 1422 inta = il_read32(priv, CSR_INT);
1423 iwl_write32(priv, CSR_INT, inta); 1423 il_write32(priv, CSR_INT, inta);
1424 1424
1425 /* Ack/clear/reset pending flow-handler (DMA) interrupts. 1425 /* Ack/clear/reset pending flow-handler (DMA) interrupts.
1426 * Any new interrupts that happen after this, either while we're 1426 * Any new interrupts that happen after this, either while we're
1427 * in this tasklet, or later, will show up in next ISR/tasklet. */ 1427 * in this tasklet, or later, will show up in next ISR/tasklet. */
1428 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 1428 inta_fh = il_read32(priv, CSR_FH_INT_STATUS);
1429 iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); 1429 il_write32(priv, CSR_FH_INT_STATUS, inta_fh);
1430 1430
1431#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 1431#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
1432 if (iwl_legacy_get_debug_level(priv) & IWL_DL_ISR) { 1432 if (il_get_debug_level(priv) & IL_DL_ISR) {
1433 /* just for debug */ 1433 /* just for debug */
1434 inta_mask = iwl_read32(priv, CSR_INT_MASK); 1434 inta_mask = il_read32(priv, CSR_INT_MASK);
1435 IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 1435 IL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
1436 inta, inta_mask, inta_fh); 1436 inta, inta_mask, inta_fh);
1437 } 1437 }
1438#endif 1438#endif
@@ -1450,13 +1450,13 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1450 1450
1451 /* Now service all interrupt bits discovered above. */ 1451 /* Now service all interrupt bits discovered above. */
1452 if (inta & CSR_INT_BIT_HW_ERR) { 1452 if (inta & CSR_INT_BIT_HW_ERR) {
1453 IWL_ERR(priv, "Hardware error detected. Restarting.\n"); 1453 IL_ERR(priv, "Hardware error detected. Restarting.\n");
1454 1454
1455 /* Tell the device to stop sending interrupts */ 1455 /* Tell the device to stop sending interrupts */
1456 iwl_legacy_disable_interrupts(priv); 1456 il_disable_interrupts(priv);
1457 1457
1458 priv->isr_stats.hw++; 1458 priv->isr_stats.hw++;
1459 iwl_legacy_irq_handle_error(priv); 1459 il_irq_handle_error(priv);
1460 1460
1461 handled |= CSR_INT_BIT_HW_ERR; 1461 handled |= CSR_INT_BIT_HW_ERR;
1462 1462
@@ -1464,17 +1464,17 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1464 } 1464 }
1465 1465
1466#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 1466#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
1467 if (iwl_legacy_get_debug_level(priv) & (IWL_DL_ISR)) { 1467 if (il_get_debug_level(priv) & (IL_DL_ISR)) {
1468 /* NIC fires this, but we don't use it, redundant with WAKEUP */ 1468 /* NIC fires this, but we don't use it, redundant with WAKEUP */
1469 if (inta & CSR_INT_BIT_SCD) { 1469 if (inta & CSR_INT_BIT_SCD) {
1470 IWL_DEBUG_ISR(priv, "Scheduler finished to transmit " 1470 IL_DEBUG_ISR(priv, "Scheduler finished to transmit "
1471 "the frame/frames.\n"); 1471 "the frame/frames.\n");
1472 priv->isr_stats.sch++; 1472 priv->isr_stats.sch++;
1473 } 1473 }
1474 1474
1475 /* Alive notification via Rx interrupt will do the real work */ 1475 /* Alive notification via Rx interrupt will do the real work */
1476 if (inta & CSR_INT_BIT_ALIVE) { 1476 if (inta & CSR_INT_BIT_ALIVE) {
1477 IWL_DEBUG_ISR(priv, "Alive interrupt\n"); 1477 IL_DEBUG_ISR(priv, "Alive interrupt\n");
1478 priv->isr_stats.alive++; 1478 priv->isr_stats.alive++;
1479 } 1479 }
1480 } 1480 }
@@ -1484,23 +1484,23 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1484 1484
1485 /* Error detected by uCode */ 1485 /* Error detected by uCode */
1486 if (inta & CSR_INT_BIT_SW_ERR) { 1486 if (inta & CSR_INT_BIT_SW_ERR) {
1487 IWL_ERR(priv, "Microcode SW error detected. " 1487 IL_ERR(priv, "Microcode SW error detected. "
1488 "Restarting 0x%X.\n", inta); 1488 "Restarting 0x%X.\n", inta);
1489 priv->isr_stats.sw++; 1489 priv->isr_stats.sw++;
1490 iwl_legacy_irq_handle_error(priv); 1490 il_irq_handle_error(priv);
1491 handled |= CSR_INT_BIT_SW_ERR; 1491 handled |= CSR_INT_BIT_SW_ERR;
1492 } 1492 }
1493 1493
1494 /* uCode wakes up after power-down sleep */ 1494 /* uCode wakes up after power-down sleep */
1495 if (inta & CSR_INT_BIT_WAKEUP) { 1495 if (inta & CSR_INT_BIT_WAKEUP) {
1496 IWL_DEBUG_ISR(priv, "Wakeup interrupt\n"); 1496 IL_DEBUG_ISR(priv, "Wakeup interrupt\n");
1497 iwl_legacy_rx_queue_update_write_ptr(priv, &priv->rxq); 1497 il_rx_queue_update_write_ptr(priv, &priv->rxq);
1498 iwl_legacy_txq_update_write_ptr(priv, &priv->txq[0]); 1498 il_txq_update_write_ptr(priv, &priv->txq[0]);
1499 iwl_legacy_txq_update_write_ptr(priv, &priv->txq[1]); 1499 il_txq_update_write_ptr(priv, &priv->txq[1]);
1500 iwl_legacy_txq_update_write_ptr(priv, &priv->txq[2]); 1500 il_txq_update_write_ptr(priv, &priv->txq[2]);
1501 iwl_legacy_txq_update_write_ptr(priv, &priv->txq[3]); 1501 il_txq_update_write_ptr(priv, &priv->txq[3]);
1502 iwl_legacy_txq_update_write_ptr(priv, &priv->txq[4]); 1502 il_txq_update_write_ptr(priv, &priv->txq[4]);
1503 iwl_legacy_txq_update_write_ptr(priv, &priv->txq[5]); 1503 il_txq_update_write_ptr(priv, &priv->txq[5]);
1504 1504
1505 priv->isr_stats.wakeup++; 1505 priv->isr_stats.wakeup++;
1506 handled |= CSR_INT_BIT_WAKEUP; 1506 handled |= CSR_INT_BIT_WAKEUP;
@@ -1510,67 +1510,67 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1510 * Rx "responses" (frame-received notification), and other 1510 * Rx "responses" (frame-received notification), and other
1511 * notifications from uCode come through here*/ 1511 * notifications from uCode come through here*/
1512 if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { 1512 if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) {
1513 iwl3945_rx_handle(priv); 1513 il3945_rx_handle(priv);
1514 priv->isr_stats.rx++; 1514 priv->isr_stats.rx++;
1515 handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); 1515 handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX);
1516 } 1516 }
1517 1517
1518 if (inta & CSR_INT_BIT_FH_TX) { 1518 if (inta & CSR_INT_BIT_FH_TX) {
1519 IWL_DEBUG_ISR(priv, "Tx interrupt\n"); 1519 IL_DEBUG_ISR(priv, "Tx interrupt\n");
1520 priv->isr_stats.tx++; 1520 priv->isr_stats.tx++;
1521 1521
1522 iwl_write32(priv, CSR_FH_INT_STATUS, (1 << 6)); 1522 il_write32(priv, CSR_FH_INT_STATUS, (1 << 6));
1523 iwl_legacy_write_direct32(priv, FH39_TCSR_CREDIT 1523 il_write_direct32(priv, FH39_TCSR_CREDIT
1524 (FH39_SRVC_CHNL), 0x0); 1524 (FH39_SRVC_CHNL), 0x0);
1525 handled |= CSR_INT_BIT_FH_TX; 1525 handled |= CSR_INT_BIT_FH_TX;
1526 } 1526 }
1527 1527
1528 if (inta & ~handled) { 1528 if (inta & ~handled) {
1529 IWL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); 1529 IL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled);
1530 priv->isr_stats.unhandled++; 1530 priv->isr_stats.unhandled++;
1531 } 1531 }
1532 1532
1533 if (inta & ~priv->inta_mask) { 1533 if (inta & ~priv->inta_mask) {
1534 IWL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", 1534 IL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n",
1535 inta & ~priv->inta_mask); 1535 inta & ~priv->inta_mask);
1536 IWL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh); 1536 IL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh);
1537 } 1537 }
1538 1538
1539 /* Re-enable all interrupts */ 1539 /* Re-enable all interrupts */
1540 /* only Re-enable if disabled by irq */ 1540 /* only Re-enable if disabled by irq */
1541 if (test_bit(STATUS_INT_ENABLED, &priv->status)) 1541 if (test_bit(STATUS_INT_ENABLED, &priv->status))
1542 iwl_legacy_enable_interrupts(priv); 1542 il_enable_interrupts(priv);
1543 1543
1544#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 1544#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
1545 if (iwl_legacy_get_debug_level(priv) & (IWL_DL_ISR)) { 1545 if (il_get_debug_level(priv) & (IL_DL_ISR)) {
1546 inta = iwl_read32(priv, CSR_INT); 1546 inta = il_read32(priv, CSR_INT);
1547 inta_mask = iwl_read32(priv, CSR_INT_MASK); 1547 inta_mask = il_read32(priv, CSR_INT_MASK);
1548 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 1548 inta_fh = il_read32(priv, CSR_FH_INT_STATUS);
1549 IWL_DEBUG_ISR(priv, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " 1549 IL_DEBUG_ISR(priv, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, "
1550 "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); 1550 "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags);
1551 } 1551 }
1552#endif 1552#endif
1553} 1553}
1554 1554
1555static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, 1555static int il3945_get_channels_for_scan(struct il_priv *priv,
1556 enum ieee80211_band band, 1556 enum ieee80211_band band,
1557 u8 is_active, u8 n_probes, 1557 u8 is_active, u8 n_probes,
1558 struct iwl3945_scan_channel *scan_ch, 1558 struct il3945_scan_channel *scan_ch,
1559 struct ieee80211_vif *vif) 1559 struct ieee80211_vif *vif)
1560{ 1560{
1561 struct ieee80211_channel *chan; 1561 struct ieee80211_channel *chan;
1562 const struct ieee80211_supported_band *sband; 1562 const struct ieee80211_supported_band *sband;
1563 const struct iwl_channel_info *ch_info; 1563 const struct il_channel_info *ch_info;
1564 u16 passive_dwell = 0; 1564 u16 passive_dwell = 0;
1565 u16 active_dwell = 0; 1565 u16 active_dwell = 0;
1566 int added, i; 1566 int added, i;
1567 1567
1568 sband = iwl_get_hw_mode(priv, band); 1568 sband = il_get_hw_mode(priv, band);
1569 if (!sband) 1569 if (!sband)
1570 return 0; 1570 return 0;
1571 1571
1572 active_dwell = iwl_legacy_get_active_dwell_time(priv, band, n_probes); 1572 active_dwell = il_get_active_dwell_time(priv, band, n_probes);
1573 passive_dwell = iwl_legacy_get_passive_dwell_time(priv, band, vif); 1573 passive_dwell = il_get_passive_dwell_time(priv, band, vif);
1574 1574
1575 if (passive_dwell <= active_dwell) 1575 if (passive_dwell <= active_dwell)
1576 passive_dwell = active_dwell + 1; 1576 passive_dwell = active_dwell + 1;
@@ -1583,10 +1583,10 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
1583 1583
1584 scan_ch->channel = chan->hw_value; 1584 scan_ch->channel = chan->hw_value;
1585 1585
1586 ch_info = iwl_legacy_get_channel_info(priv, band, 1586 ch_info = il_get_channel_info(priv, band,
1587 scan_ch->channel); 1587 scan_ch->channel);
1588 if (!iwl_legacy_is_channel_valid(ch_info)) { 1588 if (!il_is_channel_valid(ch_info)) {
1589 IWL_DEBUG_SCAN(priv, 1589 IL_DEBUG_SCAN(priv,
1590 "Channel %d is INVALID for this band.\n", 1590 "Channel %d is INVALID for this band.\n",
1591 scan_ch->channel); 1591 scan_ch->channel);
1592 continue; 1592 continue;
@@ -1597,10 +1597,10 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
1597 /* If passive , set up for auto-switch 1597 /* If passive , set up for auto-switch
1598 * and use long active_dwell time. 1598 * and use long active_dwell time.
1599 */ 1599 */
1600 if (!is_active || iwl_legacy_is_channel_passive(ch_info) || 1600 if (!is_active || il_is_channel_passive(ch_info) ||
1601 (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) { 1601 (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) {
1602 scan_ch->type = 0; /* passive */ 1602 scan_ch->type = 0; /* passive */
1603 if (IWL_UCODE_API(priv->ucode_ver) == 1) 1603 if (IL_UCODE_API(priv->ucode_ver) == 1)
1604 scan_ch->active_dwell = cpu_to_le16(passive_dwell - 1); 1604 scan_ch->active_dwell = cpu_to_le16(passive_dwell - 1);
1605 } else { 1605 } else {
1606 scan_ch->type = 1; /* active */ 1606 scan_ch->type = 1; /* active */
@@ -1610,7 +1610,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
1610 * scan channels (probes gets sent right away), 1610 * scan channels (probes gets sent right away),
1611 * or for passive channels (probes get se sent only after 1611 * or for passive channels (probes get se sent only after
1612 * hearing clear Rx packet).*/ 1612 * hearing clear Rx packet).*/
1613 if (IWL_UCODE_API(priv->ucode_ver) >= 2) { 1613 if (IL_UCODE_API(priv->ucode_ver) >= 2) {
1614 if (n_probes) 1614 if (n_probes)
1615 scan_ch->type |= IWL39_SCAN_PROBE_MASK(n_probes); 1615 scan_ch->type |= IWL39_SCAN_PROBE_MASK(n_probes);
1616 } else { 1616 } else {
@@ -1635,7 +1635,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
1635 */ 1635 */
1636 } 1636 }
1637 1637
1638 IWL_DEBUG_SCAN(priv, "Scanning %d [%s %d]\n", 1638 IL_DEBUG_SCAN(priv, "Scanning %d [%s %d]\n",
1639 scan_ch->channel, 1639 scan_ch->channel,
1640 (scan_ch->type & 1) ? "ACTIVE" : "PASSIVE", 1640 (scan_ch->type & 1) ? "ACTIVE" : "PASSIVE",
1641 (scan_ch->type & 1) ? 1641 (scan_ch->type & 1) ?
@@ -1645,25 +1645,25 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
1645 added++; 1645 added++;
1646 } 1646 }
1647 1647
1648 IWL_DEBUG_SCAN(priv, "total channels to scan %d\n", added); 1648 IL_DEBUG_SCAN(priv, "total channels to scan %d\n", added);
1649 return added; 1649 return added;
1650} 1650}
1651 1651
1652static void iwl3945_init_hw_rates(struct iwl_priv *priv, 1652static void il3945_init_hw_rates(struct il_priv *priv,
1653 struct ieee80211_rate *rates) 1653 struct ieee80211_rate *rates)
1654{ 1654{
1655 int i; 1655 int i;
1656 1656
1657 for (i = 0; i < IWL_RATE_COUNT_LEGACY; i++) { 1657 for (i = 0; i < IL_RATE_COUNT_LEGACY; i++) {
1658 rates[i].bitrate = iwl3945_rates[i].ieee * 5; 1658 rates[i].bitrate = il3945_rates[i].ieee * 5;
1659 rates[i].hw_value = i; /* Rate scaling will work on indexes */ 1659 rates[i].hw_value = i; /* Rate scaling will work on indexes */
1660 rates[i].hw_value_short = i; 1660 rates[i].hw_value_short = i;
1661 rates[i].flags = 0; 1661 rates[i].flags = 0;
1662 if ((i > IWL39_LAST_OFDM_RATE) || (i < IWL_FIRST_OFDM_RATE)) { 1662 if ((i > IWL39_LAST_OFDM_RATE) || (i < IL_FIRST_OFDM_RATE)) {
1663 /* 1663 /*
1664 * If CCK != 1M then set short preamble rate flag. 1664 * If CCK != 1M then set short preamble rate flag.
1665 */ 1665 */
1666 rates[i].flags |= (iwl3945_rates[i].plcp == 10) ? 1666 rates[i].flags |= (il3945_rates[i].plcp == 10) ?
1667 0 : IEEE80211_RATE_SHORT_PREAMBLE; 1667 0 : IEEE80211_RATE_SHORT_PREAMBLE;
1668 } 1668 }
1669 } 1669 }
@@ -1675,40 +1675,40 @@ static void iwl3945_init_hw_rates(struct iwl_priv *priv,
1675 * 1675 *
1676 ******************************************************************************/ 1676 ******************************************************************************/
1677 1677
1678static void iwl3945_dealloc_ucode_pci(struct iwl_priv *priv) 1678static void il3945_dealloc_ucode_pci(struct il_priv *priv)
1679{ 1679{
1680 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_code); 1680 il_free_fw_desc(priv->pci_dev, &priv->ucode_code);
1681 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_data); 1681 il_free_fw_desc(priv->pci_dev, &priv->ucode_data);
1682 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); 1682 il_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
1683 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_init); 1683 il_free_fw_desc(priv->pci_dev, &priv->ucode_init);
1684 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); 1684 il_free_fw_desc(priv->pci_dev, &priv->ucode_init_data);
1685 iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_boot); 1685 il_free_fw_desc(priv->pci_dev, &priv->ucode_boot);
1686} 1686}
1687 1687
1688/** 1688/**
1689 * iwl3945_verify_inst_full - verify runtime uCode image in card vs. host, 1689 * il3945_verify_inst_full - verify runtime uCode image in card vs. host,
1690 * looking at all data. 1690 * looking at all data.
1691 */ 1691 */
1692static int iwl3945_verify_inst_full(struct iwl_priv *priv, __le32 *image, u32 len) 1692static int il3945_verify_inst_full(struct il_priv *priv, __le32 *image, u32 len)
1693{ 1693{
1694 u32 val; 1694 u32 val;
1695 u32 save_len = len; 1695 u32 save_len = len;
1696 int rc = 0; 1696 int rc = 0;
1697 u32 errcnt; 1697 u32 errcnt;
1698 1698
1699 IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); 1699 IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len);
1700 1700
1701 iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, 1701 il_write_direct32(priv, HBUS_TARG_MEM_RADDR,
1702 IWL39_RTC_INST_LOWER_BOUND); 1702 IWL39_RTC_INST_LOWER_BOUND);
1703 1703
1704 errcnt = 0; 1704 errcnt = 0;
1705 for (; len > 0; len -= sizeof(u32), image++) { 1705 for (; len > 0; len -= sizeof(u32), image++) {
1706 /* read data comes through single port, auto-incr addr */ 1706 /* read data comes through single port, auto-incr addr */
1707 /* NOTE: Use the debugless read so we don't flood kernel log 1707 /* NOTE: Use the debugless read so we don't flood kernel log
1708 * if IWL_DL_IO is set */ 1708 * if IL_DL_IO is set */
1709 val = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); 1709 val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT);
1710 if (val != le32_to_cpu(*image)) { 1710 if (val != le32_to_cpu(*image)) {
1711 IWL_ERR(priv, "uCode INST section is invalid at " 1711 IL_ERR(priv, "uCode INST section is invalid at "
1712 "offset 0x%x, is 0x%x, s/b 0x%x\n", 1712 "offset 0x%x, is 0x%x, s/b 0x%x\n",
1713 save_len - len, val, le32_to_cpu(*image)); 1713 save_len - len, val, le32_to_cpu(*image));
1714 rc = -EIO; 1714 rc = -EIO;
@@ -1720,7 +1720,7 @@ static int iwl3945_verify_inst_full(struct iwl_priv *priv, __le32 *image, u32 le
1720 1720
1721 1721
1722 if (!errcnt) 1722 if (!errcnt)
1723 IWL_DEBUG_INFO(priv, 1723 IL_DEBUG_INFO(priv,
1724 "ucode image in INSTRUCTION memory is good\n"); 1724 "ucode image in INSTRUCTION memory is good\n");
1725 1725
1726 return rc; 1726 return rc;
@@ -1728,29 +1728,29 @@ static int iwl3945_verify_inst_full(struct iwl_priv *priv, __le32 *image, u32 le
1728 1728
1729 1729
1730/** 1730/**
1731 * iwl3945_verify_inst_sparse - verify runtime uCode image in card vs. host, 1731 * il3945_verify_inst_sparse - verify runtime uCode image in card vs. host,
1732 * using sample data 100 bytes apart. If these sample points are good, 1732 * using sample data 100 bytes apart. If these sample points are good,
1733 * it's a pretty good bet that everything between them is good, too. 1733 * it's a pretty good bet that everything between them is good, too.
1734 */ 1734 */
1735static int iwl3945_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) 1735static int il3945_verify_inst_sparse(struct il_priv *priv, __le32 *image, u32 len)
1736{ 1736{
1737 u32 val; 1737 u32 val;
1738 int rc = 0; 1738 int rc = 0;
1739 u32 errcnt = 0; 1739 u32 errcnt = 0;
1740 u32 i; 1740 u32 i;
1741 1741
1742 IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); 1742 IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len);
1743 1743
1744 for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { 1744 for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) {
1745 /* read data comes through single port, auto-incr addr */ 1745 /* read data comes through single port, auto-incr addr */
1746 /* NOTE: Use the debugless read so we don't flood kernel log 1746 /* NOTE: Use the debugless read so we don't flood kernel log
1747 * if IWL_DL_IO is set */ 1747 * if IL_DL_IO is set */
1748 iwl_legacy_write_direct32(priv, HBUS_TARG_MEM_RADDR, 1748 il_write_direct32(priv, HBUS_TARG_MEM_RADDR,
1749 i + IWL39_RTC_INST_LOWER_BOUND); 1749 i + IWL39_RTC_INST_LOWER_BOUND);
1750 val = _iwl_legacy_read_direct32(priv, HBUS_TARG_MEM_RDAT); 1750 val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT);
1751 if (val != le32_to_cpu(*image)) { 1751 if (val != le32_to_cpu(*image)) {
1752#if 0 /* Enable this if you want to see details */ 1752#if 0 /* Enable this if you want to see details */
1753 IWL_ERR(priv, "uCode INST section is invalid at " 1753 IL_ERR(priv, "uCode INST section is invalid at "
1754 "offset 0x%x, is 0x%x, s/b 0x%x\n", 1754 "offset 0x%x, is 0x%x, s/b 0x%x\n",
1755 i, val, *image); 1755 i, val, *image);
1756#endif 1756#endif
@@ -1766,10 +1766,10 @@ static int iwl3945_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32
1766 1766
1767 1767
1768/** 1768/**
1769 * iwl3945_verify_ucode - determine which instruction image is in SRAM, 1769 * il3945_verify_ucode - determine which instruction image is in SRAM,
1770 * and verify its contents 1770 * and verify its contents
1771 */ 1771 */
1772static int iwl3945_verify_ucode(struct iwl_priv *priv) 1772static int il3945_verify_ucode(struct il_priv *priv)
1773{ 1773{
1774 __le32 *image; 1774 __le32 *image;
1775 u32 len; 1775 u32 len;
@@ -1778,60 +1778,60 @@ static int iwl3945_verify_ucode(struct iwl_priv *priv)
1778 /* Try bootstrap */ 1778 /* Try bootstrap */
1779 image = (__le32 *)priv->ucode_boot.v_addr; 1779 image = (__le32 *)priv->ucode_boot.v_addr;
1780 len = priv->ucode_boot.len; 1780 len = priv->ucode_boot.len;
1781 rc = iwl3945_verify_inst_sparse(priv, image, len); 1781 rc = il3945_verify_inst_sparse(priv, image, len);
1782 if (rc == 0) { 1782 if (rc == 0) {
1783 IWL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n"); 1783 IL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n");
1784 return 0; 1784 return 0;
1785 } 1785 }
1786 1786
1787 /* Try initialize */ 1787 /* Try initialize */
1788 image = (__le32 *)priv->ucode_init.v_addr; 1788 image = (__le32 *)priv->ucode_init.v_addr;
1789 len = priv->ucode_init.len; 1789 len = priv->ucode_init.len;
1790 rc = iwl3945_verify_inst_sparse(priv, image, len); 1790 rc = il3945_verify_inst_sparse(priv, image, len);
1791 if (rc == 0) { 1791 if (rc == 0) {
1792 IWL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n"); 1792 IL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n");
1793 return 0; 1793 return 0;
1794 } 1794 }
1795 1795
1796 /* Try runtime/protocol */ 1796 /* Try runtime/protocol */
1797 image = (__le32 *)priv->ucode_code.v_addr; 1797 image = (__le32 *)priv->ucode_code.v_addr;
1798 len = priv->ucode_code.len; 1798 len = priv->ucode_code.len;
1799 rc = iwl3945_verify_inst_sparse(priv, image, len); 1799 rc = il3945_verify_inst_sparse(priv, image, len);
1800 if (rc == 0) { 1800 if (rc == 0) {
1801 IWL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n"); 1801 IL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n");
1802 return 0; 1802 return 0;
1803 } 1803 }
1804 1804
1805 IWL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); 1805 IL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");
1806 1806
1807 /* Since nothing seems to match, show first several data entries in 1807 /* Since nothing seems to match, show first several data entries in
1808 * instruction SRAM, so maybe visual inspection will give a clue. 1808 * instruction SRAM, so maybe visual inspection will give a clue.
1809 * Selection of bootstrap image (vs. other images) is arbitrary. */ 1809 * Selection of bootstrap image (vs. other images) is arbitrary. */
1810 image = (__le32 *)priv->ucode_boot.v_addr; 1810 image = (__le32 *)priv->ucode_boot.v_addr;
1811 len = priv->ucode_boot.len; 1811 len = priv->ucode_boot.len;
1812 rc = iwl3945_verify_inst_full(priv, image, len); 1812 rc = il3945_verify_inst_full(priv, image, len);
1813 1813
1814 return rc; 1814 return rc;
1815} 1815}
1816 1816
1817static void iwl3945_nic_start(struct iwl_priv *priv) 1817static void il3945_nic_start(struct il_priv *priv)
1818{ 1818{
1819 /* Remove all resets to allow NIC to operate */ 1819 /* Remove all resets to allow NIC to operate */
1820 iwl_write32(priv, CSR_RESET, 0); 1820 il_write32(priv, CSR_RESET, 0);
1821} 1821}
1822 1822
1823#define IWL3945_UCODE_GET(item) \ 1823#define IWL3945_UCODE_GET(item) \
1824static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode)\ 1824static u32 il3945_ucode_get_##item(const struct il_ucode_header *ucode)\
1825{ \ 1825{ \
1826 return le32_to_cpu(ucode->v1.item); \ 1826 return le32_to_cpu(ucode->v1.item); \
1827} 1827}
1828 1828
1829static u32 iwl3945_ucode_get_header_size(u32 api_ver) 1829static u32 il3945_ucode_get_header_size(u32 api_ver)
1830{ 1830{
1831 return 24; 1831 return 24;
1832} 1832}
1833 1833
1834static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode) 1834static u8 *il3945_ucode_get_data(const struct il_ucode_header *ucode)
1835{ 1835{
1836 return (u8 *) ucode->v1.data; 1836 return (u8 *) ucode->v1.data;
1837} 1837}
@@ -1843,13 +1843,13 @@ IWL3945_UCODE_GET(init_data_size);
1843IWL3945_UCODE_GET(boot_size); 1843IWL3945_UCODE_GET(boot_size);
1844 1844
1845/** 1845/**
1846 * iwl3945_read_ucode - Read uCode images from disk file. 1846 * il3945_read_ucode - Read uCode images from disk file.
1847 * 1847 *
1848 * Copy into buffers for card to fetch via bus-mastering 1848 * Copy into buffers for card to fetch via bus-mastering
1849 */ 1849 */
1850static int iwl3945_read_ucode(struct iwl_priv *priv) 1850static int il3945_read_ucode(struct il_priv *priv)
1851{ 1851{
1852 const struct iwl_ucode_header *ucode; 1852 const struct il_ucode_header *ucode;
1853 int ret = -EINVAL, index; 1853 int ret = -EINVAL, index;
1854 const struct firmware *ucode_raw; 1854 const struct firmware *ucode_raw;
1855 /* firmware file name contains uCode/driver compatibility version */ 1855 /* firmware file name contains uCode/driver compatibility version */
@@ -1867,7 +1867,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
1867 sprintf(buf, "%s%u%s", name_pre, index, ".ucode"); 1867 sprintf(buf, "%s%u%s", name_pre, index, ".ucode");
1868 ret = request_firmware(&ucode_raw, buf, &priv->pci_dev->dev); 1868 ret = request_firmware(&ucode_raw, buf, &priv->pci_dev->dev);
1869 if (ret < 0) { 1869 if (ret < 0) {
1870 IWL_ERR(priv, "%s firmware file req failed: %d\n", 1870 IL_ERR(priv, "%s firmware file req failed: %d\n",
1871 buf, ret); 1871 buf, ret);
1872 if (ret == -ENOENT) 1872 if (ret == -ENOENT)
1873 continue; 1873 continue;
@@ -1875,11 +1875,11 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
1875 goto error; 1875 goto error;
1876 } else { 1876 } else {
1877 if (index < api_max) 1877 if (index < api_max)
1878 IWL_ERR(priv, "Loaded firmware %s, " 1878 IL_ERR(priv, "Loaded firmware %s, "
1879 "which is deprecated. " 1879 "which is deprecated. "
1880 " Please use API v%u instead.\n", 1880 " Please use API v%u instead.\n",
1881 buf, api_max); 1881 buf, api_max);
1882 IWL_DEBUG_INFO(priv, "Got firmware '%s' file " 1882 IL_DEBUG_INFO(priv, "Got firmware '%s' file "
1883 "(%zd bytes) from disk\n", 1883 "(%zd bytes) from disk\n",
1884 buf, ucode_raw->size); 1884 buf, ucode_raw->size);
1885 break; 1885 break;
@@ -1890,30 +1890,30 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
1890 goto error; 1890 goto error;
1891 1891
1892 /* Make sure that we got at least our header! */ 1892 /* Make sure that we got at least our header! */
1893 if (ucode_raw->size < iwl3945_ucode_get_header_size(1)) { 1893 if (ucode_raw->size < il3945_ucode_get_header_size(1)) {
1894 IWL_ERR(priv, "File size way too small!\n"); 1894 IL_ERR(priv, "File size way too small!\n");
1895 ret = -EINVAL; 1895 ret = -EINVAL;
1896 goto err_release; 1896 goto err_release;
1897 } 1897 }
1898 1898
1899 /* Data from ucode file: header followed by uCode images */ 1899 /* Data from ucode file: header followed by uCode images */
1900 ucode = (struct iwl_ucode_header *)ucode_raw->data; 1900 ucode = (struct il_ucode_header *)ucode_raw->data;
1901 1901
1902 priv->ucode_ver = le32_to_cpu(ucode->ver); 1902 priv->ucode_ver = le32_to_cpu(ucode->ver);
1903 api_ver = IWL_UCODE_API(priv->ucode_ver); 1903 api_ver = IL_UCODE_API(priv->ucode_ver);
1904 inst_size = iwl3945_ucode_get_inst_size(ucode); 1904 inst_size = il3945_ucode_get_inst_size(ucode);
1905 data_size = iwl3945_ucode_get_data_size(ucode); 1905 data_size = il3945_ucode_get_data_size(ucode);
1906 init_size = iwl3945_ucode_get_init_size(ucode); 1906 init_size = il3945_ucode_get_init_size(ucode);
1907 init_data_size = iwl3945_ucode_get_init_data_size(ucode); 1907 init_data_size = il3945_ucode_get_init_data_size(ucode);
1908 boot_size = iwl3945_ucode_get_boot_size(ucode); 1908 boot_size = il3945_ucode_get_boot_size(ucode);
1909 src = iwl3945_ucode_get_data(ucode); 1909 src = il3945_ucode_get_data(ucode);
1910 1910
1911 /* api_ver should match the api version forming part of the 1911 /* api_ver should match the api version forming part of the
1912 * firmware filename ... but we don't check for that and only rely 1912 * firmware filename ... but we don't check for that and only rely
1913 * on the API version read from firmware header from here on forward */ 1913 * on the API version read from firmware header from here on forward */
1914 1914
1915 if (api_ver < api_min || api_ver > api_max) { 1915 if (api_ver < api_min || api_ver > api_max) {
1916 IWL_ERR(priv, "Driver unable to support your firmware API. " 1916 IL_ERR(priv, "Driver unable to support your firmware API. "
1917 "Driver supports v%u, firmware is v%u.\n", 1917 "Driver supports v%u, firmware is v%u.\n",
1918 api_max, api_ver); 1918 api_max, api_ver);
1919 priv->ucode_ver = 0; 1919 priv->ucode_ver = 0;
@@ -1921,45 +1921,45 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
1921 goto err_release; 1921 goto err_release;
1922 } 1922 }
1923 if (api_ver != api_max) 1923 if (api_ver != api_max)
1924 IWL_ERR(priv, "Firmware has old API version. Expected %u, " 1924 IL_ERR(priv, "Firmware has old API version. Expected %u, "
1925 "got %u. New firmware can be obtained " 1925 "got %u. New firmware can be obtained "
1926 "from http://www.intellinuxwireless.org.\n", 1926 "from http://www.intellinuxwireless.org.\n",
1927 api_max, api_ver); 1927 api_max, api_ver);
1928 1928
1929 IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n", 1929 IL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n",
1930 IWL_UCODE_MAJOR(priv->ucode_ver), 1930 IL_UCODE_MAJOR(priv->ucode_ver),
1931 IWL_UCODE_MINOR(priv->ucode_ver), 1931 IL_UCODE_MINOR(priv->ucode_ver),
1932 IWL_UCODE_API(priv->ucode_ver), 1932 IL_UCODE_API(priv->ucode_ver),
1933 IWL_UCODE_SERIAL(priv->ucode_ver)); 1933 IL_UCODE_SERIAL(priv->ucode_ver));
1934 1934
1935 snprintf(priv->hw->wiphy->fw_version, 1935 snprintf(priv->hw->wiphy->fw_version,
1936 sizeof(priv->hw->wiphy->fw_version), 1936 sizeof(priv->hw->wiphy->fw_version),
1937 "%u.%u.%u.%u", 1937 "%u.%u.%u.%u",
1938 IWL_UCODE_MAJOR(priv->ucode_ver), 1938 IL_UCODE_MAJOR(priv->ucode_ver),
1939 IWL_UCODE_MINOR(priv->ucode_ver), 1939 IL_UCODE_MINOR(priv->ucode_ver),
1940 IWL_UCODE_API(priv->ucode_ver), 1940 IL_UCODE_API(priv->ucode_ver),
1941 IWL_UCODE_SERIAL(priv->ucode_ver)); 1941 IL_UCODE_SERIAL(priv->ucode_ver));
1942 1942
1943 IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", 1943 IL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n",
1944 priv->ucode_ver); 1944 priv->ucode_ver);
1945 IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %u\n", 1945 IL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %u\n",
1946 inst_size); 1946 inst_size);
1947 IWL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %u\n", 1947 IL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %u\n",
1948 data_size); 1948 data_size);
1949 IWL_DEBUG_INFO(priv, "f/w package hdr init inst size = %u\n", 1949 IL_DEBUG_INFO(priv, "f/w package hdr init inst size = %u\n",
1950 init_size); 1950 init_size);
1951 IWL_DEBUG_INFO(priv, "f/w package hdr init data size = %u\n", 1951 IL_DEBUG_INFO(priv, "f/w package hdr init data size = %u\n",
1952 init_data_size); 1952 init_data_size);
1953 IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n", 1953 IL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n",
1954 boot_size); 1954 boot_size);
1955 1955
1956 1956
1957 /* Verify size of file vs. image size info in file's header */ 1957 /* Verify size of file vs. image size info in file's header */
1958 if (ucode_raw->size != iwl3945_ucode_get_header_size(api_ver) + 1958 if (ucode_raw->size != il3945_ucode_get_header_size(api_ver) +
1959 inst_size + data_size + init_size + 1959 inst_size + data_size + init_size +
1960 init_data_size + boot_size) { 1960 init_data_size + boot_size) {
1961 1961
1962 IWL_DEBUG_INFO(priv, 1962 IL_DEBUG_INFO(priv,
1963 "uCode file size %zd does not match expected size\n", 1963 "uCode file size %zd does not match expected size\n",
1964 ucode_raw->size); 1964 ucode_raw->size);
1965 ret = -EINVAL; 1965 ret = -EINVAL;
@@ -1968,34 +1968,34 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
1968 1968
1969 /* Verify that uCode images will fit in card's SRAM */ 1969 /* Verify that uCode images will fit in card's SRAM */
1970 if (inst_size > IWL39_MAX_INST_SIZE) { 1970 if (inst_size > IWL39_MAX_INST_SIZE) {
1971 IWL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n", 1971 IL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n",
1972 inst_size); 1972 inst_size);
1973 ret = -EINVAL; 1973 ret = -EINVAL;
1974 goto err_release; 1974 goto err_release;
1975 } 1975 }
1976 1976
1977 if (data_size > IWL39_MAX_DATA_SIZE) { 1977 if (data_size > IWL39_MAX_DATA_SIZE) {
1978 IWL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n", 1978 IL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n",
1979 data_size); 1979 data_size);
1980 ret = -EINVAL; 1980 ret = -EINVAL;
1981 goto err_release; 1981 goto err_release;
1982 } 1982 }
1983 if (init_size > IWL39_MAX_INST_SIZE) { 1983 if (init_size > IWL39_MAX_INST_SIZE) {
1984 IWL_DEBUG_INFO(priv, 1984 IL_DEBUG_INFO(priv,
1985 "uCode init instr len %d too large to fit in\n", 1985 "uCode init instr len %d too large to fit in\n",
1986 init_size); 1986 init_size);
1987 ret = -EINVAL; 1987 ret = -EINVAL;
1988 goto err_release; 1988 goto err_release;
1989 } 1989 }
1990 if (init_data_size > IWL39_MAX_DATA_SIZE) { 1990 if (init_data_size > IWL39_MAX_DATA_SIZE) {
1991 IWL_DEBUG_INFO(priv, 1991 IL_DEBUG_INFO(priv,
1992 "uCode init data len %d too large to fit in\n", 1992 "uCode init data len %d too large to fit in\n",
1993 init_data_size); 1993 init_data_size);
1994 ret = -EINVAL; 1994 ret = -EINVAL;
1995 goto err_release; 1995 goto err_release;
1996 } 1996 }
1997 if (boot_size > IWL39_MAX_BSM_SIZE) { 1997 if (boot_size > IWL39_MAX_BSM_SIZE) {
1998 IWL_DEBUG_INFO(priv, 1998 IL_DEBUG_INFO(priv,
1999 "uCode boot instr len %d too large to fit in\n", 1999 "uCode boot instr len %d too large to fit in\n",
2000 boot_size); 2000 boot_size);
2001 ret = -EINVAL; 2001 ret = -EINVAL;
@@ -2008,13 +2008,13 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2008 * 1) unmodified from disk 2008 * 1) unmodified from disk
2009 * 2) backup cache for save/restore during power-downs */ 2009 * 2) backup cache for save/restore during power-downs */
2010 priv->ucode_code.len = inst_size; 2010 priv->ucode_code.len = inst_size;
2011 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); 2011 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_code);
2012 2012
2013 priv->ucode_data.len = data_size; 2013 priv->ucode_data.len = data_size;
2014 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); 2014 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data);
2015 2015
2016 priv->ucode_data_backup.len = data_size; 2016 priv->ucode_data_backup.len = data_size;
2017 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); 2017 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
2018 2018
2019 if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || 2019 if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr ||
2020 !priv->ucode_data_backup.v_addr) 2020 !priv->ucode_data_backup.v_addr)
@@ -2023,10 +2023,10 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2023 /* Initialization instructions and data */ 2023 /* Initialization instructions and data */
2024 if (init_size && init_data_size) { 2024 if (init_size && init_data_size) {
2025 priv->ucode_init.len = init_size; 2025 priv->ucode_init.len = init_size;
2026 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); 2026 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init);
2027 2027
2028 priv->ucode_init_data.len = init_data_size; 2028 priv->ucode_init_data.len = init_data_size;
2029 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); 2029 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data);
2030 2030
2031 if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) 2031 if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr)
2032 goto err_pci_alloc; 2032 goto err_pci_alloc;
@@ -2035,7 +2035,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2035 /* Bootstrap (instructions only, no data) */ 2035 /* Bootstrap (instructions only, no data) */
2036 if (boot_size) { 2036 if (boot_size) {
2037 priv->ucode_boot.len = boot_size; 2037 priv->ucode_boot.len = boot_size;
2038 iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); 2038 il_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot);
2039 2039
2040 if (!priv->ucode_boot.v_addr) 2040 if (!priv->ucode_boot.v_addr)
2041 goto err_pci_alloc; 2041 goto err_pci_alloc;
@@ -2045,18 +2045,18 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2045 2045
2046 /* Runtime instructions (first block of data in file) */ 2046 /* Runtime instructions (first block of data in file) */
2047 len = inst_size; 2047 len = inst_size;
2048 IWL_DEBUG_INFO(priv, 2048 IL_DEBUG_INFO(priv,
2049 "Copying (but not loading) uCode instr len %zd\n", len); 2049 "Copying (but not loading) uCode instr len %zd\n", len);
2050 memcpy(priv->ucode_code.v_addr, src, len); 2050 memcpy(priv->ucode_code.v_addr, src, len);
2051 src += len; 2051 src += len;
2052 2052
2053 IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", 2053 IL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n",
2054 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); 2054 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr);
2055 2055
2056 /* Runtime data (2nd block) 2056 /* Runtime data (2nd block)
2057 * NOTE: Copy into backup buffer will be done in iwl3945_up() */ 2057 * NOTE: Copy into backup buffer will be done in il3945_up() */
2058 len = data_size; 2058 len = data_size;
2059 IWL_DEBUG_INFO(priv, 2059 IL_DEBUG_INFO(priv,
2060 "Copying (but not loading) uCode data len %zd\n", len); 2060 "Copying (but not loading) uCode data len %zd\n", len);
2061 memcpy(priv->ucode_data.v_addr, src, len); 2061 memcpy(priv->ucode_data.v_addr, src, len);
2062 memcpy(priv->ucode_data_backup.v_addr, src, len); 2062 memcpy(priv->ucode_data_backup.v_addr, src, len);
@@ -2065,7 +2065,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2065 /* Initialization instructions (3rd block) */ 2065 /* Initialization instructions (3rd block) */
2066 if (init_size) { 2066 if (init_size) {
2067 len = init_size; 2067 len = init_size;
2068 IWL_DEBUG_INFO(priv, 2068 IL_DEBUG_INFO(priv,
2069 "Copying (but not loading) init instr len %zd\n", len); 2069 "Copying (but not loading) init instr len %zd\n", len);
2070 memcpy(priv->ucode_init.v_addr, src, len); 2070 memcpy(priv->ucode_init.v_addr, src, len);
2071 src += len; 2071 src += len;
@@ -2074,7 +2074,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2074 /* Initialization data (4th block) */ 2074 /* Initialization data (4th block) */
2075 if (init_data_size) { 2075 if (init_data_size) {
2076 len = init_data_size; 2076 len = init_data_size;
2077 IWL_DEBUG_INFO(priv, 2077 IL_DEBUG_INFO(priv,
2078 "Copying (but not loading) init data len %zd\n", len); 2078 "Copying (but not loading) init data len %zd\n", len);
2079 memcpy(priv->ucode_init_data.v_addr, src, len); 2079 memcpy(priv->ucode_init_data.v_addr, src, len);
2080 src += len; 2080 src += len;
@@ -2082,7 +2082,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2082 2082
2083 /* Bootstrap instructions (5th block) */ 2083 /* Bootstrap instructions (5th block) */
2084 len = boot_size; 2084 len = boot_size;
2085 IWL_DEBUG_INFO(priv, 2085 IL_DEBUG_INFO(priv,
2086 "Copying (but not loading) boot instr len %zd\n", len); 2086 "Copying (but not loading) boot instr len %zd\n", len);
2087 memcpy(priv->ucode_boot.v_addr, src, len); 2087 memcpy(priv->ucode_boot.v_addr, src, len);
2088 2088
@@ -2091,9 +2091,9 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2091 return 0; 2091 return 0;
2092 2092
2093 err_pci_alloc: 2093 err_pci_alloc:
2094 IWL_ERR(priv, "failed to allocate pci memory\n"); 2094 IL_ERR(priv, "failed to allocate pci memory\n");
2095 ret = -ENOMEM; 2095 ret = -ENOMEM;
2096 iwl3945_dealloc_ucode_pci(priv); 2096 il3945_dealloc_ucode_pci(priv);
2097 2097
2098 err_release: 2098 err_release:
2099 release_firmware(ucode_raw); 2099 release_firmware(ucode_raw);
@@ -2104,7 +2104,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2104 2104
2105 2105
2106/** 2106/**
2107 * iwl3945_set_ucode_ptrs - Set uCode address location 2107 * il3945_set_ucode_ptrs - Set uCode address location
2108 * 2108 *
2109 * Tell initialization uCode where to find runtime uCode. 2109 * Tell initialization uCode where to find runtime uCode.
2110 * 2110 *
@@ -2112,7 +2112,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
2112 * We need to replace them to load runtime uCode inst and data, 2112 * We need to replace them to load runtime uCode inst and data,
2113 * and to save runtime data when powering down. 2113 * and to save runtime data when powering down.
2114 */ 2114 */
2115static int iwl3945_set_ucode_ptrs(struct iwl_priv *priv) 2115static int il3945_set_ucode_ptrs(struct il_priv *priv)
2116{ 2116{
2117 dma_addr_t pinst; 2117 dma_addr_t pinst;
2118 dma_addr_t pdata; 2118 dma_addr_t pdata;
@@ -2122,56 +2122,56 @@ static int iwl3945_set_ucode_ptrs(struct iwl_priv *priv)
2122 pdata = priv->ucode_data_backup.p_addr; 2122 pdata = priv->ucode_data_backup.p_addr;
2123 2123
2124 /* Tell bootstrap uCode where to find image to load */ 2124 /* Tell bootstrap uCode where to find image to load */
2125 iwl_legacy_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); 2125 il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
2126 iwl_legacy_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); 2126 il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
2127 iwl_legacy_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, 2127 il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG,
2128 priv->ucode_data.len); 2128 priv->ucode_data.len);
2129 2129
2130 /* Inst byte count must be last to set up, bit 31 signals uCode 2130 /* Inst byte count must be last to set up, bit 31 signals uCode
2131 * that all new ptr/size info is in place */ 2131 * that all new ptr/size info is in place */
2132 iwl_legacy_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, 2132 il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG,
2133 priv->ucode_code.len | BSM_DRAM_INST_LOAD); 2133 priv->ucode_code.len | BSM_DRAM_INST_LOAD);
2134 2134
2135 IWL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n"); 2135 IL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n");
2136 2136
2137 return 0; 2137 return 0;
2138} 2138}
2139 2139
2140/** 2140/**
2141 * iwl3945_init_alive_start - Called after REPLY_ALIVE notification received 2141 * il3945_init_alive_start - Called after REPLY_ALIVE notification received
2142 * 2142 *
2143 * Called after REPLY_ALIVE notification received from "initialize" uCode. 2143 * Called after REPLY_ALIVE notification received from "initialize" uCode.
2144 * 2144 *
2145 * Tell "initialize" uCode to go ahead and load the runtime uCode. 2145 * Tell "initialize" uCode to go ahead and load the runtime uCode.
2146 */ 2146 */
2147static void iwl3945_init_alive_start(struct iwl_priv *priv) 2147static void il3945_init_alive_start(struct il_priv *priv)
2148{ 2148{
2149 /* Check alive response for "valid" sign from uCode */ 2149 /* Check alive response for "valid" sign from uCode */
2150 if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { 2150 if (priv->card_alive_init.is_valid != UCODE_VALID_OK) {
2151 /* We had an error bringing up the hardware, so take it 2151 /* We had an error bringing up the hardware, so take it
2152 * all the way back down so we can try again */ 2152 * all the way back down so we can try again */
2153 IWL_DEBUG_INFO(priv, "Initialize Alive failed.\n"); 2153 IL_DEBUG_INFO(priv, "Initialize Alive failed.\n");
2154 goto restart; 2154 goto restart;
2155 } 2155 }
2156 2156
2157 /* Bootstrap uCode has loaded initialize uCode ... verify inst image. 2157 /* Bootstrap uCode has loaded initialize uCode ... verify inst image.
2158 * This is a paranoid check, because we would not have gotten the 2158 * This is a paranoid check, because we would not have gotten the
2159 * "initialize" alive if code weren't properly loaded. */ 2159 * "initialize" alive if code weren't properly loaded. */
2160 if (iwl3945_verify_ucode(priv)) { 2160 if (il3945_verify_ucode(priv)) {
2161 /* Runtime instruction load was bad; 2161 /* Runtime instruction load was bad;
2162 * take it all the way back down so we can try again */ 2162 * take it all the way back down so we can try again */
2163 IWL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n"); 2163 IL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n");
2164 goto restart; 2164 goto restart;
2165 } 2165 }
2166 2166
2167 /* Send pointers to protocol/runtime uCode image ... init code will 2167 /* Send pointers to protocol/runtime uCode image ... init code will
2168 * load and launch runtime uCode, which will send us another "Alive" 2168 * load and launch runtime uCode, which will send us another "Alive"
2169 * notification. */ 2169 * notification. */
2170 IWL_DEBUG_INFO(priv, "Initialization Alive received.\n"); 2170 IL_DEBUG_INFO(priv, "Initialization Alive received.\n");
2171 if (iwl3945_set_ucode_ptrs(priv)) { 2171 if (il3945_set_ucode_ptrs(priv)) {
2172 /* Runtime instruction load won't happen; 2172 /* Runtime instruction load won't happen;
2173 * take it all the way back down so we can try again */ 2173 * take it all the way back down so we can try again */
2174 IWL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n"); 2174 IL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n");
2175 goto restart; 2175 goto restart;
2176 } 2176 }
2177 return; 2177 return;
@@ -2181,49 +2181,49 @@ static void iwl3945_init_alive_start(struct iwl_priv *priv)
2181} 2181}
2182 2182
2183/** 2183/**
2184 * iwl3945_alive_start - called after REPLY_ALIVE notification received 2184 * il3945_alive_start - called after REPLY_ALIVE notification received
2185 * from protocol/runtime uCode (initialization uCode's 2185 * from protocol/runtime uCode (initialization uCode's
2186 * Alive gets handled by iwl3945_init_alive_start()). 2186 * Alive gets handled by il3945_init_alive_start()).
2187 */ 2187 */
2188static void iwl3945_alive_start(struct iwl_priv *priv) 2188static void il3945_alive_start(struct il_priv *priv)
2189{ 2189{
2190 int thermal_spin = 0; 2190 int thermal_spin = 0;
2191 u32 rfkill; 2191 u32 rfkill;
2192 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2192 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
2193 2193
2194 IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); 2194 IL_DEBUG_INFO(priv, "Runtime Alive received.\n");
2195 2195
2196 if (priv->card_alive.is_valid != UCODE_VALID_OK) { 2196 if (priv->card_alive.is_valid != UCODE_VALID_OK) {
2197 /* We had an error bringing up the hardware, so take it 2197 /* We had an error bringing up the hardware, so take it
2198 * all the way back down so we can try again */ 2198 * all the way back down so we can try again */
2199 IWL_DEBUG_INFO(priv, "Alive failed.\n"); 2199 IL_DEBUG_INFO(priv, "Alive failed.\n");
2200 goto restart; 2200 goto restart;
2201 } 2201 }
2202 2202
2203 /* Initialize uCode has loaded Runtime uCode ... verify inst image. 2203 /* Initialize uCode has loaded Runtime uCode ... verify inst image.
2204 * This is a paranoid check, because we would not have gotten the 2204 * This is a paranoid check, because we would not have gotten the
2205 * "runtime" alive if code weren't properly loaded. */ 2205 * "runtime" alive if code weren't properly loaded. */
2206 if (iwl3945_verify_ucode(priv)) { 2206 if (il3945_verify_ucode(priv)) {
2207 /* Runtime instruction load was bad; 2207 /* Runtime instruction load was bad;
2208 * take it all the way back down so we can try again */ 2208 * take it all the way back down so we can try again */
2209 IWL_DEBUG_INFO(priv, "Bad runtime uCode load.\n"); 2209 IL_DEBUG_INFO(priv, "Bad runtime uCode load.\n");
2210 goto restart; 2210 goto restart;
2211 } 2211 }
2212 2212
2213 rfkill = iwl_legacy_read_prph(priv, APMG_RFKILL_REG); 2213 rfkill = il_read_prph(priv, APMG_RFKILL_REG);
2214 IWL_DEBUG_INFO(priv, "RFKILL status: 0x%x\n", rfkill); 2214 IL_DEBUG_INFO(priv, "RFKILL status: 0x%x\n", rfkill);
2215 2215
2216 if (rfkill & 0x1) { 2216 if (rfkill & 0x1) {
2217 clear_bit(STATUS_RF_KILL_HW, &priv->status); 2217 clear_bit(STATUS_RF_KILL_HW, &priv->status);
2218 /* if RFKILL is not on, then wait for thermal 2218 /* if RFKILL is not on, then wait for thermal
2219 * sensor in adapter to kick in */ 2219 * sensor in adapter to kick in */
2220 while (iwl3945_hw_get_temperature(priv) == 0) { 2220 while (il3945_hw_get_temperature(priv) == 0) {
2221 thermal_spin++; 2221 thermal_spin++;
2222 udelay(10); 2222 udelay(10);
2223 } 2223 }
2224 2224
2225 if (thermal_spin) 2225 if (thermal_spin)
2226 IWL_DEBUG_INFO(priv, "Thermal calibration took %dus\n", 2226 IL_DEBUG_INFO(priv, "Thermal calibration took %dus\n",
2227 thermal_spin * 10); 2227 thermal_spin * 10);
2228 } else 2228 } else
2229 set_bit(STATUS_RF_KILL_HW, &priv->status); 2229 set_bit(STATUS_RF_KILL_HW, &priv->status);
@@ -2232,39 +2232,39 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2232 set_bit(STATUS_ALIVE, &priv->status); 2232 set_bit(STATUS_ALIVE, &priv->status);
2233 2233
2234 /* Enable watchdog to monitor the driver tx queues */ 2234 /* Enable watchdog to monitor the driver tx queues */
2235 iwl_legacy_setup_watchdog(priv); 2235 il_setup_watchdog(priv);
2236 2236
2237 if (iwl_legacy_is_rfkill(priv)) 2237 if (il_is_rfkill(priv))
2238 return; 2238 return;
2239 2239
2240 ieee80211_wake_queues(priv->hw); 2240 ieee80211_wake_queues(priv->hw);
2241 2241
2242 priv->active_rate = IWL_RATES_MASK_3945; 2242 priv->active_rate = IL_RATES_MASK_3945;
2243 2243
2244 iwl_legacy_power_update_mode(priv, true); 2244 il_power_update_mode(priv, true);
2245 2245
2246 if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) { 2246 if (il_is_associated(priv, IL_RXON_CTX_BSS)) {
2247 struct iwl3945_rxon_cmd *active_rxon = 2247 struct il3945_rxon_cmd *active_rxon =
2248 (struct iwl3945_rxon_cmd *)(&ctx->active); 2248 (struct il3945_rxon_cmd *)(&ctx->active);
2249 2249
2250 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2250 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2251 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2251 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2252 } else { 2252 } else {
2253 /* Initialize our rx_config data */ 2253 /* Initialize our rx_config data */
2254 iwl_legacy_connection_init_rx_config(priv, ctx); 2254 il_connection_init_rx_config(priv, ctx);
2255 } 2255 }
2256 2256
2257 /* Configure Bluetooth device coexistence support */ 2257 /* Configure Bluetooth device coexistence support */
2258 iwl_legacy_send_bt_config(priv); 2258 il_send_bt_config(priv);
2259 2259
2260 set_bit(STATUS_READY, &priv->status); 2260 set_bit(STATUS_READY, &priv->status);
2261 2261
2262 /* Configure the adapter for unassociated operation */ 2262 /* Configure the adapter for unassociated operation */
2263 iwl3945_commit_rxon(priv, ctx); 2263 il3945_commit_rxon(priv, ctx);
2264 2264
2265 iwl3945_reg_txpower_periodic(priv); 2265 il3945_reg_txpower_periodic(priv);
2266 2266
2267 IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); 2267 IL_DEBUG_INFO(priv, "ALIVE processing complete.\n");
2268 wake_up(&priv->wait_command_queue); 2268 wake_up(&priv->wait_command_queue);
2269 2269
2270 return; 2270 return;
@@ -2273,16 +2273,16 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2273 queue_work(priv->workqueue, &priv->restart); 2273 queue_work(priv->workqueue, &priv->restart);
2274} 2274}
2275 2275
2276static void iwl3945_cancel_deferred_work(struct iwl_priv *priv); 2276static void il3945_cancel_deferred_work(struct il_priv *priv);
2277 2277
2278static void __iwl3945_down(struct iwl_priv *priv) 2278static void __il3945_down(struct il_priv *priv)
2279{ 2279{
2280 unsigned long flags; 2280 unsigned long flags;
2281 int exit_pending; 2281 int exit_pending;
2282 2282
2283 IWL_DEBUG_INFO(priv, DRV_NAME " is going down\n"); 2283 IL_DEBUG_INFO(priv, DRV_NAME " is going down\n");
2284 2284
2285 iwl_legacy_scan_cancel_timeout(priv, 200); 2285 il_scan_cancel_timeout(priv, 200);
2286 2286
2287 exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status); 2287 exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status);
2288 2288
@@ -2291,9 +2291,9 @@ static void __iwl3945_down(struct iwl_priv *priv)
2291 del_timer_sync(&priv->watchdog); 2291 del_timer_sync(&priv->watchdog);
2292 2292
2293 /* Station information will now be cleared in device */ 2293 /* Station information will now be cleared in device */
2294 iwl_legacy_clear_ucode_stations(priv, NULL); 2294 il_clear_ucode_stations(priv, NULL);
2295 iwl_legacy_dealloc_bcast_stations(priv); 2295 il_dealloc_bcast_stations(priv);
2296 iwl_legacy_clear_driver_stations(priv); 2296 il_clear_driver_stations(priv);
2297 2297
2298 /* Unblock any waiting calls */ 2298 /* Unblock any waiting calls */
2299 wake_up_all(&priv->wait_command_queue); 2299 wake_up_all(&priv->wait_command_queue);
@@ -2304,20 +2304,20 @@ static void __iwl3945_down(struct iwl_priv *priv)
2304 clear_bit(STATUS_EXIT_PENDING, &priv->status); 2304 clear_bit(STATUS_EXIT_PENDING, &priv->status);
2305 2305
2306 /* stop and reset the on-board processor */ 2306 /* stop and reset the on-board processor */
2307 iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); 2307 il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
2308 2308
2309 /* tell the device to stop sending interrupts */ 2309 /* tell the device to stop sending interrupts */
2310 spin_lock_irqsave(&priv->lock, flags); 2310 spin_lock_irqsave(&priv->lock, flags);
2311 iwl_legacy_disable_interrupts(priv); 2311 il_disable_interrupts(priv);
2312 spin_unlock_irqrestore(&priv->lock, flags); 2312 spin_unlock_irqrestore(&priv->lock, flags);
2313 iwl3945_synchronize_irq(priv); 2313 il3945_synchronize_irq(priv);
2314 2314
2315 if (priv->mac80211_registered) 2315 if (priv->mac80211_registered)
2316 ieee80211_stop_queues(priv->hw); 2316 ieee80211_stop_queues(priv->hw);
2317 2317
2318 /* If we have not previously called iwl3945_init() then 2318 /* If we have not previously called il3945_init() then
2319 * clear all bits but the RF Kill bits and return */ 2319 * clear all bits but the RF Kill bits and return */
2320 if (!iwl_legacy_is_init(priv)) { 2320 if (!il_is_init(priv)) {
2321 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << 2321 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
2322 STATUS_RF_KILL_HW | 2322 STATUS_RF_KILL_HW |
2323 test_bit(STATUS_GEO_CONFIGURED, &priv->status) << 2323 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
@@ -2338,109 +2338,109 @@ static void __iwl3945_down(struct iwl_priv *priv)
2338 test_bit(STATUS_EXIT_PENDING, &priv->status) << 2338 test_bit(STATUS_EXIT_PENDING, &priv->status) <<
2339 STATUS_EXIT_PENDING; 2339 STATUS_EXIT_PENDING;
2340 2340
2341 iwl3945_hw_txq_ctx_stop(priv); 2341 il3945_hw_txq_ctx_stop(priv);
2342 iwl3945_hw_rxq_stop(priv); 2342 il3945_hw_rxq_stop(priv);
2343 2343
2344 /* Power-down device's busmaster DMA clocks */ 2344 /* Power-down device's busmaster DMA clocks */
2345 iwl_legacy_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); 2345 il_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT);
2346 udelay(5); 2346 udelay(5);
2347 2347
2348 /* Stop the device, and put it in low power state */ 2348 /* Stop the device, and put it in low power state */
2349 iwl_legacy_apm_stop(priv); 2349 il_apm_stop(priv);
2350 2350
2351 exit: 2351 exit:
2352 memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); 2352 memset(&priv->card_alive, 0, sizeof(struct il_alive_resp));
2353 2353
2354 if (priv->beacon_skb) 2354 if (priv->beacon_skb)
2355 dev_kfree_skb(priv->beacon_skb); 2355 dev_kfree_skb(priv->beacon_skb);
2356 priv->beacon_skb = NULL; 2356 priv->beacon_skb = NULL;
2357 2357
2358 /* clear out any free frames */ 2358 /* clear out any free frames */
2359 iwl3945_clear_free_frames(priv); 2359 il3945_clear_free_frames(priv);
2360} 2360}
2361 2361
2362static void iwl3945_down(struct iwl_priv *priv) 2362static void il3945_down(struct il_priv *priv)
2363{ 2363{
2364 mutex_lock(&priv->mutex); 2364 mutex_lock(&priv->mutex);
2365 __iwl3945_down(priv); 2365 __il3945_down(priv);
2366 mutex_unlock(&priv->mutex); 2366 mutex_unlock(&priv->mutex);
2367 2367
2368 iwl3945_cancel_deferred_work(priv); 2368 il3945_cancel_deferred_work(priv);
2369} 2369}
2370 2370
2371#define MAX_HW_RESTARTS 5 2371#define MAX_HW_RESTARTS 5
2372 2372
2373static int iwl3945_alloc_bcast_station(struct iwl_priv *priv) 2373static int il3945_alloc_bcast_station(struct il_priv *priv)
2374{ 2374{
2375 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2375 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
2376 unsigned long flags; 2376 unsigned long flags;
2377 u8 sta_id; 2377 u8 sta_id;
2378 2378
2379 spin_lock_irqsave(&priv->sta_lock, flags); 2379 spin_lock_irqsave(&priv->sta_lock, flags);
2380 sta_id = iwl_legacy_prep_station(priv, ctx, 2380 sta_id = il_prep_station(priv, ctx,
2381 iwlegacy_bcast_addr, false, NULL); 2381 iwlegacy_bcast_addr, false, NULL);
2382 if (sta_id == IWL_INVALID_STATION) { 2382 if (sta_id == IL_INVALID_STATION) {
2383 IWL_ERR(priv, "Unable to prepare broadcast station\n"); 2383 IL_ERR(priv, "Unable to prepare broadcast station\n");
2384 spin_unlock_irqrestore(&priv->sta_lock, flags); 2384 spin_unlock_irqrestore(&priv->sta_lock, flags);
2385 2385
2386 return -EINVAL; 2386 return -EINVAL;
2387 } 2387 }
2388 2388
2389 priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; 2389 priv->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE;
2390 priv->stations[sta_id].used |= IWL_STA_BCAST; 2390 priv->stations[sta_id].used |= IL_STA_BCAST;
2391 spin_unlock_irqrestore(&priv->sta_lock, flags); 2391 spin_unlock_irqrestore(&priv->sta_lock, flags);
2392 2392
2393 return 0; 2393 return 0;
2394} 2394}
2395 2395
2396static int __iwl3945_up(struct iwl_priv *priv) 2396static int __il3945_up(struct il_priv *priv)
2397{ 2397{
2398 int rc, i; 2398 int rc, i;
2399 2399
2400 rc = iwl3945_alloc_bcast_station(priv); 2400 rc = il3945_alloc_bcast_station(priv);
2401 if (rc) 2401 if (rc)
2402 return rc; 2402 return rc;
2403 2403
2404 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { 2404 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
2405 IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); 2405 IL_WARN(priv, "Exit pending; will not bring the NIC up\n");
2406 return -EIO; 2406 return -EIO;
2407 } 2407 }
2408 2408
2409 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { 2409 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
2410 IWL_ERR(priv, "ucode not available for device bring up\n"); 2410 IL_ERR(priv, "ucode not available for device bring up\n");
2411 return -EIO; 2411 return -EIO;
2412 } 2412 }
2413 2413
2414 /* If platform's RF_KILL switch is NOT set to KILL */ 2414 /* If platform's RF_KILL switch is NOT set to KILL */
2415 if (iwl_read32(priv, CSR_GP_CNTRL) & 2415 if (il_read32(priv, CSR_GP_CNTRL) &
2416 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) 2416 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
2417 clear_bit(STATUS_RF_KILL_HW, &priv->status); 2417 clear_bit(STATUS_RF_KILL_HW, &priv->status);
2418 else { 2418 else {
2419 set_bit(STATUS_RF_KILL_HW, &priv->status); 2419 set_bit(STATUS_RF_KILL_HW, &priv->status);
2420 IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); 2420 IL_WARN(priv, "Radio disabled by HW RF Kill switch\n");
2421 return -ENODEV; 2421 return -ENODEV;
2422 } 2422 }
2423 2423
2424 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 2424 il_write32(priv, CSR_INT, 0xFFFFFFFF);
2425 2425
2426 rc = iwl3945_hw_nic_init(priv); 2426 rc = il3945_hw_nic_init(priv);
2427 if (rc) { 2427 if (rc) {
2428 IWL_ERR(priv, "Unable to int nic\n"); 2428 IL_ERR(priv, "Unable to int nic\n");
2429 return rc; 2429 return rc;
2430 } 2430 }
2431 2431
2432 /* make sure rfkill handshake bits are cleared */ 2432 /* make sure rfkill handshake bits are cleared */
2433 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 2433 il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
2434 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 2434 il_write32(priv, CSR_UCODE_DRV_GP1_CLR,
2435 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 2435 CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
2436 2436
2437 /* clear (again), then enable host interrupts */ 2437 /* clear (again), then enable host interrupts */
2438 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 2438 il_write32(priv, CSR_INT, 0xFFFFFFFF);
2439 iwl_legacy_enable_interrupts(priv); 2439 il_enable_interrupts(priv);
2440 2440
2441 /* really make sure rfkill handshake bits are cleared */ 2441 /* really make sure rfkill handshake bits are cleared */
2442 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 2442 il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
2443 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 2443 il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
2444 2444
2445 /* Copy original ucode data image from disk into backup cache. 2445 /* Copy original ucode data image from disk into backup cache.
2446 * This will be used to initialize the on-board processor's 2446 * This will be used to initialize the on-board processor's
@@ -2460,26 +2460,26 @@ static int __iwl3945_up(struct iwl_priv *priv)
2460 rc = priv->cfg->ops->lib->load_ucode(priv); 2460 rc = priv->cfg->ops->lib->load_ucode(priv);
2461 2461
2462 if (rc) { 2462 if (rc) {
2463 IWL_ERR(priv, 2463 IL_ERR(priv,
2464 "Unable to set up bootstrap uCode: %d\n", rc); 2464 "Unable to set up bootstrap uCode: %d\n", rc);
2465 continue; 2465 continue;
2466 } 2466 }
2467 2467
2468 /* start card; "initialize" will load runtime ucode */ 2468 /* start card; "initialize" will load runtime ucode */
2469 iwl3945_nic_start(priv); 2469 il3945_nic_start(priv);
2470 2470
2471 IWL_DEBUG_INFO(priv, DRV_NAME " is coming up\n"); 2471 IL_DEBUG_INFO(priv, DRV_NAME " is coming up\n");
2472 2472
2473 return 0; 2473 return 0;
2474 } 2474 }
2475 2475
2476 set_bit(STATUS_EXIT_PENDING, &priv->status); 2476 set_bit(STATUS_EXIT_PENDING, &priv->status);
2477 __iwl3945_down(priv); 2477 __il3945_down(priv);
2478 clear_bit(STATUS_EXIT_PENDING, &priv->status); 2478 clear_bit(STATUS_EXIT_PENDING, &priv->status);
2479 2479
2480 /* tried to restart and config the device for as long as our 2480 /* tried to restart and config the device for as long as our
2481 * patience could withstand */ 2481 * patience could withstand */
2482 IWL_ERR(priv, "Unable to initialize device after %d attempts.\n", i); 2482 IL_ERR(priv, "Unable to initialize device after %d attempts.\n", i);
2483 return -EIO; 2483 return -EIO;
2484} 2484}
2485 2485
@@ -2490,30 +2490,30 @@ static int __iwl3945_up(struct iwl_priv *priv)
2490 * 2490 *
2491 *****************************************************************************/ 2491 *****************************************************************************/
2492 2492
2493static void iwl3945_bg_init_alive_start(struct work_struct *data) 2493static void il3945_bg_init_alive_start(struct work_struct *data)
2494{ 2494{
2495 struct iwl_priv *priv = 2495 struct il_priv *priv =
2496 container_of(data, struct iwl_priv, init_alive_start.work); 2496 container_of(data, struct il_priv, init_alive_start.work);
2497 2497
2498 mutex_lock(&priv->mutex); 2498 mutex_lock(&priv->mutex);
2499 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2499 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2500 goto out; 2500 goto out;
2501 2501
2502 iwl3945_init_alive_start(priv); 2502 il3945_init_alive_start(priv);
2503out: 2503out:
2504 mutex_unlock(&priv->mutex); 2504 mutex_unlock(&priv->mutex);
2505} 2505}
2506 2506
2507static void iwl3945_bg_alive_start(struct work_struct *data) 2507static void il3945_bg_alive_start(struct work_struct *data)
2508{ 2508{
2509 struct iwl_priv *priv = 2509 struct il_priv *priv =
2510 container_of(data, struct iwl_priv, alive_start.work); 2510 container_of(data, struct il_priv, alive_start.work);
2511 2511
2512 mutex_lock(&priv->mutex); 2512 mutex_lock(&priv->mutex);
2513 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2513 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2514 goto out; 2514 goto out;
2515 2515
2516 iwl3945_alive_start(priv); 2516 il3945_alive_start(priv);
2517out: 2517out:
2518 mutex_unlock(&priv->mutex); 2518 mutex_unlock(&priv->mutex);
2519} 2519}
@@ -2524,12 +2524,12 @@ out:
2524 * *is* readable even when device has been SW_RESET into low power mode 2524 * *is* readable even when device has been SW_RESET into low power mode
2525 * (e.g. during RF KILL). 2525 * (e.g. during RF KILL).
2526 */ 2526 */
2527static void iwl3945_rfkill_poll(struct work_struct *data) 2527static void il3945_rfkill_poll(struct work_struct *data)
2528{ 2528{
2529 struct iwl_priv *priv = 2529 struct il_priv *priv =
2530 container_of(data, struct iwl_priv, _3945.rfkill_poll.work); 2530 container_of(data, struct il_priv, _3945.rfkill_poll.work);
2531 bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &priv->status); 2531 bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &priv->status);
2532 bool new_rfkill = !(iwl_read32(priv, CSR_GP_CNTRL) 2532 bool new_rfkill = !(il_read32(priv, CSR_GP_CNTRL)
2533 & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); 2533 & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
2534 2534
2535 if (new_rfkill != old_rfkill) { 2535 if (new_rfkill != old_rfkill) {
@@ -2540,7 +2540,7 @@ static void iwl3945_rfkill_poll(struct work_struct *data)
2540 2540
2541 wiphy_rfkill_set_hw_state(priv->hw->wiphy, new_rfkill); 2541 wiphy_rfkill_set_hw_state(priv->hw->wiphy, new_rfkill);
2542 2542
2543 IWL_DEBUG_RF_KILL(priv, "RF_KILL bit toggled to %s.\n", 2543 IL_DEBUG_RF_KILL(priv, "RF_KILL bit toggled to %s.\n",
2544 new_rfkill ? "disable radio" : "enable radio"); 2544 new_rfkill ? "disable radio" : "enable radio");
2545 } 2545 }
2546 2546
@@ -2551,14 +2551,14 @@ static void iwl3945_rfkill_poll(struct work_struct *data)
2551 2551
2552} 2552}
2553 2553
2554int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) 2554int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif)
2555{ 2555{
2556 struct iwl_host_cmd cmd = { 2556 struct il_host_cmd cmd = {
2557 .id = REPLY_SCAN_CMD, 2557 .id = REPLY_SCAN_CMD,
2558 .len = sizeof(struct iwl3945_scan_cmd), 2558 .len = sizeof(struct il3945_scan_cmd),
2559 .flags = CMD_SIZE_HUGE, 2559 .flags = CMD_SIZE_HUGE,
2560 }; 2560 };
2561 struct iwl3945_scan_cmd *scan; 2561 struct il3945_scan_cmd *scan;
2562 u8 n_probes = 0; 2562 u8 n_probes = 0;
2563 enum ieee80211_band band; 2563 enum ieee80211_band band;
2564 bool is_active = false; 2564 bool is_active = false;
@@ -2568,26 +2568,26 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2568 lockdep_assert_held(&priv->mutex); 2568 lockdep_assert_held(&priv->mutex);
2569 2569
2570 if (!priv->scan_cmd) { 2570 if (!priv->scan_cmd) {
2571 priv->scan_cmd = kmalloc(sizeof(struct iwl3945_scan_cmd) + 2571 priv->scan_cmd = kmalloc(sizeof(struct il3945_scan_cmd) +
2572 IWL_MAX_SCAN_SIZE, GFP_KERNEL); 2572 IL_MAX_SCAN_SIZE, GFP_KERNEL);
2573 if (!priv->scan_cmd) { 2573 if (!priv->scan_cmd) {
2574 IWL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n"); 2574 IL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n");
2575 return -ENOMEM; 2575 return -ENOMEM;
2576 } 2576 }
2577 } 2577 }
2578 scan = priv->scan_cmd; 2578 scan = priv->scan_cmd;
2579 memset(scan, 0, sizeof(struct iwl3945_scan_cmd) + IWL_MAX_SCAN_SIZE); 2579 memset(scan, 0, sizeof(struct il3945_scan_cmd) + IL_MAX_SCAN_SIZE);
2580 2580
2581 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; 2581 scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH;
2582 scan->quiet_time = IWL_ACTIVE_QUIET_TIME; 2582 scan->quiet_time = IL_ACTIVE_QUIET_TIME;
2583 2583
2584 if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) { 2584 if (il_is_associated(priv, IL_RXON_CTX_BSS)) {
2585 u16 interval; 2585 u16 interval;
2586 u32 extra; 2586 u32 extra;
2587 u32 suspend_time = 100; 2587 u32 suspend_time = 100;
2588 u32 scan_suspend_time = 100; 2588 u32 scan_suspend_time = 100;
2589 2589
2590 IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); 2590 IL_DEBUG_INFO(priv, "Scanning while associated...\n");
2591 2591
2592 interval = vif->bss_conf.beacon_int; 2592 interval = vif->bss_conf.beacon_int;
2593 2593
@@ -2607,13 +2607,13 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2607 (extra | ((suspend_time % interval) * 1024)); 2607 (extra | ((suspend_time % interval) * 1024));
2608 2608
2609 scan->suspend_time = cpu_to_le32(scan_suspend_time); 2609 scan->suspend_time = cpu_to_le32(scan_suspend_time);
2610 IWL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n", 2610 IL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n",
2611 scan_suspend_time, interval); 2611 scan_suspend_time, interval);
2612 } 2612 }
2613 2613
2614 if (priv->scan_request->n_ssids) { 2614 if (priv->scan_request->n_ssids) {
2615 int i, p = 0; 2615 int i, p = 0;
2616 IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); 2616 IL_DEBUG_SCAN(priv, "Kicking off active scan\n");
2617 for (i = 0; i < priv->scan_request->n_ssids; i++) { 2617 for (i = 0; i < priv->scan_request->n_ssids; i++) {
2618 /* always does wildcard anyway */ 2618 /* always does wildcard anyway */
2619 if (!priv->scan_request->ssids[i].ssid_len) 2619 if (!priv->scan_request->ssids[i].ssid_len)
@@ -2629,12 +2629,12 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2629 } 2629 }
2630 is_active = true; 2630 is_active = true;
2631 } else 2631 } else
2632 IWL_DEBUG_SCAN(priv, "Kicking off passive scan.\n"); 2632 IL_DEBUG_SCAN(priv, "Kicking off passive scan.\n");
2633 2633
2634 /* We don't build a direct scan probe request; the uCode will do 2634 /* We don't build a direct scan probe request; the uCode will do
2635 * that based on the direct_mask added to each channel entry */ 2635 * that based on the direct_mask added to each channel entry */
2636 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; 2636 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
2637 scan->tx_cmd.sta_id = priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id; 2637 scan->tx_cmd.sta_id = priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id;
2638 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 2638 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
2639 2639
2640 /* flags + rate selection */ 2640 /* flags + rate selection */
@@ -2642,15 +2642,15 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2642 switch (priv->scan_band) { 2642 switch (priv->scan_band) {
2643 case IEEE80211_BAND_2GHZ: 2643 case IEEE80211_BAND_2GHZ:
2644 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 2644 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
2645 scan->tx_cmd.rate = IWL_RATE_1M_PLCP; 2645 scan->tx_cmd.rate = IL_RATE_1M_PLCP;
2646 band = IEEE80211_BAND_2GHZ; 2646 band = IEEE80211_BAND_2GHZ;
2647 break; 2647 break;
2648 case IEEE80211_BAND_5GHZ: 2648 case IEEE80211_BAND_5GHZ:
2649 scan->tx_cmd.rate = IWL_RATE_6M_PLCP; 2649 scan->tx_cmd.rate = IL_RATE_6M_PLCP;
2650 band = IEEE80211_BAND_5GHZ; 2650 band = IEEE80211_BAND_5GHZ;
2651 break; 2651 break;
2652 default: 2652 default:
2653 IWL_WARN(priv, "Invalid scan band\n"); 2653 IL_WARN(priv, "Invalid scan band\n");
2654 return -EIO; 2654 return -EIO;
2655 } 2655 }
2656 2656
@@ -2659,67 +2659,67 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
2659 * is marked passive, we can do active scanning if we 2659 * is marked passive, we can do active scanning if we
2660 * detect transmissions. 2660 * detect transmissions.
2661 */ 2661 */
2662 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT : 2662 scan->good_CRC_th = is_active ? IL_GOOD_CRC_TH_DEFAULT :
2663 IWL_GOOD_CRC_TH_DISABLED; 2663 IL_GOOD_CRC_TH_DISABLED;
2664 2664
2665 len = iwl_legacy_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, 2665 len = il_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data,
2666 vif->addr, priv->scan_request->ie, 2666 vif->addr, priv->scan_request->ie,
2667 priv->scan_request->ie_len, 2667 priv->scan_request->ie_len,
2668 IWL_MAX_SCAN_SIZE - sizeof(*scan)); 2668 IL_MAX_SCAN_SIZE - sizeof(*scan));
2669 scan->tx_cmd.len = cpu_to_le16(len); 2669 scan->tx_cmd.len = cpu_to_le16(len);
2670 2670
2671 /* select Rx antennas */ 2671 /* select Rx antennas */
2672 scan->flags |= iwl3945_get_antenna_flags(priv); 2672 scan->flags |= il3945_get_antenna_flags(priv);
2673 2673
2674 scan->channel_count = iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, 2674 scan->channel_count = il3945_get_channels_for_scan(priv, band, is_active, n_probes,
2675 (void *)&scan->data[len], vif); 2675 (void *)&scan->data[len], vif);
2676 if (scan->channel_count == 0) { 2676 if (scan->channel_count == 0) {
2677 IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); 2677 IL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count);
2678 return -EIO; 2678 return -EIO;
2679 } 2679 }
2680 2680
2681 cmd.len += le16_to_cpu(scan->tx_cmd.len) + 2681 cmd.len += le16_to_cpu(scan->tx_cmd.len) +
2682 scan->channel_count * sizeof(struct iwl3945_scan_channel); 2682 scan->channel_count * sizeof(struct il3945_scan_channel);
2683 cmd.data = scan; 2683 cmd.data = scan;
2684 scan->len = cpu_to_le16(cmd.len); 2684 scan->len = cpu_to_le16(cmd.len);
2685 2685
2686 set_bit(STATUS_SCAN_HW, &priv->status); 2686 set_bit(STATUS_SCAN_HW, &priv->status);
2687 ret = iwl_legacy_send_cmd_sync(priv, &cmd); 2687 ret = il_send_cmd_sync(priv, &cmd);
2688 if (ret) 2688 if (ret)
2689 clear_bit(STATUS_SCAN_HW, &priv->status); 2689 clear_bit(STATUS_SCAN_HW, &priv->status);
2690 return ret; 2690 return ret;
2691} 2691}
2692 2692
2693void iwl3945_post_scan(struct iwl_priv *priv) 2693void il3945_post_scan(struct il_priv *priv)
2694{ 2694{
2695 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2695 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
2696 2696
2697 /* 2697 /*
2698 * Since setting the RXON may have been deferred while 2698 * Since setting the RXON may have been deferred while
2699 * performing the scan, fire one off if needed 2699 * performing the scan, fire one off if needed
2700 */ 2700 */
2701 if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) 2701 if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging)))
2702 iwl3945_commit_rxon(priv, ctx); 2702 il3945_commit_rxon(priv, ctx);
2703} 2703}
2704 2704
2705static void iwl3945_bg_restart(struct work_struct *data) 2705static void il3945_bg_restart(struct work_struct *data)
2706{ 2706{
2707 struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); 2707 struct il_priv *priv = container_of(data, struct il_priv, restart);
2708 2708
2709 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2709 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2710 return; 2710 return;
2711 2711
2712 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { 2712 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) {
2713 struct iwl_rxon_context *ctx; 2713 struct il_rxon_context *ctx;
2714 mutex_lock(&priv->mutex); 2714 mutex_lock(&priv->mutex);
2715 for_each_context(priv, ctx) 2715 for_each_context(priv, ctx)
2716 ctx->vif = NULL; 2716 ctx->vif = NULL;
2717 priv->is_open = 0; 2717 priv->is_open = 0;
2718 mutex_unlock(&priv->mutex); 2718 mutex_unlock(&priv->mutex);
2719 iwl3945_down(priv); 2719 il3945_down(priv);
2720 ieee80211_restart_hw(priv->hw); 2720 ieee80211_restart_hw(priv->hw);
2721 } else { 2721 } else {
2722 iwl3945_down(priv); 2722 il3945_down(priv);
2723 2723
2724 mutex_lock(&priv->mutex); 2724 mutex_lock(&priv->mutex);
2725 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { 2725 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
@@ -2727,57 +2727,57 @@ static void iwl3945_bg_restart(struct work_struct *data)
2727 return; 2727 return;
2728 } 2728 }
2729 2729
2730 __iwl3945_up(priv); 2730 __il3945_up(priv);
2731 mutex_unlock(&priv->mutex); 2731 mutex_unlock(&priv->mutex);
2732 } 2732 }
2733} 2733}
2734 2734
2735static void iwl3945_bg_rx_replenish(struct work_struct *data) 2735static void il3945_bg_rx_replenish(struct work_struct *data)
2736{ 2736{
2737 struct iwl_priv *priv = 2737 struct il_priv *priv =
2738 container_of(data, struct iwl_priv, rx_replenish); 2738 container_of(data, struct il_priv, rx_replenish);
2739 2739
2740 mutex_lock(&priv->mutex); 2740 mutex_lock(&priv->mutex);
2741 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2741 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2742 goto out; 2742 goto out;
2743 2743
2744 iwl3945_rx_replenish(priv); 2744 il3945_rx_replenish(priv);
2745out: 2745out:
2746 mutex_unlock(&priv->mutex); 2746 mutex_unlock(&priv->mutex);
2747} 2747}
2748 2748
2749void iwl3945_post_associate(struct iwl_priv *priv) 2749void il3945_post_associate(struct il_priv *priv)
2750{ 2750{
2751 int rc = 0; 2751 int rc = 0;
2752 struct ieee80211_conf *conf = NULL; 2752 struct ieee80211_conf *conf = NULL;
2753 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2753 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
2754 2754
2755 if (!ctx->vif || !priv->is_open) 2755 if (!ctx->vif || !priv->is_open)
2756 return; 2756 return;
2757 2757
2758 IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", 2758 IL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n",
2759 ctx->vif->bss_conf.aid, ctx->active.bssid_addr); 2759 ctx->vif->bss_conf.aid, ctx->active.bssid_addr);
2760 2760
2761 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2761 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2762 return; 2762 return;
2763 2763
2764 iwl_legacy_scan_cancel_timeout(priv, 200); 2764 il_scan_cancel_timeout(priv, 200);
2765 2765
2766 conf = iwl_legacy_ieee80211_get_hw_conf(priv->hw); 2766 conf = il_ieee80211_get_hw_conf(priv->hw);
2767 2767
2768 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2768 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2769 iwl3945_commit_rxon(priv, ctx); 2769 il3945_commit_rxon(priv, ctx);
2770 2770
2771 rc = iwl_legacy_send_rxon_timing(priv, ctx); 2771 rc = il_send_rxon_timing(priv, ctx);
2772 if (rc) 2772 if (rc)
2773 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 2773 IL_WARN(priv, "REPLY_RXON_TIMING failed - "
2774 "Attempting to continue.\n"); 2774 "Attempting to continue.\n");
2775 2775
2776 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2776 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2777 2777
2778 ctx->staging.assoc_id = cpu_to_le16(ctx->vif->bss_conf.aid); 2778 ctx->staging.assoc_id = cpu_to_le16(ctx->vif->bss_conf.aid);
2779 2779
2780 IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", 2780 IL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n",
2781 ctx->vif->bss_conf.aid, ctx->vif->bss_conf.beacon_int); 2781 ctx->vif->bss_conf.aid, ctx->vif->bss_conf.beacon_int);
2782 2782
2783 if (ctx->vif->bss_conf.use_short_preamble) 2783 if (ctx->vif->bss_conf.use_short_preamble)
@@ -2792,17 +2792,17 @@ void iwl3945_post_associate(struct iwl_priv *priv)
2792 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 2792 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
2793 } 2793 }
2794 2794
2795 iwl3945_commit_rxon(priv, ctx); 2795 il3945_commit_rxon(priv, ctx);
2796 2796
2797 switch (ctx->vif->type) { 2797 switch (ctx->vif->type) {
2798 case NL80211_IFTYPE_STATION: 2798 case NL80211_IFTYPE_STATION:
2799 iwl3945_rate_scale_init(priv->hw, IWL_AP_ID); 2799 il3945_rate_scale_init(priv->hw, IL_AP_ID);
2800 break; 2800 break;
2801 case NL80211_IFTYPE_ADHOC: 2801 case NL80211_IFTYPE_ADHOC:
2802 iwl3945_send_beacon_cmd(priv); 2802 il3945_send_beacon_cmd(priv);
2803 break; 2803 break;
2804 default: 2804 default:
2805 IWL_ERR(priv, "%s Should not be called in %d mode\n", 2805 IL_ERR(priv, "%s Should not be called in %d mode\n",
2806 __func__, ctx->vif->type); 2806 __func__, ctx->vif->type);
2807 break; 2807 break;
2808 } 2808 }
@@ -2816,12 +2816,12 @@ void iwl3945_post_associate(struct iwl_priv *priv)
2816 2816
2817#define UCODE_READY_TIMEOUT (2 * HZ) 2817#define UCODE_READY_TIMEOUT (2 * HZ)
2818 2818
2819static int iwl3945_mac_start(struct ieee80211_hw *hw) 2819static int il3945_mac_start(struct ieee80211_hw *hw)
2820{ 2820{
2821 struct iwl_priv *priv = hw->priv; 2821 struct il_priv *priv = hw->priv;
2822 int ret; 2822 int ret;
2823 2823
2824 IWL_DEBUG_MAC80211(priv, "enter\n"); 2824 IL_DEBUG_MAC80211(priv, "enter\n");
2825 2825
2826 /* we should be verifying the device is ready to be opened */ 2826 /* we should be verifying the device is ready to be opened */
2827 mutex_lock(&priv->mutex); 2827 mutex_lock(&priv->mutex);
@@ -2830,22 +2830,22 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
2830 * ucode filename and max sizes are card-specific. */ 2830 * ucode filename and max sizes are card-specific. */
2831 2831
2832 if (!priv->ucode_code.len) { 2832 if (!priv->ucode_code.len) {
2833 ret = iwl3945_read_ucode(priv); 2833 ret = il3945_read_ucode(priv);
2834 if (ret) { 2834 if (ret) {
2835 IWL_ERR(priv, "Could not read microcode: %d\n", ret); 2835 IL_ERR(priv, "Could not read microcode: %d\n", ret);
2836 mutex_unlock(&priv->mutex); 2836 mutex_unlock(&priv->mutex);
2837 goto out_release_irq; 2837 goto out_release_irq;
2838 } 2838 }
2839 } 2839 }
2840 2840
2841 ret = __iwl3945_up(priv); 2841 ret = __il3945_up(priv);
2842 2842
2843 mutex_unlock(&priv->mutex); 2843 mutex_unlock(&priv->mutex);
2844 2844
2845 if (ret) 2845 if (ret)
2846 goto out_release_irq; 2846 goto out_release_irq;
2847 2847
2848 IWL_DEBUG_INFO(priv, "Start UP work.\n"); 2848 IL_DEBUG_INFO(priv, "Start UP work.\n");
2849 2849
2850 /* Wait for START_ALIVE from ucode. Otherwise callbacks from 2850 /* Wait for START_ALIVE from ucode. Otherwise callbacks from
2851 * mac80211 will not be run successfully. */ 2851 * mac80211 will not be run successfully. */
@@ -2854,7 +2854,7 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
2854 UCODE_READY_TIMEOUT); 2854 UCODE_READY_TIMEOUT);
2855 if (!ret) { 2855 if (!ret) {
2856 if (!test_bit(STATUS_READY, &priv->status)) { 2856 if (!test_bit(STATUS_READY, &priv->status)) {
2857 IWL_ERR(priv, 2857 IL_ERR(priv,
2858 "Wait for START_ALIVE timeout after %dms.\n", 2858 "Wait for START_ALIVE timeout after %dms.\n",
2859 jiffies_to_msecs(UCODE_READY_TIMEOUT)); 2859 jiffies_to_msecs(UCODE_READY_TIMEOUT));
2860 ret = -ETIMEDOUT; 2860 ret = -ETIMEDOUT;
@@ -2867,29 +2867,29 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
2867 cancel_delayed_work(&priv->_3945.rfkill_poll); 2867 cancel_delayed_work(&priv->_3945.rfkill_poll);
2868 2868
2869 priv->is_open = 1; 2869 priv->is_open = 1;
2870 IWL_DEBUG_MAC80211(priv, "leave\n"); 2870 IL_DEBUG_MAC80211(priv, "leave\n");
2871 return 0; 2871 return 0;
2872 2872
2873out_release_irq: 2873out_release_irq:
2874 priv->is_open = 0; 2874 priv->is_open = 0;
2875 IWL_DEBUG_MAC80211(priv, "leave - failed\n"); 2875 IL_DEBUG_MAC80211(priv, "leave - failed\n");
2876 return ret; 2876 return ret;
2877} 2877}
2878 2878
2879static void iwl3945_mac_stop(struct ieee80211_hw *hw) 2879static void il3945_mac_stop(struct ieee80211_hw *hw)
2880{ 2880{
2881 struct iwl_priv *priv = hw->priv; 2881 struct il_priv *priv = hw->priv;
2882 2882
2883 IWL_DEBUG_MAC80211(priv, "enter\n"); 2883 IL_DEBUG_MAC80211(priv, "enter\n");
2884 2884
2885 if (!priv->is_open) { 2885 if (!priv->is_open) {
2886 IWL_DEBUG_MAC80211(priv, "leave - skip\n"); 2886 IL_DEBUG_MAC80211(priv, "leave - skip\n");
2887 return; 2887 return;
2888 } 2888 }
2889 2889
2890 priv->is_open = 0; 2890 priv->is_open = 0;
2891 2891
2892 iwl3945_down(priv); 2892 il3945_down(priv);
2893 2893
2894 flush_workqueue(priv->workqueue); 2894 flush_workqueue(priv->workqueue);
2895 2895
@@ -2897,27 +2897,27 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw)
2897 queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, 2897 queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll,
2898 round_jiffies_relative(2 * HZ)); 2898 round_jiffies_relative(2 * HZ));
2899 2899
2900 IWL_DEBUG_MAC80211(priv, "leave\n"); 2900 IL_DEBUG_MAC80211(priv, "leave\n");
2901} 2901}
2902 2902
2903static void iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 2903static void il3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2904{ 2904{
2905 struct iwl_priv *priv = hw->priv; 2905 struct il_priv *priv = hw->priv;
2906 2906
2907 IWL_DEBUG_MAC80211(priv, "enter\n"); 2907 IL_DEBUG_MAC80211(priv, "enter\n");
2908 2908
2909 IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 2909 IL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
2910 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); 2910 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
2911 2911
2912 if (iwl3945_tx_skb(priv, skb)) 2912 if (il3945_tx_skb(priv, skb))
2913 dev_kfree_skb_any(skb); 2913 dev_kfree_skb_any(skb);
2914 2914
2915 IWL_DEBUG_MAC80211(priv, "leave\n"); 2915 IL_DEBUG_MAC80211(priv, "leave\n");
2916} 2916}
2917 2917
2918void iwl3945_config_ap(struct iwl_priv *priv) 2918void il3945_config_ap(struct il_priv *priv)
2919{ 2919{
2920 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2920 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
2921 struct ieee80211_vif *vif = ctx->vif; 2921 struct ieee80211_vif *vif = ctx->vif;
2922 int rc = 0; 2922 int rc = 0;
2923 2923
@@ -2925,16 +2925,16 @@ void iwl3945_config_ap(struct iwl_priv *priv)
2925 return; 2925 return;
2926 2926
2927 /* The following should be done only at AP bring up */ 2927 /* The following should be done only at AP bring up */
2928 if (!(iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS))) { 2928 if (!(il_is_associated(priv, IL_RXON_CTX_BSS))) {
2929 2929
2930 /* RXON - unassoc (to set timing command) */ 2930 /* RXON - unassoc (to set timing command) */
2931 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2931 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2932 iwl3945_commit_rxon(priv, ctx); 2932 il3945_commit_rxon(priv, ctx);
2933 2933
2934 /* RXON Timing */ 2934 /* RXON Timing */
2935 rc = iwl_legacy_send_rxon_timing(priv, ctx); 2935 rc = il_send_rxon_timing(priv, ctx);
2936 if (rc) 2936 if (rc)
2937 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 2937 IL_WARN(priv, "REPLY_RXON_TIMING failed - "
2938 "Attempting to continue.\n"); 2938 "Attempting to continue.\n");
2939 2939
2940 ctx->staging.assoc_id = 0; 2940 ctx->staging.assoc_id = 0;
@@ -2956,25 +2956,25 @@ void iwl3945_config_ap(struct iwl_priv *priv)
2956 } 2956 }
2957 /* restore RXON assoc */ 2957 /* restore RXON assoc */
2958 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2958 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2959 iwl3945_commit_rxon(priv, ctx); 2959 il3945_commit_rxon(priv, ctx);
2960 } 2960 }
2961 iwl3945_send_beacon_cmd(priv); 2961 il3945_send_beacon_cmd(priv);
2962} 2962}
2963 2963
2964static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 2964static int il3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2965 struct ieee80211_vif *vif, 2965 struct ieee80211_vif *vif,
2966 struct ieee80211_sta *sta, 2966 struct ieee80211_sta *sta,
2967 struct ieee80211_key_conf *key) 2967 struct ieee80211_key_conf *key)
2968{ 2968{
2969 struct iwl_priv *priv = hw->priv; 2969 struct il_priv *priv = hw->priv;
2970 int ret = 0; 2970 int ret = 0;
2971 u8 sta_id = IWL_INVALID_STATION; 2971 u8 sta_id = IL_INVALID_STATION;
2972 u8 static_key; 2972 u8 static_key;
2973 2973
2974 IWL_DEBUG_MAC80211(priv, "enter\n"); 2974 IL_DEBUG_MAC80211(priv, "enter\n");
2975 2975
2976 if (iwl3945_mod_params.sw_crypto) { 2976 if (il3945_mod_params.sw_crypto) {
2977 IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); 2977 IL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n");
2978 return -EOPNOTSUPP; 2978 return -EOPNOTSUPP;
2979 } 2979 }
2980 2980
@@ -2986,66 +2986,66 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2986 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) 2986 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
2987 return -EOPNOTSUPP; 2987 return -EOPNOTSUPP;
2988 2988
2989 static_key = !iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS); 2989 static_key = !il_is_associated(priv, IL_RXON_CTX_BSS);
2990 2990
2991 if (!static_key) { 2991 if (!static_key) {
2992 sta_id = iwl_legacy_sta_id_or_broadcast( 2992 sta_id = il_sta_id_or_broadcast(
2993 priv, &priv->contexts[IWL_RXON_CTX_BSS], sta); 2993 priv, &priv->contexts[IL_RXON_CTX_BSS], sta);
2994 if (sta_id == IWL_INVALID_STATION) 2994 if (sta_id == IL_INVALID_STATION)
2995 return -EINVAL; 2995 return -EINVAL;
2996 } 2996 }
2997 2997
2998 mutex_lock(&priv->mutex); 2998 mutex_lock(&priv->mutex);
2999 iwl_legacy_scan_cancel_timeout(priv, 100); 2999 il_scan_cancel_timeout(priv, 100);
3000 3000
3001 switch (cmd) { 3001 switch (cmd) {
3002 case SET_KEY: 3002 case SET_KEY:
3003 if (static_key) 3003 if (static_key)
3004 ret = iwl3945_set_static_key(priv, key); 3004 ret = il3945_set_static_key(priv, key);
3005 else 3005 else
3006 ret = iwl3945_set_dynamic_key(priv, key, sta_id); 3006 ret = il3945_set_dynamic_key(priv, key, sta_id);
3007 IWL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); 3007 IL_DEBUG_MAC80211(priv, "enable hwcrypto key\n");
3008 break; 3008 break;
3009 case DISABLE_KEY: 3009 case DISABLE_KEY:
3010 if (static_key) 3010 if (static_key)
3011 ret = iwl3945_remove_static_key(priv); 3011 ret = il3945_remove_static_key(priv);
3012 else 3012 else
3013 ret = iwl3945_clear_sta_key_info(priv, sta_id); 3013 ret = il3945_clear_sta_key_info(priv, sta_id);
3014 IWL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); 3014 IL_DEBUG_MAC80211(priv, "disable hwcrypto key\n");
3015 break; 3015 break;
3016 default: 3016 default:
3017 ret = -EINVAL; 3017 ret = -EINVAL;
3018 } 3018 }
3019 3019
3020 mutex_unlock(&priv->mutex); 3020 mutex_unlock(&priv->mutex);
3021 IWL_DEBUG_MAC80211(priv, "leave\n"); 3021 IL_DEBUG_MAC80211(priv, "leave\n");
3022 3022
3023 return ret; 3023 return ret;
3024} 3024}
3025 3025
3026static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, 3026static int il3945_mac_sta_add(struct ieee80211_hw *hw,
3027 struct ieee80211_vif *vif, 3027 struct ieee80211_vif *vif,
3028 struct ieee80211_sta *sta) 3028 struct ieee80211_sta *sta)
3029{ 3029{
3030 struct iwl_priv *priv = hw->priv; 3030 struct il_priv *priv = hw->priv;
3031 struct iwl3945_sta_priv *sta_priv = (void *)sta->drv_priv; 3031 struct il3945_sta_priv *sta_priv = (void *)sta->drv_priv;
3032 int ret; 3032 int ret;
3033 bool is_ap = vif->type == NL80211_IFTYPE_STATION; 3033 bool is_ap = vif->type == NL80211_IFTYPE_STATION;
3034 u8 sta_id; 3034 u8 sta_id;
3035 3035
3036 IWL_DEBUG_INFO(priv, "received request to add station %pM\n", 3036 IL_DEBUG_INFO(priv, "received request to add station %pM\n",
3037 sta->addr); 3037 sta->addr);
3038 mutex_lock(&priv->mutex); 3038 mutex_lock(&priv->mutex);
3039 IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n", 3039 IL_DEBUG_INFO(priv, "proceeding to add station %pM\n",
3040 sta->addr); 3040 sta->addr);
3041 sta_priv->common.sta_id = IWL_INVALID_STATION; 3041 sta_priv->common.sta_id = IL_INVALID_STATION;
3042 3042
3043 3043
3044 ret = iwl_legacy_add_station_common(priv, 3044 ret = il_add_station_common(priv,
3045 &priv->contexts[IWL_RXON_CTX_BSS], 3045 &priv->contexts[IL_RXON_CTX_BSS],
3046 sta->addr, is_ap, sta, &sta_id); 3046 sta->addr, is_ap, sta, &sta_id);
3047 if (ret) { 3047 if (ret) {
3048 IWL_ERR(priv, "Unable to add station %pM (%d)\n", 3048 IL_ERR(priv, "Unable to add station %pM (%d)\n",
3049 sta->addr, ret); 3049 sta->addr, ret);
3050 /* Should we return success if return code is EEXIST ? */ 3050 /* Should we return success if return code is EEXIST ? */
3051 mutex_unlock(&priv->mutex); 3051 mutex_unlock(&priv->mutex);
@@ -3055,22 +3055,22 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw,
3055 sta_priv->common.sta_id = sta_id; 3055 sta_priv->common.sta_id = sta_id;
3056 3056
3057 /* Initialize rate scaling */ 3057 /* Initialize rate scaling */
3058 IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", 3058 IL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n",
3059 sta->addr); 3059 sta->addr);
3060 iwl3945_rs_rate_init(priv, sta, sta_id); 3060 il3945_rs_rate_init(priv, sta, sta_id);
3061 mutex_unlock(&priv->mutex); 3061 mutex_unlock(&priv->mutex);
3062 3062
3063 return 0; 3063 return 0;
3064} 3064}
3065 3065
3066static void iwl3945_configure_filter(struct ieee80211_hw *hw, 3066static void il3945_configure_filter(struct ieee80211_hw *hw,
3067 unsigned int changed_flags, 3067 unsigned int changed_flags,
3068 unsigned int *total_flags, 3068 unsigned int *total_flags,
3069 u64 multicast) 3069 u64 multicast)
3070{ 3070{
3071 struct iwl_priv *priv = hw->priv; 3071 struct il_priv *priv = hw->priv;
3072 __le32 filter_or = 0, filter_nand = 0; 3072 __le32 filter_or = 0, filter_nand = 0;
3073 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 3073 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
3074 3074
3075#define CHK(test, flag) do { \ 3075#define CHK(test, flag) do { \
3076 if (*total_flags & (test)) \ 3076 if (*total_flags & (test)) \
@@ -3079,7 +3079,7 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw,
3079 filter_nand |= (flag); \ 3079 filter_nand |= (flag); \
3080 } while (0) 3080 } while (0)
3081 3081
3082 IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", 3082 IL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n",
3083 changed_flags, *total_flags); 3083 changed_flags, *total_flags);
3084 3084
3085 CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); 3085 CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK);
@@ -3103,7 +3103,7 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw,
3103 3103
3104 /* 3104 /*
3105 * Receiving all multicast frames is always enabled by the 3105 * Receiving all multicast frames is always enabled by the
3106 * default flags setup in iwl_legacy_connection_init_rx_config() 3106 * default flags setup in il_connection_init_rx_config()
3107 * since we currently do not support programming multicast 3107 * since we currently do not support programming multicast
3108 * filters into the device. 3108 * filters into the device.
3109 */ 3109 */
@@ -3131,103 +3131,103 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw,
3131 * level that is used instead of the global debug level if it (the per 3131 * level that is used instead of the global debug level if it (the per
3132 * device debug level) is set. 3132 * device debug level) is set.
3133 */ 3133 */
3134static ssize_t iwl3945_show_debug_level(struct device *d, 3134static ssize_t il3945_show_debug_level(struct device *d,
3135 struct device_attribute *attr, char *buf) 3135 struct device_attribute *attr, char *buf)
3136{ 3136{
3137 struct iwl_priv *priv = dev_get_drvdata(d); 3137 struct il_priv *priv = dev_get_drvdata(d);
3138 return sprintf(buf, "0x%08X\n", iwl_legacy_get_debug_level(priv)); 3138 return sprintf(buf, "0x%08X\n", il_get_debug_level(priv));
3139} 3139}
3140static ssize_t iwl3945_store_debug_level(struct device *d, 3140static ssize_t il3945_store_debug_level(struct device *d,
3141 struct device_attribute *attr, 3141 struct device_attribute *attr,
3142 const char *buf, size_t count) 3142 const char *buf, size_t count)
3143{ 3143{
3144 struct iwl_priv *priv = dev_get_drvdata(d); 3144 struct il_priv *priv = dev_get_drvdata(d);
3145 unsigned long val; 3145 unsigned long val;
3146 int ret; 3146 int ret;
3147 3147
3148 ret = strict_strtoul(buf, 0, &val); 3148 ret = strict_strtoul(buf, 0, &val);
3149 if (ret) 3149 if (ret)
3150 IWL_INFO(priv, "%s is not in hex or decimal form.\n", buf); 3150 IL_INFO(priv, "%s is not in hex or decimal form.\n", buf);
3151 else { 3151 else {
3152 priv->debug_level = val; 3152 priv->debug_level = val;
3153 if (iwl_legacy_alloc_traffic_mem(priv)) 3153 if (il_alloc_traffic_mem(priv))
3154 IWL_ERR(priv, 3154 IL_ERR(priv,
3155 "Not enough memory to generate traffic log\n"); 3155 "Not enough memory to generate traffic log\n");
3156 } 3156 }
3157 return strnlen(buf, count); 3157 return strnlen(buf, count);
3158} 3158}
3159 3159
3160static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, 3160static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,
3161 iwl3945_show_debug_level, iwl3945_store_debug_level); 3161 il3945_show_debug_level, il3945_store_debug_level);
3162 3162
3163#endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */ 3163#endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */
3164 3164
3165static ssize_t iwl3945_show_temperature(struct device *d, 3165static ssize_t il3945_show_temperature(struct device *d,
3166 struct device_attribute *attr, char *buf) 3166 struct device_attribute *attr, char *buf)
3167{ 3167{
3168 struct iwl_priv *priv = dev_get_drvdata(d); 3168 struct il_priv *priv = dev_get_drvdata(d);
3169 3169
3170 if (!iwl_legacy_is_alive(priv)) 3170 if (!il_is_alive(priv))
3171 return -EAGAIN; 3171 return -EAGAIN;
3172 3172
3173 return sprintf(buf, "%d\n", iwl3945_hw_get_temperature(priv)); 3173 return sprintf(buf, "%d\n", il3945_hw_get_temperature(priv));
3174} 3174}
3175 3175
3176static DEVICE_ATTR(temperature, S_IRUGO, iwl3945_show_temperature, NULL); 3176static DEVICE_ATTR(temperature, S_IRUGO, il3945_show_temperature, NULL);
3177 3177
3178static ssize_t iwl3945_show_tx_power(struct device *d, 3178static ssize_t il3945_show_tx_power(struct device *d,
3179 struct device_attribute *attr, char *buf) 3179 struct device_attribute *attr, char *buf)
3180{ 3180{
3181 struct iwl_priv *priv = dev_get_drvdata(d); 3181 struct il_priv *priv = dev_get_drvdata(d);
3182 return sprintf(buf, "%d\n", priv->tx_power_user_lmt); 3182 return sprintf(buf, "%d\n", priv->tx_power_user_lmt);
3183} 3183}
3184 3184
3185static ssize_t iwl3945_store_tx_power(struct device *d, 3185static ssize_t il3945_store_tx_power(struct device *d,
3186 struct device_attribute *attr, 3186 struct device_attribute *attr,
3187 const char *buf, size_t count) 3187 const char *buf, size_t count)
3188{ 3188{
3189 struct iwl_priv *priv = dev_get_drvdata(d); 3189 struct il_priv *priv = dev_get_drvdata(d);
3190 char *p = (char *)buf; 3190 char *p = (char *)buf;
3191 u32 val; 3191 u32 val;
3192 3192
3193 val = simple_strtoul(p, &p, 10); 3193 val = simple_strtoul(p, &p, 10);
3194 if (p == buf) 3194 if (p == buf)
3195 IWL_INFO(priv, ": %s is not in decimal form.\n", buf); 3195 IL_INFO(priv, ": %s is not in decimal form.\n", buf);
3196 else 3196 else
3197 iwl3945_hw_reg_set_txpower(priv, val); 3197 il3945_hw_reg_set_txpower(priv, val);
3198 3198
3199 return count; 3199 return count;
3200} 3200}
3201 3201
3202static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, iwl3945_show_tx_power, iwl3945_store_tx_power); 3202static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, il3945_show_tx_power, il3945_store_tx_power);
3203 3203
3204static ssize_t iwl3945_show_flags(struct device *d, 3204static ssize_t il3945_show_flags(struct device *d,
3205 struct device_attribute *attr, char *buf) 3205 struct device_attribute *attr, char *buf)
3206{ 3206{
3207 struct iwl_priv *priv = dev_get_drvdata(d); 3207 struct il_priv *priv = dev_get_drvdata(d);
3208 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 3208 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
3209 3209
3210 return sprintf(buf, "0x%04X\n", ctx->active.flags); 3210 return sprintf(buf, "0x%04X\n", ctx->active.flags);
3211} 3211}
3212 3212
3213static ssize_t iwl3945_store_flags(struct device *d, 3213static ssize_t il3945_store_flags(struct device *d,
3214 struct device_attribute *attr, 3214 struct device_attribute *attr,
3215 const char *buf, size_t count) 3215 const char *buf, size_t count)
3216{ 3216{
3217 struct iwl_priv *priv = dev_get_drvdata(d); 3217 struct il_priv *priv = dev_get_drvdata(d);
3218 u32 flags = simple_strtoul(buf, NULL, 0); 3218 u32 flags = simple_strtoul(buf, NULL, 0);
3219 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 3219 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
3220 3220
3221 mutex_lock(&priv->mutex); 3221 mutex_lock(&priv->mutex);
3222 if (le32_to_cpu(ctx->staging.flags) != flags) { 3222 if (le32_to_cpu(ctx->staging.flags) != flags) {
3223 /* Cancel any currently running scans... */ 3223 /* Cancel any currently running scans... */
3224 if (iwl_legacy_scan_cancel_timeout(priv, 100)) 3224 if (il_scan_cancel_timeout(priv, 100))
3225 IWL_WARN(priv, "Could not cancel scan.\n"); 3225 IL_WARN(priv, "Could not cancel scan.\n");
3226 else { 3226 else {
3227 IWL_DEBUG_INFO(priv, "Committing rxon.flags = 0x%04X\n", 3227 IL_DEBUG_INFO(priv, "Committing rxon.flags = 0x%04X\n",
3228 flags); 3228 flags);
3229 ctx->staging.flags = cpu_to_le32(flags); 3229 ctx->staging.flags = cpu_to_le32(flags);
3230 iwl3945_commit_rxon(priv, ctx); 3230 il3945_commit_rxon(priv, ctx);
3231 } 3231 }
3232 } 3232 }
3233 mutex_unlock(&priv->mutex); 3233 mutex_unlock(&priv->mutex);
@@ -3235,37 +3235,37 @@ static ssize_t iwl3945_store_flags(struct device *d,
3235 return count; 3235 return count;
3236} 3236}
3237 3237
3238static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, iwl3945_show_flags, iwl3945_store_flags); 3238static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, il3945_show_flags, il3945_store_flags);
3239 3239
3240static ssize_t iwl3945_show_filter_flags(struct device *d, 3240static ssize_t il3945_show_filter_flags(struct device *d,
3241 struct device_attribute *attr, char *buf) 3241 struct device_attribute *attr, char *buf)
3242{ 3242{
3243 struct iwl_priv *priv = dev_get_drvdata(d); 3243 struct il_priv *priv = dev_get_drvdata(d);
3244 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 3244 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
3245 3245
3246 return sprintf(buf, "0x%04X\n", 3246 return sprintf(buf, "0x%04X\n",
3247 le32_to_cpu(ctx->active.filter_flags)); 3247 le32_to_cpu(ctx->active.filter_flags));
3248} 3248}
3249 3249
3250static ssize_t iwl3945_store_filter_flags(struct device *d, 3250static ssize_t il3945_store_filter_flags(struct device *d,
3251 struct device_attribute *attr, 3251 struct device_attribute *attr,
3252 const char *buf, size_t count) 3252 const char *buf, size_t count)
3253{ 3253{
3254 struct iwl_priv *priv = dev_get_drvdata(d); 3254 struct il_priv *priv = dev_get_drvdata(d);
3255 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 3255 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
3256 u32 filter_flags = simple_strtoul(buf, NULL, 0); 3256 u32 filter_flags = simple_strtoul(buf, NULL, 0);
3257 3257
3258 mutex_lock(&priv->mutex); 3258 mutex_lock(&priv->mutex);
3259 if (le32_to_cpu(ctx->staging.filter_flags) != filter_flags) { 3259 if (le32_to_cpu(ctx->staging.filter_flags) != filter_flags) {
3260 /* Cancel any currently running scans... */ 3260 /* Cancel any currently running scans... */
3261 if (iwl_legacy_scan_cancel_timeout(priv, 100)) 3261 if (il_scan_cancel_timeout(priv, 100))
3262 IWL_WARN(priv, "Could not cancel scan.\n"); 3262 IL_WARN(priv, "Could not cancel scan.\n");
3263 else { 3263 else {
3264 IWL_DEBUG_INFO(priv, "Committing rxon.filter_flags = " 3264 IL_DEBUG_INFO(priv, "Committing rxon.filter_flags = "
3265 "0x%04X\n", filter_flags); 3265 "0x%04X\n", filter_flags);
3266 ctx->staging.filter_flags = 3266 ctx->staging.filter_flags =
3267 cpu_to_le32(filter_flags); 3267 cpu_to_le32(filter_flags);
3268 iwl3945_commit_rxon(priv, ctx); 3268 il3945_commit_rxon(priv, ctx);
3269 } 3269 }
3270 } 3270 }
3271 mutex_unlock(&priv->mutex); 3271 mutex_unlock(&priv->mutex);
@@ -3273,14 +3273,14 @@ static ssize_t iwl3945_store_filter_flags(struct device *d,
3273 return count; 3273 return count;
3274} 3274}
3275 3275
3276static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, iwl3945_show_filter_flags, 3276static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, il3945_show_filter_flags,
3277 iwl3945_store_filter_flags); 3277 il3945_store_filter_flags);
3278 3278
3279static ssize_t iwl3945_show_measurement(struct device *d, 3279static ssize_t il3945_show_measurement(struct device *d,
3280 struct device_attribute *attr, char *buf) 3280 struct device_attribute *attr, char *buf)
3281{ 3281{
3282 struct iwl_priv *priv = dev_get_drvdata(d); 3282 struct il_priv *priv = dev_get_drvdata(d);
3283 struct iwl_spectrum_notification measure_report; 3283 struct il_spectrum_notification measure_report;
3284 u32 size = sizeof(measure_report), len = 0, ofs = 0; 3284 u32 size = sizeof(measure_report), len = 0, ofs = 0;
3285 u8 *data = (u8 *)&measure_report; 3285 u8 *data = (u8 *)&measure_report;
3286 unsigned long flags; 3286 unsigned long flags;
@@ -3308,18 +3308,18 @@ static ssize_t iwl3945_show_measurement(struct device *d,
3308 return len; 3308 return len;
3309} 3309}
3310 3310
3311static ssize_t iwl3945_store_measurement(struct device *d, 3311static ssize_t il3945_store_measurement(struct device *d,
3312 struct device_attribute *attr, 3312 struct device_attribute *attr,
3313 const char *buf, size_t count) 3313 const char *buf, size_t count)
3314{ 3314{
3315 struct iwl_priv *priv = dev_get_drvdata(d); 3315 struct il_priv *priv = dev_get_drvdata(d);
3316 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 3316 struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS];
3317 struct ieee80211_measurement_params params = { 3317 struct ieee80211_measurement_params params = {
3318 .channel = le16_to_cpu(ctx->active.channel), 3318 .channel = le16_to_cpu(ctx->active.channel),
3319 .start_time = cpu_to_le64(priv->_3945.last_tsf), 3319 .start_time = cpu_to_le64(priv->_3945.last_tsf),
3320 .duration = cpu_to_le16(1), 3320 .duration = cpu_to_le16(1),
3321 }; 3321 };
3322 u8 type = IWL_MEASURE_BASIC; 3322 u8 type = IL_MEASURE_BASIC;
3323 u8 buffer[32]; 3323 u8 buffer[32];
3324 u8 channel; 3324 u8 channel;
3325 3325
@@ -3337,21 +3337,21 @@ static ssize_t iwl3945_store_measurement(struct device *d,
3337 type = simple_strtoul(p + 1, NULL, 0); 3337 type = simple_strtoul(p + 1, NULL, 0);
3338 } 3338 }
3339 3339
3340 IWL_DEBUG_INFO(priv, "Invoking measurement of type %d on " 3340 IL_DEBUG_INFO(priv, "Invoking measurement of type %d on "
3341 "channel %d (for '%s')\n", type, params.channel, buf); 3341 "channel %d (for '%s')\n", type, params.channel, buf);
3342 iwl3945_get_measurement(priv, &params, type); 3342 il3945_get_measurement(priv, &params, type);
3343 3343
3344 return count; 3344 return count;
3345} 3345}
3346 3346
3347static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR, 3347static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR,
3348 iwl3945_show_measurement, iwl3945_store_measurement); 3348 il3945_show_measurement, il3945_store_measurement);
3349 3349
3350static ssize_t iwl3945_store_retry_rate(struct device *d, 3350static ssize_t il3945_store_retry_rate(struct device *d,
3351 struct device_attribute *attr, 3351 struct device_attribute *attr,
3352 const char *buf, size_t count) 3352 const char *buf, size_t count)
3353{ 3353{
3354 struct iwl_priv *priv = dev_get_drvdata(d); 3354 struct il_priv *priv = dev_get_drvdata(d);
3355 3355
3356 priv->retry_rate = simple_strtoul(buf, NULL, 0); 3356 priv->retry_rate = simple_strtoul(buf, NULL, 0);
3357 if (priv->retry_rate <= 0) 3357 if (priv->retry_rate <= 0)
@@ -3360,89 +3360,89 @@ static ssize_t iwl3945_store_retry_rate(struct device *d,
3360 return count; 3360 return count;
3361} 3361}
3362 3362
3363static ssize_t iwl3945_show_retry_rate(struct device *d, 3363static ssize_t il3945_show_retry_rate(struct device *d,
3364 struct device_attribute *attr, char *buf) 3364 struct device_attribute *attr, char *buf)
3365{ 3365{
3366 struct iwl_priv *priv = dev_get_drvdata(d); 3366 struct il_priv *priv = dev_get_drvdata(d);
3367 return sprintf(buf, "%d", priv->retry_rate); 3367 return sprintf(buf, "%d", priv->retry_rate);
3368} 3368}
3369 3369
3370static DEVICE_ATTR(retry_rate, S_IWUSR | S_IRUSR, iwl3945_show_retry_rate, 3370static DEVICE_ATTR(retry_rate, S_IWUSR | S_IRUSR, il3945_show_retry_rate,
3371 iwl3945_store_retry_rate); 3371 il3945_store_retry_rate);
3372 3372
3373 3373
3374static ssize_t iwl3945_show_channels(struct device *d, 3374static ssize_t il3945_show_channels(struct device *d,
3375 struct device_attribute *attr, char *buf) 3375 struct device_attribute *attr, char *buf)
3376{ 3376{
3377 /* all this shit doesn't belong into sysfs anyway */ 3377 /* all this shit doesn't belong into sysfs anyway */
3378 return 0; 3378 return 0;
3379} 3379}
3380 3380
3381static DEVICE_ATTR(channels, S_IRUSR, iwl3945_show_channels, NULL); 3381static DEVICE_ATTR(channels, S_IRUSR, il3945_show_channels, NULL);
3382 3382
3383static ssize_t iwl3945_show_antenna(struct device *d, 3383static ssize_t il3945_show_antenna(struct device *d,
3384 struct device_attribute *attr, char *buf) 3384 struct device_attribute *attr, char *buf)
3385{ 3385{
3386 struct iwl_priv *priv = dev_get_drvdata(d); 3386 struct il_priv *priv = dev_get_drvdata(d);
3387 3387
3388 if (!iwl_legacy_is_alive(priv)) 3388 if (!il_is_alive(priv))
3389 return -EAGAIN; 3389 return -EAGAIN;
3390 3390
3391 return sprintf(buf, "%d\n", iwl3945_mod_params.antenna); 3391 return sprintf(buf, "%d\n", il3945_mod_params.antenna);
3392} 3392}
3393 3393
3394static ssize_t iwl3945_store_antenna(struct device *d, 3394static ssize_t il3945_store_antenna(struct device *d,
3395 struct device_attribute *attr, 3395 struct device_attribute *attr,
3396 const char *buf, size_t count) 3396 const char *buf, size_t count)
3397{ 3397{
3398 struct iwl_priv *priv __maybe_unused = dev_get_drvdata(d); 3398 struct il_priv *priv __maybe_unused = dev_get_drvdata(d);
3399 int ant; 3399 int ant;
3400 3400
3401 if (count == 0) 3401 if (count == 0)
3402 return 0; 3402 return 0;
3403 3403
3404 if (sscanf(buf, "%1i", &ant) != 1) { 3404 if (sscanf(buf, "%1i", &ant) != 1) {
3405 IWL_DEBUG_INFO(priv, "not in hex or decimal form.\n"); 3405 IL_DEBUG_INFO(priv, "not in hex or decimal form.\n");
3406 return count; 3406 return count;
3407 } 3407 }
3408 3408
3409 if ((ant >= 0) && (ant <= 2)) { 3409 if ((ant >= 0) && (ant <= 2)) {
3410 IWL_DEBUG_INFO(priv, "Setting antenna select to %d.\n", ant); 3410 IL_DEBUG_INFO(priv, "Setting antenna select to %d.\n", ant);
3411 iwl3945_mod_params.antenna = (enum iwl3945_antenna)ant; 3411 il3945_mod_params.antenna = (enum il3945_antenna)ant;
3412 } else 3412 } else
3413 IWL_DEBUG_INFO(priv, "Bad antenna select value %d.\n", ant); 3413 IL_DEBUG_INFO(priv, "Bad antenna select value %d.\n", ant);
3414 3414
3415 3415
3416 return count; 3416 return count;
3417} 3417}
3418 3418
3419static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, iwl3945_show_antenna, iwl3945_store_antenna); 3419static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, il3945_show_antenna, il3945_store_antenna);
3420 3420
3421static ssize_t iwl3945_show_status(struct device *d, 3421static ssize_t il3945_show_status(struct device *d,
3422 struct device_attribute *attr, char *buf) 3422 struct device_attribute *attr, char *buf)
3423{ 3423{
3424 struct iwl_priv *priv = dev_get_drvdata(d); 3424 struct il_priv *priv = dev_get_drvdata(d);
3425 if (!iwl_legacy_is_alive(priv)) 3425 if (!il_is_alive(priv))
3426 return -EAGAIN; 3426 return -EAGAIN;
3427 return sprintf(buf, "0x%08x\n", (int)priv->status); 3427 return sprintf(buf, "0x%08x\n", (int)priv->status);
3428} 3428}
3429 3429
3430static DEVICE_ATTR(status, S_IRUGO, iwl3945_show_status, NULL); 3430static DEVICE_ATTR(status, S_IRUGO, il3945_show_status, NULL);
3431 3431
3432static ssize_t iwl3945_dump_error_log(struct device *d, 3432static ssize_t il3945_dump_error_log(struct device *d,
3433 struct device_attribute *attr, 3433 struct device_attribute *attr,
3434 const char *buf, size_t count) 3434 const char *buf, size_t count)
3435{ 3435{
3436 struct iwl_priv *priv = dev_get_drvdata(d); 3436 struct il_priv *priv = dev_get_drvdata(d);
3437 char *p = (char *)buf; 3437 char *p = (char *)buf;
3438 3438
3439 if (p[0] == '1') 3439 if (p[0] == '1')
3440 iwl3945_dump_nic_error_log(priv); 3440 il3945_dump_nic_error_log(priv);
3441 3441
3442 return strnlen(buf, count); 3442 return strnlen(buf, count);
3443} 3443}
3444 3444
3445static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, iwl3945_dump_error_log); 3445static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, il3945_dump_error_log);
3446 3446
3447/***************************************************************************** 3447/*****************************************************************************
3448 * 3448 *
@@ -3450,41 +3450,41 @@ static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, iwl3945_dump_error_log);
3450 * 3450 *
3451 *****************************************************************************/ 3451 *****************************************************************************/
3452 3452
3453static void iwl3945_setup_deferred_work(struct iwl_priv *priv) 3453static void il3945_setup_deferred_work(struct il_priv *priv)
3454{ 3454{
3455 priv->workqueue = create_singlethread_workqueue(DRV_NAME); 3455 priv->workqueue = create_singlethread_workqueue(DRV_NAME);
3456 3456
3457 init_waitqueue_head(&priv->wait_command_queue); 3457 init_waitqueue_head(&priv->wait_command_queue);
3458 3458
3459 INIT_WORK(&priv->restart, iwl3945_bg_restart); 3459 INIT_WORK(&priv->restart, il3945_bg_restart);
3460 INIT_WORK(&priv->rx_replenish, iwl3945_bg_rx_replenish); 3460 INIT_WORK(&priv->rx_replenish, il3945_bg_rx_replenish);
3461 INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); 3461 INIT_DELAYED_WORK(&priv->init_alive_start, il3945_bg_init_alive_start);
3462 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); 3462 INIT_DELAYED_WORK(&priv->alive_start, il3945_bg_alive_start);
3463 INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll); 3463 INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, il3945_rfkill_poll);
3464 3464
3465 iwl_legacy_setup_scan_deferred_work(priv); 3465 il_setup_scan_deferred_work(priv);
3466 3466
3467 iwl3945_hw_setup_deferred_work(priv); 3467 il3945_hw_setup_deferred_work(priv);
3468 3468
3469 init_timer(&priv->watchdog); 3469 init_timer(&priv->watchdog);
3470 priv->watchdog.data = (unsigned long)priv; 3470 priv->watchdog.data = (unsigned long)priv;
3471 priv->watchdog.function = iwl_legacy_bg_watchdog; 3471 priv->watchdog.function = il_bg_watchdog;
3472 3472
3473 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) 3473 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
3474 iwl3945_irq_tasklet, (unsigned long)priv); 3474 il3945_irq_tasklet, (unsigned long)priv);
3475} 3475}
3476 3476
3477static void iwl3945_cancel_deferred_work(struct iwl_priv *priv) 3477static void il3945_cancel_deferred_work(struct il_priv *priv)
3478{ 3478{
3479 iwl3945_hw_cancel_deferred_work(priv); 3479 il3945_hw_cancel_deferred_work(priv);
3480 3480
3481 cancel_delayed_work_sync(&priv->init_alive_start); 3481 cancel_delayed_work_sync(&priv->init_alive_start);
3482 cancel_delayed_work(&priv->alive_start); 3482 cancel_delayed_work(&priv->alive_start);
3483 3483
3484 iwl_legacy_cancel_scan_deferred_work(priv); 3484 il_cancel_scan_deferred_work(priv);
3485} 3485}
3486 3486
3487static struct attribute *iwl3945_sysfs_entries[] = { 3487static struct attribute *il3945_sysfs_entries[] = {
3488 &dev_attr_antenna.attr, 3488 &dev_attr_antenna.attr,
3489 &dev_attr_channels.attr, 3489 &dev_attr_channels.attr,
3490 &dev_attr_dump_errors.attr, 3490 &dev_attr_dump_errors.attr,
@@ -3501,34 +3501,34 @@ static struct attribute *iwl3945_sysfs_entries[] = {
3501 NULL 3501 NULL
3502}; 3502};
3503 3503
3504static struct attribute_group iwl3945_attribute_group = { 3504static struct attribute_group il3945_attribute_group = {
3505 .name = NULL, /* put in device directory */ 3505 .name = NULL, /* put in device directory */
3506 .attrs = iwl3945_sysfs_entries, 3506 .attrs = il3945_sysfs_entries,
3507}; 3507};
3508 3508
3509struct ieee80211_ops iwl3945_hw_ops = { 3509struct ieee80211_ops il3945_hw_ops = {
3510 .tx = iwl3945_mac_tx, 3510 .tx = il3945_mac_tx,
3511 .start = iwl3945_mac_start, 3511 .start = il3945_mac_start,
3512 .stop = iwl3945_mac_stop, 3512 .stop = il3945_mac_stop,
3513 .add_interface = iwl_legacy_mac_add_interface, 3513 .add_interface = il_mac_add_interface,
3514 .remove_interface = iwl_legacy_mac_remove_interface, 3514 .remove_interface = il_mac_remove_interface,
3515 .change_interface = iwl_legacy_mac_change_interface, 3515 .change_interface = il_mac_change_interface,
3516 .config = iwl_legacy_mac_config, 3516 .config = il_mac_config,
3517 .configure_filter = iwl3945_configure_filter, 3517 .configure_filter = il3945_configure_filter,
3518 .set_key = iwl3945_mac_set_key, 3518 .set_key = il3945_mac_set_key,
3519 .conf_tx = iwl_legacy_mac_conf_tx, 3519 .conf_tx = il_mac_conf_tx,
3520 .reset_tsf = iwl_legacy_mac_reset_tsf, 3520 .reset_tsf = il_mac_reset_tsf,
3521 .bss_info_changed = iwl_legacy_mac_bss_info_changed, 3521 .bss_info_changed = il_mac_bss_info_changed,
3522 .hw_scan = iwl_legacy_mac_hw_scan, 3522 .hw_scan = il_mac_hw_scan,
3523 .sta_add = iwl3945_mac_sta_add, 3523 .sta_add = il3945_mac_sta_add,
3524 .sta_remove = iwl_legacy_mac_sta_remove, 3524 .sta_remove = il_mac_sta_remove,
3525 .tx_last_beacon = iwl_legacy_mac_tx_last_beacon, 3525 .tx_last_beacon = il_mac_tx_last_beacon,
3526}; 3526};
3527 3527
3528static int iwl3945_init_drv(struct iwl_priv *priv) 3528static int il3945_init_drv(struct il_priv *priv)
3529{ 3529{
3530 int ret; 3530 int ret;
3531 struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; 3531 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom;
3532 3532
3533 priv->retry_rate = 1; 3533 priv->retry_rate = 1;
3534 priv->beacon_skb = NULL; 3534 priv->beacon_skb = NULL;
@@ -3545,61 +3545,61 @@ static int iwl3945_init_drv(struct iwl_priv *priv)
3545 priv->band = IEEE80211_BAND_2GHZ; 3545 priv->band = IEEE80211_BAND_2GHZ;
3546 3546
3547 priv->iw_mode = NL80211_IFTYPE_STATION; 3547 priv->iw_mode = NL80211_IFTYPE_STATION;
3548 priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; 3548 priv->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF;
3549 3549
3550 /* initialize force reset */ 3550 /* initialize force reset */
3551 priv->force_reset.reset_duration = IWL_DELAY_NEXT_FORCE_FW_RELOAD; 3551 priv->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD;
3552 3552
3553 if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { 3553 if (eeprom->version < EEPROM_3945_EEPROM_VERSION) {
3554 IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", 3554 IL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n",
3555 eeprom->version); 3555 eeprom->version);
3556 ret = -EINVAL; 3556 ret = -EINVAL;
3557 goto err; 3557 goto err;
3558 } 3558 }
3559 ret = iwl_legacy_init_channel_map(priv); 3559 ret = il_init_channel_map(priv);
3560 if (ret) { 3560 if (ret) {
3561 IWL_ERR(priv, "initializing regulatory failed: %d\n", ret); 3561 IL_ERR(priv, "initializing regulatory failed: %d\n", ret);
3562 goto err; 3562 goto err;
3563 } 3563 }
3564 3564
3565 /* Set up txpower settings in driver for all channels */ 3565 /* Set up txpower settings in driver for all channels */
3566 if (iwl3945_txpower_set_from_eeprom(priv)) { 3566 if (il3945_txpower_set_from_eeprom(priv)) {
3567 ret = -EIO; 3567 ret = -EIO;
3568 goto err_free_channel_map; 3568 goto err_free_channel_map;
3569 } 3569 }
3570 3570
3571 ret = iwl_legacy_init_geos(priv); 3571 ret = il_init_geos(priv);
3572 if (ret) { 3572 if (ret) {
3573 IWL_ERR(priv, "initializing geos failed: %d\n", ret); 3573 IL_ERR(priv, "initializing geos failed: %d\n", ret);
3574 goto err_free_channel_map; 3574 goto err_free_channel_map;
3575 } 3575 }
3576 iwl3945_init_hw_rates(priv, priv->ieee_rates); 3576 il3945_init_hw_rates(priv, priv->ieee_rates);
3577 3577
3578 return 0; 3578 return 0;
3579 3579
3580err_free_channel_map: 3580err_free_channel_map:
3581 iwl_legacy_free_channel_map(priv); 3581 il_free_channel_map(priv);
3582err: 3582err:
3583 return ret; 3583 return ret;
3584} 3584}
3585 3585
3586#define IWL3945_MAX_PROBE_REQUEST 200 3586#define IWL3945_MAX_PROBE_REQUEST 200
3587 3587
3588static int iwl3945_setup_mac(struct iwl_priv *priv) 3588static int il3945_setup_mac(struct il_priv *priv)
3589{ 3589{
3590 int ret; 3590 int ret;
3591 struct ieee80211_hw *hw = priv->hw; 3591 struct ieee80211_hw *hw = priv->hw;
3592 3592
3593 hw->rate_control_algorithm = "iwl-3945-rs"; 3593 hw->rate_control_algorithm = "iwl-3945-rs";
3594 hw->sta_data_size = sizeof(struct iwl3945_sta_priv); 3594 hw->sta_data_size = sizeof(struct il3945_sta_priv);
3595 hw->vif_data_size = sizeof(struct iwl_vif_priv); 3595 hw->vif_data_size = sizeof(struct il_vif_priv);
3596 3596
3597 /* Tell mac80211 our characteristics */ 3597 /* Tell mac80211 our characteristics */
3598 hw->flags = IEEE80211_HW_SIGNAL_DBM | 3598 hw->flags = IEEE80211_HW_SIGNAL_DBM |
3599 IEEE80211_HW_SPECTRUM_MGMT; 3599 IEEE80211_HW_SPECTRUM_MGMT;
3600 3600
3601 hw->wiphy->interface_modes = 3601 hw->wiphy->interface_modes =
3602 priv->contexts[IWL_RXON_CTX_BSS].interface_modes; 3602 priv->contexts[IL_RXON_CTX_BSS].interface_modes;
3603 3603
3604 hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | 3604 hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
3605 WIPHY_FLAG_DISABLE_BEACON_HINTS | 3605 WIPHY_FLAG_DISABLE_BEACON_HINTS |
@@ -3620,11 +3620,11 @@ static int iwl3945_setup_mac(struct iwl_priv *priv)
3620 priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = 3620 priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
3621 &priv->bands[IEEE80211_BAND_5GHZ]; 3621 &priv->bands[IEEE80211_BAND_5GHZ];
3622 3622
3623 iwl_legacy_leds_init(priv); 3623 il_leds_init(priv);
3624 3624
3625 ret = ieee80211_register_hw(priv->hw); 3625 ret = ieee80211_register_hw(priv->hw);
3626 if (ret) { 3626 if (ret) {
3627 IWL_ERR(priv, "Failed to register hw (error %d)\n", ret); 3627 IL_ERR(priv, "Failed to register hw (error %d)\n", ret);
3628 return ret; 3628 return ret;
3629 } 3629 }
3630 priv->mac80211_registered = 1; 3630 priv->mac80211_registered = 1;
@@ -3632,13 +3632,13 @@ static int iwl3945_setup_mac(struct iwl_priv *priv)
3632 return 0; 3632 return 0;
3633} 3633}
3634 3634
3635static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 3635static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3636{ 3636{
3637 int err = 0, i; 3637 int err = 0, i;
3638 struct iwl_priv *priv; 3638 struct il_priv *priv;
3639 struct ieee80211_hw *hw; 3639 struct ieee80211_hw *hw;
3640 struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); 3640 struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data);
3641 struct iwl3945_eeprom *eeprom; 3641 struct il3945_eeprom *eeprom;
3642 unsigned long flags; 3642 unsigned long flags;
3643 3643
3644 /*********************** 3644 /***********************
@@ -3647,7 +3647,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3647 3647
3648 /* mac80211 allocates memory for this device instance, including 3648 /* mac80211 allocates memory for this device instance, including
3649 * space for this driver's private structure */ 3649 * space for this driver's private structure */
3650 hw = iwl_legacy_alloc_all(cfg); 3650 hw = il_alloc_all(cfg);
3651 if (hw == NULL) { 3651 if (hw == NULL) {
3652 pr_err("Can not allocate network device\n"); 3652 pr_err("Can not allocate network device\n");
3653 err = -ENOMEM; 3653 err = -ENOMEM;
@@ -3659,40 +3659,40 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3659 priv->cmd_queue = IWL39_CMD_QUEUE_NUM; 3659 priv->cmd_queue = IWL39_CMD_QUEUE_NUM;
3660 3660
3661 /* 3945 has only one valid context */ 3661 /* 3945 has only one valid context */
3662 priv->valid_contexts = BIT(IWL_RXON_CTX_BSS); 3662 priv->valid_contexts = BIT(IL_RXON_CTX_BSS);
3663 3663
3664 for (i = 0; i < NUM_IWL_RXON_CTX; i++) 3664 for (i = 0; i < NUM_IL_RXON_CTX; i++)
3665 priv->contexts[i].ctxid = i; 3665 priv->contexts[i].ctxid = i;
3666 3666
3667 priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; 3667 priv->contexts[IL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON;
3668 priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; 3668 priv->contexts[IL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING;
3669 priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; 3669 priv->contexts[IL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC;
3670 priv->contexts[IWL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; 3670 priv->contexts[IL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM;
3671 priv->contexts[IWL_RXON_CTX_BSS].ap_sta_id = IWL_AP_ID; 3671 priv->contexts[IL_RXON_CTX_BSS].ap_sta_id = IL_AP_ID;
3672 priv->contexts[IWL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; 3672 priv->contexts[IL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY;
3673 priv->contexts[IWL_RXON_CTX_BSS].interface_modes = 3673 priv->contexts[IL_RXON_CTX_BSS].interface_modes =
3674 BIT(NL80211_IFTYPE_STATION) | 3674 BIT(NL80211_IFTYPE_STATION) |
3675 BIT(NL80211_IFTYPE_ADHOC); 3675 BIT(NL80211_IFTYPE_ADHOC);
3676 priv->contexts[IWL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; 3676 priv->contexts[IL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS;
3677 priv->contexts[IWL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; 3677 priv->contexts[IL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS;
3678 priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; 3678 priv->contexts[IL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS;
3679 3679
3680 /* 3680 /*
3681 * Disabling hardware scan means that mac80211 will perform scans 3681 * Disabling hardware scan means that mac80211 will perform scans
3682 * "the hard way", rather than using device's scan. 3682 * "the hard way", rather than using device's scan.
3683 */ 3683 */
3684 if (iwl3945_mod_params.disable_hw_scan) { 3684 if (il3945_mod_params.disable_hw_scan) {
3685 IWL_DEBUG_INFO(priv, "Disabling hw_scan\n"); 3685 IL_DEBUG_INFO(priv, "Disabling hw_scan\n");
3686 iwl3945_hw_ops.hw_scan = NULL; 3686 il3945_hw_ops.hw_scan = NULL;
3687 } 3687 }
3688 3688
3689 IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); 3689 IL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n");
3690 priv->cfg = cfg; 3690 priv->cfg = cfg;
3691 priv->pci_dev = pdev; 3691 priv->pci_dev = pdev;
3692 priv->inta_mask = CSR_INI_SET_MASK; 3692 priv->inta_mask = CSR_INI_SET_MASK;
3693 3693
3694 if (iwl_legacy_alloc_traffic_mem(priv)) 3694 if (il_alloc_traffic_mem(priv))
3695 IWL_ERR(priv, "Not enough memory to generate traffic log\n"); 3695 IL_ERR(priv, "Not enough memory to generate traffic log\n");
3696 3696
3697 /*************************** 3697 /***************************
3698 * 2. Initializing PCI bus 3698 * 2. Initializing PCI bus
@@ -3711,7 +3711,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3711 if (!err) 3711 if (!err)
3712 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 3712 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
3713 if (err) { 3713 if (err) {
3714 IWL_WARN(priv, "No suitable DMA available.\n"); 3714 IL_WARN(priv, "No suitable DMA available.\n");
3715 goto out_pci_disable_device; 3715 goto out_pci_disable_device;
3716 } 3716 }
3717 3717
@@ -3729,9 +3729,9 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3729 goto out_pci_release_regions; 3729 goto out_pci_release_regions;
3730 } 3730 }
3731 3731
3732 IWL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n", 3732 IL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n",
3733 (unsigned long long) pci_resource_len(pdev, 0)); 3733 (unsigned long long) pci_resource_len(pdev, 0));
3734 IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); 3734 IL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base);
3735 3735
3736 /* We disable the RETRY_TIMEOUT register (0x41) to keep 3736 /* We disable the RETRY_TIMEOUT register (0x41) to keep
3737 * PCI Tx retries from interfering with C3 CPU state */ 3737 * PCI Tx retries from interfering with C3 CPU state */
@@ -3748,29 +3748,29 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3748 * strange state ... like being left stranded by a primary kernel 3748 * strange state ... like being left stranded by a primary kernel
3749 * and this is now the kdump kernel trying to start up 3749 * and this is now the kdump kernel trying to start up
3750 */ 3750 */
3751 iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); 3751 il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
3752 3752
3753 /*********************** 3753 /***********************
3754 * 4. Read EEPROM 3754 * 4. Read EEPROM
3755 * ********************/ 3755 * ********************/
3756 3756
3757 /* Read the EEPROM */ 3757 /* Read the EEPROM */
3758 err = iwl_legacy_eeprom_init(priv); 3758 err = il_eeprom_init(priv);
3759 if (err) { 3759 if (err) {
3760 IWL_ERR(priv, "Unable to init EEPROM\n"); 3760 IL_ERR(priv, "Unable to init EEPROM\n");
3761 goto out_iounmap; 3761 goto out_iounmap;
3762 } 3762 }
3763 /* MAC Address location in EEPROM same for 3945/4965 */ 3763 /* MAC Address location in EEPROM same for 3945/4965 */
3764 eeprom = (struct iwl3945_eeprom *)priv->eeprom; 3764 eeprom = (struct il3945_eeprom *)priv->eeprom;
3765 IWL_DEBUG_INFO(priv, "MAC address: %pM\n", eeprom->mac_address); 3765 IL_DEBUG_INFO(priv, "MAC address: %pM\n", eeprom->mac_address);
3766 SET_IEEE80211_PERM_ADDR(priv->hw, eeprom->mac_address); 3766 SET_IEEE80211_PERM_ADDR(priv->hw, eeprom->mac_address);
3767 3767
3768 /*********************** 3768 /***********************
3769 * 5. Setup HW Constants 3769 * 5. Setup HW Constants
3770 * ********************/ 3770 * ********************/
3771 /* Device-specific setup */ 3771 /* Device-specific setup */
3772 if (iwl3945_hw_set_hw_params(priv)) { 3772 if (il3945_hw_set_hw_params(priv)) {
3773 IWL_ERR(priv, "failed to set hw settings\n"); 3773 IL_ERR(priv, "failed to set hw settings\n");
3774 goto out_eeprom_free; 3774 goto out_eeprom_free;
3775 } 3775 }
3776 3776
@@ -3778,13 +3778,13 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3778 * 6. Setup priv 3778 * 6. Setup priv
3779 * ********************/ 3779 * ********************/
3780 3780
3781 err = iwl3945_init_drv(priv); 3781 err = il3945_init_drv(priv);
3782 if (err) { 3782 if (err) {
3783 IWL_ERR(priv, "initializing driver failed\n"); 3783 IL_ERR(priv, "initializing driver failed\n");
3784 goto out_unset_hw_params; 3784 goto out_unset_hw_params;
3785 } 3785 }
3786 3786
3787 IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n", 3787 IL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n",
3788 priv->cfg->name); 3788 priv->cfg->name);
3789 3789
3790 /*********************** 3790 /***********************
@@ -3792,44 +3792,44 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3792 * ********************/ 3792 * ********************/
3793 3793
3794 spin_lock_irqsave(&priv->lock, flags); 3794 spin_lock_irqsave(&priv->lock, flags);
3795 iwl_legacy_disable_interrupts(priv); 3795 il_disable_interrupts(priv);
3796 spin_unlock_irqrestore(&priv->lock, flags); 3796 spin_unlock_irqrestore(&priv->lock, flags);
3797 3797
3798 pci_enable_msi(priv->pci_dev); 3798 pci_enable_msi(priv->pci_dev);
3799 3799
3800 err = request_irq(priv->pci_dev->irq, iwl_legacy_isr, 3800 err = request_irq(priv->pci_dev->irq, il_isr,
3801 IRQF_SHARED, DRV_NAME, priv); 3801 IRQF_SHARED, DRV_NAME, priv);
3802 if (err) { 3802 if (err) {
3803 IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); 3803 IL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq);
3804 goto out_disable_msi; 3804 goto out_disable_msi;
3805 } 3805 }
3806 3806
3807 err = sysfs_create_group(&pdev->dev.kobj, &iwl3945_attribute_group); 3807 err = sysfs_create_group(&pdev->dev.kobj, &il3945_attribute_group);
3808 if (err) { 3808 if (err) {
3809 IWL_ERR(priv, "failed to create sysfs device attributes\n"); 3809 IL_ERR(priv, "failed to create sysfs device attributes\n");
3810 goto out_release_irq; 3810 goto out_release_irq;
3811 } 3811 }
3812 3812
3813 iwl_legacy_set_rxon_channel(priv, 3813 il_set_rxon_channel(priv,
3814 &priv->bands[IEEE80211_BAND_2GHZ].channels[5], 3814 &priv->bands[IEEE80211_BAND_2GHZ].channels[5],
3815 &priv->contexts[IWL_RXON_CTX_BSS]); 3815 &priv->contexts[IL_RXON_CTX_BSS]);
3816 iwl3945_setup_deferred_work(priv); 3816 il3945_setup_deferred_work(priv);
3817 iwl3945_setup_rx_handlers(priv); 3817 il3945_setup_rx_handlers(priv);
3818 iwl_legacy_power_initialize(priv); 3818 il_power_initialize(priv);
3819 3819
3820 /********************************* 3820 /*********************************
3821 * 8. Setup and Register mac80211 3821 * 8. Setup and Register mac80211
3822 * *******************************/ 3822 * *******************************/
3823 3823
3824 iwl_legacy_enable_interrupts(priv); 3824 il_enable_interrupts(priv);
3825 3825
3826 err = iwl3945_setup_mac(priv); 3826 err = il3945_setup_mac(priv);
3827 if (err) 3827 if (err)
3828 goto out_remove_sysfs; 3828 goto out_remove_sysfs;
3829 3829
3830 err = iwl_legacy_dbgfs_register(priv, DRV_NAME); 3830 err = il_dbgfs_register(priv, DRV_NAME);
3831 if (err) 3831 if (err)
3832 IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); 3832 IL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err);
3833 3833
3834 /* Start monitoring the killswitch */ 3834 /* Start monitoring the killswitch */
3835 queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, 3835 queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll,
@@ -3840,17 +3840,17 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3840 out_remove_sysfs: 3840 out_remove_sysfs:
3841 destroy_workqueue(priv->workqueue); 3841 destroy_workqueue(priv->workqueue);
3842 priv->workqueue = NULL; 3842 priv->workqueue = NULL;
3843 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); 3843 sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group);
3844 out_release_irq: 3844 out_release_irq:
3845 free_irq(priv->pci_dev->irq, priv); 3845 free_irq(priv->pci_dev->irq, priv);
3846 out_disable_msi: 3846 out_disable_msi:
3847 pci_disable_msi(priv->pci_dev); 3847 pci_disable_msi(priv->pci_dev);
3848 iwl_legacy_free_geos(priv); 3848 il_free_geos(priv);
3849 iwl_legacy_free_channel_map(priv); 3849 il_free_channel_map(priv);
3850 out_unset_hw_params: 3850 out_unset_hw_params:
3851 iwl3945_unset_hw_params(priv); 3851 il3945_unset_hw_params(priv);
3852 out_eeprom_free: 3852 out_eeprom_free:
3853 iwl_legacy_eeprom_free(priv); 3853 il_eeprom_free(priv);
3854 out_iounmap: 3854 out_iounmap:
3855 pci_iounmap(pdev, priv->hw_base); 3855 pci_iounmap(pdev, priv->hw_base);
3856 out_pci_release_regions: 3856 out_pci_release_regions:
@@ -3859,74 +3859,74 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3859 pci_set_drvdata(pdev, NULL); 3859 pci_set_drvdata(pdev, NULL);
3860 pci_disable_device(pdev); 3860 pci_disable_device(pdev);
3861 out_ieee80211_free_hw: 3861 out_ieee80211_free_hw:
3862 iwl_legacy_free_traffic_mem(priv); 3862 il_free_traffic_mem(priv);
3863 ieee80211_free_hw(priv->hw); 3863 ieee80211_free_hw(priv->hw);
3864 out: 3864 out:
3865 return err; 3865 return err;
3866} 3866}
3867 3867
3868static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) 3868static void __devexit il3945_pci_remove(struct pci_dev *pdev)
3869{ 3869{
3870 struct iwl_priv *priv = pci_get_drvdata(pdev); 3870 struct il_priv *priv = pci_get_drvdata(pdev);
3871 unsigned long flags; 3871 unsigned long flags;
3872 3872
3873 if (!priv) 3873 if (!priv)
3874 return; 3874 return;
3875 3875
3876 IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); 3876 IL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n");
3877 3877
3878 iwl_legacy_dbgfs_unregister(priv); 3878 il_dbgfs_unregister(priv);
3879 3879
3880 set_bit(STATUS_EXIT_PENDING, &priv->status); 3880 set_bit(STATUS_EXIT_PENDING, &priv->status);
3881 3881
3882 iwl_legacy_leds_exit(priv); 3882 il_leds_exit(priv);
3883 3883
3884 if (priv->mac80211_registered) { 3884 if (priv->mac80211_registered) {
3885 ieee80211_unregister_hw(priv->hw); 3885 ieee80211_unregister_hw(priv->hw);
3886 priv->mac80211_registered = 0; 3886 priv->mac80211_registered = 0;
3887 } else { 3887 } else {
3888 iwl3945_down(priv); 3888 il3945_down(priv);
3889 } 3889 }
3890 3890
3891 /* 3891 /*
3892 * Make sure device is reset to low power before unloading driver. 3892 * Make sure device is reset to low power before unloading driver.
3893 * This may be redundant with iwl_down(), but there are paths to 3893 * This may be redundant with il_down(), but there are paths to
3894 * run iwl_down() without calling apm_ops.stop(), and there are 3894 * run il_down() without calling apm_ops.stop(), and there are
3895 * paths to avoid running iwl_down() at all before leaving driver. 3895 * paths to avoid running il_down() at all before leaving driver.
3896 * This (inexpensive) call *makes sure* device is reset. 3896 * This (inexpensive) call *makes sure* device is reset.
3897 */ 3897 */
3898 iwl_legacy_apm_stop(priv); 3898 il_apm_stop(priv);
3899 3899
3900 /* make sure we flush any pending irq or 3900 /* make sure we flush any pending irq or
3901 * tasklet for the driver 3901 * tasklet for the driver
3902 */ 3902 */
3903 spin_lock_irqsave(&priv->lock, flags); 3903 spin_lock_irqsave(&priv->lock, flags);
3904 iwl_legacy_disable_interrupts(priv); 3904 il_disable_interrupts(priv);
3905 spin_unlock_irqrestore(&priv->lock, flags); 3905 spin_unlock_irqrestore(&priv->lock, flags);
3906 3906
3907 iwl3945_synchronize_irq(priv); 3907 il3945_synchronize_irq(priv);
3908 3908
3909 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); 3909 sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group);
3910 3910
3911 cancel_delayed_work_sync(&priv->_3945.rfkill_poll); 3911 cancel_delayed_work_sync(&priv->_3945.rfkill_poll);
3912 3912
3913 iwl3945_dealloc_ucode_pci(priv); 3913 il3945_dealloc_ucode_pci(priv);
3914 3914
3915 if (priv->rxq.bd) 3915 if (priv->rxq.bd)
3916 iwl3945_rx_queue_free(priv, &priv->rxq); 3916 il3945_rx_queue_free(priv, &priv->rxq);
3917 iwl3945_hw_txq_ctx_free(priv); 3917 il3945_hw_txq_ctx_free(priv);
3918 3918
3919 iwl3945_unset_hw_params(priv); 3919 il3945_unset_hw_params(priv);
3920 3920
3921 /*netif_stop_queue(dev); */ 3921 /*netif_stop_queue(dev); */
3922 flush_workqueue(priv->workqueue); 3922 flush_workqueue(priv->workqueue);
3923 3923
3924 /* ieee80211_unregister_hw calls iwl3945_mac_stop, which flushes 3924 /* ieee80211_unregister_hw calls il3945_mac_stop, which flushes
3925 * priv->workqueue... so we can't take down the workqueue 3925 * priv->workqueue... so we can't take down the workqueue
3926 * until now... */ 3926 * until now... */
3927 destroy_workqueue(priv->workqueue); 3927 destroy_workqueue(priv->workqueue);
3928 priv->workqueue = NULL; 3928 priv->workqueue = NULL;
3929 iwl_legacy_free_traffic_mem(priv); 3929 il_free_traffic_mem(priv);
3930 3930
3931 free_irq(pdev->irq, priv); 3931 free_irq(pdev->irq, priv);
3932 pci_disable_msi(pdev); 3932 pci_disable_msi(pdev);
@@ -3936,8 +3936,8 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
3936 pci_disable_device(pdev); 3936 pci_disable_device(pdev);
3937 pci_set_drvdata(pdev, NULL); 3937 pci_set_drvdata(pdev, NULL);
3938 3938
3939 iwl_legacy_free_channel_map(priv); 3939 il_free_channel_map(priv);
3940 iwl_legacy_free_geos(priv); 3940 il_free_geos(priv);
3941 kfree(priv->scan_cmd); 3941 kfree(priv->scan_cmd);
3942 if (priv->beacon_skb) 3942 if (priv->beacon_skb)
3943 dev_kfree_skb(priv->beacon_skb); 3943 dev_kfree_skb(priv->beacon_skb);
@@ -3952,28 +3952,28 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
3952 * 3952 *
3953 *****************************************************************************/ 3953 *****************************************************************************/
3954 3954
3955static struct pci_driver iwl3945_driver = { 3955static struct pci_driver il3945_driver = {
3956 .name = DRV_NAME, 3956 .name = DRV_NAME,
3957 .id_table = iwl3945_hw_card_ids, 3957 .id_table = il3945_hw_card_ids,
3958 .probe = iwl3945_pci_probe, 3958 .probe = il3945_pci_probe,
3959 .remove = __devexit_p(iwl3945_pci_remove), 3959 .remove = __devexit_p(il3945_pci_remove),
3960 .driver.pm = IWL_LEGACY_PM_OPS, 3960 .driver.pm = IL_LEGACY_PM_OPS,
3961}; 3961};
3962 3962
3963static int __init iwl3945_init(void) 3963static int __init il3945_init(void)
3964{ 3964{
3965 3965
3966 int ret; 3966 int ret;
3967 pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n"); 3967 pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n");
3968 pr_info(DRV_COPYRIGHT "\n"); 3968 pr_info(DRV_COPYRIGHT "\n");
3969 3969
3970 ret = iwl3945_rate_control_register(); 3970 ret = il3945_rate_control_register();
3971 if (ret) { 3971 if (ret) {
3972 pr_err("Unable to register rate control algorithm: %d\n", ret); 3972 pr_err("Unable to register rate control algorithm: %d\n", ret);
3973 return ret; 3973 return ret;
3974 } 3974 }
3975 3975
3976 ret = pci_register_driver(&iwl3945_driver); 3976 ret = pci_register_driver(&il3945_driver);
3977 if (ret) { 3977 if (ret) {
3978 pr_err("Unable to initialize PCI module\n"); 3978 pr_err("Unable to initialize PCI module\n");
3979 goto error_register; 3979 goto error_register;
@@ -3982,32 +3982,32 @@ static int __init iwl3945_init(void)
3982 return ret; 3982 return ret;
3983 3983
3984error_register: 3984error_register:
3985 iwl3945_rate_control_unregister(); 3985 il3945_rate_control_unregister();
3986 return ret; 3986 return ret;
3987} 3987}
3988 3988
3989static void __exit iwl3945_exit(void) 3989static void __exit il3945_exit(void)
3990{ 3990{
3991 pci_unregister_driver(&iwl3945_driver); 3991 pci_unregister_driver(&il3945_driver);
3992 iwl3945_rate_control_unregister(); 3992 il3945_rate_control_unregister();
3993} 3993}
3994 3994
3995MODULE_FIRMWARE(IWL3945_MODULE_FIRMWARE(IWL3945_UCODE_API_MAX)); 3995MODULE_FIRMWARE(IWL3945_MODULE_FIRMWARE(IWL3945_UCODE_API_MAX));
3996 3996
3997module_param_named(antenna, iwl3945_mod_params.antenna, int, S_IRUGO); 3997module_param_named(antenna, il3945_mod_params.antenna, int, S_IRUGO);
3998MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); 3998MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])");
3999module_param_named(swcrypto, iwl3945_mod_params.sw_crypto, int, S_IRUGO); 3999module_param_named(swcrypto, il3945_mod_params.sw_crypto, int, S_IRUGO);
4000MODULE_PARM_DESC(swcrypto, 4000MODULE_PARM_DESC(swcrypto,
4001 "using software crypto (default 1 [software])"); 4001 "using software crypto (default 1 [software])");
4002module_param_named(disable_hw_scan, iwl3945_mod_params.disable_hw_scan, 4002module_param_named(disable_hw_scan, il3945_mod_params.disable_hw_scan,
4003 int, S_IRUGO); 4003 int, S_IRUGO);
4004MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 1)"); 4004MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 1)");
4005#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 4005#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
4006module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR); 4006module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR);
4007MODULE_PARM_DESC(debug, "debug output mask"); 4007MODULE_PARM_DESC(debug, "debug output mask");
4008#endif 4008#endif
4009module_param_named(fw_restart, iwl3945_mod_params.restart_fw, int, S_IRUGO); 4009module_param_named(fw_restart, il3945_mod_params.restart_fw, int, S_IRUGO);
4010MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); 4010MODULE_PARM_DESC(fw_restart, "restart firmware in case of error");
4011 4011
4012module_exit(iwl3945_exit); 4012module_exit(il3945_exit);
4013module_init(iwl3945_init); 4013module_init(il3945_init);