jianhai / rpms / kernel

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