bnxt_en: Define the supported chip numbers.
authorMichael Chan <michael.chan@broadcom.com>
Mon, 13 Jun 2016 06:25:33 +0000 (02:25 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Jun 2016 23:16:13 +0000 (19:16 -0400)
Define all the supported chip numbers and chip categories.  Store the
chip_num returned by firmware.  If the call to get the version and chip
number fails, we should abort.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h

index 1cf885ad5138f941b54fc68d701064e5f76516f9..0fd27b0350b149d4d959cb4554edd7d1fa31b18e 100644 (file)
@@ -4037,6 +4037,8 @@ static int bnxt_hwrm_ver_get(struct bnxt *bp)
        if (resp->hwrm_intf_maj >= 1)
                bp->hwrm_max_req_len = le16_to_cpu(resp->max_req_win_len);
 
+       bp->chip_num = le16_to_cpu(resp->chip_num);
+
 hwrm_ver_get_exit:
        mutex_unlock(&bp->hwrm_cmd_lock);
        return rc;
@@ -6414,7 +6416,9 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                goto init_err;
 
        mutex_init(&bp->hwrm_cmd_lock);
-       bnxt_hwrm_ver_get(bp);
+       rc = bnxt_hwrm_ver_get(bp);
+       if (rc)
+               goto init_err;
 
        rc = bnxt_hwrm_func_drv_rgtr(bp);
        if (rc)
index ec18a07f90b4cc328e2767b4d00be1e9d150e602..b754be60f829864eab320d231c7d92a1410e21c0 100644 (file)
@@ -873,6 +873,44 @@ struct bnxt {
        void __iomem            *bar2;
 
        u32                     reg_base;
+       u16                     chip_num;
+#define CHIP_NUM_57301         0x16c8
+#define CHIP_NUM_57302         0x16c9
+#define CHIP_NUM_57304         0x16ca
+#define CHIP_NUM_57402         0x16d0
+#define CHIP_NUM_57404         0x16d1
+#define CHIP_NUM_57406         0x16d2
+
+#define CHIP_NUM_57311         0x16ce
+#define CHIP_NUM_57312         0x16cf
+#define CHIP_NUM_57314         0x16df
+#define CHIP_NUM_57412         0x16d6
+#define CHIP_NUM_57414         0x16d7
+#define CHIP_NUM_57416         0x16d8
+#define CHIP_NUM_57417         0x16d9
+
+#define BNXT_CHIP_NUM_5730X(chip_num)          \
+       ((chip_num) >= CHIP_NUM_57301 &&        \
+        (chip_num) <= CHIP_NUM_57304)
+
+#define BNXT_CHIP_NUM_5740X(chip_num)          \
+       ((chip_num) >= CHIP_NUM_57402 &&        \
+        (chip_num) <= CHIP_NUM_57406)
+
+#define BNXT_CHIP_NUM_5731X(chip_num)          \
+       ((chip_num) == CHIP_NUM_57311 ||        \
+        (chip_num) == CHIP_NUM_57312 ||        \
+        (chip_num) == CHIP_NUM_57314)
+
+#define BNXT_CHIP_NUM_5741X(chip_num)          \
+       ((chip_num) >= CHIP_NUM_57412 &&        \
+        (chip_num) <= CHIP_NUM_57417)
+
+#define BNXT_CHIP_NUM_57X0X(chip_num)          \
+       (BNXT_CHIP_NUM_5730X(chip_num) || BNXT_CHIP_NUM_5740X(chip_num))
+
+#define BNXT_CHIP_NUM_57X1X(chip_num)          \
+       (BNXT_CHIP_NUM_5731X(chip_num) || BNXT_CHIP_NUM_5741X(chip_num))
 
        struct net_device       *dev;
        struct pci_dev          *pdev;