imperfectism / rpms / kernel

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