diff options
author | Don Fry <donald.h.fry@intel.com> | 2011-11-10 09:55:10 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-11-11 12:32:53 -0500 |
commit | de7f5f92dbda0652dcb850fd02762e628556f645 (patch) | |
tree | e498e6edb82276153314d303b5ee8b1836eb7a9c | |
parent | baa0005663d6b4aa48ab5c632d74b459fcfeb086 (diff) |
iwlagn: move ucode files out of the iwl_priv structure
Relocate the ucode files and update relevant code.
More code refactoring.
Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-ucode.c | 96 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 73 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 24 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans.h | 29 |
6 files changed, 121 insertions, 109 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c index 9144ef5efe49..9ec315b31d45 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
34 | #include <linux/dma-mapping.h> | ||
34 | 35 | ||
35 | #include "iwl-dev.h" | 36 | #include "iwl-dev.h" |
36 | #include "iwl-core.h" | 37 | #include "iwl-core.h" |
@@ -72,6 +73,52 @@ static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = { | |||
72 | {COEX_CU_RSRVD2_RP, COEX_CU_RSRVD2_WP, 0, COEX_RSRVD2_FLAGS} | 73 | {COEX_CU_RSRVD2_RP, COEX_CU_RSRVD2_WP, 0, COEX_RSRVD2_FLAGS} |
73 | }; | 74 | }; |
74 | 75 | ||
76 | /****************************************************************************** | ||
77 | * | ||
78 | * uCode download functions | ||
79 | * | ||
80 | ******************************************************************************/ | ||
81 | |||
82 | static void iwl_free_fw_desc(struct iwl_bus *bus, struct fw_desc *desc) | ||
83 | { | ||
84 | if (desc->v_addr) | ||
85 | dma_free_coherent(bus->dev, desc->len, | ||
86 | desc->v_addr, desc->p_addr); | ||
87 | desc->v_addr = NULL; | ||
88 | desc->len = 0; | ||
89 | } | ||
90 | |||
91 | static void iwl_free_fw_img(struct iwl_bus *bus, struct fw_img *img) | ||
92 | { | ||
93 | iwl_free_fw_desc(bus, &img->code); | ||
94 | iwl_free_fw_desc(bus, &img->data); | ||
95 | } | ||
96 | |||
97 | void iwl_dealloc_ucode(struct iwl_trans *trans) | ||
98 | { | ||
99 | iwl_free_fw_img(bus(trans), &trans->ucode_rt); | ||
100 | iwl_free_fw_img(bus(trans), &trans->ucode_init); | ||
101 | iwl_free_fw_img(bus(trans), &trans->ucode_wowlan); | ||
102 | } | ||
103 | |||
104 | int iwl_alloc_fw_desc(struct iwl_bus *bus, struct fw_desc *desc, | ||
105 | const void *data, size_t len) | ||
106 | { | ||
107 | if (!len) { | ||
108 | desc->v_addr = NULL; | ||
109 | return -EINVAL; | ||
110 | } | ||
111 | |||
112 | desc->v_addr = dma_alloc_coherent(bus->dev, len, | ||
113 | &desc->p_addr, GFP_KERNEL); | ||
114 | if (!desc->v_addr) | ||
115 | return -ENOMEM; | ||
116 | |||
117 | desc->len = len; | ||
118 | memcpy(desc->v_addr, data, len); | ||
119 | return 0; | ||
120 | } | ||
121 | |||
75 | /* | 122 | /* |
76 | * ucode | 123 | * ucode |
77 | */ | 124 | */ |
@@ -125,40 +172,41 @@ static int iwlagn_load_section(struct iwl_trans *trans, const char *name, | |||
125 | return 0; | 172 | return 0; |
126 | } | 173 | } |
127 | 174 | ||
128 | static inline struct fw_img *iwl_get_ucode_image(struct iwl_priv *priv, | 175 | static inline struct fw_img *iwl_get_ucode_image(struct iwl_trans *trans, |
129 | enum iwlagn_ucode_type ucode_type) | 176 | enum iwl_ucode_type ucode_type) |
130 | { | 177 | { |
131 | switch (ucode_type) { | 178 | switch (ucode_type) { |
132 | case IWL_UCODE_INIT: | 179 | case IWL_UCODE_INIT: |
133 | return &priv->ucode_init; | 180 | return &trans->ucode_init; |
134 | case IWL_UCODE_WOWLAN: | 181 | case IWL_UCODE_WOWLAN: |
135 | return &priv->ucode_wowlan; | 182 | return &trans->ucode_wowlan; |
136 | case IWL_UCODE_REGULAR: | 183 | case IWL_UCODE_REGULAR: |
137 | return &priv->ucode_rt; | 184 | return &trans->ucode_rt; |
138 | case IWL_UCODE_NONE: | 185 | case IWL_UCODE_NONE: |
139 | break; | 186 | break; |
140 | } | 187 | } |
141 | return NULL; | 188 | return NULL; |
142 | } | 189 | } |
143 | 190 | ||
144 | static int iwlagn_load_given_ucode(struct iwl_priv *priv, | 191 | static int iwlagn_load_given_ucode(struct iwl_trans *trans, |
145 | enum iwlagn_ucode_type ucode_type) | 192 | enum iwl_ucode_type ucode_type) |
146 | { | 193 | { |
147 | int ret = 0; | 194 | int ret = 0; |
148 | struct fw_img *image = iwl_get_ucode_image(priv, ucode_type); | 195 | struct fw_img *image = iwl_get_ucode_image(trans, ucode_type); |
149 | 196 | ||
150 | 197 | ||
151 | if (!image) { | 198 | if (!image) { |
152 | IWL_ERR(priv, "Invalid ucode requested (%d)\n", ucode_type); | 199 | IWL_ERR(trans, "Invalid ucode requested (%d)\n", |
200 | ucode_type); | ||
153 | return -EINVAL; | 201 | return -EINVAL; |
154 | } | 202 | } |
155 | 203 | ||
156 | ret = iwlagn_load_section(trans(priv), "INST", &image->code, | 204 | ret = iwlagn_load_section(trans, "INST", &image->code, |
157 | IWLAGN_RTC_INST_LOWER_BOUND); | 205 | IWLAGN_RTC_INST_LOWER_BOUND); |
158 | if (ret) | 206 | if (ret) |
159 | return ret; | 207 | return ret; |
160 | 208 | ||
161 | return iwlagn_load_section(trans(priv), "DATA", &image->data, | 209 | return iwlagn_load_section(trans, "DATA", &image->data, |
162 | IWLAGN_RTC_DATA_LOWER_BOUND); | 210 | IWLAGN_RTC_DATA_LOWER_BOUND); |
163 | } | 211 | } |
164 | 212 | ||
@@ -498,24 +546,24 @@ static void iwl_print_mismatch_inst(struct iwl_bus *bus, | |||
498 | * iwl_verify_ucode - determine which instruction image is in SRAM, | 546 | * iwl_verify_ucode - determine which instruction image is in SRAM, |
499 | * and verify its contents | 547 | * and verify its contents |
500 | */ | 548 | */ |
501 | static int iwl_verify_ucode(struct iwl_priv *priv, | 549 | static int iwl_verify_ucode(struct iwl_trans *trans, |
502 | enum iwlagn_ucode_type ucode_type) | 550 | enum iwl_ucode_type ucode_type) |
503 | { | 551 | { |
504 | struct fw_img *img = iwl_get_ucode_image(priv, ucode_type); | 552 | struct fw_img *img = iwl_get_ucode_image(trans, ucode_type); |
505 | 553 | ||
506 | if (!img) { | 554 | if (!img) { |
507 | IWL_ERR(priv, "Invalid ucode requested (%d)\n", ucode_type); | 555 | IWL_ERR(trans, "Invalid ucode requested (%d)\n", ucode_type); |
508 | return -EINVAL; | 556 | return -EINVAL; |
509 | } | 557 | } |
510 | 558 | ||
511 | if (!iwl_verify_inst_sparse(bus(priv), &img->code)) { | 559 | if (!iwl_verify_inst_sparse(bus(trans), &img->code)) { |
512 | IWL_DEBUG_FW(priv, "uCode is good in inst SRAM\n"); | 560 | IWL_DEBUG_FW(trans, "uCode is good in inst SRAM\n"); |
513 | return 0; | 561 | return 0; |
514 | } | 562 | } |
515 | 563 | ||
516 | IWL_ERR(priv, "UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n"); | 564 | IWL_ERR(trans, "UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n"); |
517 | 565 | ||
518 | iwl_print_mismatch_inst(bus(priv), &img->code); | 566 | iwl_print_mismatch_inst(bus(trans), &img->code); |
519 | return -EIO; | 567 | return -EIO; |
520 | } | 568 | } |
521 | 569 | ||
@@ -551,12 +599,12 @@ static void iwlagn_alive_fn(struct iwl_priv *priv, | |||
551 | #define UCODE_CALIB_TIMEOUT (2*HZ) | 599 | #define UCODE_CALIB_TIMEOUT (2*HZ) |
552 | 600 | ||
553 | int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, | 601 | int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, |
554 | enum iwlagn_ucode_type ucode_type) | 602 | enum iwl_ucode_type ucode_type) |
555 | { | 603 | { |
556 | struct iwl_notification_wait alive_wait; | 604 | struct iwl_notification_wait alive_wait; |
557 | struct iwlagn_alive_data alive_data; | 605 | struct iwlagn_alive_data alive_data; |
558 | int ret; | 606 | int ret; |
559 | enum iwlagn_ucode_type old_type; | 607 | enum iwl_ucode_type old_type; |
560 | 608 | ||
561 | ret = iwl_trans_start_device(trans(priv)); | 609 | ret = iwl_trans_start_device(trans(priv)); |
562 | if (ret) | 610 | if (ret) |
@@ -568,7 +616,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, | |||
568 | old_type = priv->ucode_type; | 616 | old_type = priv->ucode_type; |
569 | priv->ucode_type = ucode_type; | 617 | priv->ucode_type = ucode_type; |
570 | 618 | ||
571 | ret = iwlagn_load_given_ucode(priv, ucode_type); | 619 | ret = iwlagn_load_given_ucode(trans(priv), ucode_type); |
572 | if (ret) { | 620 | if (ret) { |
573 | priv->ucode_type = old_type; | 621 | priv->ucode_type = old_type; |
574 | iwlagn_remove_notification(priv, &alive_wait); | 622 | iwlagn_remove_notification(priv, &alive_wait); |
@@ -599,7 +647,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, | |||
599 | * skip it for WoWLAN. | 647 | * skip it for WoWLAN. |
600 | */ | 648 | */ |
601 | if (ucode_type != IWL_UCODE_WOWLAN) { | 649 | if (ucode_type != IWL_UCODE_WOWLAN) { |
602 | ret = iwl_verify_ucode(priv, ucode_type); | 650 | ret = iwl_verify_ucode(trans(priv), ucode_type); |
603 | if (ret) { | 651 | if (ret) { |
604 | priv->ucode_type = old_type; | 652 | priv->ucode_type = old_type; |
605 | return ret; | 653 | return ret; |
@@ -628,7 +676,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv) | |||
628 | lockdep_assert_held(&priv->shrd->mutex); | 676 | lockdep_assert_held(&priv->shrd->mutex); |
629 | 677 | ||
630 | /* No init ucode required? Curious, but maybe ok */ | 678 | /* No init ucode required? Curious, but maybe ok */ |
631 | if (!priv->ucode_init.code.len) | 679 | if (!trans(priv)->ucode_init.code.len) |
632 | return 0; | 680 | return 0; |
633 | 681 | ||
634 | if (priv->ucode_type != IWL_UCODE_NONE) | 682 | if (priv->ucode_type != IWL_UCODE_NONE) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index b6fa361267db..7514b17193ad 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/dma-mapping.h> | ||
34 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
35 | #include <linux/sched.h> | 34 | #include <linux/sched.h> |
36 | #include <linux/skbuff.h> | 35 | #include <linux/skbuff.h> |
@@ -452,52 +451,6 @@ static void iwl_bg_tx_flush(struct work_struct *work) | |||
452 | iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL); | 451 | iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL); |
453 | } | 452 | } |
454 | 453 | ||
455 | /****************************************************************************** | ||
456 | * | ||
457 | * uCode download functions | ||
458 | * | ||
459 | ******************************************************************************/ | ||
460 | |||
461 | static void iwl_free_fw_desc(struct iwl_priv *priv, struct fw_desc *desc) | ||
462 | { | ||
463 | if (desc->v_addr) | ||
464 | dma_free_coherent(bus(priv)->dev, desc->len, | ||
465 | desc->v_addr, desc->p_addr); | ||
466 | desc->v_addr = NULL; | ||
467 | desc->len = 0; | ||
468 | } | ||
469 | |||
470 | static void iwl_free_fw_img(struct iwl_priv *priv, struct fw_img *img) | ||
471 | { | ||
472 | iwl_free_fw_desc(priv, &img->code); | ||
473 | iwl_free_fw_desc(priv, &img->data); | ||
474 | } | ||
475 | |||
476 | static void iwl_dealloc_ucode(struct iwl_priv *priv) | ||
477 | { | ||
478 | iwl_free_fw_img(priv, &priv->ucode_rt); | ||
479 | iwl_free_fw_img(priv, &priv->ucode_init); | ||
480 | iwl_free_fw_img(priv, &priv->ucode_wowlan); | ||
481 | } | ||
482 | |||
483 | static int iwl_alloc_fw_desc(struct iwl_priv *priv, struct fw_desc *desc, | ||
484 | const void *data, size_t len) | ||
485 | { | ||
486 | if (!len) { | ||
487 | desc->v_addr = NULL; | ||
488 | return -EINVAL; | ||
489 | } | ||
490 | |||
491 | desc->v_addr = dma_alloc_coherent(bus(priv)->dev, len, | ||
492 | &desc->p_addr, GFP_KERNEL); | ||
493 | if (!desc->v_addr) | ||
494 | return -ENOMEM; | ||
495 | |||
496 | desc->len = len; | ||
497 | memcpy(desc->v_addr, data, len); | ||
498 | return 0; | ||
499 | } | ||
500 | |||
501 | static void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags) | 454 | static void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags) |
502 | { | 455 | { |
503 | int i; | 456 | int i; |
@@ -1040,30 +993,32 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1040 | /* Runtime instructions and 2 copies of data: | 993 | /* Runtime instructions and 2 copies of data: |
1041 | * 1) unmodified from disk | 994 | * 1) unmodified from disk |
1042 | * 2) backup cache for save/restore during power-downs */ | 995 | * 2) backup cache for save/restore during power-downs */ |
1043 | if (iwl_alloc_fw_desc(priv, &priv->ucode_rt.code, | 996 | if (iwl_alloc_fw_desc(bus(priv), &trans(priv)->ucode_rt.code, |
1044 | pieces.inst, pieces.inst_size)) | 997 | pieces.inst, pieces.inst_size)) |
1045 | goto err_pci_alloc; | 998 | goto err_pci_alloc; |
1046 | if (iwl_alloc_fw_desc(priv, &priv->ucode_rt.data, | 999 | if (iwl_alloc_fw_desc(bus(priv), &trans(priv)->ucode_rt.data, |
1047 | pieces.data, pieces.data_size)) | 1000 | pieces.data, pieces.data_size)) |
1048 | goto err_pci_alloc; | 1001 | goto err_pci_alloc; |
1049 | 1002 | ||
1050 | /* Initialization instructions and data */ | 1003 | /* Initialization instructions and data */ |
1051 | if (pieces.init_size && pieces.init_data_size) { | 1004 | if (pieces.init_size && pieces.init_data_size) { |
1052 | if (iwl_alloc_fw_desc(priv, &priv->ucode_init.code, | 1005 | if (iwl_alloc_fw_desc(bus(priv), &trans(priv)->ucode_init.code, |
1053 | pieces.init, pieces.init_size)) | 1006 | pieces.init, pieces.init_size)) |
1054 | goto err_pci_alloc; | 1007 | goto err_pci_alloc; |
1055 | if (iwl_alloc_fw_desc(priv, &priv->ucode_init.data, | 1008 | if (iwl_alloc_fw_desc(bus(priv), &trans(priv)->ucode_init.data, |
1056 | pieces.init_data, pieces.init_data_size)) | 1009 | pieces.init_data, pieces.init_data_size)) |
1057 | goto err_pci_alloc; | 1010 | goto err_pci_alloc; |
1058 | } | 1011 | } |
1059 | 1012 | ||
1060 | /* WoWLAN instructions and data */ | 1013 | /* WoWLAN instructions and data */ |
1061 | if (pieces.wowlan_inst_size && pieces.wowlan_data_size) { | 1014 | if (pieces.wowlan_inst_size && pieces.wowlan_data_size) { |
1062 | if (iwl_alloc_fw_desc(priv, &priv->ucode_wowlan.code, | 1015 | if (iwl_alloc_fw_desc(bus(priv), |
1016 | &trans(priv)->ucode_wowlan.code, | ||
1063 | pieces.wowlan_inst, | 1017 | pieces.wowlan_inst, |
1064 | pieces.wowlan_inst_size)) | 1018 | pieces.wowlan_inst_size)) |
1065 | goto err_pci_alloc; | 1019 | goto err_pci_alloc; |
1066 | if (iwl_alloc_fw_desc(priv, &priv->ucode_wowlan.data, | 1020 | if (iwl_alloc_fw_desc(bus(priv), |
1021 | &trans(priv)->ucode_wowlan.data, | ||
1067 | pieces.wowlan_data, | 1022 | pieces.wowlan_data, |
1068 | pieces.wowlan_data_size)) | 1023 | pieces.wowlan_data_size)) |
1069 | goto err_pci_alloc; | 1024 | goto err_pci_alloc; |
@@ -1156,7 +1111,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1156 | 1111 | ||
1157 | err_pci_alloc: | 1112 | err_pci_alloc: |
1158 | IWL_ERR(priv, "failed to allocate pci memory\n"); | 1113 | IWL_ERR(priv, "failed to allocate pci memory\n"); |
1159 | iwl_dealloc_ucode(priv); | 1114 | iwl_dealloc_ucode(trans(priv)); |
1160 | out_unbind: | 1115 | out_unbind: |
1161 | complete(&priv->firmware_loading_complete); | 1116 | complete(&priv->firmware_loading_complete); |
1162 | device_release_driver(bus(priv)->dev); | 1117 | device_release_driver(bus(priv)->dev); |
@@ -1697,7 +1652,8 @@ static int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
1697 | WIPHY_FLAG_DISABLE_BEACON_HINTS | | 1652 | WIPHY_FLAG_DISABLE_BEACON_HINTS | |
1698 | WIPHY_FLAG_IBSS_RSN; | 1653 | WIPHY_FLAG_IBSS_RSN; |
1699 | 1654 | ||
1700 | if (priv->ucode_wowlan.code.len && device_can_wakeup(bus(priv)->dev)) { | 1655 | if (trans(priv)->ucode_wowlan.code.len && |
1656 | device_can_wakeup(bus(priv)->dev)) { | ||
1701 | hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | | 1657 | hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | |
1702 | WIPHY_WOWLAN_DISCONNECT | | 1658 | WIPHY_WOWLAN_DISCONNECT | |
1703 | WIPHY_WOWLAN_EAP_IDENTITY_REQ | | 1659 | WIPHY_WOWLAN_EAP_IDENTITY_REQ | |
@@ -2241,15 +2197,16 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw) | |||
2241 | 2197 | ||
2242 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 2198 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
2243 | if (ret == 0) { | 2199 | if (ret == 0) { |
2200 | struct iwl_trans *trans = trans(priv); | ||
2244 | if (!priv->wowlan_sram) | 2201 | if (!priv->wowlan_sram) |
2245 | priv->wowlan_sram = | 2202 | priv->wowlan_sram = |
2246 | kzalloc(priv->ucode_wowlan.data.len, | 2203 | kzalloc(trans->ucode_wowlan.data.len, |
2247 | GFP_KERNEL); | 2204 | GFP_KERNEL); |
2248 | 2205 | ||
2249 | if (priv->wowlan_sram) | 2206 | if (priv->wowlan_sram) |
2250 | _iwl_read_targ_mem_words( | 2207 | _iwl_read_targ_mem_words( |
2251 | bus(priv), 0x800000, priv->wowlan_sram, | 2208 | bus(priv), 0x800000, priv->wowlan_sram, |
2252 | priv->ucode_wowlan.data.len / 4); | 2209 | trans->ucode_wowlan.data.len / 4); |
2253 | } | 2210 | } |
2254 | #endif | 2211 | #endif |
2255 | } | 2212 | } |
@@ -3400,7 +3357,7 @@ void __devexit iwl_remove(struct iwl_priv * priv) | |||
3400 | /*This will stop the queues, move the device to low power state */ | 3357 | /*This will stop the queues, move the device to low power state */ |
3401 | iwl_trans_stop_device(trans(priv)); | 3358 | iwl_trans_stop_device(trans(priv)); |
3402 | 3359 | ||
3403 | iwl_dealloc_ucode(priv); | 3360 | iwl_dealloc_ucode(trans(priv)); |
3404 | 3361 | ||
3405 | iwl_eeprom_free(priv); | 3362 | iwl_eeprom_free(priv); |
3406 | 3363 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h index adefab564166..7cc5cd8deeea 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h | |||
@@ -95,7 +95,7 @@ int iwlagn_send_bt_env(struct iwl_priv *priv, u8 action, u8 type); | |||
95 | void iwlagn_send_prio_tbl(struct iwl_priv *priv); | 95 | void iwlagn_send_prio_tbl(struct iwl_priv *priv); |
96 | int iwlagn_run_init_ucode(struct iwl_priv *priv); | 96 | int iwlagn_run_init_ucode(struct iwl_priv *priv); |
97 | int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, | 97 | int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv, |
98 | enum iwlagn_ucode_type ucode_type); | 98 | enum iwl_ucode_type ucode_type); |
99 | 99 | ||
100 | /* lib */ | 100 | /* lib */ |
101 | int iwlagn_send_tx_power(struct iwl_priv *priv); | 101 | int iwlagn_send_tx_power(struct iwl_priv *priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index a1670e3f8bfa..42871bafc818 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -236,9 +236,9 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, | |||
236 | if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { | 236 | if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { |
237 | priv->dbgfs_sram_offset = 0x800000; | 237 | priv->dbgfs_sram_offset = 0x800000; |
238 | if (priv->ucode_type == IWL_UCODE_INIT) | 238 | if (priv->ucode_type == IWL_UCODE_INIT) |
239 | priv->dbgfs_sram_len = priv->ucode_init.data.len; | 239 | priv->dbgfs_sram_len = trans(priv)->ucode_init.data.len; |
240 | else | 240 | else |
241 | priv->dbgfs_sram_len = priv->ucode_rt.data.len; | 241 | priv->dbgfs_sram_len = trans(priv)->ucode_rt.data.len; |
242 | } | 242 | } |
243 | len = priv->dbgfs_sram_len; | 243 | len = priv->dbgfs_sram_len; |
244 | 244 | ||
@@ -341,7 +341,7 @@ static ssize_t iwl_dbgfs_wowlan_sram_read(struct file *file, | |||
341 | 341 | ||
342 | return simple_read_from_buffer(user_buf, count, ppos, | 342 | return simple_read_from_buffer(user_buf, count, ppos, |
343 | priv->wowlan_sram, | 343 | priv->wowlan_sram, |
344 | priv->ucode_wowlan.data.len); | 344 | trans(priv)->ucode_wowlan.data.len); |
345 | } | 345 | } |
346 | static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf, | 346 | static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf, |
347 | size_t count, loff_t *ppos) | 347 | size_t count, loff_t *ppos) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 4279e01acc49..2c68b9ba491a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -230,17 +230,6 @@ struct iwl_vif_priv { | |||
230 | u8 ibss_bssid_sta_id; | 230 | u8 ibss_bssid_sta_id; |
231 | }; | 231 | }; |
232 | 232 | ||
233 | /* one for each uCode image (inst/data, boot/init/runtime) */ | ||
234 | struct fw_desc { | ||
235 | void *v_addr; /* access by driver */ | ||
236 | dma_addr_t p_addr; /* access by card's busmaster DMA */ | ||
237 | u32 len; /* bytes */ | ||
238 | }; | ||
239 | |||
240 | struct fw_img { | ||
241 | struct fw_desc code, data; | ||
242 | }; | ||
243 | |||
244 | /* v1/v2 uCode file layout */ | 233 | /* v1/v2 uCode file layout */ |
245 | struct iwl_ucode_header { | 234 | struct iwl_ucode_header { |
246 | __le32 ver; /* major/minor/API/serial */ | 235 | __le32 ver; /* major/minor/API/serial */ |
@@ -805,13 +794,6 @@ enum iwl_scan_type { | |||
805 | IWL_SCAN_ROC, | 794 | IWL_SCAN_ROC, |
806 | }; | 795 | }; |
807 | 796 | ||
808 | enum iwlagn_ucode_type { | ||
809 | IWL_UCODE_NONE, | ||
810 | IWL_UCODE_REGULAR, | ||
811 | IWL_UCODE_INIT, | ||
812 | IWL_UCODE_WOWLAN, | ||
813 | }; | ||
814 | |||
815 | #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL | 797 | #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL |
816 | struct iwl_testmode_trace { | 798 | struct iwl_testmode_trace { |
817 | u32 buff_size; | 799 | u32 buff_size; |
@@ -915,11 +897,7 @@ struct iwl_priv { | |||
915 | u32 ucode_ver; /* version of ucode, copy of | 897 | u32 ucode_ver; /* version of ucode, copy of |
916 | iwl_ucode.ver */ | 898 | iwl_ucode.ver */ |
917 | 899 | ||
918 | struct fw_img ucode_rt; | 900 | enum iwl_ucode_type ucode_type; |
919 | struct fw_img ucode_init; | ||
920 | struct fw_img ucode_wowlan; | ||
921 | |||
922 | enum iwlagn_ucode_type ucode_type; | ||
923 | char firmware_name[25]; | 901 | char firmware_name[25]; |
924 | 902 | ||
925 | struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; | 903 | struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index 34b817f48a27..1ecdd1c2943d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -207,12 +207,34 @@ struct iwl_trans_ops { | |||
207 | #endif | 207 | #endif |
208 | }; | 208 | }; |
209 | 209 | ||
210 | /* one for each uCode image (inst/data, boot/init/runtime) */ | ||
211 | struct fw_desc { | ||
212 | dma_addr_t p_addr; /* hardware address */ | ||
213 | void *v_addr; /* software address */ | ||
214 | u32 len; /* size in bytes */ | ||
215 | }; | ||
216 | |||
217 | struct fw_img { | ||
218 | struct fw_desc code; /* firmware code image */ | ||
219 | struct fw_desc data; /* firmware data image */ | ||
220 | }; | ||
221 | |||
222 | enum iwl_ucode_type { | ||
223 | IWL_UCODE_NONE, | ||
224 | IWL_UCODE_REGULAR, | ||
225 | IWL_UCODE_INIT, | ||
226 | IWL_UCODE_WOWLAN, | ||
227 | }; | ||
228 | |||
210 | /** | 229 | /** |
211 | * struct iwl_trans - transport common data | 230 | * struct iwl_trans - transport common data |
212 | * @ops - pointer to iwl_trans_ops | 231 | * @ops - pointer to iwl_trans_ops |
213 | * @shrd - pointer to iwl_shared which holds shared data from the upper layer | 232 | * @shrd - pointer to iwl_shared which holds shared data from the upper layer |
214 | * @hcmd_lock: protects HCMD | 233 | * @hcmd_lock: protects HCMD |
215 | * @ucode_write_complete: indicates that the ucode has been copied. | 234 | * @ucode_write_complete: indicates that the ucode has been copied. |
235 | * @ucode_rt: run time ucode image | ||
236 | * @ucode_init: init ucode image | ||
237 | * @ucode_wowlan: wake on wireless ucode image (optional) | ||
216 | */ | 238 | */ |
217 | struct iwl_trans { | 239 | struct iwl_trans { |
218 | const struct iwl_trans_ops *ops; | 240 | const struct iwl_trans_ops *ops; |
@@ -220,6 +242,9 @@ struct iwl_trans { | |||
220 | spinlock_t hcmd_lock; | 242 | spinlock_t hcmd_lock; |
221 | 243 | ||
222 | u8 ucode_write_complete; /* the image write is complete */ | 244 | u8 ucode_write_complete; /* the image write is complete */ |
245 | struct fw_img ucode_rt; | ||
246 | struct fw_img ucode_init; | ||
247 | struct fw_img ucode_wowlan; | ||
223 | 248 | ||
224 | /* pointer to trans specific struct */ | 249 | /* pointer to trans specific struct */ |
225 | /*Ensure that this pointer will always be aligned to sizeof pointer */ | 250 | /*Ensure that this pointer will always be aligned to sizeof pointer */ |
@@ -351,4 +376,8 @@ static inline int iwl_trans_resume(struct iwl_trans *trans) | |||
351 | ******************************************************/ | 376 | ******************************************************/ |
352 | extern const struct iwl_trans_ops trans_ops_pcie; | 377 | extern const struct iwl_trans_ops trans_ops_pcie; |
353 | 378 | ||
379 | int iwl_alloc_fw_desc(struct iwl_bus *bus, struct fw_desc *desc, | ||
380 | const void *data, size_t len); | ||
381 | void iwl_dealloc_ucode(struct iwl_trans *trans); | ||
382 | |||
354 | #endif /* __iwl_trans_h__ */ | 383 | #endif /* __iwl_trans_h__ */ |