aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit.Saxena@avagotech.com <Sumit.Saxena@avagotech.com>2014-11-17 04:54:28 -0500
committerChristoph Hellwig <hch@lst.de>2014-11-24 08:38:57 -0500
commit6e755ddc2935d970574263db3eca547eb70e67d7 (patch)
treeb7ad0687a42931bbda62bf3abf0a11d0e8359316
parent170c238701ec38b1829321b17c70671c101bac55 (diff)
megaraid_sas: dndinaness related bug fixes
This patch addresses few endianness related bug fixes. Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com> Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Cc: <stable@vger.kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_fp.c17
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_fusion.c13
2 files changed, 16 insertions, 14 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c
index 246574bad910..460c6a3d4ade 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fp.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
@@ -185,14 +185,15 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance)
185 /* New Raid map will not set totalSize, so keep expected value 185 /* New Raid map will not set totalSize, so keep expected value
186 * for legacy code in ValidateMapInfo 186 * for legacy code in ValidateMapInfo
187 */ 187 */
188 pDrvRaidMap->totalSize = sizeof(struct MR_FW_RAID_MAP_EXT); 188 pDrvRaidMap->totalSize =
189 cpu_to_le32(sizeof(struct MR_FW_RAID_MAP_EXT));
189 } else { 190 } else {
190 fw_map_old = (struct MR_FW_RAID_MAP_ALL *) 191 fw_map_old = (struct MR_FW_RAID_MAP_ALL *)
191 fusion->ld_map[(instance->map_id & 1)]; 192 fusion->ld_map[(instance->map_id & 1)];
192 pFwRaidMap = &fw_map_old->raidMap; 193 pFwRaidMap = &fw_map_old->raidMap;
193 194
194#if VD_EXT_DEBUG 195#if VD_EXT_DEBUG
195 for (i = 0; i < pFwRaidMap->ldCount; i++) { 196 for (i = 0; i < le16_to_cpu(pFwRaidMap->ldCount); i++) {
196 dev_dbg(&instance->pdev->dev, "(%d) :Index 0x%x " 197 dev_dbg(&instance->pdev->dev, "(%d) :Index 0x%x "
197 "Target Id 0x%x Seq Num 0x%x Size 0/%llx\n", 198 "Target Id 0x%x Seq Num 0x%x Size 0/%llx\n",
198 instance->unique_id, i, 199 instance->unique_id, i,
@@ -204,12 +205,12 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance)
204 205
205 memset(drv_map, 0, fusion->drv_map_sz); 206 memset(drv_map, 0, fusion->drv_map_sz);
206 pDrvRaidMap->totalSize = pFwRaidMap->totalSize; 207 pDrvRaidMap->totalSize = pFwRaidMap->totalSize;
207 pDrvRaidMap->ldCount = pFwRaidMap->ldCount; 208 pDrvRaidMap->ldCount = (__le16)pFwRaidMap->ldCount;
208 pDrvRaidMap->fpPdIoTimeoutSec = pFwRaidMap->fpPdIoTimeoutSec; 209 pDrvRaidMap->fpPdIoTimeoutSec = pFwRaidMap->fpPdIoTimeoutSec;
209 for (i = 0; i < MAX_RAIDMAP_LOGICAL_DRIVES + MAX_RAIDMAP_VIEWS; i++) 210 for (i = 0; i < MAX_RAIDMAP_LOGICAL_DRIVES + MAX_RAIDMAP_VIEWS; i++)
210 pDrvRaidMap->ldTgtIdToLd[i] = 211 pDrvRaidMap->ldTgtIdToLd[i] =
211 (u8)pFwRaidMap->ldTgtIdToLd[i]; 212 (u8)pFwRaidMap->ldTgtIdToLd[i];
212 for (i = 0; i < pDrvRaidMap->ldCount; i++) { 213 for (i = 0; i < le16_to_cpu(pDrvRaidMap->ldCount); i++) {
213 pDrvRaidMap->ldSpanMap[i] = pFwRaidMap->ldSpanMap[i]; 214 pDrvRaidMap->ldSpanMap[i] = pFwRaidMap->ldSpanMap[i];
214#if VD_EXT_DEBUG 215#if VD_EXT_DEBUG
215 dev_dbg(&instance->pdev->dev, 216 dev_dbg(&instance->pdev->dev,
@@ -270,7 +271,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance)
270 else 271 else
271 expected_size = 272 expected_size =
272 (sizeof(struct MR_FW_RAID_MAP) - sizeof(struct MR_LD_SPAN_MAP) + 273 (sizeof(struct MR_FW_RAID_MAP) - sizeof(struct MR_LD_SPAN_MAP) +
273 (sizeof(struct MR_LD_SPAN_MAP) * le32_to_cpu(pDrvRaidMap->ldCount))); 274 (sizeof(struct MR_LD_SPAN_MAP) * le16_to_cpu(pDrvRaidMap->ldCount)));
274 275
275 if (le32_to_cpu(pDrvRaidMap->totalSize) != expected_size) { 276 if (le32_to_cpu(pDrvRaidMap->totalSize) != expected_size) {
276 dev_err(&instance->pdev->dev, "map info structure size 0x%x is not matching with ld count\n", 277 dev_err(&instance->pdev->dev, "map info structure size 0x%x is not matching with ld count\n",
@@ -286,7 +287,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance)
286 287
287 mr_update_load_balance_params(drv_map, lbInfo); 288 mr_update_load_balance_params(drv_map, lbInfo);
288 289
289 num_lds = le32_to_cpu(drv_map->raidMap.ldCount); 290 num_lds = le16_to_cpu(drv_map->raidMap.ldCount);
290 291
291 /*Convert Raid capability values to CPU arch */ 292 /*Convert Raid capability values to CPU arch */
292 for (ldCount = 0; ldCount < num_lds; ldCount++) { 293 for (ldCount = 0; ldCount < num_lds; ldCount++) {
@@ -459,7 +460,7 @@ u32 mr_spanset_get_span_block(struct megasas_instance *instance,
459 quad = &map->raidMap.ldSpanMap[ld]. 460 quad = &map->raidMap.ldSpanMap[ld].
460 spanBlock[span]. 461 spanBlock[span].
461 block_span_info.quad[info]; 462 block_span_info.quad[info];
462 if (le32_to_cpu(quad->diff == 0)) 463 if (le32_to_cpu(quad->diff) == 0)
463 return SPAN_INVALID; 464 return SPAN_INVALID;
464 if (le64_to_cpu(quad->logStart) <= row && 465 if (le64_to_cpu(quad->logStart) <= row &&
465 row <= le64_to_cpu(quad->logEnd) && 466 row <= le64_to_cpu(quad->logEnd) &&
@@ -522,7 +523,7 @@ static u64 get_row_from_strip(struct megasas_instance *instance,
522 span_set->span_row_data_width) * span_set->diff; 523 span_set->span_row_data_width) * span_set->diff;
523 for (span = 0, span_offset = 0; span < raid->spanDepth; span++) 524 for (span = 0, span_offset = 0; span < raid->spanDepth; span++)
524 if (le32_to_cpu(map->raidMap.ldSpanMap[ld].spanBlock[span]. 525 if (le32_to_cpu(map->raidMap.ldSpanMap[ld].spanBlock[span].
525 block_span_info.noElements >= info+1)) { 526 block_span_info.noElements) >= info+1) {
526 if (strip_offset >= 527 if (strip_offset >=
527 span_set->strip_offset[span]) 528 span_set->strip_offset[span])
528 span_offset++; 529 span_offset++;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 4e259edd467a..71557f64bb5e 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -882,7 +882,7 @@ megasas_sync_map_info(struct megasas_instance *instance)
882 882
883 map = fusion->ld_drv_map[instance->map_id & 1]; 883 map = fusion->ld_drv_map[instance->map_id & 1];
884 884
885 num_lds = le32_to_cpu(map->raidMap.ldCount); 885 num_lds = le16_to_cpu(map->raidMap.ldCount);
886 886
887 dcmd = &cmd->frame->dcmd; 887 dcmd = &cmd->frame->dcmd;
888 888
@@ -1137,9 +1137,10 @@ megasas_fire_cmd_fusion(struct megasas_instance *instance,
1137 struct megasas_register_set __iomem *regs) 1137 struct megasas_register_set __iomem *regs)
1138{ 1138{
1139#if defined(writeq) && defined(CONFIG_64BIT) 1139#if defined(writeq) && defined(CONFIG_64BIT)
1140 u64 req_data = (((u64)req_desc_hi << 32) | (u32)req_desc_lo); 1140 u64 req_data = (((u64)le32_to_cpu(req_desc_hi) << 32) |
1141 le32_to_cpu(req_desc_lo));
1141 1142
1142 writeq(le64_to_cpu(req_data), &(regs)->inbound_low_queue_port); 1143 writeq(req_data, &(regs)->inbound_low_queue_port);
1143#else 1144#else
1144 unsigned long flags; 1145 unsigned long flags;
1145 1146
@@ -1337,7 +1338,7 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len,
1337 /* Logical block reference tag */ 1338 /* Logical block reference tag */
1338 io_request->CDB.EEDP32.PrimaryReferenceTag = 1339 io_request->CDB.EEDP32.PrimaryReferenceTag =
1339 cpu_to_be32(ref_tag); 1340 cpu_to_be32(ref_tag);
1340 io_request->CDB.EEDP32.PrimaryApplicationTagMask = 0xffff; 1341 io_request->CDB.EEDP32.PrimaryApplicationTagMask = cpu_to_be16(0xffff);
1341 io_request->IoFlags = cpu_to_le16(32); /* Specify 32-byte cdb */ 1342 io_request->IoFlags = cpu_to_le16(32); /* Specify 32-byte cdb */
1342 1343
1343 /* Transfer length */ 1344 /* Transfer length */
@@ -1733,7 +1734,7 @@ megasas_build_dcdb_fusion(struct megasas_instance *instance,
1733 1734
1734 /* set RAID context values */ 1735 /* set RAID context values */
1735 pRAID_Context->regLockFlags = REGION_TYPE_SHARED_READ; 1736 pRAID_Context->regLockFlags = REGION_TYPE_SHARED_READ;
1736 pRAID_Context->timeoutValue = raid->fpIoTimeoutForLd; 1737 pRAID_Context->timeoutValue = cpu_to_le16(raid->fpIoTimeoutForLd);
1737 pRAID_Context->VirtualDiskTgtId = cpu_to_le16(device_id); 1738 pRAID_Context->VirtualDiskTgtId = cpu_to_le16(device_id);
1738 pRAID_Context->regLockRowLBA = 0; 1739 pRAID_Context->regLockRowLBA = 0;
1739 pRAID_Context->regLockLength = 0; 1740 pRAID_Context->regLockLength = 0;
@@ -2218,7 +2219,7 @@ build_mpt_mfi_pass_thru(struct megasas_instance *instance,
2218 * megasas_complete_cmd 2219 * megasas_complete_cmd
2219 */ 2220 */
2220 2221
2221 if (frame_hdr->flags & MFI_FRAME_DONT_POST_IN_REPLY_QUEUE) 2222 if (frame_hdr->flags & cpu_to_le16(MFI_FRAME_DONT_POST_IN_REPLY_QUEUE))
2222 cmd->flags = MFI_FRAME_DONT_POST_IN_REPLY_QUEUE; 2223 cmd->flags = MFI_FRAME_DONT_POST_IN_REPLY_QUEUE;
2223 2224
2224 fusion = instance->ctrl_context; 2225 fusion = instance->ctrl_context;