toracat / rpms / kernel

Forked from rpms/kernel 5 years ago
Clone

Blame SOURCES/centos-linux-3.10-0001-scsi-megaraid_sas-Add-new-pci-device-Ids-for-SAS3.5-.patch

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