ignatenkobrain / rpms / kernel

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