potatogim / rpms / kernel

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