aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2011-06-14 01:24:56 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-06-29 17:07:00 -0400
commitc97951ec46d4b076c2236b77db34eeed6dddb8eb (patch)
tree992d5e85f3dbc23bb702e9a295cae5c477683037 /drivers/scsi/mpt2sas
parentd7e01dc669e3f69d396ce3972ba87b7d678a94e4 (diff)
[SCSI] mpt2sas: Fixed Big Indian Issues on 32 bit PPC
This patch addresses many endian issues solved by runing sparse with the option __CHECK_ENDIAN__ turned on. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/mpt2sas')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c65
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.h53
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_ctl.c10
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_debug.h2
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c12
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_transport.c24
6 files changed, 96 insertions, 70 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index efa0255491c2..1da606cb2461 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -94,7 +94,7 @@ module_param(diag_buffer_enable, int, 0);
94MODULE_PARM_DESC(diag_buffer_enable, " post diag buffers " 94MODULE_PARM_DESC(diag_buffer_enable, " post diag buffers "
95 "(TRACE=1/SNAPSHOT=2/EXTENDED=4/default=0)"); 95 "(TRACE=1/SNAPSHOT=2/EXTENDED=4/default=0)");
96 96
97int mpt2sas_fwfault_debug; 97static int mpt2sas_fwfault_debug;
98MODULE_PARM_DESC(mpt2sas_fwfault_debug, " enable detection of firmware fault " 98MODULE_PARM_DESC(mpt2sas_fwfault_debug, " enable detection of firmware fault "
99 "and halt firmware - (default=0)"); 99 "and halt firmware - (default=0)");
100 100
@@ -857,7 +857,7 @@ _base_interrupt(int irq, void *bus_id)
857 completed_cmds = 0; 857 completed_cmds = 0;
858 cb_idx = 0xFF; 858 cb_idx = 0xFF;
859 do { 859 do {
860 rd.word = rpf->Words; 860 rd.word = le64_to_cpu(rpf->Words);
861 if (rd.u.low == UINT_MAX || rd.u.high == UINT_MAX) 861 if (rd.u.low == UINT_MAX || rd.u.high == UINT_MAX)
862 goto out; 862 goto out;
863 reply = 0; 863 reply = 0;
@@ -906,7 +906,7 @@ _base_interrupt(int irq, void *bus_id)
906 906
907 next: 907 next:
908 908
909 rpf->Words = ULLONG_MAX; 909 rpf->Words = cpu_to_le64(ULLONG_MAX);
910 ioc->reply_post_host_index = (ioc->reply_post_host_index == 910 ioc->reply_post_host_index = (ioc->reply_post_host_index ==
911 (ioc->reply_post_queue_depth - 1)) ? 0 : 911 (ioc->reply_post_queue_depth - 1)) ? 0 :
912 ioc->reply_post_host_index + 1; 912 ioc->reply_post_host_index + 1;
@@ -1817,7 +1817,9 @@ _base_display_ioc_capabilities(struct MPT2SAS_ADAPTER *ioc)
1817 char desc[16]; 1817 char desc[16];
1818 u8 revision; 1818 u8 revision;
1819 u32 iounit_pg1_flags; 1819 u32 iounit_pg1_flags;
1820 u32 bios_version;
1820 1821
1822 bios_version = le32_to_cpu(ioc->bios_pg3.BiosVersion);
1821 pci_read_config_byte(ioc->pdev, PCI_CLASS_REVISION, &revision); 1823 pci_read_config_byte(ioc->pdev, PCI_CLASS_REVISION, &revision);
1822 strncpy(desc, ioc->manu_pg0.ChipName, 16); 1824 strncpy(desc, ioc->manu_pg0.ChipName, 16);
1823 printk(MPT2SAS_INFO_FMT "%s: FWVersion(%02d.%02d.%02d.%02d), " 1825 printk(MPT2SAS_INFO_FMT "%s: FWVersion(%02d.%02d.%02d.%02d), "
@@ -1828,10 +1830,10 @@ _base_display_ioc_capabilities(struct MPT2SAS_ADAPTER *ioc)
1828 (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8, 1830 (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8,
1829 ioc->facts.FWVersion.Word & 0x000000FF, 1831 ioc->facts.FWVersion.Word & 0x000000FF,
1830 revision, 1832 revision,
1831 (ioc->bios_pg3.BiosVersion & 0xFF000000) >> 24, 1833 (bios_version & 0xFF000000) >> 24,
1832 (ioc->bios_pg3.BiosVersion & 0x00FF0000) >> 16, 1834 (bios_version & 0x00FF0000) >> 16,
1833 (ioc->bios_pg3.BiosVersion & 0x0000FF00) >> 8, 1835 (bios_version & 0x0000FF00) >> 8,
1834 ioc->bios_pg3.BiosVersion & 0x000000FF); 1836 bios_version & 0x000000FF);
1835 1837
1836 _base_display_dell_branding(ioc); 1838 _base_display_dell_branding(ioc);
1837 _base_display_intel_branding(ioc); 1839 _base_display_intel_branding(ioc);
@@ -2150,7 +2152,7 @@ _base_release_memory_pools(struct MPT2SAS_ADAPTER *ioc)
2150static int 2152static int
2151_base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) 2153_base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
2152{ 2154{
2153 Mpi2IOCFactsReply_t *facts; 2155 struct mpt2sas_facts *facts;
2154 u32 queue_size, queue_diff; 2156 u32 queue_size, queue_diff;
2155 u16 max_sge_elements; 2157 u16 max_sge_elements;
2156 u16 num_of_reply_frames; 2158 u16 num_of_reply_frames;
@@ -2783,7 +2785,7 @@ _base_handshake_req_reply_wait(struct MPT2SAS_ADAPTER *ioc, int request_bytes,
2783 int i; 2785 int i;
2784 u8 failed; 2786 u8 failed;
2785 u16 dummy; 2787 u16 dummy;
2786 u32 *mfp; 2788 __le32 *mfp;
2787 2789
2788 /* make sure doorbell is not in use */ 2790 /* make sure doorbell is not in use */
2789 if ((readl(&ioc->chip->Doorbell) & MPI2_DOORBELL_USED)) { 2791 if ((readl(&ioc->chip->Doorbell) & MPI2_DOORBELL_USED)) {
@@ -2871,7 +2873,7 @@ _base_handshake_req_reply_wait(struct MPT2SAS_ADAPTER *ioc, int request_bytes,
2871 writel(0, &ioc->chip->HostInterruptStatus); 2873 writel(0, &ioc->chip->HostInterruptStatus);
2872 2874
2873 if (ioc->logging_level & MPT_DEBUG_INIT) { 2875 if (ioc->logging_level & MPT_DEBUG_INIT) {
2874 mfp = (u32 *)reply; 2876 mfp = (__le32 *)reply;
2875 printk(KERN_INFO "\toffset:data\n"); 2877 printk(KERN_INFO "\toffset:data\n");
2876 for (i = 0; i < reply_bytes/4; i++) 2878 for (i = 0; i < reply_bytes/4; i++)
2877 printk(KERN_INFO "\t[0x%02x]:%08x\n", i*4, 2879 printk(KERN_INFO "\t[0x%02x]:%08x\n", i*4,
@@ -3097,7 +3099,8 @@ static int
3097_base_get_port_facts(struct MPT2SAS_ADAPTER *ioc, int port, int sleep_flag) 3099_base_get_port_facts(struct MPT2SAS_ADAPTER *ioc, int port, int sleep_flag)
3098{ 3100{
3099 Mpi2PortFactsRequest_t mpi_request; 3101 Mpi2PortFactsRequest_t mpi_request;
3100 Mpi2PortFactsReply_t mpi_reply, *pfacts; 3102 Mpi2PortFactsReply_t mpi_reply;
3103 struct mpt2sas_port_facts *pfacts;
3101 int mpi_reply_sz, mpi_request_sz, r; 3104 int mpi_reply_sz, mpi_request_sz, r;
3102 3105
3103 dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, 3106 dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name,
@@ -3139,7 +3142,8 @@ static int
3139_base_get_ioc_facts(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) 3142_base_get_ioc_facts(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
3140{ 3143{
3141 Mpi2IOCFactsRequest_t mpi_request; 3144 Mpi2IOCFactsRequest_t mpi_request;
3142 Mpi2IOCFactsReply_t mpi_reply, *facts; 3145 Mpi2IOCFactsReply_t mpi_reply;
3146 struct mpt2sas_facts *facts;
3143 int mpi_reply_sz, mpi_request_sz, r; 3147 int mpi_reply_sz, mpi_request_sz, r;
3144 3148
3145 dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, 3149 dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name,
@@ -3225,17 +3229,6 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
3225 mpi_request.MsgVersion = cpu_to_le16(MPI2_VERSION); 3229 mpi_request.MsgVersion = cpu_to_le16(MPI2_VERSION);
3226 mpi_request.HeaderVersion = cpu_to_le16(MPI2_HEADER_VERSION); 3230 mpi_request.HeaderVersion = cpu_to_le16(MPI2_HEADER_VERSION);
3227 3231
3228 /* In MPI Revision I (0xA), the SystemReplyFrameSize(offset 0x18) was
3229 * removed and made reserved. For those with older firmware will need
3230 * this fix. It was decided that the Reply and Request frame sizes are
3231 * the same.
3232 */
3233 if ((ioc->facts.HeaderVersion >> 8) < 0xA) {
3234 mpi_request.Reserved7 = cpu_to_le16(ioc->reply_sz);
3235/* mpi_request.SystemReplyFrameSize =
3236 * cpu_to_le16(ioc->reply_sz);
3237 */
3238 }
3239 3232
3240 mpi_request.SystemRequestFrameSize = cpu_to_le16(ioc->request_sz/4); 3233 mpi_request.SystemRequestFrameSize = cpu_to_le16(ioc->request_sz/4);
3241 mpi_request.ReplyDescriptorPostQueueDepth = 3234 mpi_request.ReplyDescriptorPostQueueDepth =
@@ -3243,25 +3236,17 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
3243 mpi_request.ReplyFreeQueueDepth = 3236 mpi_request.ReplyFreeQueueDepth =
3244 cpu_to_le16(ioc->reply_free_queue_depth); 3237 cpu_to_le16(ioc->reply_free_queue_depth);
3245 3238
3246#if BITS_PER_LONG > 32
3247 mpi_request.SenseBufferAddressHigh = 3239 mpi_request.SenseBufferAddressHigh =
3248 cpu_to_le32(ioc->sense_dma >> 32); 3240 cpu_to_le32((u64)ioc->sense_dma >> 32);
3249 mpi_request.SystemReplyAddressHigh = 3241 mpi_request.SystemReplyAddressHigh =
3250 cpu_to_le32(ioc->reply_dma >> 32); 3242 cpu_to_le32((u64)ioc->reply_dma >> 32);
3251 mpi_request.SystemRequestFrameBaseAddress = 3243 mpi_request.SystemRequestFrameBaseAddress =
3252 cpu_to_le64(ioc->request_dma); 3244 cpu_to_le64((u64)ioc->request_dma);
3253 mpi_request.ReplyFreeQueueAddress = 3245 mpi_request.ReplyFreeQueueAddress =
3254 cpu_to_le64(ioc->reply_free_dma); 3246 cpu_to_le64((u64)ioc->reply_free_dma);
3255 mpi_request.ReplyDescriptorPostQueueAddress = 3247 mpi_request.ReplyDescriptorPostQueueAddress =
3256 cpu_to_le64(ioc->reply_post_free_dma); 3248 cpu_to_le64((u64)ioc->reply_post_free_dma);
3257#else 3249
3258 mpi_request.SystemRequestFrameBaseAddress =
3259 cpu_to_le32(ioc->request_dma);
3260 mpi_request.ReplyFreeQueueAddress =
3261 cpu_to_le32(ioc->reply_free_dma);
3262 mpi_request.ReplyDescriptorPostQueueAddress =
3263 cpu_to_le32(ioc->reply_post_free_dma);
3264#endif
3265 3250
3266 /* This time stamp specifies number of milliseconds 3251 /* This time stamp specifies number of milliseconds
3267 * since epoch ~ midnight January 1, 1970. 3252 * since epoch ~ midnight January 1, 1970.
@@ -3271,10 +3256,10 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
3271 (current_time.tv_usec / 1000)); 3256 (current_time.tv_usec / 1000));
3272 3257
3273 if (ioc->logging_level & MPT_DEBUG_INIT) { 3258 if (ioc->logging_level & MPT_DEBUG_INIT) {
3274 u32 *mfp; 3259 __le32 *mfp;
3275 int i; 3260 int i;
3276 3261
3277 mfp = (u32 *)&mpi_request; 3262 mfp = (__le32 *)&mpi_request;
3278 printk(KERN_INFO "\toffset:data\n"); 3263 printk(KERN_INFO "\toffset:data\n");
3279 for (i = 0; i < sizeof(Mpi2IOCInitRequest_t)/4; i++) 3264 for (i = 0; i < sizeof(Mpi2IOCInitRequest_t)/4; i++)
3280 printk(KERN_INFO "\t[0x%02x]:%08x\n", i*4, 3265 printk(KERN_INFO "\t[0x%02x]:%08x\n", i*4,
@@ -3759,7 +3744,7 @@ _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
3759 3744
3760 /* initialize Reply Post Free Queue */ 3745 /* initialize Reply Post Free Queue */
3761 for (i = 0; i < ioc->reply_post_queue_depth; i++) 3746 for (i = 0; i < ioc->reply_post_queue_depth; i++)
3762 ioc->reply_post_free[i].Words = ULLONG_MAX; 3747 ioc->reply_post_free[i].Words = cpu_to_le64(ULLONG_MAX);
3763 3748
3764 r = _base_send_ioc_init(ioc, sleep_flag); 3749 r = _base_send_ioc_init(ioc, sleep_flag);
3765 if (r) 3750 if (r)
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h
index dcc289c25459..451dc1ce2287 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -541,6 +541,53 @@ struct _tr_list {
541 541
542typedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr); 542typedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr);
543 543
544/* IOC Facts and Port Facts converted from little endian to cpu */
545union mpi2_version_union {
546 MPI2_VERSION_STRUCT Struct;
547 u32 Word;
548};
549
550struct mpt2sas_facts {
551 u16 MsgVersion;
552 u16 HeaderVersion;
553 u8 IOCNumber;
554 u8 VP_ID;
555 u8 VF_ID;
556 u16 IOCExceptions;
557 u16 IOCStatus;
558 u32 IOCLogInfo;
559 u8 MaxChainDepth;
560 u8 WhoInit;
561 u8 NumberOfPorts;
562 u8 MaxMSIxVectors;
563 u16 RequestCredit;
564 u16 ProductID;
565 u32 IOCCapabilities;
566 union mpi2_version_union FWVersion;
567 u16 IOCRequestFrameSize;
568 u16 Reserved3;
569 u16 MaxInitiators;
570 u16 MaxTargets;
571 u16 MaxSasExpanders;
572 u16 MaxEnclosures;
573 u16 ProtocolFlags;
574 u16 HighPriorityCredit;
575 u16 MaxReplyDescriptorPostQueueDepth;
576 u8 ReplyFrameSize;
577 u8 MaxVolumes;
578 u16 MaxDevHandle;
579 u16 MaxPersistentEntries;
580 u16 MinDevHandle;
581};
582
583struct mpt2sas_port_facts {
584 u8 PortNumber;
585 u8 VP_ID;
586 u8 VF_ID;
587 u8 PortType;
588 u16 MaxPostedCmdBuffers;
589};
590
544/** 591/**
545 * struct MPT2SAS_ADAPTER - per adapter struct 592 * struct MPT2SAS_ADAPTER - per adapter struct
546 * @list: ioc_list 593 * @list: ioc_list
@@ -749,8 +796,8 @@ struct MPT2SAS_ADAPTER {
749 u32 event_masks[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS]; 796 u32 event_masks[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
750 797
751 /* static config pages */ 798 /* static config pages */
752 Mpi2IOCFactsReply_t facts; 799 struct mpt2sas_facts facts;
753 Mpi2PortFactsReply_t *pfacts; 800 struct mpt2sas_port_facts *pfacts;
754 Mpi2ManufacturingPage0_t manu_pg0; 801 Mpi2ManufacturingPage0_t manu_pg0;
755 Mpi2BiosPage2_t bios_pg2; 802 Mpi2BiosPage2_t bios_pg2;
756 Mpi2BiosPage3_t bios_pg3; 803 Mpi2BiosPage3_t bios_pg3;
@@ -840,7 +887,7 @@ struct MPT2SAS_ADAPTER {
840 887
841 /* reply free queue */ 888 /* reply free queue */
842 u16 reply_free_queue_depth; 889 u16 reply_free_queue_depth;
843 u32 *reply_free; 890 __le32 *reply_free;
844 dma_addr_t reply_free_dma; 891 dma_addr_t reply_free_dma;
845 struct dma_pool *reply_free_dma_pool; 892 struct dma_pool *reply_free_dma_pool;
846 u32 reply_free_host_index; 893 u32 reply_free_host_index;
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
index 437c2d94c45a..d1c3bba7e936 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
@@ -2706,13 +2706,13 @@ static DEVICE_ATTR(ioc_reset_count, S_IRUGO,
2706 _ctl_ioc_reset_count_show, NULL); 2706 _ctl_ioc_reset_count_show, NULL);
2707 2707
2708struct DIAG_BUFFER_START { 2708struct DIAG_BUFFER_START {
2709 u32 Size; 2709 __le32 Size;
2710 u32 DiagVersion; 2710 __le32 DiagVersion;
2711 u8 BufferType; 2711 u8 BufferType;
2712 u8 Reserved[3]; 2712 u8 Reserved[3];
2713 u32 Reserved1; 2713 __le32 Reserved1;
2714 u32 Reserved2; 2714 __le32 Reserved2;
2715 u32 Reserved3; 2715 __le32 Reserved3;
2716}; 2716};
2717/** 2717/**
2718 * _ctl_host_trace_buffer_size_show - host buffer size (trace only) 2718 * _ctl_host_trace_buffer_size_show - host buffer size (trace only)
diff --git a/drivers/scsi/mpt2sas/mpt2sas_debug.h b/drivers/scsi/mpt2sas/mpt2sas_debug.h
index 3dcddfeb6f4c..9731f8e661bf 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_debug.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_debug.h
@@ -164,7 +164,7 @@ static inline void
164_debug_dump_mf(void *mpi_request, int sz) 164_debug_dump_mf(void *mpi_request, int sz)
165{ 165{
166 int i; 166 int i;
167 u32 *mfp = (u32 *)mpi_request; 167 __le32 *mfp = (__le32 *)mpi_request;
168 168
169 printk(KERN_INFO "mf:\n\t"); 169 printk(KERN_INFO "mf:\n\t");
170 for (i = 0; i < sz; i++) { 170 for (i = 0; i < sz; i++) {
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index a7dbc6825f5f..e327a3c03608 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -1956,7 +1956,7 @@ _scsih_slave_configure(struct scsi_device *sdev)
1956 case MPI2_RAID_VOL_TYPE_RAID1E: 1956 case MPI2_RAID_VOL_TYPE_RAID1E:
1957 qdepth = MPT2SAS_RAID_QUEUE_DEPTH; 1957 qdepth = MPT2SAS_RAID_QUEUE_DEPTH;
1958 if (ioc->manu_pg10.OEMIdentifier && 1958 if (ioc->manu_pg10.OEMIdentifier &&
1959 (ioc->manu_pg10.GenericFlags0 & 1959 (le32_to_cpu(ioc->manu_pg10.GenericFlags0) &
1960 MFG10_GF0_R10_DISPLAY) && 1960 MFG10_GF0_R10_DISPLAY) &&
1961 !(raid_device->num_pds % 2)) 1961 !(raid_device->num_pds % 2))
1962 r_level = "RAID10"; 1962 r_level = "RAID10";
@@ -4598,7 +4598,7 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)
4598 Mpi2SasEnclosurePage0_t enclosure_pg0; 4598 Mpi2SasEnclosurePage0_t enclosure_pg0;
4599 u32 ioc_status; 4599 u32 ioc_status;
4600 u16 parent_handle; 4600 u16 parent_handle;
4601 __le64 sas_address, sas_address_parent = 0; 4601 u64 sas_address, sas_address_parent = 0;
4602 int i; 4602 int i;
4603 unsigned long flags; 4603 unsigned long flags;
4604 struct _sas_port *mpt2sas_port = NULL; 4604 struct _sas_port *mpt2sas_port = NULL;
@@ -5404,7 +5404,7 @@ _scsih_sas_device_status_change_event(struct MPT2SAS_ADAPTER *ioc,
5404{ 5404{
5405 struct MPT2SAS_TARGET *target_priv_data; 5405 struct MPT2SAS_TARGET *target_priv_data;
5406 struct _sas_device *sas_device; 5406 struct _sas_device *sas_device;
5407 __le64 sas_address; 5407 u64 sas_address;
5408 unsigned long flags; 5408 unsigned long flags;
5409 Mpi2EventDataSasDeviceStatusChange_t *event_data = 5409 Mpi2EventDataSasDeviceStatusChange_t *event_data =
5410 fw_event->event_data; 5410 fw_event->event_data;
@@ -6566,7 +6566,7 @@ _scsih_search_responding_expanders(struct MPT2SAS_ADAPTER *ioc)
6566 Mpi2ExpanderPage0_t expander_pg0; 6566 Mpi2ExpanderPage0_t expander_pg0;
6567 Mpi2ConfigReply_t mpi_reply; 6567 Mpi2ConfigReply_t mpi_reply;
6568 u16 ioc_status; 6568 u16 ioc_status;
6569 __le64 sas_address; 6569 u64 sas_address;
6570 u16 handle; 6570 u16 handle;
6571 6571
6572 printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, __func__); 6572 printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, __func__);
@@ -7505,7 +7505,7 @@ _scsih_suspend(struct pci_dev *pdev, pm_message_t state)
7505{ 7505{
7506 struct Scsi_Host *shost = pci_get_drvdata(pdev); 7506 struct Scsi_Host *shost = pci_get_drvdata(pdev);
7507 struct MPT2SAS_ADAPTER *ioc = shost_priv(shost); 7507 struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
7508 u32 device_state; 7508 pci_power_t device_state;
7509 7509
7510 mpt2sas_base_stop_watchdog(ioc); 7510 mpt2sas_base_stop_watchdog(ioc);
7511 scsi_block_requests(shost); 7511 scsi_block_requests(shost);
@@ -7532,7 +7532,7 @@ _scsih_resume(struct pci_dev *pdev)
7532{ 7532{
7533 struct Scsi_Host *shost = pci_get_drvdata(pdev); 7533 struct Scsi_Host *shost = pci_get_drvdata(pdev);
7534 struct MPT2SAS_ADAPTER *ioc = shost_priv(shost); 7534 struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
7535 u32 device_state = pdev->current_state; 7535 pci_power_t device_state = pdev->current_state;
7536 int r; 7536 int r;
7537 7537
7538 printk(MPT2SAS_INFO_FMT "pdev=0x%p, slot=%s, previous " 7538 printk(MPT2SAS_INFO_FMT "pdev=0x%p, slot=%s, previous "
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c
index cb1cdecbe0f8..15c798026217 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_transport.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c
@@ -299,7 +299,6 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc,
299 void *data_out = NULL; 299 void *data_out = NULL;
300 dma_addr_t data_out_dma; 300 dma_addr_t data_out_dma;
301 u32 sz; 301 u32 sz;
302 u64 *sas_address_le;
303 u16 wait_state_count; 302 u16 wait_state_count;
304 303
305 if (ioc->shost_recovery || ioc->pci_error_recovery) { 304 if (ioc->shost_recovery || ioc->pci_error_recovery) {
@@ -372,8 +371,7 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc,
372 mpi_request->PhysicalPort = 0xFF; 371 mpi_request->PhysicalPort = 0xFF;
373 mpi_request->VF_ID = 0; /* TODO */ 372 mpi_request->VF_ID = 0; /* TODO */
374 mpi_request->VP_ID = 0; 373 mpi_request->VP_ID = 0;
375 sas_address_le = (u64 *)&mpi_request->SASAddress; 374 mpi_request->SASAddress = cpu_to_le64(sas_address);
376 *sas_address_le = cpu_to_le64(sas_address);
377 mpi_request->RequestDataLength = 375 mpi_request->RequestDataLength =
378 cpu_to_le16(sizeof(struct rep_manu_request)); 376 cpu_to_le16(sizeof(struct rep_manu_request));
379 psge = &mpi_request->SGL; 377 psge = &mpi_request->SGL;
@@ -1049,14 +1047,14 @@ struct phy_error_log_reply{
1049 u8 function; /* 0x11 */ 1047 u8 function; /* 0x11 */
1050 u8 function_result; 1048 u8 function_result;
1051 u8 response_length; 1049 u8 response_length;
1052 u16 expander_change_count; 1050 __be16 expander_change_count;
1053 u8 reserved_1[3]; 1051 u8 reserved_1[3];
1054 u8 phy_identifier; 1052 u8 phy_identifier;
1055 u8 reserved_2[2]; 1053 u8 reserved_2[2];
1056 u32 invalid_dword; 1054 __be32 invalid_dword;
1057 u32 running_disparity_error; 1055 __be32 running_disparity_error;
1058 u32 loss_of_dword_sync; 1056 __be32 loss_of_dword_sync;
1059 u32 phy_reset_problem; 1057 __be32 phy_reset_problem;
1060}; 1058};
1061 1059
1062/** 1060/**
@@ -1085,7 +1083,6 @@ _transport_get_expander_phy_error_log(struct MPT2SAS_ADAPTER *ioc,
1085 void *data_out = NULL; 1083 void *data_out = NULL;
1086 dma_addr_t data_out_dma; 1084 dma_addr_t data_out_dma;
1087 u32 sz; 1085 u32 sz;
1088 u64 *sas_address_le;
1089 u16 wait_state_count; 1086 u16 wait_state_count;
1090 1087
1091 if (ioc->shost_recovery || ioc->pci_error_recovery) { 1088 if (ioc->shost_recovery || ioc->pci_error_recovery) {
@@ -1160,8 +1157,7 @@ _transport_get_expander_phy_error_log(struct MPT2SAS_ADAPTER *ioc,
1160 mpi_request->PhysicalPort = 0xFF; 1157 mpi_request->PhysicalPort = 0xFF;
1161 mpi_request->VF_ID = 0; /* TODO */ 1158 mpi_request->VF_ID = 0; /* TODO */
1162 mpi_request->VP_ID = 0; 1159 mpi_request->VP_ID = 0;
1163 sas_address_le = (u64 *)&mpi_request->SASAddress; 1160 mpi_request->SASAddress = cpu_to_le64(phy->identify.sas_address);
1164 *sas_address_le = cpu_to_le64(phy->identify.sas_address);
1165 mpi_request->RequestDataLength = 1161 mpi_request->RequestDataLength =
1166 cpu_to_le16(sizeof(struct phy_error_log_request)); 1162 cpu_to_le16(sizeof(struct phy_error_log_request));
1167 psge = &mpi_request->SGL; 1163 psge = &mpi_request->SGL;
@@ -1406,7 +1402,6 @@ _transport_expander_phy_control(struct MPT2SAS_ADAPTER *ioc,
1406 void *data_out = NULL; 1402 void *data_out = NULL;
1407 dma_addr_t data_out_dma; 1403 dma_addr_t data_out_dma;
1408 u32 sz; 1404 u32 sz;
1409 u64 *sas_address_le;
1410 u16 wait_state_count; 1405 u16 wait_state_count;
1411 1406
1412 if (ioc->shost_recovery) { 1407 if (ioc->shost_recovery) {
@@ -1486,8 +1481,7 @@ _transport_expander_phy_control(struct MPT2SAS_ADAPTER *ioc,
1486 mpi_request->PhysicalPort = 0xFF; 1481 mpi_request->PhysicalPort = 0xFF;
1487 mpi_request->VF_ID = 0; /* TODO */ 1482 mpi_request->VF_ID = 0; /* TODO */
1488 mpi_request->VP_ID = 0; 1483 mpi_request->VP_ID = 0;
1489 sas_address_le = (u64 *)&mpi_request->SASAddress; 1484 mpi_request->SASAddress = cpu_to_le64(phy->identify.sas_address);
1490 *sas_address_le = cpu_to_le64(phy->identify.sas_address);
1491 mpi_request->RequestDataLength = 1485 mpi_request->RequestDataLength =
1492 cpu_to_le16(sizeof(struct phy_error_log_request)); 1486 cpu_to_le16(sizeof(struct phy_error_log_request));
1493 psge = &mpi_request->SGL; 1487 psge = &mpi_request->SGL;
@@ -1914,7 +1908,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
1914 mpi_request->PhysicalPort = 0xFF; 1908 mpi_request->PhysicalPort = 0xFF;
1915 mpi_request->VF_ID = 0; /* TODO */ 1909 mpi_request->VF_ID = 0; /* TODO */
1916 mpi_request->VP_ID = 0; 1910 mpi_request->VP_ID = 0;
1917 *((u64 *)&mpi_request->SASAddress) = (rphy) ? 1911 mpi_request->SASAddress = (rphy) ?
1918 cpu_to_le64(rphy->identify.sas_address) : 1912 cpu_to_le64(rphy->identify.sas_address) :
1919 cpu_to_le64(ioc->sas_hba.sas_address); 1913 cpu_to_le64(ioc->sas_hba.sas_address);
1920 mpi_request->RequestDataLength = cpu_to_le16(blk_rq_bytes(req) - 4); 1914 mpi_request->RequestDataLength = cpu_to_le16(blk_rq_bytes(req) - 4);