History

Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI updates from James Bottomley: "This is mostly updates of the usual drivers: UFS, esp_scsi, NCR5380, qla2xxx, lpfc, libsas, hisi_sas. In addition there's a set of mostly small updates to the target subsystem a set of conversions to the generic DMA API, which do have some potential for issues in the older drivers but we'll handle those as case by case fixes. A new myrs driver for the DAC960/mylex raid controllers to replace the block based DAC960 which is also being removed by Jens in this merge window. Plus the usual slew of trivial changes" [ "myrs" stands for "MYlex Raid Scsi". Obviously. Silly of me to even wonder. There's also a "myrb" driver, where the 'b' stands for 'block'. Truly, somebody has got mad naming skillz. - Linus ] * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (237 commits) scsi: myrs: Fix the processor absent message in processor_show() scsi: myrs: Fix a logical vs bitwise bug scsi: hisi_sas: Fix NULL pointer dereference scsi: myrs: fix build failure on 32 bit scsi: fnic: replace gross legacy tag hack with blk-mq hack scsi: mesh: switch to generic DMA API scsi: ips: switch to generic DMA API scsi: smartpqi: fully convert to the generic DMA API scsi: vmw_pscsi: switch to generic DMA API scsi: snic: switch to generic DMA API scsi: qla4xxx: fully convert to the generic DMA API scsi: qla2xxx: fully convert to the generic DMA API scsi: qla1280: switch to generic DMA API scsi: qedi: fully convert to the generic DMA API scsi: qedf: fully convert to the generic DMA API scsi: pm8001: switch to generic DMA API scsi: nsp32: switch to generic DMA API scsi: mvsas: fully convert to the generic DMA API scsi: mvumi: switch to generic DMA API scsi: mpt3sas: switch to generic DMA API ...

Linus Torvalds committed 8 years ago

Commit d49f8a52 parents bd6bf7c a0db8a7200 files · +16045 −5954Browse files

Unified · Split

200 files
  1. Documentation/scsi/ufs.txt +20 −0
  2. MAINTAINERS +8 −1
  3. drivers/message/fusion/lsi/mpi_cnfg.h +1 −1
  4. drivers/message/fusion/mptbase.c +6 −6
  5. drivers/message/fusion/mptsas.c +4 −4
  6. drivers/scsi/3w-9xxx.c +24 −26
  7. drivers/scsi/3w-sas.c +17 −21
  8. drivers/scsi/3w-xxxx.c +14 −6
  9. drivers/scsi/3w-xxxx.h +0 −1
  10. drivers/scsi/53c700.h +1 −1
  11. drivers/scsi/BusLogic.c +19 −17
  12. drivers/scsi/FlashPoint.c +3 −3
  13. drivers/scsi/Kconfig +35 −0
  14. drivers/scsi/Makefile +2 −0
  15. drivers/scsi/NCR5380.c +100 −67
  16. drivers/scsi/NCR5380.h +1 −1
  17. drivers/scsi/a100u2w.c +13 −7
  18. drivers/scsi/aacraid/aachba.c +0 −7
  19. drivers/scsi/aacraid/commsup.c +0 −2
  20. drivers/scsi/advansys.c +1 −3
  21. drivers/scsi/aic7xxx/aic7770.c +0 −6
  22. drivers/scsi/aic7xxx/aic79xx.h +0 −6
  23. drivers/scsi/aic7xxx/aic79xx_core.c +0 −44
  24. drivers/scsi/aic7xxx/aic79xx_pci.c +0 −8
  25. drivers/scsi/aic7xxx/aic7xxx.h +0 −6
  26. drivers/scsi/aic7xxx/aic7xxx_93cx6.c +0 −6
  27. drivers/scsi/aic7xxx/aic7xxx_core.c +1 −40
  28. drivers/scsi/aic7xxx/aic7xxx_pci.c +0 −7
  29. drivers/scsi/aic7xxx/aicasm/aicasm.h +0 −4
  30. drivers/scsi/aic7xxx/aicasm/aicasm_gram.y +0 −4
  31. drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y +0 −4
  32. drivers/scsi/aic7xxx/aicasm/aicasm_macro_scan.l +0 −4
  33. drivers/scsi/aic7xxx/aicasm/aicasm_scan.l +0 −4
  34. drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c +0 −4
  35. drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h +0 −4
  36. drivers/scsi/aic94xx/aic94xx_init.c +2 −7
  37. drivers/scsi/aic94xx/aic94xx_scb.c +5 −0
  38. drivers/scsi/aic94xx/aic94xx_task.c +23 −23
  39. drivers/scsi/am53c974.c +12 −42
  40. drivers/scsi/arcmsr/arcmsr_hba.c +13 −16
  41. drivers/scsi/atp870u.c +3 −3
  42. drivers/scsi/be2iscsi/be_cmds.c +5 −5
  43. drivers/scsi/be2iscsi/be_iscsi.c +8 −7
  44. drivers/scsi/be2iscsi/be_main.c +31 −43
  45. drivers/scsi/be2iscsi/be_mgmt.c +15 −12
  46. drivers/scsi/bfa/bfa_defs_svc.h +1 −1
  47. drivers/scsi/bfa/bfa_fcbuild.c +0 −108
  48. drivers/scsi/bfa/bfa_fcbuild.h +0 −9
  49. drivers/scsi/bfa/bfad_im.h +1 −1
  50. drivers/scsi/bnx2fc/bnx2fc_fcoe.c +0 −3
  51. drivers/scsi/csiostor/csio_init.c +2 −5
  52. drivers/scsi/csiostor/csio_lnode.c +3 −3
  53. drivers/scsi/csiostor/csio_scsi.c +6 −6
  54. drivers/scsi/csiostor/csio_wr.c +9 −8
  55. drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +153 −1
  56. drivers/scsi/cxgbi/libcxgbi.h +3 −0
  57. drivers/scsi/dc395x.c +43 −148
  58. drivers/scsi/esp_scsi.c +203 −83
  59. drivers/scsi/esp_scsi.h +14 −24
  60. drivers/scsi/fnic/fnic_fcs.c +18 −23
  61. drivers/scsi/fnic/fnic_main.c +2 −17
  62. drivers/scsi/fnic/fnic_scsi.c +28 −71
  63. drivers/scsi/fnic/vnic_dev.c +13 −13
  64. drivers/scsi/hisi_sas/hisi_sas.h +2 −1
  65. drivers/scsi/hisi_sas/hisi_sas_main.c +113 −48
  66. drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +0 −1
  67. drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +9 −6
  68. drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +10 −5
  69. drivers/scsi/hpsa.c +73 −75
  70. drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +0 −1
  71. drivers/scsi/ips.c +42 −39
  72. drivers/scsi/isci/host.c +4 −4
  73. drivers/scsi/isci/host.h +1 −1
  74. drivers/scsi/isci/request.c +2 −2
  75. drivers/scsi/isci/task.c +2 −2
  76. drivers/scsi/iscsi_tcp.c +2 −1
  77. drivers/scsi/jazz_esp.c +1 −29
  78. drivers/scsi/libfc/fc_fcp.c +1 −5
  79. drivers/scsi/libfc/fc_rport.c +16 −6
  80. drivers/scsi/libsas/sas_ata.c +1 −1
  81. drivers/scsi/libsas/sas_discover.c +1 −1
  82. drivers/scsi/libsas/sas_expander.c +9 −13
  83. drivers/scsi/lpfc/lpfc.h +28 −1
  84. drivers/scsi/lpfc/lpfc_attr.c +106 −5
  85. drivers/scsi/lpfc/lpfc_bsg.c +339 −5
  86. drivers/scsi/lpfc/lpfc_bsg.h +36 −0
  87. drivers/scsi/lpfc/lpfc_crtn.h +7 −0
  88. drivers/scsi/lpfc/lpfc_ct.c +3 −8
  89. drivers/scsi/lpfc/lpfc_debugfs.c +0 −2
  90. drivers/scsi/lpfc/lpfc_els.c +3 −0
  91. drivers/scsi/lpfc/lpfc_hbadisc.c +4 −6
  92. drivers/scsi/lpfc/lpfc_hw4.h +45 −0
  93. drivers/scsi/lpfc/lpfc_init.c +83 −20
  94. drivers/scsi/lpfc/lpfc_nportdisc.c +3 −0
  95. drivers/scsi/lpfc/lpfc_nvme.c +5 −14
  96. drivers/scsi/lpfc/lpfc_nvmet.c +6 −14
  97. drivers/scsi/lpfc/lpfc_scsi.c +22 −12
  98. drivers/scsi/lpfc/lpfc_sli.c +297 −13
  99. drivers/scsi/lpfc/lpfc_sli4.h +1 −0
  100. drivers/scsi/lpfc/lpfc_version.h +1 −1
  101. drivers/scsi/lpfc/lpfc_vport.c +7 −7
  102. drivers/scsi/mac_esp.c +11 −206
  103. drivers/scsi/megaraid/megaraid_mbox.c +28 −89
  104. drivers/scsi/megaraid/megaraid_mbox.h +1 −1
  105. drivers/scsi/megaraid/megaraid_sas_base.c +78 −75
  106. drivers/scsi/megaraid/megaraid_sas_fusion.c +8 −8
  107. drivers/scsi/mesh.c +4 −4
  108. drivers/scsi/mpt3sas/mpt3sas_base.c +524 −665
  109. drivers/scsi/mpt3sas/mpt3sas_base.h +8 −1
  110. drivers/scsi/mpt3sas/mpt3sas_config.c +35 −54
  111. drivers/scsi/mpt3sas/mpt3sas_ctl.c +226 −301
  112. drivers/scsi/mpt3sas/mpt3sas_scsih.c +652 −835
  113. drivers/scsi/mpt3sas/mpt3sas_transport.c +159 −196
  114. drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c +50 −51
  115. drivers/scsi/mpt3sas/mpt3sas_warpdrive.c +27 −43
  116. drivers/scsi/mvsas/mv_init.c +3 −18
  117. drivers/scsi/mvsas/mv_sas.c +6 −6
  118. drivers/scsi/mvumi.c +36 −53
  119. drivers/scsi/myrb.c +3656 −0
  120. drivers/scsi/myrb.h +958 −0
  121. drivers/scsi/myrs.c +3268 −0
  122. drivers/scsi/myrs.h +1134 −0
  123. drivers/scsi/nsp32.c +10 −8
  124. drivers/scsi/osd/osd_initiator.c +1 −1
  125. drivers/scsi/pm8001/pm8001_defs.h +8 −0
  126. drivers/scsi/pm8001/pm8001_hwi.c +19 −12
  127. drivers/scsi/pm8001/pm8001_hwi.h +0 −4
  128. drivers/scsi/pm8001/pm8001_init.c +7 −24
  129. drivers/scsi/pm8001/pm8001_sas.c +37 −12
  130. drivers/scsi/pm8001/pm8001_sas.h +2 −1
  131. drivers/scsi/pm8001/pm80xx_hwi.c +94 −25
  132. drivers/scsi/pm8001/pm80xx_hwi.h +7 −2
  133. drivers/scsi/qedf/qedf_main.c +4 −4
  134. drivers/scsi/qedi/qedi_main.c +4 −4
  135. drivers/scsi/qla1280.c +13 −13
  136. drivers/scsi/qla2xxx/qla_attr.c +569 −18
  137. drivers/scsi/qla2xxx/qla_bsg.c +1 −1
  138. drivers/scsi/qla2xxx/qla_def.h +23 −9
  139. drivers/scsi/qla2xxx/qla_gbl.h +9 −8
  140. drivers/scsi/qla2xxx/qla_gs.c +143 −393
  141. drivers/scsi/qla2xxx/qla_init.c +257 −155
  142. drivers/scsi/qla2xxx/qla_inline.h +12 −11
  143. drivers/scsi/qla2xxx/qla_iocb.c +13 −30
  144. drivers/scsi/qla2xxx/qla_isr.c +44 −40
  145. drivers/scsi/qla2xxx/qla_mbx.c +38 −14
  146. drivers/scsi/qla2xxx/qla_nvme.c +2 −5
  147. drivers/scsi/qla2xxx/qla_nx.c +2 −2
  148. drivers/scsi/qla2xxx/qla_os.c +210 −107
  149. drivers/scsi/qla2xxx/qla_target.c +374 −168
  150. drivers/scsi/qla2xxx/qla_target.h +7 −1
  151. drivers/scsi/qla2xxx/qla_version.h +1 −1
  152. drivers/scsi/qla2xxx/tcm_qla2xxx.c +43 −8
  153. drivers/scsi/qla4xxx/ql4_init.c +4 −6
  154. drivers/scsi/qla4xxx/ql4_os.c +8 −17
  155. drivers/scsi/raid_class.c +1 −3
  156. drivers/scsi/scsi_error.c +0 −3
  157. drivers/scsi/scsi_lib.c +3 −2
  158. drivers/scsi/scsi_transport_sas.c +0 −2
  159. drivers/scsi/sg.c +1 −1
  160. drivers/scsi/smartpqi/smartpqi_init.c +42 −58
  161. drivers/scsi/smartpqi/smartpqi_sis.c +5 −6
  162. drivers/scsi/snic/snic_disc.c +4 −3
  163. drivers/scsi/snic/snic_io.c +13 −12
  164. drivers/scsi/snic/snic_main.c +2 −22
  165. drivers/scsi/snic/snic_scsi.c +7 −8
  166. drivers/scsi/snic/vnic_dev.c +14 −15
  167. drivers/scsi/sun3x_esp.c +1 −29
  168. drivers/scsi/sun_esp.c +11 −50
  169. drivers/scsi/sym53c8xx_2/sym_hipd.c +11 −4
  170. drivers/scsi/ufs/Kconfig +19 −0
  171. drivers/scsi/ufs/Makefile +2 −1
  172. drivers/scsi/ufs/ufs-qcom.c +28 −26
  173. drivers/scsi/ufs/ufs.h +3 −91
  174. drivers/scsi/ufs/ufs_bsg.c +210 −0
  175. drivers/scsi/ufs/ufs_bsg.h +23 −0
  176. drivers/scsi/ufs/ufshcd.c +289 −142
  177. drivers/scsi/ufs/ufshcd.h +12 −0
  178. drivers/scsi/ufs/ufshci.h +14 −11
  179. drivers/scsi/vmw_pvscsi.c +38 −39
  180. drivers/scsi/zorro_esp.c +36 −254
  181. drivers/target/iscsi/cxgbit/cxgbit_cm.c +20 −3
  182. drivers/target/iscsi/iscsi_target.c +1 −1
  183. drivers/target/iscsi/iscsi_target_erl0.c +1 −14
  184. drivers/target/iscsi/iscsi_target_erl1.c +12 −5
  185. drivers/target/iscsi/iscsi_target_erl2.c +1 −1
  186. drivers/target/iscsi/iscsi_target_erl2.h +1 −1
  187. drivers/target/iscsi/iscsi_target_login.c +1 −1
  188. drivers/target/iscsi/iscsi_target_stat.c +2 −2
  189. drivers/target/iscsi/iscsi_target_util.c +25 −19
  190. drivers/target/iscsi/iscsi_target_util.h +1 −0
  191. drivers/target/target_core_iblock.c +39 −19
  192. drivers/target/target_core_iblock.h +0 −1
  193. drivers/target/target_core_sbc.c +10 −13
  194. drivers/target/target_core_transport.c +7 −12
  195. drivers/target/target_core_xcopy.c +0 −3
  196. include/linux/wait.h +15 −5
  197. include/target/iscsi/iscsi_target_core.h +3 −3
  198. include/target/iscsi/iscsi_target_stat.h +2 −2
  199. include/target/target_core_base.h +0 −1
  200. include/uapi/scsi/scsi_bsg_ufs.h +106 −0
Documentation/scsi/ufs.txt+20−0
@@ -128,6 +128,26 @@ The current UFSHCD implementation supports following functionality, · 127 unmodified lines
128In this version of UFSHCD Query requests and power management128In this version of UFSHCD Query requests and power management
129functionality are not implemented.129functionality are not implemented.
130 130
1314. BSG Support
132------------------
133
134This transport driver supports exchanging UFS protocol information units
135(UPIUs) with a UFS device. Typically, user space will allocate
136struct ufs_bsg_request and struct ufs_bsg_reply (see ufs_bsg.h) as
137request_upiu and reply_upiu respectively. Filling those UPIUs should
138be done in accordance with JEDEC spec UFS2.1 paragraph 10.7.
139*Caveat emptor*: The driver makes no further input validations and sends the
140UPIU to the device as it is. Open the bsg device in /dev/ufs-bsg and
141send SG_IO with the applicable sg_io_v4:
142
143 io_hdr_v4.guard = 'Q';
144 io_hdr_v4.protocol = BSG_PROTOCOL_SCSI;
145 io_hdr_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_TRANSPORT;
146 io_hdr_v4.response = (__u64)reply_upiu;
147 io_hdr_v4.max_response_len = reply_len;
148 io_hdr_v4.request_len = request_len;
149 io_hdr_v4.request = (__u64)request_upiu;
150
131UFS Specifications can be found at,151UFS Specifications can be found at,
132UFS - http://www.jedec.org/sites/default/files/docs/JESD220.pdf152UFS - http://www.jedec.org/sites/default/files/docs/JESD220.pdf
133UFSHCI - http://www.jedec.org/sites/default/files/docs/JESD223.pdf153UFSHCI - http://www.jedec.org/sites/default/files/docs/JESD223.pdf
MAINTAINERS+8−1
@@ -4055,7 +4055,7 @@ M: Uma Krishnan <ukrishn@linux.vnet.ibm.com> · 4054 unmodified lines
4055L: linux-scsi@vger.kernel.org4055L: linux-scsi@vger.kernel.org
4056S: Supported4056S: Supported
4057F: drivers/scsi/cxlflash/4057F: drivers/scsi/cxlflash/
4058F: include/uapi/scsi/cxlflash_ioctls.h4058F: include/uapi/scsi/cxlflash_ioctl.h
4059F: Documentation/powerpc/cxlflash.txt4059F: Documentation/powerpc/cxlflash.txt
4060 4060
4061CYBERPRO FB DRIVER4061CYBERPRO FB DRIVER
@@ -10011,6 +10011,13 @@ S: Supported · 5949 unmodified lines
10011F: drivers/gpu/drm/mxsfb/10011F: drivers/gpu/drm/mxsfb/
10012F: Documentation/devicetree/bindings/display/mxsfb.txt10012F: Documentation/devicetree/bindings/display/mxsfb.txt
10013 10013
10014MYLEX DAC960 PCI RAID Controller
10015M: Hannes Reinecke <hare@kernel.org>
10016L: linux-scsi@vger.kernel.org
10017S: Supported
10018F: drivers/scsi/myrb.*
10019F: drivers/scsi/myrs.*
10020
10014MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)10021MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
10015M: Chris Lee <christopher.lee@cspi.com>10022M: Chris Lee <christopher.lee@cspi.com>
10016L: netdev@vger.kernel.org10023L: netdev@vger.kernel.org
drivers/message/fusion/lsi/mpi_cnfg.h+1−1
@@ -2004,7 +2004,7 @@ typedef struct _CONFIG_PAGE_FC_PORT_6 · 2003 unmodified lines
2004 U64 LinkFailureCount; /* 50h */2004 U64 LinkFailureCount; /* 50h */
2005 U64 LossOfSyncCount; /* 58h */2005 U64 LossOfSyncCount; /* 58h */
2006 U64 LossOfSignalCount; /* 60h */2006 U64 LossOfSignalCount; /* 60h */
2007 U64 PrimativeSeqErrCount; /* 68h */2007 U64 PrimitiveSeqErrCount; /* 68h */
2008 U64 InvalidTxWordCount; /* 70h */2008 U64 InvalidTxWordCount; /* 70h */
2009 U64 InvalidCrcCount; /* 78h */2009 U64 InvalidCrcCount; /* 78h */
2010 U64 FcpInitiatorIoCount; /* 80h */2010 U64 FcpInitiatorIoCount; /* 80h */
drivers/message/fusion/mptbase.c+6−6
@@ -335,11 +335,11 @@ static int mpt_remove_dead_ioc_func(void *arg) · 334 unmodified lines
335 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;335 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;
336 struct pci_dev *pdev;336 struct pci_dev *pdev;
337 337
338 if ((ioc == NULL))338 if (!ioc)
339 return -1;339 return -1;
340 340
341 pdev = ioc->pcidev;341 pdev = ioc->pcidev;
342 if ((pdev == NULL))342 if (!pdev)
343 return -1;343 return -1;
344 344
345 pci_stop_and_remove_bus_device_locked(pdev);345 pci_stop_and_remove_bus_device_locked(pdev);
@@ -7570,11 +7570,11 @@ mpt_display_event_info(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply) · 7224 unmodified lines
7570 u8 phy_num = (u8)(evData0);7570 u8 phy_num = (u8)(evData0);
7571 u8 port_num = (u8)(evData0 >> 8);7571 u8 port_num = (u8)(evData0 >> 8);
7572 u8 port_width = (u8)(evData0 >> 16);7572 u8 port_width = (u8)(evData0 >> 16);
7573 u8 primative = (u8)(evData0 >> 24);7573 u8 primitive = (u8)(evData0 >> 24);
7574 snprintf(evStr, EVENT_DESCR_STR_SZ,7574 snprintf(evStr, EVENT_DESCR_STR_SZ,
7575 "SAS Broadcase Primative: phy=%d port=%d "7575 "SAS Broadcast Primitive: phy=%d port=%d "
7576 "width=%d primative=0x%02x",7576 "width=%d primitive=0x%02x",
7577 phy_num, port_num, port_width, primative);7577 phy_num, port_num, port_width, primitive);
7578 break;7578 break;
7579 }7579 }
7580 7580
drivers/message/fusion/mptsas.c+4−4
@@ -129,7 +129,7 @@ static void mptsas_expander_delete(MPT_ADAPTER *ioc, · 128 unmodified lines
129static void mptsas_send_expander_event(struct fw_event_work *fw_event);129static void mptsas_send_expander_event(struct fw_event_work *fw_event);
130static void mptsas_not_responding_devices(MPT_ADAPTER *ioc);130static void mptsas_not_responding_devices(MPT_ADAPTER *ioc);
131static void mptsas_scan_sas_topology(MPT_ADAPTER *ioc);131static void mptsas_scan_sas_topology(MPT_ADAPTER *ioc);
132static void mptsas_broadcast_primative_work(struct fw_event_work *fw_event);132static void mptsas_broadcast_primitive_work(struct fw_event_work *fw_event);
133static void mptsas_handle_queue_full_event(struct fw_event_work *fw_event);133static void mptsas_handle_queue_full_event(struct fw_event_work *fw_event);
134static void mptsas_volume_delete(MPT_ADAPTER *ioc, u8 id);134static void mptsas_volume_delete(MPT_ADAPTER *ioc, u8 id);
135void mptsas_schedule_target_reset(void *ioc);135void mptsas_schedule_target_reset(void *ioc);
@@ -1665,7 +1665,7 @@ mptsas_firmware_event_work(struct work_struct *work) · 1529 unmodified lines
1665 mptsas_free_fw_event(ioc, fw_event);1665 mptsas_free_fw_event(ioc, fw_event);
1666 break;1666 break;
1667 case MPI_EVENT_SAS_BROADCAST_PRIMITIVE:1667 case MPI_EVENT_SAS_BROADCAST_PRIMITIVE:
1668 mptsas_broadcast_primative_work(fw_event);1668 mptsas_broadcast_primitive_work(fw_event);
1669 break;1669 break;
1670 case MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE:1670 case MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE:
1671 mptsas_send_expander_event(fw_event);1671 mptsas_send_expander_event(fw_event);
@@ -4826,13 +4826,13 @@ mptsas_issue_tm(MPT_ADAPTER *ioc, u8 type, u8 channel, u8 id, u64 lun, · 3154 unmodified lines
4826}4826}
4827 4827
4828/**4828/**
4829 * mptsas_broadcast_primative_work - Handle broadcast primitives4829 * mptsas_broadcast_primitive_work - Handle broadcast primitives
4830 * @work: work queue payload containing info describing the event4830 * @work: work queue payload containing info describing the event
4831 *4831 *
4832 * this will be handled in workqueue context.4832 * this will be handled in workqueue context.
4833 */4833 */
4834static void4834static void
4835mptsas_broadcast_primative_work(struct fw_event_work *fw_event)4835mptsas_broadcast_primitive_work(struct fw_event_work *fw_event)
4836{4836{
4837 MPT_ADAPTER *ioc = fw_event->ioc;4837 MPT_ADAPTER *ioc = fw_event->ioc;
4838 MPT_FRAME_HDR *mf;4838 MPT_FRAME_HDR *mf;
drivers/scsi/3w-9xxx.c+24−26
@@ -518,7 +518,8 @@ static int twa_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) · 517 unmodified lines
518 unsigned long *cpu_addr;518 unsigned long *cpu_addr;
519 int retval = 1;519 int retval = 1;
520 520
521 cpu_addr = pci_alloc_consistent(tw_dev->tw_pci_dev, size*TW_Q_LENGTH, &dma_handle);521 cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev,
522 size * TW_Q_LENGTH, &dma_handle, GFP_KERNEL);
522 if (!cpu_addr) {523 if (!cpu_addr) {
523 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed");524 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed");
524 goto out;525 goto out;
@@ -526,7 +527,8 @@ static int twa_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) · 1 unmodified line
526 527
527 if ((unsigned long)cpu_addr % (TW_ALIGNMENT_9000)) {528 if ((unsigned long)cpu_addr % (TW_ALIGNMENT_9000)) {
528 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x6, "Failed to allocate correctly aligned memory");529 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x6, "Failed to allocate correctly aligned memory");
529 pci_free_consistent(tw_dev->tw_pci_dev, size*TW_Q_LENGTH, cpu_addr, dma_handle);530 dma_free_coherent(&tw_dev->tw_pci_dev->dev, size * TW_Q_LENGTH,
531 cpu_addr, dma_handle);
530 goto out;532 goto out;
531 }533 }
532 534
@@ -1027,16 +1029,16 @@ out: · 494 unmodified lines
1027static void twa_free_device_extension(TW_Device_Extension *tw_dev)1029static void twa_free_device_extension(TW_Device_Extension *tw_dev)
1028{1030{
1029 if (tw_dev->command_packet_virt[0])1031 if (tw_dev->command_packet_virt[0])
1030 pci_free_consistent(tw_dev->tw_pci_dev,1032 dma_free_coherent(&tw_dev->tw_pci_dev->dev,
1031 sizeof(TW_Command_Full)*TW_Q_LENGTH,1033 sizeof(TW_Command_Full) * TW_Q_LENGTH,
1032 tw_dev->command_packet_virt[0],1034 tw_dev->command_packet_virt[0],
1033 tw_dev->command_packet_phys[0]);1035 tw_dev->command_packet_phys[0]);
1034 1036
1035 if (tw_dev->generic_buffer_virt[0])1037 if (tw_dev->generic_buffer_virt[0])
1036 pci_free_consistent(tw_dev->tw_pci_dev,1038 dma_free_coherent(&tw_dev->tw_pci_dev->dev,
1037 TW_SECTOR_SIZE*TW_Q_LENGTH,1039 TW_SECTOR_SIZE * TW_Q_LENGTH,
1038 tw_dev->generic_buffer_virt[0],1040 tw_dev->generic_buffer_virt[0],
1039 tw_dev->generic_buffer_phys[0]);1041 tw_dev->generic_buffer_phys[0]);
1040 1042
1041 kfree(tw_dev->event_queue[0]);1043 kfree(tw_dev->event_queue[0]);
1042} /* End twa_free_device_extension() */1044} /* End twa_free_device_extension() */
@@ -2015,14 +2017,12 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) · 972 unmodified lines
2015 pci_set_master(pdev);2017 pci_set_master(pdev);
2016 pci_try_set_mwi(pdev);2018 pci_try_set_mwi(pdev);
2017 2019
2018 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))2020 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
2019 || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))2021 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
2020 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))2022 TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask");
2021 || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {2023 retval = -ENODEV;
2022 TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask");2024 goto out_disable_device;
2023 retval = -ENODEV;2025 }
2024 goto out_disable_device;
2025 }
2026 2026
2027 host = scsi_host_alloc(&driver_template, sizeof(TW_Device_Extension));2027 host = scsi_host_alloc(&driver_template, sizeof(TW_Device_Extension));
2028 if (!host) {2028 if (!host) {
@@ -2237,14 +2237,12 @@ static int twa_resume(struct pci_dev *pdev) · 208 unmodified lines
2237 pci_set_master(pdev);2237 pci_set_master(pdev);
2238 pci_try_set_mwi(pdev);2238 pci_try_set_mwi(pdev);
2239 2239
2240 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))2240 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
2241 || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))2241 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
2242 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))2242 TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume");
2243 || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {2243 retval = -ENODEV;
2244 TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume");2244 goto out_disable_device;
2245 retval = -ENODEV;2245 }
2246 goto out_disable_device;
2247 }
2248 2246
2249 /* Initialize the card */2247 /* Initialize the card */
2250 if (twa_reset_sequence(tw_dev, 0)) {2248 if (twa_reset_sequence(tw_dev, 0)) {
drivers/scsi/3w-sas.c+17−21
@@ -644,8 +644,8 @@ static int twl_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) · 643 unmodified lines
644 unsigned long *cpu_addr;644 unsigned long *cpu_addr;
645 int retval = 1;645 int retval = 1;
646 646
647 cpu_addr = pci_zalloc_consistent(tw_dev->tw_pci_dev, size * TW_Q_LENGTH,647 cpu_addr = dma_zalloc_coherent(&tw_dev->tw_pci_dev->dev,
648 &dma_handle);648 size * TW_Q_LENGTH, &dma_handle, GFP_KERNEL);
649 if (!cpu_addr) {649 if (!cpu_addr) {
650 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed");650 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed");
651 goto out;651 goto out;
@@ -899,19 +899,19 @@ out: · 247 unmodified lines
899static void twl_free_device_extension(TW_Device_Extension *tw_dev)899static void twl_free_device_extension(TW_Device_Extension *tw_dev)
900{900{
901 if (tw_dev->command_packet_virt[0])901 if (tw_dev->command_packet_virt[0])
902 pci_free_consistent(tw_dev->tw_pci_dev,902 dma_free_coherent(&tw_dev->tw_pci_dev->dev,
903 sizeof(TW_Command_Full)*TW_Q_LENGTH,903 sizeof(TW_Command_Full)*TW_Q_LENGTH,
904 tw_dev->command_packet_virt[0],904 tw_dev->command_packet_virt[0],
905 tw_dev->command_packet_phys[0]);905 tw_dev->command_packet_phys[0]);
906 906
907 if (tw_dev->generic_buffer_virt[0])907 if (tw_dev->generic_buffer_virt[0])
908 pci_free_consistent(tw_dev->tw_pci_dev,908 dma_free_coherent(&tw_dev->tw_pci_dev->dev,
909 TW_SECTOR_SIZE*TW_Q_LENGTH,909 TW_SECTOR_SIZE*TW_Q_LENGTH,
910 tw_dev->generic_buffer_virt[0],910 tw_dev->generic_buffer_virt[0],
911 tw_dev->generic_buffer_phys[0]);911 tw_dev->generic_buffer_phys[0]);
912 912
913 if (tw_dev->sense_buffer_virt[0])913 if (tw_dev->sense_buffer_virt[0])
914 pci_free_consistent(tw_dev->tw_pci_dev,914 dma_free_coherent(&tw_dev->tw_pci_dev->dev,
915 sizeof(TW_Command_Apache_Header)*915 sizeof(TW_Command_Apache_Header)*
916 TW_Q_LENGTH,916 TW_Q_LENGTH,
917 tw_dev->sense_buffer_virt[0],917 tw_dev->sense_buffer_virt[0],
@@ -1571,14 +1571,12 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) · 653 unmodified lines
1571 pci_set_master(pdev);1571 pci_set_master(pdev);
1572 pci_try_set_mwi(pdev);1572 pci_try_set_mwi(pdev);
1573 1573
1574 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))1574 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
1575 || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))1575 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
1576 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))1576 TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");
1577 || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {1577 retval = -ENODEV;
1578 TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");1578 goto out_disable_device;
1579 retval = -ENODEV;1579 }
1580 goto out_disable_device;
1581 }
1582 1580
1583 host = scsi_host_alloc(&driver_template, sizeof(TW_Device_Extension));1581 host = scsi_host_alloc(&driver_template, sizeof(TW_Device_Extension));
1584 if (!host) {1582 if (!host) {
@@ -1805,14 +1803,12 @@ static int twl_resume(struct pci_dev *pdev) · 220 unmodified lines
1805 pci_set_master(pdev);1803 pci_set_master(pdev);
1806 pci_try_set_mwi(pdev);1804 pci_try_set_mwi(pdev);
1807 1805
1808 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))1806 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
1809 || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))1807 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
1810 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))1808 TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");
1811 || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {1809 retval = -ENODEV;
1812 TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");1810 goto out_disable_device;
1813 retval = -ENODEV;1811 }
1814 goto out_disable_device;
1815 }
1816 1812
1817 /* Initialize the card */1813 /* Initialize the card */
1818 if (twl_reset_sequence(tw_dev, 0)) {1814 if (twl_reset_sequence(tw_dev, 0)) {
drivers/scsi/3w-xxxx.c+14−6
@@ -834,15 +834,17 @@ static int tw_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) · 833 unmodified lines
834 834
835 dprintk(KERN_NOTICE "3w-xxxx: tw_allocate_memory()\n");835 dprintk(KERN_NOTICE "3w-xxxx: tw_allocate_memory()\n");
836 836
837 cpu_addr = pci_alloc_consistent(tw_dev->tw_pci_dev, size*TW_Q_LENGTH, &dma_handle);837 cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev,
838 size * TW_Q_LENGTH, &dma_handle, GFP_KERNEL);
838 if (cpu_addr == NULL) {839 if (cpu_addr == NULL) {
839 printk(KERN_WARNING "3w-xxxx: pci_alloc_consistent() failed.\n");840 printk(KERN_WARNING "3w-xxxx: dma_alloc_coherent() failed.\n");
840 return 1;841 return 1;
841 }842 }
842 843
843 if ((unsigned long)cpu_addr % (tw_dev->tw_pci_dev->device == TW_DEVICE_ID ? TW_ALIGNMENT_6000 : TW_ALIGNMENT_7000)) {844 if ((unsigned long)cpu_addr % (tw_dev->tw_pci_dev->device == TW_DEVICE_ID ? TW_ALIGNMENT_6000 : TW_ALIGNMENT_7000)) {
844 printk(KERN_WARNING "3w-xxxx: Couldn't allocate correctly aligned memory.\n");845 printk(KERN_WARNING "3w-xxxx: Couldn't allocate correctly aligned memory.\n");
845 pci_free_consistent(tw_dev->tw_pci_dev, size*TW_Q_LENGTH, cpu_addr, dma_handle);846 dma_free_coherent(&tw_dev->tw_pci_dev->dev, size * TW_Q_LENGTH,
847 cpu_addr, dma_handle);
846 return 1;848 return 1;
847 }849 }
848 850
@@ -1062,10 +1064,16 @@ static void tw_free_device_extension(TW_Device_Extension *tw_dev) · 213 unmodified lines
1062 1064
1063 /* Free command packet and generic buffer memory */1065 /* Free command packet and generic buffer memory */
1064 if (tw_dev->command_packet_virtual_address[0])1066 if (tw_dev->command_packet_virtual_address[0])
1065 pci_free_consistent(tw_dev->tw_pci_dev, sizeof(TW_Command)*TW_Q_LENGTH, tw_dev->command_packet_virtual_address[0], tw_dev->command_packet_physical_address[0]);1067 dma_free_coherent(&tw_dev->tw_pci_dev->dev,
1068 sizeof(TW_Command) * TW_Q_LENGTH,
1069 tw_dev->command_packet_virtual_address[0],
1070 tw_dev->command_packet_physical_address[0]);
1066 1071
1067 if (tw_dev->alignment_virtual_address[0])1072 if (tw_dev->alignment_virtual_address[0])
1068 pci_free_consistent(tw_dev->tw_pci_dev, sizeof(TW_Sector)*TW_Q_LENGTH, tw_dev->alignment_virtual_address[0], tw_dev->alignment_physical_address[0]);1073 dma_free_coherent(&tw_dev->tw_pci_dev->dev,
1074 sizeof(TW_Sector) * TW_Q_LENGTH,
1075 tw_dev->alignment_virtual_address[0],
1076 tw_dev->alignment_physical_address[0]);
1069} /* End tw_free_device_extension() */1077} /* End tw_free_device_extension() */
1070 1078
1071/* This function will send an initconnection command to controller */1079/* This function will send an initconnection command to controller */
@@ -2260,7 +2268,7 @@ static int tw_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) · 1188 unmodified lines
2260 2268
2261 pci_set_master(pdev);2269 pci_set_master(pdev);
2262 2270
2263 retval = pci_set_dma_mask(pdev, TW_DMA_MASK);2271 retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
2264 if (retval) {2272 if (retval) {
2265 printk(KERN_WARNING "3w-xxxx: Failed to set dma mask.");2273 printk(KERN_WARNING "3w-xxxx: Failed to set dma mask.");
2266 goto out_disable_device;2274 goto out_disable_device;
drivers/scsi/3w-xxxx.h+0−1
@@ -230,7 +230,6 @@ static unsigned char tw_sense_table[][4] = · 229 unmodified lines
230#define TW_IOCTL_TIMEOUT 25 /* 25 seconds */230#define TW_IOCTL_TIMEOUT 25 /* 25 seconds */
231#define TW_IOCTL_CHRDEV_TIMEOUT 60 /* 60 seconds */231#define TW_IOCTL_CHRDEV_TIMEOUT 60 /* 60 seconds */
232#define TW_IOCTL_CHRDEV_FREE -1232#define TW_IOCTL_CHRDEV_FREE -1
233#define TW_DMA_MASK DMA_BIT_MASK(32)
234#define TW_MAX_CDB_LEN 16233#define TW_MAX_CDB_LEN 16
235 234
236/* Bitmask macros to eliminate bitfields */235/* Bitmask macros to eliminate bitfields */
drivers/scsi/53c700.h+1−1
@@ -90,7 +90,7 @@ struct NCR_700_Device_Parameters { · 89 unmodified lines
90/* The SYNC negotiation sequence looks like:90/* The SYNC negotiation sequence looks like:
91 * 91 *
92 * If DEV_NEGOTIATED_SYNC not set, tack and SDTR message on to the92 * If DEV_NEGOTIATED_SYNC not set, tack and SDTR message on to the
93 * initial identify for the device and set DEV_BEGIN_SYNC_NEGOTATION93 * initial identify for the device and set DEV_BEGIN_SYNC_NEGOTIATION
94 * If we get an SDTR reply, work out the SXFER parameters, squirrel94 * If we get an SDTR reply, work out the SXFER parameters, squirrel
95 * them away here, clear DEV_BEGIN_SYNC_NEGOTIATION and set95 * them away here, clear DEV_BEGIN_SYNC_NEGOTIATION and set
96 * DEV_NEGOTIATED_SYNC. If we get a REJECT msg, squirrel96 * DEV_NEGOTIATED_SYNC. If we get a REJECT msg, squirrel
drivers/scsi/BusLogic.c+19−17
@@ -201,8 +201,8 @@ static bool __init blogic_create_initccbs(struct blogic_adapter *adapter) · 200 unmodified lines
201 dma_addr_t blkp;201 dma_addr_t blkp;
202 202
203 while (adapter->alloc_ccbs < adapter->initccbs) {203 while (adapter->alloc_ccbs < adapter->initccbs) {
204 blk_pointer = pci_alloc_consistent(adapter->pci_device,204 blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev,
205 blk_size, &blkp);205 blk_size, &blkp, GFP_KERNEL);
206 if (blk_pointer == NULL) {206 if (blk_pointer == NULL) {
207 blogic_err("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n",207 blogic_err("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n",
208 adapter);208 adapter);
@@ -227,15 +227,16 @@ static void blogic_destroy_ccbs(struct blogic_adapter *adapter) · 18 unmodified lines
227 next_ccb = ccb->next_all;227 next_ccb = ccb->next_all;
228 if (ccb->allocgrp_head) {228 if (ccb->allocgrp_head) {
229 if (lastccb)229 if (lastccb)
230 pci_free_consistent(adapter->pci_device,230 dma_free_coherent(&adapter->pci_device->dev,
231 lastccb->allocgrp_size, lastccb,231 lastccb->allocgrp_size, lastccb,
232 lastccb->allocgrp_head);232 lastccb->allocgrp_head);
233 lastccb = ccb;233 lastccb = ccb;
234 }234 }
235 }235 }
236 if (lastccb)236 if (lastccb)
237 pci_free_consistent(adapter->pci_device, lastccb->allocgrp_size,237 dma_free_coherent(&adapter->pci_device->dev,
238 lastccb, lastccb->allocgrp_head);238 lastccb->allocgrp_size, lastccb,
239 lastccb->allocgrp_head);
239}240}
240 241
241 242
@@ -256,8 +257,8 @@ static void blogic_create_addlccbs(struct blogic_adapter *adapter, · 14 unmodified lines
256 if (addl_ccbs <= 0)257 if (addl_ccbs <= 0)
257 return;258 return;
258 while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) {259 while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) {
259 blk_pointer = pci_alloc_consistent(adapter->pci_device,260 blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev,
260 blk_size, &blkp);261 blk_size, &blkp, GFP_KERNEL);
261 if (blk_pointer == NULL)262 if (blk_pointer == NULL)
262 break;263 break;
263 blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp);264 blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp);
@@ -318,8 +319,8 @@ static void blogic_dealloc_ccb(struct blogic_ccb *ccb, int dma_unmap) · 54 unmodified lines
318 if (ccb->command != NULL)319 if (ccb->command != NULL)
319 scsi_dma_unmap(ccb->command);320 scsi_dma_unmap(ccb->command);
320 if (dma_unmap)321 if (dma_unmap)
321 pci_unmap_single(adapter->pci_device, ccb->sensedata,322 dma_unmap_single(&adapter->pci_device->dev, ccb->sensedata,
322 ccb->sense_datalen, PCI_DMA_FROMDEVICE);323 ccb->sense_datalen, DMA_FROM_DEVICE);
323 324
324 ccb->command = NULL;325 ccb->command = NULL;
325 ccb->status = BLOGIC_CCB_FREE;326 ccb->status = BLOGIC_CCB_FREE;
@@ -712,7 +713,7 @@ static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter) · 386 unmodified lines
712 if (pci_enable_device(pci_device))713 if (pci_enable_device(pci_device))
713 continue;714 continue;
714 715
715 if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32)))716 if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
716 continue;717 continue;
717 718
718 bus = pci_device->bus->number;719 bus = pci_device->bus->number;
@@ -895,7 +896,7 @@ static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter) · 176 unmodified lines
895 if (pci_enable_device(pci_device))896 if (pci_enable_device(pci_device))
896 continue;897 continue;
897 898
898 if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32)))899 if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
899 continue;900 continue;
900 901
901 bus = pci_device->bus->number;902 bus = pci_device->bus->number;
@@ -952,7 +953,7 @@ static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter) · 50 unmodified lines
952 if (pci_enable_device(pci_device))953 if (pci_enable_device(pci_device))
953 continue;954 continue;
954 955
955 if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32)))956 if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
956 continue;957 continue;
957 958
958 bus = pci_device->bus->number;959 bus = pci_device->bus->number;
@@ -2040,7 +2041,7 @@ static void blogic_relres(struct blogic_adapter *adapter) · 1081 unmodified lines
2040 Release any allocated memory structs not released elsewhere2041 Release any allocated memory structs not released elsewhere
2041 */2042 */
2042 if (adapter->mbox_space)2043 if (adapter->mbox_space)
2043 pci_free_consistent(adapter->pci_device, adapter->mbox_sz,2044 dma_free_coherent(&adapter->pci_device->dev, adapter->mbox_sz,
2044 adapter->mbox_space, adapter->mbox_space_handle);2045 adapter->mbox_space, adapter->mbox_space_handle);
2045 pci_dev_put(adapter->pci_device);2046 pci_dev_put(adapter->pci_device);
2046 adapter->mbox_space = NULL;2047 adapter->mbox_space = NULL;
@@ -2092,8 +2093,9 @@ static bool blogic_initadapter(struct blogic_adapter *adapter) · 45 unmodified lines
2092 Initialize the Outgoing and Incoming Mailbox pointers.2093 Initialize the Outgoing and Incoming Mailbox pointers.
2093 */2094 */
2094 adapter->mbox_sz = adapter->mbox_count * (sizeof(struct blogic_outbox) + sizeof(struct blogic_inbox));2095 adapter->mbox_sz = adapter->mbox_count * (sizeof(struct blogic_outbox) + sizeof(struct blogic_inbox));
2095 adapter->mbox_space = pci_alloc_consistent(adapter->pci_device,2096 adapter->mbox_space = dma_alloc_coherent(&adapter->pci_device->dev,
2096 adapter->mbox_sz, &adapter->mbox_space_handle);2097 adapter->mbox_sz, &adapter->mbox_space_handle,
2098 GFP_KERNEL);
2097 if (adapter->mbox_space == NULL)2099 if (adapter->mbox_space == NULL)
2098 return blogic_failure(adapter, "MAILBOX ALLOCATION");2100 return blogic_failure(adapter, "MAILBOX ALLOCATION");
2099 adapter->first_outbox = (struct blogic_outbox *) adapter->mbox_space;2101 adapter->first_outbox = (struct blogic_outbox *) adapter->mbox_space;
@@ -3183,9 +3185,9 @@ static int blogic_qcmd_lck(struct scsi_cmnd *command, · 1083 unmodified lines
3183 memcpy(ccb->cdb, cdb, cdblen);3185 memcpy(ccb->cdb, cdb, cdblen);
3184 ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE;3186 ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE;
3185 ccb->command = command;3187 ccb->command = command;
3186 sense_buf = pci_map_single(adapter->pci_device,3188 sense_buf = dma_map_single(&adapter->pci_device->dev,
3187 command->sense_buffer, ccb->sense_datalen,3189 command->sense_buffer, ccb->sense_datalen,
3188 PCI_DMA_FROMDEVICE);3190 DMA_FROM_DEVICE);
3189 if (dma_mapping_error(&adapter->pci_device->dev, sense_buf)) {3191 if (dma_mapping_error(&adapter->pci_device->dev, sense_buf)) {
3190 blogic_err("DMA mapping for sense data buffer failed\n",3192 blogic_err("DMA mapping for sense data buffer failed\n",
3191 adapter);3193 adapter);
drivers/scsi/FlashPoint.c+3−3
@@ -2944,7 +2944,7 @@ static void FPT_sdecm(unsigned char message, u32 port, unsigned char p_card) · 2943 unmodified lines
2944 }2944 }
2945 2945
2946 if (currSCCB->Lun == 0x00) {2946 if (currSCCB->Lun == 0x00) {
2947 if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) {2947 if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
2948 2948
2949 currTar_Info->TarStatus |=2949 currTar_Info->TarStatus |=
2950 (unsigned char)SYNC_SUPPORTED;2950 (unsigned char)SYNC_SUPPORTED;
@@ -2953,8 +2953,8 @@ static void FPT_sdecm(unsigned char message, u32 port, unsigned char p_card) · 2 unmodified lines
2953 ~EE_SYNC_MASK;2953 ~EE_SYNC_MASK;
2954 }2954 }
2955 2955
2956 else if ((currSCCB->Sccb_scsistat ==2956 else if (currSCCB->Sccb_scsistat ==
2957 SELECT_WN_ST)) {2957 SELECT_WN_ST) {
2958 2958
2959 currTar_Info->TarStatus =2959 currTar_Info->TarStatus =
2960 (currTar_Info->2960 (currTar_Info->
drivers/scsi/Kconfig+35−0
@@ -42,6 +42,9 @@ config SCSI_DMA · 41 unmodified lines
42 bool42 bool
43 default n43 default n
44 44
45config SCSI_ESP_PIO
46 bool
47
45config SCSI_NETLINK48config SCSI_NETLINK
46 bool49 bool
47 default n50 default n
@@ -557,6 +560,36 @@ config SCSI_FLASHPOINT · 509 unmodified lines
557 substantial, so users of MultiMaster Host Adapters may not560 substantial, so users of MultiMaster Host Adapters may not
558 wish to include it.561 wish to include it.
559 562
563config SCSI_MYRB
564 tristate "Mylex DAC960/DAC1100 PCI RAID Controller (Block Interface)"
565 depends on PCI
566 select RAID_ATTRS
567 help
568 This driver adds support for the Mylex DAC960, AcceleRAID, and
569 eXtremeRAID PCI RAID controllers. This driver supports the
570 older, block based interface.
571 This driver is a reimplementation of the original DAC960
572 driver. If you have used the DAC960 driver you should enable
573 this module.
574
575 To compile this driver as a module, choose M here: the
576 module will be called myrb.
577
578config SCSI_MYRS
579 tristate "Mylex DAC960/DAC1100 PCI RAID Controller (SCSI Interface)"
580 depends on PCI
581 select RAID_ATTRS
582 help
583 This driver adds support for the Mylex DAC960, AcceleRAID, and
584 eXtremeRAID PCI RAID controllers. This driver supports the
585 newer, SCSI-based interface only.
586 This driver is a reimplementation of the original DAC960
587 driver. If you have used the DAC960 driver you should enable
588 this module.
589
590 To compile this driver as a module, choose M here: the
591 module will be called myrs.
592
560config VMWARE_PVSCSI593config VMWARE_PVSCSI
561 tristate "VMware PVSCSI driver support"594 tristate "VMware PVSCSI driver support"
562 depends on PCI && SCSI && X86595 depends on PCI && SCSI && X86
@@ -1332,6 +1365,7 @@ config SCSI_ZORRO_ESP · 769 unmodified lines
1332 tristate "Zorro ESP SCSI support"1365 tristate "Zorro ESP SCSI support"
1333 depends on ZORRO && SCSI1366 depends on ZORRO && SCSI
1334 select SCSI_SPI_ATTRS1367 select SCSI_SPI_ATTRS
1368 select SCSI_ESP_PIO
1335 help1369 help
1336 Support for various NCR53C9x (ESP) based SCSI controllers on Zorro1370 Support for various NCR53C9x (ESP) based SCSI controllers on Zorro
1337 expansion boards for the Amiga.1371 expansion boards for the Amiga.
@@ -1374,6 +1408,7 @@ config SCSI_MAC_ESP · 36 unmodified lines
1374 tristate "Macintosh NCR53c9[46] SCSI"1408 tristate "Macintosh NCR53c9[46] SCSI"
1375 depends on MAC && SCSI1409 depends on MAC && SCSI
1376 select SCSI_SPI_ATTRS1410 select SCSI_SPI_ATTRS
1411 select SCSI_ESP_PIO
1377 help1412 help
1378 This is the NCR 53c9x SCSI controller found on most of the 680401413 This is the NCR 53c9x SCSI controller found on most of the 68040
1379 based Macintoshes.1414 based Macintoshes.
drivers/scsi/Makefile+2−0
@@ -106,6 +106,8 @@ obj-$(CONFIG_SCSI_INIA100) += a100u2w.o · 105 unmodified lines
106obj-$(CONFIG_SCSI_QLOGICPTI) += qlogicpti.o106obj-$(CONFIG_SCSI_QLOGICPTI) += qlogicpti.o
107obj-$(CONFIG_SCSI_MESH) += mesh.o107obj-$(CONFIG_SCSI_MESH) += mesh.o
108obj-$(CONFIG_SCSI_MAC53C94) += mac53c94.o108obj-$(CONFIG_SCSI_MAC53C94) += mac53c94.o
109obj-$(CONFIG_SCSI_MYRB) += myrb.o
110obj-$(CONFIG_SCSI_MYRS) += myrs.o
109obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o111obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o
110obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o112obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o
111obj-$(CONFIG_SCSI_3W_SAS) += 3w-sas.o113obj-$(CONFIG_SCSI_3W_SAS) += 3w-sas.o
drivers/scsi/NCR5380.c+100−67
@@ -131,6 +131,7 @@ · 130 unmodified lines
131 131
132static int do_abort(struct Scsi_Host *);132static int do_abort(struct Scsi_Host *);
133static void do_reset(struct Scsi_Host *);133static void do_reset(struct Scsi_Host *);
134static void bus_reset_cleanup(struct Scsi_Host *);
134 135
135/**136/**
136 * initialize_SCp - init the scsi pointer field137 * initialize_SCp - init the scsi pointer field
@@ -513,16 +514,15 @@ static void complete_cmd(struct Scsi_Host *instance, · 376 unmodified lines
513 514
514 if (hostdata->sensing == cmd) {515 if (hostdata->sensing == cmd) {
515 /* Autosense processing ends here */516 /* Autosense processing ends here */
516 if ((cmd->result & 0xff) != SAM_STAT_GOOD) {517 if (status_byte(cmd->result) != GOOD) {
517 scsi_eh_restore_cmnd(cmd, &hostdata->ses);518 scsi_eh_restore_cmnd(cmd, &hostdata->ses);
518 set_host_byte(cmd, DID_ERROR);519 } else {
519 } else
520 scsi_eh_restore_cmnd(cmd, &hostdata->ses);520 scsi_eh_restore_cmnd(cmd, &hostdata->ses);
521 set_driver_byte(cmd, DRIVER_SENSE);
522 }
521 hostdata->sensing = NULL;523 hostdata->sensing = NULL;
522 }524 }
523 525
524 hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
525
526 cmd->scsi_done(cmd);526 cmd->scsi_done(cmd);
527}527}
528 528
@@ -884,7 +884,14 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id) · 355 unmodified lines
884 /* Probably Bus Reset */884 /* Probably Bus Reset */
885 NCR5380_read(RESET_PARITY_INTERRUPT_REG);885 NCR5380_read(RESET_PARITY_INTERRUPT_REG);
886 886
887 dsprintk(NDEBUG_INTR, instance, "unknown interrupt\n");887 if (sr & SR_RST) {
888 /* Certainly Bus Reset */
889 shost_printk(KERN_WARNING, instance,
890 "bus reset interrupt\n");
891 bus_reset_cleanup(instance);
892 } else {
893 dsprintk(NDEBUG_INTR, instance, "unknown interrupt\n");
894 }
888#ifdef SUN3_SCSI_VME895#ifdef SUN3_SCSI_VME
889 dregs->csr |= CSR_DMA_ENABLE;896 dregs->csr |= CSR_DMA_ENABLE;
890#endif897#endif
@@ -902,20 +909,16 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id) · 11 unmodified lines
902 return IRQ_RETVAL(handled);909 return IRQ_RETVAL(handled);
903}910}
904 911
905/*912/**
906 * Function : int NCR5380_select(struct Scsi_Host *instance,913 * NCR5380_select - attempt arbitration and selection for a given command
907 * struct scsi_cmnd *cmd)914 * @instance: the Scsi_Host instance
908 *915 * @cmd: the scsi_cmnd to execute
909 * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command,
910 * including ARBITRATION, SELECTION, and initial message out for
911 * IDENTIFY and queue messages.
912 *916 *
913 * Inputs : instance - instantiation of the 5380 driver on which this917 * This routine establishes an I_T_L nexus for a SCSI command. This involves
914 * target lives, cmd - SCSI command to execute.918 * ARBITRATION, SELECTION and MESSAGE OUT phases and an IDENTIFY message.
915 *919 *
916 * Returns cmd if selection failed but should be retried,920 * Returns true if the operation should be retried.
917 * NULL if selection failed and should not be retried, or921 * Returns false if it should not be retried.
918 * NULL if selection succeeded (hostdata->connected == cmd).
919 *922 *
920 * Side effects :923 * Side effects :
921 * If bus busy, arbitration failed, etc, NCR5380_select() will exit924 * If bus busy, arbitration failed, etc, NCR5380_select() will exit
@@ -923,16 +926,15 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id) · 1 unmodified line
923 * SELECT_ENABLE will be set appropriately, the NCR5380926 * SELECT_ENABLE will be set appropriately, the NCR5380
924 * will cease to drive any SCSI bus signals.927 * will cease to drive any SCSI bus signals.
925 *928 *
926 * If successful : I_T_L or I_T_L_Q nexus will be established,929 * If successful : the I_T_L nexus will be established, and
927 * instance->connected will be set to cmd.930 * hostdata->connected will be set to cmd.
928 * SELECT interrupt will be disabled.931 * SELECT interrupt will be disabled.
929 *932 *
930 * If failed (no target) : cmd->scsi_done() will be called, and the933 * If failed (no target) : cmd->scsi_done() will be called, and the
931 * cmd->result host byte set to DID_BAD_TARGET.934 * cmd->result host byte set to DID_BAD_TARGET.
932 */935 */
933 936
934static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,937static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd)
935 struct scsi_cmnd *cmd)
936 __releases(&hostdata->lock) __acquires(&hostdata->lock)938 __releases(&hostdata->lock) __acquires(&hostdata->lock)
937{939{
938 struct NCR5380_hostdata *hostdata = shost_priv(instance);940 struct NCR5380_hostdata *hostdata = shost_priv(instance);
@@ -940,6 +942,9 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 1 unmodified line
940 unsigned char *data;942 unsigned char *data;
941 int len;943 int len;
942 int err;944 int err;
945 bool ret = true;
946 bool can_disconnect = instance->irq != NO_IRQ &&
947 cmd->cmnd[0] != REQUEST_SENSE;
943 948
944 NCR5380_dprint(NDEBUG_ARBITRATION, instance);949 NCR5380_dprint(NDEBUG_ARBITRATION, instance);
945 dsprintk(NDEBUG_ARBITRATION, instance, "starting arbitration, id = %d\n",950 dsprintk(NDEBUG_ARBITRATION, instance, "starting arbitration, id = %d\n",
@@ -948,7 +953,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 2 unmodified lines
948 /*953 /*
949 * Arbitration and selection phases are slow and involve dropping the954 * Arbitration and selection phases are slow and involve dropping the
950 * lock, so we have to watch out for EH. An exception handler may955 * lock, so we have to watch out for EH. An exception handler may
951 * change 'selecting' to NULL. This function will then return NULL956 * change 'selecting' to NULL. This function will then return false
952 * so that the caller will forget about 'cmd'. (During information957 * so that the caller will forget about 'cmd'. (During information
953 * transfer phases, EH may change 'connected' to NULL.)958 * transfer phases, EH may change 'connected' to NULL.)
954 */959 */
@@ -984,7 +989,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 29 unmodified lines
984 if (!hostdata->selecting) {989 if (!hostdata->selecting) {
985 /* Command was aborted */990 /* Command was aborted */
986 NCR5380_write(MODE_REG, MR_BASE);991 NCR5380_write(MODE_REG, MR_BASE);
987 goto out;992 return false;
988 }993 }
989 if (err < 0) {994 if (err < 0) {
990 NCR5380_write(MODE_REG, MR_BASE);995 NCR5380_write(MODE_REG, MR_BASE);
@@ -1033,7 +1038,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 42 unmodified lines
1033 if (!hostdata->selecting) {1038 if (!hostdata->selecting) {
1034 NCR5380_write(MODE_REG, MR_BASE);1039 NCR5380_write(MODE_REG, MR_BASE);
1035 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);1040 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1036 goto out;1041 return false;
1037 }1042 }
1038 1043
1039 dsprintk(NDEBUG_ARBITRATION, instance, "won arbitration\n");1044 dsprintk(NDEBUG_ARBITRATION, instance, "won arbitration\n");
@@ -1116,13 +1121,16 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 76 unmodified lines
1116 spin_lock_irq(&hostdata->lock);1121 spin_lock_irq(&hostdata->lock);
1117 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);1122 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1118 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);1123 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
1124
1119 /* Can't touch cmd if it has been reclaimed by the scsi ML */1125 /* Can't touch cmd if it has been reclaimed by the scsi ML */
1120 if (hostdata->selecting) {1126 if (!hostdata->selecting)
1121 cmd->result = DID_BAD_TARGET << 16;1127 return false;
1122 complete_cmd(instance, cmd);1128
1123 dsprintk(NDEBUG_SELECTION, instance, "target did not respond within 250ms\n");1129 cmd->result = DID_BAD_TARGET << 16;
1124 cmd = NULL;1130 complete_cmd(instance, cmd);
1125 }1131 dsprintk(NDEBUG_SELECTION, instance,
1132 "target did not respond within 250ms\n");
1133 ret = false;
1126 goto out;1134 goto out;
1127 }1135 }
1128 1136
@@ -1155,12 +1163,12 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 26 unmodified lines
1155 }1163 }
1156 if (!hostdata->selecting) {1164 if (!hostdata->selecting) {
1157 do_abort(instance);1165 do_abort(instance);
1158 goto out;1166 return false;
1159 }1167 }
1160 1168
1161 dsprintk(NDEBUG_SELECTION, instance, "target %d selected, going into MESSAGE OUT phase.\n",1169 dsprintk(NDEBUG_SELECTION, instance, "target %d selected, going into MESSAGE OUT phase.\n",
1162 scmd_id(cmd));1170 scmd_id(cmd));
1163 tmp[0] = IDENTIFY(((instance->irq == NO_IRQ) ? 0 : 1), cmd->device->lun);1171 tmp[0] = IDENTIFY(can_disconnect, cmd->device->lun);
1164 1172
1165 len = 1;1173 len = 1;
1166 data = tmp;1174 data = tmp;
@@ -1171,7 +1179,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 4 unmodified lines
1171 cmd->result = DID_ERROR << 16;1179 cmd->result = DID_ERROR << 16;
1172 complete_cmd(instance, cmd);1180 complete_cmd(instance, cmd);
1173 dsprintk(NDEBUG_SELECTION, instance, "IDENTIFY message transfer failed\n");1181 dsprintk(NDEBUG_SELECTION, instance, "IDENTIFY message transfer failed\n");
1174 cmd = NULL;1182 ret = false;
1175 goto out;1183 goto out;
1176 }1184 }
1177 1185
@@ -1186,13 +1194,13 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 8 unmodified lines
1186 1194
1187 initialize_SCp(cmd);1195 initialize_SCp(cmd);
1188 1196
1189 cmd = NULL;1197 ret = false;
1190 1198
1191out:1199out:
1192 if (!hostdata->selecting)1200 if (!hostdata->selecting)
1193 return NULL;1201 return NULL;
1194 hostdata->selecting = NULL;1202 hostdata->selecting = NULL;
1195 return cmd;1203 return ret;
1196}1204}
1197 1205
1198/*1206/*
@@ -1711,6 +1719,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) · 512 unmodified lines
1711 cmd->result = DID_ERROR << 16;1719 cmd->result = DID_ERROR << 16;
1712 complete_cmd(instance, cmd);1720 complete_cmd(instance, cmd);
1713 hostdata->connected = NULL;1721 hostdata->connected = NULL;
1722 hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
1714 return;1723 return;
1715#endif1724#endif
1716 case PHASE_DATAIN:1725 case PHASE_DATAIN:
@@ -1793,6 +1802,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) · 76 unmodified lines
1793 cmd, scmd_id(cmd), cmd->device->lun);1802 cmd, scmd_id(cmd), cmd->device->lun);
1794 1803
1795 hostdata->connected = NULL;1804 hostdata->connected = NULL;
1805 hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
1796 1806
1797 cmd->result &= ~0xffff;1807 cmd->result &= ~0xffff;
1798 cmd->result |= cmd->SCp.Status;1808 cmd->result |= cmd->SCp.Status;
@@ -1951,6 +1961,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) · 152 unmodified lines
1951 NCR5380_transfer_pio(instance, &phase, &len, &data);1961 NCR5380_transfer_pio(instance, &phase, &len, &data);
1952 if (msgout == ABORT) {1962 if (msgout == ABORT) {
1953 hostdata->connected = NULL;1963 hostdata->connected = NULL;
1964 hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
1954 cmd->result = DID_ERROR << 16;1965 cmd->result = DID_ERROR << 16;
1955 complete_cmd(instance, cmd);1966 complete_cmd(instance, cmd);
1956 maybe_release_dma_irq(instance);1967 maybe_release_dma_irq(instance);
@@ -2014,8 +2025,11 @@ static void NCR5380_reselect(struct Scsi_Host *instance) · 57 unmodified lines
2014 NCR5380_write(MODE_REG, MR_BASE);2025 NCR5380_write(MODE_REG, MR_BASE);
2015 2026
2016 target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask);2027 target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask);
2017 2028 if (!target_mask || target_mask & (target_mask - 1)) {
2018 dsprintk(NDEBUG_RESELECTION, instance, "reselect\n");2029 shost_printk(KERN_WARNING, instance,
2030 "reselect: bad target_mask 0x%02x\n", target_mask);
2031 return;
2032 }
2019 2033
2020 /*2034 /*
2021 * At this point, we have detected that our SCSI ID is on the bus,2035 * At this point, we have detected that our SCSI ID is on the bus,
@@ -2029,6 +2043,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) · 7 unmodified lines
2029 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY);2043 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY);
2030 if (NCR5380_poll_politely(hostdata,2044 if (NCR5380_poll_politely(hostdata,
2031 STATUS_REG, SR_SEL, 0, 2 * HZ) < 0) {2045 STATUS_REG, SR_SEL, 0, 2 * HZ) < 0) {
2046 shost_printk(KERN_ERR, instance, "reselect: !SEL timeout\n");
2032 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);2047 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2033 return;2048 return;
2034 }2049 }
@@ -2040,6 +2055,10 @@ static void NCR5380_reselect(struct Scsi_Host *instance) · 5 unmodified lines
2040 2055
2041 if (NCR5380_poll_politely(hostdata,2056 if (NCR5380_poll_politely(hostdata,
2042 STATUS_REG, SR_REQ, SR_REQ, 2 * HZ) < 0) {2057 STATUS_REG, SR_REQ, SR_REQ, 2 * HZ) < 0) {
2058 if ((NCR5380_read(STATUS_REG) & (SR_BSY | SR_SEL)) == 0)
2059 /* BUS FREE phase */
2060 return;
2061 shost_printk(KERN_ERR, instance, "reselect: REQ timeout\n");
2043 do_abort(instance);2062 do_abort(instance);
2044 return;2063 return;
2045 }2064 }
@@ -2101,13 +2120,16 @@ static void NCR5380_reselect(struct Scsi_Host *instance) · 55 unmodified lines
2101 dsprintk(NDEBUG_RESELECTION | NDEBUG_QUEUES, instance,2120 dsprintk(NDEBUG_RESELECTION | NDEBUG_QUEUES, instance,
2102 "reselect: removed %p from disconnected queue\n", tmp);2121 "reselect: removed %p from disconnected queue\n", tmp);
2103 } else {2122 } else {
2123 int target = ffs(target_mask) - 1;
2124
2104 shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d not in disconnected queue.\n",2125 shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d not in disconnected queue.\n",
2105 target_mask, lun);2126 target_mask, lun);
2106 /*2127 /*
2107 * Since we have an established nexus that we can't do anything2128 * Since we have an established nexus that we can't do anything
2108 * with, we must abort it.2129 * with, we must abort it.
2109 */2130 */
2110 do_abort(instance);2131 if (do_abort(instance) == 0)
2132 hostdata->busy[target] &= ~(1 << lun);
2111 return;2133 return;
2112 }2134 }
2113 2135
@@ -2272,15 +2294,16 @@ static int NCR5380_abort(struct scsi_cmnd *cmd) · 158 unmodified lines
2272 if (list_del_cmd(&hostdata->autosense, cmd)) {2294 if (list_del_cmd(&hostdata->autosense, cmd)) {
2273 dsprintk(NDEBUG_ABORT, instance,2295 dsprintk(NDEBUG_ABORT, instance,
2274 "abort: removed %p from sense queue\n", cmd);2296 "abort: removed %p from sense queue\n", cmd);
2275 set_host_byte(cmd, DID_ERROR);
2276 complete_cmd(instance, cmd);2297 complete_cmd(instance, cmd);
2277 }2298 }
2278 2299
2279out:2300out:
2280 if (result == FAILED)2301 if (result == FAILED)
2281 dsprintk(NDEBUG_ABORT, instance, "abort: failed to abort %p\n", cmd);2302 dsprintk(NDEBUG_ABORT, instance, "abort: failed to abort %p\n", cmd);
2282 else2303 else {
2304 hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
2283 dsprintk(NDEBUG_ABORT, instance, "abort: successfully aborted %p\n", cmd);2305 dsprintk(NDEBUG_ABORT, instance, "abort: successfully aborted %p\n", cmd);
2306 }
2284 2307
2285 queue_work(hostdata->work_q, &hostdata->main_task);2308 queue_work(hostdata->work_q, &hostdata->main_task);
2286 maybe_release_dma_irq(instance);2309 maybe_release_dma_irq(instance);
@@ -2290,31 +2313,12 @@ out: · 3 unmodified lines
2290}2313}
2291 2314
2292 2315
2293/**2316static void bus_reset_cleanup(struct Scsi_Host *instance)
2294 * NCR5380_host_reset - reset the SCSI host
2295 * @cmd: SCSI command undergoing EH
2296 *
2297 * Returns SUCCESS
2298 */
2299
2300static int NCR5380_host_reset(struct scsi_cmnd *cmd)
2301{2317{
2302 struct Scsi_Host *instance = cmd->device->host;
2303 struct NCR5380_hostdata *hostdata = shost_priv(instance);2318 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2304 int i;2319 int i;
2305 unsigned long flags;
2306 struct NCR5380_cmd *ncmd;2320 struct NCR5380_cmd *ncmd;
2307 2321
2308 spin_lock_irqsave(&hostdata->lock, flags);
2309
2310#if (NDEBUG & NDEBUG_ANY)
2311 scmd_printk(KERN_INFO, cmd, __func__);
2312#endif
2313 NCR5380_dprint(NDEBUG_ANY, instance);
2314 NCR5380_dprint_phase(NDEBUG_ANY, instance);
2315
2316 do_reset(instance);
2317
2318 /* reset NCR registers */2322 /* reset NCR registers */
2319 NCR5380_write(MODE_REG, MR_BASE);2323 NCR5380_write(MODE_REG, MR_BASE);
2320 NCR5380_write(TARGET_COMMAND_REG, 0);2324 NCR5380_write(TARGET_COMMAND_REG, 0);
@@ -2326,11 +2330,6 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd) · 5 unmodified lines
2326 * commands!2330 * commands!
2327 */2331 */
2328 2332
2329 if (list_del_cmd(&hostdata->unissued, cmd)) {
2330 cmd->result = DID_RESET << 16;
2331 cmd->scsi_done(cmd);
2332 }
2333
2334 if (hostdata->selecting) {2333 if (hostdata->selecting) {
2335 hostdata->selecting->result = DID_RESET << 16;2334 hostdata->selecting->result = DID_RESET << 16;
2336 complete_cmd(instance, hostdata->selecting);2335 complete_cmd(instance, hostdata->selecting);
@@ -2348,7 +2347,6 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd) · 11 unmodified lines
2348 list_for_each_entry(ncmd, &hostdata->autosense, list) {2347 list_for_each_entry(ncmd, &hostdata->autosense, list) {
2349 struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);2348 struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);
2350 2349
2351 set_host_byte(cmd, DID_RESET);
2352 cmd->scsi_done(cmd);2350 cmd->scsi_done(cmd);
2353 }2351 }
2354 INIT_LIST_HEAD(&hostdata->autosense);2352 INIT_LIST_HEAD(&hostdata->autosense);
@@ -2365,6 +2363,41 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd) · 10 unmodified lines
2365 2363
2366 queue_work(hostdata->work_q, &hostdata->main_task);2364 queue_work(hostdata->work_q, &hostdata->main_task);
2367 maybe_release_dma_irq(instance);2365 maybe_release_dma_irq(instance);
2366}
2367
2368/**
2369 * NCR5380_host_reset - reset the SCSI host
2370 * @cmd: SCSI command undergoing EH
2371 *
2372 * Returns SUCCESS
2373 */
2374
2375static int NCR5380_host_reset(struct scsi_cmnd *cmd)
2376{
2377 struct Scsi_Host *instance = cmd->device->host;
2378 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2379 unsigned long flags;
2380 struct NCR5380_cmd *ncmd;
2381
2382 spin_lock_irqsave(&hostdata->lock, flags);
2383
2384#if (NDEBUG & NDEBUG_ANY)
2385 shost_printk(KERN_INFO, instance, __func__);
2386#endif
2387 NCR5380_dprint(NDEBUG_ANY, instance);
2388 NCR5380_dprint_phase(NDEBUG_ANY, instance);
2389
2390 list_for_each_entry(ncmd, &hostdata->unissued, list) {
2391 struct scsi_cmnd *scmd = NCR5380_to_scmd(ncmd);
2392
2393 scmd->result = DID_RESET << 16;
2394 scmd->scsi_done(scmd);
2395 }
2396 INIT_LIST_HEAD(&hostdata->unissued);
2397
2398 do_reset(instance);
2399 bus_reset_cleanup(instance);
2400
2368 spin_unlock_irqrestore(&hostdata->lock, flags);2401 spin_unlock_irqrestore(&hostdata->lock, flags);
2369 2402
2370 return SUCCESS;2403 return SUCCESS;
drivers/scsi/NCR5380.h+1−1
@@ -275,7 +275,7 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id); · 274 unmodified lines
275static void NCR5380_main(struct work_struct *work);275static void NCR5380_main(struct work_struct *work);
276static const char *NCR5380_info(struct Scsi_Host *instance);276static const char *NCR5380_info(struct Scsi_Host *instance);
277static void NCR5380_reselect(struct Scsi_Host *instance);277static void NCR5380_reselect(struct Scsi_Host *instance);
278static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *, struct scsi_cmnd *);278static bool NCR5380_select(struct Scsi_Host *, struct scsi_cmnd *);
279static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);279static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
280static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);280static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
281static int NCR5380_poll_politely2(struct NCR5380_hostdata *,281static int NCR5380_poll_politely2(struct NCR5380_hostdata *,
drivers/scsi/a100u2w.c+13−7
@@ -1094,7 +1094,7 @@ static int inia100_probe_one(struct pci_dev *pdev, · 1093 unmodified lines
1094 1094
1095 if (pci_enable_device(pdev))1095 if (pci_enable_device(pdev))
1096 goto out;1096 goto out;
1097 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {1097 if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
1098 printk(KERN_WARNING "Unable to set 32bit DMA "1098 printk(KERN_WARNING "Unable to set 32bit DMA "
1099 "on inia100 adapter, ignoring.\n");1099 "on inia100 adapter, ignoring.\n");
1100 goto out_disable_device;1100 goto out_disable_device;
@@ -1124,7 +1124,8 @@ static int inia100_probe_one(struct pci_dev *pdev, · 23 unmodified lines
1124 1124
1125 /* Get total memory needed for SCB */1125 /* Get total memory needed for SCB */
1126 sz = ORC_MAXQUEUE * sizeof(struct orc_scb);1126 sz = ORC_MAXQUEUE * sizeof(struct orc_scb);
1127 host->scb_virt = pci_zalloc_consistent(pdev, sz, &host->scb_phys);1127 host->scb_virt = dma_zalloc_coherent(&pdev->dev, sz, &host->scb_phys,
1128 GFP_KERNEL);
1128 if (!host->scb_virt) {1129 if (!host->scb_virt) {
1129 printk("inia100: SCB memory allocation error\n");1130 printk("inia100: SCB memory allocation error\n");
1130 goto out_host_put;1131 goto out_host_put;
@@ -1132,7 +1133,8 @@ static int inia100_probe_one(struct pci_dev *pdev, · 1 unmodified line
1132 1133
1133 /* Get total memory needed for ESCB */1134 /* Get total memory needed for ESCB */
1134 sz = ORC_MAXQUEUE * sizeof(struct orc_extended_scb);1135 sz = ORC_MAXQUEUE * sizeof(struct orc_extended_scb);
1135 host->escb_virt = pci_zalloc_consistent(pdev, sz, &host->escb_phys);1136 host->escb_virt = dma_zalloc_coherent(&pdev->dev, sz, &host->escb_phys,
1137 GFP_KERNEL);
1136 if (!host->escb_virt) {1138 if (!host->escb_virt) {
1137 printk("inia100: ESCB memory allocation error\n");1139 printk("inia100: ESCB memory allocation error\n");
1138 goto out_free_scb_array;1140 goto out_free_scb_array;
@@ -1177,10 +1179,12 @@ static int inia100_probe_one(struct pci_dev *pdev, · 38 unmodified lines
1177out_free_irq:1179out_free_irq:
1178 free_irq(shost->irq, shost);1180 free_irq(shost->irq, shost);
1179out_free_escb_array:1181out_free_escb_array:
1180 pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_extended_scb),1182 dma_free_coherent(&pdev->dev,
1183 ORC_MAXQUEUE * sizeof(struct orc_extended_scb),
1181 host->escb_virt, host->escb_phys);1184 host->escb_virt, host->escb_phys);
1182out_free_scb_array:1185out_free_scb_array:
1183 pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_scb),1186 dma_free_coherent(&pdev->dev,
1187 ORC_MAXQUEUE * sizeof(struct orc_scb),
1184 host->scb_virt, host->scb_phys);1188 host->scb_virt, host->scb_phys);
1185out_host_put:1189out_host_put:
1186 scsi_host_put(shost);1190 scsi_host_put(shost);
@@ -1200,9 +1204,11 @@ static void inia100_remove_one(struct pci_dev *pdev) · 13 unmodified lines
1200 scsi_remove_host(shost);1204 scsi_remove_host(shost);
1201 1205
1202 free_irq(shost->irq, shost);1206 free_irq(shost->irq, shost);
1203 pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_extended_scb),1207 dma_free_coherent(&pdev->dev,
1208 ORC_MAXQUEUE * sizeof(struct orc_extended_scb),
1204 host->escb_virt, host->escb_phys);1209 host->escb_virt, host->escb_phys);
1205 pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_scb),1210 dma_free_coherent(&pdev->dev,
1211 ORC_MAXQUEUE * sizeof(struct orc_scb),
1206 host->scb_virt, host->scb_phys);1212 host->scb_virt, host->scb_phys);
1207 release_region(shost->io_port, 256);1213 release_region(shost->io_port, 256);
1208 1214
drivers/scsi/aacraid/aachba.c+0−7
@@ -3480,7 +3480,6 @@ int aac_dev_ioctl(struct aac_dev *dev, int cmd, void __user *arg) · 3479 unmodified lines
3480 3480
3481static void aac_srb_callback(void *context, struct fib * fibptr)3481static void aac_srb_callback(void *context, struct fib * fibptr)
3482{3482{
3483 struct aac_dev *dev;
3484 struct aac_srb_reply *srbreply;3483 struct aac_srb_reply *srbreply;
3485 struct scsi_cmnd *scsicmd;3484 struct scsi_cmnd *scsicmd;
3486 3485
@@ -3491,8 +3490,6 @@ static void aac_srb_callback(void *context, struct fib * fibptr) · 4 unmodified lines
3491 3490
3492 BUG_ON(fibptr == NULL);3491 BUG_ON(fibptr == NULL);
3493 3492
3494 dev = fibptr->dev;
3495
3496 srbreply = (struct aac_srb_reply *) fib_data(fibptr);3493 srbreply = (struct aac_srb_reply *) fib_data(fibptr);
3497 3494
3498 scsicmd->sense_buffer[0] = '\0'; /* Initialize sense valid flag to false */3495 scsicmd->sense_buffer[0] = '\0'; /* Initialize sense valid flag to false */
@@ -3921,13 +3918,11 @@ static int aac_send_hba_fib(struct scsi_cmnd *scsicmd) · 422 unmodified lines
3921 3918
3922static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *psg)3919static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *psg)
3923{3920{
3924 struct aac_dev *dev;
3925 unsigned long byte_count = 0;3921 unsigned long byte_count = 0;
3926 int nseg;3922 int nseg;
3927 struct scatterlist *sg;3923 struct scatterlist *sg;
3928 int i;3924 int i;
3929 3925
3930 dev = (struct aac_dev *)scsicmd->device->host->hostdata;
3931 // Get rid of old data3926 // Get rid of old data
3932 psg->count = 0;3927 psg->count = 0;
3933 psg->sg[0].addr = 0;3928 psg->sg[0].addr = 0;
@@ -3963,14 +3958,12 @@ static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *psg) · 29 unmodified lines
3963 3958
3964static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg)3959static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg)
3965{3960{
3966 struct aac_dev *dev;
3967 unsigned long byte_count = 0;3961 unsigned long byte_count = 0;
3968 u64 addr;3962 u64 addr;
3969 int nseg;3963 int nseg;
3970 struct scatterlist *sg;3964 struct scatterlist *sg;
3971 int i;3965 int i;
3972 3966
3973 dev = (struct aac_dev *)scsicmd->device->host->hostdata;
3974 // Get rid of old data3967 // Get rid of old data
3975 psg->count = 0;3968 psg->count = 0;
3976 psg->sg[0].addr[0] = 0;3969 psg->sg[0].addr[0] = 0;
drivers/scsi/aacraid/commsup.c+0−2
@@ -2586,9 +2586,7 @@ int aac_acquire_irq(struct aac_dev *dev) · 2585 unmodified lines
2586void aac_free_irq(struct aac_dev *dev)2586void aac_free_irq(struct aac_dev *dev)
2587{2587{
2588 int i;2588 int i;
2589 int cpu;
2590 2589
2591 cpu = cpumask_first(cpu_online_mask);
2592 if (aac_is_src(dev)) {2590 if (aac_is_src(dev)) {
2593 if (dev->max_msix > 1) {2591 if (dev->max_msix > 1) {
2594 for (i = 0; i < dev->max_msix; i++)2592 for (i = 0; i < dev->max_msix; i++)
drivers/scsi/advansys.c+1−3
@@ -5949,7 +5949,6 @@ static void adv_async_callback(ADV_DVC_VAR *adv_dvc_varp, uchar code) · 5948 unmodified lines
5949static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)5949static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
5950{5950{
5951 struct asc_board *boardp = adv_dvc_varp->drv_ptr;5951 struct asc_board *boardp = adv_dvc_varp->drv_ptr;
5952 u32 srb_tag;
5953 adv_req_t *reqp;5952 adv_req_t *reqp;
5954 adv_sgblk_t *sgblkp;5953 adv_sgblk_t *sgblkp;
5955 struct scsi_cmnd *scp;5954 struct scsi_cmnd *scp;
@@ -5965,7 +5964,6 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) · 9 unmodified lines
5965 * completed. The adv_req_t structure actually contains the5964 * completed. The adv_req_t structure actually contains the
5966 * completed ADV_SCSI_REQ_Q structure.5965 * completed ADV_SCSI_REQ_Q structure.
5967 */5966 */
5968 srb_tag = le32_to_cpu(scsiqp->srb_tag);
5969 scp = scsi_host_find_tag(boardp->shost, scsiqp->srb_tag);5967 scp = scsi_host_find_tag(boardp->shost, scsiqp->srb_tag);
5970 5968
5971 ASC_DBG(1, "scp 0x%p\n", scp);5969 ASC_DBG(1, "scp 0x%p\n", scp);
@@ -6448,7 +6446,7 @@ static void AscIsrChipHalted(ASC_DVC_VAR *asc_dvc) · 476 unmodified lines
6448 sdtr_data =6446 sdtr_data =
6449 AscCalSDTRData(asc_dvc, ext_msg.xfer_period,6447 AscCalSDTRData(asc_dvc, ext_msg.xfer_period,
6450 ext_msg.req_ack_offset);6448 ext_msg.req_ack_offset);
6451 if ((sdtr_data == 0xFF)) {6449 if (sdtr_data == 0xFF) {
6452 6450
6453 q_cntl |= QC_MSG_OUT;6451 q_cntl |= QC_MSG_OUT;
6454 asc_dvc->init_sdtr &= ~target_id;6452 asc_dvc->init_sdtr &= ~target_id;
drivers/scsi/aic7xxx/aic7770.c+0−6
@@ -42,15 +42,9 @@ · 41 unmodified lines
42 * $FreeBSD$42 * $FreeBSD$
43 */43 */
44 44
45#ifdef __linux__
46#include "aic7xxx_osm.h"45#include "aic7xxx_osm.h"
47#include "aic7xxx_inline.h"46#include "aic7xxx_inline.h"
48#include "aic7xxx_93cx6.h"47#include "aic7xxx_93cx6.h"
49#else
50#include <dev/aic7xxx/aic7xxx_osm.h>
51#include <dev/aic7xxx/aic7xxx_inline.h>
52#include <dev/aic7xxx/aic7xxx_93cx6.h>
53#endif
54 48
55#define ID_AIC7770 0x0490777049#define ID_AIC7770 0x04907770
56#define ID_AHA_274x 0x0490777150#define ID_AHA_274x 0x04907771
drivers/scsi/aic7xxx/aic79xx.h+0−6
@@ -607,9 +607,6 @@ struct scb { · 606 unmodified lines
607 ahd_io_ctx_t io_ctx;607 ahd_io_ctx_t io_ctx;
608 struct ahd_softc *ahd_softc;608 struct ahd_softc *ahd_softc;
609 scb_flag flags;609 scb_flag flags;
610#ifndef __linux__
611 bus_dmamap_t dmamap;
612#endif
613 struct scb_platform_data *platform_data;610 struct scb_platform_data *platform_data;
614 struct map_node *hscb_map;611 struct map_node *hscb_map;
615 struct map_node *sg_map;612 struct map_node *sg_map;
@@ -1056,9 +1053,6 @@ struct ahd_completion · 440 unmodified lines
1056struct ahd_softc {1053struct ahd_softc {
1057 bus_space_tag_t tags[2];1054 bus_space_tag_t tags[2];
1058 bus_space_handle_t bshs[2];1055 bus_space_handle_t bshs[2];
1059#ifndef __linux__
1060 bus_dma_tag_t buffer_dmat; /* dmat for buffer I/O */
1061#endif
1062 struct scb_data scb_data;1056 struct scb_data scb_data;
1063 1057
1064 struct hardware_scb *next_queued_hscb;1058 struct hardware_scb *next_queued_hscb;
drivers/scsi/aic7xxx/aic79xx_core.c+0−44
@@ -40,16 +40,9 @@ · 39 unmodified lines
40 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#250 $40 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#250 $
41 */41 */
42 42
43#ifdef __linux__
44#include "aic79xx_osm.h"43#include "aic79xx_osm.h"
45#include "aic79xx_inline.h"44#include "aic79xx_inline.h"
46#include "aicasm/aicasm_insformat.h"45#include "aicasm/aicasm_insformat.h"
47#else
48#include <dev/aic7xxx/aic79xx_osm.h>
49#include <dev/aic7xxx/aic79xx_inline.h>
50#include <dev/aic7xxx/aicasm/aicasm_insformat.h>
51#endif
52
53 46
54/***************************** Lookup Tables **********************************/47/***************************** Lookup Tables **********************************/
55static const char *const ahd_chip_names[] =48static const char *const ahd_chip_names[] =
@@ -59,7 +52,6 @@ static const char *const ahd_chip_names[] = · 3 unmodified lines
59 "aic7902",52 "aic7902",
60 "aic7901A"53 "aic7901A"
61};54};
62static const u_int num_chip_names = ARRAY_SIZE(ahd_chip_names);
63 55
64/*56/*
65 * Hardware error codes.57 * Hardware error codes.
@@ -6172,17 +6164,11 @@ ahd_free(struct ahd_softc *ahd) · 6106 unmodified lines
6172 case 2:6164 case 2:
6173 ahd_dma_tag_destroy(ahd, ahd->shared_data_dmat);6165 ahd_dma_tag_destroy(ahd, ahd->shared_data_dmat);
6174 case 1:6166 case 1:
6175#ifndef __linux__
6176 ahd_dma_tag_destroy(ahd, ahd->buffer_dmat);
6177#endif
6178 break;6167 break;
6179 case 0:6168 case 0:
6180 break;6169 break;
6181 }6170 }
6182 6171
6183#ifndef __linux__
6184 ahd_dma_tag_destroy(ahd, ahd->parent_dmat);
6185#endif
6186 ahd_platform_free(ahd);6172 ahd_platform_free(ahd);
6187 ahd_fini_scbdata(ahd);6173 ahd_fini_scbdata(ahd);
6188 for (i = 0; i < AHD_NUM_TARGETS; i++) {6174 for (i = 0; i < AHD_NUM_TARGETS; i++) {
@@ -6934,9 +6920,6 @@ ahd_alloc_scbs(struct ahd_softc *ahd) · 745 unmodified lines
6934 for (i = 0; i < newcount; i++) {6920 for (i = 0; i < newcount; i++) {
6935 struct scb_platform_data *pdata;6921 struct scb_platform_data *pdata;
6936 u_int col_tag;6922 u_int col_tag;
6937#ifndef __linux__
6938 int error;
6939#endif
6940 6923
6941 next_scb = kmalloc(sizeof(*next_scb), GFP_ATOMIC);6924 next_scb = kmalloc(sizeof(*next_scb), GFP_ATOMIC);
6942 if (next_scb == NULL)6925 if (next_scb == NULL)
@@ -6970,15 +6953,6 @@ ahd_alloc_scbs(struct ahd_softc *ahd) · 27 unmodified lines
6970 next_scb->sg_list_busaddr += sizeof(struct ahd_dma_seg);6953 next_scb->sg_list_busaddr += sizeof(struct ahd_dma_seg);
6971 next_scb->ahd_softc = ahd;6954 next_scb->ahd_softc = ahd;
6972 next_scb->flags = SCB_FLAG_NONE;6955 next_scb->flags = SCB_FLAG_NONE;
6973#ifndef __linux__
6974 error = ahd_dmamap_create(ahd, ahd->buffer_dmat, /*flags*/0,
6975 &next_scb->dmamap);
6976 if (error != 0) {
6977 kfree(next_scb);
6978 kfree(pdata);
6979 break;
6980 }
6981#endif
6982 next_scb->hscb->tag = ahd_htole16(scb_data->numscbs);6956 next_scb->hscb->tag = ahd_htole16(scb_data->numscbs);
6983 col_tag = scb_data->numscbs ^ 0x100;6957 col_tag = scb_data->numscbs ^ 0x100;
6984 next_scb->col_scb = ahd_find_scb_by_tag(ahd, col_tag);6958 next_scb->col_scb = ahd_find_scb_by_tag(ahd, col_tag);
@@ -7091,24 +7065,6 @@ ahd_init(struct ahd_softc *ahd) · 106 unmodified lines
7091 if ((AHD_TMODE_ENABLE & (0x1 << ahd->unit)) == 0)7065 if ((AHD_TMODE_ENABLE & (0x1 << ahd->unit)) == 0)
7092 ahd->features &= ~AHD_TARGETMODE;7066 ahd->features &= ~AHD_TARGETMODE;
7093 7067
7094#ifndef __linux__
7095 /* DMA tag for mapping buffers into device visible space. */
7096 if (ahd_dma_tag_create(ahd, ahd->parent_dmat, /*alignment*/1,
7097 /*boundary*/BUS_SPACE_MAXADDR_32BIT + 1,
7098 /*lowaddr*/ahd->flags & AHD_39BIT_ADDRESSING
7099 ? (dma_addr_t)0x7FFFFFFFFFULL
7100 : BUS_SPACE_MAXADDR_32BIT,
7101 /*highaddr*/BUS_SPACE_MAXADDR,
7102 /*filter*/NULL, /*filterarg*/NULL,
7103 /*maxsize*/(AHD_NSEG - 1) * PAGE_SIZE,
7104 /*nsegments*/AHD_NSEG,
7105 /*maxsegsz*/AHD_MAXTRANSFER_SIZE,
7106 /*flags*/BUS_DMA_ALLOCNOW,
7107 &ahd->buffer_dmat) != 0) {
7108 return (ENOMEM);
7109 }
7110#endif
7111
7112 ahd->init_level++;7068 ahd->init_level++;
7113 7069
7114 /*7070 /*
drivers/scsi/aic7xxx/aic79xx_pci.c+0−8
@@ -41,14 +41,8 @@ · 40 unmodified lines
41 * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#92 $41 * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#92 $
42 */42 */
43 43
44#ifdef __linux__
45#include "aic79xx_osm.h"44#include "aic79xx_osm.h"
46#include "aic79xx_inline.h"45#include "aic79xx_inline.h"
47#else
48#include <dev/aic7xxx/aic79xx_osm.h>
49#include <dev/aic7xxx/aic79xx_inline.h>
50#endif
51
52#include "aic79xx_pci.h"46#include "aic79xx_pci.h"
53 47
54static inline uint64_t48static inline uint64_t
@@ -294,13 +288,11 @@ ahd_find_pci_device(ahd_dev_softc_t pci) · 239 unmodified lines
294int288int
295ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry)289ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry)
296{290{
297 struct scb_data *shared_scb_data;
298 u_int command;291 u_int command;
299 uint32_t devconfig;292 uint32_t devconfig;
300 uint16_t subvendor; 293 uint16_t subvendor;
301 int error;294 int error;
302 295
303 shared_scb_data = NULL;
304 ahd->description = entry->name;296 ahd->description = entry->name;
305 /*297 /*
306 * Record if this is an HP board.298 * Record if this is an HP board.
drivers/scsi/aic7xxx/aic7xxx.h+0−6
@@ -568,9 +568,6 @@ struct scb { · 567 unmodified lines
568 ahc_io_ctx_t io_ctx;568 ahc_io_ctx_t io_ctx;
569 struct ahc_softc *ahc_softc;569 struct ahc_softc *ahc_softc;
570 scb_flag flags;570 scb_flag flags;
571#ifndef __linux__
572 bus_dmamap_t dmamap;
573#endif
574 struct scb_platform_data *platform_data;571 struct scb_platform_data *platform_data;
575 struct sg_map_node *sg_map;572 struct sg_map_node *sg_map;
576 struct ahc_dma_seg *sg_list;573 struct ahc_dma_seg *sg_list;
@@ -906,9 +903,6 @@ typedef void ahc_callback_t (void *); · 329 unmodified lines
906struct ahc_softc {903struct ahc_softc {
907 bus_space_tag_t tag;904 bus_space_tag_t tag;
908 bus_space_handle_t bsh;905 bus_space_handle_t bsh;
909#ifndef __linux__
910 bus_dma_tag_t buffer_dmat; /* dmat for buffer I/O */
911#endif
912 struct scb_data *scb_data;906 struct scb_data *scb_data;
913 907
914 struct scb *next_queued_scb;908 struct scb *next_queued_scb;
drivers/scsi/aic7xxx/aic7xxx_93cx6.c+0−6
@@ -64,15 +64,9 @@ · 63 unmodified lines
64 * bit to be sent from the chip.64 * bit to be sent from the chip.
65 */65 */
66 66
67#ifdef __linux__
68#include "aic7xxx_osm.h"67#include "aic7xxx_osm.h"
69#include "aic7xxx_inline.h"68#include "aic7xxx_inline.h"
70#include "aic7xxx_93cx6.h"69#include "aic7xxx_93cx6.h"
71#else
72#include <dev/aic7xxx/aic7xxx_osm.h>
73#include <dev/aic7xxx/aic7xxx_inline.h>
74#include <dev/aic7xxx/aic7xxx_93cx6.h>
75#endif
76 70
77/*71/*
78 * Right now, we only have to read the SEEPROM. But we make it easier to72 * Right now, we only have to read the SEEPROM. But we make it easier to
drivers/scsi/aic7xxx/aic7xxx_core.c+1−40
@@ -40,15 +40,9 @@ · 39 unmodified lines
40 * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#155 $40 * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#155 $
41 */41 */
42 42
43#ifdef __linux__
44#include "aic7xxx_osm.h"43#include "aic7xxx_osm.h"
45#include "aic7xxx_inline.h"44#include "aic7xxx_inline.h"
46#include "aicasm/aicasm_insformat.h"45#include "aicasm/aicasm_insformat.h"
47#else
48#include <dev/aic7xxx/aic7xxx_osm.h>
49#include <dev/aic7xxx/aic7xxx_inline.h>
50#include <dev/aic7xxx/aicasm/aicasm_insformat.h>
51#endif
52 46
53/***************************** Lookup Tables **********************************/47/***************************** Lookup Tables **********************************/
54static const char *const ahc_chip_names[] = {48static const char *const ahc_chip_names[] = {
@@ -67,7 +61,6 @@ static const char *const ahc_chip_names[] = { · 12 unmodified lines
67 "aic7892",61 "aic7892",
68 "aic7899"62 "aic7899"
69};63};
70static const u_int num_chip_names = ARRAY_SIZE(ahc_chip_names);
71 64
72/*65/*
73 * Hardware error codes.66 * Hardware error codes.
@@ -4509,17 +4502,11 @@ ahc_free(struct ahc_softc *ahc) · 4435 unmodified lines
4509 case 2:4502 case 2:
4510 ahc_dma_tag_destroy(ahc, ahc->shared_data_dmat);4503 ahc_dma_tag_destroy(ahc, ahc->shared_data_dmat);
4511 case 1:4504 case 1:
4512#ifndef __linux__
4513 ahc_dma_tag_destroy(ahc, ahc->buffer_dmat);
4514#endif
4515 break;4505 break;
4516 case 0:4506 case 0:
4517 break;4507 break;
4518 }4508 }
4519 4509
4520#ifndef __linux__
4521 ahc_dma_tag_destroy(ahc, ahc->parent_dmat);
4522#endif
4523 ahc_platform_free(ahc);4510 ahc_platform_free(ahc);
4524 ahc_fini_scbdata(ahc);4511 ahc_fini_scbdata(ahc);
4525 for (i = 0; i < AHC_NUM_TARGETS; i++) {4512 for (i = 0; i < AHC_NUM_TARGETS; i++) {
@@ -5005,9 +4992,7 @@ ahc_alloc_scbs(struct ahc_softc *ahc) · 479 unmodified lines
5005 newcount = min(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs));4992 newcount = min(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs));
5006 for (i = 0; i < newcount; i++) {4993 for (i = 0; i < newcount; i++) {
5007 struct scb_platform_data *pdata;4994 struct scb_platform_data *pdata;
5008#ifndef __linux__4995
5009 int error;
5010#endif
5011 pdata = kmalloc(sizeof(*pdata), GFP_ATOMIC);4996 pdata = kmalloc(sizeof(*pdata), GFP_ATOMIC);
5012 if (pdata == NULL)4997 if (pdata == NULL)
5013 break;4998 break;
@@ -5021,12 +5006,6 @@ ahc_alloc_scbs(struct ahc_softc *ahc) · 7 unmodified lines
5021 next_scb->sg_list_phys = physaddr + sizeof(struct ahc_dma_seg);5006 next_scb->sg_list_phys = physaddr + sizeof(struct ahc_dma_seg);
5022 next_scb->ahc_softc = ahc;5007 next_scb->ahc_softc = ahc;
5023 next_scb->flags = SCB_FREE;5008 next_scb->flags = SCB_FREE;
5024#ifndef __linux__
5025 error = ahc_dmamap_create(ahc, ahc->buffer_dmat, /*flags*/0,
5026 &next_scb->dmamap);
5027 if (error != 0)
5028 break;
5029#endif
5030 next_scb->hscb = &scb_data->hscbs[scb_data->numscbs];5009 next_scb->hscb = &scb_data->hscbs[scb_data->numscbs];
5031 next_scb->hscb->tag = ahc->scb_data->numscbs;5010 next_scb->hscb->tag = ahc->scb_data->numscbs;
5032 SLIST_INSERT_HEAD(&ahc->scb_data->free_scbs,5011 SLIST_INSERT_HEAD(&ahc->scb_data->free_scbs,
@@ -5325,24 +5304,6 @@ ahc_init(struct ahc_softc *ahc) · 292 unmodified lines
5325 if ((AHC_TMODE_ENABLE & (0x1 << ahc->unit)) == 0)5304 if ((AHC_TMODE_ENABLE & (0x1 << ahc->unit)) == 0)
5326 ahc->features &= ~AHC_TARGETMODE;5305 ahc->features &= ~AHC_TARGETMODE;
5327 5306
5328#ifndef __linux__
5329 /* DMA tag for mapping buffers into device visible space. */
5330 if (ahc_dma_tag_create(ahc, ahc->parent_dmat, /*alignment*/1,
5331 /*boundary*/BUS_SPACE_MAXADDR_32BIT + 1,
5332 /*lowaddr*/ahc->flags & AHC_39BIT_ADDRESSING
5333 ? (dma_addr_t)0x7FFFFFFFFFULL
5334 : BUS_SPACE_MAXADDR_32BIT,
5335 /*highaddr*/BUS_SPACE_MAXADDR,
5336 /*filter*/NULL, /*filterarg*/NULL,
5337 /*maxsize*/(AHC_NSEG - 1) * PAGE_SIZE,
5338 /*nsegments*/AHC_NSEG,
5339 /*maxsegsz*/AHC_MAXTRANSFER_SIZE,
5340 /*flags*/BUS_DMA_ALLOCNOW,
5341 &ahc->buffer_dmat) != 0) {
5342 return (ENOMEM);
5343 }
5344#endif
5345
5346 ahc->init_level++;5307 ahc->init_level++;
5347 5308
5348 /*5309 /*
drivers/scsi/aic7xxx/aic7xxx_pci.c+0−7
@@ -42,16 +42,9 @@ · 41 unmodified lines
42 * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#79 $42 * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#79 $
43 */43 */
44 44
45#ifdef __linux__
46#include "aic7xxx_osm.h"45#include "aic7xxx_osm.h"
47#include "aic7xxx_inline.h"46#include "aic7xxx_inline.h"
48#include "aic7xxx_93cx6.h"47#include "aic7xxx_93cx6.h"
49#else
50#include <dev/aic7xxx/aic7xxx_osm.h>
51#include <dev/aic7xxx/aic7xxx_inline.h>
52#include <dev/aic7xxx/aic7xxx_93cx6.h>
53#endif
54
55#include "aic7xxx_pci.h"48#include "aic7xxx_pci.h"
56 49
57static inline uint64_t50static inline uint64_t
drivers/scsi/aic7xxx/aicasm/aicasm.h+0−4
@@ -42,11 +42,7 @@ · 41 unmodified lines
42 * $FreeBSD$42 * $FreeBSD$
43 */43 */
44 44
45#ifdef __linux__
46#include "../queue.h"45#include "../queue.h"
47#else
48#include <sys/queue.h>
49#endif
50 46
51#ifndef TRUE47#ifndef TRUE
52#define TRUE 148#define TRUE 1
drivers/scsi/aic7xxx/aicasm/aicasm_gram.y+0−4
@@ -52,11 +52,7 @@ · 51 unmodified lines
52#include <string.h>52#include <string.h>
53#include <sysexits.h>53#include <sysexits.h>
54 54
55#ifdef __linux__
56#include "../queue.h"55#include "../queue.h"
57#else
58#include <sys/queue.h>
59#endif
60 56
61#include "aicasm.h"57#include "aicasm.h"
62#include "aicasm_symbol.h"58#include "aicasm_symbol.h"
drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y+0−4
@@ -52,11 +52,7 @@ · 51 unmodified lines
52#include <string.h>52#include <string.h>
53#include <sysexits.h>53#include <sysexits.h>
54 54
55#ifdef __linux__
56#include "../queue.h"55#include "../queue.h"
57#else
58#include <sys/queue.h>
59#endif
60 56
61#include "aicasm.h"57#include "aicasm.h"
62#include "aicasm_symbol.h"58#include "aicasm_symbol.h"
drivers/scsi/aic7xxx/aicasm/aicasm_macro_scan.l+0−4
@@ -51,11 +51,7 @@ · 50 unmodified lines
51#include <stdio.h>51#include <stdio.h>
52#include <string.h>52#include <string.h>
53#include <sysexits.h>53#include <sysexits.h>
54#ifdef __linux__
55#include "../queue.h"54#include "../queue.h"
56#else
57#include <sys/queue.h>
58#endif
59 55
60#include "aicasm.h"56#include "aicasm.h"
61#include "aicasm_symbol.h"57#include "aicasm_symbol.h"
drivers/scsi/aic7xxx/aicasm/aicasm_scan.l+0−4
@@ -51,11 +51,7 @@ · 50 unmodified lines
51#include <stdio.h>51#include <stdio.h>
52#include <string.h>52#include <string.h>
53#include <sysexits.h>53#include <sysexits.h>
54#ifdef __linux__
55#include "../queue.h"54#include "../queue.h"
56#else
57#include <sys/queue.h>
58#endif
59 55
60#include "aicasm.h"56#include "aicasm.h"
61#include "aicasm_symbol.h"57#include "aicasm_symbol.h"
drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c+0−4
@@ -44,11 +44,7 @@ · 43 unmodified lines
44 44
45#include <sys/types.h>45#include <sys/types.h>
46 46
47#ifdef __linux__
48#include "aicdb.h"47#include "aicdb.h"
49#else
50#include <db.h>
51#endif
52#include <fcntl.h>48#include <fcntl.h>
53#include <inttypes.h>49#include <inttypes.h>
54#include <regex.h>50#include <regex.h>
drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h+0−4
@@ -42,11 +42,7 @@ · 41 unmodified lines
42 * $FreeBSD$42 * $FreeBSD$
43 */43 */
44 44
45#ifdef __linux__
46#include "../queue.h"45#include "../queue.h"
47#else
48#include <sys/queue.h>
49#endif
50 46
51typedef enum {47typedef enum {
52 UNINITIALIZED,48 UNINITIALIZED,
drivers/scsi/aic94xx/aic94xx_init.c+2−7
@@ -771,13 +771,8 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) · 770 unmodified lines
771 goto Err_remove;771 goto Err_remove;
772 772
773 err = -ENODEV;773 err = -ENODEV;
774 if (!pci_set_dma_mask(dev, DMA_BIT_MASK(64))774 if (dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)) ||
775 && !pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(64)))775 dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32))) {
776 ;
777 else if (!pci_set_dma_mask(dev, DMA_BIT_MASK(32))
778 && !pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(32)))
779 ;
780 else {
781 asd_printk("no suitable DMA mask for %s\n", pci_name(dev));776 asd_printk("no suitable DMA mask for %s\n", pci_name(dev));
782 goto Err_remove;777 goto Err_remove;
783 }778 }
drivers/scsi/aic94xx/aic94xx_scb.c+5−0
@@ -724,9 +724,11 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd) · 723 unmodified lines
724 switch (pd->max_sas_lrate) {724 switch (pd->max_sas_lrate) {
725 case SAS_LINK_RATE_6_0_GBPS:725 case SAS_LINK_RATE_6_0_GBPS:
726 *speed_mask &= ~SAS_SPEED_60_DIS;726 *speed_mask &= ~SAS_SPEED_60_DIS;
727 /* fall through*/
727 default:728 default:
728 case SAS_LINK_RATE_3_0_GBPS:729 case SAS_LINK_RATE_3_0_GBPS:
729 *speed_mask &= ~SAS_SPEED_30_DIS;730 *speed_mask &= ~SAS_SPEED_30_DIS;
731 /* fall through*/
730 case SAS_LINK_RATE_1_5_GBPS:732 case SAS_LINK_RATE_1_5_GBPS:
731 *speed_mask &= ~SAS_SPEED_15_DIS;733 *speed_mask &= ~SAS_SPEED_15_DIS;
732 }734 }
@@ -734,6 +736,7 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd) · 1 unmodified line
734 switch (pd->min_sas_lrate) {736 switch (pd->min_sas_lrate) {
735 case SAS_LINK_RATE_6_0_GBPS:737 case SAS_LINK_RATE_6_0_GBPS:
736 *speed_mask |= SAS_SPEED_30_DIS;738 *speed_mask |= SAS_SPEED_30_DIS;
739 /* fall through*/
737 case SAS_LINK_RATE_3_0_GBPS:740 case SAS_LINK_RATE_3_0_GBPS:
738 *speed_mask |= SAS_SPEED_15_DIS;741 *speed_mask |= SAS_SPEED_15_DIS;
739 default:742 default:
@@ -745,6 +748,7 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd) · 5 unmodified lines
745 switch (pd->max_sata_lrate) {748 switch (pd->max_sata_lrate) {
746 case SAS_LINK_RATE_3_0_GBPS:749 case SAS_LINK_RATE_3_0_GBPS:
747 *speed_mask &= ~SATA_SPEED_30_DIS;750 *speed_mask &= ~SATA_SPEED_30_DIS;
751 /* fall through*/
748 default:752 default:
749 case SAS_LINK_RATE_1_5_GBPS:753 case SAS_LINK_RATE_1_5_GBPS:
750 *speed_mask &= ~SATA_SPEED_15_DIS;754 *speed_mask &= ~SATA_SPEED_15_DIS;
@@ -803,6 +807,7 @@ void asd_build_control_phy(struct asd_ascb *ascb, int phy_id, u8 subfunc) · 52 unmodified lines
803 807
804 /* link reset retries, this should be nominal */808 /* link reset retries, this should be nominal */
805 control_phy->link_reset_retries = 10;809 control_phy->link_reset_retries = 10;
810 /* fall through */
806 811
807 case RELEASE_SPINUP_HOLD: /* 0x02 */812 case RELEASE_SPINUP_HOLD: /* 0x02 */
808 /* decide the func_mask */813 /* decide the func_mask */
drivers/scsi/aic94xx/aic94xx_task.c+23−23
@@ -42,13 +42,13 @@ static void asd_can_dequeue(struct asd_ha_struct *asd_ha, int num) · 41 unmodified lines
42 spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags);42 spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags);
43}43}
44 44
45/* PCI_DMA_... to our direction translation.45/* DMA_... to our direction translation.
46 */46 */
47static const u8 data_dir_flags[] = {47static const u8 data_dir_flags[] = {
48 [PCI_DMA_BIDIRECTIONAL] = DATA_DIR_BYRECIPIENT, /* UNSPECIFIED */48 [DMA_BIDIRECTIONAL] = DATA_DIR_BYRECIPIENT, /* UNSPECIFIED */
49 [PCI_DMA_TODEVICE] = DATA_DIR_OUT, /* OUTBOUND */49 [DMA_TO_DEVICE] = DATA_DIR_OUT, /* OUTBOUND */
50 [PCI_DMA_FROMDEVICE] = DATA_DIR_IN, /* INBOUND */50 [DMA_FROM_DEVICE] = DATA_DIR_IN, /* INBOUND */
51 [PCI_DMA_NONE] = DATA_DIR_NONE, /* NO TRANSFER */51 [DMA_NONE] = DATA_DIR_NONE, /* NO TRANSFER */
52};52};
53 53
54static int asd_map_scatterlist(struct sas_task *task,54static int asd_map_scatterlist(struct sas_task *task,
@@ -60,12 +60,12 @@ static int asd_map_scatterlist(struct sas_task *task, · 5 unmodified lines
60 struct scatterlist *sc;60 struct scatterlist *sc;
61 int num_sg, res;61 int num_sg, res;
62 62
63 if (task->data_dir == PCI_DMA_NONE)63 if (task->data_dir == DMA_NONE)
64 return 0;64 return 0;
65 65
66 if (task->num_scatter == 0) {66 if (task->num_scatter == 0) {
67 void *p = task->scatter;67 void *p = task->scatter;
68 dma_addr_t dma = pci_map_single(asd_ha->pcidev, p,68 dma_addr_t dma = dma_map_single(&asd_ha->pcidev->dev, p,
69 task->total_xfer_len,69 task->total_xfer_len,
70 task->data_dir);70 task->data_dir);
71 sg_arr[0].bus_addr = cpu_to_le64((u64)dma);71 sg_arr[0].bus_addr = cpu_to_le64((u64)dma);
@@ -79,7 +79,7 @@ static int asd_map_scatterlist(struct sas_task *task, · 7 unmodified lines
79 if (sas_protocol_ata(task->task_proto))79 if (sas_protocol_ata(task->task_proto))
80 num_sg = task->num_scatter;80 num_sg = task->num_scatter;
81 else81 else
82 num_sg = pci_map_sg(asd_ha->pcidev, task->scatter,82 num_sg = dma_map_sg(&asd_ha->pcidev->dev, task->scatter,
83 task->num_scatter, task->data_dir);83 task->num_scatter, task->data_dir);
84 if (num_sg == 0)84 if (num_sg == 0)
85 return -ENOMEM;85 return -ENOMEM;
@@ -126,8 +126,8 @@ static int asd_map_scatterlist(struct sas_task *task, · 40 unmodified lines
126 return 0;126 return 0;
127err_unmap:127err_unmap:
128 if (sas_protocol_ata(task->task_proto))128 if (sas_protocol_ata(task->task_proto))
129 pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter,129 dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter,
130 task->data_dir);130 task->num_scatter, task->data_dir);
131 return res;131 return res;
132}132}
133 133
@@ -136,21 +136,21 @@ static void asd_unmap_scatterlist(struct asd_ascb *ascb) · 2 unmodified lines
136 struct asd_ha_struct *asd_ha = ascb->ha;136 struct asd_ha_struct *asd_ha = ascb->ha;
137 struct sas_task *task = ascb->uldd_task;137 struct sas_task *task = ascb->uldd_task;
138 138
139 if (task->data_dir == PCI_DMA_NONE)139 if (task->data_dir == DMA_NONE)
140 return;140 return;
141 141
142 if (task->num_scatter == 0) {142 if (task->num_scatter == 0) {
143 dma_addr_t dma = (dma_addr_t)143 dma_addr_t dma = (dma_addr_t)
144 le64_to_cpu(ascb->scb->ssp_task.sg_element[0].bus_addr);144 le64_to_cpu(ascb->scb->ssp_task.sg_element[0].bus_addr);
145 pci_unmap_single(ascb->ha->pcidev, dma, task->total_xfer_len,145 dma_unmap_single(&ascb->ha->pcidev->dev, dma,
146 task->data_dir);146 task->total_xfer_len, task->data_dir);
147 return;147 return;
148 }148 }
149 149
150 asd_free_coherent(asd_ha, ascb->sg_arr);150 asd_free_coherent(asd_ha, ascb->sg_arr);
151 if (task->task_proto != SAS_PROTOCOL_STP)151 if (task->task_proto != SAS_PROTOCOL_STP)
152 pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter,152 dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter,
153 task->data_dir);153 task->num_scatter, task->data_dir);
154}154}
155 155
156/* ---------- Task complete tasklet ---------- */156/* ---------- Task complete tasklet ---------- */
@@ -436,10 +436,10 @@ static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task, · 279 unmodified lines
436 struct domain_device *dev = task->dev;436 struct domain_device *dev = task->dev;
437 struct scb *scb;437 struct scb *scb;
438 438
439 pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_req, 1,439 dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_req, 1,
440 PCI_DMA_TODEVICE);440 DMA_TO_DEVICE);
441 pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_resp, 1,441 dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_resp, 1,
442 PCI_DMA_FROMDEVICE);442 DMA_FROM_DEVICE);
443 443
444 scb = ascb->scb;444 scb = ascb->scb;
445 445
@@ -471,10 +471,10 @@ static void asd_unbuild_smp_ascb(struct asd_ascb *a) · 25 unmodified lines
471 struct sas_task *task = a->uldd_task;471 struct sas_task *task = a->uldd_task;
472 472
473 BUG_ON(!task);473 BUG_ON(!task);
474 pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_req, 1,474 dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_req, 1,
475 PCI_DMA_TODEVICE);475 DMA_TO_DEVICE);
476 pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_resp, 1,476 dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_resp, 1,
477 PCI_DMA_FROMDEVICE);477 DMA_FROM_DEVICE);
478}478}
479 479
480/* ---------- SSP ---------- */480/* ---------- SSP ---------- */
drivers/scsi/am53c974.c+12−42
@@ -96,9 +96,7 @@ static void pci_esp_dma_drain(struct esp *esp); · 95 unmodified lines
96 96
97static inline struct pci_esp_priv *pci_esp_get_priv(struct esp *esp)97static inline struct pci_esp_priv *pci_esp_get_priv(struct esp *esp)
98{98{
99 struct pci_dev *pdev = esp->dev;99 return dev_get_drvdata(esp->dev);
100
101 return pci_get_drvdata(pdev);
102}100}
103 101
104static void pci_esp_write8(struct esp *esp, u8 val, unsigned long reg)102static void pci_esp_write8(struct esp *esp, u8 val, unsigned long reg)
@@ -116,30 +114,6 @@ static void pci_esp_write32(struct esp *esp, u32 val, unsigned long reg) · 11 unmodified lines
116 return iowrite32(val, esp->regs + (reg * 4UL));114 return iowrite32(val, esp->regs + (reg * 4UL));
117}115}
118 116
119static dma_addr_t pci_esp_map_single(struct esp *esp, void *buf,
120 size_t sz, int dir)
121{
122 return pci_map_single(esp->dev, buf, sz, dir);
123}
124
125static int pci_esp_map_sg(struct esp *esp, struct scatterlist *sg,
126 int num_sg, int dir)
127{
128 return pci_map_sg(esp->dev, sg, num_sg, dir);
129}
130
131static void pci_esp_unmap_single(struct esp *esp, dma_addr_t addr,
132 size_t sz, int dir)
133{
134 pci_unmap_single(esp->dev, addr, sz, dir);
135}
136
137static void pci_esp_unmap_sg(struct esp *esp, struct scatterlist *sg,
138 int num_sg, int dir)
139{
140 pci_unmap_sg(esp->dev, sg, num_sg, dir);
141}
142
143static int pci_esp_irq_pending(struct esp *esp)117static int pci_esp_irq_pending(struct esp *esp)
144{118{
145 struct pci_esp_priv *pep = pci_esp_get_priv(esp);119 struct pci_esp_priv *pep = pci_esp_get_priv(esp);
@@ -295,10 +269,6 @@ static u32 pci_esp_dma_length_limit(struct esp *esp, u32 dma_addr, u32 dma_len) · 149 unmodified lines
295static const struct esp_driver_ops pci_esp_ops = {269static const struct esp_driver_ops pci_esp_ops = {
296 .esp_write8 = pci_esp_write8,270 .esp_write8 = pci_esp_write8,
297 .esp_read8 = pci_esp_read8,271 .esp_read8 = pci_esp_read8,
298 .map_single = pci_esp_map_single,
299 .map_sg = pci_esp_map_sg,
300 .unmap_single = pci_esp_unmap_single,
301 .unmap_sg = pci_esp_unmap_sg,
302 .irq_pending = pci_esp_irq_pending,272 .irq_pending = pci_esp_irq_pending,
303 .reset_dma = pci_esp_reset_dma,273 .reset_dma = pci_esp_reset_dma,
304 .dma_drain = pci_esp_dma_drain,274 .dma_drain = pci_esp_dma_drain,
@@ -375,18 +345,18 @@ static void dc390_read_eeprom(struct pci_dev *pdev, u16 *ptr) · 70 unmodified lines
375 345
376static void dc390_check_eeprom(struct esp *esp)346static void dc390_check_eeprom(struct esp *esp)
377{347{
348 struct pci_dev *pdev = to_pci_dev(esp->dev);
378 u8 EEbuf[128];349 u8 EEbuf[128];
379 u16 *ptr = (u16 *)EEbuf, wval = 0;350 u16 *ptr = (u16 *)EEbuf, wval = 0;
380 int i;351 int i;
381 352
382 dc390_read_eeprom((struct pci_dev *)esp->dev, ptr);353 dc390_read_eeprom(pdev, ptr);
383 354
384 for (i = 0; i < DC390_EEPROM_LEN; i++, ptr++)355 for (i = 0; i < DC390_EEPROM_LEN; i++, ptr++)
385 wval += *ptr;356 wval += *ptr;
386 357
387 /* no Tekram EEprom found */358 /* no Tekram EEprom found */
388 if (wval != 0x1234) {359 if (wval != 0x1234) {
389 struct pci_dev *pdev = esp->dev;
390 dev_printk(KERN_INFO, &pdev->dev,360 dev_printk(KERN_INFO, &pdev->dev,
391 "No valid Tekram EEprom found\n");361 "No valid Tekram EEprom found\n");
392 return;362 return;
@@ -411,7 +381,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev, · 18 unmodified lines
411 return -ENODEV;381 return -ENODEV;
412 }382 }
413 383
414 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {384 if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
415 dev_printk(KERN_INFO, &pdev->dev,385 dev_printk(KERN_INFO, &pdev->dev,
416 "failed to set 32bit DMA mask\n");386 "failed to set 32bit DMA mask\n");
417 goto fail_disable_device;387 goto fail_disable_device;
@@ -435,7 +405,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev, · 17 unmodified lines
435 405
436 esp = shost_priv(shost);406 esp = shost_priv(shost);
437 esp->host = shost;407 esp->host = shost;
438 esp->dev = pdev;408 esp->dev = &pdev->dev;
439 esp->ops = &pci_esp_ops;409 esp->ops = &pci_esp_ops;
440 /*410 /*
441 * The am53c974 HBA has a design flaw of generating411 * The am53c974 HBA has a design flaw of generating
@@ -467,8 +437,8 @@ static int pci_esp_probe_one(struct pci_dev *pdev, · 25 unmodified lines
467 437
468 pci_set_master(pdev);438 pci_set_master(pdev);
469 439
470 esp->command_block = pci_alloc_consistent(pdev, 16,440 esp->command_block = dma_alloc_coherent(&pdev->dev, 16,
471 &esp->command_block_dma);441 &esp->command_block_dma, GFP_KERNEL);
472 if (!esp->command_block) {442 if (!esp->command_block) {
473 dev_printk(KERN_ERR, &pdev->dev,443 dev_printk(KERN_ERR, &pdev->dev,
474 "failed to allocate command block\n");444 "failed to allocate command block\n");
@@ -498,7 +468,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev, · 23 unmodified lines
498 /* Assume 40MHz clock */468 /* Assume 40MHz clock */
499 esp->cfreq = 40000000;469 esp->cfreq = 40000000;
500 470
501 err = scsi_esp_register(esp, &pdev->dev);471 err = scsi_esp_register(esp);
502 if (err)472 if (err)
503 goto fail_free_irq;473 goto fail_free_irq;
504 474
@@ -508,8 +478,8 @@ fail_free_irq: · 3 unmodified lines
508 free_irq(pdev->irq, esp);478 free_irq(pdev->irq, esp);
509fail_unmap_command_block:479fail_unmap_command_block:
510 pci_set_drvdata(pdev, NULL);480 pci_set_drvdata(pdev, NULL);
511 pci_free_consistent(pdev, 16, esp->command_block,481 dma_free_coherent(&pdev->dev, 16, esp->command_block,
512 esp->command_block_dma);482 esp->command_block_dma);
513fail_unmap_regs:483fail_unmap_regs:
514 pci_iounmap(pdev, esp->regs);484 pci_iounmap(pdev, esp->regs);
515fail_release_regions:485fail_release_regions:
@@ -532,8 +502,8 @@ static void pci_esp_remove_one(struct pci_dev *pdev) · 16 unmodified lines
532 scsi_esp_unregister(esp);502 scsi_esp_unregister(esp);
533 free_irq(pdev->irq, esp);503 free_irq(pdev->irq, esp);
534 pci_set_drvdata(pdev, NULL);504 pci_set_drvdata(pdev, NULL);
535 pci_free_consistent(pdev, 16, esp->command_block,505 dma_free_coherent(&pdev->dev, 16, esp->command_block,
536 esp->command_block_dma);506 esp->command_block_dma);
537 pci_iounmap(pdev, esp->regs);507 pci_iounmap(pdev, esp->regs);
538 pci_release_regions(pdev);508 pci_release_regions(pdev);
539 pci_disable_device(pdev);509 pci_disable_device(pdev);
drivers/scsi/arcmsr/arcmsr_hba.c+13−16
@@ -1317,13 +1317,10 @@ static void arcmsr_report_ccb_state(struct AdapterControlBlock *acb, · 1316 unmodified lines
1317 1317
1318static void arcmsr_drain_donequeue(struct AdapterControlBlock *acb, struct CommandControlBlock *pCCB, bool error)1318static void arcmsr_drain_donequeue(struct AdapterControlBlock *acb, struct CommandControlBlock *pCCB, bool error)
1319{1319{
1320 int id, lun;
1321 if ((pCCB->acb != acb) || (pCCB->startdone != ARCMSR_CCB_START)) {1320 if ((pCCB->acb != acb) || (pCCB->startdone != ARCMSR_CCB_START)) {
1322 if (pCCB->startdone == ARCMSR_CCB_ABORTED) {1321 if (pCCB->startdone == ARCMSR_CCB_ABORTED) {
1323 struct scsi_cmnd *abortcmd = pCCB->pcmd;1322 struct scsi_cmnd *abortcmd = pCCB->pcmd;
1324 if (abortcmd) {1323 if (abortcmd) {
1325 id = abortcmd->device->id;
1326 lun = abortcmd->device->lun;
1327 abortcmd->result |= DID_ABORT << 16;1324 abortcmd->result |= DID_ABORT << 16;
1328 arcmsr_ccb_complete(pCCB);1325 arcmsr_ccb_complete(pCCB);
1329 printk(KERN_NOTICE "arcmsr%d: pCCB ='0x%p' isr got aborted command \n",1326 printk(KERN_NOTICE "arcmsr%d: pCCB ='0x%p' isr got aborted command \n",
@@ -1798,7 +1795,7 @@ static void arcmsr_hbaA_stop_bgrb(struct AdapterControlBlock *acb) · 468 unmodified lines
1798 writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, &reg->inbound_msgaddr0);1795 writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, &reg->inbound_msgaddr0);
1799 if (!arcmsr_hbaA_wait_msgint_ready(acb)) {1796 if (!arcmsr_hbaA_wait_msgint_ready(acb)) {
1800 printk(KERN_NOTICE1797 printk(KERN_NOTICE
1801 "arcmsr%d: wait 'stop adapter background rebulid' timeout\n"1798 "arcmsr%d: wait 'stop adapter background rebuild' timeout\n"
1802 , acb->host->host_no);1799 , acb->host->host_no);
1803 }1800 }
1804}1801}
@@ -1811,7 +1808,7 @@ static void arcmsr_hbaB_stop_bgrb(struct AdapterControlBlock *acb) · 6 unmodified lines
1811 1808
1812 if (!arcmsr_hbaB_wait_msgint_ready(acb)) {1809 if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
1813 printk(KERN_NOTICE1810 printk(KERN_NOTICE
1814 "arcmsr%d: wait 'stop adapter background rebulid' timeout\n"1811 "arcmsr%d: wait 'stop adapter background rebuild' timeout\n"
1815 , acb->host->host_no);1812 , acb->host->host_no);
1816 }1813 }
1817}1814}
@@ -1824,7 +1821,7 @@ static void arcmsr_hbaC_stop_bgrb(struct AdapterControlBlock *pACB) · 6 unmodified lines
1824 writel(ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE, &reg->inbound_doorbell);1821 writel(ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE, &reg->inbound_doorbell);
1825 if (!arcmsr_hbaC_wait_msgint_ready(pACB)) {1822 if (!arcmsr_hbaC_wait_msgint_ready(pACB)) {
1826 printk(KERN_NOTICE1823 printk(KERN_NOTICE
1827 "arcmsr%d: wait 'stop adapter background rebulid' timeout\n"1824 "arcmsr%d: wait 'stop adapter background rebuild' timeout\n"
1828 , pACB->host->host_no);1825 , pACB->host->host_no);
1829 }1826 }
1830 return;1827 return;
@@ -1837,7 +1834,7 @@ static void arcmsr_hbaD_stop_bgrb(struct AdapterControlBlock *pACB) · 6 unmodified lines
1837 pACB->acb_flags &= ~ACB_F_MSG_START_BGRB;1834 pACB->acb_flags &= ~ACB_F_MSG_START_BGRB;
1838 writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, reg->inbound_msgaddr0);1835 writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, reg->inbound_msgaddr0);
1839 if (!arcmsr_hbaD_wait_msgint_ready(pACB))1836 if (!arcmsr_hbaD_wait_msgint_ready(pACB))
1840 pr_notice("arcmsr%d: wait 'stop adapter background rebulid' "1837 pr_notice("arcmsr%d: wait 'stop adapter background rebuild' "
1841 "timeout\n", pACB->host->host_no);1838 "timeout\n", pACB->host->host_no);
1842}1839}
1843 1840
@@ -1850,7 +1847,7 @@ static void arcmsr_hbaE_stop_bgrb(struct AdapterControlBlock *pACB) · 6 unmodified lines
1850 pACB->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE;1847 pACB->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE;
1851 writel(pACB->out_doorbell, &reg->iobound_doorbell);1848 writel(pACB->out_doorbell, &reg->iobound_doorbell);
1852 if (!arcmsr_hbaE_wait_msgint_ready(pACB)) {1849 if (!arcmsr_hbaE_wait_msgint_ready(pACB)) {
1853 pr_notice("arcmsr%d: wait 'stop adapter background rebulid' "1850 pr_notice("arcmsr%d: wait 'stop adapter background rebuild' "
1854 "timeout\n", pACB->host->host_no);1851 "timeout\n", pACB->host->host_no);
1855 }1852 }
1856}1853}
@@ -3927,7 +3924,7 @@ static void arcmsr_hbaA_start_bgrb(struct AdapterControlBlock *acb) · 2070 unmodified lines
3927 writel(ARCMSR_INBOUND_MESG0_START_BGRB, &reg->inbound_msgaddr0);3924 writel(ARCMSR_INBOUND_MESG0_START_BGRB, &reg->inbound_msgaddr0);
3928 if (!arcmsr_hbaA_wait_msgint_ready(acb)) {3925 if (!arcmsr_hbaA_wait_msgint_ready(acb)) {
3929 printk(KERN_NOTICE "arcmsr%d: wait 'start adapter background \3926 printk(KERN_NOTICE "arcmsr%d: wait 'start adapter background \
3930 rebulid' timeout \n", acb->host->host_no);3927 rebuild' timeout \n", acb->host->host_no);
3931 }3928 }
3932}3929}
3933 3930
@@ -3938,7 +3935,7 @@ static void arcmsr_hbaB_start_bgrb(struct AdapterControlBlock *acb) · 4 unmodified lines
3938 writel(ARCMSR_MESSAGE_START_BGRB, reg->drv2iop_doorbell);3935 writel(ARCMSR_MESSAGE_START_BGRB, reg->drv2iop_doorbell);
3939 if (!arcmsr_hbaB_wait_msgint_ready(acb)) {3936 if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
3940 printk(KERN_NOTICE "arcmsr%d: wait 'start adapter background \3937 printk(KERN_NOTICE "arcmsr%d: wait 'start adapter background \
3941 rebulid' timeout \n",acb->host->host_no);3938 rebuild' timeout \n",acb->host->host_no);
3942 }3939 }
3943}3940}
3944 3941
@@ -3950,7 +3947,7 @@ static void arcmsr_hbaC_start_bgrb(struct AdapterControlBlock *pACB) · 5 unmodified lines
3950 writel(ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE, &phbcmu->inbound_doorbell);3947 writel(ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE, &phbcmu->inbound_doorbell);
3951 if (!arcmsr_hbaC_wait_msgint_ready(pACB)) {3948 if (!arcmsr_hbaC_wait_msgint_ready(pACB)) {
3952 printk(KERN_NOTICE "arcmsr%d: wait 'start adapter background \3949 printk(KERN_NOTICE "arcmsr%d: wait 'start adapter background \
3953 rebulid' timeout \n", pACB->host->host_no);3950 rebuild' timeout \n", pACB->host->host_no);
3954 }3951 }
3955 return;3952 return;
3956}3953}
@@ -3963,7 +3960,7 @@ static void arcmsr_hbaD_start_bgrb(struct AdapterControlBlock *pACB) · 6 unmodified lines
3963 writel(ARCMSR_INBOUND_MESG0_START_BGRB, pmu->inbound_msgaddr0);3960 writel(ARCMSR_INBOUND_MESG0_START_BGRB, pmu->inbound_msgaddr0);
3964 if (!arcmsr_hbaD_wait_msgint_ready(pACB)) {3961 if (!arcmsr_hbaD_wait_msgint_ready(pACB)) {
3965 pr_notice("arcmsr%d: wait 'start adapter "3962 pr_notice("arcmsr%d: wait 'start adapter "
3966 "background rebulid' timeout\n", pACB->host->host_no);3963 "background rebuild' timeout\n", pACB->host->host_no);
3967 }3964 }
3968}3965}
3969 3966
@@ -3977,7 +3974,7 @@ static void arcmsr_hbaE_start_bgrb(struct AdapterControlBlock *pACB) · 7 unmodified lines
3977 writel(pACB->out_doorbell, &pmu->iobound_doorbell);3974 writel(pACB->out_doorbell, &pmu->iobound_doorbell);
3978 if (!arcmsr_hbaE_wait_msgint_ready(pACB)) {3975 if (!arcmsr_hbaE_wait_msgint_ready(pACB)) {
3979 pr_notice("arcmsr%d: wait 'start adapter "3976 pr_notice("arcmsr%d: wait 'start adapter "
3980 "background rebulid' timeout \n", pACB->host->host_no);3977 "background rebuild' timeout \n", pACB->host->host_no);
3981 }3978 }
3982}3979}
3983 3980
@@ -4135,9 +4132,9 @@ static void arcmsr_hardware_reset(struct AdapterControlBlock *acb) · 151 unmodified lines
4135 pci_read_config_byte(acb->pdev, i, &value[i]);4132 pci_read_config_byte(acb->pdev, i, &value[i]);
4136 }4133 }
4137 /* hardware reset signal */4134 /* hardware reset signal */
4138 if ((acb->dev_id == 0x1680)) {4135 if (acb->dev_id == 0x1680) {
4139 writel(ARCMSR_ARC1680_BUS_RESET, &pmuA->reserved1[0]);4136 writel(ARCMSR_ARC1680_BUS_RESET, &pmuA->reserved1[0]);
4140 } else if ((acb->dev_id == 0x1880)) {4137 } else if (acb->dev_id == 0x1880) {
4141 do {4138 do {
4142 count++;4139 count++;
4143 writel(0xF, &pmuC->write_sequence);4140 writel(0xF, &pmuC->write_sequence);
@@ -4161,7 +4158,7 @@ static void arcmsr_hardware_reset(struct AdapterControlBlock *acb) · 17 unmodified lines
4161 } while (((readl(&pmuE->host_diagnostic_3xxx) &4158 } while (((readl(&pmuE->host_diagnostic_3xxx) &
4162 ARCMSR_ARC1884_DiagWrite_ENABLE) == 0) && (count < 5));4159 ARCMSR_ARC1884_DiagWrite_ENABLE) == 0) && (count < 5));
4163 writel(ARCMSR_ARC188X_RESET_ADAPTER, &pmuE->host_diagnostic_3xxx);4160 writel(ARCMSR_ARC188X_RESET_ADAPTER, &pmuE->host_diagnostic_3xxx);
4164 } else if ((acb->dev_id == 0x1214)) {4161 } else if (acb->dev_id == 0x1214) {
4165 writel(0x20, pmuD->reset_request);4162 writel(0x20, pmuD->reset_request);
4166 } else {4163 } else {
4167 pci_write_config_byte(acb->pdev, 0x84, 0x20);4164 pci_write_config_byte(acb->pdev, 0x84, 0x20);
drivers/scsi/atp870u.c+3−3
@@ -1193,7 +1193,7 @@ static void atp870u_free_tables(struct Scsi_Host *host) · 1192 unmodified lines
1193 for (k = 0; k < 16; k++) {1193 for (k = 0; k < 16; k++) {
1194 if (!atp_dev->id[j][k].prd_table)1194 if (!atp_dev->id[j][k].prd_table)
1195 continue;1195 continue;
1196 pci_free_consistent(atp_dev->pdev, 1024, atp_dev->id[j][k].prd_table, atp_dev->id[j][k].prd_bus);1196 dma_free_coherent(&atp_dev->pdev->dev, 1024, atp_dev->id[j][k].prd_table, atp_dev->id[j][k].prd_bus);
1197 atp_dev->id[j][k].prd_table = NULL;1197 atp_dev->id[j][k].prd_table = NULL;
1198 }1198 }
1199 }1199 }
@@ -1205,7 +1205,7 @@ static int atp870u_init_tables(struct Scsi_Host *host) · 5 unmodified lines
1205 int c,k;1205 int c,k;
1206 for(c=0;c < 2;c++) {1206 for(c=0;c < 2;c++) {
1207 for(k=0;k<16;k++) {1207 for(k=0;k<16;k++) {
1208 atp_dev->id[c][k].prd_table = pci_alloc_consistent(atp_dev->pdev, 1024, &(atp_dev->id[c][k].prd_bus));1208 atp_dev->id[c][k].prd_table = dma_alloc_coherent(&atp_dev->pdev->dev, 1024, &(atp_dev->id[c][k].prd_bus), GFP_KERNEL);
1209 if (!atp_dev->id[c][k].prd_table) {1209 if (!atp_dev->id[c][k].prd_table) {
1210 printk("atp870u_init_tables fail\n");1210 printk("atp870u_init_tables fail\n");
1211 atp870u_free_tables(host);1211 atp870u_free_tables(host);
@@ -1509,7 +1509,7 @@ static int atp870u_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 297 unmodified lines
1509 if (err)1509 if (err)
1510 goto fail;1510 goto fail;
1511 1511
1512 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {1512 if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
1513 printk(KERN_ERR "atp870u: DMA mask required but not available.\n");1513 printk(KERN_ERR "atp870u: DMA mask required but not available.\n");
1514 err = -EIO;1514 err = -EIO;
1515 goto disable_device;1515 goto disable_device;
drivers/scsi/be2iscsi/be_cmds.c+5−5
@@ -520,7 +520,7 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl, · 519 unmodified lines
520 **/520 **/
521 tag_mem = &ctrl->ptag_state[tag].tag_mem_state;521 tag_mem = &ctrl->ptag_state[tag].tag_mem_state;
522 if (tag_mem->size) {522 if (tag_mem->size) {
523 pci_free_consistent(ctrl->pdev, tag_mem->size,523 dma_free_coherent(&ctrl->pdev->dev, tag_mem->size,
524 tag_mem->va, tag_mem->dma);524 tag_mem->va, tag_mem->dma);
525 tag_mem->size = 0;525 tag_mem->size = 0;
526 }526 }
@@ -1269,12 +1269,12 @@ int beiscsi_check_supported_fw(struct be_ctrl_info *ctrl, · 742 unmodified lines
1269 struct be_sge *sge = nonembedded_sgl(wrb);1269 struct be_sge *sge = nonembedded_sgl(wrb);
1270 int status = 0;1270 int status = 0;
1271 1271
1272 nonemb_cmd.va = pci_alloc_consistent(ctrl->pdev,1272 nonemb_cmd.va = dma_alloc_coherent(&ctrl->pdev->dev,
1273 sizeof(struct be_mgmt_controller_attributes),1273 sizeof(struct be_mgmt_controller_attributes),
1274 &nonemb_cmd.dma);1274 &nonemb_cmd.dma, GFP_KERNEL);
1275 if (nonemb_cmd.va == NULL) {1275 if (nonemb_cmd.va == NULL) {
1276 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,1276 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
1277 "BG_%d : pci_alloc_consistent failed in %s\n",1277 "BG_%d : dma_alloc_coherent failed in %s\n",
1278 __func__);1278 __func__);
1279 return -ENOMEM;1279 return -ENOMEM;
1280 }1280 }
@@ -1314,7 +1314,7 @@ int beiscsi_check_supported_fw(struct be_ctrl_info *ctrl, · 33 unmodified lines
1314 "BG_%d : Failed in beiscsi_check_supported_fw\n");1314 "BG_%d : Failed in beiscsi_check_supported_fw\n");
1315 mutex_unlock(&ctrl->mbox_lock);1315 mutex_unlock(&ctrl->mbox_lock);
1316 if (nonemb_cmd.va)1316 if (nonemb_cmd.va)
1317 pci_free_consistent(ctrl->pdev, nonemb_cmd.size,1317 dma_free_coherent(&ctrl->pdev->dev, nonemb_cmd.size,
1318 nonemb_cmd.va, nonemb_cmd.dma);1318 nonemb_cmd.va, nonemb_cmd.dma);
1319 1319
1320 return status;1320 return status;
drivers/scsi/be2iscsi/be_iscsi.c+8−7
@@ -771,7 +771,7 @@ int beiscsi_get_host_param(struct Scsi_Host *shost, · 770 unmodified lines
771 status = beiscsi_get_initiator_name(phba, buf, false);771 status = beiscsi_get_initiator_name(phba, buf, false);
772 if (status < 0) {772 if (status < 0) {
773 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,773 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
774 "BS_%d : Retreiving Initiator Name Failed\n");774 "BS_%d : Retrieving Initiator Name Failed\n");
775 status = 0;775 status = 0;
776 }776 }
777 }777 }
@@ -1071,9 +1071,9 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, · 293 unmodified lines
1071 else1071 else
1072 req_memsize = sizeof(struct tcp_connect_and_offload_in_v1);1072 req_memsize = sizeof(struct tcp_connect_and_offload_in_v1);
1073 1073
1074 nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev,1074 nonemb_cmd.va = dma_alloc_coherent(&phba->ctrl.pdev->dev,
1075 req_memsize,1075 req_memsize,
1076 &nonemb_cmd.dma);1076 &nonemb_cmd.dma, GFP_KERNEL);
1077 if (nonemb_cmd.va == NULL) {1077 if (nonemb_cmd.va == NULL) {
1078 1078
1079 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,1079 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
@@ -1091,7 +1091,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, · 11 unmodified lines
1091 "BS_%d : mgmt_open_connection Failed for cid=%d\n",1091 "BS_%d : mgmt_open_connection Failed for cid=%d\n",
1092 beiscsi_ep->ep_cid);1092 beiscsi_ep->ep_cid);
1093 1093
1094 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,1094 dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
1095 nonemb_cmd.va, nonemb_cmd.dma);1095 nonemb_cmd.va, nonemb_cmd.dma);
1096 beiscsi_free_ep(beiscsi_ep);1096 beiscsi_free_ep(beiscsi_ep);
1097 return -EAGAIN;1097 return -EAGAIN;
@@ -1104,8 +1104,9 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, · 6 unmodified lines
1104 "BS_%d : mgmt_open_connection Failed");1104 "BS_%d : mgmt_open_connection Failed");
1105 1105
1106 if (ret != -EBUSY)1106 if (ret != -EBUSY)
1107 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,1107 dma_free_coherent(&phba->ctrl.pdev->dev,
1108 nonemb_cmd.va, nonemb_cmd.dma);1108 nonemb_cmd.size, nonemb_cmd.va,
1109 nonemb_cmd.dma);
1109 1110
1110 beiscsi_free_ep(beiscsi_ep);1111 beiscsi_free_ep(beiscsi_ep);
1111 return ret;1112 return ret;
@@ -1118,7 +1119,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, · 6 unmodified lines
1118 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,1119 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1119 "BS_%d : mgmt_open_connection Success\n");1120 "BS_%d : mgmt_open_connection Success\n");
1120 1121
1121 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,1122 dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
1122 nonemb_cmd.va, nonemb_cmd.dma);1123 nonemb_cmd.va, nonemb_cmd.dma);
1123 return 0;1124 return 0;
1124}1125}
drivers/scsi/be2iscsi/be_main.c+31−43
@@ -511,18 +511,9 @@ static int beiscsi_enable_pci(struct pci_dev *pcidev) · 510 unmodified lines
511 }511 }
512 512
513 pci_set_master(pcidev);513 pci_set_master(pcidev);
514 ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(64));514 ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(64));
515 if (ret) {515 if (ret) {
516 ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(32));516 ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
517 if (ret) {
518 dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n");
519 goto pci_region_release;
520 } else {
521 ret = pci_set_consistent_dma_mask(pcidev,
522 DMA_BIT_MASK(32));
523 }
524 } else {
525 ret = pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(64));
526 if (ret) {517 if (ret) {
527 dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n");518 dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n");
528 goto pci_region_release;519 goto pci_region_release;
@@ -550,9 +541,8 @@ static int be_ctrl_init(struct beiscsi_hba *phba, struct pci_dev *pdev) · 21 unmodified lines
550 if (status)541 if (status)
551 return status;542 return status;
552 mbox_mem_alloc->size = sizeof(struct be_mcc_mailbox) + 16;543 mbox_mem_alloc->size = sizeof(struct be_mcc_mailbox) + 16;
553 mbox_mem_alloc->va = pci_alloc_consistent(pdev,544 mbox_mem_alloc->va = dma_alloc_coherent(&pdev->dev,
554 mbox_mem_alloc->size,545 mbox_mem_alloc->size, &mbox_mem_alloc->dma, GFP_KERNEL);
555 &mbox_mem_alloc->dma);
556 if (!mbox_mem_alloc->va) {546 if (!mbox_mem_alloc->va) {
557 beiscsi_unmap_pci_function(phba);547 beiscsi_unmap_pci_function(phba);
558 return -ENOMEM;548 return -ENOMEM;
@@ -1866,7 +1856,6 @@ unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq, int budget) · 1307 unmodified lines
1866{1856{
1867 struct be_queue_info *cq;1857 struct be_queue_info *cq;
1868 struct sol_cqe *sol;1858 struct sol_cqe *sol;
1869 struct dmsg_cqe *dmsg;
1870 unsigned int total = 0;1859 unsigned int total = 0;
1871 unsigned int num_processed = 0;1860 unsigned int num_processed = 0;
1872 unsigned short code = 0, cid = 0;1861 unsigned short code = 0, cid = 0;
@@ -1939,7 +1928,6 @@ unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq, int budget) · 66 unmodified lines
1939 "BM_%d : Received %s[%d] on CID : %d\n",1928 "BM_%d : Received %s[%d] on CID : %d\n",
1940 cqe_desc[code], code, cid);1929 cqe_desc[code], code, cid);
1941 1930
1942 dmsg = (struct dmsg_cqe *)sol;
1943 hwi_complete_drvr_msgs(beiscsi_conn, phba, sol);1931 hwi_complete_drvr_msgs(beiscsi_conn, phba, sol);
1944 break;1932 break;
1945 case UNSOL_HDR_NOTIFY:1933 case UNSOL_HDR_NOTIFY:
@@ -2304,11 +2292,11 @@ static int hwi_write_buffer(struct iscsi_wrb *pwrb, struct iscsi_task *task) · 358 unmodified lines
2304 2292
2305 /* Map addr only if there is data_count */2293 /* Map addr only if there is data_count */
2306 if (dsp_value) {2294 if (dsp_value) {
2307 io_task->mtask_addr = pci_map_single(phba->pcidev,2295 io_task->mtask_addr = dma_map_single(&phba->pcidev->dev,
2308 task->data,2296 task->data,
2309 task->data_count,2297 task->data_count,
2310 PCI_DMA_TODEVICE);2298 DMA_TO_DEVICE);
2311 if (pci_dma_mapping_error(phba->pcidev,2299 if (dma_mapping_error(&phba->pcidev->dev,
2312 io_task->mtask_addr))2300 io_task->mtask_addr))
2313 return -ENOMEM;2301 return -ENOMEM;
2314 io_task->mtask_data_count = task->data_count;2302 io_task->mtask_data_count = task->data_count;
@@ -2519,10 +2507,9 @@ static int beiscsi_alloc_mem(struct beiscsi_hba *phba) · 204 unmodified lines
2519 BEISCSI_MAX_FRAGS_INIT);2507 BEISCSI_MAX_FRAGS_INIT);
2520 curr_alloc_size = min(be_max_phys_size * 1024, alloc_size);2508 curr_alloc_size = min(be_max_phys_size * 1024, alloc_size);
2521 do {2509 do {
2522 mem_arr->virtual_address = pci_alloc_consistent(2510 mem_arr->virtual_address =
2523 phba->pcidev,2511 dma_alloc_coherent(&phba->pcidev->dev,
2524 curr_alloc_size,2512 curr_alloc_size, &bus_add, GFP_KERNEL);
2525 &bus_add);
2526 if (!mem_arr->virtual_address) {2513 if (!mem_arr->virtual_address) {
2527 if (curr_alloc_size <= BE_MIN_MEM_SIZE)2514 if (curr_alloc_size <= BE_MIN_MEM_SIZE)
2528 goto free_mem;2515 goto free_mem;
@@ -2560,7 +2547,7 @@ free_mem: · 31 unmodified lines
2560 mem_descr->num_elements = j;2547 mem_descr->num_elements = j;
2561 while ((i) || (j)) {2548 while ((i) || (j)) {
2562 for (j = mem_descr->num_elements; j > 0; j--) {2549 for (j = mem_descr->num_elements; j > 0; j--) {
2563 pci_free_consistent(phba->pcidev,2550 dma_free_coherent(&phba->pcidev->dev,
2564 mem_descr->mem_array[j - 1].size,2551 mem_descr->mem_array[j - 1].size,
2565 mem_descr->mem_array[j - 1].2552 mem_descr->mem_array[j - 1].
2566 virtual_address,2553 virtual_address,
@@ -3031,9 +3018,9 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, · 464 unmodified lines
3031 eq = &phwi_context->be_eq[i].q;3018 eq = &phwi_context->be_eq[i].q;
3032 mem = &eq->dma_mem;3019 mem = &eq->dma_mem;
3033 phwi_context->be_eq[i].phba = phba;3020 phwi_context->be_eq[i].phba = phba;
3034 eq_vaddress = pci_alloc_consistent(phba->pcidev,3021 eq_vaddress = dma_alloc_coherent(&phba->pcidev->dev,
3035 num_eq_pages * PAGE_SIZE,3022 num_eq_pages * PAGE_SIZE,
3036 &paddr);3023 &paddr, GFP_KERNEL);
3037 if (!eq_vaddress) {3024 if (!eq_vaddress) {
3038 ret = -ENOMEM;3025 ret = -ENOMEM;
3039 goto create_eq_error;3026 goto create_eq_error;
@@ -3069,7 +3056,7 @@ create_eq_error: · 29 unmodified lines
3069 eq = &phwi_context->be_eq[i].q;3056 eq = &phwi_context->be_eq[i].q;
3070 mem = &eq->dma_mem;3057 mem = &eq->dma_mem;
3071 if (mem->va)3058 if (mem->va)
3072 pci_free_consistent(phba->pcidev, num_eq_pages3059 dma_free_coherent(&phba->pcidev->dev, num_eq_pages
3073 * PAGE_SIZE,3060 * PAGE_SIZE,
3074 mem->va, mem->dma);3061 mem->va, mem->dma);
3075 }3062 }
@@ -3097,9 +3084,9 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, · 21 unmodified lines
3097 pbe_eq->cq = cq;3084 pbe_eq->cq = cq;
3098 pbe_eq->phba = phba;3085 pbe_eq->phba = phba;
3099 mem = &cq->dma_mem;3086 mem = &cq->dma_mem;
3100 cq_vaddress = pci_alloc_consistent(phba->pcidev,3087 cq_vaddress = dma_alloc_coherent(&phba->pcidev->dev,
3101 num_cq_pages * PAGE_SIZE,3088 num_cq_pages * PAGE_SIZE,
3102 &paddr);3089 &paddr, GFP_KERNEL);
3103 if (!cq_vaddress) {3090 if (!cq_vaddress) {
3104 ret = -ENOMEM;3091 ret = -ENOMEM;
3105 goto create_cq_error;3092 goto create_cq_error;
@@ -3134,7 +3121,7 @@ create_cq_error: · 28 unmodified lines
3134 cq = &phwi_context->be_cq[i];3121 cq = &phwi_context->be_cq[i];
3135 mem = &cq->dma_mem;3122 mem = &cq->dma_mem;
3136 if (mem->va)3123 if (mem->va)
3137 pci_free_consistent(phba->pcidev, num_cq_pages3124 dma_free_coherent(&phba->pcidev->dev, num_cq_pages
3138 * PAGE_SIZE,3125 * PAGE_SIZE,
3139 mem->va, mem->dma);3126 mem->va, mem->dma);
3140 }3127 }
@@ -3326,7 +3313,7 @@ static void be_queue_free(struct beiscsi_hba *phba, struct be_queue_info *q) · 185 unmodified lines
3326{3313{
3327 struct be_dma_mem *mem = &q->dma_mem;3314 struct be_dma_mem *mem = &q->dma_mem;
3328 if (mem->va) {3315 if (mem->va) {
3329 pci_free_consistent(phba->pcidev, mem->size,3316 dma_free_coherent(&phba->pcidev->dev, mem->size,
3330 mem->va, mem->dma);3317 mem->va, mem->dma);
3331 mem->va = NULL;3318 mem->va = NULL;
3332 }3319 }
@@ -3341,7 +3328,8 @@ static int be_queue_alloc(struct beiscsi_hba *phba, struct be_queue_info *q, · 8 unmodified lines
3341 q->len = len;3328 q->len = len;
3342 q->entry_size = entry_size;3329 q->entry_size = entry_size;
3343 mem->size = len * entry_size;3330 mem->size = len * entry_size;
3344 mem->va = pci_zalloc_consistent(phba->pcidev, mem->size, &mem->dma);3331 mem->va = dma_zalloc_coherent(&phba->pcidev->dev, mem->size, &mem->dma,
3332 GFP_KERNEL);
3345 if (!mem->va)3333 if (!mem->va)
3346 return -ENOMEM;3334 return -ENOMEM;
3347 return 0;3335 return 0;
@@ -3479,7 +3467,7 @@ static void be_mcc_queues_destroy(struct beiscsi_hba *phba) · 131 unmodified lines
3479 &ctrl->ptag_state[tag].tag_state)) {3467 &ctrl->ptag_state[tag].tag_state)) {
3480 ptag_mem = &ctrl->ptag_state[tag].tag_mem_state;3468 ptag_mem = &ctrl->ptag_state[tag].tag_mem_state;
3481 if (ptag_mem->size) {3469 if (ptag_mem->size) {
3482 pci_free_consistent(ctrl->pdev,3470 dma_free_coherent(&ctrl->pdev->dev,
3483 ptag_mem->size,3471 ptag_mem->size,
3484 ptag_mem->va,3472 ptag_mem->va,
3485 ptag_mem->dma);3473 ptag_mem->dma);
@@ -3880,7 +3868,7 @@ static void beiscsi_free_mem(struct beiscsi_hba *phba) · 394 unmodified lines
3880 j = 0;3868 j = 0;
3881 for (i = 0; i < SE_MEM_MAX; i++) {3869 for (i = 0; i < SE_MEM_MAX; i++) {
3882 for (j = mem_descr->num_elements; j > 0; j--) {3870 for (j = mem_descr->num_elements; j > 0; j--) {
3883 pci_free_consistent(phba->pcidev,3871 dma_free_coherent(&phba->pcidev->dev,
3884 mem_descr->mem_array[j - 1].size,3872 mem_descr->mem_array[j - 1].size,
3885 mem_descr->mem_array[j - 1].virtual_address,3873 mem_descr->mem_array[j - 1].virtual_address,
3886 (unsigned long)mem_descr->mem_array[j - 1].3874 (unsigned long)mem_descr->mem_array[j - 1].
@@ -4255,10 +4243,10 @@ beiscsi_free_mgmt_task_handles(struct beiscsi_conn *beiscsi_conn, · 368 unmodified lines
4255 }4243 }
4256 4244
4257 if (io_task->mtask_addr) {4245 if (io_task->mtask_addr) {
4258 pci_unmap_single(phba->pcidev,4246 dma_unmap_single(&phba->pcidev->dev,
4259 io_task->mtask_addr,4247 io_task->mtask_addr,
4260 io_task->mtask_data_count,4248 io_task->mtask_data_count,
4261 PCI_DMA_TODEVICE);4249 DMA_TO_DEVICE);
4262 io_task->mtask_addr = 0;4250 io_task->mtask_addr = 0;
4263 }4251 }
4264}4252}
@@ -4852,9 +4840,9 @@ static int beiscsi_bsg_request(struct bsg_job *job) · 587 unmodified lines
4852 4840
4853 switch (bsg_req->msgcode) {4841 switch (bsg_req->msgcode) {
4854 case ISCSI_BSG_HST_VENDOR:4842 case ISCSI_BSG_HST_VENDOR:
4855 nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev,4843 nonemb_cmd.va = dma_alloc_coherent(&phba->ctrl.pdev->dev,
4856 job->request_payload.payload_len,4844 job->request_payload.payload_len,
4857 &nonemb_cmd.dma);4845 &nonemb_cmd.dma, GFP_KERNEL);
4858 if (nonemb_cmd.va == NULL) {4846 if (nonemb_cmd.va == NULL) {
4859 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,4847 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
4860 "BM_%d : Failed to allocate memory for "4848 "BM_%d : Failed to allocate memory for "
@@ -4867,7 +4855,7 @@ static int beiscsi_bsg_request(struct bsg_job *job) · 6 unmodified lines
4867 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,4855 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
4868 "BM_%d : MBX Tag Allocation Failed\n");4856 "BM_%d : MBX Tag Allocation Failed\n");
4869 4857
4870 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,4858 dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
4871 nonemb_cmd.va, nonemb_cmd.dma);4859 nonemb_cmd.va, nonemb_cmd.dma);
4872 return -EAGAIN;4860 return -EAGAIN;
4873 }4861 }
@@ -4881,7 +4869,7 @@ static int beiscsi_bsg_request(struct bsg_job *job) · 7 unmodified lines
4881 if (!test_bit(BEISCSI_HBA_ONLINE, &phba->state)) {4869 if (!test_bit(BEISCSI_HBA_ONLINE, &phba->state)) {
4882 clear_bit(MCC_TAG_STATE_RUNNING,4870 clear_bit(MCC_TAG_STATE_RUNNING,
4883 &phba->ctrl.ptag_state[tag].tag_state);4871 &phba->ctrl.ptag_state[tag].tag_state);
4884 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,4872 dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
4885 nonemb_cmd.va, nonemb_cmd.dma);4873 nonemb_cmd.va, nonemb_cmd.dma);
4886 return -EIO;4874 return -EIO;
4887 }4875 }
@@ -4898,7 +4886,7 @@ static int beiscsi_bsg_request(struct bsg_job *job) · 10 unmodified lines
4898 bsg_reply->result = status;4886 bsg_reply->result = status;
4899 bsg_job_done(job, bsg_reply->result,4887 bsg_job_done(job, bsg_reply->result,
4900 bsg_reply->reply_payload_rcv_len);4888 bsg_reply->reply_payload_rcv_len);
4901 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,4889 dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
4902 nonemb_cmd.va, nonemb_cmd.dma);4890 nonemb_cmd.va, nonemb_cmd.dma);
4903 if (status || extd_status) {4891 if (status || extd_status) {
4904 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,4892 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
@@ -5754,7 +5742,7 @@ free_twq: · 849 unmodified lines
5754 beiscsi_cleanup_port(phba);5742 beiscsi_cleanup_port(phba);
5755 beiscsi_free_mem(phba);5743 beiscsi_free_mem(phba);
5756free_port:5744free_port:
5757 pci_free_consistent(phba->pcidev,5745 dma_free_coherent(&phba->pcidev->dev,
5758 phba->ctrl.mbox_mem_alloced.size,5746 phba->ctrl.mbox_mem_alloced.size,
5759 phba->ctrl.mbox_mem_alloced.va,5747 phba->ctrl.mbox_mem_alloced.va,
5760 phba->ctrl.mbox_mem_alloced.dma);5748 phba->ctrl.mbox_mem_alloced.dma);
@@ -5798,7 +5786,7 @@ static void beiscsi_remove(struct pci_dev *pcidev) · 37 unmodified lines
5798 5786
5799 /* ctrl uninit */5787 /* ctrl uninit */
5800 beiscsi_unmap_pci_function(phba);5788 beiscsi_unmap_pci_function(phba);
5801 pci_free_consistent(phba->pcidev,5789 dma_free_coherent(&phba->pcidev->dev,
5802 phba->ctrl.mbox_mem_alloced.size,5790 phba->ctrl.mbox_mem_alloced.size,
5803 phba->ctrl.mbox_mem_alloced.va,5791 phba->ctrl.mbox_mem_alloced.va,
5804 phba->ctrl.mbox_mem_alloced.dma);5792 phba->ctrl.mbox_mem_alloced.dma);
drivers/scsi/be2iscsi/be_mgmt.c+15−12
@@ -284,7 +284,7 @@ static int beiscsi_exec_nemb_cmd(struct beiscsi_hba *phba, · 283 unmodified lines
284 return rc;284 return rc;
285 285
286free_cmd:286free_cmd:
287 pci_free_consistent(ctrl->pdev, nonemb_cmd->size,287 dma_free_coherent(&ctrl->pdev->dev, nonemb_cmd->size,
288 nonemb_cmd->va, nonemb_cmd->dma);288 nonemb_cmd->va, nonemb_cmd->dma);
289 return rc;289 return rc;
290}290}
@@ -293,7 +293,8 @@ static int beiscsi_prep_nemb_cmd(struct beiscsi_hba *phba, · 2 unmodified lines
293 struct be_dma_mem *cmd,293 struct be_dma_mem *cmd,
294 u8 subsystem, u8 opcode, u32 size)294 u8 subsystem, u8 opcode, u32 size)
295{295{
296 cmd->va = pci_zalloc_consistent(phba->ctrl.pdev, size, &cmd->dma);296 cmd->va = dma_zalloc_coherent(&phba->ctrl.pdev->dev, size, &cmd->dma,
297 GFP_KERNEL);
297 if (!cmd->va) {298 if (!cmd->va) {
298 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,299 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
299 "BG_%d : Failed to allocate memory for if info\n");300 "BG_%d : Failed to allocate memory for if info\n");
@@ -315,7 +316,7 @@ static void __beiscsi_eq_delay_compl(struct beiscsi_hba *phba, unsigned int tag) · 15 unmodified lines
315 __beiscsi_mcc_compl_status(phba, tag, NULL, NULL);316 __beiscsi_mcc_compl_status(phba, tag, NULL, NULL);
316 tag_mem = &phba->ctrl.ptag_state[tag].tag_mem_state;317 tag_mem = &phba->ctrl.ptag_state[tag].tag_mem_state;
317 if (tag_mem->size) {318 if (tag_mem->size) {
318 pci_free_consistent(phba->pcidev, tag_mem->size,319 dma_free_coherent(&phba->pcidev->dev, tag_mem->size,
319 tag_mem->va, tag_mem->dma);320 tag_mem->va, tag_mem->dma);
320 tag_mem->size = 0;321 tag_mem->size = 0;
321 }322 }
@@ -761,7 +762,7 @@ int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type, · 439 unmodified lines
761 "BG_%d : Memory Allocation Failure\n");762 "BG_%d : Memory Allocation Failure\n");
762 763
763 /* Free the DMA memory for the IOCTL issuing */764 /* Free the DMA memory for the IOCTL issuing */
764 pci_free_consistent(phba->ctrl.pdev,765 dma_free_coherent(&phba->ctrl.pdev->dev,
765 nonemb_cmd.size,766 nonemb_cmd.size,
766 nonemb_cmd.va,767 nonemb_cmd.va,
767 nonemb_cmd.dma);768 nonemb_cmd.dma);
@@ -780,7 +781,7 @@ int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type, · 12 unmodified lines
780 ioctl_size += sizeof(struct be_cmd_req_hdr);781 ioctl_size += sizeof(struct be_cmd_req_hdr);
781 782
782 /* Free the previous allocated DMA memory */783 /* Free the previous allocated DMA memory */
783 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,784 dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
784 nonemb_cmd.va,785 nonemb_cmd.va,
785 nonemb_cmd.dma);786 nonemb_cmd.dma);
786 787
@@ -869,7 +870,7 @@ static void beiscsi_boot_process_compl(struct beiscsi_hba *phba, · 82 unmodified lines
869 status);870 status);
870 boot_work = 0;871 boot_work = 0;
871 }872 }
872 pci_free_consistent(phba->ctrl.pdev, bs->nonemb_cmd.size,873 dma_free_coherent(&phba->ctrl.pdev->dev, bs->nonemb_cmd.size,
873 bs->nonemb_cmd.va, bs->nonemb_cmd.dma);874 bs->nonemb_cmd.va, bs->nonemb_cmd.dma);
874 bs->nonemb_cmd.va = NULL;875 bs->nonemb_cmd.va = NULL;
875 break;876 break;
@@ -1012,9 +1013,10 @@ unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba) · 136 unmodified lines
1012 1013
1013 nonemb_cmd = &phba->boot_struct.nonemb_cmd;1014 nonemb_cmd = &phba->boot_struct.nonemb_cmd;
1014 nonemb_cmd->size = sizeof(struct be_cmd_get_session_resp);1015 nonemb_cmd->size = sizeof(struct be_cmd_get_session_resp);
1015 nonemb_cmd->va = pci_alloc_consistent(phba->ctrl.pdev,1016 nonemb_cmd->va = dma_alloc_coherent(&phba->ctrl.pdev->dev,
1016 nonemb_cmd->size,1017 nonemb_cmd->size,
1017 &nonemb_cmd->dma);1018 &nonemb_cmd->dma,
1019 GFP_KERNEL);
1018 if (!nonemb_cmd->va) {1020 if (!nonemb_cmd->va) {
1019 mutex_unlock(&ctrl->mbox_lock);1021 mutex_unlock(&ctrl->mbox_lock);
1020 return 0;1022 return 0;
@@ -1508,9 +1510,10 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba, · 487 unmodified lines
1508 return -EINVAL;1510 return -EINVAL;
1509 1511
1510 nonemb_cmd.size = sizeof(union be_invldt_cmds_params);1512 nonemb_cmd.size = sizeof(union be_invldt_cmds_params);
1511 nonemb_cmd.va = pci_zalloc_consistent(phba->ctrl.pdev,1513 nonemb_cmd.va = dma_zalloc_coherent(&phba->ctrl.pdev->dev,
1512 nonemb_cmd.size,1514 nonemb_cmd.size,
1513 &nonemb_cmd.dma);1515 &nonemb_cmd.dma,
1516 GFP_KERNEL);
1514 if (!nonemb_cmd.va) {1517 if (!nonemb_cmd.va) {
1515 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_EH,1518 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_EH,
1516 "BM_%d : invldt_cmds_params alloc failed\n");1519 "BM_%d : invldt_cmds_params alloc failed\n");
@@ -1521,7 +1524,7 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba, · 4 unmodified lines
1521 wrb = alloc_mcc_wrb(phba, &tag);1524 wrb = alloc_mcc_wrb(phba, &tag);
1522 if (!wrb) {1525 if (!wrb) {
1523 mutex_unlock(&ctrl->mbox_lock);1526 mutex_unlock(&ctrl->mbox_lock);
1524 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,1527 dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
1525 nonemb_cmd.va, nonemb_cmd.dma);1528 nonemb_cmd.va, nonemb_cmd.dma);
1526 return -ENOMEM;1529 return -ENOMEM;
1527 }1530 }
@@ -1548,7 +1551,7 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba, · 20 unmodified lines
1548 1551
1549 rc = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd);1552 rc = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd);
1550 if (rc != -EBUSY)1553 if (rc != -EBUSY)
1551 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,1554 dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
1552 nonemb_cmd.va, nonemb_cmd.dma);1555 nonemb_cmd.va, nonemb_cmd.dma);
1553 return rc;1556 return rc;
1554}1557}
drivers/scsi/bfa/bfa_defs_svc.h+1−1
@@ -1453,7 +1453,7 @@ union bfa_aen_data_u { · 1452 unmodified lines
1453struct bfa_aen_entry_s {1453struct bfa_aen_entry_s {
1454 struct list_head qe;1454 struct list_head qe;
1455 enum bfa_aen_category aen_category;1455 enum bfa_aen_category aen_category;
1456 u32 aen_type;1456 int aen_type;
1457 union bfa_aen_data_u aen_data;1457 union bfa_aen_data_u aen_data;
1458 u64 aen_tv_sec;1458 u64 aen_tv_sec;
1459 u64 aen_tv_usec;1459 u64 aen_tv_usec;
drivers/scsi/bfa/bfa_fcbuild.c+0−108
@@ -190,27 +190,6 @@ fc_els_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id) · 189 unmodified lines
190 fchs->ox_id = ox_id;190 fchs->ox_id = ox_id;
191}191}
192 192
193enum fc_parse_status
194fc_els_rsp_parse(struct fchs_s *fchs, int len)
195{
196 struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1);
197 struct fc_ls_rjt_s *ls_rjt = (struct fc_ls_rjt_s *) els_cmd;
198
199 len = len;
200
201 switch (els_cmd->els_code) {
202 case FC_ELS_LS_RJT:
203 if (ls_rjt->reason_code == FC_LS_RJT_RSN_LOGICAL_BUSY)
204 return FC_PARSE_BUSY;
205 else
206 return FC_PARSE_FAILURE;
207
208 case FC_ELS_ACC:
209 return FC_PARSE_OK;
210 }
211 return FC_PARSE_OK;
212}
213
214static void193static void
215fc_bls_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id)194fc_bls_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id)
216{195{
@@ -830,18 +809,6 @@ fc_rpsc_acc_build(struct fchs_s *fchs, struct fc_rpsc_acc_s *rpsc_acc, · 613 unmodified lines
830 return sizeof(struct fc_rpsc_acc_s);809 return sizeof(struct fc_rpsc_acc_s);
831}810}
832 811
833u16
834fc_logo_rsp_parse(struct fchs_s *fchs, int len)
835{
836 struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1);
837
838 len = len;
839 if (els_cmd->els_code != FC_ELS_ACC)
840 return FC_PARSE_FAILURE;
841
842 return FC_PARSE_OK;
843}
844
845u16812u16
846fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,813fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
847 wwn_t port_name, wwn_t node_name, u16 pdu_size)814 wwn_t port_name, wwn_t node_name, u16 pdu_size)
@@ -907,40 +874,6 @@ fc_prlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id, · 59 unmodified lines
907 return be16_to_cpu(prlo->payload_len);874 return be16_to_cpu(prlo->payload_len);
908}875}
909 876
910u16
911fc_prlo_rsp_parse(struct fchs_s *fchs, int len)
912{
913 struct fc_prlo_acc_s *prlo = (struct fc_prlo_acc_s *) (fchs + 1);
914 int num_pages = 0;
915 int page = 0;
916
917 len = len;
918
919 if (prlo->command != FC_ELS_ACC)
920 return FC_PARSE_FAILURE;
921
922 num_pages = ((be16_to_cpu(prlo->payload_len)) - 4) / 16;
923
924 for (page = 0; page < num_pages; page++) {
925 if (prlo->prlo_acc_params[page].type != FC_TYPE_FCP)
926 return FC_PARSE_FAILURE;
927
928 if (prlo->prlo_acc_params[page].opa_valid != 0)
929 return FC_PARSE_FAILURE;
930
931 if (prlo->prlo_acc_params[page].rpa_valid != 0)
932 return FC_PARSE_FAILURE;
933
934 if (prlo->prlo_acc_params[page].orig_process_assc != 0)
935 return FC_PARSE_FAILURE;
936
937 if (prlo->prlo_acc_params[page].resp_process_assc != 0)
938 return FC_PARSE_FAILURE;
939 }
940 return FC_PARSE_OK;
941
942}
943
944u16877u16
945fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,878fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
946 int num_pages, enum fc_tprlo_type tprlo_type, u32 tpr_id)879 int num_pages, enum fc_tprlo_type tprlo_type, u32 tpr_id)
@@ -971,47 +904,6 @@ fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id, · 24 unmodified lines
971 return be16_to_cpu(tprlo->payload_len);904 return be16_to_cpu(tprlo->payload_len);
972}905}
973 906
974u16
975fc_tprlo_rsp_parse(struct fchs_s *fchs, int len)
976{
977 struct fc_tprlo_acc_s *tprlo = (struct fc_tprlo_acc_s *) (fchs + 1);
978 int num_pages = 0;
979 int page = 0;
980
981 len = len;
982
983 if (tprlo->command != FC_ELS_ACC)
984 return FC_PARSE_ACC_INVAL;
985
986 num_pages = (be16_to_cpu(tprlo->payload_len) - 4) / 16;
987
988 for (page = 0; page < num_pages; page++) {
989 if (tprlo->tprlo_acc_params[page].type != FC_TYPE_FCP)
990 return FC_PARSE_NOT_FCP;
991 if (tprlo->tprlo_acc_params[page].opa_valid != 0)
992 return FC_PARSE_OPAFLAG_INVAL;
993 if (tprlo->tprlo_acc_params[page].rpa_valid != 0)
994 return FC_PARSE_RPAFLAG_INVAL;
995 if (tprlo->tprlo_acc_params[page].orig_process_assc != 0)
996 return FC_PARSE_OPA_INVAL;
997 if (tprlo->tprlo_acc_params[page].resp_process_assc != 0)
998 return FC_PARSE_RPA_INVAL;
999 }
1000 return FC_PARSE_OK;
1001}
1002
1003enum fc_parse_status
1004fc_rrq_rsp_parse(struct fchs_s *fchs, int len)
1005{
1006 struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1);
1007
1008 len = len;
1009 if (els_cmd->els_code != FC_ELS_ACC)
1010 return FC_PARSE_FAILURE;
1011
1012 return FC_PARSE_OK;
1013}
1014
1015u16907u16
1016fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id,908fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id,
1017 u32 reason_code, u32 reason_expl)909 u32 reason_code, u32 reason_expl)
drivers/scsi/bfa/bfa_fcbuild.h+0−9
@@ -163,7 +163,6 @@ enum fc_parse_status fc_abts_rsp_parse(struct fchs_s *buf, int len); · 162 unmodified lines
163 163
164u16 fc_rrq_build(struct fchs_s *buf, struct fc_rrq_s *rrq, u32 d_id,164u16 fc_rrq_build(struct fchs_s *buf, struct fc_rrq_s *rrq, u32 d_id,
165 u32 s_id, u16 ox_id, u16 rrq_oxid);165 u32 s_id, u16 ox_id, u16 rrq_oxid);
166enum fc_parse_status fc_rrq_rsp_parse(struct fchs_s *buf, int len);
167 166
168u16 fc_rspnid_build(struct fchs_s *fchs, void *pld, u32 s_id,167u16 fc_rspnid_build(struct fchs_s *fchs, void *pld, u32 s_id,
169 u16 ox_id, u8 *name);168 u16 ox_id, u8 *name);
@@ -276,8 +275,6 @@ void fc_get_fc4type_bitmask(u8 fc4_type, u8 *bit_mask); · 106 unmodified lines
276void fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id,275void fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
277 __be16 ox_id);276 __be16 ox_id);
278 277
279enum fc_parse_status fc_els_rsp_parse(struct fchs_s *fchs, int len);
280
281enum fc_parse_status fc_plogi_rsp_parse(struct fchs_s *fchs, int len,278enum fc_parse_status fc_plogi_rsp_parse(struct fchs_s *fchs, int len,
282 wwn_t port_name);279 wwn_t port_name);
283 280
@@ -297,8 +294,6 @@ u16 fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc, · 13 unmodified lines
297u16 fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc,294u16 fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc,
298 u32 d_id, u32 s_id, __be16 ox_id, int num_pages);295 u32 d_id, u32 s_id, __be16 ox_id, int num_pages);
299 296
300u16 fc_logo_rsp_parse(struct fchs_s *fchs, int len);
301
302u16 fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id,297u16 fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
303 u16 ox_id, wwn_t port_name, wwn_t node_name,298 u16 ox_id, wwn_t port_name, wwn_t node_name,
304 u16 pdu_size);299 u16 pdu_size);
@@ -308,14 +303,10 @@ u16 fc_pdisc_rsp_parse(struct fchs_s *fchs, int len, wwn_t port_name); · 3 unmodified lines
308u16 fc_prlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id,303u16 fc_prlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
309 u16 ox_id, int num_pages);304 u16 ox_id, int num_pages);
310 305
311u16 fc_prlo_rsp_parse(struct fchs_s *fchs, int len);
312
313u16 fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id,306u16 fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
314 u16 ox_id, int num_pages, enum fc_tprlo_type tprlo_type,307 u16 ox_id, int num_pages, enum fc_tprlo_type tprlo_type,
315 u32 tpr_id);308 u32 tpr_id);
316 309
317u16 fc_tprlo_rsp_parse(struct fchs_s *fchs, int len);
318
319u16 fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id,310u16 fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
320 __be16 ox_id, u32 reason_code, u32 reason_expl);311 __be16 ox_id, u32 reason_code, u32 reason_expl);
321 312
drivers/scsi/bfa/bfad_im.h+1−1
@@ -143,7 +143,7 @@ struct bfad_im_s { · 142 unmodified lines
143static inline void bfad_im_post_vendor_event(struct bfa_aen_entry_s *entry,143static inline void bfad_im_post_vendor_event(struct bfa_aen_entry_s *entry,
144 struct bfad_s *drv, int cnt,144 struct bfad_s *drv, int cnt,
145 enum bfa_aen_category cat,145 enum bfa_aen_category cat,
146 enum bfa_ioc_aen_event evt)146 int evt)
147{147{
148 struct timespec64 ts;148 struct timespec64 ts;
149 149
drivers/scsi/bnx2fc/bnx2fc_fcoe.c+0−3
@@ -432,7 +432,6 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, · 431 unmodified lines
432 struct fcoe_rcv_info *fr;432 struct fcoe_rcv_info *fr;
433 struct fcoe_percpu_s *bg;433 struct fcoe_percpu_s *bg;
434 struct sk_buff *tmp_skb;434 struct sk_buff *tmp_skb;
435 unsigned short oxid;
436 435
437 interface = container_of(ptype, struct bnx2fc_interface,436 interface = container_of(ptype, struct bnx2fc_interface,
438 fcoe_packet_type);437 fcoe_packet_type);
@@ -466,8 +465,6 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, · 27 unmodified lines
466 skb_set_transport_header(skb, sizeof(struct fcoe_hdr));465 skb_set_transport_header(skb, sizeof(struct fcoe_hdr));
467 fh = (struct fc_frame_header *) skb_transport_header(skb);466 fh = (struct fc_frame_header *) skb_transport_header(skb);
468 467
469 oxid = ntohs(fh->fh_ox_id);
470
471 fr = fcoe_dev_from_skb(skb);468 fr = fcoe_dev_from_skb(skb);
472 fr->fr_dev = lport;469 fr->fr_dev = lport;
473 470
drivers/scsi/csiostor/csio_init.c+2−5
@@ -210,11 +210,8 @@ csio_pci_init(struct pci_dev *pdev, int *bars) · 209 unmodified lines
210 pci_set_master(pdev);210 pci_set_master(pdev);
211 pci_try_set_mwi(pdev);211 pci_try_set_mwi(pdev);
212 212
213 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {213 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
214 pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));214 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
215 } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
216 pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
217 } else {
218 dev_err(&pdev->dev, "No suitable DMA available.\n");215 dev_err(&pdev->dev, "No suitable DMA available.\n");
219 goto err_release_regions;216 goto err_release_regions;
220 }217 }
drivers/scsi/csiostor/csio_lnode.c+3−3
@@ -1845,8 +1845,8 @@ csio_ln_fdmi_init(struct csio_lnode *ln) · 1844 unmodified lines
1845 /* Allocate Dma buffers for FDMI response Payload */1845 /* Allocate Dma buffers for FDMI response Payload */
1846 dma_buf = &ln->mgmt_req->dma_buf;1846 dma_buf = &ln->mgmt_req->dma_buf;
1847 dma_buf->len = 2048;1847 dma_buf->len = 2048;
1848 dma_buf->vaddr = pci_alloc_consistent(hw->pdev, dma_buf->len,1848 dma_buf->vaddr = dma_alloc_coherent(&hw->pdev->dev, dma_buf->len,
1849 &dma_buf->paddr);1849 &dma_buf->paddr, GFP_KERNEL);
1850 if (!dma_buf->vaddr) {1850 if (!dma_buf->vaddr) {
1851 csio_err(hw, "Failed to alloc DMA buffer for FDMI!\n");1851 csio_err(hw, "Failed to alloc DMA buffer for FDMI!\n");
1852 kfree(ln->mgmt_req);1852 kfree(ln->mgmt_req);
@@ -1873,7 +1873,7 @@ csio_ln_fdmi_exit(struct csio_lnode *ln) · 20 unmodified lines
1873 1873
1874 dma_buf = &ln->mgmt_req->dma_buf;1874 dma_buf = &ln->mgmt_req->dma_buf;
1875 if (dma_buf->vaddr)1875 if (dma_buf->vaddr)
1876 pci_free_consistent(hw->pdev, dma_buf->len, dma_buf->vaddr,1876 dma_free_coherent(&hw->pdev->dev, dma_buf->len, dma_buf->vaddr,
1877 dma_buf->paddr);1877 dma_buf->paddr);
1878 1878
1879 kfree(ln->mgmt_req);1879 kfree(ln->mgmt_req);
drivers/scsi/csiostor/csio_scsi.c+6−6
@@ -2349,8 +2349,8 @@ csio_scsi_alloc_ddp_bufs(struct csio_scsim *scm, struct csio_hw *hw, · 2348 unmodified lines
2349 }2349 }
2350 2350
2351 /* Allocate Dma buffers for DDP */2351 /* Allocate Dma buffers for DDP */
2352 ddp_desc->vaddr = pci_alloc_consistent(hw->pdev, unit_size,2352 ddp_desc->vaddr = dma_alloc_coherent(&hw->pdev->dev, unit_size,
2353 &ddp_desc->paddr);2353 &ddp_desc->paddr, GFP_KERNEL);
2354 if (!ddp_desc->vaddr) {2354 if (!ddp_desc->vaddr) {
2355 csio_err(hw,2355 csio_err(hw,
2356 "SCSI response DMA buffer (ddp) allocation"2356 "SCSI response DMA buffer (ddp) allocation"
@@ -2372,8 +2372,8 @@ no_mem: · 15 unmodified lines
2372 list_for_each(tmp, &scm->ddp_freelist) {2372 list_for_each(tmp, &scm->ddp_freelist) {
2373 ddp_desc = (struct csio_dma_buf *) tmp;2373 ddp_desc = (struct csio_dma_buf *) tmp;
2374 tmp = csio_list_prev(tmp);2374 tmp = csio_list_prev(tmp);
2375 pci_free_consistent(hw->pdev, ddp_desc->len, ddp_desc->vaddr,2375 dma_free_coherent(&hw->pdev->dev, ddp_desc->len,
2376 ddp_desc->paddr);2376 ddp_desc->vaddr, ddp_desc->paddr);
2377 list_del_init(&ddp_desc->list);2377 list_del_init(&ddp_desc->list);
2378 kfree(ddp_desc);2378 kfree(ddp_desc);
2379 }2379 }
@@ -2399,8 +2399,8 @@ csio_scsi_free_ddp_bufs(struct csio_scsim *scm, struct csio_hw *hw) · 19 unmodified lines
2399 list_for_each(tmp, &scm->ddp_freelist) {2399 list_for_each(tmp, &scm->ddp_freelist) {
2400 ddp_desc = (struct csio_dma_buf *) tmp;2400 ddp_desc = (struct csio_dma_buf *) tmp;
2401 tmp = csio_list_prev(tmp);2401 tmp = csio_list_prev(tmp);
2402 pci_free_consistent(hw->pdev, ddp_desc->len, ddp_desc->vaddr,2402 dma_free_coherent(&hw->pdev->dev, ddp_desc->len,
2403 ddp_desc->paddr);2403 ddp_desc->vaddr, ddp_desc->paddr);
2404 list_del_init(&ddp_desc->list);2404 list_del_init(&ddp_desc->list);
2405 kfree(ddp_desc);2405 kfree(ddp_desc);
2406 }2406 }
drivers/scsi/csiostor/csio_wr.c+9−8
@@ -124,8 +124,8 @@ csio_wr_fill_fl(struct csio_hw *hw, struct csio_q *flq) · 123 unmodified lines
124 124
125 while (n--) {125 while (n--) {
126 buf->len = sge->sge_fl_buf_size[sreg];126 buf->len = sge->sge_fl_buf_size[sreg];
127 buf->vaddr = pci_alloc_consistent(hw->pdev, buf->len,127 buf->vaddr = dma_alloc_coherent(&hw->pdev->dev, buf->len,
128 &buf->paddr);128 &buf->paddr, GFP_KERNEL);
129 if (!buf->vaddr) {129 if (!buf->vaddr) {
130 csio_err(hw, "Could only fill %d buffers!\n", n + 1);130 csio_err(hw, "Could only fill %d buffers!\n", n + 1);
131 return -ENOMEM;131 return -ENOMEM;
@@ -233,7 +233,8 @@ csio_wr_alloc_q(struct csio_hw *hw, uint32_t qsize, uint32_t wrsize, · 101 unmodified lines
233 233
234 q = wrm->q_arr[free_idx];234 q = wrm->q_arr[free_idx];
235 235
236 q->vstart = pci_zalloc_consistent(hw->pdev, qsz, &q->pstart);236 q->vstart = dma_zalloc_coherent(&hw->pdev->dev, qsz, &q->pstart,
237 GFP_KERNEL);
237 if (!q->vstart) {238 if (!q->vstart) {
238 csio_err(hw,239 csio_err(hw,
239 "Failed to allocate DMA memory for "240 "Failed to allocate DMA memory for "
@@ -1703,14 +1704,14 @@ csio_wrm_exit(struct csio_wrm *wrm, struct csio_hw *hw) · 1463 unmodified lines
1703 buf = &q->un.fl.bufs[j];1704 buf = &q->un.fl.bufs[j];
1704 if (!buf->vaddr)1705 if (!buf->vaddr)
1705 continue;1706 continue;
1706 pci_free_consistent(hw->pdev, buf->len,1707 dma_free_coherent(&hw->pdev->dev,
1707 buf->vaddr,1708 buf->len, buf->vaddr,
1708 buf->paddr);1709 buf->paddr);
1709 }1710 }
1710 kfree(q->un.fl.bufs);1711 kfree(q->un.fl.bufs);
1711 }1712 }
1712 pci_free_consistent(hw->pdev, q->size,1713 dma_free_coherent(&hw->pdev->dev, q->size,
1713 q->vstart, q->pstart);1714 q->vstart, q->pstart);
1714 }1715 }
1715 kfree(q);1716 kfree(q);
1716 }1717 }
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c+153−1
@@ -35,6 +35,11 @@ static unsigned int dbg_level; · 34 unmodified lines
35 35
36#include "../libcxgbi.h"36#include "../libcxgbi.h"
37 37
38#ifdef CONFIG_CHELSIO_T4_DCB
39#include <net/dcbevent.h>
40#include "cxgb4_dcb.h"
41#endif
42
38#define DRV_MODULE_NAME "cxgb4i"43#define DRV_MODULE_NAME "cxgb4i"
39#define DRV_MODULE_DESC "Chelsio T4-T6 iSCSI Driver"44#define DRV_MODULE_DESC "Chelsio T4-T6 iSCSI Driver"
40#define DRV_MODULE_VERSION "0.9.5-ko"45#define DRV_MODULE_VERSION "0.9.5-ko"
@@ -155,6 +160,15 @@ static struct iscsi_transport cxgb4i_iscsi_transport = { · 114 unmodified lines
155 .session_recovery_timedout = iscsi_session_recovery_timedout,160 .session_recovery_timedout = iscsi_session_recovery_timedout,
156};161};
157 162
163#ifdef CONFIG_CHELSIO_T4_DCB
164static int
165cxgb4_dcb_change_notify(struct notifier_block *, unsigned long, void *);
166
167static struct notifier_block cxgb4_dcb_change = {
168 .notifier_call = cxgb4_dcb_change_notify,
169};
170#endif
171
158static struct scsi_transport_template *cxgb4i_stt;172static struct scsi_transport_template *cxgb4i_stt;
159 173
160/*174/*
@@ -574,6 +588,9 @@ static inline int tx_flowc_wr_credits(int *nparamsp, int *flowclenp) · 413 unmodified lines
574 int nparams, flowclen16, flowclen;588 int nparams, flowclen16, flowclen;
575 589
576 nparams = FLOWC_WR_NPARAMS_MIN;590 nparams = FLOWC_WR_NPARAMS_MIN;
591#ifdef CONFIG_CHELSIO_T4_DCB
592 nparams++;
593#endif
577 flowclen = offsetof(struct fw_flowc_wr, mnemval[nparams]);594 flowclen = offsetof(struct fw_flowc_wr, mnemval[nparams]);
578 flowclen16 = DIV_ROUND_UP(flowclen, 16);595 flowclen16 = DIV_ROUND_UP(flowclen, 16);
579 flowclen = flowclen16 * 16;596 flowclen = flowclen16 * 16;
@@ -595,6 +612,9 @@ static inline int send_tx_flowc_wr(struct cxgbi_sock *csk) · 15 unmodified lines
595 struct fw_flowc_wr *flowc;612 struct fw_flowc_wr *flowc;
596 int nparams, flowclen16, flowclen;613 int nparams, flowclen16, flowclen;
597 614
615#ifdef CONFIG_CHELSIO_T4_DCB
616 u16 vlan = ((struct l2t_entry *)csk->l2t)->vlan;
617#endif
598 flowclen16 = tx_flowc_wr_credits(&nparams, &flowclen);618 flowclen16 = tx_flowc_wr_credits(&nparams, &flowclen);
599 skb = alloc_wr(flowclen, 0, GFP_ATOMIC);619 skb = alloc_wr(flowclen, 0, GFP_ATOMIC);
600 flowc = (struct fw_flowc_wr *)skb->head;620 flowc = (struct fw_flowc_wr *)skb->head;
@@ -622,6 +642,17 @@ static inline int send_tx_flowc_wr(struct cxgbi_sock *csk) · 21 unmodified lines
622 flowc->mnemval[8].val = 0;642 flowc->mnemval[8].val = 0;
623 flowc->mnemval[8].mnemonic = FW_FLOWC_MNEM_TXDATAPLEN_MAX;643 flowc->mnemval[8].mnemonic = FW_FLOWC_MNEM_TXDATAPLEN_MAX;
624 flowc->mnemval[8].val = 16384;644 flowc->mnemval[8].val = 16384;
645#ifdef CONFIG_CHELSIO_T4_DCB
646 flowc->mnemval[9].mnemonic = FW_FLOWC_MNEM_DCBPRIO;
647 if (vlan == CPL_L2T_VLAN_NONE) {
648 pr_warn_ratelimited("csk %u without VLAN Tag on DCB Link\n",
649 csk->tid);
650 flowc->mnemval[9].val = cpu_to_be32(0);
651 } else {
652 flowc->mnemval[9].val = cpu_to_be32((vlan & VLAN_PRIO_MASK) >>
653 VLAN_PRIO_SHIFT);
654 }
655#endif
625 656
626 set_wr_txq(skb, CPL_PRIORITY_DATA, csk->port_id);657 set_wr_txq(skb, CPL_PRIORITY_DATA, csk->port_id);
627 658
@@ -1600,6 +1631,46 @@ static void release_offload_resources(struct cxgbi_sock *csk) · 972 unmodified lines
1600 csk->dst = NULL;1631 csk->dst = NULL;
1601}1632}
1602 1633
1634#ifdef CONFIG_CHELSIO_T4_DCB
1635static inline u8 get_iscsi_dcb_state(struct net_device *ndev)
1636{
1637 return ndev->dcbnl_ops->getstate(ndev);
1638}
1639
1640static int select_priority(int pri_mask)
1641{
1642 if (!pri_mask)
1643 return 0;
1644 return (ffs(pri_mask) - 1);
1645}
1646
1647static u8 get_iscsi_dcb_priority(struct net_device *ndev)
1648{
1649 int rv;
1650 u8 caps;
1651
1652 struct dcb_app iscsi_dcb_app = {
1653 .protocol = 3260
1654 };
1655
1656 rv = (int)ndev->dcbnl_ops->getcap(ndev, DCB_CAP_ATTR_DCBX, &caps);
1657 if (rv)
1658 return 0;
1659
1660 if (caps & DCB_CAP_DCBX_VER_IEEE) {
1661 iscsi_dcb_app.selector = IEEE_8021QAZ_APP_SEL_ANY;
1662 rv = dcb_ieee_getapp_mask(ndev, &iscsi_dcb_app);
1663 } else if (caps & DCB_CAP_DCBX_VER_CEE) {
1664 iscsi_dcb_app.selector = DCB_APP_IDTYPE_PORTNUM;
1665 rv = dcb_getapp(ndev, &iscsi_dcb_app);
1666 }
1667
1668 log_debug(1 << CXGBI_DBG_ISCSI,
1669 "iSCSI priority is set to %u\n", select_priority(rv));
1670 return select_priority(rv);
1671}
1672#endif
1673
1603static int init_act_open(struct cxgbi_sock *csk)1674static int init_act_open(struct cxgbi_sock *csk)
1604{1675{
1605 struct cxgbi_device *cdev = csk->cdev;1676 struct cxgbi_device *cdev = csk->cdev;
@@ -1613,7 +1684,9 @@ static int init_act_open(struct cxgbi_sock *csk) · 7 unmodified lines
1613 unsigned int size, size6;1684 unsigned int size, size6;
1614 unsigned int linkspeed;1685 unsigned int linkspeed;
1615 unsigned int rcv_winf, snd_winf;1686 unsigned int rcv_winf, snd_winf;
1616 1687#ifdef CONFIG_CHELSIO_T4_DCB
1688 u8 priority = 0;
1689#endif
1617 log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,1690 log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
1618 "csk 0x%p,%u,0x%lx,%u.\n",1691 "csk 0x%p,%u,0x%lx,%u.\n",
1619 csk, csk->state, csk->flags, csk->tid);1692 csk, csk->state, csk->flags, csk->tid);
@@ -1647,7 +1720,15 @@ static int init_act_open(struct cxgbi_sock *csk) · 27 unmodified lines
1647 cxgbi_sock_set_flag(csk, CTPF_HAS_ATID);1720 cxgbi_sock_set_flag(csk, CTPF_HAS_ATID);
1648 cxgbi_sock_get(csk);1721 cxgbi_sock_get(csk);
1649 1722
1723#ifdef CONFIG_CHELSIO_T4_DCB
1724 if (get_iscsi_dcb_state(ndev))
1725 priority = get_iscsi_dcb_priority(ndev);
1726
1727 csk->dcb_priority = priority;
1728 csk->l2t = cxgb4_l2t_get(lldi->l2t, n, ndev, priority);
1729#else
1650 csk->l2t = cxgb4_l2t_get(lldi->l2t, n, ndev, 0);1730 csk->l2t = cxgb4_l2t_get(lldi->l2t, n, ndev, 0);
1731#endif
1651 if (!csk->l2t) {1732 if (!csk->l2t) {
1652 pr_err("%s, cannot alloc l2t.\n", ndev->name);1733 pr_err("%s, cannot alloc l2t.\n", ndev->name);
1653 goto rel_resource_without_clip;1734 goto rel_resource_without_clip;
@@ -2146,6 +2227,70 @@ static int t4_uld_state_change(void *handle, enum cxgb4_state state) · 492 unmodified lines
2146 return 0;2227 return 0;
2147}2228}
2148 2229
2230#ifdef CONFIG_CHELSIO_T4_DCB
2231static int
2232cxgb4_dcb_change_notify(struct notifier_block *self, unsigned long val,
2233 void *data)
2234{
2235 int i, port = 0xFF;
2236 struct net_device *ndev;
2237 struct cxgbi_device *cdev = NULL;
2238 struct dcb_app_type *iscsi_app = data;
2239 struct cxgbi_ports_map *pmap;
2240 u8 priority;
2241
2242 if (iscsi_app->dcbx & DCB_CAP_DCBX_VER_IEEE) {
2243 if (iscsi_app->app.selector != IEEE_8021QAZ_APP_SEL_ANY)
2244 return NOTIFY_DONE;
2245
2246 priority = iscsi_app->app.priority;
2247 } else if (iscsi_app->dcbx & DCB_CAP_DCBX_VER_CEE) {
2248 if (iscsi_app->app.selector != DCB_APP_IDTYPE_PORTNUM)
2249 return NOTIFY_DONE;
2250
2251 if (!iscsi_app->app.priority)
2252 return NOTIFY_DONE;
2253
2254 priority = ffs(iscsi_app->app.priority) - 1;
2255 } else {
2256 return NOTIFY_DONE;
2257 }
2258
2259 if (iscsi_app->app.protocol != 3260)
2260 return NOTIFY_DONE;
2261
2262 log_debug(1 << CXGBI_DBG_ISCSI, "iSCSI priority for ifid %d is %u\n",
2263 iscsi_app->ifindex, priority);
2264
2265 ndev = dev_get_by_index(&init_net, iscsi_app->ifindex);
2266 if (!ndev)
2267 return NOTIFY_DONE;
2268
2269 cdev = cxgbi_device_find_by_netdev_rcu(ndev, &port);
2270
2271 dev_put(ndev);
2272 if (!cdev)
2273 return NOTIFY_DONE;
2274
2275 pmap = &cdev->pmap;
2276
2277 for (i = 0; i < pmap->used; i++) {
2278 if (pmap->port_csk[i]) {
2279 struct cxgbi_sock *csk = pmap->port_csk[i];
2280
2281 if (csk->dcb_priority != priority) {
2282 iscsi_conn_failure(csk->user_data,
2283 ISCSI_ERR_CONN_FAILED);
2284 pr_info("Restarting iSCSI connection %p with "
2285 "priority %u->%u.\n", csk,
2286 csk->dcb_priority, priority);
2287 }
2288 }
2289 }
2290 return NOTIFY_OK;
2291}
2292#endif
2293
2149static int __init cxgb4i_init_module(void)2294static int __init cxgb4i_init_module(void)
2150{2295{
2151 int rc;2296 int rc;
@@ -2157,11 +2302,18 @@ static int __init cxgb4i_init_module(void) · 5 unmodified lines
2157 return rc;2302 return rc;
2158 cxgb4_register_uld(CXGB4_ULD_ISCSI, &cxgb4i_uld_info);2303 cxgb4_register_uld(CXGB4_ULD_ISCSI, &cxgb4i_uld_info);
2159 2304
2305#ifdef CONFIG_CHELSIO_T4_DCB
2306 pr_info("%s dcb enabled.\n", DRV_MODULE_NAME);
2307 register_dcbevent_notifier(&cxgb4_dcb_change);
2308#endif
2160 return 0;2309 return 0;
2161}2310}
2162 2311
2163static void __exit cxgb4i_exit_module(void)2312static void __exit cxgb4i_exit_module(void)
2164{2313{
2314#ifdef CONFIG_CHELSIO_T4_DCB
2315 unregister_dcbevent_notifier(&cxgb4_dcb_change);
2316#endif
2165 cxgb4_unregister_uld(CXGB4_ULD_ISCSI);2317 cxgb4_unregister_uld(CXGB4_ULD_ISCSI);
2166 cxgbi_device_unregister_all(CXGBI_FLAG_DEV_T4);2318 cxgbi_device_unregister_all(CXGBI_FLAG_DEV_T4);
2167 cxgbi_iscsi_cleanup(&cxgb4i_iscsi_transport, &cxgb4i_stt);2319 cxgbi_iscsi_cleanup(&cxgb4i_iscsi_transport, &cxgb4i_stt);
drivers/scsi/cxgbi/libcxgbi.h+3−0
@@ -120,6 +120,9 @@ struct cxgbi_sock { · 119 unmodified lines
120 int wr_max_cred;120 int wr_max_cred;
121 int wr_cred;121 int wr_cred;
122 int wr_una_cred;122 int wr_una_cred;
123#ifdef CONFIG_CHELSIO_T4_DCB
124 u8 dcb_priority;
125#endif
123 unsigned char hcrc_len;126 unsigned char hcrc_len;
124 unsigned char dcrc_len;127 unsigned char dcrc_len;
125 128
drivers/scsi/dc395x.c+43−148
@@ -753,105 +753,6 @@ static inline struct ScsiReqBlk *find_cmd(struct scsi_cmnd *cmd, · 752 unmodified lines
753 return NULL;753 return NULL;
754}754}
755 755
756
757static struct ScsiReqBlk *srb_get_free(struct AdapterCtlBlk *acb)
758{
759 struct list_head *head = &acb->srb_free_list;
760 struct ScsiReqBlk *srb = NULL;
761
762 if (!list_empty(head)) {
763 srb = list_entry(head->next, struct ScsiReqBlk, list);
764 list_del(head->next);
765 dprintkdbg(DBG_0, "srb_get_free: srb=%p\n", srb);
766 }
767 return srb;
768}
769
770
771static void srb_free_insert(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb)
772{
773 dprintkdbg(DBG_0, "srb_free_insert: srb=%p\n", srb);
774 list_add_tail(&srb->list, &acb->srb_free_list);
775}
776
777
778static void srb_waiting_insert(struct DeviceCtlBlk *dcb,
779 struct ScsiReqBlk *srb)
780{
781 dprintkdbg(DBG_0, "srb_waiting_insert: (0x%p) <%02i-%i> srb=%p\n",
782 srb->cmd, dcb->target_id, dcb->target_lun, srb);
783 list_add(&srb->list, &dcb->srb_waiting_list);
784}
785
786
787static void srb_waiting_append(struct DeviceCtlBlk *dcb,
788 struct ScsiReqBlk *srb)
789{
790 dprintkdbg(DBG_0, "srb_waiting_append: (0x%p) <%02i-%i> srb=%p\n",
791 srb->cmd, dcb->target_id, dcb->target_lun, srb);
792 list_add_tail(&srb->list, &dcb->srb_waiting_list);
793}
794
795
796static void srb_going_append(struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb)
797{
798 dprintkdbg(DBG_0, "srb_going_append: (0x%p) <%02i-%i> srb=%p\n",
799 srb->cmd, dcb->target_id, dcb->target_lun, srb);
800 list_add_tail(&srb->list, &dcb->srb_going_list);
801}
802
803
804static void srb_going_remove(struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb)
805{
806 struct ScsiReqBlk *i;
807 struct ScsiReqBlk *tmp;
808 dprintkdbg(DBG_0, "srb_going_remove: (0x%p) <%02i-%i> srb=%p\n",
809 srb->cmd, dcb->target_id, dcb->target_lun, srb);
810
811 list_for_each_entry_safe(i, tmp, &dcb->srb_going_list, list)
812 if (i == srb) {
813 list_del(&srb->list);
814 break;
815 }
816}
817
818
819static void srb_waiting_remove(struct DeviceCtlBlk *dcb,
820 struct ScsiReqBlk *srb)
821{
822 struct ScsiReqBlk *i;
823 struct ScsiReqBlk *tmp;
824 dprintkdbg(DBG_0, "srb_waiting_remove: (0x%p) <%02i-%i> srb=%p\n",
825 srb->cmd, dcb->target_id, dcb->target_lun, srb);
826
827 list_for_each_entry_safe(i, tmp, &dcb->srb_waiting_list, list)
828 if (i == srb) {
829 list_del(&srb->list);
830 break;
831 }
832}
833
834
835static void srb_going_to_waiting_move(struct DeviceCtlBlk *dcb,
836 struct ScsiReqBlk *srb)
837{
838 dprintkdbg(DBG_0,
839 "srb_going_to_waiting_move: (0x%p) <%02i-%i> srb=%p\n",
840 srb->cmd, dcb->target_id, dcb->target_lun, srb);
841 list_move(&srb->list, &dcb->srb_waiting_list);
842}
843
844
845static void srb_waiting_to_going_move(struct DeviceCtlBlk *dcb,
846 struct ScsiReqBlk *srb)
847{
848 dprintkdbg(DBG_0,
849 "srb_waiting_to_going_move: (0x%p) <%02i-%i> srb=%p\n",
850 srb->cmd, dcb->target_id, dcb->target_lun, srb);
851 list_move(&srb->list, &dcb->srb_going_list);
852}
853
854
855/* Sets the timer to wake us up */756/* Sets the timer to wake us up */
856static void waiting_set_timer(struct AdapterCtlBlk *acb, unsigned long to)757static void waiting_set_timer(struct AdapterCtlBlk *acb, unsigned long to)
857{758{
@@ -923,7 +824,7 @@ static void waiting_process_next(struct AdapterCtlBlk *acb) · 65 unmodified lines
923 824
924 /* Try to send to the bus */825 /* Try to send to the bus */
925 if (!start_scsi(acb, pos, srb))826 if (!start_scsi(acb, pos, srb))
926 srb_waiting_to_going_move(pos, srb);827 list_move(&srb->list, &pos->srb_going_list);
927 else828 else
928 waiting_set_timer(acb, HZ/50);829 waiting_set_timer(acb, HZ/50);
929 break;830 break;
@@ -960,15 +861,15 @@ static void send_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb) · 30 unmodified lines
960 if (dcb->max_command <= list_size(&dcb->srb_going_list) ||861 if (dcb->max_command <= list_size(&dcb->srb_going_list) ||
961 acb->active_dcb ||862 acb->active_dcb ||
962 (acb->acb_flag & (RESET_DETECT + RESET_DONE + RESET_DEV))) {863 (acb->acb_flag & (RESET_DETECT + RESET_DONE + RESET_DEV))) {
963 srb_waiting_append(dcb, srb);864 list_add_tail(&srb->list, &dcb->srb_waiting_list);
964 waiting_process_next(acb);865 waiting_process_next(acb);
965 return;866 return;
966 }867 }
967 868
968 if (!start_scsi(acb, dcb, srb))869 if (!start_scsi(acb, dcb, srb)) {
969 srb_going_append(dcb, srb);870 list_add_tail(&srb->list, &dcb->srb_going_list);
970 else {871 } else {
971 srb_waiting_insert(dcb, srb);872 list_add(&srb->list, &dcb->srb_waiting_list);
972 waiting_set_timer(acb, HZ / 50);873 waiting_set_timer(acb, HZ / 50);
973 }874 }
974}875}
@@ -1045,10 +946,8 @@ static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb, · 70 unmodified lines
1045 sgp->length++;946 sgp->length++;
1046 }947 }
1047 948
1048 srb->sg_bus_addr = pci_map_single(dcb->acb->dev,949 srb->sg_bus_addr = dma_map_single(&dcb->acb->dev->dev,
1049 srb->segment_x,950 srb->segment_x, SEGMENTX_LEN, DMA_TO_DEVICE);
1050 SEGMENTX_LEN,
1051 PCI_DMA_TODEVICE);
1052 951
1053 dprintkdbg(DBG_SG, "build_srb: [n] map sg %p->%08x(%05x)\n",952 dprintkdbg(DBG_SG, "build_srb: [n] map sg %p->%08x(%05x)\n",
1054 srb->segment_x, srb->sg_bus_addr, SEGMENTX_LEN);953 srb->segment_x, srb->sg_bus_addr, SEGMENTX_LEN);
@@ -1116,9 +1015,9 @@ static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct s · 61 unmodified lines
1116 cmd->scsi_done = done;1015 cmd->scsi_done = done;
1117 cmd->result = 0;1016 cmd->result = 0;
1118 1017
1119 srb = srb_get_free(acb);1018 srb = list_first_entry_or_null(&acb->srb_free_list,
1120 if (!srb)1019 struct ScsiReqBlk, list);
1121 {1020 if (!srb) {
1122 /*1021 /*
1123 * Return 1 since we are unable to queue this command at this1022 * Return 1 since we are unable to queue this command at this
1124 * point in time.1023 * point in time.
@@ -1126,12 +1025,13 @@ static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct s · 1 unmodified line
1126 dprintkdbg(DBG_0, "queue_command: No free srb's\n");1025 dprintkdbg(DBG_0, "queue_command: No free srb's\n");
1127 return 1;1026 return 1;
1128 }1027 }
1028 list_del(&srb->list);
1129 1029
1130 build_srb(cmd, dcb, srb);1030 build_srb(cmd, dcb, srb);
1131 1031
1132 if (!list_empty(&dcb->srb_waiting_list)) {1032 if (!list_empty(&dcb->srb_waiting_list)) {
1133 /* append to waiting queue */1033 /* append to waiting queue */
1134 srb_waiting_append(dcb, srb);1034 list_add_tail(&srb->list, &dcb->srb_waiting_list);
1135 waiting_process_next(acb);1035 waiting_process_next(acb);
1136 } else {1036 } else {
1137 /* process immediately */1037 /* process immediately */
@@ -1376,11 +1276,11 @@ static int dc395x_eh_abort(struct scsi_cmnd *cmd) · 238 unmodified lines
1376 1276
1377 srb = find_cmd(cmd, &dcb->srb_waiting_list);1277 srb = find_cmd(cmd, &dcb->srb_waiting_list);
1378 if (srb) {1278 if (srb) {
1379 srb_waiting_remove(dcb, srb);1279 list_del(&srb->list);
1380 pci_unmap_srb_sense(acb, srb);1280 pci_unmap_srb_sense(acb, srb);
1381 pci_unmap_srb(acb, srb);1281 pci_unmap_srb(acb, srb);
1382 free_tag(dcb, srb);1282 free_tag(dcb, srb);
1383 srb_free_insert(acb, srb);1283 list_add_tail(&srb->list, &acb->srb_free_list);
1384 dprintkl(KERN_DEBUG, "eh_abort: Command was waiting\n");1284 dprintkl(KERN_DEBUG, "eh_abort: Command was waiting\n");
1385 cmd->result = DID_ABORT << 16;1285 cmd->result = DID_ABORT << 16;
1386 return SUCCESS;1286 return SUCCESS;
@@ -1969,14 +1869,15 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left) · 582 unmodified lines
1969 xferred -= psge->length;1869 xferred -= psge->length;
1970 } else {1870 } else {
1971 /* Partial SG entry done */1871 /* Partial SG entry done */
1872 dma_sync_single_for_cpu(&srb->dcb->acb->dev->dev,
1873 srb->sg_bus_addr, SEGMENTX_LEN,
1874 DMA_TO_DEVICE);
1972 psge->length -= xferred;1875 psge->length -= xferred;
1973 psge->address += xferred;1876 psge->address += xferred;
1974 srb->sg_index = idx;1877 srb->sg_index = idx;
1975 pci_dma_sync_single_for_device(srb->dcb->1878 dma_sync_single_for_device(&srb->dcb->acb->dev->dev,
1976 acb->dev,1879 srb->sg_bus_addr, SEGMENTX_LEN,
1977 srb->sg_bus_addr,1880 DMA_TO_DEVICE);
1978 SEGMENTX_LEN,
1979 PCI_DMA_TODEVICE);
1980 break;1881 break;
1981 }1882 }
1982 psge++;1883 psge++;
@@ -3083,7 +2984,7 @@ static void disconnect(struct AdapterCtlBlk *acb) · 1100 unmodified lines
3083 goto disc1;2984 goto disc1;
3084 }2985 }
3085 free_tag(dcb, srb);2986 free_tag(dcb, srb);
3086 srb_going_to_waiting_move(dcb, srb);2987 list_move(&srb->list, &dcb->srb_waiting_list);
3087 dprintkdbg(DBG_KG,2988 dprintkdbg(DBG_KG,
3088 "disconnect: (0x%p) Retry\n",2989 "disconnect: (0x%p) Retry\n",
3089 srb->cmd);2990 srb->cmd);
@@ -3148,7 +3049,7 @@ static void reselect(struct AdapterCtlBlk *acb) · 58 unmodified lines
3148 3049
3149 srb->state = SRB_READY;3050 srb->state = SRB_READY;
3150 free_tag(dcb, srb);3051 free_tag(dcb, srb);
3151 srb_going_to_waiting_move(dcb, srb);3052 list_move(&srb->list, &dcb->srb_waiting_list);
3152 waiting_set_timer(acb, HZ / 20);3053 waiting_set_timer(acb, HZ / 20);
3153 3054
3154 /* return; */3055 /* return; */
@@ -3271,9 +3172,8 @@ static void pci_unmap_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb) · 116 unmodified lines
3271 /* unmap DC395x SG list */3172 /* unmap DC395x SG list */
3272 dprintkdbg(DBG_SG, "pci_unmap_srb: list=%08x(%05x)\n",3173 dprintkdbg(DBG_SG, "pci_unmap_srb: list=%08x(%05x)\n",
3273 srb->sg_bus_addr, SEGMENTX_LEN);3174 srb->sg_bus_addr, SEGMENTX_LEN);
3274 pci_unmap_single(acb->dev, srb->sg_bus_addr,3175 dma_unmap_single(&acb->dev->dev, srb->sg_bus_addr, SEGMENTX_LEN,
3275 SEGMENTX_LEN,3176 DMA_TO_DEVICE);
3276 PCI_DMA_TODEVICE);
3277 dprintkdbg(DBG_SG, "pci_unmap_srb: segs=%i buffer=%p\n",3177 dprintkdbg(DBG_SG, "pci_unmap_srb: segs=%i buffer=%p\n",
3278 scsi_sg_count(cmd), scsi_bufflen(cmd));3178 scsi_sg_count(cmd), scsi_bufflen(cmd));
3279 /* unmap the sg segments */3179 /* unmap the sg segments */
@@ -3291,8 +3191,8 @@ static void pci_unmap_srb_sense(struct AdapterCtlBlk *acb, · 11 unmodified lines
3291 /* Unmap sense buffer */3191 /* Unmap sense buffer */
3292 dprintkdbg(DBG_SG, "pci_unmap_srb_sense: buffer=%08x\n",3192 dprintkdbg(DBG_SG, "pci_unmap_srb_sense: buffer=%08x\n",
3293 srb->segment_x[0].address);3193 srb->segment_x[0].address);
3294 pci_unmap_single(acb->dev, srb->segment_x[0].address,3194 dma_unmap_single(&acb->dev->dev, srb->segment_x[0].address,
3295 srb->segment_x[0].length, PCI_DMA_FROMDEVICE);3195 srb->segment_x[0].length, DMA_FROM_DEVICE);
3296 /* Restore SG stuff */3196 /* Restore SG stuff */
3297 srb->total_xfer_length = srb->xferred;3197 srb->total_xfer_length = srb->xferred;
3298 srb->segment_x[0].address =3198 srb->segment_x[0].address =
@@ -3411,7 +3311,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 112 unmodified lines
3411 tempcnt--;3311 tempcnt--;
3412 dcb->max_command = tempcnt;3312 dcb->max_command = tempcnt;
3413 free_tag(dcb, srb);3313 free_tag(dcb, srb);
3414 srb_going_to_waiting_move(dcb, srb);3314 list_move(&srb->list, &dcb->srb_waiting_list);
3415 waiting_set_timer(acb, HZ / 20);3315 waiting_set_timer(acb, HZ / 20);
3416 srb->adapter_status = 0;3316 srb->adapter_status = 0;
3417 srb->target_status = 0;3317 srb->target_status = 0;
@@ -3447,14 +3347,12 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 29 unmodified lines
3447 }3347 }
3448 }3348 }
3449 3349
3450 if (dir != PCI_DMA_NONE && scsi_sg_count(cmd))
3451 pci_dma_sync_sg_for_cpu(acb->dev, scsi_sglist(cmd),
3452 scsi_sg_count(cmd), dir);
3453
3454 ckc_only = 0;3350 ckc_only = 0;
3455/* Check Error Conditions */3351/* Check Error Conditions */
3456 ckc_e:3352 ckc_e:
3457 3353
3354 pci_unmap_srb(acb, srb);
3355
3458 if (cmd->cmnd[0] == INQUIRY) {3356 if (cmd->cmnd[0] == INQUIRY) {
3459 unsigned char *base = NULL;3357 unsigned char *base = NULL;
3460 struct ScsiInqData *ptr;3358 struct ScsiInqData *ptr;
@@ -3498,16 +3396,14 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 37 unmodified lines
3498 cmd->cmnd[0], srb->total_xfer_length);3396 cmd->cmnd[0], srb->total_xfer_length);
3499 }3397 }
3500 3398
3501 srb_going_remove(dcb, srb);3399 if (srb != acb->tmp_srb) {
3502 /* Add to free list */3400 /* Add to free list */
3503 if (srb == acb->tmp_srb)
3504 dprintkl(KERN_ERR, "srb_done: ERROR! Completed cmd with tmp_srb\n");
3505 else {
3506 dprintkdbg(DBG_0, "srb_done: (0x%p) done result=0x%08x\n",3401 dprintkdbg(DBG_0, "srb_done: (0x%p) done result=0x%08x\n",
3507 cmd, cmd->result);3402 cmd, cmd->result);
3508 srb_free_insert(acb, srb);3403 list_move_tail(&srb->list, &acb->srb_free_list);
3404 } else {
3405 dprintkl(KERN_ERR, "srb_done: ERROR! Completed cmd with tmp_srb\n");
3509 }3406 }
3510 pci_unmap_srb(acb, srb);
3511 3407
3512 cmd->scsi_done(cmd);3408 cmd->scsi_done(cmd);
3513 waiting_process_next(acb);3409 waiting_process_next(acb);
@@ -3535,9 +3431,9 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag, · 21 unmodified lines
3535 result = MK_RES(0, did_flag, 0, 0);3431 result = MK_RES(0, did_flag, 0, 0);
3536 printk("G:%p(%02i-%i) ", p,3432 printk("G:%p(%02i-%i) ", p,
3537 p->device->id, (u8)p->device->lun);3433 p->device->id, (u8)p->device->lun);
3538 srb_going_remove(dcb, srb);3434 list_del(&srb->list);
3539 free_tag(dcb, srb);3435 free_tag(dcb, srb);
3540 srb_free_insert(acb, srb);3436 list_add_tail(&srb->list, &acb->srb_free_list);
3541 p->result = result;3437 p->result = result;
3542 pci_unmap_srb_sense(acb, srb);3438 pci_unmap_srb_sense(acb, srb);
3543 pci_unmap_srb(acb, srb);3439 pci_unmap_srb(acb, srb);
@@ -3565,8 +3461,7 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag, · 21 unmodified lines
3565 result = MK_RES(0, did_flag, 0, 0);3461 result = MK_RES(0, did_flag, 0, 0);
3566 printk("W:%p<%02i-%i>", p, p->device->id,3462 printk("W:%p<%02i-%i>", p, p->device->id,
3567 (u8)p->device->lun);3463 (u8)p->device->lun);
3568 srb_waiting_remove(dcb, srb);3464 list_move_tail(&srb->list, &acb->srb_free_list);
3569 srb_free_insert(acb, srb);
3570 p->result = result;3465 p->result = result;
3571 pci_unmap_srb_sense(acb, srb);3466 pci_unmap_srb_sense(acb, srb);
3572 pci_unmap_srb(acb, srb);3467 pci_unmap_srb(acb, srb);
@@ -3692,9 +3587,9 @@ static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 119 unmodified lines
3692 srb->total_xfer_length = SCSI_SENSE_BUFFERSIZE;3587 srb->total_xfer_length = SCSI_SENSE_BUFFERSIZE;
3693 srb->segment_x[0].length = SCSI_SENSE_BUFFERSIZE;3588 srb->segment_x[0].length = SCSI_SENSE_BUFFERSIZE;
3694 /* Map sense buffer */3589 /* Map sense buffer */
3695 srb->segment_x[0].address =3590 srb->segment_x[0].address = dma_map_single(&acb->dev->dev,
3696 pci_map_single(acb->dev, cmd->sense_buffer,3591 cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
3697 SCSI_SENSE_BUFFERSIZE, PCI_DMA_FROMDEVICE);3592 DMA_FROM_DEVICE);
3698 dprintkdbg(DBG_SG, "request_sense: map buffer %p->%08x(%05x)\n",3593 dprintkdbg(DBG_SG, "request_sense: map buffer %p->%08x(%05x)\n",
3699 cmd->sense_buffer, srb->segment_x[0].address,3594 cmd->sense_buffer, srb->segment_x[0].address,
3700 SCSI_SENSE_BUFFERSIZE);3595 SCSI_SENSE_BUFFERSIZE);
@@ -3705,7 +3600,7 @@ static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 4 unmodified lines
3705 dprintkl(KERN_DEBUG,3600 dprintkl(KERN_DEBUG,
3706 "request_sense: (0x%p) failed <%02i-%i>\n",3601 "request_sense: (0x%p) failed <%02i-%i>\n",
3707 srb->cmd, dcb->target_id, dcb->target_lun);3602 srb->cmd, dcb->target_id, dcb->target_lun);
3708 srb_going_to_waiting_move(dcb, srb);3603 list_move(&srb->list, &dcb->srb_waiting_list);
3709 waiting_set_timer(acb, HZ / 100);3604 waiting_set_timer(acb, HZ / 100);
3710 }3605 }
3711}3606}
@@ -4392,7 +4287,7 @@ static void adapter_init_params(struct AdapterCtlBlk *acb) · 680 unmodified lines
4392 4287
4393 /* link static array of srbs into the srb free list */4288 /* link static array of srbs into the srb free list */
4394 for (i = 0; i < acb->srb_count - 1; i++)4289 for (i = 0; i < acb->srb_count - 1; i++)
4395 srb_free_insert(acb, &acb->srb_array[i]);4290 list_add_tail(&acb->srb_array[i].list, &acb->srb_free_list);
4396}4291}
4397 4292
4398 4293
drivers/scsi/esp_scsi.c+203−83
@@ -369,19 +369,28 @@ static void esp_map_dma(struct esp *esp, struct scsi_cmnd *cmd) · 368 unmodified lines
369{369{
370 struct esp_cmd_priv *spriv = ESP_CMD_PRIV(cmd);370 struct esp_cmd_priv *spriv = ESP_CMD_PRIV(cmd);
371 struct scatterlist *sg = scsi_sglist(cmd);371 struct scatterlist *sg = scsi_sglist(cmd);
372 int dir = cmd->sc_data_direction;372 int total = 0, i;
373 int total, i;
374 373
375 if (dir == DMA_NONE)374 if (cmd->sc_data_direction == DMA_NONE)
376 return;375 return;
377 376
378 spriv->u.num_sg = esp->ops->map_sg(esp, sg, scsi_sg_count(cmd), dir);377 if (esp->flags & ESP_FLAG_NO_DMA_MAP) {
378 /*
379 * For pseudo DMA and PIO we need the virtual address instead of
380 * a dma address, so perform an identity mapping.
381 */
382 spriv->num_sg = scsi_sg_count(cmd);
383 for (i = 0; i < spriv->num_sg; i++) {
384 sg[i].dma_address = (uintptr_t)sg_virt(&sg[i]);
385 total += sg_dma_len(&sg[i]);
386 }
387 } else {
388 spriv->num_sg = scsi_dma_map(cmd);
389 for (i = 0; i < spriv->num_sg; i++)
390 total += sg_dma_len(&sg[i]);
391 }
379 spriv->cur_residue = sg_dma_len(sg);392 spriv->cur_residue = sg_dma_len(sg);
380 spriv->cur_sg = sg;393 spriv->cur_sg = sg;
381
382 total = 0;
383 for (i = 0; i < spriv->u.num_sg; i++)
384 total += sg_dma_len(&sg[i]);
385 spriv->tot_residue = total;394 spriv->tot_residue = total;
386}395}
387 396
@@ -441,13 +450,8 @@ static void esp_advance_dma(struct esp *esp, struct esp_cmd_entry *ent, · 53 unmodified lines
441 450
442static void esp_unmap_dma(struct esp *esp, struct scsi_cmnd *cmd)451static void esp_unmap_dma(struct esp *esp, struct scsi_cmnd *cmd)
443{452{
444 struct esp_cmd_priv *spriv = ESP_CMD_PRIV(cmd);453 if (!(esp->flags & ESP_FLAG_NO_DMA_MAP))
445 int dir = cmd->sc_data_direction;454 scsi_dma_unmap(cmd);
446
447 if (dir == DMA_NONE)
448 return;
449
450 esp->ops->unmap_sg(esp, scsi_sglist(cmd), spriv->u.num_sg, dir);
451}455}
452 456
453static void esp_save_pointers(struct esp *esp, struct esp_cmd_entry *ent)457static void esp_save_pointers(struct esp *esp, struct esp_cmd_entry *ent)
@@ -478,17 +482,6 @@ static void esp_restore_pointers(struct esp *esp, struct esp_cmd_entry *ent) · 24 unmodified lines
478 spriv->tot_residue = ent->saved_tot_residue;482 spriv->tot_residue = ent->saved_tot_residue;
479}483}
480 484
481static void esp_check_command_len(struct esp *esp, struct scsi_cmnd *cmd)
482{
483 if (cmd->cmd_len == 6 ||
484 cmd->cmd_len == 10 ||
485 cmd->cmd_len == 12) {
486 esp->flags &= ~ESP_FLAG_DOING_SLOWCMD;
487 } else {
488 esp->flags |= ESP_FLAG_DOING_SLOWCMD;
489 }
490}
491
492static void esp_write_tgt_config3(struct esp *esp, int tgt)485static void esp_write_tgt_config3(struct esp *esp, int tgt)
493{486{
494 if (esp->rev > ESP100A) {487 if (esp->rev > ESP100A) {
@@ -624,6 +617,26 @@ static void esp_free_lun_tag(struct esp_cmd_entry *ent, · 129 unmodified lines
624 }617 }
625}618}
626 619
620static void esp_map_sense(struct esp *esp, struct esp_cmd_entry *ent)
621{
622 ent->sense_ptr = ent->cmd->sense_buffer;
623 if (esp->flags & ESP_FLAG_NO_DMA_MAP) {
624 ent->sense_dma = (uintptr_t)ent->sense_ptr;
625 return;
626 }
627
628 ent->sense_dma = dma_map_single(esp->dev, ent->sense_ptr,
629 SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
630}
631
632static void esp_unmap_sense(struct esp *esp, struct esp_cmd_entry *ent)
633{
634 if (!(esp->flags & ESP_FLAG_NO_DMA_MAP))
635 dma_unmap_single(esp->dev, ent->sense_dma,
636 SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
637 ent->sense_ptr = NULL;
638}
639
627/* When a contingent allegiance conditon is created, we force feed a640/* When a contingent allegiance conditon is created, we force feed a
628 * REQUEST_SENSE command to the device to fetch the sense data. I641 * REQUEST_SENSE command to the device to fetch the sense data. I
629 * tried many other schemes, relying on the scsi error handling layer642 * tried many other schemes, relying on the scsi error handling layer
@@ -645,12 +658,7 @@ static void esp_autosense(struct esp *esp, struct esp_cmd_entry *ent) · 15 unmodified lines
645 if (!ent->sense_ptr) {658 if (!ent->sense_ptr) {
646 esp_log_autosense("Doing auto-sense for tgt[%d] lun[%d]\n",659 esp_log_autosense("Doing auto-sense for tgt[%d] lun[%d]\n",
647 tgt, lun);660 tgt, lun);
648 661 esp_map_sense(esp, ent);
649 ent->sense_ptr = cmd->sense_buffer;
650 ent->sense_dma = esp->ops->map_single(esp,
651 ent->sense_ptr,
652 SCSI_SENSE_BUFFERSIZE,
653 DMA_FROM_DEVICE);
654 }662 }
655 ent->saved_sense_ptr = ent->sense_ptr;663 ent->saved_sense_ptr = ent->sense_ptr;
656 664
@@ -717,10 +725,10 @@ static struct esp_cmd_entry *find_and_prep_issuable_command(struct esp *esp) · 60 unmodified lines
717static void esp_maybe_execute_command(struct esp *esp)725static void esp_maybe_execute_command(struct esp *esp)
718{726{
719 struct esp_target_data *tp;727 struct esp_target_data *tp;
720 struct esp_lun_data *lp;
721 struct scsi_device *dev;728 struct scsi_device *dev;
722 struct scsi_cmnd *cmd;729 struct scsi_cmnd *cmd;
723 struct esp_cmd_entry *ent;730 struct esp_cmd_entry *ent;
731 bool select_and_stop = false;
724 int tgt, lun, i;732 int tgt, lun, i;
725 u32 val, start_cmd;733 u32 val, start_cmd;
726 u8 *p;734 u8 *p;
@@ -743,7 +751,6 @@ static void esp_maybe_execute_command(struct esp *esp) · 16 unmodified lines
743 tgt = dev->id;751 tgt = dev->id;
744 lun = dev->lun;752 lun = dev->lun;
745 tp = &esp->target[tgt];753 tp = &esp->target[tgt];
746 lp = dev->hostdata;
747 754
748 list_move(&ent->list, &esp->active_cmds);755 list_move(&ent->list, &esp->active_cmds);
749 756
@@ -752,7 +759,8 @@ static void esp_maybe_execute_command(struct esp *esp) · 2 unmodified lines
752 esp_map_dma(esp, cmd);759 esp_map_dma(esp, cmd);
753 esp_save_pointers(esp, ent);760 esp_save_pointers(esp, ent);
754 761
755 esp_check_command_len(esp, cmd);762 if (!(cmd->cmd_len == 6 || cmd->cmd_len == 10 || cmd->cmd_len == 12))
763 select_and_stop = true;
756 764
757 p = esp->command_block;765 p = esp->command_block;
758 766
@@ -793,42 +801,22 @@ static void esp_maybe_execute_command(struct esp *esp) · 34 unmodified lines
793 tp->flags &= ~ESP_TGT_CHECK_NEGO;801 tp->flags &= ~ESP_TGT_CHECK_NEGO;
794 }802 }
795 803
796 /* Process it like a slow command. */804 /* If there are multiple message bytes, use Select and Stop */
797 if (tp->flags & (ESP_TGT_NEGO_WIDE | ESP_TGT_NEGO_SYNC))805 if (esp->msg_out_len)
798 esp->flags |= ESP_FLAG_DOING_SLOWCMD;806 select_and_stop = true;
799 }807 }
800 808
801build_identify:809build_identify:
802 /* If we don't have a lun-data struct yet, we're probing810 *p++ = IDENTIFY(tp->flags & ESP_TGT_DISCONNECT, lun);
803 * so do not disconnect. Also, do not disconnect unless
804 * we have a tag on this command.
805 */
806 if (lp && (tp->flags & ESP_TGT_DISCONNECT) && ent->tag[0])
807 *p++ = IDENTIFY(1, lun);
808 else
809 *p++ = IDENTIFY(0, lun);
810 811
811 if (ent->tag[0] && esp->rev == ESP100) {812 if (ent->tag[0] && esp->rev == ESP100) {
812 /* ESP100 lacks select w/atn3 command, use select813 /* ESP100 lacks select w/atn3 command, use select
813 * and stop instead.814 * and stop instead.
814 */815 */
815 esp->flags |= ESP_FLAG_DOING_SLOWCMD;816 select_and_stop = true;
816 }817 }
817 818
818 if (!(esp->flags & ESP_FLAG_DOING_SLOWCMD)) {819 if (select_and_stop) {
819 start_cmd = ESP_CMD_SELA;
820 if (ent->tag[0]) {
821 *p++ = ent->tag[0];
822 *p++ = ent->tag[1];
823
824 start_cmd = ESP_CMD_SA3;
825 }
826
827 for (i = 0; i < cmd->cmd_len; i++)
828 *p++ = cmd->cmnd[i];
829
830 esp->select_state = ESP_SELECT_BASIC;
831 } else {
832 esp->cmd_bytes_left = cmd->cmd_len;820 esp->cmd_bytes_left = cmd->cmd_len;
833 esp->cmd_bytes_ptr = &cmd->cmnd[0];821 esp->cmd_bytes_ptr = &cmd->cmnd[0];
834 822
@@ -843,6 +831,19 @@ build_identify: · 8 unmodified lines
843 831
844 start_cmd = ESP_CMD_SELAS;832 start_cmd = ESP_CMD_SELAS;
845 esp->select_state = ESP_SELECT_MSGOUT;833 esp->select_state = ESP_SELECT_MSGOUT;
834 } else {
835 start_cmd = ESP_CMD_SELA;
836 if (ent->tag[0]) {
837 *p++ = ent->tag[0];
838 *p++ = ent->tag[1];
839
840 start_cmd = ESP_CMD_SA3;
841 }
842
843 for (i = 0; i < cmd->cmd_len; i++)
844 *p++ = cmd->cmnd[i];
845
846 esp->select_state = ESP_SELECT_BASIC;
846 }847 }
847 val = tgt;848 val = tgt;
848 if (esp->rev == FASHME)849 if (esp->rev == FASHME)
@@ -902,9 +903,7 @@ static void esp_cmd_is_done(struct esp *esp, struct esp_cmd_entry *ent, · 53 unmodified lines
902 }903 }
903 904
904 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) {905 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) {
905 esp->ops->unmap_single(esp, ent->sense_dma,906 esp_unmap_sense(esp, ent);
906 SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
907 ent->sense_ptr = NULL;
908 907
909 /* Restore the message/status bytes to what we actually908 /* Restore the message/status bytes to what we actually
910 * saw originally. Also, report that we are providing909 * saw originally. Also, report that we are providing
@@ -965,7 +964,7 @@ static int esp_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_ · 54 unmodified lines
965 cmd->scsi_done = done;964 cmd->scsi_done = done;
966 965
967 spriv = ESP_CMD_PRIV(cmd);966 spriv = ESP_CMD_PRIV(cmd);
968 spriv->u.dma_addr = ~(dma_addr_t)0x0;967 spriv->num_sg = 0;
969 968
970 list_add_tail(&ent->list, &esp->queued_cmds);969 list_add_tail(&ent->list, &esp->queued_cmds);
971 970
@@ -1252,14 +1251,10 @@ static int esp_finish_select(struct esp *esp) · 280 unmodified lines
1252 esp_unmap_dma(esp, cmd);1251 esp_unmap_dma(esp, cmd);
1253 esp_free_lun_tag(ent, cmd->device->hostdata);1252 esp_free_lun_tag(ent, cmd->device->hostdata);
1254 tp->flags &= ~(ESP_TGT_NEGO_SYNC | ESP_TGT_NEGO_WIDE);1253 tp->flags &= ~(ESP_TGT_NEGO_SYNC | ESP_TGT_NEGO_WIDE);
1255 esp->flags &= ~ESP_FLAG_DOING_SLOWCMD;
1256 esp->cmd_bytes_ptr = NULL;1254 esp->cmd_bytes_ptr = NULL;
1257 esp->cmd_bytes_left = 0;1255 esp->cmd_bytes_left = 0;
1258 } else {1256 } else {
1259 esp->ops->unmap_single(esp, ent->sense_dma,1257 esp_unmap_sense(esp, ent);
1260 SCSI_SENSE_BUFFERSIZE,
1261 DMA_FROM_DEVICE);
1262 ent->sense_ptr = NULL;
1263 }1258 }
1264 1259
1265 /* Now that the state is unwound properly, put back onto1260 /* Now that the state is unwound properly, put back onto
@@ -1303,9 +1298,8 @@ static int esp_finish_select(struct esp *esp) · 37 unmodified lines
1303 esp_flush_fifo(esp);1298 esp_flush_fifo(esp);
1304 }1299 }
1305 1300
1306 /* If we are doing a slow command, negotiation, etc.1301 /* If we are doing a Select And Stop command, negotiation, etc.
1307 * we'll do the right thing as we transition to the1302 * we'll do the right thing as we transition to the next phase.
1308 * next phase.
1309 */1303 */
1310 esp_event(esp, ESP_EVENT_CHECK_PHASE);1304 esp_event(esp, ESP_EVENT_CHECK_PHASE);
1311 return 0;1305 return 0;
@@ -1338,6 +1332,7 @@ static int esp_data_bytes_sent(struct esp *esp, struct esp_cmd_entry *ent, · 26 unmodified lines
1338 1332
1339 bytes_sent = esp->data_dma_len;1333 bytes_sent = esp->data_dma_len;
1340 bytes_sent -= ecount;1334 bytes_sent -= ecount;
1335 bytes_sent -= esp->send_cmd_residual;
1341 1336
1342 /*1337 /*
1343 * The am53c974 has a DMA 'pecularity'. The doc states:1338 * The am53c974 has a DMA 'pecularity'. The doc states:
@@ -1358,7 +1353,7 @@ static int esp_data_bytes_sent(struct esp *esp, struct esp_cmd_entry *ent, · 14 unmodified lines
1358 struct esp_cmd_priv *p = ESP_CMD_PRIV(cmd);1353 struct esp_cmd_priv *p = ESP_CMD_PRIV(cmd);
1359 u8 *ptr;1354 u8 *ptr;
1360 1355
1361 ptr = scsi_kmap_atomic_sg(p->cur_sg, p->u.num_sg,1356 ptr = scsi_kmap_atomic_sg(p->cur_sg, p->num_sg,
1362 &offset, &count);1357 &offset, &count);
1363 if (likely(ptr)) {1358 if (likely(ptr)) {
1364 *(ptr + offset) = bval;1359 *(ptr + offset) = bval;
@@ -2039,11 +2034,8 @@ static void esp_reset_cleanup_one(struct esp *esp, struct esp_cmd_entry *ent) · 674 unmodified lines
2039 esp_free_lun_tag(ent, cmd->device->hostdata);2034 esp_free_lun_tag(ent, cmd->device->hostdata);
2040 cmd->result = DID_RESET << 16;2035 cmd->result = DID_RESET << 16;
2041 2036
2042 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) {2037 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE)
2043 esp->ops->unmap_single(esp, ent->sense_dma,2038 esp_unmap_sense(esp, ent);
2044 SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
2045 ent->sense_ptr = NULL;
2046 }
2047 2039
2048 cmd->scsi_done(cmd);2040 cmd->scsi_done(cmd);
2049 list_del(&ent->list);2041 list_del(&ent->list);
@@ -2382,7 +2374,7 @@ static const char *esp_chip_names[] = { · 332 unmodified lines
2382 2374
2383static struct scsi_transport_template *esp_transport_template;2375static struct scsi_transport_template *esp_transport_template;
2384 2376
2385int scsi_esp_register(struct esp *esp, struct device *dev)2377int scsi_esp_register(struct esp *esp)
2386{2378{
2387 static int instance;2379 static int instance;
2388 int err;2380 int err;
@@ -2402,10 +2394,10 @@ int scsi_esp_register(struct esp *esp, struct device *dev) · 13 unmodified lines
2402 2394
2403 esp_bootup_reset(esp);2395 esp_bootup_reset(esp);
2404 2396
2405 dev_printk(KERN_INFO, dev, "esp%u: regs[%1p:%1p] irq[%u]\n",2397 dev_printk(KERN_INFO, esp->dev, "esp%u: regs[%1p:%1p] irq[%u]\n",
2406 esp->host->unique_id, esp->regs, esp->dma_regs,2398 esp->host->unique_id, esp->regs, esp->dma_regs,
2407 esp->host->irq);2399 esp->host->irq);
2408 dev_printk(KERN_INFO, dev,2400 dev_printk(KERN_INFO, esp->dev,
2409 "esp%u: is a %s, %u MHz (ccf=%u), SCSI ID %u\n",2401 "esp%u: is a %s, %u MHz (ccf=%u), SCSI ID %u\n",
2410 esp->host->unique_id, esp_chip_names[esp->rev],2402 esp->host->unique_id, esp_chip_names[esp->rev],
2411 esp->cfreq / 1000000, esp->cfact, esp->scsi_id);2403 esp->cfreq / 1000000, esp->cfact, esp->scsi_id);
@@ -2413,7 +2405,7 @@ int scsi_esp_register(struct esp *esp, struct device *dev) · 1 unmodified line
2413 /* Let the SCSI bus reset settle. */2405 /* Let the SCSI bus reset settle. */
2414 ssleep(esp_bus_reset_settle);2406 ssleep(esp_bus_reset_settle);
2415 2407
2416 err = scsi_add_host(esp->host, dev);2408 err = scsi_add_host(esp->host, esp->dev);
2417 if (err)2409 if (err)
2418 return err;2410 return err;
2419 2411
@@ -2790,3 +2782,131 @@ MODULE_PARM_DESC(esp_debug, · 370 unmodified lines
2790 2782
2791module_init(esp_init);2783module_init(esp_init);
2792module_exit(esp_exit);2784module_exit(esp_exit);
2785
2786#ifdef CONFIG_SCSI_ESP_PIO
2787static inline unsigned int esp_wait_for_fifo(struct esp *esp)
2788{
2789 int i = 500000;
2790
2791 do {
2792 unsigned int fbytes = esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES;
2793
2794 if (fbytes)
2795 return fbytes;
2796
2797 udelay(1);
2798 } while (--i);
2799
2800 shost_printk(KERN_ERR, esp->host, "FIFO is empty. sreg [%02x]\n",
2801 esp_read8(ESP_STATUS));
2802 return 0;
2803}
2804
2805static inline int esp_wait_for_intr(struct esp *esp)
2806{
2807 int i = 500000;
2808
2809 do {
2810 esp->sreg = esp_read8(ESP_STATUS);
2811 if (esp->sreg & ESP_STAT_INTR)
2812 return 0;
2813
2814 udelay(1);
2815 } while (--i);
2816
2817 shost_printk(KERN_ERR, esp->host, "IRQ timeout. sreg [%02x]\n",
2818 esp->sreg);
2819 return 1;
2820}
2821
2822#define ESP_FIFO_SIZE 16
2823
2824void esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
2825 u32 dma_count, int write, u8 cmd)
2826{
2827 u8 phase = esp->sreg & ESP_STAT_PMASK;
2828
2829 cmd &= ~ESP_CMD_DMA;
2830 esp->send_cmd_error = 0;
2831
2832 if (write) {
2833 u8 *dst = (u8 *)addr;
2834 u8 mask = ~(phase == ESP_MIP ? ESP_INTR_FDONE : ESP_INTR_BSERV);
2835
2836 scsi_esp_cmd(esp, cmd);
2837
2838 while (1) {
2839 if (!esp_wait_for_fifo(esp))
2840 break;
2841
2842 *dst++ = readb(esp->fifo_reg);
2843 --esp_count;
2844
2845 if (!esp_count)
2846 break;
2847
2848 if (esp_wait_for_intr(esp)) {
2849 esp->send_cmd_error = 1;
2850 break;
2851 }
2852
2853 if ((esp->sreg & ESP_STAT_PMASK) != phase)
2854 break;
2855
2856 esp->ireg = esp_read8(ESP_INTRPT);
2857 if (esp->ireg & mask) {
2858 esp->send_cmd_error = 1;
2859 break;
2860 }
2861
2862 if (phase == ESP_MIP)
2863 esp_write8(ESP_CMD_MOK, ESP_CMD);
2864
2865 esp_write8(ESP_CMD_TI, ESP_CMD);
2866 }
2867 } else {
2868 unsigned int n = ESP_FIFO_SIZE;
2869 u8 *src = (u8 *)addr;
2870
2871 scsi_esp_cmd(esp, ESP_CMD_FLUSH);
2872
2873 if (n > esp_count)
2874 n = esp_count;
2875 writesb(esp->fifo_reg, src, n);
2876 src += n;
2877 esp_count -= n;
2878
2879 scsi_esp_cmd(esp, cmd);
2880
2881 while (esp_count) {
2882 if (esp_wait_for_intr(esp)) {
2883 esp->send_cmd_error = 1;
2884 break;
2885 }
2886
2887 if ((esp->sreg & ESP_STAT_PMASK) != phase)
2888 break;
2889
2890 esp->ireg = esp_read8(ESP_INTRPT);
2891 if (esp->ireg & ~ESP_INTR_BSERV) {
2892 esp->send_cmd_error = 1;
2893 break;
2894 }
2895
2896 n = ESP_FIFO_SIZE -
2897 (esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES);
2898
2899 if (n > esp_count)
2900 n = esp_count;
2901 writesb(esp->fifo_reg, src, n);
2902 src += n;
2903 esp_count -= n;
2904
2905 esp_write8(ESP_CMD_TI, ESP_CMD);
2906 }
2907 }
2908
2909 esp->send_cmd_residual = esp_count;
2910}
2911EXPORT_SYMBOL(esp_send_pio_cmd);
2912#endif
drivers/scsi/esp_scsi.h+14−24
@@ -249,11 +249,7 @@ · 248 unmodified lines
249#define SYNC_DEFP_FAST 0x19 /* 10mb/s */249#define SYNC_DEFP_FAST 0x19 /* 10mb/s */
250 250
251struct esp_cmd_priv {251struct esp_cmd_priv {
252 union {252 int num_sg;
253 dma_addr_t dma_addr;
254 int num_sg;
255 } u;
256
257 int cur_residue;253 int cur_residue;
258 struct scatterlist *cur_sg;254 struct scatterlist *cur_sg;
259 int tot_residue;255 int tot_residue;
@@ -363,19 +359,6 @@ struct esp_driver_ops { · 103 unmodified lines
363 void (*esp_write8)(struct esp *esp, u8 val, unsigned long reg);359 void (*esp_write8)(struct esp *esp, u8 val, unsigned long reg);
364 u8 (*esp_read8)(struct esp *esp, unsigned long reg);360 u8 (*esp_read8)(struct esp *esp, unsigned long reg);
365 361
366 /* Map and unmap DMA memory. Eventually the driver will be
367 * converted to the generic DMA API as soon as SBUS is able to
368 * cope with that. At such time we can remove this.
369 */
370 dma_addr_t (*map_single)(struct esp *esp, void *buf,
371 size_t sz, int dir);
372 int (*map_sg)(struct esp *esp, struct scatterlist *sg,
373 int num_sg, int dir);
374 void (*unmap_single)(struct esp *esp, dma_addr_t addr,
375 size_t sz, int dir);
376 void (*unmap_sg)(struct esp *esp, struct scatterlist *sg,
377 int num_sg, int dir);
378
379 /* Return non-zero if there is an IRQ pending. Usually this362 /* Return non-zero if there is an IRQ pending. Usually this
380 * status bit lives in the DMA controller sitting in front of363 * status bit lives in the DMA controller sitting in front of
381 * the ESP. This has to be accurate or else the ESP interrupt364 * the ESP. This has to be accurate or else the ESP interrupt
@@ -435,7 +418,7 @@ struct esp { · 53 unmodified lines
435 const struct esp_driver_ops *ops;418 const struct esp_driver_ops *ops;
436 419
437 struct Scsi_Host *host;420 struct Scsi_Host *host;
438 void *dev;421 struct device *dev;
439 422
440 struct esp_cmd_entry *active_cmd;423 struct esp_cmd_entry *active_cmd;
441 424
@@ -490,11 +473,11 @@ struct esp { · 48 unmodified lines
490 u32 flags;473 u32 flags;
491#define ESP_FLAG_DIFFERENTIAL 0x00000001474#define ESP_FLAG_DIFFERENTIAL 0x00000001
492#define ESP_FLAG_RESETTING 0x00000002475#define ESP_FLAG_RESETTING 0x00000002
493#define ESP_FLAG_DOING_SLOWCMD 0x00000004
494#define ESP_FLAG_WIDE_CAPABLE 0x00000008476#define ESP_FLAG_WIDE_CAPABLE 0x00000008
495#define ESP_FLAG_QUICKIRQ_CHECK 0x00000010477#define ESP_FLAG_QUICKIRQ_CHECK 0x00000010
496#define ESP_FLAG_DISABLE_SYNC 0x00000020478#define ESP_FLAG_DISABLE_SYNC 0x00000020
497#define ESP_FLAG_USE_FIFO 0x00000040479#define ESP_FLAG_USE_FIFO 0x00000040
480#define ESP_FLAG_NO_DMA_MAP 0x00000080
498 481
499 u8 select_state;482 u8 select_state;
500#define ESP_SELECT_NONE 0x00 /* Not selecting */483#define ESP_SELECT_NONE 0x00 /* Not selecting */
@@ -532,7 +515,7 @@ struct esp { · 31 unmodified lines
532 u32 min_period;515 u32 min_period;
533 u32 radelay;516 u32 radelay;
534 517
535 /* Slow command state. */518 /* ESP_CMD_SELAS command state */
536 u8 *cmd_bytes_ptr;519 u8 *cmd_bytes_ptr;
537 int cmd_bytes_left;520 int cmd_bytes_left;
538 521
@@ -540,6 +523,11 @@ struct esp { · 1 unmodified line
540 523
541 void *dma;524 void *dma;
542 int dmarev;525 int dmarev;
526
527 /* These are used by esp_send_pio_cmd() */
528 u8 __iomem *fifo_reg;
529 int send_cmd_error;
530 u32 send_cmd_residual;
543};531};
544 532
545/* A front-end driver for the ESP chip should do the following in533/* A front-end driver for the ESP chip should do the following in
@@ -568,16 +556,18 @@ struct esp { · 22 unmodified lines
568 * example, the DMA engine has to be reset before ESP can556 * example, the DMA engine has to be reset before ESP can
569 * be programmed.557 * be programmed.
570 * 11) If necessary, call dev_set_drvdata() as needed.558 * 11) If necessary, call dev_set_drvdata() as needed.
571 * 12) Call scsi_esp_register() with prepared 'esp' structure559 * 12) Call scsi_esp_register() with prepared 'esp' structure.
572 * and a device pointer if possible.
573 * 13) Check scsi_esp_register() return value, release all resources560 * 13) Check scsi_esp_register() return value, release all resources
574 * if an error was returned.561 * if an error was returned.
575 */562 */
576extern struct scsi_host_template scsi_esp_template;563extern struct scsi_host_template scsi_esp_template;
577extern int scsi_esp_register(struct esp *, struct device *);564extern int scsi_esp_register(struct esp *);
578 565
579extern void scsi_esp_unregister(struct esp *);566extern void scsi_esp_unregister(struct esp *);
580extern irqreturn_t scsi_esp_intr(int, void *);567extern irqreturn_t scsi_esp_intr(int, void *);
581extern void scsi_esp_cmd(struct esp *, u8);568extern void scsi_esp_cmd(struct esp *, u8);
582 569
570extern void esp_send_pio_cmd(struct esp *esp, u32 dma_addr, u32 esp_count,
571 u32 dma_count, int write, u8 cmd);
572
583#endif /* !(_ESP_SCSI_H) */573#endif /* !(_ESP_SCSI_H) */
drivers/scsi/fnic/fnic_fcs.c+18−23
@@ -836,8 +836,8 @@ static void fnic_rq_cmpl_frame_recv(struct vnic_rq *rq, struct cq_desc · 835 unmodified lines
836 u32 fcp_bytes_written = 0;836 u32 fcp_bytes_written = 0;
837 unsigned long flags;837 unsigned long flags;
838 838
839 pci_unmap_single(fnic->pdev, buf->dma_addr, buf->len,839 dma_unmap_single(&fnic->pdev->dev, buf->dma_addr, buf->len,
840 PCI_DMA_FROMDEVICE);840 DMA_FROM_DEVICE);
841 skb = buf->os_buf;841 skb = buf->os_buf;
842 fp = (struct fc_frame *)skb;842 fp = (struct fc_frame *)skb;
843 buf->os_buf = NULL;843 buf->os_buf = NULL;
@@ -977,9 +977,8 @@ int fnic_alloc_rq_frame(struct vnic_rq *rq) · 133 unmodified lines
977 skb_reset_transport_header(skb);977 skb_reset_transport_header(skb);
978 skb_reset_network_header(skb);978 skb_reset_network_header(skb);
979 skb_put(skb, len);979 skb_put(skb, len);
980 pa = pci_map_single(fnic->pdev, skb->data, len, PCI_DMA_FROMDEVICE);980 pa = dma_map_single(&fnic->pdev->dev, skb->data, len, DMA_FROM_DEVICE);
981 981 if (dma_mapping_error(&fnic->pdev->dev, pa)) {
982 if (pci_dma_mapping_error(fnic->pdev, pa)) {
983 r = -ENOMEM;982 r = -ENOMEM;
984 printk(KERN_ERR "PCI mapping failed with error %d\n", r);983 printk(KERN_ERR "PCI mapping failed with error %d\n", r);
985 goto free_skb;984 goto free_skb;
@@ -998,8 +997,8 @@ void fnic_free_rq_buf(struct vnic_rq *rq, struct vnic_rq_buf *buf) · 12 unmodified lines
998 struct fc_frame *fp = buf->os_buf;997 struct fc_frame *fp = buf->os_buf;
999 struct fnic *fnic = vnic_dev_priv(rq->vdev);998 struct fnic *fnic = vnic_dev_priv(rq->vdev);
1000 999
1001 pci_unmap_single(fnic->pdev, buf->dma_addr, buf->len,1000 dma_unmap_single(&fnic->pdev->dev, buf->dma_addr, buf->len,
1002 PCI_DMA_FROMDEVICE);1001 DMA_FROM_DEVICE);
1003 1002
1004 dev_kfree_skb(fp_skb(fp));1003 dev_kfree_skb(fp_skb(fp));
1005 buf->os_buf = NULL;1004 buf->os_buf = NULL;
@@ -1018,7 +1017,6 @@ void fnic_eth_send(struct fcoe_ctlr *fip, struct sk_buff *skb) · 12 unmodified lines
1018 struct ethhdr *eth_hdr;1017 struct ethhdr *eth_hdr;
1019 struct vlan_ethhdr *vlan_hdr;1018 struct vlan_ethhdr *vlan_hdr;
1020 unsigned long flags;1019 unsigned long flags;
1021 int r;
1022 1020
1023 if (!fnic->vlan_hw_insert) {1021 if (!fnic->vlan_hw_insert) {
1024 eth_hdr = (struct ethhdr *)skb_mac_header(skb);1022 eth_hdr = (struct ethhdr *)skb_mac_header(skb);
@@ -1038,11 +1036,10 @@ void fnic_eth_send(struct fcoe_ctlr *fip, struct sk_buff *skb) · 13 unmodified lines
1038 }1036 }
1039 }1037 }
1040 1038
1041 pa = pci_map_single(fnic->pdev, skb->data, skb->len, PCI_DMA_TODEVICE);1039 pa = dma_map_single(&fnic->pdev->dev, skb->data, skb->len,
1042 1040 DMA_TO_DEVICE);
1043 r = pci_dma_mapping_error(fnic->pdev, pa);1041 if (dma_mapping_error(&fnic->pdev->dev, pa)) {
1044 if (r) {1042 printk(KERN_ERR "DMA mapping failed\n");
1045 printk(KERN_ERR "PCI mapping failed with error %d\n", r);
1046 goto free_skb;1043 goto free_skb;
1047 }1044 }
1048 1045
@@ -1058,7 +1055,7 @@ void fnic_eth_send(struct fcoe_ctlr *fip, struct sk_buff *skb) · 9 unmodified lines
1058 1055
1059irq_restore:1056irq_restore:
1060 spin_unlock_irqrestore(&fnic->wq_lock[0], flags);1057 spin_unlock_irqrestore(&fnic->wq_lock[0], flags);
1061 pci_unmap_single(fnic->pdev, pa, skb->len, PCI_DMA_TODEVICE);1058 dma_unmap_single(&fnic->pdev->dev, pa, skb->len, DMA_TO_DEVICE);
1062free_skb:1059free_skb:
1063 kfree_skb(skb);1060 kfree_skb(skb);
1064}1061}
@@ -1115,9 +1112,8 @@ static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp) · 50 unmodified lines
1115 if (FC_FCOE_VER)1112 if (FC_FCOE_VER)
1116 FC_FCOE_ENCAPS_VER(fcoe_hdr, FC_FCOE_VER);1113 FC_FCOE_ENCAPS_VER(fcoe_hdr, FC_FCOE_VER);
1117 1114
1118 pa = pci_map_single(fnic->pdev, eth_hdr, tot_len, PCI_DMA_TODEVICE);1115 pa = dma_map_single(&fnic->pdev->dev, eth_hdr, tot_len, DMA_TO_DEVICE);
1119 1116 if (dma_mapping_error(&fnic->pdev->dev, pa)) {
1120 if (pci_dma_mapping_error(fnic->pdev, pa)) {
1121 ret = -ENOMEM;1117 ret = -ENOMEM;
1122 printk(KERN_ERR "DMA map failed with error %d\n", ret);1118 printk(KERN_ERR "DMA map failed with error %d\n", ret);
1123 goto free_skb_on_err;1119 goto free_skb_on_err;
@@ -1131,8 +1127,7 @@ static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp) · 7 unmodified lines
1131 spin_lock_irqsave(&fnic->wq_lock[0], flags);1127 spin_lock_irqsave(&fnic->wq_lock[0], flags);
1132 1128
1133 if (!vnic_wq_desc_avail(wq)) {1129 if (!vnic_wq_desc_avail(wq)) {
1134 pci_unmap_single(fnic->pdev, pa,1130 dma_unmap_single(&fnic->pdev->dev, pa, tot_len, DMA_TO_DEVICE);
1135 tot_len, PCI_DMA_TODEVICE);
1136 ret = -1;1131 ret = -1;
1137 goto irq_restore;1132 goto irq_restore;
1138 }1133 }
@@ -1247,8 +1242,8 @@ static void fnic_wq_complete_frame_send(struct vnic_wq *wq, · 108 unmodified lines
1247 struct fc_frame *fp = (struct fc_frame *)skb;1242 struct fc_frame *fp = (struct fc_frame *)skb;
1248 struct fnic *fnic = vnic_dev_priv(wq->vdev);1243 struct fnic *fnic = vnic_dev_priv(wq->vdev);
1249 1244
1250 pci_unmap_single(fnic->pdev, buf->dma_addr,1245 dma_unmap_single(&fnic->pdev->dev, buf->dma_addr, buf->len,
1251 buf->len, PCI_DMA_TODEVICE);1246 DMA_TO_DEVICE);
1252 dev_kfree_skb_irq(fp_skb(fp));1247 dev_kfree_skb_irq(fp_skb(fp));
1253 buf->os_buf = NULL;1248 buf->os_buf = NULL;
1254}1249}
@@ -1290,8 +1285,8 @@ void fnic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf) · 35 unmodified lines
1290 struct fc_frame *fp = buf->os_buf;1285 struct fc_frame *fp = buf->os_buf;
1291 struct fnic *fnic = vnic_dev_priv(wq->vdev);1286 struct fnic *fnic = vnic_dev_priv(wq->vdev);
1292 1287
1293 pci_unmap_single(fnic->pdev, buf->dma_addr,1288 dma_unmap_single(&fnic->pdev->dev, buf->dma_addr, buf->len,
1294 buf->len, PCI_DMA_TODEVICE);1289 DMA_TO_DEVICE);
1295 1290
1296 dev_kfree_skb(fp_skb(fp));1291 dev_kfree_skb(fp_skb(fp));
1297 buf->os_buf = NULL;1292 buf->os_buf = NULL;
drivers/scsi/fnic/fnic_main.c+2−17
@@ -611,30 +611,15 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 610 unmodified lines
611 * limitation for the device. Try 64-bit first, and611 * limitation for the device. Try 64-bit first, and
612 * fail to 32-bit.612 * fail to 32-bit.
613 */613 */
614 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));614 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
615 if (err) {615 if (err) {
616 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));616 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
617 if (err) {617 if (err) {
618 shost_printk(KERN_ERR, fnic->lport->host,618 shost_printk(KERN_ERR, fnic->lport->host,
619 "No usable DMA configuration "619 "No usable DMA configuration "
620 "aborting\n");620 "aborting\n");
621 goto err_out_release_regions;621 goto err_out_release_regions;
622 }622 }
623 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
624 if (err) {
625 shost_printk(KERN_ERR, fnic->lport->host,
626 "Unable to obtain 32-bit DMA "
627 "for consistent allocations, aborting.\n");
628 goto err_out_release_regions;
629 }
630 } else {
631 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
632 if (err) {
633 shost_printk(KERN_ERR, fnic->lport->host,
634 "Unable to obtain 64-bit DMA "
635 "for consistent allocations, aborting.\n");
636 goto err_out_release_regions;
637 }
638 }623 }
639 624
640 /* Map vNIC resources from BAR0 */625 /* Map vNIC resources from BAR0 */
drivers/scsi/fnic/fnic_scsi.c+28−71
@@ -126,17 +126,17 @@ static void fnic_release_ioreq_buf(struct fnic *fnic, · 125 unmodified lines
126 struct scsi_cmnd *sc)126 struct scsi_cmnd *sc)
127{127{
128 if (io_req->sgl_list_pa)128 if (io_req->sgl_list_pa)
129 pci_unmap_single(fnic->pdev, io_req->sgl_list_pa,129 dma_unmap_single(&fnic->pdev->dev, io_req->sgl_list_pa,
130 sizeof(io_req->sgl_list[0]) * io_req->sgl_cnt,130 sizeof(io_req->sgl_list[0]) * io_req->sgl_cnt,
131 PCI_DMA_TODEVICE);131 DMA_TO_DEVICE);
132 scsi_dma_unmap(sc);132 scsi_dma_unmap(sc);
133 133
134 if (io_req->sgl_cnt)134 if (io_req->sgl_cnt)
135 mempool_free(io_req->sgl_list_alloc,135 mempool_free(io_req->sgl_list_alloc,
136 fnic->io_sgl_pool[io_req->sgl_type]);136 fnic->io_sgl_pool[io_req->sgl_type]);
137 if (io_req->sense_buf_pa)137 if (io_req->sense_buf_pa)
138 pci_unmap_single(fnic->pdev, io_req->sense_buf_pa,138 dma_unmap_single(&fnic->pdev->dev, io_req->sense_buf_pa,
139 SCSI_SENSE_BUFFERSIZE, PCI_DMA_FROMDEVICE);139 SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
140}140}
141 141
142/* Free up Copy Wq descriptors. Called with copy_wq lock held */142/* Free up Copy Wq descriptors. Called with copy_wq lock held */
@@ -330,7 +330,6 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic, · 187 unmodified lines
330 int flags;330 int flags;
331 u8 exch_flags;331 u8 exch_flags;
332 struct scsi_lun fc_lun;332 struct scsi_lun fc_lun;
333 int r;
334 333
335 if (sg_count) {334 if (sg_count) {
336 /* For each SGE, create a device desc entry */335 /* For each SGE, create a device desc entry */
@@ -342,30 +341,25 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic, · 5 unmodified lines
342 desc++;341 desc++;
343 }342 }
344 343
345 io_req->sgl_list_pa = pci_map_single344 io_req->sgl_list_pa = dma_map_single(&fnic->pdev->dev,
346 (fnic->pdev,345 io_req->sgl_list,
347 io_req->sgl_list,346 sizeof(io_req->sgl_list[0]) * sg_count,
348 sizeof(io_req->sgl_list[0]) * sg_count,347 DMA_TO_DEVICE);
349 PCI_DMA_TODEVICE);348 if (dma_mapping_error(&fnic->pdev->dev, io_req->sgl_list_pa)) {
350 349 printk(KERN_ERR "DMA mapping failed\n");
351 r = pci_dma_mapping_error(fnic->pdev, io_req->sgl_list_pa);
352 if (r) {
353 printk(KERN_ERR "PCI mapping failed with error %d\n", r);
354 return SCSI_MLQUEUE_HOST_BUSY;350 return SCSI_MLQUEUE_HOST_BUSY;
355 }351 }
356 }352 }
357 353
358 io_req->sense_buf_pa = pci_map_single(fnic->pdev,354 io_req->sense_buf_pa = dma_map_single(&fnic->pdev->dev,
359 sc->sense_buffer,355 sc->sense_buffer,
360 SCSI_SENSE_BUFFERSIZE,356 SCSI_SENSE_BUFFERSIZE,
361 PCI_DMA_FROMDEVICE);357 DMA_FROM_DEVICE);
362 358 if (dma_mapping_error(&fnic->pdev->dev, io_req->sense_buf_pa)) {
363 r = pci_dma_mapping_error(fnic->pdev, io_req->sense_buf_pa);359 dma_unmap_single(&fnic->pdev->dev, io_req->sgl_list_pa,
364 if (r) {
365 pci_unmap_single(fnic->pdev, io_req->sgl_list_pa,
366 sizeof(io_req->sgl_list[0]) * sg_count,360 sizeof(io_req->sgl_list[0]) * sg_count,
367 PCI_DMA_TODEVICE);361 DMA_TO_DEVICE);
368 printk(KERN_ERR "PCI mapping failed with error %d\n", r);362 printk(KERN_ERR "DMA mapping failed\n");
369 return SCSI_MLQUEUE_HOST_BUSY;363 return SCSI_MLQUEUE_HOST_BUSY;
370 }364 }
371 365
@@ -2272,33 +2266,17 @@ clean_pending_aborts_end: · 1900 unmodified lines
2272static inline int2266static inline int
2273fnic_scsi_host_start_tag(struct fnic *fnic, struct scsi_cmnd *sc)2267fnic_scsi_host_start_tag(struct fnic *fnic, struct scsi_cmnd *sc)
2274{2268{
2275 struct blk_queue_tag *bqt = fnic->lport->host->bqt;2269 struct request_queue *q = sc->request->q;
2276 int tag, ret = SCSI_NO_TAG;2270 struct request *dummy;
2277
2278 BUG_ON(!bqt);
2279 if (!bqt) {
2280 pr_err("Tags are not supported\n");
2281 goto end;
2282 }
2283
2284 do {
2285 tag = find_next_zero_bit(bqt->tag_map, bqt->max_depth, 1);
2286 if (tag >= bqt->max_depth) {
2287 pr_err("Tag allocation failure\n");
2288 goto end;
2289 }
2290 } while (test_and_set_bit(tag, bqt->tag_map));
2291 2271
2292 bqt->tag_index[tag] = sc->request;2272 dummy = blk_mq_alloc_request(q, REQ_OP_WRITE, BLK_MQ_REQ_NOWAIT);
2293 sc->request->tag = tag;2273 if (IS_ERR(dummy))
2294 sc->tag = tag;2274 return SCSI_NO_TAG;
2295 if (!sc->request->special)
2296 sc->request->special = sc;
2297 2275
2298 ret = tag;2276 sc->tag = sc->request->tag = dummy->tag;
2277 sc->request->special = sc;
2299 2278
2300end:2279 return dummy->tag;
2301 return ret;
2302}2280}
2303 2281
2304/**2282/**
@@ -2308,20 +2286,9 @@ end: · 3 unmodified lines
2308static inline void2286static inline void
2309fnic_scsi_host_end_tag(struct fnic *fnic, struct scsi_cmnd *sc)2287fnic_scsi_host_end_tag(struct fnic *fnic, struct scsi_cmnd *sc)
2310{2288{
2311 struct blk_queue_tag *bqt = fnic->lport->host->bqt;2289 struct request *dummy = sc->request->special;
2312 int tag = sc->request->tag;
2313 2290
2314 if (tag == SCSI_NO_TAG)2291 blk_mq_free_request(dummy);
2315 return;
2316
2317 BUG_ON(!bqt || !bqt->tag_index[tag]);
2318 if (!bqt)
2319 return;
2320
2321 bqt->tag_index[tag] = NULL;
2322 clear_bit(tag, bqt->tag_map);
2323
2324 return;
2325}2292}
2326 2293
2327/*2294/*
@@ -2380,19 +2347,9 @@ int fnic_device_reset(struct scsi_cmnd *sc) · 52 unmodified lines
2380 tag = sc->request->tag;2347 tag = sc->request->tag;
2381 if (unlikely(tag < 0)) {2348 if (unlikely(tag < 0)) {
2382 /*2349 /*
2383 * XXX(hch): current the midlayer fakes up a struct2350 * Really should fix the midlayer to pass in a proper
2384 * request for the explicit reset ioctls, and those2351 * request for ioctls...
2385 * don't have a tag allocated to them. The below
2386 * code pokes into midlayer structures to paper over
2387 * this design issue, but that won't work for blk-mq.
2388 *
2389 * Either someone who can actually test the hardware
2390 * will have to come up with a similar hack for the
2391 * blk-mq case, or we'll have to bite the bullet and
2392 * fix the way the EH ioctls work for real, but until
2393 * that happens we fail these explicit requests here.
2394 */2352 */
2395
2396 tag = fnic_scsi_host_start_tag(fnic, sc);2353 tag = fnic_scsi_host_start_tag(fnic, sc);
2397 if (unlikely(tag == SCSI_NO_TAG))2354 if (unlikely(tag == SCSI_NO_TAG))
2398 goto fnic_device_reset_end;2355 goto fnic_device_reset_end;
drivers/scsi/fnic/vnic_dev.c+13−13
@@ -195,9 +195,9 @@ int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring, · 194 unmodified lines
195{195{
196 vnic_dev_desc_ring_size(ring, desc_count, desc_size);196 vnic_dev_desc_ring_size(ring, desc_count, desc_size);
197 197
198 ring->descs_unaligned = pci_alloc_consistent(vdev->pdev,198 ring->descs_unaligned = dma_alloc_coherent(&vdev->pdev->dev,
199 ring->size_unaligned,199 ring->size_unaligned,
200 &ring->base_addr_unaligned);200 &ring->base_addr_unaligned, GFP_KERNEL);
201 201
202 if (!ring->descs_unaligned) {202 if (!ring->descs_unaligned) {
203 printk(KERN_ERR203 printk(KERN_ERR
@@ -221,7 +221,7 @@ int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring, · 17 unmodified lines
221void vnic_dev_free_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring)221void vnic_dev_free_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring)
222{222{
223 if (ring->descs) {223 if (ring->descs) {
224 pci_free_consistent(vdev->pdev,224 dma_free_coherent(&vdev->pdev->dev,
225 ring->size_unaligned,225 ring->size_unaligned,
226 ring->descs_unaligned,226 ring->descs_unaligned,
227 ring->base_addr_unaligned);227 ring->base_addr_unaligned);
@@ -298,9 +298,9 @@ int vnic_dev_fw_info(struct vnic_dev *vdev, · 70 unmodified lines
298 int err = 0;298 int err = 0;
299 299
300 if (!vdev->fw_info) {300 if (!vdev->fw_info) {
301 vdev->fw_info = pci_alloc_consistent(vdev->pdev,301 vdev->fw_info = dma_alloc_coherent(&vdev->pdev->dev,
302 sizeof(struct vnic_devcmd_fw_info),302 sizeof(struct vnic_devcmd_fw_info),
303 &vdev->fw_info_pa);303 &vdev->fw_info_pa, GFP_KERNEL);
304 if (!vdev->fw_info)304 if (!vdev->fw_info)
305 return -ENOMEM;305 return -ENOMEM;
306 306
@@ -361,8 +361,8 @@ int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats) · 54 unmodified lines
361 int wait = 1000;361 int wait = 1000;
362 362
363 if (!vdev->stats) {363 if (!vdev->stats) {
364 vdev->stats = pci_alloc_consistent(vdev->pdev,364 vdev->stats = dma_alloc_coherent(&vdev->pdev->dev,
365 sizeof(struct vnic_stats), &vdev->stats_pa);365 sizeof(struct vnic_stats), &vdev->stats_pa, GFP_KERNEL);
366 if (!vdev->stats)366 if (!vdev->stats)
367 return -ENOMEM;367 return -ENOMEM;
368 }368 }
@@ -523,9 +523,9 @@ int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) · 154 unmodified lines
523 int wait = 1000;523 int wait = 1000;
524 524
525 if (!vdev->notify) {525 if (!vdev->notify) {
526 vdev->notify = pci_alloc_consistent(vdev->pdev,526 vdev->notify = dma_alloc_coherent(&vdev->pdev->dev,
527 sizeof(struct vnic_devcmd_notify),527 sizeof(struct vnic_devcmd_notify),
528 &vdev->notify_pa);528 &vdev->notify_pa, GFP_KERNEL);
529 if (!vdev->notify)529 if (!vdev->notify)
530 return -ENOMEM;530 return -ENOMEM;
531 }531 }
@@ -647,21 +647,21 @@ void vnic_dev_unregister(struct vnic_dev *vdev) · 115 unmodified lines
647{647{
648 if (vdev) {648 if (vdev) {
649 if (vdev->notify)649 if (vdev->notify)
650 pci_free_consistent(vdev->pdev,650 dma_free_coherent(&vdev->pdev->dev,
651 sizeof(struct vnic_devcmd_notify),651 sizeof(struct vnic_devcmd_notify),
652 vdev->notify,652 vdev->notify,
653 vdev->notify_pa);653 vdev->notify_pa);
654 if (vdev->linkstatus)654 if (vdev->linkstatus)
655 pci_free_consistent(vdev->pdev,655 dma_free_coherent(&vdev->pdev->dev,
656 sizeof(u32),656 sizeof(u32),
657 vdev->linkstatus,657 vdev->linkstatus,
658 vdev->linkstatus_pa);658 vdev->linkstatus_pa);
659 if (vdev->stats)659 if (vdev->stats)
660 pci_free_consistent(vdev->pdev,660 dma_free_coherent(&vdev->pdev->dev,
661 sizeof(struct vnic_stats),661 sizeof(struct vnic_stats),
662 vdev->stats, vdev->stats_pa);662 vdev->stats, vdev->stats_pa);
663 if (vdev->fw_info)663 if (vdev->fw_info)
664 pci_free_consistent(vdev->pdev,664 dma_free_coherent(&vdev->pdev->dev,
665 sizeof(struct vnic_devcmd_fw_info),665 sizeof(struct vnic_devcmd_fw_info),
666 vdev->fw_info, vdev->fw_info_pa);666 vdev->fw_info, vdev->fw_info_pa);
667 kfree(vdev);667 kfree(vdev);
drivers/scsi/hisi_sas/hisi_sas.h+2−1
@@ -34,6 +34,7 @@ · 33 unmodified lines
34#define HISI_SAS_MAX_DEVICES HISI_SAS_MAX_ITCT_ENTRIES34#define HISI_SAS_MAX_DEVICES HISI_SAS_MAX_ITCT_ENTRIES
35#define HISI_SAS_RESET_BIT 035#define HISI_SAS_RESET_BIT 0
36#define HISI_SAS_REJECT_CMD_BIT 136#define HISI_SAS_REJECT_CMD_BIT 1
37#define HISI_SAS_RESERVED_IPTT_CNT 96
37 38
38#define HISI_SAS_STATUS_BUF_SZ (sizeof(struct hisi_sas_status_buffer))39#define HISI_SAS_STATUS_BUF_SZ (sizeof(struct hisi_sas_status_buffer))
39#define HISI_SAS_COMMAND_TABLE_SZ (sizeof(union hisi_sas_command_table))40#define HISI_SAS_COMMAND_TABLE_SZ (sizeof(union hisi_sas_command_table))
@@ -217,7 +218,7 @@ struct hisi_sas_hw { · 177 unmodified lines
217 int (*hw_init)(struct hisi_hba *hisi_hba);218 int (*hw_init)(struct hisi_hba *hisi_hba);
218 void (*setup_itct)(struct hisi_hba *hisi_hba,219 void (*setup_itct)(struct hisi_hba *hisi_hba,
219 struct hisi_sas_device *device);220 struct hisi_sas_device *device);
220 int (*slot_index_alloc)(struct hisi_hba *hisi_hba, int *slot_idx,221 int (*slot_index_alloc)(struct hisi_hba *hisi_hba,
221 struct domain_device *device);222 struct domain_device *device);
222 struct hisi_sas_device *(*alloc_dev)(struct domain_device *device);223 struct hisi_sas_device *(*alloc_dev)(struct domain_device *device);
223 void (*sl_notify)(struct hisi_hba *hisi_hba, int phy_no);224 void (*sl_notify)(struct hisi_hba *hisi_hba, int phy_no);
drivers/scsi/hisi_sas/hisi_sas_main.c+113−48
@@ -183,7 +183,14 @@ static void hisi_sas_slot_index_clear(struct hisi_hba *hisi_hba, int slot_idx) · 182 unmodified lines
183 183
184static void hisi_sas_slot_index_free(struct hisi_hba *hisi_hba, int slot_idx)184static void hisi_sas_slot_index_free(struct hisi_hba *hisi_hba, int slot_idx)
185{185{
186 hisi_sas_slot_index_clear(hisi_hba, slot_idx);186 unsigned long flags;
187
188 if (hisi_hba->hw->slot_index_alloc || (slot_idx >=
189 hisi_hba->hw->max_command_entries - HISI_SAS_RESERVED_IPTT_CNT)) {
190 spin_lock_irqsave(&hisi_hba->lock, flags);
191 hisi_sas_slot_index_clear(hisi_hba, slot_idx);
192 spin_unlock_irqrestore(&hisi_hba->lock, flags);
193 }
187}194}
188 195
189static void hisi_sas_slot_index_set(struct hisi_hba *hisi_hba, int slot_idx)196static void hisi_sas_slot_index_set(struct hisi_hba *hisi_hba, int slot_idx)
@@ -193,24 +200,34 @@ static void hisi_sas_slot_index_set(struct hisi_hba *hisi_hba, int slot_idx) · 3 unmodified lines
193 set_bit(slot_idx, bitmap);200 set_bit(slot_idx, bitmap);
194}201}
195 202
196static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba, int *slot_idx)203static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba,
204 struct scsi_cmnd *scsi_cmnd)
197{205{
198 unsigned int index;206 int index;
199 void *bitmap = hisi_hba->slot_index_tags;207 void *bitmap = hisi_hba->slot_index_tags;
208 unsigned long flags;
209
210 if (scsi_cmnd)
211 return scsi_cmnd->request->tag;
200 212
213 spin_lock_irqsave(&hisi_hba->lock, flags);
201 index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count,214 index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count,
202 hisi_hba->last_slot_index + 1);215 hisi_hba->last_slot_index + 1);
203 if (index >= hisi_hba->slot_index_count) {216 if (index >= hisi_hba->slot_index_count) {
204 index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count,217 index = find_next_zero_bit(bitmap,
205 0);218 hisi_hba->slot_index_count,
206 if (index >= hisi_hba->slot_index_count)219 hisi_hba->hw->max_command_entries -
220 HISI_SAS_RESERVED_IPTT_CNT);
221 if (index >= hisi_hba->slot_index_count) {
222 spin_unlock_irqrestore(&hisi_hba->lock, flags);
207 return -SAS_QUEUE_FULL;223 return -SAS_QUEUE_FULL;
224 }
208 }225 }
209 hisi_sas_slot_index_set(hisi_hba, index);226 hisi_sas_slot_index_set(hisi_hba, index);
210 *slot_idx = index;
211 hisi_hba->last_slot_index = index;227 hisi_hba->last_slot_index = index;
228 spin_unlock_irqrestore(&hisi_hba->lock, flags);
212 229
213 return 0;230 return index;
214}231}
215 232
216static void hisi_sas_slot_index_init(struct hisi_hba *hisi_hba)233static void hisi_sas_slot_index_init(struct hisi_hba *hisi_hba)
@@ -249,9 +266,7 @@ void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task, · 32 unmodified lines
249 266
250 memset(slot, 0, offsetof(struct hisi_sas_slot, buf));267 memset(slot, 0, offsetof(struct hisi_sas_slot, buf));
251 268
252 spin_lock_irqsave(&hisi_hba->lock, flags);
253 hisi_sas_slot_index_free(hisi_hba, slot->idx);269 hisi_sas_slot_index_free(hisi_hba, slot->idx);
254 spin_unlock_irqrestore(&hisi_hba->lock, flags);
255}270}
256EXPORT_SYMBOL_GPL(hisi_sas_slot_task_free);271EXPORT_SYMBOL_GPL(hisi_sas_slot_task_free);
257 272
@@ -287,13 +302,13 @@ static int hisi_sas_task_prep(struct sas_task *task, · 29 unmodified lines
287 int *pass)302 int *pass)
288{303{
289 struct domain_device *device = task->dev;304 struct domain_device *device = task->dev;
290 struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);305 struct hisi_hba *hisi_hba;
291 struct hisi_sas_device *sas_dev = device->lldd_dev;306 struct hisi_sas_device *sas_dev = device->lldd_dev;
292 struct hisi_sas_port *port;307 struct hisi_sas_port *port;
293 struct hisi_sas_slot *slot;308 struct hisi_sas_slot *slot;
294 struct hisi_sas_cmd_hdr *cmd_hdr_base;309 struct hisi_sas_cmd_hdr *cmd_hdr_base;
295 struct asd_sas_port *sas_port = device->port;310 struct asd_sas_port *sas_port = device->port;
296 struct device *dev = hisi_hba->dev;311 struct device *dev;
297 int dlvry_queue_slot, dlvry_queue, rc, slot_idx;312 int dlvry_queue_slot, dlvry_queue, rc, slot_idx;
298 int n_elem = 0, n_elem_req = 0, n_elem_resp = 0;313 int n_elem = 0, n_elem_req = 0, n_elem_resp = 0;
299 struct hisi_sas_dq *dq;314 struct hisi_sas_dq *dq;
@@ -314,6 +329,9 @@ static int hisi_sas_task_prep(struct sas_task *task, · 14 unmodified lines
314 return -ECOMM;329 return -ECOMM;
315 }330 }
316 331
332 hisi_hba = dev_to_hisi_hba(device);
333 dev = hisi_hba->dev;
334
317 if (DEV_IS_GONE(sas_dev)) {335 if (DEV_IS_GONE(sas_dev)) {
318 if (sas_dev)336 if (sas_dev)
319 dev_info(dev, "task prep: device %d not ready\n",337 dev_info(dev, "task prep: device %d not ready\n",
@@ -381,16 +399,27 @@ static int hisi_sas_task_prep(struct sas_task *task, · 61 unmodified lines
381 goto err_out_dma_unmap;399 goto err_out_dma_unmap;
382 }400 }
383 401
384 spin_lock_irqsave(&hisi_hba->lock, flags);
385 if (hisi_hba->hw->slot_index_alloc)402 if (hisi_hba->hw->slot_index_alloc)
386 rc = hisi_hba->hw->slot_index_alloc(hisi_hba, &slot_idx,403 rc = hisi_hba->hw->slot_index_alloc(hisi_hba, device);
387 device);404 else {
388 else405 struct scsi_cmnd *scsi_cmnd = NULL;
389 rc = hisi_sas_slot_index_alloc(hisi_hba, &slot_idx);406
390 spin_unlock_irqrestore(&hisi_hba->lock, flags);407 if (task->uldd_task) {
391 if (rc)408 struct ata_queued_cmd *qc;
409
410 if (dev_is_sata(device)) {
411 qc = task->uldd_task;
412 scsi_cmnd = qc->scsicmd;
413 } else {
414 scsi_cmnd = task->uldd_task;
415 }
416 }
417 rc = hisi_sas_slot_index_alloc(hisi_hba, scsi_cmnd);
418 }
419 if (rc < 0)
392 goto err_out_dma_unmap;420 goto err_out_dma_unmap;
393 421
422 slot_idx = rc;
394 slot = &hisi_hba->slot_info[slot_idx];423 slot = &hisi_hba->slot_info[slot_idx];
395 424
396 spin_lock_irqsave(&dq->lock, flags);425 spin_lock_irqsave(&dq->lock, flags);
@@ -451,9 +480,7 @@ static int hisi_sas_task_prep(struct sas_task *task, · 54 unmodified lines
451 return 0;480 return 0;
452 481
453err_out_tag:482err_out_tag:
454 spin_lock_irqsave(&hisi_hba->lock, flags);
455 hisi_sas_slot_index_free(hisi_hba, slot_idx);483 hisi_sas_slot_index_free(hisi_hba, slot_idx);
456 spin_unlock_irqrestore(&hisi_hba->lock, flags);
457err_out_dma_unmap:484err_out_dma_unmap:
458 if (!sas_protocol_ata(task->task_proto)) {485 if (!sas_protocol_ata(task->task_proto)) {
459 if (task->num_scatter) {486 if (task->num_scatter) {
@@ -904,6 +931,9 @@ static void hisi_sas_phy_set_linkrate(struct hisi_hba *hisi_hba, int phy_no, · 444 unmodified lines
904 _r.maximum_linkrate = max;931 _r.maximum_linkrate = max;
905 _r.minimum_linkrate = min;932 _r.minimum_linkrate = min;
906 933
934 sas_phy->phy->maximum_linkrate = max;
935 sas_phy->phy->minimum_linkrate = min;
936
907 hisi_hba->hw->phy_disable(hisi_hba, phy_no);937 hisi_hba->hw->phy_disable(hisi_hba, phy_no);
908 msleep(100);938 msleep(100);
909 hisi_hba->hw->phy_set_linkrate(hisi_hba, phy_no, &_r);939 hisi_hba->hw->phy_set_linkrate(hisi_hba, phy_no, &_r);
@@ -950,8 +980,7 @@ static int hisi_sas_control_phy(struct asd_sas_phy *sas_phy, enum phy_func func, · 40 unmodified lines
950 980
951static void hisi_sas_task_done(struct sas_task *task)981static void hisi_sas_task_done(struct sas_task *task)
952{982{
953 if (!del_timer(&task->slow_task->timer))983 del_timer(&task->slow_task->timer);
954 return;
955 complete(&task->slow_task->completion);984 complete(&task->slow_task->completion);
956}985}
957 986
@@ -960,13 +989,17 @@ static void hisi_sas_tmf_timedout(struct timer_list *t) · 2 unmodified lines
960 struct sas_task_slow *slow = from_timer(slow, t, timer);989 struct sas_task_slow *slow = from_timer(slow, t, timer);
961 struct sas_task *task = slow->task;990 struct sas_task *task = slow->task;
962 unsigned long flags;991 unsigned long flags;
992 bool is_completed = true;
963 993
964 spin_lock_irqsave(&task->task_state_lock, flags);994 spin_lock_irqsave(&task->task_state_lock, flags);
965 if (!(task->task_state_flags & SAS_TASK_STATE_DONE))995 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) {
966 task->task_state_flags |= SAS_TASK_STATE_ABORTED;996 task->task_state_flags |= SAS_TASK_STATE_ABORTED;
997 is_completed = false;
998 }
967 spin_unlock_irqrestore(&task->task_state_lock, flags);999 spin_unlock_irqrestore(&task->task_state_lock, flags);
968 1000
969 complete(&task->slow_task->completion);1001 if (!is_completed)
1002 complete(&task->slow_task->completion);
970}1003}
971 1004
972#define TASK_TIMEOUT 201005#define TASK_TIMEOUT 20
@@ -1019,8 +1052,16 @@ static int hisi_sas_exec_internal_tmf_task(struct domain_device *device, · 46 unmodified lines
1019 struct hisi_sas_slot *slot = task->lldd_task;1052 struct hisi_sas_slot *slot = task->lldd_task;
1020 1053
1021 dev_err(dev, "abort tmf: TMF task timeout and not done\n");1054 dev_err(dev, "abort tmf: TMF task timeout and not done\n");
1022 if (slot)1055 if (slot) {
1056 struct hisi_sas_cq *cq =
1057 &hisi_hba->cq[slot->dlvry_queue];
1058 /*
1059 * flush tasklet to avoid free'ing task
1060 * before using task in IO completion
1061 */
1062 tasklet_kill(&cq->tasklet);
1023 slot->task = NULL;1063 slot->task = NULL;
1064 }
1024 1065
1025 goto ex_err;1066 goto ex_err;
1026 } else1067 } else
@@ -1396,6 +1437,17 @@ static int hisi_sas_abort_task(struct sas_task *task) · 369 unmodified lines
1396 1437
1397 spin_lock_irqsave(&task->task_state_lock, flags);1438 spin_lock_irqsave(&task->task_state_lock, flags);
1398 if (task->task_state_flags & SAS_TASK_STATE_DONE) {1439 if (task->task_state_flags & SAS_TASK_STATE_DONE) {
1440 struct hisi_sas_slot *slot = task->lldd_task;
1441 struct hisi_sas_cq *cq;
1442
1443 if (slot) {
1444 /*
1445 * flush tasklet to avoid free'ing task
1446 * before using task in IO completion
1447 */
1448 cq = &hisi_hba->cq[slot->dlvry_queue];
1449 tasklet_kill(&cq->tasklet);
1450 }
1399 spin_unlock_irqrestore(&task->task_state_lock, flags);1451 spin_unlock_irqrestore(&task->task_state_lock, flags);
1400 rc = TMF_RESP_FUNC_COMPLETE;1452 rc = TMF_RESP_FUNC_COMPLETE;
1401 goto out;1453 goto out;
@@ -1451,12 +1503,19 @@ static int hisi_sas_abort_task(struct sas_task *task) · 49 unmodified lines
1451 /* SMP */1503 /* SMP */
1452 struct hisi_sas_slot *slot = task->lldd_task;1504 struct hisi_sas_slot *slot = task->lldd_task;
1453 u32 tag = slot->idx;1505 u32 tag = slot->idx;
1506 struct hisi_sas_cq *cq = &hisi_hba->cq[slot->dlvry_queue];
1454 1507
1455 rc = hisi_sas_internal_task_abort(hisi_hba, device,1508 rc = hisi_sas_internal_task_abort(hisi_hba, device,
1456 HISI_SAS_INT_ABT_CMD, tag);1509 HISI_SAS_INT_ABT_CMD, tag);
1457 if (((rc < 0) || (rc == TMF_RESP_FUNC_FAILED)) &&1510 if (((rc < 0) || (rc == TMF_RESP_FUNC_FAILED)) &&
1458 task->lldd_task)1511 task->lldd_task) {
1459 hisi_sas_do_release_task(hisi_hba, task, slot);1512 /*
1513 * flush tasklet to avoid free'ing task
1514 * before using task in IO completion
1515 */
1516 tasklet_kill(&cq->tasklet);
1517 slot->task = NULL;
1518 }
1460 }1519 }
1461 1520
1462out:1521out:
@@ -1705,14 +1764,11 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id, · 242 unmodified lines
1705 port = to_hisi_sas_port(sas_port);1764 port = to_hisi_sas_port(sas_port);
1706 1765
1707 /* simply get a slot and send abort command */1766 /* simply get a slot and send abort command */
1708 spin_lock_irqsave(&hisi_hba->lock, flags);1767 rc = hisi_sas_slot_index_alloc(hisi_hba, NULL);
1709 rc = hisi_sas_slot_index_alloc(hisi_hba, &slot_idx);1768 if (rc < 0)
1710 if (rc) {
1711 spin_unlock_irqrestore(&hisi_hba->lock, flags);
1712 goto err_out;1769 goto err_out;
1713 }
1714 spin_unlock_irqrestore(&hisi_hba->lock, flags);
1715 1770
1771 slot_idx = rc;
1716 slot = &hisi_hba->slot_info[slot_idx];1772 slot = &hisi_hba->slot_info[slot_idx];
1717 1773
1718 spin_lock_irqsave(&dq->lock, flags_dq);1774 spin_lock_irqsave(&dq->lock, flags_dq);
@@ -1748,7 +1804,6 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id, · 29 unmodified lines
1748 spin_lock_irqsave(&task->task_state_lock, flags);1804 spin_lock_irqsave(&task->task_state_lock, flags);
1749 task->task_state_flags |= SAS_TASK_AT_INITIATOR;1805 task->task_state_flags |= SAS_TASK_AT_INITIATOR;
1750 spin_unlock_irqrestore(&task->task_state_lock, flags);1806 spin_unlock_irqrestore(&task->task_state_lock, flags);
1751
1752 WRITE_ONCE(slot->ready, 1);1807 WRITE_ONCE(slot->ready, 1);
1753 /* send abort command to the chip */1808 /* send abort command to the chip */
1754 spin_lock_irqsave(&dq->lock, flags);1809 spin_lock_irqsave(&dq->lock, flags);
@@ -1759,9 +1814,7 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id, · 4 unmodified lines
1759 return 0;1814 return 0;
1760 1815
1761err_out_tag:1816err_out_tag:
1762 spin_lock_irqsave(&hisi_hba->lock, flags);
1763 hisi_sas_slot_index_free(hisi_hba, slot_idx);1817 hisi_sas_slot_index_free(hisi_hba, slot_idx);
1764 spin_unlock_irqrestore(&hisi_hba->lock, flags);
1765err_out:1818err_out:
1766 dev_err(dev, "internal abort task prep: failed[%d]!\n", rc);1819 dev_err(dev, "internal abort task prep: failed[%d]!\n", rc);
1767 1820
@@ -1823,8 +1876,16 @@ hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba, · 55 unmodified lines
1823 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) {1876 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) {
1824 struct hisi_sas_slot *slot = task->lldd_task;1877 struct hisi_sas_slot *slot = task->lldd_task;
1825 1878
1826 if (slot)1879 if (slot) {
1880 struct hisi_sas_cq *cq =
1881 &hisi_hba->cq[slot->dlvry_queue];
1882 /*
1883 * flush tasklet to avoid free'ing task
1884 * before using task in IO completion
1885 */
1886 tasklet_kill(&cq->tasklet);
1827 slot->task = NULL;1887 slot->task = NULL;
1888 }
1828 dev_err(dev, "internal task abort: timeout and not done.\n");1889 dev_err(dev, "internal task abort: timeout and not done.\n");
1829 res = -EIO;1890 res = -EIO;
1830 goto exit;1891 goto exit;
@@ -1861,10 +1922,6 @@ static void hisi_sas_port_formed(struct asd_sas_phy *sas_phy) · 30 unmodified lines
1861 hisi_sas_port_notify_formed(sas_phy);1922 hisi_sas_port_notify_formed(sas_phy);
1862}1923}
1863 1924
1864static void hisi_sas_port_deformed(struct asd_sas_phy *sas_phy)
1865{
1866}
1867
1868static int hisi_sas_write_gpio(struct sas_ha_struct *sha, u8 reg_type,1925static int hisi_sas_write_gpio(struct sas_ha_struct *sha, u8 reg_type,
1869 u8 reg_index, u8 reg_count, u8 *write_data)1926 u8 reg_index, u8 reg_count, u8 *write_data)
1870{1927{
@@ -1954,10 +2011,9 @@ static struct sas_domain_function_template hisi_sas_transport_ops = { · 83 unmodified lines
1954 .lldd_I_T_nexus_reset = hisi_sas_I_T_nexus_reset,2011 .lldd_I_T_nexus_reset = hisi_sas_I_T_nexus_reset,
1955 .lldd_lu_reset = hisi_sas_lu_reset,2012 .lldd_lu_reset = hisi_sas_lu_reset,
1956 .lldd_query_task = hisi_sas_query_task,2013 .lldd_query_task = hisi_sas_query_task,
1957 .lldd_clear_nexus_ha = hisi_sas_clear_nexus_ha,2014 .lldd_clear_nexus_ha = hisi_sas_clear_nexus_ha,
1958 .lldd_port_formed = hisi_sas_port_formed,2015 .lldd_port_formed = hisi_sas_port_formed,
1959 .lldd_port_deformed = hisi_sas_port_deformed,2016 .lldd_write_gpio = hisi_sas_write_gpio,
1960 .lldd_write_gpio = hisi_sas_write_gpio,
1961};2017};
1962 2018
1963void hisi_sas_init_mem(struct hisi_hba *hisi_hba)2019void hisi_sas_init_mem(struct hisi_hba *hisi_hba)
@@ -2120,6 +2176,8 @@ int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost) · 156 unmodified lines
2120 hisi_sas_init_mem(hisi_hba);2176 hisi_sas_init_mem(hisi_hba);
2121 2177
2122 hisi_sas_slot_index_init(hisi_hba);2178 hisi_sas_slot_index_init(hisi_hba);
2179 hisi_hba->last_slot_index = hisi_hba->hw->max_command_entries -
2180 HISI_SAS_RESERVED_IPTT_CNT;
2123 2181
2124 hisi_hba->wq = create_singlethread_workqueue(dev_name(dev));2182 hisi_hba->wq = create_singlethread_workqueue(dev_name(dev));
2125 if (!hisi_hba->wq) {2183 if (!hisi_hba->wq) {
@@ -2323,8 +2381,15 @@ int hisi_sas_probe(struct platform_device *pdev, · 197 unmodified lines
2323 shost->max_channel = 1;2381 shost->max_channel = 1;
2324 shost->max_cmd_len = 16;2382 shost->max_cmd_len = 16;
2325 shost->sg_tablesize = min_t(u16, SG_ALL, HISI_SAS_SGE_PAGE_CNT);2383 shost->sg_tablesize = min_t(u16, SG_ALL, HISI_SAS_SGE_PAGE_CNT);
2326 shost->can_queue = hisi_hba->hw->max_command_entries;2384 if (hisi_hba->hw->slot_index_alloc) {
2327 shost->cmd_per_lun = hisi_hba->hw->max_command_entries;2385 shost->can_queue = hisi_hba->hw->max_command_entries;
2386 shost->cmd_per_lun = hisi_hba->hw->max_command_entries;
2387 } else {
2388 shost->can_queue = hisi_hba->hw->max_command_entries -
2389 HISI_SAS_RESERVED_IPTT_CNT;
2390 shost->cmd_per_lun = hisi_hba->hw->max_command_entries -
2391 HISI_SAS_RESERVED_IPTT_CNT;
2392 }
2328 2393
2329 sha->sas_ha_name = DRV_NAME;2394 sha->sas_ha_name = DRV_NAME;
2330 sha->dev = hisi_hba->dev;2395 sha->dev = hisi_hba->dev;
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c+0−1
@@ -1809,7 +1809,6 @@ static struct scsi_host_template sht_v1_hw = { · 1808 unmodified lines
1809 .scan_start = hisi_sas_scan_start,1809 .scan_start = hisi_sas_scan_start,
1810 .change_queue_depth = sas_change_queue_depth,1810 .change_queue_depth = sas_change_queue_depth,
1811 .bios_param = sas_bios_param,1811 .bios_param = sas_bios_param,
1812 .can_queue = 1,
1813 .this_id = -1,1812 .this_id = -1,
1814 .sg_tablesize = SG_ALL,1813 .sg_tablesize = SG_ALL,
1815 .max_sectors = SCSI_DEFAULT_MAX_SECTORS,1814 .max_sectors = SCSI_DEFAULT_MAX_SECTORS,
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c+9−6
@@ -770,7 +770,7 @@ static u32 hisi_sas_phy_read32(struct hisi_hba *hisi_hba, · 769 unmodified lines
770 770
771/* This function needs to be protected from pre-emption. */771/* This function needs to be protected from pre-emption. */
772static int772static int
773slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx,773slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba,
774 struct domain_device *device)774 struct domain_device *device)
775{775{
776 int sata_dev = dev_is_sata(device);776 int sata_dev = dev_is_sata(device);
@@ -778,6 +778,7 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx, · 1 unmodified line
778 struct hisi_sas_device *sas_dev = device->lldd_dev;778 struct hisi_sas_device *sas_dev = device->lldd_dev;
779 int sata_idx = sas_dev->sata_idx;779 int sata_idx = sas_dev->sata_idx;
780 int start, end;780 int start, end;
781 unsigned long flags;
781 782
782 if (!sata_dev) {783 if (!sata_dev) {
783 /*784 /*
@@ -801,11 +802,14 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx, · 17 unmodified lines
801 end = 64 * (sata_idx + 2);802 end = 64 * (sata_idx + 2);
802 }803 }
803 804
805 spin_lock_irqsave(&hisi_hba->lock, flags);
804 while (1) {806 while (1) {
805 start = find_next_zero_bit(bitmap,807 start = find_next_zero_bit(bitmap,
806 hisi_hba->slot_index_count, start);808 hisi_hba->slot_index_count, start);
807 if (start >= end)809 if (start >= end) {
810 spin_unlock_irqrestore(&hisi_hba->lock, flags);
808 return -SAS_QUEUE_FULL;811 return -SAS_QUEUE_FULL;
812 }
809 /*813 /*
810 * SAS IPTT bit0 should be 1, and SATA IPTT bit0 should be 0.814 * SAS IPTT bit0 should be 1, and SATA IPTT bit0 should be 0.
811 */815 */
@@ -815,8 +819,8 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx, · 3 unmodified lines
815 }819 }
816 820
817 set_bit(start, bitmap);821 set_bit(start, bitmap);
818 *slot_idx = start;822 spin_unlock_irqrestore(&hisi_hba->lock, flags);
819 return 0;823 return start;
820}824}
821 825
822static bool sata_index_alloc_v2_hw(struct hisi_hba *hisi_hba, int *idx)826static bool sata_index_alloc_v2_hw(struct hisi_hba *hisi_hba, int *idx)
@@ -2483,7 +2487,6 @@ slot_complete_v2_hw(struct hisi_hba *hisi_hba, struct hisi_sas_slot *slot) · 1660 unmodified lines
2483 }2487 }
2484 2488
2485out:2489out:
2486 hisi_sas_slot_task_free(hisi_hba, task, slot);
2487 sts = ts->stat;2490 sts = ts->stat;
2488 spin_lock_irqsave(&task->task_state_lock, flags);2491 spin_lock_irqsave(&task->task_state_lock, flags);
2489 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {2492 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {
@@ -2493,6 +2496,7 @@ out: · 3 unmodified lines
2493 }2496 }
2494 task->task_state_flags |= SAS_TASK_STATE_DONE;2497 task->task_state_flags |= SAS_TASK_STATE_DONE;
2495 spin_unlock_irqrestore(&task->task_state_lock, flags);2498 spin_unlock_irqrestore(&task->task_state_lock, flags);
2499 hisi_sas_slot_task_free(hisi_hba, task, slot);
2496 2500
2497 if (!is_internal && (task->task_proto != SAS_PROTOCOL_SMP)) {2501 if (!is_internal && (task->task_proto != SAS_PROTOCOL_SMP)) {
2498 spin_lock_irqsave(&device->done_lock, flags);2502 spin_lock_irqsave(&device->done_lock, flags);
@@ -3560,7 +3564,6 @@ static struct scsi_host_template sht_v2_hw = { · 1061 unmodified lines
3560 .scan_start = hisi_sas_scan_start,3564 .scan_start = hisi_sas_scan_start,
3561 .change_queue_depth = sas_change_queue_depth,3565 .change_queue_depth = sas_change_queue_depth,
3562 .bios_param = sas_bios_param,3566 .bios_param = sas_bios_param,
3563 .can_queue = 1,
3564 .this_id = -1,3567 .this_id = -1,
3565 .sg_tablesize = SG_ALL,3568 .sg_tablesize = SG_ALL,
3566 .max_sectors = SCSI_DEFAULT_MAX_SECTORS,3569 .max_sectors = SCSI_DEFAULT_MAX_SECTORS,
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c+10−5
@@ -127,6 +127,7 @@ · 126 unmodified lines
127#define PHY_CTRL_RESET_OFF 0127#define PHY_CTRL_RESET_OFF 0
128#define PHY_CTRL_RESET_MSK (0x1 << PHY_CTRL_RESET_OFF)128#define PHY_CTRL_RESET_MSK (0x1 << PHY_CTRL_RESET_OFF)
129#define SL_CFG (PORT_BASE + 0x84)129#define SL_CFG (PORT_BASE + 0x84)
130#define AIP_LIMIT (PORT_BASE + 0x90)
130#define SL_CONTROL (PORT_BASE + 0x94)131#define SL_CONTROL (PORT_BASE + 0x94)
131#define SL_CONTROL_NOTIFY_EN_OFF 0132#define SL_CONTROL_NOTIFY_EN_OFF 0
132#define SL_CONTROL_NOTIFY_EN_MSK (0x1 << SL_CONTROL_NOTIFY_EN_OFF)133#define SL_CONTROL_NOTIFY_EN_MSK (0x1 << SL_CONTROL_NOTIFY_EN_OFF)
@@ -431,6 +432,7 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) · 298 unmodified lines
431 (u32)((1ULL << hisi_hba->queue_count) - 1));432 (u32)((1ULL << hisi_hba->queue_count) - 1));
432 hisi_sas_write32(hisi_hba, CFG_MAX_TAG, 0xfff0400);433 hisi_sas_write32(hisi_hba, CFG_MAX_TAG, 0xfff0400);
433 hisi_sas_write32(hisi_hba, HGC_SAS_TXFAIL_RETRY_CTRL, 0x108);434 hisi_sas_write32(hisi_hba, HGC_SAS_TXFAIL_RETRY_CTRL, 0x108);
435 hisi_sas_write32(hisi_hba, CFG_AGING_TIME, 0x1);
434 hisi_sas_write32(hisi_hba, INT_COAL_EN, 0x1);436 hisi_sas_write32(hisi_hba, INT_COAL_EN, 0x1);
435 hisi_sas_write32(hisi_hba, OQ_INT_COAL_TIME, 0x1);437 hisi_sas_write32(hisi_hba, OQ_INT_COAL_TIME, 0x1);
436 hisi_sas_write32(hisi_hba, OQ_INT_COAL_CNT, 0x1);438 hisi_sas_write32(hisi_hba, OQ_INT_COAL_CNT, 0x1);
@@ -441,7 +443,7 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) · 4 unmodified lines
441 hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1, 0xfefefefe);443 hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1, 0xfefefefe);
442 hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK2, 0xfefefefe);444 hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK2, 0xfefefefe);
443 if (pdev->revision >= 0x21)445 if (pdev->revision >= 0x21)
444 hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0xffff7fff);446 hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0xffff7aff);
445 else447 else
446 hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0xfffe20ff);448 hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0xfffe20ff);
447 hisi_sas_write32(hisi_hba, CHNL_PHYUPDOWN_INT_MSK, 0x0);449 hisi_sas_write32(hisi_hba, CHNL_PHYUPDOWN_INT_MSK, 0x0);
@@ -495,6 +497,7 @@ static void init_reg_v3_hw(struct hisi_hba *hisi_hba) · 47 unmodified lines
495 497
496 /* used for 12G negotiate */498 /* used for 12G negotiate */
497 hisi_sas_phy_write32(hisi_hba, i, COARSETUNE_TIME, 0x1e);499 hisi_sas_phy_write32(hisi_hba, i, COARSETUNE_TIME, 0x1e);
500 hisi_sas_phy_write32(hisi_hba, i, AIP_LIMIT, 0x2ffff);
498 }501 }
499 502
500 for (i = 0; i < hisi_hba->queue_count; i++) {503 for (i = 0; i < hisi_hba->queue_count; i++) {
@@ -1751,7 +1754,6 @@ slot_complete_v3_hw(struct hisi_hba *hisi_hba, struct hisi_sas_slot *slot) · 1250 unmodified lines
1751 }1754 }
1752 1755
1753out:1756out:
1754 hisi_sas_slot_task_free(hisi_hba, task, slot);
1755 sts = ts->stat;1757 sts = ts->stat;
1756 spin_lock_irqsave(&task->task_state_lock, flags);1758 spin_lock_irqsave(&task->task_state_lock, flags);
1757 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {1759 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {
@@ -1761,6 +1763,7 @@ out: · 3 unmodified lines
1761 }1763 }
1762 task->task_state_flags |= SAS_TASK_STATE_DONE;1764 task->task_state_flags |= SAS_TASK_STATE_DONE;
1763 spin_unlock_irqrestore(&task->task_state_lock, flags);1765 spin_unlock_irqrestore(&task->task_state_lock, flags);
1766 hisi_sas_slot_task_free(hisi_hba, task, slot);
1764 1767
1765 if (!is_internal && (task->task_proto != SAS_PROTOCOL_SMP)) {1768 if (!is_internal && (task->task_proto != SAS_PROTOCOL_SMP)) {
1766 spin_lock_irqsave(&device->done_lock, flags);1769 spin_lock_irqsave(&device->done_lock, flags);
@@ -2098,7 +2101,6 @@ static struct scsi_host_template sht_v3_hw = { · 331 unmodified lines
2098 .scan_start = hisi_sas_scan_start,2101 .scan_start = hisi_sas_scan_start,
2099 .change_queue_depth = sas_change_queue_depth,2102 .change_queue_depth = sas_change_queue_depth,
2100 .bios_param = sas_bios_param,2103 .bios_param = sas_bios_param,
2101 .can_queue = 1,
2102 .this_id = -1,2104 .this_id = -1,
2103 .sg_tablesize = SG_ALL,2105 .sg_tablesize = SG_ALL,
2104 .max_sectors = SCSI_DEFAULT_MAX_SECTORS,2106 .max_sectors = SCSI_DEFAULT_MAX_SECTORS,
@@ -2108,6 +2110,7 @@ static struct scsi_host_template sht_v3_hw = { · 3 unmodified lines
2108 .target_destroy = sas_target_destroy,2110 .target_destroy = sas_target_destroy,
2109 .ioctl = sas_ioctl,2111 .ioctl = sas_ioctl,
2110 .shost_attrs = host_attrs,2112 .shost_attrs = host_attrs,
2113 .tag_alloc_policy = BLK_TAG_ALLOC_RR,
2111};2114};
2112 2115
2113static const struct hisi_sas_hw hisi_sas_v3_hw = {2116static const struct hisi_sas_hw hisi_sas_v3_hw = {
@@ -2245,8 +2248,10 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 131 unmodified lines
2245 shost->max_channel = 1;2248 shost->max_channel = 1;
2246 shost->max_cmd_len = 16;2249 shost->max_cmd_len = 16;
2247 shost->sg_tablesize = min_t(u16, SG_ALL, HISI_SAS_SGE_PAGE_CNT);2250 shost->sg_tablesize = min_t(u16, SG_ALL, HISI_SAS_SGE_PAGE_CNT);
2248 shost->can_queue = hisi_hba->hw->max_command_entries;2251 shost->can_queue = hisi_hba->hw->max_command_entries -
2249 shost->cmd_per_lun = hisi_hba->hw->max_command_entries;2252 HISI_SAS_RESERVED_IPTT_CNT;
2253 shost->cmd_per_lun = hisi_hba->hw->max_command_entries -
2254 HISI_SAS_RESERVED_IPTT_CNT;
2250 2255
2251 sha->sas_ha_name = DRV_NAME;2256 sha->sas_ha_name = DRV_NAME;
2252 sha->dev = dev;2257 sha->dev = dev;
drivers/scsi/hpsa.c+73−75
@@ -2240,8 +2240,8 @@ static int hpsa_map_ioaccel2_sg_chain_block(struct ctlr_info *h, · 2239 unmodified lines
2240 2240
2241 chain_block = h->ioaccel2_cmd_sg_list[c->cmdindex];2241 chain_block = h->ioaccel2_cmd_sg_list[c->cmdindex];
2242 chain_size = le32_to_cpu(cp->sg[0].length);2242 chain_size = le32_to_cpu(cp->sg[0].length);
2243 temp64 = pci_map_single(h->pdev, chain_block, chain_size,2243 temp64 = dma_map_single(&h->pdev->dev, chain_block, chain_size,
2244 PCI_DMA_TODEVICE);2244 DMA_TO_DEVICE);
2245 if (dma_mapping_error(&h->pdev->dev, temp64)) {2245 if (dma_mapping_error(&h->pdev->dev, temp64)) {
2246 /* prevent subsequent unmapping */2246 /* prevent subsequent unmapping */
2247 cp->sg->address = 0;2247 cp->sg->address = 0;
@@ -2261,7 +2261,7 @@ static void hpsa_unmap_ioaccel2_sg_chain_block(struct ctlr_info *h, · 13 unmodified lines
2261 chain_sg = cp->sg;2261 chain_sg = cp->sg;
2262 temp64 = le64_to_cpu(chain_sg->address);2262 temp64 = le64_to_cpu(chain_sg->address);
2263 chain_size = le32_to_cpu(cp->sg[0].length);2263 chain_size = le32_to_cpu(cp->sg[0].length);
2264 pci_unmap_single(h->pdev, temp64, chain_size, PCI_DMA_TODEVICE);2264 dma_unmap_single(&h->pdev->dev, temp64, chain_size, DMA_TO_DEVICE);
2265}2265}
2266 2266
2267static int hpsa_map_sg_chain_block(struct ctlr_info *h,2267static int hpsa_map_sg_chain_block(struct ctlr_info *h,
@@ -2277,8 +2277,8 @@ static int hpsa_map_sg_chain_block(struct ctlr_info *h, · 9 unmodified lines
2277 chain_len = sizeof(*chain_sg) *2277 chain_len = sizeof(*chain_sg) *
2278 (le16_to_cpu(c->Header.SGTotal) - h->max_cmd_sg_entries);2278 (le16_to_cpu(c->Header.SGTotal) - h->max_cmd_sg_entries);
2279 chain_sg->Len = cpu_to_le32(chain_len);2279 chain_sg->Len = cpu_to_le32(chain_len);
2280 temp64 = pci_map_single(h->pdev, chain_block, chain_len,2280 temp64 = dma_map_single(&h->pdev->dev, chain_block, chain_len,
2281 PCI_DMA_TODEVICE);2281 DMA_TO_DEVICE);
2282 if (dma_mapping_error(&h->pdev->dev, temp64)) {2282 if (dma_mapping_error(&h->pdev->dev, temp64)) {
2283 /* prevent subsequent unmapping */2283 /* prevent subsequent unmapping */
2284 chain_sg->Addr = cpu_to_le64(0);2284 chain_sg->Addr = cpu_to_le64(0);
@@ -2297,8 +2297,8 @@ static void hpsa_unmap_sg_chain_block(struct ctlr_info *h, · 12 unmodified lines
2297 return;2297 return;
2298 2298
2299 chain_sg = &c->SG[h->max_cmd_sg_entries - 1];2299 chain_sg = &c->SG[h->max_cmd_sg_entries - 1];
2300 pci_unmap_single(h->pdev, le64_to_cpu(chain_sg->Addr),2300 dma_unmap_single(&h->pdev->dev, le64_to_cpu(chain_sg->Addr),
2301 le32_to_cpu(chain_sg->Len), PCI_DMA_TODEVICE);2301 le32_to_cpu(chain_sg->Len), DMA_TO_DEVICE);
2302}2302}
2303 2303
2304 2304
@@ -2759,13 +2759,13 @@ static void complete_scsi_command(struct CommandList *cp) · 454 unmodified lines
2759 return hpsa_cmd_free_and_done(h, cp, cmd);2759 return hpsa_cmd_free_and_done(h, cp, cmd);
2760}2760}
2761 2761
2762static void hpsa_pci_unmap(struct pci_dev *pdev,2762static void hpsa_pci_unmap(struct pci_dev *pdev, struct CommandList *c,
2763 struct CommandList *c, int sg_used, int data_direction)2763 int sg_used, enum dma_data_direction data_direction)
2764{2764{
2765 int i;2765 int i;
2766 2766
2767 for (i = 0; i < sg_used; i++)2767 for (i = 0; i < sg_used; i++)
2768 pci_unmap_single(pdev, (dma_addr_t) le64_to_cpu(c->SG[i].Addr),2768 dma_unmap_single(&pdev->dev, le64_to_cpu(c->SG[i].Addr),
2769 le32_to_cpu(c->SG[i].Len),2769 le32_to_cpu(c->SG[i].Len),
2770 data_direction);2770 data_direction);
2771}2771}
@@ -2774,17 +2774,17 @@ static int hpsa_map_one(struct pci_dev *pdev, · 2 unmodified lines
2774 struct CommandList *cp,2774 struct CommandList *cp,
2775 unsigned char *buf,2775 unsigned char *buf,
2776 size_t buflen,2776 size_t buflen,
2777 int data_direction)2777 enum dma_data_direction data_direction)
2778{2778{
2779 u64 addr64;2779 u64 addr64;
2780 2780
2781 if (buflen == 0 || data_direction == PCI_DMA_NONE) {2781 if (buflen == 0 || data_direction == DMA_NONE) {
2782 cp->Header.SGList = 0;2782 cp->Header.SGList = 0;
2783 cp->Header.SGTotal = cpu_to_le16(0);2783 cp->Header.SGTotal = cpu_to_le16(0);
2784 return 0;2784 return 0;
2785 }2785 }
2786 2786
2787 addr64 = pci_map_single(pdev, buf, buflen, data_direction);2787 addr64 = dma_map_single(&pdev->dev, buf, buflen, data_direction);
2788 if (dma_mapping_error(&pdev->dev, addr64)) {2788 if (dma_mapping_error(&pdev->dev, addr64)) {
2789 /* Prevent subsequent unmap of something never mapped */2789 /* Prevent subsequent unmap of something never mapped */
2790 cp->Header.SGList = 0;2790 cp->Header.SGList = 0;
@@ -2845,7 +2845,8 @@ static u32 lockup_detected(struct ctlr_info *h) · 54 unmodified lines
2845 2845
2846#define MAX_DRIVER_CMD_RETRIES 252846#define MAX_DRIVER_CMD_RETRIES 25
2847static int hpsa_scsi_do_simple_cmd_with_retry(struct ctlr_info *h,2847static int hpsa_scsi_do_simple_cmd_with_retry(struct ctlr_info *h,
2848 struct CommandList *c, int data_direction, unsigned long timeout_msecs)2848 struct CommandList *c, enum dma_data_direction data_direction,
2849 unsigned long timeout_msecs)
2849{2850{
2850 int backoff_time = 10, retry_count = 0;2851 int backoff_time = 10, retry_count = 0;
2851 int rc;2852 int rc;
@@ -2969,8 +2970,8 @@ static int hpsa_do_receive_diagnostic(struct ctlr_info *h, u8 *scsi3addr, · 117 unmodified lines
2969 rc = -1;2970 rc = -1;
2970 goto out;2971 goto out;
2971 }2972 }
2972 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,2973 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
2973 PCI_DMA_FROMDEVICE, NO_TIMEOUT);2974 NO_TIMEOUT);
2974 if (rc)2975 if (rc)
2975 goto out;2976 goto out;
2976 ei = c->err_info;2977 ei = c->err_info;
@@ -3022,8 +3023,8 @@ static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr, · 45 unmodified lines
3022 rc = -1;3023 rc = -1;
3023 goto out;3024 goto out;
3024 }3025 }
3025 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,3026 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
3026 PCI_DMA_FROMDEVICE, NO_TIMEOUT);3027 NO_TIMEOUT);
3027 if (rc)3028 if (rc)
3028 goto out;3029 goto out;
3029 ei = c->err_info;3030 ei = c->err_info;
@@ -3306,8 +3307,8 @@ static int hpsa_get_raid_map(struct ctlr_info *h, · 276 unmodified lines
3306 cmd_free(h, c);3307 cmd_free(h, c);
3307 return -1;3308 return -1;
3308 }3309 }
3309 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,3310 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
3310 PCI_DMA_FROMDEVICE, NO_TIMEOUT);3311 NO_TIMEOUT);
3311 if (rc)3312 if (rc)
3312 goto out;3313 goto out;
3313 ei = c->err_info;3314 ei = c->err_info;
@@ -3349,8 +3350,8 @@ static int hpsa_bmic_sense_subsystem_information(struct ctlr_info *h, · 35 unmodified lines
3349 c->Request.CDB[2] = bmic_device_index & 0xff;3350 c->Request.CDB[2] = bmic_device_index & 0xff;
3350 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;3351 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
3351 3352
3352 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,3353 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
3353 PCI_DMA_FROMDEVICE, NO_TIMEOUT);3354 NO_TIMEOUT);
3354 if (rc)3355 if (rc)
3355 goto out;3356 goto out;
3356 ei = c->err_info;3357 ei = c->err_info;
@@ -3377,8 +3378,8 @@ static int hpsa_bmic_id_controller(struct ctlr_info *h, · 20 unmodified lines
3377 if (rc)3378 if (rc)
3378 goto out;3379 goto out;
3379 3380
3380 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,3381 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
3381 PCI_DMA_FROMDEVICE, NO_TIMEOUT);3382 NO_TIMEOUT);
3382 if (rc)3383 if (rc)
3383 goto out;3384 goto out;
3384 ei = c->err_info;3385 ei = c->err_info;
@@ -3408,7 +3409,7 @@ static int hpsa_bmic_id_physical_device(struct ctlr_info *h, · 23 unmodified lines
3408 c->Request.CDB[2] = bmic_device_index & 0xff;3409 c->Request.CDB[2] = bmic_device_index & 0xff;
3409 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;3410 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
3410 3411
3411 hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,3412 hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
3412 NO_TIMEOUT);3413 NO_TIMEOUT);
3413 ei = c->err_info;3414 ei = c->err_info;
3414 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {3415 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
@@ -3484,7 +3485,7 @@ static void hpsa_get_enclosure_info(struct ctlr_info *h, · 69 unmodified lines
3484 else3485 else
3485 c->Request.CDB[5] = 0;3486 c->Request.CDB[5] = 0;
3486 3487
3487 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,3488 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
3488 NO_TIMEOUT);3489 NO_TIMEOUT);
3489 if (rc)3490 if (rc)
3490 goto out;3491 goto out;
@@ -3731,8 +3732,8 @@ static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical, · 240 unmodified lines
3731 }3732 }
3732 if (extended_response)3733 if (extended_response)
3733 c->Request.CDB[1] = extended_response;3734 c->Request.CDB[1] = extended_response;
3734 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,3735 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
3735 PCI_DMA_FROMDEVICE, NO_TIMEOUT);3736 NO_TIMEOUT);
3736 if (rc)3737 if (rc)
3737 goto out;3738 goto out;
3738 ei = c->err_info;3739 ei = c->err_info;
@@ -6320,8 +6321,8 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp) · 2581 unmodified lines
6320 6321
6321 /* Fill in the scatter gather information */6322 /* Fill in the scatter gather information */
6322 if (iocommand.buf_size > 0) {6323 if (iocommand.buf_size > 0) {
6323 temp64 = pci_map_single(h->pdev, buff,6324 temp64 = dma_map_single(&h->pdev->dev, buff,
6324 iocommand.buf_size, PCI_DMA_BIDIRECTIONAL);6325 iocommand.buf_size, DMA_BIDIRECTIONAL);
6325 if (dma_mapping_error(&h->pdev->dev, (dma_addr_t) temp64)) {6326 if (dma_mapping_error(&h->pdev->dev, (dma_addr_t) temp64)) {
6326 c->SG[0].Addr = cpu_to_le64(0);6327 c->SG[0].Addr = cpu_to_le64(0);
6327 c->SG[0].Len = cpu_to_le32(0);6328 c->SG[0].Len = cpu_to_le32(0);
@@ -6335,7 +6336,7 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp) · 7 unmodified lines
6335 rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,6336 rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
6336 NO_TIMEOUT);6337 NO_TIMEOUT);
6337 if (iocommand.buf_size > 0)6338 if (iocommand.buf_size > 0)
6338 hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_BIDIRECTIONAL);6339 hpsa_pci_unmap(h->pdev, c, 1, DMA_BIDIRECTIONAL);
6339 check_ioctl_unit_attention(h, c);6340 check_ioctl_unit_attention(h, c);
6340 if (rc) {6341 if (rc) {
6341 rc = -EIO;6342 rc = -EIO;
@@ -6381,13 +6382,9 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) · 39 unmodified lines
6381 return -EINVAL;6382 return -EINVAL;
6382 if (!capable(CAP_SYS_RAWIO))6383 if (!capable(CAP_SYS_RAWIO))
6383 return -EPERM;6384 return -EPERM;
6384 ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);6385 ioc = vmemdup_user(argp, sizeof(*ioc));
6385 if (!ioc) {6386 if (IS_ERR(ioc)) {
6386 status = -ENOMEM;6387 status = PTR_ERR(ioc);
6387 goto cleanup1;
6388 }
6389 if (copy_from_user(ioc, argp, sizeof(*ioc))) {
6390 status = -EFAULT;
6391 goto cleanup1;6388 goto cleanup1;
6392 }6389 }
6393 if ((ioc->buf_size < 1) &&6390 if ((ioc->buf_size < 1) &&
@@ -6447,14 +6444,14 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) · 53 unmodified lines
6447 if (ioc->buf_size > 0) {6444 if (ioc->buf_size > 0) {
6448 int i;6445 int i;
6449 for (i = 0; i < sg_used; i++) {6446 for (i = 0; i < sg_used; i++) {
6450 temp64 = pci_map_single(h->pdev, buff[i],6447 temp64 = dma_map_single(&h->pdev->dev, buff[i],
6451 buff_size[i], PCI_DMA_BIDIRECTIONAL);6448 buff_size[i], DMA_BIDIRECTIONAL);
6452 if (dma_mapping_error(&h->pdev->dev,6449 if (dma_mapping_error(&h->pdev->dev,
6453 (dma_addr_t) temp64)) {6450 (dma_addr_t) temp64)) {
6454 c->SG[i].Addr = cpu_to_le64(0);6451 c->SG[i].Addr = cpu_to_le64(0);
6455 c->SG[i].Len = cpu_to_le32(0);6452 c->SG[i].Len = cpu_to_le32(0);
6456 hpsa_pci_unmap(h->pdev, c, i,6453 hpsa_pci_unmap(h->pdev, c, i,
6457 PCI_DMA_BIDIRECTIONAL);6454 DMA_BIDIRECTIONAL);
6458 status = -ENOMEM;6455 status = -ENOMEM;
6459 goto cleanup0;6456 goto cleanup0;
6460 }6457 }
@@ -6467,7 +6464,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) · 6 unmodified lines
6467 status = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,6464 status = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
6468 NO_TIMEOUT);6465 NO_TIMEOUT);
6469 if (sg_used)6466 if (sg_used)
6470 hpsa_pci_unmap(h->pdev, c, sg_used, PCI_DMA_BIDIRECTIONAL);6467 hpsa_pci_unmap(h->pdev, c, sg_used, DMA_BIDIRECTIONAL);
6471 check_ioctl_unit_attention(h, c);6468 check_ioctl_unit_attention(h, c);
6472 if (status) {6469 if (status) {
6473 status = -EIO;6470 status = -EIO;
@@ -6505,7 +6502,7 @@ cleanup1: · 31 unmodified lines
6505 kfree(buff);6502 kfree(buff);
6506 }6503 }
6507 kfree(buff_size);6504 kfree(buff_size);
6508 kfree(ioc);6505 kvfree(ioc);
6509 return status;6506 return status;
6510}6507}
6511 6508
@@ -6579,7 +6576,7 @@ static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h, · 67 unmodified lines
6579 void *buff, size_t size, u16 page_code, unsigned char *scsi3addr,6576 void *buff, size_t size, u16 page_code, unsigned char *scsi3addr,
6580 int cmd_type)6577 int cmd_type)
6581{6578{
6582 int pci_dir = XFER_NONE;6579 enum dma_data_direction dir = DMA_NONE;
6583 6580
6584 c->cmd_type = CMD_IOCTL_PEND;6581 c->cmd_type = CMD_IOCTL_PEND;
6585 c->scsi_cmd = SCSI_CMD_BUSY;6582 c->scsi_cmd = SCSI_CMD_BUSY;
@@ -6785,18 +6782,18 @@ static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h, · 199 unmodified lines
6785 6782
6786 switch (GET_DIR(c->Request.type_attr_dir)) {6783 switch (GET_DIR(c->Request.type_attr_dir)) {
6787 case XFER_READ:6784 case XFER_READ:
6788 pci_dir = PCI_DMA_FROMDEVICE;6785 dir = DMA_FROM_DEVICE;
6789 break;6786 break;
6790 case XFER_WRITE:6787 case XFER_WRITE:
6791 pci_dir = PCI_DMA_TODEVICE;6788 dir = DMA_TO_DEVICE;
6792 break;6789 break;
6793 case XFER_NONE:6790 case XFER_NONE:
6794 pci_dir = PCI_DMA_NONE;6791 dir = DMA_NONE;
6795 break;6792 break;
6796 default:6793 default:
6797 pci_dir = PCI_DMA_BIDIRECTIONAL;6794 dir = DMA_BIDIRECTIONAL;
6798 }6795 }
6799 if (hpsa_map_one(h->pdev, c, buff, size, pci_dir))6796 if (hpsa_map_one(h->pdev, c, buff, size, dir))
6800 return -1;6797 return -1;
6801 return 0;6798 return 0;
6802}6799}
@@ -6992,13 +6989,13 @@ static int hpsa_message(struct pci_dev *pdev, unsigned char opcode, · 189 unmodified lines
6992 * CCISS commands, so they must be allocated from the lower 4GiB of6989 * CCISS commands, so they must be allocated from the lower 4GiB of
6993 * memory.6990 * memory.
6994 */6991 */
6995 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));6992 err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
6996 if (err) {6993 if (err) {
6997 iounmap(vaddr);6994 iounmap(vaddr);
6998 return err;6995 return err;
6999 }6996 }
7000 6997
7001 cmd = pci_alloc_consistent(pdev, cmd_sz, &paddr64);6998 cmd = dma_alloc_coherent(&pdev->dev, cmd_sz, &paddr64, GFP_KERNEL);
7002 if (cmd == NULL) {6999 if (cmd == NULL) {
7003 iounmap(vaddr);7000 iounmap(vaddr);
7004 return -ENOMEM;7001 return -ENOMEM;
@@ -7047,7 +7044,7 @@ static int hpsa_message(struct pci_dev *pdev, unsigned char opcode, · 42 unmodified lines
7047 return -ETIMEDOUT;7044 return -ETIMEDOUT;
7048 }7045 }
7049 7046
7050 pci_free_consistent(pdev, cmd_sz, cmd, paddr64);7047 dma_free_coherent(&pdev->dev, cmd_sz, cmd, paddr64);
7051 7048
7052 if (tag & HPSA_ERROR_BIT) {7049 if (tag & HPSA_ERROR_BIT) {
7053 dev_err(&pdev->dev, "controller message %02x:%02x failed\n",7050 dev_err(&pdev->dev, "controller message %02x:%02x failed\n",
@@ -7914,7 +7911,7 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h) · 860 unmodified lines
7914 kfree(h->cmd_pool_bits);7911 kfree(h->cmd_pool_bits);
7915 h->cmd_pool_bits = NULL;7912 h->cmd_pool_bits = NULL;
7916 if (h->cmd_pool) {7913 if (h->cmd_pool) {
7917 pci_free_consistent(h->pdev,7914 dma_free_coherent(&h->pdev->dev,
7918 h->nr_cmds * sizeof(struct CommandList),7915 h->nr_cmds * sizeof(struct CommandList),
7919 h->cmd_pool,7916 h->cmd_pool,
7920 h->cmd_pool_dhandle);7917 h->cmd_pool_dhandle);
@@ -7922,7 +7919,7 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h) · 1 unmodified line
7922 h->cmd_pool_dhandle = 0;7919 h->cmd_pool_dhandle = 0;
7923 }7920 }
7924 if (h->errinfo_pool) {7921 if (h->errinfo_pool) {
7925 pci_free_consistent(h->pdev,7922 dma_free_coherent(&h->pdev->dev,
7926 h->nr_cmds * sizeof(struct ErrorInfo),7923 h->nr_cmds * sizeof(struct ErrorInfo),
7927 h->errinfo_pool,7924 h->errinfo_pool,
7928 h->errinfo_pool_dhandle);7925 h->errinfo_pool_dhandle);
@@ -7936,12 +7933,12 @@ static int hpsa_alloc_cmd_pool(struct ctlr_info *h) · 7 unmodified lines
7936 h->cmd_pool_bits = kcalloc(DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG),7933 h->cmd_pool_bits = kcalloc(DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG),
7937 sizeof(unsigned long),7934 sizeof(unsigned long),
7938 GFP_KERNEL);7935 GFP_KERNEL);
7939 h->cmd_pool = pci_alloc_consistent(h->pdev,7936 h->cmd_pool = dma_alloc_coherent(&h->pdev->dev,
7940 h->nr_cmds * sizeof(*h->cmd_pool),7937 h->nr_cmds * sizeof(*h->cmd_pool),
7941 &(h->cmd_pool_dhandle));7938 &h->cmd_pool_dhandle, GFP_KERNEL);
7942 h->errinfo_pool = pci_alloc_consistent(h->pdev,7939 h->errinfo_pool = dma_alloc_coherent(&h->pdev->dev,
7943 h->nr_cmds * sizeof(*h->errinfo_pool),7940 h->nr_cmds * sizeof(*h->errinfo_pool),
7944 &(h->errinfo_pool_dhandle));7941 &h->errinfo_pool_dhandle, GFP_KERNEL);
7945 if ((h->cmd_pool_bits == NULL)7942 if ((h->cmd_pool_bits == NULL)
7946 || (h->cmd_pool == NULL)7943 || (h->cmd_pool == NULL)
7947 || (h->errinfo_pool == NULL)) {7944 || (h->errinfo_pool == NULL)) {
@@ -8068,7 +8065,7 @@ static void hpsa_free_reply_queues(struct ctlr_info *h) · 120 unmodified lines
8068 for (i = 0; i < h->nreply_queues; i++) {8065 for (i = 0; i < h->nreply_queues; i++) {
8069 if (!h->reply_queue[i].head)8066 if (!h->reply_queue[i].head)
8070 continue;8067 continue;
8071 pci_free_consistent(h->pdev,8068 dma_free_coherent(&h->pdev->dev,
8072 h->reply_queue_size,8069 h->reply_queue_size,
8073 h->reply_queue[i].head,8070 h->reply_queue[i].head,
8074 h->reply_queue[i].busaddr);8071 h->reply_queue[i].busaddr);
@@ -8594,11 +8591,11 @@ reinit_after_soft_reset: · 519 unmodified lines
8594 number_of_controllers++;8591 number_of_controllers++;
8595 8592
8596 /* configure PCI DMA stuff */8593 /* configure PCI DMA stuff */
8597 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));8594 rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
8598 if (rc == 0) {8595 if (rc == 0) {
8599 dac = 1;8596 dac = 1;
8600 } else {8597 } else {
8601 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));8598 rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
8602 if (rc == 0) {8599 if (rc == 0) {
8603 dac = 0;8600 dac = 0;
8604 } else {8601 } else {
@@ -8797,8 +8794,8 @@ static void hpsa_flush_cache(struct ctlr_info *h) · 192 unmodified lines
8797 RAID_CTLR_LUNID, TYPE_CMD)) {8794 RAID_CTLR_LUNID, TYPE_CMD)) {
8798 goto out;8795 goto out;
8799 }8796 }
8800 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,8797 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_TO_DEVICE,
8801 PCI_DMA_TODEVICE, DEFAULT_TIMEOUT);8798 DEFAULT_TIMEOUT);
8802 if (rc)8799 if (rc)
8803 goto out;8800 goto out;
8804 if (c->err_info->CommandStatus != 0)8801 if (c->err_info->CommandStatus != 0)
@@ -8833,8 +8830,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h) · 28 unmodified lines
8833 RAID_CTLR_LUNID, TYPE_CMD))8830 RAID_CTLR_LUNID, TYPE_CMD))
8834 goto errout;8831 goto errout;
8835 8832
8836 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,8833 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
8837 PCI_DMA_FROMDEVICE, NO_TIMEOUT);8834 NO_TIMEOUT);
8838 if ((rc != 0) || (c->err_info->CommandStatus != 0))8835 if ((rc != 0) || (c->err_info->CommandStatus != 0))
8839 goto errout;8836 goto errout;
8840 8837
@@ -8845,8 +8842,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h) · 4 unmodified lines
8845 RAID_CTLR_LUNID, TYPE_CMD))8842 RAID_CTLR_LUNID, TYPE_CMD))
8846 goto errout;8843 goto errout;
8847 8844
8848 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,8845 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_TO_DEVICE,
8849 PCI_DMA_TODEVICE, NO_TIMEOUT);8846 NO_TIMEOUT);
8850 if ((rc != 0) || (c->err_info->CommandStatus != 0))8847 if ((rc != 0) || (c->err_info->CommandStatus != 0))
8851 goto errout;8848 goto errout;
8852 8849
@@ -8855,8 +8852,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h) · 2 unmodified lines
8855 RAID_CTLR_LUNID, TYPE_CMD))8852 RAID_CTLR_LUNID, TYPE_CMD))
8856 goto errout;8853 goto errout;
8857 8854
8858 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,8855 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
8859 PCI_DMA_FROMDEVICE, NO_TIMEOUT);8856 NO_TIMEOUT);
8860 if ((rc != 0) || (c->err_info->CommandStatus != 0))8857 if ((rc != 0) || (c->err_info->CommandStatus != 0))
8861 goto errout;8858 goto errout;
8862 8859
@@ -9228,9 +9225,9 @@ static int hpsa_alloc_ioaccel1_cmd_and_bft(struct ctlr_info *h) · 365 unmodified lines
9228 BUILD_BUG_ON(sizeof(struct io_accel1_cmd) %9225 BUILD_BUG_ON(sizeof(struct io_accel1_cmd) %
9229 IOACCEL1_COMMANDLIST_ALIGNMENT);9226 IOACCEL1_COMMANDLIST_ALIGNMENT);
9230 h->ioaccel_cmd_pool =9227 h->ioaccel_cmd_pool =
9231 pci_alloc_consistent(h->pdev,9228 dma_alloc_coherent(&h->pdev->dev,
9232 h->nr_cmds * sizeof(*h->ioaccel_cmd_pool),9229 h->nr_cmds * sizeof(*h->ioaccel_cmd_pool),
9233 &(h->ioaccel_cmd_pool_dhandle));9230 &h->ioaccel_cmd_pool_dhandle, GFP_KERNEL);
9234 9231
9235 h->ioaccel1_blockFetchTable =9232 h->ioaccel1_blockFetchTable =
9236 kmalloc(((h->ioaccel_maxsg + 1) *9233 kmalloc(((h->ioaccel_maxsg + 1) *
@@ -9281,9 +9278,9 @@ static int hpsa_alloc_ioaccel2_cmd_and_bft(struct ctlr_info *h) · 44 unmodified lines
9281 BUILD_BUG_ON(sizeof(struct io_accel2_cmd) %9278 BUILD_BUG_ON(sizeof(struct io_accel2_cmd) %
9282 IOACCEL2_COMMANDLIST_ALIGNMENT);9279 IOACCEL2_COMMANDLIST_ALIGNMENT);
9283 h->ioaccel2_cmd_pool =9280 h->ioaccel2_cmd_pool =
9284 pci_alloc_consistent(h->pdev,9281 dma_alloc_coherent(&h->pdev->dev,
9285 h->nr_cmds * sizeof(*h->ioaccel2_cmd_pool),9282 h->nr_cmds * sizeof(*h->ioaccel2_cmd_pool),
9286 &(h->ioaccel2_cmd_pool_dhandle));9283 &h->ioaccel2_cmd_pool_dhandle, GFP_KERNEL);
9287 9284
9288 h->ioaccel2_blockFetchTable =9285 h->ioaccel2_blockFetchTable =
9289 kmalloc(((h->ioaccel_maxsg + 1) *9286 kmalloc(((h->ioaccel_maxsg + 1) *
@@ -9356,9 +9353,10 @@ static int hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h) · 66 unmodified lines
9356 h->reply_queue_size = h->max_commands * sizeof(u64);9353 h->reply_queue_size = h->max_commands * sizeof(u64);
9357 9354
9358 for (i = 0; i < h->nreply_queues; i++) {9355 for (i = 0; i < h->nreply_queues; i++) {
9359 h->reply_queue[i].head = pci_alloc_consistent(h->pdev,9356 h->reply_queue[i].head = dma_alloc_coherent(&h->pdev->dev,
9360 h->reply_queue_size,9357 h->reply_queue_size,
9361 &(h->reply_queue[i].busaddr));9358 &h->reply_queue[i].busaddr,
9359 GFP_KERNEL);
9362 if (!h->reply_queue[i].head) {9360 if (!h->reply_queue[i].head) {
9363 rc = -ENOMEM;9361 rc = -ENOMEM;
9364 goto clean1; /* rq, ioaccel */9362 goto clean1; /* rq, ioaccel */
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c+0−1
@@ -2266,7 +2266,6 @@ static int ibmvscsis_drop_nexus(struct ibmvscsis_tport *tport) · 2265 unmodified lines
2266 /*2266 /*
2267 * Release the SCSI I_T Nexus to the emulated ibmvscsis Target Port2267 * Release the SCSI I_T Nexus to the emulated ibmvscsis Target Port
2268 */2268 */
2269 target_wait_for_sess_cmds(se_sess);
2270 target_remove_session(se_sess);2269 target_remove_session(se_sess);
2271 tport->ibmv_nexus = NULL;2270 tport->ibmv_nexus = NULL;
2272 kfree(nexus);2271 kfree(nexus);
drivers/scsi/ips.c+42−39
@@ -208,7 +208,7 @@ module_param(ips, charp, 0); · 207 unmodified lines
208 208
209#define IPS_DMA_DIR(scb) ((!scb->scsi_cmd || ips_is_passthru(scb->scsi_cmd) || \209#define IPS_DMA_DIR(scb) ((!scb->scsi_cmd || ips_is_passthru(scb->scsi_cmd) || \
210 DMA_NONE == scb->scsi_cmd->sc_data_direction) ? \210 DMA_NONE == scb->scsi_cmd->sc_data_direction) ? \
211 PCI_DMA_BIDIRECTIONAL : \211 DMA_BIDIRECTIONAL : \
212 scb->scsi_cmd->sc_data_direction)212 scb->scsi_cmd->sc_data_direction)
213 213
214#ifdef IPS_DEBUG214#ifdef IPS_DEBUG
@@ -1529,11 +1529,12 @@ ips_alloc_passthru_buffer(ips_ha_t * ha, int length) · 1314 unmodified lines
1529 if (ha->ioctl_data && length <= ha->ioctl_len)1529 if (ha->ioctl_data && length <= ha->ioctl_len)
1530 return 0;1530 return 0;
1531 /* there is no buffer or it's not big enough, allocate a new one */1531 /* there is no buffer or it's not big enough, allocate a new one */
1532 bigger_buf = pci_alloc_consistent(ha->pcidev, length, &dma_busaddr);1532 bigger_buf = dma_alloc_coherent(&ha->pcidev->dev, length, &dma_busaddr,
1533 GFP_KERNEL);
1533 if (bigger_buf) {1534 if (bigger_buf) {
1534 /* free the old memory */1535 /* free the old memory */
1535 pci_free_consistent(ha->pcidev, ha->ioctl_len, ha->ioctl_data,1536 dma_free_coherent(&ha->pcidev->dev, ha->ioctl_len,
1536 ha->ioctl_busaddr);1537 ha->ioctl_data, ha->ioctl_busaddr);
1537 /* use the new memory */1538 /* use the new memory */
1538 ha->ioctl_data = (char *) bigger_buf;1539 ha->ioctl_data = (char *) bigger_buf;
1539 ha->ioctl_len = length;1540 ha->ioctl_len = length;
@@ -1678,9 +1679,8 @@ ips_flash_copperhead(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb) · 138 unmodified lines
1678 } else if (!ha->flash_data) {1679 } else if (!ha->flash_data) {
1679 datasize = pt->CoppCP.cmd.flashfw.total_packets *1680 datasize = pt->CoppCP.cmd.flashfw.total_packets *
1680 pt->CoppCP.cmd.flashfw.count;1681 pt->CoppCP.cmd.flashfw.count;
1681 ha->flash_data = pci_alloc_consistent(ha->pcidev,1682 ha->flash_data = dma_alloc_coherent(&ha->pcidev->dev,
1682 datasize,1683 datasize, &ha->flash_busaddr, GFP_KERNEL);
1683 &ha->flash_busaddr);
1684 if (!ha->flash_data){1684 if (!ha->flash_data){
1685 printk(KERN_WARNING "Unable to allocate a flash buffer\n");1685 printk(KERN_WARNING "Unable to allocate a flash buffer\n");
1686 return IPS_FAILURE;1686 return IPS_FAILURE;
@@ -1858,7 +1858,7 @@ ips_flash_firmware(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb) · 171 unmodified lines
1858 1858
1859 scb->data_len = ha->flash_datasize;1859 scb->data_len = ha->flash_datasize;
1860 scb->data_busaddr =1860 scb->data_busaddr =
1861 pci_map_single(ha->pcidev, ha->flash_data, scb->data_len,1861 dma_map_single(&ha->pcidev->dev, ha->flash_data, scb->data_len,
1862 IPS_DMA_DIR(scb));1862 IPS_DMA_DIR(scb));
1863 scb->flags |= IPS_SCB_MAP_SINGLE;1863 scb->flags |= IPS_SCB_MAP_SINGLE;
1864 scb->cmd.flashfw.command_id = IPS_COMMAND_ID(ha, scb);1864 scb->cmd.flashfw.command_id = IPS_COMMAND_ID(ha, scb);
@@ -1880,8 +1880,8 @@ ips_free_flash_copperhead(ips_ha_t * ha) · 15 unmodified lines
1880 if (ha->flash_data == ips_FlashData)1880 if (ha->flash_data == ips_FlashData)
1881 test_and_clear_bit(0, &ips_FlashDataInUse);1881 test_and_clear_bit(0, &ips_FlashDataInUse);
1882 else if (ha->flash_data)1882 else if (ha->flash_data)
1883 pci_free_consistent(ha->pcidev, ha->flash_len, ha->flash_data,1883 dma_free_coherent(&ha->pcidev->dev, ha->flash_len,
1884 ha->flash_busaddr);1884 ha->flash_data, ha->flash_busaddr);
1885 ha->flash_data = NULL;1885 ha->flash_data = NULL;
1886}1886}
1887 1887
@@ -3485,6 +3485,7 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb) · 1597 unmodified lines
3485 3485
3486 case START_STOP:3486 case START_STOP:
3487 scb->scsi_cmd->result = DID_OK << 16;3487 scb->scsi_cmd->result = DID_OK << 16;
3488 break;
3488 3489
3489 case TEST_UNIT_READY:3490 case TEST_UNIT_READY:
3490 case INQUIRY:3491 case INQUIRY:
@@ -4212,7 +4213,7 @@ ips_free(ips_ha_t * ha) · 721 unmodified lines
4212 4213
4213 if (ha) {4214 if (ha) {
4214 if (ha->enq) {4215 if (ha->enq) {
4215 pci_free_consistent(ha->pcidev, sizeof(IPS_ENQ),4216 dma_free_coherent(&ha->pcidev->dev, sizeof(IPS_ENQ),
4216 ha->enq, ha->enq_busaddr);4217 ha->enq, ha->enq_busaddr);
4217 ha->enq = NULL;4218 ha->enq = NULL;
4218 }4219 }
@@ -4221,7 +4222,7 @@ ips_free(ips_ha_t * ha) · 2 unmodified lines
4221 ha->conf = NULL;4222 ha->conf = NULL;
4222 4223
4223 if (ha->adapt) {4224 if (ha->adapt) {
4224 pci_free_consistent(ha->pcidev,4225 dma_free_coherent(&ha->pcidev->dev,
4225 sizeof (IPS_ADAPTER) +4226 sizeof (IPS_ADAPTER) +
4226 sizeof (IPS_IO_CMD), ha->adapt,4227 sizeof (IPS_IO_CMD), ha->adapt,
4227 ha->adapt->hw_status_start);4228 ha->adapt->hw_status_start);
@@ -4229,7 +4230,7 @@ ips_free(ips_ha_t * ha) · 1 unmodified line
4229 }4230 }
4230 4231
4231 if (ha->logical_drive_info) {4232 if (ha->logical_drive_info) {
4232 pci_free_consistent(ha->pcidev,4233 dma_free_coherent(&ha->pcidev->dev,
4233 sizeof (IPS_LD_INFO),4234 sizeof (IPS_LD_INFO),
4234 ha->logical_drive_info,4235 ha->logical_drive_info,
4235 ha->logical_drive_info_dma_addr);4236 ha->logical_drive_info_dma_addr);
@@ -4243,7 +4244,7 @@ ips_free(ips_ha_t * ha) · 7 unmodified lines
4243 ha->subsys = NULL;4244 ha->subsys = NULL;
4244 4245
4245 if (ha->ioctl_data) {4246 if (ha->ioctl_data) {
4246 pci_free_consistent(ha->pcidev, ha->ioctl_len,4247 dma_free_coherent(&ha->pcidev->dev, ha->ioctl_len,
4247 ha->ioctl_data, ha->ioctl_busaddr);4248 ha->ioctl_data, ha->ioctl_busaddr);
4248 ha->ioctl_data = NULL;4249 ha->ioctl_data = NULL;
4249 ha->ioctl_datasize = 0;4250 ha->ioctl_datasize = 0;
@@ -4276,11 +4277,11 @@ static int · 26 unmodified lines
4276ips_deallocatescbs(ips_ha_t * ha, int cmds)4277ips_deallocatescbs(ips_ha_t * ha, int cmds)
4277{4278{
4278 if (ha->scbs) {4279 if (ha->scbs) {
4279 pci_free_consistent(ha->pcidev,4280 dma_free_coherent(&ha->pcidev->dev,
4280 IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * cmds,4281 IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * cmds,
4281 ha->scbs->sg_list.list,4282 ha->scbs->sg_list.list,
4282 ha->scbs->sg_busaddr);4283 ha->scbs->sg_busaddr);
4283 pci_free_consistent(ha->pcidev, sizeof (ips_scb_t) * cmds,4284 dma_free_coherent(&ha->pcidev->dev, sizeof (ips_scb_t) * cmds,
4284 ha->scbs, ha->scbs->scb_busaddr);4285 ha->scbs, ha->scbs->scb_busaddr);
4285 ha->scbs = NULL;4286 ha->scbs = NULL;
4286 } /* end if */4287 } /* end if */
@@ -4307,17 +4308,16 @@ ips_allocatescbs(ips_ha_t * ha) · 20 unmodified lines
4307 METHOD_TRACE("ips_allocatescbs", 1);4308 METHOD_TRACE("ips_allocatescbs", 1);
4308 4309
4309 /* Allocate memory for the SCBs */4310 /* Allocate memory for the SCBs */
4310 ha->scbs =4311 ha->scbs = dma_alloc_coherent(&ha->pcidev->dev,
4311 pci_alloc_consistent(ha->pcidev, ha->max_cmds * sizeof (ips_scb_t),4312 ha->max_cmds * sizeof (ips_scb_t),
4312 &command_dma);4313 &command_dma, GFP_KERNEL);
4313 if (ha->scbs == NULL)4314 if (ha->scbs == NULL)
4314 return 0;4315 return 0;
4315 ips_sg.list =4316 ips_sg.list = dma_alloc_coherent(&ha->pcidev->dev,
4316 pci_alloc_consistent(ha->pcidev,4317 IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * ha->max_cmds,
4317 IPS_SGLIST_SIZE(ha) * IPS_MAX_SG *4318 &sg_dma, GFP_KERNEL);
4318 ha->max_cmds, &sg_dma);
4319 if (ips_sg.list == NULL) {4319 if (ips_sg.list == NULL) {
4320 pci_free_consistent(ha->pcidev,4320 dma_free_coherent(&ha->pcidev->dev,
4321 ha->max_cmds * sizeof (ips_scb_t), ha->scbs,4321 ha->max_cmds * sizeof (ips_scb_t), ha->scbs,
4322 command_dma);4322 command_dma);
4323 return 0;4323 return 0;
@@ -4446,8 +4446,8 @@ ips_freescb(ips_ha_t * ha, ips_scb_t * scb) · 122 unmodified lines
4446 if (scb->flags & IPS_SCB_MAP_SG)4446 if (scb->flags & IPS_SCB_MAP_SG)
4447 scsi_dma_unmap(scb->scsi_cmd);4447 scsi_dma_unmap(scb->scsi_cmd);
4448 else if (scb->flags & IPS_SCB_MAP_SINGLE)4448 else if (scb->flags & IPS_SCB_MAP_SINGLE)
4449 pci_unmap_single(ha->pcidev, scb->data_busaddr, scb->data_len,4449 dma_unmap_single(&ha->pcidev->dev, scb->data_busaddr,
4450 IPS_DMA_DIR(scb));4450 scb->data_len, IPS_DMA_DIR(scb));
4451 4451
4452 /* check to make sure this is not our "special" scb */4452 /* check to make sure this is not our "special" scb */
4453 if (IPS_COMMAND_ID(ha, scb) < (ha->max_cmds - 1)) {4453 if (IPS_COMMAND_ID(ha, scb) < (ha->max_cmds - 1)) {
@@ -4559,7 +4559,8 @@ ips_flush_and_reset(ips_ha_t *ha) · 105 unmodified lines
4559 dma_addr_t command_dma;4559 dma_addr_t command_dma;
4560 4560
4561 /* Create a usuable SCB */4561 /* Create a usuable SCB */
4562 scb = pci_alloc_consistent(ha->pcidev, sizeof(ips_scb_t), &command_dma);4562 scb = dma_alloc_coherent(&ha->pcidev->dev, sizeof(ips_scb_t),
4563 &command_dma, GFP_KERNEL);
4563 if (scb) {4564 if (scb) {
4564 memset(scb, 0, sizeof(ips_scb_t));4565 memset(scb, 0, sizeof(ips_scb_t));
4565 ips_init_scb(ha, scb);4566 ips_init_scb(ha, scb);
@@ -4594,7 +4595,7 @@ ips_flush_and_reset(ips_ha_t *ha) · 28 unmodified lines
4594 /* Now RESET and INIT the adapter */4595 /* Now RESET and INIT the adapter */
4595 (*ha->func.reset) (ha);4596 (*ha->func.reset) (ha);
4596 4597
4597 pci_free_consistent(ha->pcidev, sizeof(ips_scb_t), scb, command_dma);4598 dma_free_coherent(&ha->pcidev->dev, sizeof(ips_scb_t), scb, command_dma);
4598 return;4599 return;
4599}4600}
4600 4601
@@ -6926,29 +6927,30 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr) · 2325 unmodified lines
6926 * are guaranteed to be < 4G.6927 * are guaranteed to be < 4G.
6927 */6928 */
6928 if (IPS_ENABLE_DMA64 && IPS_HAS_ENH_SGLIST(ha) &&6929 if (IPS_ENABLE_DMA64 && IPS_HAS_ENH_SGLIST(ha) &&
6929 !pci_set_dma_mask(ha->pcidev, DMA_BIT_MASK(64))) {6930 !dma_set_mask(&ha->pcidev->dev, DMA_BIT_MASK(64))) {
6930 (ha)->flags |= IPS_HA_ENH_SG;6931 (ha)->flags |= IPS_HA_ENH_SG;
6931 } else {6932 } else {
6932 if (pci_set_dma_mask(ha->pcidev, DMA_BIT_MASK(32)) != 0) {6933 if (dma_set_mask(&ha->pcidev->dev, DMA_BIT_MASK(32)) != 0) {
6933 printk(KERN_WARNING "Unable to set DMA Mask\n");6934 printk(KERN_WARNING "Unable to set DMA Mask\n");
6934 return ips_abort_init(ha, index);6935 return ips_abort_init(ha, index);
6935 }6936 }
6936 }6937 }
6937 if(ips_cd_boot && !ips_FlashData){6938 if(ips_cd_boot && !ips_FlashData){
6938 ips_FlashData = pci_alloc_consistent(pci_dev, PAGE_SIZE << 7,6939 ips_FlashData = dma_alloc_coherent(&pci_dev->dev,
6939 &ips_flashbusaddr);6940 PAGE_SIZE << 7, &ips_flashbusaddr, GFP_KERNEL);
6940 }6941 }
6941 6942
6942 ha->enq = pci_alloc_consistent(pci_dev, sizeof (IPS_ENQ),6943 ha->enq = dma_alloc_coherent(&pci_dev->dev, sizeof (IPS_ENQ),
6943 &ha->enq_busaddr);6944 &ha->enq_busaddr, GFP_KERNEL);
6944 if (!ha->enq) {6945 if (!ha->enq) {
6945 IPS_PRINTK(KERN_WARNING, pci_dev,6946 IPS_PRINTK(KERN_WARNING, pci_dev,
6946 "Unable to allocate host inquiry structure\n");6947 "Unable to allocate host inquiry structure\n");
6947 return ips_abort_init(ha, index);6948 return ips_abort_init(ha, index);
6948 }6949 }
6949 6950
6950 ha->adapt = pci_alloc_consistent(pci_dev, sizeof (IPS_ADAPTER) +6951 ha->adapt = dma_alloc_coherent(&pci_dev->dev,
6951 sizeof (IPS_IO_CMD), &dma_address);6952 sizeof (IPS_ADAPTER) + sizeof (IPS_IO_CMD),
6953 &dma_address, GFP_KERNEL);
6952 if (!ha->adapt) {6954 if (!ha->adapt) {
6953 IPS_PRINTK(KERN_WARNING, pci_dev,6955 IPS_PRINTK(KERN_WARNING, pci_dev,
6954 "Unable to allocate host adapt & dummy structures\n");6956 "Unable to allocate host adapt & dummy structures\n");
@@ -6959,7 +6961,8 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr) · 4 unmodified lines
6959 6961
6960 6962
6961 6963
6962 ha->logical_drive_info = pci_alloc_consistent(pci_dev, sizeof (IPS_LD_INFO), &dma_address);6964 ha->logical_drive_info = dma_alloc_coherent(&pci_dev->dev,
6965 sizeof (IPS_LD_INFO), &dma_address, GFP_KERNEL);
6963 if (!ha->logical_drive_info) {6966 if (!ha->logical_drive_info) {
6964 IPS_PRINTK(KERN_WARNING, pci_dev,6967 IPS_PRINTK(KERN_WARNING, pci_dev,
6965 "Unable to allocate logical drive info structure\n");6968 "Unable to allocate logical drive info structure\n");
@@ -6997,8 +7000,8 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr) · 31 unmodified lines
6997 if (ips_ioctlsize < PAGE_SIZE)7000 if (ips_ioctlsize < PAGE_SIZE)
6998 ips_ioctlsize = PAGE_SIZE;7001 ips_ioctlsize = PAGE_SIZE;
6999 7002
7000 ha->ioctl_data = pci_alloc_consistent(pci_dev, ips_ioctlsize,7003 ha->ioctl_data = dma_alloc_coherent(&pci_dev->dev, ips_ioctlsize,
7001 &ha->ioctl_busaddr);7004 &ha->ioctl_busaddr, GFP_KERNEL);
7002 ha->ioctl_len = ips_ioctlsize;7005 ha->ioctl_len = ips_ioctlsize;
7003 if (!ha->ioctl_data) {7006 if (!ha->ioctl_data) {
7004 IPS_PRINTK(KERN_WARNING, pci_dev,7007 IPS_PRINTK(KERN_WARNING, pci_dev,
drivers/scsi/isci/host.c+4−4
@@ -2717,9 +2717,9 @@ enum sci_status sci_controller_continue_io(struct isci_request *ireq) · 2716 unmodified lines
2717 * the task management request.2717 * the task management request.
2718 * @task_request: the handle to the task request object to start.2718 * @task_request: the handle to the task request object to start.
2719 */2719 */
2720enum sci_task_status sci_controller_start_task(struct isci_host *ihost,2720enum sci_status sci_controller_start_task(struct isci_host *ihost,
2721 struct isci_remote_device *idev,2721 struct isci_remote_device *idev,
2722 struct isci_request *ireq)2722 struct isci_request *ireq)
2723{2723{
2724 enum sci_status status;2724 enum sci_status status;
2725 2725
@@ -2728,7 +2728,7 @@ enum sci_task_status sci_controller_start_task(struct isci_host *ihost, · 2 unmodified lines
2728 "%s: SCIC Controller starting task from invalid "2728 "%s: SCIC Controller starting task from invalid "
2729 "state\n",2729 "state\n",
2730 __func__);2730 __func__);
2731 return SCI_TASK_FAILURE_INVALID_STATE;2731 return SCI_FAILURE_INVALID_STATE;
2732 }2732 }
2733 2733
2734 status = sci_remote_device_start_task(ihost, idev, ireq);2734 status = sci_remote_device_start_task(ihost, idev, ireq);
drivers/scsi/isci/host.h+1−1
@@ -489,7 +489,7 @@ enum sci_status sci_controller_start_io( · 488 unmodified lines
489 struct isci_remote_device *idev,489 struct isci_remote_device *idev,
490 struct isci_request *ireq);490 struct isci_request *ireq);
491 491
492enum sci_task_status sci_controller_start_task(492enum sci_status sci_controller_start_task(
493 struct isci_host *ihost,493 struct isci_host *ihost,
494 struct isci_remote_device *idev,494 struct isci_remote_device *idev,
495 struct isci_request *ireq);495 struct isci_request *ireq);
drivers/scsi/isci/request.c+2−2
@@ -1626,9 +1626,9 @@ static enum sci_status atapi_d2h_reg_frame_handler(struct isci_request *ireq, · 1625 unmodified lines
1626 1626
1627 if (status == SCI_SUCCESS) {1627 if (status == SCI_SUCCESS) {
1628 if (ireq->stp.rsp.status & ATA_ERR)1628 if (ireq->stp.rsp.status & ATA_ERR)
1629 status = SCI_IO_FAILURE_RESPONSE_VALID;1629 status = SCI_FAILURE_IO_RESPONSE_VALID;
1630 } else {1630 } else {
1631 status = SCI_IO_FAILURE_RESPONSE_VALID;1631 status = SCI_FAILURE_IO_RESPONSE_VALID;
1632 }1632 }
1633 1633
1634 if (status != SCI_SUCCESS) {1634 if (status != SCI_SUCCESS) {
drivers/scsi/isci/task.c+2−2
@@ -258,7 +258,7 @@ static int isci_task_execute_tmf(struct isci_host *ihost, · 257 unmodified lines
258 struct isci_tmf *tmf, unsigned long timeout_ms)258 struct isci_tmf *tmf, unsigned long timeout_ms)
259{259{
260 DECLARE_COMPLETION_ONSTACK(completion);260 DECLARE_COMPLETION_ONSTACK(completion);
261 enum sci_task_status status = SCI_TASK_FAILURE;261 enum sci_status status = SCI_FAILURE;
262 struct isci_request *ireq;262 struct isci_request *ireq;
263 int ret = TMF_RESP_FUNC_FAILED;263 int ret = TMF_RESP_FUNC_FAILED;
264 unsigned long flags;264 unsigned long flags;
@@ -301,7 +301,7 @@ static int isci_task_execute_tmf(struct isci_host *ihost, · 36 unmodified lines
301 /* start the TMF io. */301 /* start the TMF io. */
302 status = sci_controller_start_task(ihost, idev, ireq);302 status = sci_controller_start_task(ihost, idev, ireq);
303 303
304 if (status != SCI_TASK_SUCCESS) {304 if (status != SCI_SUCCESS) {
305 dev_dbg(&ihost->pdev->dev,305 dev_dbg(&ihost->pdev->dev,
306 "%s: start_io failed - status = 0x%x, request = %p\n",306 "%s: start_io failed - status = 0x%x, request = %p\n",
307 __func__,307 __func__,
drivers/scsi/iscsi_tcp.c+2−1
@@ -800,7 +800,8 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost, · 799 unmodified lines
800 return rc;800 return rc;
801 801
802 return iscsi_conn_get_addr_param((struct sockaddr_storage *)802 return iscsi_conn_get_addr_param((struct sockaddr_storage *)
803 &addr, param, buf);803 &addr,
804 (enum iscsi_param)param, buf);
804 default:805 default:
805 return iscsi_host_get_param(shost, param, buf);806 return iscsi_host_get_param(shost, param, buf);
806 }807 }
drivers/scsi/jazz_esp.c+1−29
@@ -38,30 +38,6 @@ static u8 jazz_esp_read8(struct esp *esp, unsigned long reg) · 37 unmodified lines
38 return *(volatile u8 *)(esp->regs + reg);38 return *(volatile u8 *)(esp->regs + reg);
39}39}
40 40
41static dma_addr_t jazz_esp_map_single(struct esp *esp, void *buf,
42 size_t sz, int dir)
43{
44 return dma_map_single(esp->dev, buf, sz, dir);
45}
46
47static int jazz_esp_map_sg(struct esp *esp, struct scatterlist *sg,
48 int num_sg, int dir)
49{
50 return dma_map_sg(esp->dev, sg, num_sg, dir);
51}
52
53static void jazz_esp_unmap_single(struct esp *esp, dma_addr_t addr,
54 size_t sz, int dir)
55{
56 dma_unmap_single(esp->dev, addr, sz, dir);
57}
58
59static void jazz_esp_unmap_sg(struct esp *esp, struct scatterlist *sg,
60 int num_sg, int dir)
61{
62 dma_unmap_sg(esp->dev, sg, num_sg, dir);
63}
64
65static int jazz_esp_irq_pending(struct esp *esp)41static int jazz_esp_irq_pending(struct esp *esp)
66{42{
67 if (jazz_esp_read8(esp, ESP_STATUS) & ESP_STAT_INTR)43 if (jazz_esp_read8(esp, ESP_STATUS) & ESP_STAT_INTR)
@@ -117,10 +93,6 @@ static int jazz_esp_dma_error(struct esp *esp) · 49 unmodified lines
117static const struct esp_driver_ops jazz_esp_ops = {93static const struct esp_driver_ops jazz_esp_ops = {
118 .esp_write8 = jazz_esp_write8,94 .esp_write8 = jazz_esp_write8,
119 .esp_read8 = jazz_esp_read8,95 .esp_read8 = jazz_esp_read8,
120 .map_single = jazz_esp_map_single,
121 .map_sg = jazz_esp_map_sg,
122 .unmap_single = jazz_esp_unmap_single,
123 .unmap_sg = jazz_esp_unmap_sg,
124 .irq_pending = jazz_esp_irq_pending,96 .irq_pending = jazz_esp_irq_pending,
125 .reset_dma = jazz_esp_reset_dma,97 .reset_dma = jazz_esp_reset_dma,
126 .dma_drain = jazz_esp_dma_drain,98 .dma_drain = jazz_esp_dma_drain,
@@ -182,7 +154,7 @@ static int esp_jazz_probe(struct platform_device *dev) · 55 unmodified lines
182 154
183 dev_set_drvdata(&dev->dev, esp);155 dev_set_drvdata(&dev->dev, esp);
184 156
185 err = scsi_esp_register(esp, &dev->dev);157 err = scsi_esp_register(esp);
186 if (err)158 if (err)
187 goto fail_free_irq;159 goto fail_free_irq;
188 160
drivers/scsi/libfc/fc_fcp.c+1−5
@@ -1872,7 +1872,6 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd) · 1871 unmodified lines
1872 struct fc_lport *lport = shost_priv(shost);1872 struct fc_lport *lport = shost_priv(shost);
1873 struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));1873 struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));
1874 struct fc_fcp_pkt *fsp;1874 struct fc_fcp_pkt *fsp;
1875 struct fc_rport_libfc_priv *rpriv;
1876 int rval;1875 int rval;
1877 int rc = 0;1876 int rc = 0;
1878 struct fc_stats *stats;1877 struct fc_stats *stats;
@@ -1894,8 +1893,6 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd) · 15 unmodified lines
1894 goto out;1893 goto out;
1895 }1894 }
1896 1895
1897 rpriv = rport->dd_data;
1898
1899 if (!fc_fcp_lport_queue_ready(lport)) {1896 if (!fc_fcp_lport_queue_ready(lport)) {
1900 if (lport->qfull) {1897 if (lport->qfull) {
1901 if (fc_fcp_can_queue_ramp_down(lport))1898 if (fc_fcp_can_queue_ramp_down(lport))
@@ -2295,8 +2292,7 @@ int fc_setup_fcp(void) · 393 unmodified lines
2295 2292
2296void fc_destroy_fcp(void)2293void fc_destroy_fcp(void)
2297{2294{
2298 if (scsi_pkt_cachep)2295 kmem_cache_destroy(scsi_pkt_cachep);
2299 kmem_cache_destroy(scsi_pkt_cachep);
2300}2296}
2301 2297
2302/**2298/**
drivers/scsi/libfc/fc_rport.c+16−6
@@ -1038,8 +1038,11 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp, · 1037 unmodified lines
1038 struct fc_els_ls_rjt *rjt;1038 struct fc_els_ls_rjt *rjt;
1039 1039
1040 rjt = fc_frame_payload_get(fp, sizeof(*rjt));1040 rjt = fc_frame_payload_get(fp, sizeof(*rjt));
1041 FC_RPORT_DBG(rdata, "PLOGI ELS rejected, reason %x expl %x\n",1041 if (!rjt)
1042 rjt->er_reason, rjt->er_explan);1042 FC_RPORT_DBG(rdata, "PLOGI bad response\n");
1043 else
1044 FC_RPORT_DBG(rdata, "PLOGI ELS rejected, reason %x expl %x\n",
1045 rjt->er_reason, rjt->er_explan);
1043 fc_rport_error_retry(rdata, -FC_EX_ELS_RJT);1046 fc_rport_error_retry(rdata, -FC_EX_ELS_RJT);
1044 }1047 }
1045out:1048out:
@@ -1158,8 +1161,10 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, · 112 unmodified lines
1158 op = fc_frame_payload_op(fp);1161 op = fc_frame_payload_op(fp);
1159 if (op == ELS_LS_ACC) {1162 if (op == ELS_LS_ACC) {
1160 pp = fc_frame_payload_get(fp, sizeof(*pp));1163 pp = fc_frame_payload_get(fp, sizeof(*pp));
1161 if (!pp)1164 if (!pp) {
1165 fc_rport_error_retry(rdata, -FC_EX_SEQ_ERR);
1162 goto out;1166 goto out;
1167 }
1163 1168
1164 resp_code = (pp->spp.spp_flags & FC_SPP_RESP_MASK);1169 resp_code = (pp->spp.spp_flags & FC_SPP_RESP_MASK);
1165 FC_RPORT_DBG(rdata, "PRLI spp_flags = 0x%x spp_type 0x%x\n",1170 FC_RPORT_DBG(rdata, "PRLI spp_flags = 0x%x spp_type 0x%x\n",
@@ -1172,8 +1177,10 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, · 6 unmodified lines
1172 fc_rport_error_retry(rdata, -FC_EX_SEQ_ERR);1177 fc_rport_error_retry(rdata, -FC_EX_SEQ_ERR);
1173 goto out;1178 goto out;
1174 }1179 }
1175 if (pp->prli.prli_spp_len < sizeof(pp->spp))1180 if (pp->prli.prli_spp_len < sizeof(pp->spp)) {
1181 fc_rport_error_retry(rdata, -FC_EX_SEQ_ERR);
1176 goto out;1182 goto out;
1183 }
1177 1184
1178 fcp_parm = ntohl(pp->spp.spp_params);1185 fcp_parm = ntohl(pp->spp.spp_params);
1179 if (fcp_parm & FCP_SPPF_RETRY)1186 if (fcp_parm & FCP_SPPF_RETRY)
@@ -1211,8 +1218,11 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, · 31 unmodified lines
1211 1218
1212 } else {1219 } else {
1213 rjt = fc_frame_payload_get(fp, sizeof(*rjt));1220 rjt = fc_frame_payload_get(fp, sizeof(*rjt));
1214 FC_RPORT_DBG(rdata, "PRLI ELS rejected, reason %x expl %x\n",1221 if (!rjt)
1215 rjt->er_reason, rjt->er_explan);1222 FC_RPORT_DBG(rdata, "PRLI bad response\n");
1223 else
1224 FC_RPORT_DBG(rdata, "PRLI ELS rejected, reason %x expl %x\n",
1225 rjt->er_reason, rjt->er_explan);
1216 fc_rport_error_retry(rdata, FC_EX_ELS_RJT);1226 fc_rport_error_retry(rdata, FC_EX_ELS_RJT);
1217 }1227 }
1218 1228
drivers/scsi/libsas/sas_ata.c+1−1
@@ -654,7 +654,7 @@ void sas_probe_sata(struct asd_sas_port *port) · 653 unmodified lines
654 /* if libata could not bring the link up, don't surface654 /* if libata could not bring the link up, don't surface
655 * the device655 * the device
656 */656 */
657 if (ata_dev_disabled(sas_to_ata_dev(dev)))657 if (!ata_dev_enabled(sas_to_ata_dev(dev)))
658 sas_fail_probe(dev, __func__, -ENODEV);658 sas_fail_probe(dev, __func__, -ENODEV);
659 }659 }
660 660
drivers/scsi/libsas/sas_discover.c+1−1
@@ -260,7 +260,7 @@ static void sas_suspend_devices(struct work_struct *work) · 259 unmodified lines
260 * phy_list is not being mutated260 * phy_list is not being mutated
261 */261 */
262 list_for_each_entry(phy, &port->phy_list, port_phy_el) {262 list_for_each_entry(phy, &port->phy_list, port_phy_el) {
263 if (si->dft->lldd_port_formed)263 if (si->dft->lldd_port_deformed)
264 si->dft->lldd_port_deformed(phy);264 si->dft->lldd_port_deformed(phy);
265 phy->suspended = 1;265 phy->suspended = 1;
266 port->suspended = 1;266 port->suspended = 1;
drivers/scsi/libsas/sas_expander.c+9−13
@@ -48,17 +48,16 @@ static void smp_task_timedout(struct timer_list *t) · 47 unmodified lines
48 unsigned long flags;48 unsigned long flags;
49 49
50 spin_lock_irqsave(&task->task_state_lock, flags);50 spin_lock_irqsave(&task->task_state_lock, flags);
51 if (!(task->task_state_flags & SAS_TASK_STATE_DONE))51 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) {
52 task->task_state_flags |= SAS_TASK_STATE_ABORTED;52 task->task_state_flags |= SAS_TASK_STATE_ABORTED;
53 complete(&task->slow_task->completion);
54 }
53 spin_unlock_irqrestore(&task->task_state_lock, flags);55 spin_unlock_irqrestore(&task->task_state_lock, flags);
54
55 complete(&task->slow_task->completion);
56}56}
57 57
58static void smp_task_done(struct sas_task *task)58static void smp_task_done(struct sas_task *task)
59{59{
60 if (!del_timer(&task->slow_task->timer))60 del_timer(&task->slow_task->timer);
61 return;
62 complete(&task->slow_task->completion);61 complete(&task->slow_task->completion);
63}62}
64 63
@@ -2054,14 +2053,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) · 1989 unmodified lines
2054 return res;2053 return res;
2055 }2054 }
2056 2055
2057 /* delete the old link */2056 /* we always have to delete the old device when we went here */
2058 if (SAS_ADDR(phy->attached_sas_addr) &&2057 SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n",
2059 SAS_ADDR(sas_addr) != SAS_ADDR(phy->attached_sas_addr)) {2058 SAS_ADDR(dev->sas_addr), phy_id,
2060 SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n",2059 SAS_ADDR(phy->attached_sas_addr));
2061 SAS_ADDR(dev->sas_addr), phy_id,2060 sas_unregister_devs_sas_addr(dev, phy_id, last);
2062 SAS_ADDR(phy->attached_sas_addr));
2063 sas_unregister_devs_sas_addr(dev, phy_id, last);
2064 }
2065 2061
2066 return sas_discover_new(dev, phy_id);2062 return sas_discover_new(dev, phy_id);
2067}2063}
drivers/scsi/lpfc/lpfc.h+28−1
@@ -52,7 +52,7 @@ struct lpfc_sli2_slim; · 51 unmodified lines
52 downloads using bsg */52 downloads using bsg */
53 53
54#define LPFC_MIN_SG_SLI4_BUF_SZ 0x800 /* based on LPFC_DEFAULT_SG_SEG_CNT */54#define LPFC_MIN_SG_SLI4_BUF_SZ 0x800 /* based on LPFC_DEFAULT_SG_SEG_CNT */
55#define LPFC_MAX_SG_SLI4_SEG_CNT_DIF 128 /* sg element count per scsi cmnd */55#define LPFC_MAX_BG_SLI4_SEG_CNT_DIF 128 /* sg element count for BlockGuard */
56#define LPFC_MAX_SG_SEG_CNT_DIF 512 /* sg element count per scsi cmnd */56#define LPFC_MAX_SG_SEG_CNT_DIF 512 /* sg element count per scsi cmnd */
57#define LPFC_MAX_SG_SEG_CNT 4096 /* sg element count per scsi cmnd */57#define LPFC_MAX_SG_SEG_CNT 4096 /* sg element count per scsi cmnd */
58#define LPFC_MIN_SG_SEG_CNT 32 /* sg element count per scsi cmnd */58#define LPFC_MIN_SG_SEG_CNT 32 /* sg element count per scsi cmnd */
@@ -583,6 +583,25 @@ struct lpfc_mbox_ext_buf_ctx { · 524 unmodified lines
583 struct list_head ext_dmabuf_list;583 struct list_head ext_dmabuf_list;
584};584};
585 585
586struct lpfc_ras_fwlog {
587 uint8_t *fwlog_buff;
588 uint32_t fw_buffcount; /* Buffer size posted to FW */
589#define LPFC_RAS_BUFF_ENTERIES 16 /* Each entry can hold max of 64k */
590#define LPFC_RAS_MAX_ENTRY_SIZE (64 * 1024)
591#define LPFC_RAS_MIN_BUFF_POST_SIZE (256 * 1024)
592#define LPFC_RAS_MAX_BUFF_POST_SIZE (1024 * 1024)
593 uint32_t fw_loglevel; /* Log level set */
594 struct lpfc_dmabuf lwpd;
595 struct list_head fwlog_buff_list;
596
597 /* RAS support status on adapter */
598 bool ras_hwsupport; /* RAS Support available on HW or not */
599 bool ras_enabled; /* Ras Enabled for the function */
600#define LPFC_RAS_DISABLE_LOGGING 0x00
601#define LPFC_RAS_ENABLE_LOGGING 0x01
602 bool ras_active; /* RAS logging running state */
603};
604
586struct lpfc_hba {605struct lpfc_hba {
587 /* SCSI interface function jump table entries */606 /* SCSI interface function jump table entries */
588 int (*lpfc_new_scsi_buf)607 int (*lpfc_new_scsi_buf)
@@ -790,6 +809,7 @@ struct lpfc_hba { · 201 unmodified lines
790 uint32_t cfg_total_seg_cnt;809 uint32_t cfg_total_seg_cnt;
791 uint32_t cfg_sg_seg_cnt;810 uint32_t cfg_sg_seg_cnt;
792 uint32_t cfg_nvme_seg_cnt;811 uint32_t cfg_nvme_seg_cnt;
812 uint32_t cfg_scsi_seg_cnt;
793 uint32_t cfg_sg_dma_buf_size;813 uint32_t cfg_sg_dma_buf_size;
794 uint64_t cfg_soft_wwnn;814 uint64_t cfg_soft_wwnn;
795 uint64_t cfg_soft_wwpn;815 uint64_t cfg_soft_wwpn;
@@ -833,6 +853,9 @@ struct lpfc_hba { · 37 unmodified lines
833#define LPFC_FDMI_SUPPORT 1 /* FDMI supported? */853#define LPFC_FDMI_SUPPORT 1 /* FDMI supported? */
834 uint32_t cfg_enable_SmartSAN;854 uint32_t cfg_enable_SmartSAN;
835 uint32_t cfg_enable_mds_diags;855 uint32_t cfg_enable_mds_diags;
856 uint32_t cfg_ras_fwlog_level;
857 uint32_t cfg_ras_fwlog_buffsize;
858 uint32_t cfg_ras_fwlog_func;
836 uint32_t cfg_enable_fc4_type;859 uint32_t cfg_enable_fc4_type;
837 uint32_t cfg_enable_bbcr; /* Enable BB Credit Recovery */860 uint32_t cfg_enable_bbcr; /* Enable BB Credit Recovery */
838 uint32_t cfg_enable_dpp; /* Enable Direct Packet Push */861 uint32_t cfg_enable_dpp; /* Enable Direct Packet Push */
@@ -963,6 +986,7 @@ struct lpfc_hba { · 124 unmodified lines
963 uint32_t intr_mode;986 uint32_t intr_mode;
964#define LPFC_INTR_ERROR 0xFFFFFFFF987#define LPFC_INTR_ERROR 0xFFFFFFFF
965 struct list_head port_list;988 struct list_head port_list;
989 spinlock_t port_list_lock; /* lock for port_list mutations */
966 struct lpfc_vport *pport; /* physical lpfc_vport pointer */990 struct lpfc_vport *pport; /* physical lpfc_vport pointer */
967 uint16_t max_vpi; /* Maximum virtual nports */991 uint16_t max_vpi; /* Maximum virtual nports */
968#define LPFC_MAX_VPI 0xFFFF /* Max number of VPI supported */992#define LPFC_MAX_VPI 0xFFFF /* Max number of VPI supported */
@@ -1092,6 +1116,9 @@ struct lpfc_hba { · 123 unmodified lines
1092 struct unsol_rcv_ct_ctx ct_ctx[LPFC_CT_CTX_MAX];1116 struct unsol_rcv_ct_ctx ct_ctx[LPFC_CT_CTX_MAX];
1093 uint32_t ctx_idx;1117 uint32_t ctx_idx;
1094 1118
1119 /* RAS Support */
1120 struct lpfc_ras_fwlog ras_fwlog;
1121
1095 uint8_t menlo_flag; /* menlo generic flags */1122 uint8_t menlo_flag; /* menlo generic flags */
1096#define HBA_MENLO_SUPPORT 0x1 /* HBA supports menlo commands */1123#define HBA_MENLO_SUPPORT 0x1 /* HBA supports menlo commands */
1097 uint32_t iocb_cnt;1124 uint32_t iocb_cnt;
drivers/scsi/lpfc/lpfc_attr.c+106−5
@@ -5358,15 +5358,74 @@ LPFC_ATTR(delay_discovery, 0, 0, 1, · 5357 unmodified lines
5358 5358
5359/*5359/*
5360 * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count5360 * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count
5361 * This value can be set to values between 64 and 4096. The default value is5361 * This value can be set to values between 64 and 4096. The default value
5362 * 64, but may be increased to allow for larger Max I/O sizes. The scsi layer5362 * is 64, but may be increased to allow for larger Max I/O sizes. The scsi
5363 * will be allowed to request I/Os of sizes up to (MAX_SEG_COUNT * SEG_SIZE).5363 * and nvme layers will allow I/O sizes up to (MAX_SEG_COUNT * SEG_SIZE).
5364 * Because of the additional overhead involved in setting up T10-DIF,5364 * Because of the additional overhead involved in setting up T10-DIF,
5365 * this parameter will be limited to 128 if BlockGuard is enabled under SLI45365 * this parameter will be limited to 128 if BlockGuard is enabled under SLI4
5366 * and will be limited to 512 if BlockGuard is enabled under SLI3.5366 * and will be limited to 512 if BlockGuard is enabled under SLI3.
5367 */5367 */
5368LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_MIN_SG_SEG_CNT,5368static uint lpfc_sg_seg_cnt = LPFC_DEFAULT_SG_SEG_CNT;
5369 LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count");5369module_param(lpfc_sg_seg_cnt, uint, 0444);
5370MODULE_PARM_DESC(lpfc_sg_seg_cnt, "Max Scatter Gather Segment Count");
5371
5372/**
5373 * lpfc_sg_seg_cnt_show - Display the scatter/gather list sizes
5374 * configured for the adapter
5375 * @dev: class converted to a Scsi_host structure.
5376 * @attr: device attribute, not used.
5377 * @buf: on return contains a string with the list sizes
5378 *
5379 * Returns: size of formatted string.
5380 **/
5381static ssize_t
5382lpfc_sg_seg_cnt_show(struct device *dev, struct device_attribute *attr,
5383 char *buf)
5384{
5385 struct Scsi_Host *shost = class_to_shost(dev);
5386 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata;
5387 struct lpfc_hba *phba = vport->phba;
5388 int len;
5389
5390 len = snprintf(buf, PAGE_SIZE, "SGL sz: %d total SGEs: %d\n",
5391 phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt);
5392
5393 len += snprintf(buf + len, PAGE_SIZE, "Cfg: %d SCSI: %d NVME: %d\n",
5394 phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt,
5395 phba->cfg_nvme_seg_cnt);
5396 return len;
5397}
5398
5399static DEVICE_ATTR_RO(lpfc_sg_seg_cnt);
5400
5401/**
5402 * lpfc_sg_seg_cnt_init - Set the hba sg_seg_cnt initial value
5403 * @phba: lpfc_hba pointer.
5404 * @val: contains the initial value
5405 *
5406 * Description:
5407 * Validates the initial value is within range and assigns it to the
5408 * adapter. If not in range, an error message is posted and the
5409 * default value is assigned.
5410 *
5411 * Returns:
5412 * zero if value is in range and is set
5413 * -EINVAL if value was out of range
5414 **/
5415static int
5416lpfc_sg_seg_cnt_init(struct lpfc_hba *phba, int val)
5417{
5418 if (val >= LPFC_MIN_SG_SEG_CNT && val <= LPFC_MAX_SG_SEG_CNT) {
5419 phba->cfg_sg_seg_cnt = val;
5420 return 0;
5421 }
5422 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
5423 "0409 "LPFC_DRIVER_NAME"_sg_seg_cnt attribute cannot "
5424 "be set to %d, allowed range is [%d, %d]\n",
5425 val, LPFC_MIN_SG_SEG_CNT, LPFC_MAX_SG_SEG_CNT);
5426 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_SG_SEG_CNT;
5427 return -EINVAL;
5428}
5370 5429
5371/*5430/*
5372 * lpfc_enable_mds_diags: Enable MDS Diagnostics5431 * lpfc_enable_mds_diags: Enable MDS Diagnostics
@@ -5376,6 +5435,31 @@ LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_MIN_SG_SEG_CNT, · 3 unmodified lines
5376 */5435 */
5377LPFC_ATTR_R(enable_mds_diags, 0, 0, 1, "Enable MDS Diagnostics");5436LPFC_ATTR_R(enable_mds_diags, 0, 0, 1, "Enable MDS Diagnostics");
5378 5437
5438/*
5439 * lpfc_ras_fwlog_buffsize: Firmware logging host buffer size
5440 * 0 = Disable firmware logging (default)
5441 * [1-4] = Multiple of 1/4th Mb of host memory for FW logging
5442 * Value range [0..4]. Default value is 0
5443 */
5444LPFC_ATTR_RW(ras_fwlog_buffsize, 0, 0, 4, "Host memory for FW logging");
5445
5446/*
5447 * lpfc_ras_fwlog_level: Firmware logging verbosity level
5448 * Valid only if firmware logging is enabled
5449 * 0(Least Verbosity) 4 (most verbosity)
5450 * Value range is [0..4]. Default value is 0
5451 */
5452LPFC_ATTR_RW(ras_fwlog_level, 0, 0, 4, "Firmware Logging Level");
5453
5454/*
5455 * lpfc_ras_fwlog_func: Firmware logging enabled on function number
5456 * Default function which has RAS support : 0
5457 * Value Range is [0..7].
5458 * FW logging is a global action and enablement is via a specific
5459 * port.
5460 */
5461LPFC_ATTR_RW(ras_fwlog_func, 0, 0, 7, "Firmware Logging Enabled on Function");
5462
5379/*5463/*
5380 * lpfc_enable_bbcr: Enable BB Credit Recovery5464 * lpfc_enable_bbcr: Enable BB Credit Recovery
5381 * 0 = BB Credit Recovery disabled5465 * 0 = BB Credit Recovery disabled
@@ -5501,6 +5585,9 @@ struct device_attribute *lpfc_hba_attrs[] = { · 119 unmodified lines
5501 &dev_attr_protocol,5585 &dev_attr_protocol,
5502 &dev_attr_lpfc_xlane_supported,5586 &dev_attr_lpfc_xlane_supported,
5503 &dev_attr_lpfc_enable_mds_diags,5587 &dev_attr_lpfc_enable_mds_diags,
5588 &dev_attr_lpfc_ras_fwlog_buffsize,
5589 &dev_attr_lpfc_ras_fwlog_level,
5590 &dev_attr_lpfc_ras_fwlog_func,
5504 &dev_attr_lpfc_enable_bbcr,5591 &dev_attr_lpfc_enable_bbcr,
5505 &dev_attr_lpfc_enable_dpp,5592 &dev_attr_lpfc_enable_dpp,
5506 NULL,5593 NULL,
@@ -6587,6 +6674,20 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) · 1080 unmodified lines
6587 lpfc_sli_mode_init(phba, lpfc_sli_mode);6674 lpfc_sli_mode_init(phba, lpfc_sli_mode);
6588 phba->cfg_enable_dss = 1;6675 phba->cfg_enable_dss = 1;
6589 lpfc_enable_mds_diags_init(phba, lpfc_enable_mds_diags);6676 lpfc_enable_mds_diags_init(phba, lpfc_enable_mds_diags);
6677 lpfc_ras_fwlog_buffsize_init(phba, lpfc_ras_fwlog_buffsize);
6678 lpfc_ras_fwlog_level_init(phba, lpfc_ras_fwlog_level);
6679 lpfc_ras_fwlog_func_init(phba, lpfc_ras_fwlog_func);
6680
6681
6682 /* If the NVME FC4 type is enabled, scale the sg_seg_cnt to
6683 * accommodate 512K and 1M IOs in a single nvme buf and supply
6684 * enough NVME LS iocb buffers for larger connectivity counts.
6685 */
6686 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) {
6687 phba->cfg_sg_seg_cnt = LPFC_MAX_NVME_SEG_CNT;
6688 phba->cfg_iocb_cnt = 5;
6689 }
6690
6590 return;6691 return;
6591}6692}
6592 6693
drivers/scsi/lpfc/lpfc_bsg.c+339−5
@@ -27,6 +27,7 @@ · 26 unmodified lines
27#include <linux/delay.h>27#include <linux/delay.h>
28#include <linux/list.h>28#include <linux/list.h>
29#include <linux/bsg-lib.h>29#include <linux/bsg-lib.h>
30#include <linux/vmalloc.h>
30 31
31#include <scsi/scsi.h>32#include <scsi/scsi.h>
32#include <scsi/scsi_host.h>33#include <scsi/scsi_host.h>
@@ -2843,9 +2844,6 @@ diag_cmd_data_alloc(struct lpfc_hba *phba, · 2810 unmodified lines
2843 2844
2844 if (nocopydata) {2845 if (nocopydata) {
2845 bpl->tus.f.bdeFlags = 0;2846 bpl->tus.f.bdeFlags = 0;
2846 pci_dma_sync_single_for_device(phba->pcidev,
2847 dmp->dma.phys, LPFC_BPL_SIZE, PCI_DMA_TODEVICE);
2848
2849 } else {2847 } else {
2850 memset((uint8_t *)dmp->dma.virt, 0, cnt);2848 memset((uint8_t *)dmp->dma.virt, 0, cnt);
2851 bpl->tus.f.bdeFlags = BUFF_TYPE_BDE_64I;2849 bpl->tus.f.bdeFlags = BUFF_TYPE_BDE_64I;
@@ -5308,6 +5306,330 @@ job_error: · 2456 unmodified lines
5308 return rc;5306 return rc;
5309}5307}
5310 5308
5309/**
5310 * lpfc_check_fwlog_support: Check FW log support on the adapter
5311 * @phba: Pointer to HBA context object.
5312 *
5313 * Check if FW Logging support by the adapter
5314 **/
5315int
5316lpfc_check_fwlog_support(struct lpfc_hba *phba)
5317{
5318 struct lpfc_ras_fwlog *ras_fwlog = NULL;
5319
5320 ras_fwlog = &phba->ras_fwlog;
5321
5322 if (ras_fwlog->ras_hwsupport == false)
5323 return -EACCES;
5324 else if (ras_fwlog->ras_enabled == false)
5325 return -EPERM;
5326 else
5327 return 0;
5328}
5329
5330/**
5331 * lpfc_bsg_get_ras_config: Get RAS configuration settings
5332 * @job: fc_bsg_job to handle
5333 *
5334 * Get RAS configuration values set.
5335 **/
5336static int
5337lpfc_bsg_get_ras_config(struct bsg_job *job)
5338{
5339 struct Scsi_Host *shost = fc_bsg_to_shost(job);
5340 struct lpfc_vport *vport = shost_priv(shost);
5341 struct fc_bsg_reply *bsg_reply = job->reply;
5342 struct lpfc_hba *phba = vport->phba;
5343 struct lpfc_bsg_get_ras_config_reply *ras_reply;
5344 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog;
5345 int rc = 0;
5346
5347 if (job->request_len <
5348 sizeof(struct fc_bsg_request) +
5349 sizeof(struct lpfc_bsg_ras_req)) {
5350 lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC,
5351 "6181 Received RAS_LOG request "
5352 "below minimum size\n");
5353 rc = -EINVAL;
5354 goto ras_job_error;
5355 }
5356
5357 /* Check FW log status */
5358 rc = lpfc_check_fwlog_support(phba);
5359 if (rc == -EACCES || rc == -EPERM)
5360 goto ras_job_error;
5361
5362 ras_reply = (struct lpfc_bsg_get_ras_config_reply *)
5363 bsg_reply->reply_data.vendor_reply.vendor_rsp;
5364
5365 /* Current logging state */
5366 if (ras_fwlog->ras_active == true)
5367 ras_reply->state = LPFC_RASLOG_STATE_RUNNING;
5368 else
5369 ras_reply->state = LPFC_RASLOG_STATE_STOPPED;
5370
5371 ras_reply->log_level = phba->ras_fwlog.fw_loglevel;
5372 ras_reply->log_buff_sz = phba->cfg_ras_fwlog_buffsize;
5373
5374ras_job_error:
5375 /* make error code available to userspace */
5376 bsg_reply->result = rc;
5377
5378 /* complete the job back to userspace */
5379 bsg_job_done(job, bsg_reply->result, bsg_reply->reply_payload_rcv_len);
5380 return rc;
5381}
5382
5383/**
5384 * lpfc_ras_stop_fwlog: Disable FW logging by the adapter
5385 * @phba: Pointer to HBA context object.
5386 *
5387 * Disable FW logging into host memory on the adapter. To
5388 * be done before reading logs from the host memory.
5389 **/
5390static void
5391lpfc_ras_stop_fwlog(struct lpfc_hba *phba)
5392{
5393 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog;
5394
5395 ras_fwlog->ras_active = false;
5396
5397 /* Disable FW logging to host memory */
5398 writel(LPFC_CTL_PDEV_CTL_DDL_RAS,
5399 phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET);
5400}
5401
5402/**
5403 * lpfc_bsg_set_ras_config: Set FW logging parameters
5404 * @job: fc_bsg_job to handle
5405 *
5406 * Set log-level parameters for FW-logging in host memory
5407 **/
5408static int
5409lpfc_bsg_set_ras_config(struct bsg_job *job)
5410{
5411 struct Scsi_Host *shost = fc_bsg_to_shost(job);
5412 struct lpfc_vport *vport = shost_priv(shost);
5413 struct lpfc_hba *phba = vport->phba;
5414 struct lpfc_bsg_set_ras_config_req *ras_req;
5415 struct fc_bsg_request *bsg_request = job->request;
5416 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog;
5417 struct fc_bsg_reply *bsg_reply = job->reply;
5418 uint8_t action = 0, log_level = 0;
5419 int rc = 0;
5420
5421 if (job->request_len <
5422 sizeof(struct fc_bsg_request) +
5423 sizeof(struct lpfc_bsg_set_ras_config_req)) {
5424 lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC,
5425 "6182 Received RAS_LOG request "
5426 "below minimum size\n");
5427 rc = -EINVAL;
5428 goto ras_job_error;
5429 }
5430
5431 /* Check FW log status */
5432 rc = lpfc_check_fwlog_support(phba);
5433 if (rc == -EACCES || rc == -EPERM)
5434 goto ras_job_error;
5435
5436 ras_req = (struct lpfc_bsg_set_ras_config_req *)
5437 bsg_request->rqst_data.h_vendor.vendor_cmd;
5438 action = ras_req->action;
5439 log_level = ras_req->log_level;
5440
5441 if (action == LPFC_RASACTION_STOP_LOGGING) {
5442 /* Check if already disabled */
5443 if (ras_fwlog->ras_active == false) {
5444 rc = -ESRCH;
5445 goto ras_job_error;
5446 }
5447
5448 /* Disable logging */
5449 lpfc_ras_stop_fwlog(phba);
5450 } else {
5451 /*action = LPFC_RASACTION_START_LOGGING*/
5452 if (ras_fwlog->ras_active == true) {
5453 rc = -EINPROGRESS;
5454 goto ras_job_error;
5455 }
5456
5457 /* Enable logging */
5458 rc = lpfc_sli4_ras_fwlog_init(phba, log_level,
5459 LPFC_RAS_ENABLE_LOGGING);
5460 if (rc)
5461 rc = -EINVAL;
5462 }
5463ras_job_error:
5464 /* make error code available to userspace */
5465 bsg_reply->result = rc;
5466
5467 /* complete the job back to userspace */
5468 bsg_job_done(job, bsg_reply->result,
5469 bsg_reply->reply_payload_rcv_len);
5470
5471 return rc;
5472}
5473
5474/**
5475 * lpfc_bsg_get_ras_lwpd: Get log write position data
5476 * @job: fc_bsg_job to handle
5477 *
5478 * Get Offset/Wrap count of the log message written
5479 * in host memory
5480 **/
5481static int
5482lpfc_bsg_get_ras_lwpd(struct bsg_job *job)
5483{
5484 struct Scsi_Host *shost = fc_bsg_to_shost(job);
5485 struct lpfc_vport *vport = shost_priv(shost);
5486 struct lpfc_bsg_get_ras_lwpd *ras_reply;
5487 struct lpfc_hba *phba = vport->phba;
5488 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog;
5489 struct fc_bsg_reply *bsg_reply = job->reply;
5490 uint32_t lwpd_offset = 0;
5491 uint64_t wrap_value = 0;
5492 int rc = 0;
5493
5494 rc = lpfc_check_fwlog_support(phba);
5495 if (rc == -EACCES || rc == -EPERM)
5496 goto ras_job_error;
5497
5498 if (job->request_len <
5499 sizeof(struct fc_bsg_request) +
5500 sizeof(struct lpfc_bsg_ras_req)) {
5501 lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC,
5502 "6183 Received RAS_LOG request "
5503 "below minimum size\n");
5504 rc = -EINVAL;
5505 goto ras_job_error;
5506 }
5507
5508 ras_reply = (struct lpfc_bsg_get_ras_lwpd *)
5509 bsg_reply->reply_data.vendor_reply.vendor_rsp;
5510
5511 lwpd_offset = *((uint32_t *)ras_fwlog->lwpd.virt) & 0xffffffff;
5512 ras_reply->offset = be32_to_cpu(lwpd_offset);
5513
5514 wrap_value = *((uint64_t *)ras_fwlog->lwpd.virt);
5515 ras_reply->wrap_count = be32_to_cpu((wrap_value >> 32) & 0xffffffff);
5516
5517ras_job_error:
5518 /* make error code available to userspace */
5519 bsg_reply->result = rc;
5520
5521 /* complete the job back to userspace */
5522 bsg_job_done(job, bsg_reply->result, bsg_reply->reply_payload_rcv_len);
5523
5524 return rc;
5525}
5526
5527/**
5528 * lpfc_bsg_get_ras_fwlog: Read FW log
5529 * @job: fc_bsg_job to handle
5530 *
5531 * Copy the FW log into the passed buffer.
5532 **/
5533static int
5534lpfc_bsg_get_ras_fwlog(struct bsg_job *job)
5535{
5536 struct Scsi_Host *shost = fc_bsg_to_shost(job);
5537 struct lpfc_vport *vport = shost_priv(shost);
5538 struct lpfc_hba *phba = vport->phba;
5539 struct fc_bsg_request *bsg_request = job->request;
5540 struct fc_bsg_reply *bsg_reply = job->reply;
5541 struct lpfc_bsg_get_fwlog_req *ras_req;
5542 uint32_t rd_offset, rd_index, offset, pending_wlen;
5543 uint32_t boundary = 0, align_len = 0, write_len = 0;
5544 void *dest, *src, *fwlog_buff;
5545 struct lpfc_ras_fwlog *ras_fwlog = NULL;
5546 struct lpfc_dmabuf *dmabuf, *next;
5547 int rc = 0;
5548
5549 ras_fwlog = &phba->ras_fwlog;
5550
5551 rc = lpfc_check_fwlog_support(phba);
5552 if (rc == -EACCES || rc == -EPERM)
5553 goto ras_job_error;
5554
5555 /* Logging to be stopped before reading */
5556 if (ras_fwlog->ras_active == true) {
5557 rc = -EINPROGRESS;
5558 goto ras_job_error;
5559 }
5560
5561 if (job->request_len <
5562 sizeof(struct fc_bsg_request) +
5563 sizeof(struct lpfc_bsg_get_fwlog_req)) {
5564 lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC,
5565 "6184 Received RAS_LOG request "
5566 "below minimum size\n");
5567 rc = -EINVAL;
5568 goto ras_job_error;
5569 }
5570
5571 ras_req = (struct lpfc_bsg_get_fwlog_req *)
5572 bsg_request->rqst_data.h_vendor.vendor_cmd;
5573 rd_offset = ras_req->read_offset;
5574
5575 /* Allocate memory to read fw log*/
5576 fwlog_buff = vmalloc(ras_req->read_size);
5577 if (!fwlog_buff) {
5578 rc = -ENOMEM;
5579 goto ras_job_error;
5580 }
5581
5582 rd_index = (rd_offset / LPFC_RAS_MAX_ENTRY_SIZE);
5583 offset = (rd_offset % LPFC_RAS_MAX_ENTRY_SIZE);
5584 pending_wlen = ras_req->read_size;
5585 dest = fwlog_buff;
5586
5587 list_for_each_entry_safe(dmabuf, next,
5588 &ras_fwlog->fwlog_buff_list, list) {
5589
5590 if (dmabuf->buffer_tag < rd_index)
5591 continue;
5592
5593 /* Align read to buffer size */
5594 if (offset) {
5595 boundary = ((dmabuf->buffer_tag + 1) *
5596 LPFC_RAS_MAX_ENTRY_SIZE);
5597
5598 align_len = (boundary - offset);
5599 write_len = min_t(u32, align_len,
5600 LPFC_RAS_MAX_ENTRY_SIZE);
5601 } else {
5602 write_len = min_t(u32, pending_wlen,
5603 LPFC_RAS_MAX_ENTRY_SIZE);
5604 align_len = 0;
5605 boundary = 0;
5606 }
5607 src = dmabuf->virt + offset;
5608 memcpy(dest, src, write_len);
5609
5610 pending_wlen -= write_len;
5611 if (!pending_wlen)
5612 break;
5613
5614 dest += write_len;
5615 offset = (offset + write_len) % LPFC_RAS_MAX_ENTRY_SIZE;
5616 }
5617
5618 bsg_reply->reply_payload_rcv_len =
5619 sg_copy_from_buffer(job->reply_payload.sg_list,
5620 job->reply_payload.sg_cnt,
5621 fwlog_buff, ras_req->read_size);
5622
5623 vfree(fwlog_buff);
5624
5625ras_job_error:
5626 bsg_reply->result = rc;
5627 bsg_job_done(job, bsg_reply->result, bsg_reply->reply_payload_rcv_len);
5628
5629 return rc;
5630}
5631
5632
5311/**5633/**
5312 * lpfc_bsg_hst_vendor - process a vendor-specific fc_bsg_job5634 * lpfc_bsg_hst_vendor - process a vendor-specific fc_bsg_job
5313 * @job: fc_bsg_job to handle5635 * @job: fc_bsg_job to handle
@@ -5355,6 +5677,18 @@ lpfc_bsg_hst_vendor(struct bsg_job *job) · 41 unmodified lines
5355 case LPFC_BSG_VENDOR_FORCED_LINK_SPEED:5677 case LPFC_BSG_VENDOR_FORCED_LINK_SPEED:
5356 rc = lpfc_forced_link_speed(job);5678 rc = lpfc_forced_link_speed(job);
5357 break;5679 break;
5680 case LPFC_BSG_VENDOR_RAS_GET_LWPD:
5681 rc = lpfc_bsg_get_ras_lwpd(job);
5682 break;
5683 case LPFC_BSG_VENDOR_RAS_GET_FWLOG:
5684 rc = lpfc_bsg_get_ras_fwlog(job);
5685 break;
5686 case LPFC_BSG_VENDOR_RAS_GET_CONFIG:
5687 rc = lpfc_bsg_get_ras_config(job);
5688 break;
5689 case LPFC_BSG_VENDOR_RAS_SET_CONFIG:
5690 rc = lpfc_bsg_set_ras_config(job);
5691 break;
5358 default:5692 default:
5359 rc = -EINVAL;5693 rc = -EINVAL;
5360 bsg_reply->reply_payload_rcv_len = 0;5694 bsg_reply->reply_payload_rcv_len = 0;
@@ -5368,7 +5702,7 @@ lpfc_bsg_hst_vendor(struct bsg_job *job) · 7 unmodified lines
5368 5702
5369/**5703/**
5370 * lpfc_bsg_request - handle a bsg request from the FC transport5704 * lpfc_bsg_request - handle a bsg request from the FC transport
5371 * @job: fc_bsg_job to handle5705 * @job: bsg_job to handle
5372 **/5706 **/
5373int5707int
5374lpfc_bsg_request(struct bsg_job *job)5708lpfc_bsg_request(struct bsg_job *job)
@@ -5402,7 +5736,7 @@ lpfc_bsg_request(struct bsg_job *job) · 27 unmodified lines
5402 5736
5403/**5737/**
5404 * lpfc_bsg_timeout - handle timeout of a bsg request from the FC transport5738 * lpfc_bsg_timeout - handle timeout of a bsg request from the FC transport
5405 * @job: fc_bsg_job that has timed out5739 * @job: bsg_job that has timed out
5406 *5740 *
5407 * This function just aborts the job's IOCB. The aborted IOCB will return to5741 * This function just aborts the job's IOCB. The aborted IOCB will return to
5408 * the waiting function which will handle passing the error back to userspace5742 * the waiting function which will handle passing the error back to userspace
drivers/scsi/lpfc/lpfc_bsg.h+36−0
@@ -38,6 +38,10 @@ · 37 unmodified lines
38#define LPFC_BSG_VENDOR_DIAG_MODE_END 1038#define LPFC_BSG_VENDOR_DIAG_MODE_END 10
39#define LPFC_BSG_VENDOR_LINK_DIAG_TEST 1139#define LPFC_BSG_VENDOR_LINK_DIAG_TEST 11
40#define LPFC_BSG_VENDOR_FORCED_LINK_SPEED 1440#define LPFC_BSG_VENDOR_FORCED_LINK_SPEED 14
41#define LPFC_BSG_VENDOR_RAS_GET_LWPD 16
42#define LPFC_BSG_VENDOR_RAS_GET_FWLOG 17
43#define LPFC_BSG_VENDOR_RAS_GET_CONFIG 18
44#define LPFC_BSG_VENDOR_RAS_SET_CONFIG 19
41 45
42struct set_ct_event {46struct set_ct_event {
43 uint32_t command;47 uint32_t command;
@@ -296,6 +300,38 @@ struct forced_link_speed_support_reply { · 252 unmodified lines
296 uint8_t supported;300 uint8_t supported;
297};301};
298 302
303struct lpfc_bsg_ras_req {
304 uint32_t command;
305};
306
307struct lpfc_bsg_get_fwlog_req {
308 uint32_t command;
309 uint32_t read_size;
310 uint32_t read_offset;
311};
312
313struct lpfc_bsg_get_ras_lwpd {
314 uint32_t offset;
315 uint32_t wrap_count;
316};
317
318struct lpfc_bsg_set_ras_config_req {
319 uint32_t command;
320 uint8_t action;
321#define LPFC_RASACTION_STOP_LOGGING 0x00
322#define LPFC_RASACTION_START_LOGGING 0x01
323 uint8_t log_level;
324};
325
326struct lpfc_bsg_get_ras_config_reply {
327 uint8_t state;
328#define LPFC_RASLOG_STATE_STOPPED 0x00
329#define LPFC_RASLOG_STATE_RUNNING 0x01
330 uint8_t log_level;
331 uint32_t log_buff_sz;
332};
333
334
299/* driver only */335/* driver only */
300#define SLI_CONFIG_NOT_HANDLED 0336#define SLI_CONFIG_NOT_HANDLED 0
301#define SLI_CONFIG_HANDLED 1337#define SLI_CONFIG_HANDLED 1
drivers/scsi/lpfc/lpfc_crtn.h+7−0
@@ -545,6 +545,13 @@ bool lpfc_find_next_oas_lun(struct lpfc_hba *, struct lpfc_name *, · 544 unmodified lines
545int lpfc_sli4_dump_page_a0(struct lpfc_hba *phba, struct lpfcMboxq *mbox);545int lpfc_sli4_dump_page_a0(struct lpfc_hba *phba, struct lpfcMboxq *mbox);
546void lpfc_mbx_cmpl_rdp_page_a0(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb);546void lpfc_mbx_cmpl_rdp_page_a0(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb);
547 547
548/* RAS Interface */
549void lpfc_sli4_ras_init(struct lpfc_hba *phba);
550void lpfc_sli4_ras_setup(struct lpfc_hba *phba);
551int lpfc_sli4_ras_fwlog_init(struct lpfc_hba *phba, uint32_t fwlog_level,
552 uint32_t fwlog_enable);
553int lpfc_check_fwlog_support(struct lpfc_hba *phba);
554
548/* NVME interfaces. */555/* NVME interfaces. */
549void lpfc_nvme_unregister_port(struct lpfc_vport *vport,556void lpfc_nvme_unregister_port(struct lpfc_vport *vport,
550 struct lpfc_nodelist *ndlp);557 struct lpfc_nodelist *ndlp);
drivers/scsi/lpfc/lpfc_ct.c+3−8
@@ -445,14 +445,14 @@ lpfc_find_vport_by_did(struct lpfc_hba *phba, uint32_t did) { · 444 unmodified lines
445 struct lpfc_vport *vport_curr;445 struct lpfc_vport *vport_curr;
446 unsigned long flags;446 unsigned long flags;
447 447
448 spin_lock_irqsave(&phba->hbalock, flags);448 spin_lock_irqsave(&phba->port_list_lock, flags);
449 list_for_each_entry(vport_curr, &phba->port_list, listentry) {449 list_for_each_entry(vport_curr, &phba->port_list, listentry) {
450 if ((vport_curr->fc_myDID) && (vport_curr->fc_myDID == did)) {450 if ((vport_curr->fc_myDID) && (vport_curr->fc_myDID == did)) {
451 spin_unlock_irqrestore(&phba->hbalock, flags);451 spin_unlock_irqrestore(&phba->port_list_lock, flags);
452 return vport_curr;452 return vport_curr;
453 }453 }
454 }454 }
455 spin_unlock_irqrestore(&phba->hbalock, flags);455 spin_unlock_irqrestore(&phba->port_list_lock, flags);
456 return NULL;456 return NULL;
457}457}
458 458
@@ -471,11 +471,6 @@ lpfc_prep_node_fc4type(struct lpfc_vport *vport, uint32_t Did, uint8_t fc4_type) · 12 unmodified lines
471 "Parse GID_FTrsp: did:x%x flg:x%x x%x",471 "Parse GID_FTrsp: did:x%x flg:x%x x%x",
472 Did, ndlp->nlp_flag, vport->fc_flag);472 Did, ndlp->nlp_flag, vport->fc_flag);
473 473
474 /* Don't assume the rport is always the previous
475 * FC4 type.
476 */
477 ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME);
478
479 /* By default, the driver expects to support FCP FC4 */474 /* By default, the driver expects to support FCP FC4 */
480 if (fc4_type == FC_TYPE_FCP)475 if (fc4_type == FC_TYPE_FCP)
481 ndlp->nlp_fc4_type |= NLP_FC4_FCP;476 ndlp->nlp_fc4_type |= NLP_FC4_FCP;
drivers/scsi/lpfc/lpfc_debugfs.c+0−2
@@ -550,7 +550,6 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) · 549 unmodified lines
550 struct lpfc_nodelist *ndlp;550 struct lpfc_nodelist *ndlp;
551 unsigned char *statep;551 unsigned char *statep;
552 struct nvme_fc_local_port *localport;552 struct nvme_fc_local_port *localport;
553 struct lpfc_nvmet_tgtport *tgtp;
554 struct nvme_fc_remote_port *nrport = NULL;553 struct nvme_fc_remote_port *nrport = NULL;
555 struct lpfc_nvme_rport *rport;554 struct lpfc_nvme_rport *rport;
556 555
@@ -654,7 +653,6 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) · 97 unmodified lines
654 "\nOutstanding IO x%x\n", outio);653 "\nOutstanding IO x%x\n", outio);
655 654
656 if (phba->nvmet_support && phba->targetport && (vport == phba->pport)) {655 if (phba->nvmet_support && phba->targetport && (vport == phba->pport)) {
657 tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
658 len += snprintf(buf + len, size - len,656 len += snprintf(buf + len, size - len,
659 "\nNVME Targetport Entry ...\n");657 "\nNVME Targetport Entry ...\n");
660 658
drivers/scsi/lpfc/lpfc_els.c+3−0
@@ -7673,8 +7673,11 @@ void · 7672 unmodified lines
7673lpfc_els_flush_all_cmd(struct lpfc_hba *phba)7673lpfc_els_flush_all_cmd(struct lpfc_hba *phba)
7674{7674{
7675 struct lpfc_vport *vport;7675 struct lpfc_vport *vport;
7676
7677 spin_lock_irq(&phba->port_list_lock);
7676 list_for_each_entry(vport, &phba->port_list, listentry)7678 list_for_each_entry(vport, &phba->port_list, listentry)
7677 lpfc_els_flush_cmd(vport);7679 lpfc_els_flush_cmd(vport);
7680 spin_unlock_irq(&phba->port_list_lock);
7678 7681
7679 return;7682 return;
7680}7683}
drivers/scsi/lpfc/lpfc_hbadisc.c+4−6
@@ -4193,7 +4193,7 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, · 4192 unmodified lines
4193 4193
4194 if (new_state == NLP_STE_MAPPED_NODE ||4194 if (new_state == NLP_STE_MAPPED_NODE ||
4195 new_state == NLP_STE_UNMAPPED_NODE) {4195 new_state == NLP_STE_UNMAPPED_NODE) {
4196 if (ndlp->nlp_fc4_type & NLP_FC4_FCP ||4196 if (ndlp->nlp_fc4_type ||
4197 ndlp->nlp_DID == Fabric_DID ||4197 ndlp->nlp_DID == Fabric_DID ||
4198 ndlp->nlp_DID == NameServer_DID ||4198 ndlp->nlp_DID == NameServer_DID ||
4199 ndlp->nlp_DID == FDMI_DID) {4199 ndlp->nlp_DID == FDMI_DID) {
@@ -5428,12 +5428,10 @@ static void · 1228 unmodified lines
5428lpfc_free_tx(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)5428lpfc_free_tx(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
5429{5429{
5430 LIST_HEAD(completions);5430 LIST_HEAD(completions);
5431 struct lpfc_sli *psli;
5432 IOCB_t *icmd;5431 IOCB_t *icmd;
5433 struct lpfc_iocbq *iocb, *next_iocb;5432 struct lpfc_iocbq *iocb, *next_iocb;
5434 struct lpfc_sli_ring *pring;5433 struct lpfc_sli_ring *pring;
5435 5434
5436 psli = &phba->sli;
5437 pring = lpfc_phba_elsring(phba);5435 pring = lpfc_phba_elsring(phba);
5438 if (unlikely(!pring))5436 if (unlikely(!pring))
5439 return;5437 return;
@@ -5938,14 +5936,14 @@ lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi) · 498 unmodified lines
5938 }5936 }
5939 }5937 }
5940 5938
5941 spin_lock_irqsave(&phba->hbalock, flags);5939 spin_lock_irqsave(&phba->port_list_lock, flags);
5942 list_for_each_entry(vport, &phba->port_list, listentry) {5940 list_for_each_entry(vport, &phba->port_list, listentry) {
5943 if (vport->vpi == i) {5941 if (vport->vpi == i) {
5944 spin_unlock_irqrestore(&phba->hbalock, flags);5942 spin_unlock_irqrestore(&phba->port_list_lock, flags);
5945 return vport;5943 return vport;
5946 }5944 }
5947 }5945 }
5948 spin_unlock_irqrestore(&phba->hbalock, flags);5946 spin_unlock_irqrestore(&phba->port_list_lock, flags);
5949 return NULL;5947 return NULL;
5950}5948}
5951 5949
drivers/scsi/lpfc/lpfc_hw4.h+45−0
@@ -186,6 +186,7 @@ struct lpfc_sli_intf { · 185 unmodified lines
186#define LPFC_CTL_PDEV_CTL_FRL_ALL 0x00186#define LPFC_CTL_PDEV_CTL_FRL_ALL 0x00
187#define LPFC_CTL_PDEV_CTL_FRL_FC_FCOE 0x10187#define LPFC_CTL_PDEV_CTL_FRL_FC_FCOE 0x10
188#define LPFC_CTL_PDEV_CTL_FRL_NIC 0x20188#define LPFC_CTL_PDEV_CTL_FRL_NIC 0x20
189#define LPFC_CTL_PDEV_CTL_DDL_RAS 0x1000000
189 190
190#define LPFC_FW_DUMP_REQUEST (LPFC_CTL_PDEV_CTL_DD | LPFC_CTL_PDEV_CTL_FRST)191#define LPFC_FW_DUMP_REQUEST (LPFC_CTL_PDEV_CTL_DD | LPFC_CTL_PDEV_CTL_FRST)
191 192
@@ -964,6 +965,7 @@ struct mbox_header { · 772 unmodified lines
964/* Subsystem Definitions */965/* Subsystem Definitions */
965#define LPFC_MBOX_SUBSYSTEM_NA 0x0966#define LPFC_MBOX_SUBSYSTEM_NA 0x0
966#define LPFC_MBOX_SUBSYSTEM_COMMON 0x1967#define LPFC_MBOX_SUBSYSTEM_COMMON 0x1
968#define LPFC_MBOX_SUBSYSTEM_LOWLEVEL 0xB
967#define LPFC_MBOX_SUBSYSTEM_FCOE 0xC969#define LPFC_MBOX_SUBSYSTEM_FCOE 0xC
968 970
969/* Device Specific Definitions */971/* Device Specific Definitions */
@@ -1030,6 +1032,9 @@ struct mbox_header { · 60 unmodified lines
1030#define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_STATE 0x221032#define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_STATE 0x22
1031#define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_LOOPBACK 0x231033#define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_LOOPBACK 0x23
1032 1034
1035/* Low level Opcodes */
1036#define LPFC_MBOX_OPCODE_SET_DIAG_LOG_OPTION 0x37
1037
1033/* Mailbox command structures */1038/* Mailbox command structures */
1034struct eq_context {1039struct eq_context {
1035 uint32_t word0;1040 uint32_t word0;
@@ -1162,6 +1167,45 @@ struct lpfc_mbx_nop { · 126 unmodified lines
1162 uint32_t context[2];1167 uint32_t context[2];
1163};1168};
1164 1169
1170
1171
1172struct lpfc_mbx_set_ras_fwlog {
1173 struct mbox_header header;
1174 union {
1175 struct {
1176 uint32_t word4;
1177#define lpfc_fwlog_enable_SHIFT 0
1178#define lpfc_fwlog_enable_MASK 0x00000001
1179#define lpfc_fwlog_enable_WORD word4
1180#define lpfc_fwlog_loglvl_SHIFT 8
1181#define lpfc_fwlog_loglvl_MASK 0x0000000F
1182#define lpfc_fwlog_loglvl_WORD word4
1183#define lpfc_fwlog_ra_SHIFT 15
1184#define lpfc_fwlog_ra_WORD 0x00000008
1185#define lpfc_fwlog_buffcnt_SHIFT 16
1186#define lpfc_fwlog_buffcnt_MASK 0x000000FF
1187#define lpfc_fwlog_buffcnt_WORD word4
1188#define lpfc_fwlog_buffsz_SHIFT 24
1189#define lpfc_fwlog_buffsz_MASK 0x000000FF
1190#define lpfc_fwlog_buffsz_WORD word4
1191 uint32_t word5;
1192#define lpfc_fwlog_acqe_SHIFT 0
1193#define lpfc_fwlog_acqe_MASK 0x0000FFFF
1194#define lpfc_fwlog_acqe_WORD word5
1195#define lpfc_fwlog_cqid_SHIFT 16
1196#define lpfc_fwlog_cqid_MASK 0x0000FFFF
1197#define lpfc_fwlog_cqid_WORD word5
1198#define LPFC_MAX_FWLOG_PAGE 16
1199 struct dma_address lwpd;
1200 struct dma_address buff_fwlog[LPFC_MAX_FWLOG_PAGE];
1201 } request;
1202 struct {
1203 uint32_t word0;
1204 } response;
1205 } u;
1206};
1207
1208
1165struct cq_context {1209struct cq_context {
1166 uint32_t word0;1210 uint32_t word0;
1167#define lpfc_cq_context_event_SHIFT 311211#define lpfc_cq_context_event_SHIFT 31
@@ -3868,6 +3912,7 @@ struct lpfc_mqe { · 2700 unmodified lines
3868 struct lpfc_mbx_memory_dump_type3 mem_dump_type3;3912 struct lpfc_mbx_memory_dump_type3 mem_dump_type3;
3869 struct lpfc_mbx_set_host_data set_host_data;3913 struct lpfc_mbx_set_host_data set_host_data;
3870 struct lpfc_mbx_nop nop;3914 struct lpfc_mbx_nop nop;
3915 struct lpfc_mbx_set_ras_fwlog ras_fwlog;
3871 } un;3916 } un;
3872};3917};
3873 3918
drivers/scsi/lpfc/lpfc_init.c+83−20
@@ -3956,7 +3956,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) · 3955 unmodified lines
3956 if (phba->sli_rev == LPFC_SLI_REV4) {3956 if (phba->sli_rev == LPFC_SLI_REV4) {
3957 shost->dma_boundary =3957 shost->dma_boundary =
3958 phba->sli4_hba.pc_sli4_params.sge_supp_len-1;3958 phba->sli4_hba.pc_sli4_params.sge_supp_len-1;
3959 shost->sg_tablesize = phba->cfg_sg_seg_cnt;3959 shost->sg_tablesize = phba->cfg_scsi_seg_cnt;
3960 }3960 }
3961 3961
3962 /*3962 /*
@@ -3988,9 +3988,9 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) · 25 unmodified lines
3988 if (error)3988 if (error)
3989 goto out_put_shost;3989 goto out_put_shost;
3990 3990
3991 spin_lock_irq(&phba->hbalock);3991 spin_lock_irq(&phba->port_list_lock);
3992 list_add_tail(&vport->listentry, &phba->port_list);3992 list_add_tail(&vport->listentry, &phba->port_list);
3993 spin_unlock_irq(&phba->hbalock);3993 spin_unlock_irq(&phba->port_list_lock);
3994 return vport;3994 return vport;
3995 3995
3996out_put_shost:3996out_put_shost:
@@ -4016,9 +4016,9 @@ destroy_port(struct lpfc_vport *vport) · 19 unmodified lines
4016 fc_remove_host(shost);4016 fc_remove_host(shost);
4017 scsi_remove_host(shost);4017 scsi_remove_host(shost);
4018 4018
4019 spin_lock_irq(&phba->hbalock);4019 spin_lock_irq(&phba->port_list_lock);
4020 list_del_init(&vport->listentry);4020 list_del_init(&vport->listentry);
4021 spin_unlock_irq(&phba->hbalock);4021 spin_unlock_irq(&phba->port_list_lock);
4022 4022
4023 lpfc_cleanup(vport);4023 lpfc_cleanup(vport);
4024 return;4024 return;
@@ -5621,7 +5621,10 @@ lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) · 1596 unmodified lines
5621 /* Initialize ndlp management spinlock */5621 /* Initialize ndlp management spinlock */
5622 spin_lock_init(&phba->ndlp_lock);5622 spin_lock_init(&phba->ndlp_lock);
5623 5623
5624 /* Initialize port_list spinlock */
5625 spin_lock_init(&phba->port_list_lock);
5624 INIT_LIST_HEAD(&phba->port_list);5626 INIT_LIST_HEAD(&phba->port_list);
5627
5625 INIT_LIST_HEAD(&phba->work_list);5628 INIT_LIST_HEAD(&phba->work_list);
5626 init_waitqueue_head(&phba->wait_4_mlo_m_q);5629 init_waitqueue_head(&phba->wait_4_mlo_m_q);
5627 5630
@@ -5919,8 +5922,6 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 291 unmodified lines
5919 * There are going to be 2 reserved SGEs: 1 FCP cmnd + 1 FCP rsp5922 * There are going to be 2 reserved SGEs: 1 FCP cmnd + 1 FCP rsp
5920 */5923 */
5921 max_buf_size = (2 * SLI4_PAGE_SIZE);5924 max_buf_size = (2 * SLI4_PAGE_SIZE);
5922 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SGL_SEG_CNT - extra)
5923 phba->cfg_sg_seg_cnt = LPFC_MAX_SGL_SEG_CNT - extra;
5924 5925
5925 /*5926 /*
5926 * Since lpfc_sg_seg_cnt is module param, the sg_dma_buf_size5927 * Since lpfc_sg_seg_cnt is module param, the sg_dma_buf_size
@@ -5942,9 +5943,16 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 15 unmodified lines
5942 /* Total SGEs for scsi_sg_list and scsi_sg_prot_list */5943 /* Total SGEs for scsi_sg_list and scsi_sg_prot_list */
5943 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT;5944 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT;
5944 5945
5945 if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SLI4_SEG_CNT_DIF)5946 /*
5946 phba->cfg_sg_seg_cnt =5947 * If supporting DIF, reduce the seg count for scsi to
5947 LPFC_MAX_SG_SLI4_SEG_CNT_DIF;5948 * allow room for the DIF sges.
5949 */
5950 if (phba->cfg_enable_bg &&
5951 phba->cfg_sg_seg_cnt > LPFC_MAX_BG_SLI4_SEG_CNT_DIF)
5952 phba->cfg_scsi_seg_cnt = LPFC_MAX_BG_SLI4_SEG_CNT_DIF;
5953 else
5954 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt;
5955
5948 } else {5956 } else {
5949 /*5957 /*
5950 * The scsi_buf for a regular I/O holds the FCP cmnd,5958 * The scsi_buf for a regular I/O holds the FCP cmnd,
@@ -5958,6 +5966,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 7 unmodified lines
5958 5966
5959 /* Total SGEs for scsi_sg_list */5967 /* Total SGEs for scsi_sg_list */
5960 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra;5968 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra;
5969 phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt;
5961 5970
5962 /*5971 /*
5963 * NOTE: if (phba->cfg_sg_seg_cnt + extra) <= 256 we only5972 * NOTE: if (phba->cfg_sg_seg_cnt + extra) <= 256 we only
@@ -5965,10 +5974,22 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 1 unmodified line
5965 */5974 */
5966 }5975 }
5967 5976
5977 /* Limit to LPFC_MAX_NVME_SEG_CNT for NVME. */
5978 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) {
5979 if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) {
5980 lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT,
5981 "6300 Reducing NVME sg segment "
5982 "cnt to %d\n",
5983 LPFC_MAX_NVME_SEG_CNT);
5984 phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT;
5985 } else
5986 phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt;
5987 }
5988
5968 /* Initialize the host templates with the updated values. */5989 /* Initialize the host templates with the updated values. */
5969 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt;5990 lpfc_vport_template.sg_tablesize = phba->cfg_scsi_seg_cnt;
5970 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt;5991 lpfc_template.sg_tablesize = phba->cfg_scsi_seg_cnt;
5971 lpfc_template_no_hr.sg_tablesize = phba->cfg_sg_seg_cnt;5992 lpfc_template_no_hr.sg_tablesize = phba->cfg_scsi_seg_cnt;
5972 5993
5973 if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ)5994 if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ)
5974 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ;5995 phba->cfg_sg_dma_buf_size = LPFC_MIN_SG_SLI4_BUF_SZ;
@@ -5977,9 +5998,11 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 2 unmodified lines
5977 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size);5998 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size);
5978 5999
5979 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP,6000 lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_FCP,
5980 "9087 sg_tablesize:%d dmabuf_size:%d total_sge:%d\n",6001 "9087 sg_seg_cnt:%d dmabuf_size:%d "
6002 "total:%d scsi:%d nvme:%d\n",
5981 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size,6003 phba->cfg_sg_seg_cnt, phba->cfg_sg_dma_buf_size,
5982 phba->cfg_total_seg_cnt);6004 phba->cfg_total_seg_cnt, phba->cfg_scsi_seg_cnt,
6005 phba->cfg_nvme_seg_cnt);
5983 6006
5984 /* Initialize buffer queue management fields */6007 /* Initialize buffer queue management fields */
5985 INIT_LIST_HEAD(&phba->hbqs[LPFC_ELS_HBQ].hbq_buffer_list);6008 INIT_LIST_HEAD(&phba->hbqs[LPFC_ELS_HBQ].hbq_buffer_list);
@@ -6205,6 +6228,9 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 219 unmodified lines
6205 if (phba->cfg_fof)6228 if (phba->cfg_fof)
6206 fof_vectors = 1;6229 fof_vectors = 1;
6207 6230
6231 /* Verify RAS support on adapter */
6232 lpfc_sli4_ras_init(phba);
6233
6208 /* Verify all the SLI4 queues */6234 /* Verify all the SLI4 queues */
6209 rc = lpfc_sli4_queue_verify(phba);6235 rc = lpfc_sli4_queue_verify(phba);
6210 if (rc)6236 if (rc)
@@ -7967,7 +7993,7 @@ lpfc_sli4_read_config(struct lpfc_hba *phba) · 1756 unmodified lines
7967 else7993 else
7968 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,7994 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
7969 "3028 GET_FUNCTION_CONFIG: failed to find "7995 "3028 GET_FUNCTION_CONFIG: failed to find "
7970 "Resrouce Descriptor:x%x\n",7996 "Resource Descriptor:x%x\n",
7971 LPFC_RSRC_DESC_TYPE_FCFCOE);7997 LPFC_RSRC_DESC_TYPE_FCFCOE);
7972 7998
7973read_cfg_out:7999read_cfg_out:
@@ -10492,6 +10518,14 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phba) · 2518 unmodified lines
10492 /* Stop kthread signal shall trigger work_done one more time */10518 /* Stop kthread signal shall trigger work_done one more time */
10493 kthread_stop(phba->worker_thread);10519 kthread_stop(phba->worker_thread);
10494 10520
10521 /* Disable FW logging to host memory */
10522 writel(LPFC_CTL_PDEV_CTL_DDL_RAS,
10523 phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET);
10524
10525 /* Free RAS DMA memory */
10526 if (phba->ras_fwlog.ras_enabled == true)
10527 lpfc_sli4_ras_dma_free(phba);
10528
10495 /* Unset the queues shared with the hardware then release all10529 /* Unset the queues shared with the hardware then release all
10496 * allocated resources.10530 * allocated resources.
10497 */10531 */
@@ -10737,6 +10771,7 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) · 239 unmodified lines
10737 phba->mds_diags_support = 1;10771 phba->mds_diags_support = 1;
10738 else10772 else
10739 phba->mds_diags_support = 0;10773 phba->mds_diags_support = 0;
10774
10740 return 0;10775 return 0;
10741}10776}
10742 10777
@@ -10965,9 +11000,9 @@ lpfc_pci_remove_one_s3(struct pci_dev *pdev) · 222 unmodified lines
10965 kfree(phba->vpi_ids);11000 kfree(phba->vpi_ids);
10966 11001
10967 lpfc_stop_hba_timers(phba);11002 lpfc_stop_hba_timers(phba);
10968 spin_lock_irq(&phba->hbalock);11003 spin_lock_irq(&phba->port_list_lock);
10969 list_del_init(&vport->listentry);11004 list_del_init(&vport->listentry);
10970 spin_unlock_irq(&phba->hbalock);11005 spin_unlock_irq(&phba->port_list_lock);
10971 11006
10972 lpfc_debugfs_terminate(vport);11007 lpfc_debugfs_terminate(vport);
10973 11008
@@ -11694,6 +11729,10 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) · 720 unmodified lines
11694 11729
11695 /* Check if there are static vports to be created. */11730 /* Check if there are static vports to be created. */
11696 lpfc_create_static_vport(phba);11731 lpfc_create_static_vport(phba);
11732
11733 /* Enable RAS FW log support */
11734 lpfc_sli4_ras_setup(phba);
11735
11697 return 0;11736 return 0;
11698 11737
11699out_disable_intr:11738out_disable_intr:
@@ -11773,9 +11812,9 @@ lpfc_pci_remove_one_s4(struct pci_dev *pdev) · 73 unmodified lines
11773 lpfc_sli4_hba_unset(phba);11812 lpfc_sli4_hba_unset(phba);
11774 11813
11775 lpfc_stop_hba_timers(phba);11814 lpfc_stop_hba_timers(phba);
11776 spin_lock_irq(&phba->hbalock);11815 spin_lock_irq(&phba->port_list_lock);
11777 list_del_init(&vport->listentry);11816 list_del_init(&vport->listentry);
11778 spin_unlock_irq(&phba->hbalock);11817 spin_unlock_irq(&phba->port_list_lock);
11779 11818
11780 /* Perform scsi free before driver resource_unset since scsi11819 /* Perform scsi free before driver resource_unset since scsi
11781 * buffers are released to their corresponding pools here.11820 * buffers are released to their corresponding pools here.
@@ -12419,6 +12458,30 @@ lpfc_sli4_oas_verify(struct lpfc_hba *phba) · 637 unmodified lines
12419 return;12458 return;
12420}12459}
12421 12460
12461/**
12462 * lpfc_sli4_ras_init - Verify RAS-FW log is supported by this adapter
12463 * @phba: pointer to lpfc hba data structure.
12464 *
12465 * This routine checks to see if RAS is supported by the adapter. Check the
12466 * function through which RAS support enablement is to be done.
12467 **/
12468void
12469lpfc_sli4_ras_init(struct lpfc_hba *phba)
12470{
12471 switch (phba->pcidev->device) {
12472 case PCI_DEVICE_ID_LANCER_G6_FC:
12473 case PCI_DEVICE_ID_LANCER_G7_FC:
12474 phba->ras_fwlog.ras_hwsupport = true;
12475 if (phba->cfg_ras_fwlog_func == PCI_FUNC(phba->pcidev->devfn))
12476 phba->ras_fwlog.ras_enabled = true;
12477 else
12478 phba->ras_fwlog.ras_enabled = false;
12479 break;
12480 default:
12481 phba->ras_fwlog.ras_hwsupport = false;
12482 }
12483}
12484
12422/**12485/**
12423 * lpfc_fof_queue_setup - Set up all the fof queues12486 * lpfc_fof_queue_setup - Set up all the fof queues
12424 * @phba: pointer to lpfc hba data structure.12487 * @phba: pointer to lpfc hba data structure.
drivers/scsi/lpfc/lpfc_nportdisc.c+3−0
@@ -2318,6 +2318,7 @@ lpfc_device_recov_unmap_node(struct lpfc_vport *vport, · 2317 unmodified lines
2318 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);2318 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
2319 spin_lock_irq(shost->host_lock);2319 spin_lock_irq(shost->host_lock);
2320 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);2320 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
2321 ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME);
2321 spin_unlock_irq(shost->host_lock);2322 spin_unlock_irq(shost->host_lock);
2322 lpfc_disc_set_adisc(vport, ndlp);2323 lpfc_disc_set_adisc(vport, ndlp);
2323 2324
@@ -2395,6 +2396,7 @@ lpfc_device_recov_mapped_node(struct lpfc_vport *vport, · 71 unmodified lines
2395 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);2396 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
2396 spin_lock_irq(shost->host_lock);2397 spin_lock_irq(shost->host_lock);
2397 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);2398 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
2399 ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME);
2398 spin_unlock_irq(shost->host_lock);2400 spin_unlock_irq(shost->host_lock);
2399 lpfc_disc_set_adisc(vport, ndlp);2401 lpfc_disc_set_adisc(vport, ndlp);
2400 return ndlp->nlp_state;2402 return ndlp->nlp_state;
@@ -2652,6 +2654,7 @@ lpfc_device_recov_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, · 251 unmodified lines
2652 lpfc_cancel_retry_delay_tmo(vport, ndlp);2654 lpfc_cancel_retry_delay_tmo(vport, ndlp);
2653 spin_lock_irq(shost->host_lock);2655 spin_lock_irq(shost->host_lock);
2654 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);2656 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
2657 ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME);
2655 spin_unlock_irq(shost->host_lock);2658 spin_unlock_irq(shost->host_lock);
2656 return ndlp->nlp_state;2659 return ndlp->nlp_state;
2657}2660}
drivers/scsi/lpfc/lpfc_nvme.c+5−14
@@ -282,7 +282,7 @@ lpfc_nvme_delete_queue(struct nvme_fc_local_port *pnvme_lport, · 281 unmodified lines
282 vport = lport->vport;282 vport = lport->vport;
283 283
284 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME,284 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME,
285 "6001 ENTER. lpfc_pnvme %p, qidx x%xi qhandle %p\n",285 "6001 ENTER. lpfc_pnvme %p, qidx x%x qhandle %p\n",
286 lport, qidx, handle);286 lport, qidx, handle);
287 kfree(handle);287 kfree(handle);
288}288}
@@ -2235,13 +2235,11 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc) · 1946 unmodified lines
2235 struct sli4_sge *sgl;2235 struct sli4_sge *sgl;
2236 dma_addr_t pdma_phys_sgl;2236 dma_addr_t pdma_phys_sgl;
2237 uint16_t iotag, lxri = 0;2237 uint16_t iotag, lxri = 0;
2238 int bcnt, num_posted, sgl_size;2238 int bcnt, num_posted;
2239 LIST_HEAD(prep_nblist);2239 LIST_HEAD(prep_nblist);
2240 LIST_HEAD(post_nblist);2240 LIST_HEAD(post_nblist);
2241 LIST_HEAD(nvme_nblist);2241 LIST_HEAD(nvme_nblist);
2242 2242
2243 sgl_size = phba->cfg_sg_dma_buf_size;
2244
2245 for (bcnt = 0; bcnt < num_to_alloc; bcnt++) {2243 for (bcnt = 0; bcnt < num_to_alloc; bcnt++) {
2246 lpfc_ncmd = kzalloc(sizeof(struct lpfc_nvme_buf), GFP_KERNEL);2244 lpfc_ncmd = kzalloc(sizeof(struct lpfc_nvme_buf), GFP_KERNEL);
2247 if (!lpfc_ncmd)2245 if (!lpfc_ncmd)
@@ -2462,17 +2460,10 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) · 214 unmodified lines
2462 nfcp_info.node_name = wwn_to_u64(vport->fc_nodename.u.wwn);2460 nfcp_info.node_name = wwn_to_u64(vport->fc_nodename.u.wwn);
2463 nfcp_info.port_name = wwn_to_u64(vport->fc_portname.u.wwn);2461 nfcp_info.port_name = wwn_to_u64(vport->fc_portname.u.wwn);
2464 2462
2465 /* Limit to LPFC_MAX_NVME_SEG_CNT.2463 /* We need to tell the transport layer + 1 because it takes page
2466 * For now need + 1 to get around NVME transport logic.2464 * alignment into account. When space for the SGL is allocated we
2465 * allocate + 3, one for cmd, one for rsp and one for this alignment
2467 */2466 */
2468 if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) {
2469 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME | LOG_INIT,
2470 "6300 Reducing sg segment cnt to %d\n",
2471 LPFC_MAX_NVME_SEG_CNT);
2472 phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT;
2473 } else {
2474 phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt;
2475 }
2476 lpfc_nvme_template.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1;2467 lpfc_nvme_template.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1;
2477 lpfc_nvme_template.max_hw_queues = phba->cfg_nvme_io_channel;2468 lpfc_nvme_template.max_hw_queues = phba->cfg_nvme_io_channel;
2478 2469
drivers/scsi/lpfc/lpfc_nvmet.c+6−14
@@ -1339,15 +1339,14 @@ lpfc_nvmet_setup_io_context(struct lpfc_hba *phba) · 1338 unmodified lines
1339 idx = 0;1339 idx = 0;
1340 }1340 }
1341 1341
1342 infop = phba->sli4_hba.nvmet_ctx_info;1342 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) {
1343 for (j = 0; j < phba->cfg_nvmet_mrq; j++) {1343 for (j = 0; j < phba->cfg_nvmet_mrq; j++) {
1344 for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) {1344 infop = lpfc_get_ctx_list(phba, i, j);
1345 lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT,1345 lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT,
1346 "6408 TOTAL NVMET ctx for CPU %d "1346 "6408 TOTAL NVMET ctx for CPU %d "
1347 "MRQ %d: cnt %d nextcpu %p\n",1347 "MRQ %d: cnt %d nextcpu %p\n",
1348 i, j, infop->nvmet_ctx_list_cnt,1348 i, j, infop->nvmet_ctx_list_cnt,
1349 infop->nvmet_ctx_next_cpu);1349 infop->nvmet_ctx_next_cpu);
1350 infop++;
1351 }1350 }
1352 }1351 }
1353 return 0;1352 return 0;
@@ -1373,17 +1372,10 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba) · 19 unmodified lines
1373 pinfo.port_name = wwn_to_u64(vport->fc_portname.u.wwn);1372 pinfo.port_name = wwn_to_u64(vport->fc_portname.u.wwn);
1374 pinfo.port_id = vport->fc_myDID;1373 pinfo.port_id = vport->fc_myDID;
1375 1374
1376 /* Limit to LPFC_MAX_NVME_SEG_CNT.1375 /* We need to tell the transport layer + 1 because it takes page
1377 * For now need + 1 to get around NVME transport logic.1376 * alignment into account. When space for the SGL is allocated we
1377 * allocate + 3, one for cmd, one for rsp and one for this alignment
1378 */1378 */
1379 if (phba->cfg_sg_seg_cnt > LPFC_MAX_NVME_SEG_CNT) {
1380 lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT,
1381 "6400 Reducing sg segment cnt to %d\n",
1382 LPFC_MAX_NVME_SEG_CNT);
1383 phba->cfg_nvme_seg_cnt = LPFC_MAX_NVME_SEG_CNT;
1384 } else {
1385 phba->cfg_nvme_seg_cnt = phba->cfg_sg_seg_cnt;
1386 }
1387 lpfc_tgttemplate.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1;1379 lpfc_tgttemplate.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1;
1388 lpfc_tgttemplate.max_hw_queues = phba->cfg_nvme_io_channel;1380 lpfc_tgttemplate.max_hw_queues = phba->cfg_nvme_io_channel;
1389 lpfc_tgttemplate.target_features = NVMET_FCTGTFEAT_READDATA_RSP;1381 lpfc_tgttemplate.target_features = NVMET_FCTGTFEAT_READDATA_RSP;
drivers/scsi/lpfc/lpfc_scsi.c+22−12
@@ -202,8 +202,8 @@ lpfc_sli4_set_rsp_sgl_last(struct lpfc_hba *phba, · 201 unmodified lines
202static void202static void
203lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)203lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
204{204{
205 struct lpfc_rport_data *rdata = lpfc_cmd->rdata;205 struct lpfc_rport_data *rdata;
206 struct lpfc_nodelist *pnode = rdata->pnode;206 struct lpfc_nodelist *pnode;
207 struct scsi_cmnd *cmd = lpfc_cmd->pCmd;207 struct scsi_cmnd *cmd = lpfc_cmd->pCmd;
208 unsigned long flags;208 unsigned long flags;
209 struct Scsi_Host *shost = cmd->device->host;209 struct Scsi_Host *shost = cmd->device->host;
@@ -211,17 +211,19 @@ lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) · 1 unmodified line
211 unsigned long latency;211 unsigned long latency;
212 int i;212 int i;
213 213
214 if (cmd->result)214 if (!vport->stat_data_enabled ||
215 vport->stat_data_blocked ||
216 (cmd->result))
215 return;217 return;
216 218
217 latency = jiffies_to_msecs((long)jiffies - (long)lpfc_cmd->start_time);219 latency = jiffies_to_msecs((long)jiffies - (long)lpfc_cmd->start_time);
220 rdata = lpfc_cmd->rdata;
221 pnode = rdata->pnode;
218 222
219 spin_lock_irqsave(shost->host_lock, flags);223 spin_lock_irqsave(shost->host_lock, flags);
220 if (!vport->stat_data_enabled ||224 if (!pnode ||
221 vport->stat_data_blocked ||225 !pnode->lat_data ||
222 !pnode ||226 (phba->bucket_type == LPFC_NO_BUCKET)) {
223 !pnode->lat_data ||
224 (phba->bucket_type == LPFC_NO_BUCKET)) {
225 spin_unlock_irqrestore(shost->host_lock, flags);227 spin_unlock_irqrestore(shost->host_lock, flags);
226 return;228 return;
227 }229 }
@@ -1050,7 +1052,7 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) · 822 unmodified lines
1050 if (!found)1052 if (!found)
1051 return NULL;1053 return NULL;
1052 1054
1053 if (lpfc_ndlp_check_qdepth(phba, ndlp) && lpfc_cmd) {1055 if (lpfc_ndlp_check_qdepth(phba, ndlp)) {
1054 atomic_inc(&ndlp->cmd_pending);1056 atomic_inc(&ndlp->cmd_pending);
1055 lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH;1057 lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH;
1056 }1058 }
@@ -4158,9 +4160,17 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, · 3101 unmodified lines
4158 }4160 }
4159 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd);4161 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd);
4160 4162
4161 spin_lock_irqsave(&phba->hbalock, flags);4163 /* If pCmd was set to NULL from abort path, do not call scsi_done */
4162 lpfc_cmd->pCmd = NULL;4164 if (xchg(&lpfc_cmd->pCmd, NULL) == NULL) {
4163 spin_unlock_irqrestore(&phba->hbalock, flags);4165 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
4166 "0711 FCP cmd already NULL, sid: 0x%06x, "
4167 "did: 0x%06x, oxid: 0x%04x\n",
4168 vport->fc_myDID,
4169 (pnode) ? pnode->nlp_DID : 0,
4170 phba->sli_rev == LPFC_SLI_REV4 ?
4171 lpfc_cmd->cur_iocbq.sli4_xritag : 0xffff);
4172 return;
4173 }
4164 4174
4165 /* The sdev is not guaranteed to be valid post scsi_done upcall. */4175 /* The sdev is not guaranteed to be valid post scsi_done upcall. */
4166 cmd->scsi_done(cmd);4176 cmd->scsi_done(cmd);
drivers/scsi/lpfc/lpfc_sli.c+297−13
@@ -392,11 +392,7 @@ lpfc_sli4_if6_eq_clr_intr(struct lpfc_queue *q) · 391 unmodified lines
392 struct lpfc_register doorbell;392 struct lpfc_register doorbell;
393 393
394 doorbell.word0 = 0;394 doorbell.word0 = 0;
395 bf_set(lpfc_eqcq_doorbell_eqci, &doorbell, 1);395 bf_set(lpfc_if6_eq_doorbell_eqid, &doorbell, q->queue_id);
396 bf_set(lpfc_eqcq_doorbell_qt, &doorbell, LPFC_QUEUE_TYPE_EVENT);
397 bf_set(lpfc_eqcq_doorbell_eqid_hi, &doorbell,
398 (q->queue_id >> LPFC_EQID_HI_FIELD_SHIFT));
399 bf_set(lpfc_eqcq_doorbell_eqid_lo, &doorbell, q->queue_id);
400 writel(doorbell.word0, q->phba->sli4_hba.EQDBregaddr);396 writel(doorbell.word0, q->phba->sli4_hba.EQDBregaddr);
401}397}
402 398
@@ -3797,6 +3793,7 @@ lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba, · 3394 unmodified lines
3797 struct hbq_dmabuf *dmabuf;3793 struct hbq_dmabuf *dmabuf;
3798 struct lpfc_cq_event *cq_event;3794 struct lpfc_cq_event *cq_event;
3799 unsigned long iflag;3795 unsigned long iflag;
3796 int count = 0;
3800 3797
3801 spin_lock_irqsave(&phba->hbalock, iflag);3798 spin_lock_irqsave(&phba->hbalock, iflag);
3802 phba->hba_flag &= ~HBA_SP_QUEUE_EVT;3799 phba->hba_flag &= ~HBA_SP_QUEUE_EVT;
@@ -3818,16 +3815,22 @@ lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba, · 15 unmodified lines
3818 if (irspiocbq)3815 if (irspiocbq)
3819 lpfc_sli_sp_handle_rspiocb(phba, pring,3816 lpfc_sli_sp_handle_rspiocb(phba, pring,
3820 irspiocbq);3817 irspiocbq);
3818 count++;
3821 break;3819 break;
3822 case CQE_CODE_RECEIVE:3820 case CQE_CODE_RECEIVE:
3823 case CQE_CODE_RECEIVE_V1:3821 case CQE_CODE_RECEIVE_V1:
3824 dmabuf = container_of(cq_event, struct hbq_dmabuf,3822 dmabuf = container_of(cq_event, struct hbq_dmabuf,
3825 cq_event);3823 cq_event);
3826 lpfc_sli4_handle_received_buffer(phba, dmabuf);3824 lpfc_sli4_handle_received_buffer(phba, dmabuf);
3825 count++;
3827 break;3826 break;
3828 default:3827 default:
3829 break;3828 break;
3830 }3829 }
3830
3831 /* Limit the number of events to 64 to avoid soft lockups */
3832 if (count == 64)
3833 break;
3831 }3834 }
3832}3835}
3833 3836
@@ -6145,6 +6148,271 @@ lpfc_set_features(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox, · 2311 unmodified lines
6145 return;6148 return;
6146}6149}
6147 6150
6151/**
6152 * lpfc_sli4_ras_dma_free - Free memory allocated for FW logging.
6153 * @phba: Pointer to HBA context object.
6154 *
6155 * This function is called to free memory allocated for RAS FW logging
6156 * support in the driver.
6157 **/
6158void
6159lpfc_sli4_ras_dma_free(struct lpfc_hba *phba)
6160{
6161 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog;
6162 struct lpfc_dmabuf *dmabuf, *next;
6163
6164 if (!list_empty(&ras_fwlog->fwlog_buff_list)) {
6165 list_for_each_entry_safe(dmabuf, next,
6166 &ras_fwlog->fwlog_buff_list,
6167 list) {
6168 list_del(&dmabuf->list);
6169 dma_free_coherent(&phba->pcidev->dev,
6170 LPFC_RAS_MAX_ENTRY_SIZE,
6171 dmabuf->virt, dmabuf->phys);
6172 kfree(dmabuf);
6173 }
6174 }
6175
6176 if (ras_fwlog->lwpd.virt) {
6177 dma_free_coherent(&phba->pcidev->dev,
6178 sizeof(uint32_t) * 2,
6179 ras_fwlog->lwpd.virt,
6180 ras_fwlog->lwpd.phys);
6181 ras_fwlog->lwpd.virt = NULL;
6182 }
6183
6184 ras_fwlog->ras_active = false;
6185}
6186
6187/**
6188 * lpfc_sli4_ras_dma_alloc: Allocate memory for FW support
6189 * @phba: Pointer to HBA context object.
6190 * @fwlog_buff_count: Count of buffers to be created.
6191 *
6192 * This routine DMA memory for Log Write Position Data[LPWD] and buffer
6193 * to update FW log is posted to the adapter.
6194 * Buffer count is calculated based on module param ras_fwlog_buffsize
6195 * Size of each buffer posted to FW is 64K.
6196 **/
6197
6198static int
6199lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba,
6200 uint32_t fwlog_buff_count)
6201{
6202 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog;
6203 struct lpfc_dmabuf *dmabuf;
6204 int rc = 0, i = 0;
6205
6206 /* Initialize List */
6207 INIT_LIST_HEAD(&ras_fwlog->fwlog_buff_list);
6208
6209 /* Allocate memory for the LWPD */
6210 ras_fwlog->lwpd.virt = dma_alloc_coherent(&phba->pcidev->dev,
6211 sizeof(uint32_t) * 2,
6212 &ras_fwlog->lwpd.phys,
6213 GFP_KERNEL);
6214 if (!ras_fwlog->lwpd.virt) {
6215 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
6216 "6185 LWPD Memory Alloc Failed\n");
6217
6218 return -ENOMEM;
6219 }
6220
6221 ras_fwlog->fw_buffcount = fwlog_buff_count;
6222 for (i = 0; i < ras_fwlog->fw_buffcount; i++) {
6223 dmabuf = kzalloc(sizeof(struct lpfc_dmabuf),
6224 GFP_KERNEL);
6225 if (!dmabuf) {
6226 rc = -ENOMEM;
6227 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
6228 "6186 Memory Alloc failed FW logging");
6229 goto free_mem;
6230 }
6231
6232 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev,
6233 LPFC_RAS_MAX_ENTRY_SIZE,
6234 &dmabuf->phys,
6235 GFP_KERNEL);
6236 if (!dmabuf->virt) {
6237 kfree(dmabuf);
6238 rc = -ENOMEM;
6239 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
6240 "6187 DMA Alloc Failed FW logging");
6241 goto free_mem;
6242 }
6243 memset(dmabuf->virt, 0, LPFC_RAS_MAX_ENTRY_SIZE);
6244 dmabuf->buffer_tag = i;
6245 list_add_tail(&dmabuf->list, &ras_fwlog->fwlog_buff_list);
6246 }
6247
6248free_mem:
6249 if (rc)
6250 lpfc_sli4_ras_dma_free(phba);
6251
6252 return rc;
6253}
6254
6255/**
6256 * lpfc_sli4_ras_mbox_cmpl: Completion handler for RAS MBX command
6257 * @phba: pointer to lpfc hba data structure.
6258 * @pmboxq: pointer to the driver internal queue element for mailbox command.
6259 *
6260 * Completion handler for driver's RAS MBX command to the device.
6261 **/
6262static void
6263lpfc_sli4_ras_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
6264{
6265 MAILBOX_t *mb;
6266 union lpfc_sli4_cfg_shdr *shdr;
6267 uint32_t shdr_status, shdr_add_status;
6268 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog;
6269
6270 mb = &pmb->u.mb;
6271
6272 shdr = (union lpfc_sli4_cfg_shdr *)
6273 &pmb->u.mqe.un.ras_fwlog.header.cfg_shdr;
6274 shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response);
6275 shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response);
6276
6277 if (mb->mbxStatus != MBX_SUCCESS || shdr_status) {
6278 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX,
6279 "6188 FW LOG mailbox "
6280 "completed with status x%x add_status x%x,"
6281 " mbx status x%x\n",
6282 shdr_status, shdr_add_status, mb->mbxStatus);
6283 goto disable_ras;
6284 }
6285
6286 ras_fwlog->ras_active = true;
6287 mempool_free(pmb, phba->mbox_mem_pool);
6288
6289 return;
6290
6291disable_ras:
6292 /* Free RAS DMA memory */
6293 lpfc_sli4_ras_dma_free(phba);
6294 mempool_free(pmb, phba->mbox_mem_pool);
6295}
6296
6297/**
6298 * lpfc_sli4_ras_fwlog_init: Initialize memory and post RAS MBX command
6299 * @phba: pointer to lpfc hba data structure.
6300 * @fwlog_level: Logging verbosity level.
6301 * @fwlog_enable: Enable/Disable logging.
6302 *
6303 * Initialize memory and post mailbox command to enable FW logging in host
6304 * memory.
6305 **/
6306int
6307lpfc_sli4_ras_fwlog_init(struct lpfc_hba *phba,
6308 uint32_t fwlog_level,
6309 uint32_t fwlog_enable)
6310{
6311 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog;
6312 struct lpfc_mbx_set_ras_fwlog *mbx_fwlog = NULL;
6313 struct lpfc_dmabuf *dmabuf;
6314 LPFC_MBOXQ_t *mbox;
6315 uint32_t len = 0, fwlog_buffsize, fwlog_entry_count;
6316 int rc = 0;
6317
6318 fwlog_buffsize = (LPFC_RAS_MIN_BUFF_POST_SIZE *
6319 phba->cfg_ras_fwlog_buffsize);
6320 fwlog_entry_count = (fwlog_buffsize/LPFC_RAS_MAX_ENTRY_SIZE);
6321
6322 /*
6323 * If re-enabling FW logging support use earlier allocated
6324 * DMA buffers while posting MBX command.
6325 **/
6326 if (!ras_fwlog->lwpd.virt) {
6327 rc = lpfc_sli4_ras_dma_alloc(phba, fwlog_entry_count);
6328 if (rc) {
6329 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
6330 "6189 RAS FW Log Support Not Enabled");
6331 return rc;
6332 }
6333 }
6334
6335 /* Setup Mailbox command */
6336 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
6337 if (!mbox) {
6338 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
6339 "6190 RAS MBX Alloc Failed");
6340 rc = -ENOMEM;
6341 goto mem_free;
6342 }
6343
6344 ras_fwlog->fw_loglevel = fwlog_level;
6345 len = (sizeof(struct lpfc_mbx_set_ras_fwlog) -
6346 sizeof(struct lpfc_sli4_cfg_mhdr));
6347
6348 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_LOWLEVEL,
6349 LPFC_MBOX_OPCODE_SET_DIAG_LOG_OPTION,
6350 len, LPFC_SLI4_MBX_EMBED);
6351
6352 mbx_fwlog = (struct lpfc_mbx_set_ras_fwlog *)&mbox->u.mqe.un.ras_fwlog;
6353 bf_set(lpfc_fwlog_enable, &mbx_fwlog->u.request,
6354 fwlog_enable);
6355 bf_set(lpfc_fwlog_loglvl, &mbx_fwlog->u.request,
6356 ras_fwlog->fw_loglevel);
6357 bf_set(lpfc_fwlog_buffcnt, &mbx_fwlog->u.request,
6358 ras_fwlog->fw_buffcount);
6359 bf_set(lpfc_fwlog_buffsz, &mbx_fwlog->u.request,
6360 LPFC_RAS_MAX_ENTRY_SIZE/SLI4_PAGE_SIZE);
6361
6362 /* Update DMA buffer address */
6363 list_for_each_entry(dmabuf, &ras_fwlog->fwlog_buff_list, list) {
6364 memset(dmabuf->virt, 0, LPFC_RAS_MAX_ENTRY_SIZE);
6365
6366 mbx_fwlog->u.request.buff_fwlog[dmabuf->buffer_tag].addr_lo =
6367 putPaddrLow(dmabuf->phys);
6368
6369 mbx_fwlog->u.request.buff_fwlog[dmabuf->buffer_tag].addr_hi =
6370 putPaddrHigh(dmabuf->phys);
6371 }
6372
6373 /* Update LPWD address */
6374 mbx_fwlog->u.request.lwpd.addr_lo = putPaddrLow(ras_fwlog->lwpd.phys);
6375 mbx_fwlog->u.request.lwpd.addr_hi = putPaddrHigh(ras_fwlog->lwpd.phys);
6376
6377 mbox->vport = phba->pport;
6378 mbox->mbox_cmpl = lpfc_sli4_ras_mbox_cmpl;
6379
6380 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
6381
6382 if (rc == MBX_NOT_FINISHED) {
6383 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
6384 "6191 RAS Mailbox failed. "
6385 "status %d mbxStatus : x%x", rc,
6386 bf_get(lpfc_mqe_status, &mbox->u.mqe));
6387 mempool_free(mbox, phba->mbox_mem_pool);
6388 rc = -EIO;
6389 goto mem_free;
6390 } else
6391 rc = 0;
6392mem_free:
6393 if (rc)
6394 lpfc_sli4_ras_dma_free(phba);
6395
6396 return rc;
6397}
6398
6399/**
6400 * lpfc_sli4_ras_setup - Check if RAS supported on the adapter
6401 * @phba: Pointer to HBA context object.
6402 *
6403 * Check if RAS is supported on the adapter and initialize it.
6404 **/
6405void
6406lpfc_sli4_ras_setup(struct lpfc_hba *phba)
6407{
6408 /* Check RAS FW Log needs to be enabled or not */
6409 if (lpfc_check_fwlog_support(phba))
6410 return;
6411
6412 lpfc_sli4_ras_fwlog_init(phba, phba->cfg_ras_fwlog_level,
6413 LPFC_RAS_ENABLE_LOGGING);
6414}
6415
6148/**6416/**
6149 * lpfc_sli4_alloc_resource_identifiers - Allocate all SLI4 resource extents.6417 * lpfc_sli4_alloc_resource_identifiers - Allocate all SLI4 resource extents.
6150 * @phba: Pointer to HBA context object.6418 * @phba: Pointer to HBA context object.
@@ -10266,8 +10534,12 @@ lpfc_sli_mbox_sys_flush(struct lpfc_hba *phba) · 4115 unmodified lines
10266 LPFC_MBOXQ_t *pmb;10534 LPFC_MBOXQ_t *pmb;
10267 unsigned long iflag;10535 unsigned long iflag;
10268 10536
10537 /* Disable softirqs, including timers from obtaining phba->hbalock */
10538 local_bh_disable();
10539
10269 /* Flush all the mailbox commands in the mbox system */10540 /* Flush all the mailbox commands in the mbox system */
10270 spin_lock_irqsave(&phba->hbalock, iflag);10541 spin_lock_irqsave(&phba->hbalock, iflag);
10542
10271 /* The pending mailbox command queue */10543 /* The pending mailbox command queue */
10272 list_splice_init(&phba->sli.mboxq, &completions);10544 list_splice_init(&phba->sli.mboxq, &completions);
10273 /* The outstanding active mailbox command */10545 /* The outstanding active mailbox command */
@@ -10280,6 +10552,9 @@ lpfc_sli_mbox_sys_flush(struct lpfc_hba *phba) · 6 unmodified lines
10280 list_splice_init(&phba->sli.mboxq_cmpl, &completions);10552 list_splice_init(&phba->sli.mboxq_cmpl, &completions);
10281 spin_unlock_irqrestore(&phba->hbalock, iflag);10553 spin_unlock_irqrestore(&phba->hbalock, iflag);
10282 10554
10555 /* Enable softirqs again, done with phba->hbalock */
10556 local_bh_enable();
10557
10283 /* Return all flushed mailbox commands with MBX_NOT_FINISHED status */10558 /* Return all flushed mailbox commands with MBX_NOT_FINISHED status */
10284 while (!list_empty(&completions)) {10559 while (!list_empty(&completions)) {
10285 list_remove_head(&completions, pmb, LPFC_MBOXQ_t, list);10560 list_remove_head(&completions, pmb, LPFC_MBOXQ_t, list);
@@ -10419,6 +10694,9 @@ lpfc_sli_hba_down(struct lpfc_hba *phba) · 133 unmodified lines
10419 10694
10420 lpfc_hba_down_prep(phba);10695 lpfc_hba_down_prep(phba);
10421 10696
10697 /* Disable softirqs, including timers from obtaining phba->hbalock */
10698 local_bh_disable();
10699
10422 lpfc_fabric_abort_hba(phba);10700 lpfc_fabric_abort_hba(phba);
10423 10701
10424 spin_lock_irqsave(&phba->hbalock, flags);10702 spin_lock_irqsave(&phba->hbalock, flags);
@@ -10472,6 +10750,9 @@ lpfc_sli_hba_down(struct lpfc_hba *phba) · 47 unmodified lines
10472 kfree(buf_ptr);10750 kfree(buf_ptr);
10473 }10751 }
10474 10752
10753 /* Enable softirqs again, done with phba->hbalock */
10754 local_bh_enable();
10755
10475 /* Return any active mbox cmds */10756 /* Return any active mbox cmds */
10476 del_timer_sync(&psli->mbox_tmo);10757 del_timer_sync(&psli->mbox_tmo);
10477 10758
@@ -11775,6 +12056,9 @@ lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba, int mbx_action) · 1297 unmodified lines
11775 }12056 }
11776 timeout = msecs_to_jiffies(LPFC_MBOX_TMO * 1000) + jiffies;12057 timeout = msecs_to_jiffies(LPFC_MBOX_TMO * 1000) + jiffies;
11777 12058
12059 /* Disable softirqs, including timers from obtaining phba->hbalock */
12060 local_bh_disable();
12061
11778 spin_lock_irq(&phba->hbalock);12062 spin_lock_irq(&phba->hbalock);
11779 psli->sli_flag |= LPFC_SLI_ASYNC_MBX_BLK;12063 psli->sli_flag |= LPFC_SLI_ASYNC_MBX_BLK;
11780 12064
@@ -11788,6 +12072,9 @@ lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba, int mbx_action) · 7 unmodified lines
11788 1000) + jiffies;12072 1000) + jiffies;
11789 spin_unlock_irq(&phba->hbalock);12073 spin_unlock_irq(&phba->hbalock);
11790 12074
12075 /* Enable softirqs again, done with phba->hbalock */
12076 local_bh_enable();
12077
11791 while (phba->sli.mbox_active) {12078 while (phba->sli.mbox_active) {
11792 /* Check active mailbox complete status every 2ms */12079 /* Check active mailbox complete status every 2ms */
11793 msleep(2);12080 msleep(2);
@@ -11797,9 +12084,13 @@ lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba, int mbx_action) · 3 unmodified lines
11797 */12084 */
11798 break;12085 break;
11799 }12086 }
11800 } else12087 } else {
11801 spin_unlock_irq(&phba->hbalock);12088 spin_unlock_irq(&phba->hbalock);
11802 12089
12090 /* Enable softirqs again, done with phba->hbalock */
12091 local_bh_enable();
12092 }
12093
11803 lpfc_sli_mbox_sys_flush(phba);12094 lpfc_sli_mbox_sys_flush(phba);
11804}12095}
11805 12096
@@ -13136,7 +13427,6 @@ static bool · 1330 unmodified lines
13136lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)13427lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
13137{13428{
13138 bool workposted = false;13429 bool workposted = false;
13139 struct fc_frame_header *fc_hdr;
13140 struct lpfc_queue *hrq = phba->sli4_hba.hdr_rq;13430 struct lpfc_queue *hrq = phba->sli4_hba.hdr_rq;
13141 struct lpfc_queue *drq = phba->sli4_hba.dat_rq;13431 struct lpfc_queue *drq = phba->sli4_hba.dat_rq;
13142 struct lpfc_nvmet_tgtport *tgtp;13432 struct lpfc_nvmet_tgtport *tgtp;
@@ -13173,9 +13463,6 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe) · 30 unmodified lines
13173 hrq->RQ_buf_posted--;13463 hrq->RQ_buf_posted--;
13174 memcpy(&dma_buf->cq_event.cqe.rcqe_cmpl, rcqe, sizeof(*rcqe));13464 memcpy(&dma_buf->cq_event.cqe.rcqe_cmpl, rcqe, sizeof(*rcqe));
13175 13465
13176 /* If a NVME LS event (type 0x28), treat it as Fast path */
13177 fc_hdr = (struct fc_frame_header *)dma_buf->hbuf.virt;
13178
13179 /* save off the frame for the word thread to process */13466 /* save off the frame for the word thread to process */
13180 list_add_tail(&dma_buf->cq_event.list,13467 list_add_tail(&dma_buf->cq_event.list,
13181 &phba->sli4_hba.sp_queue_event);13468 &phba->sli4_hba.sp_queue_event);
@@ -14558,13 +14845,10 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq, · 1376 unmodified lines
14558 int rc, length, status = 0;14845 int rc, length, status = 0;
14559 uint32_t shdr_status, shdr_add_status;14846 uint32_t shdr_status, shdr_add_status;
14560 union lpfc_sli4_cfg_shdr *shdr;14847 union lpfc_sli4_cfg_shdr *shdr;
14561 uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz;
14562 14848
14563 /* sanity check on queue memory */14849 /* sanity check on queue memory */
14564 if (!cq || !eq)14850 if (!cq || !eq)
14565 return -ENODEV;14851 return -ENODEV;
14566 if (!phba->sli4_hba.pc_sli4_params.supported)
14567 hw_page_size = cq->page_size;
14568 14852
14569 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);14853 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
14570 if (!mbox)14854 if (!mbox)
drivers/scsi/lpfc/lpfc_sli4.h+1−0
@@ -886,3 +886,4 @@ int lpfc_sli4_unregister_fcf(struct lpfc_hba *); · 885 unmodified lines
886int lpfc_sli4_post_status_check(struct lpfc_hba *);886int lpfc_sli4_post_status_check(struct lpfc_hba *);
887uint8_t lpfc_sli_config_mbox_subsys_get(struct lpfc_hba *, LPFC_MBOXQ_t *);887uint8_t lpfc_sli_config_mbox_subsys_get(struct lpfc_hba *, LPFC_MBOXQ_t *);
888uint8_t lpfc_sli_config_mbox_opcode_get(struct lpfc_hba *, LPFC_MBOXQ_t *);888uint8_t lpfc_sli_config_mbox_opcode_get(struct lpfc_hba *, LPFC_MBOXQ_t *);
889void lpfc_sli4_ras_dma_free(struct lpfc_hba *phba);
drivers/scsi/lpfc/lpfc_version.h+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
20 * included with this package. *20 * included with this package. *
21 *******************************************************************/21 *******************************************************************/
22 22
23#define LPFC_DRIVER_VERSION "12.0.0.6"23#define LPFC_DRIVER_VERSION "12.0.0.7"
24#define LPFC_DRIVER_NAME "lpfc"24#define LPFC_DRIVER_NAME "lpfc"
25 25
26/* Used for SLI 2/3 */26/* Used for SLI 2/3 */
drivers/scsi/lpfc/lpfc_vport.c+7−7
@@ -207,7 +207,7 @@ lpfc_unique_wwpn(struct lpfc_hba *phba, struct lpfc_vport *new_vport) · 206 unmodified lines
207 struct lpfc_vport *vport;207 struct lpfc_vport *vport;
208 unsigned long flags;208 unsigned long flags;
209 209
210 spin_lock_irqsave(&phba->hbalock, flags);210 spin_lock_irqsave(&phba->port_list_lock, flags);
211 list_for_each_entry(vport, &phba->port_list, listentry) {211 list_for_each_entry(vport, &phba->port_list, listentry) {
212 if (vport == new_vport)212 if (vport == new_vport)
213 continue;213 continue;
@@ -215,11 +215,11 @@ lpfc_unique_wwpn(struct lpfc_hba *phba, struct lpfc_vport *new_vport) · 1 unmodified line
215 if (memcmp(&vport->fc_sparam.portName,215 if (memcmp(&vport->fc_sparam.portName,
216 &new_vport->fc_sparam.portName,216 &new_vport->fc_sparam.portName,
217 sizeof(struct lpfc_name)) == 0) {217 sizeof(struct lpfc_name)) == 0) {
218 spin_unlock_irqrestore(&phba->hbalock, flags);218 spin_unlock_irqrestore(&phba->port_list_lock, flags);
219 return 0;219 return 0;
220 }220 }
221 }221 }
222 spin_unlock_irqrestore(&phba->hbalock, flags);222 spin_unlock_irqrestore(&phba->port_list_lock, flags);
223 return 1;223 return 1;
224}224}
225 225
@@ -825,9 +825,9 @@ skip_logo: · 599 unmodified lines
825 825
826 lpfc_free_vpi(phba, vport->vpi);826 lpfc_free_vpi(phba, vport->vpi);
827 vport->work_port_events = 0;827 vport->work_port_events = 0;
828 spin_lock_irq(&phba->hbalock);828 spin_lock_irq(&phba->port_list_lock);
829 list_del_init(&vport->listentry);829 list_del_init(&vport->listentry);
830 spin_unlock_irq(&phba->hbalock);830 spin_unlock_irq(&phba->port_list_lock);
831 lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,831 lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
832 "1828 Vport Deleted.\n");832 "1828 Vport Deleted.\n");
833 scsi_host_put(shost);833 scsi_host_put(shost);
@@ -844,7 +844,7 @@ lpfc_create_vport_work_array(struct lpfc_hba *phba) · 10 unmodified lines
844 GFP_KERNEL);844 GFP_KERNEL);
845 if (vports == NULL)845 if (vports == NULL)
846 return NULL;846 return NULL;
847 spin_lock_irq(&phba->hbalock);847 spin_lock_irq(&phba->port_list_lock);
848 list_for_each_entry(port_iterator, &phba->port_list, listentry) {848 list_for_each_entry(port_iterator, &phba->port_list, listentry) {
849 if (port_iterator->load_flag & FC_UNLOADING)849 if (port_iterator->load_flag & FC_UNLOADING)
850 continue;850 continue;
@@ -856,7 +856,7 @@ lpfc_create_vport_work_array(struct lpfc_hba *phba) · 5 unmodified lines
856 }856 }
857 vports[index++] = port_iterator;857 vports[index++] = port_iterator;
858 }858 }
859 spin_unlock_irq(&phba->hbalock);859 spin_unlock_irq(&phba->port_list_lock);
860 return vports;860 return vports;
861}861}
862 862
drivers/scsi/mac_esp.c+11−206
@@ -52,14 +52,12 @@ struct mac_esp_priv { · 51 unmodified lines
52 struct esp *esp;52 struct esp *esp;
53 void __iomem *pdma_regs;53 void __iomem *pdma_regs;
54 void __iomem *pdma_io;54 void __iomem *pdma_io;
55 int error;
56};55};
57static struct esp *esp_chips[2];56static struct esp *esp_chips[2];
58static DEFINE_SPINLOCK(esp_chips_lock);57static DEFINE_SPINLOCK(esp_chips_lock);
59 58
60#define MAC_ESP_GET_PRIV(esp) ((struct mac_esp_priv *) \59#define MAC_ESP_GET_PRIV(esp) ((struct mac_esp_priv *) \
61 platform_get_drvdata((struct platform_device *) \60 dev_get_drvdata((esp)->dev))
62 (esp->dev)))
63 61
64static inline void mac_esp_write8(struct esp *esp, u8 val, unsigned long reg)62static inline void mac_esp_write8(struct esp *esp, u8 val, unsigned long reg)
65{63{
@@ -71,38 +69,6 @@ static inline u8 mac_esp_read8(struct esp *esp, unsigned long reg) · 5 unmodified lines
71 return nubus_readb(esp->regs + reg * 16);69 return nubus_readb(esp->regs + reg * 16);
72}70}
73 71
74/* For pseudo DMA and PIO we need the virtual address
75 * so this address mapping is the identity mapping.
76 */
77
78static dma_addr_t mac_esp_map_single(struct esp *esp, void *buf,
79 size_t sz, int dir)
80{
81 return (dma_addr_t)buf;
82}
83
84static int mac_esp_map_sg(struct esp *esp, struct scatterlist *sg,
85 int num_sg, int dir)
86{
87 int i;
88
89 for (i = 0; i < num_sg; i++)
90 sg[i].dma_address = (u32)sg_virt(&sg[i]);
91 return num_sg;
92}
93
94static void mac_esp_unmap_single(struct esp *esp, dma_addr_t addr,
95 size_t sz, int dir)
96{
97 /* Nothing to do. */
98}
99
100static void mac_esp_unmap_sg(struct esp *esp, struct scatterlist *sg,
101 int num_sg, int dir)
102{
103 /* Nothing to do. */
104}
105
106static void mac_esp_reset_dma(struct esp *esp)72static void mac_esp_reset_dma(struct esp *esp)
107{73{
108 /* Nothing to do. */74 /* Nothing to do. */
@@ -120,12 +86,11 @@ static void mac_esp_dma_invalidate(struct esp *esp) · 11 unmodified lines
120 86
121static int mac_esp_dma_error(struct esp *esp)87static int mac_esp_dma_error(struct esp *esp)
122{88{
123 return MAC_ESP_GET_PRIV(esp)->error;89 return esp->send_cmd_error;
124}90}
125 91
126static inline int mac_esp_wait_for_empty_fifo(struct esp *esp)92static inline int mac_esp_wait_for_empty_fifo(struct esp *esp)
127{93{
128 struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp);
129 int i = 500000;94 int i = 500000;
130 95
131 do {96 do {
@@ -140,7 +105,7 @@ static inline int mac_esp_wait_for_empty_fifo(struct esp *esp) · 8 unmodified lines
140 105
141 printk(KERN_ERR PFX "FIFO is not empty (sreg %02x)\n",106 printk(KERN_ERR PFX "FIFO is not empty (sreg %02x)\n",
142 esp_read8(ESP_STATUS));107 esp_read8(ESP_STATUS));
143 mep->error = 1;108 esp->send_cmd_error = 1;
144 return 1;109 return 1;
145}110}
146 111
@@ -166,7 +131,7 @@ static inline int mac_esp_wait_for_dreq(struct esp *esp) · 19 unmodified lines
166 131
167 printk(KERN_ERR PFX "PDMA timeout (sreg %02x)\n",132 printk(KERN_ERR PFX "PDMA timeout (sreg %02x)\n",
168 esp_read8(ESP_STATUS));133 esp_read8(ESP_STATUS));
169 mep->error = 1;134 esp->send_cmd_error = 1;
170 return 1;135 return 1;
171}136}
172 137
@@ -233,7 +198,7 @@ static void mac_esp_send_pdma_cmd(struct esp *esp, u32 addr, u32 esp_count, · 60 unmodified lines
233{198{
234 struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp);199 struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp);
235 200
236 mep->error = 0;201 esp->send_cmd_error = 0;
237 202
238 if (!write)203 if (!write)
239 scsi_esp_cmd(esp, ESP_CMD_FLUSH);204 scsi_esp_cmd(esp, ESP_CMD_FLUSH);
@@ -271,164 +236,6 @@ static void mac_esp_send_pdma_cmd(struct esp *esp, u32 addr, u32 esp_count, · 31 unmodified lines
271 } while (esp_count);236 } while (esp_count);
272}237}
273 238
274/*
275 * Programmed IO routines follow.
276 */
277
278static inline unsigned int mac_esp_wait_for_fifo(struct esp *esp)
279{
280 int i = 500000;
281
282 do {
283 unsigned int fbytes = esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES;
284
285 if (fbytes)
286 return fbytes;
287
288 udelay(2);
289 } while (--i);
290
291 printk(KERN_ERR PFX "FIFO is empty (sreg %02x)\n",
292 esp_read8(ESP_STATUS));
293 return 0;
294}
295
296static inline int mac_esp_wait_for_intr(struct esp *esp)
297{
298 struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp);
299 int i = 500000;
300
301 do {
302 esp->sreg = esp_read8(ESP_STATUS);
303 if (esp->sreg & ESP_STAT_INTR)
304 return 0;
305
306 udelay(2);
307 } while (--i);
308
309 printk(KERN_ERR PFX "IRQ timeout (sreg %02x)\n", esp->sreg);
310 mep->error = 1;
311 return 1;
312}
313
314#define MAC_ESP_PIO_LOOP(operands, reg1) \
315 asm volatile ( \
316 "1: moveb " operands " \n" \
317 " subqw #1,%1 \n" \
318 " jbne 1b \n" \
319 : "+a" (addr), "+r" (reg1) \
320 : "a" (fifo))
321
322#define MAC_ESP_PIO_FILL(operands, reg1) \
323 asm volatile ( \
324 " moveb " operands " \n" \
325 " moveb " operands " \n" \
326 " moveb " operands " \n" \
327 " moveb " operands " \n" \
328 " moveb " operands " \n" \
329 " moveb " operands " \n" \
330 " moveb " operands " \n" \
331 " moveb " operands " \n" \
332 " moveb " operands " \n" \
333 " moveb " operands " \n" \
334 " moveb " operands " \n" \
335 " moveb " operands " \n" \
336 " moveb " operands " \n" \
337 " moveb " operands " \n" \
338 " moveb " operands " \n" \
339 " moveb " operands " \n" \
340 " subqw #8,%1 \n" \
341 " subqw #8,%1 \n" \
342 : "+a" (addr), "+r" (reg1) \
343 : "a" (fifo))
344
345#define MAC_ESP_FIFO_SIZE 16
346
347static void mac_esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
348 u32 dma_count, int write, u8 cmd)
349{
350 struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp);
351 u8 __iomem *fifo = esp->regs + ESP_FDATA * 16;
352 u8 phase = esp->sreg & ESP_STAT_PMASK;
353
354 cmd &= ~ESP_CMD_DMA;
355 mep->error = 0;
356
357 if (write) {
358 u8 *dst = (u8 *)addr;
359 u8 mask = ~(phase == ESP_MIP ? ESP_INTR_FDONE : ESP_INTR_BSERV);
360
361 scsi_esp_cmd(esp, cmd);
362
363 while (1) {
364 if (!mac_esp_wait_for_fifo(esp))
365 break;
366
367 *dst++ = esp_read8(ESP_FDATA);
368 --esp_count;
369
370 if (!esp_count)
371 break;
372
373 if (mac_esp_wait_for_intr(esp))
374 break;
375
376 if ((esp->sreg & ESP_STAT_PMASK) != phase)
377 break;
378
379 esp->ireg = esp_read8(ESP_INTRPT);
380 if (esp->ireg & mask) {
381 mep->error = 1;
382 break;
383 }
384
385 if (phase == ESP_MIP)
386 scsi_esp_cmd(esp, ESP_CMD_MOK);
387
388 scsi_esp_cmd(esp, ESP_CMD_TI);
389 }
390 } else {
391 scsi_esp_cmd(esp, ESP_CMD_FLUSH);
392
393 if (esp_count >= MAC_ESP_FIFO_SIZE)
394 MAC_ESP_PIO_FILL("%0@+,%2@", esp_count);
395 else
396 MAC_ESP_PIO_LOOP("%0@+,%2@", esp_count);
397
398 scsi_esp_cmd(esp, cmd);
399
400 while (esp_count) {
401 unsigned int n;
402
403 if (mac_esp_wait_for_intr(esp))
404 break;
405
406 if ((esp->sreg & ESP_STAT_PMASK) != phase)
407 break;
408
409 esp->ireg = esp_read8(ESP_INTRPT);
410 if (esp->ireg & ~ESP_INTR_BSERV) {
411 mep->error = 1;
412 break;
413 }
414
415 n = MAC_ESP_FIFO_SIZE -
416 (esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES);
417 if (n > esp_count)
418 n = esp_count;
419
420 if (n == MAC_ESP_FIFO_SIZE) {
421 MAC_ESP_PIO_FILL("%0@+,%2@", esp_count);
422 } else {
423 esp_count -= n;
424 MAC_ESP_PIO_LOOP("%0@+,%2@", n);
425 }
426
427 scsi_esp_cmd(esp, ESP_CMD_TI);
428 }
429 }
430}
431
432static int mac_esp_irq_pending(struct esp *esp)239static int mac_esp_irq_pending(struct esp *esp)
433{240{
434 if (esp_read8(ESP_STATUS) & ESP_STAT_INTR)241 if (esp_read8(ESP_STATUS) & ESP_STAT_INTR)
@@ -470,10 +277,6 @@ static irqreturn_t mac_scsi_esp_intr(int irq, void *dev_id) · 35 unmodified lines
470static struct esp_driver_ops mac_esp_ops = {277static struct esp_driver_ops mac_esp_ops = {
471 .esp_write8 = mac_esp_write8,278 .esp_write8 = mac_esp_write8,
472 .esp_read8 = mac_esp_read8,279 .esp_read8 = mac_esp_read8,
473 .map_single = mac_esp_map_single,
474 .map_sg = mac_esp_map_sg,
475 .unmap_single = mac_esp_unmap_single,
476 .unmap_sg = mac_esp_unmap_sg,
477 .irq_pending = mac_esp_irq_pending,280 .irq_pending = mac_esp_irq_pending,
478 .dma_length_limit = mac_esp_dma_length_limit,281 .dma_length_limit = mac_esp_dma_length_limit,
479 .reset_dma = mac_esp_reset_dma,282 .reset_dma = mac_esp_reset_dma,
@@ -508,7 +311,7 @@ static int esp_mac_probe(struct platform_device *dev) · 28 unmodified lines
508 esp = shost_priv(host);311 esp = shost_priv(host);
509 312
510 esp->host = host;313 esp->host = host;
511 esp->dev = dev;314 esp->dev = &dev->dev;
512 315
513 esp->command_block = kzalloc(16, GFP_KERNEL);316 esp->command_block = kzalloc(16, GFP_KERNEL);
514 if (!esp->command_block)317 if (!esp->command_block)
@@ -551,14 +354,16 @@ static int esp_mac_probe(struct platform_device *dev) · 36 unmodified lines
551 mep->pdma_regs = NULL;354 mep->pdma_regs = NULL;
552 break;355 break;
553 }356 }
357 esp->fifo_reg = esp->regs + ESP_FDATA * 16;
554 358
555 esp->ops = &mac_esp_ops;359 esp->ops = &mac_esp_ops;
360 esp->flags = ESP_FLAG_NO_DMA_MAP;
556 if (mep->pdma_io == NULL) {361 if (mep->pdma_io == NULL) {
557 printk(KERN_INFO PFX "using PIO for controller %d\n", dev->id);362 printk(KERN_INFO PFX "using PIO for controller %d\n", dev->id);
558 esp_write8(0, ESP_TCLOW);363 esp_write8(0, ESP_TCLOW);
559 esp_write8(0, ESP_TCMED);364 esp_write8(0, ESP_TCMED);
560 esp->flags = ESP_FLAG_DISABLE_SYNC;365 esp->flags |= ESP_FLAG_DISABLE_SYNC;
561 mac_esp_ops.send_dma_cmd = mac_esp_send_pio_cmd;366 mac_esp_ops.send_dma_cmd = esp_send_pio_cmd;
562 } else {367 } else {
563 printk(KERN_INFO PFX "using PDMA for controller %d\n", dev->id);368 printk(KERN_INFO PFX "using PDMA for controller %d\n", dev->id);
564 }369 }
@@ -577,7 +382,7 @@ static int esp_mac_probe(struct platform_device *dev) · 12 unmodified lines
577 esp_chips[dev->id] = esp;382 esp_chips[dev->id] = esp;
578 spin_unlock(&esp_chips_lock);383 spin_unlock(&esp_chips_lock);
579 384
580 err = scsi_esp_register(esp, &dev->dev);385 err = scsi_esp_register(esp);
581 if (err)386 if (err)
582 goto fail_free_irq;387 goto fail_free_irq;
583 388
drivers/scsi/megaraid/megaraid_mbox.c+28−89
@@ -201,13 +201,6 @@ int mraid_debug_level = CL_ANN; · 200 unmodified lines
201module_param_named(debug_level, mraid_debug_level, int, 0);201module_param_named(debug_level, mraid_debug_level, int, 0);
202MODULE_PARM_DESC(debug_level, "Debug level for driver (default=0)");202MODULE_PARM_DESC(debug_level, "Debug level for driver (default=0)");
203 203
204/*
205 * ### global data ###
206 */
207static uint8_t megaraid_mbox_version[8] =
208 { 0x02, 0x20, 0x04, 0x06, 3, 7, 20, 5 };
209
210
211/*204/*
212 * PCI table for all supported controllers.205 * PCI table for all supported controllers.
213 */206 */
@@ -457,10 +450,9 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 243 unmodified lines
457 450
458 // Setup the default DMA mask. This would be changed later on451 // Setup the default DMA mask. This would be changed later on
459 // depending on hardware capabilities452 // depending on hardware capabilities
460 if (pci_set_dma_mask(adapter->pdev, DMA_BIT_MASK(32)) != 0) {453 if (dma_set_mask(&adapter->pdev->dev, DMA_BIT_MASK(32))) {
461
462 con_log(CL_ANN, (KERN_WARNING454 con_log(CL_ANN, (KERN_WARNING
463 "megaraid: pci_set_dma_mask failed:%d\n", __LINE__));455 "megaraid: dma_set_mask failed:%d\n", __LINE__));
464 456
465 goto out_free_adapter;457 goto out_free_adapter;
466 }458 }
@@ -484,7 +476,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 17 unmodified lines
484 // Start the mailbox based controller476 // Start the mailbox based controller
485 if (megaraid_init_mbox(adapter) != 0) {477 if (megaraid_init_mbox(adapter) != 0) {
486 con_log(CL_ANN, (KERN_WARNING478 con_log(CL_ANN, (KERN_WARNING
487 "megaraid: maibox adapter did not initialize\n"));479 "megaraid: mailbox adapter did not initialize\n"));
488 480
489 goto out_free_adapter;481 goto out_free_adapter;
490 }482 }
@@ -878,11 +870,12 @@ megaraid_init_mbox(adapter_t *adapter) · 387 unmodified lines
878 adapter->pdev->device == PCI_DEVICE_ID_PERC4_DI_EVERGLADES) ||870 adapter->pdev->device == PCI_DEVICE_ID_PERC4_DI_EVERGLADES) ||
879 (adapter->pdev->vendor == PCI_VENDOR_ID_DELL &&871 (adapter->pdev->vendor == PCI_VENDOR_ID_DELL &&
880 adapter->pdev->device == PCI_DEVICE_ID_PERC4E_DI_KOBUK)) {872 adapter->pdev->device == PCI_DEVICE_ID_PERC4E_DI_KOBUK)) {
881 if (pci_set_dma_mask(adapter->pdev, DMA_BIT_MASK(64))) {873 if (dma_set_mask(&adapter->pdev->dev, DMA_BIT_MASK(64))) {
882 con_log(CL_ANN, (KERN_WARNING874 con_log(CL_ANN, (KERN_WARNING
883 "megaraid: DMA mask for 64-bit failed\n"));875 "megaraid: DMA mask for 64-bit failed\n"));
884 876
885 if (pci_set_dma_mask (adapter->pdev, DMA_BIT_MASK(32))) {877 if (dma_set_mask(&adapter->pdev->dev,
878 DMA_BIT_MASK(32))) {
886 con_log(CL_ANN, (KERN_WARNING879 con_log(CL_ANN, (KERN_WARNING
887 "megaraid: 32-bit DMA mask failed\n"));880 "megaraid: 32-bit DMA mask failed\n"));
888 goto out_free_sysfs_res;881 goto out_free_sysfs_res;
@@ -950,7 +943,7 @@ megaraid_fini_mbox(adapter_t *adapter) · 61 unmodified lines
950 * megaraid_alloc_cmd_packets - allocate shared mailbox943 * megaraid_alloc_cmd_packets - allocate shared mailbox
951 * @adapter : soft state of the raid controller944 * @adapter : soft state of the raid controller
952 *945 *
953 * Allocate and align the shared mailbox. This maibox is used to issue946 * Allocate and align the shared mailbox. This mailbox is used to issue
954 * all the commands. For IO based controllers, the mailbox is also registered947 * all the commands. For IO based controllers, the mailbox is also registered
955 * with the FW. Allocate memory for all commands as well.948 * with the FW. Allocate memory for all commands as well.
956 * This is our big allocator.949 * This is our big allocator.
@@ -975,9 +968,9 @@ megaraid_alloc_cmd_packets(adapter_t *adapter) · 18 unmodified lines
975 * Allocate the common 16-byte aligned memory for the handshake968 * Allocate the common 16-byte aligned memory for the handshake
976 * mailbox.969 * mailbox.
977 */970 */
978 raid_dev->una_mbox64 = pci_zalloc_consistent(adapter->pdev,971 raid_dev->una_mbox64 = dma_zalloc_coherent(&adapter->pdev->dev,
979 sizeof(mbox64_t),972 sizeof(mbox64_t), &raid_dev->una_mbox64_dma,
980 &raid_dev->una_mbox64_dma);973 GFP_KERNEL);
981 974
982 if (!raid_dev->una_mbox64) {975 if (!raid_dev->una_mbox64) {
983 con_log(CL_ANN, (KERN_WARNING976 con_log(CL_ANN, (KERN_WARNING
@@ -1003,8 +996,8 @@ megaraid_alloc_cmd_packets(adapter_t *adapter) · 19 unmodified lines
1003 align;996 align;
1004 997
1005 // Allocate memory for commands issued internally998 // Allocate memory for commands issued internally
1006 adapter->ibuf = pci_zalloc_consistent(pdev, MBOX_IBUF_SIZE,999 adapter->ibuf = dma_zalloc_coherent(&pdev->dev, MBOX_IBUF_SIZE,
1007 &adapter->ibuf_dma_h);1000 &adapter->ibuf_dma_h, GFP_KERNEL);
1008 if (!adapter->ibuf) {1001 if (!adapter->ibuf) {
1009 1002
1010 con_log(CL_ANN, (KERN_WARNING1003 con_log(CL_ANN, (KERN_WARNING
@@ -1082,7 +1075,7 @@ megaraid_alloc_cmd_packets(adapter_t *adapter) · 71 unmodified lines
1082 1075
1083 scb->scp = NULL;1076 scb->scp = NULL;
1084 scb->state = SCB_FREE;1077 scb->state = SCB_FREE;
1085 scb->dma_direction = PCI_DMA_NONE;1078 scb->dma_direction = DMA_NONE;
1086 scb->dma_type = MRAID_DMA_NONE;1079 scb->dma_type = MRAID_DMA_NONE;
1087 scb->dev_channel = -1;1080 scb->dev_channel = -1;
1088 scb->dev_target = -1;1081 scb->dev_target = -1;
@@ -1098,10 +1091,10 @@ out_teardown_dma_pools: · 9 unmodified lines
1098out_free_scb_list:1091out_free_scb_list:
1099 kfree(adapter->kscb_list);1092 kfree(adapter->kscb_list);
1100out_free_ibuf:1093out_free_ibuf:
1101 pci_free_consistent(pdev, MBOX_IBUF_SIZE, (void *)adapter->ibuf,1094 dma_free_coherent(&pdev->dev, MBOX_IBUF_SIZE, (void *)adapter->ibuf,
1102 adapter->ibuf_dma_h);1095 adapter->ibuf_dma_h);
1103out_free_common_mbox:1096out_free_common_mbox:
1104 pci_free_consistent(adapter->pdev, sizeof(mbox64_t),1097 dma_free_coherent(&adapter->pdev->dev, sizeof(mbox64_t),
1105 (caddr_t)raid_dev->una_mbox64, raid_dev->una_mbox64_dma);1098 (caddr_t)raid_dev->una_mbox64, raid_dev->una_mbox64_dma);
1106 1099
1107 return -1;1100 return -1;
@@ -1123,10 +1116,10 @@ megaraid_free_cmd_packets(adapter_t *adapter) · 15 unmodified lines
1123 1116
1124 kfree(adapter->kscb_list);1117 kfree(adapter->kscb_list);
1125 1118
1126 pci_free_consistent(adapter->pdev, MBOX_IBUF_SIZE,1119 dma_free_coherent(&adapter->pdev->dev, MBOX_IBUF_SIZE,
1127 (void *)adapter->ibuf, adapter->ibuf_dma_h);1120 (void *)adapter->ibuf, adapter->ibuf_dma_h);
1128 1121
1129 pci_free_consistent(adapter->pdev, sizeof(mbox64_t),1122 dma_free_coherent(&adapter->pdev->dev, sizeof(mbox64_t),
1130 (caddr_t)raid_dev->una_mbox64, raid_dev->una_mbox64_dma);1123 (caddr_t)raid_dev->una_mbox64, raid_dev->una_mbox64_dma);
1131 return;1124 return;
1132}1125}
@@ -1428,12 +1421,6 @@ mbox_post_cmd(adapter_t *adapter, scb_t *scb) · 295 unmodified lines
1428 1421
1429 adapter->outstanding_cmds++;1422 adapter->outstanding_cmds++;
1430 1423
1431 if (scb->dma_direction == PCI_DMA_TODEVICE)
1432 pci_dma_sync_sg_for_device(adapter->pdev,
1433 scsi_sglist(scb->scp),
1434 scsi_sg_count(scb->scp),
1435 PCI_DMA_TODEVICE);
1436
1437 mbox->busy = 1; // Set busy1424 mbox->busy = 1; // Set busy
1438 mbox->poll = 0;1425 mbox->poll = 0;
1439 mbox->ack = 0;1426 mbox->ack = 0;
@@ -2180,31 +2167,6 @@ megaraid_isr(int irq, void *devp) · 740 unmodified lines
2180}2167}
2181 2168
2182 2169
2183/**
2184 * megaraid_mbox_sync_scb - sync kernel buffers
2185 * @adapter : controller's soft state
2186 * @scb : pointer to the resource packet
2187 *
2188 * DMA sync if required.
2189 */
2190static void
2191megaraid_mbox_sync_scb(adapter_t *adapter, scb_t *scb)
2192{
2193 mbox_ccb_t *ccb;
2194
2195 ccb = (mbox_ccb_t *)scb->ccb;
2196
2197 if (scb->dma_direction == PCI_DMA_FROMDEVICE)
2198 pci_dma_sync_sg_for_cpu(adapter->pdev,
2199 scsi_sglist(scb->scp),
2200 scsi_sg_count(scb->scp),
2201 PCI_DMA_FROMDEVICE);
2202
2203 scsi_dma_unmap(scb->scp);
2204 return;
2205}
2206
2207
2208/**2170/**
2209 * megaraid_mbox_dpc - the tasklet to complete the commands from completed list2171 * megaraid_mbox_dpc - the tasklet to complete the commands from completed list
2210 * @devp : pointer to HBA soft state2172 * @devp : pointer to HBA soft state
@@ -2403,9 +2365,7 @@ megaraid_mbox_dpc(unsigned long devp) · 192 unmodified lines
2403 megaraid_mbox_display_scb(adapter, scb);2365 megaraid_mbox_display_scb(adapter, scb);
2404 }2366 }
2405 2367
2406 // Free our internal resources and call the mid-layer callback2368 scsi_dma_unmap(scp);
2407 // routine
2408 megaraid_mbox_sync_scb(adapter, scb);
2409 2369
2410 // remove from local clist2370 // remove from local clist
2411 list_del_init(&scb->list);2371 list_del_init(&scb->list);
@@ -2577,7 +2537,6 @@ megaraid_reset_handler(struct scsi_cmnd *scp) · 165 unmodified lines
2577 uint8_t raw_mbox[sizeof(mbox_t)];2537 uint8_t raw_mbox[sizeof(mbox_t)];
2578 int rval;2538 int rval;
2579 int recovery_window;2539 int recovery_window;
2580 int recovering;
2581 int i;2540 int i;
2582 uioc_t *kioc;2541 uioc_t *kioc;
2583 2542
@@ -2591,7 +2550,6 @@ megaraid_reset_handler(struct scsi_cmnd *scp) · 7 unmodified lines
2591 return FAILED;2550 return FAILED;
2592 }2551 }
2593 2552
2594
2595 // Under exceptional conditions, FW can take up to 3 minutes to2553 // Under exceptional conditions, FW can take up to 3 minutes to
2596 // complete command processing. Wait for additional 2 minutes for the2554 // complete command processing. Wait for additional 2 minutes for the
2597 // pending commands counter to go down to 0. If it doesn't, let the2555 // pending commands counter to go down to 0. If it doesn't, let the
@@ -2640,8 +2598,6 @@ megaraid_reset_handler(struct scsi_cmnd *scp) · 42 unmodified lines
2640 2598
2641 recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT;2599 recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT;
2642 2600
2643 recovering = adapter->outstanding_cmds;
2644
2645 for (i = 0; i < recovery_window; i++) {2601 for (i = 0; i < recovery_window; i++) {
2646 2602
2647 megaraid_ack_sequence(adapter);2603 megaraid_ack_sequence(adapter);
@@ -2725,13 +2681,10 @@ static int · 77 unmodified lines
2725mbox_post_sync_cmd(adapter_t *adapter, uint8_t raw_mbox[])2681mbox_post_sync_cmd(adapter_t *adapter, uint8_t raw_mbox[])
2726{2682{
2727 mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter);2683 mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter);
2728 mbox64_t *mbox64;
2729 mbox_t *mbox;2684 mbox_t *mbox;
2730 uint8_t status;2685 uint8_t status;
2731 int i;2686 int i;
2732 2687
2733
2734 mbox64 = raid_dev->mbox64;
2735 mbox = raid_dev->mbox;2688 mbox = raid_dev->mbox;
2736 2689
2737 /*2690 /*
@@ -2948,9 +2901,8 @@ megaraid_mbox_product_info(adapter_t *adapter) · 210 unmodified lines
2948 * Issue an ENQUIRY3 command to find out certain adapter parameters,2901 * Issue an ENQUIRY3 command to find out certain adapter parameters,
2949 * e.g., max channels, max commands etc.2902 * e.g., max channels, max commands etc.
2950 */2903 */
2951 pinfo = pci_zalloc_consistent(adapter->pdev, sizeof(mraid_pinfo_t),2904 pinfo = dma_zalloc_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t),
2952 &pinfo_dma_h);2905 &pinfo_dma_h, GFP_KERNEL);
2953
2954 if (pinfo == NULL) {2906 if (pinfo == NULL) {
2955 con_log(CL_ANN, (KERN_WARNING2907 con_log(CL_ANN, (KERN_WARNING
2956 "megaraid: out of memory, %s %d\n", __func__,2908 "megaraid: out of memory, %s %d\n", __func__,
@@ -2971,7 +2923,7 @@ megaraid_mbox_product_info(adapter_t *adapter) · 14 unmodified lines
2971 2923
2972 con_log(CL_ANN, (KERN_WARNING "megaraid: Inquiry3 failed\n"));2924 con_log(CL_ANN, (KERN_WARNING "megaraid: Inquiry3 failed\n"));
2973 2925
2974 pci_free_consistent(adapter->pdev, sizeof(mraid_pinfo_t),2926 dma_free_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t),
2975 pinfo, pinfo_dma_h);2927 pinfo, pinfo_dma_h);
2976 2928
2977 return -1;2929 return -1;
@@ -3002,7 +2954,7 @@ megaraid_mbox_product_info(adapter_t *adapter) · 24 unmodified lines
3002 con_log(CL_ANN, (KERN_WARNING2954 con_log(CL_ANN, (KERN_WARNING
3003 "megaraid: product info failed\n"));2955 "megaraid: product info failed\n"));
3004 2956
3005 pci_free_consistent(adapter->pdev, sizeof(mraid_pinfo_t),2957 dma_free_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t),
3006 pinfo, pinfo_dma_h);2958 pinfo, pinfo_dma_h);
3007 2959
3008 return -1;2960 return -1;
@@ -3038,7 +2990,7 @@ megaraid_mbox_product_info(adapter_t *adapter) · 29 unmodified lines
3038 "megaraid: fw version:[%s] bios version:[%s]\n",2990 "megaraid: fw version:[%s] bios version:[%s]\n",
3039 adapter->fw_version, adapter->bios_version));2991 adapter->fw_version, adapter->bios_version));
3040 2992
3041 pci_free_consistent(adapter->pdev, sizeof(mraid_pinfo_t), pinfo,2993 dma_free_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t), pinfo,
3042 pinfo_dma_h);2994 pinfo_dma_h);
3043 2995
3044 return 0;2996 return 0;
@@ -3135,7 +3087,6 @@ megaraid_mbox_support_ha(adapter_t *adapter, uint16_t *init_id) · 90 unmodified lines
3135static int3087static int
3136megaraid_mbox_support_random_del(adapter_t *adapter)3088megaraid_mbox_support_random_del(adapter_t *adapter)
3137{3089{
3138 mbox_t *mbox;
3139 uint8_t raw_mbox[sizeof(mbox_t)];3090 uint8_t raw_mbox[sizeof(mbox_t)];
3140 int rval;3091 int rval;
3141 3092
@@ -3157,8 +3108,6 @@ megaraid_mbox_support_random_del(adapter_t *adapter) · 15 unmodified lines
3157 return 0;3108 return 0;
3158 }3109 }
3159 3110
3160 mbox = (mbox_t *)raw_mbox;
3161
3162 memset((caddr_t)raw_mbox, 0, sizeof(mbox_t));3111 memset((caddr_t)raw_mbox, 0, sizeof(mbox_t));
3163 3112
3164 raw_mbox[0] = FC_DEL_LOGDRV;3113 raw_mbox[0] = FC_DEL_LOGDRV;
@@ -3263,12 +3212,8 @@ megaraid_mbox_enum_raid_scsi(adapter_t *adapter) · 98 unmodified lines
3263static void3212static void
3264megaraid_mbox_flush_cache(adapter_t *adapter)3213megaraid_mbox_flush_cache(adapter_t *adapter)
3265{3214{
3266 mbox_t *mbox;
3267 uint8_t raw_mbox[sizeof(mbox_t)];3215 uint8_t raw_mbox[sizeof(mbox_t)];
3268 3216
3269
3270 mbox = (mbox_t *)raw_mbox;
3271
3272 memset((caddr_t)raw_mbox, 0, sizeof(mbox_t));3217 memset((caddr_t)raw_mbox, 0, sizeof(mbox_t));
3273 3218
3274 raw_mbox[0] = FLUSH_ADAPTER;3219 raw_mbox[0] = FLUSH_ADAPTER;
@@ -3299,7 +3244,6 @@ megaraid_mbox_fire_sync_cmd(adapter_t *adapter) · 24 unmodified lines
3299 mbox_t *mbox;3244 mbox_t *mbox;
3300 uint8_t raw_mbox[sizeof(mbox_t)];3245 uint8_t raw_mbox[sizeof(mbox_t)];
3301 mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter);3246 mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter);
3302 mbox64_t *mbox64;
3303 int status = 0;3247 int status = 0;
3304 int i;3248 int i;
3305 uint32_t dword;3249 uint32_t dword;
@@ -3310,7 +3254,6 @@ megaraid_mbox_fire_sync_cmd(adapter_t *adapter) · 4 unmodified lines
3310 3254
3311 raw_mbox[0] = 0xFF;3255 raw_mbox[0] = 0xFF;
3312 3256
3313 mbox64 = raid_dev->mbox64;
3314 mbox = raid_dev->mbox;3257 mbox = raid_dev->mbox;
3315 3258
3316 /* Wait until mailbox is free */3259 /* Wait until mailbox is free */
@@ -3515,7 +3458,7 @@ megaraid_cmm_register(adapter_t *adapter) · 198 unmodified lines
3515 3458
3516 scb->scp = NULL;3459 scb->scp = NULL;
3517 scb->state = SCB_FREE;3460 scb->state = SCB_FREE;
3518 scb->dma_direction = PCI_DMA_NONE;3461 scb->dma_direction = DMA_NONE;
3519 scb->dma_type = MRAID_DMA_NONE;3462 scb->dma_type = MRAID_DMA_NONE;
3520 scb->dev_channel = -1;3463 scb->dev_channel = -1;
3521 scb->dev_target = -1;3464 scb->dev_target = -1;
@@ -3653,7 +3596,7 @@ megaraid_mbox_mm_command(adapter_t *adapter, uioc_t *kioc) · 131 unmodified lines
3653 3596
3654 scb->state = SCB_ACTIVE;3597 scb->state = SCB_ACTIVE;
3655 scb->dma_type = MRAID_DMA_NONE;3598 scb->dma_type = MRAID_DMA_NONE;
3656 scb->dma_direction = PCI_DMA_NONE;3599 scb->dma_direction = DMA_NONE;
3657 3600
3658 ccb = (mbox_ccb_t *)scb->ccb;3601 ccb = (mbox_ccb_t *)scb->ccb;
3659 mbox64 = (mbox64_t *)(unsigned long)kioc->cmdbuf;3602 mbox64 = (mbox64_t *)(unsigned long)kioc->cmdbuf;
@@ -3794,10 +3737,6 @@ megaraid_mbox_mm_done(adapter_t *adapter, scb_t *scb) · 134 unmodified lines
3794static int3737static int
3795gather_hbainfo(adapter_t *adapter, mraid_hba_info_t *hinfo)3738gather_hbainfo(adapter_t *adapter, mraid_hba_info_t *hinfo)
3796{3739{
3797 uint8_t dmajor;
3798
3799 dmajor = megaraid_mbox_version[0];
3800
3801 hinfo->pci_vendor_id = adapter->pdev->vendor;3740 hinfo->pci_vendor_id = adapter->pdev->vendor;
3802 hinfo->pci_device_id = adapter->pdev->device;3741 hinfo->pci_device_id = adapter->pdev->device;
3803 hinfo->subsys_vendor_id = adapter->pdev->subsystem_vendor;3742 hinfo->subsys_vendor_id = adapter->pdev->subsystem_vendor;
@@ -3843,8 +3782,8 @@ megaraid_sysfs_alloc_resources(adapter_t *adapter) · 39 unmodified lines
3843 3782
3844 raid_dev->sysfs_mbox64 = kmalloc(sizeof(mbox64_t), GFP_KERNEL);3783 raid_dev->sysfs_mbox64 = kmalloc(sizeof(mbox64_t), GFP_KERNEL);
3845 3784
3846 raid_dev->sysfs_buffer = pci_alloc_consistent(adapter->pdev,3785 raid_dev->sysfs_buffer = dma_alloc_coherent(&adapter->pdev->dev,
3847 PAGE_SIZE, &raid_dev->sysfs_buffer_dma);3786 PAGE_SIZE, &raid_dev->sysfs_buffer_dma, GFP_KERNEL);
3848 3787
3849 if (!raid_dev->sysfs_uioc || !raid_dev->sysfs_mbox64 ||3788 if (!raid_dev->sysfs_uioc || !raid_dev->sysfs_mbox64 ||
3850 !raid_dev->sysfs_buffer) {3789 !raid_dev->sysfs_buffer) {
@@ -3881,7 +3820,7 @@ megaraid_sysfs_free_resources(adapter_t *adapter) · 30 unmodified lines
3881 kfree(raid_dev->sysfs_mbox64);3820 kfree(raid_dev->sysfs_mbox64);
3882 3821
3883 if (raid_dev->sysfs_buffer) {3822 if (raid_dev->sysfs_buffer) {
3884 pci_free_consistent(adapter->pdev, PAGE_SIZE,3823 dma_free_coherent(&adapter->pdev->dev, PAGE_SIZE,
3885 raid_dev->sysfs_buffer, raid_dev->sysfs_buffer_dma);3824 raid_dev->sysfs_buffer, raid_dev->sysfs_buffer_dma);
3886 }3825 }
3887}3826}
drivers/scsi/megaraid/megaraid_mbox.h+1−1
@@ -117,7 +117,7 @@ · 116 unmodified lines
117 * @raw_mbox : raw mailbox pointer117 * @raw_mbox : raw mailbox pointer
118 * @mbox : mailbox118 * @mbox : mailbox
119 * @mbox64 : extended mailbox119 * @mbox64 : extended mailbox
120 * @mbox_dma_h : maibox dma address120 * @mbox_dma_h : mailbox dma address
121 * @sgl64 : 64-bit scatter-gather list121 * @sgl64 : 64-bit scatter-gather list
122 * @sgl32 : 32-bit scatter-gather list122 * @sgl32 : 32-bit scatter-gather list
123 * @sgl_dma_h : dma handle for the scatter-gather list123 * @sgl_dma_h : dma handle for the scatter-gather list
drivers/scsi/megaraid/megaraid_sas_base.c+78−75
@@ -1330,11 +1330,11 @@ megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp, · 1329 unmodified lines
1330 device_id = MEGASAS_DEV_INDEX(scp);1330 device_id = MEGASAS_DEV_INDEX(scp);
1331 pthru = (struct megasas_pthru_frame *)cmd->frame;1331 pthru = (struct megasas_pthru_frame *)cmd->frame;
1332 1332
1333 if (scp->sc_data_direction == PCI_DMA_TODEVICE)1333 if (scp->sc_data_direction == DMA_TO_DEVICE)
1334 flags = MFI_FRAME_DIR_WRITE;1334 flags = MFI_FRAME_DIR_WRITE;
1335 else if (scp->sc_data_direction == PCI_DMA_FROMDEVICE)1335 else if (scp->sc_data_direction == DMA_FROM_DEVICE)
1336 flags = MFI_FRAME_DIR_READ;1336 flags = MFI_FRAME_DIR_READ;
1337 else if (scp->sc_data_direction == PCI_DMA_NONE)1337 else if (scp->sc_data_direction == DMA_NONE)
1338 flags = MFI_FRAME_DIR_NONE;1338 flags = MFI_FRAME_DIR_NONE;
1339 1339
1340 if (instance->flag_ieee == 1) {1340 if (instance->flag_ieee == 1) {
@@ -1428,9 +1428,9 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp, · 87 unmodified lines
1428 device_id = MEGASAS_DEV_INDEX(scp);1428 device_id = MEGASAS_DEV_INDEX(scp);
1429 ldio = (struct megasas_io_frame *)cmd->frame;1429 ldio = (struct megasas_io_frame *)cmd->frame;
1430 1430
1431 if (scp->sc_data_direction == PCI_DMA_TODEVICE)1431 if (scp->sc_data_direction == DMA_TO_DEVICE)
1432 flags = MFI_FRAME_DIR_WRITE;1432 flags = MFI_FRAME_DIR_WRITE;
1433 else if (scp->sc_data_direction == PCI_DMA_FROMDEVICE)1433 else if (scp->sc_data_direction == DMA_FROM_DEVICE)
1434 flags = MFI_FRAME_DIR_READ;1434 flags = MFI_FRAME_DIR_READ;
1435 1435
1436 if (instance->flag_ieee == 1) {1436 if (instance->flag_ieee == 1) {
@@ -2240,9 +2240,9 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance, · 803 unmodified lines
2240 sizeof(struct MR_LD_VF_AFFILIATION_111));2240 sizeof(struct MR_LD_VF_AFFILIATION_111));
2241 else {2241 else {
2242 new_affiliation_111 =2242 new_affiliation_111 =
2243 pci_zalloc_consistent(instance->pdev,2243 dma_zalloc_coherent(&instance->pdev->dev,
2244 sizeof(struct MR_LD_VF_AFFILIATION_111),2244 sizeof(struct MR_LD_VF_AFFILIATION_111),
2245 &new_affiliation_111_h);2245 &new_affiliation_111_h, GFP_KERNEL);
2246 if (!new_affiliation_111) {2246 if (!new_affiliation_111) {
2247 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "2247 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "
2248 "memory for new affiliation for scsi%d\n",2248 "memory for new affiliation for scsi%d\n",
@@ -2302,7 +2302,7 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance, · 53 unmodified lines
2302 }2302 }
2303out:2303out:
2304 if (new_affiliation_111) {2304 if (new_affiliation_111) {
2305 pci_free_consistent(instance->pdev,2305 dma_free_coherent(&instance->pdev->dev,
2306 sizeof(struct MR_LD_VF_AFFILIATION_111),2306 sizeof(struct MR_LD_VF_AFFILIATION_111),
2307 new_affiliation_111,2307 new_affiliation_111,
2308 new_affiliation_111_h);2308 new_affiliation_111_h);
@@ -2347,10 +2347,10 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance, · 38 unmodified lines
2347 sizeof(struct MR_LD_VF_AFFILIATION));2347 sizeof(struct MR_LD_VF_AFFILIATION));
2348 else {2348 else {
2349 new_affiliation =2349 new_affiliation =
2350 pci_zalloc_consistent(instance->pdev,2350 dma_zalloc_coherent(&instance->pdev->dev,
2351 (MAX_LOGICAL_DRIVES + 1) *2351 (MAX_LOGICAL_DRIVES + 1) *
2352 sizeof(struct MR_LD_VF_AFFILIATION),2352 sizeof(struct MR_LD_VF_AFFILIATION),
2353 &new_affiliation_h);2353 &new_affiliation_h, GFP_KERNEL);
2354 if (!new_affiliation) {2354 if (!new_affiliation) {
2355 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "2355 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "
2356 "memory for new affiliation for scsi%d\n",2356 "memory for new affiliation for scsi%d\n",
@@ -2470,7 +2470,7 @@ out: · 113 unmodified lines
2470 }2470 }
2471 2471
2472 if (new_affiliation)2472 if (new_affiliation)
2473 pci_free_consistent(instance->pdev,2473 dma_free_coherent(&instance->pdev->dev,
2474 (MAX_LOGICAL_DRIVES + 1) *2474 (MAX_LOGICAL_DRIVES + 1) *
2475 sizeof(struct MR_LD_VF_AFFILIATION),2475 sizeof(struct MR_LD_VF_AFFILIATION),
2476 new_affiliation, new_affiliation_h);2476 new_affiliation, new_affiliation_h);
@@ -2513,9 +2513,9 @@ int megasas_sriov_start_heartbeat(struct megasas_instance *instance, · 36 unmodified lines
2513 2513
2514 if (initial) {2514 if (initial) {
2515 instance->hb_host_mem =2515 instance->hb_host_mem =
2516 pci_zalloc_consistent(instance->pdev,2516 dma_zalloc_coherent(&instance->pdev->dev,
2517 sizeof(struct MR_CTRL_HB_HOST_MEM),2517 sizeof(struct MR_CTRL_HB_HOST_MEM),
2518 &instance->hb_host_mem_h);2518 &instance->hb_host_mem_h, GFP_KERNEL);
2519 if (!instance->hb_host_mem) {2519 if (!instance->hb_host_mem) {
2520 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate"2520 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate"
2521 " memory for heartbeat host memory for scsi%d\n",2521 " memory for heartbeat host memory for scsi%d\n",
@@ -4995,9 +4995,8 @@ megasas_init_adapter_mfi(struct megasas_instance *instance) · 2473 unmodified lines
4995 context_sz = sizeof(u32);4995 context_sz = sizeof(u32);
4996 reply_q_sz = context_sz * (instance->max_fw_cmds + 1);4996 reply_q_sz = context_sz * (instance->max_fw_cmds + 1);
4997 4997
4998 instance->reply_queue = pci_alloc_consistent(instance->pdev,4998 instance->reply_queue = dma_alloc_coherent(&instance->pdev->dev,
4999 reply_q_sz,4999 reply_q_sz, &instance->reply_queue_h, GFP_KERNEL);
5000 &instance->reply_queue_h);
5001 5000
5002 if (!instance->reply_queue) {5001 if (!instance->reply_queue) {
5003 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Out of DMA mem for reply queue\n");5002 dev_printk(KERN_DEBUG, &instance->pdev->dev, "Out of DMA mem for reply queue\n");
@@ -5029,7 +5028,7 @@ megasas_init_adapter_mfi(struct megasas_instance *instance) · 25 unmodified lines
5029 5028
5030fail_fw_init:5029fail_fw_init:
5031 5030
5032 pci_free_consistent(instance->pdev, reply_q_sz,5031 dma_free_coherent(&instance->pdev->dev, reply_q_sz,
5033 instance->reply_queue, instance->reply_queue_h);5032 instance->reply_queue, instance->reply_queue_h);
5034fail_reply_queue:5033fail_reply_queue:
5035 megasas_free_cmds(instance);5034 megasas_free_cmds(instance);
@@ -5533,7 +5532,7 @@ static int megasas_init_fw(struct megasas_instance *instance) · 497 unmodified lines
5533 5532
5534 else {5533 else {
5535 if (instance->crash_dump_buf)5534 if (instance->crash_dump_buf)
5536 pci_free_consistent(instance->pdev,5535 dma_free_coherent(&instance->pdev->dev,
5537 CRASH_DMA_BUF_SIZE,5536 CRASH_DMA_BUF_SIZE,
5538 instance->crash_dump_buf,5537 instance->crash_dump_buf,
5539 instance->crash_dump_h);5538 instance->crash_dump_h);
@@ -5616,7 +5615,7 @@ static void megasas_release_mfi(struct megasas_instance *instance) · 76 unmodified lines
5616 u32 reply_q_sz = sizeof(u32) *(instance->max_mfi_cmds + 1);5615 u32 reply_q_sz = sizeof(u32) *(instance->max_mfi_cmds + 1);
5617 5616
5618 if (instance->reply_queue)5617 if (instance->reply_queue)
5619 pci_free_consistent(instance->pdev, reply_q_sz,5618 dma_free_coherent(&instance->pdev->dev, reply_q_sz,
5620 instance->reply_queue, instance->reply_queue_h);5619 instance->reply_queue, instance->reply_queue_h);
5621 5620
5622 megasas_free_cmds(instance);5621 megasas_free_cmds(instance);
@@ -5655,10 +5654,9 @@ megasas_get_seq_num(struct megasas_instance *instance, · 32 unmodified lines
5655 }5654 }
5656 5655
5657 dcmd = &cmd->frame->dcmd;5656 dcmd = &cmd->frame->dcmd;
5658 el_info = pci_zalloc_consistent(instance->pdev,5657 el_info = dma_zalloc_coherent(&instance->pdev->dev,
5659 sizeof(struct megasas_evt_log_info),5658 sizeof(struct megasas_evt_log_info), &el_info_h,
5660 &el_info_h);5659 GFP_KERNEL);
5661
5662 if (!el_info) {5660 if (!el_info) {
5663 megasas_return_cmd(instance, cmd);5661 megasas_return_cmd(instance, cmd);
5664 return -ENOMEM;5662 return -ENOMEM;
@@ -5695,8 +5693,9 @@ megasas_get_seq_num(struct megasas_instance *instance, · 30 unmodified lines
5695 eli->boot_seq_num = el_info->boot_seq_num;5693 eli->boot_seq_num = el_info->boot_seq_num;
5696 5694
5697dcmd_failed:5695dcmd_failed:
5698 pci_free_consistent(instance->pdev, sizeof(struct megasas_evt_log_info),5696 dma_free_coherent(&instance->pdev->dev,
5699 el_info, el_info_h);5697 sizeof(struct megasas_evt_log_info),
5698 el_info, el_info_h);
5700 5699
5701 megasas_return_cmd(instance, cmd);5700 megasas_return_cmd(instance, cmd);
5702 5701
@@ -6134,10 +6133,10 @@ static inline void megasas_set_adapter_type(struct megasas_instance *instance) · 431 unmodified lines
6134 6133
6135static inline int megasas_alloc_mfi_ctrl_mem(struct megasas_instance *instance)6134static inline int megasas_alloc_mfi_ctrl_mem(struct megasas_instance *instance)
6136{6135{
6137 instance->producer = pci_alloc_consistent(instance->pdev, sizeof(u32),6136 instance->producer = dma_alloc_coherent(&instance->pdev->dev,
6138 &instance->producer_h);6137 sizeof(u32), &instance->producer_h, GFP_KERNEL);
6139 instance->consumer = pci_alloc_consistent(instance->pdev, sizeof(u32),6138 instance->consumer = dma_alloc_coherent(&instance->pdev->dev,
6140 &instance->consumer_h);6139 sizeof(u32), &instance->consumer_h, GFP_KERNEL);
6141 6140
6142 if (!instance->producer || !instance->consumer) {6141 if (!instance->producer || !instance->consumer) {
6143 dev_err(&instance->pdev->dev,6142 dev_err(&instance->pdev->dev,
@@ -6199,11 +6198,11 @@ static inline void megasas_free_ctrl_mem(struct megasas_instance *instance) · 55 unmodified lines
6199 kfree(instance->reply_map);6198 kfree(instance->reply_map);
6200 if (instance->adapter_type == MFI_SERIES) {6199 if (instance->adapter_type == MFI_SERIES) {
6201 if (instance->producer)6200 if (instance->producer)
6202 pci_free_consistent(instance->pdev, sizeof(u32),6201 dma_free_coherent(&instance->pdev->dev, sizeof(u32),
6203 instance->producer,6202 instance->producer,
6204 instance->producer_h);6203 instance->producer_h);
6205 if (instance->consumer)6204 if (instance->consumer)
6206 pci_free_consistent(instance->pdev, sizeof(u32),6205 dma_free_coherent(&instance->pdev->dev, sizeof(u32),
6207 instance->consumer,6206 instance->consumer,
6208 instance->consumer_h);6207 instance->consumer_h);
6209 } else {6208 } else {
@@ -6224,10 +6223,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 14 unmodified lines
6224 struct pci_dev *pdev = instance->pdev;6223 struct pci_dev *pdev = instance->pdev;
6225 struct fusion_context *fusion = instance->ctrl_context;6224 struct fusion_context *fusion = instance->ctrl_context;
6226 6225
6227 instance->evt_detail =6226 instance->evt_detail = dma_alloc_coherent(&pdev->dev,
6228 pci_alloc_consistent(pdev,6227 sizeof(struct megasas_evt_detail),
6229 sizeof(struct megasas_evt_detail),6228 &instance->evt_detail_h, GFP_KERNEL);
6230 &instance->evt_detail_h);
6231 6229
6232 if (!instance->evt_detail) {6230 if (!instance->evt_detail) {
6233 dev_err(&instance->pdev->dev,6231 dev_err(&instance->pdev->dev,
@@ -6250,9 +6248,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 16 unmodified lines
6250 }6248 }
6251 6249
6252 instance->pd_list_buf =6250 instance->pd_list_buf =
6253 pci_alloc_consistent(pdev,6251 dma_alloc_coherent(&pdev->dev,
6254 MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST),6252 MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST),
6255 &instance->pd_list_buf_h);6253 &instance->pd_list_buf_h, GFP_KERNEL);
6256 6254
6257 if (!instance->pd_list_buf) {6255 if (!instance->pd_list_buf) {
6258 dev_err(&pdev->dev, "Failed to allocate PD list buffer\n");6256 dev_err(&pdev->dev, "Failed to allocate PD list buffer\n");
@@ -6260,9 +6258,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 1 unmodified line
6260 }6258 }
6261 6259
6262 instance->ctrl_info_buf =6260 instance->ctrl_info_buf =
6263 pci_alloc_consistent(pdev,6261 dma_alloc_coherent(&pdev->dev,
6264 sizeof(struct megasas_ctrl_info),6262 sizeof(struct megasas_ctrl_info),
6265 &instance->ctrl_info_buf_h);6263 &instance->ctrl_info_buf_h, GFP_KERNEL);
6266 6264
6267 if (!instance->ctrl_info_buf) {6265 if (!instance->ctrl_info_buf) {
6268 dev_err(&pdev->dev,6266 dev_err(&pdev->dev,
@@ -6271,9 +6269,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 2 unmodified lines
6271 }6269 }
6272 6270
6273 instance->ld_list_buf =6271 instance->ld_list_buf =
6274 pci_alloc_consistent(pdev,6272 dma_alloc_coherent(&pdev->dev,
6275 sizeof(struct MR_LD_LIST),6273 sizeof(struct MR_LD_LIST),
6276 &instance->ld_list_buf_h);6274 &instance->ld_list_buf_h, GFP_KERNEL);
6277 6275
6278 if (!instance->ld_list_buf) {6276 if (!instance->ld_list_buf) {
6279 dev_err(&pdev->dev, "Failed to allocate LD list buffer\n");6277 dev_err(&pdev->dev, "Failed to allocate LD list buffer\n");
@@ -6281,9 +6279,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 1 unmodified line
6281 }6279 }
6282 6280
6283 instance->ld_targetid_list_buf =6281 instance->ld_targetid_list_buf =
6284 pci_alloc_consistent(pdev,6282 dma_alloc_coherent(&pdev->dev,
6285 sizeof(struct MR_LD_TARGETID_LIST),6283 sizeof(struct MR_LD_TARGETID_LIST),
6286 &instance->ld_targetid_list_buf_h);6284 &instance->ld_targetid_list_buf_h, GFP_KERNEL);
6287 6285
6288 if (!instance->ld_targetid_list_buf) {6286 if (!instance->ld_targetid_list_buf) {
6289 dev_err(&pdev->dev,6287 dev_err(&pdev->dev,
@@ -6293,21 +6291,20 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 3 unmodified lines
6293 6291
6294 if (!reset_devices) {6292 if (!reset_devices) {
6295 instance->system_info_buf =6293 instance->system_info_buf =
6296 pci_alloc_consistent(pdev,6294 dma_alloc_coherent(&pdev->dev,
6297 sizeof(struct MR_DRV_SYSTEM_INFO),6295 sizeof(struct MR_DRV_SYSTEM_INFO),
6298 &instance->system_info_h);6296 &instance->system_info_h, GFP_KERNEL);
6299 instance->pd_info =6297 instance->pd_info =
6300 pci_alloc_consistent(pdev,6298 dma_alloc_coherent(&pdev->dev,
6301 sizeof(struct MR_PD_INFO),6299 sizeof(struct MR_PD_INFO),
6302 &instance->pd_info_h);6300 &instance->pd_info_h, GFP_KERNEL);
6303 instance->tgt_prop =6301 instance->tgt_prop =
6304 pci_alloc_consistent(pdev,6302 dma_alloc_coherent(&pdev->dev,
6305 sizeof(struct MR_TARGET_PROPERTIES),6303 sizeof(struct MR_TARGET_PROPERTIES),
6306 &instance->tgt_prop_h);6304 &instance->tgt_prop_h, GFP_KERNEL);
6307 instance->crash_dump_buf =6305 instance->crash_dump_buf =
6308 pci_alloc_consistent(pdev,6306 dma_alloc_coherent(&pdev->dev, CRASH_DMA_BUF_SIZE,
6309 CRASH_DMA_BUF_SIZE,6307 &instance->crash_dump_h, GFP_KERNEL);
6310 &instance->crash_dump_h);
6311 6308
6312 if (!instance->system_info_buf)6309 if (!instance->system_info_buf)
6313 dev_err(&instance->pdev->dev,6310 dev_err(&instance->pdev->dev,
@@ -6343,7 +6340,7 @@ void megasas_free_ctrl_dma_buffers(struct megasas_instance *instance) · 29 unmodified lines
6343 struct fusion_context *fusion = instance->ctrl_context;6340 struct fusion_context *fusion = instance->ctrl_context;
6344 6341
6345 if (instance->evt_detail)6342 if (instance->evt_detail)
6346 pci_free_consistent(pdev, sizeof(struct megasas_evt_detail),6343 dma_free_coherent(&pdev->dev, sizeof(struct megasas_evt_detail),
6347 instance->evt_detail,6344 instance->evt_detail,
6348 instance->evt_detail_h);6345 instance->evt_detail_h);
6349 6346
@@ -6354,41 +6351,41 @@ void megasas_free_ctrl_dma_buffers(struct megasas_instance *instance) · 4 unmodified lines
6354 fusion->ioc_init_request_phys);6351 fusion->ioc_init_request_phys);
6355 6352
6356 if (instance->pd_list_buf)6353 if (instance->pd_list_buf)
6357 pci_free_consistent(pdev,6354 dma_free_coherent(&pdev->dev,
6358 MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST),6355 MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST),
6359 instance->pd_list_buf,6356 instance->pd_list_buf,
6360 instance->pd_list_buf_h);6357 instance->pd_list_buf_h);
6361 6358
6362 if (instance->ld_list_buf)6359 if (instance->ld_list_buf)
6363 pci_free_consistent(pdev, sizeof(struct MR_LD_LIST),6360 dma_free_coherent(&pdev->dev, sizeof(struct MR_LD_LIST),
6364 instance->ld_list_buf,6361 instance->ld_list_buf,
6365 instance->ld_list_buf_h);6362 instance->ld_list_buf_h);
6366 6363
6367 if (instance->ld_targetid_list_buf)6364 if (instance->ld_targetid_list_buf)
6368 pci_free_consistent(pdev, sizeof(struct MR_LD_TARGETID_LIST),6365 dma_free_coherent(&pdev->dev, sizeof(struct MR_LD_TARGETID_LIST),
6369 instance->ld_targetid_list_buf,6366 instance->ld_targetid_list_buf,
6370 instance->ld_targetid_list_buf_h);6367 instance->ld_targetid_list_buf_h);
6371 6368
6372 if (instance->ctrl_info_buf)6369 if (instance->ctrl_info_buf)
6373 pci_free_consistent(pdev, sizeof(struct megasas_ctrl_info),6370 dma_free_coherent(&pdev->dev, sizeof(struct megasas_ctrl_info),
6374 instance->ctrl_info_buf,6371 instance->ctrl_info_buf,
6375 instance->ctrl_info_buf_h);6372 instance->ctrl_info_buf_h);
6376 6373
6377 if (instance->system_info_buf)6374 if (instance->system_info_buf)
6378 pci_free_consistent(pdev, sizeof(struct MR_DRV_SYSTEM_INFO),6375 dma_free_coherent(&pdev->dev, sizeof(struct MR_DRV_SYSTEM_INFO),
6379 instance->system_info_buf,6376 instance->system_info_buf,
6380 instance->system_info_h);6377 instance->system_info_h);
6381 6378
6382 if (instance->pd_info)6379 if (instance->pd_info)
6383 pci_free_consistent(pdev, sizeof(struct MR_PD_INFO),6380 dma_free_coherent(&pdev->dev, sizeof(struct MR_PD_INFO),
6384 instance->pd_info, instance->pd_info_h);6381 instance->pd_info, instance->pd_info_h);
6385 6382
6386 if (instance->tgt_prop)6383 if (instance->tgt_prop)
6387 pci_free_consistent(pdev, sizeof(struct MR_TARGET_PROPERTIES),6384 dma_free_coherent(&pdev->dev, sizeof(struct MR_TARGET_PROPERTIES),
6388 instance->tgt_prop, instance->tgt_prop_h);6385 instance->tgt_prop, instance->tgt_prop_h);
6389 6386
6390 if (instance->crash_dump_buf)6387 if (instance->crash_dump_buf)
6391 pci_free_consistent(pdev, CRASH_DMA_BUF_SIZE,6388 dma_free_coherent(&pdev->dev, CRASH_DMA_BUF_SIZE,
6392 instance->crash_dump_buf,6389 instance->crash_dump_buf,
6393 instance->crash_dump_h);6390 instance->crash_dump_h);
6394}6391}
@@ -6516,17 +6513,20 @@ static int megasas_probe_one(struct pci_dev *pdev, · 121 unmodified lines
6516 if (instance->requestorId) {6513 if (instance->requestorId) {
6517 if (instance->PlasmaFW111) {6514 if (instance->PlasmaFW111) {
6518 instance->vf_affiliation_111 =6515 instance->vf_affiliation_111 =
6519 pci_alloc_consistent(pdev, sizeof(struct MR_LD_VF_AFFILIATION_111),6516 dma_alloc_coherent(&pdev->dev,
6520 &instance->vf_affiliation_111_h);6517 sizeof(struct MR_LD_VF_AFFILIATION_111),
6518 &instance->vf_affiliation_111_h,
6519 GFP_KERNEL);
6521 if (!instance->vf_affiliation_111)6520 if (!instance->vf_affiliation_111)
6522 dev_warn(&pdev->dev, "Can't allocate "6521 dev_warn(&pdev->dev, "Can't allocate "
6523 "memory for VF affiliation buffer\n");6522 "memory for VF affiliation buffer\n");
6524 } else {6523 } else {
6525 instance->vf_affiliation =6524 instance->vf_affiliation =
6526 pci_alloc_consistent(pdev,6525 dma_alloc_coherent(&pdev->dev,
6527 (MAX_LOGICAL_DRIVES + 1) *6526 (MAX_LOGICAL_DRIVES + 1) *
6528 sizeof(struct MR_LD_VF_AFFILIATION),6527 sizeof(struct MR_LD_VF_AFFILIATION),
6529 &instance->vf_affiliation_h);6528 &instance->vf_affiliation_h,
6529 GFP_KERNEL);
6530 if (!instance->vf_affiliation)6530 if (!instance->vf_affiliation)
6531 dev_warn(&pdev->dev, "Can't allocate "6531 dev_warn(&pdev->dev, "Can't allocate "
6532 "memory for VF affiliation buffer\n");6532 "memory for VF affiliation buffer\n");
@@ -6994,19 +6994,19 @@ skip_firing_dcmds: · 461 unmodified lines
6994 }6994 }
6995 6995
6996 if (instance->vf_affiliation)6996 if (instance->vf_affiliation)
6997 pci_free_consistent(pdev, (MAX_LOGICAL_DRIVES + 1) *6997 dma_free_coherent(&pdev->dev, (MAX_LOGICAL_DRIVES + 1) *
6998 sizeof(struct MR_LD_VF_AFFILIATION),6998 sizeof(struct MR_LD_VF_AFFILIATION),
6999 instance->vf_affiliation,6999 instance->vf_affiliation,
7000 instance->vf_affiliation_h);7000 instance->vf_affiliation_h);
7001 7001
7002 if (instance->vf_affiliation_111)7002 if (instance->vf_affiliation_111)
7003 pci_free_consistent(pdev,7003 dma_free_coherent(&pdev->dev,
7004 sizeof(struct MR_LD_VF_AFFILIATION_111),7004 sizeof(struct MR_LD_VF_AFFILIATION_111),
7005 instance->vf_affiliation_111,7005 instance->vf_affiliation_111,
7006 instance->vf_affiliation_111_h);7006 instance->vf_affiliation_111_h);
7007 7007
7008 if (instance->hb_host_mem)7008 if (instance->hb_host_mem)
7009 pci_free_consistent(pdev, sizeof(struct MR_CTRL_HB_HOST_MEM),7009 dma_free_coherent(&pdev->dev, sizeof(struct MR_CTRL_HB_HOST_MEM),
7010 instance->hb_host_mem,7010 instance->hb_host_mem,
7011 instance->hb_host_mem_h);7011 instance->hb_host_mem_h);
7012 7012
@@ -7254,7 +7254,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance, · 241 unmodified lines
7254 7254
7255 /*7255 /*
7256 * We don't change the dma_coherent_mask, so7256 * We don't change the dma_coherent_mask, so
7257 * pci_alloc_consistent only returns 32bit addresses7257 * dma_alloc_coherent only returns 32bit addresses
7258 */7258 */
7259 if (instance->consistent_mask_64bit) {7259 if (instance->consistent_mask_64bit) {
7260 kern_sge64[i].phys_addr = cpu_to_le64(buf_handle);7260 kern_sge64[i].phys_addr = cpu_to_le64(buf_handle);
@@ -7523,6 +7523,9 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg) · 262 unmodified lines
7523 get_user(user_sense_off, &cioc->sense_off))7523 get_user(user_sense_off, &cioc->sense_off))
7524 return -EFAULT;7524 return -EFAULT;
7525 7525
7526 if (local_sense_off != user_sense_off)
7527 return -EINVAL;
7528
7526 if (local_sense_len) {7529 if (local_sense_len) {
7527 void __user **sense_ioc_ptr =7530 void __user **sense_ioc_ptr =
7528 (void __user **)((u8 *)((unsigned long)&ioc->frame.raw) + local_sense_off);7531 (void __user **)((u8 *)((unsigned long)&ioc->frame.raw) + local_sense_off);
drivers/scsi/megaraid/megaraid_sas_fusion.c+8−8
@@ -684,8 +684,8 @@ megasas_alloc_rdpq_fusion(struct megasas_instance *instance) · 683 unmodified lines
684 array_size = sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) *684 array_size = sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) *
685 MAX_MSIX_QUEUES_FUSION;685 MAX_MSIX_QUEUES_FUSION;
686 686
687 fusion->rdpq_virt = pci_zalloc_consistent(instance->pdev, array_size,687 fusion->rdpq_virt = dma_zalloc_coherent(&instance->pdev->dev,
688 &fusion->rdpq_phys);688 array_size, &fusion->rdpq_phys, GFP_KERNEL);
689 if (!fusion->rdpq_virt) {689 if (!fusion->rdpq_virt) {
690 dev_err(&instance->pdev->dev,690 dev_err(&instance->pdev->dev,
691 "Failed from %s %d\n", __func__, __LINE__);691 "Failed from %s %d\n", __func__, __LINE__);
@@ -813,7 +813,7 @@ megasas_free_rdpq_fusion(struct megasas_instance *instance) { · 121 unmodified lines
813 dma_pool_destroy(fusion->reply_frames_desc_pool_align);813 dma_pool_destroy(fusion->reply_frames_desc_pool_align);
814 814
815 if (fusion->rdpq_virt)815 if (fusion->rdpq_virt)
816 pci_free_consistent(instance->pdev,816 dma_free_coherent(&instance->pdev->dev,
817 sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) * MAX_MSIX_QUEUES_FUSION,817 sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) * MAX_MSIX_QUEUES_FUSION,
818 fusion->rdpq_virt, fusion->rdpq_phys);818 fusion->rdpq_virt, fusion->rdpq_phys);
819}819}
@@ -2209,7 +2209,7 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len, · 1389 unmodified lines
2209 cdb[0] = MEGASAS_SCSI_VARIABLE_LENGTH_CMD;2209 cdb[0] = MEGASAS_SCSI_VARIABLE_LENGTH_CMD;
2210 cdb[7] = MEGASAS_SCSI_ADDL_CDB_LEN;2210 cdb[7] = MEGASAS_SCSI_ADDL_CDB_LEN;
2211 2211
2212 if (scp->sc_data_direction == PCI_DMA_FROMDEVICE)2212 if (scp->sc_data_direction == DMA_FROM_DEVICE)
2213 cdb[9] = MEGASAS_SCSI_SERVICE_ACTION_READ32;2213 cdb[9] = MEGASAS_SCSI_SERVICE_ACTION_READ32;
2214 else2214 else
2215 cdb[9] = MEGASAS_SCSI_SERVICE_ACTION_WRITE32;2215 cdb[9] = MEGASAS_SCSI_SERVICE_ACTION_WRITE32;
@@ -2238,7 +2238,7 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len, · 22 unmodified lines
2238 cdb[31] = (u8)(num_blocks & 0xff);2238 cdb[31] = (u8)(num_blocks & 0xff);
2239 2239
2240 /* set SCSI IO EEDPFlags */2240 /* set SCSI IO EEDPFlags */
2241 if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) {2241 if (scp->sc_data_direction == DMA_FROM_DEVICE) {
2242 io_request->EEDPFlags = cpu_to_le16(2242 io_request->EEDPFlags = cpu_to_le16(
2243 MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG |2243 MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG |
2244 MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG |2244 MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG |
@@ -2621,7 +2621,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, · 376 unmodified lines
2621 scsi_buff_len = scsi_bufflen(scp);2621 scsi_buff_len = scsi_bufflen(scp);
2622 io_request->DataLength = cpu_to_le32(scsi_buff_len);2622 io_request->DataLength = cpu_to_le32(scsi_buff_len);
2623 2623
2624 if (scp->sc_data_direction == PCI_DMA_FROMDEVICE)2624 if (scp->sc_data_direction == DMA_FROM_DEVICE)
2625 io_info.isRead = 1;2625 io_info.isRead = 1;
2626 2626
2627 local_map_ptr = fusion->ld_drv_map[(instance->map_id & 1)];2627 local_map_ptr = fusion->ld_drv_map[(instance->map_id & 1)];
@@ -3088,9 +3088,9 @@ megasas_build_io_fusion(struct megasas_instance *instance, · 460 unmodified lines
3088 3088
3089 io_request->SGLFlags = cpu_to_le16(MPI2_SGE_FLAGS_64_BIT_ADDRESSING);3089 io_request->SGLFlags = cpu_to_le16(MPI2_SGE_FLAGS_64_BIT_ADDRESSING);
3090 3090
3091 if (scp->sc_data_direction == PCI_DMA_TODEVICE)3091 if (scp->sc_data_direction == DMA_TO_DEVICE)
3092 io_request->Control |= cpu_to_le32(MPI2_SCSIIO_CONTROL_WRITE);3092 io_request->Control |= cpu_to_le32(MPI2_SCSIIO_CONTROL_WRITE);
3093 else if (scp->sc_data_direction == PCI_DMA_FROMDEVICE)3093 else if (scp->sc_data_direction == DMA_FROM_DEVICE)
3094 io_request->Control |= cpu_to_le32(MPI2_SCSIIO_CONTROL_READ);3094 io_request->Control |= cpu_to_le32(MPI2_SCSIIO_CONTROL_READ);
3095 3095
3096 io_request->SGLOffset0 =3096 io_request->SGLOffset0 =
drivers/scsi/mesh.c+4−4
@@ -1915,8 +1915,8 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) · 1914 unmodified lines
1915 /* We use the PCI APIs for now until the generic one gets fixed1915 /* We use the PCI APIs for now until the generic one gets fixed
1916 * enough or until we get some macio-specific versions1916 * enough or until we get some macio-specific versions
1917 */1917 */
1918 dma_cmd_space = pci_zalloc_consistent(macio_get_pci_dev(mdev),1918 dma_cmd_space = dma_zalloc_coherent(&macio_get_pci_dev(mdev)->dev,
1919 ms->dma_cmd_size, &dma_cmd_bus);1919 ms->dma_cmd_size, &dma_cmd_bus, GFP_KERNEL);
1920 if (dma_cmd_space == NULL) {1920 if (dma_cmd_space == NULL) {
1921 printk(KERN_ERR "mesh: can't allocate DMA table\n");1921 printk(KERN_ERR "mesh: can't allocate DMA table\n");
1922 goto out_unmap;1922 goto out_unmap;
@@ -1974,7 +1974,7 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) · 51 unmodified lines
1974 */1974 */
1975 mesh_shutdown(mdev);1975 mesh_shutdown(mdev);
1976 set_mesh_power(ms, 0);1976 set_mesh_power(ms, 0);
1977 pci_free_consistent(macio_get_pci_dev(mdev), ms->dma_cmd_size,1977 dma_free_coherent(&macio_get_pci_dev(mdev)->dev, ms->dma_cmd_size,
1978 ms->dma_cmd_space, ms->dma_cmd_bus);1978 ms->dma_cmd_space, ms->dma_cmd_bus);
1979 out_unmap:1979 out_unmap:
1980 iounmap(ms->dma);1980 iounmap(ms->dma);
@@ -2007,7 +2007,7 @@ static int mesh_remove(struct macio_dev *mdev) · 26 unmodified lines
2007 iounmap(ms->dma);2007 iounmap(ms->dma);
2008 2008
2009 /* Free DMA commands memory */2009 /* Free DMA commands memory */
2010 pci_free_consistent(macio_get_pci_dev(mdev), ms->dma_cmd_size,2010 dma_free_coherent(&macio_get_pci_dev(mdev)->dev, ms->dma_cmd_size,
2011 ms->dma_cmd_space, ms->dma_cmd_bus);2011 ms->dma_cmd_space, ms->dma_cmd_bus);
2012 2012
2013 /* Release memory resources */2013 /* Release memory resources */
drivers/scsi/mpt3sas/mpt3sas_base.c+524−665
@@ -122,8 +122,8 @@ mpt3sas_base_check_cmd_timeout(struct MPT3SAS_ADAPTER *ioc, · 121 unmodified lines
122 if (!(status & MPT3_CMD_RESET))122 if (!(status & MPT3_CMD_RESET))
123 issue_reset = 1;123 issue_reset = 1;
124 124
125 pr_err(MPT3SAS_FMT "Command %s\n", ioc->name,125 ioc_err(ioc, "Command %s\n",
126 ((issue_reset == 0) ? "terminated due to Host Reset" : "Timeout"));126 issue_reset == 0 ? "terminated due to Host Reset" : "Timeout");
127 _debug_dump_mf(mpi_request, sz);127 _debug_dump_mf(mpi_request, sz);
128 128
129 return issue_reset;129 return issue_reset;
@@ -336,9 +336,7 @@ _base_get_chain_buffer_dma_to_chain_buffer(struct MPT3SAS_ADAPTER *ioc, · 206 unmodified lines
336 return ct->chain_buffer;336 return ct->chain_buffer;
337 }337 }
338 }338 }
339 pr_info(MPT3SAS_FMT339 ioc_info(ioc, "Provided chain_buffer_dma address is not in the lookup list\n");
340 "Provided chain_buffer_dma address is not in the lookup list\n",
341 ioc->name);
342 return NULL;340 return NULL;
343}341}
344 342
@@ -394,7 +392,7 @@ static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc, · 49 unmodified lines
394 /* Get scsi_cmd using smid */392 /* Get scsi_cmd using smid */
395 scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);393 scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
396 if (scmd == NULL) {394 if (scmd == NULL) {
397 pr_err(MPT3SAS_FMT "scmd is NULL\n", ioc->name);395 ioc_err(ioc, "scmd is NULL\n");
398 return;396 return;
399 }397 }
400 398
@@ -532,11 +530,11 @@ static int mpt3sas_remove_dead_ioc_func(void *arg) · 131 unmodified lines
532 struct MPT3SAS_ADAPTER *ioc = (struct MPT3SAS_ADAPTER *)arg;530 struct MPT3SAS_ADAPTER *ioc = (struct MPT3SAS_ADAPTER *)arg;
533 struct pci_dev *pdev;531 struct pci_dev *pdev;
534 532
535 if ((ioc == NULL))533 if (!ioc)
536 return -1;534 return -1;
537 535
538 pdev = ioc->pdev;536 pdev = ioc->pdev;
539 if ((pdev == NULL))537 if (!pdev)
540 return -1;538 return -1;
541 pci_stop_and_remove_bus_device_locked(pdev);539 pci_stop_and_remove_bus_device_locked(pdev);
542 return 0;540 return 0;
@@ -566,8 +564,7 @@ _base_fault_reset_work(struct work_struct *work) · 23 unmodified lines
566 564
567 doorbell = mpt3sas_base_get_iocstate(ioc, 0);565 doorbell = mpt3sas_base_get_iocstate(ioc, 0);
568 if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_MASK) {566 if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_MASK) {
569 pr_err(MPT3SAS_FMT "SAS host is non-operational !!!!\n",567 ioc_err(ioc, "SAS host is non-operational !!!!\n");
570 ioc->name);
571 568
572 /* It may be possible that EEH recovery can resolve some of569 /* It may be possible that EEH recovery can resolve some of
573 * pci bus failure issues rather removing the dead ioc function570 * pci bus failure issues rather removing the dead ioc function
@@ -600,13 +597,11 @@ _base_fault_reset_work(struct work_struct *work) · 26 unmodified lines
600 p = kthread_run(mpt3sas_remove_dead_ioc_func, ioc,597 p = kthread_run(mpt3sas_remove_dead_ioc_func, ioc,
601 "%s_dead_ioc_%d", ioc->driver_name, ioc->id);598 "%s_dead_ioc_%d", ioc->driver_name, ioc->id);
602 if (IS_ERR(p))599 if (IS_ERR(p))
603 pr_err(MPT3SAS_FMT600 ioc_err(ioc, "%s: Running mpt3sas_dead_ioc thread failed !!!!\n",
604 "%s: Running mpt3sas_dead_ioc thread failed !!!!\n",601 __func__);
605 ioc->name, __func__);
606 else602 else
607 pr_err(MPT3SAS_FMT603 ioc_err(ioc, "%s: Running mpt3sas_dead_ioc thread success !!!!\n",
608 "%s: Running mpt3sas_dead_ioc thread success !!!!\n",604 __func__);
609 ioc->name, __func__);
610 return; /* don't rearm timer */605 return; /* don't rearm timer */
611 }606 }
612 607
@@ -614,8 +609,8 @@ _base_fault_reset_work(struct work_struct *work) · 1 unmodified line
614 609
615 if ((doorbell & MPI2_IOC_STATE_MASK) != MPI2_IOC_STATE_OPERATIONAL) {610 if ((doorbell & MPI2_IOC_STATE_MASK) != MPI2_IOC_STATE_OPERATIONAL) {
616 rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);611 rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
617 pr_warn(MPT3SAS_FMT "%s: hard reset: %s\n", ioc->name,612 ioc_warn(ioc, "%s: hard reset: %s\n",
618 __func__, (rc == 0) ? "success" : "failed");613 __func__, rc == 0 ? "success" : "failed");
619 doorbell = mpt3sas_base_get_iocstate(ioc, 0);614 doorbell = mpt3sas_base_get_iocstate(ioc, 0);
620 if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_FAULT)615 if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_FAULT)
621 mpt3sas_base_fault_info(ioc, doorbell &616 mpt3sas_base_fault_info(ioc, doorbell &
@@ -657,8 +652,7 @@ mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc) · 35 unmodified lines
657 ioc->fault_reset_work_q =652 ioc->fault_reset_work_q =
658 create_singlethread_workqueue(ioc->fault_reset_work_q_name);653 create_singlethread_workqueue(ioc->fault_reset_work_q_name);
659 if (!ioc->fault_reset_work_q) {654 if (!ioc->fault_reset_work_q) {
660 pr_err(MPT3SAS_FMT "%s: failed (line=%d)\n",655 ioc_err(ioc, "%s: failed (line=%d)\n", __func__, __LINE__);
661 ioc->name, __func__, __LINE__);
662 return;656 return;
663 }657 }
664 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);658 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
@@ -700,8 +694,7 @@ mpt3sas_base_stop_watchdog(struct MPT3SAS_ADAPTER *ioc) · 35 unmodified lines
700void694void
701mpt3sas_base_fault_info(struct MPT3SAS_ADAPTER *ioc , u16 fault_code)695mpt3sas_base_fault_info(struct MPT3SAS_ADAPTER *ioc , u16 fault_code)
702{696{
703 pr_err(MPT3SAS_FMT "fault_state(0x%04x)!\n",697 ioc_err(ioc, "fault_state(0x%04x)!\n", fault_code);
704 ioc->name, fault_code);
705}698}
706 699
707/**700/**
@@ -728,8 +721,7 @@ mpt3sas_halt_firmware(struct MPT3SAS_ADAPTER *ioc) · 20 unmodified lines
728 mpt3sas_base_fault_info(ioc , doorbell);721 mpt3sas_base_fault_info(ioc , doorbell);
729 else {722 else {
730 writel(0xC0FFEE00, &ioc->chip->Doorbell);723 writel(0xC0FFEE00, &ioc->chip->Doorbell);
731 pr_err(MPT3SAS_FMT "Firmware is halted due to command timeout\n",724 ioc_err(ioc, "Firmware is halted due to command timeout\n");
732 ioc->name);
733 }725 }
734 726
735 if (ioc->fwfault_debug == 2)727 if (ioc->fwfault_debug == 2)
@@ -956,8 +948,8 @@ _base_sas_ioc_info(struct MPT3SAS_ADAPTER *ioc, MPI2DefaultReply_t *mpi_reply, · 220 unmodified lines
956 break;948 break;
957 }949 }
958 950
959 pr_warn(MPT3SAS_FMT "ioc_status: %s(0x%04x), request(0x%p),(%s)\n",951 ioc_warn(ioc, "ioc_status: %s(0x%04x), request(0x%p),(%s)\n",
960 ioc->name, desc, ioc_status, request_hdr, func_str);952 desc, ioc_status, request_hdr, func_str);
961 953
962 _debug_dump_mf(request_hdr, frame_sz/4);954 _debug_dump_mf(request_hdr, frame_sz/4);
963}955}
@@ -1003,9 +995,9 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc, · 39 unmodified lines
1003 {995 {
1004 Mpi2EventDataSasDiscovery_t *event_data =996 Mpi2EventDataSasDiscovery_t *event_data =
1005 (Mpi2EventDataSasDiscovery_t *)mpi_reply->EventData;997 (Mpi2EventDataSasDiscovery_t *)mpi_reply->EventData;
1006 pr_info(MPT3SAS_FMT "Discovery: (%s)", ioc->name,998 ioc_info(ioc, "Discovery: (%s)",
1007 (event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED) ?999 event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED ?
1008 "start" : "stop");1000 "start" : "stop");
1009 if (event_data->DiscoveryStatus)1001 if (event_data->DiscoveryStatus)
1010 pr_cont(" discovery_status(0x%08x)",1002 pr_cont(" discovery_status(0x%08x)",
1011 le32_to_cpu(event_data->DiscoveryStatus));1003 le32_to_cpu(event_data->DiscoveryStatus));
@@ -1059,14 +1051,13 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc, · 47 unmodified lines
1059 {1051 {
1060 Mpi26EventDataPCIeEnumeration_t *event_data =1052 Mpi26EventDataPCIeEnumeration_t *event_data =
1061 (Mpi26EventDataPCIeEnumeration_t *)mpi_reply->EventData;1053 (Mpi26EventDataPCIeEnumeration_t *)mpi_reply->EventData;
1062 pr_info(MPT3SAS_FMT "PCIE Enumeration: (%s)", ioc->name,1054 ioc_info(ioc, "PCIE Enumeration: (%s)",
1063 (event_data->ReasonCode ==1055 event_data->ReasonCode == MPI26_EVENT_PCIE_ENUM_RC_STARTED ?
1064 MPI26_EVENT_PCIE_ENUM_RC_STARTED) ?1056 "start" : "stop");
1065 "start" : "stop");
1066 if (event_data->EnumerationStatus)1057 if (event_data->EnumerationStatus)
1067 pr_info("enumeration_status(0x%08x)",1058 pr_cont("enumeration_status(0x%08x)",
1068 le32_to_cpu(event_data->EnumerationStatus));1059 le32_to_cpu(event_data->EnumerationStatus));
1069 pr_info("\n");1060 pr_cont("\n");
1070 return;1061 return;
1071 }1062 }
1072 case MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST:1063 case MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST:
@@ -1077,7 +1068,7 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc, · 4 unmodified lines
1077 if (!desc)1068 if (!desc)
1078 return;1069 return;
1079 1070
1080 pr_info(MPT3SAS_FMT "%s\n", ioc->name, desc);1071 ioc_info(ioc, "%s\n", desc);
1081}1072}
1082 1073
1083/**1074/**
@@ -1128,11 +1119,9 @@ _base_sas_log_info(struct MPT3SAS_ADAPTER *ioc , u32 log_info) · 44 unmodified lines
1128 break;1119 break;
1129 }1120 }
1130 1121
1131 pr_warn(MPT3SAS_FMT1122 ioc_warn(ioc, "log_info(0x%08x): originator(%s), code(0x%02x), sub_code(0x%04x)\n",
1132 "log_info(0x%08x): originator(%s), code(0x%02x), sub_code(0x%04x)\n",1123 log_info,
1133 ioc->name, log_info,1124 originator_str, sas_loginfo.dw.code, sas_loginfo.dw.subcode);
1134 originator_str, sas_loginfo.dw.code,
1135 sas_loginfo.dw.subcode);
1136}1125}
1137 1126
1138/**1127/**
@@ -1152,8 +1141,8 @@ _base_display_reply_info(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, · 13 unmodified lines
1152 1141
1153 mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply);1142 mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply);
1154 if (unlikely(!mpi_reply)) {1143 if (unlikely(!mpi_reply)) {
1155 pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",1144 ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
1156 ioc->name, __FILE__, __LINE__, __func__);1145 __FILE__, __LINE__, __func__);
1157 return;1146 return;
1158 }1147 }
1159 ioc_status = le16_to_cpu(mpi_reply->IOCStatus);1148 ioc_status = le16_to_cpu(mpi_reply->IOCStatus);
@@ -1249,9 +1238,9 @@ _base_async_event(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, u32 reply) · 89 unmodified lines
1249 delayed_event_ack->EventContext = mpi_reply->EventContext;1238 delayed_event_ack->EventContext = mpi_reply->EventContext;
1250 list_add_tail(&delayed_event_ack->list,1239 list_add_tail(&delayed_event_ack->list,
1251 &ioc->delayed_event_ack_list);1240 &ioc->delayed_event_ack_list);
1252 dewtprintk(ioc, pr_info(MPT3SAS_FMT1241 dewtprintk(ioc,
1253 "DELAYED: EVENT ACK: event (0x%04x)\n",1242 ioc_info(ioc, "DELAYED: EVENT ACK: event (0x%04x)\n",
1254 ioc->name, le16_to_cpu(mpi_reply->Event)));1243 le16_to_cpu(mpi_reply->Event)));
1255 goto out;1244 goto out;
1256 }1245 }
1257 1246
@@ -2270,7 +2259,7 @@ _base_build_sg_scmd(struct MPT3SAS_ADAPTER *ioc, · 1012 unmodified lines
2270 sges_left = scsi_dma_map(scmd);2259 sges_left = scsi_dma_map(scmd);
2271 if (sges_left < 0) {2260 if (sges_left < 0) {
2272 sdev_printk(KERN_ERR, scmd->device,2261 sdev_printk(KERN_ERR, scmd->device,
2273 "pci_map_sg failed: request for %d bytes!\n",2262 "scsi_dma_map failed: request for %d bytes!\n",
2274 scsi_bufflen(scmd));2263 scsi_bufflen(scmd));
2275 return -ENOMEM;2264 return -ENOMEM;
2276 }2265 }
@@ -2418,7 +2407,7 @@ _base_build_sg_scmd_ieee(struct MPT3SAS_ADAPTER *ioc, · 141 unmodified lines
2418 sges_left = scsi_dma_map(scmd);2407 sges_left = scsi_dma_map(scmd);
2419 if (sges_left < 0) {2408 if (sges_left < 0) {
2420 sdev_printk(KERN_ERR, scmd->device,2409 sdev_printk(KERN_ERR, scmd->device,
2421 "pci_map_sg failed: request for %d bytes!\n",2410 "scsi_dma_map failed: request for %d bytes!\n",
2422 scsi_bufflen(scmd));2411 scsi_bufflen(scmd));
2423 return -ENOMEM;2412 return -ENOMEM;
2424 }2413 }
@@ -2563,44 +2552,41 @@ _base_build_sg_ieee(struct MPT3SAS_ADAPTER *ioc, void *psge, · 138 unmodified lines
2563static int2552static int
2564_base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)2553_base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
2565{2554{
2555 u64 required_mask, coherent_mask;
2566 struct sysinfo s;2556 struct sysinfo s;
2567 u64 consistent_dma_mask;
2568 2557
2569 if (ioc->is_mcpu_endpoint)2558 if (ioc->is_mcpu_endpoint)
2570 goto try_32bit;2559 goto try_32bit;
2571 2560
2561 required_mask = dma_get_required_mask(&pdev->dev);
2562 if (sizeof(dma_addr_t) == 4 || required_mask == 32)
2563 goto try_32bit;
2564
2572 if (ioc->dma_mask)2565 if (ioc->dma_mask)
2573 consistent_dma_mask = DMA_BIT_MASK(64);2566 coherent_mask = DMA_BIT_MASK(64);
2574 else2567 else
2575 consistent_dma_mask = DMA_BIT_MASK(32);2568 coherent_mask = DMA_BIT_MASK(32);
2576 2569
2577 if (sizeof(dma_addr_t) > 4) {2570 if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) ||
2578 const uint64_t required_mask =2571 dma_set_coherent_mask(&pdev->dev, coherent_mask))
2579 dma_get_required_mask(&pdev->dev);2572 goto try_32bit;
2580 if ((required_mask > DMA_BIT_MASK(32)) &&2573
2581 !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&2574 ioc->base_add_sg_single = &_base_add_sg_single_64;
2582 !pci_set_consistent_dma_mask(pdev, consistent_dma_mask)) {2575 ioc->sge_size = sizeof(Mpi2SGESimple64_t);
2583 ioc->base_add_sg_single = &_base_add_sg_single_64;2576 ioc->dma_mask = 64;
2584 ioc->sge_size = sizeof(Mpi2SGESimple64_t);2577 goto out;
2585 ioc->dma_mask = 64;
2586 goto out;
2587 }
2588 }
2589 2578
2590 try_32bit:2579 try_32bit:
2591 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))2580 if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))
2592 && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
2593 ioc->base_add_sg_single = &_base_add_sg_single_32;
2594 ioc->sge_size = sizeof(Mpi2SGESimple32_t);
2595 ioc->dma_mask = 32;
2596 } else
2597 return -ENODEV;2581 return -ENODEV;
2598 2582
2583 ioc->base_add_sg_single = &_base_add_sg_single_32;
2584 ioc->sge_size = sizeof(Mpi2SGESimple32_t);
2585 ioc->dma_mask = 32;
2599 out:2586 out:
2600 si_meminfo(&s);2587 si_meminfo(&s);
2601 pr_info(MPT3SAS_FMT2588 ioc_info(ioc, "%d BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (%ld kB)\n",
2602 "%d BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (%ld kB)\n",2589 ioc->dma_mask, convert_to_kb(s.totalram));
2603 ioc->name, ioc->dma_mask, convert_to_kb(s.totalram));
2604 2590
2605 return 0;2591 return 0;
2606}2592}
@@ -2639,8 +2625,7 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 32 unmodified lines
2639 2625
2640 base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);2626 base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);
2641 if (!base) {2627 if (!base) {
2642 dfailprintk(ioc, pr_info(MPT3SAS_FMT "msix not supported\n",2628 dfailprintk(ioc, ioc_info(ioc, "msix not supported\n"));
2643 ioc->name));
2644 return -EINVAL;2629 return -EINVAL;
2645 }2630 }
2646 2631
@@ -2658,9 +2643,8 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 11 unmodified lines
2658 pci_read_config_word(ioc->pdev, base + 2, &message_control);2643 pci_read_config_word(ioc->pdev, base + 2, &message_control);
2659 ioc->msix_vector_count = (message_control & 0x3FF) + 1;2644 ioc->msix_vector_count = (message_control & 0x3FF) + 1;
2660 }2645 }
2661 dinitprintk(ioc, pr_info(MPT3SAS_FMT2646 dinitprintk(ioc, ioc_info(ioc, "msix is supported, vector_count(%d)\n",
2662 "msix is supported, vector_count(%d)\n",2647 ioc->msix_vector_count));
2663 ioc->name, ioc->msix_vector_count));
2664 return 0;2648 return 0;
2665}2649}
2666 2650
@@ -2702,8 +2686,8 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index) · 35 unmodified lines
2702 2686
2703 reply_q = kzalloc(sizeof(struct adapter_reply_queue), GFP_KERNEL);2687 reply_q = kzalloc(sizeof(struct adapter_reply_queue), GFP_KERNEL);
2704 if (!reply_q) {2688 if (!reply_q) {
2705 pr_err(MPT3SAS_FMT "unable to allocate memory %d!\n",2689 ioc_err(ioc, "unable to allocate memory %zu!\n",
2706 ioc->name, (int)sizeof(struct adapter_reply_queue));2690 sizeof(struct adapter_reply_queue));
2707 return -ENOMEM;2691 return -ENOMEM;
2708 }2692 }
2709 reply_q->ioc = ioc;2693 reply_q->ioc = ioc;
@@ -2719,7 +2703,7 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index) · 9 unmodified lines
2719 r = request_irq(pci_irq_vector(pdev, index), _base_interrupt,2703 r = request_irq(pci_irq_vector(pdev, index), _base_interrupt,
2720 IRQF_SHARED, reply_q->name, reply_q);2704 IRQF_SHARED, reply_q->name, reply_q);
2721 if (r) {2705 if (r) {
2722 pr_err(MPT3SAS_FMT "unable to allocate interrupt %d!\n",2706 pr_err("%s: unable to allocate interrupt %d!\n",
2723 reply_q->name, pci_irq_vector(pdev, index));2707 reply_q->name, pci_irq_vector(pdev, index));
2724 kfree(reply_q);2708 kfree(reply_q);
2725 return -EBUSY;2709 return -EBUSY;
@@ -2761,8 +2745,8 @@ _base_assign_reply_queues(struct MPT3SAS_ADAPTER *ioc) · 35 unmodified lines
2761 const cpumask_t *mask = pci_irq_get_affinity(ioc->pdev,2745 const cpumask_t *mask = pci_irq_get_affinity(ioc->pdev,
2762 reply_q->msix_index);2746 reply_q->msix_index);
2763 if (!mask) {2747 if (!mask) {
2764 pr_warn(MPT3SAS_FMT "no affinity for msi %x\n",2748 ioc_warn(ioc, "no affinity for msi %x\n",
2765 ioc->name, reply_q->msix_index);2749 reply_q->msix_index);
2766 continue;2750 continue;
2767 }2751 }
2768 2752
@@ -2833,9 +2817,8 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 64 unmodified lines
2833 ioc->reply_queue_count = min_t(int, ioc->cpu_count,2817 ioc->reply_queue_count = min_t(int, ioc->cpu_count,
2834 ioc->msix_vector_count);2818 ioc->msix_vector_count);
2835 2819
2836 printk(MPT3SAS_FMT "MSI-X vectors supported: %d, no of cores"2820 ioc_info(ioc, "MSI-X vectors supported: %d, no of cores: %d, max_msix_vectors: %d\n",
2837 ": %d, max_msix_vectors: %d\n", ioc->name, ioc->msix_vector_count,2821 ioc->msix_vector_count, ioc->cpu_count, max_msix_vectors);
2838 ioc->cpu_count, max_msix_vectors);
2839 2822
2840 if (!ioc->rdpq_array_enable && max_msix_vectors == -1)2823 if (!ioc->rdpq_array_enable && max_msix_vectors == -1)
2841 local_max_msix_vectors = (reset_devices) ? 1 : 8;2824 local_max_msix_vectors = (reset_devices) ? 1 : 8;
@@ -2857,9 +2840,9 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 15 unmodified lines
2857 r = pci_alloc_irq_vectors(ioc->pdev, 1, ioc->reply_queue_count,2840 r = pci_alloc_irq_vectors(ioc->pdev, 1, ioc->reply_queue_count,
2858 irq_flags);2841 irq_flags);
2859 if (r < 0) {2842 if (r < 0) {
2860 dfailprintk(ioc, pr_info(MPT3SAS_FMT2843 dfailprintk(ioc,
2861 "pci_alloc_irq_vectors failed (r=%d) !!!\n",2844 ioc_info(ioc, "pci_alloc_irq_vectors failed (r=%d) !!!\n",
2862 ioc->name, r));2845 r));
2863 goto try_ioapic;2846 goto try_ioapic;
2864 }2847 }
2865 2848
@@ -2882,9 +2865,9 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines
2882 ioc->reply_queue_count = 1;2865 ioc->reply_queue_count = 1;
2883 r = pci_alloc_irq_vectors(ioc->pdev, 1, 1, PCI_IRQ_LEGACY);2866 r = pci_alloc_irq_vectors(ioc->pdev, 1, 1, PCI_IRQ_LEGACY);
2884 if (r < 0) {2867 if (r < 0) {
2885 dfailprintk(ioc, pr_info(MPT3SAS_FMT2868 dfailprintk(ioc,
2886 "pci_alloc_irq_vector(legacy) failed (r=%d) !!!\n",2869 ioc_info(ioc, "pci_alloc_irq_vector(legacy) failed (r=%d) !!!\n",
2887 ioc->name, r));2870 r));
2888 } else2871 } else
2889 r = _base_request_irq(ioc, 0);2872 r = _base_request_irq(ioc, 0);
2890 2873
@@ -2900,8 +2883,7 @@ mpt3sas_base_unmap_resources(struct MPT3SAS_ADAPTER *ioc) · 9 unmodified lines
2900{2883{
2901 struct pci_dev *pdev = ioc->pdev;2884 struct pci_dev *pdev = ioc->pdev;
2902 2885
2903 dexitprintk(ioc, printk(MPT3SAS_FMT "%s\n",2886 dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
2904 ioc->name, __func__));
2905 2887
2906 _base_free_irq(ioc);2888 _base_free_irq(ioc);
2907 _base_disable_msix(ioc);2889 _base_disable_msix(ioc);
@@ -2939,13 +2921,11 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 31 unmodified lines
2939 phys_addr_t chip_phys = 0;2921 phys_addr_t chip_phys = 0;
2940 struct adapter_reply_queue *reply_q;2922 struct adapter_reply_queue *reply_q;
2941 2923
2942 dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n",2924 dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
2943 ioc->name, __func__));
2944 2925
2945 ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM);2926 ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM);
2946 if (pci_enable_device_mem(pdev)) {2927 if (pci_enable_device_mem(pdev)) {
2947 pr_warn(MPT3SAS_FMT "pci_enable_device_mem: failed\n",2928 ioc_warn(ioc, "pci_enable_device_mem: failed\n");
2948 ioc->name);
2949 ioc->bars = 0;2929 ioc->bars = 0;
2950 return -ENODEV;2930 return -ENODEV;
2951 }2931 }
@@ -2953,8 +2933,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
2953 2933
2954 if (pci_request_selected_regions(pdev, ioc->bars,2934 if (pci_request_selected_regions(pdev, ioc->bars,
2955 ioc->driver_name)) {2935 ioc->driver_name)) {
2956 pr_warn(MPT3SAS_FMT "pci_request_selected_regions: failed\n",2936 ioc_warn(ioc, "pci_request_selected_regions: failed\n");
2957 ioc->name);
2958 ioc->bars = 0;2937 ioc->bars = 0;
2959 r = -ENODEV;2938 r = -ENODEV;
2960 goto out_fail;2939 goto out_fail;
@@ -2967,8 +2946,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 6 unmodified lines
2967 2946
2968 2947
2969 if (_base_config_dma_addressing(ioc, pdev) != 0) {2948 if (_base_config_dma_addressing(ioc, pdev) != 0) {
2970 pr_warn(MPT3SAS_FMT "no suitable DMA mask for %s\n",2949 ioc_warn(ioc, "no suitable DMA mask for %s\n", pci_name(pdev));
2971 ioc->name, pci_name(pdev));
2972 r = -ENODEV;2950 r = -ENODEV;
2973 goto out_fail;2951 goto out_fail;
2974 }2952 }
@@ -2991,8 +2969,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines
2991 }2969 }
2992 2970
2993 if (ioc->chip == NULL) {2971 if (ioc->chip == NULL) {
2994 pr_err(MPT3SAS_FMT "unable to map adapter memory! "2972 ioc_err(ioc, "unable to map adapter memory! or resource not found\n");
2995 " or resource not found\n", ioc->name);
2996 r = -EINVAL;2973 r = -EINVAL;
2997 goto out_fail;2974 goto out_fail;
2998 }2975 }
@@ -3026,9 +3003,8 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 27 unmodified lines
3026 ioc->combined_reply_index_count,3003 ioc->combined_reply_index_count,
3027 sizeof(resource_size_t *), GFP_KERNEL);3004 sizeof(resource_size_t *), GFP_KERNEL);
3028 if (!ioc->replyPostRegisterIndex) {3005 if (!ioc->replyPostRegisterIndex) {
3029 dfailprintk(ioc, printk(MPT3SAS_FMT3006 dfailprintk(ioc,
3030 "allocation for reply Post Register Index failed!!!\n",3007 ioc_warn(ioc, "allocation for reply Post Register Index failed!!!\n"));
3031 ioc->name));
3032 r = -ENOMEM;3008 r = -ENOMEM;
3033 goto out_fail;3009 goto out_fail;
3034 }3010 }
@@ -3053,15 +3029,15 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 18 unmodified lines
3053 }3029 }
3054 3030
3055 list_for_each_entry(reply_q, &ioc->reply_queue_list, list)3031 list_for_each_entry(reply_q, &ioc->reply_queue_list, list)
3056 pr_info(MPT3SAS_FMT "%s: IRQ %d\n",3032 pr_info("%s: %s enabled: IRQ %d\n",
3057 reply_q->name, ((ioc->msix_enable) ? "PCI-MSI-X enabled" :3033 reply_q->name,
3058 "IO-APIC enabled"),3034 ioc->msix_enable ? "PCI-MSI-X" : "IO-APIC",
3059 pci_irq_vector(ioc->pdev, reply_q->msix_index));3035 pci_irq_vector(ioc->pdev, reply_q->msix_index));
3060 3036
3061 pr_info(MPT3SAS_FMT "iomem(%pap), mapped(0x%p), size(%d)\n",3037 ioc_info(ioc, "iomem(%pap), mapped(0x%p), size(%d)\n",
3062 ioc->name, &chip_phys, ioc->chip, memap_sz);3038 &chip_phys, ioc->chip, memap_sz);
3063 pr_info(MPT3SAS_FMT "ioport(0x%016llx), size(%d)\n",3039 ioc_info(ioc, "ioport(0x%016llx), size(%d)\n",
3064 ioc->name, (unsigned long long)pio_chip, pio_sz);3040 (unsigned long long)pio_chip, pio_sz);
3065 3041
3066 /* Save PCI configuration state for recovery from PCI AER/EEH errors */3042 /* Save PCI configuration state for recovery from PCI AER/EEH errors */
3067 pci_save_state(pdev);3043 pci_save_state(pdev);
@@ -3176,8 +3152,7 @@ mpt3sas_base_get_smid(struct MPT3SAS_ADAPTER *ioc, u8 cb_idx) · 108 unmodified lines
3176 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);3152 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
3177 if (list_empty(&ioc->internal_free_list)) {3153 if (list_empty(&ioc->internal_free_list)) {
3178 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);3154 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
3179 pr_err(MPT3SAS_FMT "%s: smid not available\n",3155 ioc_err(ioc, "%s: smid not available\n", __func__);
3180 ioc->name, __func__);
3181 return 0;3156 return 0;
3182 }3157 }
3183 3158
@@ -3545,89 +3520,85 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) · 361 unmodified lines
3545 case MPI2_MFGPAGE_DEVID_SAS2008:3520 case MPI2_MFGPAGE_DEVID_SAS2008:
3546 switch (ioc->pdev->subsystem_device) {3521 switch (ioc->pdev->subsystem_device) {
3547 case MPT2SAS_INTEL_RMS2LL080_SSDID:3522 case MPT2SAS_INTEL_RMS2LL080_SSDID:
3548 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3523 ioc_info(ioc, "%s\n",
3549 MPT2SAS_INTEL_RMS2LL080_BRANDING);3524 MPT2SAS_INTEL_RMS2LL080_BRANDING);
3550 break;3525 break;
3551 case MPT2SAS_INTEL_RMS2LL040_SSDID:3526 case MPT2SAS_INTEL_RMS2LL040_SSDID:
3552 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3527 ioc_info(ioc, "%s\n",
3553 MPT2SAS_INTEL_RMS2LL040_BRANDING);3528 MPT2SAS_INTEL_RMS2LL040_BRANDING);
3554 break;3529 break;
3555 case MPT2SAS_INTEL_SSD910_SSDID:3530 case MPT2SAS_INTEL_SSD910_SSDID:
3556 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3531 ioc_info(ioc, "%s\n",
3557 MPT2SAS_INTEL_SSD910_BRANDING);3532 MPT2SAS_INTEL_SSD910_BRANDING);
3558 break;3533 break;
3559 default:3534 default:
3560 pr_info(MPT3SAS_FMT3535 ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n",
3561 "Intel(R) Controller: Subsystem ID: 0x%X\n",3536 ioc->pdev->subsystem_device);
3562 ioc->name, ioc->pdev->subsystem_device);
3563 break;3537 break;
3564 }3538 }
3565 case MPI2_MFGPAGE_DEVID_SAS2308_2:3539 case MPI2_MFGPAGE_DEVID_SAS2308_2:
3566 switch (ioc->pdev->subsystem_device) {3540 switch (ioc->pdev->subsystem_device) {
3567 case MPT2SAS_INTEL_RS25GB008_SSDID:3541 case MPT2SAS_INTEL_RS25GB008_SSDID:
3568 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3542 ioc_info(ioc, "%s\n",
3569 MPT2SAS_INTEL_RS25GB008_BRANDING);3543 MPT2SAS_INTEL_RS25GB008_BRANDING);
3570 break;3544 break;
3571 case MPT2SAS_INTEL_RMS25JB080_SSDID:3545 case MPT2SAS_INTEL_RMS25JB080_SSDID:
3572 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3546 ioc_info(ioc, "%s\n",
3573 MPT2SAS_INTEL_RMS25JB080_BRANDING);3547 MPT2SAS_INTEL_RMS25JB080_BRANDING);
3574 break;3548 break;
3575 case MPT2SAS_INTEL_RMS25JB040_SSDID:3549 case MPT2SAS_INTEL_RMS25JB040_SSDID:
3576 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3550 ioc_info(ioc, "%s\n",
3577 MPT2SAS_INTEL_RMS25JB040_BRANDING);3551 MPT2SAS_INTEL_RMS25JB040_BRANDING);
3578 break;3552 break;
3579 case MPT2SAS_INTEL_RMS25KB080_SSDID:3553 case MPT2SAS_INTEL_RMS25KB080_SSDID:
3580 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3554 ioc_info(ioc, "%s\n",
3581 MPT2SAS_INTEL_RMS25KB080_BRANDING);3555 MPT2SAS_INTEL_RMS25KB080_BRANDING);
3582 break;3556 break;
3583 case MPT2SAS_INTEL_RMS25KB040_SSDID:3557 case MPT2SAS_INTEL_RMS25KB040_SSDID:
3584 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3558 ioc_info(ioc, "%s\n",
3585 MPT2SAS_INTEL_RMS25KB040_BRANDING);3559 MPT2SAS_INTEL_RMS25KB040_BRANDING);
3586 break;3560 break;
3587 case MPT2SAS_INTEL_RMS25LB040_SSDID:3561 case MPT2SAS_INTEL_RMS25LB040_SSDID:
3588 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3562 ioc_info(ioc, "%s\n",
3589 MPT2SAS_INTEL_RMS25LB040_BRANDING);3563 MPT2SAS_INTEL_RMS25LB040_BRANDING);
3590 break;3564 break;
3591 case MPT2SAS_INTEL_RMS25LB080_SSDID:3565 case MPT2SAS_INTEL_RMS25LB080_SSDID:
3592 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3566 ioc_info(ioc, "%s\n",
3593 MPT2SAS_INTEL_RMS25LB080_BRANDING);3567 MPT2SAS_INTEL_RMS25LB080_BRANDING);
3594 break;3568 break;
3595 default:3569 default:
3596 pr_info(MPT3SAS_FMT3570 ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n",
3597 "Intel(R) Controller: Subsystem ID: 0x%X\n",3571 ioc->pdev->subsystem_device);
3598 ioc->name, ioc->pdev->subsystem_device);
3599 break;3572 break;
3600 }3573 }
3601 case MPI25_MFGPAGE_DEVID_SAS3008:3574 case MPI25_MFGPAGE_DEVID_SAS3008:
3602 switch (ioc->pdev->subsystem_device) {3575 switch (ioc->pdev->subsystem_device) {
3603 case MPT3SAS_INTEL_RMS3JC080_SSDID:3576 case MPT3SAS_INTEL_RMS3JC080_SSDID:
3604 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3577 ioc_info(ioc, "%s\n",
3605 MPT3SAS_INTEL_RMS3JC080_BRANDING);3578 MPT3SAS_INTEL_RMS3JC080_BRANDING);
3606 break;3579 break;
3607 3580
3608 case MPT3SAS_INTEL_RS3GC008_SSDID:3581 case MPT3SAS_INTEL_RS3GC008_SSDID:
3609 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3582 ioc_info(ioc, "%s\n",
3610 MPT3SAS_INTEL_RS3GC008_BRANDING);3583 MPT3SAS_INTEL_RS3GC008_BRANDING);
3611 break;3584 break;
3612 case MPT3SAS_INTEL_RS3FC044_SSDID:3585 case MPT3SAS_INTEL_RS3FC044_SSDID:
3613 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3586 ioc_info(ioc, "%s\n",
3614 MPT3SAS_INTEL_RS3FC044_BRANDING);3587 MPT3SAS_INTEL_RS3FC044_BRANDING);
3615 break;3588 break;
3616 case MPT3SAS_INTEL_RS3UC080_SSDID:3589 case MPT3SAS_INTEL_RS3UC080_SSDID:
3617 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3590 ioc_info(ioc, "%s\n",
3618 MPT3SAS_INTEL_RS3UC080_BRANDING);3591 MPT3SAS_INTEL_RS3UC080_BRANDING);
3619 break;3592 break;
3620 default:3593 default:
3621 pr_info(MPT3SAS_FMT3594 ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n",
3622 "Intel(R) Controller: Subsystem ID: 0x%X\n",3595 ioc->pdev->subsystem_device);
3623 ioc->name, ioc->pdev->subsystem_device);
3624 break;3596 break;
3625 }3597 }
3626 break;3598 break;
3627 default:3599 default:
3628 pr_info(MPT3SAS_FMT3600 ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n",
3629 "Intel(R) Controller: Subsystem ID: 0x%X\n",3601 ioc->pdev->subsystem_device);
3630 ioc->name, ioc->pdev->subsystem_device);
3631 break;3602 break;
3632 }3603 }
3633 break;3604 break;
@@ -3636,57 +3607,54 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
3636 case MPI2_MFGPAGE_DEVID_SAS2008:3607 case MPI2_MFGPAGE_DEVID_SAS2008:
3637 switch (ioc->pdev->subsystem_device) {3608 switch (ioc->pdev->subsystem_device) {
3638 case MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID:3609 case MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID:
3639 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3610 ioc_info(ioc, "%s\n",
3640 MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING);3611 MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING);
3641 break;3612 break;
3642 case MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID:3613 case MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID:
3643 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3614 ioc_info(ioc, "%s\n",
3644 MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING);3615 MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING);
3645 break;3616 break;
3646 case MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID:3617 case MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID:
3647 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3618 ioc_info(ioc, "%s\n",
3648 MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING);3619 MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING);
3649 break;3620 break;
3650 case MPT2SAS_DELL_PERC_H200_MODULAR_SSDID:3621 case MPT2SAS_DELL_PERC_H200_MODULAR_SSDID:
3651 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3622 ioc_info(ioc, "%s\n",
3652 MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING);3623 MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING);
3653 break;3624 break;
3654 case MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID:3625 case MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID:
3655 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3626 ioc_info(ioc, "%s\n",
3656 MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING);3627 MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING);
3657 break;3628 break;
3658 case MPT2SAS_DELL_PERC_H200_SSDID:3629 case MPT2SAS_DELL_PERC_H200_SSDID:
3659 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3630 ioc_info(ioc, "%s\n",
3660 MPT2SAS_DELL_PERC_H200_BRANDING);3631 MPT2SAS_DELL_PERC_H200_BRANDING);
3661 break;3632 break;
3662 case MPT2SAS_DELL_6GBPS_SAS_SSDID:3633 case MPT2SAS_DELL_6GBPS_SAS_SSDID:
3663 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3634 ioc_info(ioc, "%s\n",
3664 MPT2SAS_DELL_6GBPS_SAS_BRANDING);3635 MPT2SAS_DELL_6GBPS_SAS_BRANDING);
3665 break;3636 break;
3666 default:3637 default:
3667 pr_info(MPT3SAS_FMT3638 ioc_info(ioc, "Dell 6Gbps HBA: Subsystem ID: 0x%X\n",
3668 "Dell 6Gbps HBA: Subsystem ID: 0x%X\n",3639 ioc->pdev->subsystem_device);
3669 ioc->name, ioc->pdev->subsystem_device);
3670 break;3640 break;
3671 }3641 }
3672 break;3642 break;
3673 case MPI25_MFGPAGE_DEVID_SAS3008:3643 case MPI25_MFGPAGE_DEVID_SAS3008:
3674 switch (ioc->pdev->subsystem_device) {3644 switch (ioc->pdev->subsystem_device) {
3675 case MPT3SAS_DELL_12G_HBA_SSDID:3645 case MPT3SAS_DELL_12G_HBA_SSDID:
3676 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3646 ioc_info(ioc, "%s\n",
3677 MPT3SAS_DELL_12G_HBA_BRANDING);3647 MPT3SAS_DELL_12G_HBA_BRANDING);
3678 break;3648 break;
3679 default:3649 default:
3680 pr_info(MPT3SAS_FMT3650 ioc_info(ioc, "Dell 12Gbps HBA: Subsystem ID: 0x%X\n",
3681 "Dell 12Gbps HBA: Subsystem ID: 0x%X\n",3651 ioc->pdev->subsystem_device);
3682 ioc->name, ioc->pdev->subsystem_device);
3683 break;3652 break;
3684 }3653 }
3685 break;3654 break;
3686 default:3655 default:
3687 pr_info(MPT3SAS_FMT3656 ioc_info(ioc, "Dell HBA: Subsystem ID: 0x%X\n",
3688 "Dell HBA: Subsystem ID: 0x%X\n", ioc->name,3657 ioc->pdev->subsystem_device);
3689 ioc->pdev->subsystem_device);
3690 break;3658 break;
3691 }3659 }
3692 break;3660 break;
@@ -3695,46 +3663,42 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
3695 case MPI25_MFGPAGE_DEVID_SAS3008:3663 case MPI25_MFGPAGE_DEVID_SAS3008:
3696 switch (ioc->pdev->subsystem_device) {3664 switch (ioc->pdev->subsystem_device) {
3697 case MPT3SAS_CISCO_12G_8E_HBA_SSDID:3665 case MPT3SAS_CISCO_12G_8E_HBA_SSDID:
3698 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3666 ioc_info(ioc, "%s\n",
3699 MPT3SAS_CISCO_12G_8E_HBA_BRANDING);3667 MPT3SAS_CISCO_12G_8E_HBA_BRANDING);
3700 break;3668 break;
3701 case MPT3SAS_CISCO_12G_8I_HBA_SSDID:3669 case MPT3SAS_CISCO_12G_8I_HBA_SSDID:
3702 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3670 ioc_info(ioc, "%s\n",
3703 MPT3SAS_CISCO_12G_8I_HBA_BRANDING);3671 MPT3SAS_CISCO_12G_8I_HBA_BRANDING);
3704 break;3672 break;
3705 case MPT3SAS_CISCO_12G_AVILA_HBA_SSDID:3673 case MPT3SAS_CISCO_12G_AVILA_HBA_SSDID:
3706 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3674 ioc_info(ioc, "%s\n",
3707 MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING);3675 MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING);
3708 break;3676 break;
3709 default:3677 default:
3710 pr_info(MPT3SAS_FMT3678 ioc_info(ioc, "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n",
3711 "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n",3679 ioc->pdev->subsystem_device);
3712 ioc->name, ioc->pdev->subsystem_device);
3713 break;3680 break;
3714 }3681 }
3715 break;3682 break;
3716 case MPI25_MFGPAGE_DEVID_SAS3108_1:3683 case MPI25_MFGPAGE_DEVID_SAS3108_1:
3717 switch (ioc->pdev->subsystem_device) {3684 switch (ioc->pdev->subsystem_device) {
3718 case MPT3SAS_CISCO_12G_AVILA_HBA_SSDID:3685 case MPT3SAS_CISCO_12G_AVILA_HBA_SSDID:
3719 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3686 ioc_info(ioc, "%s\n",
3720 MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING);3687 MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING);
3721 break;3688 break;
3722 case MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_SSDID:3689 case MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_SSDID:
3723 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3690 ioc_info(ioc, "%s\n",
3724 MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_BRANDING3691 MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_BRANDING);
3725 );
3726 break;3692 break;
3727 default:3693 default:
3728 pr_info(MPT3SAS_FMT3694 ioc_info(ioc, "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n",
3729 "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n",3695 ioc->pdev->subsystem_device);
3730 ioc->name, ioc->pdev->subsystem_device);
3731 break;3696 break;
3732 }3697 }
3733 break;3698 break;
3734 default:3699 default:
3735 pr_info(MPT3SAS_FMT3700 ioc_info(ioc, "Cisco SAS HBA: Subsystem ID: 0x%X\n",
3736 "Cisco SAS HBA: Subsystem ID: 0x%X\n",3701 ioc->pdev->subsystem_device);
3737 ioc->name, ioc->pdev->subsystem_device);
3738 break;3702 break;
3739 }3703 }
3740 break;3704 break;
@@ -3743,43 +3707,40 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
3743 case MPI2_MFGPAGE_DEVID_SAS2004:3707 case MPI2_MFGPAGE_DEVID_SAS2004:
3744 switch (ioc->pdev->subsystem_device) {3708 switch (ioc->pdev->subsystem_device) {
3745 case MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_SSDID:3709 case MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_SSDID:
3746 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3710 ioc_info(ioc, "%s\n",
3747 MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_BRANDING);3711 MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_BRANDING);
3748 break;3712 break;
3749 default:3713 default:
3750 pr_info(MPT3SAS_FMT3714 ioc_info(ioc, "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n",
3751 "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n",3715 ioc->pdev->subsystem_device);
3752 ioc->name, ioc->pdev->subsystem_device);
3753 break;3716 break;
3754 }3717 }
3755 case MPI2_MFGPAGE_DEVID_SAS2308_2:3718 case MPI2_MFGPAGE_DEVID_SAS2308_2:
3756 switch (ioc->pdev->subsystem_device) {3719 switch (ioc->pdev->subsystem_device) {
3757 case MPT2SAS_HP_2_4_INTERNAL_SSDID:3720 case MPT2SAS_HP_2_4_INTERNAL_SSDID:
3758 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3721 ioc_info(ioc, "%s\n",
3759 MPT2SAS_HP_2_4_INTERNAL_BRANDING);3722 MPT2SAS_HP_2_4_INTERNAL_BRANDING);
3760 break;3723 break;
3761 case MPT2SAS_HP_2_4_EXTERNAL_SSDID:3724 case MPT2SAS_HP_2_4_EXTERNAL_SSDID:
3762 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3725 ioc_info(ioc, "%s\n",
3763 MPT2SAS_HP_2_4_EXTERNAL_BRANDING);3726 MPT2SAS_HP_2_4_EXTERNAL_BRANDING);
3764 break;3727 break;
3765 case MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_SSDID:3728 case MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_SSDID:
3766 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3729 ioc_info(ioc, "%s\n",
3767 MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_BRANDING);3730 MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_BRANDING);
3768 break;3731 break;
3769 case MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_SSDID:3732 case MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_SSDID:
3770 pr_info(MPT3SAS_FMT "%s\n", ioc->name,3733 ioc_info(ioc, "%s\n",
3771 MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_BRANDING);3734 MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_BRANDING);
3772 break;3735 break;
3773 default:3736 default:
3774 pr_info(MPT3SAS_FMT3737 ioc_info(ioc, "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n",
3775 "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n",3738 ioc->pdev->subsystem_device);
3776 ioc->name, ioc->pdev->subsystem_device);
3777 break;3739 break;
3778 }3740 }
3779 default:3741 default:
3780 pr_info(MPT3SAS_FMT3742 ioc_info(ioc, "HP SAS HBA: Subsystem ID: 0x%X\n",
3781 "HP SAS HBA: Subsystem ID: 0x%X\n",3743 ioc->pdev->subsystem_device);
3782 ioc->name, ioc->pdev->subsystem_device);
3783 break;3744 break;
3784 }3745 }
3785 default:3746 default:
@@ -3806,28 +3767,25 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) · 20 unmodified lines
3806 u16 smid, ioc_status;3767 u16 smid, ioc_status;
3807 size_t data_length;3768 size_t data_length;
3808 3769
3809 dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,3770 dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
3810 __func__));
3811 3771
3812 if (ioc->base_cmds.status & MPT3_CMD_PENDING) {3772 if (ioc->base_cmds.status & MPT3_CMD_PENDING) {
3813 pr_err(MPT3SAS_FMT "%s: internal command already in use\n",3773 ioc_err(ioc, "%s: internal command already in use\n", __func__);
3814 ioc->name, __func__);
3815 return -EAGAIN;3774 return -EAGAIN;
3816 }3775 }
3817 3776
3818 data_length = sizeof(Mpi2FWImageHeader_t);3777 data_length = sizeof(Mpi2FWImageHeader_t);
3819 fwpkg_data = pci_alloc_consistent(ioc->pdev, data_length,3778 fwpkg_data = dma_alloc_coherent(&ioc->pdev->dev, data_length,
3820 &fwpkg_data_dma);3779 &fwpkg_data_dma, GFP_KERNEL);
3821 if (!fwpkg_data) {3780 if (!fwpkg_data) {
3822 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",3781 ioc_err(ioc, "failure at %s:%d/%s()!\n",
3823 ioc->name, __FILE__, __LINE__, __func__);3782 __FILE__, __LINE__, __func__);
3824 return -ENOMEM;3783 return -ENOMEM;
3825 }3784 }
3826 3785
3827 smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);3786 smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);
3828 if (!smid) {3787 if (!smid) {
3829 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",3788 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
3830 ioc->name, __func__);
3831 r = -EAGAIN;3789 r = -EAGAIN;
3832 goto out;3790 goto out;
3833 }3791 }
@@ -3846,11 +3804,9 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) · 12 unmodified lines
3846 /* Wait for 15 seconds */3804 /* Wait for 15 seconds */
3847 wait_for_completion_timeout(&ioc->base_cmds.done,3805 wait_for_completion_timeout(&ioc->base_cmds.done,
3848 FW_IMG_HDR_READ_TIMEOUT*HZ);3806 FW_IMG_HDR_READ_TIMEOUT*HZ);
3849 pr_info(MPT3SAS_FMT "%s: complete\n",3807 ioc_info(ioc, "%s: complete\n", __func__);
3850 ioc->name, __func__);
3851 if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) {3808 if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) {
3852 pr_err(MPT3SAS_FMT "%s: timeout\n",3809 ioc_err(ioc, "%s: timeout\n", __func__);
3853 ioc->name, __func__);
3854 _debug_dump_mf(mpi_request,3810 _debug_dump_mf(mpi_request,
3855 sizeof(Mpi25FWUploadRequest_t)/4);3811 sizeof(Mpi25FWUploadRequest_t)/4);
3856 r = -ETIME;3812 r = -ETIME;
@@ -3864,13 +3820,11 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines
3864 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {3820 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
3865 FWImgHdr = (Mpi2FWImageHeader_t *)fwpkg_data;3821 FWImgHdr = (Mpi2FWImageHeader_t *)fwpkg_data;
3866 if (FWImgHdr->PackageVersion.Word) {3822 if (FWImgHdr->PackageVersion.Word) {
3867 pr_info(MPT3SAS_FMT "FW Package Version"3823 ioc_info(ioc, "FW Package Version (%02d.%02d.%02d.%02d)\n",
3868 "(%02d.%02d.%02d.%02d)\n",3824 FWImgHdr->PackageVersion.Struct.Major,
3869 ioc->name,3825 FWImgHdr->PackageVersion.Struct.Minor,
3870 FWImgHdr->PackageVersion.Struct.Major,3826 FWImgHdr->PackageVersion.Struct.Unit,
3871 FWImgHdr->PackageVersion.Struct.Minor,3827 FWImgHdr->PackageVersion.Struct.Dev);
3872 FWImgHdr->PackageVersion.Struct.Unit,
3873 FWImgHdr->PackageVersion.Struct.Dev);
3874 }3828 }
3875 } else {3829 } else {
3876 _debug_dump_mf(&mpi_reply,3830 _debug_dump_mf(&mpi_reply,
@@ -3881,7 +3835,7 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines
3881 ioc->base_cmds.status = MPT3_CMD_NOT_USED;3835 ioc->base_cmds.status = MPT3_CMD_NOT_USED;
3882out:3836out:
3883 if (fwpkg_data)3837 if (fwpkg_data)
3884 pci_free_consistent(ioc->pdev, data_length, fwpkg_data,3838 dma_free_coherent(&ioc->pdev->dev, data_length, fwpkg_data,
3885 fwpkg_data_dma);3839 fwpkg_data_dma);
3886 return r;3840 return r;
3887}3841}
@@ -3900,18 +3854,17 @@ _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc) · 12 unmodified lines
3900 3854
3901 bios_version = le32_to_cpu(ioc->bios_pg3.BiosVersion);3855 bios_version = le32_to_cpu(ioc->bios_pg3.BiosVersion);
3902 strncpy(desc, ioc->manu_pg0.ChipName, 16);3856 strncpy(desc, ioc->manu_pg0.ChipName, 16);
3903 pr_info(MPT3SAS_FMT "%s: FWVersion(%02d.%02d.%02d.%02d), "\3857 ioc_info(ioc, "%s: FWVersion(%02d.%02d.%02d.%02d), ChipRevision(0x%02x), BiosVersion(%02d.%02d.%02d.%02d)\n",
3904 "ChipRevision(0x%02x), BiosVersion(%02d.%02d.%02d.%02d)\n",3858 desc,
3905 ioc->name, desc,3859 (ioc->facts.FWVersion.Word & 0xFF000000) >> 24,
3906 (ioc->facts.FWVersion.Word & 0xFF000000) >> 24,3860 (ioc->facts.FWVersion.Word & 0x00FF0000) >> 16,
3907 (ioc->facts.FWVersion.Word & 0x00FF0000) >> 16,3861 (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8,
3908 (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8,3862 ioc->facts.FWVersion.Word & 0x000000FF,
3909 ioc->facts.FWVersion.Word & 0x000000FF,3863 ioc->pdev->revision,
3910 ioc->pdev->revision,3864 (bios_version & 0xFF000000) >> 24,
3911 (bios_version & 0xFF000000) >> 24,3865 (bios_version & 0x00FF0000) >> 16,
3912 (bios_version & 0x00FF0000) >> 16,3866 (bios_version & 0x0000FF00) >> 8,
3913 (bios_version & 0x0000FF00) >> 8,3867 bios_version & 0x000000FF);
3914 bios_version & 0x000000FF);
3915 3868
3916 _base_display_OEMs_branding(ioc);3869 _base_display_OEMs_branding(ioc);
3917 3870
@@ -3920,82 +3873,81 @@ _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
3920 i++;3873 i++;
3921 }3874 }
3922 3875
3923 pr_info(MPT3SAS_FMT "Protocol=(", ioc->name);3876 ioc_info(ioc, "Protocol=(");
3924 3877
3925 if (ioc->facts.ProtocolFlags & MPI2_IOCFACTS_PROTOCOL_SCSI_INITIATOR) {3878 if (ioc->facts.ProtocolFlags & MPI2_IOCFACTS_PROTOCOL_SCSI_INITIATOR) {
3926 pr_info("Initiator");3879 pr_cont("Initiator");
3927 i++;3880 i++;
3928 }3881 }
3929 3882
3930 if (ioc->facts.ProtocolFlags & MPI2_IOCFACTS_PROTOCOL_SCSI_TARGET) {3883 if (ioc->facts.ProtocolFlags & MPI2_IOCFACTS_PROTOCOL_SCSI_TARGET) {
3931 pr_info("%sTarget", i ? "," : "");3884 pr_cont("%sTarget", i ? "," : "");
3932 i++;3885 i++;
3933 }3886 }
3934 3887
3935 i = 0;3888 i = 0;
3936 pr_info("), ");3889 pr_cont("), Capabilities=(");
3937 pr_info("Capabilities=(");
3938 3890
3939 if (!ioc->hide_ir_msg) {3891 if (!ioc->hide_ir_msg) {
3940 if (ioc->facts.IOCCapabilities &3892 if (ioc->facts.IOCCapabilities &
3941 MPI2_IOCFACTS_CAPABILITY_INTEGRATED_RAID) {3893 MPI2_IOCFACTS_CAPABILITY_INTEGRATED_RAID) {
3942 pr_info("Raid");3894 pr_cont("Raid");
3943 i++;3895 i++;
3944 }3896 }
3945 }3897 }
3946 3898
3947 if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_TLR) {3899 if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_TLR) {
3948 pr_info("%sTLR", i ? "," : "");3900 pr_cont("%sTLR", i ? "," : "");
3949 i++;3901 i++;
3950 }3902 }
3951 3903
3952 if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_MULTICAST) {3904 if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_MULTICAST) {
3953 pr_info("%sMulticast", i ? "," : "");3905 pr_cont("%sMulticast", i ? "," : "");
3954 i++;3906 i++;
3955 }3907 }
3956 3908
3957 if (ioc->facts.IOCCapabilities &3909 if (ioc->facts.IOCCapabilities &
3958 MPI2_IOCFACTS_CAPABILITY_BIDIRECTIONAL_TARGET) {3910 MPI2_IOCFACTS_CAPABILITY_BIDIRECTIONAL_TARGET) {
3959 pr_info("%sBIDI Target", i ? "," : "");3911 pr_cont("%sBIDI Target", i ? "," : "");
3960 i++;3912 i++;
3961 }3913 }
3962 3914
3963 if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_EEDP) {3915 if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_EEDP) {
3964 pr_info("%sEEDP", i ? "," : "");3916 pr_cont("%sEEDP", i ? "," : "");
3965 i++;3917 i++;
3966 }3918 }
3967 3919
3968 if (ioc->facts.IOCCapabilities &3920 if (ioc->facts.IOCCapabilities &
3969 MPI2_IOCFACTS_CAPABILITY_SNAPSHOT_BUFFER) {3921 MPI2_IOCFACTS_CAPABILITY_SNAPSHOT_BUFFER) {
3970 pr_info("%sSnapshot Buffer", i ? "," : "");3922 pr_cont("%sSnapshot Buffer", i ? "," : "");
3971 i++;3923 i++;
3972 }3924 }
3973 3925
3974 if (ioc->facts.IOCCapabilities &3926 if (ioc->facts.IOCCapabilities &
3975 MPI2_IOCFACTS_CAPABILITY_DIAG_TRACE_BUFFER) {3927 MPI2_IOCFACTS_CAPABILITY_DIAG_TRACE_BUFFER) {
3976 pr_info("%sDiag Trace Buffer", i ? "," : "");3928 pr_cont("%sDiag Trace Buffer", i ? "," : "");
3977 i++;3929 i++;
3978 }3930 }
3979 3931
3980 if (ioc->facts.IOCCapabilities &3932 if (ioc->facts.IOCCapabilities &
3981 MPI2_IOCFACTS_CAPABILITY_EXTENDED_BUFFER) {3933 MPI2_IOCFACTS_CAPABILITY_EXTENDED_BUFFER) {
3982 pr_info("%sDiag Extended Buffer", i ? "," : "");3934 pr_cont("%sDiag Extended Buffer", i ? "," : "");
3983 i++;3935 i++;
3984 }3936 }
3985 3937
3986 if (ioc->facts.IOCCapabilities &3938 if (ioc->facts.IOCCapabilities &
3987 MPI2_IOCFACTS_CAPABILITY_TASK_SET_FULL_HANDLING) {3939 MPI2_IOCFACTS_CAPABILITY_TASK_SET_FULL_HANDLING) {
3988 pr_info("%sTask Set Full", i ? "," : "");3940 pr_cont("%sTask Set Full", i ? "," : "");
3989 i++;3941 i++;
3990 }3942 }
3991 3943
3992 iounit_pg1_flags = le32_to_cpu(ioc->iounit_pg1.Flags);3944 iounit_pg1_flags = le32_to_cpu(ioc->iounit_pg1.Flags);
3993 if (!(iounit_pg1_flags & MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE)) {3945 if (!(iounit_pg1_flags & MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE)) {
3994 pr_info("%sNCQ", i ? "," : "");3946 pr_cont("%sNCQ", i ? "," : "");
3995 i++;3947 i++;
3996 }3948 }
3997 3949
3998 pr_info(")\n");3950 pr_cont(")\n");
3999}3951}
4000 3952
4001/**3953/**
@@ -4028,21 +3980,21 @@ mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc, · 26 unmodified lines
4028 sizeof(Mpi2SasIOUnit1PhyData_t));3980 sizeof(Mpi2SasIOUnit1PhyData_t));
4029 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);3981 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
4030 if (!sas_iounit_pg1) {3982 if (!sas_iounit_pg1) {
4031 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",3983 ioc_err(ioc, "failure at %s:%d/%s()!\n",
4032 ioc->name, __FILE__, __LINE__, __func__);3984 __FILE__, __LINE__, __func__);
4033 goto out;3985 goto out;
4034 }3986 }
4035 if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,3987 if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
4036 sas_iounit_pg1, sz))) {3988 sas_iounit_pg1, sz))) {
4037 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",3989 ioc_err(ioc, "failure at %s:%d/%s()!\n",
4038 ioc->name, __FILE__, __LINE__, __func__);3990 __FILE__, __LINE__, __func__);
4039 goto out;3991 goto out;
4040 }3992 }
4041 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &3993 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
4042 MPI2_IOCSTATUS_MASK;3994 MPI2_IOCSTATUS_MASK;
4043 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {3995 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
4044 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",3996 ioc_err(ioc, "failure at %s:%d/%s()!\n",
4045 ioc->name, __FILE__, __LINE__, __func__);3997 __FILE__, __LINE__, __func__);
4046 goto out;3998 goto out;
4047 }3999 }
4048 4000
@@ -4074,11 +4026,11 @@ mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc, · 25 unmodified lines
4074 else4026 else
4075 dmd_new =4027 dmd_new =
4076 dmd & MPI2_SASIOUNIT1_REPORT_MISSING_TIMEOUT_MASK;4028 dmd & MPI2_SASIOUNIT1_REPORT_MISSING_TIMEOUT_MASK;
4077 pr_info(MPT3SAS_FMT "device_missing_delay: old(%d), new(%d)\n",4029 ioc_info(ioc, "device_missing_delay: old(%d), new(%d)\n",
4078 ioc->name, dmd_orignal, dmd_new);4030 dmd_orignal, dmd_new);
4079 pr_info(MPT3SAS_FMT "ioc_missing_delay: old(%d), new(%d)\n",4031 ioc_info(ioc, "ioc_missing_delay: old(%d), new(%d)\n",
4080 ioc->name, io_missing_delay_original,4032 io_missing_delay_original,
4081 io_missing_delay);4033 io_missing_delay);
4082 ioc->device_missing_delay = dmd_new;4034 ioc->device_missing_delay = dmd_new;
4083 ioc->io_missing_delay = io_missing_delay;4035 ioc->io_missing_delay = io_missing_delay;
4084 }4036 }
@@ -4189,33 +4141,32 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 104 unmodified lines
4189 struct chain_tracker *ct;4141 struct chain_tracker *ct;
4190 struct reply_post_struct *rps;4142 struct reply_post_struct *rps;
4191 4143
4192 dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,4144 dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
4193 __func__));
4194 4145
4195 if (ioc->request) {4146 if (ioc->request) {
4196 pci_free_consistent(ioc->pdev, ioc->request_dma_sz,4147 dma_free_coherent(&ioc->pdev->dev, ioc->request_dma_sz,
4197 ioc->request, ioc->request_dma);4148 ioc->request, ioc->request_dma);
4198 dexitprintk(ioc, pr_info(MPT3SAS_FMT4149 dexitprintk(ioc,
4199 "request_pool(0x%p): free\n",4150 ioc_info(ioc, "request_pool(0x%p): free\n",
4200 ioc->name, ioc->request));4151 ioc->request));
4201 ioc->request = NULL;4152 ioc->request = NULL;
4202 }4153 }
4203 4154
4204 if (ioc->sense) {4155 if (ioc->sense) {
4205 dma_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma);4156 dma_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma);
4206 dma_pool_destroy(ioc->sense_dma_pool);4157 dma_pool_destroy(ioc->sense_dma_pool);
4207 dexitprintk(ioc, pr_info(MPT3SAS_FMT4158 dexitprintk(ioc,
4208 "sense_pool(0x%p): free\n",4159 ioc_info(ioc, "sense_pool(0x%p): free\n",
4209 ioc->name, ioc->sense));4160 ioc->sense));
4210 ioc->sense = NULL;4161 ioc->sense = NULL;
4211 }4162 }
4212 4163
4213 if (ioc->reply) {4164 if (ioc->reply) {
4214 dma_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma);4165 dma_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma);
4215 dma_pool_destroy(ioc->reply_dma_pool);4166 dma_pool_destroy(ioc->reply_dma_pool);
4216 dexitprintk(ioc, pr_info(MPT3SAS_FMT4167 dexitprintk(ioc,
4217 "reply_pool(0x%p): free\n",4168 ioc_info(ioc, "reply_pool(0x%p): free\n",
4218 ioc->name, ioc->reply));4169 ioc->reply));
4219 ioc->reply = NULL;4170 ioc->reply = NULL;
4220 }4171 }
4221 4172
@@ -4223,9 +4174,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
4223 dma_pool_free(ioc->reply_free_dma_pool, ioc->reply_free,4174 dma_pool_free(ioc->reply_free_dma_pool, ioc->reply_free,
4224 ioc->reply_free_dma);4175 ioc->reply_free_dma);
4225 dma_pool_destroy(ioc->reply_free_dma_pool);4176 dma_pool_destroy(ioc->reply_free_dma_pool);
4226 dexitprintk(ioc, pr_info(MPT3SAS_FMT4177 dexitprintk(ioc,
4227 "reply_free_pool(0x%p): free\n",4178 ioc_info(ioc, "reply_free_pool(0x%p): free\n",
4228 ioc->name, ioc->reply_free));4179 ioc->reply_free));
4229 ioc->reply_free = NULL;4180 ioc->reply_free = NULL;
4230 }4181 }
4231 4182
@@ -4237,9 +4188,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
4237 ioc->reply_post_free_dma_pool,4188 ioc->reply_post_free_dma_pool,
4238 rps->reply_post_free,4189 rps->reply_post_free,
4239 rps->reply_post_free_dma);4190 rps->reply_post_free_dma);
4240 dexitprintk(ioc, pr_info(MPT3SAS_FMT4191 dexitprintk(ioc,
4241 "reply_post_free_pool(0x%p): free\n",4192 ioc_info(ioc, "reply_post_free_pool(0x%p): free\n",
4242 ioc->name, rps->reply_post_free));4193 rps->reply_post_free));
4243 rps->reply_post_free = NULL;4194 rps->reply_post_free = NULL;
4244 }4195 }
4245 } while (ioc->rdpq_array_enable &&4196 } while (ioc->rdpq_array_enable &&
@@ -4267,10 +4218,10 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 21 unmodified lines
4267 }4218 }
4268 4219
4269 if (ioc->config_page) {4220 if (ioc->config_page) {
4270 dexitprintk(ioc, pr_info(MPT3SAS_FMT4221 dexitprintk(ioc,
4271 "config_page(0x%p): free\n", ioc->name,4222 ioc_info(ioc, "config_page(0x%p): free\n",
4272 ioc->config_page));4223 ioc->config_page));
4273 pci_free_consistent(ioc->pdev, ioc->config_page_sz,4224 dma_free_coherent(&ioc->pdev->dev, ioc->config_page_sz,
4274 ioc->config_page, ioc->config_page_dma);4225 ioc->config_page, ioc->config_page_dma);
4275 }4226 }
4276 4227
@@ -4338,8 +4289,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 61 unmodified lines
4338 int i, j;4289 int i, j;
4339 struct chain_tracker *ct;4290 struct chain_tracker *ct;
4340 4291
4341 dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,4292 dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
4342 __func__));
4343 4293
4344 4294
4345 retry_sz = 0;4295 retry_sz = 0;
@@ -4368,10 +4318,8 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 22 unmodified lines
4368 else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) {4318 else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) {
4369 sg_tablesize = min_t(unsigned short, sg_tablesize,4319 sg_tablesize = min_t(unsigned short, sg_tablesize,
4370 SG_MAX_SEGMENTS);4320 SG_MAX_SEGMENTS);
4371 pr_warn(MPT3SAS_FMT4321 ioc_warn(ioc, "sg_tablesize(%u) is bigger than kernel defined SG_CHUNK_SIZE(%u)\n",
4372 "sg_tablesize(%u) is bigger than kernel "4322 sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
4373 "defined SG_CHUNK_SIZE(%u)\n", ioc->name,
4374 sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
4375 }4323 }
4376 ioc->shost->sg_tablesize = sg_tablesize;4324 ioc->shost->sg_tablesize = sg_tablesize;
4377 }4325 }
@@ -4381,9 +4329,8 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
4381 if (ioc->internal_depth < INTERNAL_CMDS_COUNT) {4329 if (ioc->internal_depth < INTERNAL_CMDS_COUNT) {
4382 if (facts->RequestCredit <= (INTERNAL_CMDS_COUNT +4330 if (facts->RequestCredit <= (INTERNAL_CMDS_COUNT +
4383 INTERNAL_SCSIIO_CMDS_COUNT)) {4331 INTERNAL_SCSIIO_CMDS_COUNT)) {
4384 pr_err(MPT3SAS_FMT "IOC doesn't have enough Request \4332 ioc_err(ioc, "IOC doesn't have enough Request Credits, it has just %d number of credits\n",
4385 Credits, it has just %d number of credits\n",4333 facts->RequestCredit);
4386 ioc->name, facts->RequestCredit);
4387 return -ENOMEM;4334 return -ENOMEM;
4388 }4335 }
4389 ioc->internal_depth = 10;4336 ioc->internal_depth = 10;
@@ -4482,11 +4429,12 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 92 unmodified lines
4482 ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64;4429 ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64;
4483 }4430 }
4484 4431
4485 dinitprintk(ioc, pr_info(MPT3SAS_FMT "scatter gather: " \4432 dinitprintk(ioc,
4486 "sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), "4433 ioc_info(ioc, "scatter gather: sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), chains_per_io(%d)\n",
4487 "chains_per_io(%d)\n", ioc->name, ioc->max_sges_in_main_message,4434 ioc->max_sges_in_main_message,
4488 ioc->max_sges_in_chain_message, ioc->shost->sg_tablesize,4435 ioc->max_sges_in_chain_message,
4489 ioc->chains_needed_per_io));4436 ioc->shost->sg_tablesize,
4437 ioc->chains_needed_per_io));
4490 4438
4491 /* reply post queue, 16 byte align */4439 /* reply post queue, 16 byte align */
4492 reply_post_free_sz = ioc->reply_post_queue_depth *4440 reply_post_free_sz = ioc->reply_post_queue_depth *
@@ -4501,48 +4449,40 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 8 unmodified lines
4501 sizeof(struct reply_post_struct), GFP_KERNEL);4449 sizeof(struct reply_post_struct), GFP_KERNEL);
4502 4450
4503 if (!ioc->reply_post) {4451 if (!ioc->reply_post) {
4504 pr_err(MPT3SAS_FMT "reply_post_free pool: kcalloc failed\n",4452 ioc_err(ioc, "reply_post_free pool: kcalloc failed\n");
4505 ioc->name);
4506 goto out;4453 goto out;
4507 }4454 }
4508 ioc->reply_post_free_dma_pool = dma_pool_create("reply_post_free pool",4455 ioc->reply_post_free_dma_pool = dma_pool_create("reply_post_free pool",
4509 &ioc->pdev->dev, sz, 16, 0);4456 &ioc->pdev->dev, sz, 16, 0);
4510 if (!ioc->reply_post_free_dma_pool) {4457 if (!ioc->reply_post_free_dma_pool) {
4511 pr_err(MPT3SAS_FMT4458 ioc_err(ioc, "reply_post_free pool: dma_pool_create failed\n");
4512 "reply_post_free pool: dma_pool_create failed\n",
4513 ioc->name);
4514 goto out;4459 goto out;
4515 }4460 }
4516 i = 0;4461 i = 0;
4517 do {4462 do {
4518 ioc->reply_post[i].reply_post_free =4463 ioc->reply_post[i].reply_post_free =
4519 dma_pool_alloc(ioc->reply_post_free_dma_pool,4464 dma_pool_zalloc(ioc->reply_post_free_dma_pool,
4520 GFP_KERNEL,4465 GFP_KERNEL,
4521 &ioc->reply_post[i].reply_post_free_dma);4466 &ioc->reply_post[i].reply_post_free_dma);
4522 if (!ioc->reply_post[i].reply_post_free) {4467 if (!ioc->reply_post[i].reply_post_free) {
4523 pr_err(MPT3SAS_FMT4468 ioc_err(ioc, "reply_post_free pool: dma_pool_alloc failed\n");
4524 "reply_post_free pool: dma_pool_alloc failed\n",
4525 ioc->name);
4526 goto out;4469 goto out;
4527 }4470 }
4528 memset(ioc->reply_post[i].reply_post_free, 0, sz);4471 dinitprintk(ioc,
4529 dinitprintk(ioc, pr_info(MPT3SAS_FMT4472 ioc_info(ioc, "reply post free pool (0x%p): depth(%d), element_size(%d), pool_size(%d kB)\n",
4530 "reply post free pool (0x%p): depth(%d),"4473 ioc->reply_post[i].reply_post_free,
4531 "element_size(%d), pool_size(%d kB)\n", ioc->name,4474 ioc->reply_post_queue_depth,
4532 ioc->reply_post[i].reply_post_free,4475 8, sz / 1024));
4533 ioc->reply_post_queue_depth, 8, sz/1024));4476 dinitprintk(ioc,
4534 dinitprintk(ioc, pr_info(MPT3SAS_FMT4477 ioc_info(ioc, "reply_post_free_dma = (0x%llx)\n",
4535 "reply_post_free_dma = (0x%llx)\n", ioc->name,4478 (u64)ioc->reply_post[i].reply_post_free_dma));
4536 (unsigned long long)
4537 ioc->reply_post[i].reply_post_free_dma));
4538 total_sz += sz;4479 total_sz += sz;
4539 } while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count));4480 } while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count));
4540 4481
4541 if (ioc->dma_mask == 64) {4482 if (ioc->dma_mask == 64) {
4542 if (_base_change_consistent_dma_mask(ioc, ioc->pdev) != 0) {4483 if (_base_change_consistent_dma_mask(ioc, ioc->pdev) != 0) {
4543 pr_warn(MPT3SAS_FMT4484 ioc_warn(ioc, "no suitable consistent DMA mask for %s\n",
4544 "no suitable consistent DMA mask for %s\n",4485 pci_name(ioc->pdev));
4545 ioc->name, pci_name(ioc->pdev));
4546 goto out;4486 goto out;
4547 }4487 }
4548 }4488 }
@@ -4554,9 +4494,9 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
4554 * with some internal commands that could be outstanding4494 * with some internal commands that could be outstanding
4555 */4495 */
4556 ioc->shost->can_queue = ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT;4496 ioc->shost->can_queue = ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT;
4557 dinitprintk(ioc, pr_info(MPT3SAS_FMT4497 dinitprintk(ioc,
4558 "scsi host: can_queue depth (%d)\n",4498 ioc_info(ioc, "scsi host: can_queue depth (%d)\n",
4559 ioc->name, ioc->shost->can_queue));4499 ioc->shost->can_queue));
4560 4500
4561 4501
4562 /* contiguous pool for request and chains, 16 byte align, one extra "4502 /* contiguous pool for request and chains, 16 byte align, one extra "
@@ -4572,12 +4512,12 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 9 unmodified lines
4572 sz += (ioc->internal_depth * ioc->request_sz);4512 sz += (ioc->internal_depth * ioc->request_sz);
4573 4513
4574 ioc->request_dma_sz = sz;4514 ioc->request_dma_sz = sz;
4575 ioc->request = pci_alloc_consistent(ioc->pdev, sz, &ioc->request_dma);4515 ioc->request = dma_alloc_coherent(&ioc->pdev->dev, sz,
4516 &ioc->request_dma, GFP_KERNEL);
4576 if (!ioc->request) {4517 if (!ioc->request) {
4577 pr_err(MPT3SAS_FMT "request pool: pci_alloc_consistent " \4518 ioc_err(ioc, "request pool: dma_alloc_coherent failed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), total(%d kB)\n",
4578 "failed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), "4519 ioc->hba_queue_depth, ioc->chains_needed_per_io,
4579 "total(%d kB)\n", ioc->name, ioc->hba_queue_depth,4520 ioc->request_sz, sz / 1024);
4580 ioc->chains_needed_per_io, ioc->request_sz, sz/1024);
4581 if (ioc->scsiio_depth < MPT3SAS_SAS_QUEUE_DEPTH)4521 if (ioc->scsiio_depth < MPT3SAS_SAS_QUEUE_DEPTH)
4582 goto out;4522 goto out;
4583 retry_sz = 64;4523 retry_sz = 64;
@@ -4587,10 +4527,9 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
4587 }4527 }
4588 4528
4589 if (retry_sz)4529 if (retry_sz)
4590 pr_err(MPT3SAS_FMT "request pool: pci_alloc_consistent " \4530 ioc_err(ioc, "request pool: dma_alloc_coherent succeed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), total(%d kb)\n",
4591 "succeed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), "4531 ioc->hba_queue_depth, ioc->chains_needed_per_io,
4592 "total(%d kb)\n", ioc->name, ioc->hba_queue_depth,4532 ioc->request_sz, sz / 1024);
4593 ioc->chains_needed_per_io, ioc->request_sz, sz/1024);
4594 4533
4595 /* hi-priority queue */4534 /* hi-priority queue */
4596 ioc->hi_priority = ioc->request + ((ioc->scsiio_depth + 1) *4535 ioc->hi_priority = ioc->request + ((ioc->scsiio_depth + 1) *
@@ -4604,24 +4543,26 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines
4604 ioc->internal_dma = ioc->hi_priority_dma + (ioc->hi_priority_depth *4543 ioc->internal_dma = ioc->hi_priority_dma + (ioc->hi_priority_depth *
4605 ioc->request_sz);4544 ioc->request_sz);
4606 4545
4607 dinitprintk(ioc, pr_info(MPT3SAS_FMT4546 dinitprintk(ioc,
4608 "request pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n",4547 ioc_info(ioc, "request pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n",
4609 ioc->name, ioc->request, ioc->hba_queue_depth, ioc->request_sz,4548 ioc->request, ioc->hba_queue_depth,
4610 (ioc->hba_queue_depth * ioc->request_sz)/1024));4549 ioc->request_sz,
4550 (ioc->hba_queue_depth * ioc->request_sz) / 1024));
4611 4551
4612 dinitprintk(ioc, pr_info(MPT3SAS_FMT "request pool: dma(0x%llx)\n",4552 dinitprintk(ioc,
4613 ioc->name, (unsigned long long) ioc->request_dma));4553 ioc_info(ioc, "request pool: dma(0x%llx)\n",
4554 (unsigned long long)ioc->request_dma));
4614 total_sz += sz;4555 total_sz += sz;
4615 4556
4616 dinitprintk(ioc, pr_info(MPT3SAS_FMT "scsiio(0x%p): depth(%d)\n",4557 dinitprintk(ioc,
4617 ioc->name, ioc->request, ioc->scsiio_depth));4558 ioc_info(ioc, "scsiio(0x%p): depth(%d)\n",
4559 ioc->request, ioc->scsiio_depth));
4618 4560
4619 ioc->chain_depth = min_t(u32, ioc->chain_depth, MAX_CHAIN_DEPTH);4561 ioc->chain_depth = min_t(u32, ioc->chain_depth, MAX_CHAIN_DEPTH);
4620 sz = ioc->scsiio_depth * sizeof(struct chain_lookup);4562 sz = ioc->scsiio_depth * sizeof(struct chain_lookup);
4621 ioc->chain_lookup = kzalloc(sz, GFP_KERNEL);4563 ioc->chain_lookup = kzalloc(sz, GFP_KERNEL);
4622 if (!ioc->chain_lookup) {4564 if (!ioc->chain_lookup) {
4623 pr_err(MPT3SAS_FMT "chain_lookup: __get_free_pages "4565 ioc_err(ioc, "chain_lookup: __get_free_pages failed\n");
4624 "failed\n", ioc->name);
4625 goto out;4566 goto out;
4626 }4567 }
4627 4568
@@ -4629,8 +4570,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
4629 for (i = 0; i < ioc->scsiio_depth; i++) {4570 for (i = 0; i < ioc->scsiio_depth; i++) {
4630 ioc->chain_lookup[i].chains_per_smid = kzalloc(sz, GFP_KERNEL);4571 ioc->chain_lookup[i].chains_per_smid = kzalloc(sz, GFP_KERNEL);
4631 if (!ioc->chain_lookup[i].chains_per_smid) {4572 if (!ioc->chain_lookup[i].chains_per_smid) {
4632 pr_err(MPT3SAS_FMT "chain_lookup: "4573 ioc_err(ioc, "chain_lookup: kzalloc failed\n");
4633 " kzalloc failed\n", ioc->name);
4634 goto out;4574 goto out;
4635 }4575 }
4636 }4576 }
@@ -4639,29 +4579,27 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
4639 ioc->hpr_lookup = kcalloc(ioc->hi_priority_depth,4579 ioc->hpr_lookup = kcalloc(ioc->hi_priority_depth,
4640 sizeof(struct request_tracker), GFP_KERNEL);4580 sizeof(struct request_tracker), GFP_KERNEL);
4641 if (!ioc->hpr_lookup) {4581 if (!ioc->hpr_lookup) {
4642 pr_err(MPT3SAS_FMT "hpr_lookup: kcalloc failed\n",4582 ioc_err(ioc, "hpr_lookup: kcalloc failed\n");
4643 ioc->name);
4644 goto out;4583 goto out;
4645 }4584 }
4646 ioc->hi_priority_smid = ioc->scsiio_depth + 1;4585 ioc->hi_priority_smid = ioc->scsiio_depth + 1;
4647 dinitprintk(ioc, pr_info(MPT3SAS_FMT4586 dinitprintk(ioc,
4648 "hi_priority(0x%p): depth(%d), start smid(%d)\n",4587 ioc_info(ioc, "hi_priority(0x%p): depth(%d), start smid(%d)\n",
4649 ioc->name, ioc->hi_priority,4588 ioc->hi_priority,
4650 ioc->hi_priority_depth, ioc->hi_priority_smid));4589 ioc->hi_priority_depth, ioc->hi_priority_smid));
4651 4590
4652 /* initialize internal queue smid's */4591 /* initialize internal queue smid's */
4653 ioc->internal_lookup = kcalloc(ioc->internal_depth,4592 ioc->internal_lookup = kcalloc(ioc->internal_depth,
4654 sizeof(struct request_tracker), GFP_KERNEL);4593 sizeof(struct request_tracker), GFP_KERNEL);
4655 if (!ioc->internal_lookup) {4594 if (!ioc->internal_lookup) {
4656 pr_err(MPT3SAS_FMT "internal_lookup: kcalloc failed\n",4595 ioc_err(ioc, "internal_lookup: kcalloc failed\n");
4657 ioc->name);
4658 goto out;4596 goto out;
4659 }4597 }
4660 ioc->internal_smid = ioc->hi_priority_smid + ioc->hi_priority_depth;4598 ioc->internal_smid = ioc->hi_priority_smid + ioc->hi_priority_depth;
4661 dinitprintk(ioc, pr_info(MPT3SAS_FMT4599 dinitprintk(ioc,
4662 "internal(0x%p): depth(%d), start smid(%d)\n",4600 ioc_info(ioc, "internal(0x%p): depth(%d), start smid(%d)\n",
4663 ioc->name, ioc->internal,4601 ioc->internal,
4664 ioc->internal_depth, ioc->internal_smid));4602 ioc->internal_depth, ioc->internal_smid));
4665 /*4603 /*
4666 * The number of NVMe page sized blocks needed is:4604 * The number of NVMe page sized blocks needed is:
4667 * (((sg_tablesize * 8) - 1) / (page_size - 8)) + 14605 * (((sg_tablesize * 8) - 1) / (page_size - 8)) + 1
@@ -4685,17 +4623,14 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 17 unmodified lines
4685 sz = sizeof(struct pcie_sg_list) * ioc->scsiio_depth;4623 sz = sizeof(struct pcie_sg_list) * ioc->scsiio_depth;
4686 ioc->pcie_sg_lookup = kzalloc(sz, GFP_KERNEL);4624 ioc->pcie_sg_lookup = kzalloc(sz, GFP_KERNEL);
4687 if (!ioc->pcie_sg_lookup) {4625 if (!ioc->pcie_sg_lookup) {
4688 pr_info(MPT3SAS_FMT4626 ioc_info(ioc, "PCIe SGL lookup: kzalloc failed\n");
4689 "PCIe SGL lookup: kzalloc failed\n", ioc->name);
4690 goto out;4627 goto out;
4691 }4628 }
4692 sz = nvme_blocks_needed * ioc->page_size;4629 sz = nvme_blocks_needed * ioc->page_size;
4693 ioc->pcie_sgl_dma_pool =4630 ioc->pcie_sgl_dma_pool =
4694 dma_pool_create("PCIe SGL pool", &ioc->pdev->dev, sz, 16, 0);4631 dma_pool_create("PCIe SGL pool", &ioc->pdev->dev, sz, 16, 0);
4695 if (!ioc->pcie_sgl_dma_pool) {4632 if (!ioc->pcie_sgl_dma_pool) {
4696 pr_info(MPT3SAS_FMT4633 ioc_info(ioc, "PCIe SGL pool: dma_pool_create failed\n");
4697 "PCIe SGL pool: dma_pool_create failed\n",
4698 ioc->name);
4699 goto out;4634 goto out;
4700 }4635 }
4701 4636
@@ -4708,9 +4643,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 6 unmodified lines
4708 ioc->pcie_sgl_dma_pool, GFP_KERNEL,4643 ioc->pcie_sgl_dma_pool, GFP_KERNEL,
4709 &ioc->pcie_sg_lookup[i].pcie_sgl_dma);4644 &ioc->pcie_sg_lookup[i].pcie_sgl_dma);
4710 if (!ioc->pcie_sg_lookup[i].pcie_sgl) {4645 if (!ioc->pcie_sg_lookup[i].pcie_sgl) {
4711 pr_info(MPT3SAS_FMT4646 ioc_info(ioc, "PCIe SGL pool: dma_pool_alloc failed\n");
4712 "PCIe SGL pool: dma_pool_alloc failed\n",
4713 ioc->name);
4714 goto out;4647 goto out;
4715 }4648 }
4716 for (j = 0; j < ioc->chains_per_prp_buffer; j++) {4649 for (j = 0; j < ioc->chains_per_prp_buffer; j++) {
@@ -4724,20 +4657,20 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines
4724 }4657 }
4725 }4658 }
4726 4659
4727 dinitprintk(ioc, pr_info(MPT3SAS_FMT "PCIe sgl pool depth(%d), "4660 dinitprintk(ioc,
4728 "element_size(%d), pool_size(%d kB)\n", ioc->name,4661 ioc_info(ioc, "PCIe sgl pool depth(%d), element_size(%d), pool_size(%d kB)\n",
4729 ioc->scsiio_depth, sz, (sz * ioc->scsiio_depth)/1024));4662 ioc->scsiio_depth, sz,
4730 dinitprintk(ioc, pr_info(MPT3SAS_FMT "Number of chains can "4663 (sz * ioc->scsiio_depth) / 1024));
4731 "fit in a PRP page(%d)\n", ioc->name,4664 dinitprintk(ioc,
4732 ioc->chains_per_prp_buffer));4665 ioc_info(ioc, "Number of chains can fit in a PRP page(%d)\n",
4666 ioc->chains_per_prp_buffer));
4733 total_sz += sz * ioc->scsiio_depth;4667 total_sz += sz * ioc->scsiio_depth;
4734 }4668 }
4735 4669
4736 ioc->chain_dma_pool = dma_pool_create("chain pool", &ioc->pdev->dev,4670 ioc->chain_dma_pool = dma_pool_create("chain pool", &ioc->pdev->dev,
4737 ioc->chain_segment_sz, 16, 0);4671 ioc->chain_segment_sz, 16, 0);
4738 if (!ioc->chain_dma_pool) {4672 if (!ioc->chain_dma_pool) {
4739 pr_err(MPT3SAS_FMT "chain_dma_pool: dma_pool_create failed\n",4673 ioc_err(ioc, "chain_dma_pool: dma_pool_create failed\n");
4740 ioc->name);
4741 goto out;4674 goto out;
4742 }4675 }
4743 for (i = 0; i < ioc->scsiio_depth; i++) {4676 for (i = 0; i < ioc->scsiio_depth; i++) {
@@ -4748,8 +4681,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines
4748 ioc->chain_dma_pool, GFP_KERNEL,4681 ioc->chain_dma_pool, GFP_KERNEL,
4749 &ct->chain_buffer_dma);4682 &ct->chain_buffer_dma);
4750 if (!ct->chain_buffer) {4683 if (!ct->chain_buffer) {
4751 pr_err(MPT3SAS_FMT "chain_lookup: "4684 ioc_err(ioc, "chain_lookup: pci_pool_alloc failed\n");
4752 " pci_pool_alloc failed\n", ioc->name);
4753 _base_release_memory_pools(ioc);4685 _base_release_memory_pools(ioc);
4754 goto out;4686 goto out;
4755 }4687 }
@@ -4757,25 +4689,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
4757 total_sz += ioc->chain_segment_sz;4689 total_sz += ioc->chain_segment_sz;
4758 }4690 }
4759 4691
4760 dinitprintk(ioc, pr_info(MPT3SAS_FMT4692 dinitprintk(ioc,
4761 "chain pool depth(%d), frame_size(%d), pool_size(%d kB)\n",4693 ioc_info(ioc, "chain pool depth(%d), frame_size(%d), pool_size(%d kB)\n",
4762 ioc->name, ioc->chain_depth, ioc->chain_segment_sz,4694 ioc->chain_depth, ioc->chain_segment_sz,
4763 ((ioc->chain_depth * ioc->chain_segment_sz))/1024));4695 (ioc->chain_depth * ioc->chain_segment_sz) / 1024));
4764 4696
4765 /* sense buffers, 4 byte align */4697 /* sense buffers, 4 byte align */
4766 sz = ioc->scsiio_depth * SCSI_SENSE_BUFFERSIZE;4698 sz = ioc->scsiio_depth * SCSI_SENSE_BUFFERSIZE;
4767 ioc->sense_dma_pool = dma_pool_create("sense pool", &ioc->pdev->dev, sz,4699 ioc->sense_dma_pool = dma_pool_create("sense pool", &ioc->pdev->dev, sz,
4768 4, 0);4700 4, 0);
4769 if (!ioc->sense_dma_pool) {4701 if (!ioc->sense_dma_pool) {
4770 pr_err(MPT3SAS_FMT "sense pool: dma_pool_create failed\n",4702 ioc_err(ioc, "sense pool: dma_pool_create failed\n");
4771 ioc->name);
4772 goto out;4703 goto out;
4773 }4704 }
4774 ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL,4705 ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL,
4775 &ioc->sense_dma);4706 &ioc->sense_dma);
4776 if (!ioc->sense) {4707 if (!ioc->sense) {
4777 pr_err(MPT3SAS_FMT "sense pool: dma_pool_alloc failed\n",4708 ioc_err(ioc, "sense pool: dma_pool_alloc failed\n");
4778 ioc->name);
4779 goto out;4709 goto out;
4780 }4710 }
4781 /* sense buffer requires to be in same 4 gb region.4711 /* sense buffer requires to be in same 4 gb region.
@@ -4797,24 +4727,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 15 unmodified lines
4797 dma_pool_create("sense pool", &ioc->pdev->dev, sz,4727 dma_pool_create("sense pool", &ioc->pdev->dev, sz,
4798 roundup_pow_of_two(sz), 0);4728 roundup_pow_of_two(sz), 0);
4799 if (!ioc->sense_dma_pool) {4729 if (!ioc->sense_dma_pool) {
4800 pr_err(MPT3SAS_FMT "sense pool: pci_pool_create failed\n",4730 ioc_err(ioc, "sense pool: pci_pool_create failed\n");
4801 ioc->name);
4802 goto out;4731 goto out;
4803 }4732 }
4804 ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL,4733 ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL,
4805 &ioc->sense_dma);4734 &ioc->sense_dma);
4806 if (!ioc->sense) {4735 if (!ioc->sense) {
4807 pr_err(MPT3SAS_FMT "sense pool: pci_pool_alloc failed\n",4736 ioc_err(ioc, "sense pool: pci_pool_alloc failed\n");
4808 ioc->name);
4809 goto out;4737 goto out;
4810 }4738 }
4811 }4739 }
4812 dinitprintk(ioc, pr_info(MPT3SAS_FMT4740 dinitprintk(ioc,
4813 "sense pool(0x%p): depth(%d), element_size(%d), pool_size"4741 ioc_info(ioc, "sense pool(0x%p): depth(%d), element_size(%d), pool_size(%d kB)\n",
4814 "(%d kB)\n", ioc->name, ioc->sense, ioc->scsiio_depth,4742 ioc->sense, ioc->scsiio_depth,
4815 SCSI_SENSE_BUFFERSIZE, sz/1024));4743 SCSI_SENSE_BUFFERSIZE, sz / 1024));
4816 dinitprintk(ioc, pr_info(MPT3SAS_FMT "sense_dma(0x%llx)\n",4744 dinitprintk(ioc,
4817 ioc->name, (unsigned long long)ioc->sense_dma));4745 ioc_info(ioc, "sense_dma(0x%llx)\n",
4746 (unsigned long long)ioc->sense_dma));
4818 total_sz += sz;4747 total_sz += sz;
4819 4748
4820 /* reply pool, 4 byte align */4749 /* reply pool, 4 byte align */
@@ -4822,25 +4751,24 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
4822 ioc->reply_dma_pool = dma_pool_create("reply pool", &ioc->pdev->dev, sz,4751 ioc->reply_dma_pool = dma_pool_create("reply pool", &ioc->pdev->dev, sz,
4823 4, 0);4752 4, 0);
4824 if (!ioc->reply_dma_pool) {4753 if (!ioc->reply_dma_pool) {
4825 pr_err(MPT3SAS_FMT "reply pool: dma_pool_create failed\n",4754 ioc_err(ioc, "reply pool: dma_pool_create failed\n");
4826 ioc->name);
4827 goto out;4755 goto out;
4828 }4756 }
4829 ioc->reply = dma_pool_alloc(ioc->reply_dma_pool, GFP_KERNEL,4757 ioc->reply = dma_pool_alloc(ioc->reply_dma_pool, GFP_KERNEL,
4830 &ioc->reply_dma);4758 &ioc->reply_dma);
4831 if (!ioc->reply) {4759 if (!ioc->reply) {
4832 pr_err(MPT3SAS_FMT "reply pool: dma_pool_alloc failed\n",4760 ioc_err(ioc, "reply pool: dma_pool_alloc failed\n");
4833 ioc->name);
4834 goto out;4761 goto out;
4835 }4762 }
4836 ioc->reply_dma_min_address = (u32)(ioc->reply_dma);4763 ioc->reply_dma_min_address = (u32)(ioc->reply_dma);
4837 ioc->reply_dma_max_address = (u32)(ioc->reply_dma) + sz;4764 ioc->reply_dma_max_address = (u32)(ioc->reply_dma) + sz;
4838 dinitprintk(ioc, pr_info(MPT3SAS_FMT4765 dinitprintk(ioc,
4839 "reply pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n",4766 ioc_info(ioc, "reply pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n",
4840 ioc->name, ioc->reply,4767 ioc->reply, ioc->reply_free_queue_depth,
4841 ioc->reply_free_queue_depth, ioc->reply_sz, sz/1024));4768 ioc->reply_sz, sz / 1024));
4842 dinitprintk(ioc, pr_info(MPT3SAS_FMT "reply_dma(0x%llx)\n",4769 dinitprintk(ioc,
4843 ioc->name, (unsigned long long)ioc->reply_dma));4770 ioc_info(ioc, "reply_dma(0x%llx)\n",
4771 (unsigned long long)ioc->reply_dma));
4844 total_sz += sz;4772 total_sz += sz;
4845 4773
4846 /* reply free queue, 16 byte align */4774 /* reply free queue, 16 byte align */
@@ -4848,24 +4776,22 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
4848 ioc->reply_free_dma_pool = dma_pool_create("reply_free pool",4776 ioc->reply_free_dma_pool = dma_pool_create("reply_free pool",
4849 &ioc->pdev->dev, sz, 16, 0);4777 &ioc->pdev->dev, sz, 16, 0);
4850 if (!ioc->reply_free_dma_pool) {4778 if (!ioc->reply_free_dma_pool) {
4851 pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_create failed\n",4779 ioc_err(ioc, "reply_free pool: dma_pool_create failed\n");
4852 ioc->name);
4853 goto out;4780 goto out;
4854 }4781 }
4855 ioc->reply_free = dma_pool_alloc(ioc->reply_free_dma_pool, GFP_KERNEL,4782 ioc->reply_free = dma_pool_zalloc(ioc->reply_free_dma_pool, GFP_KERNEL,
4856 &ioc->reply_free_dma);4783 &ioc->reply_free_dma);
4857 if (!ioc->reply_free) {4784 if (!ioc->reply_free) {
4858 pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_alloc failed\n",4785 ioc_err(ioc, "reply_free pool: dma_pool_alloc failed\n");
4859 ioc->name);
4860 goto out;4786 goto out;
4861 }4787 }
4862 memset(ioc->reply_free, 0, sz);4788 dinitprintk(ioc,
4863 dinitprintk(ioc, pr_info(MPT3SAS_FMT "reply_free pool(0x%p): " \4789 ioc_info(ioc, "reply_free pool(0x%p): depth(%d), element_size(%d), pool_size(%d kB)\n",
4864 "depth(%d), element_size(%d), pool_size(%d kB)\n", ioc->name,4790 ioc->reply_free, ioc->reply_free_queue_depth,
4865 ioc->reply_free, ioc->reply_free_queue_depth, 4, sz/1024));4791 4, sz / 1024));
4866 dinitprintk(ioc, pr_info(MPT3SAS_FMT4792 dinitprintk(ioc,
4867 "reply_free_dma (0x%llx)\n",4793 ioc_info(ioc, "reply_free_dma (0x%llx)\n",
4868 ioc->name, (unsigned long long)ioc->reply_free_dma));4794 (unsigned long long)ioc->reply_free_dma));
4869 total_sz += sz;4795 total_sz += sz;
4870 4796
4871 if (ioc->rdpq_array_enable) {4797 if (ioc->rdpq_array_enable) {
@@ -4876,8 +4802,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines
4876 &ioc->pdev->dev, reply_post_free_array_sz, 16, 0);4802 &ioc->pdev->dev, reply_post_free_array_sz, 16, 0);
4877 if (!ioc->reply_post_free_array_dma_pool) {4803 if (!ioc->reply_post_free_array_dma_pool) {
4878 dinitprintk(ioc,4804 dinitprintk(ioc,
4879 pr_info(MPT3SAS_FMT "reply_post_free_array pool: "4805 ioc_info(ioc, "reply_post_free_array pool: dma_pool_create failed\n"));
4880 "dma_pool_create failed\n", ioc->name));
4881 goto out;4806 goto out;
4882 }4807 }
4883 ioc->reply_post_free_array =4808 ioc->reply_post_free_array =
@@ -4885,34 +4810,31 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
4885 GFP_KERNEL, &ioc->reply_post_free_array_dma);4810 GFP_KERNEL, &ioc->reply_post_free_array_dma);
4886 if (!ioc->reply_post_free_array) {4811 if (!ioc->reply_post_free_array) {
4887 dinitprintk(ioc,4812 dinitprintk(ioc,
4888 pr_info(MPT3SAS_FMT "reply_post_free_array pool: "4813 ioc_info(ioc, "reply_post_free_array pool: dma_pool_alloc failed\n"));
4889 "dma_pool_alloc failed\n", ioc->name));
4890 goto out;4814 goto out;
4891 }4815 }
4892 }4816 }
4893 ioc->config_page_sz = 512;4817 ioc->config_page_sz = 512;
4894 ioc->config_page = pci_alloc_consistent(ioc->pdev,4818 ioc->config_page = dma_alloc_coherent(&ioc->pdev->dev,
4895 ioc->config_page_sz, &ioc->config_page_dma);4819 ioc->config_page_sz, &ioc->config_page_dma, GFP_KERNEL);
4896 if (!ioc->config_page) {4820 if (!ioc->config_page) {
4897 pr_err(MPT3SAS_FMT4821 ioc_err(ioc, "config page: dma_pool_alloc failed\n");
4898 "config page: dma_pool_alloc failed\n",
4899 ioc->name);
4900 goto out;4822 goto out;
4901 }4823 }
4902 dinitprintk(ioc, pr_info(MPT3SAS_FMT4824 dinitprintk(ioc,
4903 "config page(0x%p): size(%d)\n",4825 ioc_info(ioc, "config page(0x%p): size(%d)\n",
4904 ioc->name, ioc->config_page, ioc->config_page_sz));4826 ioc->config_page, ioc->config_page_sz));
4905 dinitprintk(ioc, pr_info(MPT3SAS_FMT "config_page_dma(0x%llx)\n",4827 dinitprintk(ioc,
4906 ioc->name, (unsigned long long)ioc->config_page_dma));4828 ioc_info(ioc, "config_page_dma(0x%llx)\n",
4829 (unsigned long long)ioc->config_page_dma));
4907 total_sz += ioc->config_page_sz;4830 total_sz += ioc->config_page_sz;
4908 4831
4909 pr_info(MPT3SAS_FMT "Allocated physical memory: size(%d kB)\n",4832 ioc_info(ioc, "Allocated physical memory: size(%d kB)\n",
4910 ioc->name, total_sz/1024);4833 total_sz / 1024);
4911 pr_info(MPT3SAS_FMT4834 ioc_info(ioc, "Current Controller Queue Depth(%d),Max Controller Queue Depth(%d)\n",
4912 "Current Controller Queue Depth(%d),Max Controller Queue Depth(%d)\n",4835 ioc->shost->can_queue, facts->RequestCredit);
4913 ioc->name, ioc->shost->can_queue, facts->RequestCredit);4836 ioc_info(ioc, "Scatter Gather Elements per IO(%d)\n",
4914 pr_info(MPT3SAS_FMT "Scatter Gather Elements per IO(%d)\n",4837 ioc->shost->sg_tablesize);
4915 ioc->name, ioc->shost->sg_tablesize);
4916 return 0;4838 return 0;
4917 4839
4918 out:4840 out:
@@ -4990,9 +4912,9 @@ _base_wait_for_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) · 71 unmodified lines
4990 do {4912 do {
4991 int_status = readl(&ioc->chip->HostInterruptStatus);4913 int_status = readl(&ioc->chip->HostInterruptStatus);
4992 if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) {4914 if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) {
4993 dhsprintk(ioc, pr_info(MPT3SAS_FMT4915 dhsprintk(ioc,
4994 "%s: successful count(%d), timeout(%d)\n",4916 ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
4995 ioc->name, __func__, count, timeout));4917 __func__, count, timeout));
4996 return 0;4918 return 0;
4997 }4919 }
4998 4920
@@ -5000,9 +4922,8 @@ _base_wait_for_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) · 1 unmodified line
5000 count++;4922 count++;
5001 } while (--cntdn);4923 } while (--cntdn);
5002 4924
5003 pr_err(MPT3SAS_FMT4925 ioc_err(ioc, "%s: failed due to timeout count(%d), int_status(%x)!\n",
5004 "%s: failed due to timeout count(%d), int_status(%x)!\n",4926 __func__, count, int_status);
5005 ioc->name, __func__, count, int_status);
5006 return -EFAULT;4927 return -EFAULT;
5007}4928}
5008 4929
@@ -5017,9 +4938,9 @@ _base_spin_on_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) · 8 unmodified lines
5017 do {4938 do {
5018 int_status = readl(&ioc->chip->HostInterruptStatus);4939 int_status = readl(&ioc->chip->HostInterruptStatus);
5019 if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) {4940 if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) {
5020 dhsprintk(ioc, pr_info(MPT3SAS_FMT4941 dhsprintk(ioc,
5021 "%s: successful count(%d), timeout(%d)\n",4942 ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
5022 ioc->name, __func__, count, timeout));4943 __func__, count, timeout));
5023 return 0;4944 return 0;
5024 }4945 }
5025 4946
@@ -5027,9 +4948,8 @@ _base_spin_on_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) · 1 unmodified line
5027 count++;4948 count++;
5028 } while (--cntdn);4949 } while (--cntdn);
5029 4950
5030 pr_err(MPT3SAS_FMT4951 ioc_err(ioc, "%s: failed due to timeout count(%d), int_status(%x)!\n",
5031 "%s: failed due to timeout count(%d), int_status(%x)!\n",4952 __func__, count, int_status);
5032 ioc->name, __func__, count, int_status);
5033 return -EFAULT;4953 return -EFAULT;
5034 4954
5035}4955}
@@ -5056,9 +4976,9 @@ _base_wait_for_doorbell_ack(struct MPT3SAS_ADAPTER *ioc, int timeout) · 20 unmodified lines
5056 do {4976 do {
5057 int_status = readl(&ioc->chip->HostInterruptStatus);4977 int_status = readl(&ioc->chip->HostInterruptStatus);
5058 if (!(int_status & MPI2_HIS_SYS2IOC_DB_STATUS)) {4978 if (!(int_status & MPI2_HIS_SYS2IOC_DB_STATUS)) {
5059 dhsprintk(ioc, pr_info(MPT3SAS_FMT4979 dhsprintk(ioc,
5060 "%s: successful count(%d), timeout(%d)\n",4980 ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
5061 ioc->name, __func__, count, timeout));4981 __func__, count, timeout));
5062 return 0;4982 return 0;
5063 } else if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) {4983 } else if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) {
5064 doorbell = readl(&ioc->chip->Doorbell);4984 doorbell = readl(&ioc->chip->Doorbell);
@@ -5075,9 +4995,8 @@ _base_wait_for_doorbell_ack(struct MPT3SAS_ADAPTER *ioc, int timeout) · 10 unmodified lines
5075 } while (--cntdn);4995 } while (--cntdn);
5076 4996
5077 out:4997 out:
5078 pr_err(MPT3SAS_FMT4998 ioc_err(ioc, "%s: failed due to timeout count(%d), int_status(%x)!\n",
5079 "%s: failed due to timeout count(%d), int_status(%x)!\n",4999 __func__, count, int_status);
5080 ioc->name, __func__, count, int_status);
5081 return -EFAULT;5000 return -EFAULT;
5082}5001}
5083 5002
@@ -5099,9 +5018,9 @@ _base_wait_for_doorbell_not_used(struct MPT3SAS_ADAPTER *ioc, int timeout) · 15 unmodified lines
5099 do {5018 do {
5100 doorbell_reg = readl(&ioc->chip->Doorbell);5019 doorbell_reg = readl(&ioc->chip->Doorbell);
5101 if (!(doorbell_reg & MPI2_DOORBELL_USED)) {5020 if (!(doorbell_reg & MPI2_DOORBELL_USED)) {
5102 dhsprintk(ioc, pr_info(MPT3SAS_FMT5021 dhsprintk(ioc,
5103 "%s: successful count(%d), timeout(%d)\n",5022 ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
5104 ioc->name, __func__, count, timeout));5023 __func__, count, timeout));
5105 return 0;5024 return 0;
5106 }5025 }
5107 5026
@@ -5109,9 +5028,8 @@ _base_wait_for_doorbell_not_used(struct MPT3SAS_ADAPTER *ioc, int timeout) · 1 unmodified line
5109 count++;5028 count++;
5110 } while (--cntdn);5029 } while (--cntdn);
5111 5030
5112 pr_err(MPT3SAS_FMT5031 ioc_err(ioc, "%s: failed due to timeout count(%d), doorbell_reg(%x)!\n",
5113 "%s: failed due to timeout count(%d), doorbell_reg(%x)!\n",5032 __func__, count, doorbell_reg);
5114 ioc->name, __func__, count, doorbell_reg);
5115 return -EFAULT;5033 return -EFAULT;
5116}5034}
5117 5035
@@ -5130,8 +5048,7 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout) · 12 unmodified lines
5130 int r = 0;5048 int r = 0;
5131 5049
5132 if (reset_type != MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET) {5050 if (reset_type != MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET) {
5133 pr_err(MPT3SAS_FMT "%s: unknown reset_type\n",5051 ioc_err(ioc, "%s: unknown reset_type\n", __func__);
5134 ioc->name, __func__);
5135 return -EFAULT;5052 return -EFAULT;
5136 }5053 }
5137 5054
@@ -5139,7 +5056,7 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout) · 1 unmodified line
5139 MPI2_IOCFACTS_CAPABILITY_EVENT_REPLAY))5056 MPI2_IOCFACTS_CAPABILITY_EVENT_REPLAY))
5140 return -EFAULT;5057 return -EFAULT;
5141 5058
5142 pr_info(MPT3SAS_FMT "sending message unit reset !!\n", ioc->name);5059 ioc_info(ioc, "sending message unit reset !!\n");
5143 5060
5144 writel(reset_type << MPI2_DOORBELL_FUNCTION_SHIFT,5061 writel(reset_type << MPI2_DOORBELL_FUNCTION_SHIFT,
5145 &ioc->chip->Doorbell);5062 &ioc->chip->Doorbell);
@@ -5149,15 +5066,14 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout) · 3 unmodified lines
5149 }5066 }
5150 ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, timeout);5067 ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, timeout);
5151 if (ioc_state) {5068 if (ioc_state) {
5152 pr_err(MPT3SAS_FMT5069 ioc_err(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n",
5153 "%s: failed going to ready state (ioc_state=0x%x)\n",5070 __func__, ioc_state);
5154 ioc->name, __func__, ioc_state);
5155 r = -EFAULT;5071 r = -EFAULT;
5156 goto out;5072 goto out;
5157 }5073 }
5158 out:5074 out:
5159 pr_info(MPT3SAS_FMT "message unit reset: %s\n",5075 ioc_info(ioc, "message unit reset: %s\n",
5160 ioc->name, ((r == 0) ? "SUCCESS" : "FAILED"));5076 r == 0 ? "SUCCESS" : "FAILED");
5161 return r;5077 return r;
5162}5078}
5163 5079
@@ -5183,9 +5099,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 19 unmodified lines
5183 5099
5184 /* make sure doorbell is not in use */5100 /* make sure doorbell is not in use */
5185 if ((readl(&ioc->chip->Doorbell) & MPI2_DOORBELL_USED)) {5101 if ((readl(&ioc->chip->Doorbell) & MPI2_DOORBELL_USED)) {
5186 pr_err(MPT3SAS_FMT5102 ioc_err(ioc, "doorbell is in use (line=%d)\n", __LINE__);
5187 "doorbell is in use (line=%d)\n",
5188 ioc->name, __LINE__);
5189 return -EFAULT;5103 return -EFAULT;
5190 }5104 }
5191 5105
@@ -5200,17 +5114,15 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 8 unmodified lines
5200 &ioc->chip->Doorbell);5114 &ioc->chip->Doorbell);
5201 5115
5202 if ((_base_spin_on_doorbell_int(ioc, 5))) {5116 if ((_base_spin_on_doorbell_int(ioc, 5))) {
5203 pr_err(MPT3SAS_FMT5117 ioc_err(ioc, "doorbell handshake int failed (line=%d)\n",
5204 "doorbell handshake int failed (line=%d)\n",5118 __LINE__);
5205 ioc->name, __LINE__);
5206 return -EFAULT;5119 return -EFAULT;
5207 }5120 }
5208 writel(0, &ioc->chip->HostInterruptStatus);5121 writel(0, &ioc->chip->HostInterruptStatus);
5209 5122
5210 if ((_base_wait_for_doorbell_ack(ioc, 5))) {5123 if ((_base_wait_for_doorbell_ack(ioc, 5))) {
5211 pr_err(MPT3SAS_FMT5124 ioc_err(ioc, "doorbell handshake ack failed (line=%d)\n",
5212 "doorbell handshake ack failed (line=%d)\n",5125 __LINE__);
5213 ioc->name, __LINE__);
5214 return -EFAULT;5126 return -EFAULT;
5215 }5127 }
5216 5128
@@ -5222,17 +5134,15 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 5 unmodified lines
5222 }5134 }
5223 5135
5224 if (failed) {5136 if (failed) {
5225 pr_err(MPT3SAS_FMT5137 ioc_err(ioc, "doorbell handshake sending request failed (line=%d)\n",
5226 "doorbell handshake sending request failed (line=%d)\n",5138 __LINE__);
5227 ioc->name, __LINE__);
5228 return -EFAULT;5139 return -EFAULT;
5229 }5140 }
5230 5141
5231 /* now wait for the reply */5142 /* now wait for the reply */
5232 if ((_base_wait_for_doorbell_int(ioc, timeout))) {5143 if ((_base_wait_for_doorbell_int(ioc, timeout))) {
5233 pr_err(MPT3SAS_FMT5144 ioc_err(ioc, "doorbell handshake int failed (line=%d)\n",
5234 "doorbell handshake int failed (line=%d)\n",5145 __LINE__);
5235 ioc->name, __LINE__);
5236 return -EFAULT;5146 return -EFAULT;
5237 }5147 }
5238 5148
@@ -5241,9 +5151,8 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 2 unmodified lines
5241 & MPI2_DOORBELL_DATA_MASK);5151 & MPI2_DOORBELL_DATA_MASK);
5242 writel(0, &ioc->chip->HostInterruptStatus);5152 writel(0, &ioc->chip->HostInterruptStatus);
5243 if ((_base_wait_for_doorbell_int(ioc, 5))) {5153 if ((_base_wait_for_doorbell_int(ioc, 5))) {
5244 pr_err(MPT3SAS_FMT5154 ioc_err(ioc, "doorbell handshake int failed (line=%d)\n",
5245 "doorbell handshake int failed (line=%d)\n",5155 __LINE__);
5246 ioc->name, __LINE__);
5247 return -EFAULT;5156 return -EFAULT;
5248 }5157 }
5249 reply[1] = le16_to_cpu(readl(&ioc->chip->Doorbell)5158 reply[1] = le16_to_cpu(readl(&ioc->chip->Doorbell)
@@ -5252,9 +5161,8 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 2 unmodified lines
5252 5161
5253 for (i = 2; i < default_reply->MsgLength * 2; i++) {5162 for (i = 2; i < default_reply->MsgLength * 2; i++) {
5254 if ((_base_wait_for_doorbell_int(ioc, 5))) {5163 if ((_base_wait_for_doorbell_int(ioc, 5))) {
5255 pr_err(MPT3SAS_FMT5164 ioc_err(ioc, "doorbell handshake int failed (line=%d)\n",
5256 "doorbell handshake int failed (line=%d)\n",5165 __LINE__);
5257 ioc->name, __LINE__);
5258 return -EFAULT;5166 return -EFAULT;
5259 }5167 }
5260 if (i >= reply_bytes/2) /* overflow case */5168 if (i >= reply_bytes/2) /* overflow case */
@@ -5267,8 +5175,9 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 6 unmodified lines
5267 5175
5268 _base_wait_for_doorbell_int(ioc, 5);5176 _base_wait_for_doorbell_int(ioc, 5);
5269 if (_base_wait_for_doorbell_not_used(ioc, 5) != 0) {5177 if (_base_wait_for_doorbell_not_used(ioc, 5) != 0) {
5270 dhsprintk(ioc, pr_info(MPT3SAS_FMT5178 dhsprintk(ioc,
5271 "doorbell is in use (line=%d)\n", ioc->name, __LINE__));5179 ioc_info(ioc, "doorbell is in use (line=%d)\n",
5180 __LINE__));
5272 }5181 }
5273 writel(0, &ioc->chip->HostInterruptStatus);5182 writel(0, &ioc->chip->HostInterruptStatus);
5274 5183
@@ -5308,14 +5217,12 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc, · 33 unmodified lines
5308 void *request;5217 void *request;
5309 u16 wait_state_count;5218 u16 wait_state_count;
5310 5219
5311 dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,5220 dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
5312 __func__));
5313 5221
5314 mutex_lock(&ioc->base_cmds.mutex);5222 mutex_lock(&ioc->base_cmds.mutex);
5315 5223
5316 if (ioc->base_cmds.status != MPT3_CMD_NOT_USED) {5224 if (ioc->base_cmds.status != MPT3_CMD_NOT_USED) {
5317 pr_err(MPT3SAS_FMT "%s: base_cmd in use\n",5225 ioc_err(ioc, "%s: base_cmd in use\n", __func__);
5318 ioc->name, __func__);
5319 rc = -EAGAIN;5226 rc = -EAGAIN;
5320 goto out;5227 goto out;
5321 }5228 }
@@ -5324,23 +5231,20 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines
5324 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);5231 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
5325 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {5232 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
5326 if (wait_state_count++ == 10) {5233 if (wait_state_count++ == 10) {
5327 pr_err(MPT3SAS_FMT5234 ioc_err(ioc, "%s: failed due to ioc not operational\n",
5328 "%s: failed due to ioc not operational\n",5235 __func__);
5329 ioc->name, __func__);
5330 rc = -EFAULT;5236 rc = -EFAULT;
5331 goto out;5237 goto out;
5332 }5238 }
5333 ssleep(1);5239 ssleep(1);
5334 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);5240 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
5335 pr_info(MPT3SAS_FMT5241 ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
5336 "%s: waiting for operational state(count=%d)\n",5242 __func__, wait_state_count);
5337 ioc->name, __func__, wait_state_count);
5338 }5243 }
5339 5244
5340 smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);5245 smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);
5341 if (!smid) {5246 if (!smid) {
5342 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",5247 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
5343 ioc->name, __func__);
5344 rc = -EAGAIN;5248 rc = -EAGAIN;
5345 goto out;5249 goto out;
5346 }5250 }
@@ -5408,14 +5312,12 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc, · 61 unmodified lines
5408 void *request;5312 void *request;
5409 u16 wait_state_count;5313 u16 wait_state_count;
5410 5314
5411 dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,5315 dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
5412 __func__));
5413 5316
5414 mutex_lock(&ioc->base_cmds.mutex);5317 mutex_lock(&ioc->base_cmds.mutex);
5415 5318
5416 if (ioc->base_cmds.status != MPT3_CMD_NOT_USED) {5319 if (ioc->base_cmds.status != MPT3_CMD_NOT_USED) {
5417 pr_err(MPT3SAS_FMT "%s: base_cmd in use\n",5320 ioc_err(ioc, "%s: base_cmd in use\n", __func__);
5418 ioc->name, __func__);
5419 rc = -EAGAIN;5321 rc = -EAGAIN;
5420 goto out;5322 goto out;
5421 }5323 }
@@ -5424,24 +5326,20 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines
5424 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);5326 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
5425 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {5327 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
5426 if (wait_state_count++ == 10) {5328 if (wait_state_count++ == 10) {
5427 pr_err(MPT3SAS_FMT5329 ioc_err(ioc, "%s: failed due to ioc not operational\n",
5428 "%s: failed due to ioc not operational\n",5330 __func__);
5429 ioc->name, __func__);
5430 rc = -EFAULT;5331 rc = -EFAULT;
5431 goto out;5332 goto out;
5432 }5333 }
5433 ssleep(1);5334 ssleep(1);
5434 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);5335 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
5435 pr_info(MPT3SAS_FMT5336 ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
5436 "%s: waiting for operational state(count=%d)\n",5337 __func__, wait_state_count);
5437 ioc->name,
5438 __func__, wait_state_count);
5439 }5338 }
5440 5339
5441 smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);5340 smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);
5442 if (!smid) {5341 if (!smid) {
5443 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",5342 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
5444 ioc->name, __func__);
5445 rc = -EAGAIN;5343 rc = -EAGAIN;
5446 goto out;5344 goto out;
5447 }5345 }
@@ -5495,8 +5393,7 @@ _base_get_port_facts(struct MPT3SAS_ADAPTER *ioc, int port) · 47 unmodified lines
5495 struct mpt3sas_port_facts *pfacts;5393 struct mpt3sas_port_facts *pfacts;
5496 int mpi_reply_sz, mpi_request_sz, r;5394 int mpi_reply_sz, mpi_request_sz, r;
5497 5395
5498 dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,5396 dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
5499 __func__));
5500 5397
5501 mpi_reply_sz = sizeof(Mpi2PortFactsReply_t);5398 mpi_reply_sz = sizeof(Mpi2PortFactsReply_t);
5502 mpi_request_sz = sizeof(Mpi2PortFactsRequest_t);5399 mpi_request_sz = sizeof(Mpi2PortFactsRequest_t);
@@ -5507,8 +5404,7 @@ _base_get_port_facts(struct MPT3SAS_ADAPTER *ioc, int port) · 4 unmodified lines
5507 (u32 *)&mpi_request, mpi_reply_sz, (u16 *)&mpi_reply, 5);5404 (u32 *)&mpi_request, mpi_reply_sz, (u16 *)&mpi_reply, 5);
5508 5405
5509 if (r != 0) {5406 if (r != 0) {
5510 pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n",5407 ioc_err(ioc, "%s: handshake failed (r=%d)\n", __func__, r);
5511 ioc->name, __func__, r);
5512 return r;5408 return r;
5513 }5409 }
5514 5410
@@ -5536,26 +5432,26 @@ _base_wait_for_iocstate(struct MPT3SAS_ADAPTER *ioc, int timeout) · 21 unmodified lines
5536 u32 ioc_state;5432 u32 ioc_state;
5537 int rc;5433 int rc;
5538 5434
5539 dinitprintk(ioc, printk(MPT3SAS_FMT "%s\n", ioc->name,5435 dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
5540 __func__));
5541 5436
5542 if (ioc->pci_error_recovery) {5437 if (ioc->pci_error_recovery) {
5543 dfailprintk(ioc, printk(MPT3SAS_FMT5438 dfailprintk(ioc,
5544 "%s: host in pci error recovery\n", ioc->name, __func__));5439 ioc_info(ioc, "%s: host in pci error recovery\n",
5440 __func__));
5545 return -EFAULT;5441 return -EFAULT;
5546 }5442 }
5547 5443
5548 ioc_state = mpt3sas_base_get_iocstate(ioc, 0);5444 ioc_state = mpt3sas_base_get_iocstate(ioc, 0);
5549 dhsprintk(ioc, printk(MPT3SAS_FMT "%s: ioc_state(0x%08x)\n",5445 dhsprintk(ioc,
5550 ioc->name, __func__, ioc_state));5446 ioc_info(ioc, "%s: ioc_state(0x%08x)\n",
5447 __func__, ioc_state));
5551 5448
5552 if (((ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_READY) ||5449 if (((ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_READY) ||
5553 (ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_OPERATIONAL)5450 (ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_OPERATIONAL)
5554 return 0;5451 return 0;
5555 5452
5556 if (ioc_state & MPI2_DOORBELL_USED) {5453 if (ioc_state & MPI2_DOORBELL_USED) {
5557 dhsprintk(ioc, printk(MPT3SAS_FMT5454 dhsprintk(ioc, ioc_info(ioc, "unexpected doorbell active!\n"));
5558 "unexpected doorbell active!\n", ioc->name));
5559 goto issue_diag_reset;5455 goto issue_diag_reset;
5560 }5456 }
5561 5457
@@ -5567,9 +5463,9 @@ _base_wait_for_iocstate(struct MPT3SAS_ADAPTER *ioc, int timeout) · 5 unmodified lines
5567 5463
5568 ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, timeout);5464 ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, timeout);
5569 if (ioc_state) {5465 if (ioc_state) {
5570 dfailprintk(ioc, printk(MPT3SAS_FMT5466 dfailprintk(ioc,
5571 "%s: failed going to ready state (ioc_state=0x%x)\n",5467 ioc_info(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n",
5572 ioc->name, __func__, ioc_state));5468 __func__, ioc_state));
5573 return -EFAULT;5469 return -EFAULT;
5574 }5470 }
5575 5471
@@ -5592,14 +5488,13 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines
5592 struct mpt3sas_facts *facts;5488 struct mpt3sas_facts *facts;
5593 int mpi_reply_sz, mpi_request_sz, r;5489 int mpi_reply_sz, mpi_request_sz, r;
5594 5490
5595 dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,5491 dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
5596 __func__));
5597 5492
5598 r = _base_wait_for_iocstate(ioc, 10);5493 r = _base_wait_for_iocstate(ioc, 10);
5599 if (r) {5494 if (r) {
5600 dfailprintk(ioc, printk(MPT3SAS_FMT5495 dfailprintk(ioc,
5601 "%s: failed getting to correct state\n",5496 ioc_info(ioc, "%s: failed getting to correct state\n",
5602 ioc->name, __func__));5497 __func__));
5603 return r;5498 return r;
5604 }5499 }
5605 mpi_reply_sz = sizeof(Mpi2IOCFactsReply_t);5500 mpi_reply_sz = sizeof(Mpi2IOCFactsReply_t);
@@ -5610,8 +5505,7 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines
5610 (u32 *)&mpi_request, mpi_reply_sz, (u16 *)&mpi_reply, 5);5505 (u32 *)&mpi_request, mpi_reply_sz, (u16 *)&mpi_reply, 5);
5611 5506
5612 if (r != 0) {5507 if (r != 0) {
5613 pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n",5508 ioc_err(ioc, "%s: handshake failed (r=%d)\n", __func__, r);
5614 ioc->name, __func__, r);
5615 return r;5509 return r;
5616 }5510 }
5617 5511
@@ -5663,20 +5557,20 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc) · 45 unmodified lines
5663 */5557 */
5664 ioc->page_size = 1 << facts->CurrentHostPageSize;5558 ioc->page_size = 1 << facts->CurrentHostPageSize;
5665 if (ioc->page_size == 1) {5559 if (ioc->page_size == 1) {
5666 pr_info(MPT3SAS_FMT "CurrentHostPageSize is 0: Setting "5560 ioc_info(ioc, "CurrentHostPageSize is 0: Setting default host page size to 4k\n");
5667 "default host page size to 4k\n", ioc->name);
5668 ioc->page_size = 1 << MPT3SAS_HOST_PAGE_SIZE_4K;5561 ioc->page_size = 1 << MPT3SAS_HOST_PAGE_SIZE_4K;
5669 }5562 }
5670 dinitprintk(ioc, pr_info(MPT3SAS_FMT "CurrentHostPageSize(%d)\n",5563 dinitprintk(ioc,
5671 ioc->name, facts->CurrentHostPageSize));5564 ioc_info(ioc, "CurrentHostPageSize(%d)\n",
5672 5565 facts->CurrentHostPageSize));
5673 dinitprintk(ioc, pr_info(MPT3SAS_FMT5566
5674 "hba queue depth(%d), max chains per io(%d)\n",5567 dinitprintk(ioc,
5675 ioc->name, facts->RequestCredit,5568 ioc_info(ioc, "hba queue depth(%d), max chains per io(%d)\n",
5676 facts->MaxChainDepth));5569 facts->RequestCredit, facts->MaxChainDepth));
5677 dinitprintk(ioc, pr_info(MPT3SAS_FMT5570 dinitprintk(ioc,
5678 "request frame size(%d), reply frame size(%d)\n", ioc->name,5571 ioc_info(ioc, "request frame size(%d), reply frame size(%d)\n",
5679 facts->IOCRequestFrameSize * 4, facts->ReplyFrameSize * 4));5572 facts->IOCRequestFrameSize * 4,
5573 facts->ReplyFrameSize * 4));
5680 return 0;5574 return 0;
5681}5575}
5682 5576
@@ -5696,8 +5590,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc) · 13 unmodified lines
5696 u16 ioc_status;5590 u16 ioc_status;
5697 u32 reply_post_free_array_sz = 0;5591 u32 reply_post_free_array_sz = 0;
5698 5592
5699 dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,5593 dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
5700 __func__));
5701 5594
5702 memset(&mpi_request, 0, sizeof(Mpi2IOCInitRequest_t));5595 memset(&mpi_request, 0, sizeof(Mpi2IOCInitRequest_t));
5703 mpi_request.Function = MPI2_FUNCTION_IOC_INIT;5596 mpi_request.Function = MPI2_FUNCTION_IOC_INIT;
@@ -5763,15 +5656,14 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc) · 59 unmodified lines
5763 sizeof(Mpi2IOCInitReply_t), (u16 *)&mpi_reply, 10);5656 sizeof(Mpi2IOCInitReply_t), (u16 *)&mpi_reply, 10);
5764 5657
5765 if (r != 0) {5658 if (r != 0) {
5766 pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n",5659 ioc_err(ioc, "%s: handshake failed (r=%d)\n", __func__, r);
5767 ioc->name, __func__, r);
5768 return r;5660 return r;
5769 }5661 }
5770 5662
5771 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK;5663 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK;
5772 if (ioc_status != MPI2_IOCSTATUS_SUCCESS ||5664 if (ioc_status != MPI2_IOCSTATUS_SUCCESS ||
5773 mpi_reply.IOCLogInfo) {5665 mpi_reply.IOCLogInfo) {
5774 pr_err(MPT3SAS_FMT "%s: failed\n", ioc->name, __func__);5666 ioc_err(ioc, "%s: failed\n", __func__);
5775 r = -EIO;5667 r = -EIO;
5776 }5668 }
5777 5669
@@ -5842,18 +5734,16 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc) · 64 unmodified lines
5842 u16 smid;5734 u16 smid;
5843 u16 ioc_status;5735 u16 ioc_status;
5844 5736
5845 pr_info(MPT3SAS_FMT "sending port enable !!\n", ioc->name);5737 ioc_info(ioc, "sending port enable !!\n");
5846 5738
5847 if (ioc->port_enable_cmds.status & MPT3_CMD_PENDING) {5739 if (ioc->port_enable_cmds.status & MPT3_CMD_PENDING) {
5848 pr_err(MPT3SAS_FMT "%s: internal command already in use\n",5740 ioc_err(ioc, "%s: internal command already in use\n", __func__);
5849 ioc->name, __func__);
5850 return -EAGAIN;5741 return -EAGAIN;
5851 }5742 }
5852 5743
5853 smid = mpt3sas_base_get_smid(ioc, ioc->port_enable_cb_idx);5744 smid = mpt3sas_base_get_smid(ioc, ioc->port_enable_cb_idx);
5854 if (!smid) {5745 if (!smid) {
5855 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",5746 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
5856 ioc->name, __func__);
5857 return -EAGAIN;5747 return -EAGAIN;
5858 }5748 }
5859 5749
@@ -5867,8 +5757,7 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines
5867 mpt3sas_base_put_smid_default(ioc, smid);5757 mpt3sas_base_put_smid_default(ioc, smid);
5868 wait_for_completion_timeout(&ioc->port_enable_cmds.done, 300*HZ);5758 wait_for_completion_timeout(&ioc->port_enable_cmds.done, 300*HZ);
5869 if (!(ioc->port_enable_cmds.status & MPT3_CMD_COMPLETE)) {5759 if (!(ioc->port_enable_cmds.status & MPT3_CMD_COMPLETE)) {
5870 pr_err(MPT3SAS_FMT "%s: timeout\n",5760 ioc_err(ioc, "%s: timeout\n", __func__);
5871 ioc->name, __func__);
5872 _debug_dump_mf(mpi_request,5761 _debug_dump_mf(mpi_request,
5873 sizeof(Mpi2PortEnableRequest_t)/4);5762 sizeof(Mpi2PortEnableRequest_t)/4);
5874 if (ioc->port_enable_cmds.status & MPT3_CMD_RESET)5763 if (ioc->port_enable_cmds.status & MPT3_CMD_RESET)
@@ -5881,16 +5770,15 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc) · 6 unmodified lines
5881 mpi_reply = ioc->port_enable_cmds.reply;5770 mpi_reply = ioc->port_enable_cmds.reply;
5882 ioc_status = le16_to_cpu(mpi_reply->IOCStatus) & MPI2_IOCSTATUS_MASK;5771 ioc_status = le16_to_cpu(mpi_reply->IOCStatus) & MPI2_IOCSTATUS_MASK;
5883 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {5772 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5884 pr_err(MPT3SAS_FMT "%s: failed with (ioc_status=0x%08x)\n",5773 ioc_err(ioc, "%s: failed with (ioc_status=0x%08x)\n",
5885 ioc->name, __func__, ioc_status);5774 __func__, ioc_status);
5886 r = -EFAULT;5775 r = -EFAULT;
5887 goto out;5776 goto out;
5888 }5777 }
5889 5778
5890 out:5779 out:
5891 ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED;5780 ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED;
5892 pr_info(MPT3SAS_FMT "port enable: %s\n", ioc->name, ((r == 0) ?5781 ioc_info(ioc, "port enable: %s\n", r == 0 ? "SUCCESS" : "FAILED");
5893 "SUCCESS" : "FAILED"));
5894 return r;5782 return r;
5895}5783}
5896 5784
@@ -5906,18 +5794,16 @@ mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc) · 9 unmodified lines
5906 Mpi2PortEnableRequest_t *mpi_request;5794 Mpi2PortEnableRequest_t *mpi_request;
5907 u16 smid;5795 u16 smid;
5908 5796
5909 pr_info(MPT3SAS_FMT "sending port enable !!\n", ioc->name);5797 ioc_info(ioc, "sending port enable !!\n");
5910 5798
5911 if (ioc->port_enable_cmds.status & MPT3_CMD_PENDING) {5799 if (ioc->port_enable_cmds.status & MPT3_CMD_PENDING) {
5912 pr_err(MPT3SAS_FMT "%s: internal command already in use\n",5800 ioc_err(ioc, "%s: internal command already in use\n", __func__);
5913 ioc->name, __func__);
5914 return -EAGAIN;5801 return -EAGAIN;
5915 }5802 }
5916 5803
5917 smid = mpt3sas_base_get_smid(ioc, ioc->port_enable_cb_idx);5804 smid = mpt3sas_base_get_smid(ioc, ioc->port_enable_cb_idx);
5918 if (!smid) {5805 if (!smid) {
5919 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",5806 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
5920 ioc->name, __func__);
5921 return -EAGAIN;5807 return -EAGAIN;
5922 }5808 }
5923 5809
@@ -6020,19 +5906,16 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc) · 96 unmodified lines
6020 int r = 0;5906 int r = 0;
6021 int i;5907 int i;
6022 5908
6023 dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,5909 dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
6024 __func__));
6025 5910
6026 if (ioc->base_cmds.status & MPT3_CMD_PENDING) {5911 if (ioc->base_cmds.status & MPT3_CMD_PENDING) {
6027 pr_err(MPT3SAS_FMT "%s: internal command already in use\n",5912 ioc_err(ioc, "%s: internal command already in use\n", __func__);
6028 ioc->name, __func__);
6029 return -EAGAIN;5913 return -EAGAIN;
6030 }5914 }
6031 5915
6032 smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);5916 smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);
6033 if (!smid) {5917 if (!smid) {
6034 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",5918 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
6035 ioc->name, __func__);
6036 return -EAGAIN;5919 return -EAGAIN;
6037 }5920 }
6038 ioc->base_cmds.status = MPT3_CMD_PENDING;5921 ioc->base_cmds.status = MPT3_CMD_PENDING;
@@ -6049,8 +5932,7 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc) · 10 unmodified lines
6049 mpt3sas_base_put_smid_default(ioc, smid);5932 mpt3sas_base_put_smid_default(ioc, smid);
6050 wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ);5933 wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ);
6051 if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) {5934 if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) {
6052 pr_err(MPT3SAS_FMT "%s: timeout\n",5935 ioc_err(ioc, "%s: timeout\n", __func__);
6053 ioc->name, __func__);
6054 _debug_dump_mf(mpi_request,5936 _debug_dump_mf(mpi_request,
6055 sizeof(Mpi2EventNotificationRequest_t)/4);5937 sizeof(Mpi2EventNotificationRequest_t)/4);
6056 if (ioc->base_cmds.status & MPT3_CMD_RESET)5938 if (ioc->base_cmds.status & MPT3_CMD_RESET)
@@ -6058,8 +5940,7 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
6058 else5940 else
6059 r = -ETIME;5941 r = -ETIME;
6060 } else5942 } else
6061 dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s: complete\n",5943 dinitprintk(ioc, ioc_info(ioc, "%s: complete\n", __func__));
6062 ioc->name, __func__));
6063 ioc->base_cmds.status = MPT3_CMD_NOT_USED;5944 ioc->base_cmds.status = MPT3_CMD_NOT_USED;
6064 return r;5945 return r;
6065}5946}
@@ -6115,18 +5996,16 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc) · 49 unmodified lines
6115 u32 count;5996 u32 count;
6116 u32 hcb_size;5997 u32 hcb_size;
6117 5998
6118 pr_info(MPT3SAS_FMT "sending diag reset !!\n", ioc->name);5999 ioc_info(ioc, "sending diag reset !!\n");
6119 6000
6120 drsprintk(ioc, pr_info(MPT3SAS_FMT "clear interrupts\n",6001 drsprintk(ioc, ioc_info(ioc, "clear interrupts\n"));
6121 ioc->name));
6122 6002
6123 count = 0;6003 count = 0;
6124 do {6004 do {
6125 /* Write magic sequence to WriteSequence register6005 /* Write magic sequence to WriteSequence register
6126 * Loop until in diagnostic mode6006 * Loop until in diagnostic mode
6127 */6007 */
6128 drsprintk(ioc, pr_info(MPT3SAS_FMT6008 drsprintk(ioc, ioc_info(ioc, "write magic sequence\n"));
6129 "write magic sequence\n", ioc->name));
6130 writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, &ioc->chip->WriteSequence);6009 writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, &ioc->chip->WriteSequence);
6131 writel(MPI2_WRSEQ_1ST_KEY_VALUE, &ioc->chip->WriteSequence);6010 writel(MPI2_WRSEQ_1ST_KEY_VALUE, &ioc->chip->WriteSequence);
6132 writel(MPI2_WRSEQ_2ND_KEY_VALUE, &ioc->chip->WriteSequence);6011 writel(MPI2_WRSEQ_2ND_KEY_VALUE, &ioc->chip->WriteSequence);
@@ -6142,16 +6021,15 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc) · 9 unmodified lines
6142 goto out;6021 goto out;
6143 6022
6144 host_diagnostic = readl(&ioc->chip->HostDiagnostic);6023 host_diagnostic = readl(&ioc->chip->HostDiagnostic);
6145 drsprintk(ioc, pr_info(MPT3SAS_FMT6024 drsprintk(ioc,
6146 "wrote magic sequence: count(%d), host_diagnostic(0x%08x)\n",6025 ioc_info(ioc, "wrote magic sequence: count(%d), host_diagnostic(0x%08x)\n",
6147 ioc->name, count, host_diagnostic));6026 count, host_diagnostic));
6148 6027
6149 } while ((host_diagnostic & MPI2_DIAG_DIAG_WRITE_ENABLE) == 0);6028 } while ((host_diagnostic & MPI2_DIAG_DIAG_WRITE_ENABLE) == 0);
6150 6029
6151 hcb_size = readl(&ioc->chip->HCBSize);6030 hcb_size = readl(&ioc->chip->HCBSize);
6152 6031
6153 drsprintk(ioc, pr_info(MPT3SAS_FMT "diag reset: issued\n",6032 drsprintk(ioc, ioc_info(ioc, "diag reset: issued\n"));
6154 ioc->name));
6155 writel(host_diagnostic | MPI2_DIAG_RESET_ADAPTER,6033 writel(host_diagnostic | MPI2_DIAG_RESET_ADAPTER,
6156 &ioc->chip->HostDiagnostic);6034 &ioc->chip->HostDiagnostic);
6157 6035
@@ -6174,43 +6052,38 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines
6174 6052
6175 if (host_diagnostic & MPI2_DIAG_HCB_MODE) {6053 if (host_diagnostic & MPI2_DIAG_HCB_MODE) {
6176 6054
6177 drsprintk(ioc, pr_info(MPT3SAS_FMT6055 drsprintk(ioc,
6178 "restart the adapter assuming the HCB Address points to good F/W\n",6056 ioc_info(ioc, "restart the adapter assuming the HCB Address points to good F/W\n"));
6179 ioc->name));
6180 host_diagnostic &= ~MPI2_DIAG_BOOT_DEVICE_SELECT_MASK;6057 host_diagnostic &= ~MPI2_DIAG_BOOT_DEVICE_SELECT_MASK;
6181 host_diagnostic |= MPI2_DIAG_BOOT_DEVICE_SELECT_HCDW;6058 host_diagnostic |= MPI2_DIAG_BOOT_DEVICE_SELECT_HCDW;
6182 writel(host_diagnostic, &ioc->chip->HostDiagnostic);6059 writel(host_diagnostic, &ioc->chip->HostDiagnostic);
6183 6060
6184 drsprintk(ioc, pr_info(MPT3SAS_FMT6061 drsprintk(ioc, ioc_info(ioc, "re-enable the HCDW\n"));
6185 "re-enable the HCDW\n", ioc->name));
6186 writel(hcb_size | MPI2_HCB_SIZE_HCB_ENABLE,6062 writel(hcb_size | MPI2_HCB_SIZE_HCB_ENABLE,
6187 &ioc->chip->HCBSize);6063 &ioc->chip->HCBSize);
6188 }6064 }
6189 6065
6190 drsprintk(ioc, pr_info(MPT3SAS_FMT "restart the adapter\n",6066 drsprintk(ioc, ioc_info(ioc, "restart the adapter\n"));
6191 ioc->name));
6192 writel(host_diagnostic & ~MPI2_DIAG_HOLD_IOC_RESET,6067 writel(host_diagnostic & ~MPI2_DIAG_HOLD_IOC_RESET,
6193 &ioc->chip->HostDiagnostic);6068 &ioc->chip->HostDiagnostic);
6194 6069
6195 drsprintk(ioc, pr_info(MPT3SAS_FMT6070 drsprintk(ioc,
6196 "disable writes to the diagnostic register\n", ioc->name));6071 ioc_info(ioc, "disable writes to the diagnostic register\n"));
6197 writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, &ioc->chip->WriteSequence);6072 writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, &ioc->chip->WriteSequence);
6198 6073
6199 drsprintk(ioc, pr_info(MPT3SAS_FMT6074 drsprintk(ioc, ioc_info(ioc, "Wait for FW to go to the READY state\n"));
6200 "Wait for FW to go to the READY state\n", ioc->name));
6201 ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, 20);6075 ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, 20);
6202 if (ioc_state) {6076 if (ioc_state) {
6203 pr_err(MPT3SAS_FMT6077 ioc_err(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n",
6204 "%s: failed going to ready state (ioc_state=0x%x)\n",6078 __func__, ioc_state);
6205 ioc->name, __func__, ioc_state);
6206 goto out;6079 goto out;
6207 }6080 }
6208 6081
6209 pr_info(MPT3SAS_FMT "diag reset: SUCCESS\n", ioc->name);6082 ioc_info(ioc, "diag reset: SUCCESS\n");
6210 return 0;6083 return 0;
6211 6084
6212 out:6085 out:
6213 pr_err(MPT3SAS_FMT "diag reset: FAILED\n", ioc->name);6086 ioc_err(ioc, "diag reset: FAILED\n");
6214 return -EFAULT;6087 return -EFAULT;
6215}6088}
6216 6089
@@ -6228,15 +6101,15 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) · 11 unmodified lines
6228 int rc;6101 int rc;
6229 int count;6102 int count;
6230 6103
6231 dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,6104 dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
6232 __func__));
6233 6105
6234 if (ioc->pci_error_recovery)6106 if (ioc->pci_error_recovery)
6235 return 0;6107 return 0;
6236 6108
6237 ioc_state = mpt3sas_base_get_iocstate(ioc, 0);6109 ioc_state = mpt3sas_base_get_iocstate(ioc, 0);
6238 dhsprintk(ioc, pr_info(MPT3SAS_FMT "%s: ioc_state(0x%08x)\n",6110 dhsprintk(ioc,
6239 ioc->name, __func__, ioc_state));6111 ioc_info(ioc, "%s: ioc_state(0x%08x)\n",
6112 __func__, ioc_state));
6240 6113
6241 /* if in RESET state, it should move to READY state shortly */6114 /* if in RESET state, it should move to READY state shortly */
6242 count = 0;6115 count = 0;
@@ -6244,9 +6117,8 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) · 1 unmodified line
6244 while ((ioc_state & MPI2_IOC_STATE_MASK) !=6117 while ((ioc_state & MPI2_IOC_STATE_MASK) !=
6245 MPI2_IOC_STATE_READY) {6118 MPI2_IOC_STATE_READY) {
6246 if (count++ == 10) {6119 if (count++ == 10) {
6247 pr_err(MPT3SAS_FMT6120 ioc_err(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n",
6248 "%s: failed going to ready state (ioc_state=0x%x)\n",6121 __func__, ioc_state);
6249 ioc->name, __func__, ioc_state);
6250 return -EFAULT;6122 return -EFAULT;
6251 }6123 }
6252 ssleep(1);6124 ssleep(1);
@@ -6258,9 +6130,7 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) · 5 unmodified lines
6258 return 0;6130 return 0;
6259 6131
6260 if (ioc_state & MPI2_DOORBELL_USED) {6132 if (ioc_state & MPI2_DOORBELL_USED) {
6261 dhsprintk(ioc, pr_info(MPT3SAS_FMT6133 dhsprintk(ioc, ioc_info(ioc, "unexpected doorbell active!\n"));
6262 "unexpected doorbell active!\n",
6263 ioc->name));
6264 goto issue_diag_reset;6134 goto issue_diag_reset;
6265 }6135 }
6266 6136
@@ -6304,8 +6174,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc) · 37 unmodified lines
6304 struct adapter_reply_queue *reply_q;6174 struct adapter_reply_queue *reply_q;
6305 Mpi2ReplyDescriptorsUnion_t *reply_post_free_contig;6175 Mpi2ReplyDescriptorsUnion_t *reply_post_free_contig;
6306 6176
6307 dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,6177 dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
6308 __func__));
6309 6178
6310 /* clean the delayed target reset list */6179 /* clean the delayed target reset list */
6311 list_for_each_entry_safe(delayed_tr, delayed_tr_next,6180 list_for_each_entry_safe(delayed_tr, delayed_tr_next,
@@ -6465,8 +6334,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc) · 153 unmodified lines
6465void6334void
6466mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc)6335mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc)
6467{6336{
6468 dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,6337 dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
6469 __func__));
6470 6338
6471 /* synchronizing freeing resource with pci_access_mutex lock */6339 /* synchronizing freeing resource with pci_access_mutex lock */
6472 mutex_lock(&ioc->pci_access_mutex);6340 mutex_lock(&ioc->pci_access_mutex);
@@ -6494,8 +6362,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) · 21 unmodified lines
6494 int r, i;6362 int r, i;
6495 int cpu_id, last_cpu_id = 0;6363 int cpu_id, last_cpu_id = 0;
6496 6364
6497 dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,6365 dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
6498 __func__));
6499 6366
6500 /* setup cpu_msix_table */6367 /* setup cpu_msix_table */
6501 ioc->cpu_count = num_online_cpus();6368 ioc->cpu_count = num_online_cpus();
@@ -6505,9 +6372,8 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
6505 ioc->cpu_msix_table = kzalloc(ioc->cpu_msix_table_sz, GFP_KERNEL);6372 ioc->cpu_msix_table = kzalloc(ioc->cpu_msix_table_sz, GFP_KERNEL);
6506 ioc->reply_queue_count = 1;6373 ioc->reply_queue_count = 1;
6507 if (!ioc->cpu_msix_table) {6374 if (!ioc->cpu_msix_table) {
6508 dfailprintk(ioc, pr_info(MPT3SAS_FMT6375 dfailprintk(ioc,
6509 "allocation for cpu_msix_table failed!!!\n",6376 ioc_info(ioc, "allocation for cpu_msix_table failed!!!\n"));
6510 ioc->name));
6511 r = -ENOMEM;6377 r = -ENOMEM;
6512 goto out_free_resources;6378 goto out_free_resources;
6513 }6379 }
@@ -6516,9 +6382,8 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
6516 ioc->reply_post_host_index = kcalloc(ioc->cpu_msix_table_sz,6382 ioc->reply_post_host_index = kcalloc(ioc->cpu_msix_table_sz,
6517 sizeof(resource_size_t *), GFP_KERNEL);6383 sizeof(resource_size_t *), GFP_KERNEL);
6518 if (!ioc->reply_post_host_index) {6384 if (!ioc->reply_post_host_index) {
6519 dfailprintk(ioc, pr_info(MPT3SAS_FMT "allocation "6385 dfailprintk(ioc,
6520 "for reply_post_host_index failed!!!\n",6386 ioc_info(ioc, "allocation for reply_post_host_index failed!!!\n"));
6521 ioc->name));
6522 r = -ENOMEM;6387 r = -ENOMEM;
6523 goto out_free_resources;6388 goto out_free_resources;
6524 }6389 }
@@ -6747,8 +6612,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) · 222 unmodified lines
6747void6612void
6748mpt3sas_base_detach(struct MPT3SAS_ADAPTER *ioc)6613mpt3sas_base_detach(struct MPT3SAS_ADAPTER *ioc)
6749{6614{
6750 dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,6615 dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
6751 __func__));
6752 6616
6753 mpt3sas_base_stop_watchdog(ioc);6617 mpt3sas_base_stop_watchdog(ioc);
6754 mpt3sas_base_free_resources(ioc);6618 mpt3sas_base_free_resources(ioc);
@@ -6781,8 +6645,7 @@ static void _base_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 26 unmodified lines
6781{6645{
6782 mpt3sas_scsih_pre_reset_handler(ioc);6646 mpt3sas_scsih_pre_reset_handler(ioc);
6783 mpt3sas_ctl_pre_reset_handler(ioc);6647 mpt3sas_ctl_pre_reset_handler(ioc);
6784 dtmprintk(ioc, pr_info(MPT3SAS_FMT6648 dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_PRE_RESET\n", __func__));
6785 "%s: MPT3_IOC_PRE_RESET\n", ioc->name, __func__));
6786}6649}
6787 6650
6788/**6651/**
@@ -6793,8 +6656,7 @@ static void _base_after_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines
6793{6656{
6794 mpt3sas_scsih_after_reset_handler(ioc);6657 mpt3sas_scsih_after_reset_handler(ioc);
6795 mpt3sas_ctl_after_reset_handler(ioc);6658 mpt3sas_ctl_after_reset_handler(ioc);
6796 dtmprintk(ioc, pr_info(MPT3SAS_FMT6659 dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_AFTER_RESET\n", __func__));
6797 "%s: MPT3_IOC_AFTER_RESET\n", ioc->name, __func__));
6798 if (ioc->transport_cmds.status & MPT3_CMD_PENDING) {6660 if (ioc->transport_cmds.status & MPT3_CMD_PENDING) {
6799 ioc->transport_cmds.status |= MPT3_CMD_RESET;6661 ioc->transport_cmds.status |= MPT3_CMD_RESET;
6800 mpt3sas_base_free_smid(ioc, ioc->transport_cmds.smid);6662 mpt3sas_base_free_smid(ioc, ioc->transport_cmds.smid);
@@ -6835,8 +6697,7 @@ static void _base_reset_done_handler(struct MPT3SAS_ADAPTER *ioc) · 34 unmodified lines
6835{6697{
6836 mpt3sas_scsih_reset_done_handler(ioc);6698 mpt3sas_scsih_reset_done_handler(ioc);
6837 mpt3sas_ctl_reset_done_handler(ioc);6699 mpt3sas_ctl_reset_done_handler(ioc);
6838 dtmprintk(ioc, pr_info(MPT3SAS_FMT6700 dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_DONE_RESET\n", __func__));
6839 "%s: MPT3_IOC_DONE_RESET\n", ioc->name, __func__));
6840}6701}
6841 6702
6842/**6703/**
@@ -6883,12 +6744,10 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, · 40 unmodified lines
6883 u32 ioc_state;6744 u32 ioc_state;
6884 u8 is_fault = 0, is_trigger = 0;6745 u8 is_fault = 0, is_trigger = 0;
6885 6746
6886 dtmprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name,6747 dtmprintk(ioc, ioc_info(ioc, "%s: enter\n", __func__));
6887 __func__));
6888 6748
6889 if (ioc->pci_error_recovery) {6749 if (ioc->pci_error_recovery) {
6890 pr_err(MPT3SAS_FMT "%s: pci error recovery reset\n",6750 ioc_err(ioc, "%s: pci error recovery reset\n", __func__);
6891 ioc->name, __func__);
6892 r = 0;6751 r = 0;
6893 goto out_unlocked;6752 goto out_unlocked;
6894 }6753 }
@@ -6942,8 +6801,9 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, · 47 unmodified lines
6942 _base_reset_done_handler(ioc);6801 _base_reset_done_handler(ioc);
6943 6802
6944 out:6803 out:
6945 dtmprintk(ioc, pr_info(MPT3SAS_FMT "%s: %s\n",6804 dtmprintk(ioc,
6946 ioc->name, __func__, ((r == 0) ? "SUCCESS" : "FAILED")));6805 ioc_info(ioc, "%s: %s\n",
6806 __func__, r == 0 ? "SUCCESS" : "FAILED"));
6947 6807
6948 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);6808 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
6949 ioc->shost_recovery = 0;6809 ioc->shost_recovery = 0;
@@ -6959,7 +6819,6 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, · 9 unmodified lines
6959 mpt3sas_trigger_master(ioc,6819 mpt3sas_trigger_master(ioc,
6960 MASTER_TRIGGER_ADAPTER_RESET);6820 MASTER_TRIGGER_ADAPTER_RESET);
6961 }6821 }
6962 dtmprintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,6822 dtmprintk(ioc, ioc_info(ioc, "%s: exit\n", __func__));
6963 __func__));
6964 return r;6823 return r;
6965}6824}
drivers/scsi/mpt3sas/mpt3sas_base.h+8−1
@@ -158,7 +158,14 @@ struct mpt3sas_nvme_cmd { · 157 unmodified lines
158/*158/*
159 * logging format159 * logging format
160 */160 */
161#define MPT3SAS_FMT "%s: "161#define ioc_err(ioc, fmt, ...) \
162 pr_err("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
163#define ioc_notice(ioc, fmt, ...) \
164 pr_notice("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
165#define ioc_warn(ioc, fmt, ...) \
166 pr_warn("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
167#define ioc_info(ioc, fmt, ...) \
168 pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
162 169
163/*170/*
164 * WarpDrive Specific Log codes171 * WarpDrive Specific Log codes
drivers/scsi/mpt3sas/mpt3sas_config.c+35−54
@@ -175,20 +175,18 @@ _config_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid, · 174 unmodified lines
175 if (!desc)175 if (!desc)
176 return;176 return;
177 177
178 pr_info(MPT3SAS_FMT178 ioc_info(ioc, "%s: %s(%d), action(%d), form(0x%08x), smid(%d)\n",
179 "%s: %s(%d), action(%d), form(0x%08x), smid(%d)\n",179 calling_function_name, desc,
180 ioc->name, calling_function_name, desc,180 mpi_request->Header.PageNumber, mpi_request->Action,
181 mpi_request->Header.PageNumber, mpi_request->Action,181 le32_to_cpu(mpi_request->PageAddress), smid);
182 le32_to_cpu(mpi_request->PageAddress), smid);
183 182
184 if (!mpi_reply)183 if (!mpi_reply)
185 return;184 return;
186 185
187 if (mpi_reply->IOCStatus || mpi_reply->IOCLogInfo)186 if (mpi_reply->IOCStatus || mpi_reply->IOCLogInfo)
188 pr_info(MPT3SAS_FMT187 ioc_info(ioc, "\tiocstatus(0x%04x), loginfo(0x%08x)\n",
189 "\tiocstatus(0x%04x), loginfo(0x%08x)\n",188 le16_to_cpu(mpi_reply->IOCStatus),
190 ioc->name, le16_to_cpu(mpi_reply->IOCStatus),189 le32_to_cpu(mpi_reply->IOCLogInfo));
191 le32_to_cpu(mpi_reply->IOCLogInfo));
192}190}
193 191
194/**192/**
@@ -210,9 +208,8 @@ _config_alloc_config_dma_memory(struct MPT3SAS_ADAPTER *ioc, · 15 unmodified lines
210 mem->page = dma_alloc_coherent(&ioc->pdev->dev, mem->sz,208 mem->page = dma_alloc_coherent(&ioc->pdev->dev, mem->sz,
211 &mem->page_dma, GFP_KERNEL);209 &mem->page_dma, GFP_KERNEL);
212 if (!mem->page) {210 if (!mem->page) {
213 pr_err(MPT3SAS_FMT211 ioc_err(ioc, "%s: dma_alloc_coherent failed asking for (%d) bytes!!\n",
214 "%s: dma_alloc_coherent failed asking for (%d) bytes!!\n",212 __func__, mem->sz);
215 ioc->name, __func__, mem->sz);
216 r = -ENOMEM;213 r = -ENOMEM;
217 }214 }
218 } else { /* use tmp buffer if less than 512 bytes */215 } else { /* use tmp buffer if less than 512 bytes */
@@ -313,8 +310,7 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 94 unmodified lines
313 310
314 mutex_lock(&ioc->config_cmds.mutex);311 mutex_lock(&ioc->config_cmds.mutex);
315 if (ioc->config_cmds.status != MPT3_CMD_NOT_USED) {312 if (ioc->config_cmds.status != MPT3_CMD_NOT_USED) {
316 pr_err(MPT3SAS_FMT "%s: config_cmd in use\n",313 ioc_err(ioc, "%s: config_cmd in use\n", __func__);
317 ioc->name, __func__);
318 mutex_unlock(&ioc->config_cmds.mutex);314 mutex_unlock(&ioc->config_cmds.mutex);
319 return -EAGAIN;315 return -EAGAIN;
320 }316 }
@@ -362,34 +358,30 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 41 unmodified lines
362 r = -EFAULT;358 r = -EFAULT;
363 goto free_mem;359 goto free_mem;
364 }360 }
365 pr_info(MPT3SAS_FMT "%s: attempting retry (%d)\n",361 ioc_info(ioc, "%s: attempting retry (%d)\n",
366 ioc->name, __func__, retry_count);362 __func__, retry_count);
367 }363 }
368 wait_state_count = 0;364 wait_state_count = 0;
369 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);365 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
370 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {366 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
371 if (wait_state_count++ == MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT) {367 if (wait_state_count++ == MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT) {
372 pr_err(MPT3SAS_FMT368 ioc_err(ioc, "%s: failed due to ioc not operational\n",
373 "%s: failed due to ioc not operational\n",369 __func__);
374 ioc->name, __func__);
375 ioc->config_cmds.status = MPT3_CMD_NOT_USED;370 ioc->config_cmds.status = MPT3_CMD_NOT_USED;
376 r = -EFAULT;371 r = -EFAULT;
377 goto free_mem;372 goto free_mem;
378 }373 }
379 ssleep(1);374 ssleep(1);
380 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);375 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
381 pr_info(MPT3SAS_FMT376 ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
382 "%s: waiting for operational state(count=%d)\n",377 __func__, wait_state_count);
383 ioc->name, __func__, wait_state_count);
384 }378 }
385 if (wait_state_count)379 if (wait_state_count)
386 pr_info(MPT3SAS_FMT "%s: ioc is operational\n",380 ioc_info(ioc, "%s: ioc is operational\n", __func__);
387 ioc->name, __func__);
388 381
389 smid = mpt3sas_base_get_smid(ioc, ioc->config_cb_idx);382 smid = mpt3sas_base_get_smid(ioc, ioc->config_cb_idx);
390 if (!smid) {383 if (!smid) {
391 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",384 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
392 ioc->name, __func__);
393 ioc->config_cmds.status = MPT3_CMD_NOT_USED;385 ioc->config_cmds.status = MPT3_CMD_NOT_USED;
394 r = -EAGAIN;386 r = -EAGAIN;
395 goto free_mem;387 goto free_mem;
@@ -429,12 +421,10 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 33 unmodified lines
429 (mpi_reply->Header.PageType & 0xF)) {421 (mpi_reply->Header.PageType & 0xF)) {
430 _debug_dump_mf(mpi_request, ioc->request_sz/4);422 _debug_dump_mf(mpi_request, ioc->request_sz/4);
431 _debug_dump_reply(mpi_reply, ioc->request_sz/4);423 _debug_dump_reply(mpi_reply, ioc->request_sz/4);
432 panic(KERN_WARNING MPT3SAS_FMT "%s: Firmware BUG:" \424 panic("%s: %s: Firmware BUG: mpi_reply mismatch: Requested PageType(0x%02x) Reply PageType(0x%02x)\n",
433 " mpi_reply mismatch: Requested PageType(0x%02x)" \425 ioc->name, __func__,
434 " Reply PageType(0x%02x)\n", \426 mpi_request->Header.PageType & 0xF,
435 ioc->name, __func__,427 mpi_reply->Header.PageType & 0xF);
436 (mpi_request->Header.PageType & 0xF),
437 (mpi_reply->Header.PageType & 0xF));
438 }428 }
439 429
440 if (((mpi_request->Header.PageType & 0xF) ==430 if (((mpi_request->Header.PageType & 0xF) ==
@@ -442,19 +432,18 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 1 unmodified line
442 mpi_request->ExtPageType != mpi_reply->ExtPageType) {432 mpi_request->ExtPageType != mpi_reply->ExtPageType) {
443 _debug_dump_mf(mpi_request, ioc->request_sz/4);433 _debug_dump_mf(mpi_request, ioc->request_sz/4);
444 _debug_dump_reply(mpi_reply, ioc->request_sz/4);434 _debug_dump_reply(mpi_reply, ioc->request_sz/4);
445 panic(KERN_WARNING MPT3SAS_FMT "%s: Firmware BUG:" \435 panic("%s: %s: Firmware BUG: mpi_reply mismatch: Requested ExtPageType(0x%02x) Reply ExtPageType(0x%02x)\n",
446 " mpi_reply mismatch: Requested ExtPageType(0x%02x)"436 ioc->name, __func__,
447 " Reply ExtPageType(0x%02x)\n",437 mpi_request->ExtPageType,
448 ioc->name, __func__, mpi_request->ExtPageType,438 mpi_reply->ExtPageType);
449 mpi_reply->ExtPageType);
450 }439 }
451 ioc_status = le16_to_cpu(mpi_reply->IOCStatus)440 ioc_status = le16_to_cpu(mpi_reply->IOCStatus)
452 & MPI2_IOCSTATUS_MASK;441 & MPI2_IOCSTATUS_MASK;
453 }442 }
454 443
455 if (retry_count)444 if (retry_count)
456 pr_info(MPT3SAS_FMT "%s: retry (%d) completed!!\n", \445 ioc_info(ioc, "%s: retry (%d) completed!!\n",
457 ioc->name, __func__, retry_count);446 __func__, retry_count);
458 447
459 if ((ioc_status == MPI2_IOCSTATUS_SUCCESS) &&448 if ((ioc_status == MPI2_IOCSTATUS_SUCCESS) &&
460 config_page && mpi_request->Action ==449 config_page && mpi_request->Action ==
@@ -469,14 +458,10 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 8 unmodified lines
469 _debug_dump_reply(mpi_reply, ioc->request_sz/4);458 _debug_dump_reply(mpi_reply, ioc->request_sz/4);
470 _debug_dump_config(p, min_t(u16, mem.sz,459 _debug_dump_config(p, min_t(u16, mem.sz,
471 config_page_sz)/4);460 config_page_sz)/4);
472 panic(KERN_WARNING MPT3SAS_FMT461 panic("%s: %s: Firmware BUG: config page mismatch: Requested PageType(0x%02x) Reply PageType(0x%02x)\n",
473 "%s: Firmware BUG:" \462 ioc->name, __func__,
474 " config page mismatch:"463 mpi_request->Header.PageType & 0xF,
475 " Requested PageType(0x%02x)"464 p[3] & 0xF);
476 " Reply PageType(0x%02x)\n",
477 ioc->name, __func__,
478 (mpi_request->Header.PageType & 0xF),
479 (p[3] & 0xF));
480 }465 }
481 466
482 if (((mpi_request->Header.PageType & 0xF) ==467 if (((mpi_request->Header.PageType & 0xF) ==
@@ -486,13 +471,9 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 3 unmodified lines
486 _debug_dump_reply(mpi_reply, ioc->request_sz/4);471 _debug_dump_reply(mpi_reply, ioc->request_sz/4);
487 _debug_dump_config(p, min_t(u16, mem.sz,472 _debug_dump_config(p, min_t(u16, mem.sz,
488 config_page_sz)/4);473 config_page_sz)/4);
489 panic(KERN_WARNING MPT3SAS_FMT474 panic("%s: %s: Firmware BUG: config page mismatch: Requested ExtPageType(0x%02x) Reply ExtPageType(0x%02x)\n",
490 "%s: Firmware BUG:" \475 ioc->name, __func__,
491 " config page mismatch:"476 mpi_request->ExtPageType, p[6]);
492 " Requested ExtPageType(0x%02x)"
493 " Reply ExtPageType(0x%02x)\n",
494 ioc->name, __func__,
495 mpi_request->ExtPageType, p[6]);
496 }477 }
497 }478 }
498 memcpy(config_page, mem.page, min_t(u16, mem.sz,479 memcpy(config_page, mem.page, min_t(u16, mem.sz,
drivers/scsi/mpt3sas/mpt3sas_ctl.c+226−301
@@ -185,17 +185,15 @@ _ctl_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid, · 184 unmodified lines
185 if (!desc)185 if (!desc)
186 return;186 return;
187 187
188 pr_info(MPT3SAS_FMT "%s: %s, smid(%d)\n",188 ioc_info(ioc, "%s: %s, smid(%d)\n", calling_function_name, desc, smid);
189 ioc->name, calling_function_name, desc, smid);
190 189
191 if (!mpi_reply)190 if (!mpi_reply)
192 return;191 return;
193 192
194 if (mpi_reply->IOCStatus || mpi_reply->IOCLogInfo)193 if (mpi_reply->IOCStatus || mpi_reply->IOCLogInfo)
195 pr_info(MPT3SAS_FMT194 ioc_info(ioc, "\tiocstatus(0x%04x), loginfo(0x%08x)\n",
196 "\tiocstatus(0x%04x), loginfo(0x%08x)\n",195 le16_to_cpu(mpi_reply->IOCStatus),
197 ioc->name, le16_to_cpu(mpi_reply->IOCStatus),196 le32_to_cpu(mpi_reply->IOCLogInfo));
198 le32_to_cpu(mpi_reply->IOCLogInfo));
199 197
200 if (mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST ||198 if (mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST ||
201 mpi_request->Function ==199 mpi_request->Function ==
@@ -208,38 +206,32 @@ _ctl_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid, · 6 unmodified lines
208 sas_device = mpt3sas_get_sdev_by_handle(ioc,206 sas_device = mpt3sas_get_sdev_by_handle(ioc,
209 le16_to_cpu(scsi_reply->DevHandle));207 le16_to_cpu(scsi_reply->DevHandle));
210 if (sas_device) {208 if (sas_device) {
211 pr_warn(MPT3SAS_FMT "\tsas_address(0x%016llx), phy(%d)\n",209 ioc_warn(ioc, "\tsas_address(0x%016llx), phy(%d)\n",
212 ioc->name, (unsigned long long)210 (u64)sas_device->sas_address,
213 sas_device->sas_address, sas_device->phy);211 sas_device->phy);
214 pr_warn(MPT3SAS_FMT212 ioc_warn(ioc, "\tenclosure_logical_id(0x%016llx), slot(%d)\n",
215 "\tenclosure_logical_id(0x%016llx), slot(%d)\n",213 (u64)sas_device->enclosure_logical_id,
216 ioc->name, (unsigned long long)214 sas_device->slot);
217 sas_device->enclosure_logical_id, sas_device->slot);
218 sas_device_put(sas_device);215 sas_device_put(sas_device);
219 }216 }
220 if (!sas_device) {217 if (!sas_device) {
221 pcie_device = mpt3sas_get_pdev_by_handle(ioc,218 pcie_device = mpt3sas_get_pdev_by_handle(ioc,
222 le16_to_cpu(scsi_reply->DevHandle));219 le16_to_cpu(scsi_reply->DevHandle));
223 if (pcie_device) {220 if (pcie_device) {
224 pr_warn(MPT3SAS_FMT221 ioc_warn(ioc, "\tWWID(0x%016llx), port(%d)\n",
225 "\tWWID(0x%016llx), port(%d)\n", ioc->name,222 (unsigned long long)pcie_device->wwid,
226 (unsigned long long)pcie_device->wwid,223 pcie_device->port_num);
227 pcie_device->port_num);
228 if (pcie_device->enclosure_handle != 0)224 if (pcie_device->enclosure_handle != 0)
229 pr_warn(MPT3SAS_FMT225 ioc_warn(ioc, "\tenclosure_logical_id(0x%016llx), slot(%d)\n",
230 "\tenclosure_logical_id(0x%016llx), slot(%d)\n",226 (u64)pcie_device->enclosure_logical_id,
231 ioc->name, (unsigned long long)227 pcie_device->slot);
232 pcie_device->enclosure_logical_id,
233 pcie_device->slot);
234 pcie_device_put(pcie_device);228 pcie_device_put(pcie_device);
235 }229 }
236 }230 }
237 if (scsi_reply->SCSIState || scsi_reply->SCSIStatus)231 if (scsi_reply->SCSIState || scsi_reply->SCSIStatus)
238 pr_info(MPT3SAS_FMT232 ioc_info(ioc, "\tscsi_state(0x%02x), scsi_status(0x%02x)\n",
239 "\tscsi_state(0x%02x), scsi_status"233 scsi_reply->SCSIState,
240 "(0x%02x)\n", ioc->name,234 scsi_reply->SCSIStatus);
241 scsi_reply->SCSIState,
242 scsi_reply->SCSIStatus);
243 }235 }
244}236}
245 237
@@ -466,8 +458,7 @@ void mpt3sas_ctl_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 220 unmodified lines
466 int i;458 int i;
467 u8 issue_reset;459 u8 issue_reset;
468 460
469 dtmprintk(ioc, pr_info(MPT3SAS_FMT461 dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_PRE_RESET\n", __func__));
470 "%s: MPT3_IOC_PRE_RESET\n", ioc->name, __func__));
471 for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) {462 for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) {
472 if (!(ioc->diag_buffer_status[i] &463 if (!(ioc->diag_buffer_status[i] &
473 MPT3_DIAG_BUFFER_IS_REGISTERED))464 MPT3_DIAG_BUFFER_IS_REGISTERED))
@@ -487,8 +478,7 @@ void mpt3sas_ctl_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 13 unmodified lines
487 */478 */
488void mpt3sas_ctl_after_reset_handler(struct MPT3SAS_ADAPTER *ioc)479void mpt3sas_ctl_after_reset_handler(struct MPT3SAS_ADAPTER *ioc)
489{480{
490 dtmprintk(ioc, pr_info(MPT3SAS_FMT481 dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_AFTER_RESET\n", __func__));
491 "%s: MPT3_IOC_AFTER_RESET\n", ioc->name, __func__));
492 if (ioc->ctl_cmds.status & MPT3_CMD_PENDING) {482 if (ioc->ctl_cmds.status & MPT3_CMD_PENDING) {
493 ioc->ctl_cmds.status |= MPT3_CMD_RESET;483 ioc->ctl_cmds.status |= MPT3_CMD_RESET;
494 mpt3sas_base_free_smid(ioc, ioc->ctl_cmds.smid);484 mpt3sas_base_free_smid(ioc, ioc->ctl_cmds.smid);
@@ -506,8 +496,7 @@ void mpt3sas_ctl_reset_done_handler(struct MPT3SAS_ADAPTER *ioc) · 11 unmodified lines
506{496{
507 int i;497 int i;
508 498
509 dtmprintk(ioc, pr_info(MPT3SAS_FMT499 dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_DONE_RESET\n", __func__));
510 "%s: MPT3_IOC_DONE_RESET\n", ioc->name, __func__));
511 500
512 for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) {501 for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) {
513 if (!(ioc->diag_buffer_status[i] &502 if (!(ioc->diag_buffer_status[i] &
@@ -612,10 +601,10 @@ _ctl_set_task_mid(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command *karg, · 98 unmodified lines
612 }601 }
613 602
614 if (!found) {603 if (!found) {
615 dctlprintk(ioc, pr_info(MPT3SAS_FMT604 dctlprintk(ioc,
616 "%s: handle(0x%04x), lun(%d), no active mid!!\n",605 ioc_info(ioc, "%s: handle(0x%04x), lun(%d), no active mid!!\n",
617 ioc->name,606 desc, le16_to_cpu(tm_request->DevHandle),
618 desc, le16_to_cpu(tm_request->DevHandle), lun));607 lun));
619 tm_reply = ioc->ctl_cmds.reply;608 tm_reply = ioc->ctl_cmds.reply;
620 tm_reply->DevHandle = tm_request->DevHandle;609 tm_reply->DevHandle = tm_request->DevHandle;
621 tm_reply->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;610 tm_reply->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;
@@ -631,10 +620,10 @@ _ctl_set_task_mid(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command *karg, · 9 unmodified lines
631 return 1;620 return 1;
632 }621 }
633 622
634 dctlprintk(ioc, pr_info(MPT3SAS_FMT623 dctlprintk(ioc,
635 "%s: handle(0x%04x), lun(%d), task_mid(%d)\n", ioc->name,624 ioc_info(ioc, "%s: handle(0x%04x), lun(%d), task_mid(%d)\n",
636 desc, le16_to_cpu(tm_request->DevHandle), lun,625 desc, le16_to_cpu(tm_request->DevHandle), lun,
637 le16_to_cpu(tm_request->TaskMID)));626 le16_to_cpu(tm_request->TaskMID)));
638 return 0;627 return 0;
639}628}
640 629
@@ -672,8 +661,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 31 unmodified lines
672 issue_reset = 0;661 issue_reset = 0;
673 662
674 if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {663 if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {
675 pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n",664 ioc_err(ioc, "%s: ctl_cmd in use\n", __func__);
676 ioc->name, __func__);
677 ret = -EAGAIN;665 ret = -EAGAIN;
678 goto out;666 goto out;
679 }667 }
@@ -682,28 +670,23 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 2 unmodified lines
682 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);670 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
683 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {671 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
684 if (wait_state_count++ == 10) {672 if (wait_state_count++ == 10) {
685 pr_err(MPT3SAS_FMT673 ioc_err(ioc, "%s: failed due to ioc not operational\n",
686 "%s: failed due to ioc not operational\n",674 __func__);
687 ioc->name, __func__);
688 ret = -EFAULT;675 ret = -EFAULT;
689 goto out;676 goto out;
690 }677 }
691 ssleep(1);678 ssleep(1);
692 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);679 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
693 pr_info(MPT3SAS_FMT680 ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
694 "%s: waiting for operational state(count=%d)\n",681 __func__, wait_state_count);
695 ioc->name,
696 __func__, wait_state_count);
697 }682 }
698 if (wait_state_count)683 if (wait_state_count)
699 pr_info(MPT3SAS_FMT "%s: ioc is operational\n",684 ioc_info(ioc, "%s: ioc is operational\n", __func__);
700 ioc->name, __func__);
701 685
702 mpi_request = kzalloc(ioc->request_sz, GFP_KERNEL);686 mpi_request = kzalloc(ioc->request_sz, GFP_KERNEL);
703 if (!mpi_request) {687 if (!mpi_request) {
704 pr_err(MPT3SAS_FMT688 ioc_err(ioc, "%s: failed obtaining a memory for mpi_request\n",
705 "%s: failed obtaining a memory for mpi_request\n",689 __func__);
706 ioc->name, __func__);
707 ret = -ENOMEM;690 ret = -ENOMEM;
708 goto out;691 goto out;
709 }692 }
@@ -726,8 +709,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 16 unmodified lines
726 if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) {709 if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) {
727 smid = mpt3sas_base_get_smid_hpr(ioc, ioc->ctl_cb_idx);710 smid = mpt3sas_base_get_smid_hpr(ioc, ioc->ctl_cb_idx);
728 if (!smid) {711 if (!smid) {
729 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",712 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
730 ioc->name, __func__);
731 ret = -EAGAIN;713 ret = -EAGAIN;
732 goto out;714 goto out;
733 }715 }
@@ -762,8 +744,8 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 28 unmodified lines
762 744
763 /* obtain dma-able memory for data transfer */745 /* obtain dma-able memory for data transfer */
764 if (data_out_sz) /* WRITE */ {746 if (data_out_sz) /* WRITE */ {
765 data_out = pci_alloc_consistent(ioc->pdev, data_out_sz,747 data_out = dma_alloc_coherent(&ioc->pdev->dev, data_out_sz,
766 &data_out_dma);748 &data_out_dma, GFP_KERNEL);
767 if (!data_out) {749 if (!data_out) {
768 pr_err("failure at %s:%d/%s()!\n", __FILE__,750 pr_err("failure at %s:%d/%s()!\n", __FILE__,
769 __LINE__, __func__);751 __LINE__, __func__);
@@ -782,8 +764,8 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 12 unmodified lines
782 }764 }
783 765
784 if (data_in_sz) /* READ */ {766 if (data_in_sz) /* READ */ {
785 data_in = pci_alloc_consistent(ioc->pdev, data_in_sz,767 data_in = dma_alloc_coherent(&ioc->pdev->dev, data_in_sz,
786 &data_in_dma);768 &data_in_dma, GFP_KERNEL);
787 if (!data_in) {769 if (!data_in) {
788 pr_err("failure at %s:%d/%s()!\n", __FILE__,770 pr_err("failure at %s:%d/%s()!\n", __FILE__,
789 __LINE__, __func__);771 __LINE__, __func__);
@@ -823,9 +805,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 33 unmodified lines
823 ioc->build_nvme_prp(ioc, smid, nvme_encap_request,805 ioc->build_nvme_prp(ioc, smid, nvme_encap_request,
824 data_out_dma, data_out_sz, data_in_dma, data_in_sz);806 data_out_dma, data_out_sz, data_in_dma, data_in_sz);
825 if (test_bit(device_handle, ioc->device_remove_in_progress)) {807 if (test_bit(device_handle, ioc->device_remove_in_progress)) {
826 dtmprintk(ioc, pr_info(MPT3SAS_FMT "handle(0x%04x) :"808 dtmprintk(ioc,
827 "ioctl failed due to device removal in progress\n",809 ioc_info(ioc, "handle(0x%04x): ioctl failed due to device removal in progress\n",
828 ioc->name, device_handle));810 device_handle));
829 mpt3sas_base_free_smid(ioc, smid);811 mpt3sas_base_free_smid(ioc, smid);
830 ret = -EINVAL;812 ret = -EINVAL;
831 goto out;813 goto out;
@@ -843,9 +825,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 11 unmodified lines
843 mpt3sas_base_get_sense_buffer_dma(ioc, smid);825 mpt3sas_base_get_sense_buffer_dma(ioc, smid);
844 memset(ioc->ctl_cmds.sense, 0, SCSI_SENSE_BUFFERSIZE);826 memset(ioc->ctl_cmds.sense, 0, SCSI_SENSE_BUFFERSIZE);
845 if (test_bit(device_handle, ioc->device_remove_in_progress)) {827 if (test_bit(device_handle, ioc->device_remove_in_progress)) {
846 dtmprintk(ioc, pr_info(MPT3SAS_FMT828 dtmprintk(ioc,
847 "handle(0x%04x) :ioctl failed due to device removal in progress\n",829 ioc_info(ioc, "handle(0x%04x) :ioctl failed due to device removal in progress\n",
848 ioc->name, device_handle));830 device_handle));
849 mpt3sas_base_free_smid(ioc, smid);831 mpt3sas_base_free_smid(ioc, smid);
850 ret = -EINVAL;832 ret = -EINVAL;
851 goto out;833 goto out;
@@ -863,10 +845,10 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 11 unmodified lines
863 Mpi2SCSITaskManagementRequest_t *tm_request =845 Mpi2SCSITaskManagementRequest_t *tm_request =
864 (Mpi2SCSITaskManagementRequest_t *)request;846 (Mpi2SCSITaskManagementRequest_t *)request;
865 847
866 dtmprintk(ioc, pr_info(MPT3SAS_FMT848 dtmprintk(ioc,
867 "TASK_MGMT: handle(0x%04x), task_type(0x%02x)\n",849 ioc_info(ioc, "TASK_MGMT: handle(0x%04x), task_type(0x%02x)\n",
868 ioc->name,850 le16_to_cpu(tm_request->DevHandle),
869 le16_to_cpu(tm_request->DevHandle), tm_request->TaskType));851 tm_request->TaskType));
870 ioc->got_task_abort_from_ioctl = 1;852 ioc->got_task_abort_from_ioctl = 1;
871 if (tm_request->TaskType ==853 if (tm_request->TaskType ==
872 MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK ||854 MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK ||
@@ -881,9 +863,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 8 unmodified lines
881 ioc->got_task_abort_from_ioctl = 0;863 ioc->got_task_abort_from_ioctl = 0;
882 864
883 if (test_bit(device_handle, ioc->device_remove_in_progress)) {865 if (test_bit(device_handle, ioc->device_remove_in_progress)) {
884 dtmprintk(ioc, pr_info(MPT3SAS_FMT866 dtmprintk(ioc,
885 "handle(0x%04x) :ioctl failed due to device removal in progress\n",867 ioc_info(ioc, "handle(0x%04x) :ioctl failed due to device removal in progress\n",
886 ioc->name, device_handle));868 device_handle));
887 mpt3sas_base_free_smid(ioc, smid);869 mpt3sas_base_free_smid(ioc, smid);
888 ret = -EINVAL;870 ret = -EINVAL;
889 goto out;871 goto out;
@@ -929,9 +911,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 39 unmodified lines
929 case MPI2_FUNCTION_SATA_PASSTHROUGH:911 case MPI2_FUNCTION_SATA_PASSTHROUGH:
930 {912 {
931 if (test_bit(device_handle, ioc->device_remove_in_progress)) {913 if (test_bit(device_handle, ioc->device_remove_in_progress)) {
932 dtmprintk(ioc, pr_info(MPT3SAS_FMT914 dtmprintk(ioc,
933 "handle(0x%04x) :ioctl failed due to device removal in progress\n",915 ioc_info(ioc, "handle(0x%04x) :ioctl failed due to device removal in progress\n",
934 ioc->name, device_handle));916 device_handle));
935 mpt3sas_base_free_smid(ioc, smid);917 mpt3sas_base_free_smid(ioc, smid);
936 ret = -EINVAL;918 ret = -EINVAL;
937 goto out;919 goto out;
@@ -1017,12 +999,10 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 79 unmodified lines
1017 Mpi2SCSITaskManagementReply_t *tm_reply =999 Mpi2SCSITaskManagementReply_t *tm_reply =
1018 (Mpi2SCSITaskManagementReply_t *)mpi_reply;1000 (Mpi2SCSITaskManagementReply_t *)mpi_reply;
1019 1001
1020 pr_info(MPT3SAS_FMT "TASK_MGMT: " \1002 ioc_info(ioc, "TASK_MGMT: IOCStatus(0x%04x), IOCLogInfo(0x%08x), TerminationCount(0x%08x)\n",
1021 "IOCStatus(0x%04x), IOCLogInfo(0x%08x), "1003 le16_to_cpu(tm_reply->IOCStatus),
1022 "TerminationCount(0x%08x)\n", ioc->name,1004 le32_to_cpu(tm_reply->IOCLogInfo),
1023 le16_to_cpu(tm_reply->IOCStatus),1005 le32_to_cpu(tm_reply->TerminationCount));
1024 le32_to_cpu(tm_reply->IOCLogInfo),
1025 le32_to_cpu(tm_reply->TerminationCount));
1026 }1006 }
1027 1007
1028 /* copy out xdata to user */1008 /* copy out xdata to user */
@@ -1054,9 +1034,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 25 unmodified lines
1054 MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH || mpi_request->Function ==1034 MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH || mpi_request->Function ==
1055 MPI2_FUNCTION_NVME_ENCAPSULATED)) {1035 MPI2_FUNCTION_NVME_ENCAPSULATED)) {
1056 if (karg.sense_data_ptr == NULL) {1036 if (karg.sense_data_ptr == NULL) {
1057 pr_info(MPT3SAS_FMT "Response buffer provided"1037 ioc_info(ioc, "Response buffer provided by application is NULL; Response data will not be returned\n");
1058 " by application is NULL; Response data will"
1059 " not be returned.\n", ioc->name);
1060 goto out;1038 goto out;
1061 }1039 }
1062 sz_arg = (mpi_request->Function ==1040 sz_arg = (mpi_request->Function ==
@@ -1079,9 +1057,8 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 16 unmodified lines
1079 mpi_request->Function ==1057 mpi_request->Function ==
1080 MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH ||1058 MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH ||
1081 mpi_request->Function == MPI2_FUNCTION_SATA_PASSTHROUGH)) {1059 mpi_request->Function == MPI2_FUNCTION_SATA_PASSTHROUGH)) {
1082 pr_info(MPT3SAS_FMT "issue target reset: handle = (0x%04x)\n",1060 ioc_info(ioc, "issue target reset: handle = (0x%04x)\n",
1083 ioc->name,1061 le16_to_cpu(mpi_request->FunctionDependent1));
1084 le16_to_cpu(mpi_request->FunctionDependent1));
1085 mpt3sas_halt_firmware(ioc);1062 mpt3sas_halt_firmware(ioc);
1086 pcie_device = mpt3sas_get_pdev_by_handle(ioc,1063 pcie_device = mpt3sas_get_pdev_by_handle(ioc,
1087 le16_to_cpu(mpi_request->FunctionDependent1));1064 le16_to_cpu(mpi_request->FunctionDependent1));
@@ -1106,11 +1083,11 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 18 unmodified lines
1106 1083
1107 /* free memory associated with sg buffers */1084 /* free memory associated with sg buffers */
1108 if (data_in)1085 if (data_in)
1109 pci_free_consistent(ioc->pdev, data_in_sz, data_in,1086 dma_free_coherent(&ioc->pdev->dev, data_in_sz, data_in,
1110 data_in_dma);1087 data_in_dma);
1111 1088
1112 if (data_out)1089 if (data_out)
1113 pci_free_consistent(ioc->pdev, data_out_sz, data_out,1090 dma_free_coherent(&ioc->pdev->dev, data_out_sz, data_out,
1114 data_out_dma);1091 data_out_dma);
1115 1092
1116 kfree(mpi_request);1093 kfree(mpi_request);
@@ -1128,8 +1105,8 @@ _ctl_getiocinfo(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 11 unmodified lines
1128{1105{
1129 struct mpt3_ioctl_iocinfo karg;1106 struct mpt3_ioctl_iocinfo karg;
1130 1107
1131 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name,1108 dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
1132 __func__));1109 __func__));
1133 1110
1134 memset(&karg, 0 , sizeof(karg));1111 memset(&karg, 0 , sizeof(karg));
1135 if (ioc->pfacts)1112 if (ioc->pfacts)
@@ -1188,8 +1165,8 @@ _ctl_eventquery(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 52 unmodified lines
1188 return -EFAULT;1165 return -EFAULT;
1189 }1166 }
1190 1167
1191 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name,1168 dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
1192 __func__));1169 __func__));
1193 1170
1194 karg.event_entries = MPT3SAS_CTL_EVENT_LOG_SIZE;1171 karg.event_entries = MPT3SAS_CTL_EVENT_LOG_SIZE;
1195 memcpy(karg.event_types, ioc->event_type,1172 memcpy(karg.event_types, ioc->event_type,
@@ -1219,8 +1196,8 @@ _ctl_eventenable(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 23 unmodified lines
1219 return -EFAULT;1196 return -EFAULT;
1220 }1197 }
1221 1198
1222 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name,1199 dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
1223 __func__));1200 __func__));
1224 1201
1225 memcpy(ioc->event_type, karg.event_types,1202 memcpy(ioc->event_type, karg.event_types,
1226 MPI2_EVENT_NOTIFY_EVENTMASK_WORDS * sizeof(u32));1203 MPI2_EVENT_NOTIFY_EVENTMASK_WORDS * sizeof(u32));
@@ -1259,8 +1236,8 @@ _ctl_eventreport(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 32 unmodified lines
1259 return -EFAULT;1236 return -EFAULT;
1260 }1237 }
1261 1238
1262 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name,1239 dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
1263 __func__));1240 __func__));
1264 1241
1265 number_bytes = karg.hdr.max_data_size -1242 number_bytes = karg.hdr.max_data_size -
1266 sizeof(struct mpt3_ioctl_header);1243 sizeof(struct mpt3_ioctl_header);
@@ -1306,12 +1283,11 @@ _ctl_do_reset(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 39 unmodified lines
1306 ioc->is_driver_loading)1283 ioc->is_driver_loading)
1307 return -EAGAIN;1284 return -EAGAIN;
1308 1285
1309 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name,1286 dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
1310 __func__));1287 __func__));
1311 1288
1312 retval = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);1289 retval = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
1313 pr_info(MPT3SAS_FMT "host reset: %s\n",1290 ioc_info(ioc, "host reset: %s\n", ((!retval) ? "SUCCESS" : "FAILED"));
1314 ioc->name, ((!retval) ? "SUCCESS" : "FAILED"));
1315 return 0;1291 return 0;
1316}1292}
1317 1293
@@ -1440,8 +1416,8 @@ _ctl_btdh_mapping(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 122 unmodified lines
1440 return -EFAULT;1416 return -EFAULT;
1441 }1417 }
1442 1418
1443 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,1419 dctlprintk(ioc, ioc_info(ioc, "%s\n",
1444 __func__));1420 __func__));
1445 1421
1446 rc = _ctl_btdh_search_sas_device(ioc, &karg);1422 rc = _ctl_btdh_search_sas_device(ioc, &karg);
1447 if (!rc)1423 if (!rc)
@@ -1512,53 +1488,46 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 64 unmodified lines
1512 u32 ioc_state;1488 u32 ioc_state;
1513 u8 issue_reset = 0;1489 u8 issue_reset = 0;
1514 1490
1515 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,1491 dctlprintk(ioc, ioc_info(ioc, "%s\n",
1516 __func__));1492 __func__));
1517 1493
1518 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);1494 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
1519 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {1495 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
1520 pr_err(MPT3SAS_FMT1496 ioc_err(ioc, "%s: failed due to ioc not operational\n",
1521 "%s: failed due to ioc not operational\n",1497 __func__);
1522 ioc->name, __func__);
1523 rc = -EAGAIN;1498 rc = -EAGAIN;
1524 goto out;1499 goto out;
1525 }1500 }
1526 1501
1527 if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {1502 if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {
1528 pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n",1503 ioc_err(ioc, "%s: ctl_cmd in use\n", __func__);
1529 ioc->name, __func__);
1530 rc = -EAGAIN;1504 rc = -EAGAIN;
1531 goto out;1505 goto out;
1532 }1506 }
1533 1507
1534 buffer_type = diag_register->buffer_type;1508 buffer_type = diag_register->buffer_type;
1535 if (!_ctl_diag_capability(ioc, buffer_type)) {1509 if (!_ctl_diag_capability(ioc, buffer_type)) {
1536 pr_err(MPT3SAS_FMT1510 ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
1537 "%s: doesn't have capability for buffer_type(0x%02x)\n",1511 __func__, buffer_type);
1538 ioc->name, __func__, buffer_type);
1539 return -EPERM;1512 return -EPERM;
1540 }1513 }
1541 1514
1542 if (ioc->diag_buffer_status[buffer_type] &1515 if (ioc->diag_buffer_status[buffer_type] &
1543 MPT3_DIAG_BUFFER_IS_REGISTERED) {1516 MPT3_DIAG_BUFFER_IS_REGISTERED) {
1544 pr_err(MPT3SAS_FMT1517 ioc_err(ioc, "%s: already has a registered buffer for buffer_type(0x%02x)\n",
1545 "%s: already has a registered buffer for buffer_type(0x%02x)\n",1518 __func__, buffer_type);
1546 ioc->name, __func__,
1547 buffer_type);
1548 return -EINVAL;1519 return -EINVAL;
1549 }1520 }
1550 1521
1551 if (diag_register->requested_buffer_size % 4) {1522 if (diag_register->requested_buffer_size % 4) {
1552 pr_err(MPT3SAS_FMT1523 ioc_err(ioc, "%s: the requested_buffer_size is not 4 byte aligned\n",
1553 "%s: the requested_buffer_size is not 4 byte aligned\n",1524 __func__);
1554 ioc->name, __func__);
1555 return -EINVAL;1525 return -EINVAL;
1556 }1526 }
1557 1527
1558 smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx);1528 smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx);
1559 if (!smid) {1529 if (!smid) {
1560 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",1530 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
1561 ioc->name, __func__);
1562 rc = -EAGAIN;1531 rc = -EAGAIN;
1563 goto out;1532 goto out;
1564 }1533 }
@@ -1580,9 +1549,9 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 15 unmodified lines
1580 if (request_data) {1549 if (request_data) {
1581 request_data_dma = ioc->diag_buffer_dma[buffer_type];1550 request_data_dma = ioc->diag_buffer_dma[buffer_type];
1582 if (request_data_sz != ioc->diag_buffer_sz[buffer_type]) {1551 if (request_data_sz != ioc->diag_buffer_sz[buffer_type]) {
1583 pci_free_consistent(ioc->pdev,1552 dma_free_coherent(&ioc->pdev->dev,
1584 ioc->diag_buffer_sz[buffer_type],1553 ioc->diag_buffer_sz[buffer_type],
1585 request_data, request_data_dma);1554 request_data, request_data_dma);
1586 request_data = NULL;1555 request_data = NULL;
1587 }1556 }
1588 }1557 }
@@ -1590,12 +1559,11 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
1590 if (request_data == NULL) {1559 if (request_data == NULL) {
1591 ioc->diag_buffer_sz[buffer_type] = 0;1560 ioc->diag_buffer_sz[buffer_type] = 0;
1592 ioc->diag_buffer_dma[buffer_type] = 0;1561 ioc->diag_buffer_dma[buffer_type] = 0;
1593 request_data = pci_alloc_consistent(1562 request_data = dma_alloc_coherent(&ioc->pdev->dev,
1594 ioc->pdev, request_data_sz, &request_data_dma);1563 request_data_sz, &request_data_dma, GFP_KERNEL);
1595 if (request_data == NULL) {1564 if (request_data == NULL) {
1596 pr_err(MPT3SAS_FMT "%s: failed allocating memory" \1565 ioc_err(ioc, "%s: failed allocating memory for diag buffers, requested size(%d)\n",
1597 " for diag buffers, requested size(%d)\n",1566 __func__, request_data_sz);
1598 ioc->name, __func__, request_data_sz);
1599 mpt3sas_base_free_smid(ioc, smid);1567 mpt3sas_base_free_smid(ioc, smid);
1600 return -ENOMEM;1568 return -ENOMEM;
1601 }1569 }
@@ -1612,11 +1580,11 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 10 unmodified lines
1612 mpi_request->VF_ID = 0; /* TODO */1580 mpi_request->VF_ID = 0; /* TODO */
1613 mpi_request->VP_ID = 0;1581 mpi_request->VP_ID = 0;
1614 1582
1615 dctlprintk(ioc, pr_info(MPT3SAS_FMT1583 dctlprintk(ioc,
1616 "%s: diag_buffer(0x%p), dma(0x%llx), sz(%d)\n",1584 ioc_info(ioc, "%s: diag_buffer(0x%p), dma(0x%llx), sz(%d)\n",
1617 ioc->name, __func__, request_data,1585 __func__, request_data,
1618 (unsigned long long)request_data_dma,1586 (unsigned long long)request_data_dma,
1619 le32_to_cpu(mpi_request->BufferLength)));1587 le32_to_cpu(mpi_request->BufferLength)));
1620 1588
1621 for (i = 0; i < MPT3_PRODUCT_SPECIFIC_DWORDS; i++)1589 for (i = 0; i < MPT3_PRODUCT_SPECIFIC_DWORDS; i++)
1622 mpi_request->ProductSpecific[i] =1590 mpi_request->ProductSpecific[i] =
@@ -1637,8 +1605,7 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 14 unmodified lines
1637 1605
1638 /* process the completed Reply Message Frame */1606 /* process the completed Reply Message Frame */
1639 if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) {1607 if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) {
1640 pr_err(MPT3SAS_FMT "%s: no reply message\n",1608 ioc_err(ioc, "%s: no reply message\n", __func__);
1641 ioc->name, __func__);
1642 rc = -EFAULT;1609 rc = -EFAULT;
1643 goto out;1610 goto out;
1644 }1611 }
@@ -1649,13 +1616,11 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 4 unmodified lines
1649 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {1616 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
1650 ioc->diag_buffer_status[buffer_type] |=1617 ioc->diag_buffer_status[buffer_type] |=
1651 MPT3_DIAG_BUFFER_IS_REGISTERED;1618 MPT3_DIAG_BUFFER_IS_REGISTERED;
1652 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: success\n",1619 dctlprintk(ioc, ioc_info(ioc, "%s: success\n", __func__));
1653 ioc->name, __func__));
1654 } else {1620 } else {
1655 pr_info(MPT3SAS_FMT1621 ioc_info(ioc, "%s: ioc_status(0x%04x) log_info(0x%08x)\n",
1656 "%s: ioc_status(0x%04x) log_info(0x%08x)\n",1622 __func__,
1657 ioc->name, __func__,1623 ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
1658 ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
1659 rc = -EFAULT;1624 rc = -EFAULT;
1660 }1625 }
1661 1626
@@ -1666,7 +1631,7 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 4 unmodified lines
1666 out:1631 out:
1667 1632
1668 if (rc && request_data)1633 if (rc && request_data)
1669 pci_free_consistent(ioc->pdev, request_data_sz,1634 dma_free_coherent(&ioc->pdev->dev, request_data_sz,
1670 request_data, request_data_dma);1635 request_data, request_data_dma);
1671 1636
1672 ioc->ctl_cmds.status = MPT3_CMD_NOT_USED;1637 ioc->ctl_cmds.status = MPT3_CMD_NOT_USED;
@@ -1689,8 +1654,7 @@ mpt3sas_enable_diag_buffer(struct MPT3SAS_ADAPTER *ioc, u8 bits_to_register) · 16 unmodified lines
1689 memset(&diag_register, 0, sizeof(struct mpt3_diag_register));1654 memset(&diag_register, 0, sizeof(struct mpt3_diag_register));
1690 1655
1691 if (bits_to_register & 1) {1656 if (bits_to_register & 1) {
1692 pr_info(MPT3SAS_FMT "registering trace buffer support\n",1657 ioc_info(ioc, "registering trace buffer support\n");
1693 ioc->name);
1694 ioc->diag_trigger_master.MasterData =1658 ioc->diag_trigger_master.MasterData =
1695 (MASTER_TRIGGER_FW_FAULT + MASTER_TRIGGER_ADAPTER_RESET);1659 (MASTER_TRIGGER_FW_FAULT + MASTER_TRIGGER_ADAPTER_RESET);
1696 diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_TRACE;1660 diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_TRACE;
@@ -1701,8 +1665,7 @@ mpt3sas_enable_diag_buffer(struct MPT3SAS_ADAPTER *ioc, u8 bits_to_register) · 4 unmodified lines
1701 }1665 }
1702 1666
1703 if (bits_to_register & 2) {1667 if (bits_to_register & 2) {
1704 pr_info(MPT3SAS_FMT "registering snapshot buffer support\n",1668 ioc_info(ioc, "registering snapshot buffer support\n");
1705 ioc->name);
1706 diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_SNAPSHOT;1669 diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_SNAPSHOT;
1707 /* register for 2MB buffers */1670 /* register for 2MB buffers */
1708 diag_register.requested_buffer_size = 2 * (1024 * 1024);1671 diag_register.requested_buffer_size = 2 * (1024 * 1024);
@@ -1711,8 +1674,7 @@ mpt3sas_enable_diag_buffer(struct MPT3SAS_ADAPTER *ioc, u8 bits_to_register) · 2 unmodified lines
1711 }1674 }
1712 1675
1713 if (bits_to_register & 4) {1676 if (bits_to_register & 4) {
1714 pr_info(MPT3SAS_FMT "registering extended buffer support\n",1677 ioc_info(ioc, "registering extended buffer support\n");
1715 ioc->name);
1716 diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_EXTENDED;1678 diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_EXTENDED;
1717 /* register for 2MB buffers */1679 /* register for 2MB buffers */
1718 diag_register.requested_buffer_size = 2 * (1024 * 1024);1680 diag_register.requested_buffer_size = 2 * (1024 * 1024);
@@ -1768,51 +1730,46 @@ _ctl_diag_unregister(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 49 unmodified lines
1768 return -EFAULT;1730 return -EFAULT;
1769 }1731 }
1770 1732
1771 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,1733 dctlprintk(ioc, ioc_info(ioc, "%s\n",
1772 __func__));1734 __func__));
1773 1735
1774 buffer_type = karg.unique_id & 0x000000ff;1736 buffer_type = karg.unique_id & 0x000000ff;
1775 if (!_ctl_diag_capability(ioc, buffer_type)) {1737 if (!_ctl_diag_capability(ioc, buffer_type)) {
1776 pr_err(MPT3SAS_FMT1738 ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
1777 "%s: doesn't have capability for buffer_type(0x%02x)\n",1739 __func__, buffer_type);
1778 ioc->name, __func__, buffer_type);
1779 return -EPERM;1740 return -EPERM;
1780 }1741 }
1781 1742
1782 if ((ioc->diag_buffer_status[buffer_type] &1743 if ((ioc->diag_buffer_status[buffer_type] &
1783 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {1744 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
1784 pr_err(MPT3SAS_FMT1745 ioc_err(ioc, "%s: buffer_type(0x%02x) is not registered\n",
1785 "%s: buffer_type(0x%02x) is not registered\n",1746 __func__, buffer_type);
1786 ioc->name, __func__, buffer_type);
1787 return -EINVAL;1747 return -EINVAL;
1788 }1748 }
1789 if ((ioc->diag_buffer_status[buffer_type] &1749 if ((ioc->diag_buffer_status[buffer_type] &
1790 MPT3_DIAG_BUFFER_IS_RELEASED) == 0) {1750 MPT3_DIAG_BUFFER_IS_RELEASED) == 0) {
1791 pr_err(MPT3SAS_FMT1751 ioc_err(ioc, "%s: buffer_type(0x%02x) has not been released\n",
1792 "%s: buffer_type(0x%02x) has not been released\n",1752 __func__, buffer_type);
1793 ioc->name, __func__, buffer_type);
1794 return -EINVAL;1753 return -EINVAL;
1795 }1754 }
1796 1755
1797 if (karg.unique_id != ioc->unique_id[buffer_type]) {1756 if (karg.unique_id != ioc->unique_id[buffer_type]) {
1798 pr_err(MPT3SAS_FMT1757 ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n",
1799 "%s: unique_id(0x%08x) is not registered\n",1758 __func__, karg.unique_id);
1800 ioc->name, __func__, karg.unique_id);
1801 return -EINVAL;1759 return -EINVAL;
1802 }1760 }
1803 1761
1804 request_data = ioc->diag_buffer[buffer_type];1762 request_data = ioc->diag_buffer[buffer_type];
1805 if (!request_data) {1763 if (!request_data) {
1806 pr_err(MPT3SAS_FMT1764 ioc_err(ioc, "%s: doesn't have memory allocated for buffer_type(0x%02x)\n",
1807 "%s: doesn't have memory allocated for buffer_type(0x%02x)\n",1765 __func__, buffer_type);
1808 ioc->name, __func__, buffer_type);
1809 return -ENOMEM;1766 return -ENOMEM;
1810 }1767 }
1811 1768
1812 request_data_sz = ioc->diag_buffer_sz[buffer_type];1769 request_data_sz = ioc->diag_buffer_sz[buffer_type];
1813 request_data_dma = ioc->diag_buffer_dma[buffer_type];1770 request_data_dma = ioc->diag_buffer_dma[buffer_type];
1814 pci_free_consistent(ioc->pdev, request_data_sz,1771 dma_free_coherent(&ioc->pdev->dev, request_data_sz,
1815 request_data, request_data_dma);1772 request_data, request_data_dma);
1816 ioc->diag_buffer[buffer_type] = NULL;1773 ioc->diag_buffer[buffer_type] = NULL;
1817 ioc->diag_buffer_status[buffer_type] = 0;1774 ioc->diag_buffer_status[buffer_type] = 0;
1818 return 0;1775 return 0;
@@ -1841,41 +1798,37 @@ _ctl_diag_query(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 22 unmodified lines
1841 return -EFAULT;1798 return -EFAULT;
1842 }1799 }
1843 1800
1844 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,1801 dctlprintk(ioc, ioc_info(ioc, "%s\n",
1845 __func__));1802 __func__));
1846 1803
1847 karg.application_flags = 0;1804 karg.application_flags = 0;
1848 buffer_type = karg.buffer_type;1805 buffer_type = karg.buffer_type;
1849 1806
1850 if (!_ctl_diag_capability(ioc, buffer_type)) {1807 if (!_ctl_diag_capability(ioc, buffer_type)) {
1851 pr_err(MPT3SAS_FMT1808 ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
1852 "%s: doesn't have capability for buffer_type(0x%02x)\n",1809 __func__, buffer_type);
1853 ioc->name, __func__, buffer_type);
1854 return -EPERM;1810 return -EPERM;
1855 }1811 }
1856 1812
1857 if ((ioc->diag_buffer_status[buffer_type] &1813 if ((ioc->diag_buffer_status[buffer_type] &
1858 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {1814 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
1859 pr_err(MPT3SAS_FMT1815 ioc_err(ioc, "%s: buffer_type(0x%02x) is not registered\n",
1860 "%s: buffer_type(0x%02x) is not registered\n",1816 __func__, buffer_type);
1861 ioc->name, __func__, buffer_type);
1862 return -EINVAL;1817 return -EINVAL;
1863 }1818 }
1864 1819
1865 if (karg.unique_id & 0xffffff00) {1820 if (karg.unique_id & 0xffffff00) {
1866 if (karg.unique_id != ioc->unique_id[buffer_type]) {1821 if (karg.unique_id != ioc->unique_id[buffer_type]) {
1867 pr_err(MPT3SAS_FMT1822 ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n",
1868 "%s: unique_id(0x%08x) is not registered\n",1823 __func__, karg.unique_id);
1869 ioc->name, __func__, karg.unique_id);
1870 return -EINVAL;1824 return -EINVAL;
1871 }1825 }
1872 }1826 }
1873 1827
1874 request_data = ioc->diag_buffer[buffer_type];1828 request_data = ioc->diag_buffer[buffer_type];
1875 if (!request_data) {1829 if (!request_data) {
1876 pr_err(MPT3SAS_FMT1830 ioc_err(ioc, "%s: doesn't have buffer for buffer_type(0x%02x)\n",
1877 "%s: doesn't have buffer for buffer_type(0x%02x)\n",1831 __func__, buffer_type);
1878 ioc->name, __func__, buffer_type);
1879 return -ENOMEM;1832 return -ENOMEM;
1880 }1833 }
1881 1834
@@ -1897,9 +1850,8 @@ _ctl_diag_query(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 15 unmodified lines
1897 karg.diagnostic_flags = ioc->diagnostic_flags[buffer_type];1850 karg.diagnostic_flags = ioc->diagnostic_flags[buffer_type];
1898 1851
1899 if (copy_to_user(arg, &karg, sizeof(struct mpt3_diag_query))) {1852 if (copy_to_user(arg, &karg, sizeof(struct mpt3_diag_query))) {
1900 pr_err(MPT3SAS_FMT1853 ioc_err(ioc, "%s: unable to write mpt3_diag_query data @ %p\n",
1901 "%s: unable to write mpt3_diag_query data @ %p\n",1854 __func__, arg);
1902 ioc->name, __func__, arg);
1903 return -EFAULT;1855 return -EFAULT;
1904 }1856 }
1905 return 0;1857 return 0;
@@ -1923,8 +1875,8 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, · 17 unmodified lines
1923 u32 ioc_state;1875 u32 ioc_state;
1924 int rc;1876 int rc;
1925 1877
1926 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,1878 dctlprintk(ioc, ioc_info(ioc, "%s\n",
1927 __func__));1879 __func__));
1928 1880
1929 rc = 0;1881 rc = 0;
1930 *issue_reset = 0;1882 *issue_reset = 0;
@@ -1935,24 +1887,22 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, · 4 unmodified lines
1935 MPT3_DIAG_BUFFER_IS_REGISTERED)1887 MPT3_DIAG_BUFFER_IS_REGISTERED)
1936 ioc->diag_buffer_status[buffer_type] |=1888 ioc->diag_buffer_status[buffer_type] |=
1937 MPT3_DIAG_BUFFER_IS_RELEASED;1889 MPT3_DIAG_BUFFER_IS_RELEASED;
1938 dctlprintk(ioc, pr_info(MPT3SAS_FMT1890 dctlprintk(ioc,
1939 "%s: skipping due to FAULT state\n", ioc->name,1891 ioc_info(ioc, "%s: skipping due to FAULT state\n",
1940 __func__));1892 __func__));
1941 rc = -EAGAIN;1893 rc = -EAGAIN;
1942 goto out;1894 goto out;
1943 }1895 }
1944 1896
1945 if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {1897 if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {
1946 pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n",1898 ioc_err(ioc, "%s: ctl_cmd in use\n", __func__);
1947 ioc->name, __func__);
1948 rc = -EAGAIN;1899 rc = -EAGAIN;
1949 goto out;1900 goto out;
1950 }1901 }
1951 1902
1952 smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx);1903 smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx);
1953 if (!smid) {1904 if (!smid) {
1954 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",1905 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
1955 ioc->name, __func__);
1956 rc = -EAGAIN;1906 rc = -EAGAIN;
1957 goto out;1907 goto out;
1958 }1908 }
@@ -1982,8 +1932,7 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, · 23 unmodified lines
1982 1932
1983 /* process the completed Reply Message Frame */1933 /* process the completed Reply Message Frame */
1984 if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) {1934 if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) {
1985 pr_err(MPT3SAS_FMT "%s: no reply message\n",1935 ioc_err(ioc, "%s: no reply message\n", __func__);
1986 ioc->name, __func__);
1987 rc = -EFAULT;1936 rc = -EFAULT;
1988 goto out;1937 goto out;
1989 }1938 }
@@ -1994,13 +1943,11 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, · 4 unmodified lines
1994 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {1943 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
1995 ioc->diag_buffer_status[buffer_type] |=1944 ioc->diag_buffer_status[buffer_type] |=
1996 MPT3_DIAG_BUFFER_IS_RELEASED;1945 MPT3_DIAG_BUFFER_IS_RELEASED;
1997 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: success\n",1946 dctlprintk(ioc, ioc_info(ioc, "%s: success\n", __func__));
1998 ioc->name, __func__));
1999 } else {1947 } else {
2000 pr_info(MPT3SAS_FMT1948 ioc_info(ioc, "%s: ioc_status(0x%04x) log_info(0x%08x)\n",
2001 "%s: ioc_status(0x%04x) log_info(0x%08x)\n",1949 __func__,
2002 ioc->name, __func__,1950 ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
2003 ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
2004 rc = -EFAULT;1951 rc = -EFAULT;
2005 }1952 }
2006 1953
@@ -2033,47 +1980,41 @@ _ctl_diag_release(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 26 unmodified lines
2033 return -EFAULT;1980 return -EFAULT;
2034 }1981 }
2035 1982
2036 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,1983 dctlprintk(ioc, ioc_info(ioc, "%s\n",
2037 __func__));1984 __func__));
2038 1985
2039 buffer_type = karg.unique_id & 0x000000ff;1986 buffer_type = karg.unique_id & 0x000000ff;
2040 if (!_ctl_diag_capability(ioc, buffer_type)) {1987 if (!_ctl_diag_capability(ioc, buffer_type)) {
2041 pr_err(MPT3SAS_FMT1988 ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
2042 "%s: doesn't have capability for buffer_type(0x%02x)\n",1989 __func__, buffer_type);
2043 ioc->name, __func__, buffer_type);
2044 return -EPERM;1990 return -EPERM;
2045 }1991 }
2046 1992
2047 if ((ioc->diag_buffer_status[buffer_type] &1993 if ((ioc->diag_buffer_status[buffer_type] &
2048 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {1994 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
2049 pr_err(MPT3SAS_FMT1995 ioc_err(ioc, "%s: buffer_type(0x%02x) is not registered\n",
2050 "%s: buffer_type(0x%02x) is not registered\n",1996 __func__, buffer_type);
2051 ioc->name, __func__, buffer_type);
2052 return -EINVAL;1997 return -EINVAL;
2053 }1998 }
2054 1999
2055 if (karg.unique_id != ioc->unique_id[buffer_type]) {2000 if (karg.unique_id != ioc->unique_id[buffer_type]) {
2056 pr_err(MPT3SAS_FMT2001 ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n",
2057 "%s: unique_id(0x%08x) is not registered\n",2002 __func__, karg.unique_id);
2058 ioc->name, __func__, karg.unique_id);
2059 return -EINVAL;2003 return -EINVAL;
2060 }2004 }
2061 2005
2062 if (ioc->diag_buffer_status[buffer_type] &2006 if (ioc->diag_buffer_status[buffer_type] &
2063 MPT3_DIAG_BUFFER_IS_RELEASED) {2007 MPT3_DIAG_BUFFER_IS_RELEASED) {
2064 pr_err(MPT3SAS_FMT2008 ioc_err(ioc, "%s: buffer_type(0x%02x) is already released\n",
2065 "%s: buffer_type(0x%02x) is already released\n",2009 __func__, buffer_type);
2066 ioc->name, __func__,
2067 buffer_type);
2068 return 0;2010 return 0;
2069 }2011 }
2070 2012
2071 request_data = ioc->diag_buffer[buffer_type];2013 request_data = ioc->diag_buffer[buffer_type];
2072 2014
2073 if (!request_data) {2015 if (!request_data) {
2074 pr_err(MPT3SAS_FMT2016 ioc_err(ioc, "%s: doesn't have memory allocated for buffer_type(0x%02x)\n",
2075 "%s: doesn't have memory allocated for buffer_type(0x%02x)\n",2017 __func__, buffer_type);
2076 ioc->name, __func__, buffer_type);
2077 return -ENOMEM;2018 return -ENOMEM;
2078 }2019 }
2079 2020
@@ -2084,9 +2025,8 @@ _ctl_diag_release(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 4 unmodified lines
2084 MPT3_DIAG_BUFFER_IS_RELEASED;2025 MPT3_DIAG_BUFFER_IS_RELEASED;
2085 ioc->diag_buffer_status[buffer_type] &=2026 ioc->diag_buffer_status[buffer_type] &=
2086 ~MPT3_DIAG_BUFFER_IS_DIAG_RESET;2027 ~MPT3_DIAG_BUFFER_IS_DIAG_RESET;
2087 pr_err(MPT3SAS_FMT2028 ioc_err(ioc, "%s: buffer_type(0x%02x) was released due to host reset\n",
2088 "%s: buffer_type(0x%02x) was released due to host reset\n",2029 __func__, buffer_type);
2089 ioc->name, __func__, buffer_type);
2090 return 0;2030 return 0;
2091 }2031 }
2092 2032
@@ -2124,38 +2064,34 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 31 unmodified lines
2124 return -EFAULT;2064 return -EFAULT;
2125 }2065 }
2126 2066
2127 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,2067 dctlprintk(ioc, ioc_info(ioc, "%s\n",
2128 __func__));2068 __func__));
2129 2069
2130 buffer_type = karg.unique_id & 0x000000ff;2070 buffer_type = karg.unique_id & 0x000000ff;
2131 if (!_ctl_diag_capability(ioc, buffer_type)) {2071 if (!_ctl_diag_capability(ioc, buffer_type)) {
2132 pr_err(MPT3SAS_FMT2072 ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
2133 "%s: doesn't have capability for buffer_type(0x%02x)\n",2073 __func__, buffer_type);
2134 ioc->name, __func__, buffer_type);
2135 return -EPERM;2074 return -EPERM;
2136 }2075 }
2137 2076
2138 if (karg.unique_id != ioc->unique_id[buffer_type]) {2077 if (karg.unique_id != ioc->unique_id[buffer_type]) {
2139 pr_err(MPT3SAS_FMT2078 ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n",
2140 "%s: unique_id(0x%08x) is not registered\n",2079 __func__, karg.unique_id);
2141 ioc->name, __func__, karg.unique_id);
2142 return -EINVAL;2080 return -EINVAL;
2143 }2081 }
2144 2082
2145 request_data = ioc->diag_buffer[buffer_type];2083 request_data = ioc->diag_buffer[buffer_type];
2146 if (!request_data) {2084 if (!request_data) {
2147 pr_err(MPT3SAS_FMT2085 ioc_err(ioc, "%s: doesn't have buffer for buffer_type(0x%02x)\n",
2148 "%s: doesn't have buffer for buffer_type(0x%02x)\n",2086 __func__, buffer_type);
2149 ioc->name, __func__, buffer_type);
2150 return -ENOMEM;2087 return -ENOMEM;
2151 }2088 }
2152 2089
2153 request_size = ioc->diag_buffer_sz[buffer_type];2090 request_size = ioc->diag_buffer_sz[buffer_type];
2154 2091
2155 if ((karg.starting_offset % 4) || (karg.bytes_to_read % 4)) {2092 if ((karg.starting_offset % 4) || (karg.bytes_to_read % 4)) {
2156 pr_err(MPT3SAS_FMT "%s: either the starting_offset " \2093 ioc_err(ioc, "%s: either the starting_offset or bytes_to_read are not 4 byte aligned\n",
2157 "or bytes_to_read are not 4 byte aligned\n", ioc->name,2094 __func__);
2158 __func__);
2159 return -EINVAL;2095 return -EINVAL;
2160 }2096 }
2161 2097
@@ -2163,10 +2099,10 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 1 unmodified line
2163 return -EINVAL;2099 return -EINVAL;
2164 2100
2165 diag_data = (void *)(request_data + karg.starting_offset);2101 diag_data = (void *)(request_data + karg.starting_offset);
2166 dctlprintk(ioc, pr_info(MPT3SAS_FMT2102 dctlprintk(ioc,
2167 "%s: diag_buffer(%p), offset(%d), sz(%d)\n",2103 ioc_info(ioc, "%s: diag_buffer(%p), offset(%d), sz(%d)\n",
2168 ioc->name, __func__,2104 __func__, diag_data, karg.starting_offset,
2169 diag_data, karg.starting_offset, karg.bytes_to_read));2105 karg.bytes_to_read));
2170 2106
2171 /* Truncate data on requests that are too large */2107 /* Truncate data on requests that are too large */
2172 if ((diag_data + karg.bytes_to_read < diag_data) ||2108 if ((diag_data + karg.bytes_to_read < diag_data) ||
@@ -2177,39 +2113,36 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 4 unmodified lines
2177 2113
2178 if (copy_to_user((void __user *)uarg->diagnostic_data,2114 if (copy_to_user((void __user *)uarg->diagnostic_data,
2179 diag_data, copy_size)) {2115 diag_data, copy_size)) {
2180 pr_err(MPT3SAS_FMT2116 ioc_err(ioc, "%s: Unable to write mpt_diag_read_buffer_t data @ %p\n",
2181 "%s: Unable to write mpt_diag_read_buffer_t data @ %p\n",2117 __func__, diag_data);
2182 ioc->name, __func__, diag_data);
2183 return -EFAULT;2118 return -EFAULT;
2184 }2119 }
2185 2120
2186 if ((karg.flags & MPT3_FLAGS_REREGISTER) == 0)2121 if ((karg.flags & MPT3_FLAGS_REREGISTER) == 0)
2187 return 0;2122 return 0;
2188 2123
2189 dctlprintk(ioc, pr_info(MPT3SAS_FMT2124 dctlprintk(ioc,
2190 "%s: Reregister buffer_type(0x%02x)\n",2125 ioc_info(ioc, "%s: Reregister buffer_type(0x%02x)\n",
2191 ioc->name, __func__, buffer_type));2126 __func__, buffer_type));
2192 if ((ioc->diag_buffer_status[buffer_type] &2127 if ((ioc->diag_buffer_status[buffer_type] &
2193 MPT3_DIAG_BUFFER_IS_RELEASED) == 0) {2128 MPT3_DIAG_BUFFER_IS_RELEASED) == 0) {
2194 dctlprintk(ioc, pr_info(MPT3SAS_FMT2129 dctlprintk(ioc,
2195 "%s: buffer_type(0x%02x) is still registered\n",2130 ioc_info(ioc, "%s: buffer_type(0x%02x) is still registered\n",
2196 ioc->name, __func__, buffer_type));2131 __func__, buffer_type));
2197 return 0;2132 return 0;
2198 }2133 }
2199 /* Get a free request frame and save the message context.2134 /* Get a free request frame and save the message context.
2200 */2135 */
2201 2136
2202 if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {2137 if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {
2203 pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n",2138 ioc_err(ioc, "%s: ctl_cmd in use\n", __func__);
2204 ioc->name, __func__);
2205 rc = -EAGAIN;2139 rc = -EAGAIN;
2206 goto out;2140 goto out;
2207 }2141 }
2208 2142
2209 smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx);2143 smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx);
2210 if (!smid) {2144 if (!smid) {
2211 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",2145 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
2212 ioc->name, __func__);
2213 rc = -EAGAIN;2146 rc = -EAGAIN;
2214 goto out;2147 goto out;
2215 }2148 }
@@ -2247,8 +2180,7 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 31 unmodified lines
2247 2180
2248 /* process the completed Reply Message Frame */2181 /* process the completed Reply Message Frame */
2249 if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) {2182 if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) {
2250 pr_err(MPT3SAS_FMT "%s: no reply message\n",2183 ioc_err(ioc, "%s: no reply message\n", __func__);
2251 ioc->name, __func__);
2252 rc = -EFAULT;2184 rc = -EFAULT;
2253 goto out;2185 goto out;
2254 }2186 }
@@ -2259,13 +2191,11 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 4 unmodified lines
2259 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {2191 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
2260 ioc->diag_buffer_status[buffer_type] |=2192 ioc->diag_buffer_status[buffer_type] |=
2261 MPT3_DIAG_BUFFER_IS_REGISTERED;2193 MPT3_DIAG_BUFFER_IS_REGISTERED;
2262 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: success\n",2194 dctlprintk(ioc, ioc_info(ioc, "%s: success\n", __func__));
2263 ioc->name, __func__));
2264 } else {2195 } else {
2265 pr_info(MPT3SAS_FMT2196 ioc_info(ioc, "%s: ioc_status(0x%04x) log_info(0x%08x)\n",
2266 "%s: ioc_status(0x%04x) log_info(0x%08x)\n",2197 __func__, ioc_status,
2267 ioc->name, __func__,2198 le32_to_cpu(mpi_reply->IOCLogInfo));
2268 ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
2269 rc = -EFAULT;2199 rc = -EFAULT;
2270 }2200 }
2271 2201
@@ -2450,8 +2380,9 @@ _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg, · 178 unmodified lines
2450 ret = _ctl_diag_read_buffer(ioc, arg);2380 ret = _ctl_diag_read_buffer(ioc, arg);
2451 break;2381 break;
2452 default:2382 default:
2453 dctlprintk(ioc, pr_info(MPT3SAS_FMT2383 dctlprintk(ioc,
2454 "unsupported ioctl opcode(0x%08x)\n", ioc->name, cmd));2384 ioc_info(ioc, "unsupported ioctl opcode(0x%08x)\n",
2385 cmd));
2455 break;2386 break;
2456 }2387 }
2457 2388
@@ -2840,8 +2771,8 @@ _ctl_logging_level_store(struct device *cdev, struct device_attribute *attr, · 382 unmodified lines
2840 return -EINVAL;2771 return -EINVAL;
2841 2772
2842 ioc->logging_level = val;2773 ioc->logging_level = val;
2843 pr_info(MPT3SAS_FMT "logging_level=%08xh\n", ioc->name,2774 ioc_info(ioc, "logging_level=%08xh\n",
2844 ioc->logging_level);2775 ioc->logging_level);
2845 return strlen(buf);2776 return strlen(buf);
2846}2777}
2847static DEVICE_ATTR(logging_level, S_IRUGO | S_IWUSR, _ctl_logging_level_show,2778static DEVICE_ATTR(logging_level, S_IRUGO | S_IWUSR, _ctl_logging_level_show,
@@ -2877,8 +2808,8 @@ _ctl_fwfault_debug_store(struct device *cdev, struct device_attribute *attr, · 29 unmodified lines
2877 return -EINVAL;2808 return -EINVAL;
2878 2809
2879 ioc->fwfault_debug = val;2810 ioc->fwfault_debug = val;
2880 pr_info(MPT3SAS_FMT "fwfault_debug=%d\n", ioc->name,2811 ioc_info(ioc, "fwfault_debug=%d\n",
2881 ioc->fwfault_debug);2812 ioc->fwfault_debug);
2882 return strlen(buf);2813 return strlen(buf);
2883}2814}
2884static DEVICE_ATTR(fwfault_debug, S_IRUGO | S_IWUSR,2815static DEVICE_ATTR(fwfault_debug, S_IRUGO | S_IWUSR,
@@ -2958,8 +2889,8 @@ _ctl_BRM_status_show(struct device *cdev, struct device_attribute *attr, · 73 unmodified lines
2958 ssize_t rc = 0;2889 ssize_t rc = 0;
2959 2890
2960 if (!ioc->is_warpdrive) {2891 if (!ioc->is_warpdrive) {
2961 pr_err(MPT3SAS_FMT "%s: BRM attribute is only for"2892 ioc_err(ioc, "%s: BRM attribute is only for warpdrive\n",
2962 " warpdrive\n", ioc->name, __func__);2893 __func__);
2963 goto out;2894 goto out;
2964 }2895 }
2965 /* pci_access_mutex lock acquired by sysfs show path */2896 /* pci_access_mutex lock acquired by sysfs show path */
@@ -2973,30 +2904,28 @@ _ctl_BRM_status_show(struct device *cdev, struct device_attribute *attr, · 7 unmodified lines
2973 sz = offsetof(Mpi2IOUnitPage3_t, GPIOVal) + (sizeof(u16) * 36);2904 sz = offsetof(Mpi2IOUnitPage3_t, GPIOVal) + (sizeof(u16) * 36);
2974 io_unit_pg3 = kzalloc(sz, GFP_KERNEL);2905 io_unit_pg3 = kzalloc(sz, GFP_KERNEL);
2975 if (!io_unit_pg3) {2906 if (!io_unit_pg3) {
2976 pr_err(MPT3SAS_FMT "%s: failed allocating memory "2907 ioc_err(ioc, "%s: failed allocating memory for iounit_pg3: (%d) bytes\n",
2977 "for iounit_pg3: (%d) bytes\n", ioc->name, __func__, sz);2908 __func__, sz);
2978 goto out;2909 goto out;
2979 }2910 }
2980 2911
2981 if (mpt3sas_config_get_iounit_pg3(ioc, &mpi_reply, io_unit_pg3, sz) !=2912 if (mpt3sas_config_get_iounit_pg3(ioc, &mpi_reply, io_unit_pg3, sz) !=
2982 0) {2913 0) {
2983 pr_err(MPT3SAS_FMT2914 ioc_err(ioc, "%s: failed reading iounit_pg3\n",
2984 "%s: failed reading iounit_pg3\n", ioc->name,2915 __func__);
2985 __func__);
2986 goto out;2916 goto out;
2987 }2917 }
2988 2918
2989 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK;2919 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK;
2990 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {2920 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
2991 pr_err(MPT3SAS_FMT "%s: iounit_pg3 failed with "2921 ioc_err(ioc, "%s: iounit_pg3 failed with ioc_status(0x%04x)\n",
2992 "ioc_status(0x%04x)\n", ioc->name, __func__, ioc_status);2922 __func__, ioc_status);
2993 goto out;2923 goto out;
2994 }2924 }
2995 2925
2996 if (io_unit_pg3->GPIOCount < 25) {2926 if (io_unit_pg3->GPIOCount < 25) {
2997 pr_err(MPT3SAS_FMT "%s: iounit_pg3->GPIOCount less than "2927 ioc_err(ioc, "%s: iounit_pg3->GPIOCount less than 25 entries, detected (%d) entries\n",
2998 "25 entries, detected (%d) entries\n", ioc->name, __func__,2928 __func__, io_unit_pg3->GPIOCount);
2999 io_unit_pg3->GPIOCount);
3000 goto out;2929 goto out;
3001 }2930 }
3002 2931
@@ -3039,17 +2968,15 @@ _ctl_host_trace_buffer_size_show(struct device *cdev, · 36 unmodified lines
3039 struct DIAG_BUFFER_START *request_data;2968 struct DIAG_BUFFER_START *request_data;
3040 2969
3041 if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) {2970 if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) {
3042 pr_err(MPT3SAS_FMT2971 ioc_err(ioc, "%s: host_trace_buffer is not registered\n",
3043 "%s: host_trace_buffer is not registered\n",2972 __func__);
3044 ioc->name, __func__);
3045 return 0;2973 return 0;
3046 }2974 }
3047 2975
3048 if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &2976 if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
3049 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {2977 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
3050 pr_err(MPT3SAS_FMT2978 ioc_err(ioc, "%s: host_trace_buffer is not registered\n",
3051 "%s: host_trace_buffer is not registered\n",2979 __func__);
3052 ioc->name, __func__);
3053 return 0;2980 return 0;
3054 }2981 }
3055 2982
@@ -3089,17 +3016,15 @@ _ctl_host_trace_buffer_show(struct device *cdev, struct device_attribute *attr, · 33 unmodified lines
3089 u32 size;3016 u32 size;
3090 3017
3091 if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) {3018 if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) {
3092 pr_err(MPT3SAS_FMT3019 ioc_err(ioc, "%s: host_trace_buffer is not registered\n",
3093 "%s: host_trace_buffer is not registered\n",3020 __func__);
3094 ioc->name, __func__);
3095 return 0;3021 return 0;
3096 }3022 }
3097 3023
3098 if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &3024 if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
3099 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {3025 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
3100 pr_err(MPT3SAS_FMT3026 ioc_err(ioc, "%s: host_trace_buffer is not registered\n",
3101 "%s: host_trace_buffer is not registered\n",3027 __func__);
3102 ioc->name, __func__);
3103 return 0;3028 return 0;
3104 }3029 }
3105 3030
@@ -3188,8 +3113,7 @@ _ctl_host_trace_buffer_enable_store(struct device *cdev, · 82 unmodified lines
3188 MPT3_DIAG_BUFFER_IS_RELEASED) == 0))3113 MPT3_DIAG_BUFFER_IS_RELEASED) == 0))
3189 goto out;3114 goto out;
3190 memset(&diag_register, 0, sizeof(struct mpt3_diag_register));3115 memset(&diag_register, 0, sizeof(struct mpt3_diag_register));
3191 pr_info(MPT3SAS_FMT "posting host trace buffers\n",3116 ioc_info(ioc, "posting host trace buffers\n");
3192 ioc->name);
3193 diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_TRACE;3117 diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_TRACE;
3194 diag_register.requested_buffer_size = (1024 * 1024);3118 diag_register.requested_buffer_size = (1024 * 1024);
3195 diag_register.unique_id = 0x7075900;3119 diag_register.unique_id = 0x7075900;
@@ -3205,8 +3129,7 @@ _ctl_host_trace_buffer_enable_store(struct device *cdev, · 9 unmodified lines
3205 if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &3129 if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
3206 MPT3_DIAG_BUFFER_IS_RELEASED))3130 MPT3_DIAG_BUFFER_IS_RELEASED))
3207 goto out;3131 goto out;
3208 pr_info(MPT3SAS_FMT "releasing host trace buffer\n",3132 ioc_info(ioc, "releasing host trace buffer\n");
3209 ioc->name);
3210 mpt3sas_send_diag_release(ioc, MPI2_DIAG_BUF_TYPE_TRACE,3133 mpt3sas_send_diag_release(ioc, MPI2_DIAG_BUF_TYPE_TRACE,
3211 &issue_reset);3134 &issue_reset);
3212 }3135 }
@@ -3658,8 +3581,10 @@ mpt3sas_ctl_exit(ushort hbas_to_enumerate) · 445 unmodified lines
3658 if ((ioc->diag_buffer_status[i] &3581 if ((ioc->diag_buffer_status[i] &
3659 MPT3_DIAG_BUFFER_IS_RELEASED))3582 MPT3_DIAG_BUFFER_IS_RELEASED))
3660 continue;3583 continue;
3661 pci_free_consistent(ioc->pdev, ioc->diag_buffer_sz[i],3584 dma_free_coherent(&ioc->pdev->dev,
3662 ioc->diag_buffer[i], ioc->diag_buffer_dma[i]);3585 ioc->diag_buffer_sz[i],
3586 ioc->diag_buffer[i],
3587 ioc->diag_buffer_dma[i]);
3663 ioc->diag_buffer[i] = NULL;3588 ioc->diag_buffer[i] = NULL;
3664 ioc->diag_buffer_status[i] = 0;3589 ioc->diag_buffer_status[i] = 0;
3665 }3590 }
drivers/scsi/mpt3sas/mpt3sas_scsih.c+652−835
@@ -418,8 +418,8 @@ _scsih_get_sas_address(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 417 unmodified lines
418 418
419 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,419 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
420 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {420 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
421 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name,421 ioc_err(ioc, "failure at %s:%d/%s()!\n",
422 __FILE__, __LINE__, __func__);422 __FILE__, __LINE__, __func__);
423 return -ENXIO;423 return -ENXIO;
424 }424 }
425 425
@@ -442,10 +442,8 @@ _scsih_get_sas_address(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 16 unmodified lines
442 return -ENXIO;442 return -ENXIO;
443 443
444 /* else error case */444 /* else error case */
445 pr_err(MPT3SAS_FMT445 ioc_err(ioc, "handle(0x%04x), ioc_status(0x%04x), failure at %s:%d/%s()!\n",
446 "handle(0x%04x), ioc_status(0x%04x), failure at %s:%d/%s()!\n",446 handle, ioc_status, __FILE__, __LINE__, __func__);
447 ioc->name, handle, ioc_status,
448 __FILE__, __LINE__, __func__);
449 return -EIO;447 return -EIO;
450}448}
451 449
@@ -508,10 +506,9 @@ _scsih_determine_boot_device(struct MPT3SAS_ADAPTER *ioc, void *device, · 56 unmodified lines
508 (ioc->bios_pg2.ReqBootDeviceForm &506 (ioc->bios_pg2.ReqBootDeviceForm &
509 MPI2_BIOSPAGE2_FORM_MASK),507 MPI2_BIOSPAGE2_FORM_MASK),
510 &ioc->bios_pg2.RequestedBootDevice)) {508 &ioc->bios_pg2.RequestedBootDevice)) {
511 dinitprintk(ioc, pr_info(MPT3SAS_FMT509 dinitprintk(ioc,
512 "%s: req_boot_device(0x%016llx)\n",510 ioc_info(ioc, "%s: req_boot_device(0x%016llx)\n",
513 ioc->name, __func__,511 __func__, (u64)sas_address));
514 (unsigned long long)sas_address));
515 ioc->req_boot_device.device = device;512 ioc->req_boot_device.device = device;
516 ioc->req_boot_device.channel = channel;513 ioc->req_boot_device.channel = channel;
517 }514 }
@@ -523,10 +520,9 @@ _scsih_determine_boot_device(struct MPT3SAS_ADAPTER *ioc, void *device, · 5 unmodified lines
523 (ioc->bios_pg2.ReqAltBootDeviceForm &520 (ioc->bios_pg2.ReqAltBootDeviceForm &
524 MPI2_BIOSPAGE2_FORM_MASK),521 MPI2_BIOSPAGE2_FORM_MASK),
525 &ioc->bios_pg2.RequestedAltBootDevice)) {522 &ioc->bios_pg2.RequestedAltBootDevice)) {
526 dinitprintk(ioc, pr_info(MPT3SAS_FMT523 dinitprintk(ioc,
527 "%s: req_alt_boot_device(0x%016llx)\n",524 ioc_info(ioc, "%s: req_alt_boot_device(0x%016llx)\n",
528 ioc->name, __func__,525 __func__, (u64)sas_address));
529 (unsigned long long)sas_address));
530 ioc->req_alt_boot_device.device = device;526 ioc->req_alt_boot_device.device = device;
531 ioc->req_alt_boot_device.channel = channel;527 ioc->req_alt_boot_device.channel = channel;
532 }528 }
@@ -538,10 +534,9 @@ _scsih_determine_boot_device(struct MPT3SAS_ADAPTER *ioc, void *device, · 5 unmodified lines
538 (ioc->bios_pg2.CurrentBootDeviceForm &534 (ioc->bios_pg2.CurrentBootDeviceForm &
539 MPI2_BIOSPAGE2_FORM_MASK),535 MPI2_BIOSPAGE2_FORM_MASK),
540 &ioc->bios_pg2.CurrentBootDevice)) {536 &ioc->bios_pg2.CurrentBootDevice)) {
541 dinitprintk(ioc, pr_info(MPT3SAS_FMT537 dinitprintk(ioc,
542 "%s: current_boot_device(0x%016llx)\n",538 ioc_info(ioc, "%s: current_boot_device(0x%016llx)\n",
543 ioc->name, __func__,539 __func__, (u64)sas_address));
544 (unsigned long long)sas_address));
545 ioc->current_boot_device.device = device;540 ioc->current_boot_device.device = device;
546 ioc->current_boot_device.channel = channel;541 ioc->current_boot_device.channel = channel;
547 }542 }
@@ -752,19 +747,16 @@ _scsih_display_enclosure_chassis_info(struct MPT3SAS_ADAPTER *ioc, · 204 unmodified lines
752 sas_device->chassis_slot);747 sas_device->chassis_slot);
753 } else {748 } else {
754 if (sas_device->enclosure_handle != 0)749 if (sas_device->enclosure_handle != 0)
755 pr_info(MPT3SAS_FMT750 ioc_info(ioc, "enclosure logical id(0x%016llx), slot(%d)\n",
756 "enclosure logical id(0x%016llx), slot(%d) \n",751 (u64)sas_device->enclosure_logical_id,
757 ioc->name, (unsigned long long)752 sas_device->slot);
758 sas_device->enclosure_logical_id,
759 sas_device->slot);
760 if (sas_device->connector_name[0] != '\0')753 if (sas_device->connector_name[0] != '\0')
761 pr_info(MPT3SAS_FMT754 ioc_info(ioc, "enclosure level(0x%04x), connector name( %s)\n",
762 "enclosure level(0x%04x), connector name( %s)\n",755 sas_device->enclosure_level,
763 ioc->name, sas_device->enclosure_level,756 sas_device->connector_name);
764 sas_device->connector_name);
765 if (sas_device->is_chassis_slot_valid)757 if (sas_device->is_chassis_slot_valid)
766 pr_info(MPT3SAS_FMT "chassis slot(0x%04x)\n",758 ioc_info(ioc, "chassis slot(0x%04x)\n",
767 ioc->name, sas_device->chassis_slot);759 sas_device->chassis_slot);
768 }760 }
769}761}
770 762
@@ -784,10 +776,8 @@ _scsih_sas_device_remove(struct MPT3SAS_ADAPTER *ioc, · 13 unmodified lines
784 776
785 if (!sas_device)777 if (!sas_device)
786 return;778 return;
787 pr_info(MPT3SAS_FMT779 ioc_info(ioc, "removing handle(0x%04x), sas_addr(0x%016llx)\n",
788 "removing handle(0x%04x), sas_addr(0x%016llx)\n",780 sas_device->handle, (u64)sas_device->sas_address);
789 ioc->name, sas_device->handle,
790 (unsigned long long) sas_device->sas_address);
791 781
792 _scsih_display_enclosure_chassis_info(ioc, sas_device, NULL, NULL);782 _scsih_display_enclosure_chassis_info(ioc, sas_device, NULL, NULL);
793 783
@@ -872,10 +862,10 @@ _scsih_sas_device_add(struct MPT3SAS_ADAPTER *ioc, · 78 unmodified lines
872{862{
873 unsigned long flags;863 unsigned long flags;
874 864
875 dewtprintk(ioc, pr_info(MPT3SAS_FMT865 dewtprintk(ioc,
876 "%s: handle(0x%04x), sas_addr(0x%016llx)\n",866 ioc_info(ioc, "%s: handle(0x%04x), sas_addr(0x%016llx)\n",
877 ioc->name, __func__, sas_device->handle,867 __func__, sas_device->handle,
878 (unsigned long long)sas_device->sas_address));868 (u64)sas_device->sas_address));
879 869
880 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,870 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,
881 NULL, NULL));871 NULL, NULL));
@@ -923,10 +913,10 @@ _scsih_sas_device_init_add(struct MPT3SAS_ADAPTER *ioc, · 41 unmodified lines
923{913{
924 unsigned long flags;914 unsigned long flags;
925 915
926 dewtprintk(ioc, pr_info(MPT3SAS_FMT916 dewtprintk(ioc,
927 "%s: handle(0x%04x), sas_addr(0x%016llx)\n", ioc->name,917 ioc_info(ioc, "%s: handle(0x%04x), sas_addr(0x%016llx)\n",
928 __func__, sas_device->handle,918 __func__, sas_device->handle,
929 (unsigned long long)sas_device->sas_address));919 (u64)sas_device->sas_address));
930 920
931 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,921 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,
932 NULL, NULL));922 NULL, NULL));
@@ -1073,21 +1063,16 @@ _scsih_pcie_device_remove(struct MPT3SAS_ADAPTER *ioc, · 140 unmodified lines
1073 1063
1074 if (!pcie_device)1064 if (!pcie_device)
1075 return;1065 return;
1076 pr_info(MPT3SAS_FMT1066 ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n",
1077 "removing handle(0x%04x), wwid(0x%016llx)\n",1067 pcie_device->handle, (u64)pcie_device->wwid);
1078 ioc->name, pcie_device->handle,
1079 (unsigned long long) pcie_device->wwid);
1080 if (pcie_device->enclosure_handle != 0)1068 if (pcie_device->enclosure_handle != 0)
1081 pr_info(MPT3SAS_FMT1069 ioc_info(ioc, "removing enclosure logical id(0x%016llx), slot(%d)\n",
1082 "removing enclosure logical id(0x%016llx), slot(%d)\n",1070 (u64)pcie_device->enclosure_logical_id,
1083 ioc->name,1071 pcie_device->slot);
1084 (unsigned long long)pcie_device->enclosure_logical_id,
1085 pcie_device->slot);
1086 if (pcie_device->connector_name[0] != '\0')1072 if (pcie_device->connector_name[0] != '\0')
1087 pr_info(MPT3SAS_FMT1073 ioc_info(ioc, "removing enclosure level(0x%04x), connector name( %s)\n",
1088 "removing enclosure level(0x%04x), connector name( %s)\n",1074 pcie_device->enclosure_level,
1089 ioc->name, pcie_device->enclosure_level,1075 pcie_device->connector_name);
1090 pcie_device->connector_name);
1091 1076
1092 spin_lock_irqsave(&ioc->pcie_device_lock, flags);1077 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
1093 if (!list_empty(&pcie_device->list)) {1078 if (!list_empty(&pcie_device->list)) {
@@ -1146,20 +1131,21 @@ _scsih_pcie_device_add(struct MPT3SAS_ADAPTER *ioc, · 52 unmodified lines
1146{1131{
1147 unsigned long flags;1132 unsigned long flags;
1148 1133
1149 dewtprintk(ioc, pr_info(MPT3SAS_FMT1134 dewtprintk(ioc,
1150 "%s: handle (0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,1135 ioc_info(ioc, "%s: handle (0x%04x), wwid(0x%016llx)\n",
1151 pcie_device->handle, (unsigned long long)pcie_device->wwid));1136 __func__,
1137 pcie_device->handle, (u64)pcie_device->wwid));
1152 if (pcie_device->enclosure_handle != 0)1138 if (pcie_device->enclosure_handle != 0)
1153 dewtprintk(ioc, pr_info(MPT3SAS_FMT1139 dewtprintk(ioc,
1154 "%s: enclosure logical id(0x%016llx), slot( %d)\n",1140 ioc_info(ioc, "%s: enclosure logical id(0x%016llx), slot( %d)\n",
1155 ioc->name, __func__,1141 __func__,
1156 (unsigned long long)pcie_device->enclosure_logical_id,1142 (u64)pcie_device->enclosure_logical_id,
1157 pcie_device->slot));1143 pcie_device->slot));
1158 if (pcie_device->connector_name[0] != '\0')1144 if (pcie_device->connector_name[0] != '\0')
1159 dewtprintk(ioc, pr_info(MPT3SAS_FMT1145 dewtprintk(ioc,
1160 "%s: enclosure level(0x%04x), connector name( %s)\n",1146 ioc_info(ioc, "%s: enclosure level(0x%04x), connector name( %s)\n",
1161 ioc->name, __func__, pcie_device->enclosure_level,1147 __func__, pcie_device->enclosure_level,
1162 pcie_device->connector_name));1148 pcie_device->connector_name));
1163 1149
1164 spin_lock_irqsave(&ioc->pcie_device_lock, flags);1150 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
1165 pcie_device_get(pcie_device);1151 pcie_device_get(pcie_device);
@@ -1191,20 +1177,21 @@ _scsih_pcie_device_init_add(struct MPT3SAS_ADAPTER *ioc, · 25 unmodified lines
1191{1177{
1192 unsigned long flags;1178 unsigned long flags;
1193 1179
1194 dewtprintk(ioc, pr_info(MPT3SAS_FMT1180 dewtprintk(ioc,
1195 "%s: handle (0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,1181 ioc_info(ioc, "%s: handle (0x%04x), wwid(0x%016llx)\n",
1196 pcie_device->handle, (unsigned long long)pcie_device->wwid));1182 __func__,
1183 pcie_device->handle, (u64)pcie_device->wwid));
1197 if (pcie_device->enclosure_handle != 0)1184 if (pcie_device->enclosure_handle != 0)
1198 dewtprintk(ioc, pr_info(MPT3SAS_FMT1185 dewtprintk(ioc,
1199 "%s: enclosure logical id(0x%016llx), slot( %d)\n",1186 ioc_info(ioc, "%s: enclosure logical id(0x%016llx), slot( %d)\n",
1200 ioc->name, __func__,1187 __func__,
1201 (unsigned long long)pcie_device->enclosure_logical_id,1188 (u64)pcie_device->enclosure_logical_id,
1202 pcie_device->slot));1189 pcie_device->slot));
1203 if (pcie_device->connector_name[0] != '\0')1190 if (pcie_device->connector_name[0] != '\0')
1204 dewtprintk(ioc, pr_info(MPT3SAS_FMT1191 dewtprintk(ioc,
1205 "%s: enclosure level(0x%04x), connector name( %s)\n",1192 ioc_info(ioc, "%s: enclosure level(0x%04x), connector name( %s)\n",
1206 ioc->name, __func__, pcie_device->enclosure_level,1193 __func__, pcie_device->enclosure_level,
1207 pcie_device->connector_name));1194 pcie_device->connector_name));
1208 1195
1209 spin_lock_irqsave(&ioc->pcie_device_lock, flags);1196 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
1210 pcie_device_get(pcie_device);1197 pcie_device_get(pcie_device);
@@ -1304,9 +1291,10 @@ _scsih_raid_device_add(struct MPT3SAS_ADAPTER *ioc, · 93 unmodified lines
1304{1291{
1305 unsigned long flags;1292 unsigned long flags;
1306 1293
1307 dewtprintk(ioc, pr_info(MPT3SAS_FMT1294 dewtprintk(ioc,
1308 "%s: handle(0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,1295 ioc_info(ioc, "%s: handle(0x%04x), wwid(0x%016llx)\n",
1309 raid_device->handle, (unsigned long long)raid_device->wwid));1296 __func__,
1297 raid_device->handle, (u64)raid_device->wwid));
1310 1298
1311 spin_lock_irqsave(&ioc->raid_device_lock, flags);1299 spin_lock_irqsave(&ioc->raid_device_lock, flags);
1312 list_add_tail(&raid_device->list, &ioc->raid_device_list);1300 list_add_tail(&raid_device->list, &ioc->raid_device_list);
@@ -1857,16 +1845,16 @@ _scsih_display_sata_capabilities(struct MPT3SAS_ADAPTER *ioc, · 544 unmodified lines
1857 1845
1858 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,1846 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
1859 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {1847 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
1860 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1848 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1861 ioc->name, __FILE__, __LINE__, __func__);1849 __FILE__, __LINE__, __func__);
1862 return;1850 return;
1863 }1851 }
1864 1852
1865 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &1853 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
1866 MPI2_IOCSTATUS_MASK;1854 MPI2_IOCSTATUS_MASK;
1867 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {1855 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
1868 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1856 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1869 ioc->name, __FILE__, __LINE__, __func__);1857 __FILE__, __LINE__, __func__);
1870 return;1858 return;
1871 }1859 }
1872 1860
@@ -1952,8 +1940,8 @@ scsih_get_resync(struct device *dev) · 79 unmodified lines
1952 if (mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, &vol_pg0,1940 if (mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, &vol_pg0,
1953 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle,1941 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle,
1954 sizeof(Mpi2RaidVolPage0_t))) {1942 sizeof(Mpi2RaidVolPage0_t))) {
1955 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1943 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1956 ioc->name, __FILE__, __LINE__, __func__);1944 __FILE__, __LINE__, __func__);
1957 percent_complete = 0;1945 percent_complete = 0;
1958 goto out;1946 goto out;
1959 }1947 }
@@ -2006,8 +1994,8 @@ scsih_get_state(struct device *dev) · 46 unmodified lines
2006 if (mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, &vol_pg0,1994 if (mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, &vol_pg0,
2007 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle,1995 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle,
2008 sizeof(Mpi2RaidVolPage0_t))) {1996 sizeof(Mpi2RaidVolPage0_t))) {
2009 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1997 ioc_err(ioc, "failure at %s:%d/%s()!\n",
2010 ioc->name, __FILE__, __LINE__, __func__);1998 __FILE__, __LINE__, __func__);
2011 goto out;1999 goto out;
2012 }2000 }
2013 2001
@@ -2103,9 +2091,9 @@ _scsih_get_volume_capabilities(struct MPT3SAS_ADAPTER *ioc, · 89 unmodified lines
2103 2091
2104 if ((mpt3sas_config_get_number_pds(ioc, raid_device->handle,2092 if ((mpt3sas_config_get_number_pds(ioc, raid_device->handle,
2105 &num_pds)) || !num_pds) {2093 &num_pds)) || !num_pds) {
2106 dfailprintk(ioc, pr_warn(MPT3SAS_FMT2094 dfailprintk(ioc,
2107 "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__,2095 ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2108 __func__));2096 __FILE__, __LINE__, __func__));
2109 return 1;2097 return 1;
2110 }2098 }
2111 2099
@@ -2114,17 +2102,17 @@ _scsih_get_volume_capabilities(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines
2114 sizeof(Mpi2RaidVol0PhysDisk_t));2102 sizeof(Mpi2RaidVol0PhysDisk_t));
2115 vol_pg0 = kzalloc(sz, GFP_KERNEL);2103 vol_pg0 = kzalloc(sz, GFP_KERNEL);
2116 if (!vol_pg0) {2104 if (!vol_pg0) {
2117 dfailprintk(ioc, pr_warn(MPT3SAS_FMT2105 dfailprintk(ioc,
2118 "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__,2106 ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2119 __func__));2107 __FILE__, __LINE__, __func__));
2120 return 1;2108 return 1;
2121 }2109 }
2122 2110
2123 if ((mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, vol_pg0,2111 if ((mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, vol_pg0,
2124 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, raid_device->handle, sz))) {2112 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, raid_device->handle, sz))) {
2125 dfailprintk(ioc, pr_warn(MPT3SAS_FMT2113 dfailprintk(ioc,
2126 "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__,2114 ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2127 __func__));2115 __FILE__, __LINE__, __func__));
2128 kfree(vol_pg0);2116 kfree(vol_pg0);
2129 return 1;2117 return 1;
2130 }2118 }
@@ -2215,16 +2203,16 @@ scsih_slave_configure(struct scsi_device *sdev) · 84 unmodified lines
2215 raid_device = mpt3sas_raid_device_find_by_handle(ioc, handle);2203 raid_device = mpt3sas_raid_device_find_by_handle(ioc, handle);
2216 spin_unlock_irqrestore(&ioc->raid_device_lock, flags);2204 spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
2217 if (!raid_device) {2205 if (!raid_device) {
2218 dfailprintk(ioc, pr_warn(MPT3SAS_FMT2206 dfailprintk(ioc,
2219 "failure at %s:%d/%s()!\n", ioc->name, __FILE__,2207 ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2220 __LINE__, __func__));2208 __FILE__, __LINE__, __func__));
2221 return 1;2209 return 1;
2222 }2210 }
2223 2211
2224 if (_scsih_get_volume_capabilities(ioc, raid_device)) {2212 if (_scsih_get_volume_capabilities(ioc, raid_device)) {
2225 dfailprintk(ioc, pr_warn(MPT3SAS_FMT2213 dfailprintk(ioc,
2226 "failure at %s:%d/%s()!\n", ioc->name, __FILE__,2214 ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2227 __LINE__, __func__));2215 __FILE__, __LINE__, __func__));
2228 return 1;2216 return 1;
2229 }2217 }
2230 2218
@@ -2308,16 +2296,16 @@ scsih_slave_configure(struct scsi_device *sdev) · 77 unmodified lines
2308 if (sas_target_priv_data->flags & MPT_TARGET_FLAGS_RAID_COMPONENT) {2296 if (sas_target_priv_data->flags & MPT_TARGET_FLAGS_RAID_COMPONENT) {
2309 if (mpt3sas_config_get_volume_handle(ioc, handle,2297 if (mpt3sas_config_get_volume_handle(ioc, handle,
2310 &volume_handle)) {2298 &volume_handle)) {
2311 dfailprintk(ioc, pr_warn(MPT3SAS_FMT2299 dfailprintk(ioc,
2312 "failure at %s:%d/%s()!\n", ioc->name,2300 ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2313 __FILE__, __LINE__, __func__));2301 __FILE__, __LINE__, __func__));
2314 return 1;2302 return 1;
2315 }2303 }
2316 if (volume_handle && mpt3sas_config_get_volume_wwid(ioc,2304 if (volume_handle && mpt3sas_config_get_volume_wwid(ioc,
2317 volume_handle, &volume_wwid)) {2305 volume_handle, &volume_wwid)) {
2318 dfailprintk(ioc, pr_warn(MPT3SAS_FMT2306 dfailprintk(ioc,
2319 "failure at %s:%d/%s()!\n", ioc->name,2307 ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2320 __FILE__, __LINE__, __func__));2308 __FILE__, __LINE__, __func__));
2321 return 1;2309 return 1;
2322 }2310 }
2323 }2311 }
@@ -2329,9 +2317,9 @@ scsih_slave_configure(struct scsi_device *sdev) · 5 unmodified lines
2329 sas_device_priv_data->sas_target->sas_address);2317 sas_device_priv_data->sas_target->sas_address);
2330 if (!pcie_device) {2318 if (!pcie_device) {
2331 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);2319 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
2332 dfailprintk(ioc, pr_warn(MPT3SAS_FMT2320 dfailprintk(ioc,
2333 "failure at %s:%d/%s()!\n", ioc->name, __FILE__,2321 ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2334 __LINE__, __func__));2322 __FILE__, __LINE__, __func__));
2335 return 1;2323 return 1;
2336 }2324 }
2337 2325
@@ -2377,9 +2365,9 @@ scsih_slave_configure(struct scsi_device *sdev) · 39 unmodified lines
2377 sas_device_priv_data->sas_target->sas_address);2365 sas_device_priv_data->sas_target->sas_address);
2378 if (!sas_device) {2366 if (!sas_device) {
2379 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);2367 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
2380 dfailprintk(ioc, pr_warn(MPT3SAS_FMT2368 dfailprintk(ioc,
2381 "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__,2369 ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2382 __func__));2370 __FILE__, __LINE__, __func__));
2383 return 1;2371 return 1;
2384 }2372 }
2385 2373
@@ -2515,8 +2503,7 @@ _scsih_response_code(struct MPT3SAS_ADAPTER *ioc, u8 response_code) · 129 unmodified lines
2515 desc = "unknown";2503 desc = "unknown";
2516 break;2504 break;
2517 }2505 }
2518 pr_warn(MPT3SAS_FMT "response_code(0x%01x): %s\n",2506 ioc_warn(ioc, "response_code(0x%01x): %s\n", response_code, desc);
2519 ioc->name, response_code, desc);
2520}2507}
2521 2508
2522/**2509/**
@@ -2640,22 +2627,19 @@ mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, u64 lun, · 117 unmodified lines
2640 lockdep_assert_held(&ioc->tm_cmds.mutex);2627 lockdep_assert_held(&ioc->tm_cmds.mutex);
2641 2628
2642 if (ioc->tm_cmds.status != MPT3_CMD_NOT_USED) {2629 if (ioc->tm_cmds.status != MPT3_CMD_NOT_USED) {
2643 pr_info(MPT3SAS_FMT "%s: tm_cmd busy!!!\n",2630 ioc_info(ioc, "%s: tm_cmd busy!!!\n", __func__);
2644 __func__, ioc->name);
2645 return FAILED;2631 return FAILED;
2646 }2632 }
2647 2633
2648 if (ioc->shost_recovery || ioc->remove_host ||2634 if (ioc->shost_recovery || ioc->remove_host ||
2649 ioc->pci_error_recovery) {2635 ioc->pci_error_recovery) {
2650 pr_info(MPT3SAS_FMT "%s: host reset in progress!\n",2636 ioc_info(ioc, "%s: host reset in progress!\n", __func__);
2651 __func__, ioc->name);
2652 return FAILED;2637 return FAILED;
2653 }2638 }
2654 2639
2655 ioc_state = mpt3sas_base_get_iocstate(ioc, 0);2640 ioc_state = mpt3sas_base_get_iocstate(ioc, 0);
2656 if (ioc_state & MPI2_DOORBELL_USED) {2641 if (ioc_state & MPI2_DOORBELL_USED) {
2657 dhsprintk(ioc, pr_info(MPT3SAS_FMT2642 dhsprintk(ioc, ioc_info(ioc, "unexpected doorbell active!\n"));
2658 "unexpected doorbell active!\n", ioc->name));
2659 rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);2643 rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
2660 return (!rc) ? SUCCESS : FAILED;2644 return (!rc) ? SUCCESS : FAILED;
2661 }2645 }
@@ -2669,14 +2653,13 @@ mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, u64 lun, · 7 unmodified lines
2669 2653
2670 smid = mpt3sas_base_get_smid_hpr(ioc, ioc->tm_cb_idx);2654 smid = mpt3sas_base_get_smid_hpr(ioc, ioc->tm_cb_idx);
2671 if (!smid) {2655 if (!smid) {
2672 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",2656 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
2673 ioc->name, __func__);
2674 return FAILED;2657 return FAILED;
2675 }2658 }
2676 2659
2677 dtmprintk(ioc, pr_info(MPT3SAS_FMT2660 dtmprintk(ioc,
2678 "sending tm: handle(0x%04x), task_type(0x%02x), smid(%d), timeout(%d), tr_method(0x%x)\n",2661 ioc_info(ioc, "sending tm: handle(0x%04x), task_type(0x%02x), smid(%d), timeout(%d), tr_method(0x%x)\n",
2679 ioc->name, handle, type, smid_task, timeout, tr_method));2662 handle, type, smid_task, timeout, tr_method));
2680 ioc->tm_cmds.status = MPT3_CMD_PENDING;2663 ioc->tm_cmds.status = MPT3_CMD_PENDING;
2681 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);2664 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
2682 ioc->tm_cmds.smid = smid;2665 ioc->tm_cmds.smid = smid;
@@ -2709,11 +2692,11 @@ mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, u64 lun, · 26 unmodified lines
2709 if (ioc->tm_cmds.status & MPT3_CMD_REPLY_VALID) {2692 if (ioc->tm_cmds.status & MPT3_CMD_REPLY_VALID) {
2710 mpt3sas_trigger_master(ioc, MASTER_TRIGGER_TASK_MANAGMENT);2693 mpt3sas_trigger_master(ioc, MASTER_TRIGGER_TASK_MANAGMENT);
2711 mpi_reply = ioc->tm_cmds.reply;2694 mpi_reply = ioc->tm_cmds.reply;
2712 dtmprintk(ioc, pr_info(MPT3SAS_FMT "complete tm: " \2695 dtmprintk(ioc,
2713 "ioc_status(0x%04x), loginfo(0x%08x), term_count(0x%08x)\n",2696 ioc_info(ioc, "complete tm: ioc_status(0x%04x), loginfo(0x%08x), term_count(0x%08x)\n",
2714 ioc->name, le16_to_cpu(mpi_reply->IOCStatus),2697 le16_to_cpu(mpi_reply->IOCStatus),
2715 le32_to_cpu(mpi_reply->IOCLogInfo),2698 le32_to_cpu(mpi_reply->IOCLogInfo),
2716 le32_to_cpu(mpi_reply->TerminationCount)));2699 le32_to_cpu(mpi_reply->TerminationCount)));
2717 if (ioc->logging_level & MPT_DEBUG_TM) {2700 if (ioc->logging_level & MPT_DEBUG_TM) {
2718 _scsih_response_code(ioc, mpi_reply->ResponseCode);2701 _scsih_response_code(ioc, mpi_reply->ResponseCode);
2719 if (mpi_reply->IOCStatus)2702 if (mpi_reply->IOCStatus)
@@ -3060,13 +3043,11 @@ scsih_host_reset(struct scsi_cmnd *scmd) · 340 unmodified lines
3060 struct MPT3SAS_ADAPTER *ioc = shost_priv(scmd->device->host);3043 struct MPT3SAS_ADAPTER *ioc = shost_priv(scmd->device->host);
3061 int r, retval;3044 int r, retval;
3062 3045
3063 pr_info(MPT3SAS_FMT "attempting host reset! scmd(%p)\n",3046 ioc_info(ioc, "attempting host reset! scmd(%p)\n", scmd);
3064 ioc->name, scmd);
3065 scsi_print_command(scmd);3047 scsi_print_command(scmd);
3066 3048
3067 if (ioc->is_driver_loading || ioc->remove_host) {3049 if (ioc->is_driver_loading || ioc->remove_host) {
3068 pr_info(MPT3SAS_FMT "Blocking the host reset\n",3050 ioc_info(ioc, "Blocking the host reset\n");
3069 ioc->name);
3070 r = FAILED;3051 r = FAILED;
3071 goto out;3052 goto out;
3072 }3053 }
@@ -3074,8 +3055,8 @@ scsih_host_reset(struct scsi_cmnd *scmd) · 1 unmodified line
3074 retval = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);3055 retval = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
3075 r = (retval < 0) ? FAILED : SUCCESS;3056 r = (retval < 0) ? FAILED : SUCCESS;
3076out:3057out:
3077 pr_info(MPT3SAS_FMT "host reset: %s scmd(%p)\n",3058 ioc_info(ioc, "host reset: %s scmd(%p)\n",
3078 ioc->name, ((r == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);3059 r == SUCCESS ? "SUCCESS" : "FAILED", scmd);
3079 3060
3080 return r;3061 return r;
3081}3062}
@@ -3567,18 +3548,16 @@ _scsih_tm_tr_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 485 unmodified lines
3567 u8 tr_method = 0;3548 u8 tr_method = 0;
3568 3549
3569 if (ioc->pci_error_recovery) {3550 if (ioc->pci_error_recovery) {
3570 dewtprintk(ioc, pr_info(MPT3SAS_FMT3551 dewtprintk(ioc,
3571 "%s: host in pci error recovery: handle(0x%04x)\n",3552 ioc_info(ioc, "%s: host in pci error recovery: handle(0x%04x)\n",
3572 __func__, ioc->name,3553 __func__, handle));
3573 handle));
3574 return;3554 return;
3575 }3555 }
3576 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);3556 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
3577 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {3557 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
3578 dewtprintk(ioc, pr_info(MPT3SAS_FMT3558 dewtprintk(ioc,
3579 "%s: host is not operational: handle(0x%04x)\n",3559 ioc_info(ioc, "%s: host is not operational: handle(0x%04x)\n",
3580 __func__, ioc->name,3560 __func__, handle));
3581 handle));
3582 return;3561 return;
3583 }3562 }
3584 3563
@@ -3614,39 +3593,31 @@ _scsih_tm_tr_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 29 unmodified lines
3614 tr_method = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET;3593 tr_method = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET;
3615 }3594 }
3616 if (sas_target_priv_data) {3595 if (sas_target_priv_data) {
3617 dewtprintk(ioc, pr_info(MPT3SAS_FMT3596 dewtprintk(ioc,
3618 "setting delete flag: handle(0x%04x), sas_addr(0x%016llx)\n",3597 ioc_info(ioc, "setting delete flag: handle(0x%04x), sas_addr(0x%016llx)\n",
3619 ioc->name, handle,3598 handle, (u64)sas_address));
3620 (unsigned long long)sas_address));
3621 if (sas_device) {3599 if (sas_device) {
3622 if (sas_device->enclosure_handle != 0)3600 if (sas_device->enclosure_handle != 0)
3623 dewtprintk(ioc, pr_info(MPT3SAS_FMT3601 dewtprintk(ioc,
3624 "setting delete flag:enclosure logical "3602 ioc_info(ioc, "setting delete flag:enclosure logical id(0x%016llx), slot(%d)\n",
3625 "id(0x%016llx), slot(%d)\n", ioc->name,3603 (u64)sas_device->enclosure_logical_id,
3626 (unsigned long long)3604 sas_device->slot));
3627 sas_device->enclosure_logical_id,
3628 sas_device->slot));
3629 if (sas_device->connector_name[0] != '\0')3605 if (sas_device->connector_name[0] != '\0')
3630 dewtprintk(ioc, pr_info(MPT3SAS_FMT3606 dewtprintk(ioc,
3631 "setting delete flag: enclosure "3607 ioc_info(ioc, "setting delete flag: enclosure level(0x%04x), connector name( %s)\n",
3632 "level(0x%04x), connector name( %s)\n",3608 sas_device->enclosure_level,
3633 ioc->name, sas_device->enclosure_level,3609 sas_device->connector_name));
3634 sas_device->connector_name));
3635 } else if (pcie_device) {3610 } else if (pcie_device) {
3636 if (pcie_device->enclosure_handle != 0)3611 if (pcie_device->enclosure_handle != 0)
3637 dewtprintk(ioc, pr_info(MPT3SAS_FMT3612 dewtprintk(ioc,
3638 "setting delete flag: logical "3613 ioc_info(ioc, "setting delete flag: logical id(0x%016llx), slot(%d)\n",
3639 "id(0x%016llx), slot(%d)\n", ioc->name,3614 (u64)pcie_device->enclosure_logical_id,
3640 (unsigned long long)3615 pcie_device->slot));
3641 pcie_device->enclosure_logical_id,
3642 pcie_device->slot));
3643 if (pcie_device->connector_name[0] != '\0')3616 if (pcie_device->connector_name[0] != '\0')
3644 dewtprintk(ioc, pr_info(MPT3SAS_FMT3617 dewtprintk(ioc,
3645 "setting delete flag:, enclosure "3618 ioc_info(ioc, "setting delete flag:, enclosure level(0x%04x), connector name( %s)\n",
3646 "level(0x%04x), "3619 pcie_device->enclosure_level,
3647 "connector name( %s)\n", ioc->name,3620 pcie_device->connector_name));
3648 pcie_device->enclosure_level,
3649 pcie_device->connector_name));
3650 }3621 }
3651 _scsih_ublock_io_device(ioc, sas_address);3622 _scsih_ublock_io_device(ioc, sas_address);
3652 sas_target_priv_data->handle = MPT3SAS_INVALID_DEVICE_HANDLE;3623 sas_target_priv_data->handle = MPT3SAS_INVALID_DEVICE_HANDLE;
@@ -3660,16 +3631,15 @@ _scsih_tm_tr_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 7 unmodified lines
3660 INIT_LIST_HEAD(&delayed_tr->list);3631 INIT_LIST_HEAD(&delayed_tr->list);
3661 delayed_tr->handle = handle;3632 delayed_tr->handle = handle;
3662 list_add_tail(&delayed_tr->list, &ioc->delayed_tr_list);3633 list_add_tail(&delayed_tr->list, &ioc->delayed_tr_list);
3663 dewtprintk(ioc, pr_info(MPT3SAS_FMT3634 dewtprintk(ioc,
3664 "DELAYED:tr:handle(0x%04x), (open)\n",3635 ioc_info(ioc, "DELAYED:tr:handle(0x%04x), (open)\n",
3665 ioc->name, handle));3636 handle));
3666 goto out;3637 goto out;
3667 }3638 }
3668 3639
3669 dewtprintk(ioc, pr_info(MPT3SAS_FMT3640 dewtprintk(ioc,
3670 "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",3641 ioc_info(ioc, "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3671 ioc->name, handle, smid,3642 handle, smid, ioc->tm_tr_cb_idx));
3672 ioc->tm_tr_cb_idx));
3673 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);3643 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
3674 memset(mpi_request, 0, sizeof(Mpi2SCSITaskManagementRequest_t));3644 memset(mpi_request, 0, sizeof(Mpi2SCSITaskManagementRequest_t));
3675 mpi_request->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;3645 mpi_request->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;
@@ -3717,39 +3687,39 @@ _scsih_tm_tr_complete(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, · 41 unmodified lines
3717 struct _sc_list *delayed_sc;3687 struct _sc_list *delayed_sc;
3718 3688
3719 if (ioc->pci_error_recovery) {3689 if (ioc->pci_error_recovery) {
3720 dewtprintk(ioc, pr_info(MPT3SAS_FMT3690 dewtprintk(ioc,
3721 "%s: host in pci error recovery\n", __func__,3691 ioc_info(ioc, "%s: host in pci error recovery\n",
3722 ioc->name));3692 __func__));
3723 return 1;3693 return 1;
3724 }3694 }
3725 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);3695 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
3726 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {3696 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
3727 dewtprintk(ioc, pr_info(MPT3SAS_FMT3697 dewtprintk(ioc,
3728 "%s: host is not operational\n", __func__, ioc->name));3698 ioc_info(ioc, "%s: host is not operational\n",
3699 __func__));
3729 return 1;3700 return 1;
3730 }3701 }
3731 if (unlikely(!mpi_reply)) {3702 if (unlikely(!mpi_reply)) {
3732 pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",3703 ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
3733 ioc->name, __FILE__, __LINE__, __func__);3704 __FILE__, __LINE__, __func__);
3734 return 1;3705 return 1;
3735 }3706 }
3736 mpi_request_tm = mpt3sas_base_get_msg_frame(ioc, smid);3707 mpi_request_tm = mpt3sas_base_get_msg_frame(ioc, smid);
3737 handle = le16_to_cpu(mpi_request_tm->DevHandle);3708 handle = le16_to_cpu(mpi_request_tm->DevHandle);
3738 if (handle != le16_to_cpu(mpi_reply->DevHandle)) {3709 if (handle != le16_to_cpu(mpi_reply->DevHandle)) {
3739 dewtprintk(ioc, pr_err(MPT3SAS_FMT3710 dewtprintk(ioc,
3740 "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n",3711 ioc_err(ioc, "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n",
3741 ioc->name, handle,3712 handle,
3742 le16_to_cpu(mpi_reply->DevHandle), smid));3713 le16_to_cpu(mpi_reply->DevHandle), smid));
3743 return 0;3714 return 0;
3744 }3715 }
3745 3716
3746 mpt3sas_trigger_master(ioc, MASTER_TRIGGER_TASK_MANAGMENT);3717 mpt3sas_trigger_master(ioc, MASTER_TRIGGER_TASK_MANAGMENT);
3747 dewtprintk(ioc, pr_info(MPT3SAS_FMT3718 dewtprintk(ioc,
3748 "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), "3719 ioc_info(ioc, "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), loginfo(0x%08x), completed(%d)\n",
3749 "loginfo(0x%08x), completed(%d)\n", ioc->name,3720 handle, smid, le16_to_cpu(mpi_reply->IOCStatus),
3750 handle, smid, le16_to_cpu(mpi_reply->IOCStatus),3721 le32_to_cpu(mpi_reply->IOCLogInfo),
3751 le32_to_cpu(mpi_reply->IOCLogInfo),3722 le32_to_cpu(mpi_reply->TerminationCount)));
3752 le32_to_cpu(mpi_reply->TerminationCount)));
3753 3723
3754 smid_sas_ctrl = mpt3sas_base_get_smid(ioc, ioc->tm_sas_control_cb_idx);3724 smid_sas_ctrl = mpt3sas_base_get_smid(ioc, ioc->tm_sas_control_cb_idx);
3755 if (!smid_sas_ctrl) {3725 if (!smid_sas_ctrl) {
@@ -3759,16 +3729,15 @@ _scsih_tm_tr_complete(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, · 3 unmodified lines
3759 INIT_LIST_HEAD(&delayed_sc->list);3729 INIT_LIST_HEAD(&delayed_sc->list);
3760 delayed_sc->handle = le16_to_cpu(mpi_request_tm->DevHandle);3730 delayed_sc->handle = le16_to_cpu(mpi_request_tm->DevHandle);
3761 list_add_tail(&delayed_sc->list, &ioc->delayed_sc_list);3731 list_add_tail(&delayed_sc->list, &ioc->delayed_sc_list);
3762 dewtprintk(ioc, pr_info(MPT3SAS_FMT3732 dewtprintk(ioc,
3763 "DELAYED:sc:handle(0x%04x), (open)\n",3733 ioc_info(ioc, "DELAYED:sc:handle(0x%04x), (open)\n",
3764 ioc->name, handle));3734 handle));
3765 return _scsih_check_for_pending_tm(ioc, smid);3735 return _scsih_check_for_pending_tm(ioc, smid);
3766 }3736 }
3767 3737
3768 dewtprintk(ioc, pr_info(MPT3SAS_FMT3738 dewtprintk(ioc,
3769 "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",3739 ioc_info(ioc, "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3770 ioc->name, handle, smid_sas_ctrl,3740 handle, smid_sas_ctrl, ioc->tm_sas_control_cb_idx));
3771 ioc->tm_sas_control_cb_idx));
3772 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid_sas_ctrl);3741 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid_sas_ctrl);
3773 memset(mpi_request, 0, sizeof(Mpi2SasIoUnitControlRequest_t));3742 memset(mpi_request, 0, sizeof(Mpi2SasIoUnitControlRequest_t));
3774 mpi_request->Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL;3743 mpi_request->Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL;
@@ -3803,20 +3772,19 @@ _scsih_sas_control_complete(struct MPT3SAS_ADAPTER *ioc, u16 smid, · 28 unmodified lines
3803 mpt3sas_base_get_reply_virt_addr(ioc, reply);3772 mpt3sas_base_get_reply_virt_addr(ioc, reply);
3804 3773
3805 if (likely(mpi_reply)) {3774 if (likely(mpi_reply)) {
3806 dewtprintk(ioc, pr_info(MPT3SAS_FMT3775 dewtprintk(ioc,
3807 "sc_complete:handle(0x%04x), (open) "3776 ioc_info(ioc, "sc_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), loginfo(0x%08x)\n",
3808 "smid(%d), ioc_status(0x%04x), loginfo(0x%08x)\n",3777 le16_to_cpu(mpi_reply->DevHandle), smid,
3809 ioc->name, le16_to_cpu(mpi_reply->DevHandle), smid,3778 le16_to_cpu(mpi_reply->IOCStatus),
3810 le16_to_cpu(mpi_reply->IOCStatus),3779 le32_to_cpu(mpi_reply->IOCLogInfo)));
3811 le32_to_cpu(mpi_reply->IOCLogInfo)));
3812 if (le16_to_cpu(mpi_reply->IOCStatus) ==3780 if (le16_to_cpu(mpi_reply->IOCStatus) ==
3813 MPI2_IOCSTATUS_SUCCESS) {3781 MPI2_IOCSTATUS_SUCCESS) {
3814 clear_bit(le16_to_cpu(mpi_reply->DevHandle),3782 clear_bit(le16_to_cpu(mpi_reply->DevHandle),
3815 ioc->device_remove_in_progress);3783 ioc->device_remove_in_progress);
3816 }3784 }
3817 } else {3785 } else {
3818 pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",3786 ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
3819 ioc->name, __FILE__, __LINE__, __func__);3787 __FILE__, __LINE__, __func__);
3820 }3788 }
3821 return mpt3sas_check_for_pending_internal_cmds(ioc, smid);3789 return mpt3sas_check_for_pending_internal_cmds(ioc, smid);
3822}3790}
@@ -3839,9 +3807,9 @@ _scsih_tm_tr_volume_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 16 unmodified lines
3839 struct _tr_list *delayed_tr;3807 struct _tr_list *delayed_tr;
3840 3808
3841 if (ioc->pci_error_recovery) {3809 if (ioc->pci_error_recovery) {
3842 dewtprintk(ioc, pr_info(MPT3SAS_FMT3810 dewtprintk(ioc,
3843 "%s: host reset in progress!\n",3811 ioc_info(ioc, "%s: host reset in progress!\n",
3844 __func__, ioc->name));3812 __func__));
3845 return;3813 return;
3846 }3814 }
3847 3815
@@ -3853,16 +3821,15 @@ _scsih_tm_tr_volume_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 5 unmodified lines
3853 INIT_LIST_HEAD(&delayed_tr->list);3821 INIT_LIST_HEAD(&delayed_tr->list);
3854 delayed_tr->handle = handle;3822 delayed_tr->handle = handle;
3855 list_add_tail(&delayed_tr->list, &ioc->delayed_tr_volume_list);3823 list_add_tail(&delayed_tr->list, &ioc->delayed_tr_volume_list);
3856 dewtprintk(ioc, pr_info(MPT3SAS_FMT3824 dewtprintk(ioc,
3857 "DELAYED:tr:handle(0x%04x), (open)\n",3825 ioc_info(ioc, "DELAYED:tr:handle(0x%04x), (open)\n",
3858 ioc->name, handle));3826 handle));
3859 return;3827 return;
3860 }3828 }
3861 3829
3862 dewtprintk(ioc, pr_info(MPT3SAS_FMT3830 dewtprintk(ioc,
3863 "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",3831 ioc_info(ioc, "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3864 ioc->name, handle, smid,3832 handle, smid, ioc->tm_tr_volume_cb_idx));
3865 ioc->tm_tr_volume_cb_idx));
3866 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);3833 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
3867 memset(mpi_request, 0, sizeof(Mpi2SCSITaskManagementRequest_t));3834 memset(mpi_request, 0, sizeof(Mpi2SCSITaskManagementRequest_t));
3868 mpi_request->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;3835 mpi_request->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;
@@ -3892,33 +3859,32 @@ _scsih_tm_volume_tr_complete(struct MPT3SAS_ADAPTER *ioc, u16 smid, · 23 unmodified lines
3892 mpt3sas_base_get_reply_virt_addr(ioc, reply);3859 mpt3sas_base_get_reply_virt_addr(ioc, reply);
3893 3860
3894 if (ioc->shost_recovery || ioc->pci_error_recovery) {3861 if (ioc->shost_recovery || ioc->pci_error_recovery) {
3895 dewtprintk(ioc, pr_info(MPT3SAS_FMT3862 dewtprintk(ioc,
3896 "%s: host reset in progress!\n",3863 ioc_info(ioc, "%s: host reset in progress!\n",
3897 __func__, ioc->name));3864 __func__));
3898 return 1;3865 return 1;
3899 }3866 }
3900 if (unlikely(!mpi_reply)) {3867 if (unlikely(!mpi_reply)) {
3901 pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",3868 ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
3902 ioc->name, __FILE__, __LINE__, __func__);3869 __FILE__, __LINE__, __func__);
3903 return 1;3870 return 1;
3904 }3871 }
3905 3872
3906 mpi_request_tm = mpt3sas_base_get_msg_frame(ioc, smid);3873 mpi_request_tm = mpt3sas_base_get_msg_frame(ioc, smid);
3907 handle = le16_to_cpu(mpi_request_tm->DevHandle);3874 handle = le16_to_cpu(mpi_request_tm->DevHandle);
3908 if (handle != le16_to_cpu(mpi_reply->DevHandle)) {3875 if (handle != le16_to_cpu(mpi_reply->DevHandle)) {
3909 dewtprintk(ioc, pr_err(MPT3SAS_FMT3876 dewtprintk(ioc,
3910 "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n",3877 ioc_err(ioc, "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n",
3911 ioc->name, handle,3878 handle, le16_to_cpu(mpi_reply->DevHandle),
3912 le16_to_cpu(mpi_reply->DevHandle), smid));3879 smid));
3913 return 0;3880 return 0;
3914 }3881 }
3915 3882
3916 dewtprintk(ioc, pr_info(MPT3SAS_FMT3883 dewtprintk(ioc,
3917 "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), "3884 ioc_info(ioc, "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), loginfo(0x%08x), completed(%d)\n",
3918 "loginfo(0x%08x), completed(%d)\n", ioc->name,3885 handle, smid, le16_to_cpu(mpi_reply->IOCStatus),
3919 handle, smid, le16_to_cpu(mpi_reply->IOCStatus),3886 le32_to_cpu(mpi_reply->IOCLogInfo),
3920 le32_to_cpu(mpi_reply->IOCLogInfo),3887 le32_to_cpu(mpi_reply->TerminationCount)));
3921 le32_to_cpu(mpi_reply->TerminationCount)));
3922 3888
3923 return _scsih_check_for_pending_tm(ioc, smid);3889 return _scsih_check_for_pending_tm(ioc, smid);
3924}3890}
@@ -3948,10 +3914,9 @@ _scsih_issue_delayed_event_ack(struct MPT3SAS_ADAPTER *ioc, u16 smid, U16 event, · 23 unmodified lines
3948 ioc->internal_lookup[i].cb_idx = ioc->base_cb_idx;3914 ioc->internal_lookup[i].cb_idx = ioc->base_cb_idx;
3949 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);3915 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
3950 3916
3951 dewtprintk(ioc, pr_info(MPT3SAS_FMT3917 dewtprintk(ioc,
3952 "EVENT ACK: event(0x%04x), smid(%d), cb(%d)\n",3918 ioc_info(ioc, "EVENT ACK: event(0x%04x), smid(%d), cb(%d)\n",
3953 ioc->name, le16_to_cpu(event), smid,3919 le16_to_cpu(event), smid, ioc->base_cb_idx));
3954 ioc->base_cb_idx));
3955 ack_request = mpt3sas_base_get_msg_frame(ioc, smid);3920 ack_request = mpt3sas_base_get_msg_frame(ioc, smid);
3956 memset(ack_request, 0, sizeof(Mpi2EventAckRequest_t));3921 memset(ack_request, 0, sizeof(Mpi2EventAckRequest_t));
3957 ack_request->Function = MPI2_FUNCTION_EVENT_ACK;3922 ack_request->Function = MPI2_FUNCTION_EVENT_ACK;
@@ -3981,21 +3946,21 @@ _scsih_issue_delayed_sas_io_unit_ctrl(struct MPT3SAS_ADAPTER *ioc, · 23 unmodified lines
3981 unsigned long flags;3946 unsigned long flags;
3982 3947
3983 if (ioc->remove_host) {3948 if (ioc->remove_host) {
3984 dewtprintk(ioc, pr_info(MPT3SAS_FMT3949 dewtprintk(ioc,
3985 "%s: host has been removed\n",3950 ioc_info(ioc, "%s: host has been removed\n",
3986 __func__, ioc->name));3951 __func__));
3987 return;3952 return;
3988 } else if (ioc->pci_error_recovery) {3953 } else if (ioc->pci_error_recovery) {
3989 dewtprintk(ioc, pr_info(MPT3SAS_FMT3954 dewtprintk(ioc,
3990 "%s: host in pci error recovery\n",3955 ioc_info(ioc, "%s: host in pci error recovery\n",
3991 __func__, ioc->name));3956 __func__));
3992 return;3957 return;
3993 }3958 }
3994 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);3959 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
3995 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {3960 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
3996 dewtprintk(ioc, pr_info(MPT3SAS_FMT3961 dewtprintk(ioc,
3997 "%s: host is not operational\n",3962 ioc_info(ioc, "%s: host is not operational\n",
3998 __func__, ioc->name));3963 __func__));
3999 return;3964 return;
4000 }3965 }
4001 3966
@@ -4007,10 +3972,9 @@ _scsih_issue_delayed_sas_io_unit_ctrl(struct MPT3SAS_ADAPTER *ioc, · 5 unmodified lines
4007 ioc->internal_lookup[i].cb_idx = ioc->tm_sas_control_cb_idx;3972 ioc->internal_lookup[i].cb_idx = ioc->tm_sas_control_cb_idx;
4008 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);3973 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
4009 3974
4010 dewtprintk(ioc, pr_info(MPT3SAS_FMT3975 dewtprintk(ioc,
4011 "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",3976 ioc_info(ioc, "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
4012 ioc->name, handle, smid,3977 handle, smid, ioc->tm_sas_control_cb_idx));
4013 ioc->tm_sas_control_cb_idx));
4014 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);3978 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
4015 memset(mpi_request, 0, sizeof(Mpi2SasIoUnitControlRequest_t));3979 memset(mpi_request, 0, sizeof(Mpi2SasIoUnitControlRequest_t));
4016 mpi_request->Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL;3980 mpi_request->Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL;
@@ -4171,8 +4135,8 @@ _scsih_check_topo_delete_events(struct MPT3SAS_ADAPTER *ioc, · 154 unmodified lines
4171 MPI2_EVENT_SAS_TOPO_ES_RESPONDING) {4135 MPI2_EVENT_SAS_TOPO_ES_RESPONDING) {
4172 if (le16_to_cpu(local_event_data->ExpanderDevHandle) ==4136 if (le16_to_cpu(local_event_data->ExpanderDevHandle) ==
4173 expander_handle) {4137 expander_handle) {
4174 dewtprintk(ioc, pr_info(MPT3SAS_FMT4138 dewtprintk(ioc,
4175 "setting ignoring flag\n", ioc->name));4139 ioc_info(ioc, "setting ignoring flag\n"));
4176 fw_event->ignore = 1;4140 fw_event->ignore = 1;
4177 }4141 }
4178 }4142 }
@@ -4243,9 +4207,8 @@ _scsih_check_pcie_topo_remove_events(struct MPT3SAS_ADAPTER *ioc, · 64 unmodified lines
4243 MPI2_EVENT_SAS_TOPO_ES_RESPONDING) {4207 MPI2_EVENT_SAS_TOPO_ES_RESPONDING) {
4244 if (le16_to_cpu(local_event_data->SwitchDevHandle) ==4208 if (le16_to_cpu(local_event_data->SwitchDevHandle) ==
4245 switch_handle) {4209 switch_handle) {
4246 dewtprintk(ioc, pr_info(MPT3SAS_FMT4210 dewtprintk(ioc,
4247 "setting ignoring flag for switch event\n",4211 ioc_info(ioc, "setting ignoring flag for switch event\n"));
4248 ioc->name));
4249 fw_event->ignore = 1;4212 fw_event->ignore = 1;
4250 }4213 }
4251 }4214 }
@@ -4274,10 +4237,9 @@ _scsih_set_volume_delete_flag(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 22 unmodified lines
4274 sas_target_priv_data =4237 sas_target_priv_data =
4275 raid_device->starget->hostdata;4238 raid_device->starget->hostdata;
4276 sas_target_priv_data->deleted = 1;4239 sas_target_priv_data->deleted = 1;
4277 dewtprintk(ioc, pr_info(MPT3SAS_FMT4240 dewtprintk(ioc,
4278 "setting delete flag: handle(0x%04x), "4241 ioc_info(ioc, "setting delete flag: handle(0x%04x), wwid(0x%016llx)\n",
4279 "wwid(0x%016llx)\n", ioc->name, handle,4242 handle, (u64)raid_device->wwid));
4280 (unsigned long long) raid_device->wwid));
4281 }4243 }
4282 spin_unlock_irqrestore(&ioc->raid_device_lock, flags);4244 spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
4283}4245}
@@ -4379,9 +4341,9 @@ _scsih_check_ir_config_unhide_events(struct MPT3SAS_ADAPTER *ioc, · 95 unmodified lines
4379 INIT_LIST_HEAD(&delayed_tr->list);4341 INIT_LIST_HEAD(&delayed_tr->list);
4380 delayed_tr->handle = handle;4342 delayed_tr->handle = handle;
4381 list_add_tail(&delayed_tr->list, &ioc->delayed_tr_list);4343 list_add_tail(&delayed_tr->list, &ioc->delayed_tr_list);
4382 dewtprintk(ioc, pr_info(MPT3SAS_FMT4344 dewtprintk(ioc,
4383 "DELAYED:tr:handle(0x%04x), (open)\n", ioc->name,4345 ioc_info(ioc, "DELAYED:tr:handle(0x%04x), (open)\n",
4384 handle));4346 handle));
4385 } else4347 } else
4386 _scsih_tm_tr_send(ioc, handle);4348 _scsih_tm_tr_send(ioc, handle);
4387 }4349 }
@@ -4424,15 +4386,14 @@ _scsih_temp_threshold_events(struct MPT3SAS_ADAPTER *ioc, · 36 unmodified lines
4424 Mpi2EventDataTemperature_t *event_data)4386 Mpi2EventDataTemperature_t *event_data)
4425{4387{
4426 if (ioc->temp_sensors_count >= event_data->SensorNum) {4388 if (ioc->temp_sensors_count >= event_data->SensorNum) {
4427 pr_err(MPT3SAS_FMT "Temperature Threshold flags %s%s%s%s"4389 ioc_err(ioc, "Temperature Threshold flags %s%s%s%s exceeded for Sensor: %d !!!\n",
4428 " exceeded for Sensor: %d !!!\n", ioc->name,4390 le16_to_cpu(event_data->Status) & 0x1 ? "0 " : " ",
4429 ((le16_to_cpu(event_data->Status) & 0x1) == 1) ? "0 " : " ",4391 le16_to_cpu(event_data->Status) & 0x2 ? "1 " : " ",
4430 ((le16_to_cpu(event_data->Status) & 0x2) == 2) ? "1 " : " ",4392 le16_to_cpu(event_data->Status) & 0x4 ? "2 " : " ",
4431 ((le16_to_cpu(event_data->Status) & 0x4) == 4) ? "2 " : " ",4393 le16_to_cpu(event_data->Status) & 0x8 ? "3 " : " ",
4432 ((le16_to_cpu(event_data->Status) & 0x8) == 8) ? "3 " : " ",4394 event_data->SensorNum);
4433 event_data->SensorNum);4395 ioc_err(ioc, "Current Temp In Celsius: %d\n",
4434 pr_err(MPT3SAS_FMT "Current Temp In Celsius: %d\n",4396 event_data->CurrentTemperature);
4435 ioc->name, event_data->CurrentTemperature);
4436 }4397 }
4437}4398}
4438 4399
@@ -4480,8 +4441,7 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc) · 41 unmodified lines
4480 scmd->result = DID_RESET << 16;4441 scmd->result = DID_RESET << 16;
4481 scmd->scsi_done(scmd);4442 scmd->scsi_done(scmd);
4482 }4443 }
4483 dtmprintk(ioc, pr_info(MPT3SAS_FMT "completing %d cmds\n",4444 dtmprintk(ioc, ioc_info(ioc, "completing %d cmds\n", count));
4484 ioc->name, count));
4485}4445}
4486 4446
4487/**4447/**
@@ -4680,8 +4640,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) · 192 unmodified lines
4680 4640
4681 smid = mpt3sas_base_get_smid_scsiio(ioc, ioc->scsi_io_cb_idx, scmd);4641 smid = mpt3sas_base_get_smid_scsiio(ioc, ioc->scsi_io_cb_idx, scmd);
4682 if (!smid) {4642 if (!smid) {
4683 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",4643 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
4684 ioc->name, __func__);
4685 _scsih_set_satl_pending(scmd, false);4644 _scsih_set_satl_pending(scmd, false);
4686 goto out;4645 goto out;
4687 }4646 }
@@ -4919,37 +4878,28 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, · 231 unmodified lines
4919 scsi_print_command(scmd);4878 scsi_print_command(scmd);
4920 4879
4921 if (priv_target->flags & MPT_TARGET_FLAGS_VOLUME) {4880 if (priv_target->flags & MPT_TARGET_FLAGS_VOLUME) {
4922 pr_warn(MPT3SAS_FMT "\t%s wwid(0x%016llx)\n", ioc->name,4881 ioc_warn(ioc, "\t%s wwid(0x%016llx)\n",
4923 device_str, (unsigned long long)priv_target->sas_address);4882 device_str, (u64)priv_target->sas_address);
4924 } else if (priv_target->flags & MPT_TARGET_FLAGS_PCIE_DEVICE) {4883 } else if (priv_target->flags & MPT_TARGET_FLAGS_PCIE_DEVICE) {
4925 pcie_device = mpt3sas_get_pdev_from_target(ioc, priv_target);4884 pcie_device = mpt3sas_get_pdev_from_target(ioc, priv_target);
4926 if (pcie_device) {4885 if (pcie_device) {
4927 pr_info(MPT3SAS_FMT "\twwid(0x%016llx), port(%d)\n",4886 ioc_info(ioc, "\twwid(0x%016llx), port(%d)\n",
4928 ioc->name,4887 (u64)pcie_device->wwid, pcie_device->port_num);
4929 (unsigned long long)pcie_device->wwid,
4930 pcie_device->port_num);
4931 if (pcie_device->enclosure_handle != 0)4888 if (pcie_device->enclosure_handle != 0)
4932 pr_info(MPT3SAS_FMT4889 ioc_info(ioc, "\tenclosure logical id(0x%016llx), slot(%d)\n",
4933 "\tenclosure logical id(0x%016llx), "4890 (u64)pcie_device->enclosure_logical_id,
4934 "slot(%d)\n", ioc->name,4891 pcie_device->slot);
4935 (unsigned long long)
4936 pcie_device->enclosure_logical_id,
4937 pcie_device->slot);
4938 if (pcie_device->connector_name[0])4892 if (pcie_device->connector_name[0])
4939 pr_info(MPT3SAS_FMT4893 ioc_info(ioc, "\tenclosure level(0x%04x), connector name( %s)\n",
4940 "\tenclosure level(0x%04x),"4894 pcie_device->enclosure_level,
4941 "connector name( %s)\n",4895 pcie_device->connector_name);
4942 ioc->name, pcie_device->enclosure_level,
4943 pcie_device->connector_name);
4944 pcie_device_put(pcie_device);4896 pcie_device_put(pcie_device);
4945 }4897 }
4946 } else {4898 } else {
4947 sas_device = mpt3sas_get_sdev_from_target(ioc, priv_target);4899 sas_device = mpt3sas_get_sdev_from_target(ioc, priv_target);
4948 if (sas_device) {4900 if (sas_device) {
4949 pr_warn(MPT3SAS_FMT4901 ioc_warn(ioc, "\tsas_address(0x%016llx), phy(%d)\n",
4950 "\tsas_address(0x%016llx), phy(%d)\n",4902 (u64)sas_device->sas_address, sas_device->phy);
4951 ioc->name, (unsigned long long)
4952 sas_device->sas_address, sas_device->phy);
4953 4903
4954 _scsih_display_enclosure_chassis_info(ioc, sas_device,4904 _scsih_display_enclosure_chassis_info(ioc, sas_device,
4955 NULL, NULL);4905 NULL, NULL);
@@ -4958,30 +4908,23 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, · 2 unmodified lines
4958 }4908 }
4959 }4909 }
4960 4910
4961 pr_warn(MPT3SAS_FMT4911 ioc_warn(ioc, "\thandle(0x%04x), ioc_status(%s)(0x%04x), smid(%d)\n",
4962 "\thandle(0x%04x), ioc_status(%s)(0x%04x), smid(%d)\n",4912 le16_to_cpu(mpi_reply->DevHandle),
4963 ioc->name, le16_to_cpu(mpi_reply->DevHandle),4913 desc_ioc_state, ioc_status, smid);
4964 desc_ioc_state, ioc_status, smid);4914 ioc_warn(ioc, "\trequest_len(%d), underflow(%d), resid(%d)\n",
4965 pr_warn(MPT3SAS_FMT4915 scsi_bufflen(scmd), scmd->underflow, scsi_get_resid(scmd));
4966 "\trequest_len(%d), underflow(%d), resid(%d)\n",4916 ioc_warn(ioc, "\ttag(%d), transfer_count(%d), sc->result(0x%08x)\n",
4967 ioc->name, scsi_bufflen(scmd), scmd->underflow,4917 le16_to_cpu(mpi_reply->TaskTag),
4968 scsi_get_resid(scmd));4918 le32_to_cpu(mpi_reply->TransferCount), scmd->result);
4969 pr_warn(MPT3SAS_FMT4919 ioc_warn(ioc, "\tscsi_status(%s)(0x%02x), scsi_state(%s)(0x%02x)\n",
4970 "\ttag(%d), transfer_count(%d), sc->result(0x%08x)\n",4920 desc_scsi_status, scsi_status, desc_scsi_state, scsi_state);
4971 ioc->name, le16_to_cpu(mpi_reply->TaskTag),
4972 le32_to_cpu(mpi_reply->TransferCount), scmd->result);
4973 pr_warn(MPT3SAS_FMT
4974 "\tscsi_status(%s)(0x%02x), scsi_state(%s)(0x%02x)\n",
4975 ioc->name, desc_scsi_status,
4976 scsi_status, desc_scsi_state, scsi_state);
4977 4921
4978 if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID) {4922 if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID) {
4979 struct sense_info data;4923 struct sense_info data;
4980 _scsih_normalize_sense(scmd->sense_buffer, &data);4924 _scsih_normalize_sense(scmd->sense_buffer, &data);
4981 pr_warn(MPT3SAS_FMT4925 ioc_warn(ioc, "\t[sense_key,asc,ascq]: [0x%02x,0x%02x,0x%02x], count(%d)\n",
4982 "\t[sense_key,asc,ascq]: [0x%02x,0x%02x,0x%02x], count(%d)\n",4926 data.skey, data.asc, data.ascq,
4983 ioc->name, data.skey,4927 le32_to_cpu(mpi_reply->SenseCount));
4984 data.asc, data.ascq, le32_to_cpu(mpi_reply->SenseCount));
4985 }4928 }
4986 if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) {4929 if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) {
4987 response_info = le32_to_cpu(mpi_reply->ResponseInfo);4930 response_info = le32_to_cpu(mpi_reply->ResponseInfo);
@@ -5016,17 +4959,17 @@ _scsih_turn_on_pfa_led(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 28 unmodified lines
5016 mpi_request.Flags = MPI2_SEP_REQ_FLAGS_DEVHANDLE_ADDRESS;4959 mpi_request.Flags = MPI2_SEP_REQ_FLAGS_DEVHANDLE_ADDRESS;
5017 if ((mpt3sas_base_scsi_enclosure_processor(ioc, &mpi_reply,4960 if ((mpt3sas_base_scsi_enclosure_processor(ioc, &mpi_reply,
5018 &mpi_request)) != 0) {4961 &mpi_request)) != 0) {
5019 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name,4962 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5020 __FILE__, __LINE__, __func__);4963 __FILE__, __LINE__, __func__);
5021 goto out;4964 goto out;
5022 }4965 }
5023 sas_device->pfa_led_on = 1;4966 sas_device->pfa_led_on = 1;
5024 4967
5025 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {4968 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {
5026 dewtprintk(ioc, pr_info(MPT3SAS_FMT4969 dewtprintk(ioc,
5027 "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",4970 ioc_info(ioc, "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",
5028 ioc->name, le16_to_cpu(mpi_reply.IOCStatus),4971 le16_to_cpu(mpi_reply.IOCStatus),
5029 le32_to_cpu(mpi_reply.IOCLogInfo)));4972 le32_to_cpu(mpi_reply.IOCLogInfo)));
5030 goto out;4973 goto out;
5031 }4974 }
5032out:4975out:
@@ -5056,16 +4999,16 @@ _scsih_turn_off_pfa_led(struct MPT3SAS_ADAPTER *ioc, · 23 unmodified lines
5056 mpi_request.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS;4999 mpi_request.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS;
5057 if ((mpt3sas_base_scsi_enclosure_processor(ioc, &mpi_reply,5000 if ((mpt3sas_base_scsi_enclosure_processor(ioc, &mpi_reply,
5058 &mpi_request)) != 0) {5001 &mpi_request)) != 0) {
5059 printk(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name,5002 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5060 __FILE__, __LINE__, __func__);5003 __FILE__, __LINE__, __func__);
5061 return;5004 return;
5062 }5005 }
5063 5006
5064 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {5007 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {
5065 dewtprintk(ioc, printk(MPT3SAS_FMT5008 dewtprintk(ioc,
5066 "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",5009 ioc_info(ioc, "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",
5067 ioc->name, le16_to_cpu(mpi_reply.IOCStatus),5010 le16_to_cpu(mpi_reply.IOCStatus),
5068 le32_to_cpu(mpi_reply.IOCLogInfo)));5011 le32_to_cpu(mpi_reply.IOCLogInfo)));
5069 return;5012 return;
5070 }5013 }
5071}5014}
@@ -5133,8 +5076,8 @@ _scsih_smart_predicted_fault(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 61 unmodified lines
5133 sizeof(Mpi2EventDataSasDeviceStatusChange_t);5076 sizeof(Mpi2EventDataSasDeviceStatusChange_t);
5134 event_reply = kzalloc(sz, GFP_KERNEL);5077 event_reply = kzalloc(sz, GFP_KERNEL);
5135 if (!event_reply) {5078 if (!event_reply) {
5136 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5079 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5137 ioc->name, __FILE__, __LINE__, __func__);5080 __FILE__, __LINE__, __func__);
5138 goto out;5081 goto out;
5139 }5082 }
5140 5083
@@ -5424,16 +5367,16 @@ _scsih_sas_host_refresh(struct MPT3SAS_ADAPTER *ioc) · 283 unmodified lines
5424 u16 attached_handle;5367 u16 attached_handle;
5425 u8 link_rate;5368 u8 link_rate;
5426 5369
5427 dtmprintk(ioc, pr_info(MPT3SAS_FMT5370 dtmprintk(ioc,
5428 "updating handles for sas_host(0x%016llx)\n",5371 ioc_info(ioc, "updating handles for sas_host(0x%016llx)\n",
5429 ioc->name, (unsigned long long)ioc->sas_hba.sas_address));5372 (u64)ioc->sas_hba.sas_address));
5430 5373
5431 sz = offsetof(Mpi2SasIOUnitPage0_t, PhyData) + (ioc->sas_hba.num_phys5374 sz = offsetof(Mpi2SasIOUnitPage0_t, PhyData) + (ioc->sas_hba.num_phys
5432 * sizeof(Mpi2SasIOUnit0PhyData_t));5375 * sizeof(Mpi2SasIOUnit0PhyData_t));
5433 sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL);5376 sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL);
5434 if (!sas_iounit_pg0) {5377 if (!sas_iounit_pg0) {
5435 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5378 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5436 ioc->name, __FILE__, __LINE__, __func__);5379 __FILE__, __LINE__, __func__);
5437 return;5380 return;
5438 }5381 }
5439 5382
@@ -5483,15 +5426,15 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 43 unmodified lines
5483 5426
5484 mpt3sas_config_get_number_hba_phys(ioc, &num_phys);5427 mpt3sas_config_get_number_hba_phys(ioc, &num_phys);
5485 if (!num_phys) {5428 if (!num_phys) {
5486 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5429 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5487 ioc->name, __FILE__, __LINE__, __func__);5430 __FILE__, __LINE__, __func__);
5488 return;5431 return;
5489 }5432 }
5490 ioc->sas_hba.phy = kcalloc(num_phys,5433 ioc->sas_hba.phy = kcalloc(num_phys,
5491 sizeof(struct _sas_phy), GFP_KERNEL);5434 sizeof(struct _sas_phy), GFP_KERNEL);
5492 if (!ioc->sas_hba.phy) {5435 if (!ioc->sas_hba.phy) {
5493 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5436 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5494 ioc->name, __FILE__, __LINE__, __func__);5437 __FILE__, __LINE__, __func__);
5495 goto out;5438 goto out;
5496 }5439 }
5497 ioc->sas_hba.num_phys = num_phys;5440 ioc->sas_hba.num_phys = num_phys;
@@ -5501,21 +5444,21 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
5501 sizeof(Mpi2SasIOUnit0PhyData_t));5444 sizeof(Mpi2SasIOUnit0PhyData_t));
5502 sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL);5445 sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL);
5503 if (!sas_iounit_pg0) {5446 if (!sas_iounit_pg0) {
5504 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5447 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5505 ioc->name, __FILE__, __LINE__, __func__);5448 __FILE__, __LINE__, __func__);
5506 return;5449 return;
5507 }5450 }
5508 if ((mpt3sas_config_get_sas_iounit_pg0(ioc, &mpi_reply,5451 if ((mpt3sas_config_get_sas_iounit_pg0(ioc, &mpi_reply,
5509 sas_iounit_pg0, sz))) {5452 sas_iounit_pg0, sz))) {
5510 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5453 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5511 ioc->name, __FILE__, __LINE__, __func__);5454 __FILE__, __LINE__, __func__);
5512 goto out;5455 goto out;
5513 }5456 }
5514 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &5457 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
5515 MPI2_IOCSTATUS_MASK;5458 MPI2_IOCSTATUS_MASK;
5516 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {5459 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5517 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5460 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5518 ioc->name, __FILE__, __LINE__, __func__);5461 __FILE__, __LINE__, __func__);
5519 goto out;5462 goto out;
5520 }5463 }
5521 5464
@@ -5524,21 +5467,21 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
5524 sizeof(Mpi2SasIOUnit1PhyData_t));5467 sizeof(Mpi2SasIOUnit1PhyData_t));
5525 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);5468 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
5526 if (!sas_iounit_pg1) {5469 if (!sas_iounit_pg1) {
5527 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5470 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5528 ioc->name, __FILE__, __LINE__, __func__);5471 __FILE__, __LINE__, __func__);
5529 goto out;5472 goto out;
5530 }5473 }
5531 if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,5474 if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
5532 sas_iounit_pg1, sz))) {5475 sas_iounit_pg1, sz))) {
5533 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5476 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5534 ioc->name, __FILE__, __LINE__, __func__);5477 __FILE__, __LINE__, __func__);
5535 goto out;5478 goto out;
5536 }5479 }
5537 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &5480 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
5538 MPI2_IOCSTATUS_MASK;5481 MPI2_IOCSTATUS_MASK;
5539 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {5482 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5540 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5483 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5541 ioc->name, __FILE__, __LINE__, __func__);5484 __FILE__, __LINE__, __func__);
5542 goto out;5485 goto out;
5543 }5486 }
5544 5487
@@ -5557,15 +5500,15 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 12 unmodified lines
5557 for (i = 0; i < ioc->sas_hba.num_phys ; i++) {5500 for (i = 0; i < ioc->sas_hba.num_phys ; i++) {
5558 if ((mpt3sas_config_get_phy_pg0(ioc, &mpi_reply, &phy_pg0,5501 if ((mpt3sas_config_get_phy_pg0(ioc, &mpi_reply, &phy_pg0,
5559 i))) {5502 i))) {
5560 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5503 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5561 ioc->name, __FILE__, __LINE__, __func__);5504 __FILE__, __LINE__, __func__);
5562 goto out;5505 goto out;
5563 }5506 }
5564 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &5507 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
5565 MPI2_IOCSTATUS_MASK;5508 MPI2_IOCSTATUS_MASK;
5566 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {5509 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5567 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5510 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5568 ioc->name, __FILE__, __LINE__, __func__);5511 __FILE__, __LINE__, __func__);
5569 goto out;5512 goto out;
5570 }5513 }
5571 5514
@@ -5579,18 +5522,17 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines
5579 }5522 }
5580 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,5523 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
5581 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, ioc->sas_hba.handle))) {5524 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, ioc->sas_hba.handle))) {
5582 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5525 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5583 ioc->name, __FILE__, __LINE__, __func__);5526 __FILE__, __LINE__, __func__);
5584 goto out;5527 goto out;
5585 }5528 }
5586 ioc->sas_hba.enclosure_handle =5529 ioc->sas_hba.enclosure_handle =
5587 le16_to_cpu(sas_device_pg0.EnclosureHandle);5530 le16_to_cpu(sas_device_pg0.EnclosureHandle);
5588 ioc->sas_hba.sas_address = le64_to_cpu(sas_device_pg0.SASAddress);5531 ioc->sas_hba.sas_address = le64_to_cpu(sas_device_pg0.SASAddress);
5589 pr_info(MPT3SAS_FMT5532 ioc_info(ioc, "host_add: handle(0x%04x), sas_addr(0x%016llx), phys(%d)\n",
5590 "host_add: handle(0x%04x), sas_addr(0x%016llx), phys(%d)\n",5533 ioc->sas_hba.handle,
5591 ioc->name, ioc->sas_hba.handle,5534 (u64)ioc->sas_hba.sas_address,
5592 (unsigned long long) ioc->sas_hba.sas_address,5535 ioc->sas_hba.num_phys);
5593 ioc->sas_hba.num_phys) ;
5594 5536
5595 if (ioc->sas_hba.enclosure_handle) {5537 if (ioc->sas_hba.enclosure_handle) {
5596 if (!(mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply,5538 if (!(mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply,
@@ -5639,16 +5581,16 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 42 unmodified lines
5639 5581
5640 if ((mpt3sas_config_get_expander_pg0(ioc, &mpi_reply, &expander_pg0,5582 if ((mpt3sas_config_get_expander_pg0(ioc, &mpi_reply, &expander_pg0,
5641 MPI2_SAS_EXPAND_PGAD_FORM_HNDL, handle))) {5583 MPI2_SAS_EXPAND_PGAD_FORM_HNDL, handle))) {
5642 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5584 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5643 ioc->name, __FILE__, __LINE__, __func__);5585 __FILE__, __LINE__, __func__);
5644 return -1;5586 return -1;
5645 }5587 }
5646 5588
5647 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &5589 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
5648 MPI2_IOCSTATUS_MASK;5590 MPI2_IOCSTATUS_MASK;
5649 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {5591 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5650 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5592 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5651 ioc->name, __FILE__, __LINE__, __func__);5593 __FILE__, __LINE__, __func__);
5652 return -1;5594 return -1;
5653 }5595 }
5654 5596
@@ -5656,8 +5598,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 1 unmodified line
5656 parent_handle = le16_to_cpu(expander_pg0.ParentDevHandle);5598 parent_handle = le16_to_cpu(expander_pg0.ParentDevHandle);
5657 if (_scsih_get_sas_address(ioc, parent_handle, &sas_address_parent)5599 if (_scsih_get_sas_address(ioc, parent_handle, &sas_address_parent)
5658 != 0) {5600 != 0) {
5659 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5601 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5660 ioc->name, __FILE__, __LINE__, __func__);5602 __FILE__, __LINE__, __func__);
5661 return -1;5603 return -1;
5662 }5604 }
5663 if (sas_address_parent != ioc->sas_hba.sas_address) {5605 if (sas_address_parent != ioc->sas_hba.sas_address) {
@@ -5684,8 +5626,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 20 unmodified lines
5684 sas_expander = kzalloc(sizeof(struct _sas_node),5626 sas_expander = kzalloc(sizeof(struct _sas_node),
5685 GFP_KERNEL);5627 GFP_KERNEL);
5686 if (!sas_expander) {5628 if (!sas_expander) {
5687 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5629 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5688 ioc->name, __FILE__, __LINE__, __func__);5630 __FILE__, __LINE__, __func__);
5689 return -1;5631 return -1;
5690 }5632 }
5691 5633
@@ -5694,18 +5636,17 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 2 unmodified lines
5694 sas_expander->sas_address_parent = sas_address_parent;5636 sas_expander->sas_address_parent = sas_address_parent;
5695 sas_expander->sas_address = sas_address;5637 sas_expander->sas_address = sas_address;
5696 5638
5697 pr_info(MPT3SAS_FMT "expander_add: handle(0x%04x)," \5639 ioc_info(ioc, "expander_add: handle(0x%04x), parent(0x%04x), sas_addr(0x%016llx), phys(%d)\n",
5698 " parent(0x%04x), sas_addr(0x%016llx), phys(%d)\n", ioc->name,5640 handle, parent_handle,
5699 handle, parent_handle, (unsigned long long)5641 (u64)sas_expander->sas_address, sas_expander->num_phys);
5700 sas_expander->sas_address, sas_expander->num_phys);
5701 5642
5702 if (!sas_expander->num_phys)5643 if (!sas_expander->num_phys)
5703 goto out_fail;5644 goto out_fail;
5704 sas_expander->phy = kcalloc(sas_expander->num_phys,5645 sas_expander->phy = kcalloc(sas_expander->num_phys,
5705 sizeof(struct _sas_phy), GFP_KERNEL);5646 sizeof(struct _sas_phy), GFP_KERNEL);
5706 if (!sas_expander->phy) {5647 if (!sas_expander->phy) {
5707 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5648 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5708 ioc->name, __FILE__, __LINE__, __func__);5649 __FILE__, __LINE__, __func__);
5709 rc = -1;5650 rc = -1;
5710 goto out_fail;5651 goto out_fail;
5711 }5652 }
@@ -5714,8 +5655,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 2 unmodified lines
5714 mpt3sas_port = mpt3sas_transport_port_add(ioc, handle,5655 mpt3sas_port = mpt3sas_transport_port_add(ioc, handle,
5715 sas_address_parent);5656 sas_address_parent);
5716 if (!mpt3sas_port) {5657 if (!mpt3sas_port) {
5717 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5658 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5718 ioc->name, __FILE__, __LINE__, __func__);5659 __FILE__, __LINE__, __func__);
5719 rc = -1;5660 rc = -1;
5720 goto out_fail;5661 goto out_fail;
5721 }5662 }
@@ -5724,8 +5665,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 2 unmodified lines
5724 for (i = 0 ; i < sas_expander->num_phys ; i++) {5665 for (i = 0 ; i < sas_expander->num_phys ; i++) {
5725 if ((mpt3sas_config_get_expander_pg1(ioc, &mpi_reply,5666 if ((mpt3sas_config_get_expander_pg1(ioc, &mpi_reply,
5726 &expander_pg1, i, handle))) {5667 &expander_pg1, i, handle))) {
5727 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5668 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5728 ioc->name, __FILE__, __LINE__, __func__);5669 __FILE__, __LINE__, __func__);
5729 rc = -1;5670 rc = -1;
5730 goto out_fail;5671 goto out_fail;
5731 }5672 }
@@ -5735,8 +5676,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 3 unmodified lines
5735 if ((mpt3sas_transport_add_expander_phy(ioc,5676 if ((mpt3sas_transport_add_expander_phy(ioc,
5736 &sas_expander->phy[i], expander_pg1,5677 &sas_expander->phy[i], expander_pg1,
5737 sas_expander->parent_dev))) {5678 sas_expander->parent_dev))) {
5738 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5679 ioc_err(ioc, "failure at %s:%d/%s()!\n",
5739 ioc->name, __FILE__, __LINE__, __func__);5680 __FILE__, __LINE__, __func__);
5740 rc = -1;5681 rc = -1;
5741 goto out_fail;5682 goto out_fail;
5742 }5683 }
@@ -5883,9 +5824,8 @@ _scsih_check_access_status(struct MPT3SAS_ADAPTER *ioc, u64 sas_address, · 140 unmodified lines
5883 if (!rc)5824 if (!rc)
5884 return 0;5825 return 0;
5885 5826
5886 pr_err(MPT3SAS_FMT5827 ioc_err(ioc, "discovery errors(%s): sas_address(0x%016llx), handle(0x%04x)\n",
5887 "discovery errors(%s): sas_address(0x%016llx), handle(0x%04x)\n",5828 desc, (u64)sas_address, handle);
5888 ioc->name, desc, (unsigned long long)sas_address, handle);
5889 return rc;5829 return rc;
5890}5830}
5891 5831
@@ -5979,9 +5919,8 @@ _scsih_check_device(struct MPT3SAS_ADAPTER *ioc, · 87 unmodified lines
5979 /* check if device is present */5919 /* check if device is present */
5980 if (!(le16_to_cpu(sas_device_pg0.Flags) &5920 if (!(le16_to_cpu(sas_device_pg0.Flags) &
5981 MPI2_SAS_DEVICE0_FLAGS_DEVICE_PRESENT)) {5921 MPI2_SAS_DEVICE0_FLAGS_DEVICE_PRESENT)) {
5982 pr_err(MPT3SAS_FMT5922 ioc_err(ioc, "device is not present handle(0x%04x), flags!!!\n",
5983 "device is not present handle(0x%04x), flags!!!\n",5923 handle);
5984 ioc->name, handle);
5985 goto out_unlock;5924 goto out_unlock;
5986 }5925 }
5987 5926
@@ -6028,16 +5967,16 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, · 40 unmodified lines
6028 5967
6029 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,5968 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
6030 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {5969 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
6031 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5970 ioc_err(ioc, "failure at %s:%d/%s()!\n",
6032 ioc->name, __FILE__, __LINE__, __func__);5971 __FILE__, __LINE__, __func__);
6033 return -1;5972 return -1;
6034 }5973 }
6035 5974
6036 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &5975 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
6037 MPI2_IOCSTATUS_MASK;5976 MPI2_IOCSTATUS_MASK;
6038 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {5977 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
6039 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",5978 ioc_err(ioc, "failure at %s:%d/%s()!\n",
6040 ioc->name, __FILE__, __LINE__, __func__);5979 __FILE__, __LINE__, __func__);
6041 return -1;5980 return -1;
6042 }5981 }
6043 5982
@@ -6051,8 +5990,8 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, · 7 unmodified lines
6051 /* check if device is present */5990 /* check if device is present */
6052 if (!(le16_to_cpu(sas_device_pg0.Flags) &5991 if (!(le16_to_cpu(sas_device_pg0.Flags) &
6053 MPI2_SAS_DEVICE0_FLAGS_DEVICE_PRESENT)) {5992 MPI2_SAS_DEVICE0_FLAGS_DEVICE_PRESENT)) {
6054 pr_err(MPT3SAS_FMT "device is not present handle(0x04%x)!!!\n",5993 ioc_err(ioc, "device is not present handle(0x04%x)!!!\n",
6055 ioc->name, handle);5994 handle);
6056 return -1;5995 return -1;
6057 }5996 }
6058 5997
@@ -6074,16 +6013,15 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, · 15 unmodified lines
6074 mpt3sas_scsih_enclosure_find_by_handle(ioc,6013 mpt3sas_scsih_enclosure_find_by_handle(ioc,
6075 le16_to_cpu(sas_device_pg0.EnclosureHandle));6014 le16_to_cpu(sas_device_pg0.EnclosureHandle));
6076 if (enclosure_dev == NULL)6015 if (enclosure_dev == NULL)
6077 pr_info(MPT3SAS_FMT "Enclosure handle(0x%04x)"6016 ioc_info(ioc, "Enclosure handle(0x%04x) doesn't match with enclosure device!\n",
6078 "doesn't match with enclosure device!\n",6017 sas_device_pg0.EnclosureHandle);
6079 ioc->name, sas_device_pg0.EnclosureHandle);
6080 }6018 }
6081 6019
6082 sas_device = kzalloc(sizeof(struct _sas_device),6020 sas_device = kzalloc(sizeof(struct _sas_device),
6083 GFP_KERNEL);6021 GFP_KERNEL);
6084 if (!sas_device) {6022 if (!sas_device) {
6085 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",6023 ioc_err(ioc, "failure at %s:%d/%s()!\n",
6086 ioc->name, __FILE__, __LINE__, __func__);6024 __FILE__, __LINE__, __func__);
6087 return 0;6025 return 0;
6088 }6026 }
6089 6027
@@ -6092,8 +6030,8 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, · 2 unmodified lines
6092 if (_scsih_get_sas_address(ioc,6030 if (_scsih_get_sas_address(ioc,
6093 le16_to_cpu(sas_device_pg0.ParentDevHandle),6031 le16_to_cpu(sas_device_pg0.ParentDevHandle),
6094 &sas_device->sas_address_parent) != 0)6032 &sas_device->sas_address_parent) != 0)
6095 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",6033 ioc_err(ioc, "failure at %s:%d/%s()!\n",
6096 ioc->name, __FILE__, __LINE__, __func__);6034 __FILE__, __LINE__, __func__);
6097 sas_device->enclosure_handle =6035 sas_device->enclosure_handle =
6098 le16_to_cpu(sas_device_pg0.EnclosureHandle);6036 le16_to_cpu(sas_device_pg0.EnclosureHandle);
6099 if (sas_device->enclosure_handle != 0)6037 if (sas_device->enclosure_handle != 0)
@@ -6158,11 +6096,10 @@ _scsih_remove_device(struct MPT3SAS_ADAPTER *ioc, · 58 unmodified lines
6158 sas_device->pfa_led_on = 0;6096 sas_device->pfa_led_on = 0;
6159 }6097 }
6160 6098
6161 dewtprintk(ioc, pr_info(MPT3SAS_FMT6099 dewtprintk(ioc,
6162 "%s: enter: handle(0x%04x), sas_addr(0x%016llx)\n",6100 ioc_info(ioc, "%s: enter: handle(0x%04x), sas_addr(0x%016llx)\n",
6163 ioc->name, __func__,6101 __func__,
6164 sas_device->handle, (unsigned long long)6102 sas_device->handle, (u64)sas_device->sas_address));
6165 sas_device->sas_address));
6166 6103
6167 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,6104 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,
6168 NULL, NULL));6105 NULL, NULL));
@@ -6180,18 +6117,15 @@ _scsih_remove_device(struct MPT3SAS_ADAPTER *ioc, · 11 unmodified lines
6180 sas_device->sas_address,6117 sas_device->sas_address,
6181 sas_device->sas_address_parent);6118 sas_device->sas_address_parent);
6182 6119
6183 pr_info(MPT3SAS_FMT6120 ioc_info(ioc, "removing handle(0x%04x), sas_addr(0x%016llx)\n",
6184 "removing handle(0x%04x), sas_addr(0x%016llx)\n",6121 sas_device->handle, (u64)sas_device->sas_address);
6185 ioc->name, sas_device->handle,
6186 (unsigned long long) sas_device->sas_address);
6187 6122
6188 _scsih_display_enclosure_chassis_info(ioc, sas_device, NULL, NULL);6123 _scsih_display_enclosure_chassis_info(ioc, sas_device, NULL, NULL);
6189 6124
6190 dewtprintk(ioc, pr_info(MPT3SAS_FMT6125 dewtprintk(ioc,
6191 "%s: exit: handle(0x%04x), sas_addr(0x%016llx)\n",6126 ioc_info(ioc, "%s: exit: handle(0x%04x), sas_addr(0x%016llx)\n",
6192 ioc->name, __func__,6127 __func__,
6193 sas_device->handle, (unsigned long long)6128 sas_device->handle, (u64)sas_device->sas_address));
6194 sas_device->sas_address));
6195 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,6129 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,
6196 NULL, NULL));6130 NULL, NULL));
6197}6131}
@@ -6231,8 +6165,7 @@ _scsih_sas_topology_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 33 unmodified lines
6231 status_str = "unknown status";6165 status_str = "unknown status";
6232 break;6166 break;
6233 }6167 }
6234 pr_info(MPT3SAS_FMT "sas topology change: (%s)\n",6168 ioc_info(ioc, "sas topology change: (%s)\n", status_str);
6235 ioc->name, status_str);
6236 pr_info("\thandle(0x%04x), enclosure_handle(0x%04x) " \6169 pr_info("\thandle(0x%04x), enclosure_handle(0x%04x) " \
6237 "start_phy(%02d), count(%d)\n",6170 "start_phy(%02d), count(%d)\n",
6238 le16_to_cpu(event_data->ExpanderDevHandle),6171 le16_to_cpu(event_data->ExpanderDevHandle),
@@ -6309,8 +6242,7 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, · 70 unmodified lines
6309 _scsih_sas_host_refresh(ioc);6242 _scsih_sas_host_refresh(ioc);
6310 6243
6311 if (fw_event->ignore) {6244 if (fw_event->ignore) {
6312 dewtprintk(ioc, pr_info(MPT3SAS_FMT6245 dewtprintk(ioc, ioc_info(ioc, "ignoring expander event\n"));
6313 "ignoring expander event\n", ioc->name));
6314 return 0;6246 return 0;
6315 }6247 }
6316 6248
@@ -6339,8 +6271,8 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, · 22 unmodified lines
6339 /* handle siblings events */6271 /* handle siblings events */
6340 for (i = 0; i < event_data->NumEntries; i++) {6272 for (i = 0; i < event_data->NumEntries; i++) {
6341 if (fw_event->ignore) {6273 if (fw_event->ignore) {
6342 dewtprintk(ioc, pr_info(MPT3SAS_FMT6274 dewtprintk(ioc,
6343 "ignoring expander event\n", ioc->name));6275 ioc_info(ioc, "ignoring expander event\n"));
6344 return 0;6276 return 0;
6345 }6277 }
6346 if (ioc->remove_host || ioc->pci_error_recovery)6278 if (ioc->remove_host || ioc->pci_error_recovery)
@@ -6464,15 +6396,14 @@ _scsih_sas_device_status_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 117 unmodified lines
6464 reason_str = "unknown reason";6396 reason_str = "unknown reason";
6465 break;6397 break;
6466 }6398 }
6467 pr_info(MPT3SAS_FMT "device status change: (%s)\n"6399 ioc_info(ioc, "device status change: (%s)\thandle(0x%04x), sas address(0x%016llx), tag(%d)",
6468 "\thandle(0x%04x), sas address(0x%016llx), tag(%d)",6400 reason_str, le16_to_cpu(event_data->DevHandle),
6469 ioc->name, reason_str, le16_to_cpu(event_data->DevHandle),6401 (u64)le64_to_cpu(event_data->SASAddress),
6470 (unsigned long long)le64_to_cpu(event_data->SASAddress),6402 le16_to_cpu(event_data->TaskTag));
6471 le16_to_cpu(event_data->TaskTag));
6472 if (event_data->ReasonCode == MPI2_EVENT_SAS_DEV_STAT_RC_SMART_DATA)6403 if (event_data->ReasonCode == MPI2_EVENT_SAS_DEV_STAT_RC_SMART_DATA)
6473 pr_info(MPT3SAS_FMT ", ASC(0x%x), ASCQ(0x%x)\n", ioc->name,6404 pr_cont(", ASC(0x%x), ASCQ(0x%x)\n",
6474 event_data->ASC, event_data->ASCQ);6405 event_data->ASC, event_data->ASCQ);
6475 pr_info("\n");6406 pr_cont("\n");
6476}6407}
6477 6408
6478/**6409/**
@@ -6605,20 +6536,16 @@ _scsih_check_pcie_access_status(struct MPT3SAS_ADAPTER *ioc, u64 wwid, · 126 unmodified lines
6605 desc = "nvme failure status";6536 desc = "nvme failure status";
6606 break;6537 break;
6607 default:6538 default:
6608 pr_err(MPT3SAS_FMT6539 ioc_err(ioc, "NVMe discovery error(0x%02x): wwid(0x%016llx), handle(0x%04x)\n",
6609 " NVMe discovery error(0x%02x): wwid(0x%016llx),"6540 access_status, (u64)wwid, handle);
6610 "handle(0x%04x)\n", ioc->name, access_status,
6611 (unsigned long long)wwid, handle);
6612 return rc;6541 return rc;
6613 }6542 }
6614 6543
6615 if (!rc)6544 if (!rc)
6616 return rc;6545 return rc;
6617 6546
6618 pr_info(MPT3SAS_FMT6547 ioc_info(ioc, "NVMe discovery error(%s): wwid(0x%016llx), handle(0x%04x)\n",
6619 "NVMe discovery error(%s): wwid(0x%016llx), handle(0x%04x)\n",6548 desc, (u64)wwid, handle);
6620 ioc->name, desc,
6621 (unsigned long long)wwid, handle);
6622 return rc;6549 return rc;
6623}6550}
6624 6551
@@ -6634,22 +6561,22 @@ _scsih_pcie_device_remove_from_sml(struct MPT3SAS_ADAPTER *ioc, · 9 unmodified lines
6634{6561{
6635 struct MPT3SAS_TARGET *sas_target_priv_data;6562 struct MPT3SAS_TARGET *sas_target_priv_data;
6636 6563
6637 dewtprintk(ioc, pr_info(MPT3SAS_FMT6564 dewtprintk(ioc,
6638 "%s: enter: handle(0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,6565 ioc_info(ioc, "%s: enter: handle(0x%04x), wwid(0x%016llx)\n",
6639 pcie_device->handle, (unsigned long long)6566 __func__,
6640 pcie_device->wwid));6567 pcie_device->handle, (u64)pcie_device->wwid));
6641 if (pcie_device->enclosure_handle != 0)6568 if (pcie_device->enclosure_handle != 0)
6642 dewtprintk(ioc, pr_info(MPT3SAS_FMT6569 dewtprintk(ioc,
6643 "%s: enter: enclosure logical id(0x%016llx), slot(%d)\n",6570 ioc_info(ioc, "%s: enter: enclosure logical id(0x%016llx), slot(%d)\n",
6644 ioc->name, __func__,6571 __func__,
6645 (unsigned long long)pcie_device->enclosure_logical_id,6572 (u64)pcie_device->enclosure_logical_id,
6646 pcie_device->slot));6573 pcie_device->slot));
6647 if (pcie_device->connector_name[0] != '\0')6574 if (pcie_device->connector_name[0] != '\0')
6648 dewtprintk(ioc, pr_info(MPT3SAS_FMT6575 dewtprintk(ioc,
6649 "%s: enter: enclosure level(0x%04x), connector name( %s)\n",6576 ioc_info(ioc, "%s: enter: enclosure level(0x%04x), connector name(%s)\n",
6650 ioc->name, __func__,6577 __func__,
6651 pcie_device->enclosure_level,6578 pcie_device->enclosure_level,
6652 pcie_device->connector_name));6579 pcie_device->connector_name));
6653 6580
6654 if (pcie_device->starget && pcie_device->starget->hostdata) {6581 if (pcie_device->starget && pcie_device->starget->hostdata) {
6655 sas_target_priv_data = pcie_device->starget->hostdata;6582 sas_target_priv_data = pcie_device->starget->hostdata;
@@ -6658,39 +6585,35 @@ _scsih_pcie_device_remove_from_sml(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines
6658 sas_target_priv_data->handle = MPT3SAS_INVALID_DEVICE_HANDLE;6585 sas_target_priv_data->handle = MPT3SAS_INVALID_DEVICE_HANDLE;
6659 }6586 }
6660 6587
6661 pr_info(MPT3SAS_FMT6588 ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n",
6662 "removing handle(0x%04x), wwid (0x%016llx)\n",6589 pcie_device->handle, (u64)pcie_device->wwid);
6663 ioc->name, pcie_device->handle,
6664 (unsigned long long) pcie_device->wwid);
6665 if (pcie_device->enclosure_handle != 0)6590 if (pcie_device->enclosure_handle != 0)
6666 pr_info(MPT3SAS_FMT6591 ioc_info(ioc, "removing : enclosure logical id(0x%016llx), slot(%d)\n",
6667 "removing : enclosure logical id(0x%016llx), slot(%d)\n",6592 (u64)pcie_device->enclosure_logical_id,
6668 ioc->name,6593 pcie_device->slot);
6669 (unsigned long long)pcie_device->enclosure_logical_id,
6670 pcie_device->slot);
6671 if (pcie_device->connector_name[0] != '\0')6594 if (pcie_device->connector_name[0] != '\0')
6672 pr_info(MPT3SAS_FMT6595 ioc_info(ioc, "removing: enclosure level(0x%04x), connector name( %s)\n",
6673 "removing: enclosure level(0x%04x), connector name( %s)\n",6596 pcie_device->enclosure_level,
6674 ioc->name, pcie_device->enclosure_level,6597 pcie_device->connector_name);
6675 pcie_device->connector_name);
6676 6598
6677 if (pcie_device->starget)6599 if (pcie_device->starget)
6678 scsi_remove_target(&pcie_device->starget->dev);6600 scsi_remove_target(&pcie_device->starget->dev);
6679 dewtprintk(ioc, pr_info(MPT3SAS_FMT6601 dewtprintk(ioc,
6680 "%s: exit: handle(0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,6602 ioc_info(ioc, "%s: exit: handle(0x%04x), wwid(0x%016llx)\n",
6681 pcie_device->handle, (unsigned long long)6603 __func__,
6682 pcie_device->wwid));6604 pcie_device->handle, (u64)pcie_device->wwid));
6683 if (pcie_device->enclosure_handle != 0)6605 if (pcie_device->enclosure_handle != 0)
6684 dewtprintk(ioc, pr_info(MPT3SAS_FMT6606 dewtprintk(ioc,
6685 "%s: exit: enclosure logical id(0x%016llx), slot(%d)\n",6607 ioc_info(ioc, "%s: exit: enclosure logical id(0x%016llx), slot(%d)\n",
6686 ioc->name, __func__,6608 __func__,
6687 (unsigned long long)pcie_device->enclosure_logical_id,6609 (u64)pcie_device->enclosure_logical_id,
6688 pcie_device->slot));6610 pcie_device->slot));
6689 if (pcie_device->connector_name[0] != '\0')6611 if (pcie_device->connector_name[0] != '\0')
6690 dewtprintk(ioc, pr_info(MPT3SAS_FMT6612 dewtprintk(ioc,
6691 "%s: exit: enclosure level(0x%04x), connector name( %s)\n",6613 ioc_info(ioc, "%s: exit: enclosure level(0x%04x), connector name( %s)\n",
6692 ioc->name, __func__, pcie_device->enclosure_level,6614 __func__,
6693 pcie_device->connector_name));6615 pcie_device->enclosure_level,
6616 pcie_device->connector_name));
6694 6617
6695 kfree(pcie_device->serial_number);6618 kfree(pcie_device->serial_number);
6696}6619}
@@ -6760,9 +6683,8 @@ _scsih_pcie_check_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 63 unmodified lines
6760 /* check if device is present */6683 /* check if device is present */
6761 if (!(le32_to_cpu(pcie_device_pg0.Flags) &6684 if (!(le32_to_cpu(pcie_device_pg0.Flags) &
6762 MPI26_PCIEDEV0_FLAGS_DEVICE_PRESENT)) {6685 MPI26_PCIEDEV0_FLAGS_DEVICE_PRESENT)) {
6763 pr_info(MPT3SAS_FMT6686 ioc_info(ioc, "device is not present handle(0x%04x), flags!!!\n",
6764 "device is not present handle(0x%04x), flags!!!\n",6687 handle);
6765 ioc->name, handle);
6766 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);6688 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
6767 pcie_device_put(pcie_device);6689 pcie_device_put(pcie_device);
6768 return;6690 return;
@@ -6806,16 +6728,15 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 37 unmodified lines
6806 6728
6807 if ((mpt3sas_config_get_pcie_device_pg0(ioc, &mpi_reply,6729 if ((mpt3sas_config_get_pcie_device_pg0(ioc, &mpi_reply,
6808 &pcie_device_pg0, MPI26_PCIE_DEVICE_PGAD_FORM_HANDLE, handle))) {6730 &pcie_device_pg0, MPI26_PCIE_DEVICE_PGAD_FORM_HANDLE, handle))) {
6809 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",6731 ioc_err(ioc, "failure at %s:%d/%s()!\n",
6810 ioc->name, __FILE__, __LINE__, __func__);6732 __FILE__, __LINE__, __func__);
6811 return 0;6733 return 0;
6812 }6734 }
6813 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &6735 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
6814 MPI2_IOCSTATUS_MASK;6736 MPI2_IOCSTATUS_MASK;
6815 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {6737 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
6816 pr_err(MPT3SAS_FMT6738 ioc_err(ioc, "failure at %s:%d/%s()!\n",
6817 "failure at %s:%d/%s()!\n",6739 __FILE__, __LINE__, __func__);
6818 ioc->name, __FILE__, __LINE__, __func__);
6819 return 0;6740 return 0;
6820 }6741 }
6821 6742
@@ -6825,9 +6746,8 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 3 unmodified lines
6825 /* check if device is present */6746 /* check if device is present */
6826 if (!(le32_to_cpu(pcie_device_pg0.Flags) &6747 if (!(le32_to_cpu(pcie_device_pg0.Flags) &
6827 MPI26_PCIEDEV0_FLAGS_DEVICE_PRESENT)) {6748 MPI26_PCIEDEV0_FLAGS_DEVICE_PRESENT)) {
6828 pr_err(MPT3SAS_FMT6749 ioc_err(ioc, "device is not present handle(0x04%x)!!!\n",
6829 "device is not present handle(0x04%x)!!!\n",6750 handle);
6830 ioc->name, handle);
6831 return 0;6751 return 0;
6832 }6752 }
6833 6753
@@ -6848,8 +6768,8 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 14 unmodified lines
6848 6768
6849 pcie_device = kzalloc(sizeof(struct _pcie_device), GFP_KERNEL);6769 pcie_device = kzalloc(sizeof(struct _pcie_device), GFP_KERNEL);
6850 if (!pcie_device) {6770 if (!pcie_device) {
6851 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",6771 ioc_err(ioc, "failure at %s:%d/%s()!\n",
6852 ioc->name, __FILE__, __LINE__, __func__);6772 __FILE__, __LINE__, __func__);
6853 return 0;6773 return 0;
6854 }6774 }
6855 6775
@@ -6890,16 +6810,16 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 34 unmodified lines
6890 /* TODO -- Add device name once FW supports it */6810 /* TODO -- Add device name once FW supports it */
6891 if (mpt3sas_config_get_pcie_device_pg2(ioc, &mpi_reply,6811 if (mpt3sas_config_get_pcie_device_pg2(ioc, &mpi_reply,
6892 &pcie_device_pg2, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle)) {6812 &pcie_device_pg2, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle)) {
6893 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",6813 ioc_err(ioc, "failure at %s:%d/%s()!\n",
6894 ioc->name, __FILE__, __LINE__, __func__);6814 __FILE__, __LINE__, __func__);
6895 kfree(pcie_device);6815 kfree(pcie_device);
6896 return 0;6816 return 0;
6897 }6817 }
6898 6818
6899 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK;6819 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK;
6900 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {6820 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
6901 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",6821 ioc_err(ioc, "failure at %s:%d/%s()!\n",
6902 ioc->name, __FILE__, __LINE__, __func__);6822 __FILE__, __LINE__, __func__);
6903 kfree(pcie_device);6823 kfree(pcie_device);
6904 return 0;6824 return 0;
6905 }6825 }
@@ -6956,8 +6876,7 @@ _scsih_pcie_topology_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 50 unmodified lines
6956 status_str = "unknown status";6876 status_str = "unknown status";
6957 break;6877 break;
6958 }6878 }
6959 pr_info(MPT3SAS_FMT "pcie topology change: (%s)\n",6879 ioc_info(ioc, "pcie topology change: (%s)\n", status_str);
6960 ioc->name, status_str);
6961 pr_info("\tswitch_handle(0x%04x), enclosure_handle(0x%04x)"6880 pr_info("\tswitch_handle(0x%04x), enclosure_handle(0x%04x)"
6962 "start_port(%02d), count(%d)\n",6881 "start_port(%02d), count(%d)\n",
6963 le16_to_cpu(event_data->SwitchDevHandle),6882 le16_to_cpu(event_data->SwitchDevHandle),
@@ -7030,16 +6949,15 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc, · 66 unmodified lines
7030 return;6949 return;
7031 6950
7032 if (fw_event->ignore) {6951 if (fw_event->ignore) {
7033 dewtprintk(ioc, pr_info(MPT3SAS_FMT "ignoring switch event\n",6952 dewtprintk(ioc, ioc_info(ioc, "ignoring switch event\n"));
7034 ioc->name));
7035 return;6953 return;
7036 }6954 }
7037 6955
7038 /* handle siblings events */6956 /* handle siblings events */
7039 for (i = 0; i < event_data->NumEntries; i++) {6957 for (i = 0; i < event_data->NumEntries; i++) {
7040 if (fw_event->ignore) {6958 if (fw_event->ignore) {
7041 dewtprintk(ioc, pr_info(MPT3SAS_FMT6959 dewtprintk(ioc,
7042 "ignoring switch event\n", ioc->name));6960 ioc_info(ioc, "ignoring switch event\n"));
7043 return;6961 return;
7044 }6962 }
7045 if (ioc->remove_host || ioc->pci_error_recovery)6963 if (ioc->remove_host || ioc->pci_error_recovery)
@@ -7084,9 +7002,9 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc, · 38 unmodified lines
7084 if (!test_bit(handle, ioc->pend_os_device_add))7002 if (!test_bit(handle, ioc->pend_os_device_add))
7085 break;7003 break;
7086 7004
7087 dewtprintk(ioc, pr_info(MPT3SAS_FMT7005 dewtprintk(ioc,
7088 "handle(0x%04x) device not found: convert "7006 ioc_info(ioc, "handle(0x%04x) device not found: convert event to a device add\n",
7089 "event to a device add\n", ioc->name, handle));7007 handle));
7090 event_data->PortEntry[i].PortStatus &= 0xF0;7008 event_data->PortEntry[i].PortStatus &= 0xF0;
7091 event_data->PortEntry[i].PortStatus |=7009 event_data->PortEntry[i].PortStatus |=
7092 MPI26_EVENT_PCIE_TOPO_PS_DEV_ADDED;7010 MPI26_EVENT_PCIE_TOPO_PS_DEV_ADDED;
@@ -7169,15 +7087,15 @@ _scsih_pcie_device_status_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 76 unmodified lines
7169 break;7087 break;
7170 }7088 }
7171 7089
7172 pr_info(MPT3SAS_FMT "PCIE device status change: (%s)\n"7090 ioc_info(ioc, "PCIE device status change: (%s)\n"
7173 "\thandle(0x%04x), WWID(0x%016llx), tag(%d)",7091 "\thandle(0x%04x), WWID(0x%016llx), tag(%d)",
7174 ioc->name, reason_str, le16_to_cpu(event_data->DevHandle),7092 reason_str, le16_to_cpu(event_data->DevHandle),
7175 (unsigned long long)le64_to_cpu(event_data->WWID),7093 (u64)le64_to_cpu(event_data->WWID),
7176 le16_to_cpu(event_data->TaskTag));7094 le16_to_cpu(event_data->TaskTag));
7177 if (event_data->ReasonCode == MPI26_EVENT_PCIDEV_STAT_RC_SMART_DATA)7095 if (event_data->ReasonCode == MPI26_EVENT_PCIDEV_STAT_RC_SMART_DATA)
7178 pr_info(MPT3SAS_FMT ", ASC(0x%x), ASCQ(0x%x)\n", ioc->name,7096 pr_cont(", ASC(0x%x), ASCQ(0x%x)\n",
7179 event_data->ASC, event_data->ASCQ);7097 event_data->ASC, event_data->ASCQ);
7180 pr_info("\n");7098 pr_cont("\n");
7181}7099}
7182 7100
7183/**7101/**
@@ -7255,12 +7173,12 @@ _scsih_sas_enclosure_dev_status_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 71 unmodified lines
7255 break;7173 break;
7256 }7174 }
7257 7175
7258 pr_info(MPT3SAS_FMT "enclosure status change: (%s)\n"7176 ioc_info(ioc, "enclosure status change: (%s)\n"
7259 "\thandle(0x%04x), enclosure logical id(0x%016llx)"7177 "\thandle(0x%04x), enclosure logical id(0x%016llx) number slots(%d)\n",
7260 " number slots(%d)\n", ioc->name, reason_str,7178 reason_str,
7261 le16_to_cpu(event_data->EnclosureHandle),7179 le16_to_cpu(event_data->EnclosureHandle),
7262 (unsigned long long)le64_to_cpu(event_data->EnclosureLogicalID),7180 (u64)le64_to_cpu(event_data->EnclosureLogicalID),
7263 le16_to_cpu(event_data->StartSlot));7181 le16_to_cpu(event_data->StartSlot));
7264}7182}
7265 7183
7266/**7184/**
@@ -7298,9 +7216,8 @@ _scsih_sas_enclosure_dev_status_change_event(struct MPT3SAS_ADAPTER *ioc, · 31 unmodified lines
7298 kzalloc(sizeof(struct _enclosure_node),7216 kzalloc(sizeof(struct _enclosure_node),
7299 GFP_KERNEL);7217 GFP_KERNEL);
7300 if (!enclosure_dev) {7218 if (!enclosure_dev) {
7301 pr_info(MPT3SAS_FMT7219 ioc_info(ioc, "failure at %s:%d/%s()!\n",
7302 "failure at %s:%d/%s()!\n", ioc->name,7220 __FILE__, __LINE__, __func__);
7303 __FILE__, __LINE__, __func__);
7304 return;7221 return;
7305 }7222 }
7306 rc = mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply,7223 rc = mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply,
@@ -7358,10 +7275,8 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 51 unmodified lines
7358 u8 task_abort_retries;7275 u8 task_abort_retries;
7359 7276
7360 mutex_lock(&ioc->tm_cmds.mutex);7277 mutex_lock(&ioc->tm_cmds.mutex);
7361 pr_info(MPT3SAS_FMT7278 ioc_info(ioc, "%s: enter: phy number(%d), width(%d)\n",
7362 "%s: enter: phy number(%d), width(%d)\n",7279 __func__, event_data->PhyNum, event_data->PortWidth);
7363 ioc->name, __func__, event_data->PhyNum,
7364 event_data->PortWidth);
7365 7280
7366 _scsih_block_io_all_device(ioc);7281 _scsih_block_io_all_device(ioc);
7367 7282
@@ -7371,12 +7286,12 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
7371 7286
7372 /* sanity checks for retrying this loop */7287 /* sanity checks for retrying this loop */
7373 if (max_retries++ == 5) {7288 if (max_retries++ == 5) {
7374 dewtprintk(ioc, pr_info(MPT3SAS_FMT "%s: giving up\n",7289 dewtprintk(ioc, ioc_info(ioc, "%s: giving up\n", __func__));
7375 ioc->name, __func__));
7376 goto out;7290 goto out;
7377 } else if (max_retries > 1)7291 } else if (max_retries > 1)
7378 dewtprintk(ioc, pr_info(MPT3SAS_FMT "%s: %d retry\n",7292 dewtprintk(ioc,
7379 ioc->name, __func__, max_retries - 1));7293 ioc_info(ioc, "%s: %d retry\n",
7294 __func__, max_retries - 1));
7380 7295
7381 termination_count = 0;7296 termination_count = 0;
7382 query_count = 0;7297 query_count = 0;
@@ -7443,9 +7358,9 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 60 unmodified lines
7443 task_abort_retries = 0;7358 task_abort_retries = 0;
7444 tm_retry:7359 tm_retry:
7445 if (task_abort_retries++ == 60) {7360 if (task_abort_retries++ == 60) {
7446 dewtprintk(ioc, pr_info(MPT3SAS_FMT7361 dewtprintk(ioc,
7447 "%s: ABORT_TASK: giving up\n", ioc->name,7362 ioc_info(ioc, "%s: ABORT_TASK: giving up\n",
7448 __func__));7363 __func__));
7449 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);7364 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
7450 goto broadcast_aen_retry;7365 goto broadcast_aen_retry;
7451 }7366 }
@@ -7474,9 +7389,10 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 22 unmodified lines
7474 }7389 }
7475 7390
7476 if (ioc->broadcast_aen_pending) {7391 if (ioc->broadcast_aen_pending) {
7477 dewtprintk(ioc, pr_info(MPT3SAS_FMT7392 dewtprintk(ioc,
7478 "%s: loop back due to pending AEN\n",7393 ioc_info(ioc,
7479 ioc->name, __func__));7394 "%s: loop back due to pending AEN\n",
7395 __func__));
7480 ioc->broadcast_aen_pending = 0;7396 ioc->broadcast_aen_pending = 0;
7481 goto broadcast_aen_retry;7397 goto broadcast_aen_retry;
7482 }7398 }
@@ -7485,9 +7401,9 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines
7485 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);7401 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
7486 out_no_lock:7402 out_no_lock:
7487 7403
7488 dewtprintk(ioc, pr_info(MPT3SAS_FMT7404 dewtprintk(ioc,
7489 "%s - exit, query_count = %d termination_count = %d\n",7405 ioc_info(ioc, "%s - exit, query_count = %d termination_count = %d\n",
7490 ioc->name, __func__, query_count, termination_count));7406 __func__, query_count, termination_count));
7491 7407
7492 ioc->broadcast_aen_busy = 0;7408 ioc->broadcast_aen_busy = 0;
7493 if (!ioc->shost_recovery)7409 if (!ioc->shost_recovery)
@@ -7509,13 +7425,13 @@ _scsih_sas_discovery_event(struct MPT3SAS_ADAPTER *ioc, · 15 unmodified lines
7509 (Mpi2EventDataSasDiscovery_t *) fw_event->event_data;7425 (Mpi2EventDataSasDiscovery_t *) fw_event->event_data;
7510 7426
7511 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) {7427 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) {
7512 pr_info(MPT3SAS_FMT "discovery event: (%s)", ioc->name,7428 ioc_info(ioc, "discovery event: (%s)",
7513 (event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED) ?7429 event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED ?
7514 "start" : "stop");7430 "start" : "stop");
7515 if (event_data->DiscoveryStatus)7431 if (event_data->DiscoveryStatus)
7516 pr_info("discovery_status(0x%08x)",7432 pr_cont("discovery_status(0x%08x)",
7517 le32_to_cpu(event_data->DiscoveryStatus));7433 le32_to_cpu(event_data->DiscoveryStatus));
7518 pr_info("\n");7434 pr_cont("\n");
7519 }7435 }
7520 7436
7521 if (event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED &&7437 if (event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED &&
@@ -7545,20 +7461,16 @@ _scsih_sas_device_discovery_error_event(struct MPT3SAS_ADAPTER *ioc, · 23 unmodified lines
7545 7461
7546 switch (event_data->ReasonCode) {7462 switch (event_data->ReasonCode) {
7547 case MPI25_EVENT_SAS_DISC_ERR_SMP_FAILED:7463 case MPI25_EVENT_SAS_DISC_ERR_SMP_FAILED:
7548 pr_warn(MPT3SAS_FMT "SMP command sent to the expander"7464 ioc_warn(ioc, "SMP command sent to the expander (handle:0x%04x, sas_address:0x%016llx, physical_port:0x%02x) has failed\n",
7549 "(handle:0x%04x, sas_address:0x%016llx,"7465 le16_to_cpu(event_data->DevHandle),
7550 "physical_port:0x%02x) has failed",7466 (u64)le64_to_cpu(event_data->SASAddress),
7551 ioc->name, le16_to_cpu(event_data->DevHandle),7467 event_data->PhysicalPort);
7552 (unsigned long long)le64_to_cpu(event_data->SASAddress),
7553 event_data->PhysicalPort);
7554 break;7468 break;
7555 case MPI25_EVENT_SAS_DISC_ERR_SMP_TIMEOUT:7469 case MPI25_EVENT_SAS_DISC_ERR_SMP_TIMEOUT:
7556 pr_warn(MPT3SAS_FMT "SMP command sent to the expander"7470 ioc_warn(ioc, "SMP command sent to the expander (handle:0x%04x, sas_address:0x%016llx, physical_port:0x%02x) has timed out\n",
7557 "(handle:0x%04x, sas_address:0x%016llx,"7471 le16_to_cpu(event_data->DevHandle),
7558 "physical_port:0x%02x) has timed out",7472 (u64)le64_to_cpu(event_data->SASAddress),
7559 ioc->name, le16_to_cpu(event_data->DevHandle),7473 event_data->PhysicalPort);
7560 (unsigned long long)le64_to_cpu(event_data->SASAddress),
7561 event_data->PhysicalPort);
7562 break;7474 break;
7563 default:7475 default:
7564 break;7476 break;
@@ -7581,11 +7493,10 @@ _scsih_pcie_enumeration_event(struct MPT3SAS_ADAPTER *ioc, · 16 unmodified lines
7581 if (!(ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK))7493 if (!(ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK))
7582 return;7494 return;
7583 7495
7584 pr_info(MPT3SAS_FMT "pcie enumeration event: (%s) Flag 0x%02x",7496 ioc_info(ioc, "pcie enumeration event: (%s) Flag 0x%02x",
7585 ioc->name,7497 (event_data->ReasonCode == MPI26_EVENT_PCIE_ENUM_RC_STARTED) ?
7586 (event_data->ReasonCode == MPI26_EVENT_PCIE_ENUM_RC_STARTED) ?7498 "started" : "completed",
7587 "started" : "completed",7499 event_data->Flags);
7588 event_data->Flags);
7589 if (event_data->EnumerationStatus)7500 if (event_data->EnumerationStatus)
7590 pr_cont("enumeration_status(0x%08x)",7501 pr_cont("enumeration_status(0x%08x)",
7591 le32_to_cpu(event_data->EnumerationStatus));7502 le32_to_cpu(event_data->EnumerationStatus));
@@ -7617,8 +7528,7 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num) · 25 unmodified lines
7617 mutex_lock(&ioc->scsih_cmds.mutex);7528 mutex_lock(&ioc->scsih_cmds.mutex);
7618 7529
7619 if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) {7530 if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) {
7620 pr_err(MPT3SAS_FMT "%s: scsih_cmd in use\n",7531 ioc_err(ioc, "%s: scsih_cmd in use\n", __func__);
7621 ioc->name, __func__);
7622 rc = -EAGAIN;7532 rc = -EAGAIN;
7623 goto out;7533 goto out;
7624 }7534 }
@@ -7626,8 +7536,7 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num) · 1 unmodified line
7626 7536
7627 smid = mpt3sas_base_get_smid(ioc, ioc->scsih_cb_idx);7537 smid = mpt3sas_base_get_smid(ioc, ioc->scsih_cb_idx);
7628 if (!smid) {7538 if (!smid) {
7629 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",7539 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
7630 ioc->name, __func__);
7631 ioc->scsih_cmds.status = MPT3_CMD_NOT_USED;7540 ioc->scsih_cmds.status = MPT3_CMD_NOT_USED;
7632 rc = -EAGAIN;7541 rc = -EAGAIN;
7633 goto out;7542 goto out;
@@ -7641,9 +7550,9 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num) · 7 unmodified lines
7641 mpi_request->Action = MPI2_RAID_ACTION_PHYSDISK_HIDDEN;7550 mpi_request->Action = MPI2_RAID_ACTION_PHYSDISK_HIDDEN;
7642 mpi_request->PhysDiskNum = phys_disk_num;7551 mpi_request->PhysDiskNum = phys_disk_num;
7643 7552
7644 dewtprintk(ioc, pr_info(MPT3SAS_FMT "IR RAID_ACTION: turning fast "\7553 dewtprintk(ioc,
7645 "path on for handle(0x%04x), phys_disk_num (0x%02x)\n", ioc->name,7554 ioc_info(ioc, "IR RAID_ACTION: turning fast path on for handle(0x%04x), phys_disk_num (0x%02x)\n",
7646 handle, phys_disk_num));7555 handle, phys_disk_num));
7647 7556
7648 init_completion(&ioc->scsih_cmds.done);7557 init_completion(&ioc->scsih_cmds.done);
7649 mpt3sas_base_put_smid_default(ioc, smid);7558 mpt3sas_base_put_smid_default(ioc, smid);
@@ -7668,15 +7577,13 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num) · 18 unmodified lines
7668 log_info = 0;7577 log_info = 0;
7669 ioc_status &= MPI2_IOCSTATUS_MASK;7578 ioc_status &= MPI2_IOCSTATUS_MASK;
7670 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {7579 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
7671 dewtprintk(ioc, pr_info(MPT3SAS_FMT7580 dewtprintk(ioc,
7672 "IR RAID_ACTION: failed: ioc_status(0x%04x), "7581 ioc_info(ioc, "IR RAID_ACTION: failed: ioc_status(0x%04x), loginfo(0x%08x)!!!\n",
7673 "loginfo(0x%08x)!!!\n", ioc->name, ioc_status,7582 ioc_status, log_info));
7674 log_info));
7675 rc = -EFAULT;7583 rc = -EFAULT;
7676 } else7584 } else
7677 dewtprintk(ioc, pr_info(MPT3SAS_FMT7585 dewtprintk(ioc,
7678 "IR RAID_ACTION: completed successfully\n",7586 ioc_info(ioc, "IR RAID_ACTION: completed successfully\n"));
7679 ioc->name));
7680 }7587 }
7681 7588
7682 out:7589 out:
@@ -7721,9 +7628,8 @@ _scsih_sas_volume_add(struct MPT3SAS_ADAPTER *ioc, · 38 unmodified lines
7721 7628
7722 mpt3sas_config_get_volume_wwid(ioc, handle, &wwid);7629 mpt3sas_config_get_volume_wwid(ioc, handle, &wwid);
7723 if (!wwid) {7630 if (!wwid) {
7724 pr_err(MPT3SAS_FMT7631 ioc_err(ioc, "failure at %s:%d/%s()!\n",
7725 "failure at %s:%d/%s()!\n", ioc->name,7632 __FILE__, __LINE__, __func__);
7726 __FILE__, __LINE__, __func__);
7727 return;7633 return;
7728 }7634 }
7729 7635
@@ -7736,9 +7642,8 @@ _scsih_sas_volume_add(struct MPT3SAS_ADAPTER *ioc, · 6 unmodified lines
7736 7642
7737 raid_device = kzalloc(sizeof(struct _raid_device), GFP_KERNEL);7643 raid_device = kzalloc(sizeof(struct _raid_device), GFP_KERNEL);
7738 if (!raid_device) {7644 if (!raid_device) {
7739 pr_err(MPT3SAS_FMT7645 ioc_err(ioc, "failure at %s:%d/%s()!\n",
7740 "failure at %s:%d/%s()!\n", ioc->name,7646 __FILE__, __LINE__, __func__);
7741 __FILE__, __LINE__, __func__);
7742 return;7647 return;
7743 }7648 }
7744 7649
@@ -7781,9 +7686,8 @@ _scsih_sas_volume_delete(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 36 unmodified lines
7781 sas_target_priv_data = starget->hostdata;7686 sas_target_priv_data = starget->hostdata;
7782 sas_target_priv_data->deleted = 1;7687 sas_target_priv_data->deleted = 1;
7783 }7688 }
7784 pr_info(MPT3SAS_FMT "removing handle(0x%04x), wwid(0x%016llx)\n",7689 ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n",
7785 ioc->name, raid_device->handle,7690 raid_device->handle, (u64)raid_device->wwid);
7786 (unsigned long long) raid_device->wwid);
7787 list_del(&raid_device->list);7691 list_del(&raid_device->list);
7788 kfree(raid_device);7692 kfree(raid_device);
7789 }7693 }
@@ -7925,16 +7829,16 @@ _scsih_sas_pd_add(struct MPT3SAS_ADAPTER *ioc, · 135 unmodified lines
7925 7829
7926 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,7830 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
7927 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {7831 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
7928 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",7832 ioc_err(ioc, "failure at %s:%d/%s()!\n",
7929 ioc->name, __FILE__, __LINE__, __func__);7833 __FILE__, __LINE__, __func__);
7930 return;7834 return;
7931 }7835 }
7932 7836
7933 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &7837 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
7934 MPI2_IOCSTATUS_MASK;7838 MPI2_IOCSTATUS_MASK;
7935 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {7839 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
7936 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",7840 ioc_err(ioc, "failure at %s:%d/%s()!\n",
7937 ioc->name, __FILE__, __LINE__, __func__);7841 __FILE__, __LINE__, __func__);
7938 return;7842 return;
7939 }7843 }
7940 7844
@@ -7964,10 +7868,10 @@ _scsih_sas_ir_config_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 23 unmodified lines
7964 7868
7965 element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0];7869 element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0];
7966 7870
7967 pr_info(MPT3SAS_FMT "raid config change: (%s), elements(%d)\n",7871 ioc_info(ioc, "raid config change: (%s), elements(%d)\n",
7968 ioc->name, (le32_to_cpu(event_data->Flags) &7872 le32_to_cpu(event_data->Flags) & MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG ?
7969 MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG) ?7873 "foreign" : "native",
7970 "foreign" : "native", event_data->NumElements);7874 event_data->NumElements);
7971 for (i = 0; i < event_data->NumElements; i++, element++) {7875 for (i = 0; i < event_data->NumElements; i++, element++) {
7972 switch (element->ReasonCode) {7876 switch (element->ReasonCode) {
7973 case MPI2_EVENT_IR_CHANGE_RC_ADDED:7877 case MPI2_EVENT_IR_CHANGE_RC_ADDED:
@@ -8123,10 +8027,11 @@ _scsih_sas_ir_volume_event(struct MPT3SAS_ADAPTER *ioc, · 149 unmodified lines
8123 handle = le16_to_cpu(event_data->VolDevHandle);8027 handle = le16_to_cpu(event_data->VolDevHandle);
8124 state = le32_to_cpu(event_data->NewValue);8028 state = le32_to_cpu(event_data->NewValue);
8125 if (!ioc->hide_ir_msg)8029 if (!ioc->hide_ir_msg)
8126 dewtprintk(ioc, pr_info(MPT3SAS_FMT8030 dewtprintk(ioc,
8127 "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n",8031 ioc_info(ioc, "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n",
8128 ioc->name, __func__, handle,8032 __func__, handle,
8129 le32_to_cpu(event_data->PreviousValue), state));8033 le32_to_cpu(event_data->PreviousValue),
8034 state));
8130 switch (state) {8035 switch (state) {
8131 case MPI2_RAID_VOL_STATE_MISSING:8036 case MPI2_RAID_VOL_STATE_MISSING:
8132 case MPI2_RAID_VOL_STATE_FAILED:8037 case MPI2_RAID_VOL_STATE_FAILED:
@@ -8146,17 +8051,15 @@ _scsih_sas_ir_volume_event(struct MPT3SAS_ADAPTER *ioc, · 13 unmodified lines
8146 8051
8147 mpt3sas_config_get_volume_wwid(ioc, handle, &wwid);8052 mpt3sas_config_get_volume_wwid(ioc, handle, &wwid);
8148 if (!wwid) {8053 if (!wwid) {
8149 pr_err(MPT3SAS_FMT8054 ioc_err(ioc, "failure at %s:%d/%s()!\n",
8150 "failure at %s:%d/%s()!\n", ioc->name,8055 __FILE__, __LINE__, __func__);
8151 __FILE__, __LINE__, __func__);
8152 break;8056 break;
8153 }8057 }
8154 8058
8155 raid_device = kzalloc(sizeof(struct _raid_device), GFP_KERNEL);8059 raid_device = kzalloc(sizeof(struct _raid_device), GFP_KERNEL);
8156 if (!raid_device) {8060 if (!raid_device) {
8157 pr_err(MPT3SAS_FMT8061 ioc_err(ioc, "failure at %s:%d/%s()!\n",
8158 "failure at %s:%d/%s()!\n", ioc->name,8062 __FILE__, __LINE__, __func__);
8159 __FILE__, __LINE__, __func__);
8160 break;8063 break;
8161 }8064 }
8162 8065
@@ -8207,10 +8110,11 @@ _scsih_sas_ir_physical_disk_event(struct MPT3SAS_ADAPTER *ioc, · 44 unmodified lines
8207 state = le32_to_cpu(event_data->NewValue);8110 state = le32_to_cpu(event_data->NewValue);
8208 8111
8209 if (!ioc->hide_ir_msg)8112 if (!ioc->hide_ir_msg)
8210 dewtprintk(ioc, pr_info(MPT3SAS_FMT8113 dewtprintk(ioc,
8211 "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n",8114 ioc_info(ioc, "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n",
8212 ioc->name, __func__, handle,8115 __func__, handle,
8213 le32_to_cpu(event_data->PreviousValue), state));8116 le32_to_cpu(event_data->PreviousValue),
8117 state));
8214 8118
8215 switch (state) {8119 switch (state) {
8216 case MPI2_RAID_PD_STATE_ONLINE:8120 case MPI2_RAID_PD_STATE_ONLINE:
@@ -8231,16 +8135,16 @@ _scsih_sas_ir_physical_disk_event(struct MPT3SAS_ADAPTER *ioc, · 14 unmodified lines
8231 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply,8135 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply,
8232 &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE,8136 &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE,
8233 handle))) {8137 handle))) {
8234 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",8138 ioc_err(ioc, "failure at %s:%d/%s()!\n",
8235 ioc->name, __FILE__, __LINE__, __func__);8139 __FILE__, __LINE__, __func__);
8236 return;8140 return;
8237 }8141 }
8238 8142
8239 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &8143 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
8240 MPI2_IOCSTATUS_MASK;8144 MPI2_IOCSTATUS_MASK;
8241 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {8145 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
8242 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",8146 ioc_err(ioc, "failure at %s:%d/%s()!\n",
8243 ioc->name, __FILE__, __LINE__, __func__);8147 __FILE__, __LINE__, __func__);
8244 return;8148 return;
8245 }8149 }
8246 8150
@@ -8294,11 +8198,10 @@ _scsih_sas_ir_operation_status_event_debug(struct MPT3SAS_ADAPTER *ioc, · 47 unmodified lines
8294 if (!reason_str)8198 if (!reason_str)
8295 return;8199 return;
8296 8200
8297 pr_info(MPT3SAS_FMT "raid operational status: (%s)" \8201 ioc_info(ioc, "raid operational status: (%s)\thandle(0x%04x), percent complete(%d)\n",
8298 "\thandle(0x%04x), percent complete(%d)\n",8202 reason_str,
8299 ioc->name, reason_str,8203 le16_to_cpu(event_data->VolDevHandle),
8300 le16_to_cpu(event_data->VolDevHandle),8204 event_data->PercentComplete);
8301 event_data->PercentComplete);
8302}8205}
8303 8206
8304/**8207/**
@@ -8379,9 +8282,8 @@ Mpi2SasDevicePage0_t *sas_device_pg0) · 74 unmodified lines
8379 mpt3sas_scsih_enclosure_find_by_handle(ioc,8282 mpt3sas_scsih_enclosure_find_by_handle(ioc,
8380 le16_to_cpu(sas_device_pg0->EnclosureHandle));8283 le16_to_cpu(sas_device_pg0->EnclosureHandle));
8381 if (enclosure_dev == NULL)8284 if (enclosure_dev == NULL)
8382 pr_info(MPT3SAS_FMT "Enclosure handle(0x%04x)"8285 ioc_info(ioc, "Enclosure handle(0x%04x) doesn't match with enclosure device!\n",
8383 "doesn't match with enclosure device!\n",8286 sas_device_pg0->EnclosureHandle);
8384 ioc->name, sas_device_pg0->EnclosureHandle);
8385 }8287 }
8386 spin_lock_irqsave(&ioc->sas_device_lock, flags);8288 spin_lock_irqsave(&ioc->sas_device_lock, flags);
8387 list_for_each_entry(sas_device, &ioc->sas_device_list, list) {8289 list_for_each_entry(sas_device, &ioc->sas_device_list, list) {
@@ -8475,8 +8377,7 @@ _scsih_create_enclosure_list_after_reset(struct MPT3SAS_ADAPTER *ioc) · 87 unmodified lines
8475 enclosure_dev =8377 enclosure_dev =
8476 kzalloc(sizeof(struct _enclosure_node), GFP_KERNEL);8378 kzalloc(sizeof(struct _enclosure_node), GFP_KERNEL);
8477 if (!enclosure_dev) {8379 if (!enclosure_dev) {
8478 pr_err(MPT3SAS_FMT8380 ioc_err(ioc, "failure at %s:%d/%s()!\n",
8479 "failure at %s:%d/%s()!\n", ioc->name,
8480 __FILE__, __LINE__, __func__);8381 __FILE__, __LINE__, __func__);
8481 return;8382 return;
8482 }8383 }
@@ -8513,7 +8414,7 @@ _scsih_search_responding_sas_devices(struct MPT3SAS_ADAPTER *ioc) · 30 unmodified lines
8513 u16 handle;8414 u16 handle;
8514 u32 device_info;8415 u32 device_info;
8515 8416
8516 pr_info(MPT3SAS_FMT "search for end-devices: start\n", ioc->name);8417 ioc_info(ioc, "search for end-devices: start\n");
8517 8418
8518 if (list_empty(&ioc->sas_device_list))8419 if (list_empty(&ioc->sas_device_list))
8519 goto out;8420 goto out;
@@ -8534,8 +8435,7 @@ _scsih_search_responding_sas_devices(struct MPT3SAS_ADAPTER *ioc) · 14 unmodified lines
8534 }8435 }
8535 8436
8536 out:8437 out:
8537 pr_info(MPT3SAS_FMT "search for end-devices: complete\n",8438 ioc_info(ioc, "search for end-devices: complete\n");
8538 ioc->name);
8539}8439}
8540 8440
8541/**8441/**
@@ -8628,7 +8528,7 @@ _scsih_search_responding_pcie_devices(struct MPT3SAS_ADAPTER *ioc) · 86 unmodified lines
8628 u16 handle;8528 u16 handle;
8629 u32 device_info;8529 u32 device_info;
8630 8530
8631 pr_info(MPT3SAS_FMT "search for end-devices: start\n", ioc->name);8531 ioc_info(ioc, "search for end-devices: start\n");
8632 8532
8633 if (list_empty(&ioc->pcie_device_list))8533 if (list_empty(&ioc->pcie_device_list))
8634 goto out;8534 goto out;
@@ -8640,10 +8540,9 @@ _scsih_search_responding_pcie_devices(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
8640 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &8540 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
8641 MPI2_IOCSTATUS_MASK;8541 MPI2_IOCSTATUS_MASK;
8642 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {8542 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
8643 pr_info(MPT3SAS_FMT "\tbreak from %s: "8543 ioc_info(ioc, "\tbreak from %s: ioc_status(0x%04x), loginfo(0x%08x)\n",
8644 "ioc_status(0x%04x), loginfo(0x%08x)\n", ioc->name,8544 __func__, ioc_status,
8645 __func__, ioc_status,8545 le32_to_cpu(mpi_reply.IOCLogInfo));
8646 le32_to_cpu(mpi_reply.IOCLogInfo));
8647 break;8546 break;
8648 }8547 }
8649 handle = le16_to_cpu(pcie_device_pg0.DevHandle);8548 handle = le16_to_cpu(pcie_device_pg0.DevHandle);
@@ -8653,8 +8552,7 @@ _scsih_search_responding_pcie_devices(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
8653 _scsih_mark_responding_pcie_device(ioc, &pcie_device_pg0);8552 _scsih_mark_responding_pcie_device(ioc, &pcie_device_pg0);
8654 }8553 }
8655out:8554out:
8656 pr_info(MPT3SAS_FMT "search for PCIe end-devices: complete\n",8555 ioc_info(ioc, "search for PCIe end-devices: complete\n");
8657 ioc->name);
8658}8556}
8659 8557
8660/**8558/**
@@ -8735,8 +8633,7 @@ _scsih_search_responding_raid_devices(struct MPT3SAS_ADAPTER *ioc) · 74 unmodified lines
8735 if (!ioc->ir_firmware)8633 if (!ioc->ir_firmware)
8736 return;8634 return;
8737 8635
8738 pr_info(MPT3SAS_FMT "search for raid volumes: start\n",8636 ioc_info(ioc, "search for raid volumes: start\n");
8739 ioc->name);
8740 8637
8741 if (list_empty(&ioc->raid_device_list))8638 if (list_empty(&ioc->raid_device_list))
8742 goto out;8639 goto out;
@@ -8779,8 +8676,7 @@ _scsih_search_responding_raid_devices(struct MPT3SAS_ADAPTER *ioc) · 36 unmodified lines
8779 }8676 }
8780 }8677 }
8781 out:8678 out:
8782 pr_info(MPT3SAS_FMT "search for responding raid volumes: complete\n",8679 ioc_info(ioc, "search for responding raid volumes: complete\n");
8783 ioc->name);
8784}8680}
8785 8681
8786/**8682/**
@@ -8852,7 +8748,7 @@ _scsih_search_responding_expanders(struct MPT3SAS_ADAPTER *ioc) · 65 unmodified lines
8852 u64 sas_address;8748 u64 sas_address;
8853 u16 handle;8749 u16 handle;
8854 8750
8855 pr_info(MPT3SAS_FMT "search for expanders: start\n", ioc->name);8751 ioc_info(ioc, "search for expanders: start\n");
8856 8752
8857 if (list_empty(&ioc->sas_expander_list))8753 if (list_empty(&ioc->sas_expander_list))
8858 goto out;8754 goto out;
@@ -8875,7 +8771,7 @@ _scsih_search_responding_expanders(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines
8875 }8771 }
8876 8772
8877 out:8773 out:
8878 pr_info(MPT3SAS_FMT "search for expanders: complete\n", ioc->name);8774 ioc_info(ioc, "search for expanders: complete\n");
8879}8775}
8880 8776
8881/**8777/**
@@ -8893,12 +8789,10 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc) · 11 unmodified lines
8893 unsigned long flags;8789 unsigned long flags;
8894 LIST_HEAD(head);8790 LIST_HEAD(head);
8895 8791
8896 pr_info(MPT3SAS_FMT "removing unresponding devices: start\n",8792 ioc_info(ioc, "removing unresponding devices: start\n");
8897 ioc->name);
8898 8793
8899 /* removing unresponding end devices */8794 /* removing unresponding end devices */
8900 pr_info(MPT3SAS_FMT "removing unresponding devices: end-devices\n",8795 ioc_info(ioc, "removing unresponding devices: end-devices\n");
8901 ioc->name);
8902 /*8796 /*
8903 * Iterate, pulling off devices marked as non-responding. We become the8797 * Iterate, pulling off devices marked as non-responding. We become the
8904 * owner for the reference the list had on any object we prune.8798 * owner for the reference the list had on any object we prune.
@@ -8922,9 +8816,7 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc) · 17 unmodified lines
8922 sas_device_put(sas_device);8816 sas_device_put(sas_device);
8923 }8817 }
8924 8818
8925 pr_info(MPT3SAS_FMT8819 ioc_info(ioc, "Removing unresponding devices: pcie end-devices\n");
8926 " Removing unresponding devices: pcie end-devices\n"
8927 , ioc->name);
8928 INIT_LIST_HEAD(&head);8820 INIT_LIST_HEAD(&head);
8929 spin_lock_irqsave(&ioc->pcie_device_lock, flags);8821 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
8930 list_for_each_entry_safe(pcie_device, pcie_device_next,8822 list_for_each_entry_safe(pcie_device, pcie_device_next,
@@ -8944,8 +8836,7 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc) · 13 unmodified lines
8944 8836
8945 /* removing unresponding volumes */8837 /* removing unresponding volumes */
8946 if (ioc->ir_firmware) {8838 if (ioc->ir_firmware) {
8947 pr_info(MPT3SAS_FMT "removing unresponding devices: volumes\n",8839 ioc_info(ioc, "removing unresponding devices: volumes\n");
8948 ioc->name);
8949 list_for_each_entry_safe(raid_device, raid_device_next,8840 list_for_each_entry_safe(raid_device, raid_device_next,
8950 &ioc->raid_device_list, list) {8841 &ioc->raid_device_list, list) {
8951 if (!raid_device->responding)8842 if (!raid_device->responding)
@@ -8957,8 +8848,7 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
8957 }8848 }
8958 8849
8959 /* removing unresponding expanders */8850 /* removing unresponding expanders */
8960 pr_info(MPT3SAS_FMT "removing unresponding devices: expanders\n",8851 ioc_info(ioc, "removing unresponding devices: expanders\n");
8961 ioc->name);
8962 spin_lock_irqsave(&ioc->sas_node_lock, flags);8852 spin_lock_irqsave(&ioc->sas_node_lock, flags);
8963 INIT_LIST_HEAD(&tmp_list);8853 INIT_LIST_HEAD(&tmp_list);
8964 list_for_each_entry_safe(sas_expander, sas_expander_next,8854 list_for_each_entry_safe(sas_expander, sas_expander_next,
@@ -8974,8 +8864,7 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc) · 9 unmodified lines
8974 _scsih_expander_node_remove(ioc, sas_expander);8864 _scsih_expander_node_remove(ioc, sas_expander);
8975 }8865 }
8976 8866
8977 pr_info(MPT3SAS_FMT "removing unresponding devices: complete\n",8867 ioc_info(ioc, "removing unresponding devices: complete\n");
8978 ioc->name);
8979 8868
8980 /* unblock devices */8869 /* unblock devices */
8981 _scsih_ublock_io_all_device(ioc);8870 _scsih_ublock_io_all_device(ioc);
@@ -8992,8 +8881,8 @@ _scsih_refresh_expander_links(struct MPT3SAS_ADAPTER *ioc, · 10 unmodified lines
8992 for (i = 0 ; i < sas_expander->num_phys ; i++) {8881 for (i = 0 ; i < sas_expander->num_phys ; i++) {
8993 if ((mpt3sas_config_get_expander_pg1(ioc, &mpi_reply,8882 if ((mpt3sas_config_get_expander_pg1(ioc, &mpi_reply,
8994 &expander_pg1, i, handle))) {8883 &expander_pg1, i, handle))) {
8995 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",8884 ioc_err(ioc, "failure at %s:%d/%s()!\n",
8996 ioc->name, __FILE__, __LINE__, __func__);8885 __FILE__, __LINE__, __func__);
8997 return;8886 return;
8998 }8887 }
8999 8888
@@ -9029,11 +8918,11 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 29 unmodified lines
9029 u8 retry_count;8918 u8 retry_count;
9030 unsigned long flags;8919 unsigned long flags;
9031 8920
9032 pr_info(MPT3SAS_FMT "scan devices: start\n", ioc->name);8921 ioc_info(ioc, "scan devices: start\n");
9033 8922
9034 _scsih_sas_host_refresh(ioc);8923 _scsih_sas_host_refresh(ioc);
9035 8924
9036 pr_info(MPT3SAS_FMT "\tscan devices: expanders start\n", ioc->name);8925 ioc_info(ioc, "\tscan devices: expanders start\n");
9037 8926
9038 /* expanders */8927 /* expanders */
9039 handle = 0xFFFF;8928 handle = 0xFFFF;
@@ -9042,10 +8931,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
9042 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &8931 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
9043 MPI2_IOCSTATUS_MASK;8932 MPI2_IOCSTATUS_MASK;
9044 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {8933 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9045 pr_info(MPT3SAS_FMT "\tbreak from expander scan: " \8934 ioc_info(ioc, "\tbreak from expander scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9046 "ioc_status(0x%04x), loginfo(0x%08x)\n",8935 ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
9047 ioc->name, ioc_status,
9048 le32_to_cpu(mpi_reply.IOCLogInfo));
9049 break;8936 break;
9050 }8937 }
9051 handle = le16_to_cpu(expander_pg0.DevHandle);8938 handle = le16_to_cpu(expander_pg0.DevHandle);
@@ -9057,25 +8944,22 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
9057 _scsih_refresh_expander_links(ioc, expander_device,8944 _scsih_refresh_expander_links(ioc, expander_device,
9058 handle);8945 handle);
9059 else {8946 else {
9060 pr_info(MPT3SAS_FMT "\tBEFORE adding expander: " \8947 ioc_info(ioc, "\tBEFORE adding expander: handle (0x%04x), sas_addr(0x%016llx)\n",
9061 "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name,8948 handle,
9062 handle, (unsigned long long)8949 (u64)le64_to_cpu(expander_pg0.SASAddress));
9063 le64_to_cpu(expander_pg0.SASAddress));
9064 _scsih_expander_add(ioc, handle);8950 _scsih_expander_add(ioc, handle);
9065 pr_info(MPT3SAS_FMT "\tAFTER adding expander: " \8951 ioc_info(ioc, "\tAFTER adding expander: handle (0x%04x), sas_addr(0x%016llx)\n",
9066 "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name,8952 handle,
9067 handle, (unsigned long long)8953 (u64)le64_to_cpu(expander_pg0.SASAddress));
9068 le64_to_cpu(expander_pg0.SASAddress));
9069 }8954 }
9070 }8955 }
9071 8956
9072 pr_info(MPT3SAS_FMT "\tscan devices: expanders complete\n",8957 ioc_info(ioc, "\tscan devices: expanders complete\n");
9073 ioc->name);
9074 8958
9075 if (!ioc->ir_firmware)8959 if (!ioc->ir_firmware)
9076 goto skip_to_sas;8960 goto skip_to_sas;
9077 8961
9078 pr_info(MPT3SAS_FMT "\tscan devices: phys disk start\n", ioc->name);8962 ioc_info(ioc, "\tscan devices: phys disk start\n");
9079 8963
9080 /* phys disk */8964 /* phys disk */
9081 phys_disk_num = 0xFF;8965 phys_disk_num = 0xFF;
@@ -9085,10 +8969,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
9085 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &8969 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
9086 MPI2_IOCSTATUS_MASK;8970 MPI2_IOCSTATUS_MASK;
9087 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {8971 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9088 pr_info(MPT3SAS_FMT "\tbreak from phys disk scan: "\8972 ioc_info(ioc, "\tbreak from phys disk scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9089 "ioc_status(0x%04x), loginfo(0x%08x)\n",8973 ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
9090 ioc->name, ioc_status,
9091 le32_to_cpu(mpi_reply.IOCLogInfo));
9092 break;8974 break;
9093 }8975 }
9094 phys_disk_num = pd_pg0.PhysDiskNum;8976 phys_disk_num = pd_pg0.PhysDiskNum;
@@ -9105,19 +8987,16 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 10 unmodified lines
9105 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &8987 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
9106 MPI2_IOCSTATUS_MASK;8988 MPI2_IOCSTATUS_MASK;
9107 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {8989 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9108 pr_info(MPT3SAS_FMT "\tbreak from phys disk scan " \8990 ioc_info(ioc, "\tbreak from phys disk scan ioc_status(0x%04x), loginfo(0x%08x)\n",
9109 "ioc_status(0x%04x), loginfo(0x%08x)\n",8991 ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
9110 ioc->name, ioc_status,
9111 le32_to_cpu(mpi_reply.IOCLogInfo));
9112 break;8992 break;
9113 }8993 }
9114 parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle);8994 parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle);
9115 if (!_scsih_get_sas_address(ioc, parent_handle,8995 if (!_scsih_get_sas_address(ioc, parent_handle,
9116 &sas_address)) {8996 &sas_address)) {
9117 pr_info(MPT3SAS_FMT "\tBEFORE adding phys disk: " \8997 ioc_info(ioc, "\tBEFORE adding phys disk: handle (0x%04x), sas_addr(0x%016llx)\n",
9118 " handle (0x%04x), sas_addr(0x%016llx)\n",8998 handle,
9119 ioc->name, handle, (unsigned long long)8999 (u64)le64_to_cpu(sas_device_pg0.SASAddress));
9120 le64_to_cpu(sas_device_pg0.SASAddress));
9121 mpt3sas_transport_update_links(ioc, sas_address,9000 mpt3sas_transport_update_links(ioc, sas_address,
9122 handle, sas_device_pg0.PhyNum,9001 handle, sas_device_pg0.PhyNum,
9123 MPI2_SAS_NEG_LINK_RATE_1_5);9002 MPI2_SAS_NEG_LINK_RATE_1_5);
@@ -9131,17 +9010,15 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines
9131 1)) {9010 1)) {
9132 ssleep(1);9011 ssleep(1);
9133 }9012 }
9134 pr_info(MPT3SAS_FMT "\tAFTER adding phys disk: " \9013 ioc_info(ioc, "\tAFTER adding phys disk: handle (0x%04x), sas_addr(0x%016llx)\n",
9135 " handle (0x%04x), sas_addr(0x%016llx)\n",9014 handle,
9136 ioc->name, handle, (unsigned long long)9015 (u64)le64_to_cpu(sas_device_pg0.SASAddress));
9137 le64_to_cpu(sas_device_pg0.SASAddress));
9138 }9016 }
9139 }9017 }
9140 9018
9141 pr_info(MPT3SAS_FMT "\tscan devices: phys disk complete\n",9019 ioc_info(ioc, "\tscan devices: phys disk complete\n");
9142 ioc->name);
9143 9020
9144 pr_info(MPT3SAS_FMT "\tscan devices: volumes start\n", ioc->name);9021 ioc_info(ioc, "\tscan devices: volumes start\n");
9145 9022
9146 /* volumes */9023 /* volumes */
9147 handle = 0xFFFF;9024 handle = 0xFFFF;
@@ -9150,10 +9027,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
9150 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &9027 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
9151 MPI2_IOCSTATUS_MASK;9028 MPI2_IOCSTATUS_MASK;
9152 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {9029 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9153 pr_info(MPT3SAS_FMT "\tbreak from volume scan: " \9030 ioc_info(ioc, "\tbreak from volume scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9154 "ioc_status(0x%04x), loginfo(0x%08x)\n",9031 ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
9155 ioc->name, ioc_status,
9156 le32_to_cpu(mpi_reply.IOCLogInfo));
9157 break;9032 break;
9158 }9033 }
9159 handle = le16_to_cpu(volume_pg1.DevHandle);9034 handle = le16_to_cpu(volume_pg1.DevHandle);
@@ -9170,10 +9045,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 10 unmodified lines
9170 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &9045 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
9171 MPI2_IOCSTATUS_MASK;9046 MPI2_IOCSTATUS_MASK;
9172 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {9047 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9173 pr_info(MPT3SAS_FMT "\tbreak from volume scan: " \9048 ioc_info(ioc, "\tbreak from volume scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9174 "ioc_status(0x%04x), loginfo(0x%08x)\n",9049 ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
9175 ioc->name, ioc_status,
9176 le32_to_cpu(mpi_reply.IOCLogInfo));
9177 break;9050 break;
9178 }9051 }
9179 if (volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_OPTIMAL ||9052 if (volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_OPTIMAL ||
@@ -9182,23 +9055,19 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
9182 memset(&element, 0, sizeof(Mpi2EventIrConfigElement_t));9055 memset(&element, 0, sizeof(Mpi2EventIrConfigElement_t));
9183 element.ReasonCode = MPI2_EVENT_IR_CHANGE_RC_ADDED;9056 element.ReasonCode = MPI2_EVENT_IR_CHANGE_RC_ADDED;
9184 element.VolDevHandle = volume_pg1.DevHandle;9057 element.VolDevHandle = volume_pg1.DevHandle;
9185 pr_info(MPT3SAS_FMT9058 ioc_info(ioc, "\tBEFORE adding volume: handle (0x%04x)\n",
9186 "\tBEFORE adding volume: handle (0x%04x)\n",9059 volume_pg1.DevHandle);
9187 ioc->name, volume_pg1.DevHandle);
9188 _scsih_sas_volume_add(ioc, &element);9060 _scsih_sas_volume_add(ioc, &element);
9189 pr_info(MPT3SAS_FMT9061 ioc_info(ioc, "\tAFTER adding volume: handle (0x%04x)\n",
9190 "\tAFTER adding volume: handle (0x%04x)\n",9062 volume_pg1.DevHandle);
9191 ioc->name, volume_pg1.DevHandle);
9192 }9063 }
9193 }9064 }
9194 9065
9195 pr_info(MPT3SAS_FMT "\tscan devices: volumes complete\n",9066 ioc_info(ioc, "\tscan devices: volumes complete\n");
9196 ioc->name);
9197 9067
9198 skip_to_sas:9068 skip_to_sas:
9199 9069
9200 pr_info(MPT3SAS_FMT "\tscan devices: end devices start\n",9070 ioc_info(ioc, "\tscan devices: end devices start\n");
9201 ioc->name);
9202 9071
9203 /* sas devices */9072 /* sas devices */
9204 handle = 0xFFFF;9073 handle = 0xFFFF;
@@ -9208,10 +9077,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
9208 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &9077 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
9209 MPI2_IOCSTATUS_MASK;9078 MPI2_IOCSTATUS_MASK;
9210 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {9079 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9211 pr_info(MPT3SAS_FMT "\tbreak from end device scan:"\9080 ioc_info(ioc, "\tbreak from end device scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9212 " ioc_status(0x%04x), loginfo(0x%08x)\n",9081 ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
9213 ioc->name, ioc_status,
9214 le32_to_cpu(mpi_reply.IOCLogInfo));
9215 break;9082 break;
9216 }9083 }
9217 handle = le16_to_cpu(sas_device_pg0.DevHandle);9084 handle = le16_to_cpu(sas_device_pg0.DevHandle);
@@ -9226,10 +9093,9 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 8 unmodified lines
9226 }9093 }
9227 parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle);9094 parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle);
9228 if (!_scsih_get_sas_address(ioc, parent_handle, &sas_address)) {9095 if (!_scsih_get_sas_address(ioc, parent_handle, &sas_address)) {
9229 pr_info(MPT3SAS_FMT "\tBEFORE adding end device: " \9096 ioc_info(ioc, "\tBEFORE adding end device: handle (0x%04x), sas_addr(0x%016llx)\n",
9230 "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name,9097 handle,
9231 handle, (unsigned long long)9098 (u64)le64_to_cpu(sas_device_pg0.SASAddress));
9232 le64_to_cpu(sas_device_pg0.SASAddress));
9233 mpt3sas_transport_update_links(ioc, sas_address, handle,9099 mpt3sas_transport_update_links(ioc, sas_address, handle,
9234 sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);9100 sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);
9235 retry_count = 0;9101 retry_count = 0;
@@ -9241,16 +9107,13 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
9241 0)) {9107 0)) {
9242 ssleep(1);9108 ssleep(1);
9243 }9109 }
9244 pr_info(MPT3SAS_FMT "\tAFTER adding end device: " \9110 ioc_info(ioc, "\tAFTER adding end device: handle (0x%04x), sas_addr(0x%016llx)\n",
9245 "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name,9111 handle,
9246 handle, (unsigned long long)9112 (u64)le64_to_cpu(sas_device_pg0.SASAddress));
9247 le64_to_cpu(sas_device_pg0.SASAddress));
9248 }9113 }
9249 }9114 }
9250 pr_info(MPT3SAS_FMT "\tscan devices: end devices complete\n",9115 ioc_info(ioc, "\tscan devices: end devices complete\n");
9251 ioc->name);9116 ioc_info(ioc, "\tscan devices: pcie end devices start\n");
9252 pr_info(MPT3SAS_FMT "\tscan devices: pcie end devices start\n",
9253 ioc->name);
9254 9117
9255 /* pcie devices */9118 /* pcie devices */
9256 handle = 0xFFFF;9119 handle = 0xFFFF;
@@ -9260,10 +9123,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
9260 ioc_status = le16_to_cpu(mpi_reply.IOCStatus)9123 ioc_status = le16_to_cpu(mpi_reply.IOCStatus)
9261 & MPI2_IOCSTATUS_MASK;9124 & MPI2_IOCSTATUS_MASK;
9262 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {9125 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9263 pr_info(MPT3SAS_FMT "\tbreak from pcie end device"9126 ioc_info(ioc, "\tbreak from pcie end device scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9264 " scan: ioc_status(0x%04x), loginfo(0x%08x)\n",9127 ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
9265 ioc->name, ioc_status,
9266 le32_to_cpu(mpi_reply.IOCLogInfo));
9267 break;9128 break;
9268 }9129 }
9269 handle = le16_to_cpu(pcie_device_pg0.DevHandle);9130 handle = le16_to_cpu(pcie_device_pg0.DevHandle);
@@ -9280,14 +9141,11 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 10 unmodified lines
9280 parent_handle = le16_to_cpu(pcie_device_pg0.ParentDevHandle);9141 parent_handle = le16_to_cpu(pcie_device_pg0.ParentDevHandle);
9281 _scsih_pcie_add_device(ioc, handle);9142 _scsih_pcie_add_device(ioc, handle);
9282 9143
9283 pr_info(MPT3SAS_FMT "\tAFTER adding pcie end device: "9144 ioc_info(ioc, "\tAFTER adding pcie end device: handle (0x%04x), wwid(0x%016llx)\n",
9284 "handle (0x%04x), wwid(0x%016llx)\n", ioc->name,9145 handle, (u64)le64_to_cpu(pcie_device_pg0.WWID));
9285 handle,
9286 (unsigned long long) le64_to_cpu(pcie_device_pg0.WWID));
9287 }9146 }
9288 pr_info(MPT3SAS_FMT "\tpcie devices: pcie end devices complete\n",9147 ioc_info(ioc, "\tpcie devices: pcie end devices complete\n");
9289 ioc->name);9148 ioc_info(ioc, "scan devices: complete\n");
9290 pr_info(MPT3SAS_FMT "scan devices: complete\n", ioc->name);
9291}9149}
9292 9150
9293/**9151/**
@@ -9298,8 +9156,7 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines
9298 */9156 */
9299void mpt3sas_scsih_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc)9157void mpt3sas_scsih_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc)
9300{9158{
9301 dtmprintk(ioc, pr_info(MPT3SAS_FMT9159 dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_PRE_RESET\n", __func__));
9302 "%s: MPT3_IOC_PRE_RESET\n", ioc->name, __func__));
9303}9160}
9304 9161
9305/**9162/**
@@ -9311,8 +9168,7 @@ void mpt3sas_scsih_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
9311void9168void
9312mpt3sas_scsih_after_reset_handler(struct MPT3SAS_ADAPTER *ioc)9169mpt3sas_scsih_after_reset_handler(struct MPT3SAS_ADAPTER *ioc)
9313{9170{
9314 dtmprintk(ioc, pr_info(MPT3SAS_FMT9171 dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_AFTER_RESET\n", __func__));
9315 "%s: MPT3_IOC_AFTER_RESET\n", ioc->name, __func__));
9316 if (ioc->scsih_cmds.status & MPT3_CMD_PENDING) {9172 if (ioc->scsih_cmds.status & MPT3_CMD_PENDING) {
9317 ioc->scsih_cmds.status |= MPT3_CMD_RESET;9173 ioc->scsih_cmds.status |= MPT3_CMD_RESET;
9318 mpt3sas_base_free_smid(ioc, ioc->scsih_cmds.smid);9174 mpt3sas_base_free_smid(ioc, ioc->scsih_cmds.smid);
@@ -9340,8 +9196,7 @@ mpt3sas_scsih_after_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 21 unmodified lines
9340void9196void
9341mpt3sas_scsih_reset_done_handler(struct MPT3SAS_ADAPTER *ioc)9197mpt3sas_scsih_reset_done_handler(struct MPT3SAS_ADAPTER *ioc)
9342{9198{
9343 dtmprintk(ioc, pr_info(MPT3SAS_FMT9199 dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_DONE_RESET\n", __func__));
9344 "%s: MPT3_IOC_DONE_RESET\n", ioc->name, __func__));
9345 if ((!ioc->is_driver_loading) && !(disable_discovery > 0 &&9200 if ((!ioc->is_driver_loading) && !(disable_discovery > 0 &&
9346 !ioc->sas_hba.num_phys)) {9201 !ioc->sas_hba.num_phys)) {
9347 _scsih_prep_device_scan(ioc);9202 _scsih_prep_device_scan(ioc);
@@ -9396,9 +9251,8 @@ _mpt3sas_fw_work(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event) · 48 unmodified lines
9396 if (missing_delay[0] != -1 && missing_delay[1] != -1)9251 if (missing_delay[0] != -1 && missing_delay[1] != -1)
9397 mpt3sas_base_update_missing_delay(ioc, missing_delay[0],9252 mpt3sas_base_update_missing_delay(ioc, missing_delay[0],
9398 missing_delay[1]);9253 missing_delay[1]);
9399 dewtprintk(ioc, pr_info(MPT3SAS_FMT9254 dewtprintk(ioc,
9400 "port enable: complete from worker thread\n",9255 ioc_info(ioc, "port enable: complete from worker thread\n"));
9401 ioc->name));
9402 break;9256 break;
9403 case MPT3SAS_TURN_ON_PFA_LED:9257 case MPT3SAS_TURN_ON_PFA_LED:
9404 _scsih_turn_on_pfa_led(ioc, fw_event->device_handle);9258 _scsih_turn_on_pfa_led(ioc, fw_event->device_handle);
@@ -9496,8 +9350,8 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, · 91 unmodified lines
9496 mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply);9350 mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply);
9497 9351
9498 if (unlikely(!mpi_reply)) {9352 if (unlikely(!mpi_reply)) {
9499 pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",9353 ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
9500 ioc->name, __FILE__, __LINE__, __func__);9354 __FILE__, __LINE__, __func__);
9501 return 1;9355 return 1;
9502 }9356 }
9503 9357
@@ -9564,30 +9418,16 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, · 60 unmodified lines
9564 9418
9565 switch (le32_to_cpu(*log_code)) {9419 switch (le32_to_cpu(*log_code)) {
9566 case MPT2_WARPDRIVE_LC_SSDT:9420 case MPT2_WARPDRIVE_LC_SSDT:
9567 pr_warn(MPT3SAS_FMT "WarpDrive Warning: "9421 ioc_warn(ioc, "WarpDrive Warning: IO Throttling has occurred in the WarpDrive subsystem. Check WarpDrive documentation for additional details.\n");
9568 "IO Throttling has occurred in the WarpDrive "
9569 "subsystem. Check WarpDrive documentation for "
9570 "additional details.\n", ioc->name);
9571 break;9422 break;
9572 case MPT2_WARPDRIVE_LC_SSDLW:9423 case MPT2_WARPDRIVE_LC_SSDLW:
9573 pr_warn(MPT3SAS_FMT "WarpDrive Warning: "9424 ioc_warn(ioc, "WarpDrive Warning: Program/Erase Cycles for the WarpDrive subsystem in degraded range. Check WarpDrive documentation for additional details.\n");
9574 "Program/Erase Cycles for the WarpDrive subsystem "
9575 "in degraded range. Check WarpDrive documentation "
9576 "for additional details.\n", ioc->name);
9577 break;9425 break;
9578 case MPT2_WARPDRIVE_LC_SSDLF:9426 case MPT2_WARPDRIVE_LC_SSDLF:
9579 pr_err(MPT3SAS_FMT "WarpDrive Fatal Error: "9427 ioc_err(ioc, "WarpDrive Fatal Error: There are no Program/Erase Cycles for the WarpDrive subsystem. The storage device will be in read-only mode. Check WarpDrive documentation for additional details.\n");
9580 "There are no Program/Erase Cycles for the "
9581 "WarpDrive subsystem. The storage device will be "
9582 "in read-only mode. Check WarpDrive documentation "
9583 "for additional details.\n", ioc->name);
9584 break;9428 break;
9585 case MPT2_WARPDRIVE_LC_BRMF:9429 case MPT2_WARPDRIVE_LC_BRMF:
9586 pr_err(MPT3SAS_FMT "WarpDrive Fatal Error: "9430 ioc_err(ioc, "WarpDrive Fatal Error: The Backup Rail Monitor has failed on the WarpDrive subsystem. Check WarpDrive documentation for additional details.\n");
9587 "The Backup Rail Monitor has failed on the "
9588 "WarpDrive subsystem. Check WarpDrive "
9589 "documentation for additional details.\n",
9590 ioc->name);
9591 break;9431 break;
9592 }9432 }
9593 9433
@@ -9613,9 +9453,8 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, · 19 unmodified lines
9613 (Mpi26EventDataActiveCableExcept_t *) mpi_reply->EventData;9453 (Mpi26EventDataActiveCableExcept_t *) mpi_reply->EventData;
9614 switch (ActiveCableEventData->ReasonCode) {9454 switch (ActiveCableEventData->ReasonCode) {
9615 case MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER:9455 case MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER:
9616 pr_notice(MPT3SAS_FMT9456 ioc_notice(ioc, "Currently an active cable with ReceptacleID %d\n",
9617 "Currently an active cable with ReceptacleID %d\n",9457 ActiveCableEventData->ReceptacleID);
9618 ioc->name, ActiveCableEventData->ReceptacleID);
9619 pr_notice("cannot be powered and devices connected\n");9458 pr_notice("cannot be powered and devices connected\n");
9620 pr_notice("to this active cable will not be seen\n");9459 pr_notice("to this active cable will not be seen\n");
9621 pr_notice("This active cable requires %d mW of power\n",9460 pr_notice("This active cable requires %d mW of power\n",
@@ -9623,9 +9462,8 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, · 1 unmodified line
9623 break;9462 break;
9624 9463
9625 case MPI26_EVENT_ACTIVE_CABLE_DEGRADED:9464 case MPI26_EVENT_ACTIVE_CABLE_DEGRADED:
9626 pr_notice(MPT3SAS_FMT9465 ioc_notice(ioc, "Currently a cable with ReceptacleID %d\n",
9627 "Currently a cable with ReceptacleID %d\n",9466 ActiveCableEventData->ReceptacleID);
9628 ioc->name, ActiveCableEventData->ReceptacleID);
9629 pr_notice(9467 pr_notice(
9630 "is not running at optimal speed(12 Gb/s rate)\n");9468 "is not running at optimal speed(12 Gb/s rate)\n");
9631 break;9469 break;
@@ -9640,8 +9478,8 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, · 8 unmodified lines
9640 sz = le16_to_cpu(mpi_reply->EventDataLength) * 4;9478 sz = le16_to_cpu(mpi_reply->EventDataLength) * 4;
9641 fw_event = alloc_fw_event_work(sz);9479 fw_event = alloc_fw_event_work(sz);
9642 if (!fw_event) {9480 if (!fw_event) {
9643 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",9481 ioc_err(ioc, "failure at %s:%d/%s()!\n",
9644 ioc->name, __FILE__, __LINE__, __func__);9482 __FILE__, __LINE__, __func__);
9645 return 1;9483 return 1;
9646 }9484 }
9647 9485
@@ -9690,11 +9528,9 @@ _scsih_expander_node_remove(struct MPT3SAS_ADAPTER *ioc, · 42 unmodified lines
9690 mpt3sas_transport_port_remove(ioc, sas_expander->sas_address,9528 mpt3sas_transport_port_remove(ioc, sas_expander->sas_address,
9691 sas_expander->sas_address_parent);9529 sas_expander->sas_address_parent);
9692 9530
9693 pr_info(MPT3SAS_FMT9531 ioc_info(ioc, "expander_remove: handle(0x%04x), sas_addr(0x%016llx)\n",
9694 "expander_remove: handle(0x%04x), sas_addr(0x%016llx)\n",9532 sas_expander->handle, (unsigned long long)
9695 ioc->name,9533 sas_expander->sas_address);
9696 sas_expander->handle, (unsigned long long)
9697 sas_expander->sas_address);
9698 9534
9699 spin_lock_irqsave(&ioc->sas_node_lock, flags);9535 spin_lock_irqsave(&ioc->sas_node_lock, flags);
9700 list_del(&sas_expander->list);9536 list_del(&sas_expander->list);
@@ -9729,16 +9565,14 @@ _scsih_ir_shutdown(struct MPT3SAS_ADAPTER *ioc) · 28 unmodified lines
9729 mutex_lock(&ioc->scsih_cmds.mutex);9565 mutex_lock(&ioc->scsih_cmds.mutex);
9730 9566
9731 if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) {9567 if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) {
9732 pr_err(MPT3SAS_FMT "%s: scsih_cmd in use\n",9568 ioc_err(ioc, "%s: scsih_cmd in use\n", __func__);
9733 ioc->name, __func__);
9734 goto out;9569 goto out;
9735 }9570 }
9736 ioc->scsih_cmds.status = MPT3_CMD_PENDING;9571 ioc->scsih_cmds.status = MPT3_CMD_PENDING;
9737 9572
9738 smid = mpt3sas_base_get_smid(ioc, ioc->scsih_cb_idx);9573 smid = mpt3sas_base_get_smid(ioc, ioc->scsih_cb_idx);
9739 if (!smid) {9574 if (!smid) {
9740 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",9575 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
9741 ioc->name, __func__);
9742 ioc->scsih_cmds.status = MPT3_CMD_NOT_USED;9576 ioc->scsih_cmds.status = MPT3_CMD_NOT_USED;
9743 goto out;9577 goto out;
9744 }9578 }
@@ -9751,24 +9585,22 @@ _scsih_ir_shutdown(struct MPT3SAS_ADAPTER *ioc) · 6 unmodified lines
9751 mpi_request->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED;9585 mpi_request->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED;
9752 9586
9753 if (!ioc->hide_ir_msg)9587 if (!ioc->hide_ir_msg)
9754 pr_info(MPT3SAS_FMT "IR shutdown (sending)\n", ioc->name);9588 ioc_info(ioc, "IR shutdown (sending)\n");
9755 init_completion(&ioc->scsih_cmds.done);9589 init_completion(&ioc->scsih_cmds.done);
9756 mpt3sas_base_put_smid_default(ioc, smid);9590 mpt3sas_base_put_smid_default(ioc, smid);
9757 wait_for_completion_timeout(&ioc->scsih_cmds.done, 10*HZ);9591 wait_for_completion_timeout(&ioc->scsih_cmds.done, 10*HZ);
9758 9592
9759 if (!(ioc->scsih_cmds.status & MPT3_CMD_COMPLETE)) {9593 if (!(ioc->scsih_cmds.status & MPT3_CMD_COMPLETE)) {
9760 pr_err(MPT3SAS_FMT "%s: timeout\n",9594 ioc_err(ioc, "%s: timeout\n", __func__);
9761 ioc->name, __func__);
9762 goto out;9595 goto out;
9763 }9596 }
9764 9597
9765 if (ioc->scsih_cmds.status & MPT3_CMD_REPLY_VALID) {9598 if (ioc->scsih_cmds.status & MPT3_CMD_REPLY_VALID) {
9766 mpi_reply = ioc->scsih_cmds.reply;9599 mpi_reply = ioc->scsih_cmds.reply;
9767 if (!ioc->hide_ir_msg)9600 if (!ioc->hide_ir_msg)
9768 pr_info(MPT3SAS_FMT "IR shutdown "9601 ioc_info(ioc, "IR shutdown (complete): ioc_status(0x%04x), loginfo(0x%08x)\n",
9769 "(complete): ioc_status(0x%04x), loginfo(0x%08x)\n",9602 le16_to_cpu(mpi_reply->IOCStatus),
9770 ioc->name, le16_to_cpu(mpi_reply->IOCStatus),9603 le32_to_cpu(mpi_reply->IOCLogInfo));
9771 le32_to_cpu(mpi_reply->IOCLogInfo));
9772 }9604 }
9773 9605
9774 out:9606 out:
@@ -9817,9 +9649,8 @@ static void scsih_remove(struct pci_dev *pdev) · 42 unmodified lines
9817 sas_target_priv_data->deleted = 1;9649 sas_target_priv_data->deleted = 1;
9818 scsi_remove_target(&raid_device->starget->dev);9650 scsi_remove_target(&raid_device->starget->dev);
9819 }9651 }
9820 pr_info(MPT3SAS_FMT "removing handle(0x%04x), wwid(0x%016llx)\n",9652 ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n",
9821 ioc->name, raid_device->handle,9653 raid_device->handle, (u64)raid_device->wwid);
9822 (unsigned long long) raid_device->wwid);
9823 _scsih_raid_device_remove(ioc, raid_device);9654 _scsih_raid_device_remove(ioc, raid_device);
9824 }9655 }
9825 list_for_each_entry_safe(pcie_device, pcienext, &ioc->pcie_device_list,9656 list_for_each_entry_safe(pcie_device, pcienext, &ioc->pcie_device_list,
@@ -10230,7 +10061,7 @@ scsih_scan_start(struct Scsi_Host *shost) · 404 unmodified lines
10230 rc = mpt3sas_port_enable(ioc);10061 rc = mpt3sas_port_enable(ioc);
10231 10062
10232 if (rc != 0)10063 if (rc != 0)
10233 pr_info(MPT3SAS_FMT "port enable: FAILED\n", ioc->name);10064 ioc_info(ioc, "port enable: FAILED\n");
10234}10065}
10235 10066
10236/**10067/**
@@ -10255,9 +10086,7 @@ scsih_scan_finished(struct Scsi_Host *shost, unsigned long time) · 18 unmodified lines
10255 10086
10256 if (time >= (300 * HZ)) {10087 if (time >= (300 * HZ)) {
10257 ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED;10088 ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED;
10258 pr_info(MPT3SAS_FMT10089 ioc_info(ioc, "port enable: FAILED with timeout (timeout=300s)\n");
10259 "port enable: FAILED with timeout (timeout=300s)\n",
10260 ioc->name);
10261 ioc->is_driver_loading = 0;10090 ioc->is_driver_loading = 0;
10262 return 1;10091 return 1;
10263 }10092 }
@@ -10266,16 +10095,15 @@ scsih_scan_finished(struct Scsi_Host *shost, unsigned long time) · 2 unmodified lines
10266 return 0;10095 return 0;
10267 10096
10268 if (ioc->start_scan_failed) {10097 if (ioc->start_scan_failed) {
10269 pr_info(MPT3SAS_FMT10098 ioc_info(ioc, "port enable: FAILED with (ioc_status=0x%08x)\n",
10270 "port enable: FAILED with (ioc_status=0x%08x)\n",10099 ioc->start_scan_failed);
10271 ioc->name, ioc->start_scan_failed);
10272 ioc->is_driver_loading = 0;10100 ioc->is_driver_loading = 0;
10273 ioc->wait_for_discovery_to_complete = 0;10101 ioc->wait_for_discovery_to_complete = 0;
10274 ioc->remove_host = 1;10102 ioc->remove_host = 1;
10275 return 1;10103 return 1;
10276 }10104 }
10277 10105
10278 pr_info(MPT3SAS_FMT "port enable: SUCCESS\n", ioc->name);10106 ioc_info(ioc, "port enable: SUCCESS\n");
10279 ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED;10107 ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED;
10280 10108
10281 if (ioc->wait_for_discovery_to_complete) {10109 if (ioc->wait_for_discovery_to_complete) {
@@ -10586,28 +10414,22 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 304 unmodified lines
10586 if (ioc->is_mcpu_endpoint) {10414 if (ioc->is_mcpu_endpoint) {
10587 /* mCPU MPI support 64K max IO */10415 /* mCPU MPI support 64K max IO */
10588 shost->max_sectors = 128;10416 shost->max_sectors = 128;
10589 pr_info(MPT3SAS_FMT10417 ioc_info(ioc, "The max_sectors value is set to %d\n",
10590 "The max_sectors value is set to %d\n",10418 shost->max_sectors);
10591 ioc->name, shost->max_sectors);
10592 } else {10419 } else {
10593 if (max_sectors != 0xFFFF) {10420 if (max_sectors != 0xFFFF) {
10594 if (max_sectors < 64) {10421 if (max_sectors < 64) {
10595 shost->max_sectors = 64;10422 shost->max_sectors = 64;
10596 pr_warn(MPT3SAS_FMT "Invalid value %d passed " \10423 ioc_warn(ioc, "Invalid value %d passed for max_sectors, range is 64 to 32767. Assigning value of 64.\n",
10597 "for max_sectors, range is 64 to 32767. " \10424 max_sectors);
10598 "Assigning value of 64.\n", \
10599 ioc->name, max_sectors);
10600 } else if (max_sectors > 32767) {10425 } else if (max_sectors > 32767) {
10601 shost->max_sectors = 32767;10426 shost->max_sectors = 32767;
10602 pr_warn(MPT3SAS_FMT "Invalid value %d passed " \10427 ioc_warn(ioc, "Invalid value %d passed for max_sectors, range is 64 to 32767.Assigning default value of 32767.\n",
10603 "for max_sectors, range is 64 to 32767." \10428 max_sectors);
10604 "Assigning default value of 32767.\n", \
10605 ioc->name, max_sectors);
10606 } else {10429 } else {
10607 shost->max_sectors = max_sectors & 0xFFFE;10430 shost->max_sectors = max_sectors & 0xFFFE;
10608 pr_info(MPT3SAS_FMT10431 ioc_info(ioc, "The max_sectors value is set to %d\n",
10609 "The max_sectors value is set to %d\n",10432 shost->max_sectors);
10610 ioc->name, shost->max_sectors);
10611 }10433 }
10612 }10434 }
10613 }10435 }
@@ -10627,16 +10449,16 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 13 unmodified lines
10627 ioc->firmware_event_thread = alloc_ordered_workqueue(10449 ioc->firmware_event_thread = alloc_ordered_workqueue(
10628 ioc->firmware_event_name, 0);10450 ioc->firmware_event_name, 0);
10629 if (!ioc->firmware_event_thread) {10451 if (!ioc->firmware_event_thread) {
10630 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",10452 ioc_err(ioc, "failure at %s:%d/%s()!\n",
10631 ioc->name, __FILE__, __LINE__, __func__);10453 __FILE__, __LINE__, __func__);
10632 rv = -ENODEV;10454 rv = -ENODEV;
10633 goto out_thread_fail;10455 goto out_thread_fail;
10634 }10456 }
10635 10457
10636 ioc->is_driver_loading = 1;10458 ioc->is_driver_loading = 1;
10637 if ((mpt3sas_base_attach(ioc))) {10459 if ((mpt3sas_base_attach(ioc))) {
10638 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",10460 ioc_err(ioc, "failure at %s:%d/%s()!\n",
10639 ioc->name, __FILE__, __LINE__, __func__);10461 __FILE__, __LINE__, __func__);
10640 rv = -ENODEV;10462 rv = -ENODEV;
10641 goto out_attach_fail;10463 goto out_attach_fail;
10642 }10464 }
@@ -10657,8 +10479,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 14 unmodified lines
10657 10479
10658 rv = scsi_add_host(shost, &pdev->dev);10480 rv = scsi_add_host(shost, &pdev->dev);
10659 if (rv) {10481 if (rv) {
10660 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",10482 ioc_err(ioc, "failure at %s:%d/%s()!\n",
10661 ioc->name, __FILE__, __LINE__, __func__);10483 __FILE__, __LINE__, __func__);
10662 goto out_add_shost_fail;10484 goto out_add_shost_fail;
10663 }10485 }
10664 10486
@@ -10695,9 +10517,8 @@ scsih_suspend(struct pci_dev *pdev, pm_message_t state) · 30 unmodified lines
10695 flush_scheduled_work();10517 flush_scheduled_work();
10696 scsi_block_requests(shost);10518 scsi_block_requests(shost);
10697 device_state = pci_choose_state(pdev, state);10519 device_state = pci_choose_state(pdev, state);
10698 pr_info(MPT3SAS_FMT10520 ioc_info(ioc, "pdev=0x%p, slot=%s, entering operating state [D%d]\n",
10699 "pdev=0x%p, slot=%s, entering operating state [D%d]\n",10521 pdev, pci_name(pdev), device_state);
10700 ioc->name, pdev, pci_name(pdev), device_state);
10701 10522
10702 pci_save_state(pdev);10523 pci_save_state(pdev);
10703 mpt3sas_base_free_resources(ioc);10524 mpt3sas_base_free_resources(ioc);
@@ -10719,9 +10540,8 @@ scsih_resume(struct pci_dev *pdev) · 15 unmodified lines
10719 pci_power_t device_state = pdev->current_state;10540 pci_power_t device_state = pdev->current_state;
10720 int r;10541 int r;
10721 10542
10722 pr_info(MPT3SAS_FMT10543 ioc_info(ioc, "pdev=0x%p, slot=%s, previous operating state [D%d]\n",
10723 "pdev=0x%p, slot=%s, previous operating state [D%d]\n",10544 pdev, pci_name(pdev), device_state);
10724 ioc->name, pdev, pci_name(pdev), device_state);
10725 10545
10726 pci_set_power_state(pdev, PCI_D0);10546 pci_set_power_state(pdev, PCI_D0);
10727 pci_enable_wake(pdev, PCI_D0, 0);10547 pci_enable_wake(pdev, PCI_D0, 0);
@@ -10753,8 +10573,7 @@ scsih_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) · 25 unmodified lines
10753 struct Scsi_Host *shost = pci_get_drvdata(pdev);10573 struct Scsi_Host *shost = pci_get_drvdata(pdev);
10754 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);10574 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
10755 10575
10756 pr_info(MPT3SAS_FMT "PCI error: detected callback, state(%d)!!\n",10576 ioc_info(ioc, "PCI error: detected callback, state(%d)!!\n", state);
10757 ioc->name, state);
10758 10577
10759 switch (state) {10578 switch (state) {
10760 case pci_channel_io_normal:10579 case pci_channel_io_normal:
@@ -10791,8 +10610,7 @@ scsih_pci_slot_reset(struct pci_dev *pdev) · 30 unmodified lines
10791 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);10610 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
10792 int rc;10611 int rc;
10793 10612
10794 pr_info(MPT3SAS_FMT "PCI error: slot reset callback!!\n",10613 ioc_info(ioc, "PCI error: slot reset callback!!\n");
10795 ioc->name);
10796 10614
10797 ioc->pci_error_recovery = 0;10615 ioc->pci_error_recovery = 0;
10798 ioc->pdev = pdev;10616 ioc->pdev = pdev;
@@ -10803,8 +10621,8 @@ scsih_pci_slot_reset(struct pci_dev *pdev) · 4 unmodified lines
10803 10621
10804 rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);10622 rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
10805 10623
10806 pr_warn(MPT3SAS_FMT "hard reset: %s\n", ioc->name,10624 ioc_warn(ioc, "hard reset: %s\n",
10807 (rc == 0) ? "success" : "failed");10625 (rc == 0) ? "success" : "failed");
10808 10626
10809 if (!rc)10627 if (!rc)
10810 return PCI_ERS_RESULT_RECOVERED;10628 return PCI_ERS_RESULT_RECOVERED;
@@ -10826,7 +10644,7 @@ scsih_pci_resume(struct pci_dev *pdev) · 15 unmodified lines
10826 struct Scsi_Host *shost = pci_get_drvdata(pdev);10644 struct Scsi_Host *shost = pci_get_drvdata(pdev);
10827 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);10645 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
10828 10646
10829 pr_info(MPT3SAS_FMT "PCI error: resume callback!!\n", ioc->name);10647 ioc_info(ioc, "PCI error: resume callback!!\n");
10830 10648
10831 mpt3sas_base_start_watchdog(ioc);10649 mpt3sas_base_start_watchdog(ioc);
10832 scsi_unblock_requests(ioc->shost);10650 scsi_unblock_requests(ioc->shost);
@@ -10842,8 +10660,7 @@ scsih_pci_mmio_enabled(struct pci_dev *pdev) · 9 unmodified lines
10842 struct Scsi_Host *shost = pci_get_drvdata(pdev);10660 struct Scsi_Host *shost = pci_get_drvdata(pdev);
10843 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);10661 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
10844 10662
10845 pr_info(MPT3SAS_FMT "PCI error: mmio enabled callback!!\n",10663 ioc_info(ioc, "PCI error: mmio enabled callback!!\n");
10846 ioc->name);
10847 10664
10848 /* TODO - dump whatever for debugging purposes */10665 /* TODO - dump whatever for debugging purposes */
10849 10666
drivers/scsi/mpt3sas/mpt3sas_transport.c+159−196
@@ -146,25 +146,22 @@ _transport_set_identify(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 145 unmodified lines
146 u32 ioc_status;146 u32 ioc_status;
147 147
148 if (ioc->shost_recovery || ioc->pci_error_recovery) {148 if (ioc->shost_recovery || ioc->pci_error_recovery) {
149 pr_info(MPT3SAS_FMT "%s: host reset in progress!\n",149 ioc_info(ioc, "%s: host reset in progress!\n", __func__);
150 __func__, ioc->name);
151 return -EFAULT;150 return -EFAULT;
152 }151 }
153 152
154 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,153 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
155 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {154 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
156 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",155 ioc_err(ioc, "failure at %s:%d/%s()!\n",
157 ioc->name, __FILE__, __LINE__, __func__);156 __FILE__, __LINE__, __func__);
158 return -ENXIO;157 return -ENXIO;
159 }158 }
160 159
161 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &160 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
162 MPI2_IOCSTATUS_MASK;161 MPI2_IOCSTATUS_MASK;
163 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {162 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
164 pr_err(MPT3SAS_FMT163 ioc_err(ioc, "handle(0x%04x), ioc_status(0x%04x) failure at %s:%d/%s()!\n",
165 "handle(0x%04x), ioc_status(0x%04x)\nfailure at %s:%d/%s()!\n",164 handle, ioc_status, __FILE__, __LINE__, __func__);
166 ioc->name, handle, ioc_status,
167 __FILE__, __LINE__, __func__);
168 return -EIO;165 return -EIO;
169 }166 }
170 167
@@ -310,16 +307,14 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 139 unmodified lines
310 u16 wait_state_count;307 u16 wait_state_count;
311 308
312 if (ioc->shost_recovery || ioc->pci_error_recovery) {309 if (ioc->shost_recovery || ioc->pci_error_recovery) {
313 pr_info(MPT3SAS_FMT "%s: host reset in progress!\n",310 ioc_info(ioc, "%s: host reset in progress!\n", __func__);
314 __func__, ioc->name);
315 return -EFAULT;311 return -EFAULT;
316 }312 }
317 313
318 mutex_lock(&ioc->transport_cmds.mutex);314 mutex_lock(&ioc->transport_cmds.mutex);
319 315
320 if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {316 if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {
321 pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n",317 ioc_err(ioc, "%s: transport_cmds in use\n", __func__);
322 ioc->name, __func__);
323 rc = -EAGAIN;318 rc = -EAGAIN;
324 goto out;319 goto out;
325 }320 }
@@ -329,26 +324,22 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
329 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);324 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
330 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {325 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
331 if (wait_state_count++ == 10) {326 if (wait_state_count++ == 10) {
332 pr_err(MPT3SAS_FMT327 ioc_err(ioc, "%s: failed due to ioc not operational\n",
333 "%s: failed due to ioc not operational\n",328 __func__);
334 ioc->name, __func__);
335 rc = -EFAULT;329 rc = -EFAULT;
336 goto out;330 goto out;
337 }331 }
338 ssleep(1);332 ssleep(1);
339 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);333 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
340 pr_info(MPT3SAS_FMT334 ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
341 "%s: waiting for operational state(count=%d)\n",335 __func__, wait_state_count);
342 ioc->name, __func__, wait_state_count);
343 }336 }
344 if (wait_state_count)337 if (wait_state_count)
345 pr_info(MPT3SAS_FMT "%s: ioc is operational\n",338 ioc_info(ioc, "%s: ioc is operational\n", __func__);
346 ioc->name, __func__);
347 339
348 smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);340 smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);
349 if (!smid) {341 if (!smid) {
350 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",342 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
351 ioc->name, __func__);
352 rc = -EAGAIN;343 rc = -EAGAIN;
353 goto out;344 goto out;
354 }345 }
@@ -359,9 +350,8 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 4 unmodified lines
359 350
360 data_out_sz = sizeof(struct rep_manu_request);351 data_out_sz = sizeof(struct rep_manu_request);
361 data_in_sz = sizeof(struct rep_manu_reply);352 data_in_sz = sizeof(struct rep_manu_reply);
362 data_out = pci_alloc_consistent(ioc->pdev, data_out_sz + data_in_sz,353 data_out = dma_alloc_coherent(&ioc->pdev->dev, data_out_sz + data_in_sz,
363 &data_out_dma);354 &data_out_dma, GFP_KERNEL);
364
365 if (!data_out) {355 if (!data_out) {
366 pr_err("failure at %s:%d/%s()!\n", __FILE__,356 pr_err("failure at %s:%d/%s()!\n", __FILE__,
367 __LINE__, __func__);357 __LINE__, __func__);
@@ -388,16 +378,15 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 20 unmodified lines
388 ioc->build_sg(ioc, psge, data_out_dma, data_out_sz, data_in_dma,378 ioc->build_sg(ioc, psge, data_out_dma, data_out_sz, data_in_dma,
389 data_in_sz);379 data_in_sz);
390 380
391 dtransportprintk(ioc, pr_info(MPT3SAS_FMT381 dtransportprintk(ioc,
392 "report_manufacture - send to sas_addr(0x%016llx)\n",382 ioc_info(ioc, "report_manufacture - send to sas_addr(0x%016llx)\n",
393 ioc->name, (unsigned long long)sas_address));383 (u64)sas_address));
394 init_completion(&ioc->transport_cmds.done);384 init_completion(&ioc->transport_cmds.done);
395 mpt3sas_base_put_smid_default(ioc, smid);385 mpt3sas_base_put_smid_default(ioc, smid);
396 wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);386 wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
397 387
398 if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {388 if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
399 pr_err(MPT3SAS_FMT "%s: timeout\n",389 ioc_err(ioc, "%s: timeout\n", __func__);
400 ioc->name, __func__);
401 _debug_dump_mf(mpi_request,390 _debug_dump_mf(mpi_request,
402 sizeof(Mpi2SmpPassthroughRequest_t)/4);391 sizeof(Mpi2SmpPassthroughRequest_t)/4);
403 if (!(ioc->transport_cmds.status & MPT3_CMD_RESET))392 if (!(ioc->transport_cmds.status & MPT3_CMD_RESET))
@@ -405,17 +394,16 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
405 goto issue_host_reset;394 goto issue_host_reset;
406 }395 }
407 396
408 dtransportprintk(ioc, pr_info(MPT3SAS_FMT397 dtransportprintk(ioc, ioc_info(ioc, "report_manufacture - complete\n"));
409 "report_manufacture - complete\n", ioc->name));
410 398
411 if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) {399 if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) {
412 u8 *tmp;400 u8 *tmp;
413 401
414 mpi_reply = ioc->transport_cmds.reply;402 mpi_reply = ioc->transport_cmds.reply;
415 403
416 dtransportprintk(ioc, pr_info(MPT3SAS_FMT404 dtransportprintk(ioc,
417 "report_manufacture - reply data transfer size(%d)\n",405 ioc_info(ioc, "report_manufacture - reply data transfer size(%d)\n",
418 ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength)));406 le16_to_cpu(mpi_reply->ResponseDataLength)));
419 407
420 if (le16_to_cpu(mpi_reply->ResponseDataLength) !=408 if (le16_to_cpu(mpi_reply->ResponseDataLength) !=
421 sizeof(struct rep_manu_reply))409 sizeof(struct rep_manu_reply))
@@ -439,8 +427,8 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 17 unmodified lines
439 manufacture_reply->component_revision_id;427 manufacture_reply->component_revision_id;
440 }428 }
441 } else429 } else
442 dtransportprintk(ioc, pr_info(MPT3SAS_FMT430 dtransportprintk(ioc,
443 "report_manufacture - no reply\n", ioc->name));431 ioc_info(ioc, "report_manufacture - no reply\n"));
444 432
445 issue_host_reset:433 issue_host_reset:
446 if (issue_reset)434 if (issue_reset)
@@ -448,7 +436,7 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
448 out:436 out:
449 ioc->transport_cmds.status = MPT3_CMD_NOT_USED;437 ioc->transport_cmds.status = MPT3_CMD_NOT_USED;
450 if (data_out)438 if (data_out)
451 pci_free_consistent(ioc->pdev, data_out_sz + data_in_sz,439 dma_free_coherent(&ioc->pdev->dev, data_out_sz + data_in_sz,
452 data_out, data_out_dma);440 data_out, data_out_dma);
453 441
454 mutex_unlock(&ioc->transport_cmds.mutex);442 mutex_unlock(&ioc->transport_cmds.mutex);
@@ -643,8 +631,8 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 188 unmodified lines
643 mpt3sas_port = kzalloc(sizeof(struct _sas_port),631 mpt3sas_port = kzalloc(sizeof(struct _sas_port),
644 GFP_KERNEL);632 GFP_KERNEL);
645 if (!mpt3sas_port) {633 if (!mpt3sas_port) {
646 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",634 ioc_err(ioc, "failure at %s:%d/%s()!\n",
647 ioc->name, __FILE__, __LINE__, __func__);635 __FILE__, __LINE__, __func__);
648 return NULL;636 return NULL;
649 }637 }
650 638
@@ -655,22 +643,21 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 4 unmodified lines
655 spin_unlock_irqrestore(&ioc->sas_node_lock, flags);643 spin_unlock_irqrestore(&ioc->sas_node_lock, flags);
656 644
657 if (!sas_node) {645 if (!sas_node) {
658 pr_err(MPT3SAS_FMT646 ioc_err(ioc, "%s: Could not find parent sas_address(0x%016llx)!\n",
659 "%s: Could not find parent sas_address(0x%016llx)!\n",647 __func__, (u64)sas_address);
660 ioc->name, __func__, (unsigned long long)sas_address);
661 goto out_fail;648 goto out_fail;
662 }649 }
663 650
664 if ((_transport_set_identify(ioc, handle,651 if ((_transport_set_identify(ioc, handle,
665 &mpt3sas_port->remote_identify))) {652 &mpt3sas_port->remote_identify))) {
666 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",653 ioc_err(ioc, "failure at %s:%d/%s()!\n",
667 ioc->name, __FILE__, __LINE__, __func__);654 __FILE__, __LINE__, __func__);
668 goto out_fail;655 goto out_fail;
669 }656 }
670 657
671 if (mpt3sas_port->remote_identify.device_type == SAS_PHY_UNUSED) {658 if (mpt3sas_port->remote_identify.device_type == SAS_PHY_UNUSED) {
672 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",659 ioc_err(ioc, "failure at %s:%d/%s()!\n",
673 ioc->name, __FILE__, __LINE__, __func__);660 __FILE__, __LINE__, __func__);
674 goto out_fail;661 goto out_fail;
675 }662 }
676 663
@@ -687,20 +674,20 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 10 unmodified lines
687 }674 }
688 675
689 if (!mpt3sas_port->num_phys) {676 if (!mpt3sas_port->num_phys) {
690 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",677 ioc_err(ioc, "failure at %s:%d/%s()!\n",
691 ioc->name, __FILE__, __LINE__, __func__);678 __FILE__, __LINE__, __func__);
692 goto out_fail;679 goto out_fail;
693 }680 }
694 681
695 if (!sas_node->parent_dev) {682 if (!sas_node->parent_dev) {
696 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",683 ioc_err(ioc, "failure at %s:%d/%s()!\n",
697 ioc->name, __FILE__, __LINE__, __func__);684 __FILE__, __LINE__, __func__);
698 goto out_fail;685 goto out_fail;
699 }686 }
700 port = sas_port_alloc_num(sas_node->parent_dev);687 port = sas_port_alloc_num(sas_node->parent_dev);
701 if ((sas_port_add(port))) {688 if ((sas_port_add(port))) {
702 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",689 ioc_err(ioc, "failure at %s:%d/%s()!\n",
703 ioc->name, __FILE__, __LINE__, __func__);690 __FILE__, __LINE__, __func__);
704 goto out_fail;691 goto out_fail;
705 }692 }
706 693
@@ -729,17 +716,17 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 22 unmodified lines
729 sas_device = mpt3sas_get_sdev_by_addr(ioc,716 sas_device = mpt3sas_get_sdev_by_addr(ioc,
730 mpt3sas_port->remote_identify.sas_address);717 mpt3sas_port->remote_identify.sas_address);
731 if (!sas_device) {718 if (!sas_device) {
732 dfailprintk(ioc, printk(MPT3SAS_FMT719 dfailprintk(ioc,
733 "failure at %s:%d/%s()!\n",720 ioc_info(ioc, "failure at %s:%d/%s()!\n",
734 ioc->name, __FILE__, __LINE__, __func__));721 __FILE__, __LINE__, __func__));
735 goto out_fail;722 goto out_fail;
736 }723 }
737 sas_device->pend_sas_rphy_add = 1;724 sas_device->pend_sas_rphy_add = 1;
738 }725 }
739 726
740 if ((sas_rphy_add(rphy))) {727 if ((sas_rphy_add(rphy))) {
741 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",728 ioc_err(ioc, "failure at %s:%d/%s()!\n",
742 ioc->name, __FILE__, __LINE__, __func__);729 __FILE__, __LINE__, __func__);
743 }730 }
744 731
745 if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) {732 if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) {
@@ -861,14 +848,14 @@ mpt3sas_transport_add_host_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy · 115 unmodified lines
861 INIT_LIST_HEAD(&mpt3sas_phy->port_siblings);848 INIT_LIST_HEAD(&mpt3sas_phy->port_siblings);
862 phy = sas_phy_alloc(parent_dev, phy_index);849 phy = sas_phy_alloc(parent_dev, phy_index);
863 if (!phy) {850 if (!phy) {
864 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",851 ioc_err(ioc, "failure at %s:%d/%s()!\n",
865 ioc->name, __FILE__, __LINE__, __func__);852 __FILE__, __LINE__, __func__);
866 return -1;853 return -1;
867 }854 }
868 if ((_transport_set_identify(ioc, mpt3sas_phy->handle,855 if ((_transport_set_identify(ioc, mpt3sas_phy->handle,
869 &mpt3sas_phy->identify))) {856 &mpt3sas_phy->identify))) {
870 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",857 ioc_err(ioc, "failure at %s:%d/%s()!\n",
871 ioc->name, __FILE__, __LINE__, __func__);858 __FILE__, __LINE__, __func__);
872 sas_phy_free(phy);859 sas_phy_free(phy);
873 return -1;860 return -1;
874 }861 }
@@ -890,8 +877,8 @@ mpt3sas_transport_add_host_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy · 15 unmodified lines
890 phy_pg0.ProgrammedLinkRate >> 4);877 phy_pg0.ProgrammedLinkRate >> 4);
891 878
892 if ((sas_phy_add(phy))) {879 if ((sas_phy_add(phy))) {
893 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",880 ioc_err(ioc, "failure at %s:%d/%s()!\n",
894 ioc->name, __FILE__, __LINE__, __func__);881 __FILE__, __LINE__, __func__);
895 sas_phy_free(phy);882 sas_phy_free(phy);
896 return -1;883 return -1;
897 }884 }
@@ -929,14 +916,14 @@ mpt3sas_transport_add_expander_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy · 31 unmodified lines
929 INIT_LIST_HEAD(&mpt3sas_phy->port_siblings);916 INIT_LIST_HEAD(&mpt3sas_phy->port_siblings);
930 phy = sas_phy_alloc(parent_dev, phy_index);917 phy = sas_phy_alloc(parent_dev, phy_index);
931 if (!phy) {918 if (!phy) {
932 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",919 ioc_err(ioc, "failure at %s:%d/%s()!\n",
933 ioc->name, __FILE__, __LINE__, __func__);920 __FILE__, __LINE__, __func__);
934 return -1;921 return -1;
935 }922 }
936 if ((_transport_set_identify(ioc, mpt3sas_phy->handle,923 if ((_transport_set_identify(ioc, mpt3sas_phy->handle,
937 &mpt3sas_phy->identify))) {924 &mpt3sas_phy->identify))) {
938 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",925 ioc_err(ioc, "failure at %s:%d/%s()!\n",
939 ioc->name, __FILE__, __LINE__, __func__);926 __FILE__, __LINE__, __func__);
940 sas_phy_free(phy);927 sas_phy_free(phy);
941 return -1;928 return -1;
942 }929 }
@@ -960,8 +947,8 @@ mpt3sas_transport_add_expander_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy · 17 unmodified lines
960 expander_pg1.ProgrammedLinkRate >> 4);947 expander_pg1.ProgrammedLinkRate >> 4);
961 948
962 if ((sas_phy_add(phy))) {949 if ((sas_phy_add(phy))) {
963 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",950 ioc_err(ioc, "failure at %s:%d/%s()!\n",
964 ioc->name, __FILE__, __LINE__, __func__);951 __FILE__, __LINE__, __func__);
965 sas_phy_free(phy);952 sas_phy_free(phy);
966 return -1;953 return -1;
967 }954 }
@@ -1098,16 +1085,14 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 130 unmodified lines
1098 u16 wait_state_count;1085 u16 wait_state_count;
1099 1086
1100 if (ioc->shost_recovery || ioc->pci_error_recovery) {1087 if (ioc->shost_recovery || ioc->pci_error_recovery) {
1101 pr_info(MPT3SAS_FMT "%s: host reset in progress!\n",1088 ioc_info(ioc, "%s: host reset in progress!\n", __func__);
1102 __func__, ioc->name);
1103 return -EFAULT;1089 return -EFAULT;
1104 }1090 }
1105 1091
1106 mutex_lock(&ioc->transport_cmds.mutex);1092 mutex_lock(&ioc->transport_cmds.mutex);
1107 1093
1108 if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {1094 if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {
1109 pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n",1095 ioc_err(ioc, "%s: transport_cmds in use\n", __func__);
1110 ioc->name, __func__);
1111 rc = -EAGAIN;1096 rc = -EAGAIN;
1112 goto out;1097 goto out;
1113 }1098 }
@@ -1117,26 +1102,22 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
1117 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);1102 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
1118 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {1103 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
1119 if (wait_state_count++ == 10) {1104 if (wait_state_count++ == 10) {
1120 pr_err(MPT3SAS_FMT1105 ioc_err(ioc, "%s: failed due to ioc not operational\n",
1121 "%s: failed due to ioc not operational\n",1106 __func__);
1122 ioc->name, __func__);
1123 rc = -EFAULT;1107 rc = -EFAULT;
1124 goto out;1108 goto out;
1125 }1109 }
1126 ssleep(1);1110 ssleep(1);
1127 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);1111 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
1128 pr_info(MPT3SAS_FMT1112 ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
1129 "%s: waiting for operational state(count=%d)\n",1113 __func__, wait_state_count);
1130 ioc->name, __func__, wait_state_count);
1131 }1114 }
1132 if (wait_state_count)1115 if (wait_state_count)
1133 pr_info(MPT3SAS_FMT "%s: ioc is operational\n",1116 ioc_info(ioc, "%s: ioc is operational\n", __func__);
1134 ioc->name, __func__);
1135 1117
1136 smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);1118 smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);
1137 if (!smid) {1119 if (!smid) {
1138 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",1120 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
1139 ioc->name, __func__);
1140 rc = -EAGAIN;1121 rc = -EAGAIN;
1141 goto out;1122 goto out;
1142 }1123 }
@@ -1146,7 +1127,8 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
1146 1127
1147 sz = sizeof(struct phy_error_log_request) +1128 sz = sizeof(struct phy_error_log_request) +
1148 sizeof(struct phy_error_log_reply);1129 sizeof(struct phy_error_log_reply);
1149 data_out = pci_alloc_consistent(ioc->pdev, sz, &data_out_dma);1130 data_out = dma_alloc_coherent(&ioc->pdev->dev, sz, &data_out_dma,
1131 GFP_KERNEL);
1150 if (!data_out) {1132 if (!data_out) {
1151 pr_err("failure at %s:%d/%s()!\n", __FILE__,1133 pr_err("failure at %s:%d/%s()!\n", __FILE__,
1152 __LINE__, __func__);1134 __LINE__, __func__);
@@ -1179,17 +1161,16 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 26 unmodified lines
1179 data_out_dma + sizeof(struct phy_error_log_request),1161 data_out_dma + sizeof(struct phy_error_log_request),
1180 sizeof(struct phy_error_log_reply));1162 sizeof(struct phy_error_log_reply));
1181 1163
1182 dtransportprintk(ioc, pr_info(MPT3SAS_FMT1164 dtransportprintk(ioc,
1183 "phy_error_log - send to sas_addr(0x%016llx), phy(%d)\n",1165 ioc_info(ioc, "phy_error_log - send to sas_addr(0x%016llx), phy(%d)\n",
1184 ioc->name, (unsigned long long)phy->identify.sas_address,1166 (u64)phy->identify.sas_address,
1185 phy->number));1167 phy->number));
1186 init_completion(&ioc->transport_cmds.done);1168 init_completion(&ioc->transport_cmds.done);
1187 mpt3sas_base_put_smid_default(ioc, smid);1169 mpt3sas_base_put_smid_default(ioc, smid);
1188 wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);1170 wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
1189 1171
1190 if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {1172 if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
1191 pr_err(MPT3SAS_FMT "%s: timeout\n",1173 ioc_err(ioc, "%s: timeout\n", __func__);
1192 ioc->name, __func__);
1193 _debug_dump_mf(mpi_request,1174 _debug_dump_mf(mpi_request,
1194 sizeof(Mpi2SmpPassthroughRequest_t)/4);1175 sizeof(Mpi2SmpPassthroughRequest_t)/4);
1195 if (!(ioc->transport_cmds.status & MPT3_CMD_RESET))1176 if (!(ioc->transport_cmds.status & MPT3_CMD_RESET))
@@ -1197,16 +1178,15 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
1197 goto issue_host_reset;1178 goto issue_host_reset;
1198 }1179 }
1199 1180
1200 dtransportprintk(ioc, pr_info(MPT3SAS_FMT1181 dtransportprintk(ioc, ioc_info(ioc, "phy_error_log - complete\n"));
1201 "phy_error_log - complete\n", ioc->name));
1202 1182
1203 if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) {1183 if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) {
1204 1184
1205 mpi_reply = ioc->transport_cmds.reply;1185 mpi_reply = ioc->transport_cmds.reply;
1206 1186
1207 dtransportprintk(ioc, pr_info(MPT3SAS_FMT1187 dtransportprintk(ioc,
1208 "phy_error_log - reply data transfer size(%d)\n",1188 ioc_info(ioc, "phy_error_log - reply data transfer size(%d)\n",
1209 ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength)));1189 le16_to_cpu(mpi_reply->ResponseDataLength)));
1210 1190
1211 if (le16_to_cpu(mpi_reply->ResponseDataLength) !=1191 if (le16_to_cpu(mpi_reply->ResponseDataLength) !=
1212 sizeof(struct phy_error_log_reply))1192 sizeof(struct phy_error_log_reply))
@@ -1215,9 +1195,9 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines
1215 phy_error_log_reply = data_out +1195 phy_error_log_reply = data_out +
1216 sizeof(struct phy_error_log_request);1196 sizeof(struct phy_error_log_request);
1217 1197
1218 dtransportprintk(ioc, pr_info(MPT3SAS_FMT1198 dtransportprintk(ioc,
1219 "phy_error_log - function_result(%d)\n",1199 ioc_info(ioc, "phy_error_log - function_result(%d)\n",
1220 ioc->name, phy_error_log_reply->function_result));1200 phy_error_log_reply->function_result));
1221 1201
1222 phy->invalid_dword_count =1202 phy->invalid_dword_count =
1223 be32_to_cpu(phy_error_log_reply->invalid_dword);1203 be32_to_cpu(phy_error_log_reply->invalid_dword);
@@ -1229,8 +1209,8 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 5 unmodified lines
1229 be32_to_cpu(phy_error_log_reply->phy_reset_problem);1209 be32_to_cpu(phy_error_log_reply->phy_reset_problem);
1230 rc = 0;1210 rc = 0;
1231 } else1211 } else
1232 dtransportprintk(ioc, pr_info(MPT3SAS_FMT1212 dtransportprintk(ioc,
1233 "phy_error_log - no reply\n", ioc->name));1213 ioc_info(ioc, "phy_error_log - no reply\n"));
1234 1214
1235 issue_host_reset:1215 issue_host_reset:
1236 if (issue_reset)1216 if (issue_reset)
@@ -1238,7 +1218,7 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
1238 out:1218 out:
1239 ioc->transport_cmds.status = MPT3_CMD_NOT_USED;1219 ioc->transport_cmds.status = MPT3_CMD_NOT_USED;
1240 if (data_out)1220 if (data_out)
1241 pci_free_consistent(ioc->pdev, sz, data_out, data_out_dma);1221 dma_free_coherent(&ioc->pdev->dev, sz, data_out, data_out_dma);
1242 1222
1243 mutex_unlock(&ioc->transport_cmds.mutex);1223 mutex_unlock(&ioc->transport_cmds.mutex);
1244 return rc;1224 return rc;
@@ -1273,17 +1253,16 @@ _transport_get_linkerrors(struct sas_phy *phy) · 28 unmodified lines
1273 /* get hba phy error logs */1253 /* get hba phy error logs */
1274 if ((mpt3sas_config_get_phy_pg1(ioc, &mpi_reply, &phy_pg1,1254 if ((mpt3sas_config_get_phy_pg1(ioc, &mpi_reply, &phy_pg1,
1275 phy->number))) {1255 phy->number))) {
1276 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1256 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1277 ioc->name, __FILE__, __LINE__, __func__);1257 __FILE__, __LINE__, __func__);
1278 return -ENXIO;1258 return -ENXIO;
1279 }1259 }
1280 1260
1281 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo)1261 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo)
1282 pr_info(MPT3SAS_FMT1262 ioc_info(ioc, "phy(%d), ioc_status (0x%04x), loginfo(0x%08x)\n",
1283 "phy(%d), ioc_status (0x%04x), loginfo(0x%08x)\n",1263 phy->number,
1284 ioc->name, phy->number,1264 le16_to_cpu(mpi_reply.IOCStatus),
1285 le16_to_cpu(mpi_reply.IOCStatus),1265 le32_to_cpu(mpi_reply.IOCLogInfo));
1286 le32_to_cpu(mpi_reply.IOCLogInfo));
1287 1266
1288 phy->invalid_dword_count = le32_to_cpu(phy_pg1.InvalidDwordCount);1267 phy->invalid_dword_count = le32_to_cpu(phy_pg1.InvalidDwordCount);
1289 phy->running_disparity_error_count =1268 phy->running_disparity_error_count =
@@ -1411,16 +1390,14 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 121 unmodified lines
1411 u16 wait_state_count;1390 u16 wait_state_count;
1412 1391
1413 if (ioc->shost_recovery || ioc->pci_error_recovery) {1392 if (ioc->shost_recovery || ioc->pci_error_recovery) {
1414 pr_info(MPT3SAS_FMT "%s: host reset in progress!\n",1393 ioc_info(ioc, "%s: host reset in progress!\n", __func__);
1415 __func__, ioc->name);
1416 return -EFAULT;1394 return -EFAULT;
1417 }1395 }
1418 1396
1419 mutex_lock(&ioc->transport_cmds.mutex);1397 mutex_lock(&ioc->transport_cmds.mutex);
1420 1398
1421 if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {1399 if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {
1422 pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n",1400 ioc_err(ioc, "%s: transport_cmds in use\n", __func__);
1423 ioc->name, __func__);
1424 rc = -EAGAIN;1401 rc = -EAGAIN;
1425 goto out;1402 goto out;
1426 }1403 }
@@ -1430,26 +1407,22 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
1430 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);1407 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
1431 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {1408 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
1432 if (wait_state_count++ == 10) {1409 if (wait_state_count++ == 10) {
1433 pr_err(MPT3SAS_FMT1410 ioc_err(ioc, "%s: failed due to ioc not operational\n",
1434 "%s: failed due to ioc not operational\n",1411 __func__);
1435 ioc->name, __func__);
1436 rc = -EFAULT;1412 rc = -EFAULT;
1437 goto out;1413 goto out;
1438 }1414 }
1439 ssleep(1);1415 ssleep(1);
1440 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);1416 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
1441 pr_info(MPT3SAS_FMT1417 ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
1442 "%s: waiting for operational state(count=%d)\n",1418 __func__, wait_state_count);
1443 ioc->name, __func__, wait_state_count);
1444 }1419 }
1445 if (wait_state_count)1420 if (wait_state_count)
1446 pr_info(MPT3SAS_FMT "%s: ioc is operational\n",1421 ioc_info(ioc, "%s: ioc is operational\n", __func__);
1447 ioc->name, __func__);
1448 1422
1449 smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);1423 smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);
1450 if (!smid) {1424 if (!smid) {
1451 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",1425 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
1452 ioc->name, __func__);
1453 rc = -EAGAIN;1426 rc = -EAGAIN;
1454 goto out;1427 goto out;
1455 }1428 }
@@ -1459,7 +1432,8 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
1459 1432
1460 sz = sizeof(struct phy_control_request) +1433 sz = sizeof(struct phy_control_request) +
1461 sizeof(struct phy_control_reply);1434 sizeof(struct phy_control_reply);
1462 data_out = pci_alloc_consistent(ioc->pdev, sz, &data_out_dma);1435 data_out = dma_alloc_coherent(&ioc->pdev->dev, sz, &data_out_dma,
1436 GFP_KERNEL);
1463 if (!data_out) {1437 if (!data_out) {
1464 pr_err("failure at %s:%d/%s()!\n", __FILE__,1438 pr_err("failure at %s:%d/%s()!\n", __FILE__,
1465 __LINE__, __func__);1439 __LINE__, __func__);
@@ -1497,17 +1471,16 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 31 unmodified lines
1497 data_out_dma + sizeof(struct phy_control_request),1471 data_out_dma + sizeof(struct phy_control_request),
1498 sizeof(struct phy_control_reply));1472 sizeof(struct phy_control_reply));
1499 1473
1500 dtransportprintk(ioc, pr_info(MPT3SAS_FMT1474 dtransportprintk(ioc,
1501 "phy_control - send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n",1475 ioc_info(ioc, "phy_control - send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n",
1502 ioc->name, (unsigned long long)phy->identify.sas_address,1476 (u64)phy->identify.sas_address,
1503 phy->number, phy_operation));1477 phy->number, phy_operation));
1504 init_completion(&ioc->transport_cmds.done);1478 init_completion(&ioc->transport_cmds.done);
1505 mpt3sas_base_put_smid_default(ioc, smid);1479 mpt3sas_base_put_smid_default(ioc, smid);
1506 wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);1480 wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
1507 1481
1508 if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {1482 if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
1509 pr_err(MPT3SAS_FMT "%s: timeout\n",1483 ioc_err(ioc, "%s: timeout\n", __func__);
1510 ioc->name, __func__);
1511 _debug_dump_mf(mpi_request,1484 _debug_dump_mf(mpi_request,
1512 sizeof(Mpi2SmpPassthroughRequest_t)/4);1485 sizeof(Mpi2SmpPassthroughRequest_t)/4);
1513 if (!(ioc->transport_cmds.status & MPT3_CMD_RESET))1486 if (!(ioc->transport_cmds.status & MPT3_CMD_RESET))
@@ -1515,16 +1488,15 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
1515 goto issue_host_reset;1488 goto issue_host_reset;
1516 }1489 }
1517 1490
1518 dtransportprintk(ioc, pr_info(MPT3SAS_FMT1491 dtransportprintk(ioc, ioc_info(ioc, "phy_control - complete\n"));
1519 "phy_control - complete\n", ioc->name));
1520 1492
1521 if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) {1493 if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) {
1522 1494
1523 mpi_reply = ioc->transport_cmds.reply;1495 mpi_reply = ioc->transport_cmds.reply;
1524 1496
1525 dtransportprintk(ioc, pr_info(MPT3SAS_FMT1497 dtransportprintk(ioc,
1526 "phy_control - reply data transfer size(%d)\n",1498 ioc_info(ioc, "phy_control - reply data transfer size(%d)\n",
1527 ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength)));1499 le16_to_cpu(mpi_reply->ResponseDataLength)));
1528 1500
1529 if (le16_to_cpu(mpi_reply->ResponseDataLength) !=1501 if (le16_to_cpu(mpi_reply->ResponseDataLength) !=
1530 sizeof(struct phy_control_reply))1502 sizeof(struct phy_control_reply))
@@ -1533,14 +1505,14 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines
1533 phy_control_reply = data_out +1505 phy_control_reply = data_out +
1534 sizeof(struct phy_control_request);1506 sizeof(struct phy_control_request);
1535 1507
1536 dtransportprintk(ioc, pr_info(MPT3SAS_FMT1508 dtransportprintk(ioc,
1537 "phy_control - function_result(%d)\n",1509 ioc_info(ioc, "phy_control - function_result(%d)\n",
1538 ioc->name, phy_control_reply->function_result));1510 phy_control_reply->function_result));
1539 1511
1540 rc = 0;1512 rc = 0;
1541 } else1513 } else
1542 dtransportprintk(ioc, pr_info(MPT3SAS_FMT1514 dtransportprintk(ioc,
1543 "phy_control - no reply\n", ioc->name));1515 ioc_info(ioc, "phy_control - no reply\n"));
1544 1516
1545 issue_host_reset:1517 issue_host_reset:
1546 if (issue_reset)1518 if (issue_reset)
@@ -1548,7 +1520,8 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
1548 out:1520 out:
1549 ioc->transport_cmds.status = MPT3_CMD_NOT_USED;1521 ioc->transport_cmds.status = MPT3_CMD_NOT_USED;
1550 if (data_out)1522 if (data_out)
1551 pci_free_consistent(ioc->pdev, sz, data_out, data_out_dma);1523 dma_free_coherent(&ioc->pdev->dev, sz, data_out,
1524 data_out_dma);
1552 1525
1553 mutex_unlock(&ioc->transport_cmds.mutex);1526 mutex_unlock(&ioc->transport_cmds.mutex);
1554 return rc;1527 return rc;
@@ -1591,16 +1564,15 @@ _transport_phy_reset(struct sas_phy *phy, int hard_reset) · 36 unmodified lines
1591 mpi_request.PhyNum = phy->number;1564 mpi_request.PhyNum = phy->number;
1592 1565
1593 if ((mpt3sas_base_sas_iounit_control(ioc, &mpi_reply, &mpi_request))) {1566 if ((mpt3sas_base_sas_iounit_control(ioc, &mpi_reply, &mpi_request))) {
1594 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1567 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1595 ioc->name, __FILE__, __LINE__, __func__);1568 __FILE__, __LINE__, __func__);
1596 return -ENXIO;1569 return -ENXIO;
1597 }1570 }
1598 1571
1599 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo)1572 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo)
1600 pr_info(MPT3SAS_FMT1573 ioc_info(ioc, "phy(%d), ioc_status(0x%04x), loginfo(0x%08x)\n",
1601 "phy(%d), ioc_status(0x%04x), loginfo(0x%08x)\n",1574 phy->number, le16_to_cpu(mpi_reply.IOCStatus),
1602 ioc->name, phy->number, le16_to_cpu(mpi_reply.IOCStatus),1575 le32_to_cpu(mpi_reply.IOCLogInfo));
1603 le32_to_cpu(mpi_reply.IOCLogInfo));
1604 1576
1605 return 0;1577 return 0;
1606}1578}
@@ -1647,23 +1619,23 @@ _transport_phy_enable(struct sas_phy *phy, int enable) · 40 unmodified lines
1647 sizeof(Mpi2SasIOUnit0PhyData_t));1619 sizeof(Mpi2SasIOUnit0PhyData_t));
1648 sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL);1620 sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL);
1649 if (!sas_iounit_pg0) {1621 if (!sas_iounit_pg0) {
1650 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1622 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1651 ioc->name, __FILE__, __LINE__, __func__);1623 __FILE__, __LINE__, __func__);
1652 rc = -ENOMEM;1624 rc = -ENOMEM;
1653 goto out;1625 goto out;
1654 }1626 }
1655 if ((mpt3sas_config_get_sas_iounit_pg0(ioc, &mpi_reply,1627 if ((mpt3sas_config_get_sas_iounit_pg0(ioc, &mpi_reply,
1656 sas_iounit_pg0, sz))) {1628 sas_iounit_pg0, sz))) {
1657 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1629 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1658 ioc->name, __FILE__, __LINE__, __func__);1630 __FILE__, __LINE__, __func__);
1659 rc = -ENXIO;1631 rc = -ENXIO;
1660 goto out;1632 goto out;
1661 }1633 }
1662 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &1634 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
1663 MPI2_IOCSTATUS_MASK;1635 MPI2_IOCSTATUS_MASK;
1664 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {1636 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
1665 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1637 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1666 ioc->name, __FILE__, __LINE__, __func__);1638 __FILE__, __LINE__, __func__);
1667 rc = -EIO;1639 rc = -EIO;
1668 goto out;1640 goto out;
1669 }1641 }
@@ -1672,10 +1644,8 @@ _transport_phy_enable(struct sas_phy *phy, int enable) · 2 unmodified lines
1672 for (i = 0, discovery_active = 0; i < ioc->sas_hba.num_phys ; i++) {1644 for (i = 0, discovery_active = 0; i < ioc->sas_hba.num_phys ; i++) {
1673 if (sas_iounit_pg0->PhyData[i].PortFlags &1645 if (sas_iounit_pg0->PhyData[i].PortFlags &
1674 MPI2_SASIOUNIT0_PORTFLAGS_DISCOVERY_IN_PROGRESS) {1646 MPI2_SASIOUNIT0_PORTFLAGS_DISCOVERY_IN_PROGRESS) {
1675 pr_err(MPT3SAS_FMT "discovery is active on " \1647 ioc_err(ioc, "discovery is active on port = %d, phy = %d: unable to enable/disable phys, try again later!\n",
1676 "port = %d, phy = %d: unable to enable/disable "1648 sas_iounit_pg0->PhyData[i].Port, i);
1677 "phys, try again later!\n", ioc->name,
1678 sas_iounit_pg0->PhyData[i].Port, i);
1679 discovery_active = 1;1649 discovery_active = 1;
1680 }1650 }
1681 }1651 }
@@ -1690,23 +1660,23 @@ _transport_phy_enable(struct sas_phy *phy, int enable) · 8 unmodified lines
1690 sizeof(Mpi2SasIOUnit1PhyData_t));1660 sizeof(Mpi2SasIOUnit1PhyData_t));
1691 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);1661 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
1692 if (!sas_iounit_pg1) {1662 if (!sas_iounit_pg1) {
1693 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1663 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1694 ioc->name, __FILE__, __LINE__, __func__);1664 __FILE__, __LINE__, __func__);
1695 rc = -ENOMEM;1665 rc = -ENOMEM;
1696 goto out;1666 goto out;
1697 }1667 }
1698 if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,1668 if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
1699 sas_iounit_pg1, sz))) {1669 sas_iounit_pg1, sz))) {
1700 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1670 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1701 ioc->name, __FILE__, __LINE__, __func__);1671 __FILE__, __LINE__, __func__);
1702 rc = -ENXIO;1672 rc = -ENXIO;
1703 goto out;1673 goto out;
1704 }1674 }
1705 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &1675 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
1706 MPI2_IOCSTATUS_MASK;1676 MPI2_IOCSTATUS_MASK;
1707 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {1677 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
1708 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1678 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1709 ioc->name, __FILE__, __LINE__, __func__);1679 __FILE__, __LINE__, __func__);
1710 rc = -EIO;1680 rc = -EIO;
1711 goto out;1681 goto out;
1712 }1682 }
@@ -1798,23 +1768,23 @@ _transport_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates) · 85 unmodified lines
1798 sizeof(Mpi2SasIOUnit1PhyData_t));1768 sizeof(Mpi2SasIOUnit1PhyData_t));
1799 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);1769 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
1800 if (!sas_iounit_pg1) {1770 if (!sas_iounit_pg1) {
1801 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1771 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1802 ioc->name, __FILE__, __LINE__, __func__);1772 __FILE__, __LINE__, __func__);
1803 rc = -ENOMEM;1773 rc = -ENOMEM;
1804 goto out;1774 goto out;
1805 }1775 }
1806 if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,1776 if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
1807 sas_iounit_pg1, sz))) {1777 sas_iounit_pg1, sz))) {
1808 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1778 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1809 ioc->name, __FILE__, __LINE__, __func__);1779 __FILE__, __LINE__, __func__);
1810 rc = -ENXIO;1780 rc = -ENXIO;
1811 goto out;1781 goto out;
1812 }1782 }
1813 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &1783 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
1814 MPI2_IOCSTATUS_MASK;1784 MPI2_IOCSTATUS_MASK;
1815 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {1785 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
1816 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1786 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1817 ioc->name, __FILE__, __LINE__, __func__);1787 __FILE__, __LINE__, __func__);
1818 rc = -EIO;1788 rc = -EIO;
1819 goto out;1789 goto out;
1820 }1790 }
@@ -1833,8 +1803,8 @@ _transport_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates) · 12 unmodified lines
1833 1803
1834 if (mpt3sas_config_set_sas_iounit_pg1(ioc, &mpi_reply, sas_iounit_pg1,1804 if (mpt3sas_config_set_sas_iounit_pg1(ioc, &mpi_reply, sas_iounit_pg1,
1835 sz)) {1805 sz)) {
1836 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",1806 ioc_err(ioc, "failure at %s:%d/%s()!\n",
1837 ioc->name, __FILE__, __LINE__, __func__);1807 __FILE__, __LINE__, __func__);
1838 rc = -ENXIO;1808 rc = -ENXIO;
1839 goto out;1809 goto out;
1840 }1810 }
@@ -1922,8 +1892,7 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 81 unmodified lines
1922 unsigned int reslen = 0;1892 unsigned int reslen = 0;
1923 1893
1924 if (ioc->shost_recovery || ioc->pci_error_recovery) {1894 if (ioc->shost_recovery || ioc->pci_error_recovery) {
1925 pr_info(MPT3SAS_FMT "%s: host reset in progress!\n",1895 ioc_info(ioc, "%s: host reset in progress!\n", __func__);
1926 __func__, ioc->name);
1927 rc = -EFAULT;1896 rc = -EFAULT;
1928 goto job_done;1897 goto job_done;
1929 }1898 }
@@ -1933,8 +1902,8 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 3 unmodified lines
1933 goto job_done;1902 goto job_done;
1934 1903
1935 if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {1904 if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {
1936 pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", ioc->name,1905 ioc_err(ioc, "%s: transport_cmds in use\n",
1937 __func__);1906 __func__);
1938 rc = -EAGAIN;1907 rc = -EAGAIN;
1939 goto out;1908 goto out;
1940 }1909 }
@@ -1959,26 +1928,22 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 18 unmodified lines
1959 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);1928 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
1960 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {1929 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
1961 if (wait_state_count++ == 10) {1930 if (wait_state_count++ == 10) {
1962 pr_err(MPT3SAS_FMT1931 ioc_err(ioc, "%s: failed due to ioc not operational\n",
1963 "%s: failed due to ioc not operational\n",1932 __func__);
1964 ioc->name, __func__);
1965 rc = -EFAULT;1933 rc = -EFAULT;
1966 goto unmap_in;1934 goto unmap_in;
1967 }1935 }
1968 ssleep(1);1936 ssleep(1);
1969 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);1937 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
1970 pr_info(MPT3SAS_FMT1938 ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
1971 "%s: waiting for operational state(count=%d)\n",1939 __func__, wait_state_count);
1972 ioc->name, __func__, wait_state_count);
1973 }1940 }
1974 if (wait_state_count)1941 if (wait_state_count)
1975 pr_info(MPT3SAS_FMT "%s: ioc is operational\n",1942 ioc_info(ioc, "%s: ioc is operational\n", __func__);
1976 ioc->name, __func__);
1977 1943
1978 smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);1944 smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);
1979 if (!smid) {1945 if (!smid) {
1980 pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",1946 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
1981 ioc->name, __func__);
1982 rc = -EAGAIN;1947 rc = -EAGAIN;
1983 goto unmap_in;1948 goto unmap_in;
1984 }1949 }
@@ -1999,16 +1964,15 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 14 unmodified lines
1999 ioc->build_sg(ioc, psge, dma_addr_out, dma_len_out - 4, dma_addr_in,1964 ioc->build_sg(ioc, psge, dma_addr_out, dma_len_out - 4, dma_addr_in,
2000 dma_len_in - 4);1965 dma_len_in - 4);
2001 1966
2002 dtransportprintk(ioc, pr_info(MPT3SAS_FMT1967 dtransportprintk(ioc,
2003 "%s - sending smp request\n", ioc->name, __func__));1968 ioc_info(ioc, "%s: sending smp request\n", __func__));
2004 1969
2005 init_completion(&ioc->transport_cmds.done);1970 init_completion(&ioc->transport_cmds.done);
2006 mpt3sas_base_put_smid_default(ioc, smid);1971 mpt3sas_base_put_smid_default(ioc, smid);
2007 wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);1972 wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
2008 1973
2009 if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {1974 if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
2010 pr_err(MPT3SAS_FMT "%s : timeout\n",1975 ioc_err(ioc, "%s: timeout\n", __func__);
2011 __func__, ioc->name);
2012 _debug_dump_mf(mpi_request,1976 _debug_dump_mf(mpi_request,
2013 sizeof(Mpi2SmpPassthroughRequest_t)/4);1977 sizeof(Mpi2SmpPassthroughRequest_t)/4);
2014 if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) {1978 if (!(ioc->transport_cmds.status & MPT3_CMD_RESET)) {
@@ -2018,12 +1982,11 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 3 unmodified lines
2018 }1982 }
2019 }1983 }
2020 1984
2021 dtransportprintk(ioc, pr_info(MPT3SAS_FMT1985 dtransportprintk(ioc, ioc_info(ioc, "%s - complete\n", __func__));
2022 "%s - complete\n", ioc->name, __func__));
2023 1986
2024 if (!(ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID)) {1987 if (!(ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID)) {
2025 dtransportprintk(ioc, pr_info(MPT3SAS_FMT1988 dtransportprintk(ioc,
2026 "%s - no reply\n", ioc->name, __func__));1989 ioc_info(ioc, "%s: no reply\n", __func__));
2027 rc = -ENXIO;1990 rc = -ENXIO;
2028 goto unmap_in;1991 goto unmap_in;
2029 }1992 }
@@ -2031,9 +1994,9 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 1 unmodified line
2031 mpi_reply = ioc->transport_cmds.reply;1994 mpi_reply = ioc->transport_cmds.reply;
2032 1995
2033 dtransportprintk(ioc,1996 dtransportprintk(ioc,
2034 pr_info(MPT3SAS_FMT "%s - reply data transfer size(%d)\n",1997 ioc_info(ioc, "%s: reply data transfer size(%d)\n",
2035 ioc->name, __func__,1998 __func__,
2036 le16_to_cpu(mpi_reply->ResponseDataLength)));1999 le16_to_cpu(mpi_reply->ResponseDataLength)));
2037 2000
2038 memcpy(job->reply, mpi_reply, sizeof(*mpi_reply));2001 memcpy(job->reply, mpi_reply, sizeof(*mpi_reply));
2039 job->reply_len = sizeof(*mpi_reply);2002 job->reply_len = sizeof(*mpi_reply);
drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c+50−51
@@ -72,8 +72,7 @@ _mpt3sas_raise_sigio(struct MPT3SAS_ADAPTER *ioc, · 71 unmodified lines
72 u16 sz, event_data_sz;72 u16 sz, event_data_sz;
73 unsigned long flags;73 unsigned long flags;
74 74
75 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n",75 dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: enter\n", __func__));
76 ioc->name, __func__));
77 76
78 sz = offsetof(Mpi2EventNotificationReply_t, EventData) +77 sz = offsetof(Mpi2EventNotificationReply_t, EventData) +
79 sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T) + 4;78 sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T) + 4;
@@ -85,23 +84,23 @@ _mpt3sas_raise_sigio(struct MPT3SAS_ADAPTER *ioc, · 5 unmodified lines
85 mpi_reply->EventDataLength = cpu_to_le16(event_data_sz);84 mpi_reply->EventDataLength = cpu_to_le16(event_data_sz);
86 memcpy(&mpi_reply->EventData, event_data,85 memcpy(&mpi_reply->EventData, event_data,
87 sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));86 sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
88 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT87 dTriggerDiagPrintk(ioc,
89 "%s: add to driver event log\n",88 ioc_info(ioc, "%s: add to driver event log\n",
90 ioc->name, __func__));89 __func__));
91 mpt3sas_ctl_add_to_event_log(ioc, mpi_reply);90 mpt3sas_ctl_add_to_event_log(ioc, mpi_reply);
92 kfree(mpi_reply);91 kfree(mpi_reply);
93 out:92 out:
94 93
95 /* clearing the diag_trigger_active flag */94 /* clearing the diag_trigger_active flag */
96 spin_lock_irqsave(&ioc->diag_trigger_lock, flags);95 spin_lock_irqsave(&ioc->diag_trigger_lock, flags);
97 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT96 dTriggerDiagPrintk(ioc,
98 "%s: clearing diag_trigger_active flag\n",97 ioc_info(ioc, "%s: clearing diag_trigger_active flag\n",
99 ioc->name, __func__));98 __func__));
100 ioc->diag_trigger_active = 0;99 ioc->diag_trigger_active = 0;
101 spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags);100 spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags);
102 101
103 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,102 dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
104 __func__));103 __func__));
105}104}
106 105
107/**106/**
@@ -115,22 +114,22 @@ mpt3sas_process_trigger_data(struct MPT3SAS_ADAPTER *ioc, · 7 unmodified lines
115{114{
116 u8 issue_reset = 0;115 u8 issue_reset = 0;
117 116
118 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n",117 dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: enter\n", __func__));
119 ioc->name, __func__));
120 118
121 /* release the diag buffer trace */119 /* release the diag buffer trace */
122 if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &120 if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
123 MPT3_DIAG_BUFFER_IS_RELEASED) == 0) {121 MPT3_DIAG_BUFFER_IS_RELEASED) == 0) {
124 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT122 dTriggerDiagPrintk(ioc,
125 "%s: release trace diag buffer\n", ioc->name, __func__));123 ioc_info(ioc, "%s: release trace diag buffer\n",
124 __func__));
126 mpt3sas_send_diag_release(ioc, MPI2_DIAG_BUF_TYPE_TRACE,125 mpt3sas_send_diag_release(ioc, MPI2_DIAG_BUF_TYPE_TRACE,
127 &issue_reset);126 &issue_reset);
128 }127 }
129 128
130 _mpt3sas_raise_sigio(ioc, event_data);129 _mpt3sas_raise_sigio(ioc, event_data);
131 130
132 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,131 dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
133 __func__));132 __func__));
134}133}
135 134
136/**135/**
@@ -168,9 +167,9 @@ mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, u32 trigger_bitmask) · 31 unmodified lines
168 167
169 by_pass_checks:168 by_pass_checks:
170 169
171 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT170 dTriggerDiagPrintk(ioc,
172 "%s: enter - trigger_bitmask = 0x%08x\n",171 ioc_info(ioc, "%s: enter - trigger_bitmask = 0x%08x\n",
173 ioc->name, __func__, trigger_bitmask));172 __func__, trigger_bitmask));
174 173
175 /* don't send trigger if an trigger is currently active */174 /* don't send trigger if an trigger is currently active */
176 if (ioc->diag_trigger_active) {175 if (ioc->diag_trigger_active) {
@@ -182,9 +181,9 @@ mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, u32 trigger_bitmask) · 5 unmodified lines
182 if (ioc->diag_trigger_master.MasterData & trigger_bitmask) {181 if (ioc->diag_trigger_master.MasterData & trigger_bitmask) {
183 found_match = 1;182 found_match = 1;
184 ioc->diag_trigger_active = 1;183 ioc->diag_trigger_active = 1;
185 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT184 dTriggerDiagPrintk(ioc,
186 "%s: setting diag_trigger_active flag\n",185 ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
187 ioc->name, __func__));186 __func__));
188 }187 }
189 spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags);188 spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags);
190 189
@@ -202,8 +201,8 @@ mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, u32 trigger_bitmask) · 11 unmodified lines
202 mpt3sas_send_trigger_data_event(ioc, &event_data);201 mpt3sas_send_trigger_data_event(ioc, &event_data);
203 202
204 out:203 out:
205 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,204 dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
206 __func__));205 __func__));
207}206}
208 207
209/**208/**
@@ -239,9 +238,9 @@ mpt3sas_trigger_event(struct MPT3SAS_ADAPTER *ioc, u16 event, · 29 unmodified lines
239 return;238 return;
240 }239 }
241 240
242 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT241 dTriggerDiagPrintk(ioc,
243 "%s: enter - event = 0x%04x, log_entry_qualifier = 0x%04x\n",242 ioc_info(ioc, "%s: enter - event = 0x%04x, log_entry_qualifier = 0x%04x\n",
244 ioc->name, __func__, event, log_entry_qualifier));243 __func__, event, log_entry_qualifier));
245 244
246 /* don't send trigger if an trigger is currently active */245 /* don't send trigger if an trigger is currently active */
247 if (ioc->diag_trigger_active) {246 if (ioc->diag_trigger_active) {
@@ -263,26 +262,26 @@ mpt3sas_trigger_event(struct MPT3SAS_ADAPTER *ioc, u16 event, · 15 unmodified lines
263 }262 }
264 found_match = 1;263 found_match = 1;
265 ioc->diag_trigger_active = 1;264 ioc->diag_trigger_active = 1;
266 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT265 dTriggerDiagPrintk(ioc,
267 "%s: setting diag_trigger_active flag\n",266 ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
268 ioc->name, __func__));267 __func__));
269 }268 }
270 spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags);269 spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags);
271 270
272 if (!found_match)271 if (!found_match)
273 goto out;272 goto out;
274 273
275 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT274 dTriggerDiagPrintk(ioc,
276 "%s: setting diag_trigger_active flag\n",275 ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
277 ioc->name, __func__));276 __func__));
278 memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));277 memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
279 event_data.trigger_type = MPT3SAS_TRIGGER_EVENT;278 event_data.trigger_type = MPT3SAS_TRIGGER_EVENT;
280 event_data.u.event.EventValue = event;279 event_data.u.event.EventValue = event;
281 event_data.u.event.LogEntryQualifier = log_entry_qualifier;280 event_data.u.event.LogEntryQualifier = log_entry_qualifier;
282 mpt3sas_send_trigger_data_event(ioc, &event_data);281 mpt3sas_send_trigger_data_event(ioc, &event_data);
283 out:282 out:
284 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,283 dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
285 __func__));284 __func__));
286}285}
287 286
288/**287/**
@@ -319,9 +318,9 @@ mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, u8 asc, · 30 unmodified lines
319 return;318 return;
320 }319 }
321 320
322 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT321 dTriggerDiagPrintk(ioc,
323 "%s: enter - sense_key = 0x%02x, asc = 0x%02x, ascq = 0x%02x\n",322 ioc_info(ioc, "%s: enter - sense_key = 0x%02x, asc = 0x%02x, ascq = 0x%02x\n",
324 ioc->name, __func__, sense_key, asc, ascq));323 __func__, sense_key, asc, ascq));
325 324
326 /* don't send trigger if an trigger is currently active */325 /* don't send trigger if an trigger is currently active */
327 if (ioc->diag_trigger_active) {326 if (ioc->diag_trigger_active) {
@@ -347,9 +346,9 @@ mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, u8 asc, · 19 unmodified lines
347 if (!found_match)346 if (!found_match)
348 goto out;347 goto out;
349 348
350 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT349 dTriggerDiagPrintk(ioc,
351 "%s: setting diag_trigger_active flag\n",350 ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
352 ioc->name, __func__));351 __func__));
353 memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));352 memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
354 event_data.trigger_type = MPT3SAS_TRIGGER_SCSI;353 event_data.trigger_type = MPT3SAS_TRIGGER_SCSI;
355 event_data.u.scsi.SenseKey = sense_key;354 event_data.u.scsi.SenseKey = sense_key;
@@ -357,8 +356,8 @@ mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, u8 asc, · 1 unmodified line
357 event_data.u.scsi.ASCQ = ascq;356 event_data.u.scsi.ASCQ = ascq;
358 mpt3sas_send_trigger_data_event(ioc, &event_data);357 mpt3sas_send_trigger_data_event(ioc, &event_data);
359 out:358 out:
360 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,359 dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
361 __func__));360 __func__));
362}361}
363 362
364/**363/**
@@ -393,9 +392,9 @@ mpt3sas_trigger_mpi(struct MPT3SAS_ADAPTER *ioc, u16 ioc_status, u32 loginfo) · 28 unmodified lines
393 return;392 return;
394 }393 }
395 394
396 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT395 dTriggerDiagPrintk(ioc,
397 "%s: enter - ioc_status = 0x%04x, loginfo = 0x%08x\n",396 ioc_info(ioc, "%s: enter - ioc_status = 0x%04x, loginfo = 0x%08x\n",
398 ioc->name, __func__, ioc_status, loginfo));397 __func__, ioc_status, loginfo));
399 398
400 /* don't send trigger if an trigger is currently active */399 /* don't send trigger if an trigger is currently active */
401 if (ioc->diag_trigger_active) {400 if (ioc->diag_trigger_active) {
@@ -420,15 +419,15 @@ mpt3sas_trigger_mpi(struct MPT3SAS_ADAPTER *ioc, u16 ioc_status, u32 loginfo) · 18 unmodified lines
420 if (!found_match)419 if (!found_match)
421 goto out;420 goto out;
422 421
423 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT422 dTriggerDiagPrintk(ioc,
424 "%s: setting diag_trigger_active flag\n",423 ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
425 ioc->name, __func__));424 __func__));
426 memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));425 memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
427 event_data.trigger_type = MPT3SAS_TRIGGER_MPI;426 event_data.trigger_type = MPT3SAS_TRIGGER_MPI;
428 event_data.u.mpi.IOCStatus = ioc_status;427 event_data.u.mpi.IOCStatus = ioc_status;
429 event_data.u.mpi.IocLogInfo = loginfo;428 event_data.u.mpi.IocLogInfo = loginfo;
430 mpt3sas_send_trigger_data_event(ioc, &event_data);429 mpt3sas_send_trigger_data_event(ioc, &event_data);
431 out:430 out:
432 dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,431 dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
433 __func__));432 __func__));
434}433}
drivers/scsi/mpt3sas/mpt3sas_warpdrive.c+27−43
@@ -127,20 +127,17 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 126 unmodified lines
127 return;127 return;
128 128
129 if (ioc->mfg_pg10_hide_flag == MFG_PAGE10_EXPOSE_ALL_DISKS) {129 if (ioc->mfg_pg10_hide_flag == MFG_PAGE10_EXPOSE_ALL_DISKS) {
130 pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "130 ioc_info(ioc, "WarpDrive : Direct IO is disabled globally as drives are exposed\n");
131 "globally as drives are exposed\n", ioc->name);
132 return;131 return;
133 }132 }
134 if (mpt3sas_get_num_volumes(ioc) > 1) {133 if (mpt3sas_get_num_volumes(ioc) > 1) {
135 _warpdrive_disable_ddio(ioc);134 _warpdrive_disable_ddio(ioc);
136 pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "135 ioc_info(ioc, "WarpDrive : Direct IO is disabled globally as number of drives > 1\n");
137 "globally as number of drives > 1\n", ioc->name);
138 return;136 return;
139 }137 }
140 if ((mpt3sas_config_get_number_pds(ioc, raid_device->handle,138 if ((mpt3sas_config_get_number_pds(ioc, raid_device->handle,
141 &num_pds)) || !num_pds) {139 &num_pds)) || !num_pds) {
142 pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "140 ioc_info(ioc, "WarpDrive : Direct IO is disabled Failure in computing number of drives\n");
143 "Failure in computing number of drives\n", ioc->name);
144 return;141 return;
145 }142 }
146 143
@@ -148,15 +145,13 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
148 sizeof(Mpi2RaidVol0PhysDisk_t));145 sizeof(Mpi2RaidVol0PhysDisk_t));
149 vol_pg0 = kzalloc(sz, GFP_KERNEL);146 vol_pg0 = kzalloc(sz, GFP_KERNEL);
150 if (!vol_pg0) {147 if (!vol_pg0) {
151 pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "148 ioc_info(ioc, "WarpDrive : Direct IO is disabled Memory allocation failure for RVPG0\n");
152 "Memory allocation failure for RVPG0\n", ioc->name);
153 return;149 return;
154 }150 }
155 151
156 if ((mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, vol_pg0,152 if ((mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, vol_pg0,
157 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, raid_device->handle, sz))) {153 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, raid_device->handle, sz))) {
158 pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "154 ioc_info(ioc, "WarpDrive : Direct IO is disabled Failure in retrieving RVPG0\n");
159 "Failure in retrieving RVPG0\n", ioc->name);
160 kfree(vol_pg0);155 kfree(vol_pg0);
161 return;156 return;
162 }157 }
@@ -166,10 +161,8 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
166 * assumed for WARPDRIVE, disable direct I/O161 * assumed for WARPDRIVE, disable direct I/O
167 */162 */
168 if (num_pds > MPT_MAX_WARPDRIVE_PDS) {163 if (num_pds > MPT_MAX_WARPDRIVE_PDS) {
169 pr_warn(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "164 ioc_warn(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x): num_mem=%d, max_mem_allowed=%d\n",
170 "for the drive with handle(0x%04x): num_mem=%d, "165 raid_device->handle, num_pds, MPT_MAX_WARPDRIVE_PDS);
171 "max_mem_allowed=%d\n", ioc->name, raid_device->handle,
172 num_pds, MPT_MAX_WARPDRIVE_PDS);
173 kfree(vol_pg0);166 kfree(vol_pg0);
174 return;167 return;
175 }168 }
@@ -179,22 +172,18 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
179 vol_pg0->PhysDisk[count].PhysDiskNum) ||172 vol_pg0->PhysDisk[count].PhysDiskNum) ||
180 le16_to_cpu(pd_pg0.DevHandle) ==173 le16_to_cpu(pd_pg0.DevHandle) ==
181 MPT3SAS_INVALID_DEVICE_HANDLE) {174 MPT3SAS_INVALID_DEVICE_HANDLE) {
182 pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is "175 ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x) member handle retrieval failed for member number=%d\n",
183 "disabled for the drive with handle(0x%04x) member"176 raid_device->handle,
184 "handle retrieval failed for member number=%d\n",177 vol_pg0->PhysDisk[count].PhysDiskNum);
185 ioc->name, raid_device->handle,
186 vol_pg0->PhysDisk[count].PhysDiskNum);
187 goto out_error;178 goto out_error;
188 }179 }
189 /* Disable direct I/O if member drive lba exceeds 4 bytes */180 /* Disable direct I/O if member drive lba exceeds 4 bytes */
190 dev_max_lba = le64_to_cpu(pd_pg0.DeviceMaxLBA);181 dev_max_lba = le64_to_cpu(pd_pg0.DeviceMaxLBA);
191 if (dev_max_lba >> 32) {182 if (dev_max_lba >> 32) {
192 pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is "183 ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x) member handle (0x%04x) unsupported max lba 0x%016llx\n",
193 "disabled for the drive with handle(0x%04x) member"184 raid_device->handle,
194 " handle (0x%04x) unsupported max lba 0x%016llx\n",185 le16_to_cpu(pd_pg0.DevHandle),
195 ioc->name, raid_device->handle,186 (u64)dev_max_lba);
196 le16_to_cpu(pd_pg0.DevHandle),
197 (unsigned long long)dev_max_lba);
198 goto out_error;187 goto out_error;
199 }188 }
200 189
@@ -206,41 +195,36 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 5 unmodified lines
206 * not RAID0195 * not RAID0
207 */196 */
208 if (raid_device->volume_type != MPI2_RAID_VOL_TYPE_RAID0) {197 if (raid_device->volume_type != MPI2_RAID_VOL_TYPE_RAID0) {
209 pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "198 ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x): type=%d, s_sz=%uK, blk_size=%u\n",
210 "for the drive with handle(0x%04x): type=%d, "199 raid_device->handle, raid_device->volume_type,
211 "s_sz=%uK, blk_size=%u\n", ioc->name,200 (le32_to_cpu(vol_pg0->StripeSize) *
212 raid_device->handle, raid_device->volume_type,201 le16_to_cpu(vol_pg0->BlockSize)) / 1024,
213 (le32_to_cpu(vol_pg0->StripeSize) *202 le16_to_cpu(vol_pg0->BlockSize));
214 le16_to_cpu(vol_pg0->BlockSize)) / 1024,
215 le16_to_cpu(vol_pg0->BlockSize));
216 goto out_error;203 goto out_error;
217 }204 }
218 205
219 stripe_sz = le32_to_cpu(vol_pg0->StripeSize);206 stripe_sz = le32_to_cpu(vol_pg0->StripeSize);
220 stripe_exp = find_first_bit(&stripe_sz, 32);207 stripe_exp = find_first_bit(&stripe_sz, 32);
221 if (stripe_exp == 32) {208 if (stripe_exp == 32) {
222 pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "209 ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x) invalid stripe sz %uK\n",
223 "for the drive with handle(0x%04x) invalid stripe sz %uK\n",210 raid_device->handle,
224 ioc->name, raid_device->handle,211 (le32_to_cpu(vol_pg0->StripeSize) *
225 (le32_to_cpu(vol_pg0->StripeSize) *212 le16_to_cpu(vol_pg0->BlockSize)) / 1024);
226 le16_to_cpu(vol_pg0->BlockSize)) / 1024);
227 goto out_error;213 goto out_error;
228 }214 }
229 raid_device->stripe_exponent = stripe_exp;215 raid_device->stripe_exponent = stripe_exp;
230 block_sz = le16_to_cpu(vol_pg0->BlockSize);216 block_sz = le16_to_cpu(vol_pg0->BlockSize);
231 block_exp = find_first_bit(&block_sz, 16);217 block_exp = find_first_bit(&block_sz, 16);
232 if (block_exp == 16) {218 if (block_exp == 16) {
233 pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "219 ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x) invalid block sz %u\n",
234 "for the drive with handle(0x%04x) invalid block sz %u\n",220 raid_device->handle, le16_to_cpu(vol_pg0->BlockSize));
235 ioc->name, raid_device->handle,
236 le16_to_cpu(vol_pg0->BlockSize));
237 goto out_error;221 goto out_error;
238 }222 }
239 raid_device->block_exponent = block_exp;223 raid_device->block_exponent = block_exp;
240 raid_device->direct_io_enabled = 1;224 raid_device->direct_io_enabled = 1;
241 225
242 pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is Enabled for the drive"226 ioc_info(ioc, "WarpDrive : Direct IO is Enabled for the drive with handle(0x%04x)\n",
243 " with handle(0x%04x)\n", ioc->name, raid_device->handle);227 raid_device->handle);
244 /*228 /*
245 * WARPDRIVE: Though the following fields are not used for direct IO,229 * WARPDRIVE: Though the following fields are not used for direct IO,
246 * stored for future purpose:230 * stored for future purpose:
drivers/scsi/mvsas/mv_init.c+3−18
@@ -403,29 +403,14 @@ static int pci_go_64(struct pci_dev *pdev) · 402 unmodified lines
403{403{
404 int rc;404 int rc;
405 405
406 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {406 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
407 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));407 if (rc) {
408 if (rc) {408 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
409 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
410 if (rc) {
411 dev_printk(KERN_ERR, &pdev->dev,
412 "64-bit DMA enable failed\n");
413 return rc;
414 }
415 }
416 } else {
417 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
418 if (rc) {409 if (rc) {
419 dev_printk(KERN_ERR, &pdev->dev,410 dev_printk(KERN_ERR, &pdev->dev,
420 "32-bit DMA enable failed\n");411 "32-bit DMA enable failed\n");
421 return rc;412 return rc;
422 }413 }
423 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
424 if (rc) {
425 dev_printk(KERN_ERR, &pdev->dev,
426 "32-bit consistent DMA enable failed\n");
427 return rc;
428 }
429 }414 }
430 415
431 return rc;416 return rc;
drivers/scsi/mvsas/mv_sas.c+6−6
@@ -336,13 +336,13 @@ static int mvs_task_prep_smp(struct mvs_info *mvi, · 335 unmodified lines
336 * DMA-map SMP request, response buffers336 * DMA-map SMP request, response buffers
337 */337 */
338 sg_req = &task->smp_task.smp_req;338 sg_req = &task->smp_task.smp_req;
339 elem = dma_map_sg(mvi->dev, sg_req, 1, PCI_DMA_TODEVICE);339 elem = dma_map_sg(mvi->dev, sg_req, 1, DMA_TO_DEVICE);
340 if (!elem)340 if (!elem)
341 return -ENOMEM;341 return -ENOMEM;
342 req_len = sg_dma_len(sg_req);342 req_len = sg_dma_len(sg_req);
343 343
344 sg_resp = &task->smp_task.smp_resp;344 sg_resp = &task->smp_task.smp_resp;
345 elem = dma_map_sg(mvi->dev, sg_resp, 1, PCI_DMA_FROMDEVICE);345 elem = dma_map_sg(mvi->dev, sg_resp, 1, DMA_FROM_DEVICE);
346 if (!elem) {346 if (!elem) {
347 rc = -ENOMEM;347 rc = -ENOMEM;
348 goto err_out;348 goto err_out;
@@ -416,10 +416,10 @@ static int mvs_task_prep_smp(struct mvs_info *mvi, · 67 unmodified lines
416 416
417err_out_2:417err_out_2:
418 dma_unmap_sg(mvi->dev, &tei->task->smp_task.smp_resp, 1,418 dma_unmap_sg(mvi->dev, &tei->task->smp_task.smp_resp, 1,
419 PCI_DMA_FROMDEVICE);419 DMA_FROM_DEVICE);
420err_out:420err_out:
421 dma_unmap_sg(mvi->dev, &tei->task->smp_task.smp_req, 1,421 dma_unmap_sg(mvi->dev, &tei->task->smp_task.smp_req, 1,
422 PCI_DMA_TODEVICE);422 DMA_TO_DEVICE);
423 return rc;423 return rc;
424}424}
425 425
@@ -904,9 +904,9 @@ static void mvs_slot_task_free(struct mvs_info *mvi, struct sas_task *task, · 478 unmodified lines
904 switch (task->task_proto) {904 switch (task->task_proto) {
905 case SAS_PROTOCOL_SMP:905 case SAS_PROTOCOL_SMP:
906 dma_unmap_sg(mvi->dev, &task->smp_task.smp_resp, 1,906 dma_unmap_sg(mvi->dev, &task->smp_task.smp_resp, 1,
907 PCI_DMA_FROMDEVICE);907 DMA_FROM_DEVICE);
908 dma_unmap_sg(mvi->dev, &task->smp_task.smp_req, 1,908 dma_unmap_sg(mvi->dev, &task->smp_task.smp_req, 1,
909 PCI_DMA_TODEVICE);909 DMA_TO_DEVICE);
910 break;910 break;
911 911
912 case SAS_PROTOCOL_SATA:912 case SAS_PROTOCOL_SATA:
drivers/scsi/mvumi.c+36−53
@@ -143,8 +143,8 @@ static struct mvumi_res *mvumi_alloc_mem_resource(struct mvumi_hba *mhba, · 142 unmodified lines
143 143
144 case RESOURCE_UNCACHED_MEMORY:144 case RESOURCE_UNCACHED_MEMORY:
145 size = round_up(size, 8);145 size = round_up(size, 8);
146 res->virt_addr = pci_zalloc_consistent(mhba->pdev, size,146 res->virt_addr = dma_zalloc_coherent(&mhba->pdev->dev, size,
147 &res->bus_addr);147 &res->bus_addr, GFP_KERNEL);
148 if (!res->virt_addr) {148 if (!res->virt_addr) {
149 dev_err(&mhba->pdev->dev,149 dev_err(&mhba->pdev->dev,
150 "unable to allocate consistent mem,"150 "unable to allocate consistent mem,"
@@ -175,7 +175,7 @@ static void mvumi_release_mem_resource(struct mvumi_hba *mhba) · 24 unmodified lines
175 list_for_each_entry_safe(res, tmp, &mhba->res_list, entry) {175 list_for_each_entry_safe(res, tmp, &mhba->res_list, entry) {
176 switch (res->type) {176 switch (res->type) {
177 case RESOURCE_UNCACHED_MEMORY:177 case RESOURCE_UNCACHED_MEMORY:
178 pci_free_consistent(mhba->pdev, res->size,178 dma_free_coherent(&mhba->pdev->dev, res->size,
179 res->virt_addr, res->bus_addr);179 res->virt_addr, res->bus_addr);
180 break;180 break;
181 case RESOURCE_CACHED_MEMORY:181 case RESOURCE_CACHED_MEMORY:
@@ -211,14 +211,14 @@ static int mvumi_make_sgl(struct mvumi_hba *mhba, struct scsi_cmnd *scmd, · 29 unmodified lines
211 dma_addr_t busaddr;211 dma_addr_t busaddr;
212 212
213 sg = scsi_sglist(scmd);213 sg = scsi_sglist(scmd);
214 *sg_count = pci_map_sg(mhba->pdev, sg, sgnum,214 *sg_count = dma_map_sg(&mhba->pdev->dev, sg, sgnum,
215 (int) scmd->sc_data_direction);215 scmd->sc_data_direction);
216 if (*sg_count > mhba->max_sge) {216 if (*sg_count > mhba->max_sge) {
217 dev_err(&mhba->pdev->dev,217 dev_err(&mhba->pdev->dev,
218 "sg count[0x%x] is bigger than max sg[0x%x].\n",218 "sg count[0x%x] is bigger than max sg[0x%x].\n",
219 *sg_count, mhba->max_sge);219 *sg_count, mhba->max_sge);
220 pci_unmap_sg(mhba->pdev, sg, sgnum,220 dma_unmap_sg(&mhba->pdev->dev, sg, sgnum,
221 (int) scmd->sc_data_direction);221 scmd->sc_data_direction);
222 return -1;222 return -1;
223 }223 }
224 for (i = 0; i < *sg_count; i++) {224 for (i = 0; i < *sg_count; i++) {
@@ -246,7 +246,8 @@ static int mvumi_internal_cmd_sgl(struct mvumi_hba *mhba, struct mvumi_cmd *cmd, · 21 unmodified lines
246 if (size == 0)246 if (size == 0)
247 return 0;247 return 0;
248 248
249 virt_addr = pci_zalloc_consistent(mhba->pdev, size, &phy_addr);249 virt_addr = dma_zalloc_coherent(&mhba->pdev->dev, size, &phy_addr,
250 GFP_KERNEL);
250 if (!virt_addr)251 if (!virt_addr)
251 return -1;252 return -1;
252 253
@@ -274,8 +275,8 @@ static struct mvumi_cmd *mvumi_create_internal_cmd(struct mvumi_hba *mhba, · 21 unmodified lines
274 }275 }
275 INIT_LIST_HEAD(&cmd->queue_pointer);276 INIT_LIST_HEAD(&cmd->queue_pointer);
276 277
277 cmd->frame = pci_alloc_consistent(mhba->pdev,278 cmd->frame = dma_alloc_coherent(&mhba->pdev->dev, mhba->ib_max_size,
278 mhba->ib_max_size, &cmd->frame_phys);279 &cmd->frame_phys, GFP_KERNEL);
279 if (!cmd->frame) {280 if (!cmd->frame) {
280 dev_err(&mhba->pdev->dev, "failed to allocate memory for FW"281 dev_err(&mhba->pdev->dev, "failed to allocate memory for FW"
281 " frame,size = %d.\n", mhba->ib_max_size);282 " frame,size = %d.\n", mhba->ib_max_size);
@@ -287,7 +288,7 @@ static struct mvumi_cmd *mvumi_create_internal_cmd(struct mvumi_hba *mhba, · 5 unmodified lines
287 if (mvumi_internal_cmd_sgl(mhba, cmd, buf_size)) {288 if (mvumi_internal_cmd_sgl(mhba, cmd, buf_size)) {
288 dev_err(&mhba->pdev->dev, "failed to allocate memory"289 dev_err(&mhba->pdev->dev, "failed to allocate memory"
289 " for internal frame\n");290 " for internal frame\n");
290 pci_free_consistent(mhba->pdev, mhba->ib_max_size,291 dma_free_coherent(&mhba->pdev->dev, mhba->ib_max_size,
291 cmd->frame, cmd->frame_phys);292 cmd->frame, cmd->frame_phys);
292 kfree(cmd);293 kfree(cmd);
293 return NULL;294 return NULL;
@@ -313,10 +314,10 @@ static void mvumi_delete_internal_cmd(struct mvumi_hba *mhba, · 19 unmodified lines
313 phy_addr = (dma_addr_t) m_sg->baseaddr_l |314 phy_addr = (dma_addr_t) m_sg->baseaddr_l |
314 (dma_addr_t) ((m_sg->baseaddr_h << 16) << 16);315 (dma_addr_t) ((m_sg->baseaddr_h << 16) << 16);
315 316
316 pci_free_consistent(mhba->pdev, size, cmd->data_buf,317 dma_free_coherent(&mhba->pdev->dev, size, cmd->data_buf,
317 phy_addr);318 phy_addr);
318 }319 }
319 pci_free_consistent(mhba->pdev, mhba->ib_max_size,320 dma_free_coherent(&mhba->pdev->dev, mhba->ib_max_size,
320 cmd->frame, cmd->frame_phys);321 cmd->frame, cmd->frame_phys);
321 kfree(cmd);322 kfree(cmd);
322 }323 }
@@ -663,16 +664,17 @@ static void mvumi_restore_bar_addr(struct mvumi_hba *mhba) · 340 unmodified lines
663 }664 }
664}665}
665 666
666static unsigned int mvumi_pci_set_master(struct pci_dev *pdev)667static int mvumi_pci_set_master(struct pci_dev *pdev)
667{668{
668 unsigned int ret = 0;669 int ret = 0;
670
669 pci_set_master(pdev);671 pci_set_master(pdev);
670 672
671 if (IS_DMA64) {673 if (IS_DMA64) {
672 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))674 if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)))
673 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));675 ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
674 } else676 } else
675 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));677 ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
676 678
677 return ret;679 return ret;
678}680}
@@ -771,7 +773,7 @@ static void mvumi_release_fw(struct mvumi_hba *mhba) · 92 unmodified lines
771 mvumi_free_cmds(mhba);773 mvumi_free_cmds(mhba);
772 mvumi_release_mem_resource(mhba);774 mvumi_release_mem_resource(mhba);
773 mvumi_unmap_pci_addr(mhba->pdev, mhba->base_addr);775 mvumi_unmap_pci_addr(mhba->pdev, mhba->base_addr);
774 pci_free_consistent(mhba->pdev, HSP_MAX_SIZE,776 dma_free_coherent(&mhba->pdev->dev, HSP_MAX_SIZE,
775 mhba->handshake_page, mhba->handshake_page_phys);777 mhba->handshake_page, mhba->handshake_page_phys);
776 kfree(mhba->regs);778 kfree(mhba->regs);
777 pci_release_regions(mhba->pdev);779 pci_release_regions(mhba->pdev);
@@ -1339,9 +1341,9 @@ static void mvumi_complete_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd, · 561 unmodified lines
1339 }1341 }
1340 1342
1341 if (scsi_bufflen(scmd))1343 if (scsi_bufflen(scmd))
1342 pci_unmap_sg(mhba->pdev, scsi_sglist(scmd),1344 dma_unmap_sg(&mhba->pdev->dev, scsi_sglist(scmd),
1343 scsi_sg_count(scmd),1345 scsi_sg_count(scmd),
1344 (int) scmd->sc_data_direction);1346 scmd->sc_data_direction);
1345 cmd->scmd->scsi_done(scmd);1347 cmd->scmd->scsi_done(scmd);
1346 mvumi_return_cmd(mhba, cmd);1348 mvumi_return_cmd(mhba, cmd);
1347}1349}
@@ -2148,9 +2150,9 @@ static enum blk_eh_timer_return mvumi_timed_out(struct scsi_cmnd *scmd) · 800 unmodified lines
2148 scmd->result = (DRIVER_INVALID << 24) | (DID_ABORT << 16);2150 scmd->result = (DRIVER_INVALID << 24) | (DID_ABORT << 16);
2149 scmd->SCp.ptr = NULL;2151 scmd->SCp.ptr = NULL;
2150 if (scsi_bufflen(scmd)) {2152 if (scsi_bufflen(scmd)) {
2151 pci_unmap_sg(mhba->pdev, scsi_sglist(scmd),2153 dma_unmap_sg(&mhba->pdev->dev, scsi_sglist(scmd),
2152 scsi_sg_count(scmd),2154 scsi_sg_count(scmd),
2153 (int)scmd->sc_data_direction);2155 scmd->sc_data_direction);
2154 }2156 }
2155 mvumi_return_cmd(mhba, cmd);2157 mvumi_return_cmd(mhba, cmd);
2156 spin_unlock_irqrestore(mhba->shost->host_lock, flags);2158 spin_unlock_irqrestore(mhba->shost->host_lock, flags);
@@ -2362,8 +2364,8 @@ static int mvumi_init_fw(struct mvumi_hba *mhba) · 205 unmodified lines
2362 ret = -ENOMEM;2364 ret = -ENOMEM;
2363 goto fail_alloc_mem;2365 goto fail_alloc_mem;
2364 }2366 }
2365 mhba->handshake_page = pci_alloc_consistent(mhba->pdev, HSP_MAX_SIZE,2367 mhba->handshake_page = dma_alloc_coherent(&mhba->pdev->dev,
2366 &mhba->handshake_page_phys);2368 HSP_MAX_SIZE, &mhba->handshake_page_phys, GFP_KERNEL);
2367 if (!mhba->handshake_page) {2369 if (!mhba->handshake_page) {
2368 dev_err(&mhba->pdev->dev,2370 dev_err(&mhba->pdev->dev,
2369 "failed to allocate memory for handshake\n");2371 "failed to allocate memory for handshake\n");
@@ -2383,7 +2385,7 @@ static int mvumi_init_fw(struct mvumi_hba *mhba) · 13 unmodified lines
2383 2385
2384fail_ready_state:2386fail_ready_state:
2385 mvumi_release_mem_resource(mhba);2387 mvumi_release_mem_resource(mhba);
2386 pci_free_consistent(mhba->pdev, HSP_MAX_SIZE,2388 dma_free_coherent(&mhba->pdev->dev, HSP_MAX_SIZE,
2387 mhba->handshake_page, mhba->handshake_page_phys);2389 mhba->handshake_page, mhba->handshake_page_phys);
2388fail_alloc_page:2390fail_alloc_page:
2389 kfree(mhba->regs);2391 kfree(mhba->regs);
@@ -2480,20 +2482,9 @@ static int mvumi_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 90 unmodified lines
2480 if (ret)2482 if (ret)
2481 return ret;2483 return ret;
2482 2484
2483 pci_set_master(pdev);2485 ret = mvumi_pci_set_master(pdev);
2484 2486 if (ret)
2485 if (IS_DMA64) {2487 goto fail_set_dma_mask;
2486 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
2487 if (ret) {
2488 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
2489 if (ret)
2490 goto fail_set_dma_mask;
2491 }
2492 } else {
2493 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
2494 if (ret)
2495 goto fail_set_dma_mask;
2496 }
2497 2488
2498 host = scsi_host_alloc(&mvumi_template, sizeof(*mhba));2489 host = scsi_host_alloc(&mvumi_template, sizeof(*mhba));
2499 if (!host) {2490 if (!host) {
@@ -2627,19 +2618,11 @@ static int __maybe_unused mvumi_resume(struct pci_dev *pdev) · 127 unmodified lines
2627 dev_err(&pdev->dev, "enable device failed\n");2618 dev_err(&pdev->dev, "enable device failed\n");
2628 return ret;2619 return ret;
2629 }2620 }
2630 pci_set_master(pdev);2621
2631 if (IS_DMA64) {2622 ret = mvumi_pci_set_master(pdev);
2632 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));2623 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
2633 if (ret) {2624 if (ret)
2634 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));2625 goto fail;
2635 if (ret)
2636 goto fail;
2637 }
2638 } else {
2639 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
2640 if (ret)
2641 goto fail;
2642 }
2643 ret = pci_request_regions(mhba->pdev, MV_DRIVER_NAME);2626 ret = pci_request_regions(mhba->pdev, MV_DRIVER_NAME);
2644 if (ret)2627 if (ret)
2645 goto fail;2628 goto fail;
drivers/scsi/myrb.c+3656−0
@@ -0,0 +1,3656 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Linux Driver for Mylex DAC960/AcceleRAID/eXtremeRAID PCI RAID Controllers
4 *
5 * Copyright 2017 Hannes Reinecke, SUSE Linux GmbH <hare@suse.com>
6 *
7 * Based on the original DAC960 driver,
8 * Copyright 1998-2001 by Leonard N. Zubkoff <lnz@dandelion.com>
9 * Portions Copyright 2002 by Mylex (An IBM Business Unit)
10 *
11 */
12
13#include <linux/module.h>
14#include <linux/types.h>
15#include <linux/delay.h>
16#include <linux/interrupt.h>
17#include <linux/pci.h>
18#include <linux/raid_class.h>
19#include <asm/unaligned.h>
20#include <scsi/scsi.h>
21#include <scsi/scsi_host.h>
22#include <scsi/scsi_device.h>
23#include <scsi/scsi_cmnd.h>
24#include <scsi/scsi_tcq.h>
25#include "myrb.h"
26
27static struct raid_template *myrb_raid_template;
28
29static void myrb_monitor(struct work_struct *work);
30static inline void myrb_translate_devstate(void *DeviceState);
31
32static inline int myrb_logical_channel(struct Scsi_Host *shost)
33{
34 return shost->max_channel - 1;
35}
36
37static struct myrb_devstate_name_entry {
38 enum myrb_devstate state;
39 const char *name;
40} myrb_devstate_name_list[] = {
41 { MYRB_DEVICE_DEAD, "Dead" },
42 { MYRB_DEVICE_WO, "WriteOnly" },
43 { MYRB_DEVICE_ONLINE, "Online" },
44 { MYRB_DEVICE_CRITICAL, "Critical" },
45 { MYRB_DEVICE_STANDBY, "Standby" },
46 { MYRB_DEVICE_OFFLINE, "Offline" },
47};
48
49static const char *myrb_devstate_name(enum myrb_devstate state)
50{
51 struct myrb_devstate_name_entry *entry = myrb_devstate_name_list;
52 int i;
53
54 for (i = 0; i < ARRAY_SIZE(myrb_devstate_name_list); i++) {
55 if (entry[i].state == state)
56 return entry[i].name;
57 }
58 return "Unknown";
59}
60
61static struct myrb_raidlevel_name_entry {
62 enum myrb_raidlevel level;
63 const char *name;
64} myrb_raidlevel_name_list[] = {
65 { MYRB_RAID_LEVEL0, "RAID0" },
66 { MYRB_RAID_LEVEL1, "RAID1" },
67 { MYRB_RAID_LEVEL3, "RAID3" },
68 { MYRB_RAID_LEVEL5, "RAID5" },
69 { MYRB_RAID_LEVEL6, "RAID6" },
70 { MYRB_RAID_JBOD, "JBOD" },
71};
72
73static const char *myrb_raidlevel_name(enum myrb_raidlevel level)
74{
75 struct myrb_raidlevel_name_entry *entry = myrb_raidlevel_name_list;
76 int i;
77
78 for (i = 0; i < ARRAY_SIZE(myrb_raidlevel_name_list); i++) {
79 if (entry[i].level == level)
80 return entry[i].name;
81 }
82 return NULL;
83}
84
85/**
86 * myrb_create_mempools - allocates auxiliary data structures
87 *
88 * Return: true on success, false otherwise.
89 */
90static bool myrb_create_mempools(struct pci_dev *pdev, struct myrb_hba *cb)
91{
92 size_t elem_size, elem_align;
93
94 elem_align = sizeof(struct myrb_sge);
95 elem_size = cb->host->sg_tablesize * elem_align;
96 cb->sg_pool = dma_pool_create("myrb_sg", &pdev->dev,
97 elem_size, elem_align, 0);
98 if (cb->sg_pool == NULL) {
99 shost_printk(KERN_ERR, cb->host,
100 "Failed to allocate SG pool\n");
101 return false;
102 }
103
104 cb->dcdb_pool = dma_pool_create("myrb_dcdb", &pdev->dev,
105 sizeof(struct myrb_dcdb),
106 sizeof(unsigned int), 0);
107 if (!cb->dcdb_pool) {
108 dma_pool_destroy(cb->sg_pool);
109 cb->sg_pool = NULL;
110 shost_printk(KERN_ERR, cb->host,
111 "Failed to allocate DCDB pool\n");
112 return false;
113 }
114
115 snprintf(cb->work_q_name, sizeof(cb->work_q_name),
116 "myrb_wq_%d", cb->host->host_no);
117 cb->work_q = create_singlethread_workqueue(cb->work_q_name);
118 if (!cb->work_q) {
119 dma_pool_destroy(cb->dcdb_pool);
120 cb->dcdb_pool = NULL;
121 dma_pool_destroy(cb->sg_pool);
122 cb->sg_pool = NULL;
123 shost_printk(KERN_ERR, cb->host,
124 "Failed to create workqueue\n");
125 return false;
126 }
127
128 /*
129 * Initialize the Monitoring Timer.
130 */
131 INIT_DELAYED_WORK(&cb->monitor_work, myrb_monitor);
132 queue_delayed_work(cb->work_q, &cb->monitor_work, 1);
133
134 return true;
135}
136
137/**
138 * myrb_destroy_mempools - tears down the memory pools for the controller
139 */
140static void myrb_destroy_mempools(struct myrb_hba *cb)
141{
142 cancel_delayed_work_sync(&cb->monitor_work);
143 destroy_workqueue(cb->work_q);
144
145 dma_pool_destroy(cb->sg_pool);
146 dma_pool_destroy(cb->dcdb_pool);
147}
148
149/**
150 * myrb_reset_cmd - reset command block
151 */
152static inline void myrb_reset_cmd(struct myrb_cmdblk *cmd_blk)
153{
154 union myrb_cmd_mbox *mbox = &cmd_blk->mbox;
155
156 memset(mbox, 0, sizeof(union myrb_cmd_mbox));
157 cmd_blk->status = 0;
158}
159
160/**
161 * myrb_qcmd - queues command block for execution
162 */
163static void myrb_qcmd(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk)
164{
165 void __iomem *base = cb->io_base;
166 union myrb_cmd_mbox *mbox = &cmd_blk->mbox;
167 union myrb_cmd_mbox *next_mbox = cb->next_cmd_mbox;
168
169 cb->write_cmd_mbox(next_mbox, mbox);
170 if (cb->prev_cmd_mbox1->words[0] == 0 ||
171 cb->prev_cmd_mbox2->words[0] == 0)
172 cb->get_cmd_mbox(base);
173 cb->prev_cmd_mbox2 = cb->prev_cmd_mbox1;
174 cb->prev_cmd_mbox1 = next_mbox;
175 if (++next_mbox > cb->last_cmd_mbox)
176 next_mbox = cb->first_cmd_mbox;
177 cb->next_cmd_mbox = next_mbox;
178}
179
180/**
181 * myrb_exec_cmd - executes command block and waits for completion.
182 *
183 * Return: command status
184 */
185static unsigned short myrb_exec_cmd(struct myrb_hba *cb,
186 struct myrb_cmdblk *cmd_blk)
187{
188 DECLARE_COMPLETION_ONSTACK(cmpl);
189 unsigned long flags;
190
191 cmd_blk->completion = &cmpl;
192
193 spin_lock_irqsave(&cb->queue_lock, flags);
194 cb->qcmd(cb, cmd_blk);
195 spin_unlock_irqrestore(&cb->queue_lock, flags);
196
197 WARN_ON(in_interrupt());
198 wait_for_completion(&cmpl);
199 return cmd_blk->status;
200}
201
202/**
203 * myrb_exec_type3 - executes a type 3 command and waits for completion.
204 *
205 * Return: command status
206 */
207static unsigned short myrb_exec_type3(struct myrb_hba *cb,
208 enum myrb_cmd_opcode op, dma_addr_t addr)
209{
210 struct myrb_cmdblk *cmd_blk = &cb->dcmd_blk;
211 union myrb_cmd_mbox *mbox = &cmd_blk->mbox;
212 unsigned short status;
213
214 mutex_lock(&cb->dcmd_mutex);
215 myrb_reset_cmd(cmd_blk);
216 mbox->type3.id = MYRB_DCMD_TAG;
217 mbox->type3.opcode = op;
218 mbox->type3.addr = addr;
219 status = myrb_exec_cmd(cb, cmd_blk);
220 mutex_unlock(&cb->dcmd_mutex);
221 return status;
222}
223
224/**
225 * myrb_exec_type3D - executes a type 3D command and waits for completion.
226 *
227 * Return: command status
228 */
229static unsigned short myrb_exec_type3D(struct myrb_hba *cb,
230 enum myrb_cmd_opcode op, struct scsi_device *sdev,
231 struct myrb_pdev_state *pdev_info)
232{
233 struct myrb_cmdblk *cmd_blk = &cb->dcmd_blk;
234 union myrb_cmd_mbox *mbox = &cmd_blk->mbox;
235 unsigned short status;
236 dma_addr_t pdev_info_addr;
237
238 pdev_info_addr = dma_map_single(&cb->pdev->dev, pdev_info,
239 sizeof(struct myrb_pdev_state),
240 DMA_FROM_DEVICE);
241 if (dma_mapping_error(&cb->pdev->dev, pdev_info_addr))
242 return MYRB_STATUS_SUBSYS_FAILED;
243
244 mutex_lock(&cb->dcmd_mutex);
245 myrb_reset_cmd(cmd_blk);
246 mbox->type3D.id = MYRB_DCMD_TAG;
247 mbox->type3D.opcode = op;
248 mbox->type3D.channel = sdev->channel;
249 mbox->type3D.target = sdev->id;
250 mbox->type3D.addr = pdev_info_addr;
251 status = myrb_exec_cmd(cb, cmd_blk);
252 mutex_unlock(&cb->dcmd_mutex);
253 dma_unmap_single(&cb->pdev->dev, pdev_info_addr,
254 sizeof(struct myrb_pdev_state), DMA_FROM_DEVICE);
255 if (status == MYRB_STATUS_SUCCESS &&
256 mbox->type3D.opcode == MYRB_CMD_GET_DEVICE_STATE_OLD)
257 myrb_translate_devstate(pdev_info);
258
259 return status;
260}
261
262static char *myrb_event_msg[] = {
263 "killed because write recovery failed",
264 "killed because of SCSI bus reset failure",
265 "killed because of double check condition",
266 "killed because it was removed",
267 "killed because of gross error on SCSI chip",
268 "killed because of bad tag returned from drive",
269 "killed because of timeout on SCSI command",
270 "killed because of reset SCSI command issued from system",
271 "killed because busy or parity error count exceeded limit",
272 "killed because of 'kill drive' command from system",
273 "killed because of selection timeout",
274 "killed due to SCSI phase sequence error",
275 "killed due to unknown status",
276};
277
278/**
279 * myrb_get_event - get event log from HBA
280 * @cb: pointer to the hba structure
281 * @event: number of the event
282 *
283 * Execute a type 3E command and logs the event message
284 */
285static void myrb_get_event(struct myrb_hba *cb, unsigned int event)
286{
287 struct myrb_cmdblk *cmd_blk = &cb->mcmd_blk;
288 union myrb_cmd_mbox *mbox = &cmd_blk->mbox;
289 struct myrb_log_entry *ev_buf;
290 dma_addr_t ev_addr;
291 unsigned short status;
292
293 ev_buf = dma_alloc_coherent(&cb->pdev->dev,
294 sizeof(struct myrb_log_entry),
295 &ev_addr, GFP_KERNEL);
296 if (!ev_buf)
297 return;
298
299 myrb_reset_cmd(cmd_blk);
300 mbox->type3E.id = MYRB_MCMD_TAG;
301 mbox->type3E.opcode = MYRB_CMD_EVENT_LOG_OPERATION;
302 mbox->type3E.optype = DAC960_V1_GetEventLogEntry;
303 mbox->type3E.opqual = 1;
304 mbox->type3E.ev_seq = event;
305 mbox->type3E.addr = ev_addr;
306 status = myrb_exec_cmd(cb, cmd_blk);
307 if (status != MYRB_STATUS_SUCCESS)
308 shost_printk(KERN_INFO, cb->host,
309 "Failed to get event log %d, status %04x\n",
310 event, status);
311
312 else if (ev_buf->seq_num == event) {
313 struct scsi_sense_hdr sshdr;
314
315 memset(&sshdr, 0, sizeof(sshdr));
316 scsi_normalize_sense(ev_buf->sense, 32, &sshdr);
317
318 if (sshdr.sense_key == VENDOR_SPECIFIC &&
319 sshdr.asc == 0x80 &&
320 sshdr.ascq < ARRAY_SIZE(myrb_event_msg))
321 shost_printk(KERN_CRIT, cb->host,
322 "Physical drive %d:%d: %s\n",
323 ev_buf->channel, ev_buf->target,
324 myrb_event_msg[sshdr.ascq]);
325 else
326 shost_printk(KERN_CRIT, cb->host,
327 "Physical drive %d:%d: Sense: %X/%02X/%02X\n",
328 ev_buf->channel, ev_buf->target,
329 sshdr.sense_key, sshdr.asc, sshdr.ascq);
330 }
331
332 dma_free_coherent(&cb->pdev->dev, sizeof(struct myrb_log_entry),
333 ev_buf, ev_addr);
334}
335
336/**
337 * myrb_get_errtable - retrieves the error table from the controller
338 *
339 * Executes a type 3 command and logs the error table from the controller.
340 */
341static void myrb_get_errtable(struct myrb_hba *cb)
342{
343 struct myrb_cmdblk *cmd_blk = &cb->mcmd_blk;
344 union myrb_cmd_mbox *mbox = &cmd_blk->mbox;
345 unsigned short status;
346 struct myrb_error_entry old_table[MYRB_MAX_CHANNELS * MYRB_MAX_TARGETS];
347
348 memcpy(&old_table, cb->err_table, sizeof(old_table));
349
350 myrb_reset_cmd(cmd_blk);
351 mbox->type3.id = MYRB_MCMD_TAG;
352 mbox->type3.opcode = MYRB_CMD_GET_ERROR_TABLE;
353 mbox->type3.addr = cb->err_table_addr;
354 status = myrb_exec_cmd(cb, cmd_blk);
355 if (status == MYRB_STATUS_SUCCESS) {
356 struct myrb_error_entry *table = cb->err_table;
357 struct myrb_error_entry *new, *old;
358 size_t err_table_offset;
359 struct scsi_device *sdev;
360
361 shost_for_each_device(sdev, cb->host) {
362 if (sdev->channel >= myrb_logical_channel(cb->host))
363 continue;
364 err_table_offset = sdev->channel * MYRB_MAX_TARGETS
365 + sdev->id;
366 new = table + err_table_offset;
367 old = &old_table[err_table_offset];
368 if (new->parity_err == old->parity_err &&
369 new->soft_err == old->soft_err &&
370 new->hard_err == old->hard_err &&
371 new->misc_err == old->misc_err)
372 continue;
373 sdev_printk(KERN_CRIT, sdev,
374 "Errors: Parity = %d, Soft = %d, Hard = %d, Misc = %d\n",
375 new->parity_err, new->soft_err,
376 new->hard_err, new->misc_err);
377 }
378 }
379}
380
381/**
382 * myrb_get_ldev_info - retrieves the logical device table from the controller
383 *
384 * Executes a type 3 command and updates the logical device table.
385 *
386 * Return: command status
387 */
388static unsigned short myrb_get_ldev_info(struct myrb_hba *cb)
389{
390 unsigned short status;
391 int ldev_num, ldev_cnt = cb->enquiry->ldev_count;
392 struct Scsi_Host *shost = cb->host;
393
394 status = myrb_exec_type3(cb, MYRB_CMD_GET_LDEV_INFO,
395 cb->ldev_info_addr);
396 if (status != MYRB_STATUS_SUCCESS)
397 return status;
398
399 for (ldev_num = 0; ldev_num < ldev_cnt; ldev_num++) {
400 struct myrb_ldev_info *old = NULL;
401 struct myrb_ldev_info *new = cb->ldev_info_buf + ldev_num;
402 struct scsi_device *sdev;
403
404 sdev = scsi_device_lookup(shost, myrb_logical_channel(shost),
405 ldev_num, 0);
406 if (!sdev) {
407 if (new->state == MYRB_DEVICE_OFFLINE)
408 continue;
409 shost_printk(KERN_INFO, shost,
410 "Adding Logical Drive %d in state %s\n",
411 ldev_num, myrb_devstate_name(new->state));
412 scsi_add_device(shost, myrb_logical_channel(shost),
413 ldev_num, 0);
414 continue;
415 }
416 old = sdev->hostdata;
417 if (new->state != old->state)
418 shost_printk(KERN_INFO, shost,
419 "Logical Drive %d is now %s\n",
420 ldev_num, myrb_devstate_name(new->state));
421 if (new->wb_enabled != old->wb_enabled)
422 sdev_printk(KERN_INFO, sdev,
423 "Logical Drive is now WRITE %s\n",
424 (new->wb_enabled ? "BACK" : "THRU"));
425 memcpy(old, new, sizeof(*new));
426 scsi_device_put(sdev);
427 }
428 return status;
429}
430
431/**
432 * myrb_get_rbld_progress - get rebuild progress information
433 *
434 * Executes a type 3 command and returns the rebuild progress
435 * information.
436 *
437 * Return: command status
438 */
439static unsigned short myrb_get_rbld_progress(struct myrb_hba *cb,
440 struct myrb_rbld_progress *rbld)
441{
442 struct myrb_cmdblk *cmd_blk = &cb->mcmd_blk;
443 union myrb_cmd_mbox *mbox = &cmd_blk->mbox;
444 struct myrb_rbld_progress *rbld_buf;
445 dma_addr_t rbld_addr;
446 unsigned short status;
447
448 rbld_buf = dma_alloc_coherent(&cb->pdev->dev,
449 sizeof(struct myrb_rbld_progress),
450 &rbld_addr, GFP_KERNEL);
451 if (!rbld_buf)
452 return MYRB_STATUS_RBLD_NOT_CHECKED;
453
454 myrb_reset_cmd(cmd_blk);
455 mbox->type3.id = MYRB_MCMD_TAG;
456 mbox->type3.opcode = MYRB_CMD_GET_REBUILD_PROGRESS;
457 mbox->type3.addr = rbld_addr;
458 status = myrb_exec_cmd(cb, cmd_blk);
459 if (rbld)
460 memcpy(rbld, rbld_buf, sizeof(struct myrb_rbld_progress));
461 dma_free_coherent(&cb->pdev->dev, sizeof(struct myrb_rbld_progress),
462 rbld_buf, rbld_addr);
463 return status;
464}
465
466/**
467 * myrb_update_rbld_progress - updates the rebuild status
468 *
469 * Updates the rebuild status for the attached logical devices.
470 *
471 */
472static void myrb_update_rbld_progress(struct myrb_hba *cb)
473{
474 struct myrb_rbld_progress rbld_buf;
475 unsigned short status;
476
477 status = myrb_get_rbld_progress(cb, &rbld_buf);
478 if (status == MYRB_NO_STDBY_RBLD_OR_CHECK_IN_PROGRESS &&
479 cb->last_rbld_status == MYRB_STATUS_SUCCESS)
480 status = MYRB_STATUS_RBLD_SUCCESS;
481 if (status != MYRB_NO_STDBY_RBLD_OR_CHECK_IN_PROGRESS) {
482 unsigned int blocks_done =
483 rbld_buf.ldev_size - rbld_buf.blocks_left;
484 struct scsi_device *sdev;
485
486 sdev = scsi_device_lookup(cb->host,
487 myrb_logical_channel(cb->host),
488 rbld_buf.ldev_num, 0);
489 if (!sdev)
490 return;
491
492 switch (status) {
493 case MYRB_STATUS_SUCCESS:
494 sdev_printk(KERN_INFO, sdev,
495 "Rebuild in Progress, %d%% completed\n",
496 (100 * (blocks_done >> 7))
497 / (rbld_buf.ldev_size >> 7));
498 break;
499 case MYRB_STATUS_RBLD_FAILED_LDEV_FAILURE:
500 sdev_printk(KERN_INFO, sdev,
501 "Rebuild Failed due to Logical Drive Failure\n");
502 break;
503 case MYRB_STATUS_RBLD_FAILED_BADBLOCKS:
504 sdev_printk(KERN_INFO, sdev,
505 "Rebuild Failed due to Bad Blocks on Other Drives\n");
506 break;
507 case MYRB_STATUS_RBLD_FAILED_NEW_DRIVE_FAILED:
508 sdev_printk(KERN_INFO, sdev,
509 "Rebuild Failed due to Failure of Drive Being Rebuilt\n");
510 break;
511 case MYRB_STATUS_RBLD_SUCCESS:
512 sdev_printk(KERN_INFO, sdev,
513 "Rebuild Completed Successfully\n");
514 break;
515 case MYRB_STATUS_RBLD_SUCCESS_TERMINATED:
516 sdev_printk(KERN_INFO, sdev,
517 "Rebuild Successfully Terminated\n");
518 break;
519 default:
520 break;
521 }
522 scsi_device_put(sdev);
523 }
524 cb->last_rbld_status = status;
525}
526
527/**
528 * myrb_get_cc_progress - retrieve the rebuild status
529 *
530 * Execute a type 3 Command and fetch the rebuild / consistency check
531 * status.
532 */
533static void myrb_get_cc_progress(struct myrb_hba *cb)
534{
535 struct myrb_cmdblk *cmd_blk = &cb->mcmd_blk;
536 union myrb_cmd_mbox *mbox = &cmd_blk->mbox;
537 struct myrb_rbld_progress *rbld_buf;
538 dma_addr_t rbld_addr;
539 unsigned short status;
540
541 rbld_buf = dma_alloc_coherent(&cb->pdev->dev,
542 sizeof(struct myrb_rbld_progress),
543 &rbld_addr, GFP_KERNEL);
544 if (!rbld_buf) {
545 cb->need_cc_status = true;
546 return;
547 }
548 myrb_reset_cmd(cmd_blk);
549 mbox->type3.id = MYRB_MCMD_TAG;
550 mbox->type3.opcode = MYRB_CMD_REBUILD_STAT;
551 mbox->type3.addr = rbld_addr;
552 status = myrb_exec_cmd(cb, cmd_blk);
553 if (status == MYRB_STATUS_SUCCESS) {
554 unsigned int ldev_num = rbld_buf->ldev_num;
555 unsigned int ldev_size = rbld_buf->ldev_size;
556 unsigned int blocks_done =
557 ldev_size - rbld_buf->blocks_left;
558 struct scsi_device *sdev;
559
560 sdev = scsi_device_lookup(cb->host,
561 myrb_logical_channel(cb->host),
562 ldev_num, 0);
563 if (sdev) {
564 sdev_printk(KERN_INFO, sdev,
565 "Consistency Check in Progress: %d%% completed\n",
566 (100 * (blocks_done >> 7))
567 / (ldev_size >> 7));
568 scsi_device_put(sdev);
569 }
570 }
571 dma_free_coherent(&cb->pdev->dev, sizeof(struct myrb_rbld_progress),
572 rbld_buf, rbld_addr);
573}
574
575/**
576 * myrb_bgi_control - updates background initialisation status
577 *
578 * Executes a type 3B command and updates the background initialisation status
579 */
580static void myrb_bgi_control(struct myrb_hba *cb)
581{
582 struct myrb_cmdblk *cmd_blk = &cb->mcmd_blk;
583 union myrb_cmd_mbox *mbox = &cmd_blk->mbox;
584 struct myrb_bgi_status *bgi, *last_bgi;
585 dma_addr_t bgi_addr;
586 struct scsi_device *sdev = NULL;
587 unsigned short status;
588
589 bgi = dma_alloc_coherent(&cb->pdev->dev, sizeof(struct myrb_bgi_status),
590 &bgi_addr, GFP_KERNEL);
591 if (!bgi) {
592 shost_printk(KERN_ERR, cb->host,
593 "Failed to allocate bgi memory\n");
594 return;
595 }
596 myrb_reset_cmd(cmd_blk);
597 mbox->type3B.id = MYRB_DCMD_TAG;
598 mbox->type3B.opcode = MYRB_CMD_BGI_CONTROL;
599 mbox->type3B.optype = 0x20;
600 mbox->type3B.addr = bgi_addr;
601 status = myrb_exec_cmd(cb, cmd_blk);
602 last_bgi = &cb->bgi_status;
603 sdev = scsi_device_lookup(cb->host,
604 myrb_logical_channel(cb->host),
605 bgi->ldev_num, 0);
606 switch (status) {
607 case MYRB_STATUS_SUCCESS:
608 switch (bgi->status) {
609 case MYRB_BGI_INVALID:
610 break;
611 case MYRB_BGI_STARTED:
612 if (!sdev)
613 break;
614 sdev_printk(KERN_INFO, sdev,
615 "Background Initialization Started\n");
616 break;
617 case MYRB_BGI_INPROGRESS:
618 if (!sdev)
619 break;
620 if (bgi->blocks_done == last_bgi->blocks_done &&
621 bgi->ldev_num == last_bgi->ldev_num)
622 break;
623 sdev_printk(KERN_INFO, sdev,
624 "Background Initialization in Progress: %d%% completed\n",
625 (100 * (bgi->blocks_done >> 7))
626 / (bgi->ldev_size >> 7));
627 break;
628 case MYRB_BGI_SUSPENDED:
629 if (!sdev)
630 break;
631 sdev_printk(KERN_INFO, sdev,
632 "Background Initialization Suspended\n");
633 break;
634 case MYRB_BGI_CANCELLED:
635 if (!sdev)
636 break;
637 sdev_printk(KERN_INFO, sdev,
638 "Background Initialization Cancelled\n");
639 break;
640 }
641 memcpy(&cb->bgi_status, bgi, sizeof(struct myrb_bgi_status));
642 break;
643 case MYRB_STATUS_BGI_SUCCESS:
644 if (sdev && cb->bgi_status.status == MYRB_BGI_INPROGRESS)
645 sdev_printk(KERN_INFO, sdev,
646 "Background Initialization Completed Successfully\n");
647 cb->bgi_status.status = MYRB_BGI_INVALID;
648 break;
649 case MYRB_STATUS_BGI_ABORTED:
650 if (sdev && cb->bgi_status.status == MYRB_BGI_INPROGRESS)
651 sdev_printk(KERN_INFO, sdev,
652 "Background Initialization Aborted\n");
653 /* Fallthrough */
654 case MYRB_STATUS_NO_BGI_INPROGRESS:
655 cb->bgi_status.status = MYRB_BGI_INVALID;
656 break;
657 }
658 if (sdev)
659 scsi_device_put(sdev);
660 dma_free_coherent(&cb->pdev->dev, sizeof(struct myrb_bgi_status),
661 bgi, bgi_addr);
662}
663
664/**
665 * myrb_hba_enquiry - updates the controller status
666 *
667 * Executes a DAC_V1_Enquiry command and updates the controller status.
668 *
669 * Return: command status
670 */
671static unsigned short myrb_hba_enquiry(struct myrb_hba *cb)
672{
673 struct myrb_enquiry old, *new;
674 unsigned short status;
675
676 memcpy(&old, cb->enquiry, sizeof(struct myrb_enquiry));
677
678 status = myrb_exec_type3(cb, MYRB_CMD_ENQUIRY, cb->enquiry_addr);
679 if (status != MYRB_STATUS_SUCCESS)
680 return status;
681
682 new = cb->enquiry;
683 if (new->ldev_count > old.ldev_count) {
684 int ldev_num = old.ldev_count - 1;
685
686 while (++ldev_num < new->ldev_count)
687 shost_printk(KERN_CRIT, cb->host,
688 "Logical Drive %d Now Exists\n",
689 ldev_num);
690 }
691 if (new->ldev_count < old.ldev_count) {
692 int ldev_num = new->ldev_count - 1;
693
694 while (++ldev_num < old.ldev_count)
695 shost_printk(KERN_CRIT, cb->host,
696 "Logical Drive %d No Longer Exists\n",
697 ldev_num);
698 }
699 if (new->status.deferred != old.status.deferred)
700 shost_printk(KERN_CRIT, cb->host,
701 "Deferred Write Error Flag is now %s\n",
702 (new->status.deferred ? "TRUE" : "FALSE"));
703 if (new->ev_seq != old.ev_seq) {
704 cb->new_ev_seq = new->ev_seq;
705 cb->need_err_info = true;
706 shost_printk(KERN_INFO, cb->host,
707 "Event log %d/%d (%d/%d) available\n",
708 cb->old_ev_seq, cb->new_ev_seq,
709 old.ev_seq, new->ev_seq);
710 }
711 if ((new->ldev_critical > 0 &&
712 new->ldev_critical != old.ldev_critical) ||
713 (new->ldev_offline > 0 &&
714 new->ldev_offline != old.ldev_offline) ||
715 (new->ldev_count != old.ldev_count)) {
716 shost_printk(KERN_INFO, cb->host,
717 "Logical drive count changed (%d/%d/%d)\n",
718 new->ldev_critical,
719 new->ldev_offline,
720 new->ldev_count);
721 cb->need_ldev_info = true;
722 }
723 if (new->pdev_dead > 0 ||
724 new->pdev_dead != old.pdev_dead ||
725 time_after_eq(jiffies, cb->secondary_monitor_time
726 + MYRB_SECONDARY_MONITOR_INTERVAL)) {
727 cb->need_bgi_status = cb->bgi_status_supported;
728 cb->secondary_monitor_time = jiffies;
729 }
730 if (new->rbld == MYRB_STDBY_RBLD_IN_PROGRESS ||
731 new->rbld == MYRB_BG_RBLD_IN_PROGRESS ||
732 old.rbld == MYRB_STDBY_RBLD_IN_PROGRESS ||
733 old.rbld == MYRB_BG_RBLD_IN_PROGRESS) {
734 cb->need_rbld = true;
735 cb->rbld_first = (new->ldev_critical < old.ldev_critical);
736 }
737 if (old.rbld == MYRB_BG_CHECK_IN_PROGRESS)
738 switch (new->rbld) {
739 case MYRB_NO_STDBY_RBLD_OR_CHECK_IN_PROGRESS:
740 shost_printk(KERN_INFO, cb->host,
741 "Consistency Check Completed Successfully\n");
742 break;
743 case MYRB_STDBY_RBLD_IN_PROGRESS:
744 case MYRB_BG_RBLD_IN_PROGRESS:
745 break;
746 case MYRB_BG_CHECK_IN_PROGRESS:
747 cb->need_cc_status = true;
748 break;
749 case MYRB_STDBY_RBLD_COMPLETED_WITH_ERROR:
750 shost_printk(KERN_INFO, cb->host,
751 "Consistency Check Completed with Error\n");
752 break;
753 case MYRB_BG_RBLD_OR_CHECK_FAILED_DRIVE_FAILED:
754 shost_printk(KERN_INFO, cb->host,
755 "Consistency Check Failed - Physical Device Failed\n");
756 break;
757 case MYRB_BG_RBLD_OR_CHECK_FAILED_LDEV_FAILED:
758 shost_printk(KERN_INFO, cb->host,
759 "Consistency Check Failed - Logical Drive Failed\n");
760 break;
761 case MYRB_BG_RBLD_OR_CHECK_FAILED_OTHER:
762 shost_printk(KERN_INFO, cb->host,
763 "Consistency Check Failed - Other Causes\n");
764 break;
765 case MYRB_BG_RBLD_OR_CHECK_SUCCESS_TERMINATED:
766 shost_printk(KERN_INFO, cb->host,
767 "Consistency Check Successfully Terminated\n");
768 break;
769 }
770 else if (new->rbld == MYRB_BG_CHECK_IN_PROGRESS)
771 cb->need_cc_status = true;
772
773 return MYRB_STATUS_SUCCESS;
774}
775
776/**
777 * myrb_set_pdev_state - sets the device state for a physical device
778 *
779 * Return: command status
780 */
781static unsigned short myrb_set_pdev_state(struct myrb_hba *cb,
782 struct scsi_device *sdev, enum myrb_devstate state)
783{
784 struct myrb_cmdblk *cmd_blk = &cb->dcmd_blk;
785 union myrb_cmd_mbox *mbox = &cmd_blk->mbox;
786 unsigned short status;
787
788 mutex_lock(&cb->dcmd_mutex);
789 mbox->type3D.opcode = MYRB_CMD_START_DEVICE;
790 mbox->type3D.id = MYRB_DCMD_TAG;
791 mbox->type3D.channel = sdev->channel;
792 mbox->type3D.target = sdev->id;
793 mbox->type3D.state = state & 0x1F;
794 status = myrb_exec_cmd(cb, cmd_blk);
795 mutex_unlock(&cb->dcmd_mutex);
796
797 return status;
798}
799
800/**
801 * myrb_enable_mmio - enables the Memory Mailbox Interface
802 *
803 * PD and P controller types have no memory mailbox, but still need the
804 * other dma mapped memory.
805 *
806 * Return: true on success, false otherwise.
807 */
808static bool myrb_enable_mmio(struct myrb_hba *cb, mbox_mmio_init_t mmio_init_fn)
809{
810 void __iomem *base = cb->io_base;
811 struct pci_dev *pdev = cb->pdev;
812 size_t err_table_size;
813 size_t ldev_info_size;
814 union myrb_cmd_mbox *cmd_mbox_mem;
815 struct myrb_stat_mbox *stat_mbox_mem;
816 union myrb_cmd_mbox mbox;
817 unsigned short status;
818
819 memset(&mbox, 0, sizeof(union myrb_cmd_mbox));
820
821 if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
822 dev_err(&pdev->dev, "DMA mask out of range\n");
823 return false;
824 }
825
826 cb->enquiry = dma_alloc_coherent(&pdev->dev,
827 sizeof(struct myrb_enquiry),
828 &cb->enquiry_addr, GFP_KERNEL);
829 if (!cb->enquiry)
830 return false;
831
832 err_table_size = sizeof(struct myrb_error_entry) *
833 MYRB_MAX_CHANNELS * MYRB_MAX_TARGETS;
834 cb->err_table = dma_alloc_coherent(&pdev->dev, err_table_size,
835 &cb->err_table_addr, GFP_KERNEL);
836 if (!cb->err_table)
837 return false;
838
839 ldev_info_size = sizeof(struct myrb_ldev_info) * MYRB_MAX_LDEVS;
840 cb->ldev_info_buf = dma_alloc_coherent(&pdev->dev, ldev_info_size,
841 &cb->ldev_info_addr, GFP_KERNEL);
842 if (!cb->ldev_info_buf)
843 return false;
844
845 /*
846 * Skip mailbox initialisation for PD and P Controllers
847 */
848 if (!mmio_init_fn)
849 return true;
850
851 /* These are the base addresses for the command memory mailbox array */
852 cb->cmd_mbox_size = MYRB_CMD_MBOX_COUNT * sizeof(union myrb_cmd_mbox);
853 cb->first_cmd_mbox = dma_alloc_coherent(&pdev->dev,
854 cb->cmd_mbox_size,
855 &cb->cmd_mbox_addr,
856 GFP_KERNEL);
857 if (!cb->first_cmd_mbox)
858 return false;
859
860 cmd_mbox_mem = cb->first_cmd_mbox;
861 cmd_mbox_mem += MYRB_CMD_MBOX_COUNT - 1;
862 cb->last_cmd_mbox = cmd_mbox_mem;
863 cb->next_cmd_mbox = cb->first_cmd_mbox;
864 cb->prev_cmd_mbox1 = cb->last_cmd_mbox;
865 cb->prev_cmd_mbox2 = cb->last_cmd_mbox - 1;
866
867 /* These are the base addresses for the status memory mailbox array */
868 cb->stat_mbox_size = MYRB_STAT_MBOX_COUNT *
869 sizeof(struct myrb_stat_mbox);
870 cb->first_stat_mbox = dma_alloc_coherent(&pdev->dev,
871 cb->stat_mbox_size,
872 &cb->stat_mbox_addr,
873 GFP_KERNEL);
874 if (!cb->first_stat_mbox)
875 return false;
876
877 stat_mbox_mem = cb->first_stat_mbox;
878 stat_mbox_mem += MYRB_STAT_MBOX_COUNT - 1;
879 cb->last_stat_mbox = stat_mbox_mem;
880 cb->next_stat_mbox = cb->first_stat_mbox;
881
882 /* Enable the Memory Mailbox Interface. */
883 cb->dual_mode_interface = true;
884 mbox.typeX.opcode = 0x2B;
885 mbox.typeX.id = 0;
886 mbox.typeX.opcode2 = 0x14;
887 mbox.typeX.cmd_mbox_addr = cb->cmd_mbox_addr;
888 mbox.typeX.stat_mbox_addr = cb->stat_mbox_addr;
889
890 status = mmio_init_fn(pdev, base, &mbox);
891 if (status != MYRB_STATUS_SUCCESS) {
892 cb->dual_mode_interface = false;
893 mbox.typeX.opcode2 = 0x10;
894 status = mmio_init_fn(pdev, base, &mbox);
895 if (status != MYRB_STATUS_SUCCESS) {
896 dev_err(&pdev->dev,
897 "Failed to enable mailbox, statux %02X\n",
898 status);
899 return false;
900 }
901 }
902 return true;
903}
904
905/**
906 * myrb_get_hba_config - reads the configuration information
907 *
908 * Reads the configuration information from the controller and
909 * initializes the controller structure.
910 *
911 * Return: 0 on success, errno otherwise
912 */
913static int myrb_get_hba_config(struct myrb_hba *cb)
914{
915 struct myrb_enquiry2 *enquiry2;
916 dma_addr_t enquiry2_addr;
917 struct myrb_config2 *config2;
918 dma_addr_t config2_addr;
919 struct Scsi_Host *shost = cb->host;
920 struct pci_dev *pdev = cb->pdev;
921 int pchan_max = 0, pchan_cur = 0;
922 unsigned short status;
923 int ret = -ENODEV, memsize = 0;
924
925 enquiry2 = dma_alloc_coherent(&pdev->dev, sizeof(struct myrb_enquiry2),
926 &enquiry2_addr, GFP_KERNEL);
927 if (!enquiry2) {
928 shost_printk(KERN_ERR, cb->host,
929 "Failed to allocate V1 enquiry2 memory\n");
930 return -ENOMEM;
931 }
932 config2 = dma_alloc_coherent(&pdev->dev, sizeof(struct myrb_config2),
933 &config2_addr, GFP_KERNEL);
934 if (!config2) {
935 shost_printk(KERN_ERR, cb->host,
936 "Failed to allocate V1 config2 memory\n");
937 dma_free_coherent(&pdev->dev, sizeof(struct myrb_enquiry2),
938 enquiry2, enquiry2_addr);
939 return -ENOMEM;
940 }
941 mutex_lock(&cb->dma_mutex);
942 status = myrb_hba_enquiry(cb);
943 mutex_unlock(&cb->dma_mutex);
944 if (status != MYRB_STATUS_SUCCESS) {
945 shost_printk(KERN_WARNING, cb->host,
946 "Failed it issue V1 Enquiry\n");
947 goto out_free;
948 }
949
950 status = myrb_exec_type3(cb, MYRB_CMD_ENQUIRY2, enquiry2_addr);
951 if (status != MYRB_STATUS_SUCCESS) {
952 shost_printk(KERN_WARNING, cb->host,
953 "Failed to issue V1 Enquiry2\n");
954 goto out_free;
955 }
956
957 status = myrb_exec_type3(cb, MYRB_CMD_READ_CONFIG2, config2_addr);
958 if (status != MYRB_STATUS_SUCCESS) {
959 shost_printk(KERN_WARNING, cb->host,
960 "Failed to issue ReadConfig2\n");
961 goto out_free;
962 }
963
964 status = myrb_get_ldev_info(cb);
965 if (status != MYRB_STATUS_SUCCESS) {
966 shost_printk(KERN_WARNING, cb->host,
967 "Failed to get logical drive information\n");
968 goto out_free;
969 }
970
971 /*
972 * Initialize the Controller Model Name and Full Model Name fields.
973 */
974 switch (enquiry2->hw.sub_model) {
975 case DAC960_V1_P_PD_PU:
976 if (enquiry2->scsi_cap.bus_speed == MYRB_SCSI_SPEED_ULTRA)
977 strcpy(cb->model_name, "DAC960PU");
978 else
979 strcpy(cb->model_name, "DAC960PD");
980 break;
981 case DAC960_V1_PL:
982 strcpy(cb->model_name, "DAC960PL");
983 break;
984 case DAC960_V1_PG:
985 strcpy(cb->model_name, "DAC960PG");
986 break;
987 case DAC960_V1_PJ:
988 strcpy(cb->model_name, "DAC960PJ");
989 break;
990 case DAC960_V1_PR:
991 strcpy(cb->model_name, "DAC960PR");
992 break;
993 case DAC960_V1_PT:
994 strcpy(cb->model_name, "DAC960PT");
995 break;
996 case DAC960_V1_PTL0:
997 strcpy(cb->model_name, "DAC960PTL0");
998 break;
999 case DAC960_V1_PRL:
1000 strcpy(cb->model_name, "DAC960PRL");
1001 break;
1002 case DAC960_V1_PTL1:
1003 strcpy(cb->model_name, "DAC960PTL1");
1004 break;
1005 case DAC960_V1_1164P:
1006 strcpy(cb->model_name, "eXtremeRAID 1100");
1007 break;
1008 default:
1009 shost_printk(KERN_WARNING, cb->host,
1010 "Unknown Model %X\n",
1011 enquiry2->hw.sub_model);
1012 goto out;
1013 }
1014 /*
1015 * Initialize the Controller Firmware Version field and verify that it
1016 * is a supported firmware version.
1017 * The supported firmware versions are:
1018 *
1019 * DAC1164P 5.06 and above
1020 * DAC960PTL/PRL/PJ/PG 4.06 and above
1021 * DAC960PU/PD/PL 3.51 and above
1022 * DAC960PU/PD/PL/P 2.73 and above
1023 */
1024#if defined(CONFIG_ALPHA)
1025 /*
1026 * DEC Alpha machines were often equipped with DAC960 cards that were
1027 * OEMed from Mylex, and had their own custom firmware. Version 2.70,
1028 * the last custom FW revision to be released by DEC for these older
1029 * controllers, appears to work quite well with this driver.
1030 *
1031 * Cards tested successfully were several versions each of the PD and
1032 * PU, called by DEC the KZPSC and KZPAC, respectively, and having
1033 * the Manufacturer Numbers (from Mylex), usually on a sticker on the
1034 * back of the board, of:
1035 *
1036 * KZPSC: D040347 (1-channel) or D040348 (2-channel)
1037 * or D040349 (3-channel)
1038 * KZPAC: D040395 (1-channel) or D040396 (2-channel)
1039 * or D040397 (3-channel)
1040 */
1041# define FIRMWARE_27X "2.70"
1042#else
1043# define FIRMWARE_27X "2.73"
1044#endif
1045
1046 if (enquiry2->fw.major_version == 0) {
1047 enquiry2->fw.major_version = cb->enquiry->fw_major_version;
1048 enquiry2->fw.minor_version = cb->enquiry->fw_minor_version;
1049 enquiry2->fw.firmware_type = '0';
1050 enquiry2->fw.turn_id = 0;
1051 }
1052 sprintf(cb->fw_version, "%d.%02d-%c-%02d",
1053 enquiry2->fw.major_version,
1054 enquiry2->fw.minor_version,
1055 enquiry2->fw.firmware_type,
1056 enquiry2->fw.turn_id);
1057 if (!((enquiry2->fw.major_version == 5 &&
1058 enquiry2->fw.minor_version >= 6) ||
1059 (enquiry2->fw.major_version == 4 &&
1060 enquiry2->fw.minor_version >= 6) ||
1061 (enquiry2->fw.major_version == 3 &&
1062 enquiry2->fw.minor_version >= 51) ||
1063 (enquiry2->fw.major_version == 2 &&
1064 strcmp(cb->fw_version, FIRMWARE_27X) >= 0))) {
1065 shost_printk(KERN_WARNING, cb->host,
1066 "Firmware Version '%s' unsupported\n",
1067 cb->fw_version);
1068 goto out;
1069 }
1070 /*
1071 * Initialize the Channels, Targets, Memory Size, and SAF-TE
1072 * Enclosure Management Enabled fields.
1073 */
1074 switch (enquiry2->hw.model) {
1075 case MYRB_5_CHANNEL_BOARD:
1076 pchan_max = 5;
1077 break;
1078 case MYRB_3_CHANNEL_BOARD:
1079 case MYRB_3_CHANNEL_ASIC_DAC:
1080 pchan_max = 3;
1081 break;
1082 case MYRB_2_CHANNEL_BOARD:
1083 pchan_max = 2;
1084 break;
1085 default:
1086 pchan_max = enquiry2->cfg_chan;
1087 break;
1088 }
1089 pchan_cur = enquiry2->cur_chan;
1090 if (enquiry2->scsi_cap.bus_width == MYRB_WIDTH_WIDE_32BIT)
1091 cb->bus_width = 32;
1092 else if (enquiry2->scsi_cap.bus_width == MYRB_WIDTH_WIDE_16BIT)
1093 cb->bus_width = 16;
1094 else
1095 cb->bus_width = 8;
1096 cb->ldev_block_size = enquiry2->ldev_block_size;
1097 shost->max_channel = pchan_cur;
1098 shost->max_id = enquiry2->max_targets;
1099 memsize = enquiry2->mem_size >> 20;
1100 cb->safte_enabled = (enquiry2->fault_mgmt == MYRB_FAULT_SAFTE);
1101 /*
1102 * Initialize the Controller Queue Depth, Driver Queue Depth,
1103 * Logical Drive Count, Maximum Blocks per Command, Controller
1104 * Scatter/Gather Limit, and Driver Scatter/Gather Limit.
1105 * The Driver Queue Depth must be at most one less than the
1106 * Controller Queue Depth to allow for an automatic drive
1107 * rebuild operation.
1108 */
1109 shost->can_queue = cb->enquiry->max_tcq;
1110 if (shost->can_queue < 3)
1111 shost->can_queue = enquiry2->max_cmds;
1112 if (shost->can_queue < 3)
1113 /* Play safe and disable TCQ */
1114 shost->can_queue = 1;
1115
1116 if (shost->can_queue > MYRB_CMD_MBOX_COUNT - 2)
1117 shost->can_queue = MYRB_CMD_MBOX_COUNT - 2;
1118 shost->max_sectors = enquiry2->max_sectors;
1119 shost->sg_tablesize = enquiry2->max_sge;
1120 if (shost->sg_tablesize > MYRB_SCATTER_GATHER_LIMIT)
1121 shost->sg_tablesize = MYRB_SCATTER_GATHER_LIMIT;
1122 /*
1123 * Initialize the Stripe Size, Segment Size, and Geometry Translation.
1124 */
1125 cb->stripe_size = config2->blocks_per_stripe * config2->block_factor
1126 >> (10 - MYRB_BLKSIZE_BITS);
1127 cb->segment_size = config2->blocks_per_cacheline * config2->block_factor
1128 >> (10 - MYRB_BLKSIZE_BITS);
1129 /* Assume 255/63 translation */
1130 cb->ldev_geom_heads = 255;
1131 cb->ldev_geom_sectors = 63;
1132 if (config2->drive_geometry) {
1133 cb->ldev_geom_heads = 128;
1134 cb->ldev_geom_sectors = 32;
1135 }
1136
1137 /*
1138 * Initialize the Background Initialization Status.
1139 */
1140 if ((cb->fw_version[0] == '4' &&
1141 strcmp(cb->fw_version, "4.08") >= 0) ||
1142 (cb->fw_version[0] == '5' &&
1143 strcmp(cb->fw_version, "5.08") >= 0)) {
1144 cb->bgi_status_supported = true;
1145 myrb_bgi_control(cb);
1146 }
1147 cb->last_rbld_status = MYRB_NO_STDBY_RBLD_OR_CHECK_IN_PROGRESS;
1148 ret = 0;
1149
1150out:
1151 shost_printk(KERN_INFO, cb->host,
1152 "Configuring %s PCI RAID Controller\n", cb->model_name);
1153 shost_printk(KERN_INFO, cb->host,
1154 " Firmware Version: %s, Memory Size: %dMB\n",
1155 cb->fw_version, memsize);
1156 if (cb->io_addr == 0)
1157 shost_printk(KERN_INFO, cb->host,
1158 " I/O Address: n/a, PCI Address: 0x%lX, IRQ Channel: %d\n",
1159 (unsigned long)cb->pci_addr, cb->irq);
1160 else
1161 shost_printk(KERN_INFO, cb->host,
1162 " I/O Address: 0x%lX, PCI Address: 0x%lX, IRQ Channel: %d\n",
1163 (unsigned long)cb->io_addr, (unsigned long)cb->pci_addr,
1164 cb->irq);
1165 shost_printk(KERN_INFO, cb->host,
1166 " Controller Queue Depth: %d, Maximum Blocks per Command: %d\n",
1167 cb->host->can_queue, cb->host->max_sectors);
1168 shost_printk(KERN_INFO, cb->host,
1169 " Driver Queue Depth: %d, Scatter/Gather Limit: %d of %d Segments\n",
1170 cb->host->can_queue, cb->host->sg_tablesize,
1171 MYRB_SCATTER_GATHER_LIMIT);
1172 shost_printk(KERN_INFO, cb->host,
1173 " Stripe Size: %dKB, Segment Size: %dKB, BIOS Geometry: %d/%d%s\n",
1174 cb->stripe_size, cb->segment_size,
1175 cb->ldev_geom_heads, cb->ldev_geom_sectors,
1176 cb->safte_enabled ?
1177 " SAF-TE Enclosure Management Enabled" : "");
1178 shost_printk(KERN_INFO, cb->host,
1179 " Physical: %d/%d channels %d/%d/%d devices\n",
1180 pchan_cur, pchan_max, 0, cb->enquiry->pdev_dead,
1181 cb->host->max_id);
1182
1183 shost_printk(KERN_INFO, cb->host,
1184 " Logical: 1/1 channels, %d/%d disks\n",
1185 cb->enquiry->ldev_count, MYRB_MAX_LDEVS);
1186
1187out_free:
1188 dma_free_coherent(&pdev->dev, sizeof(struct myrb_enquiry2),
1189 enquiry2, enquiry2_addr);
1190 dma_free_coherent(&pdev->dev, sizeof(struct myrb_config2),
1191 config2, config2_addr);
1192
1193 return ret;
1194}
1195
1196/**
1197 * myrb_unmap - unmaps controller structures
1198 */
1199static void myrb_unmap(struct myrb_hba *cb)
1200{
1201 if (cb->ldev_info_buf) {
1202 size_t ldev_info_size = sizeof(struct myrb_ldev_info) *
1203 MYRB_MAX_LDEVS;
1204 dma_free_coherent(&cb->pdev->dev, ldev_info_size,
1205 cb->ldev_info_buf, cb->ldev_info_addr);
1206 cb->ldev_info_buf = NULL;
1207 }
1208 if (cb->err_table) {
1209 size_t err_table_size = sizeof(struct myrb_error_entry) *
1210 MYRB_MAX_CHANNELS * MYRB_MAX_TARGETS;
1211 dma_free_coherent(&cb->pdev->dev, err_table_size,
1212 cb->err_table, cb->err_table_addr);
1213 cb->err_table = NULL;
1214 }
1215 if (cb->enquiry) {
1216 dma_free_coherent(&cb->pdev->dev, sizeof(struct myrb_enquiry),
1217 cb->enquiry, cb->enquiry_addr);
1218 cb->enquiry = NULL;
1219 }
1220 if (cb->first_stat_mbox) {
1221 dma_free_coherent(&cb->pdev->dev, cb->stat_mbox_size,
1222 cb->first_stat_mbox, cb->stat_mbox_addr);
1223 cb->first_stat_mbox = NULL;
1224 }
1225 if (cb->first_cmd_mbox) {
1226 dma_free_coherent(&cb->pdev->dev, cb->cmd_mbox_size,
1227 cb->first_cmd_mbox, cb->cmd_mbox_addr);
1228 cb->first_cmd_mbox = NULL;
1229 }
1230}
1231
1232/**
1233 * myrb_cleanup - cleanup controller structures
1234 */
1235static void myrb_cleanup(struct myrb_hba *cb)
1236{
1237 struct pci_dev *pdev = cb->pdev;
1238
1239 /* Free the memory mailbox, status, and related structures */
1240 myrb_unmap(cb);
1241
1242 if (cb->mmio_base) {
1243 cb->disable_intr(cb->io_base);
1244 iounmap(cb->mmio_base);
1245 }
1246 if (cb->irq)
1247 free_irq(cb->irq, cb);
1248 if (cb->io_addr)
1249 release_region(cb->io_addr, 0x80);
1250 pci_set_drvdata(pdev, NULL);
1251 pci_disable_device(pdev);
1252 scsi_host_put(cb->host);
1253}
1254
1255static int myrb_host_reset(struct scsi_cmnd *scmd)
1256{
1257 struct Scsi_Host *shost = scmd->device->host;
1258 struct myrb_hba *cb = shost_priv(shost);
1259
1260 cb->reset(cb->io_base);
1261 return SUCCESS;
1262}
1263
1264static int myrb_pthru_queuecommand(struct Scsi_Host *shost,
1265 struct scsi_cmnd *scmd)
1266{
1267 struct myrb_hba *cb = shost_priv(shost);
1268 struct myrb_cmdblk *cmd_blk = scsi_cmd_priv(scmd);
1269 union myrb_cmd_mbox *mbox = &cmd_blk->mbox;
1270 struct myrb_dcdb *dcdb;
1271 dma_addr_t dcdb_addr;
1272 struct scsi_device *sdev = scmd->device;
1273 struct scatterlist *sgl;
1274 unsigned long flags;
1275 int nsge;
1276
1277 myrb_reset_cmd(cmd_blk);
1278 dcdb = dma_pool_alloc(cb->dcdb_pool, GFP_ATOMIC, &dcdb_addr);
1279 if (!dcdb)
1280 return SCSI_MLQUEUE_HOST_BUSY;
1281 nsge = scsi_dma_map(scmd);
1282 if (nsge > 1) {
1283 dma_pool_free(cb->dcdb_pool, dcdb, dcdb_addr);
1284 scmd->result = (DID_ERROR << 16);
1285 scmd->scsi_done(scmd);
1286 return 0;
1287 }
1288
1289 mbox->type3.opcode = MYRB_CMD_DCDB;
1290 mbox->type3.id = scmd->request->tag + 3;
1291 mbox->type3.addr = dcdb_addr;
1292 dcdb->channel = sdev->channel;
1293 dcdb->target = sdev->id;
1294 switch (scmd->sc_data_direction) {
1295 case DMA_NONE:
1296 dcdb->data_xfer = MYRB_DCDB_XFER_NONE;
1297 break;
1298 case DMA_TO_DEVICE:
1299 dcdb->data_xfer = MYRB_DCDB_XFER_SYSTEM_TO_DEVICE;
1300 break;
1301 case DMA_FROM_DEVICE:
1302 dcdb->data_xfer = MYRB_DCDB_XFER_DEVICE_TO_SYSTEM;
1303 break;
1304 default:
1305 dcdb->data_xfer = MYRB_DCDB_XFER_ILLEGAL;
1306 break;
1307 }
1308 dcdb->early_status = false;
1309 if (scmd->request->timeout <= 10)
1310 dcdb->timeout = MYRB_DCDB_TMO_10_SECS;
1311 else if (scmd->request->timeout <= 60)
1312 dcdb->timeout = MYRB_DCDB_TMO_60_SECS;
1313 else if (scmd->request->timeout <= 600)
1314 dcdb->timeout = MYRB_DCDB_TMO_10_MINS;
1315 else
1316 dcdb->timeout = MYRB_DCDB_TMO_24_HRS;
1317 dcdb->no_autosense = false;
1318 dcdb->allow_disconnect = true;
1319 sgl = scsi_sglist(scmd);
1320 dcdb->dma_addr = sg_dma_address(sgl);
1321 if (sg_dma_len(sgl) > USHRT_MAX) {
1322 dcdb->xfer_len_lo = sg_dma_len(sgl) & 0xffff;
1323 dcdb->xfer_len_hi4 = sg_dma_len(sgl) >> 16;
1324 } else {
1325 dcdb->xfer_len_lo = sg_dma_len(sgl);
1326 dcdb->xfer_len_hi4 = 0;
1327 }
1328 dcdb->cdb_len = scmd->cmd_len;
1329 dcdb->sense_len = sizeof(dcdb->sense);
1330 memcpy(&dcdb->cdb, scmd->cmnd, scmd->cmd_len);
1331
1332 spin_lock_irqsave(&cb->queue_lock, flags);
1333 cb->qcmd(cb, cmd_blk);
1334 spin_unlock_irqrestore(&cb->queue_lock, flags);
1335 return 0;
1336}
1337
1338static void myrb_inquiry(struct myrb_hba *cb,
1339 struct scsi_cmnd *scmd)
1340{
1341 unsigned char inq[36] = {
1342 0x00, 0x00, 0x03, 0x02, 0x20, 0x00, 0x01, 0x00,
1343 0x4d, 0x59, 0x4c, 0x45, 0x58, 0x20, 0x20, 0x20,
1344 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1345 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1346 0x20, 0x20, 0x20, 0x20,
1347 };
1348
1349 if (cb->bus_width > 16)
1350 inq[7] |= 1 << 6;
1351 if (cb->bus_width > 8)
1352 inq[7] |= 1 << 5;
1353 memcpy(&inq[16], cb->model_name, 16);
1354 memcpy(&inq[32], cb->fw_version, 1);
1355 memcpy(&inq[33], &cb->fw_version[2], 2);
1356 memcpy(&inq[35], &cb->fw_version[7], 1);
1357
1358 scsi_sg_copy_from_buffer(scmd, (void *)inq, 36);
1359}
1360
1361static void
1362myrb_mode_sense(struct myrb_hba *cb, struct scsi_cmnd *scmd,
1363 struct myrb_ldev_info *ldev_info)
1364{
1365 unsigned char modes[32], *mode_pg;
1366 bool dbd;
1367 size_t mode_len;
1368
1369 dbd = (scmd->cmnd[1] & 0x08) == 0x08;
1370 if (dbd) {
1371 mode_len = 24;
1372 mode_pg = &modes[4];
1373 } else {
1374 mode_len = 32;
1375 mode_pg = &modes[12];
1376 }
1377 memset(modes, 0, sizeof(modes));
1378 modes[0] = mode_len - 1;
1379 if (!dbd) {
1380 unsigned char *block_desc = &modes[4];
1381
1382 modes[3] = 8;
1383 put_unaligned_be32(ldev_info->size, &block_desc[0]);
1384 put_unaligned_be32(cb->ldev_block_size, &block_desc[5]);
1385 }
1386 mode_pg[0] = 0x08;
1387 mode_pg[1] = 0x12;
1388 if (ldev_info->wb_enabled)
1389 mode_pg[2] |= 0x04;
1390 if (cb->segment_size) {
1391 mode_pg[2] |= 0x08;
1392 put_unaligned_be16(cb->segment_size, &mode_pg[14]);
1393 }
1394
1395 scsi_sg_copy_from_buffer(scmd, modes, mode_len);
1396}
1397
1398static void myrb_request_sense(struct myrb_hba *cb,
1399 struct scsi_cmnd *scmd)
1400{
1401 scsi_build_sense_buffer(0, scmd->sense_buffer,
1402 NO_SENSE, 0, 0);
1403 scsi_sg_copy_from_buffer(scmd, scmd->sense_buffer,
1404 SCSI_SENSE_BUFFERSIZE);
1405}
1406
1407static void myrb_read_capacity(struct myrb_hba *cb, struct scsi_cmnd *scmd,
1408 struct myrb_ldev_info *ldev_info)
1409{
1410 unsigned char data[8];
1411
1412 dev_dbg(&scmd->device->sdev_gendev,
1413 "Capacity %u, blocksize %u\n",
1414 ldev_info->size, cb->ldev_block_size);
1415 put_unaligned_be32(ldev_info->size - 1, &data[0]);
1416 put_unaligned_be32(cb->ldev_block_size, &data[4]);
1417 scsi_sg_copy_from_buffer(scmd, data, 8);
1418}
1419
1420static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
1421 struct scsi_cmnd *scmd)
1422{
1423 struct myrb_hba *cb = shost_priv(shost);
1424 struct myrb_cmdblk *cmd_blk = scsi_cmd_priv(scmd);
1425 union myrb_cmd_mbox *mbox = &cmd_blk->mbox;
1426 struct myrb_ldev_info *ldev_info;
1427 struct scsi_device *sdev = scmd->device;
1428 struct scatterlist *sgl;
1429 unsigned long flags;
1430 u64 lba;
1431 u32 block_cnt;
1432 int nsge;
1433
1434 ldev_info = sdev->hostdata;
1435 if (ldev_info->state != MYRB_DEVICE_ONLINE &&
1436 ldev_info->state != MYRB_DEVICE_WO) {
1437 dev_dbg(&shost->shost_gendev, "ldev %u in state %x, skip\n",
1438 sdev->id, ldev_info ? ldev_info->state : 0xff);
1439 scmd->result = (DID_BAD_TARGET << 16);
1440 scmd->scsi_done(scmd);
1441 return 0;
1442 }
1443 switch (scmd->cmnd[0]) {
1444 case TEST_UNIT_READY:
1445 scmd->result = (DID_OK << 16);
1446 scmd->scsi_done(scmd);
1447 return 0;
1448 case INQUIRY:
1449 if (scmd->cmnd[1] & 1) {
1450 /* Illegal request, invalid field in CDB */
1451 scsi_build_sense_buffer(0, scmd->sense_buffer,
1452 ILLEGAL_REQUEST, 0x24, 0);
1453 scmd->result = (DRIVER_SENSE << 24) |
1454 SAM_STAT_CHECK_CONDITION;
1455 } else {
1456 myrb_inquiry(cb, scmd);
1457 scmd->result = (DID_OK << 16);
1458 }
1459 scmd->scsi_done(scmd);
1460 return 0;
1461 case SYNCHRONIZE_CACHE:
1462 scmd->result = (DID_OK << 16);
1463 scmd->scsi_done(scmd);
1464 return 0;
1465 case MODE_SENSE:
1466 if ((scmd->cmnd[2] & 0x3F) != 0x3F &&
1467 (scmd->cmnd[2] & 0x3F) != 0x08) {
1468 /* Illegal request, invalid field in CDB */
1469 scsi_build_sense_buffer(0, scmd->sense_buffer,
1470 ILLEGAL_REQUEST, 0x24, 0);
1471 scmd->result = (DRIVER_SENSE << 24) |
1472 SAM_STAT_CHECK_CONDITION;
1473 } else {
1474 myrb_mode_sense(cb, scmd, ldev_info);
1475 scmd->result = (DID_OK << 16);
1476 }
1477 scmd->scsi_done(scmd);
1478 return 0;
1479 case READ_CAPACITY:
1480 if ((scmd->cmnd[1] & 1) ||
1481 (scmd->cmnd[8] & 1)) {
1482 /* Illegal request, invalid field in CDB */
1483 scsi_build_sense_buffer(0, scmd->sense_buffer,
1484 ILLEGAL_REQUEST, 0x24, 0);
1485 scmd->result = (DRIVER_SENSE << 24) |
1486 SAM_STAT_CHECK_CONDITION;
1487 scmd->scsi_done(scmd);
1488 return 0;
1489 }
1490 lba = get_unaligned_be32(&scmd->cmnd[2]);
1491 if (lba) {
1492 /* Illegal request, invalid field in CDB */
1493 scsi_build_sense_buffer(0, scmd->sense_buffer,
1494 ILLEGAL_REQUEST, 0x24, 0);
1495 scmd->result = (DRIVER_SENSE << 24) |
1496 SAM_STAT_CHECK_CONDITION;
1497 scmd->scsi_done(scmd);
1498 return 0;
1499 }
1500 myrb_read_capacity(cb, scmd, ldev_info);
1501 scmd->scsi_done(scmd);
1502 return 0;
1503 case REQUEST_SENSE:
1504 myrb_request_sense(cb, scmd);
1505 scmd->result = (DID_OK << 16);
1506 return 0;
1507 case SEND_DIAGNOSTIC:
1508 if (scmd->cmnd[1] != 0x04) {
1509 /* Illegal request, invalid field in CDB */
1510 scsi_build_sense_buffer(0, scmd->sense_buffer,
1511 ILLEGAL_REQUEST, 0x24, 0);
1512 scmd->result = (DRIVER_SENSE << 24) |
1513 SAM_STAT_CHECK_CONDITION;
1514 } else {
1515 /* Assume good status */
1516 scmd->result = (DID_OK << 16);
1517 }
1518 scmd->scsi_done(scmd);
1519 return 0;
1520 case READ_6:
1521 if (ldev_info->state == MYRB_DEVICE_WO) {
1522 /* Data protect, attempt to read invalid data */
1523 scsi_build_sense_buffer(0, scmd->sense_buffer,
1524 DATA_PROTECT, 0x21, 0x06);
1525 scmd->result = (DRIVER_SENSE << 24) |
1526 SAM_STAT_CHECK_CONDITION;
1527 scmd->scsi_done(scmd);
1528 return 0;
1529 }
1530 case WRITE_6:
1531 lba = (((scmd->cmnd[1] & 0x1F) << 16) |
1532 (scmd->cmnd[2] << 8) |
1533 scmd->cmnd[3]);
1534 block_cnt = scmd->cmnd[4];
1535 break;
1536 case READ_10:
1537 if (ldev_info->state == MYRB_DEVICE_WO) {
1538 /* Data protect, attempt to read invalid data */
1539 scsi_build_sense_buffer(0, scmd->sense_buffer,
1540 DATA_PROTECT, 0x21, 0x06);
1541 scmd->result = (DRIVER_SENSE << 24) |
1542 SAM_STAT_CHECK_CONDITION;
1543 scmd->scsi_done(scmd);
1544 return 0;
1545 }
1546 case WRITE_10:
1547 case VERIFY: /* 0x2F */
1548 case WRITE_VERIFY: /* 0x2E */
1549 lba = get_unaligned_be32(&scmd->cmnd[2]);
1550 block_cnt = get_unaligned_be16(&scmd->cmnd[7]);
1551 break;
1552 case READ_12:
1553 if (ldev_info->state == MYRB_DEVICE_WO) {
1554 /* Data protect, attempt to read invalid data */
1555 scsi_build_sense_buffer(0, scmd->sense_buffer,
1556 DATA_PROTECT, 0x21, 0x06);
1557 scmd->result = (DRIVER_SENSE << 24) |
1558 SAM_STAT_CHECK_CONDITION;
1559 scmd->scsi_done(scmd);
1560 return 0;
1561 }
1562 case WRITE_12:
1563 case VERIFY_12: /* 0xAF */
1564 case WRITE_VERIFY_12: /* 0xAE */
1565 lba = get_unaligned_be32(&scmd->cmnd[2]);
1566 block_cnt = get_unaligned_be32(&scmd->cmnd[6]);
1567 break;
1568 default:
1569 /* Illegal request, invalid opcode */
1570 scsi_build_sense_buffer(0, scmd->sense_buffer,
1571 ILLEGAL_REQUEST, 0x20, 0);
1572 scmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
1573 scmd->scsi_done(scmd);
1574 return 0;
1575 }
1576
1577 myrb_reset_cmd(cmd_blk);
1578 mbox->type5.id = scmd->request->tag + 3;
1579 if (scmd->sc_data_direction == DMA_NONE)
1580 goto submit;
1581 nsge = scsi_dma_map(scmd);
1582 if (nsge == 1) {
1583 sgl = scsi_sglist(scmd);
1584 if (scmd->sc_data_direction == DMA_FROM_DEVICE)
1585 mbox->type5.opcode = MYRB_CMD_READ;
1586 else
1587 mbox->type5.opcode = MYRB_CMD_WRITE;
1588
1589 mbox->type5.ld.xfer_len = block_cnt;
1590 mbox->type5.ld.ldev_num = sdev->id;
1591 mbox->type5.lba = lba;
1592 mbox->type5.addr = (u32)sg_dma_address(sgl);
1593 } else {
1594 struct myrb_sge *hw_sgl;
1595 dma_addr_t hw_sgl_addr;
1596 int i;
1597
1598 hw_sgl = dma_pool_alloc(cb->sg_pool, GFP_ATOMIC, &hw_sgl_addr);
1599 if (!hw_sgl)
1600 return SCSI_MLQUEUE_HOST_BUSY;
1601
1602 cmd_blk->sgl = hw_sgl;
1603 cmd_blk->sgl_addr = hw_sgl_addr;
1604
1605 if (scmd->sc_data_direction == DMA_FROM_DEVICE)
1606 mbox->type5.opcode = MYRB_CMD_READ_SG;
1607 else
1608 mbox->type5.opcode = MYRB_CMD_WRITE_SG;
1609
1610 mbox->type5.ld.xfer_len = block_cnt;
1611 mbox->type5.ld.ldev_num = sdev->id;
1612 mbox->type5.lba = lba;
1613 mbox->type5.addr = hw_sgl_addr;
1614 mbox->type5.sg_count = nsge;
1615
1616 scsi_for_each_sg(scmd, sgl, nsge, i) {
1617 hw_sgl->sge_addr = (u32)sg_dma_address(sgl);
1618 hw_sgl->sge_count = (u32)sg_dma_len(sgl);
1619 hw_sgl++;
1620 }
1621 }
1622submit:
1623 spin_lock_irqsave(&cb->queue_lock, flags);
1624 cb->qcmd(cb, cmd_blk);
1625 spin_unlock_irqrestore(&cb->queue_lock, flags);
1626
1627 return 0;
1628}
1629
1630static int myrb_queuecommand(struct Scsi_Host *shost,
1631 struct scsi_cmnd *scmd)
1632{
1633 struct scsi_device *sdev = scmd->device;
1634
1635 if (sdev->channel > myrb_logical_channel(shost)) {
1636 scmd->result = (DID_BAD_TARGET << 16);
1637 scmd->scsi_done(scmd);
1638 return 0;
1639 }
1640 if (sdev->channel == myrb_logical_channel(shost))
1641 return myrb_ldev_queuecommand(shost, scmd);
1642
1643 return myrb_pthru_queuecommand(shost, scmd);
1644}
1645
1646static int myrb_ldev_slave_alloc(struct scsi_device *sdev)
1647{
1648 struct myrb_hba *cb = shost_priv(sdev->host);
1649 struct myrb_ldev_info *ldev_info;
1650 unsigned short ldev_num = sdev->id;
1651 enum raid_level level;
1652
1653 ldev_info = cb->ldev_info_buf + ldev_num;
1654 if (!ldev_info)
1655 return -ENXIO;
1656
1657 sdev->hostdata = kzalloc(sizeof(*ldev_info), GFP_KERNEL);
1658 if (!sdev->hostdata)
1659 return -ENOMEM;
1660 dev_dbg(&sdev->sdev_gendev,
1661 "slave alloc ldev %d state %x\n",
1662 ldev_num, ldev_info->state);
1663 memcpy(sdev->hostdata, ldev_info,
1664 sizeof(*ldev_info));
1665 switch (ldev_info->raid_level) {
1666 case MYRB_RAID_LEVEL0:
1667 level = RAID_LEVEL_LINEAR;
1668 break;
1669 case MYRB_RAID_LEVEL1:
1670 level = RAID_LEVEL_1;
1671 break;
1672 case MYRB_RAID_LEVEL3:
1673 level = RAID_LEVEL_3;
1674 break;
1675 case MYRB_RAID_LEVEL5:
1676 level = RAID_LEVEL_5;
1677 break;
1678 case MYRB_RAID_LEVEL6:
1679 level = RAID_LEVEL_6;
1680 break;
1681 case MYRB_RAID_JBOD:
1682 level = RAID_LEVEL_JBOD;
1683 break;
1684 default:
1685 level = RAID_LEVEL_UNKNOWN;
1686 break;
1687 }
1688 raid_set_level(myrb_raid_template, &sdev->sdev_gendev, level);
1689 return 0;
1690}
1691
1692static int myrb_pdev_slave_alloc(struct scsi_device *sdev)
1693{
1694 struct myrb_hba *cb = shost_priv(sdev->host);
1695 struct myrb_pdev_state *pdev_info;
1696 unsigned short status;
1697
1698 if (sdev->id > MYRB_MAX_TARGETS)
1699 return -ENXIO;
1700
1701 pdev_info = kzalloc(sizeof(*pdev_info), GFP_KERNEL|GFP_DMA);
1702 if (!pdev_info)
1703 return -ENOMEM;
1704
1705 status = myrb_exec_type3D(cb, MYRB_CMD_GET_DEVICE_STATE,
1706 sdev, pdev_info);
1707 if (status != MYRB_STATUS_SUCCESS) {
1708 dev_dbg(&sdev->sdev_gendev,
1709 "Failed to get device state, status %x\n",
1710 status);
1711 kfree(pdev_info);
1712 return -ENXIO;
1713 }
1714 if (!pdev_info->present) {
1715 dev_dbg(&sdev->sdev_gendev,
1716 "device not present, skip\n");
1717 kfree(pdev_info);
1718 return -ENXIO;
1719 }
1720 dev_dbg(&sdev->sdev_gendev,
1721 "slave alloc pdev %d:%d state %x\n",
1722 sdev->channel, sdev->id, pdev_info->state);
1723 sdev->hostdata = pdev_info;
1724
1725 return 0;
1726}
1727
1728static int myrb_slave_alloc(struct scsi_device *sdev)
1729{
1730 if (sdev->channel > myrb_logical_channel(sdev->host))
1731 return -ENXIO;
1732
1733 if (sdev->lun > 0)
1734 return -ENXIO;
1735
1736 if (sdev->channel == myrb_logical_channel(sdev->host))
1737 return myrb_ldev_slave_alloc(sdev);
1738
1739 return myrb_pdev_slave_alloc(sdev);
1740}
1741
1742static int myrb_slave_configure(struct scsi_device *sdev)
1743{
1744 struct myrb_ldev_info *ldev_info;
1745
1746 if (sdev->channel > myrb_logical_channel(sdev->host))
1747 return -ENXIO;
1748
1749 if (sdev->channel < myrb_logical_channel(sdev->host)) {
1750 sdev->no_uld_attach = 1;
1751 return 0;
1752 }
1753 if (sdev->lun != 0)
1754 return -ENXIO;
1755
1756 ldev_info = sdev->hostdata;
1757 if (!ldev_info)
1758 return -ENXIO;
1759 if (ldev_info->state != MYRB_DEVICE_ONLINE)
1760 sdev_printk(KERN_INFO, sdev,
1761 "Logical drive is %s\n",
1762 myrb_devstate_name(ldev_info->state));
1763
1764 sdev->tagged_supported = 1;
1765 return 0;
1766}
1767
1768static void myrb_slave_destroy(struct scsi_device *sdev)
1769{
1770 kfree(sdev->hostdata);
1771}
1772
1773static int myrb_biosparam(struct scsi_device *sdev, struct block_device *bdev,
1774 sector_t capacity, int geom[])
1775{
1776 struct myrb_hba *cb = shost_priv(sdev->host);
1777
1778 geom[0] = cb->ldev_geom_heads;
1779 geom[1] = cb->ldev_geom_sectors;
1780 geom[2] = sector_div(capacity, geom[0] * geom[1]);
1781
1782 return 0;
1783}
1784
1785static ssize_t raid_state_show(struct device *dev,
1786 struct device_attribute *attr, char *buf)
1787{
1788 struct scsi_device *sdev = to_scsi_device(dev);
1789 struct myrb_hba *cb = shost_priv(sdev->host);
1790 int ret;
1791
1792 if (!sdev->hostdata)
1793 return snprintf(buf, 16, "Unknown\n");
1794
1795 if (sdev->channel == myrb_logical_channel(sdev->host)) {
1796 struct myrb_ldev_info *ldev_info = sdev->hostdata;
1797 const char *name;
1798
1799 name = myrb_devstate_name(ldev_info->state);
1800 if (name)
1801 ret = snprintf(buf, 32, "%s\n", name);
1802 else
1803 ret = snprintf(buf, 32, "Invalid (%02X)\n",
1804 ldev_info->state);
1805 } else {
1806 struct myrb_pdev_state *pdev_info = sdev->hostdata;
1807 unsigned short status;
1808 const char *name;
1809
1810 status = myrb_exec_type3D(cb, MYRB_CMD_GET_DEVICE_STATE,
1811 sdev, pdev_info);
1812 if (status != MYRB_STATUS_SUCCESS)
1813 sdev_printk(KERN_INFO, sdev,
1814 "Failed to get device state, status %x\n",
1815 status);
1816
1817 if (!pdev_info->present)
1818 name = "Removed";
1819 else
1820 name = myrb_devstate_name(pdev_info->state);
1821 if (name)
1822 ret = snprintf(buf, 32, "%s\n", name);
1823 else
1824 ret = snprintf(buf, 32, "Invalid (%02X)\n",
1825 pdev_info->state);
1826 }
1827 return ret;
1828}
1829
1830static ssize_t raid_state_store(struct device *dev,
1831 struct device_attribute *attr, const char *buf, size_t count)
1832{
1833 struct scsi_device *sdev = to_scsi_device(dev);
1834 struct myrb_hba *cb = shost_priv(sdev->host);
1835 struct myrb_pdev_state *pdev_info;
1836 enum myrb_devstate new_state;
1837 unsigned short status;
1838
1839 if (!strncmp(buf, "kill", 4) ||
1840 !strncmp(buf, "offline", 7))
1841 new_state = MYRB_DEVICE_DEAD;
1842 else if (!strncmp(buf, "online", 6))
1843 new_state = MYRB_DEVICE_ONLINE;
1844 else if (!strncmp(buf, "standby", 7))
1845 new_state = MYRB_DEVICE_STANDBY;
1846 else
1847 return -EINVAL;
1848
1849 pdev_info = sdev->hostdata;
1850 if (!pdev_info) {
1851 sdev_printk(KERN_INFO, sdev,
1852 "Failed - no physical device information\n");
1853 return -ENXIO;
1854 }
1855 if (!pdev_info->present) {
1856 sdev_printk(KERN_INFO, sdev,
1857 "Failed - device not present\n");
1858 return -ENXIO;
1859 }
1860
1861 if (pdev_info->state == new_state)
1862 return count;
1863
1864 status = myrb_set_pdev_state(cb, sdev, new_state);
1865 switch (status) {
1866 case MYRB_STATUS_SUCCESS:
1867 break;
1868 case MYRB_STATUS_START_DEVICE_FAILED:
1869 sdev_printk(KERN_INFO, sdev,
1870 "Failed - Unable to Start Device\n");
1871 count = -EAGAIN;
1872 break;
1873 case MYRB_STATUS_NO_DEVICE:
1874 sdev_printk(KERN_INFO, sdev,
1875 "Failed - No Device at Address\n");
1876 count = -ENODEV;
1877 break;
1878 case MYRB_STATUS_INVALID_CHANNEL_OR_TARGET:
1879 sdev_printk(KERN_INFO, sdev,
1880 "Failed - Invalid Channel or Target or Modifier\n");
1881 count = -EINVAL;
1882 break;
1883 case MYRB_STATUS_CHANNEL_BUSY:
1884 sdev_printk(KERN_INFO, sdev,
1885 "Failed - Channel Busy\n");
1886 count = -EBUSY;
1887 break;
1888 default:
1889 sdev_printk(KERN_INFO, sdev,
1890 "Failed - Unexpected Status %04X\n", status);
1891 count = -EIO;
1892 break;
1893 }
1894 return count;
1895}
1896static DEVICE_ATTR_RW(raid_state);
1897
1898static ssize_t raid_level_show(struct device *dev,
1899 struct device_attribute *attr, char *buf)
1900{
1901 struct scsi_device *sdev = to_scsi_device(dev);
1902
1903 if (sdev->channel == myrb_logical_channel(sdev->host)) {
1904 struct myrb_ldev_info *ldev_info = sdev->hostdata;
1905 const char *name;
1906
1907 if (!ldev_info)
1908 return -ENXIO;
1909
1910 name = myrb_raidlevel_name(ldev_info->raid_level);
1911 if (!name)
1912 return snprintf(buf, 32, "Invalid (%02X)\n",
1913 ldev_info->state);
1914 return snprintf(buf, 32, "%s\n", name);
1915 }
1916 return snprintf(buf, 32, "Physical Drive\n");
1917}
1918static DEVICE_ATTR_RO(raid_level);
1919
1920static ssize_t rebuild_show(struct device *dev,
1921 struct device_attribute *attr, char *buf)
1922{
1923 struct scsi_device *sdev = to_scsi_device(dev);
1924 struct myrb_hba *cb = shost_priv(sdev->host);
1925 struct myrb_rbld_progress rbld_buf;
1926 unsigned char status;
1927
1928 if (sdev->channel < myrb_logical_channel(sdev->host))
1929 return snprintf(buf, 32, "physical device - not rebuilding\n");
1930
1931 status = myrb_get_rbld_progress(cb, &rbld_buf);
1932
1933 if (rbld_buf.ldev_num != sdev->id ||
1934 status != MYRB_STATUS_SUCCESS)
1935 return snprintf(buf, 32, "not rebuilding\n");
1936
1937 return snprintf(buf, 32, "rebuilding block %u of %u\n",
1938 rbld_buf.ldev_size - rbld_buf.blocks_left,
1939 rbld_buf.ldev_size);
1940}
1941
1942static ssize_t rebuild_store(struct device *dev,
1943 struct device_attribute *attr, const char *buf, size_t count)
1944{
1945 struct scsi_device *sdev = to_scsi_device(dev);
1946 struct myrb_hba *cb = shost_priv(sdev->host);
1947 struct myrb_cmdblk *cmd_blk;
1948 union myrb_cmd_mbox *mbox;
1949 unsigned short status;
1950 int rc, start;
1951 const char *msg;
1952
1953 rc = kstrtoint(buf, 0, &start);
1954 if (rc)
1955 return rc;
1956
1957 if (sdev->channel >= myrb_logical_channel(sdev->host))
1958 return -ENXIO;
1959
1960 status = myrb_get_rbld_progress(cb, NULL);
1961 if (start) {
1962 if (status == MYRB_STATUS_SUCCESS) {
1963 sdev_printk(KERN_INFO, sdev,
1964 "Rebuild Not Initiated; already in progress\n");
1965 return -EALREADY;
1966 }
1967 mutex_lock(&cb->dcmd_mutex);
1968 cmd_blk = &cb->dcmd_blk;
1969 myrb_reset_cmd(cmd_blk);
1970 mbox = &cmd_blk->mbox;
1971 mbox->type3D.opcode = MYRB_CMD_REBUILD_ASYNC;
1972 mbox->type3D.id = MYRB_DCMD_TAG;
1973 mbox->type3D.channel = sdev->channel;
1974 mbox->type3D.target = sdev->id;
1975 status = myrb_exec_cmd(cb, cmd_blk);
1976 mutex_unlock(&cb->dcmd_mutex);
1977 } else {
1978 struct pci_dev *pdev = cb->pdev;
1979 unsigned char *rate;
1980 dma_addr_t rate_addr;
1981
1982 if (status != MYRB_STATUS_SUCCESS) {
1983 sdev_printk(KERN_INFO, sdev,
1984 "Rebuild Not Cancelled; not in progress\n");
1985 return 0;
1986 }
1987
1988 rate = dma_alloc_coherent(&pdev->dev, sizeof(char),
1989 &rate_addr, GFP_KERNEL);
1990 if (rate == NULL) {
1991 sdev_printk(KERN_INFO, sdev,
1992 "Cancellation of Rebuild Failed - Out of Memory\n");
1993 return -ENOMEM;
1994 }
1995 mutex_lock(&cb->dcmd_mutex);
1996 cmd_blk = &cb->dcmd_blk;
1997 myrb_reset_cmd(cmd_blk);
1998 mbox = &cmd_blk->mbox;
1999 mbox->type3R.opcode = MYRB_CMD_REBUILD_CONTROL;
2000 mbox->type3R.id = MYRB_DCMD_TAG;
2001 mbox->type3R.rbld_rate = 0xFF;
2002 mbox->type3R.addr = rate_addr;
2003 status = myrb_exec_cmd(cb, cmd_blk);
2004 dma_free_coherent(&pdev->dev, sizeof(char), rate, rate_addr);
2005 mutex_unlock(&cb->dcmd_mutex);
2006 }
2007 if (status == MYRB_STATUS_SUCCESS) {
2008 sdev_printk(KERN_INFO, sdev, "Rebuild %s\n",
2009 start ? "Initiated" : "Cancelled");
2010 return count;
2011 }
2012 if (!start) {
2013 sdev_printk(KERN_INFO, sdev,
2014 "Rebuild Not Cancelled, status 0x%x\n",
2015 status);
2016 return -EIO;
2017 }
2018
2019 switch (status) {
2020 case MYRB_STATUS_ATTEMPT_TO_RBLD_ONLINE_DRIVE:
2021 msg = "Attempt to Rebuild Online or Unresponsive Drive";
2022 break;
2023 case MYRB_STATUS_RBLD_NEW_DISK_FAILED:
2024 msg = "New Disk Failed During Rebuild";
2025 break;
2026 case MYRB_STATUS_INVALID_ADDRESS:
2027 msg = "Invalid Device Address";
2028 break;
2029 case MYRB_STATUS_RBLD_OR_CHECK_INPROGRESS:
2030 msg = "Already in Progress";
2031 break;
2032 default:
2033 msg = NULL;
2034 break;
2035 }
2036 if (msg)
2037 sdev_printk(KERN_INFO, sdev,
2038 "Rebuild Failed - %s\n", msg);
2039 else
2040 sdev_printk(KERN_INFO, sdev,
2041 "Rebuild Failed, status 0x%x\n", status);
2042
2043 return -EIO;
2044}
2045static DEVICE_ATTR_RW(rebuild);
2046
2047static ssize_t consistency_check_store(struct device *dev,
2048 struct device_attribute *attr, const char *buf, size_t count)
2049{
2050 struct scsi_device *sdev = to_scsi_device(dev);
2051 struct myrb_hba *cb = shost_priv(sdev->host);
2052 struct myrb_rbld_progress rbld_buf;
2053 struct myrb_cmdblk *cmd_blk;
2054 union myrb_cmd_mbox *mbox;
2055 unsigned short ldev_num = 0xFFFF;
2056 unsigned short status;
2057 int rc, start;
2058 const char *msg;
2059
2060 rc = kstrtoint(buf, 0, &start);
2061 if (rc)
2062 return rc;
2063
2064 if (sdev->channel < myrb_logical_channel(sdev->host))
2065 return -ENXIO;
2066
2067 status = myrb_get_rbld_progress(cb, &rbld_buf);
2068 if (start) {
2069 if (status == MYRB_STATUS_SUCCESS) {
2070 sdev_printk(KERN_INFO, sdev,
2071 "Check Consistency Not Initiated; already in progress\n");
2072 return -EALREADY;
2073 }
2074 mutex_lock(&cb->dcmd_mutex);
2075 cmd_blk = &cb->dcmd_blk;
2076 myrb_reset_cmd(cmd_blk);
2077 mbox = &cmd_blk->mbox;
2078 mbox->type3C.opcode = MYRB_CMD_CHECK_CONSISTENCY_ASYNC;
2079 mbox->type3C.id = MYRB_DCMD_TAG;
2080 mbox->type3C.ldev_num = sdev->id;
2081 mbox->type3C.auto_restore = true;
2082
2083 status = myrb_exec_cmd(cb, cmd_blk);
2084 mutex_unlock(&cb->dcmd_mutex);
2085 } else {
2086 struct pci_dev *pdev = cb->pdev;
2087 unsigned char *rate;
2088 dma_addr_t rate_addr;
2089
2090 if (ldev_num != sdev->id) {
2091 sdev_printk(KERN_INFO, sdev,
2092 "Check Consistency Not Cancelled; not in progress\n");
2093 return 0;
2094 }
2095 rate = dma_alloc_coherent(&pdev->dev, sizeof(char),
2096 &rate_addr, GFP_KERNEL);
2097 if (rate == NULL) {
2098 sdev_printk(KERN_INFO, sdev,
2099 "Cancellation of Check Consistency Failed - Out of Memory\n");
2100 return -ENOMEM;
2101 }
2102 mutex_lock(&cb->dcmd_mutex);
2103 cmd_blk = &cb->dcmd_blk;
2104 myrb_reset_cmd(cmd_blk);
2105 mbox = &cmd_blk->mbox;
2106 mbox->type3R.opcode = MYRB_CMD_REBUILD_CONTROL;
2107 mbox->type3R.id = MYRB_DCMD_TAG;
2108 mbox->type3R.rbld_rate = 0xFF;
2109 mbox->type3R.addr = rate_addr;
2110 status = myrb_exec_cmd(cb, cmd_blk);
2111 dma_free_coherent(&pdev->dev, sizeof(char), rate, rate_addr);
2112 mutex_unlock(&cb->dcmd_mutex);
2113 }
2114 if (status == MYRB_STATUS_SUCCESS) {
2115 sdev_printk(KERN_INFO, sdev, "Check Consistency %s\n",
2116 start ? "Initiated" : "Cancelled");
2117 return count;
2118 }
2119 if (!start) {
2120 sdev_printk(KERN_INFO, sdev,
2121 "Check Consistency Not Cancelled, status 0x%x\n",
2122 status);
2123 return -EIO;
2124 }
2125
2126 switch (status) {
2127 case MYRB_STATUS_ATTEMPT_TO_RBLD_ONLINE_DRIVE:
2128 msg = "Dependent Physical Device is DEAD";
2129 break;
2130 case MYRB_STATUS_RBLD_NEW_DISK_FAILED:
2131 msg = "New Disk Failed During Rebuild";
2132 break;
2133 case MYRB_STATUS_INVALID_ADDRESS:
2134 msg = "Invalid or Nonredundant Logical Drive";
2135 break;
2136 case MYRB_STATUS_RBLD_OR_CHECK_INPROGRESS:
2137 msg = "Already in Progress";
2138 break;
2139 default:
2140 msg = NULL;
2141 break;
2142 }
2143 if (msg)
2144 sdev_printk(KERN_INFO, sdev,
2145 "Check Consistency Failed - %s\n", msg);
2146 else
2147 sdev_printk(KERN_INFO, sdev,
2148 "Check Consistency Failed, status 0x%x\n", status);
2149
2150 return -EIO;
2151}
2152
2153static ssize_t consistency_check_show(struct device *dev,
2154 struct device_attribute *attr, char *buf)
2155{
2156 return rebuild_show(dev, attr, buf);
2157}
2158static DEVICE_ATTR_RW(consistency_check);
2159
2160static ssize_t ctlr_num_show(struct device *dev,
2161 struct device_attribute *attr, char *buf)
2162{
2163 struct Scsi_Host *shost = class_to_shost(dev);
2164 struct myrb_hba *cb = shost_priv(shost);
2165
2166 return snprintf(buf, 20, "%d\n", cb->ctlr_num);
2167}
2168static DEVICE_ATTR_RO(ctlr_num);
2169
2170static ssize_t firmware_show(struct device *dev,
2171 struct device_attribute *attr, char *buf)
2172{
2173 struct Scsi_Host *shost = class_to_shost(dev);
2174 struct myrb_hba *cb = shost_priv(shost);
2175
2176 return snprintf(buf, 16, "%s\n", cb->fw_version);
2177}
2178static DEVICE_ATTR_RO(firmware);
2179
2180static ssize_t model_show(struct device *dev,
2181 struct device_attribute *attr, char *buf)
2182{
2183 struct Scsi_Host *shost = class_to_shost(dev);
2184 struct myrb_hba *cb = shost_priv(shost);
2185
2186 return snprintf(buf, 16, "%s\n", cb->model_name);
2187}
2188static DEVICE_ATTR_RO(model);
2189
2190static ssize_t flush_cache_store(struct device *dev,
2191 struct device_attribute *attr, const char *buf, size_t count)
2192{
2193 struct Scsi_Host *shost = class_to_shost(dev);
2194 struct myrb_hba *cb = shost_priv(shost);
2195 unsigned short status;
2196
2197 status = myrb_exec_type3(cb, MYRB_CMD_FLUSH, 0);
2198 if (status == MYRB_STATUS_SUCCESS) {
2199 shost_printk(KERN_INFO, shost,
2200 "Cache Flush Completed\n");
2201 return count;
2202 }
2203 shost_printk(KERN_INFO, shost,
2204 "Cache Flush Failed, status %x\n", status);
2205 return -EIO;
2206}
2207static DEVICE_ATTR_WO(flush_cache);
2208
2209static struct device_attribute *myrb_sdev_attrs[] = {
2210 &dev_attr_rebuild,
2211 &dev_attr_consistency_check,
2212 &dev_attr_raid_state,
2213 &dev_attr_raid_level,
2214 NULL,
2215};
2216
2217static struct device_attribute *myrb_shost_attrs[] = {
2218 &dev_attr_ctlr_num,
2219 &dev_attr_model,
2220 &dev_attr_firmware,
2221 &dev_attr_flush_cache,
2222 NULL,
2223};
2224
2225struct scsi_host_template myrb_template = {
2226 .module = THIS_MODULE,
2227 .name = "DAC960",
2228 .proc_name = "myrb",
2229 .queuecommand = myrb_queuecommand,
2230 .eh_host_reset_handler = myrb_host_reset,
2231 .slave_alloc = myrb_slave_alloc,
2232 .slave_configure = myrb_slave_configure,
2233 .slave_destroy = myrb_slave_destroy,
2234 .bios_param = myrb_biosparam,
2235 .cmd_size = sizeof(struct myrb_cmdblk),
2236 .shost_attrs = myrb_shost_attrs,
2237 .sdev_attrs = myrb_sdev_attrs,
2238 .this_id = -1,
2239};
2240
2241/**
2242 * myrb_is_raid - return boolean indicating device is raid volume
2243 * @dev the device struct object
2244 */
2245static int myrb_is_raid(struct device *dev)
2246{
2247 struct scsi_device *sdev = to_scsi_device(dev);
2248
2249 return sdev->channel == myrb_logical_channel(sdev->host);
2250}
2251
2252/**
2253 * myrb_get_resync - get raid volume resync percent complete
2254 * @dev the device struct object
2255 */
2256static void myrb_get_resync(struct device *dev)
2257{
2258 struct scsi_device *sdev = to_scsi_device(dev);
2259 struct myrb_hba *cb = shost_priv(sdev->host);
2260 struct myrb_rbld_progress rbld_buf;
2261 unsigned int percent_complete = 0;
2262 unsigned short status;
2263 unsigned int ldev_size = 0, remaining = 0;
2264
2265 if (sdev->channel < myrb_logical_channel(sdev->host))
2266 return;
2267 status = myrb_get_rbld_progress(cb, &rbld_buf);
2268 if (status == MYRB_STATUS_SUCCESS) {
2269 if (rbld_buf.ldev_num == sdev->id) {
2270 ldev_size = rbld_buf.ldev_size;
2271 remaining = rbld_buf.blocks_left;
2272 }
2273 }
2274 if (remaining && ldev_size)
2275 percent_complete = (ldev_size - remaining) * 100 / ldev_size;
2276 raid_set_resync(myrb_raid_template, dev, percent_complete);
2277}
2278
2279/**
2280 * myrb_get_state - get raid volume status
2281 * @dev the device struct object
2282 */
2283static void myrb_get_state(struct device *dev)
2284{
2285 struct scsi_device *sdev = to_scsi_device(dev);
2286 struct myrb_hba *cb = shost_priv(sdev->host);
2287 struct myrb_ldev_info *ldev_info = sdev->hostdata;
2288 enum raid_state state = RAID_STATE_UNKNOWN;
2289 unsigned short status;
2290
2291 if (sdev->channel < myrb_logical_channel(sdev->host) || !ldev_info)
2292 state = RAID_STATE_UNKNOWN;
2293 else {
2294 status = myrb_get_rbld_progress(cb, NULL);
2295 if (status == MYRB_STATUS_SUCCESS)
2296 state = RAID_STATE_RESYNCING;
2297 else {
2298 switch (ldev_info->state) {
2299 case MYRB_DEVICE_ONLINE:
2300 state = RAID_STATE_ACTIVE;
2301 break;
2302 case MYRB_DEVICE_WO:
2303 case MYRB_DEVICE_CRITICAL:
2304 state = RAID_STATE_DEGRADED;
2305 break;
2306 default:
2307 state = RAID_STATE_OFFLINE;
2308 }
2309 }
2310 }
2311 raid_set_state(myrb_raid_template, dev, state);
2312}
2313
2314struct raid_function_template myrb_raid_functions = {
2315 .cookie = &myrb_template,
2316 .is_raid = myrb_is_raid,
2317 .get_resync = myrb_get_resync,
2318 .get_state = myrb_get_state,
2319};
2320
2321static void myrb_handle_scsi(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk,
2322 struct scsi_cmnd *scmd)
2323{
2324 unsigned short status;
2325
2326 if (!cmd_blk)
2327 return;
2328
2329 scsi_dma_unmap(scmd);
2330
2331 if (cmd_blk->dcdb) {
2332 memcpy(scmd->sense_buffer, &cmd_blk->dcdb->sense, 64);
2333 dma_pool_free(cb->dcdb_pool, cmd_blk->dcdb,
2334 cmd_blk->dcdb_addr);
2335 cmd_blk->dcdb = NULL;
2336 }
2337 if (cmd_blk->sgl) {
2338 dma_pool_free(cb->sg_pool, cmd_blk->sgl, cmd_blk->sgl_addr);
2339 cmd_blk->sgl = NULL;
2340 cmd_blk->sgl_addr = 0;
2341 }
2342 status = cmd_blk->status;
2343 switch (status) {
2344 case MYRB_STATUS_SUCCESS:
2345 case MYRB_STATUS_DEVICE_BUSY:
2346 scmd->result = (DID_OK << 16) | status;
2347 break;
2348 case MYRB_STATUS_BAD_DATA:
2349 dev_dbg(&scmd->device->sdev_gendev,
2350 "Bad Data Encountered\n");
2351 if (scmd->sc_data_direction == DMA_FROM_DEVICE)
2352 /* Unrecovered read error */
2353 scsi_build_sense_buffer(0, scmd->sense_buffer,
2354 MEDIUM_ERROR, 0x11, 0);
2355 else
2356 /* Write error */
2357 scsi_build_sense_buffer(0, scmd->sense_buffer,
2358 MEDIUM_ERROR, 0x0C, 0);
2359 scmd->result = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION;
2360 break;
2361 case MYRB_STATUS_IRRECOVERABLE_DATA_ERROR:
2362 scmd_printk(KERN_ERR, scmd, "Irrecoverable Data Error\n");
2363 if (scmd->sc_data_direction == DMA_FROM_DEVICE)
2364 /* Unrecovered read error, auto-reallocation failed */
2365 scsi_build_sense_buffer(0, scmd->sense_buffer,
2366 MEDIUM_ERROR, 0x11, 0x04);
2367 else
2368 /* Write error, auto-reallocation failed */
2369 scsi_build_sense_buffer(0, scmd->sense_buffer,
2370 MEDIUM_ERROR, 0x0C, 0x02);
2371 scmd->result = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION;
2372 break;
2373 case MYRB_STATUS_LDRV_NONEXISTENT_OR_OFFLINE:
2374 dev_dbg(&scmd->device->sdev_gendev,
2375 "Logical Drive Nonexistent or Offline");
2376 scmd->result = (DID_BAD_TARGET << 16);
2377 break;
2378 case MYRB_STATUS_ACCESS_BEYOND_END_OF_LDRV:
2379 dev_dbg(&scmd->device->sdev_gendev,
2380 "Attempt to Access Beyond End of Logical Drive");
2381 /* Logical block address out of range */
2382 scsi_build_sense_buffer(0, scmd->sense_buffer,
2383 NOT_READY, 0x21, 0);
2384 break;
2385 case MYRB_STATUS_DEVICE_NONRESPONSIVE:
2386 dev_dbg(&scmd->device->sdev_gendev, "Device nonresponsive\n");
2387 scmd->result = (DID_BAD_TARGET << 16);
2388 break;
2389 default:
2390 scmd_printk(KERN_ERR, scmd,
2391 "Unexpected Error Status %04X", status);
2392 scmd->result = (DID_ERROR << 16);
2393 break;
2394 }
2395 scmd->scsi_done(scmd);
2396}
2397
2398static void myrb_handle_cmdblk(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk)
2399{
2400 if (!cmd_blk)
2401 return;
2402
2403 if (cmd_blk->completion) {
2404 complete(cmd_blk->completion);
2405 cmd_blk->completion = NULL;
2406 }
2407}
2408
2409static void myrb_monitor(struct work_struct *work)
2410{
2411 struct myrb_hba *cb = container_of(work,
2412 struct myrb_hba, monitor_work.work);
2413 struct Scsi_Host *shost = cb->host;
2414 unsigned long interval = MYRB_PRIMARY_MONITOR_INTERVAL;
2415
2416 dev_dbg(&shost->shost_gendev, "monitor tick\n");
2417
2418 if (cb->new_ev_seq > cb->old_ev_seq) {
2419 int event = cb->old_ev_seq;
2420
2421 dev_dbg(&shost->shost_gendev,
2422 "get event log no %d/%d\n",
2423 cb->new_ev_seq, event);
2424 myrb_get_event(cb, event);
2425 cb->old_ev_seq = event + 1;
2426 interval = 10;
2427 } else if (cb->need_err_info) {
2428 cb->need_err_info = false;
2429 dev_dbg(&shost->shost_gendev, "get error table\n");
2430 myrb_get_errtable(cb);
2431 interval = 10;
2432 } else if (cb->need_rbld && cb->rbld_first) {
2433 cb->need_rbld = false;
2434 dev_dbg(&shost->shost_gendev,
2435 "get rebuild progress\n");
2436 myrb_update_rbld_progress(cb);
2437 interval = 10;
2438 } else if (cb->need_ldev_info) {
2439 cb->need_ldev_info = false;
2440 dev_dbg(&shost->shost_gendev,
2441 "get logical drive info\n");
2442 myrb_get_ldev_info(cb);
2443 interval = 10;
2444 } else if (cb->need_rbld) {
2445 cb->need_rbld = false;
2446 dev_dbg(&shost->shost_gendev,
2447 "get rebuild progress\n");
2448 myrb_update_rbld_progress(cb);
2449 interval = 10;
2450 } else if (cb->need_cc_status) {
2451 cb->need_cc_status = false;
2452 dev_dbg(&shost->shost_gendev,
2453 "get consistency check progress\n");
2454 myrb_get_cc_progress(cb);
2455 interval = 10;
2456 } else if (cb->need_bgi_status) {
2457 cb->need_bgi_status = false;
2458 dev_dbg(&shost->shost_gendev, "get background init status\n");
2459 myrb_bgi_control(cb);
2460 interval = 10;
2461 } else {
2462 dev_dbg(&shost->shost_gendev, "new enquiry\n");
2463 mutex_lock(&cb->dma_mutex);
2464 myrb_hba_enquiry(cb);
2465 mutex_unlock(&cb->dma_mutex);
2466 if ((cb->new_ev_seq - cb->old_ev_seq > 0) ||
2467 cb->need_err_info || cb->need_rbld ||
2468 cb->need_ldev_info || cb->need_cc_status ||
2469 cb->need_bgi_status) {
2470 dev_dbg(&shost->shost_gendev,
2471 "reschedule monitor\n");
2472 interval = 0;
2473 }
2474 }
2475 if (interval > 1)
2476 cb->primary_monitor_time = jiffies;
2477 queue_delayed_work(cb->work_q, &cb->monitor_work, interval);
2478}
2479
2480/**
2481 * myrb_err_status - reports controller BIOS messages
2482 *
2483 * Controller BIOS messages are passed through the Error Status Register
2484 * when the driver performs the BIOS handshaking.
2485 *
2486 * Return: true for fatal errors and false otherwise.
2487 */
2488bool myrb_err_status(struct myrb_hba *cb, unsigned char error,
2489 unsigned char parm0, unsigned char parm1)
2490{
2491 struct pci_dev *pdev = cb->pdev;
2492
2493 switch (error) {
2494 case 0x00:
2495 dev_info(&pdev->dev,
2496 "Physical Device %d:%d Not Responding\n",
2497 parm1, parm0);
2498 break;
2499 case 0x08:
2500 dev_notice(&pdev->dev, "Spinning Up Drives\n");
2501 break;
2502 case 0x30:
2503 dev_notice(&pdev->dev, "Configuration Checksum Error\n");
2504 break;
2505 case 0x60:
2506 dev_notice(&pdev->dev, "Mirror Race Recovery Failed\n");
2507 break;
2508 case 0x70:
2509 dev_notice(&pdev->dev, "Mirror Race Recovery In Progress\n");
2510 break;
2511 case 0x90:
2512 dev_notice(&pdev->dev, "Physical Device %d:%d COD Mismatch\n",
2513 parm1, parm0);
2514 break;
2515 case 0xA0:
2516 dev_notice(&pdev->dev, "Logical Drive Installation Aborted\n");
2517 break;
2518 case 0xB0:
2519 dev_notice(&pdev->dev, "Mirror Race On A Critical Logical Drive\n");
2520 break;
2521 case 0xD0:
2522 dev_notice(&pdev->dev, "New Controller Configuration Found\n");
2523 break;
2524 case 0xF0:
2525 dev_err(&pdev->dev, "Fatal Memory Parity Error\n");
2526 return true;
2527 default:
2528 dev_err(&pdev->dev, "Unknown Initialization Error %02X\n",
2529 error);
2530 return true;
2531 }
2532 return false;
2533}
2534
2535/*
2536 * Hardware-specific functions
2537 */
2538
2539/*
2540 * DAC960 LA Series Controllers
2541 */
2542
2543static inline void DAC960_LA_hw_mbox_new_cmd(void __iomem *base)
2544{
2545 writeb(DAC960_LA_IDB_HWMBOX_NEW_CMD, base + DAC960_LA_IDB_OFFSET);
2546}
2547
2548static inline void DAC960_LA_ack_hw_mbox_status(void __iomem *base)
2549{
2550 writeb(DAC960_LA_IDB_HWMBOX_ACK_STS, base + DAC960_LA_IDB_OFFSET);
2551}
2552
2553static inline void DAC960_LA_gen_intr(void __iomem *base)
2554{
2555 writeb(DAC960_LA_IDB_GEN_IRQ, base + DAC960_LA_IDB_OFFSET);
2556}
2557
2558static inline void DAC960_LA_reset_ctrl(void __iomem *base)
2559{
2560 writeb(DAC960_LA_IDB_CTRL_RESET, base + DAC960_LA_IDB_OFFSET);
2561}
2562
2563static inline void DAC960_LA_mem_mbox_new_cmd(void __iomem *base)
2564{
2565 writeb(DAC960_LA_IDB_MMBOX_NEW_CMD, base + DAC960_LA_IDB_OFFSET);
2566}
2567
2568static inline bool DAC960_LA_hw_mbox_is_full(void __iomem *base)
2569{
2570 unsigned char idb = readb(base + DAC960_LA_IDB_OFFSET);
2571
2572 return !(idb & DAC960_LA_IDB_HWMBOX_EMPTY);
2573}
2574
2575static inline bool DAC960_LA_init_in_progress(void __iomem *base)
2576{
2577 unsigned char idb = readb(base + DAC960_LA_IDB_OFFSET);
2578
2579 return !(idb & DAC960_LA_IDB_INIT_DONE);
2580}
2581
2582static inline void DAC960_LA_ack_hw_mbox_intr(void __iomem *base)
2583{
2584 writeb(DAC960_LA_ODB_HWMBOX_ACK_IRQ, base + DAC960_LA_ODB_OFFSET);
2585}
2586
2587static inline void DAC960_LA_ack_mem_mbox_intr(void __iomem *base)
2588{
2589 writeb(DAC960_LA_ODB_MMBOX_ACK_IRQ, base + DAC960_LA_ODB_OFFSET);
2590}
2591
2592static inline void DAC960_LA_ack_intr(void __iomem *base)
2593{
2594 writeb(DAC960_LA_ODB_HWMBOX_ACK_IRQ | DAC960_LA_ODB_MMBOX_ACK_IRQ,
2595 base + DAC960_LA_ODB_OFFSET);
2596}
2597
2598static inline bool DAC960_LA_hw_mbox_status_available(void __iomem *base)
2599{
2600 unsigned char odb = readb(base + DAC960_LA_ODB_OFFSET);
2601
2602 return odb & DAC960_LA_ODB_HWMBOX_STS_AVAIL;
2603}
2604
2605static inline bool DAC960_LA_mem_mbox_status_available(void __iomem *base)
2606{
2607 unsigned char odb = readb(base + DAC960_LA_ODB_OFFSET);
2608
2609 return odb & DAC960_LA_ODB_MMBOX_STS_AVAIL;
2610}
2611
2612static inline void DAC960_LA_enable_intr(void __iomem *base)
2613{
2614 unsigned char odb = 0xFF;
2615
2616 odb &= ~DAC960_LA_IRQMASK_DISABLE_IRQ;
2617 writeb(odb, base + DAC960_LA_IRQMASK_OFFSET);
2618}
2619
2620static inline void DAC960_LA_disable_intr(void __iomem *base)
2621{
2622 unsigned char odb = 0xFF;
2623
2624 odb |= DAC960_LA_IRQMASK_DISABLE_IRQ;
2625 writeb(odb, base + DAC960_LA_IRQMASK_OFFSET);
2626}
2627
2628static inline bool DAC960_LA_intr_enabled(void __iomem *base)
2629{
2630 unsigned char imask = readb(base + DAC960_LA_IRQMASK_OFFSET);
2631
2632 return !(imask & DAC960_LA_IRQMASK_DISABLE_IRQ);
2633}
2634
2635static inline void DAC960_LA_write_cmd_mbox(union myrb_cmd_mbox *mem_mbox,
2636 union myrb_cmd_mbox *mbox)
2637{
2638 mem_mbox->words[1] = mbox->words[1];
2639 mem_mbox->words[2] = mbox->words[2];
2640 mem_mbox->words[3] = mbox->words[3];
2641 /* Memory barrier to prevent reordering */
2642 wmb();
2643 mem_mbox->words[0] = mbox->words[0];
2644 /* Memory barrier to force PCI access */
2645 mb();
2646}
2647
2648static inline void DAC960_LA_write_hw_mbox(void __iomem *base,
2649 union myrb_cmd_mbox *mbox)
2650{
2651 writel(mbox->words[0], base + DAC960_LA_CMDOP_OFFSET);
2652 writel(mbox->words[1], base + DAC960_LA_MBOX4_OFFSET);
2653 writel(mbox->words[2], base + DAC960_LA_MBOX8_OFFSET);
2654 writeb(mbox->bytes[12], base + DAC960_LA_MBOX12_OFFSET);
2655}
2656
2657static inline unsigned char DAC960_LA_read_status_cmd_ident(void __iomem *base)
2658{
2659 return readb(base + DAC960_LA_STSID_OFFSET);
2660}
2661
2662static inline unsigned short DAC960_LA_read_status(void __iomem *base)
2663{
2664 return readw(base + DAC960_LA_STS_OFFSET);
2665}
2666
2667static inline bool
2668DAC960_LA_read_error_status(void __iomem *base, unsigned char *error,
2669 unsigned char *param0, unsigned char *param1)
2670{
2671 unsigned char errsts = readb(base + DAC960_LA_ERRSTS_OFFSET);
2672
2673 if (!(errsts & DAC960_LA_ERRSTS_PENDING))
2674 return false;
2675 errsts &= ~DAC960_LA_ERRSTS_PENDING;
2676
2677 *error = errsts;
2678 *param0 = readb(base + DAC960_LA_CMDOP_OFFSET);
2679 *param1 = readb(base + DAC960_LA_CMDID_OFFSET);
2680 writeb(0xFF, base + DAC960_LA_ERRSTS_OFFSET);
2681 return true;
2682}
2683
2684static inline unsigned short
2685DAC960_LA_mbox_init(struct pci_dev *pdev, void __iomem *base,
2686 union myrb_cmd_mbox *mbox)
2687{
2688 unsigned short status;
2689 int timeout = 0;
2690
2691 while (timeout < MYRB_MAILBOX_TIMEOUT) {
2692 if (!DAC960_LA_hw_mbox_is_full(base))
2693 break;
2694 udelay(10);
2695 timeout++;
2696 }
2697 if (DAC960_LA_hw_mbox_is_full(base)) {
2698 dev_err(&pdev->dev,
2699 "Timeout waiting for empty mailbox\n");
2700 return MYRB_STATUS_SUBSYS_TIMEOUT;
2701 }
2702 DAC960_LA_write_hw_mbox(base, mbox);
2703 DAC960_LA_hw_mbox_new_cmd(base);
2704 timeout = 0;
2705 while (timeout < MYRB_MAILBOX_TIMEOUT) {
2706 if (DAC960_LA_hw_mbox_status_available(base))
2707 break;
2708 udelay(10);
2709 timeout++;
2710 }
2711 if (!DAC960_LA_hw_mbox_status_available(base)) {
2712 dev_err(&pdev->dev, "Timeout waiting for mailbox status\n");
2713 return MYRB_STATUS_SUBSYS_TIMEOUT;
2714 }
2715 status = DAC960_LA_read_status(base);
2716 DAC960_LA_ack_hw_mbox_intr(base);
2717 DAC960_LA_ack_hw_mbox_status(base);
2718
2719 return status;
2720}
2721
2722static int DAC960_LA_hw_init(struct pci_dev *pdev,
2723 struct myrb_hba *cb, void __iomem *base)
2724{
2725 int timeout = 0;
2726 unsigned char error, parm0, parm1;
2727
2728 DAC960_LA_disable_intr(base);
2729 DAC960_LA_ack_hw_mbox_status(base);
2730 udelay(1000);
2731 timeout = 0;
2732 while (DAC960_LA_init_in_progress(base) &&
2733 timeout < MYRB_MAILBOX_TIMEOUT) {
2734 if (DAC960_LA_read_error_status(base, &error,
2735 &parm0, &parm1) &&
2736 myrb_err_status(cb, error, parm0, parm1))
2737 return -ENODEV;
2738 udelay(10);
2739 timeout++;
2740 }
2741 if (timeout == MYRB_MAILBOX_TIMEOUT) {
2742 dev_err(&pdev->dev,
2743 "Timeout waiting for Controller Initialisation\n");
2744 return -ETIMEDOUT;
2745 }
2746 if (!myrb_enable_mmio(cb, DAC960_LA_mbox_init)) {
2747 dev_err(&pdev->dev,
2748 "Unable to Enable Memory Mailbox Interface\n");
2749 DAC960_LA_reset_ctrl(base);
2750 return -ENODEV;
2751 }
2752 DAC960_LA_enable_intr(base);
2753 cb->qcmd = myrb_qcmd;
2754 cb->write_cmd_mbox = DAC960_LA_write_cmd_mbox;
2755 if (cb->dual_mode_interface)
2756 cb->get_cmd_mbox = DAC960_LA_mem_mbox_new_cmd;
2757 else
2758 cb->get_cmd_mbox = DAC960_LA_hw_mbox_new_cmd;
2759 cb->disable_intr = DAC960_LA_disable_intr;
2760 cb->reset = DAC960_LA_reset_ctrl;
2761
2762 return 0;
2763}
2764
2765static irqreturn_t DAC960_LA_intr_handler(int irq, void *arg)
2766{
2767 struct myrb_hba *cb = arg;
2768 void __iomem *base = cb->io_base;
2769 struct myrb_stat_mbox *next_stat_mbox;
2770 unsigned long flags;
2771
2772 spin_lock_irqsave(&cb->queue_lock, flags);
2773 DAC960_LA_ack_intr(base);
2774 next_stat_mbox = cb->next_stat_mbox;
2775 while (next_stat_mbox->valid) {
2776 unsigned char id = next_stat_mbox->id;
2777 struct scsi_cmnd *scmd = NULL;
2778 struct myrb_cmdblk *cmd_blk = NULL;
2779
2780 if (id == MYRB_DCMD_TAG)
2781 cmd_blk = &cb->dcmd_blk;
2782 else if (id == MYRB_MCMD_TAG)
2783 cmd_blk = &cb->mcmd_blk;
2784 else {
2785 scmd = scsi_host_find_tag(cb->host, id - 3);
2786 if (scmd)
2787 cmd_blk = scsi_cmd_priv(scmd);
2788 }
2789 if (cmd_blk)
2790 cmd_blk->status = next_stat_mbox->status;
2791 else
2792 dev_err(&cb->pdev->dev,
2793 "Unhandled command completion %d\n", id);
2794
2795 memset(next_stat_mbox, 0, sizeof(struct myrb_stat_mbox));
2796 if (++next_stat_mbox > cb->last_stat_mbox)
2797 next_stat_mbox = cb->first_stat_mbox;
2798
2799 if (cmd_blk) {
2800 if (id < 3)
2801 myrb_handle_cmdblk(cb, cmd_blk);
2802 else
2803 myrb_handle_scsi(cb, cmd_blk, scmd);
2804 }
2805 }
2806 cb->next_stat_mbox = next_stat_mbox;
2807 spin_unlock_irqrestore(&cb->queue_lock, flags);
2808 return IRQ_HANDLED;
2809}
2810
2811struct myrb_privdata DAC960_LA_privdata = {
2812 .hw_init = DAC960_LA_hw_init,
2813 .irq_handler = DAC960_LA_intr_handler,
2814 .mmio_size = DAC960_LA_mmio_size,
2815};
2816
2817/*
2818 * DAC960 PG Series Controllers
2819 */
2820static inline void DAC960_PG_hw_mbox_new_cmd(void __iomem *base)
2821{
2822 writel(DAC960_PG_IDB_HWMBOX_NEW_CMD, base + DAC960_PG_IDB_OFFSET);
2823}
2824
2825static inline void DAC960_PG_ack_hw_mbox_status(void __iomem *base)
2826{
2827 writel(DAC960_PG_IDB_HWMBOX_ACK_STS, base + DAC960_PG_IDB_OFFSET);
2828}
2829
2830static inline void DAC960_PG_gen_intr(void __iomem *base)
2831{
2832 writel(DAC960_PG_IDB_GEN_IRQ, base + DAC960_PG_IDB_OFFSET);
2833}
2834
2835static inline void DAC960_PG_reset_ctrl(void __iomem *base)
2836{
2837 writel(DAC960_PG_IDB_CTRL_RESET, base + DAC960_PG_IDB_OFFSET);
2838}
2839
2840static inline void DAC960_PG_mem_mbox_new_cmd(void __iomem *base)
2841{
2842 writel(DAC960_PG_IDB_MMBOX_NEW_CMD, base + DAC960_PG_IDB_OFFSET);
2843}
2844
2845static inline bool DAC960_PG_hw_mbox_is_full(void __iomem *base)
2846{
2847 unsigned char idb = readl(base + DAC960_PG_IDB_OFFSET);
2848
2849 return idb & DAC960_PG_IDB_HWMBOX_FULL;
2850}
2851
2852static inline bool DAC960_PG_init_in_progress(void __iomem *base)
2853{
2854 unsigned char idb = readl(base + DAC960_PG_IDB_OFFSET);
2855
2856 return idb & DAC960_PG_IDB_INIT_IN_PROGRESS;
2857}
2858
2859static inline void DAC960_PG_ack_hw_mbox_intr(void __iomem *base)
2860{
2861 writel(DAC960_PG_ODB_HWMBOX_ACK_IRQ, base + DAC960_PG_ODB_OFFSET);
2862}
2863
2864static inline void DAC960_PG_ack_mem_mbox_intr(void __iomem *base)
2865{
2866 writel(DAC960_PG_ODB_MMBOX_ACK_IRQ, base + DAC960_PG_ODB_OFFSET);
2867}
2868
2869static inline void DAC960_PG_ack_intr(void __iomem *base)
2870{
2871 writel(DAC960_PG_ODB_HWMBOX_ACK_IRQ | DAC960_PG_ODB_MMBOX_ACK_IRQ,
2872 base + DAC960_PG_ODB_OFFSET);
2873}
2874
2875static inline bool DAC960_PG_hw_mbox_status_available(void __iomem *base)
2876{
2877 unsigned char odb = readl(base + DAC960_PG_ODB_OFFSET);
2878
2879 return odb & DAC960_PG_ODB_HWMBOX_STS_AVAIL;
2880}
2881
2882static inline bool DAC960_PG_mem_mbox_status_available(void __iomem *base)
2883{
2884 unsigned char odb = readl(base + DAC960_PG_ODB_OFFSET);
2885
2886 return odb & DAC960_PG_ODB_MMBOX_STS_AVAIL;
2887}
2888
2889static inline void DAC960_PG_enable_intr(void __iomem *base)
2890{
2891 unsigned int imask = (unsigned int)-1;
2892
2893 imask &= ~DAC960_PG_IRQMASK_DISABLE_IRQ;
2894 writel(imask, base + DAC960_PG_IRQMASK_OFFSET);
2895}
2896
2897static inline void DAC960_PG_disable_intr(void __iomem *base)
2898{
2899 unsigned int imask = (unsigned int)-1;
2900
2901 writel(imask, base + DAC960_PG_IRQMASK_OFFSET);
2902}
2903
2904static inline bool DAC960_PG_intr_enabled(void __iomem *base)
2905{
2906 unsigned int imask = readl(base + DAC960_PG_IRQMASK_OFFSET);
2907
2908 return !(imask & DAC960_PG_IRQMASK_DISABLE_IRQ);
2909}
2910
2911static inline void DAC960_PG_write_cmd_mbox(union myrb_cmd_mbox *mem_mbox,
2912 union myrb_cmd_mbox *mbox)
2913{
2914 mem_mbox->words[1] = mbox->words[1];
2915 mem_mbox->words[2] = mbox->words[2];
2916 mem_mbox->words[3] = mbox->words[3];
2917 /* Memory barrier to prevent reordering */
2918 wmb();
2919 mem_mbox->words[0] = mbox->words[0];
2920 /* Memory barrier to force PCI access */
2921 mb();
2922}
2923
2924static inline void DAC960_PG_write_hw_mbox(void __iomem *base,
2925 union myrb_cmd_mbox *mbox)
2926{
2927 writel(mbox->words[0], base + DAC960_PG_CMDOP_OFFSET);
2928 writel(mbox->words[1], base + DAC960_PG_MBOX4_OFFSET);
2929 writel(mbox->words[2], base + DAC960_PG_MBOX8_OFFSET);
2930 writeb(mbox->bytes[12], base + DAC960_PG_MBOX12_OFFSET);
2931}
2932
2933static inline unsigned char
2934DAC960_PG_read_status_cmd_ident(void __iomem *base)
2935{
2936 return readb(base + DAC960_PG_STSID_OFFSET);
2937}
2938
2939static inline unsigned short
2940DAC960_PG_read_status(void __iomem *base)
2941{
2942 return readw(base + DAC960_PG_STS_OFFSET);
2943}
2944
2945static inline bool
2946DAC960_PG_read_error_status(void __iomem *base, unsigned char *error,
2947 unsigned char *param0, unsigned char *param1)
2948{
2949 unsigned char errsts = readb(base + DAC960_PG_ERRSTS_OFFSET);
2950
2951 if (!(errsts & DAC960_PG_ERRSTS_PENDING))
2952 return false;
2953 errsts &= ~DAC960_PG_ERRSTS_PENDING;
2954 *error = errsts;
2955 *param0 = readb(base + DAC960_PG_CMDOP_OFFSET);
2956 *param1 = readb(base + DAC960_PG_CMDID_OFFSET);
2957 writeb(0, base + DAC960_PG_ERRSTS_OFFSET);
2958 return true;
2959}
2960
2961static inline unsigned short
2962DAC960_PG_mbox_init(struct pci_dev *pdev, void __iomem *base,
2963 union myrb_cmd_mbox *mbox)
2964{
2965 unsigned short status;
2966 int timeout = 0;
2967
2968 while (timeout < MYRB_MAILBOX_TIMEOUT) {
2969 if (!DAC960_PG_hw_mbox_is_full(base))
2970 break;
2971 udelay(10);
2972 timeout++;
2973 }
2974 if (DAC960_PG_hw_mbox_is_full(base)) {
2975 dev_err(&pdev->dev,
2976 "Timeout waiting for empty mailbox\n");
2977 return MYRB_STATUS_SUBSYS_TIMEOUT;
2978 }
2979 DAC960_PG_write_hw_mbox(base, mbox);
2980 DAC960_PG_hw_mbox_new_cmd(base);
2981
2982 timeout = 0;
2983 while (timeout < MYRB_MAILBOX_TIMEOUT) {
2984 if (DAC960_PG_hw_mbox_status_available(base))
2985 break;
2986 udelay(10);
2987 timeout++;
2988 }
2989 if (!DAC960_PG_hw_mbox_status_available(base)) {
2990 dev_err(&pdev->dev,
2991 "Timeout waiting for mailbox status\n");
2992 return MYRB_STATUS_SUBSYS_TIMEOUT;
2993 }
2994 status = DAC960_PG_read_status(base);
2995 DAC960_PG_ack_hw_mbox_intr(base);
2996 DAC960_PG_ack_hw_mbox_status(base);
2997
2998 return status;
2999}
3000
3001static int DAC960_PG_hw_init(struct pci_dev *pdev,
3002 struct myrb_hba *cb, void __iomem *base)
3003{
3004 int timeout = 0;
3005 unsigned char error, parm0, parm1;
3006
3007 DAC960_PG_disable_intr(base);
3008 DAC960_PG_ack_hw_mbox_status(base);
3009 udelay(1000);
3010 while (DAC960_PG_init_in_progress(base) &&
3011 timeout < MYRB_MAILBOX_TIMEOUT) {
3012 if (DAC960_PG_read_error_status(base, &error,
3013 &parm0, &parm1) &&
3014 myrb_err_status(cb, error, parm0, parm1))
3015 return -EIO;
3016 udelay(10);
3017 timeout++;
3018 }
3019 if (timeout == MYRB_MAILBOX_TIMEOUT) {
3020 dev_err(&pdev->dev,
3021 "Timeout waiting for Controller Initialisation\n");
3022 return -ETIMEDOUT;
3023 }
3024 if (!myrb_enable_mmio(cb, DAC960_PG_mbox_init)) {
3025 dev_err(&pdev->dev,
3026 "Unable to Enable Memory Mailbox Interface\n");
3027 DAC960_PG_reset_ctrl(base);
3028 return -ENODEV;
3029 }
3030 DAC960_PG_enable_intr(base);
3031 cb->qcmd = myrb_qcmd;
3032 cb->write_cmd_mbox = DAC960_PG_write_cmd_mbox;
3033 if (cb->dual_mode_interface)
3034 cb->get_cmd_mbox = DAC960_PG_mem_mbox_new_cmd;
3035 else
3036 cb->get_cmd_mbox = DAC960_PG_hw_mbox_new_cmd;
3037 cb->disable_intr = DAC960_PG_disable_intr;
3038 cb->reset = DAC960_PG_reset_ctrl;
3039
3040 return 0;
3041}
3042
3043static irqreturn_t DAC960_PG_intr_handler(int irq, void *arg)
3044{
3045 struct myrb_hba *cb = arg;
3046 void __iomem *base = cb->io_base;
3047 struct myrb_stat_mbox *next_stat_mbox;
3048 unsigned long flags;
3049
3050 spin_lock_irqsave(&cb->queue_lock, flags);
3051 DAC960_PG_ack_intr(base);
3052 next_stat_mbox = cb->next_stat_mbox;
3053 while (next_stat_mbox->valid) {
3054 unsigned char id = next_stat_mbox->id;
3055 struct scsi_cmnd *scmd = NULL;
3056 struct myrb_cmdblk *cmd_blk = NULL;
3057
3058 if (id == MYRB_DCMD_TAG)
3059 cmd_blk = &cb->dcmd_blk;
3060 else if (id == MYRB_MCMD_TAG)
3061 cmd_blk = &cb->mcmd_blk;
3062 else {
3063 scmd = scsi_host_find_tag(cb->host, id - 3);
3064 if (scmd)
3065 cmd_blk = scsi_cmd_priv(scmd);
3066 }
3067 if (cmd_blk)
3068 cmd_blk->status = next_stat_mbox->status;
3069 else
3070 dev_err(&cb->pdev->dev,
3071 "Unhandled command completion %d\n", id);
3072
3073 memset(next_stat_mbox, 0, sizeof(struct myrb_stat_mbox));
3074 if (++next_stat_mbox > cb->last_stat_mbox)
3075 next_stat_mbox = cb->first_stat_mbox;
3076

580 more lines aren’t shown here.

drivers/scsi/myrb.h+958−0

This diff is large: its 959 lines aren’t shown here.

drivers/scsi/myrs.c+3268−0

This diff is large: its 3269 lines aren’t shown here.

drivers/scsi/myrs.h+1134−0

This diff is large: its 1135 lines aren’t shown here.

drivers/scsi/nsp32.c+10−8

This diff is large: its 60 lines aren’t shown here.

drivers/scsi/osd/osd_initiator.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/scsi/pm8001/pm8001_defs.h+8−0

This diff is large: its 13 lines aren’t shown here.

drivers/scsi/pm8001/pm8001_hwi.c+19−12

This diff is large: its 88 lines aren’t shown here.

drivers/scsi/pm8001/pm8001_hwi.h+0−4

This diff is large: its 11 lines aren’t shown here.

drivers/scsi/pm8001/pm8001_init.c+7−24

This diff is large: its 61 lines aren’t shown here.

drivers/scsi/pm8001/pm8001_sas.c+37−12

This diff is large: its 142 lines aren’t shown here.

drivers/scsi/pm8001/pm8001_sas.h+2−1

This diff is large: its 17 lines aren’t shown here.

drivers/scsi/pm8001/pm80xx_hwi.c+94−25

This diff is large: its 235 lines aren’t shown here.

drivers/scsi/pm8001/pm80xx_hwi.h+7−2

This diff is large: its 30 lines aren’t shown here.

drivers/scsi/qedf/qedf_main.c+4−4

This diff is large: its 25 lines aren’t shown here.

drivers/scsi/qedi/qedi_main.c+4−4

This diff is large: its 24 lines aren’t shown here.

drivers/scsi/qla1280.c+13−13

This diff is large: its 87 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_attr.c+569−18

This diff is large: its 783 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_bsg.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_def.h+23−9

This diff is large: its 132 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_gbl.h+9−8

This diff is large: its 86 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_gs.c+143−393

This diff is large: its 792 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_init.c+257−155

This diff is large: its 857 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_inline.h+12−11

This diff is large: its 70 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_iocb.c+13−30

This diff is large: its 119 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_isr.c+44−40

This diff is large: its 174 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_mbx.c+38−14

This diff is large: its 184 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_nvme.c+2−5

This diff is large: its 28 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_nx.c+2−2

This diff is large: its 11 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_os.c+210−107

This diff is large: its 595 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_target.c+374−168

This diff is large: its 918 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_target.h+7−1

This diff is large: its 38 lines aren’t shown here.

drivers/scsi/qla2xxx/qla_version.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/scsi/qla2xxx/tcm_qla2xxx.c+43−8

This diff is large: its 108 lines aren’t shown here.

drivers/scsi/qla4xxx/ql4_init.c+4−6

This diff is large: its 17 lines aren’t shown here.

drivers/scsi/qla4xxx/ql4_os.c+8−17

This diff is large: its 50 lines aren’t shown here.

drivers/scsi/raid_class.c+1−3

This diff is large: its 18 lines aren’t shown here.

drivers/scsi/scsi_error.c+0−3

This diff is large: its 10 lines aren’t shown here.

drivers/scsi/scsi_lib.c+3−2

This diff is large: its 19 lines aren’t shown here.

drivers/scsi/scsi_transport_sas.c+0−2

This diff is large: its 16 lines aren’t shown here.

drivers/scsi/sg.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/scsi/smartpqi/smartpqi_init.c+42−58

This diff is large: its 334 lines aren’t shown here.

drivers/scsi/smartpqi/smartpqi_sis.c+5−6

This diff is large: its 25 lines aren’t shown here.

drivers/scsi/snic/snic_disc.c+4−3

This diff is large: its 21 lines aren’t shown here.

drivers/scsi/snic/snic_io.c+13−12

This diff is large: its 79 lines aren’t shown here.

drivers/scsi/snic/snic_main.c+2−22

This diff is large: its 40 lines aren’t shown here.

drivers/scsi/snic/snic_scsi.c+7−8

This diff is large: its 47 lines aren’t shown here.

drivers/scsi/snic/vnic_dev.c+14−15

This diff is large: its 84 lines aren’t shown here.

drivers/scsi/sun3x_esp.c+1−29

This diff is large: its 51 lines aren’t shown here.

drivers/scsi/sun_esp.c+11−50

This diff is large: its 152 lines aren’t shown here.

drivers/scsi/sym53c8xx_2/sym_hipd.c+11−4

This diff is large: its 50 lines aren’t shown here.

drivers/scsi/ufs/Kconfig+19−0

This diff is large: its 23 lines aren’t shown here.

drivers/scsi/ufs/Makefile+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/scsi/ufs/ufs-qcom.c+28−26

This diff is large: its 112 lines aren’t shown here.

drivers/scsi/ufs/ufs.h+3−91

This diff is large: its 123 lines aren’t shown here.

drivers/scsi/ufs/ufs_bsg.c+210−0

This diff is large: its 211 lines aren’t shown here.

drivers/scsi/ufs/ufs_bsg.h+23−0

This diff is large: its 24 lines aren’t shown here.

drivers/scsi/ufs/ufshcd.c+289−142

This diff is large: its 611 lines aren’t shown here.

drivers/scsi/ufs/ufshcd.h+12−0

This diff is large: its 26 lines aren’t shown here.

drivers/scsi/ufs/ufshci.h+14−11

This diff is large: its 37 lines aren’t shown here.

drivers/scsi/vmw_pvscsi.c+38−39

This diff is large: its 182 lines aren’t shown here.

drivers/scsi/zorro_esp.c+36−254

This diff is large: its 501 lines aren’t shown here.

drivers/target/iscsi/cxgbit/cxgbit_cm.c+20−3

This diff is large: its 76 lines aren’t shown here.

drivers/target/iscsi/iscsi_target.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/target/iscsi/iscsi_target_erl0.c+1−14

This diff is large: its 23 lines aren’t shown here.

drivers/target/iscsi/iscsi_target_erl1.c+12−5

This diff is large: its 35 lines aren’t shown here.

drivers/target/iscsi/iscsi_target_erl2.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/target/iscsi/iscsi_target_erl2.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/target/iscsi/iscsi_target_login.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/target/iscsi/iscsi_target_stat.c+2−2

This diff is large: its 13 lines aren’t shown here.

drivers/target/iscsi/iscsi_target_util.c+25−19

This diff is large: its 65 lines aren’t shown here.

drivers/target/iscsi/iscsi_target_util.h+1−0

This diff is large: its 7 lines aren’t shown here.

drivers/target/target_core_iblock.c+39−19

This diff is large: its 141 lines aren’t shown here.

drivers/target/target_core_iblock.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/target/target_core_sbc.c+10−13

This diff is large: its 63 lines aren’t shown here.

drivers/target/target_core_transport.c+7−12

This diff is large: its 61 lines aren’t shown here.

drivers/target/target_core_xcopy.c+0−3

This diff is large: its 17 lines aren’t shown here.

include/linux/wait.h+15−5

This diff is large: its 35 lines aren’t shown here.

include/target/iscsi/iscsi_target_core.h+3−3

This diff is large: its 28 lines aren’t shown here.

include/target/iscsi/iscsi_target_stat.h+2−2

This diff is large: its 18 lines aren’t shown here.

include/target/target_core_base.h+0−1

This diff is large: its 8 lines aren’t shown here.

include/uapi/scsi/scsi_bsg_ufs.h+106−0

This diff is large: its 107 lines aren’t shown here.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t