diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-04-15 00:16:14 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-04-16 15:59:59 -0400 |
commit | 059ff8266104d4919c693d6bf974c9e350da513e (patch) | |
tree | 647a74a19d6f48eb1440f34f33b92a01c7ebbdf9 | |
parent | 508e32e177f54d1f6ebcfa181b9d6f2583c3b1c0 (diff) |
iwlwifi: move shared pointers to iwl_priv
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-hw.h | 12 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 55 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.h | 11 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 6 |
4 files changed, 40 insertions, 44 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h index de7bac149723..3d098da25fc9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h | |||
@@ -1554,29 +1554,29 @@ struct iwl4965_sched_queue_byte_cnt_tbl { | |||
1554 | struct iwl4965_shared { | 1554 | struct iwl4965_shared { |
1555 | struct iwl4965_sched_queue_byte_cnt_tbl | 1555 | struct iwl4965_sched_queue_byte_cnt_tbl |
1556 | queues_byte_cnt_tbls[IWL_MAX_NUM_QUEUES]; | 1556 | queues_byte_cnt_tbls[IWL_MAX_NUM_QUEUES]; |
1557 | __le32 val0; | 1557 | __le32 rb_closed; |
1558 | 1558 | ||
1559 | /* __le32 rb_closed_stts_rb_num:12; */ | 1559 | /* __le32 rb_closed_stts_rb_num:12; */ |
1560 | #define IWL_rb_closed_stts_rb_num_POS 0 | 1560 | #define IWL_rb_closed_stts_rb_num_POS 0 |
1561 | #define IWL_rb_closed_stts_rb_num_LEN 12 | 1561 | #define IWL_rb_closed_stts_rb_num_LEN 12 |
1562 | #define IWL_rb_closed_stts_rb_num_SYM val0 | 1562 | #define IWL_rb_closed_stts_rb_num_SYM rb_closed |
1563 | /* __le32 rsrv1:4; */ | 1563 | /* __le32 rsrv1:4; */ |
1564 | /* __le32 rb_closed_stts_rx_frame_num:12; */ | 1564 | /* __le32 rb_closed_stts_rx_frame_num:12; */ |
1565 | #define IWL_rb_closed_stts_rx_frame_num_POS 16 | 1565 | #define IWL_rb_closed_stts_rx_frame_num_POS 16 |
1566 | #define IWL_rb_closed_stts_rx_frame_num_LEN 12 | 1566 | #define IWL_rb_closed_stts_rx_frame_num_LEN 12 |
1567 | #define IWL_rb_closed_stts_rx_frame_num_SYM val0 | 1567 | #define IWL_rb_closed_stts_rx_frame_num_SYM rb_closed |
1568 | /* __le32 rsrv2:4; */ | 1568 | /* __le32 rsrv2:4; */ |
1569 | 1569 | ||
1570 | __le32 val1; | 1570 | __le32 frm_finished; |
1571 | /* __le32 frame_finished_stts_rb_num:12; */ | 1571 | /* __le32 frame_finished_stts_rb_num:12; */ |
1572 | #define IWL_frame_finished_stts_rb_num_POS 0 | 1572 | #define IWL_frame_finished_stts_rb_num_POS 0 |
1573 | #define IWL_frame_finished_stts_rb_num_LEN 12 | 1573 | #define IWL_frame_finished_stts_rb_num_LEN 12 |
1574 | #define IWL_frame_finished_stts_rb_num_SYM val1 | 1574 | #define IWL_frame_finished_stts_rb_num_SYM frm_finished |
1575 | /* __le32 rsrv3:4; */ | 1575 | /* __le32 rsrv3:4; */ |
1576 | /* __le32 frame_finished_stts_rx_frame_num:12; */ | 1576 | /* __le32 frame_finished_stts_rx_frame_num:12; */ |
1577 | #define IWL_frame_finished_stts_rx_frame_num_POS 16 | 1577 | #define IWL_frame_finished_stts_rx_frame_num_POS 16 |
1578 | #define IWL_frame_finished_stts_rx_frame_num_LEN 12 | 1578 | #define IWL_frame_finished_stts_rx_frame_num_LEN 12 |
1579 | #define IWL_frame_finished_stts_rx_frame_num_SYM val1 | 1579 | #define IWL_frame_finished_stts_rx_frame_num_SYM frm_finished |
1580 | /* __le32 rsrv4:4; */ | 1580 | /* __le32 rsrv4:4; */ |
1581 | 1581 | ||
1582 | __le32 padding1; /* so that allocation will be aligned to 16B */ | 1582 | __le32 padding1; /* so that allocation will be aligned to 16B */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 04fed5e0724a..a10a6e81769f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -274,6 +274,18 @@ static int iwl4965_init_drv(struct iwl_priv *priv) | |||
274 | spin_lock_init(&priv->hcmd_lock); | 274 | spin_lock_init(&priv->hcmd_lock); |
275 | spin_lock_init(&priv->lq_mngr.lock); | 275 | spin_lock_init(&priv->lq_mngr.lock); |
276 | 276 | ||
277 | priv->shared_virt = pci_alloc_consistent(priv->pci_dev, | ||
278 | sizeof(struct iwl4965_shared), | ||
279 | &priv->shared_phys); | ||
280 | |||
281 | if (!priv->shared_virt) { | ||
282 | ret = -ENOMEM; | ||
283 | goto err; | ||
284 | } | ||
285 | |||
286 | memset(priv->shared_virt, 0, sizeof(struct iwl4965_shared)); | ||
287 | |||
288 | |||
277 | for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) | 289 | for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) |
278 | INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); | 290 | INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); |
279 | 291 | ||
@@ -546,15 +558,15 @@ static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) | |||
546 | 558 | ||
547 | static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl4965_rx_queue *rxq) | 559 | static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl4965_rx_queue *rxq) |
548 | { | 560 | { |
549 | int rc; | 561 | int ret; |
550 | unsigned long flags; | 562 | unsigned long flags; |
551 | unsigned int rb_size; | 563 | unsigned int rb_size; |
552 | 564 | ||
553 | spin_lock_irqsave(&priv->lock, flags); | 565 | spin_lock_irqsave(&priv->lock, flags); |
554 | rc = iwl_grab_nic_access(priv); | 566 | ret = iwl_grab_nic_access(priv); |
555 | if (rc) { | 567 | if (ret) { |
556 | spin_unlock_irqrestore(&priv->lock, flags); | 568 | spin_unlock_irqrestore(&priv->lock, flags); |
557 | return rc; | 569 | return ret; |
558 | } | 570 | } |
559 | 571 | ||
560 | if (priv->cfg->mod_params->amsdu_size_8K) | 572 | if (priv->cfg->mod_params->amsdu_size_8K) |
@@ -574,15 +586,15 @@ static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl4965_rx_queue *rxq) | |||
574 | 586 | ||
575 | /* Tell device where in DRAM to update its Rx status */ | 587 | /* Tell device where in DRAM to update its Rx status */ |
576 | iwl_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, | 588 | iwl_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, |
577 | (priv->hw_setting.shared_phys + | 589 | (priv->shared_phys + |
578 | offsetof(struct iwl4965_shared, val0)) >> 4); | 590 | offsetof(struct iwl4965_shared, rb_closed)) >> 4); |
579 | 591 | ||
580 | /* Enable Rx DMA, enable host interrupt, Rx buffer size 4k, 256 RBDs */ | 592 | /* Enable Rx DMA, enable host interrupt, Rx buffer size 4k, 256 RBDs */ |
581 | iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, | 593 | iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, |
582 | FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | | 594 | FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | |
583 | FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | | 595 | FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | |
584 | rb_size | | 596 | rb_size | |
585 | /*0x10 << 4 | */ | 597 | /* 0x10 << 4 | */ |
586 | (RX_QUEUE_SIZE_LOG << | 598 | (RX_QUEUE_SIZE_LOG << |
587 | FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT)); | 599 | FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT)); |
588 | 600 | ||
@@ -1966,7 +1978,7 @@ int iwl4965_alive_notify(struct iwl_priv *priv) | |||
1966 | 1978 | ||
1967 | /* Tel 4965 where to find Tx byte count tables */ | 1979 | /* Tel 4965 where to find Tx byte count tables */ |
1968 | iwl_write_prph(priv, IWL49_SCD_DRAM_BASE_ADDR, | 1980 | iwl_write_prph(priv, IWL49_SCD_DRAM_BASE_ADDR, |
1969 | (priv->hw_setting.shared_phys + | 1981 | (priv->shared_phys + |
1970 | offsetof(struct iwl4965_shared, queues_byte_cnt_tbls)) >> 10); | 1982 | offsetof(struct iwl4965_shared, queues_byte_cnt_tbls)) >> 10); |
1971 | 1983 | ||
1972 | /* Disable chain mode for all queues */ | 1984 | /* Disable chain mode for all queues */ |
@@ -2024,29 +2036,14 @@ int iwl4965_alive_notify(struct iwl_priv *priv) | |||
2024 | */ | 2036 | */ |
2025 | int iwl4965_hw_set_hw_setting(struct iwl_priv *priv) | 2037 | int iwl4965_hw_set_hw_setting(struct iwl_priv *priv) |
2026 | { | 2038 | { |
2027 | int ret = 0; | ||
2028 | 2039 | ||
2029 | if ((priv->cfg->mod_params->num_of_queues > IWL_MAX_NUM_QUEUES) || | 2040 | if ((priv->cfg->mod_params->num_of_queues > IWL_MAX_NUM_QUEUES) || |
2030 | (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) { | 2041 | (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) { |
2031 | IWL_ERROR("invalid queues_num, should be between %d and %d\n", | 2042 | IWL_ERROR("invalid queues_num, should be between %d and %d\n", |
2032 | IWL_MIN_NUM_QUEUES, IWL_MAX_NUM_QUEUES); | 2043 | IWL_MIN_NUM_QUEUES, IWL_MAX_NUM_QUEUES); |
2033 | ret = -EINVAL; | 2044 | return -EINVAL; |
2034 | goto out; | ||
2035 | } | ||
2036 | |||
2037 | /* Allocate area for Tx byte count tables and Rx queue status */ | ||
2038 | priv->hw_setting.shared_virt = | ||
2039 | pci_alloc_consistent(priv->pci_dev, | ||
2040 | sizeof(struct iwl4965_shared), | ||
2041 | &priv->hw_setting.shared_phys); | ||
2042 | |||
2043 | if (!priv->hw_setting.shared_virt) { | ||
2044 | ret = -ENOMEM; | ||
2045 | goto out; | ||
2046 | } | 2045 | } |
2047 | 2046 | ||
2048 | memset(priv->hw_setting.shared_virt, 0, sizeof(struct iwl4965_shared)); | ||
2049 | |||
2050 | priv->hw_setting.max_txq_num = priv->cfg->mod_params->num_of_queues; | 2047 | priv->hw_setting.max_txq_num = priv->cfg->mod_params->num_of_queues; |
2051 | priv->hw_setting.tx_cmd_len = sizeof(struct iwl4965_tx_cmd); | 2048 | priv->hw_setting.tx_cmd_len = sizeof(struct iwl4965_tx_cmd); |
2052 | priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE; | 2049 | priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE; |
@@ -2061,8 +2058,7 @@ int iwl4965_hw_set_hw_setting(struct iwl_priv *priv) | |||
2061 | 2058 | ||
2062 | priv->hw_setting.tx_ant_num = 2; | 2059 | priv->hw_setting.tx_ant_num = 2; |
2063 | 2060 | ||
2064 | out: | 2061 | return 0; |
2065 | return ret; | ||
2066 | } | 2062 | } |
2067 | 2063 | ||
2068 | /** | 2064 | /** |
@@ -3014,9 +3010,8 @@ void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv, | |||
3014 | 3010 | ||
3015 | int iwl4965_hw_get_rx_read(struct iwl_priv *priv) | 3011 | int iwl4965_hw_get_rx_read(struct iwl_priv *priv) |
3016 | { | 3012 | { |
3017 | struct iwl4965_shared *shared_data = priv->hw_setting.shared_virt; | 3013 | struct iwl4965_shared *s = priv->shared_virt; |
3018 | 3014 | return le32_to_cpu(s->rb_closed) & 0xFFF; | |
3019 | return IWL_GET_BITS(*shared_data, rb_closed_stts_rb_num); | ||
3020 | } | 3015 | } |
3021 | 3016 | ||
3022 | int iwl4965_hw_get_temperature(struct iwl_priv *priv) | 3017 | int iwl4965_hw_get_temperature(struct iwl_priv *priv) |
@@ -3149,7 +3144,7 @@ static void iwl4965_txq_update_byte_cnt_tbl(struct iwl_priv *priv, | |||
3149 | { | 3144 | { |
3150 | int len; | 3145 | int len; |
3151 | int txq_id = txq->q.id; | 3146 | int txq_id = txq->q.id; |
3152 | struct iwl4965_shared *shared_data = priv->hw_setting.shared_virt; | 3147 | struct iwl4965_shared *shared_data = priv->shared_virt; |
3153 | 3148 | ||
3154 | len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; | 3149 | len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; |
3155 | 3150 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 17c4bcfe113b..e5ab4c01ec9b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h | |||
@@ -576,8 +576,6 @@ struct iwl4965_ibss_seq { | |||
576 | * @max_rxq_log: Log-base-2 of max_rxq_size | 576 | * @max_rxq_log: Log-base-2 of max_rxq_size |
577 | * @max_stations: | 577 | * @max_stations: |
578 | * @bcast_sta_id: | 578 | * @bcast_sta_id: |
579 | * @shared_virt: Pointer to driver/uCode shared Tx Byte Counts and Rx status | ||
580 | * @shared_phys: Physical Pointer to Tx Byte Counts and Rx status | ||
581 | */ | 579 | */ |
582 | struct iwl4965_driver_hw_info { | 580 | struct iwl4965_driver_hw_info { |
583 | u16 max_txq_num; | 581 | u16 max_txq_num; |
@@ -589,8 +587,6 @@ struct iwl4965_driver_hw_info { | |||
589 | u16 max_rxq_log; | 587 | u16 max_rxq_log; |
590 | u8 max_stations; | 588 | u8 max_stations; |
591 | u8 bcast_sta_id; | 589 | u8 bcast_sta_id; |
592 | void *shared_virt; | ||
593 | dma_addr_t shared_phys; | ||
594 | }; | 590 | }; |
595 | 591 | ||
596 | #define HT_SHORT_GI_20MHZ_ONLY (1 << 0) | 592 | #define HT_SHORT_GI_20MHZ_ONLY (1 << 0) |
@@ -1147,9 +1143,14 @@ struct iwl_priv { | |||
1147 | /* Last Rx'd beacon timestamp */ | 1143 | /* Last Rx'd beacon timestamp */ |
1148 | u64 timestamp; | 1144 | u64 timestamp; |
1149 | u16 beacon_int; | 1145 | u16 beacon_int; |
1150 | struct iwl4965_driver_hw_info hw_setting; | ||
1151 | struct ieee80211_vif *vif; | 1146 | struct ieee80211_vif *vif; |
1152 | 1147 | ||
1148 | struct iwl4965_driver_hw_info hw_setting; | ||
1149 | /* driver/uCode shared Tx Byte Counts and Rx status */ | ||
1150 | void *shared_virt; | ||
1151 | /* Physical Pointer to Tx Byte Counts and Rx status */ | ||
1152 | dma_addr_t shared_phys; | ||
1153 | |||
1153 | /* Current association information needed to configure the | 1154 | /* Current association information needed to configure the |
1154 | * hardware */ | 1155 | * hardware */ |
1155 | u16 assoc_id; | 1156 | u16 assoc_id; |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 1f343409c904..5ec0af4788e4 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -1219,11 +1219,11 @@ static int iwl4965_send_beacon_cmd(struct iwl_priv *priv) | |||
1219 | 1219 | ||
1220 | static void iwl4965_unset_hw_setting(struct iwl_priv *priv) | 1220 | static void iwl4965_unset_hw_setting(struct iwl_priv *priv) |
1221 | { | 1221 | { |
1222 | if (priv->hw_setting.shared_virt) | 1222 | if (priv->shared_virt) |
1223 | pci_free_consistent(priv->pci_dev, | 1223 | pci_free_consistent(priv->pci_dev, |
1224 | sizeof(struct iwl4965_shared), | 1224 | sizeof(struct iwl4965_shared), |
1225 | priv->hw_setting.shared_virt, | 1225 | priv->shared_virt, |
1226 | priv->hw_setting.shared_phys); | 1226 | priv->shared_phys); |
1227 | } | 1227 | } |
1228 | 1228 | ||
1229 | /** | 1229 | /** |