diff options
author | Don Fry <donald.h.fry@intel.com> | 2012-02-07 18:00:12 -0500 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2012-02-17 13:28:20 -0500 |
commit | 6516174d1a42c1b1b2861360bf44fe9992fb0f7e (patch) | |
tree | b6ae78dc87f2526e24408819d42e3fe412d68df8 /drivers/net | |
parent | 96502ceb1c122cf5496c9176bb690a52b3fab362 (diff) |
iwlwifi: Move ucode pointers to iwl_fw
The ucode image is a ucode related thing not a transport one. Move them.
Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-mac80211.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-testmode.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans.h | 16 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-ucode.c | 33 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-ucode.h | 14 |
6 files changed, 46 insertions, 48 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 136de6fb3fa4..ad74138e1c70 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "iwl-core.h" | 40 | #include "iwl-core.h" |
41 | #include "iwl-io.h" | 41 | #include "iwl-io.h" |
42 | #include "iwl-agn.h" | 42 | #include "iwl-agn.h" |
43 | #include "iwl-wifi.h" | ||
43 | 44 | ||
44 | /* create and remove of files */ | 45 | /* create and remove of files */ |
45 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ | 46 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ |
@@ -234,12 +235,12 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, | |||
234 | 235 | ||
235 | /* default is to dump the entire data segment */ | 236 | /* default is to dump the entire data segment */ |
236 | if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { | 237 | if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { |
237 | struct iwl_trans *trans = trans(priv); | 238 | struct iwl_nic *nic = nic(priv); |
238 | priv->dbgfs_sram_offset = 0x800000; | 239 | priv->dbgfs_sram_offset = 0x800000; |
239 | if (trans->shrd->ucode_type == IWL_UCODE_INIT) | 240 | if (nic->shrd->ucode_type == IWL_UCODE_INIT) |
240 | priv->dbgfs_sram_len = trans->ucode_init.data.len; | 241 | priv->dbgfs_sram_len = nic->fw.ucode_init.data.len; |
241 | else | 242 | else |
242 | priv->dbgfs_sram_len = trans->ucode_rt.data.len; | 243 | priv->dbgfs_sram_len = nic->fw.ucode_rt.data.len; |
243 | } | 244 | } |
244 | len = priv->dbgfs_sram_len; | 245 | len = priv->dbgfs_sram_len; |
245 | 246 | ||
@@ -342,7 +343,7 @@ static ssize_t iwl_dbgfs_wowlan_sram_read(struct file *file, | |||
342 | 343 | ||
343 | return simple_read_from_buffer(user_buf, count, ppos, | 344 | return simple_read_from_buffer(user_buf, count, ppos, |
344 | priv->wowlan_sram, | 345 | priv->wowlan_sram, |
345 | trans(priv)->ucode_wowlan.data.len); | 346 | nic(priv)->fw.ucode_wowlan.data.len); |
346 | } | 347 | } |
347 | static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf, | 348 | static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf, |
348 | size_t count, loff_t *ppos) | 349 | size_t count, loff_t *ppos) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c index 17358cfb68a9..ca0c46506674 100644 --- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c +++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c | |||
@@ -195,7 +195,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
195 | WIPHY_FLAG_DISABLE_BEACON_HINTS | | 195 | WIPHY_FLAG_DISABLE_BEACON_HINTS | |
196 | WIPHY_FLAG_IBSS_RSN; | 196 | WIPHY_FLAG_IBSS_RSN; |
197 | 197 | ||
198 | if (trans(priv)->ucode_wowlan.code.len && | 198 | if (nic(priv)->fw.ucode_wowlan.code.len && |
199 | device_can_wakeup(trans(priv)->dev)) { | 199 | device_can_wakeup(trans(priv)->dev)) { |
200 | hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | | 200 | hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | |
201 | WIPHY_WOWLAN_DISCONNECT | | 201 | WIPHY_WOWLAN_DISCONNECT | |
@@ -453,17 +453,17 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw) | |||
453 | 453 | ||
454 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 454 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
455 | if (ret == 0) { | 455 | if (ret == 0) { |
456 | struct iwl_trans *trans = trans(priv); | 456 | struct iwl_nic *nic = nic(priv); |
457 | if (!priv->wowlan_sram) | 457 | if (!priv->wowlan_sram) |
458 | priv->wowlan_sram = | 458 | priv->wowlan_sram = |
459 | kzalloc(trans->ucode_wowlan.data.len, | 459 | kzalloc(nic->fw.ucode_wowlan.data.len, |
460 | GFP_KERNEL); | 460 | GFP_KERNEL); |
461 | 461 | ||
462 | if (priv->wowlan_sram) | 462 | if (priv->wowlan_sram) |
463 | _iwl_read_targ_mem_words( | 463 | _iwl_read_targ_mem_words( |
464 | trans(priv), 0x800000, | 464 | trans(priv), 0x800000, |
465 | priv->wowlan_sram, | 465 | priv->wowlan_sram, |
466 | trans->ucode_wowlan.data.len / 4); | 466 | nic->fw.ucode_wowlan.data.len / 4); |
467 | } | 467 | } |
468 | #endif | 468 | #endif |
469 | } | 469 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.c b/drivers/net/wireless/iwlwifi/iwl-testmode.c index 963cc6c89a46..5f00a3712707 100644 --- a/drivers/net/wireless/iwlwifi/iwl-testmode.c +++ b/drivers/net/wireless/iwlwifi/iwl-testmode.c | |||
@@ -591,16 +591,16 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) | |||
591 | } | 591 | } |
592 | switch (priv->shrd->ucode_type) { | 592 | switch (priv->shrd->ucode_type) { |
593 | case IWL_UCODE_REGULAR: | 593 | case IWL_UCODE_REGULAR: |
594 | inst_size = trans(priv)->ucode_rt.code.len; | 594 | inst_size = nic(priv)->fw.ucode_rt.code.len; |
595 | data_size = trans(priv)->ucode_rt.data.len; | 595 | data_size = nic(priv)->fw.ucode_rt.data.len; |
596 | break; | 596 | break; |
597 | case IWL_UCODE_INIT: | 597 | case IWL_UCODE_INIT: |
598 | inst_size = trans(priv)->ucode_init.code.len; | 598 | inst_size = nic(priv)->fw.ucode_init.code.len; |
599 | data_size = trans(priv)->ucode_init.data.len; | 599 | data_size = nic(priv)->fw.ucode_init.data.len; |
600 | break; | 600 | break; |
601 | case IWL_UCODE_WOWLAN: | 601 | case IWL_UCODE_WOWLAN: |
602 | inst_size = trans(priv)->ucode_wowlan.code.len; | 602 | inst_size = nic(priv)->fw.ucode_wowlan.code.len; |
603 | data_size = trans(priv)->ucode_wowlan.data.len; | 603 | data_size = nic(priv)->fw.ucode_wowlan.data.len; |
604 | break; | 604 | break; |
605 | case IWL_UCODE_NONE: | 605 | case IWL_UCODE_NONE: |
606 | IWL_ERR(priv, "No uCode has not been loaded\n"); | 606 | IWL_ERR(priv, "No uCode has not been loaded\n"); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index ae68c51e5327..913df937c964 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -68,6 +68,7 @@ | |||
68 | 68 | ||
69 | #include "iwl-shared.h" | 69 | #include "iwl-shared.h" |
70 | #include "iwl-commands.h" | 70 | #include "iwl-commands.h" |
71 | #include "iwl-ucode.h" | ||
71 | 72 | ||
72 | /*This file includes the declaration that are exported from the transport | 73 | /*This file includes the declaration that are exported from the transport |
73 | * layer */ | 74 | * layer */ |
@@ -131,18 +132,6 @@ struct iwl_host_cmd { | |||
131 | u8 id; | 132 | u8 id; |
132 | }; | 133 | }; |
133 | 134 | ||
134 | /* one for each uCode image (inst/data, boot/init/runtime) */ | ||
135 | struct fw_desc { | ||
136 | dma_addr_t p_addr; /* hardware address */ | ||
137 | void *v_addr; /* software address */ | ||
138 | u32 len; /* size in bytes */ | ||
139 | }; | ||
140 | |||
141 | struct fw_img { | ||
142 | struct fw_desc code; /* firmware code image */ | ||
143 | struct fw_desc data; /* firmware data image */ | ||
144 | }; | ||
145 | |||
146 | /** | 135 | /** |
147 | * struct iwl_trans_ops - transport specific operations | 136 | * struct iwl_trans_ops - transport specific operations |
148 | * @start_hw: starts the HW- from that point on, the HW can send interrupts | 137 | * @start_hw: starts the HW- from that point on, the HW can send interrupts |
@@ -258,9 +247,6 @@ struct iwl_trans { | |||
258 | char hw_id_str[52]; | 247 | char hw_id_str[52]; |
259 | 248 | ||
260 | u8 ucode_write_complete; /* the image write is complete */ | 249 | u8 ucode_write_complete; /* the image write is complete */ |
261 | struct fw_img ucode_rt; | ||
262 | struct fw_img ucode_init; | ||
263 | struct fw_img ucode_wowlan; | ||
264 | 250 | ||
265 | /* eeprom related variables */ | 251 | /* eeprom related variables */ |
266 | int nvm_device_type; | 252 | int nvm_device_type; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-ucode.c b/drivers/net/wireless/iwlwifi/iwl-ucode.c index 51a8fb353a6e..36039eb54dd4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-ucode.c +++ b/drivers/net/wireless/iwlwifi/iwl-ucode.c | |||
@@ -99,9 +99,10 @@ static void iwl_free_fw_img(struct iwl_trans *trans, struct fw_img *img) | |||
99 | 99 | ||
100 | void iwl_dealloc_ucode(struct iwl_trans *trans) | 100 | void iwl_dealloc_ucode(struct iwl_trans *trans) |
101 | { | 101 | { |
102 | iwl_free_fw_img(trans, &trans->ucode_rt); | 102 | struct iwl_nic *nic = nic(trans); |
103 | iwl_free_fw_img(trans, &trans->ucode_init); | 103 | iwl_free_fw_img(trans, &nic->fw.ucode_rt); |
104 | iwl_free_fw_img(trans, &trans->ucode_wowlan); | 104 | iwl_free_fw_img(trans, &nic->fw.ucode_init); |
105 | iwl_free_fw_img(trans, &nic->fw.ucode_wowlan); | ||
105 | } | 106 | } |
106 | 107 | ||
107 | static int iwl_alloc_fw_desc(struct iwl_trans *trans, struct fw_desc *desc, | 108 | static int iwl_alloc_fw_desc(struct iwl_trans *trans, struct fw_desc *desc, |
@@ -122,16 +123,16 @@ static int iwl_alloc_fw_desc(struct iwl_trans *trans, struct fw_desc *desc, | |||
122 | return 0; | 123 | return 0; |
123 | } | 124 | } |
124 | 125 | ||
125 | static inline struct fw_img *iwl_get_ucode_image(struct iwl_trans *trans, | 126 | static inline struct fw_img *iwl_get_ucode_image(struct iwl_nic *nic, |
126 | enum iwl_ucode_type ucode_type) | 127 | enum iwl_ucode_type ucode_type) |
127 | { | 128 | { |
128 | switch (ucode_type) { | 129 | switch (ucode_type) { |
129 | case IWL_UCODE_INIT: | 130 | case IWL_UCODE_INIT: |
130 | return &trans->ucode_init; | 131 | return &nic->fw.ucode_init; |
131 | case IWL_UCODE_WOWLAN: | 132 | case IWL_UCODE_WOWLAN: |
132 | return &trans->ucode_wowlan; | 133 | return &nic->fw.ucode_wowlan; |
133 | case IWL_UCODE_REGULAR: | 134 | case IWL_UCODE_REGULAR: |
134 | return &trans->ucode_rt; | 135 | return &nic->fw.ucode_rt; |
135 | case IWL_UCODE_NONE: | 136 | case IWL_UCODE_NONE: |
136 | break; | 137 | break; |
137 | } | 138 | } |
@@ -456,7 +457,7 @@ static void iwl_print_mismatch_inst(struct iwl_trans *trans, | |||
456 | static int iwl_verify_ucode(struct iwl_trans *trans, | 457 | static int iwl_verify_ucode(struct iwl_trans *trans, |
457 | enum iwl_ucode_type ucode_type) | 458 | enum iwl_ucode_type ucode_type) |
458 | { | 459 | { |
459 | struct fw_img *img = iwl_get_ucode_image(trans, ucode_type); | 460 | struct fw_img *img = iwl_get_ucode_image(nic(trans), ucode_type); |
460 | 461 | ||
461 | if (!img) { | 462 | if (!img) { |
462 | IWL_ERR(trans, "Invalid ucode requested (%d)\n", ucode_type); | 463 | IWL_ERR(trans, "Invalid ucode requested (%d)\n", ucode_type); |
@@ -583,7 +584,7 @@ int iwl_load_ucode_wait_alive(struct iwl_trans *trans, | |||
583 | 584 | ||
584 | old_type = trans->shrd->ucode_type; | 585 | old_type = trans->shrd->ucode_type; |
585 | trans->shrd->ucode_type = ucode_type; | 586 | trans->shrd->ucode_type = ucode_type; |
586 | fw = iwl_get_ucode_image(trans, ucode_type); | 587 | fw = iwl_get_ucode_image(nic(trans), ucode_type); |
587 | 588 | ||
588 | if (!fw) | 589 | if (!fw) |
589 | return -EINVAL; | 590 | return -EINVAL; |
@@ -647,7 +648,7 @@ int iwl_run_init_ucode(struct iwl_trans *trans) | |||
647 | lockdep_assert_held(&trans->shrd->mutex); | 648 | lockdep_assert_held(&trans->shrd->mutex); |
648 | 649 | ||
649 | /* No init ucode required? Curious, but maybe ok */ | 650 | /* No init ucode required? Curious, but maybe ok */ |
650 | if (!trans->ucode_init.code.len) | 651 | if (!nic(trans)->fw.ucode_init.code.len) |
651 | return 0; | 652 | return 0; |
652 | 653 | ||
653 | if (trans->shrd->ucode_type != IWL_UCODE_NONE) | 654 | if (trans->shrd->ucode_type != IWL_UCODE_NONE) |
@@ -1163,21 +1164,21 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1163 | /* Runtime instructions and 2 copies of data: | 1164 | /* Runtime instructions and 2 copies of data: |
1164 | * 1) unmodified from disk | 1165 | * 1) unmodified from disk |
1165 | * 2) backup cache for save/restore during power-downs */ | 1166 | * 2) backup cache for save/restore during power-downs */ |
1166 | if (iwl_alloc_fw_desc(trans(priv), &trans(priv)->ucode_rt.code, | 1167 | if (iwl_alloc_fw_desc(trans(priv), &nic(priv)->fw.ucode_rt.code, |
1167 | pieces.inst, pieces.inst_size)) | 1168 | pieces.inst, pieces.inst_size)) |
1168 | goto err_pci_alloc; | 1169 | goto err_pci_alloc; |
1169 | if (iwl_alloc_fw_desc(trans(priv), &trans(priv)->ucode_rt.data, | 1170 | if (iwl_alloc_fw_desc(trans(priv), &nic(priv)->fw.ucode_rt.data, |
1170 | pieces.data, pieces.data_size)) | 1171 | pieces.data, pieces.data_size)) |
1171 | goto err_pci_alloc; | 1172 | goto err_pci_alloc; |
1172 | 1173 | ||
1173 | /* Initialization instructions and data */ | 1174 | /* Initialization instructions and data */ |
1174 | if (pieces.init_size && pieces.init_data_size) { | 1175 | if (pieces.init_size && pieces.init_data_size) { |
1175 | if (iwl_alloc_fw_desc(trans(priv), | 1176 | if (iwl_alloc_fw_desc(trans(priv), |
1176 | &trans(priv)->ucode_init.code, | 1177 | &nic(priv)->fw.ucode_init.code, |
1177 | pieces.init, pieces.init_size)) | 1178 | pieces.init, pieces.init_size)) |
1178 | goto err_pci_alloc; | 1179 | goto err_pci_alloc; |
1179 | if (iwl_alloc_fw_desc(trans(priv), | 1180 | if (iwl_alloc_fw_desc(trans(priv), |
1180 | &trans(priv)->ucode_init.data, | 1181 | &nic(priv)->fw.ucode_init.data, |
1181 | pieces.init_data, pieces.init_data_size)) | 1182 | pieces.init_data, pieces.init_data_size)) |
1182 | goto err_pci_alloc; | 1183 | goto err_pci_alloc; |
1183 | } | 1184 | } |
@@ -1185,12 +1186,12 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1185 | /* WoWLAN instructions and data */ | 1186 | /* WoWLAN instructions and data */ |
1186 | if (pieces.wowlan_inst_size && pieces.wowlan_data_size) { | 1187 | if (pieces.wowlan_inst_size && pieces.wowlan_data_size) { |
1187 | if (iwl_alloc_fw_desc(trans(priv), | 1188 | if (iwl_alloc_fw_desc(trans(priv), |
1188 | &trans(priv)->ucode_wowlan.code, | 1189 | &nic(priv)->fw.ucode_wowlan.code, |
1189 | pieces.wowlan_inst, | 1190 | pieces.wowlan_inst, |
1190 | pieces.wowlan_inst_size)) | 1191 | pieces.wowlan_inst_size)) |
1191 | goto err_pci_alloc; | 1192 | goto err_pci_alloc; |
1192 | if (iwl_alloc_fw_desc(trans(priv), | 1193 | if (iwl_alloc_fw_desc(trans(priv), |
1193 | &trans(priv)->ucode_wowlan.data, | 1194 | &nic(priv)->fw.ucode_wowlan.data, |
1194 | pieces.wowlan_data, | 1195 | pieces.wowlan_data, |
1195 | pieces.wowlan_data_size)) | 1196 | pieces.wowlan_data_size)) |
1196 | goto err_pci_alloc; | 1197 | goto err_pci_alloc; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-ucode.h b/drivers/net/wireless/iwlwifi/iwl-ucode.h index 18c77e9bb9b0..5e4b88e05c62 100644 --- a/drivers/net/wireless/iwlwifi/iwl-ucode.h +++ b/drivers/net/wireless/iwlwifi/iwl-ucode.h | |||
@@ -63,8 +63,6 @@ | |||
63 | #ifndef __iwl_ucode_h__ | 63 | #ifndef __iwl_ucode_h__ |
64 | #define __iwl_ucode_h__ | 64 | #define __iwl_ucode_h__ |
65 | 65 | ||
66 | #include "iwl-trans.h" | ||
67 | |||
68 | #include <linux/netdevice.h> | 66 | #include <linux/netdevice.h> |
69 | 67 | ||
70 | /* v1/v2 uCode file layout */ | 68 | /* v1/v2 uCode file layout */ |
@@ -181,6 +179,18 @@ struct iwl_ucode_capabilities { | |||
181 | u32 flags; | 179 | u32 flags; |
182 | }; | 180 | }; |
183 | 181 | ||
182 | /* one for each uCode image (inst/data, boot/init/runtime) */ | ||
183 | struct fw_desc { | ||
184 | dma_addr_t p_addr; /* hardware address */ | ||
185 | void *v_addr; /* software address */ | ||
186 | u32 len; /* size in bytes */ | ||
187 | }; | ||
188 | |||
189 | struct fw_img { | ||
190 | struct fw_desc code; /* firmware code image */ | ||
191 | struct fw_desc data; /* firmware data image */ | ||
192 | }; | ||
193 | |||
184 | /** | 194 | /** |
185 | * struct iwl_fw - variables associated with the firmware | 195 | * struct iwl_fw - variables associated with the firmware |
186 | * | 196 | * |