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>
#include "iwl-trans.h"
#include "iwl-csr.h"
#include "iwl-cfg.h"
+#include "iwl-wifi.h"
#define IWL_PCI_DEVICE(dev, subdev, cfg) \
.vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \
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);
#ifdef CONFIG_IWLWIFI_IDI
trans(bus) = iwl_trans_idi_alloc(bus->shrd, pdev, ent);
if (trans(bus) == NULL) {
err = -ENOMEM;
- goto out_free_bus;
+ goto out_free_nic;
}
err = iwl_probe(bus, &trans_ops_idi, cfg);
trans(bus) = iwl_trans_pcie_alloc(bus->shrd, pdev, ent);
if (trans(bus) == NULL) {
err = -ENOMEM;
- goto out_free_bus;
+ goto out_free_nic;
}
err = iwl_probe(bus, &trans_ops_pcie, cfg);
out_free_trans:
iwl_trans_free(trans(bus));
pci_set_drvdata(pdev, NULL);
+out_free_nic:
+ kfree(bus->shrd->nic);
out_free_bus:
kfree(bus->shrd);
kfree(bus);
pci_set_drvdata(pdev, NULL);
+ kfree(bus->shrd->nic);
kfree(bus->shrd);
kfree(bus);
}
* @cfg: see struct iwl_cfg
* @priv: pointer to the upper layer data
* @trans: pointer to the transport layer data
+ * @nic: pointer to the nic data
* @hw_params: see struct iwl_hw_params
* @lock: protect general shared data
* @sta_lock: protects the station table.
struct iwl_cfg *cfg;
struct iwl_priv *priv;
struct iwl_trans *trans;
+ struct iwl_nic *nic;
struct iwl_hw_params hw_params;
spinlock_t lock;
#define priv(_m) ((_m)->shrd->priv)
#define cfg(_m) ((_m)->shrd->cfg)
#define bus(_m) ((_m)->shrd->bus)
+#define nic(_m) ((_m)->shrd->nic)
#define trans(_m) ((_m)->shrd->trans)
#define hw_params(_m) ((_m)->shrd->hw_params)
#ifndef __iwl_ucode_h__
#define __iwl_ucode_h__
+#include "iwl-trans.h"
+
+#include <linux/netdevice.h>
+
/* v1/v2 uCode file layout */
struct iwl_ucode_header {
__le32 ver; /* major/minor/API/serial */
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;
int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first);
#define __iwl_wifi_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);
void iwl_send_prio_tbl(struct iwl_trans *trans);