l30013671 / rpms / kernel

Forked from rpms/kernel 2 years ago
Clone
24d93b
From 1d7d67352bddfd44384bd8778f822da279ff78f8 Mon Sep 17 00:00:00 2001
24d93b
From: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
24d93b
Date: Tue, 10 Jan 2017 18:20:49 -0500
24d93b
Subject: [PATCH 07/11] scsi: megaraid_sas: Add the Support for SAS3.5 Generic
24d93b
 Megaraid Controllers Capabilities
24d93b
24d93b
The Megaraid driver has to support the SAS3.5 Generic Megaraid Controllers Firmware functionality.
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_base.c   | 53 ++++++++++++++---------------
24d93b
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 19 ++++++-----
24d93b
 drivers/scsi/megaraid/megaraid_sas_fusion.h |  1 +
24d93b
 3 files changed, 37 insertions(+), 36 deletions(-)
24d93b
24d93b
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
24d93b
index 1d8cf03..8b0c686 100644
24d93b
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
24d93b
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
24d93b
@@ -5089,34 +5089,29 @@ static int megasas_init_fw(struct megasas_instance *instance)
24d93b
 
24d93b
 	reg_set = instance->reg_set;
24d93b
 
24d93b
-	switch (instance->pdev->device) {
24d93b
-	case PCI_DEVICE_ID_LSI_FUSION:
24d93b
-	case PCI_DEVICE_ID_LSI_PLASMA:
24d93b
-	case PCI_DEVICE_ID_LSI_INVADER:
24d93b
-	case PCI_DEVICE_ID_LSI_FURY:
24d93b
-	case PCI_DEVICE_ID_LSI_INTRUDER:
24d93b
-	case PCI_DEVICE_ID_LSI_INTRUDER_24:
24d93b
-	case PCI_DEVICE_ID_LSI_CUTLASS_52:
24d93b
-	case PCI_DEVICE_ID_LSI_CUTLASS_53:
24d93b
+	if (fusion)
24d93b
 		instance->instancet = &megasas_instance_template_fusion;
24d93b
-		break;
24d93b
-	case PCI_DEVICE_ID_LSI_SAS1078R:
24d93b
-	case PCI_DEVICE_ID_LSI_SAS1078DE:
24d93b
-		instance->instancet = &megasas_instance_template_ppc;
24d93b
-		break;
24d93b
-	case PCI_DEVICE_ID_LSI_SAS1078GEN2:
24d93b
-	case PCI_DEVICE_ID_LSI_SAS0079GEN2:
24d93b
-		instance->instancet = &megasas_instance_template_gen2;
24d93b
-		break;
24d93b
-	case PCI_DEVICE_ID_LSI_SAS0073SKINNY:
24d93b
-	case PCI_DEVICE_ID_LSI_SAS0071SKINNY:
24d93b
-		instance->instancet = &megasas_instance_template_skinny;
24d93b
-		break;
24d93b
-	case PCI_DEVICE_ID_LSI_SAS1064R:
24d93b
-	case PCI_DEVICE_ID_DELL_PERC5:
24d93b
-	default:
24d93b
-		instance->instancet = &megasas_instance_template_xscale;
24d93b
-		break;
24d93b
+	else {
24d93b
+		switch (instance->pdev->device) {
24d93b
+		case PCI_DEVICE_ID_LSI_SAS1078R:
24d93b
+		case PCI_DEVICE_ID_LSI_SAS1078DE:
24d93b
+			instance->instancet = &megasas_instance_template_ppc;
24d93b
+			break;
24d93b
+		case PCI_DEVICE_ID_LSI_SAS1078GEN2:
24d93b
+		case PCI_DEVICE_ID_LSI_SAS0079GEN2:
24d93b
+			instance->instancet = &megasas_instance_template_gen2;
24d93b
+			break;
24d93b
+		case PCI_DEVICE_ID_LSI_SAS0073SKINNY:
24d93b
+		case PCI_DEVICE_ID_LSI_SAS0071SKINNY:
24d93b
+			instance->instancet = &megasas_instance_template_skinny;
24d93b
+			break;
24d93b
+		case PCI_DEVICE_ID_LSI_SAS1064R:
24d93b
+		case PCI_DEVICE_ID_DELL_PERC5:
24d93b
+		default:
24d93b
+			instance->instancet = &megasas_instance_template_xscale;
24d93b
+			instance->pd_list_not_supported = 1;
24d93b
+			break;
24d93b
+		}
24d93b
 	}
24d93b
 
24d93b
 	if (megasas_transition_to_ready(instance, 0)) {
24d93b
@@ -5869,7 +5864,9 @@ 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 if (!instance->is_ventura)
24d93b
+		else if (instance->is_ventura)
24d93b
+			fusion->adapter_type = VENTURA_SERIES;
24d93b
+		else
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 178f166..1802c57 100644
24d93b
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
24d93b
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
24d93b
@@ -244,7 +244,10 @@ megasas_fusion_update_can_queue(struct megasas_instance *instance, int fw_boot_c
24d93b
 
24d93b
 	reg_set = instance->reg_set;
24d93b
 
24d93b
-	cur_max_fw_cmds = readl(&instance->reg_set->outbound_scratch_pad_3) & 0x00FFFF;
24d93b
+	/* ventura FW does not fill outbound_scratch_pad_3 with queue depth */
24d93b
+	if (!instance->is_ventura)
24d93b
+		cur_max_fw_cmds =
24d93b
+		readl(&instance->reg_set->outbound_scratch_pad_3) & 0x00FFFF;
24d93b
 
24d93b
 	if (dual_qdepth_disable || !cur_max_fw_cmds)
24d93b
 		cur_max_fw_cmds = instance->instancet->read_fw_status_reg(reg_set) & 0x00FFFF;
24d93b
@@ -837,7 +840,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
24d93b
 	drv_ops = (MFI_CAPABILITIES *) &(init_frame->driver_operations);
24d93b
 
24d93b
 	/* driver support Extended MSIX */
24d93b
-	if (fusion->adapter_type == INVADER_SERIES)
24d93b
+	if (fusion->adapter_type >= INVADER_SERIES)
24d93b
 		drv_ops->mfi_capabilities.support_additional_msix = 1;
24d93b
 	/* driver supports HA / Remote LUN over Fast Path interface */
24d93b
 	drv_ops->mfi_capabilities.support_fp_remote_lun = 1;
24d93b
@@ -1491,7 +1494,7 @@ megasas_make_sgl_fusion(struct megasas_instance *instance,
24d93b
 
24d93b
 	fusion = instance->ctrl_context;
24d93b
 
24d93b
-	if (fusion->adapter_type == INVADER_SERIES) {
24d93b
+	if (fusion->adapter_type >= INVADER_SERIES) {
24d93b
 		struct MPI25_IEEE_SGE_CHAIN64 *sgl_ptr_end = sgl_ptr;
24d93b
 		sgl_ptr_end += fusion->max_sge_in_main_msg - 1;
24d93b
 		sgl_ptr_end->Flags = 0;
24d93b
@@ -1508,7 +1511,7 @@ megasas_make_sgl_fusion(struct megasas_instance *instance,
24d93b
 		sgl_ptr->Length = cpu_to_le32(sg_dma_len(os_sgl));
24d93b
 		sgl_ptr->Address = cpu_to_le64(sg_dma_address(os_sgl));
24d93b
 		sgl_ptr->Flags = 0;
24d93b
-		if (fusion->adapter_type == INVADER_SERIES)
24d93b
+		if (fusion->adapter_type >= INVADER_SERIES)
24d93b
 			if (i == sge_count - 1)
24d93b
 				sgl_ptr->Flags = IEEE_SGE_FLAGS_END_OF_LIST;
24d93b
 		sgl_ptr++;
24d93b
@@ -1519,7 +1522,7 @@ megasas_make_sgl_fusion(struct megasas_instance *instance,
24d93b
 		    (sge_count > fusion->max_sge_in_main_msg)) {
24d93b
 
24d93b
 			struct MPI25_IEEE_SGE_CHAIN64 *sg_chain;
24d93b
-			if (fusion->adapter_type == INVADER_SERIES) {
24d93b
+			if (fusion->adapter_type >= INVADER_SERIES) {
24d93b
 				if ((le16_to_cpu(cmd->io_request->IoFlags) &
24d93b
 					MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) !=
24d93b
 					MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH)
24d93b
@@ -1535,7 +1538,7 @@ megasas_make_sgl_fusion(struct megasas_instance *instance,
24d93b
 			sg_chain = sgl_ptr;
24d93b
 			/* Prepare chain element */
24d93b
 			sg_chain->NextChainOffset = 0;
24d93b
-			if (fusion->adapter_type == INVADER_SERIES)
24d93b
+			if (fusion->adapter_type >= INVADER_SERIES)
24d93b
 				sg_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT;
24d93b
 			else
24d93b
 				sg_chain->Flags =
24d93b
@@ -2286,7 +2289,7 @@ megasas_build_syspd_fusion(struct megasas_instance *instance,
24d93b
 		pRAID_Context->timeout_value =
24d93b
 			cpu_to_le16((os_timeout_value > timeout_limit) ?
24d93b
 			timeout_limit : os_timeout_value);
24d93b
-		if (fusion->adapter_type == INVADER_SERIES)
24d93b
+		if (fusion->adapter_type >= INVADER_SERIES)
24d93b
 			io_request->IoFlags |=
24d93b
 				cpu_to_le16(MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH);
24d93b
 
24d93b
@@ -2995,7 +2998,7 @@ build_mpt_mfi_pass_thru(struct megasas_instance *instance,
24d93b
 
24d93b
 	io_req = cmd->io_request;
24d93b
 
24d93b
-	if (fusion->adapter_type == INVADER_SERIES) {
24d93b
+	if (fusion->adapter_type >= INVADER_SERIES) {
24d93b
 		struct MPI25_IEEE_SGE_CHAIN64 *sgl_ptr_end =
24d93b
 			(struct MPI25_IEEE_SGE_CHAIN64 *)&io_req->SGL;
24d93b
 		sgl_ptr_end += fusion->max_sge_in_main_msg - 1;
24d93b
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h
24d93b
index 2de12b4..b24262a 100644
24d93b
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.h
24d93b
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h
24d93b
@@ -107,6 +107,7 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE {
24d93b
 enum MR_FUSION_ADAPTER_TYPE {
24d93b
 	THUNDERBOLT_SERIES = 0,
24d93b
 	INVADER_SERIES = 1,
24d93b
+	VENTURA_SERIES = 2,
24d93b
 };
24d93b
 
24d93b
 /*
24d93b
-- 
24d93b
1.8.3.1
24d93b