Commit 5a8cb85b authored by sumit.saxena@avagotech.com's avatar sumit.saxena@avagotech.com Committed by Martin K. Petersen

megaraid_sas: Remove PCI id checks

Remove PCI id based checks and use instance->ctrl_context to decide
whether controller is MFI-based or a Fusion adapter. Additionally,
Fusion adapters are divided into two categories: Thunderbolt and
Invader.
Signed-off-by: default avatarSumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: default avatarKashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: default avatarTomas Henzl <thenzl@redhat.com>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 0d5b47a7
This diff is collapsed.
...@@ -741,14 +741,12 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld, ...@@ -741,14 +741,12 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld,
u8 physArm, span; u8 physArm, span;
u64 row; u64 row;
u8 retval = TRUE; u8 retval = TRUE;
u8 do_invader = 0;
u64 *pdBlock = &io_info->pdBlock; u64 *pdBlock = &io_info->pdBlock;
__le16 *pDevHandle = &io_info->devHandle; __le16 *pDevHandle = &io_info->devHandle;
u32 logArm, rowMod, armQ, arm; u32 logArm, rowMod, armQ, arm;
struct fusion_context *fusion;
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER || fusion = instance->ctrl_context;
instance->pdev->device == PCI_DEVICE_ID_LSI_FURY))
do_invader = 1;
/*Get row and span from io_info for Uneven Span IO.*/ /*Get row and span from io_info for Uneven Span IO.*/
row = io_info->start_row; row = io_info->start_row;
...@@ -779,7 +777,8 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld, ...@@ -779,7 +777,8 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld,
else { else {
*pDevHandle = cpu_to_le16(MR_PD_INVALID); *pDevHandle = cpu_to_le16(MR_PD_INVALID);
if ((raid->level >= 5) && if ((raid->level >= 5) &&
(!do_invader || (do_invader && ((fusion->adapter_type == THUNDERBOLT_SERIES) ||
((fusion->adapter_type == INVADER_SERIES) &&
(raid->regTypeReqOnRead != REGION_TYPE_UNUSED)))) (raid->regTypeReqOnRead != REGION_TYPE_UNUSED))))
pRAID_Context->regLockFlags = REGION_TYPE_EXCLUSIVE; pRAID_Context->regLockFlags = REGION_TYPE_EXCLUSIVE;
else if (raid->level == 1) { else if (raid->level == 1) {
...@@ -823,13 +822,12 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow, ...@@ -823,13 +822,12 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
u8 physArm, span; u8 physArm, span;
u64 row; u64 row;
u8 retval = TRUE; u8 retval = TRUE;
u8 do_invader = 0;
u64 *pdBlock = &io_info->pdBlock; u64 *pdBlock = &io_info->pdBlock;
__le16 *pDevHandle = &io_info->devHandle; __le16 *pDevHandle = &io_info->devHandle;
struct fusion_context *fusion;
fusion = instance->ctrl_context;
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER ||
instance->pdev->device == PCI_DEVICE_ID_LSI_FURY))
do_invader = 1;
row = mega_div64_32(stripRow, raid->rowDataSize); row = mega_div64_32(stripRow, raid->rowDataSize);
...@@ -875,7 +873,8 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow, ...@@ -875,7 +873,8 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
/* set dev handle as invalid. */ /* set dev handle as invalid. */
*pDevHandle = cpu_to_le16(MR_PD_INVALID); *pDevHandle = cpu_to_le16(MR_PD_INVALID);
if ((raid->level >= 5) && if ((raid->level >= 5) &&
(!do_invader || (do_invader && ((fusion->adapter_type == THUNDERBOLT_SERIES) ||
((fusion->adapter_type == INVADER_SERIES) &&
(raid->regTypeReqOnRead != REGION_TYPE_UNUSED)))) (raid->regTypeReqOnRead != REGION_TYPE_UNUSED))))
pRAID_Context->regLockFlags = REGION_TYPE_EXCLUSIVE; pRAID_Context->regLockFlags = REGION_TYPE_EXCLUSIVE;
else if (raid->level == 1) { else if (raid->level == 1) {
...@@ -909,6 +908,7 @@ MR_BuildRaidContext(struct megasas_instance *instance, ...@@ -909,6 +908,7 @@ MR_BuildRaidContext(struct megasas_instance *instance,
struct RAID_CONTEXT *pRAID_Context, struct RAID_CONTEXT *pRAID_Context,
struct MR_DRV_RAID_MAP_ALL *map, u8 **raidLUN) struct MR_DRV_RAID_MAP_ALL *map, u8 **raidLUN)
{ {
struct fusion_context *fusion;
struct MR_LD_RAID *raid; struct MR_LD_RAID *raid;
u32 ld, stripSize, stripe_mask; u32 ld, stripSize, stripe_mask;
u64 endLba, endStrip, endRow, start_row, start_strip; u64 endLba, endStrip, endRow, start_row, start_strip;
...@@ -929,6 +929,7 @@ MR_BuildRaidContext(struct megasas_instance *instance, ...@@ -929,6 +929,7 @@ MR_BuildRaidContext(struct megasas_instance *instance,
isRead = io_info->isRead; isRead = io_info->isRead;
io_info->IoforUnevenSpan = 0; io_info->IoforUnevenSpan = 0;
io_info->start_span = SPAN_INVALID; io_info->start_span = SPAN_INVALID;
fusion = instance->ctrl_context;
ld = MR_TargetIdToLdGet(ldTgtId, map); ld = MR_TargetIdToLdGet(ldTgtId, map);
raid = MR_LdRaidGet(ld, map); raid = MR_LdRaidGet(ld, map);
...@@ -1092,8 +1093,7 @@ MR_BuildRaidContext(struct megasas_instance *instance, ...@@ -1092,8 +1093,7 @@ MR_BuildRaidContext(struct megasas_instance *instance,
cpu_to_le16(raid->fpIoTimeoutForLd ? cpu_to_le16(raid->fpIoTimeoutForLd ?
raid->fpIoTimeoutForLd : raid->fpIoTimeoutForLd :
map->raidMap.fpPdIoTimeoutSec); map->raidMap.fpPdIoTimeoutSec);
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || if (fusion->adapter_type == INVADER_SERIES)
(instance->pdev->device == PCI_DEVICE_ID_LSI_FURY))
pRAID_Context->regLockFlags = (isRead) ? pRAID_Context->regLockFlags = (isRead) ?
raid->regTypeReqOnRead : raid->regTypeReqOnWrite; raid->regTypeReqOnRead : raid->regTypeReqOnWrite;
else else
......
...@@ -653,8 +653,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ...@@ -653,8 +653,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
drv_ops = (MFI_CAPABILITIES *) &(init_frame->driver_operations); drv_ops = (MFI_CAPABILITIES *) &(init_frame->driver_operations);
/* driver support Extended MSIX */ /* driver support Extended MSIX */
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || if (fusion->adapter_type == INVADER_SERIES)
(instance->pdev->device == PCI_DEVICE_ID_LSI_FURY))
drv_ops->mfi_capabilities.support_additional_msix = 1; drv_ops->mfi_capabilities.support_additional_msix = 1;
/* driver supports HA / Remote LUN over Fast Path interface */ /* driver supports HA / Remote LUN over Fast Path interface */
drv_ops->mfi_capabilities.support_fp_remote_lun = 1; drv_ops->mfi_capabilities.support_fp_remote_lun = 1;
...@@ -1288,8 +1287,7 @@ megasas_make_sgl_fusion(struct megasas_instance *instance, ...@@ -1288,8 +1287,7 @@ megasas_make_sgl_fusion(struct megasas_instance *instance,
fusion = instance->ctrl_context; fusion = instance->ctrl_context;
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || if (fusion->adapter_type == INVADER_SERIES) {
(instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) {
struct MPI25_IEEE_SGE_CHAIN64 *sgl_ptr_end = sgl_ptr; struct MPI25_IEEE_SGE_CHAIN64 *sgl_ptr_end = sgl_ptr;
sgl_ptr_end += fusion->max_sge_in_main_msg - 1; sgl_ptr_end += fusion->max_sge_in_main_msg - 1;
sgl_ptr_end->Flags = 0; sgl_ptr_end->Flags = 0;
...@@ -1306,11 +1304,9 @@ megasas_make_sgl_fusion(struct megasas_instance *instance, ...@@ -1306,11 +1304,9 @@ megasas_make_sgl_fusion(struct megasas_instance *instance,
sgl_ptr->Length = cpu_to_le32(sg_dma_len(os_sgl)); sgl_ptr->Length = cpu_to_le32(sg_dma_len(os_sgl));
sgl_ptr->Address = cpu_to_le64(sg_dma_address(os_sgl)); sgl_ptr->Address = cpu_to_le64(sg_dma_address(os_sgl));
sgl_ptr->Flags = 0; sgl_ptr->Flags = 0;
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || if (fusion->adapter_type == INVADER_SERIES)
(instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) {
if (i == sge_count - 1) if (i == sge_count - 1)
sgl_ptr->Flags = IEEE_SGE_FLAGS_END_OF_LIST; sgl_ptr->Flags = IEEE_SGE_FLAGS_END_OF_LIST;
}
sgl_ptr++; sgl_ptr++;
sg_processed = i + 1; sg_processed = i + 1;
...@@ -1319,10 +1315,7 @@ megasas_make_sgl_fusion(struct megasas_instance *instance, ...@@ -1319,10 +1315,7 @@ megasas_make_sgl_fusion(struct megasas_instance *instance,
(sge_count > fusion->max_sge_in_main_msg)) { (sge_count > fusion->max_sge_in_main_msg)) {
struct MPI25_IEEE_SGE_CHAIN64 *sg_chain; struct MPI25_IEEE_SGE_CHAIN64 *sg_chain;
if ((instance->pdev->device == if (fusion->adapter_type == INVADER_SERIES) {
PCI_DEVICE_ID_LSI_INVADER) ||
(instance->pdev->device ==
PCI_DEVICE_ID_LSI_FURY)) {
if ((le16_to_cpu(cmd->io_request->IoFlags) & if ((le16_to_cpu(cmd->io_request->IoFlags) &
MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) != MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) !=
MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH)
...@@ -1338,10 +1331,7 @@ megasas_make_sgl_fusion(struct megasas_instance *instance, ...@@ -1338,10 +1331,7 @@ megasas_make_sgl_fusion(struct megasas_instance *instance,
sg_chain = sgl_ptr; sg_chain = sgl_ptr;
/* Prepare chain element */ /* Prepare chain element */
sg_chain->NextChainOffset = 0; sg_chain->NextChainOffset = 0;
if ((instance->pdev->device == if (fusion->adapter_type == INVADER_SERIES)
PCI_DEVICE_ID_LSI_INVADER) ||
(instance->pdev->device ==
PCI_DEVICE_ID_LSI_FURY))
sg_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT; sg_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT;
else else
sg_chain->Flags = sg_chain->Flags =
...@@ -1658,8 +1648,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, ...@@ -1658,8 +1648,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
cmd->request_desc->SCSIIO.RequestFlags = cmd->request_desc->SCSIIO.RequestFlags =
(MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY (MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY
<< MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); << MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || if (fusion->adapter_type == INVADER_SERIES) {
(instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) {
if (io_request->RaidContext.regLockFlags == if (io_request->RaidContext.regLockFlags ==
REGION_TYPE_UNUSED) REGION_TYPE_UNUSED)
cmd->request_desc->SCSIIO.RequestFlags = cmd->request_desc->SCSIIO.RequestFlags =
...@@ -1700,8 +1689,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, ...@@ -1700,8 +1689,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
cmd->request_desc->SCSIIO.RequestFlags = cmd->request_desc->SCSIIO.RequestFlags =
(MEGASAS_REQ_DESCRIPT_FLAGS_LD_IO (MEGASAS_REQ_DESCRIPT_FLAGS_LD_IO
<< MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); << MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || if (fusion->adapter_type == INVADER_SERIES) {
(instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) {
if (io_request->RaidContext.regLockFlags == if (io_request->RaidContext.regLockFlags ==
REGION_TYPE_UNUSED) REGION_TYPE_UNUSED)
cmd->request_desc->SCSIIO.RequestFlags = cmd->request_desc->SCSIIO.RequestFlags =
...@@ -1890,8 +1878,7 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, ...@@ -1890,8 +1878,7 @@ megasas_build_syspd_fusion(struct megasas_instance *instance,
pRAID_Context->timeoutValue = pRAID_Context->timeoutValue =
cpu_to_le16((os_timeout_value > timeout_limit) ? cpu_to_le16((os_timeout_value > timeout_limit) ?
timeout_limit : os_timeout_value); timeout_limit : os_timeout_value);
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || if (fusion->adapter_type == INVADER_SERIES) {
(instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) {
pRAID_Context->Type = MPI2_TYPE_CUDA; pRAID_Context->Type = MPI2_TYPE_CUDA;
pRAID_Context->nseg = 0x1; pRAID_Context->nseg = 0x1;
io_request->IoFlags |= io_request->IoFlags |=
...@@ -2209,10 +2196,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex) ...@@ -2209,10 +2196,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex)
* pending to be completed * pending to be completed
*/ */
if (threshold_reply_count >= THRESHOLD_REPLY_COUNT) { if (threshold_reply_count >= THRESHOLD_REPLY_COUNT) {
if ((instance->pdev->device == if (fusion->adapter_type == INVADER_SERIES)
PCI_DEVICE_ID_LSI_INVADER) ||
(instance->pdev->device ==
PCI_DEVICE_ID_LSI_FURY))
writel(((MSIxIndex & 0x7) << 24) | writel(((MSIxIndex & 0x7) << 24) |
fusion->last_reply_idx[MSIxIndex], fusion->last_reply_idx[MSIxIndex],
instance->reply_post_host_index_addr[MSIxIndex/8]); instance->reply_post_host_index_addr[MSIxIndex/8]);
...@@ -2228,8 +2212,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex) ...@@ -2228,8 +2212,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex)
return IRQ_NONE; return IRQ_NONE;
wmb(); wmb();
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || if (fusion->adapter_type == INVADER_SERIES)
(instance->pdev->device == PCI_DEVICE_ID_LSI_FURY))
writel(((MSIxIndex & 0x7) << 24) | writel(((MSIxIndex & 0x7) << 24) |
fusion->last_reply_idx[MSIxIndex], fusion->last_reply_idx[MSIxIndex],
instance->reply_post_host_index_addr[MSIxIndex/8]); instance->reply_post_host_index_addr[MSIxIndex/8]);
...@@ -2352,8 +2335,7 @@ build_mpt_mfi_pass_thru(struct megasas_instance *instance, ...@@ -2352,8 +2335,7 @@ build_mpt_mfi_pass_thru(struct megasas_instance *instance,
io_req = cmd->io_request; io_req = cmd->io_request;
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || if (fusion->adapter_type == INVADER_SERIES) {
(instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) {
struct MPI25_IEEE_SGE_CHAIN64 *sgl_ptr_end = struct MPI25_IEEE_SGE_CHAIN64 *sgl_ptr_end =
(struct MPI25_IEEE_SGE_CHAIN64 *)&io_req->SGL; (struct MPI25_IEEE_SGE_CHAIN64 *)&io_req->SGL;
sgl_ptr_end += fusion->max_sge_in_main_msg - 1; sgl_ptr_end += fusion->max_sge_in_main_msg - 1;
......
...@@ -96,6 +96,11 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE { ...@@ -96,6 +96,11 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE {
#define THRESHOLD_REPLY_COUNT 50 #define THRESHOLD_REPLY_COUNT 50
#define JBOD_MAPS_COUNT 2 #define JBOD_MAPS_COUNT 2
enum MR_FUSION_ADAPTER_TYPE {
THUNDERBOLT_SERIES = 0,
INVADER_SERIES = 1,
};
/* /*
* Raid Context structure which describes MegaRAID specific IO Parameters * Raid Context structure which describes MegaRAID specific IO Parameters
* This resides at offset 0x60 where the SGL normally starts in MPT IO Frames * This resides at offset 0x60 where the SGL normally starts in MPT IO Frames
...@@ -857,6 +862,7 @@ struct fusion_context { ...@@ -857,6 +862,7 @@ struct fusion_context {
u8 fast_path_io; u8 fast_path_io;
struct LD_LOAD_BALANCE_INFO load_balance_info[MAX_LOGICAL_DRIVES_EXT]; struct LD_LOAD_BALANCE_INFO load_balance_info[MAX_LOGICAL_DRIVES_EXT];
LD_SPAN_INFO log_to_span[MAX_LOGICAL_DRIVES_EXT]; LD_SPAN_INFO log_to_span[MAX_LOGICAL_DRIVES_EXT];
u8 adapter_type;
}; };
union desc_value { union desc_value {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment