update for 3.4: iwlwifi 2012-02-02
Subsystems (2)
cover update for 3.4: iwlwifi 2012-02-02
We doing a lot of preparation works and get ready to split the driver into two separate layers in order to accommodate the new architecture.
Amit Beka (1):
iwlwifi: range check to testmode direct reg access
Don Fry (3):
iwlwifi: clarify comment
iwlwifi: move bcast_sta_id init to common routine
iwlwifi: move all ucode routines to iwl-ucode.c
Emmanuel Grumbach (22):
iwlwifi: add fw_alive to transport layer API, kill tx_start
iwlwifi: separate the APM from the EEPROM
iwlwifi: move the shrd memory from priv
iwlwifi: allocate the transport from the bus layer
iwlwifi: move the bus configuration to transport
iwlwifi: the read / write register ops move to transport
iwlwifi: give trans to all the read / write functions
iwlwifi: remove the pointer to dev from the bus layer
iwlwifi: don't use the bus for ucode fw_desc any more
iwlwifi: rename trans_ops->request_irq to trans_ops->start_hw
iwlwifi: move prepare_card_hw to start_hw
iwlwifi: move apm_init to start_hw
iwlwifi: introduce trans_ops->stop_hw
iwlwifi: move the RF kill logic from iwl_probe to transport
iwlwifi: consolidate the start_device flow
iwlwifi: kill bus_apm_config
iwlwifi: kill bus_is_pm_supported
iwlwifi: kill bus_get_hw_id_string
iwlwifi: kill bus_get_hw_id
iwlwifi: move hw_rev to transport layer
iwlwifi: stop_hw replace enable_rfkill_int
iwlwifi: debug print in tx_queue_set_status is more clear
Gregory Greenman (1):
iwlwifi: Connect IDI transport to driver.
Johannes Berg (1):
iwlwifi: release IRQ in error path
these patches are also available from wireless-next branch on
git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi.git
drivers/net/wireless/iwlwifi/iwl-1000.c | 6 +- drivers/net/wireless/iwlwifi/iwl-2000.c | 4 +- drivers/net/wireless/iwlwifi/iwl-5000.c | 6 +- drivers/net/wireless/iwlwifi/iwl-6000.c | 10 +- drivers/net/wireless/iwlwifi/iwl-agn-rx.c | 8 +- drivers/net/wireless/iwlwifi/iwl-agn-tt.c | 14 +- drivers/net/wireless/iwlwifi/iwl-agn.c | 713 +------------------- drivers/net/wireless/iwlwifi/iwl-agn.h | 3 +- drivers/net/wireless/iwlwifi/iwl-bus.h | 64 -- drivers/net/wireless/iwlwifi/iwl-core.c | 128 +---- drivers/net/wireless/iwlwifi/iwl-core.h | 6 - drivers/net/wireless/iwlwifi/iwl-debug.h | 16 +- drivers/net/wireless/iwlwifi/iwl-debugfs.c | 6 +- drivers/net/wireless/iwlwifi/iwl-dev.h | 109 --- drivers/net/wireless/iwlwifi/iwl-eeprom.c | 65 +- drivers/net/wireless/iwlwifi/iwl-io.c | 193 +++--- drivers/net/wireless/iwlwifi/iwl-io.h | 60 +- drivers/net/wireless/iwlwifi/iwl-led.c | 9 +- drivers/net/wireless/iwlwifi/iwl-mac80211.c | 36 +- drivers/net/wireless/iwlwifi/iwl-pci.c | 229 +------ drivers/net/wireless/iwlwifi/iwl-power.c | 2 +- drivers/net/wireless/iwlwifi/iwl-shared.h | 2 - drivers/net/wireless/iwlwifi/iwl-testmode.c | 36 +- drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 18 +- drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 103 ++-- drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c | 55 +- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 661 +++++++++++++++---- drivers/net/wireless/iwlwifi/iwl-trans.h | 133 +++-- drivers/net/wireless/iwlwifi/iwl-ucode.c | 740 ++++++++++++++++++--- drivers/net/wireless/iwlwifi/iwl-ucode.h | 178 +++++ 30 files changed, 1837 insertions(+), 1776 deletions(-) create mode 100644 drivers/net/wireless/iwlwifi/iwl-ucode.h
PATCH 1/28 iwlwifi: add fw_alive to transport layer API, kill tx_start
From: Emmanuel Grumbach <[email protected]>
Define a new handler in the transport layer API: fw_alive. Move iwl_reset_ict to this new handler, and move the content of tx_start to this handler.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 3 --- drivers/net/wireless/iwlwifi/iwl-agn.h | 2 -- drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 2 +- drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 6 ++---- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 10 ++++++++-- drivers/net/wireless/iwlwifi/iwl-trans.h | 15 +++++++-------- drivers/net/wireless/iwlwifi/iwl-ucode.c | 2 +- 7 files changed, 19 insertions(+), 21 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +0 -3
@@ -1243,9 +1243,6 @@ int iwl_alive_start(struct iwl_priv *priv)int ret =0 ;struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS ]; -/*TODO: this should go to the transport layer */ -iwl_reset_ict (trans (priv)); -IWL_DEBUG_INFO (priv,"Runtime Alive received.\n" );/* After the ALIVE response, we can send host commands to the uCode */
drivers/net/wireless/iwlwifi/iwl-agn.h +0 -2
@@ -73,8 +73,6 @@ struct iwlagn_ucode_capabilities {extern struct ieee80211_ops iwlagn_hw_ops; -int iwl_reset_ict (struct iwl_trans *trans); -static inline void iwl_set_calib_hdr (struct iwl_calib_hdr *hdr,u8 cmd) { hdr->op_code = cmd;
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h +1 -1
@@ -258,7 +258,7 @@ void iwl_rx_queue_update_write_ptr(struct iwl_trans *trans,/***************************************************** * ICT ******************************************************/ -int iwl_reset_ict (struct iwl_trans *trans); +void iwl_reset_ict (struct iwl_trans *trans);void iwl_disable_ict (struct iwl_trans *trans);int iwl_alloc_isr_ict (struct iwl_trans *trans);void iwl_free_isr_ict (struct iwl_trans *trans);
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c +2 -4
@@ -1213,7 +1213,7 @@ int iwl_alloc_isr_ict(struct iwl_trans *trans)/* Device is going up inform it about using ICT interrupt table, * also we need to tell the driver to start using ICT interrupt. */ -int iwl_reset_ict (struct iwl_trans *trans) +void iwl_reset_ict (struct iwl_trans *trans) {u32 val;unsigned long flags;
@@ -1221,7 +1221,7 @@ int iwl_reset_ict(struct iwl_trans *trans)IWL_TRANS_GET_PCIE_TRANS (trans);if (!trans_pcie->ict_tbl) -return 0 ; +return ;spin_lock_irqsave (&trans->shrd->lock, flags);iwl_disable_interrupts (trans);
@@ -1241,8 +1241,6 @@ int iwl_reset_ict(struct iwl_trans *trans)iwl_write32 (bus (trans),CSR_INT , trans_pcie->inta_mask);iwl_enable_interrupts (trans);spin_unlock_irqrestore (&trans->shrd->lock, flags); - -return 0 ; }/* Device is going down disable ict interrupt usage */
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +8 -2
@@ -835,7 +835,7 @@ static void iwl_trans_txq_set_sched(struct iwl_trans *trans, u32 mask)iwl_write_prph (bus (trans),SCD_TXFACT , mask); } -static void iwl_trans_pcie_tx_start (struct iwl_trans *trans) +static void iwl_tx_start (struct iwl_trans *trans) {const struct queue_to_fifo_ac *queue_to_fifo; struct iwl_trans_pcie *trans_pcie =
@@ -948,6 +948,12 @@ static void iwl_trans_pcie_tx_start(struct iwl_trans *trans) APMG_PCIDEV_STT_VAL_L1_ACT_DIS); } +static void iwl_trans_pcie_fw_alive (struct iwl_trans *trans) +{ +iwl_reset_ict (trans); +iwl_tx_start (trans); +} +/** * iwlagn_txq_ctx_stop - Stop all Tx DMA channels */
@@ -1903,11 +1909,11 @@ static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans,const struct iwl_trans_ops trans_ops_pcie = { .alloc = iwl_trans_pcie_alloc, .request_irq = iwl_trans_pcie_request_irq, + .fw_alive = iwl_trans_pcie_fw_alive, .start_device = iwl_trans_pcie_start_device, .prepare_card_hw = iwl_trans_pcie_prepare_card_hw, .stop_device = iwl_trans_pcie_stop_device, - .tx_start = iwl_trans_pcie_tx_start, .wake_any_queue = iwl_trans_pcie_wake_any_queue, .send_cmd = iwl_trans_pcie_send_cmd,
drivers/net/wireless/iwlwifi/iwl-trans.h +7 -8
@@ -139,8 +139,7 @@ struct iwl_host_cmd {* layer. * @prepare_card_hw: claim the ownership on the HW. Will be called during * probe. -* @tx_start: starts and configures all the Tx fifo - usually done once the fw -* is alive. +* @fw_alive: called when the fw sends alive notification * @wake_any_queue: wake all the queues of a specfic context IWL_RXON_CTX_* * @stop_device:stops the whole device (embedded CPU put to reset) * @send_cmd:send a host command
@@ -166,9 +165,9 @@ struct iwl_trans_ops {struct iwl_trans *(*alloc)(struct iwl_shared *shrd);int (*request_irq)(struct iwl_trans *iwl_trans);int (*start_device)(struct iwl_trans *trans); +void (*fw_alive)(struct iwl_trans *trans);int (*prepare_card_hw)(struct iwl_trans *trans);void (*stop_device)(struct iwl_trans *trans); -void (*tx_start)(struct iwl_trans *trans); void (*wake_any_queue)(struct iwl_trans *trans, enum iwl_rxon_context_id ctx,
@@ -264,6 +263,11 @@ static inline int iwl_trans_request_irq(struct iwl_trans *trans)return trans->ops->request_irq (trans); } +static inline void iwl_trans_fw_alive (struct iwl_trans *trans) +{ + trans->ops->fw_alive (trans); +} +static inline int iwl_trans_start_device (struct iwl_trans *trans) {return trans->ops->start_device (trans);
@@ -279,11 +283,6 @@ static inline void iwl_trans_stop_device(struct iwl_trans *trans) trans->ops->stop_device (trans); } -static inline void iwl_trans_tx_start (struct iwl_trans *trans) -{ - trans->ops->tx_start (trans); -} -static inline void iwl_trans_wake_any_queue (struct iwl_trans *trans,enum iwl_rxon_context_id ctx,const char *msg)
drivers/net/wireless/iwlwifi/iwl-ucode.c +1 -1
@@ -447,7 +447,7 @@ static int iwl_alive_notify(struct iwl_trans *trans)if (!priv->tx_cmd_pool)return -ENOMEM ; -iwl_trans_tx_start (trans); +iwl_trans_fw_alive (trans);for_each_context (priv, ctx) ctx->last_tx_rejected = false;
Signature · 1 line
1.7.0.4
PATCH 2/28 iwlwifi: Connect IDI transport to driver.
In reply to Wey-Yi GuyFrom: Gregory Greenman <[email protected]>
This patch connects IDI transport to driver. It does so by using a number of ifdefs at this stage.
IDI is a new transport that is under development.
--- drivers/net/wireless/iwlwifi/iwl-pci.c | 4 ++++ drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 13 ++++++++++++- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 7 ++++++- drivers/net/wireless/iwlwifi/iwl-trans.h | 1 + 4 files changed, 23 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/iwl-pci.c +4 -0
@@ -454,7 +454,11 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) bus->irq = pdev->irq; bus->ops = &bus_ops_pci; +#ifdef CONFIG_IWLWIFI_IDI + err =iwl_probe (bus, &trans_ops_idi, cfg); +#else err =iwl_probe (bus, &trans_ops_pcie, cfg); +#endif if (err) goto out_disable_msi;return 0 ;
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c +12 -1
@@ -35,6 +35,10 @@#include "iwl-io.h" #include "iwl-trans-pcie-int.h" +#ifdef CONFIG_IWLWIFI_IDI +#include "iwl-amfh.h" +#endif +/****************************************************************************** * * RX path functions
@@ -1100,8 +1104,11 @@ void iwl_irq_tasklet(struct iwl_trans *trans)/* Disable periodic interrupt; we use it as just a one-shot. */ iwl_write8 (bus (trans),CSR_INT_PERIODIC_REG ,CSR_INT_PERIODIC_DIS ); +#ifdef CONFIG_IWLWIFI_IDI +iwl_amfh_rx_handler (); +#else iwl_rx_handle (trans); - +#endif /* * Enable periodic interrupt in 8 msec only if we received * real RX interrupt (instead of just periodic int), to catch
@@ -1123,7 +1130,11 @@ void iwl_irq_tasklet(struct iwl_trans *trans) isr_stats->tx++; handled |=CSR_INT_BIT_FH_TX ;/* Wake up uCode load routine, now that load is complete */ +#ifdef CONFIG_IWLWIFI_IDI + trans->shrd->trans->ucode_write_complete =1 ; +#else trans->ucode_write_complete =1 ; +#endif wake_up (&trans->shrd->wait_command_queue); }
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +6 -1
@@ -647,8 +647,10 @@ static int iwl_nic_init(struct iwl_trans *trans)iwl_nic_config (priv (trans)); +#ifndef CONFIG_IWLWIFI_IDI /* Allocate the RX queue, or reset if it is already allocated */ iwl_rx_init (trans); +#endif /* Allocate or reset and init all Tx and Command queues */ if (iwl_tx_init (trans))
@@ -1016,8 +1018,9 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)*/ if (test_bit (STATUS_DEVICE_ENABLED , &trans->shrd->status)) {iwl_trans_tx_stop (trans); +#ifndef CONFIG_IWLWIFI_IDI iwl_trans_rx_stop (trans); - +#endif /* Power-down device's busmaster DMA clocks */ iwl_write_prph (bus (trans),APMG_CLK_DIS_REG ,APMG_CLK_VAL_DMA_CLK_RQT );
@@ -1298,7 +1301,9 @@ static void iwl_trans_pcie_free(struct iwl_trans *trans) {iwl_calib_free_results (trans);iwl_trans_pcie_tx_free (trans); +#ifndef CONFIG_IWLWIFI_IDI iwl_trans_pcie_rx_free (trans); +#endif free_irq (bus (trans)->irq, trans);iwl_free_isr_ict (trans); trans->shrd->trans =NULL ;
drivers/net/wireless/iwlwifi/iwl-trans.h +1 -0
@@ -383,6 +383,7 @@ static inline int iwl_trans_resume(struct iwl_trans *trans)* Transport layers implementations ******************************************************/ extern const struct iwl_trans_ops trans_ops_pcie; +extern const struct iwl_trans_ops trans_ops_idi;int iwl_alloc_fw_desc (struct iwl_bus *bus,struct fw_desc *desc,const void *data,size_t len);
Signature · 1 line
1.7.0.4
PATCH 3/28 iwlwifi: separate the APM from the EEPROM
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
There is no link between the two. Ensure that the NIC is on outside the code of the EEPROM handling.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 4 ++++ drivers/net/wireless/iwlwifi/iwl-eeprom.c | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +4 -0
@@ -1848,8 +1848,12 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,/***************** * 4. Read EEPROM *****************/ +/* switch the NIC on before accessing the EEPROM */ +iwl_apm_init (priv);/* Read the EEPROM */ err =iwl_eeprom_init (priv, hw_rev); +/* Reset chip to save power until we load uCode during "up". */ +iwl_apm_stop (priv);if (err) {IWL_ERR (priv,"Unable to init EEPROM\n" ); goto out_free_trans;
drivers/net/wireless/iwlwifi/iwl-eeprom.c +0 -4
@@ -676,8 +676,6 @@ int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) } e = (__le16 *)shrd->eeprom; -iwl_apm_init (priv); - ret =iwl_eeprom_verify_signature (trans (priv));if (ret <0 ) {IWL_ERR (priv,"EEPROM not found, EEPROM_GP=0x%08x\n" , gp);
@@ -758,8 +756,6 @@ done: err:if (ret)iwl_eeprom_free (priv->shrd); -/* Reset chip to save power until we load uCode during "up". */ -iwl_apm_stop (priv); alloc_err:return ret; }
Signature · 1 line
1.7.0.4
PATCH 9/28 iwlwifi: remove the pointer to dev from the bus layer
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 4 ++-- drivers/net/wireless/iwlwifi/iwl-bus.h | 2 -- drivers/net/wireless/iwlwifi/iwl-debug.h | 16 ++++++++-------- drivers/net/wireless/iwlwifi/iwl-pci.c | 7 ++++--- drivers/net/wireless/iwlwifi/iwl-ucode.c | 4 ++-- 5 files changed, 16 insertions(+), 17 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +2 -2
@@ -1146,7 +1146,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)iwl_dealloc_ucode (trans (priv)); out_unbind:complete (&priv->firmware_loading_complete); -device_release_driver (bus (priv)->dev); +device_release_driver (trans (priv)->dev);release_firmware (ucode_raw); }
@@ -1785,7 +1785,7 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,/* At this point both hw and priv are allocated. */ -SET_IEEE80211_DEV (hw,bus (priv)->dev); +SET_IEEE80211_DEV (hw,trans (priv)->dev);/* what debugging capabilities we have */ iwl_debug_config (priv);
drivers/net/wireless/iwlwifi/iwl-bus.h +0 -2
@@ -137,14 +137,12 @@ struct iwl_bus_ops {* * This data is common to all bus layer implementations. * -* @dev - pointer to struct device * that represents the device * @ops - pointer to iwl_bus_ops * @shrd - pointer to iwl_shared which holds shared data from the upper layer * NB: for the time being this needs to be set by the upper layer since * it allocates the shared data */ struct iwl_bus { -struct device *dev;const struct iwl_bus_ops *ops;struct iwl_shared *shrd;
drivers/net/wireless/iwlwifi/iwl-debug.h +8 -8
@@ -35,10 +35,10 @@struct iwl_priv ;/*No matter what is m (priv, bus, trans), this will work */ -#define IWL_ERR(m, f, a...) dev_err(bus(m)->dev, f, ## a) -#define IWL_WARN(m, f, a...) dev_warn(bus(m)->dev, f, ## a) -#define IWL_INFO(m, f, a...) dev_info(bus(m)->dev, f, ## a) -#define IWL_CRIT(m, f, a...) dev_crit(bus(m)->dev, f, ## a) +#define IWL_ERR(m, f, a...) dev_err(trans(m)->dev, f, ## a) +#define IWL_WARN(m, f, a...) dev_warn(trans(m)->dev, f, ## a) +#define IWL_INFO(m, f, a...) dev_info(trans(m)->dev, f, ## a) +#define IWL_CRIT(m, f, a...) dev_crit(trans(m)->dev, f, ## a)#define iwl_print_hex_error (m, p, len) \ do { \
@@ -50,7 +50,7 @@ do { \#define IWL_DEBUG (m, level, fmt, ...) \ do { \ if (iwl_get_debug_level((m)->shrd) & (level)) \ - dev_err(bus(m)->dev, "%c %s " fmt, \ + dev_err(trans(m)->dev, "%c %s " fmt, \ in_interrupt() ? 'I' : 'U', __func__, \ ##__VA_ARGS__); \ } while (0)
@@ -59,7 +59,7 @@ do { \do { \if (iwl_get_debug_level ((m)->shrd) & (level) && \net_ratelimit ()) \ -dev_err (bus (m)->dev,"%c %s " fmt, \ +dev_err (trans (m)->dev,"%c %s " fmt, \in_interrupt () ?'I' :'U' , __func__, \ ##__VA_ARGS__); \ }while (0 )
@@ -74,12 +74,12 @@ do { \#define IWL_DEBUG_QUIET_RFKILL (p, fmt, ...) \ do { \ if (!iwl_is_rfkill(p->shrd)) \ - dev_err(bus(p)->dev, "%s%c %s " fmt, \ + dev_err(trans(p)->dev, "%s%c %s " fmt, \ "", \ in_interrupt() ? 'I' : 'U', __func__, \ ##__VA_ARGS__); \ else if (iwl_get_debug_level(p->shrd) & IWL_DL_RADIO) \ - dev_err(bus(p)->dev, "%s%c %s " fmt, \ + dev_err(trans(p)->dev, "%s%c %s " fmt, \ "(RFKILL) ", \ in_interrupt() ? 'I' : 'U', __func__, \ ##__VA_ARGS__); \
drivers/net/wireless/iwlwifi/iwl-pci.c +4 -3
@@ -123,12 +123,14 @@ static void iwl_pci_apm_config(struct iwl_bus *bus)/* L1-ASPM enabled; disable(!) L0S */ iwl_set_bit (trans (bus),CSR_GIO_REG ,CSR_GIO_REG_VAL_L0S_ENABLED ); -dev_printk (KERN_INFO , bus->dev,"L1 Enabled; Disabling L0S\n" ); +dev_printk (KERN_INFO ,trans (bus)->dev, +"L1 Enabled; Disabling L0S\n" ); }else {/* L1-ASPM disabled; enable(!) L0S */ iwl_clear_bit (trans (bus),CSR_GIO_REG ,CSR_GIO_REG_VAL_L0S_ENABLED ); -dev_printk (KERN_INFO , bus->dev,"L1 Disabled; Enabling L0S\n" ); +dev_printk (KERN_INFO ,trans (bus)->dev, +"L1 Disabled; Enabling L0S\n" ); } }
@@ -368,7 +370,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)pci_set_drvdata (pdev, bus); - bus->dev = &pdev->dev; bus->ops = &bus_ops_pci;#ifdef CONFIG_IWLWIFI_IDI
drivers/net/wireless/iwlwifi/iwl-ucode.c +2 -2
@@ -83,7 +83,7 @@ static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = {static void iwl_free_fw_desc (struct iwl_bus *bus,struct fw_desc *desc) {if (desc->v_addr) -dma_free_coherent (bus->dev, desc->len, +dma_free_coherent (trans (bus)->dev, desc->len, desc->v_addr, desc->p_addr); desc->v_addr =NULL ; desc->len =0 ;
@@ -110,7 +110,7 @@ int iwl_alloc_fw_desc(struct iwl_bus *bus, struct fw_desc *desc,return -EINVAL ; } - desc->v_addr =dma_alloc_coherent (bus->dev, len, + desc->v_addr =dma_alloc_coherent (trans (bus)->dev, len, &desc->p_addr,GFP_KERNEL );if (!desc->v_addr)return -ENOMEM ;
Signature · 1 line
1.7.0.4
PATCH 4/28 iwlwifi: move the shrd memory from priv
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
Allocating the shrd area dynamically will allow more agility while revamping the flows.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 4 +--- drivers/net/wireless/iwlwifi/iwl-dev.h | 1 - drivers/net/wireless/iwlwifi/iwl-pci.c | 10 ++++++++++ 3 files changed, 11 insertions(+), 4 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +1 -3
@@ -1780,9 +1780,7 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops, } priv = hw->priv; - priv->shrd = &priv->_shrd; - bus->shrd = priv->shrd; - priv->shrd->bus = bus; + priv->shrd = bus->shrd; priv->shrd->priv = priv; priv->shrd->trans = trans_ops->alloc (priv->shrd);
drivers/net/wireless/iwlwifi/iwl-dev.h +0 -1
@@ -821,7 +821,6 @@ struct iwl_wipan_noa_data {struct iwl_priv {/*data shared among all the driver's layers */ -struct iwl_shared _shrd;struct iwl_shared *shrd;/* ieee device used by generic ieee processing code */
drivers/net/wireless/iwlwifi/iwl-pci.c +10 -0
@@ -374,10 +374,18 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (!bus) {dev_printk (KERN_ERR , &pdev->dev,"Couldn't allocate iwl_pci_bus" ); +return -ENOMEM ; + } + + bus->shrd =kzalloc (sizeof (*bus->shrd),GFP_KERNEL ); +if (!bus->shrd) { +dev_printk (KERN_ERR , &pdev->dev, +"Couldn't allocate iwl_shared" ); err = -ENOMEM ; goto out_no_pci; } + bus->shrd->bus = bus; pci_bus =IWL_BUS_GET_PCI_BUS (bus); pci_bus->pci_dev = pdev;
@@ -472,6 +480,7 @@ out_pci_release_regions: out_pci_disable_device:pci_disable_device (pdev); out_no_pci: +kfree (bus->shrd);kfree (bus);return err; }
@@ -491,6 +500,7 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)pci_disable_device (pci_dev);pci_set_drvdata (pci_dev,NULL ); +kfree (bus->shrd);kfree (bus); }
Signature · 1 line
1.7.0.4
PATCH 5/28 iwlwifi: allocate the transport from the bus layer
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
Change the way we alloc the transport on the way.
Since the transport is allocated from a bus specific area, we can give the bus specific parameters (i.e. pci_dev for PCI) to the transport. This will be useful when the bus layer will be killed.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 16 +++------------- drivers/net/wireless/iwlwifi/iwl-pci.c | 17 ++++++++++++++++- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 24 ++++++++++++++---------- drivers/net/wireless/iwlwifi/iwl-trans.h | 21 +++++++++++++++------ 4 files changed, 48 insertions(+), 30 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +3 -13
@@ -1783,12 +1783,6 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops, priv->shrd = bus->shrd; priv->shrd->priv = priv; - priv->shrd->trans = trans_ops->alloc (priv->shrd); -if (priv->shrd->trans ==NULL ) { - err = -ENOMEM ; - goto out_free_traffic_mem; - } -/* At this point both hw and priv are allocated. */ SET_IEEE80211_DEV (hw,bus (priv)->dev);
@@ -1835,12 +1829,12 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops, err =iwl_trans_request_irq (trans (priv));if (err) - goto out_free_trans; + goto out_free_traffic_mem;if (iwl_trans_prepare_card_hw (trans (priv))) { err = -EIO ;IWL_WARN (priv,"Failed, HW not ready\n" ); - goto out_free_trans; + goto out_free_traffic_mem; }/*****************
@@ -1854,7 +1848,7 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,iwl_apm_stop (priv);if (err) {IWL_ERR (priv,"Unable to init EEPROM\n" ); - goto out_free_trans; + goto out_free_traffic_mem; } err =iwl_eeprom_check_version (priv);if (err)
@@ -1935,8 +1929,6 @@ out_destroy_workqueue:iwl_uninit_drv (priv); out_free_eeprom:iwl_eeprom_free (priv->shrd); -out_free_trans: -iwl_trans_free (trans (priv)); out_free_traffic_mem:iwl_free_traffic_mem (priv);ieee80211_free_hw (priv->hw);
@@ -1980,8 +1972,6 @@ void __devexit iwl_remove(struct iwl_priv * priv) priv->shrd->workqueue =NULL ;iwl_free_traffic_mem (priv); -iwl_trans_free (trans (priv)); -iwl_uninit_drv (priv);dev_kfree_skb (priv->beacon_skb);
drivers/net/wireless/iwlwifi/iwl-pci.c +16 -1
@@ -463,14 +463,28 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) bus->ops = &bus_ops_pci;#ifdef CONFIG_IWLWIFI_IDI +trans (bus) =iwl_trans_idi_alloc (bus->shrd, pdev, ent); +if (trans (bus) ==NULL ) { + err = -ENOMEM ; + goto out_disable_msi; + } + err =iwl_probe (bus, &trans_ops_idi, cfg);#else +trans (bus) =iwl_trans_pcie_alloc (bus->shrd, pdev, ent); +if (trans (bus) ==NULL ) { + err = -ENOMEM ; + goto out_disable_msi; + } + err =iwl_probe (bus, &trans_ops_pcie, cfg);#endif if (err) - goto out_disable_msi; + goto out_free_trans;return 0 ; +out_free_trans: +iwl_trans_free (trans (bus)); out_disable_msi:pci_disable_msi (pdev);pci_iounmap (pdev, pci_bus->hw_base);
@@ -493,6 +507,7 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)struct iwl_shared *shrd = bus->shrd;iwl_remove (shrd->priv); +iwl_trans_free (shrd->trans);pci_disable_msi (pci_dev);pci_iounmap (pci_dev, pci_bus->hw_base);
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +14 -10
@@ -1376,19 +1376,24 @@ static void iwl_trans_pcie_wake_any_queue(struct iwl_trans *trans,const struct iwl_trans_ops trans_ops_pcie; -static struct iwl_trans *iwl_trans_pcie_alloc (struct iwl_shared *shrd) +struct iwl_trans *iwl_trans_pcie_alloc (struct iwl_shared *shrd, +struct pci_dev *pdev, +const struct pci_device_id *ent) { +struct iwl_trans_pcie *trans_pcie;struct iwl_trans *iwl_trans =kzalloc (sizeof (struct iwl_trans ) +sizeof (struct iwl_trans_pcie ),GFP_KERNEL ); -if (iwl_trans) { -struct iwl_trans_pcie *trans_pcie = -IWL_TRANS_GET_PCIE_TRANS (iwl_trans); - iwl_trans->ops = &trans_ops_pcie; - iwl_trans->shrd = shrd; - trans_pcie->trans = iwl_trans; -spin_lock_init (&iwl_trans->hcmd_lock); - } + +if (WARN_ON (!iwl_trans)) +return NULL ; + + trans_pcie =IWL_TRANS_GET_PCIE_TRANS (iwl_trans); + + iwl_trans->ops = &trans_ops_pcie; + iwl_trans->shrd = shrd; + trans_pcie->trans = iwl_trans; +spin_lock_init (&iwl_trans->hcmd_lock);return iwl_trans; }
@@ -1912,7 +1917,6 @@ static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans,#endif /*CONFIG_IWLWIFI_DEBUGFS */ const struct iwl_trans_ops trans_ops_pcie = { - .alloc = iwl_trans_pcie_alloc, .request_irq = iwl_trans_pcie_request_irq, .fw_alive = iwl_trans_pcie_fw_alive, .start_device = iwl_trans_pcie_start_device,
drivers/net/wireless/iwlwifi/iwl-trans.h +15 -6
@@ -133,7 +133,6 @@ struct iwl_host_cmd {/** * struct iwl_trans_ops - transport specific operations -* @alloc: allocates the meta data (not the queues themselves) * @request_irq: requests IRQ - will be called before the FW load in probe flow * @start_device: allocates and inits all the resources for the transport * layer.
@@ -162,7 +161,6 @@ struct iwl_host_cmd {*/ struct iwl_trans_ops { -struct iwl_trans *(*alloc)(struct iwl_shared *shrd);int (*request_irq)(struct iwl_trans *iwl_trans);int (*start_device)(struct iwl_trans *trans);void (*fw_alive)(struct iwl_trans *trans);
@@ -380,11 +378,8 @@ static inline int iwl_trans_resume(struct iwl_trans *trans)#endif /***************************************************** -* Transport layers implementations +* Utils functions ******************************************************/ -extern const struct iwl_trans_ops trans_ops_pcie; -extern const struct iwl_trans_ops trans_ops_idi; -int iwl_alloc_fw_desc (struct iwl_bus *bus,struct fw_desc *desc,const void *data,size_t len);void iwl_dealloc_ucode (struct iwl_trans *trans);
@@ -394,4 +389,18 @@ int iwl_calib_set(struct iwl_trans *trans, const struct iwl_calib_hdr *cmd, int len);void iwl_calib_free_results (struct iwl_trans *trans); +/***************************************************** +* Transport layers implementations + their allocation function +******************************************************/ +struct pci_dev ; +struct pci_device_id ; +extern const struct iwl_trans_ops trans_ops_pcie; +struct iwl_trans *iwl_trans_pcie_alloc (struct iwl_shared *shrd, +struct pci_dev *pdev, +const struct pci_device_id *ent); + +extern const struct iwl_trans_ops trans_ops_idi; +struct iwl_trans *iwl_trans_idi_alloc (struct iwl_shared *shrd, +void *pdev_void, +const void *ent_void);#endif /* __iwl_trans_h__ */
Signature · 1 line
1.7.0.4
PATCH 10/28 iwlwifi: don't use the bus for ucode fw_desc any more
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
This is transport related
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 14 ++++++++------ drivers/net/wireless/iwlwifi/iwl-trans.h | 2 +- drivers/net/wireless/iwlwifi/iwl-ucode.c | 20 ++++++++++---------- 3 files changed, 19 insertions(+), 17 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +8 -6
@@ -1023,31 +1023,33 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)/* Runtime instructions and 2 copies of data: * 1) unmodified from disk * 2) backup cache for save/restore during power-downs */ -if (iwl_alloc_fw_desc (bus (priv), &trans (priv)->ucode_rt.code, +if (iwl_alloc_fw_desc (trans (priv), &trans (priv)->ucode_rt.code, pieces.inst, pieces.inst_size)) goto err_pci_alloc; -if (iwl_alloc_fw_desc (bus (priv), &trans (priv)->ucode_rt.data, +if (iwl_alloc_fw_desc (trans (priv), &trans (priv)->ucode_rt.data, pieces.data, pieces.data_size)) goto err_pci_alloc;/* Initialization instructions and data */ if (pieces.init_size && pieces.init_data_size) { -if (iwl_alloc_fw_desc (bus (priv), &trans (priv)->ucode_init.code, +if (iwl_alloc_fw_desc (trans (priv), + &trans (priv)->ucode_init.code, pieces.init, pieces.init_size)) goto err_pci_alloc; -if (iwl_alloc_fw_desc (bus (priv), &trans (priv)->ucode_init.data, +if (iwl_alloc_fw_desc (trans (priv), + &trans (priv)->ucode_init.data, pieces.init_data, pieces.init_data_size)) goto err_pci_alloc; }/* WoWLAN instructions and data */ if (pieces.wowlan_inst_size && pieces.wowlan_data_size) { -if (iwl_alloc_fw_desc (bus (priv), +if (iwl_alloc_fw_desc (trans (priv), &trans (priv)->ucode_wowlan.code, pieces.wowlan_inst, pieces.wowlan_inst_size)) goto err_pci_alloc; -if (iwl_alloc_fw_desc (bus (priv), +if (iwl_alloc_fw_desc (trans (priv), &trans (priv)->ucode_wowlan.data, pieces.wowlan_data, pieces.wowlan_data_size))
drivers/net/wireless/iwlwifi/iwl-trans.h +1 -1
@@ -408,7 +408,7 @@ static inline u32 iwl_trans_read32(struct iwl_trans *trans, u32 ofs)/***************************************************** * Utils functions ******************************************************/ -int iwl_alloc_fw_desc (struct iwl_bus *bus,struct fw_desc *desc, +int iwl_alloc_fw_desc (struct iwl_trans *trans,struct fw_desc *desc,const void *data,size_t len);void iwl_dealloc_ucode (struct iwl_trans *trans);
drivers/net/wireless/iwlwifi/iwl-ucode.c +10 -10
@@ -80,29 +80,29 @@ static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = {* ******************************************************************************/ -static void iwl_free_fw_desc (struct iwl_bus *bus,struct fw_desc *desc) +static void iwl_free_fw_desc (struct iwl_trans *trans,struct fw_desc *desc) {if (desc->v_addr) -dma_free_coherent (trans (bus)->dev, desc->len, +dma_free_coherent (trans->dev, desc->len, desc->v_addr, desc->p_addr); desc->v_addr =NULL ; desc->len =0 ; } -static void iwl_free_fw_img (struct iwl_bus *bus,struct fw_img *img) +static void iwl_free_fw_img (struct iwl_trans *trans,struct fw_img *img) { -iwl_free_fw_desc (bus, &img->code); -iwl_free_fw_desc (bus, &img->data); +iwl_free_fw_desc (trans, &img->code); +iwl_free_fw_desc (trans, &img->data); }void iwl_dealloc_ucode (struct iwl_trans *trans) { -iwl_free_fw_img (bus (trans), &trans->ucode_rt); -iwl_free_fw_img (bus (trans), &trans->ucode_init); -iwl_free_fw_img (bus (trans), &trans->ucode_wowlan); +iwl_free_fw_img (trans, &trans->ucode_rt); +iwl_free_fw_img (trans, &trans->ucode_init); +iwl_free_fw_img (trans, &trans->ucode_wowlan); } -int iwl_alloc_fw_desc (struct iwl_bus *bus,struct fw_desc *desc, +int iwl_alloc_fw_desc (struct iwl_trans *trans,struct fw_desc *desc,const void *data,size_t len) {if (!len) {
@@ -110,7 +110,7 @@ int iwl_alloc_fw_desc(struct iwl_bus *bus, struct fw_desc *desc,return -EINVAL ; } - desc->v_addr =dma_alloc_coherent (trans (bus)->dev, len, + desc->v_addr =dma_alloc_coherent (trans->dev, len, &desc->p_addr,GFP_KERNEL );if (!desc->v_addr)return -ENOMEM ;
Signature · 1 line
1.7.0.4
PATCH 11/28 iwlwifi: rename trans_ops->request_irq to trans_ops->start_hw
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
This handler will become thicker, reflect its real role now.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +- drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 2 + drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 36 +++++++++++++-------- drivers/net/wireless/iwlwifi/iwl-trans.h | 8 ++-- 4 files changed, 29 insertions(+), 19 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +1 -1
@@ -1829,7 +1829,7 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,IWL_INFO (priv,"Detected %s, REV=0x%X\n" ,cfg (priv)->name, hw_rev); - err =iwl_trans_request_irq (trans (priv)); + err =iwl_trans_start_hw (trans (priv));if (err) goto out_free_traffic_mem;
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h +2 -0
@@ -201,6 +201,7 @@ struct iwl_tx_queue {* @rxq: all the RX queue data * @rx_replenish: work that will be called when buffers need to be allocated * @trans: pointer to the generic transport area +* @irq_requested: true when the irq has been requested * @scd_base_addr: scheduler sram base address in SRAM * @scd_bc_tbls: pointer to the byte count table of the scheduler * @kw: keep warm address
@@ -225,6 +226,7 @@ struct iwl_trans_pcie {int ict_index;u32 inta;bool use_ict; +bool irq_requested;struct tasklet_struct irq_tasklet;struct isr_statistics isr_stats;
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +22 -14
@@ -1235,7 +1235,7 @@ static void iwl_trans_pcie_kick_nic(struct iwl_trans *trans)iwl_write32 (trans,CSR_RESET ,0 ); } -static int iwl_trans_pcie_request_irq (struct iwl_trans *trans) +static int iwl_trans_pcie_start_hw (struct iwl_trans *trans) {struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans);
@@ -1243,20 +1243,26 @@ static int iwl_trans_pcie_request_irq(struct iwl_trans *trans) trans_pcie->inta_mask =CSR_INI_SET_MASK ; -tasklet_init (&trans_pcie->irq_tasklet, (void (*)(unsigned long )) - iwl_irq_tasklet, (unsigned long )trans); +if (!trans_pcie->irq_requested) { +tasklet_init (&trans_pcie->irq_tasklet, (void (*)(unsigned long )) + iwl_irq_tasklet, (unsigned long )trans); -iwl_alloc_isr_ict (trans); +iwl_alloc_isr_ict (trans); - err =request_irq (trans->irq, iwl_isr_ict,IRQF_SHARED , -DRV_NAME , trans); -if (err) { -IWL_ERR (trans,"Error allocating IRQ %d\n" , trans->irq); -iwl_free_isr_ict (trans); -return err; + err =request_irq (trans->irq, iwl_isr_ict,IRQF_SHARED , +DRV_NAME , trans); +if (err) { +IWL_ERR (trans,"Error allocating IRQ %d\n" , + trans->irq); +iwl_free_isr_ict (trans); +tasklet_kill (&trans_pcie->irq_tasklet); +return err; + } + +INIT_WORK (&trans_pcie->rx_replenish, iwl_bg_rx_replenish); + trans_pcie->irq_requested = true; } -INIT_WORK (&trans_pcie->rx_replenish, iwl_bg_rx_replenish);return 0 ; }
@@ -1325,8 +1331,10 @@ static void iwl_trans_pcie_free(struct iwl_trans *trans)#ifndef CONFIG_IWLWIFI_IDI iwl_trans_pcie_rx_free (trans);#endif -free_irq (trans->irq, trans); -iwl_free_isr_ict (trans); +if (trans_pcie->irq_requested == true) { +free_irq (trans->irq, trans); +iwl_free_isr_ict (trans); + }pci_disable_msi (trans_pcie->pci_dev);pci_iounmap (trans_pcie->pci_dev, trans_pcie->hw_base);
@@ -1920,7 +1928,7 @@ static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans,#endif /*CONFIG_IWLWIFI_DEBUGFS */ const struct iwl_trans_ops trans_ops_pcie = { - .request_irq = iwl_trans_pcie_request_irq, + .start_hw = iwl_trans_pcie_start_hw, .fw_alive = iwl_trans_pcie_fw_alive, .start_device = iwl_trans_pcie_start_device, .prepare_card_hw = iwl_trans_pcie_prepare_card_hw,
drivers/net/wireless/iwlwifi/iwl-trans.h +4 -4
@@ -133,7 +133,7 @@ struct iwl_host_cmd {/** * struct iwl_trans_ops - transport specific operations -* @request_irq: requests IRQ - will be called before the FW load in probe flow +* @start_hw: starts the HW- from that point on, the HW can send interrupts * @start_device: allocates and inits all the resources for the transport * layer. * @prepare_card_hw: claim the ownership on the HW. Will be called during
@@ -164,7 +164,7 @@ struct iwl_host_cmd {*/ struct iwl_trans_ops { -int (*request_irq)(struct iwl_trans *iwl_trans); +int (*start_hw)(struct iwl_trans *iwl_trans);int (*start_device)(struct iwl_trans *trans);void (*fw_alive)(struct iwl_trans *trans);int (*prepare_card_hw)(struct iwl_trans *trans);
@@ -269,9 +269,9 @@ struct iwl_trans { char trans_specific[0] __attribute__((__aligned__(sizeof(void *)))); }; -static inline int iwl_trans_request_irq (struct iwl_trans *trans) +static inline int iwl_trans_start_hw (struct iwl_trans *trans) { -return trans->ops->request_irq (trans); +return trans->ops->start_hw (trans); }static inline void iwl_trans_fw_alive (struct iwl_trans *trans)
Signature · 1 line
1.7.0.4
PATCH 12/28 iwlwifi: move prepare_card_hw to start_hw
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
Kill the trans_ops->prepare_card_hw which is now useless.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 6 ------ drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 22 +++++++++++++++------- drivers/net/wireless/iwlwifi/iwl-trans.h | 8 -------- 3 files changed, 15 insertions(+), 21 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +0 -6
@@ -1833,12 +1833,6 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,if (err) goto out_free_traffic_mem; -if (iwl_trans_prepare_card_hw (trans (priv))) { - err = -EIO ; -IWL_WARN (priv,"Failed, HW not ready\n" ); - goto out_free_traffic_mem; - } -/***************** * 4. Read EEPROM *****************/
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +15 -7
@@ -690,13 +690,14 @@ static int iwl_set_hw_ready(struct iwl_trans *trans) }/* Note: returns standard 0/-ERROR code */ -static int iwl_trans_pcie_prepare_card_hw (struct iwl_trans *trans) +static int iwl_prepare_card_hw (struct iwl_trans *trans) {int ret;IWL_DEBUG_INFO (trans,"iwl_trans_prepare_card_hw enter\n" ); ret =iwl_set_hw_ready (trans); +/* If the card is ready, exit 0 */ if (ret >=0 )return 0 ;
@@ -788,7 +789,7 @@ static int iwl_trans_pcie_start_device(struct iwl_trans *trans) trans_pcie->mcast_queue[IWL_RXON_CTX_PAN ] =IWL_IPAN_MCAST_QUEUE ;if ((hw_params (trans).sku &EEPROM_SKU_CAP_AMT_ENABLE ) && -iwl_trans_pcie_prepare_card_hw (trans)) { +iwl_prepare_card_hw (trans)) {IWL_WARN (trans,"Exit HW not ready\n" );return -EIO ; }
@@ -1254,16 +1255,24 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)if (err) {IWL_ERR (trans,"Error allocating IRQ %d\n" , trans->irq); -iwl_free_isr_ict (trans); -tasklet_kill (&trans_pcie->irq_tasklet); -return err; + goto error; }INIT_WORK (&trans_pcie->rx_replenish, iwl_bg_rx_replenish); trans_pcie->irq_requested = true; } -return 0 ; + err =iwl_prepare_card_hw (trans); +if (err) { +IWL_ERR (trans,"Error while preparing HW: %d" , err); + goto error; + } +return err; + +error: +iwl_free_isr_ict (trans); +tasklet_kill (&trans_pcie->irq_tasklet); +return err; } static int iwl_trans_pcie_reclaim(struct iwl_trans *trans, int sta_id, int tid,
@@ -1931,7 +1940,6 @@ const struct iwl_trans_ops trans_ops_pcie = { .start_hw = iwl_trans_pcie_start_hw, .fw_alive = iwl_trans_pcie_fw_alive, .start_device = iwl_trans_pcie_start_device, - .prepare_card_hw = iwl_trans_pcie_prepare_card_hw, .stop_device = iwl_trans_pcie_stop_device, .wake_any_queue = iwl_trans_pcie_wake_any_queue,
drivers/net/wireless/iwlwifi/iwl-trans.h +0 -8
@@ -136,8 +136,6 @@ struct iwl_host_cmd {* @start_hw: starts the HW- from that point on, the HW can send interrupts * @start_device: allocates and inits all the resources for the transport * layer. -* @prepare_card_hw: claim the ownership on the HW. Will be called during -* probe. * @fw_alive: called when the fw sends alive notification * @wake_any_queue: wake all the queues of a specfic context IWL_RXON_CTX_* * @stop_device:stops the whole device (embedded CPU put to reset)
@@ -167,7 +165,6 @@ struct iwl_trans_ops {int (*start_hw)(struct iwl_trans *iwl_trans);int (*start_device)(struct iwl_trans *trans);void (*fw_alive)(struct iwl_trans *trans); -int (*prepare_card_hw)(struct iwl_trans *trans);void (*stop_device)(struct iwl_trans *trans); void (*wake_any_queue)(struct iwl_trans *trans,
@@ -284,11 +281,6 @@ static inline int iwl_trans_start_device(struct iwl_trans *trans)return trans->ops->start_device (trans); } -static inline int iwl_trans_prepare_card_hw (struct iwl_trans *trans) -{ -return trans->ops->prepare_card_hw (trans); -} -static inline void iwl_trans_stop_device (struct iwl_trans *trans) { trans->ops->stop_device (trans);
Signature · 1 line
1.7.0.4
PATCH 6/28 iwlwifi: move the bus configuration to transport
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
All the bus configuration is now done in the transport allocation fucntion.
--- drivers/net/wireless/iwlwifi/iwl-bus.h | 2 - drivers/net/wireless/iwlwifi/iwl-pci.c | 93 +----------- drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 6 + drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 169 +++++++++++++++++---- drivers/net/wireless/iwlwifi/iwl-trans.h | 5 + 5 files changed, 158 insertions(+), 117 deletions(-)
drivers/net/wireless/iwlwifi/iwl-bus.h +0 -2
@@ -148,7 +148,6 @@ struct iwl_bus_ops {* @shrd - pointer to iwl_shared which holds shared data from the upper layer * NB: for the time being this needs to be set by the upper layer since * it allocates the shared data -* @irq - the irq number for the device * @reg_lock - protect hw register access */ struct iwl_bus {
@@ -156,7 +155,6 @@ struct iwl_bus {const struct iwl_bus_ops *ops;struct iwl_shared *shrd; -unsigned int irq;spinlock_t reg_lock;/* pointer to bus specific struct */
drivers/net/wireless/iwlwifi/iwl-pci.c +6 -87
146 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h +6 -0
@@ -211,6 +211,8 @@ struct iwl_tx_queue {* @txq_ctx_active_msk: what queue is active * queue_stopped: tracks what queue is stopped * queue_stop_count: tracks what SW queue is stopped +* @pci_dev: basic pci-network driver stuff +* @hw_base: pci hardware address support */ struct iwl_trans_pcie {struct iwl_rx_queue rxq;
@@ -241,6 +243,10 @@ struct iwl_trans_pcie {#define IWL_MAX_HW_QUEUES 32unsigned long queue_stopped[BITS_TO_LONGS (IWL_MAX_HW_QUEUES )];atomic_t queue_stop_count[4 ]; + +/* PCI bus related data */ +struct pci_dev *pci_dev; +void __iomem *hw_base; };#define IWL_TRANS_GET_PCIE_TRANS (_iwl_trans) \
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +141 -28
210 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-trans.h +5 -0
@@ -228,6 +228,8 @@ struct iwl_calib_result {* @ops - pointer to iwl_trans_ops * @shrd - pointer to iwl_shared which holds shared data from the upper layer * @hcmd_lock: protects HCMD +* @dev - pointer to struct device * that represents the device +* @irq - the irq number for the device * @ucode_write_complete: indicates that the ucode has been copied. * @ucode_rt: run time ucode image * @ucode_init: init ucode image
@@ -240,6 +242,9 @@ struct iwl_trans {struct iwl_shared *shrd;spinlock_t hcmd_lock; +struct device *dev; +unsigned int irq; +u8 ucode_write_complete;/* the image write is complete */ struct fw_img ucode_rt;struct fw_img ucode_init;
Signature · 1 line
1.7.0.4
PATCH 7/28 iwlwifi: the read / write register ops move to transport
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
Most of the accesses to the registers are done from the transport layer.
--- drivers/net/wireless/iwlwifi/iwl-bus.h | 21 -------------- drivers/net/wireless/iwlwifi/iwl-io.h | 11 +++++-- drivers/net/wireless/iwlwifi/iwl-pci.c | 22 --------------- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 37 +++++++++++++------------ drivers/net/wireless/iwlwifi/iwl-trans.h | 21 ++++++++++++++ 5 files changed, 48 insertions(+), 64 deletions(-)
drivers/net/wireless/iwlwifi/iwl-bus.h +0 -21
@@ -124,18 +124,12 @@ struct iwl_bus;* @apm_config: will be called during the config of the APM * @get_hw_id_string: prints the hw_id in the provided buffer * @get_hw_id: get hw_id in u32 -* @write8: write a byte to register at offset ofs -* @write32: write a dword to register at offset ofs -* @wread32: read a dword at register at offset ofs */ struct iwl_bus_ops {bool (*get_pm_support)(struct iwl_bus *bus);void (*apm_config)(struct iwl_bus *bus);void (*get_hw_id_string)(struct iwl_bus *bus,char buf[],int buf_len);u32 (*get_hw_id)(struct iwl_bus *bus); -void (*write8)(struct iwl_bus *bus,u32 ofs,u8 val); -void (*write32)(struct iwl_bus *bus,u32 ofs,u32 val); -u32 (*read32)(struct iwl_bus *bus,u32 ofs); };/**
@@ -183,21 +177,6 @@ static inline u32 bus_get_hw_id(struct iwl_bus *bus)return bus->ops->get_hw_id (bus); } -static inline void bus_write8 (struct iwl_bus *bus,u32 ofs,u8 val) -{ - bus->ops->write8 (bus, ofs, val); -} - -static inline void bus_write32 (struct iwl_bus *bus,u32 ofs,u32 val) -{ - bus->ops->write32 (bus, ofs, val); -} - -static inline u32 bus_read32 (struct iwl_bus *bus,u32 ofs) -{ -return bus->ops->read32 (bus, ofs); -} -/***************************************************** * Bus layer registration functions ******************************************************/
drivers/net/wireless/iwlwifi/iwl-io.h +8 -3
@@ -31,23 +31,28 @@#include "iwl-devtrace.h" #include "iwl-shared.h" +/* TODO: remove when not needed any more */ #include "iwl-bus.h" +#include "iwl-trans.h" static inline void iwl_write8 (struct iwl_bus *bus,u32 ofs,u8 val) { +/* TODO: get trans instead of bus */ trace_iwlwifi_dev_iowrite8 (priv (bus), ofs, val); -bus_write8 (bus, ofs, val); +iwl_trans_write8 (trans (bus), ofs, val); }static inline void iwl_write32 (struct iwl_bus *bus,u32 ofs,u32 val) { +/* TODO: get trans instead of bus */ trace_iwlwifi_dev_iowrite32 (priv (bus), ofs, val); -bus_write32 (bus, ofs, val); +iwl_trans_write32 (trans (bus), ofs, val); }static inline u32 iwl_read32 (struct iwl_bus *bus,u32 ofs) { -u32 val =bus_read32 (bus, ofs); +/* TODO: get trans instead of bus */ +u32 val =iwl_trans_read32 (trans (bus), ofs);trace_iwlwifi_dev_ioread32 (priv (bus), ofs, val);return val; }
drivers/net/wireless/iwlwifi/iwl-pci.c +0 -22
@@ -79,9 +79,6 @@struct iwl_pci_bus {/* basic pci-network driver stuff */ struct pci_dev *pci_dev; - -/* pci hardware address support */ -void __iomem *hw_base; };#define IWL_BUS_GET_PCI_BUS (_iwl_bus) \
@@ -151,30 +148,11 @@ static u32 iwl_pci_get_hw_id(struct iwl_bus *bus)return (pci_dev->device <<16 ) + pci_dev->subsystem_device; } -static void iwl_pci_write8 (struct iwl_bus *bus,u32 ofs,u8 val) -{ -iowrite8 (val,IWL_BUS_GET_PCI_BUS (bus)->hw_base + ofs); -} - -static void iwl_pci_write32 (struct iwl_bus *bus,u32 ofs,u32 val) -{ -iowrite32 (val,IWL_BUS_GET_PCI_BUS (bus)->hw_base + ofs); -} - -static u32 iwl_pci_read32 (struct iwl_bus *bus,u32 ofs) -{ -u32 val =ioread32 (IWL_BUS_GET_PCI_BUS (bus)->hw_base + ofs); -return val; -} -static const struct iwl_bus_ops bus_ops_pci = { .get_pm_support = iwl_pci_is_pm_supported, .apm_config = iwl_pci_apm_config, .get_hw_id_string = iwl_pci_get_hw_id_string, .get_hw_id = iwl_pci_get_hw_id, - .write8 = iwl_pci_write8, - .write32 = iwl_pci_write32, - .read32 = iwl_pci_read32, };#define IWL_PCI_DEVICE (dev, subdev, cfg) \
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +19 -18
@@ -1299,6 +1299,22 @@ static int iwl_trans_pcie_reclaim(struct iwl_trans *trans, int sta_id, int tid,return 0 ; } +static void iwl_trans_pcie_write8 (struct iwl_trans *trans,u32 ofs,u8 val) +{ +iowrite8 (val,IWL_TRANS_GET_PCIE_TRANS (trans)->hw_base + ofs); +} + +static void iwl_trans_pcie_write32 (struct iwl_trans *trans,u32 ofs,u32 val) +{ +iowrite32 (val,IWL_TRANS_GET_PCIE_TRANS (trans)->hw_base + ofs); +} + +static u32 iwl_trans_pcie_read32 (struct iwl_trans *trans,u32 ofs) +{ +u32 val =ioread32 (IWL_TRANS_GET_PCIE_TRANS (trans)->hw_base + ofs); +return val; +} +static void iwl_trans_pcie_free (struct iwl_trans *trans) { struct iwl_trans_pcie *trans_pcie =
@@ -1935,22 +1951,11 @@ const struct iwl_trans_ops trans_ops_pcie = { .suspend = iwl_trans_pcie_suspend, .resume = iwl_trans_pcie_resume, #endif + .write8 = iwl_trans_pcie_write8, + .write32 = iwl_trans_pcie_write32, + .read32 = iwl_trans_pcie_read32, }; -/* TODO: remove this hack - will be possible when all the io{write/read} ops -* will be done through the transport -*/ -struct iwl_pci_bus { -/* basic pci-network driver stuff */ -struct pci_dev *pci_dev; - -/* pci hardware address support */ -void __iomem *hw_base; -}; - -#define IWL_BUS_GET_PCI_BUS (_iwl_bus) \ - ((struct iwl_pci_bus *) ((_iwl_bus)->bus_specific)) -/* PCI registers */ #define PCI_CFG_RETRY_TIMEOUT 0x041
@@ -1958,7 +1963,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,struct pci_dev *pdev, const struct pci_device_id *ent) { - struct iwl_pci_bus *iwl_pci_bus = IWL_BUS_GET_PCI_BUS(shrd->bus); struct iwl_trans_pcie *trans_pcie;struct iwl_trans *trans;u16 pci_cmd;
@@ -2018,9 +2022,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, goto out_pci_release_regions; } -/* TODO: remove this hack */ - iwl_pci_bus->hw_base = trans_pcie->hw_base; -dev_printk (KERN_INFO , &pdev->dev,"pci_resource_len = 0x%08llx\n" , (unsigned long long )pci_resource_len (pdev,0 ));
drivers/net/wireless/iwlwifi/iwl-trans.h +21 -0
@@ -158,6 +158,9 @@ struct iwl_host_cmd {* automatically deleted. * @suspend: stop the device unless WoWLAN is configured * @resume: resume activity of the device +* @write8: write a u8 to a register at offset ofs from the BAR +* @write32: write a u32 to a register at offset ofs from the BAR +* @read32: read a u32 register at offset ofs from the BAR */ struct iwl_trans_ops {
@@ -201,6 +204,9 @@ struct iwl_trans_ops {int (*suspend)(struct iwl_trans *trans);int (*resume)(struct iwl_trans *trans);#endif +void (*write8)(struct iwl_trans *trans,u32 ofs,u8 val); +void (*write32)(struct iwl_trans *trans,u32 ofs,u32 val); +u32 (*read32)(struct iwl_trans *trans,u32 ofs); };/* one for each uCode image (inst/data, boot/init/runtime) */
@@ -382,6 +388,21 @@ static inline int iwl_trans_resume(struct iwl_trans *trans) }#endif +static inline void iwl_trans_write8 (struct iwl_trans *trans,u32 ofs,u8 val) +{ + trans->ops->write8 (trans, ofs, val); +} + +static inline void iwl_trans_write32 (struct iwl_trans *trans,u32 ofs,u32 val) +{ + trans->ops->write32 (trans, ofs, val); +} + +static inline u32 iwl_trans_read32 (struct iwl_trans *trans,u32 ofs) +{ +return trans->ops->read32 (trans, ofs); +} +/***************************************************** * Utils functions ******************************************************/
Signature · 1 line
1.7.0.4
PATCH 8/28 iwlwifi: give trans to all the read / write functions
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
Quoted 1 line
From now on, the transport layer in charge of providing access to the
device. So change all the driver to give a pointer to the transport to all the low level functions that actually access the device.
--- drivers/net/wireless/iwlwifi/iwl-1000.c | 4 +- drivers/net/wireless/iwlwifi/iwl-2000.c | 2 +- drivers/net/wireless/iwlwifi/iwl-5000.c | 2 +- drivers/net/wireless/iwlwifi/iwl-6000.c | 8 +- drivers/net/wireless/iwlwifi/iwl-agn-rx.c | 8 +- drivers/net/wireless/iwlwifi/iwl-agn-tt.c | 14 +- drivers/net/wireless/iwlwifi/iwl-agn.c | 42 +++--- drivers/net/wireless/iwlwifi/iwl-bus.h | 3 - drivers/net/wireless/iwlwifi/iwl-core.c | 28 ++-- drivers/net/wireless/iwlwifi/iwl-core.h | 2 +- drivers/net/wireless/iwlwifi/iwl-debugfs.c | 6 +- drivers/net/wireless/iwlwifi/iwl-eeprom.c | 61 ++++---- drivers/net/wireless/iwlwifi/iwl-io.c | 193 +++++++++++---------- drivers/net/wireless/iwlwifi/iwl-io.h | 63 +++---- drivers/net/wireless/iwlwifi/iwl-led.c | 9 +- drivers/net/wireless/iwlwifi/iwl-mac80211.c | 27 ++-- drivers/net/wireless/iwlwifi/iwl-pci.c | 4 +- drivers/net/wireless/iwlwifi/iwl-testmode.c | 16 +- drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 8 +- drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 82 +++++----- drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c | 46 +++--- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 144 ++++++++-------- drivers/net/wireless/iwlwifi/iwl-trans.h | 2 + drivers/net/wireless/iwlwifi/iwl-ucode.c | 37 ++-- 24 files changed, 405 insertions(+), 406 deletions(-)
drivers/net/wireless/iwlwifi/iwl-1000.c +2 -2
@@ -84,13 +84,13 @@ static void iwl1000_set_ct_threshold(struct iwl_priv *priv)static void iwl1000_nic_config (struct iwl_priv *priv) {/* set CSR_HW_CONFIG_REG for uCode use */ -iwl_set_bit (bus (priv),CSR_HW_IF_CONFIG_REG , +iwl_set_bit (trans (priv),CSR_HW_IF_CONFIG_REG ,CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |CSR_HW_IF_CONFIG_REG_BIT_MAC_SI );/* Setting digital SVR for 1000 card to 1.32V */ /* locking is acquired in iwl_set_bits_mask_prph() function */ -iwl_set_bits_mask_prph (bus (priv),APMG_DIGITAL_SVR_REG , +iwl_set_bits_mask_prph (trans (priv),APMG_DIGITAL_SVR_REG ,APMG_SVR_DIGITAL_VOLTAGE_1_32 , ~APMG_SVR_VOLTAGE_CONFIG_BIT_MSK ); }
drivers/net/wireless/iwlwifi/iwl-2000.c +1 -1
@@ -87,7 +87,7 @@ static void iwl2000_nic_config(struct iwl_priv *priv)iwl_rf_config (priv);if (cfg (priv)->iq_invert) -iwl_set_bit (bus (priv),CSR_GP_DRIVER_REG , +iwl_set_bit (trans (priv),CSR_GP_DRIVER_REG ,CSR_GP_DRIVER_REG_BIT_RADIO_IQ_INVER ); }
drivers/net/wireless/iwlwifi/iwl-5000.c +1 -1
@@ -73,7 +73,7 @@ static void iwl5000_nic_config(struct iwl_priv *priv)* (PCIe power is lost before PERST# is asserted), * causing ME FW to lose ownership and not being able to obtain it back. */ -iwl_set_bits_mask_prph (bus (priv),APMG_PS_CTRL_REG , +iwl_set_bits_mask_prph (trans (priv),APMG_PS_CTRL_REG ,APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS , ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS );
drivers/net/wireless/iwlwifi/iwl-6000.c +4 -4
@@ -82,7 +82,7 @@ static void iwl6050_additional_nic_config(struct iwl_priv *priv) {/* Indicate calibration version to uCode. */ if (iwl_eeprom_calib_version (priv->shrd) >=6 ) -iwl_set_bit (bus (priv),CSR_GP_DRIVER_REG , +iwl_set_bit (trans (priv),CSR_GP_DRIVER_REG ,CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6 ); }
@@ -90,9 +90,9 @@ static void iwl6150_additional_nic_config(struct iwl_priv *priv) {/* Indicate calibration version to uCode. */ if (iwl_eeprom_calib_version (priv->shrd) >=6 ) -iwl_set_bit (bus (priv),CSR_GP_DRIVER_REG , +iwl_set_bit (trans (priv),CSR_GP_DRIVER_REG ,CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6 ); -iwl_set_bit (bus (priv),CSR_GP_DRIVER_REG , +iwl_set_bit (trans (priv),CSR_GP_DRIVER_REG , CSR_GP_DRIVER_REG_BIT_6050_1x2); }
@@ -104,7 +104,7 @@ static void iwl6000_nic_config(struct iwl_priv *priv)/* no locking required for register write */ if (cfg (priv)->pa_type ==IWL_PA_INTERNAL ) {/* 2x2 IPA phy type */ -iwl_write32 (bus (priv),CSR_GP_DRIVER_REG , +iwl_write32 (trans (priv),CSR_GP_DRIVER_REG , CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA); }/* do additional nic configuration if needed */
drivers/net/wireless/iwlwifi/iwl-agn-rx.c +4 -4
@@ -628,16 +628,16 @@ static int iwlagn_rx_card_state_notif(struct iwl_priv *priv,if (flags & (SW_CARD_DISABLED |HW_CARD_DISABLED |CT_CARD_DISABLED )) { -iwl_write32 (bus (priv),CSR_UCODE_DRV_GP1_SET , +iwl_write32 (trans (priv),CSR_UCODE_DRV_GP1_SET ,CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED ); -iwl_write_direct32 (bus (priv),HBUS_TARG_MBX_C , +iwl_write_direct32 (trans (priv),HBUS_TARG_MBX_C ,HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED );if (!(flags &RXON_CARD_DISABLED )) { -iwl_write32 (bus (priv),CSR_UCODE_DRV_GP1_CLR , +iwl_write32 (trans (priv),CSR_UCODE_DRV_GP1_CLR ,CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED ); -iwl_write_direct32 (bus (priv),HBUS_TARG_MBX_C , +iwl_write_direct32 (trans (priv),HBUS_TARG_MBX_C ,HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED ); }if (flags &CT_CARD_DISABLED )
drivers/net/wireless/iwlwifi/iwl-agn-tt.c +7 -7
@@ -178,19 +178,19 @@ static void iwl_tt_check_exit_ct_kill(unsigned long data)if (tt->state ==IWL_TI_CT_KILL ) {if (priv->thermal_throttle.ct_kill_toggle) { -iwl_write32 (bus (priv),CSR_UCODE_DRV_GP1_CLR , +iwl_write32 (trans (priv),CSR_UCODE_DRV_GP1_CLR ,CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT ); priv->thermal_throttle.ct_kill_toggle = false; }else { -iwl_write32 (bus (priv),CSR_UCODE_DRV_GP1_SET , +iwl_write32 (trans (priv),CSR_UCODE_DRV_GP1_SET ,CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT ); priv->thermal_throttle.ct_kill_toggle = true; } -iwl_read32 (bus (priv),CSR_UCODE_DRV_GP1 ); -spin_lock_irqsave (&bus (priv)->reg_lock, flags); -if (!iwl_grab_nic_access (bus (priv))) -iwl_release_nic_access (bus (priv)); -spin_unlock_irqrestore (&bus (priv)->reg_lock, flags); +iwl_read32 (trans (priv),CSR_UCODE_DRV_GP1 ); +spin_lock_irqsave (&trans (priv)->reg_lock, flags); +if (!iwl_grab_nic_access (trans (priv))) +iwl_release_nic_access (trans (priv)); +spin_unlock_irqrestore (&trans (priv)->reg_lock, flags);/* Reschedule the ct_kill timer to occur in * CT_KILL_EXIT_DURATION seconds to ensure we get a
drivers/net/wireless/iwlwifi/iwl-agn.c +21 -21
135 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-bus.h +0 -3
@@ -142,15 +142,12 @@ struct iwl_bus_ops {* @shrd - pointer to iwl_shared which holds shared data from the upper layer * NB: for the time being this needs to be set by the upper layer since * it allocates the shared data -* @reg_lock - protect hw register access */ struct iwl_bus {struct device *dev;const struct iwl_bus_ops *ops;struct iwl_shared *shrd; -spinlock_t reg_lock; -/* pointer to bus specific struct */ /*Ensure that this pointer will always be aligned to sizeof pointer */ char bus_specific[0 ] __attribute__((__aligned__ (sizeof (void *))));
drivers/net/wireless/iwlwifi/iwl-core.c +15 -13
@@ -888,9 +888,9 @@ static int iwl_apm_stop_master(struct iwl_priv *priv)int ret =0 ;/* stop device's busmaster DMA activity */ -iwl_set_bit (bus (priv),CSR_RESET ,CSR_RESET_REG_FLAG_STOP_MASTER ); +iwl_set_bit (trans (priv),CSR_RESET ,CSR_RESET_REG_FLAG_STOP_MASTER ); - ret =iwl_poll_bit (bus (priv),CSR_RESET , + ret =iwl_poll_bit (trans (priv),CSR_RESET ,CSR_RESET_REG_FLAG_MASTER_DISABLED ,CSR_RESET_REG_FLAG_MASTER_DISABLED ,100 );if (ret)
@@ -911,7 +911,7 @@ void iwl_apm_stop(struct iwl_priv *priv)iwl_apm_stop_master (priv);/* Reset the entire device */ -iwl_set_bit (bus (priv),CSR_RESET ,CSR_RESET_REG_FLAG_SW_RESET ); +iwl_set_bit (trans (priv),CSR_RESET ,CSR_RESET_REG_FLAG_SW_RESET );udelay (10 );
@@ -919,7 +919,8 @@ void iwl_apm_stop(struct iwl_priv *priv)* Clear "initialization complete" bit to move adapter from * D0A* (powered-up Active) --> D0U* (Uninitialized) state. */ -iwl_clear_bit (bus (priv),CSR_GP_CNTRL ,CSR_GP_CNTRL_REG_FLAG_INIT_DONE ); +iwl_clear_bit (trans (priv),CSR_GP_CNTRL , +CSR_GP_CNTRL_REG_FLAG_INIT_DONE ); }
@@ -939,45 +940,46 @@ int iwl_apm_init(struct iwl_priv *priv)*/ /* Disable L0S exit timer (platform NMI Work/Around) */ -iwl_set_bit (bus (priv),CSR_GIO_CHICKEN_BITS , +iwl_set_bit (trans (priv),CSR_GIO_CHICKEN_BITS ,CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER );/* * Disable L0s without affecting L1; * don't wait for ICH L0s (ICH bug W/A) */ -iwl_set_bit (bus (priv),CSR_GIO_CHICKEN_BITS , +iwl_set_bit (trans (priv),CSR_GIO_CHICKEN_BITS ,CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX );/* Set FH wait threshold to maximum (HW error during stress W/A) */ -iwl_set_bit (bus (priv),CSR_DBG_HPET_MEM_REG ,CSR_DBG_HPET_MEM_REG_VAL ); +iwl_set_bit (trans (priv),CSR_DBG_HPET_MEM_REG , +CSR_DBG_HPET_MEM_REG_VAL );/* * Enable HAP INTA (interrupt from management bus) to * wake device's PCI Express link L1a -> L0s */ -iwl_set_bit (bus (priv),CSR_HW_IF_CONFIG_REG , +iwl_set_bit (trans (priv),CSR_HW_IF_CONFIG_REG ,CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A );bus_apm_config (bus (priv));/* Configure analog phase-lock-loop before activating to D0A */ if (cfg (priv)->base_params->pll_cfg_val) -iwl_set_bit (bus (priv),CSR_ANA_PLL_CFG , +iwl_set_bit (trans (priv),CSR_ANA_PLL_CFG ,cfg (priv)->base_params->pll_cfg_val);/* * Set "initialization complete" bit to move adapter from * D0U* --> D0A* (powered-up active) state. */ -iwl_set_bit (bus (priv),CSR_GP_CNTRL ,CSR_GP_CNTRL_REG_FLAG_INIT_DONE ); +iwl_set_bit (trans (priv),CSR_GP_CNTRL ,CSR_GP_CNTRL_REG_FLAG_INIT_DONE );/* * Wait for clock stabilization; once stabilized, access to * device-internal resources is supported, e.g. iwl_write_prph() * and accesses to uCode SRAM. */ - ret =iwl_poll_bit (bus (priv),CSR_GP_CNTRL , + ret =iwl_poll_bit (trans (priv),CSR_GP_CNTRL ,CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY ,CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY ,25000 );if (ret <0 ) {
@@ -992,11 +994,11 @@ int iwl_apm_init(struct iwl_priv *priv)* do not disable clocks. This preserves any hardware bits already * set by default in "CLK_CTRL_REG" after reset. */ -iwl_write_prph (bus (priv),APMG_CLK_EN_REG ,APMG_CLK_VAL_DMA_CLK_RQT ); +iwl_write_prph (trans (priv),APMG_CLK_EN_REG ,APMG_CLK_VAL_DMA_CLK_RQT );udelay (20 );/* Disable L1-Active */ -iwl_set_bits_prph (bus (priv),APMG_PCIDEV_STT_REG , +iwl_set_bits_prph (trans (priv),APMG_PCIDEV_STT_REG ,APMG_PCIDEV_STT_VAL_L1_ACT_DIS );set_bit (STATUS_DEVICE_ENABLED , &priv->shrd->status);
drivers/net/wireless/iwlwifi/iwl-core.h +1 -1
@@ -300,7 +300,7 @@ static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv)static inline void iwl_enable_rfkill_int (struct iwl_priv *priv) {IWL_DEBUG_ISR (priv,"Enabling rfkill interrupt\n" ); -iwl_write32 (bus (priv),CSR_INT_MASK ,CSR_INT_BIT_RF_KILL ); +iwl_write32 (trans (priv),CSR_INT_MASK ,CSR_INT_BIT_RF_KILL ); }extern bool bt_siso_mode;
drivers/net/wireless/iwlwifi/iwl-debugfs.c +3 -3
@@ -263,7 +263,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, sram = priv->dbgfs_sram_offset & ~0x3 ;/* read the first u32 from sram */ - val =iwl_read_targ_mem (bus (priv), sram); + val =iwl_read_targ_mem (trans (priv), sram);for (; len; len--) {/* put the address at the start of every line */
@@ -282,7 +282,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,if (++offset ==4 ) { sram +=4 ; offset =0 ; - val =iwl_read_targ_mem (bus (priv), sram); + val =iwl_read_targ_mem (trans (priv), sram); }/* put in extra spaces and split lines for human readability */
@@ -2055,7 +2055,7 @@ static ssize_t iwl_dbgfs_power_save_status_read(struct file *file,const size_t bufsz =sizeof (buf);u32 pwrsave_status; - pwrsave_status =iwl_read32 (bus (priv),CSR_GP_CNTRL ) & + pwrsave_status =iwl_read32 (trans (priv),CSR_GP_CNTRL ) &CSR_GP_REG_POWER_SAVE_STATUS_MSK ; pos +=scnprintf (buf + pos, bufsz - pos,"Power Save Status: " );
drivers/net/wireless/iwlwifi/iwl-eeprom.c +31 -30
188 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-io.c +97 -96
357 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-io.h +29 -34
97 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-led.c +5 -4
@@ -71,7 +71,7 @@ static const struct ieee80211_tpt_blink iwl_blink[] = {/* Set led register off */ void iwlagn_led_enable (struct iwl_priv *priv) { -iwl_write32 (bus (priv),CSR_LED_REG ,CSR_LED_REG_TRUN_ON ); +iwl_write32 (trans (priv),CSR_LED_REG ,CSR_LED_REG_TRUN_ON ); }/*
@@ -107,9 +107,10 @@ static int iwl_send_led_cmd(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd) };u32 reg; - reg =iwl_read32 (bus (priv),CSR_LED_REG ); + reg =iwl_read32 (trans (priv),CSR_LED_REG );if (reg != (reg &CSR_LED_BSM_CTRL_MSK )) -iwl_write32 (bus (priv),CSR_LED_REG , reg &CSR_LED_BSM_CTRL_MSK ); +iwl_write32 (trans (priv),CSR_LED_REG , + reg &CSR_LED_BSM_CTRL_MSK );return iwl_trans_send_cmd (trans (priv), &cmd); }
@@ -206,7 +207,7 @@ void iwl_leds_init(struct iwl_priv *priv)break ; } - ret =led_classdev_register (bus (priv)->dev, &priv->led); + ret =led_classdev_register (trans (priv)->dev, &priv->led);if (ret) {kfree (priv->led.name);return ;
drivers/net/wireless/iwlwifi/iwl-mac80211.c +14 -13
@@ -196,7 +196,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,WIPHY_FLAG_IBSS_RSN ;if (trans (priv)->ucode_wowlan.code.len && -device_can_wakeup (bus (priv)->dev)) { +device_can_wakeup (trans (priv)->dev)) { hw->wiphy->wowlan.flags =WIPHY_WOWLAN_MAGIC_PKT |WIPHY_WOWLAN_DISCONNECT | WIPHY_WOWLAN_EAP_IDENTITY_REQ |
@@ -347,7 +347,7 @@ static void iwlagn_mac_stop(struct ieee80211_hw *hw)/* User space software may expect getting rfkill changes * even if interface is down */ -iwl_write32 (bus (priv),CSR_INT ,0xFFFFFFFF ); +iwl_write32 (trans (priv),CSR_INT ,0xFFFFFFFF );iwl_enable_rfkill_int (priv);IWL_DEBUG_MAC80211 (priv,"leave\n" );
@@ -405,10 +405,10 @@ static int iwlagn_mac_suspend(struct ieee80211_hw *hw,if (ret) goto error; -device_set_wakeup_enable (bus (priv)->dev, true); +device_set_wakeup_enable (trans (priv)->dev, true);/* Now let the ucode operate on its own */ -iwl_write32 (bus (priv),CSR_UCODE_DRV_GP1_SET , +iwl_write32 (trans (priv),CSR_UCODE_DRV_GP1_SET ,CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE ); goto out;
@@ -436,19 +436,19 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw)IWL_DEBUG_MAC80211 (priv,"enter\n" );mutex_lock (&priv->shrd->mutex); -iwl_write32 (bus (priv),CSR_UCODE_DRV_GP1_CLR , +iwl_write32 (trans (priv),CSR_UCODE_DRV_GP1_CLR ,CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE ); base = priv->shrd->device_pointers.error_event_table;if (iwlagn_hw_valid_rtc_data_addr (base)) { -spin_lock_irqsave (&bus (priv)->reg_lock, flags); - ret =iwl_grab_nic_access_silent (bus (priv)); +spin_lock_irqsave (&trans (priv)->reg_lock, flags); + ret =iwl_grab_nic_access_silent (trans (priv));if (ret ==0 ) { -iwl_write32 (bus (priv),HBUS_TARG_MEM_RADDR , base); - status =iwl_read32 (bus (priv),HBUS_TARG_MEM_RDAT ); -iwl_release_nic_access (bus (priv)); +iwl_write32 (trans (priv),HBUS_TARG_MEM_RADDR , base); + status =iwl_read32 (trans (priv),HBUS_TARG_MEM_RDAT ); +iwl_release_nic_access (trans (priv)); } -spin_unlock_irqrestore (&bus (priv)->reg_lock, flags); +spin_unlock_irqrestore (&trans (priv)->reg_lock, flags);#ifdef CONFIG_IWLWIFI_DEBUGFS if (ret ==0 ) {
@@ -460,7 +460,8 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw)if (priv->wowlan_sram)_iwl_read_targ_mem_words ( -bus (priv),0x800000 , priv->wowlan_sram, +trans (priv),0x800000 , + priv->wowlan_sram, trans->ucode_wowlan.data.len / 4); }#endif
@@ -471,7 +472,7 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw) priv->shrd->wowlan = false; -device_set_wakeup_enable (bus (priv)->dev, false); +device_set_wakeup_enable (trans (priv)->dev, false);iwlagn_prepare_restart (priv);
drivers/net/wireless/iwlwifi/iwl-pci.c +2 -2
@@ -121,12 +121,12 @@ static void iwl_pci_apm_config(struct iwl_bus *bus)if ((lctl &PCI_CFG_LINK_CTRL_VAL_L1_EN ) ==PCI_CFG_LINK_CTRL_VAL_L1_EN ) {/* L1-ASPM enabled; disable(!) L0S */ -iwl_set_bit (bus,CSR_GIO_REG , +iwl_set_bit (trans (bus),CSR_GIO_REG ,CSR_GIO_REG_VAL_L0S_ENABLED );dev_printk (KERN_INFO , bus->dev,"L1 Enabled; Disabling L0S\n" ); }else {/* L1-ASPM disabled; enable(!) L0S */ -iwl_clear_bit (bus,CSR_GIO_REG , +iwl_clear_bit (trans (bus),CSR_GIO_REG ,CSR_GIO_REG_VAL_L0S_ENABLED );dev_printk (KERN_INFO , bus->dev,"L1 Disabled; Enabling L0S\n" ); }
drivers/net/wireless/iwlwifi/iwl-testmode.c +8 -8
@@ -208,7 +208,7 @@ static void iwl_trace_cleanup(struct iwl_priv *priv)if (priv->testmode_trace.trace_enabled) {if (priv->testmode_trace.cpu_addr && priv->testmode_trace.dma_addr) -dma_free_coherent (bus (priv)->dev, +dma_free_coherent (trans (priv)->dev, priv->testmode_trace.total_size, priv->testmode_trace.cpu_addr, priv->testmode_trace.dma_addr);
@@ -302,7 +302,7 @@ static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb)switch (nla_get_u32 (tb[IWL_TM_ATTR_COMMAND ])) {case IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32 : - val32 =iwl_read_direct32 (bus (priv), ofs); + val32 =iwl_read_direct32 (trans (priv), ofs);IWL_INFO (priv,"32bit value to read 0x%x\n" , val32); skb =cfg80211_testmode_alloc_reply_skb (hw->wiphy,20 );
@@ -324,7 +324,7 @@ static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb) }else { val32 =nla_get_u32 (tb[IWL_TM_ATTR_REG_VALUE32 ]);IWL_INFO (priv,"32bit value to write 0x%x\n" , val32); -iwl_write_direct32 (bus (priv), ofs, val32); +iwl_write_direct32 (trans (priv), ofs, val32); }break ;case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8 :
@@ -334,11 +334,11 @@ static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb) }else { val8 =nla_get_u8 (tb[IWL_TM_ATTR_REG_VALUE8 ]);IWL_INFO (priv,"8bit value to write 0x%x\n" , val8); -iwl_write8 (bus (priv), ofs, val8); +iwl_write8 (trans (priv), ofs, val8); }break ;case IWL_TM_CMD_APP2DEV_INDIRECT_REG_READ32 : - val32 =iwl_read_prph (bus (priv), ofs); + val32 =iwl_read_prph (trans (priv), ofs);IWL_INFO (priv,"32bit value to read 0x%x\n" , val32); skb =cfg80211_testmode_alloc_reply_skb (hw->wiphy,20 );
@@ -360,7 +360,7 @@ static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb) }else { val32 =nla_get_u32 (tb[IWL_TM_ATTR_REG_VALUE32 ]);IWL_INFO (priv,"32bit value to write 0x%x\n" , val32); -iwl_write_prph (bus (priv), ofs, val32); +iwl_write_prph (trans (priv), ofs, val32); }break ;default :
@@ -615,7 +615,7 @@ static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb)struct iwl_priv *priv = hw->priv;struct sk_buff *skb;int status =0 ; -struct device *dev =bus (priv)->dev; +struct device *dev =trans (priv)->dev;switch (nla_get_u32 (tb[IWL_TM_ATTR_COMMAND ])) {case IWL_TM_CMD_APP2DEV_BEGIN_TRACE :
@@ -814,7 +814,7 @@ static int iwl_testmode_sram(struct ieee80211_hw *hw, struct nlattr **tb)IWL_ERR (priv,"Error allocating memory\n" );return -ENOMEM ; } -_iwl_read_targ_mem_words (bus (priv), ofs, +_iwl_read_targ_mem_words (trans (priv), ofs, priv->testmode_sram.buff_addr, priv->testmode_sram.buff_size /4 ); priv->testmode_sram.num_chunks =
drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h +4 -4
@@ -317,12 +317,12 @@ static inline void iwl_disable_interrupts(struct iwl_trans *trans)clear_bit (STATUS_INT_ENABLED , &trans->shrd->status);/* disable interrupts from uCode/NIC to host */ -iwl_write32 (bus (trans),CSR_INT_MASK ,0x00000000 ); +iwl_write32 (trans,CSR_INT_MASK ,0x00000000 );/* acknowledge/clear/reset any interrupts still pending * from uCode or flow handler (Rx/Tx DMA) */ -iwl_write32 (bus (trans),CSR_INT ,0xffffffff ); -iwl_write32 (bus (trans),CSR_FH_INT_STATUS ,0xffffffff ); +iwl_write32 (trans,CSR_INT ,0xffffffff ); +iwl_write32 (trans,CSR_FH_INT_STATUS ,0xffffffff );IWL_DEBUG_ISR (trans,"Disabled interrupts\n" ); }
@@ -333,7 +333,7 @@ static inline void iwl_enable_interrupts(struct iwl_trans *trans)IWL_DEBUG_ISR (trans,"Enabling interrupts\n" );set_bit (STATUS_INT_ENABLED , &trans->shrd->status); -iwl_write32 (bus (trans),CSR_INT_MASK , trans_pcie->inta_mask); +iwl_write32 (trans,CSR_INT_MASK , trans_pcie->inta_mask); }/*
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c +41 -41
255 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c +23 -23
163 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +72 -72
447 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-trans.h +2 -0
@@ -234,6 +234,7 @@ struct iwl_calib_result {* @ops - pointer to iwl_trans_ops * @shrd - pointer to iwl_shared which holds shared data from the upper layer * @hcmd_lock: protects HCMD +* @reg_lock - protect hw register access * @dev - pointer to struct device * that represents the device * @irq - the irq number for the device * @ucode_write_complete: indicates that the ucode has been copied.
@@ -247,6 +248,7 @@ struct iwl_trans {const struct iwl_trans_ops *ops;struct iwl_shared *shrd;spinlock_t hcmd_lock; +spinlock_t reg_lock;struct device *dev;unsigned int irq;
drivers/net/wireless/iwlwifi/iwl-ucode.c +18 -19
@@ -126,42 +126,41 @@ int iwl_alloc_fw_desc(struct iwl_bus *bus, struct fw_desc *desc,static int iwl_load_section (struct iwl_trans *trans,const char *name,struct fw_desc *image,u32 dst_addr) { -struct iwl_bus *bus =bus (trans);dma_addr_t phy_addr = image->p_addr;u32 byte_cnt = image->len;int ret; trans->ucode_write_complete =0 ; -iwl_write_direct32 (bus, +iwl_write_direct32 (trans,FH_TCSR_CHNL_TX_CONFIG_REG (FH_SRVC_CHNL ),FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE ); -iwl_write_direct32 (bus, +iwl_write_direct32 (trans,FH_SRVC_CHNL_SRAM_ADDR_REG (FH_SRVC_CHNL ), dst_addr); -iwl_write_direct32 (bus, +iwl_write_direct32 (trans,FH_TFDIB_CTRL0_REG (FH_SRVC_CHNL ), phy_addr &FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK ); -iwl_write_direct32 (bus, +iwl_write_direct32 (trans,FH_TFDIB_CTRL1_REG (FH_SRVC_CHNL ), (iwl_get_dma_hi_addr (phy_addr) <<FH_MEM_TFDIB_REG1_ADDR_BITSHIFT ) | byte_cnt); -iwl_write_direct32 (bus, +iwl_write_direct32 (trans,FH_TCSR_CHNL_TX_BUF_STS_REG (FH_SRVC_CHNL ),1 <<FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM |1 <<FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX |FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID ); -iwl_write_direct32 (bus, +iwl_write_direct32 (trans,FH_TCSR_CHNL_TX_CONFIG_REG (FH_SRVC_CHNL ),FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE |FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD ); -IWL_DEBUG_FW (bus,"%s uCode section being loaded...\n" , name); +IWL_DEBUG_FW (trans,"%s uCode section being loaded...\n" , name); ret =wait_event_timeout (trans->shrd->wait_command_queue, trans->ucode_write_complete,5 *HZ );if (!ret) {
@@ -470,7 +469,7 @@ static int iwl_alive_notify(struct iwl_trans *trans)* using sample data 100 bytes apart. If these sample points are good, * it's a pretty good bet that everything between them is good, too. */ -static int iwl_verify_inst_sparse (struct iwl_bus *bus, +static int iwl_verify_inst_sparse (struct iwl_trans *trans,struct fw_desc *fw_desc) {__le32 *image = (__le32 *)fw_desc->v_addr;
@@ -478,15 +477,15 @@ static int iwl_verify_inst_sparse(struct iwl_bus *bus,u32 val;u32 i; -IWL_DEBUG_FW (bus,"ucode inst image size is %u\n" , len); +IWL_DEBUG_FW (trans,"ucode inst image size is %u\n" , len);for (i =0 ; i < len; i +=100 , image +=100 /sizeof (u32)) {/* read data comes through single port, auto-incr addr */ /* NOTE: Use the debugless read so we don't flood kernel log * if IWL_DL_IO is set */ -iwl_write_direct32 (bus,HBUS_TARG_MEM_RADDR , +iwl_write_direct32 (trans,HBUS_TARG_MEM_RADDR , i +IWLAGN_RTC_INST_LOWER_BOUND ); - val =iwl_read32 (bus,HBUS_TARG_MEM_RDAT ); + val =iwl_read32 (trans,HBUS_TARG_MEM_RDAT );if (val !=le32_to_cpu (*image))return -EIO ; }
@@ -494,7 +493,7 @@ static int iwl_verify_inst_sparse(struct iwl_bus *bus,return 0 ; } -static void iwl_print_mismatch_inst (struct iwl_bus *bus, +static void iwl_print_mismatch_inst (struct iwl_trans *trans,struct fw_desc *fw_desc) {__le32 *image = (__le32 *)fw_desc->v_addr;
@@ -503,18 +502,18 @@ static void iwl_print_mismatch_inst(struct iwl_bus *bus,u32 offs;int errors =0 ; -IWL_DEBUG_FW (bus,"ucode inst image size is %u\n" , len); +IWL_DEBUG_FW (trans,"ucode inst image size is %u\n" , len); -iwl_write_direct32 (bus,HBUS_TARG_MEM_RADDR , +iwl_write_direct32 (trans,HBUS_TARG_MEM_RADDR ,IWLAGN_RTC_INST_LOWER_BOUND );for (offs =0 ; offs < len && errors <20 ; offs +=sizeof (u32), image++) {/* read data comes through single port, auto-incr addr */ - val =iwl_read32 (bus,HBUS_TARG_MEM_RDAT ); + val =iwl_read32 (trans,HBUS_TARG_MEM_RDAT );if (val !=le32_to_cpu (*image)) { -IWL_ERR (bus,"uCode INST section at " +IWL_ERR (trans,"uCode INST section at " "offset 0x%x, is 0x%x, s/b 0x%x\n" , offs, val,le32_to_cpu (*image)); errors++;
@@ -536,14 +535,14 @@ static int iwl_verify_ucode(struct iwl_trans *trans,return -EINVAL ; } -if (!iwl_verify_inst_sparse (bus (trans), &img->code)) { +if (!iwl_verify_inst_sparse (trans, &img->code)) {IWL_DEBUG_FW (trans,"uCode is good in inst SRAM\n" );return 0 ; }IWL_ERR (trans,"UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n" ); -iwl_print_mismatch_inst (bus (trans), &img->code); +iwl_print_mismatch_inst (trans, &img->code);return -EIO ; }
Signature · 1 line
1.7.0.4
PATCH 13/28 iwlwifi: move apm_init to start_hw
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
This is transport related
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 2 - drivers/net/wireless/iwlwifi/iwl-core.c | 85 ------------------------ drivers/net/wireless/iwlwifi/iwl-shared.h | 1 - drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 88 ++++++++++++++++++++++++- 4 files changed, 87 insertions(+), 89 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +0 -2
@@ -1836,8 +1836,6 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,/***************** * 4. Read EEPROM *****************/ -/* switch the NIC on before accessing the EEPROM */ -iwl_apm_init (priv);/* Read the EEPROM */ err =iwl_eeprom_init (priv, hw_rev);/* Reset chip to save power until we load uCode during "up". */
drivers/net/wireless/iwlwifi/iwl-core.c +0 -85
91 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-shared.h +0 -1
@@ -544,7 +544,6 @@ void iwl_set_hw_rfkill_state(struct iwl_priv *priv, bool state);void iwl_nic_config (struct iwl_priv *priv);void iwl_free_skb (struct iwl_priv *priv,struct sk_buff *skb);void iwl_apm_stop (struct iwl_priv *priv); -int iwl_apm_init (struct iwl_priv *priv);void iwlagn_fw_error (struct iwl_priv *priv,bool ondemand);const char *get_cmd_string (u8 cmd);bool iwl_check_for_ct_kill (struct iwl_priv *priv);
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +87 -1
112 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 14/28 iwlwifi: introduce trans_ops->stop_hw
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
This handler stops the HW and puts it in low power state. It will allow to clean up the flows in the upper layers.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +- drivers/net/wireless/iwlwifi/iwl-core.c | 40 ------------------ drivers/net/wireless/iwlwifi/iwl-shared.h | 1 - drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 54 ++++++++++++++++++++++++- drivers/net/wireless/iwlwifi/iwl-trans.h | 8 ++++ 5 files changed, 61 insertions(+), 44 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +1 -1
@@ -1839,7 +1839,7 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,/* Read the EEPROM */ err =iwl_eeprom_init (priv, hw_rev);/* Reset chip to save power until we load uCode during "up". */ -iwl_apm_stop (priv); +iwl_trans_stop_hw (trans (priv));if (err) {IWL_ERR (priv,"Unable to init EEPROM\n" ); goto out_free_traffic_mem;
drivers/net/wireless/iwlwifi/iwl-core.c +0 -40
@@ -883,46 +883,6 @@ void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand) } } -static int iwl_apm_stop_master (struct iwl_priv *priv) -{ -int ret =0 ; - -/* stop device's busmaster DMA activity */ -iwl_set_bit (trans (priv),CSR_RESET ,CSR_RESET_REG_FLAG_STOP_MASTER ); - - ret =iwl_poll_bit (trans (priv),CSR_RESET , -CSR_RESET_REG_FLAG_MASTER_DISABLED , -CSR_RESET_REG_FLAG_MASTER_DISABLED ,100 ); -if (ret) -IWL_WARN (priv,"Master Disable Timed Out, 100 usec\n" ); - -IWL_DEBUG_INFO (priv,"stop master\n" ); - -return ret; -} - -void iwl_apm_stop (struct iwl_priv *priv) -{ -IWL_DEBUG_INFO (priv,"Stop card, put in low power state\n" ); - -clear_bit (STATUS_DEVICE_ENABLED , &priv->shrd->status); - -/* Stop device's DMA activity */ -iwl_apm_stop_master (priv); - -/* Reset the entire device */ -iwl_set_bit (trans (priv),CSR_RESET ,CSR_RESET_REG_FLAG_SW_RESET ); - -udelay (10 ); - -/* -* Clear "initialization complete" bit to move adapter from -* D0A* (powered-up Active) --> D0U* (Uninitialized) state. -*/ -iwl_clear_bit (trans (priv),CSR_GP_CNTRL , -CSR_GP_CNTRL_REG_FLAG_INIT_DONE ); -} -int iwl_set_tx_power (struct iwl_priv *priv,s8 tx_power,bool force) {int ret;
drivers/net/wireless/iwlwifi/iwl-shared.h +0 -1
@@ -543,7 +543,6 @@ int iwlagn_hw_valid_rtc_data_addr(u32 addr);void iwl_set_hw_rfkill_state (struct iwl_priv *priv,bool state);void iwl_nic_config (struct iwl_priv *priv);void iwl_free_skb (struct iwl_priv *priv,struct sk_buff *skb); -void iwl_apm_stop (struct iwl_priv *priv);void iwlagn_fw_error (struct iwl_priv *priv,bool ondemand);const char *get_cmd_string (u8 cmd);bool iwl_check_for_ct_kill (struct iwl_priv *priv);
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +52 -2
84 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-trans.h +8 -0
@@ -134,6 +134,8 @@ struct iwl_host_cmd {/** * struct iwl_trans_ops - transport specific operations * @start_hw: starts the HW- from that point on, the HW can send interrupts +* @stop_hw: stops the HW- from that point on, the HW will be in low power but +* will still issue interrupt if the HW RF kill is triggered. * @start_device: allocates and inits all the resources for the transport * layer. * @fw_alive: called when the fw sends alive notification
@@ -163,6 +165,7 @@ struct iwl_host_cmd {struct iwl_trans_ops {int (*start_hw)(struct iwl_trans *iwl_trans); +void (*stop_hw)(struct iwl_trans *iwl_trans);int (*start_device)(struct iwl_trans *trans);void (*fw_alive)(struct iwl_trans *trans);void (*stop_device)(struct iwl_trans *trans);
@@ -271,6 +274,11 @@ static inline int iwl_trans_start_hw(struct iwl_trans *trans)return trans->ops->start_hw (trans); } +static inline void iwl_trans_stop_hw (struct iwl_trans *trans) +{ + trans->ops->stop_hw (trans); +} +static inline void iwl_trans_fw_alive (struct iwl_trans *trans) { trans->ops->fw_alive (trans);
Signature · 1 line
1.7.0.4
PATCH 15/28 iwlwifi: move the RF kill logic from iwl_probe to transport
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
This is another clean up of the proble flow.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 23 ----------------------- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 23 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +0 -23
@@ -1815,13 +1815,6 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,spin_lock_init (&trans (priv)->reg_lock);spin_lock_init (&priv->shrd->lock); -/* -* stop and reset the on-board processor just in case it is in a -* strange state ... like being left stranded by a primary kernel -* and this is now the kdump kernel trying to start up -*/ -iwl_write32 (trans (priv),CSR_RESET ,CSR_RESET_REG_FLAG_NEVO_RESET ); -/*********************** * 3. Read REV register ***********************/
@@ -1890,22 +1883,6 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,iwl_setup_rx_handlers (priv);iwl_testmode_init (priv); -/********************************************* -* 8. Enable interrupts -*********************************************/ - -iwl_enable_rfkill_int (priv); - -/* If platform's RF_KILL switch is NOT set to KILL */ -if (iwl_read32 (trans (priv), -CSR_GP_CNTRL ) &CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW ) -clear_bit (STATUS_RF_KILL_HW , &priv->shrd->status); -else -set_bit (STATUS_RF_KILL_HW , &priv->shrd->status); - -wiphy_rfkill_set_hw_state (priv->hw->wiphy, -test_bit (STATUS_RF_KILL_HW , &priv->shrd->status)); -iwl_power_initialize (priv);iwl_tt_initialize (priv);
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +11 -0
@@ -1393,6 +1393,17 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)iwl_apm_init (trans); +/* If platform's RF_KILL switch is NOT set to KILL */ +if (iwl_read32 (trans, +CSR_GP_CNTRL ) &CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW ) +clear_bit (STATUS_RF_KILL_HW , &trans->shrd->status); +else +set_bit (STATUS_RF_KILL_HW , &trans->shrd->status); + +iwl_set_hw_rfkill_state (priv (trans), +test_bit (STATUS_RF_KILL_HW , + &trans->shrd->status)); +return err; error:
Signature · 1 line
1.7.0.4
PATCH 16/28 iwlwifi: consolidate the start_device flow
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
Now there is only one transport function that launch a specific fw:trans_ops->start_fw. This one replaces trans_ops->start_device and trans_ops->kick_nic. The code that actually loads the fw to the device has been moved to the transport specific code.
--- drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 4 - drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 88 +++++++++++++++++++--- drivers/net/wireless/iwlwifi/iwl-trans.h | 44 +++++------ drivers/net/wireless/iwlwifi/iwl-ucode.c | 87 ++-------------------- 4 files changed, 103 insertions(+), 120 deletions(-)
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c +0 -4
@@ -1130,11 +1130,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans) isr_stats->tx++; handled |=CSR_INT_BIT_FH_TX ;/* Wake up uCode load routine, now that load is complete */ -#ifdef CONFIG_IWLWIFI_IDI - trans->shrd->trans->ucode_write_complete =1 ; -#else trans->ucode_write_complete =1 ; -#endif wake_up (&trans->shrd->wait_command_queue); }
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +78 -10
124 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-trans.h +19 -25
92 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-ucode.c +6 -81
120 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 17/28 iwlwifi: kill bus_apm_config
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
This handler was called from the transport layer only. Merge it to the transport's apm_init.
--- drivers/net/wireless/iwlwifi/iwl-bus.h | 7 --- drivers/net/wireless/iwlwifi/iwl-pci.c | 29 -------------- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 50 +++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 40 deletions(-)
drivers/net/wireless/iwlwifi/iwl-bus.h +0 -7
@@ -121,13 +121,11 @@ struct iwl_bus;/** * struct iwl_bus_ops - bus specific operations * @get_pm_support: must returns true if the bus can go to sleep -* @apm_config: will be called during the config of the APM * @get_hw_id_string: prints the hw_id in the provided buffer * @get_hw_id: get hw_id in u32 */ struct iwl_bus_ops {bool (*get_pm_support)(struct iwl_bus *bus); -void (*apm_config)(struct iwl_bus *bus);void (*get_hw_id_string)(struct iwl_bus *bus,char buf[],int buf_len);u32 (*get_hw_id)(struct iwl_bus *bus); };
@@ -156,11 +154,6 @@ static inline bool bus_get_pm_support(struct iwl_bus *bus)return bus->ops->get_pm_support (bus); } -static inline void bus_apm_config (struct iwl_bus *bus) -{ - bus->ops->apm_config (bus); -} -static inline void bus_get_hw_id_string (struct iwl_bus *bus,char buf[],int buf_len) {
drivers/net/wireless/iwlwifi/iwl-pci.c +0 -29
@@ -106,34 +106,6 @@ static bool iwl_pci_is_pm_supported(struct iwl_bus *bus)return !(lctl &PCI_CFG_LINK_CTRL_VAL_L0S_EN ); } -static void iwl_pci_apm_config (struct iwl_bus *bus) -{ -/* -* HW bug W/A for instability in PCIe bus L0S->L1 transition. -* Check if BIOS (or OS) enabled L1-ASPM on this device. -* If so (likely), disable L0S, so device moves directly L0->L1; -* costs negligible amount of power savings. -* If not (unlikely), enable L0S, so there is at least some -* power savings, even without L1. -*/ -u16 lctl =iwl_pciexp_link_ctrl (bus); - -if ((lctl &PCI_CFG_LINK_CTRL_VAL_L1_EN ) == -PCI_CFG_LINK_CTRL_VAL_L1_EN ) { -/* L1-ASPM enabled; disable(!) L0S */ -iwl_set_bit (trans (bus),CSR_GIO_REG , -CSR_GIO_REG_VAL_L0S_ENABLED ); -dev_printk (KERN_INFO ,trans (bus)->dev, -"L1 Enabled; Disabling L0S\n" ); - }else { -/* L1-ASPM disabled; enable(!) L0S */ -iwl_clear_bit (trans (bus),CSR_GIO_REG , -CSR_GIO_REG_VAL_L0S_ENABLED ); -dev_printk (KERN_INFO ,trans (bus)->dev, -"L1 Disabled; Enabling L0S\n" ); - } -} -static void iwl_pci_get_hw_id_string (struct iwl_bus *bus,char buf[],int buf_len) {
@@ -152,7 +124,6 @@ static u32 iwl_pci_get_hw_id(struct iwl_bus *bus)static const struct iwl_bus_ops bus_ops_pci = { .get_pm_support = iwl_pci_is_pm_supported, - .apm_config = iwl_pci_apm_config, .get_hw_id_string = iwl_pci_get_hw_id_string, .get_hw_id = iwl_pci_get_hw_id, };
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +46 -4
68 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 18/28 iwlwifi: kill bus_is_pm_supported
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
Get this information from the transport layer which is now in charge of the APM too.
--- drivers/net/wireless/iwlwifi/iwl-bus.h | 7 ------- drivers/net/wireless/iwlwifi/iwl-pci.c | 20 -------------------- drivers/net/wireless/iwlwifi/iwl-power.c | 2 +- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 1 + drivers/net/wireless/iwlwifi/iwl-trans.h | 2 ++ 5 files changed, 4 insertions(+), 28 deletions(-)
drivers/net/wireless/iwlwifi/iwl-bus.h +0 -7
@@ -120,12 +120,10 @@ struct iwl_bus;/** * struct iwl_bus_ops - bus specific operations -* @get_pm_support: must returns true if the bus can go to sleep * @get_hw_id_string: prints the hw_id in the provided buffer * @get_hw_id: get hw_id in u32 */ struct iwl_bus_ops { -bool (*get_pm_support)(struct iwl_bus *bus);void (*get_hw_id_string)(struct iwl_bus *bus,char buf[],int buf_len);u32 (*get_hw_id)(struct iwl_bus *bus); };
@@ -149,11 +147,6 @@ struct iwl_bus { char bus_specific[0] __attribute__((__aligned__(sizeof(void *)))); }; -static inline bool bus_get_pm_support (struct iwl_bus *bus) -{ -return bus->ops->get_pm_support (bus); -} -static inline void bus_get_hw_id_string (struct iwl_bus *bus,char buf[],int buf_len) {
drivers/net/wireless/iwlwifi/iwl-pci.c +0 -20
@@ -87,25 +87,6 @@ struct iwl_pci_bus {#define IWL_BUS_GET_PCI_DEV (_iwl_bus) \ ((IWL_BUS_GET_PCI_BUS(_iwl_bus))->pci_dev) -static u16 iwl_pciexp_link_ctrl (struct iwl_bus *bus) -{ -int pos; -u16 pci_lnk_ctl; - -struct pci_dev *pci_dev =IWL_BUS_GET_PCI_DEV (bus); - - pos =pci_pcie_cap (pci_dev); -pci_read_config_word (pci_dev, pos +PCI_EXP_LNKCTL , &pci_lnk_ctl); -return pci_lnk_ctl; -} - -static bool iwl_pci_is_pm_supported (struct iwl_bus *bus) -{ -u16 lctl =iwl_pciexp_link_ctrl (bus); - -return !(lctl &PCI_CFG_LINK_CTRL_VAL_L0S_EN ); -} -static void iwl_pci_get_hw_id_string (struct iwl_bus *bus,char buf[],int buf_len) {
@@ -123,7 +104,6 @@ static u32 iwl_pci_get_hw_id(struct iwl_bus *bus) }static const struct iwl_bus_ops bus_ops_pci = { - .get_pm_support = iwl_pci_is_pm_supported, .get_hw_id_string = iwl_pci_get_hw_id_string, .get_hw_id = iwl_pci_get_hw_id, };
drivers/net/wireless/iwlwifi/iwl-power.c +1 -1
@@ -436,7 +436,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force)/* initialize to default */ void iwl_power_initialize (struct iwl_priv *priv) { - priv->power_data.bus_pm =bus_get_pm_support (bus (priv)); + priv->power_data.bus_pm =trans (priv)->pm_support; priv->power_data.debug_sleep_level_override =-1 ;
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +1 -0
@@ -676,6 +676,7 @@ static void iwl_apm_config(struct iwl_trans *trans)dev_printk (KERN_INFO , trans->dev,"L1 Disabled; Enabling L0S\n" ); } + trans->pm_support = !(lctl &PCI_CFG_LINK_CTRL_VAL_L0S_EN ); }/*
drivers/net/wireless/iwlwifi/iwl-trans.h +2 -0
@@ -239,6 +239,7 @@ struct iwl_calib_result {* @ucode_init: init ucode image * @ucode_wowlan: wake on wireless ucode image (optional) * @nvm_device_type: indicates OTP or eeprom +* @pm_support: set to true in start_hw if link pm is supported * @calib_results: list head for init calibration results */ struct iwl_trans {
@@ -257,6 +258,7 @@ struct iwl_trans {/* eeprom related variables */ int nvm_device_type; +bool pm_support;/* init calibration results */ struct list_head calib_results;
Signature · 1 line
1.7.0.4
PATCH 19/28 iwlwifi: kill bus_get_hw_id_string
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
Get this information from the transport layer.
--- drivers/net/wireless/iwlwifi/iwl-bus.h | 8 -------- drivers/net/wireless/iwlwifi/iwl-core.c | 5 ++--- drivers/net/wireless/iwlwifi/iwl-pci.c | 10 ---------- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 2 ++ drivers/net/wireless/iwlwifi/iwl-trans.h | 2 ++ 5 files changed, 6 insertions(+), 21 deletions(-)
drivers/net/wireless/iwlwifi/iwl-bus.h +0 -8
@@ -120,11 +120,9 @@ struct iwl_bus;/** * struct iwl_bus_ops - bus specific operations -* @get_hw_id_string: prints the hw_id in the provided buffer * @get_hw_id: get hw_id in u32 */ struct iwl_bus_ops { -void (*get_hw_id_string)(struct iwl_bus *bus,char buf[],int buf_len);u32 (*get_hw_id)(struct iwl_bus *bus); };
@@ -147,12 +145,6 @@ struct iwl_bus { char bus_specific[0] __attribute__((__aligned__(sizeof(void *)))); }; -static inline void bus_get_hw_id_string (struct iwl_bus *bus,char buf[], -int buf_len) -{ - bus->ops->get_hw_id_string (bus, buf, buf_len); -} -static inline u32 bus_get_hw_id (struct iwl_bus *bus) {return bus->ops->get_hw_id (bus);
drivers/net/wireless/iwlwifi/iwl-core.c +2 -3
@@ -203,10 +203,9 @@ int iwl_init_geos(struct iwl_priv *priv)if ((priv->bands[IEEE80211_BAND_5GHZ ].n_channels ==0 ) &&cfg (priv)->sku &EEPROM_SKU_CAP_BAND_52GHZ ) { -char buf[32 ]; -bus_get_hw_id_string (bus (priv), buf,sizeof (buf));IWL_INFO (priv,"Incorrectly detected BG card as ABG. " -"Please send your %s to maintainer.\n" , buf); +"Please send your %s to maintainer.\n" , +trans (priv)->hw_id_str);cfg (priv)->sku &= ~EEPROM_SKU_CAP_BAND_52GHZ ; }
drivers/net/wireless/iwlwifi/iwl-pci.c +0 -10
@@ -87,15 +87,6 @@ struct iwl_pci_bus {#define IWL_BUS_GET_PCI_DEV (_iwl_bus) \ ((IWL_BUS_GET_PCI_BUS(_iwl_bus))->pci_dev) -static void iwl_pci_get_hw_id_string (struct iwl_bus *bus,char buf[], -int buf_len) -{ -struct pci_dev *pci_dev =IWL_BUS_GET_PCI_DEV (bus); - -snprintf (buf, buf_len,"PCI ID: 0x%04X:0x%04X" , pci_dev->device, - pci_dev->subsystem_device); -} -static u32 iwl_pci_get_hw_id (struct iwl_bus *bus) {struct pci_dev *pci_dev =IWL_BUS_GET_PCI_DEV (bus);
@@ -104,7 +95,6 @@ static u32 iwl_pci_get_hw_id(struct iwl_bus *bus) }static const struct iwl_bus_ops bus_ops_pci = { - .get_hw_id_string = iwl_pci_get_hw_id_string, .get_hw_id = iwl_pci_get_hw_id, };
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +2 -0
@@ -2317,6 +2317,8 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, trans->dev = &pdev->dev; trans->irq = pdev->irq; trans_pcie->pci_dev = pdev; +snprintf (trans->hw_id_str,sizeof (trans->hw_id_str), +"PCI ID: 0x%04X:0x%04X" , pdev->device, pdev->subsystem_device);/* TODO: Move this away, not needed if not MSI */ /* enable rfkill interrupt: hw bug w/a */
drivers/net/wireless/iwlwifi/iwl-trans.h +2 -0
@@ -234,6 +234,7 @@ struct iwl_calib_result {* @reg_lock - protect hw register access * @dev - pointer to struct device * that represents the device * @irq - the irq number for the device +* @hw_id_str: a string with info about HW ID. Set during transport allocation. * @ucode_write_complete: indicates that the ucode has been copied. * @ucode_rt: run time ucode image * @ucode_init: init ucode image
@@ -250,6 +251,7 @@ struct iwl_trans {struct device *dev;unsigned int irq; +char hw_id_str[52 ];u8 ucode_write_complete;/* the image write is complete */ struct fw_img ucode_rt;
Signature · 1 line
1.7.0.4
PATCH 20/28 iwlwifi: kill bus_get_hw_id
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
Get this information from the transport layer.
--- drivers/net/wireless/iwlwifi/iwl-bus.h | 14 --------- drivers/net/wireless/iwlwifi/iwl-mac80211.c | 2 +- drivers/net/wireless/iwlwifi/iwl-pci.c | 37 +++---------------------- drivers/net/wireless/iwlwifi/iwl-testmode.c | 2 +- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 1 + drivers/net/wireless/iwlwifi/iwl-trans.h | 3 ++ 6 files changed, 10 insertions(+), 49 deletions(-)
drivers/net/wireless/iwlwifi/iwl-bus.h +0 -14
@@ -119,14 +119,6 @@ struct iwl_shared;struct iwl_bus ;/** -* struct iwl_bus_ops - bus specific operations -* @get_hw_id: get hw_id in u32 -*/ -struct iwl_bus_ops { -u32 (*get_hw_id)(struct iwl_bus *bus); -}; - -/** * struct iwl_bus - bus common data * * This data is common to all bus layer implementations.
@@ -137,7 +129,6 @@ struct iwl_bus_ops {* it allocates the shared data */ struct iwl_bus { -const struct iwl_bus_ops *ops;struct iwl_shared *shrd;/* pointer to bus specific struct */
@@ -145,11 +136,6 @@ struct iwl_bus { char bus_specific[0] __attribute__((__aligned__(sizeof(void *)))); }; -static inline u32 bus_get_hw_id (struct iwl_bus *bus) -{ -return bus->ops->get_hw_id (bus); -} -/***************************************************** * Bus layer registration functions ******************************************************/
drivers/net/wireless/iwlwifi/iwl-mac80211.c +1 -1
@@ -234,7 +234,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ ] = &priv->bands[IEEE80211_BAND_5GHZ ]; - hw->wiphy->hw_version =bus_get_hw_id (bus (priv)); + hw->wiphy->hw_version =trans (priv)->hw_id;iwl_leds_init (priv);
drivers/net/wireless/iwlwifi/iwl-pci.c +4 -33
@@ -71,33 +71,6 @@#include "iwl-csr.h" #include "iwl-cfg.h" -/* PCI registers */ -#define PCI_CFG_RETRY_TIMEOUT 0x041 -#define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01 -#define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02 - -struct iwl_pci_bus { -/* basic pci-network driver stuff */ -struct pci_dev *pci_dev; -}; - -#define IWL_BUS_GET_PCI_BUS (_iwl_bus) \ - ((struct iwl_pci_bus *) ((_iwl_bus)->bus_specific)) - -#define IWL_BUS_GET_PCI_DEV (_iwl_bus) \ - ((IWL_BUS_GET_PCI_BUS(_iwl_bus))->pci_dev) - -static u32 iwl_pci_get_hw_id (struct iwl_bus *bus) -{ -struct pci_dev *pci_dev =IWL_BUS_GET_PCI_DEV (bus); - -return (pci_dev->device <<16 ) + pci_dev->subsystem_device; -} - -static const struct iwl_bus_ops bus_ops_pci = { - .get_hw_id = iwl_pci_get_hw_id, -}; -#define IWL_PCI_DEVICE (dev, subdev, cfg) \ .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ .subvendor = PCI_ANY_ID, .subdevice = (subdev), \
@@ -283,14 +256,16 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { };MODULE_DEVICE_TABLE (pci, iwl_hw_card_ids); +/* PCI registers */ +#define PCI_CFG_RETRY_TIMEOUT 0x041 +static int iwl_pci_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);struct iwl_bus *bus; -struct iwl_pci_bus *pci_bus;int err; - bus =kzalloc (sizeof (*bus) +sizeof (*pci_bus),GFP_KERNEL ); + bus =kzalloc (sizeof (*bus),GFP_KERNEL );if (!bus) {dev_printk (KERN_ERR , &pdev->dev,"Couldn't allocate iwl_pci_bus" );
@@ -306,13 +281,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } bus->shrd->bus = bus; - pci_bus =IWL_BUS_GET_PCI_BUS (bus); - pci_bus->pci_dev = pdev;pci_set_drvdata (pdev, bus); - bus->ops = &bus_ops_pci; -#ifdef CONFIG_IWLWIFI_IDI trans (bus) =iwl_trans_idi_alloc (bus->shrd, pdev, ent);if (trans (bus) ==NULL ) {
drivers/net/wireless/iwlwifi/iwl-testmode.c +1 -1
@@ -536,7 +536,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)break ;case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID : - devid =bus_get_hw_id (bus (priv)); + devid =trans (priv)->hw_id;IWL_INFO (priv,"hw version: 0x%x\n" , devid); skb =cfg80211_testmode_alloc_reply_skb (hw->wiphy,20 );
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +1 -0
@@ -2317,6 +2317,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, trans->dev = &pdev->dev; trans->irq = pdev->irq; trans_pcie->pci_dev = pdev; + trans->hw_id = (pdev->device <<16 ) + pdev->subsystem_device;snprintf (trans->hw_id_str,sizeof (trans->hw_id_str),"PCI ID: 0x%04X:0x%04X" , pdev->device, pdev->subsystem_device);
drivers/net/wireless/iwlwifi/iwl-trans.h +3 -0
@@ -234,6 +234,8 @@ struct iwl_calib_result {* @reg_lock - protect hw register access * @dev - pointer to struct device * that represents the device * @irq - the irq number for the device +* @hw_id: a u32 with the ID of the device / subdevice. +* Set during transport alloaction. * @hw_id_str: a string with info about HW ID. Set during transport allocation. * @ucode_write_complete: indicates that the ucode has been copied. * @ucode_rt: run time ucode image
@@ -251,6 +253,7 @@ struct iwl_trans {struct device *dev;unsigned int irq; +u32 hw_id;char hw_id_str[52 ];u8 ucode_write_complete;/* the image write is complete */
Signature · 1 line
1.7.0.4
PATCH 21/28 iwlwifi: move hw_rev to transport layer
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
The HW revision is now read by the transport layer in its allocation.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 13 ++----------- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 1 + drivers/net/wireless/iwlwifi/iwl-trans.h | 1 + 3 files changed, 4 insertions(+), 11 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +2 -11
@@ -1691,13 +1691,6 @@ static void iwl_uninit_drv(struct iwl_priv *priv)#endif } - - -static u32 iwl_hw_detect (struct iwl_priv *priv) -{ -return iwl_read32 (trans (priv),CSR_HW_REV ); -} -/* Size of one Rx buffer in host DRAM */ #define IWL_RX_BUF_SIZE_4K (4 * 1024)#define IWL_RX_BUF_SIZE_8K (8 * 1024)
@@ -1769,7 +1762,6 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,struct iwl_priv *priv;struct ieee80211_hw *hw;u16 num_mac; -u32 hw_rev;/************************ * 1. Allocating HW data
@@ -1818,9 +1810,8 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,/*********************** * 3. Read REV register ***********************/ - hw_rev =iwl_hw_detect (priv);IWL_INFO (priv,"Detected %s, REV=0x%X\n" , -cfg (priv)->name, hw_rev); +cfg (priv)->name,trans (priv)->hw_rev); err =iwl_trans_start_hw (trans (priv));if (err)
@@ -1830,7 +1821,7 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,* 4. Read EEPROM *****************/ /* Read the EEPROM */ - err =iwl_eeprom_init (priv, hw_rev); + err =iwl_eeprom_init (priv,trans (priv)->hw_rev);/* Reset chip to save power until we load uCode during "up". */ iwl_trans_stop_hw (trans (priv));if (err) {
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +1 -0
@@ -2317,6 +2317,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, trans->dev = &pdev->dev; trans->irq = pdev->irq; trans_pcie->pci_dev = pdev; + trans->hw_rev =iwl_read32 (trans,CSR_HW_REV ); trans->hw_id = (pdev->device <<16 ) + pdev->subsystem_device;snprintf (trans->hw_id_str,sizeof (trans->hw_id_str),"PCI ID: 0x%04X:0x%04X" , pdev->device, pdev->subsystem_device);
drivers/net/wireless/iwlwifi/iwl-trans.h +1 -0
@@ -253,6 +253,7 @@ struct iwl_trans {struct device *dev;unsigned int irq; +u32 hw_rev;u32 hw_id;char hw_id_str[52 ];
Signature · 1 line
1.7.0.4
PATCH 22/28 iwlwifi: stop_hw replace enable_rfkill_int
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
This trans_ops->stop_hw leaves the RFKILL interrupt enabled, we can call that one instead of enable_rfkill_int. By that, we reduce the numbers of acceesses to the NIC from the upper layers.
--- drivers/net/wireless/iwlwifi/iwl-core.h | 6 ------ drivers/net/wireless/iwlwifi/iwl-mac80211.c | 7 ++++--- drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 6 ++++-- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 2 ++ 4 files changed, 10 insertions(+), 11 deletions(-)
drivers/net/wireless/iwlwifi/iwl-core.h +0 -6
@@ -297,12 +297,6 @@ static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv) cfg(priv)->bt_params->advanced_bt_coexist; } -static inline void iwl_enable_rfkill_int (struct iwl_priv *priv) -{ -IWL_DEBUG_ISR (priv,"Enabling rfkill interrupt\n" ); -iwl_write32 (trans (priv),CSR_INT_MASK ,CSR_INT_BIT_RF_KILL ); -} -extern bool bt_siso_mode;#endif /* __iwl_core_h__ */
drivers/net/wireless/iwlwifi/iwl-mac80211.c +4 -3
@@ -346,9 +346,10 @@ static void iwlagn_mac_stop(struct ieee80211_hw *hw)flush_workqueue (priv->shrd->workqueue);/* User space software may expect getting rfkill changes -* even if interface is down */ -iwl_write32 (trans (priv),CSR_INT ,0xFFFFFFFF ); -iwl_enable_rfkill_int (priv); +* even if interface is down, trans->down will leave the RF +* kill interrupt enabled +*/ +iwl_trans_stop_hw (trans (priv));IWL_DEBUG_MAC80211 (priv,"leave\n" ); }
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c +4 -2
@@ -1149,8 +1149,10 @@ void iwl_irq_tasklet(struct iwl_trans *trans)if (test_bit (STATUS_INT_ENABLED , &trans->shrd->status))iwl_enable_interrupts (trans);/* Re-enable RF_KILL if it occurred */ -else if (handled &CSR_INT_BIT_RF_KILL ) -iwl_enable_rfkill_int (priv (trans)); +else if (handled &CSR_INT_BIT_RF_KILL ) { +IWL_DEBUG_ISR (trans,"Enabling rfkill interrupt\n" ); +iwl_write32 (trans,CSR_INT_MASK ,CSR_INT_BIT_RF_KILL ); + } }/******************************************************************************
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +2 -0
@@ -1532,6 +1532,8 @@ static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans) {iwl_apm_stop (trans); +iwl_write32 (trans,CSR_INT ,0xFFFFFFFF ); +/* Even if we stop the HW, we still want the RF kill interrupt */ IWL_DEBUG_ISR (trans,"Enabling rfkill interrupt\n" );iwl_write32 (trans,CSR_INT_MASK ,CSR_INT_BIT_RF_KILL );
Signature · 1 line
1.7.0.4
PATCH 23/28 iwlwifi: debug print in tx_queue_set_status is more clear
In reply to Wey-Yi GuyFrom: Emmanuel Grumbach <[email protected]>
The message was misleading when a queue is deactivated. The fifo number is irrelevant then, so don't print it.
--- drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c +6 -3
@@ -431,9 +431,12 @@ void iwl_trans_tx_queue_set_status(struct iwl_trans *trans, txq->sched_retry = scd_retry; -IWL_DEBUG_TX_QUEUES (trans,"%s %s Queue %d on FIFO %d\n" , - active ?"Activate" :"Deactivate" , - scd_retry ?"BA" :"AC/CMD" , txq_id, tx_fifo_id); +if (active) +IWL_DEBUG_TX_QUEUES (trans,"Activate %s Queue %d on FIFO %d\n" , + scd_retry ?"BA" :"AC/CMD" , txq_id, tx_fifo_id); +else +IWL_DEBUG_TX_QUEUES (trans,"Deactivate %s Queue %d\n" , + scd_retry ?"BA" :"AC/CMD" , txq_id); } static inline int get_fifo_from_tid(struct iwl_trans_pcie *trans_pcie,
Signature · 1 line
1.7.0.4
PATCH 24/28 iwlwifi: clarify comment
In reply to Wey-Yi GuyFrom: Don Fry <[email protected]>
change a comment to be a little more clear
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +1 -1
@@ -1781,7 +1781,7 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,SET_IEEE80211_DEV (hw,trans (priv)->dev); -/* what debugging capabilities we have */ +/* show what debugging capabilities we have */ iwl_debug_config (priv);IWL_DEBUG_INFO (priv,"*** LOAD DRIVER ***\n" );
Signature · 1 line
1.7.0.4
PATCH 25/28 iwlwifi: move bcast_sta_id init to common routine
In reply to Wey-Yi GuyFrom: Don Fry <[email protected]>
There is nothing device specific in the initialization of the bcast_sta_id so move it to the common inititalization routine.
--- drivers/net/wireless/iwlwifi/iwl-1000.c | 2 -- drivers/net/wireless/iwlwifi/iwl-2000.c | 2 -- drivers/net/wireless/iwlwifi/iwl-5000.c | 4 ---- drivers/net/wireless/iwlwifi/iwl-6000.c | 2 -- drivers/net/wireless/iwlwifi/iwl-agn.c | 1 + 5 files changed, 1 insertions(+), 10 deletions(-)
drivers/net/wireless/iwlwifi/iwl-1000.c +0 -2
@@ -128,8 +128,6 @@ static int iwl1000_hw_set_hw_params(struct iwl_priv *priv) iwlagn_mod_params.num_of_queues;hw_params (priv).max_txq_num =cfg (priv)->base_params->num_of_queues; - priv->contexts[IWL_RXON_CTX_BSS ].bcast_sta_id =IWLAGN_BROADCAST_ID ; -hw_params (priv).max_data_size =IWLAGN_RTC_DATA_SIZE ;hw_params (priv).max_inst_size =IWLAGN_RTC_INST_SIZE ;
drivers/net/wireless/iwlwifi/iwl-2000.c +0 -2
@@ -124,8 +124,6 @@ static int iwl2000_hw_set_hw_params(struct iwl_priv *priv) iwlagn_mod_params.num_of_queues;hw_params (priv).max_txq_num =cfg (priv)->base_params->num_of_queues; - priv->contexts[IWL_RXON_CTX_BSS ].bcast_sta_id =IWLAGN_BROADCAST_ID ; -hw_params (priv).max_data_size =IWL60_RTC_DATA_SIZE ;hw_params (priv).max_inst_size =IWL60_RTC_INST_SIZE ;
drivers/net/wireless/iwlwifi/iwl-5000.c +0 -4
@@ -170,8 +170,6 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv) iwlagn_mod_params.num_of_queues;hw_params (priv).max_txq_num =cfg (priv)->base_params->num_of_queues; - priv->contexts[IWL_RXON_CTX_BSS ].bcast_sta_id =IWLAGN_BROADCAST_ID ; -hw_params (priv).max_data_size =IWLAGN_RTC_DATA_SIZE ;hw_params (priv).max_inst_size =IWLAGN_RTC_INST_SIZE ;
@@ -199,8 +197,6 @@ static int iwl5150_hw_set_hw_params(struct iwl_priv *priv) iwlagn_mod_params.num_of_queues;hw_params (priv).max_txq_num =cfg (priv)->base_params->num_of_queues; - priv->contexts[IWL_RXON_CTX_BSS ].bcast_sta_id =IWLAGN_BROADCAST_ID ; -hw_params (priv).max_data_size =IWLAGN_RTC_DATA_SIZE ;hw_params (priv).max_inst_size =IWLAGN_RTC_INST_SIZE ;
drivers/net/wireless/iwlwifi/iwl-6000.c +0 -2
@@ -145,8 +145,6 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv) iwlagn_mod_params.num_of_queues;hw_params (priv).max_txq_num =cfg (priv)->base_params->num_of_queues; - priv->contexts[IWL_RXON_CTX_BSS ].bcast_sta_id =IWLAGN_BROADCAST_ID ; -hw_params (priv).max_data_size =IWL60_RTC_DATA_SIZE ;hw_params (priv).max_inst_size =IWL60_RTC_INST_SIZE ;
drivers/net/wireless/iwlwifi/iwl-agn.c +1 -0
@@ -513,6 +513,7 @@ static void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags) priv->contexts[IWL_RXON_CTX_BSS ].qos_cmd =REPLY_QOS_PARAM ; priv->contexts[IWL_RXON_CTX_BSS ].ap_sta_id =IWL_AP_ID ; priv->contexts[IWL_RXON_CTX_BSS ].wep_key_cmd =REPLY_WEPKEY ; + priv->contexts[IWL_RXON_CTX_BSS ].bcast_sta_id =IWLAGN_BROADCAST_ID ; priv->contexts[IWL_RXON_CTX_BSS ].exclusive_interface_modes =BIT (NL80211_IFTYPE_ADHOC ); priv->contexts[IWL_RXON_CTX_BSS].interface_modes =
Signature · 1 line
1.7.0.4
PATCH 26/28 iwlwifi: move all ucode routines to iwl-ucode.c
In reply to Wey-Yi GuyFrom: Don Fry <[email protected]>
The routines dealing with the ucode are spread through several files. Move them all to the same file and create a iwl-ucode.h file with the ucode file definitions.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 609 +-------------------------- drivers/net/wireless/iwlwifi/iwl-agn.h | 1 + drivers/net/wireless/iwlwifi/iwl-dev.h | 108 ----- drivers/net/wireless/iwlwifi/iwl-mac80211.c | 2 +- drivers/net/wireless/iwlwifi/iwl-trans.h | 2 - drivers/net/wireless/iwlwifi/iwl-ucode.c | 610 ++++++++++++++++++++++++++- drivers/net/wireless/iwlwifi/iwl-ucode.h | 178 ++++++++ 7 files changed, 791 insertions(+), 719 deletions(-) create mode 100644 drivers/net/wireless/iwlwifi/iwl-ucode.h
drivers/net/wireless/iwlwifi/iwl-agn.c +2 -607
@@ -34,7 +34,6 @@#include <linux/sched.h> #include <linux/skbuff.h> #include <linux/netdevice.h> -#include <linux/firmware.h> #include <linux/etherdevice.h> #include <linux/if_arp.h>
@@ -42,6 +41,7 @@#include <asm/div64.h> +#include "iwl-ucode.h" #include "iwl-eeprom.h" #include "iwl-wifi.h" #include "iwl-dev.h"
@@ -490,7 +490,7 @@ static void iwl_bg_tx_flush(struct work_struct *work)iwlagn_dev_txfifo_flush (priv,IWL_DROP_ALL ); } -static void iwl_init_context (struct iwl_priv *priv,u32 ucode_flags) +void iwl_init_context (struct iwl_priv *priv,u32 ucode_flags) {int i;
@@ -548,611 +548,6 @@ static void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags)BUILD_BUG_ON (NUM_IWL_RXON_CTX !=2 ); } -static void iwl_ucode_callback (const struct firmware *ucode_raw,void *context); - -#define UCODE_EXPERIMENTAL_INDEX 100 -#define UCODE_EXPERIMENTAL_TAG "exp" - -static int __must_check iwl_request_firmware (struct iwl_priv *priv,bool first) -{ -const char *name_pre =cfg (priv)->fw_name_pre; -char tag[8 ]; - -if (first) { -#ifdef CONFIG_IWLWIFI_DEBUG_EXPERIMENTAL_UCODE - priv->fw_index =UCODE_EXPERIMENTAL_INDEX ; - strcpy(tag, UCODE_EXPERIMENTAL_TAG); - }else if (priv->fw_index ==UCODE_EXPERIMENTAL_INDEX ) { -#endif - priv->fw_index =cfg (priv)->ucode_api_max; -sprintf (tag,"%d" , priv->fw_index); - }else { - priv->fw_index--; -sprintf (tag,"%d" , priv->fw_index); - } - -if (priv->fw_index <cfg (priv)->ucode_api_min) { -IWL_ERR (priv,"no suitable firmware found!\n" ); -return -ENOENT ; - } - -sprintf (priv->firmware_name,"%s%s%s" , name_pre, tag,".ucode" ); - -IWL_DEBUG_INFO (priv,"attempting to load firmware %s'%s'\n" , - (priv->fw_index ==UCODE_EXPERIMENTAL_INDEX ) - ?"EXPERIMENTAL " :"" , - priv->firmware_name); - -return request_firmware_nowait (THIS_MODULE ,1 , priv->firmware_name, -trans (priv)->dev, -GFP_KERNEL , priv, iwl_ucode_callback); -} - -struct iwlagn_firmware_pieces { -const void *inst, *data, *init, *init_data, *wowlan_inst, *wowlan_data; -size_t inst_size, data_size, init_size, init_data_size, - wowlan_inst_size, wowlan_data_size; - -u32 build; - -u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr; -u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr; -}; - -static int iwlagn_load_legacy_firmware (struct iwl_priv *priv, -const struct firmware *ucode_raw, -struct iwlagn_firmware_pieces *pieces) -{ -struct iwl_ucode_header *ucode = (void *)ucode_raw->data; -u32 api_ver, hdr_size; -const u8 *src; - - priv->ucode_ver =le32_to_cpu (ucode->ver); - api_ver =IWL_UCODE_API (priv->ucode_ver); - -switch (api_ver) { -default : - hdr_size =28 ; -if (ucode_raw->size < hdr_size) { -IWL_ERR (priv,"File size too small!\n" ); -return -EINVAL ; - } - pieces->build =le32_to_cpu (ucode->u.v2.build); - pieces->inst_size =le32_to_cpu (ucode->u.v2.inst_size); - pieces->data_size =le32_to_cpu (ucode->u.v2.data_size); - pieces->init_size =le32_to_cpu (ucode->u.v2.init_size); - pieces->init_data_size =le32_to_cpu (ucode->u.v2.init_data_size); - src = ucode->u.v2.data; -break ; -case 0 : -case 1 : -case 2 : - hdr_size =24 ; -if (ucode_raw->size < hdr_size) { -IWL_ERR (priv,"File size too small!\n" ); -return -EINVAL ; - } - pieces->build =0 ; - pieces->inst_size =le32_to_cpu (ucode->u.v1.inst_size); - pieces->data_size =le32_to_cpu (ucode->u.v1.data_size); - pieces->init_size =le32_to_cpu (ucode->u.v1.init_size); - pieces->init_data_size =le32_to_cpu (ucode->u.v1.init_data_size); - src = ucode->u.v1.data; -break ; - } - -/* Verify size of file vs. image size info in file's header */ -if (ucode_raw->size != hdr_size + pieces->inst_size + - pieces->data_size + pieces->init_size + - pieces->init_data_size) { - -IWL_ERR (priv, -"uCode file size %d does not match expected size\n" , - (int )ucode_raw->size); -return -EINVAL ; - } - - pieces->inst = src; - src += pieces->inst_size; - pieces->data = src; - src += pieces->data_size; - pieces->init = src; - src += pieces->init_size; - pieces->init_data = src; - src += pieces->init_data_size; - -return 0 ; -} - -static int iwlagn_load_firmware (struct iwl_priv *priv, -const struct firmware *ucode_raw, -struct iwlagn_firmware_pieces *pieces, -struct iwlagn_ucode_capabilities *capa) -{ -struct iwl_tlv_ucode_header *ucode = (void *)ucode_raw->data; -struct iwl_ucode_tlv *tlv; -size_t len = ucode_raw->size; -const u8 *data; -int wanted_alternative = iwlagn_mod_params.wanted_ucode_alternative; -int tmp; -u64 alternatives; -u32 tlv_len; -enum iwl_ucode_tlv_type tlv_type; -const u8 *tlv_data; - -if (len <sizeof (*ucode)) { -IWL_ERR (priv,"uCode has invalid length: %zd\n" , len); -return -EINVAL ; - } - -if (ucode->magic !=cpu_to_le32 (IWL_TLV_UCODE_MAGIC )) { -IWL_ERR (priv,"invalid uCode magic: 0X%x\n" , -le32_to_cpu (ucode->magic)); -return -EINVAL ; - } - -/* -* Check which alternatives are present, and "downgrade" -* when the chosen alternative is not present, warning -* the user when that happens. Some files may not have -* any alternatives, so don't warn in that case. -*/ - alternatives =le64_to_cpu (ucode->alternatives); - tmp = wanted_alternative; -if (wanted_alternative >63 ) - wanted_alternative =63 ; -while (wanted_alternative && !(alternatives &BIT (wanted_alternative))) - wanted_alternative--; -if (wanted_alternative && wanted_alternative != tmp) -IWL_WARN (priv, -"uCode alternative %d not available, choosing %d\n" , - tmp, wanted_alternative); - - priv->ucode_ver =le32_to_cpu (ucode->ver); - pieces->build =le32_to_cpu (ucode->build); - data = ucode->data; - - len -=sizeof (*ucode); - -while (len >=sizeof (*tlv)) { -u16 tlv_alt; - - len -=sizeof (*tlv); - tlv = (void *)data; - - tlv_len =le32_to_cpu (tlv->length); - tlv_type =le16_to_cpu (tlv->type); - tlv_alt =le16_to_cpu (tlv->alternative); - tlv_data = tlv->data; - -if (len < tlv_len) { -IWL_ERR (priv,"invalid TLV len: %zd/%u\n" , - len, tlv_len); -return -EINVAL ; - } - len -=ALIGN (tlv_len,4 ); - data +=sizeof (*tlv) +ALIGN (tlv_len,4 ); - -/* -* Alternative 0 is always valid. -* -* Skip alternative TLVs that are not selected. -*/ -if (tlv_alt !=0 && tlv_alt != wanted_alternative) -continue ; - -switch (tlv_type) { -case IWL_UCODE_TLV_INST : - pieces->inst = tlv_data; - pieces->inst_size = tlv_len; -break ; -case IWL_UCODE_TLV_DATA : - pieces->data = tlv_data; - pieces->data_size = tlv_len; -break ; -case IWL_UCODE_TLV_INIT : - pieces->init = tlv_data; - pieces->init_size = tlv_len; -break ; -case IWL_UCODE_TLV_INIT_DATA : - pieces->init_data = tlv_data; - pieces->init_data_size = tlv_len; -break ; -case IWL_UCODE_TLV_BOOT : -IWL_ERR (priv,"Found unexpected BOOT ucode\n" ); -break ; -case IWL_UCODE_TLV_PROBE_MAX_LEN : -if (tlv_len !=sizeof (u32)) - goto invalid_tlv_len; - capa->max_probe_length = -le32_to_cpup ((__le32 *)tlv_data); -break ; -case IWL_UCODE_TLV_PAN : -if (tlv_len) - goto invalid_tlv_len; - capa->flags |=IWL_UCODE_TLV_FLAGS_PAN ; -break ; -case IWL_UCODE_TLV_FLAGS : -/* must be at least one u32 */ -if (tlv_len <sizeof (u32)) - goto invalid_tlv_len; -/* and a proper number of u32s */ -if (tlv_len %sizeof (u32)) - goto invalid_tlv_len; -/* -* This driver only reads the first u32 as -* right now no more features are defined, -* if that changes then either the driver -* will not work with the new firmware, or -* it'll not take advantage of new features. -*/ - capa->flags =le32_to_cpup ((__le32 *)tlv_data); -break ; -case IWL_UCODE_TLV_INIT_EVTLOG_PTR : -if (tlv_len !=sizeof (u32)) - goto invalid_tlv_len; - pieces->init_evtlog_ptr = -le32_to_cpup ((__le32 *)tlv_data); -break ; -case IWL_UCODE_TLV_INIT_EVTLOG_SIZE : -if (tlv_len !=sizeof (u32)) - goto invalid_tlv_len; - pieces->init_evtlog_size = -le32_to_cpup ((__le32 *)tlv_data); -break ; -case IWL_UCODE_TLV_INIT_ERRLOG_PTR : -if (tlv_len !=sizeof (u32)) - goto invalid_tlv_len; - pieces->init_errlog_ptr = -le32_to_cpup ((__le32 *)tlv_data); -break ; -case IWL_UCODE_TLV_RUNT_EVTLOG_PTR : -if (tlv_len !=sizeof (u32)) - goto invalid_tlv_len; - pieces->inst_evtlog_ptr = -le32_to_cpup ((__le32 *)tlv_data); -break ; -case IWL_UCODE_TLV_RUNT_EVTLOG_SIZE : -if (tlv_len !=sizeof (u32)) - goto invalid_tlv_len; - pieces->inst_evtlog_size = -le32_to_cpup ((__le32 *)tlv_data); -break ; -case IWL_UCODE_TLV_RUNT_ERRLOG_PTR : -if (tlv_len !=sizeof (u32)) - goto invalid_tlv_len; - pieces->inst_errlog_ptr = -le32_to_cpup ((__le32 *)tlv_data); -break ; -case IWL_UCODE_TLV_ENHANCE_SENS_TBL : -if (tlv_len) - goto invalid_tlv_len; - priv->enhance_sensitivity_table = true; -break ; -case IWL_UCODE_TLV_WOWLAN_INST : - pieces->wowlan_inst = tlv_data; - pieces->wowlan_inst_size = tlv_len; -break ; -case IWL_UCODE_TLV_WOWLAN_DATA : - pieces->wowlan_data = tlv_data; - pieces->wowlan_data_size = tlv_len; -break ; -case IWL_UCODE_TLV_PHY_CALIBRATION_SIZE : -if (tlv_len !=sizeof (u32)) - goto invalid_tlv_len; - capa->standard_phy_calibration_size = -le32_to_cpup ((__le32 *)tlv_data); -break ; -default : -IWL_DEBUG_INFO (priv,"unknown TLV: %d\n" , tlv_type); -break ; - } - } - -if (len) { -IWL_ERR (priv,"invalid TLV after parsing: %zd\n" , len); -iwl_print_hex_dump (priv,IWL_DL_FW , (u8 *)data, len); -return -EINVAL ; - } - -return 0 ; - - invalid_tlv_len: -IWL_ERR (priv,"TLV %d has invalid size: %u\n" , tlv_type, tlv_len); -iwl_print_hex_dump (priv,IWL_DL_FW , tlv_data, tlv_len); - -return -EINVAL ; -} - -/** -* iwl_ucode_callback - callback when firmware was loaded -* -* If loaded successfully, copies the firmware into buffers -* for the card to fetch (via DMA). -*/ -static void iwl_ucode_callback (const struct firmware *ucode_raw,void *context) -{ -struct iwl_priv *priv = context; -struct iwl_ucode_header *ucode; -int err; -struct iwlagn_firmware_pieces pieces; -const unsigned int api_max =cfg (priv)->ucode_api_max; -unsigned int api_ok =cfg (priv)->ucode_api_ok; -const unsigned int api_min =cfg (priv)->ucode_api_min; -u32 api_ver; -char buildstr[25 ]; -u32 build; -struct iwlagn_ucode_capabilities ucode_capa = { - .max_probe_length =200 , - .standard_phy_calibration_size = -IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE , - }; - -if (!api_ok) - api_ok = api_max; - -memset (&pieces,0 ,sizeof (pieces)); - -if (!ucode_raw) { -if (priv->fw_index <= api_ok) -IWL_ERR (priv, -"request for firmware file '%s' failed.\n" , - priv->firmware_name); - goto try_again; - } - -IWL_DEBUG_INFO (priv,"Loaded firmware file '%s' (%zd bytes).\n" , - priv->firmware_name, ucode_raw->size); - -/* Make sure that we got at least the API version number */ -if (ucode_raw->size <4 ) { -IWL_ERR (priv,"File size way too small!\n" ); - goto try_again; - } - -/* Data from ucode file: header followed by uCode images */ - ucode = (struct iwl_ucode_header *)ucode_raw->data; - -if (ucode->ver) - err =iwlagn_load_legacy_firmware (priv, ucode_raw, &pieces); -else - err =iwlagn_load_firmware (priv, ucode_raw, &pieces, - &ucode_capa); - -if (err) - goto try_again; - - api_ver =IWL_UCODE_API (priv->ucode_ver); - build = pieces.build; - -/* -* api_ver should match the api version forming part of the -* firmware filename ... but we don't check for that and only rely -* on the API version read from firmware header from here on forward -*/ -/* no api version check required for experimental uCode */ -if (priv->fw_index !=UCODE_EXPERIMENTAL_INDEX ) { -if (api_ver < api_min || api_ver > api_max) { -IWL_ERR (priv, -"Driver unable to support your firmware API. " -"Driver supports v%u, firmware is v%u.\n" , - api_max, api_ver); - goto try_again; - } - -if (api_ver < api_ok) { -if (api_ok != api_max) -IWL_ERR (priv,"Firmware has old API version, " -"expected v%u through v%u, got v%u.\n" , - api_ok, api_max, api_ver); -else -IWL_ERR (priv,"Firmware has old API version, " -"expected v%u, got v%u.\n" , - api_max, api_ver); -IWL_ERR (priv,"New firmware can be obtained from " -"http://www.intellinuxwireless.org/.\n" ); - } - } - -if (build) -sprintf (buildstr," build %u%s" , build, - (priv->fw_index ==UCODE_EXPERIMENTAL_INDEX ) - ?" (EXP)" :"" ); -else - buildstr[0 ] ='\0' ; - -IWL_INFO (priv,"loaded firmware version %u.%u.%u.%u%s\n" , -IWL_UCODE_MAJOR (priv->ucode_ver), -IWL_UCODE_MINOR (priv->ucode_ver), -IWL_UCODE_API (priv->ucode_ver), -IWL_UCODE_SERIAL (priv->ucode_ver), - buildstr); - -snprintf (priv->hw->wiphy->fw_version, -sizeof (priv->hw->wiphy->fw_version), -"%u.%u.%u.%u%s" , -IWL_UCODE_MAJOR (priv->ucode_ver), -IWL_UCODE_MINOR (priv->ucode_ver), -IWL_UCODE_API (priv->ucode_ver), -IWL_UCODE_SERIAL (priv->ucode_ver), - buildstr); - -/* -* For any of the failures below (before allocating pci memory) -* we will try to load a version with a smaller API -- maybe the -* user just got a corrupted version of the latest API. -*/ - -IWL_DEBUG_INFO (priv,"f/w package hdr ucode version raw = 0x%x\n" , - priv->ucode_ver); -IWL_DEBUG_INFO (priv,"f/w package hdr runtime inst size = %Zd\n" , - pieces.inst_size); -IWL_DEBUG_INFO (priv,"f/w package hdr runtime data size = %Zd\n" , - pieces.data_size); -IWL_DEBUG_INFO (priv,"f/w package hdr init inst size = %Zd\n" , - pieces.init_size); -IWL_DEBUG_INFO (priv,"f/w package hdr init data size = %Zd\n" , - pieces.init_data_size); - -/* Verify that uCode images will fit in card's SRAM */ -if (pieces.inst_size >hw_params (priv).max_inst_size) { -IWL_ERR (priv,"uCode instr len %Zd too large to fit in\n" , - pieces.inst_size); - goto try_again; - } - -if (pieces.data_size >hw_params (priv).max_data_size) { -IWL_ERR (priv,"uCode data len %Zd too large to fit in\n" , - pieces.data_size); - goto try_again; - } - -if (pieces.init_size >hw_params (priv).max_inst_size) { -IWL_ERR (priv,"uCode init instr len %Zd too large to fit in\n" , - pieces.init_size); - goto try_again; - } - -if (pieces.init_data_size >hw_params (priv).max_data_size) { -IWL_ERR (priv,"uCode init data len %Zd too large to fit in\n" , - pieces.init_data_size); - goto try_again; - } - -/* Allocate ucode buffers for card's bus-master loading ... */ - -/* Runtime instructions and 2 copies of data: -* 1) unmodified from disk -* 2) backup cache for save/restore during power-downs */ -if (iwl_alloc_fw_desc (trans (priv), &trans (priv)->ucode_rt.code, - pieces.inst, pieces.inst_size)) - goto err_pci_alloc; -if (iwl_alloc_fw_desc (trans (priv), &trans (priv)->ucode_rt.data, - pieces.data, pieces.data_size)) - goto err_pci_alloc; - -/* Initialization instructions and data */ -if (pieces.init_size && pieces.init_data_size) { -if (iwl_alloc_fw_desc (trans (priv), - &trans (priv)->ucode_init.code, - pieces.init, pieces.init_size)) - goto err_pci_alloc; -if (iwl_alloc_fw_desc (trans (priv), - &trans (priv)->ucode_init.data, - pieces.init_data, pieces.init_data_size)) - goto err_pci_alloc; - } - -/* WoWLAN instructions and data */ -if (pieces.wowlan_inst_size && pieces.wowlan_data_size) { -if (iwl_alloc_fw_desc (trans (priv), - &trans (priv)->ucode_wowlan.code, - pieces.wowlan_inst, - pieces.wowlan_inst_size)) - goto err_pci_alloc; -if (iwl_alloc_fw_desc (trans (priv), - &trans (priv)->ucode_wowlan.data, - pieces.wowlan_data, - pieces.wowlan_data_size)) - goto err_pci_alloc; - } - -/* Now that we can no longer fail, copy information */ - -/* -* The (size - 16) / 12 formula is based on the information recorded -* for each event, which is of mode 1 (including timestamp) for all -* new microcodes that include this information. -*/ - priv->init_evtlog_ptr = pieces.init_evtlog_ptr; -if (pieces.init_evtlog_size) - priv->init_evtlog_size = (pieces.init_evtlog_size -16 )/12 ; -else - priv->init_evtlog_size = -cfg (priv)->base_params->max_event_log_size; - priv->init_errlog_ptr = pieces.init_errlog_ptr; - priv->inst_evtlog_ptr = pieces.inst_evtlog_ptr; -if (pieces.inst_evtlog_size) - priv->inst_evtlog_size = (pieces.inst_evtlog_size -16 )/12 ; -else - priv->inst_evtlog_size = -cfg (priv)->base_params->max_event_log_size; - priv->inst_errlog_ptr = pieces.inst_errlog_ptr; -#ifndef CONFIG_IWLWIFI_P2P - ucode_capa.flags &= ~IWL_UCODE_TLV_FLAGS_PAN ; -#endif - - priv->new_scan_threshold_behaviour = - !!(ucode_capa.flags &IWL_UCODE_TLV_FLAGS_NEWSCAN ); - -if (!(cfg (priv)->sku &EEPROM_SKU_CAP_IPAN_ENABLE )) - ucode_capa.flags &= ~IWL_UCODE_TLV_FLAGS_PAN ; - -/* -* if not PAN, then don't support P2P -- might be a uCode -* packaging bug or due to the eeprom check above -*/ -if (!(ucode_capa.flags &IWL_UCODE_TLV_FLAGS_PAN )) - ucode_capa.flags &= ~IWL_UCODE_TLV_FLAGS_P2P ; - -if (ucode_capa.flags &IWL_UCODE_TLV_FLAGS_PAN ) { - priv->sta_key_max_num =STA_KEY_MAX_NUM_PAN ; - priv->shrd->cmd_queue =IWL_IPAN_CMD_QUEUE_NUM ; - }else { - priv->sta_key_max_num =STA_KEY_MAX_NUM ; - priv->shrd->cmd_queue =IWL_DEFAULT_CMD_QUEUE_NUM ; - } -/* -* figure out the offset of chain noise reset and gain commands -* base on the size of standard phy calibration commands table size -*/ -if (ucode_capa.standard_phy_calibration_size > -IWL_MAX_PHY_CALIBRATE_TBL_SIZE ) - ucode_capa.standard_phy_calibration_size = -IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE ; - - priv->phy_calib_chain_noise_reset_cmd = - ucode_capa.standard_phy_calibration_size; - priv->phy_calib_chain_noise_gain_cmd = - ucode_capa.standard_phy_calibration_size +1 ; - -/* initialize all valid contexts */ -iwl_init_context (priv, ucode_capa.flags); - -/************************************************** -* This is still part of probe() in a sense... -* -* 9. Setup and register with mac80211 and debugfs -**************************************************/ - err =iwlagn_mac_setup_register (priv, &ucode_capa); -if (err) - goto out_unbind; - - err =iwl_dbgfs_register (priv,DRV_NAME ); -if (err) -IWL_ERR (priv,"failed to create debugfs files. Ignoring error: %d\n" , err); - -/* We have our copies now, allow OS release its copies */ -release_firmware (ucode_raw); -complete (&priv->firmware_loading_complete); -return ; - - try_again: -/* try next, if any */ -if (iwl_request_firmware (priv, false)) - goto out_unbind; -release_firmware (ucode_raw); -return ; - - err_pci_alloc: -IWL_ERR (priv,"failed to allocate pci memory\n" ); -iwl_dealloc_ucode (trans (priv)); - out_unbind: -complete (&priv->firmware_loading_complete); -device_release_driver (trans (priv)->dev); -release_firmware (ucode_raw); -} -static void iwl_rf_kill_ct_config (struct iwl_priv *priv) {struct iwl_ct_kill_config cmd;
drivers/net/wireless/iwlwifi/iwl-agn.h +1 -0
@@ -107,6 +107,7 @@ void iwlagn_config_ht40(struct ieee80211_conf *conf,int iwlagn_rx_calib_result (struct iwl_priv *priv,struct iwl_rx_mem_buffer *rxb,struct iwl_device_cmd *cmd); +void iwl_init_context (struct iwl_priv *priv,u32 ucode_flags);/* lib */ int iwlagn_send_tx_power (struct iwl_priv *priv);
drivers/net/wireless/iwlwifi/iwl-dev.h +0 -108
114 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-mac80211.c +1 -1
@@ -35,7 +35,6 @@#include <linux/sched.h> #include <linux/skbuff.h> #include <linux/netdevice.h> -#include <linux/firmware.h> #include <linux/etherdevice.h> #include <linux/if_arp.h>
@@ -43,6 +42,7 @@#include <asm/div64.h> +#include "iwl-ucode.h" #include "iwl-eeprom.h" #include "iwl-wifi.h" #include "iwl-dev.h"
drivers/net/wireless/iwlwifi/iwl-trans.h +0 -2
@@ -410,8 +410,6 @@ static inline u32 iwl_trans_read32(struct iwl_trans *trans, u32 ofs)/***************************************************** * Utils functions ******************************************************/ -int iwl_alloc_fw_desc (struct iwl_trans *trans,struct fw_desc *desc, -const void *data,size_t len);void iwl_dealloc_ucode (struct iwl_trans *trans);int iwl_send_calib_results (struct iwl_trans *trans);
drivers/net/wireless/iwlwifi/iwl-ucode.c +609 -1
626 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-ucode.h new file +178 -0
178 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 27/28 iwlwifi: release IRQ in error path
In reply to Wey-Yi GuyFrom: Johannes Berg <[email protected]>
smatch correctly complains:iwl-trans-pcie.c +1528 iwl_trans_pcie_start_hw(50) warn: 'trans->irq' was not released on error
Fix it.
--- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +3 -1
@@ -1504,7 +1504,7 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) err =iwl_prepare_card_hw (trans);if (err) {IWL_ERR (trans,"Error while preparing HW: %d" , err); - goto error; + goto err_free_irq; }iwl_apm_init (trans);
@@ -1522,6 +1522,8 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)return err; +err_free_irq: +free_irq (trans->irq, trans); error:iwl_free_isr_ict (trans);tasklet_kill (&trans_pcie->irq_tasklet);
Signature · 1 line
1.7.0.4
PATCH 28/28 iwlwifi: range check to testmode direct reg access
In reply to Wey-Yi GuyFrom: Amit Beka <[email protected]>
Added a check on the direct register access. Checks that the address is in the lower ragnge (0x0-0x2000), which belongs to CSR, HBUS and FH registers.
--- drivers/net/wireless/iwlwifi/iwl-testmode.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/iwl-testmode.c +16 -2
@@ -79,6 +79,7 @@#include "iwl-testmode.h" #include "iwl-trans.h" #include "iwl-bus.h" +#include "iwl-fh.h" /* The TLVs used in the gnl message policy between the kernel module and * user space application. iwl_testmode_gnl_msg_policy is to be carried
@@ -288,7 +289,7 @@ static int iwl_testmode_ucode(struct ieee80211_hw *hw, struct nlattr **tb)static int iwl_testmode_reg (struct ieee80211_hw *hw,struct nlattr **tb) {struct iwl_priv *priv = hw->priv; -u32 ofs, val32; +u32 ofs, val32, cmd;u8 val8;struct sk_buff *skb;int status =0 ;
@@ -300,7 +301,20 @@ static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb) ofs =nla_get_u32 (tb[IWL_TM_ATTR_REG_OFFSET ]);IWL_INFO (priv,"testmode register access command offset 0x%x\n" , ofs); -switch (nla_get_u32 (tb[IWL_TM_ATTR_COMMAND ])) { +/* Allow access only to FH/CSR/HBUS in direct mode. +Since we don't have the upper bounds for the CSR and HBUS segments, +we will use only the upper bound of FH for sanity check. */ + cmd =nla_get_u32 (tb[IWL_TM_ATTR_COMMAND ]); +if ((cmd ==IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32 || + cmd ==IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE32 || + cmd ==IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8 ) && + (ofs >=FH_MEM_UPPER_BOUND )) { +IWL_DEBUG_INFO (priv,"offset out of segment (0x0 - 0x%x)\n" , +FH_MEM_UPPER_BOUND ); +return -EINVAL ; + } + +switch (cmd) {case IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32 : val32 =iwl_read_direct32 (trans (priv), ofs);IWL_INFO (priv,"32bit value to read 0x%x\n" , val32);
Signature · 1 line
1.7.0.4