aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-ucode.c
diff options
context:
space:
mode:
authorDon Fry <donald.h.fry@intel.com>2012-02-07 18:00:12 -0500
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2012-02-17 13:28:20 -0500
commit6516174d1a42c1b1b2861360bf44fe9992fb0f7e (patch)
treeb6ae78dc87f2526e24408819d42e3fe412d68df8 /drivers/net/wireless/iwlwifi/iwl-ucode.c
parent96502ceb1c122cf5496c9176bb690a52b3fab362 (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/wireless/iwlwifi/iwl-ucode.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-ucode.c33
1 files changed, 17 insertions, 16 deletions
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
100void iwl_dealloc_ucode(struct iwl_trans *trans) 100void 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
107static int iwl_alloc_fw_desc(struct iwl_trans *trans, struct fw_desc *desc, 108static 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
125static inline struct fw_img *iwl_get_ucode_image(struct iwl_trans *trans, 126static 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,
456static int iwl_verify_ucode(struct iwl_trans *trans, 457static 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;