mirror of https://gitee.com/openkylin/linux.git
iwlwifi: create iwl_nic structure
Create iwl_nic structure and link it together. Signed-off-by: Don Fry <donald.h.fry@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
This commit is contained in:
parent
7b11488fbb
commit
b1c23d9ec3
|
@ -70,6 +70,7 @@
|
||||||
#include "iwl-trans.h"
|
#include "iwl-trans.h"
|
||||||
#include "iwl-csr.h"
|
#include "iwl-csr.h"
|
||||||
#include "iwl-cfg.h"
|
#include "iwl-cfg.h"
|
||||||
|
#include "iwl-wifi.h"
|
||||||
|
|
||||||
#define IWL_PCI_DEVICE(dev, subdev, cfg) \
|
#define IWL_PCI_DEVICE(dev, subdev, cfg) \
|
||||||
.vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \
|
.vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \
|
||||||
|
@ -282,13 +283,23 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
|
|
||||||
bus->shrd->bus = bus;
|
bus->shrd->bus = bus;
|
||||||
|
|
||||||
|
/* temporarily create this here */
|
||||||
|
bus->shrd->nic = kzalloc(sizeof(*bus->shrd->nic), GFP_KERNEL);
|
||||||
|
if (!bus->shrd->nic) {
|
||||||
|
dev_printk(KERN_ERR, &pdev->dev,
|
||||||
|
"Couldn't allocate iwl_nic");
|
||||||
|
err = -ENOMEM;
|
||||||
|
goto out_free_bus;
|
||||||
|
}
|
||||||
|
/* and initialize it as well, temporarily */
|
||||||
|
bus->shrd->nic->shrd = bus->shrd;
|
||||||
pci_set_drvdata(pdev, bus);
|
pci_set_drvdata(pdev, bus);
|
||||||
|
|
||||||
#ifdef CONFIG_IWLWIFI_IDI
|
#ifdef CONFIG_IWLWIFI_IDI
|
||||||
trans(bus) = iwl_trans_idi_alloc(bus->shrd, pdev, ent);
|
trans(bus) = iwl_trans_idi_alloc(bus->shrd, pdev, ent);
|
||||||
if (trans(bus) == NULL) {
|
if (trans(bus) == NULL) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto out_free_bus;
|
goto out_free_nic;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = iwl_probe(bus, &trans_ops_idi, cfg);
|
err = iwl_probe(bus, &trans_ops_idi, cfg);
|
||||||
|
@ -296,7 +307,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
trans(bus) = iwl_trans_pcie_alloc(bus->shrd, pdev, ent);
|
trans(bus) = iwl_trans_pcie_alloc(bus->shrd, pdev, ent);
|
||||||
if (trans(bus) == NULL) {
|
if (trans(bus) == NULL) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto out_free_bus;
|
goto out_free_nic;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = iwl_probe(bus, &trans_ops_pcie, cfg);
|
err = iwl_probe(bus, &trans_ops_pcie, cfg);
|
||||||
|
@ -309,6 +320,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
out_free_trans:
|
out_free_trans:
|
||||||
iwl_trans_free(trans(bus));
|
iwl_trans_free(trans(bus));
|
||||||
pci_set_drvdata(pdev, NULL);
|
pci_set_drvdata(pdev, NULL);
|
||||||
|
out_free_nic:
|
||||||
|
kfree(bus->shrd->nic);
|
||||||
out_free_bus:
|
out_free_bus:
|
||||||
kfree(bus->shrd);
|
kfree(bus->shrd);
|
||||||
kfree(bus);
|
kfree(bus);
|
||||||
|
@ -325,6 +338,7 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
|
||||||
|
|
||||||
pci_set_drvdata(pdev, NULL);
|
pci_set_drvdata(pdev, NULL);
|
||||||
|
|
||||||
|
kfree(bus->shrd->nic);
|
||||||
kfree(bus->shrd);
|
kfree(bus->shrd);
|
||||||
kfree(bus);
|
kfree(bus);
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,6 +358,7 @@ struct iwl_cfg {
|
||||||
* @cfg: see struct iwl_cfg
|
* @cfg: see struct iwl_cfg
|
||||||
* @priv: pointer to the upper layer data
|
* @priv: pointer to the upper layer data
|
||||||
* @trans: pointer to the transport layer data
|
* @trans: pointer to the transport layer data
|
||||||
|
* @nic: pointer to the nic data
|
||||||
* @hw_params: see struct iwl_hw_params
|
* @hw_params: see struct iwl_hw_params
|
||||||
* @lock: protect general shared data
|
* @lock: protect general shared data
|
||||||
* @sta_lock: protects the station table.
|
* @sta_lock: protects the station table.
|
||||||
|
@ -388,6 +389,7 @@ struct iwl_shared {
|
||||||
struct iwl_cfg *cfg;
|
struct iwl_cfg *cfg;
|
||||||
struct iwl_priv *priv;
|
struct iwl_priv *priv;
|
||||||
struct iwl_trans *trans;
|
struct iwl_trans *trans;
|
||||||
|
struct iwl_nic *nic;
|
||||||
struct iwl_hw_params hw_params;
|
struct iwl_hw_params hw_params;
|
||||||
|
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
|
@ -418,6 +420,7 @@ struct iwl_shared {
|
||||||
#define priv(_m) ((_m)->shrd->priv)
|
#define priv(_m) ((_m)->shrd->priv)
|
||||||
#define cfg(_m) ((_m)->shrd->cfg)
|
#define cfg(_m) ((_m)->shrd->cfg)
|
||||||
#define bus(_m) ((_m)->shrd->bus)
|
#define bus(_m) ((_m)->shrd->bus)
|
||||||
|
#define nic(_m) ((_m)->shrd->nic)
|
||||||
#define trans(_m) ((_m)->shrd->trans)
|
#define trans(_m) ((_m)->shrd->trans)
|
||||||
#define hw_params(_m) ((_m)->shrd->hw_params)
|
#define hw_params(_m) ((_m)->shrd->hw_params)
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,10 @@
|
||||||
#ifndef __iwl_ucode_h__
|
#ifndef __iwl_ucode_h__
|
||||||
#define __iwl_ucode_h__
|
#define __iwl_ucode_h__
|
||||||
|
|
||||||
|
#include "iwl-trans.h"
|
||||||
|
|
||||||
|
#include <linux/netdevice.h>
|
||||||
|
|
||||||
/* v1/v2 uCode file layout */
|
/* v1/v2 uCode file layout */
|
||||||
struct iwl_ucode_header {
|
struct iwl_ucode_header {
|
||||||
__le32 ver; /* major/minor/API/serial */
|
__le32 ver; /* major/minor/API/serial */
|
||||||
|
@ -171,6 +175,39 @@ struct iwl_tlv_ucode_header {
|
||||||
u8 data[0];
|
u8 data[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct iwl_ucode_capabilities {
|
||||||
|
u32 max_probe_length;
|
||||||
|
u32 standard_phy_calibration_size;
|
||||||
|
u32 flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct iwl_fw - variables associated with the firmware
|
||||||
|
*
|
||||||
|
* @ucode_ver: ucode version from the ucode file
|
||||||
|
* @fw_version: firmware version string
|
||||||
|
* @ucode_rt: run time ucode image
|
||||||
|
* @ucode_init: init ucode image
|
||||||
|
* @ucode_wowlan: wake on wireless ucode image (optional)
|
||||||
|
* @ucode_capa: capabilities parsed from the ucode file.
|
||||||
|
* @enhance_sensitivity_table: device can do enhanced sensitivity.
|
||||||
|
*/
|
||||||
|
struct iwl_fw {
|
||||||
|
|
||||||
|
/* ucode image and variables */
|
||||||
|
u32 ucode_ver; /* version of ucode, copy of
|
||||||
|
iwl_ucode.ver */
|
||||||
|
char fw_version[ETHTOOL_BUSINFO_LEN];
|
||||||
|
|
||||||
|
/* ucode images */
|
||||||
|
struct fw_img ucode_rt;
|
||||||
|
struct fw_img ucode_init;
|
||||||
|
struct fw_img ucode_wowlan;
|
||||||
|
|
||||||
|
struct iwl_ucode_capabilities ucode_capa;
|
||||||
|
bool enhance_sensitivity_table;
|
||||||
|
};
|
||||||
|
|
||||||
struct iwl_priv;
|
struct iwl_priv;
|
||||||
|
|
||||||
int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first);
|
int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first);
|
||||||
|
|
|
@ -64,6 +64,36 @@
|
||||||
#define __iwl_wifi_h__
|
#define __iwl_wifi_h__
|
||||||
|
|
||||||
#include "iwl-shared.h"
|
#include "iwl-shared.h"
|
||||||
|
#include "iwl-ucode.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct iwl_nic - nic common data
|
||||||
|
* @fw: the iwl_fw structure
|
||||||
|
* @shrd: pointer to common shared structure
|
||||||
|
* @fw_index: firmware revision to try loading
|
||||||
|
* @firmware_name: composite filename of ucode file to load
|
||||||
|
* @init_evtlog_ptr: event log offset for init ucode.
|
||||||
|
* @init_evtlog_size: event log size for init ucode.
|
||||||
|
* @init_errlog_ptr: error log offfset for init ucode.
|
||||||
|
* @inst_evtlog_ptr: event log offset for runtime ucode.
|
||||||
|
* @inst_evtlog_size: event log size for runtime ucode.
|
||||||
|
* @inst_errlog_ptr: error log offfset for runtime ucode.
|
||||||
|
* @request_firmware_complete: the firmware has been obtained from user space
|
||||||
|
*/
|
||||||
|
struct iwl_nic {
|
||||||
|
struct iwl_fw fw;
|
||||||
|
|
||||||
|
struct iwl_shared *shrd;
|
||||||
|
|
||||||
|
int fw_index; /* firmware we're trying to load */
|
||||||
|
char firmware_name[25]; /* name of firmware file to load */
|
||||||
|
|
||||||
|
u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr;
|
||||||
|
u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
|
||||||
|
|
||||||
|
struct completion request_firmware_complete;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
int iwl_send_bt_env(struct iwl_trans *trans, u8 action, u8 type);
|
int iwl_send_bt_env(struct iwl_trans *trans, u8 action, u8 type);
|
||||||
void iwl_send_prio_tbl(struct iwl_trans *trans);
|
void iwl_send_prio_tbl(struct iwl_trans *trans);
|
||||||
|
|
Loading…
Reference in New Issue