diff options
author | Johannes Berg <johannes.berg@intel.com> | 2011-04-16 11:29:24 -0400 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2011-04-22 13:21:18 -0400 |
commit | dbf28e21ca391110e90ccad05dda79d2e2f60e0e (patch) | |
tree | 76aa45ec1cfb00c09b9cae51742c475ab821911a /drivers/net/wireless/iwlwifi/iwl-agn-ucode.c | |
parent | ca7966c88e44233fac113579071a6f55e00ef5ac (diff) |
iwlagn: combine firmware code/data
On new hardware, ucode images always come in
pairs: code and data. Therefore, combine the
variables into an appropriate struct and use
that when both code and data are needed.
Also, combine allocation and copying so that
we have less code in total.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-ucode.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-ucode.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c index 56dc7712aa70..c3ae2e44fcc9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c | |||
@@ -161,17 +161,16 @@ static int iwlagn_load_section(struct iwl_priv *priv, const char *name, | |||
161 | } | 161 | } |
162 | 162 | ||
163 | static int iwlagn_load_given_ucode(struct iwl_priv *priv, | 163 | static int iwlagn_load_given_ucode(struct iwl_priv *priv, |
164 | struct fw_desc *inst_image, | 164 | struct fw_img *image) |
165 | struct fw_desc *data_image) | ||
166 | { | 165 | { |
167 | int ret = 0; | 166 | int ret = 0; |
168 | 167 | ||
169 | ret = iwlagn_load_section(priv, "INST", inst_image, | 168 | ret = iwlagn_load_section(priv, "INST", &image->code, |
170 | IWLAGN_RTC_INST_LOWER_BOUND); | 169 | IWLAGN_RTC_INST_LOWER_BOUND); |
171 | if (ret) | 170 | if (ret) |
172 | return ret; | 171 | return ret; |
173 | 172 | ||
174 | return iwlagn_load_section(priv, "DATA", data_image, | 173 | return iwlagn_load_section(priv, "DATA", &image->data, |
175 | IWLAGN_RTC_DATA_LOWER_BOUND); | 174 | IWLAGN_RTC_DATA_LOWER_BOUND); |
176 | } | 175 | } |
177 | 176 | ||
@@ -557,16 +556,16 @@ static void iwl_print_mismatch_inst(struct iwl_priv *priv, | |||
557 | * iwl_verify_ucode - determine which instruction image is in SRAM, | 556 | * iwl_verify_ucode - determine which instruction image is in SRAM, |
558 | * and verify its contents | 557 | * and verify its contents |
559 | */ | 558 | */ |
560 | static int iwl_verify_ucode(struct iwl_priv *priv, struct fw_desc *fw_desc) | 559 | static int iwl_verify_ucode(struct iwl_priv *priv, struct fw_img *img) |
561 | { | 560 | { |
562 | if (!iwlcore_verify_inst_sparse(priv, fw_desc)) { | 561 | if (!iwlcore_verify_inst_sparse(priv, &img->code)) { |
563 | IWL_DEBUG_INFO(priv, "uCode is good in inst SRAM\n"); | 562 | IWL_DEBUG_INFO(priv, "uCode is good in inst SRAM\n"); |
564 | return 0; | 563 | return 0; |
565 | } | 564 | } |
566 | 565 | ||
567 | IWL_ERR(priv, "UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n"); | 566 | IWL_ERR(priv, "UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n"); |
568 | 567 | ||
569 | iwl_print_mismatch_inst(priv, fw_desc); | 568 | iwl_print_mismatch_inst(priv, &img->code); |
570 | return -EIO; | 569 | return -EIO; |
571 | } | 570 | } |
572 | 571 | ||
@@ -602,8 +601,7 @@ static void iwlagn_alive_fn(struct iwl_priv *priv, | |||
602 | #define UCODE_CALIB_TIMEOUT (2*HZ) | 601 | #define UCODE_CALIB_TIMEOUT (2*HZ) |
603 | 602 | ||
604 | int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, | 603 | int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, |
605 | struct fw_desc *inst_image, | 604 | struct fw_img *image, |
606 | struct fw_desc *data_image, | ||
607 | int subtype, int alternate_subtype) | 605 | int subtype, int alternate_subtype) |
608 | { | 606 | { |
609 | struct iwl_notification_wait alive_wait; | 607 | struct iwl_notification_wait alive_wait; |
@@ -621,7 +619,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, | |||
621 | old_type = priv->ucode_type; | 619 | old_type = priv->ucode_type; |
622 | priv->ucode_type = subtype; | 620 | priv->ucode_type = subtype; |
623 | 621 | ||
624 | ret = iwlagn_load_given_ucode(priv, inst_image, data_image); | 622 | ret = iwlagn_load_given_ucode(priv, image); |
625 | if (ret) { | 623 | if (ret) { |
626 | priv->ucode_type = old_type; | 624 | priv->ucode_type = old_type; |
627 | iwlagn_remove_notification(priv, &alive_wait); | 625 | iwlagn_remove_notification(priv, &alive_wait); |
@@ -656,7 +654,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, | |||
656 | return -EIO; | 654 | return -EIO; |
657 | } | 655 | } |
658 | 656 | ||
659 | ret = iwl_verify_ucode(priv, inst_image); | 657 | ret = iwl_verify_ucode(priv, image); |
660 | if (ret) { | 658 | if (ret) { |
661 | priv->ucode_type = old_type; | 659 | priv->ucode_type = old_type; |
662 | return ret; | 660 | return ret; |
@@ -684,7 +682,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv) | |||
684 | lockdep_assert_held(&priv->mutex); | 682 | lockdep_assert_held(&priv->mutex); |
685 | 683 | ||
686 | /* No init ucode required? Curious, but maybe ok */ | 684 | /* No init ucode required? Curious, but maybe ok */ |
687 | if (!priv->ucode_init.len) | 685 | if (!priv->ucode_init.code.len) |
688 | return 0; | 686 | return 0; |
689 | 687 | ||
690 | if (priv->ucode_type != UCODE_SUBTYPE_NONE_LOADED) | 688 | if (priv->ucode_type != UCODE_SUBTYPE_NONE_LOADED) |
@@ -696,7 +694,6 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv) | |||
696 | 694 | ||
697 | /* Will also start the device */ | 695 | /* Will also start the device */ |
698 | ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init, | 696 | ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init, |
699 | &priv->ucode_init_data, | ||
700 | UCODE_SUBTYPE_INIT, -1); | 697 | UCODE_SUBTYPE_INIT, -1); |
701 | if (ret) | 698 | if (ret) |
702 | goto error; | 699 | goto error; |