@@ -394,13 +394,14 @@ static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
394
394
buff_ptr_phys = buffer_iomem_phys ;
395
395
WARN_ON (buff_ptr_phys > U32_MAX );
396
396
397
- if (sgel -> FlagsLength &
397
+ if (le32_to_cpu ( sgel -> FlagsLength ) &
398
398
(MPI2_SGE_FLAGS_HOST_TO_IOC << MPI2_SGE_FLAGS_SHIFT ))
399
399
is_write = 1 ;
400
400
401
401
for (i = 0 ; i < MPT_MIN_PHYS_SEGMENTS + ioc -> facts .MaxChainDepth ; i ++ ) {
402
402
403
- sgl_flags = (sgel -> FlagsLength >> MPI2_SGE_FLAGS_SHIFT );
403
+ sgl_flags =
404
+ (le32_to_cpu (sgel -> FlagsLength ) >> MPI2_SGE_FLAGS_SHIFT );
404
405
405
406
switch (sgl_flags & MPI2_SGE_FLAGS_ELEMENT_MASK ) {
406
407
case MPI2_SGE_FLAGS_CHAIN_ELEMENT :
@@ -411,7 +412,7 @@ static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
411
412
*/
412
413
sgel_next =
413
414
_base_get_chain_buffer_dma_to_chain_buffer (ioc ,
414
- sgel -> Address );
415
+ le32_to_cpu ( sgel -> Address ) );
415
416
if (sgel_next == NULL )
416
417
return ;
417
418
/*
@@ -426,7 +427,8 @@ static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
426
427
dst_addr_phys = _base_get_chain_phys (ioc ,
427
428
smid , sge_chain_count );
428
429
WARN_ON (dst_addr_phys > U32_MAX );
429
- sgel -> Address = (u32 )dst_addr_phys ;
430
+ sgel -> Address =
431
+ cpu_to_le32 (lower_32_bits (dst_addr_phys ));
430
432
sgel = sgel_next ;
431
433
sge_chain_count ++ ;
432
434
break ;
@@ -435,22 +437,28 @@ static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
435
437
if (is_scsiio_req ) {
436
438
_base_clone_to_sys_mem (buff_ptr ,
437
439
sg_virt (sg_scmd ),
438
- (sgel -> FlagsLength & 0x00ffffff ));
440
+ (le32_to_cpu (sgel -> FlagsLength ) &
441
+ 0x00ffffff ));
439
442
/*
440
443
* FIXME: this relies on a a zero
441
444
* PCI mem_offset.
442
445
*/
443
- sgel -> Address = (u32 )buff_ptr_phys ;
446
+ sgel -> Address =
447
+ cpu_to_le32 ((u32 )buff_ptr_phys );
444
448
} else {
445
449
_base_clone_to_sys_mem (buff_ptr ,
446
450
ioc -> config_vaddr ,
447
- (sgel -> FlagsLength & 0x00ffffff ));
448
- sgel -> Address = (u32 )buff_ptr_phys ;
451
+ (le32_to_cpu (sgel -> FlagsLength ) &
452
+ 0x00ffffff ));
453
+ sgel -> Address =
454
+ cpu_to_le32 ((u32 )buff_ptr_phys );
449
455
}
450
456
}
451
- buff_ptr += (sgel -> FlagsLength & 0x00ffffff );
452
- buff_ptr_phys += (sgel -> FlagsLength & 0x00ffffff );
453
- if ((sgel -> FlagsLength &
457
+ buff_ptr += (le32_to_cpu (sgel -> FlagsLength ) &
458
+ 0x00ffffff );
459
+ buff_ptr_phys += (le32_to_cpu (sgel -> FlagsLength ) &
460
+ 0x00ffffff );
461
+ if ((le32_to_cpu (sgel -> FlagsLength ) &
454
462
(MPI2_SGE_FLAGS_END_OF_BUFFER
455
463
<< MPI2_SGE_FLAGS_SHIFT )))
456
464
goto eob_clone_chain ;
@@ -1433,7 +1441,7 @@ _base_interrupt(int irq, void *bus_id)
1433
1441
cpu_to_le32 (reply );
1434
1442
if (ioc -> is_mcpu_endpoint )
1435
1443
_base_clone_reply_to_sys_mem (ioc ,
1436
- cpu_to_le32 ( reply ) ,
1444
+ reply ,
1437
1445
ioc -> reply_free_host_index );
1438
1446
writel (ioc -> reply_free_host_index ,
1439
1447
& ioc -> chip -> ReplyFreeHostIndex );
@@ -3044,7 +3052,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
3044
3052
3045
3053
for (i = 0 ; i < ioc -> combined_reply_index_count ; i ++ ) {
3046
3054
ioc -> replyPostRegisterIndex [i ] = (resource_size_t * )
3047
- ((u8 * )& ioc -> chip -> Doorbell +
3055
+ ((u8 __force * )& ioc -> chip -> Doorbell +
3048
3056
MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET +
3049
3057
(i * MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET ));
3050
3058
}
@@ -3339,7 +3347,7 @@ _base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr,
3339
3347
spinlock_t * writeq_lock )
3340
3348
{
3341
3349
unsigned long flags ;
3342
- __u64 data_out = cpu_to_le64 ( b ) ;
3350
+ __u64 data_out = b ;
3343
3351
3344
3352
spin_lock_irqsave (writeq_lock , flags );
3345
3353
writel ((u32 )(data_out ), addr );
@@ -3362,7 +3370,7 @@ _base_mpi_ep_writeq(__u64 b, volatile void __iomem *addr,
3362
3370
static inline void
3363
3371
_base_writeq (__u64 b , volatile void __iomem * addr , spinlock_t * writeq_lock )
3364
3372
{
3365
- writeq (cpu_to_le64 ( b ) , addr );
3373
+ writeq (b , addr );
3366
3374
}
3367
3375
#else
3368
3376
static inline void
@@ -3389,7 +3397,7 @@ _base_put_smid_mpi_ep_scsi_io(struct MPT3SAS_ADAPTER *ioc, u16 smid, u16 handle)
3389
3397
__le32 * mfp = (__le32 * )mpt3sas_base_get_msg_frame (ioc , smid );
3390
3398
3391
3399
_clone_sg_entries (ioc , (void * ) mfp , smid );
3392
- mpi_req_iomem = (void * )ioc -> chip +
3400
+ mpi_req_iomem = (void __force * )ioc -> chip +
3393
3401
MPI_FRAME_START_OFFSET + (smid * ioc -> request_sz );
3394
3402
_base_clone_mpi_to_sys_mem (mpi_req_iomem , (void * )mfp ,
3395
3403
ioc -> request_sz );
@@ -3473,7 +3481,8 @@ mpt3sas_base_put_smid_hi_priority(struct MPT3SAS_ADAPTER *ioc, u16 smid,
3473
3481
3474
3482
request_hdr = (MPI2RequestHeader_t * )mfp ;
3475
3483
/* TBD 256 is offset within sys register. */
3476
- mpi_req_iomem = (void * )ioc -> chip + MPI_FRAME_START_OFFSET
3484
+ mpi_req_iomem = (void __force * )ioc -> chip
3485
+ + MPI_FRAME_START_OFFSET
3477
3486
+ (smid * ioc -> request_sz );
3478
3487
_base_clone_mpi_to_sys_mem (mpi_req_iomem , (void * )mfp ,
3479
3488
ioc -> request_sz );
@@ -3542,7 +3551,7 @@ mpt3sas_base_put_smid_default(struct MPT3SAS_ADAPTER *ioc, u16 smid)
3542
3551
3543
3552
_clone_sg_entries (ioc , (void * ) mfp , smid );
3544
3553
/* TBD 256 is offset within sys register */
3545
- mpi_req_iomem = (void * )ioc -> chip +
3554
+ mpi_req_iomem = (void __force * )ioc -> chip +
3546
3555
MPI_FRAME_START_OFFSET + (smid * ioc -> request_sz );
3547
3556
_base_clone_mpi_to_sys_mem (mpi_req_iomem , (void * )mfp ,
3548
3557
ioc -> request_sz );
@@ -5002,7 +5011,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
5002
5011
5003
5012
/* send message 32-bits at a time */
5004
5013
for (i = 0 , failed = 0 ; i < request_bytes /4 && !failed ; i ++ ) {
5005
- writel (cpu_to_le32 (request [i ]), & ioc -> chip -> Doorbell );
5014
+ writel (( u32 ) (request [i ]), & ioc -> chip -> Doorbell );
5006
5015
if ((_base_wait_for_doorbell_ack (ioc , 5 )))
5007
5016
failed = 1 ;
5008
5017
}
@@ -5023,7 +5032,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
5023
5032
}
5024
5033
5025
5034
/* read the first two 16-bits, it gives the total length of the reply */
5026
- reply [0 ] = le16_to_cpu (readl (& ioc -> chip -> Doorbell )
5035
+ reply [0 ] = ( u16 ) (readl (& ioc -> chip -> Doorbell )
5027
5036
& MPI2_DOORBELL_DATA_MASK );
5028
5037
writel (0 , & ioc -> chip -> HostInterruptStatus );
5029
5038
if ((_base_wait_for_doorbell_int (ioc , 5 ))) {
@@ -5032,7 +5041,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
5032
5041
ioc -> name , __LINE__ );
5033
5042
return - EFAULT ;
5034
5043
}
5035
- reply [1 ] = le16_to_cpu (readl (& ioc -> chip -> Doorbell )
5044
+ reply [1 ] = ( u16 ) (readl (& ioc -> chip -> Doorbell )
5036
5045
& MPI2_DOORBELL_DATA_MASK );
5037
5046
writel (0 , & ioc -> chip -> HostInterruptStatus );
5038
5047
@@ -5046,7 +5055,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
5046
5055
if (i >= reply_bytes /2 ) /* overflow case */
5047
5056
readl (& ioc -> chip -> Doorbell );
5048
5057
else
5049
- reply [i ] = le16_to_cpu (readl (& ioc -> chip -> Doorbell )
5058
+ reply [i ] = ( u16 ) (readl (& ioc -> chip -> Doorbell )
5050
5059
& MPI2_DOORBELL_DATA_MASK );
5051
5060
writel (0 , & ioc -> chip -> HostInterruptStatus );
5052
5061
}
@@ -6172,7 +6181,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc)
6172
6181
ioc -> reply_free [i ] = cpu_to_le32 (reply_address );
6173
6182
if (ioc -> is_mcpu_endpoint )
6174
6183
_base_clone_reply_to_sys_mem (ioc ,
6175
- ( __le32 ) reply_address , i );
6184
+ reply_address , i );
6176
6185
}
6177
6186
6178
6187
/* initialize reply queues */
0 commit comments