Commit 88ed2377 authored by David Daney's avatar David Daney Committed by David S. Miller

net: thunderx: Rewrite silicon revision tests.

The test for pass-1 silicon was incorrect, it should be for all
revisions less than 8.  Also the revision is already present in the
pci_dev, so there is no need to read and keep a private copy.

Remove rev_id and code to read it from struct nicpf.  Create new
static inline function pass1_silicon() to be used to testing the
silicon version.  Use pass1_silicon() for revision checks, this will
be more widely used in follow on patches.
Signed-off-by: default avatarDavid Daney <david.daney@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4e85777f
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
struct nicpf { struct nicpf {
struct pci_dev *pdev; struct pci_dev *pdev;
u8 rev_id;
u8 node; u8 node;
unsigned int flags; unsigned int flags;
u8 num_vf_en; /* No of VF enabled */ u8 num_vf_en; /* No of VF enabled */
...@@ -54,6 +53,11 @@ struct nicpf { ...@@ -54,6 +53,11 @@ struct nicpf {
bool irq_allocated[NIC_PF_MSIX_VECTORS]; bool irq_allocated[NIC_PF_MSIX_VECTORS];
}; };
static inline bool pass1_silicon(struct nicpf *nic)
{
return nic->pdev->revision < 8;
}
/* Supported devices */ /* Supported devices */
static const struct pci_device_id nic_id_table[] = { static const struct pci_device_id nic_id_table[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVICE_ID_THUNDER_NIC_PF) }, { PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVICE_ID_THUNDER_NIC_PF) },
...@@ -117,7 +121,7 @@ static void nic_send_msg_to_vf(struct nicpf *nic, int vf, union nic_mbx *mbx) ...@@ -117,7 +121,7 @@ static void nic_send_msg_to_vf(struct nicpf *nic, int vf, union nic_mbx *mbx)
* when PF writes to MBOX(1), in next revisions when * when PF writes to MBOX(1), in next revisions when
* PF writes to MBOX(0) * PF writes to MBOX(0)
*/ */
if (nic->rev_id == 0) { if (pass1_silicon(nic)) {
/* see the comment for nic_reg_write()/nic_reg_read() /* see the comment for nic_reg_write()/nic_reg_read()
* functions above * functions above
*/ */
...@@ -998,8 +1002,6 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -998,8 +1002,6 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_release_regions; goto err_release_regions;
} }
pci_read_config_byte(pdev, PCI_REVISION_ID, &nic->rev_id);
nic->node = nic_get_node_id(pdev); nic->node = nic_get_node_id(pdev);
nic_set_lmac_vf_mapping(nic); nic_set_lmac_vf_mapping(nic);
......
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