aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Manlunas <felix.manlunas@cavium.com>2017-08-22 15:46:37 -0400
committerDavid S. Miller <davem@davemloft.net>2017-08-23 23:29:24 -0400
commitb28547728d4fd42a004df2b662724e16ff778db6 (patch)
tree54047681512d9d6b89940a5ae17d608dc9048d2a
parente3d0328c76dde0b957f62f8c407b79f1d8fe3ef8 (diff)
liquidio: change manner of detecting whether or not NIC firmware is loaded
In the NIC firmware, the 1-bit flag indicating "firmware is loaded" moved from SLI_SCRATCH_1 to SLI_SCRATCH_2 (these are Octeon general-purpose scratch registers). Make the PF driver conform to this change. Remove code that sets the "firmware is loaded" flag because it's now the firmware's job to do that. In the code that detects whether or not the firmware is loaded, don't just rely on checking the "firmware is loaded" flag because that may cause a rare false negative. Add code that deduces whether or not the firmware is loaded; that will never give a false negative. Also bump up driver version to match newer NIC firmware. Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com> Signed-off-by: Derek Chickles <derek.chickles@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c15
-rw-r--r--drivers/net/ethernet/cavium/liquidio/lio_main.c6
-rw-r--r--drivers/net/ethernet/cavium/liquidio/liquidio_common.h3
3 files changed, 15 insertions, 9 deletions
diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
index fbc0d4e008f3..f6c0bad78cd4 100644
--- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
+++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
@@ -1442,8 +1442,19 @@ int cn23xx_fw_loaded(struct octeon_device *oct)
1442{ 1442{
1443 u64 val; 1443 u64 val;
1444 1444
1445 val = octeon_read_csr64(oct, CN23XX_SLI_SCRATCH1); 1445 /* If there's more than one active PF on this NIC, then that
1446 return (val >> 1) & 1ULL; 1446 * implies that the NIC firmware is loaded and running. This check
1447 * prevents a rare false negative that might occur if we only relied
1448 * on checking the SCR2_BIT_FW_LOADED flag. The false negative would
1449 * happen if the PF driver sees SCR2_BIT_FW_LOADED as cleared even
1450 * though the firmware was already loaded but still booting and has yet
1451 * to set SCR2_BIT_FW_LOADED.
1452 */
1453 if (atomic_read(oct->adapter_refcount) > 1)
1454 return 1;
1455
1456 val = octeon_read_csr64(oct, CN23XX_SLI_SCRATCH2);
1457 return (val >> SCR2_BIT_FW_LOADED) & 1ULL;
1447} 1458}
1448 1459
1449void cn23xx_tell_vf_its_macaddr_changed(struct octeon_device *oct, int vfidx, 1460void cn23xx_tell_vf_its_macaddr_changed(struct octeon_device *oct, int vfidx,
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index c2360fe8cef2..e7f54948173f 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -4125,12 +4125,6 @@ static int octeon_device_init(struct octeon_device *octeon_dev)
4125 dev_err(&octeon_dev->pci_dev->dev, "Could not load firmware to board\n"); 4125 dev_err(&octeon_dev->pci_dev->dev, "Could not load firmware to board\n");
4126 return 1; 4126 return 1;
4127 } 4127 }
4128 /* set bit 1 of SLI_SCRATCH_1 to indicate that firmware is
4129 * loaded
4130 */
4131 if (OCTEON_CN23XX_PF(octeon_dev))
4132 octeon_write_csr64(octeon_dev, CN23XX_SLI_SCRATCH1,
4133 2ULL);
4134 } 4128 }
4135 4129
4136 handshake[octeon_dev->octeon_id].init_ok = 1; 4130 handshake[octeon_dev->octeon_id].init_ok = 1;
diff --git a/drivers/net/ethernet/cavium/liquidio/liquidio_common.h b/drivers/net/ethernet/cavium/liquidio/liquidio_common.h
index d0076c191cee..3788c8cd082a 100644
--- a/drivers/net/ethernet/cavium/liquidio/liquidio_common.h
+++ b/drivers/net/ethernet/cavium/liquidio/liquidio_common.h
@@ -28,7 +28,7 @@
28#define LIQUIDIO_PACKAGE "" 28#define LIQUIDIO_PACKAGE ""
29#define LIQUIDIO_BASE_MAJOR_VERSION 1 29#define LIQUIDIO_BASE_MAJOR_VERSION 1
30#define LIQUIDIO_BASE_MINOR_VERSION 6 30#define LIQUIDIO_BASE_MINOR_VERSION 6
31#define LIQUIDIO_BASE_MICRO_VERSION 0 31#define LIQUIDIO_BASE_MICRO_VERSION 1
32#define LIQUIDIO_BASE_VERSION __stringify(LIQUIDIO_BASE_MAJOR_VERSION) "." \ 32#define LIQUIDIO_BASE_VERSION __stringify(LIQUIDIO_BASE_MAJOR_VERSION) "." \
33 __stringify(LIQUIDIO_BASE_MINOR_VERSION) 33 __stringify(LIQUIDIO_BASE_MINOR_VERSION)
34#define LIQUIDIO_MICRO_VERSION "." __stringify(LIQUIDIO_BASE_MICRO_VERSION) 34#define LIQUIDIO_MICRO_VERSION "." __stringify(LIQUIDIO_BASE_MICRO_VERSION)
@@ -106,6 +106,7 @@ enum octeon_tag_type {
106#define MAX_IOQ_INTERRUPTS_PER_PF (64 * 2) 106#define MAX_IOQ_INTERRUPTS_PER_PF (64 * 2)
107#define MAX_IOQ_INTERRUPTS_PER_VF (8 * 2) 107#define MAX_IOQ_INTERRUPTS_PER_VF (8 * 2)
108 108
109#define SCR2_BIT_FW_LOADED 63
109 110
110static inline u32 incr_index(u32 index, u32 count, u32 max) 111static inline u32 incr_index(u32 index, u32 count, u32 max)
111{ 112{