diff mbox series

scsi: lpfc: Add support for ATTO Fibre Channel devices

Message ID 20220512164032.47943-1-bgrove@attotech.com (mailing list archive)
State Superseded
Headers show
Series scsi: lpfc: Add support for ATTO Fibre Channel devices | expand

Commit Message

Bradley Grove May 12, 2022, 4:40 p.m. UTC
Update pci_device_id table and generate reporting strings for ATTO
Celerity and ThunderLink Fibre Channel devices.

Co-developed-by: Jason Seba <jseba@attotech.com>
Signed-off-by: Jason Seba <jseba@attotech.com>
Signed-off-by: Bradley Grove <bgrove@attotech.com>
---
 drivers/scsi/lpfc/lpfc_hw.h   | 22 +++++++++
 drivers/scsi/lpfc/lpfc_ids.h  | 30 ++++++++++++
 drivers/scsi/lpfc/lpfc_init.c | 89 +++++++++++++++++++++++++++++++++++
 3 files changed, 141 insertions(+)

Comments

Bradley Grove May 12, 2022, 11:13 p.m. UTC | #1
We'd like to withdraw this patch request while we work out an issue on 
our end.

Bradley Grove

On 5/12/2022 12:40 PM, Bradley Grove wrote:
> Update pci_device_id table and generate reporting strings for ATTO
> Celerity and ThunderLink Fibre Channel devices.
> 
> Co-developed-by: Jason Seba <jseba@attotech.com>
> Signed-off-by: Jason Seba <jseba@attotech.com>
> Signed-off-by: Bradley Grove <bgrove@attotech.com>
> ---
>   drivers/scsi/lpfc/lpfc_hw.h   | 22 +++++++++
>   drivers/scsi/lpfc/lpfc_ids.h  | 30 ++++++++++++
>   drivers/scsi/lpfc/lpfc_init.c | 89 +++++++++++++++++++++++++++++++++++
>   3 files changed, 141 insertions(+)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
> index d6050f3c9efe..74a02586fe55 100644
> --- a/drivers/scsi/lpfc/lpfc_hw.h
> +++ b/drivers/scsi/lpfc/lpfc_hw.h
> @@ -1738,6 +1738,28 @@ struct lpfc_fdmi_reg_portattr {
>   #define PCI_DEVICE_ID_TOMCAT        0x0714
>   #define PCI_DEVICE_ID_SKYHAWK       0x0724
>   #define PCI_DEVICE_ID_SKYHAWK_VF    0x072c
> +#define PCI_VENDOR_ID_ATTO          0x117c
> +#define PCI_DEVICE_ID_CLRY_16XE     0x0064
> +#define PCI_DEVICE_ID_CLRY_161E     0x0063
> +#define PCI_DEVICE_ID_CLRY_162E     0x0064
> +#define PCI_DEVICE_ID_CLRY_164E     0x0065
> +#define PCI_DEVICE_ID_CLRY_16XP     0x0094
> +#define PCI_DEVICE_ID_CLRY_161P     0x00a0
> +#define PCI_DEVICE_ID_CLRY_162P     0x0094
> +#define PCI_DEVICE_ID_CLRY_164P     0x00a1
> +#define PCI_DEVICE_ID_CLRY_32XE     0x0094
> +#define PCI_DEVICE_ID_CLRY_321E     0x00a2
> +#define PCI_DEVICE_ID_CLRY_322E     0x00a3
> +#define PCI_DEVICE_ID_CLRY_324E     0x00ac
> +#define PCI_DEVICE_ID_CLRY_32XP     0x00bb
> +#define PCI_DEVICE_ID_CLRY_321P     0x00bc
> +#define PCI_DEVICE_ID_CLRY_322P     0x00bd
> +#define PCI_DEVICE_ID_CLRY_324P     0x00be
> +#define PCI_DEVICE_ID_TLFC_2        0x0064
> +#define PCI_DEVICE_ID_TLFC_2XX2     0x4064
> +#define PCI_DEVICE_ID_TLFC_3        0x0094
> +#define PCI_DEVICE_ID_TLFC_3162     0x40a6
> +#define PCI_DEVICE_ID_TLFC_3322     0x40a7
>   
>   #define JEDEC_ID_ADDRESS            0x0080001c
>   #define FIREFLY_JEDEC_ID            0x1ACC
> diff --git a/drivers/scsi/lpfc/lpfc_ids.h b/drivers/scsi/lpfc/lpfc_ids.h
> index 6a90e6e53d09..a1b9be245560 100644
> --- a/drivers/scsi/lpfc/lpfc_ids.h
> +++ b/drivers/scsi/lpfc/lpfc_ids.h
> @@ -124,5 +124,35 @@ const struct pci_device_id lpfc_id_table[] = {
>   		PCI_ANY_ID, PCI_ANY_ID, },
>   	{PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SKYHAWK_VF,
>   		PCI_ANY_ID, PCI_ANY_ID, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XE,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_161E, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XE,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_162E, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XE,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_164E, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XP,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_161P, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XP,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_162P, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XP,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_164P, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XE,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_321E, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XE,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_322E, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XE,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_324E, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XP,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_321P, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XP,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_322P, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XP,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_324P, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_2,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_2XX2, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_3,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_3162, },
> +	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_3,
> +		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_3322, },
>   	{ 0 }
>   };
> diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
> index 461d333b1b3a..45a71ab55be8 100644
> --- a/drivers/scsi/lpfc/lpfc_init.c
> +++ b/drivers/scsi/lpfc/lpfc_init.c
> @@ -2408,6 +2408,90 @@ lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len)
>   	return(1);
>   }
>   
> +/**
> + * lpfc_get_atto_model_desc - Retrieve ATTO HBA device model name and description
> + * @phba: pointer to lpfc hba data structure.
> + * @mdp: pointer to the data structure to hold the derived model name.
> + * @descp: pointer to the data structure to hold the derived description.
> + *
> + * This routine retrieves HBA's description based on its registered PCI device
> + * ID. The @descp passed into this function points to an array of 256 chars. It
> + * shall be returned with the model name, maximum speed, and the host bus type.
> + * The @mdp passed into this function points to an array of 80 chars. When the
> + * function returns, the @mdp will be filled with the model name.
> + **/
> +static void
> +lpfc_get_atto_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
> +{
> +	uint16_t sub_dev_id = phba->pcidev->subsystem_device;
> +	char *model = "<Unknown>";
> +	int tbolt = 0;
> +
> +	switch (sub_dev_id) {
> +	case PCI_DEVICE_ID_CLRY_161E:
> +		model = "161E";
> +		break;
> +	case PCI_DEVICE_ID_CLRY_162E:
> +		model = "162E";
> +		break;
> +	case PCI_DEVICE_ID_CLRY_164E:
> +		model = "164E";
> +		break;
> +	case PCI_DEVICE_ID_CLRY_161P:
> +		model = "161P";
> +		break;
> +	case PCI_DEVICE_ID_CLRY_162P:
> +		model = "162P";
> +		break;
> +	case PCI_DEVICE_ID_CLRY_164P:
> +		model = "164P";
> +		break;
> +	case PCI_DEVICE_ID_CLRY_321E:
> +		model = "321E";
> +		break;
> +	case PCI_DEVICE_ID_CLRY_322E:
> +		model = "322E";
> +		break;
> +	case PCI_DEVICE_ID_CLRY_324E:
> +		model = "324E";
> +		break;
> +	case PCI_DEVICE_ID_CLRY_321P:
> +		model = "321P";
> +		break;
> +	case PCI_DEVICE_ID_CLRY_322P:
> +		model = "322P";
> +		break;
> +	case PCI_DEVICE_ID_CLRY_324P:
> +		model = "324P";
> +		break;
> +	case PCI_DEVICE_ID_TLFC_2XX2:
> +		model = "2XX2";
> +		tbolt = 1;
> +		break;
> +	case PCI_DEVICE_ID_TLFC_3162:
> +		model = "3162";
> +		tbolt = 1;
> +		break;
> +	case PCI_DEVICE_ID_TLFC_3322:
> +		model = "3322";
> +		tbolt = 1;
> +		break;
> +	default:
> +		model = "Unknown";
> +		break;
> +	}
> +
> +	if (mdp && mdp[0] == '\0')
> +		snprintf(mdp, 79, "%s", model);
> +
> +	if (descp && descp[0] == '\0')
> +		snprintf(descp, 255,
> +			 "ATTO %s%s, Fibre Channel Adapter Initiator, Port %s",
> +			 (tbolt) ? "ThunderLink FC " : "Celerity FC-",
> +			 model,
> +			 phba->Port);
> +}
> +
>   /**
>    * lpfc_get_hba_model_desc - Retrieve HBA device model name and description
>    * @phba: pointer to lpfc hba data structure.
> @@ -2438,6 +2522,11 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
>   		&& descp && descp[0] != '\0')
>   		return;
>   
> +	if (phba->pcidev->vendor == PCI_VENDOR_ID_ATTO) {
> +		lpfc_get_atto_model_desc(phba, mdp, descp);
> +		return;
> +	}
> +
>   	if (phba->lmt & LMT_64Gb)
>   		max_speed = 64;
>   	else if (phba->lmt & LMT_32Gb)
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index d6050f3c9efe..74a02586fe55 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -1738,6 +1738,28 @@  struct lpfc_fdmi_reg_portattr {
 #define PCI_DEVICE_ID_TOMCAT        0x0714
 #define PCI_DEVICE_ID_SKYHAWK       0x0724
 #define PCI_DEVICE_ID_SKYHAWK_VF    0x072c
+#define PCI_VENDOR_ID_ATTO          0x117c
+#define PCI_DEVICE_ID_CLRY_16XE     0x0064
+#define PCI_DEVICE_ID_CLRY_161E     0x0063
+#define PCI_DEVICE_ID_CLRY_162E     0x0064
+#define PCI_DEVICE_ID_CLRY_164E     0x0065
+#define PCI_DEVICE_ID_CLRY_16XP     0x0094
+#define PCI_DEVICE_ID_CLRY_161P     0x00a0
+#define PCI_DEVICE_ID_CLRY_162P     0x0094
+#define PCI_DEVICE_ID_CLRY_164P     0x00a1
+#define PCI_DEVICE_ID_CLRY_32XE     0x0094
+#define PCI_DEVICE_ID_CLRY_321E     0x00a2
+#define PCI_DEVICE_ID_CLRY_322E     0x00a3
+#define PCI_DEVICE_ID_CLRY_324E     0x00ac
+#define PCI_DEVICE_ID_CLRY_32XP     0x00bb
+#define PCI_DEVICE_ID_CLRY_321P     0x00bc
+#define PCI_DEVICE_ID_CLRY_322P     0x00bd
+#define PCI_DEVICE_ID_CLRY_324P     0x00be
+#define PCI_DEVICE_ID_TLFC_2        0x0064
+#define PCI_DEVICE_ID_TLFC_2XX2     0x4064
+#define PCI_DEVICE_ID_TLFC_3        0x0094
+#define PCI_DEVICE_ID_TLFC_3162     0x40a6
+#define PCI_DEVICE_ID_TLFC_3322     0x40a7
 
 #define JEDEC_ID_ADDRESS            0x0080001c
 #define FIREFLY_JEDEC_ID            0x1ACC
diff --git a/drivers/scsi/lpfc/lpfc_ids.h b/drivers/scsi/lpfc/lpfc_ids.h
index 6a90e6e53d09..a1b9be245560 100644
--- a/drivers/scsi/lpfc/lpfc_ids.h
+++ b/drivers/scsi/lpfc/lpfc_ids.h
@@ -124,5 +124,35 @@  const struct pci_device_id lpfc_id_table[] = {
 		PCI_ANY_ID, PCI_ANY_ID, },
 	{PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SKYHAWK_VF,
 		PCI_ANY_ID, PCI_ANY_ID, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XE,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_161E, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XE,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_162E, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XE,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_164E, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XP,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_161P, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XP,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_162P, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_16XP,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_164P, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XE,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_321E, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XE,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_322E, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XE,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_324E, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XP,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_321P, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XP,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_322P, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_32XP,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_CLRY_324P, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_2,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_2XX2, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_3,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_3162, },
+	{PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_3,
+		PCI_VENDOR_ID_ATTO, PCI_DEVICE_ID_TLFC_3322, },
 	{ 0 }
 };
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 461d333b1b3a..45a71ab55be8 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -2408,6 +2408,90 @@  lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len)
 	return(1);
 }
 
+/**
+ * lpfc_get_atto_model_desc - Retrieve ATTO HBA device model name and description
+ * @phba: pointer to lpfc hba data structure.
+ * @mdp: pointer to the data structure to hold the derived model name.
+ * @descp: pointer to the data structure to hold the derived description.
+ *
+ * This routine retrieves HBA's description based on its registered PCI device
+ * ID. The @descp passed into this function points to an array of 256 chars. It
+ * shall be returned with the model name, maximum speed, and the host bus type.
+ * The @mdp passed into this function points to an array of 80 chars. When the
+ * function returns, the @mdp will be filled with the model name.
+ **/
+static void
+lpfc_get_atto_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
+{
+	uint16_t sub_dev_id = phba->pcidev->subsystem_device;
+	char *model = "<Unknown>";
+	int tbolt = 0;
+
+	switch (sub_dev_id) {
+	case PCI_DEVICE_ID_CLRY_161E:
+		model = "161E";
+		break;
+	case PCI_DEVICE_ID_CLRY_162E:
+		model = "162E";
+		break;
+	case PCI_DEVICE_ID_CLRY_164E:
+		model = "164E";
+		break;
+	case PCI_DEVICE_ID_CLRY_161P:
+		model = "161P";
+		break;
+	case PCI_DEVICE_ID_CLRY_162P:
+		model = "162P";
+		break;
+	case PCI_DEVICE_ID_CLRY_164P:
+		model = "164P";
+		break;
+	case PCI_DEVICE_ID_CLRY_321E:
+		model = "321E";
+		break;
+	case PCI_DEVICE_ID_CLRY_322E:
+		model = "322E";
+		break;
+	case PCI_DEVICE_ID_CLRY_324E:
+		model = "324E";
+		break;
+	case PCI_DEVICE_ID_CLRY_321P:
+		model = "321P";
+		break;
+	case PCI_DEVICE_ID_CLRY_322P:
+		model = "322P";
+		break;
+	case PCI_DEVICE_ID_CLRY_324P:
+		model = "324P";
+		break;
+	case PCI_DEVICE_ID_TLFC_2XX2:
+		model = "2XX2";
+		tbolt = 1;
+		break;
+	case PCI_DEVICE_ID_TLFC_3162:
+		model = "3162";
+		tbolt = 1;
+		break;
+	case PCI_DEVICE_ID_TLFC_3322:
+		model = "3322";
+		tbolt = 1;
+		break;
+	default:
+		model = "Unknown";
+		break;
+	}
+
+	if (mdp && mdp[0] == '\0')
+		snprintf(mdp, 79, "%s", model);
+
+	if (descp && descp[0] == '\0')
+		snprintf(descp, 255,
+			 "ATTO %s%s, Fibre Channel Adapter Initiator, Port %s",
+			 (tbolt) ? "ThunderLink FC " : "Celerity FC-",
+			 model,
+			 phba->Port);
+}
+
 /**
  * lpfc_get_hba_model_desc - Retrieve HBA device model name and description
  * @phba: pointer to lpfc hba data structure.
@@ -2438,6 +2522,11 @@  lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
 		&& descp && descp[0] != '\0')
 		return;
 
+	if (phba->pcidev->vendor == PCI_VENDOR_ID_ATTO) {
+		lpfc_get_atto_model_desc(phba, mdp, descp);
+		return;
+	}
+
 	if (phba->lmt & LMT_64Gb)
 		max_speed = 64;
 	else if (phba->lmt & LMT_32Gb)