Commit 2a612a60 authored by Luca Coelho's avatar Luca Coelho

iwlwifi: implement a new device configuration table

Add a new device table that contains information that can be checked
at runtime in order to decide which configuration to use.  This allows
us to map the full cfg independently from the tran-specific
configuration.

This is the first step in creating the new table.  Subsequent patches
will add the possibility of checking different values at runtime in
order to make the decision.
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent b3bd6416
......@@ -171,6 +171,12 @@ static const struct iwl_tt_params iwl9000_tt_params = {
}, \
}
const struct iwl_cfg_trans_params iwl9000_trans_cfg = {
.device_family = IWL_DEVICE_FAMILY_9000,
.base_params = &iwl9000_base_params,
.mq_rx_supported = true,
.rf_id = true,
};
const struct iwl_cfg iwl9160_2ac_cfg = {
.name = "Intel(R) Dual Band Wireless AC 9160",
......
......@@ -452,9 +452,19 @@ struct iwl_cfg {
const struct iwl_fw_mon_regs mon_smem_regs;
};
#define IWL_CFG_ANY (~0)
struct iwl_dev_info {
u16 device;
u16 subdevice;
const struct iwl_cfg *cfg;
};
/*
* This list declares the config structures for all devices.
*/
extern const struct iwl_cfg_trans_params iwl9000_trans_cfg;
#if IS_ENABLED(CONFIG_IWLDVM)
extern const struct iwl_cfg iwl5300_agn_cfg;
extern const struct iwl_cfg iwl5100_agn_cfg;
......
......@@ -565,14 +565,8 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
{IWL_PCI_DEVICE(0x06F0, 0x40A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)},
{IWL_PCI_DEVICE(0x06F0, 0x4234, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)},
{IWL_PCI_DEVICE(0x06F0, 0x42A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)},
{IWL_PCI_DEVICE(0x2526, 0x0010, iwl9260_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, 0x0014, iwl9260_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, 0x0018, iwl9260_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, 0x001C, iwl9260_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, 0x0030, iwl9560_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, 0x0034, iwl9560_2ac_cfg)},
{IWL_PCI_DEVICE(0x2526, 0x0038, iwl9560_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, 0x003C, iwl9560_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, 0x0060, iwl9461_2ac_cfg_soc)},
{IWL_PCI_DEVICE(0x2526, 0x0064, iwl9461_2ac_cfg_soc)},
{IWL_PCI_DEVICE(0x2526, 0x00A0, iwl9462_2ac_cfg_soc)},
......@@ -601,7 +595,6 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
{IWL_PCI_DEVICE(0x2526, 0x4010, iwl9260_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, 0x4018, iwl9260_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, 0x401C, iwl9260_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, 0x4030, iwl9560_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, 0x4034, iwl9560_2ac_160_cfg_soc)},
{IWL_PCI_DEVICE(0x2526, 0x40A4, iwl9462_2ac_cfg_soc)},
{IWL_PCI_DEVICE(0x2526, 0x4234, iwl9560_2ac_cfg_soc)},
......@@ -613,6 +606,8 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
{IWL_PCI_DEVICE(0x2526, 0xA014, iwl9260_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, 0xE010, iwl9260_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, 0xE014, iwl9260_2ac_160_cfg)},
{IWL_PCI_DEVICE(0x2526, PCI_ANY_ID, iwl9000_trans_cfg)},
{IWL_PCI_DEVICE(0x271B, 0x0010, iwl9160_2ac_cfg)},
{IWL_PCI_DEVICE(0x271B, 0x0014, iwl9160_2ac_cfg)},
{IWL_PCI_DEVICE(0x271B, 0x0210, iwl9160_2ac_cfg)},
......@@ -986,6 +981,22 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
};
MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
#define IWL_DEV_INFO(_device, _subdevice, _cfg) \
{.device = (_device), .subdevice = (_subdevice), .cfg = &(_cfg)}
static const struct iwl_dev_info iwl_dev_info_table[] = {
#if IS_ENABLED(CONFIG_IWLMVM)
IWL_DEV_INFO(0x2526, 0x0010, iwl9260_2ac_160_cfg),
IWL_DEV_INFO(0x2526, 0x0014, iwl9260_2ac_160_cfg),
IWL_DEV_INFO(0x2526, 0x0018, iwl9260_2ac_160_cfg),
IWL_DEV_INFO(0x2526, 0x001C, iwl9260_2ac_160_cfg),
IWL_DEV_INFO(0x2526, 0x0030, iwl9560_2ac_160_cfg),
IWL_DEV_INFO(0x2526, 0x0038, iwl9560_2ac_160_cfg),
IWL_DEV_INFO(0x2526, 0x003C, iwl9560_2ac_160_cfg),
IWL_DEV_INFO(0x2526, 0x4030, iwl9560_2ac_160_cfg),
#endif /* CONFIG_IWLMVM */
};
/* PCI registers */
#define PCI_CFG_RETRY_TIMEOUT 0x041
......@@ -997,7 +1008,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
struct iwl_trans *iwl_trans;
struct iwl_trans_pcie *trans_pcie;
unsigned long flags;
int ret;
int i, ret;
/*
* This is needed for backwards compatibility with the old
* tables, so we don't need to change all the config structs
......@@ -1018,6 +1029,18 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* the trans_cfg should never change, so set it now */
iwl_trans->trans_cfg = trans;
for (i = 0; i < ARRAY_SIZE(iwl_dev_info_table); i++) {
const struct iwl_dev_info *dev_info = &iwl_dev_info_table[i];
if ((dev_info->device == IWL_CFG_ANY ||
dev_info->device == pdev->device) &&
(dev_info->subdevice == IWL_CFG_ANY ||
dev_info->subdevice == pdev->subsystem_device)) {
iwl_trans->cfg = dev_info->cfg;
goto found;
}
}
#if IS_ENABLED(CONFIG_IWLMVM)
/*
* special-case 7265D, it has the same PCI IDs.
......@@ -1140,6 +1163,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (!iwl_trans->cfg)
iwl_trans->cfg = cfg;
found:
if (iwl_trans->trans_cfg->mq_rx_supported) {
if (WARN_ON(!iwl_trans->cfg->num_rbds)) {
ret = -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment