aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/megaraid/megaraid_sas_fp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/megaraid/megaraid_sas_fp.c')
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_fp.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c
index 5a5af1fe7581..5255dd688aca 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fp.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
@@ -52,6 +52,7 @@
52#include <scsi/scsi_host.h> 52#include <scsi/scsi_host.h>
53 53
54#include "megaraid_sas_fusion.h" 54#include "megaraid_sas_fusion.h"
55#include "megaraid_sas.h"
55#include <asm/div64.h> 56#include <asm/div64.h>
56 57
57#define ABS_DIFF(a, b) (((a) > (b)) ? ((a) - (b)) : ((b) - (a))) 58#define ABS_DIFF(a, b) (((a) > (b)) ? ((a) - (b)) : ((b) - (a)))
@@ -226,8 +227,9 @@ u32 MR_GetSpanBlock(u32 ld, u64 row, u64 *span_blk,
226* span - Span number 227* span - Span number
227* block - Absolute Block number in the physical disk 228* block - Absolute Block number in the physical disk
228*/ 229*/
229u8 MR_GetPhyParams(u32 ld, u64 stripRow, u16 stripRef, u64 *pdBlock, 230u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
230 u16 *pDevHandle, struct RAID_CONTEXT *pRAID_Context, 231 u16 stripRef, u64 *pdBlock, u16 *pDevHandle,
232 struct RAID_CONTEXT *pRAID_Context,
231 struct MR_FW_RAID_MAP_ALL *map) 233 struct MR_FW_RAID_MAP_ALL *map)
232{ 234{
233 struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map); 235 struct MR_LD_RAID *raid = MR_LdRaidGet(ld, map);
@@ -279,7 +281,8 @@ u8 MR_GetPhyParams(u32 ld, u64 stripRow, u16 stripRef, u64 *pdBlock,
279 *pDevHandle = MR_PdDevHandleGet(pd, map); 281 *pDevHandle = MR_PdDevHandleGet(pd, map);
280 else { 282 else {
281 *pDevHandle = MR_PD_INVALID; /* set dev handle as invalid. */ 283 *pDevHandle = MR_PD_INVALID; /* set dev handle as invalid. */
282 if (raid->level >= 5) 284 if ((raid->level >= 5) &&
285 (instance->pdev->device != PCI_DEVICE_ID_LSI_INVADER))
283 pRAID_Context->regLockFlags = REGION_TYPE_EXCLUSIVE; 286 pRAID_Context->regLockFlags = REGION_TYPE_EXCLUSIVE;
284 else if (raid->level == 1) { 287 else if (raid->level == 1) {
285 /* Get alternate Pd. */ 288 /* Get alternate Pd. */
@@ -306,7 +309,8 @@ u8 MR_GetPhyParams(u32 ld, u64 stripRow, u16 stripRef, u64 *pdBlock,
306* This function will return 0 if region lock was acquired OR return num strips 309* This function will return 0 if region lock was acquired OR return num strips
307*/ 310*/
308u8 311u8
309MR_BuildRaidContext(struct IO_REQUEST_INFO *io_info, 312MR_BuildRaidContext(struct megasas_instance *instance,
313 struct IO_REQUEST_INFO *io_info,
310 struct RAID_CONTEXT *pRAID_Context, 314 struct RAID_CONTEXT *pRAID_Context,
311 struct MR_FW_RAID_MAP_ALL *map) 315 struct MR_FW_RAID_MAP_ALL *map)
312{ 316{
@@ -394,8 +398,12 @@ MR_BuildRaidContext(struct IO_REQUEST_INFO *io_info,
394 } 398 }
395 399
396 pRAID_Context->timeoutValue = map->raidMap.fpPdIoTimeoutSec; 400 pRAID_Context->timeoutValue = map->raidMap.fpPdIoTimeoutSec;
397 pRAID_Context->regLockFlags = (isRead) ? REGION_TYPE_SHARED_READ : 401 if (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER)
398 raid->regTypeReqOnWrite; 402 pRAID_Context->regLockFlags = (isRead) ?
403 raid->regTypeReqOnRead : raid->regTypeReqOnWrite;
404 else
405 pRAID_Context->regLockFlags = (isRead) ?
406 REGION_TYPE_SHARED_READ : raid->regTypeReqOnWrite;
399 pRAID_Context->VirtualDiskTgtId = raid->targetId; 407 pRAID_Context->VirtualDiskTgtId = raid->targetId;
400 pRAID_Context->regLockRowLBA = regStart; 408 pRAID_Context->regLockRowLBA = regStart;
401 pRAID_Context->regLockLength = regSize; 409 pRAID_Context->regLockLength = regSize;
@@ -404,7 +412,8 @@ MR_BuildRaidContext(struct IO_REQUEST_INFO *io_info,
404 /*Get Phy Params only if FP capable, or else leave it to MR firmware 412 /*Get Phy Params only if FP capable, or else leave it to MR firmware
405 to do the calculation.*/ 413 to do the calculation.*/
406 if (io_info->fpOkForIo) { 414 if (io_info->fpOkForIo) {
407 retval = MR_GetPhyParams(ld, start_strip, ref_in_start_stripe, 415 retval = MR_GetPhyParams(instance, ld, start_strip,
416 ref_in_start_stripe,
408 &io_info->pdBlock, 417 &io_info->pdBlock,
409 &io_info->devHandle, pRAID_Context, 418 &io_info->devHandle, pRAID_Context,
410 map); 419 map);
@@ -415,7 +424,8 @@ MR_BuildRaidContext(struct IO_REQUEST_INFO *io_info,
415 } else if (isRead) { 424 } else if (isRead) {
416 uint stripIdx; 425 uint stripIdx;
417 for (stripIdx = 0; stripIdx < num_strips; stripIdx++) { 426 for (stripIdx = 0; stripIdx < num_strips; stripIdx++) {
418 if (!MR_GetPhyParams(ld, start_strip + stripIdx, 427 if (!MR_GetPhyParams(instance, ld,
428 start_strip + stripIdx,
419 ref_in_start_stripe, 429 ref_in_start_stripe,
420 &io_info->pdBlock, 430 &io_info->pdBlock,
421 &io_info->devHandle, 431 &io_info->devHandle,