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 /drivers/net/wireless/iwlwifi/iwl-4965.c | |
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>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 55 |
1 files changed, 25 insertions, 30 deletions
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 | ||