fanghuilin / rpms / kernel

Forked from rpms/kernel 3 years ago
Clone
b37f23
From 748b88ff6deca4fda640b16ca021857b33aa5ca6 Mon Sep 17 00:00:00 2001
b37f23
From: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
b37f23
Date: Tue, 10 Jan 2017 18:20:43 -0500
b37f23
Subject: [PATCH 01/11] scsi: megaraid_sas: Add new pci device Ids for SAS3.5
b37f23
 Generic Megaraid Controllers
b37f23
b37f23
This patch contains new pci device ids for SAS3.5 Generic Megaraid Controllers
b37f23
b37f23
Signed-off-by: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
b37f23
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
b37f23
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
b37f23
---
b37f23
 drivers/scsi/megaraid/megaraid_sas.h        | 12 +++++++++---
b37f23
 drivers/scsi/megaraid/megaraid_sas_base.c   | 14 +++++++++++++-
b37f23
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 30 ++++++++++++++++++++++-------
b37f23
 3 files changed, 45 insertions(+), 11 deletions(-)
b37f23
b37f23
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
b37f23
index ba52d14..e5ac6b1 100644
b37f23
--- a/drivers/scsi/megaraid/megaraid_sas.h
b37f23
+++ b/drivers/scsi/megaraid/megaraid_sas.h
b37f23
@@ -56,6 +56,11 @@
b37f23
 #define PCI_DEVICE_ID_LSI_INTRUDER_24		0x00cf
b37f23
 #define PCI_DEVICE_ID_LSI_CUTLASS_52		0x0052
b37f23
 #define PCI_DEVICE_ID_LSI_CUTLASS_53		0x0053
b37f23
+#define PCI_DEVICE_ID_LSI_VENTURA		    0x0014
b37f23
+#define PCI_DEVICE_ID_LSI_HARPOON		    0x0016
b37f23
+#define PCI_DEVICE_ID_LSI_TOMCAT		    0x0017
b37f23
+#define PCI_DEVICE_ID_LSI_VENTURA_4PORT		0x001B
b37f23
+#define PCI_DEVICE_ID_LSI_CRUSADER_4PORT	0x001C
b37f23
 
b37f23
 /*
b37f23
  * Intel HBA SSDIDs
b37f23
@@ -100,7 +105,7 @@
b37f23
  */
b37f23
 
b37f23
 /*
b37f23
- * MFI stands for  MegaRAID SAS FW Interface. This is just a moniker for 
b37f23
+ * MFI stands for  MegaRAID SAS FW Interface. This is just a moniker for
b37f23
  * protocol between the software and firmware. Commands are issued using
b37f23
  * "message frames"
b37f23
  */
b37f23
@@ -1435,7 +1440,7 @@ enum FW_BOOT_CONTEXT {
b37f23
 * register set for both 1068 and 1078 controllers
b37f23
 * structure extended for 1078 registers
b37f23
 */
b37f23
- 
b37f23
+
b37f23
 struct megasas_register_set {
b37f23
 	u32	doorbell;                       /*0000h*/
b37f23
 	u32	fusion_seq_offset;		/*0004h*/
b37f23
@@ -1478,7 +1483,7 @@ struct megasas_register_set {
b37f23
 
b37f23
 	u32 	inbound_high_queue_port ;	/*00C4h*/
b37f23
 
b37f23
-	u32 	reserved_5;			/*00C8h*/
b37f23
+	u32 inbound_single_queue_port;	/*00C8h*/
b37f23
 	u32	res_6[11];			/*CCh*/
b37f23
 	u32	host_diag;
b37f23
 	u32	seq_offset;
b37f23
@@ -2143,6 +2148,7 @@ struct megasas_instance {
b37f23
 	u8 is_rdpq;
b37f23
 	bool dev_handle;
b37f23
 	bool fw_sync_cache_support;
b37f23
+	bool is_ventura;
b37f23
 };
b37f23
 struct MR_LD_VF_MAP {
b37f23
 	u32 size;
b37f23
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
b37f23
index ac01648..a73e6f6 100644
b37f23
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
b37f23
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
b37f23
@@ -155,6 +155,12 @@ static struct pci_device_id megasas_pci_table[] = {
b37f23
 	/* Intruder 24 port*/
b37f23
 	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_CUTLASS_52)},
b37f23
 	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_CUTLASS_53)},
b37f23
+	/* VENTURA */
b37f23
+	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VENTURA)},
b37f23
+	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_HARPOON)},
b37f23
+	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_TOMCAT)},
b37f23
+	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VENTURA_4PORT)},
b37f23
+	{PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_CRUSADER_4PORT)},
b37f23
 	{}
b37f23
 };
b37f23
 
b37f23
@@ -5765,6 +5771,12 @@ static int megasas_probe_one(struct pci_dev *pdev,
b37f23
 	instance->pdev = pdev;
b37f23
 
b37f23
 	switch (instance->pdev->device) {
b37f23
+	case PCI_DEVICE_ID_LSI_VENTURA:
b37f23
+	case PCI_DEVICE_ID_LSI_HARPOON:
b37f23
+	case PCI_DEVICE_ID_LSI_TOMCAT:
b37f23
+	case PCI_DEVICE_ID_LSI_VENTURA_4PORT:
b37f23
+	case PCI_DEVICE_ID_LSI_CRUSADER_4PORT:
b37f23
+	     instance->is_ventura = true;
b37f23
 	case PCI_DEVICE_ID_LSI_FUSION:
b37f23
 	case PCI_DEVICE_ID_LSI_PLASMA:
b37f23
 	case PCI_DEVICE_ID_LSI_INVADER:
b37f23
@@ -5789,7 +5801,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
b37f23
 		if ((instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION) ||
b37f23
 			(instance->pdev->device == PCI_DEVICE_ID_LSI_PLASMA))
b37f23
 			fusion->adapter_type = THUNDERBOLT_SERIES;
b37f23
-		else
b37f23
+		else if (!instance->is_ventura)
b37f23
 			fusion->adapter_type = INVADER_SERIES;
b37f23
 	}
b37f23
 	break;
b37f23
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
b37f23
index 7ecd0b4..5ad8a07 100644
b37f23
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
b37f23
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
b37f23
@@ -189,15 +189,29 @@ inline void megasas_return_cmd_fusion(struct megasas_instance *instance,
b37f23
  */
b37f23
 static void
b37f23
 megasas_fire_cmd_fusion(struct megasas_instance *instance,
b37f23
-		union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc)
b37f23
+	union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc, bool is_32bit)
b37f23
 {
b37f23
+	struct megasas_register_set __iomem *regs = instance->reg_set;
b37f23
+	unsigned long flags;
b37f23
+
b37f23
+	if (is_32bit)
b37f23
+		writel(le32_to_cpu(req_desc->u.low),
b37f23
+			&(regs)->inbound_single_queue_port);
b37f23
+	else if (instance->is_ventura) {
b37f23
+		spin_lock_irqsave(&instance->hba_lock, flags);
b37f23
+		writel(le32_to_cpu(req_desc->u.low),
b37f23
+			&(regs)->inbound_low_queue_port);
b37f23
+		writel(le32_to_cpu(req_desc->u.high),
b37f23
+			&(regs)->inbound_high_queue_port);
b37f23
+		mmiowb();
b37f23
+		spin_unlock_irqrestore(&instance->hba_lock, flags);
b37f23
+	} else {
b37f23
 #if defined(writeq) && defined(CONFIG_64BIT)
b37f23
 	u64 req_data = (((u64)le32_to_cpu(req_desc->u.high) << 32) |
b37f23
 			le32_to_cpu(req_desc->u.low));
b37f23
 
b37f23
 	writeq(req_data, &instance->reg_set->inbound_low_queue_port);
b37f23
 #else
b37f23
-	unsigned long flags;
b37f23
 
b37f23
 	spin_lock_irqsave(&instance->hba_lock, flags);
b37f23
 	writel(le32_to_cpu(req_desc->u.low),
b37f23
@@ -207,6 +221,7 @@ megasas_fire_cmd_fusion(struct megasas_instance *instance,
b37f23
 	mmiowb();
b37f23
 	spin_unlock_irqrestore(&instance->hba_lock, flags);
b37f23
 #endif
b37f23
+	}
b37f23
 }
b37f23
 
b37f23
 /**
b37f23
@@ -850,7 +865,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
b37f23
 			break;
b37f23
 	}
b37f23
 
b37f23
-	megasas_fire_cmd_fusion(instance, &req_desc);
b37f23
+	megasas_fire_cmd_fusion(instance, &req_desc, false);
b37f23
 
b37f23
 	wait_and_poll(instance, cmd, MFI_POLL_TIMEOUT_SECS);
b37f23
 
b37f23
@@ -2224,7 +2239,7 @@ megasas_build_and_issue_cmd_fusion(struct megasas_instance *instance,
b37f23
 	 */
b37f23
 	atomic_inc(&instance->fw_outstanding);
b37f23
 
b37f23
-	megasas_fire_cmd_fusion(instance, req_desc);
b37f23
+	megasas_fire_cmd_fusion(instance, req_desc, instance->is_ventura);
b37f23
 
b37f23
 	return 0;
b37f23
 }
b37f23
@@ -2592,7 +2607,7 @@ megasas_issue_dcmd_fusion(struct megasas_instance *instance,
b37f23
 		return DCMD_NOT_FIRED;
b37f23
 	}
b37f23
 
b37f23
-	megasas_fire_cmd_fusion(instance, req_desc);
b37f23
+	megasas_fire_cmd_fusion(instance, req_desc, instance->is_ventura);
b37f23
 	return DCMD_SUCCESS;
b37f23
 }
b37f23
 
b37f23
@@ -2884,7 +2899,8 @@ void megasas_refire_mgmt_cmd(struct megasas_instance *instance)
b37f23
 				cpu_to_le32(MR_DCMD_SYSTEM_PD_MAP_GET_INFO)))
b37f23
 				&& !(cmd_mfi->flags & DRV_DCMD_SKIP_REFIRE);
b37f23
 		if (refire_cmd)
b37f23
-			megasas_fire_cmd_fusion(instance, req_desc);
b37f23
+			megasas_fire_cmd_fusion(instance, req_desc,
b37f23
+							instance->is_ventura);
b37f23
 		else
b37f23
 			megasas_return_cmd(instance, cmd_mfi);
b37f23
 	}
b37f23
@@ -3063,7 +3079,7 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle,
b37f23
 		mr_request->tmReqFlags.isTMForLD = 1;
b37f23
 
b37f23
 	init_completion(&cmd_fusion->done);
b37f23
-	megasas_fire_cmd_fusion(instance, req_desc);
b37f23
+	megasas_fire_cmd_fusion(instance, req_desc, instance->is_ventura);
b37f23
 
b37f23
 	timeleft = wait_for_completion_timeout(&cmd_fusion->done, 50 * HZ);
b37f23
 
b37f23
-- 
b37f23
1.8.3.1
b37f23