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
128128 In this version of UFSHCD Query requests and power management
129129 functionality are not implemented.
130130
131+4. BSG Support
132+------------------
133+
134+This transport driver supports exchanging UFS protocol information units
135+(UPIUs) with a UFS device. Typically, user space will allocate
136+struct ufs_bsg_request and struct ufs_bsg_reply (see ufs_bsg.h) as
137+request_upiu and reply_upiu respectively. Filling those UPIUs should
138+be done in accordance with JEDEC spec UFS2.1 paragraph 10.7.
139+*Caveat emptor*: The driver makes no further input validations and sends the
140+UPIU to the device as it is. Open the bsg device in /dev/ufs-bsg and
141+send 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+
131151 UFS Specifications can be found at,
132152 UFS - http://www.jedec.org/sites/default/files/docs/JESD220.pdf
133153 UFSHCI - 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
40554055 L: linux-scsi@vger.kernel.org
40564056 S: Supported
40574057 F: drivers/scsi/cxlflash/
4058−F: include/uapi/scsi/cxlflash_ioctls.h
4058+F: include/uapi/scsi/cxlflash_ioctl.h
40594059 F: Documentation/powerpc/cxlflash.txt
40604060
40614061 CYBERPRO FB DRIVER
@@ -10011,6 +10011,13 @@ S: Supported · 5949 unmodified lines
1001110011 F: drivers/gpu/drm/mxsfb/
1001210012 F: Documentation/devicetree/bindings/display/mxsfb.txt
1001310013
10014+MYLEX DAC960 PCI RAID Controller
10015+M: Hannes Reinecke <hare@kernel.org>
10016+L: linux-scsi@vger.kernel.org
10017+S: Supported
10018+F: drivers/scsi/myrb.*
10019+F: drivers/scsi/myrs.*
10020+
1001410021 MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
1001510022 M: Chris Lee <christopher.lee@cspi.com>
1001610023 L: 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
20042004 U64 LinkFailureCount; /* 50h */
20052005 U64 LossOfSyncCount; /* 58h */
20062006 U64 LossOfSignalCount; /* 60h */
2007− U64 PrimativeSeqErrCount; /* 68h */
2007+ U64 PrimitiveSeqErrCount; /* 68h */
20082008 U64 InvalidTxWordCount; /* 70h */
20092009 U64 InvalidCrcCount; /* 78h */
20102010 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
335335 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;
336336 struct pci_dev *pdev;
337337
338− if ((ioc == NULL))
338+ if (!ioc)
339339 return -1;
340340
341341 pdev = ioc->pcidev;
342− if ((pdev == NULL))
342+ if (!pdev)
343343 return -1;
344344
345345 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
75707570 u8 phy_num = (u8)(evData0);
75717571 u8 port_num = (u8)(evData0 >> 8);
75727572 u8 port_width = (u8)(evData0 >> 16);
7573− u8 primative = (u8)(evData0 >> 24);
7573+ u8 primitive = (u8)(evData0 >> 24);
75747574 snprintf(evStr, EVENT_DESCR_STR_SZ,
7575− "SAS Broadcase Primative: phy=%d port=%d "
7576− "width=%d primative=0x%02x",
7577− phy_num, port_num, port_width, primative);
7575+ "SAS Broadcast Primitive: phy=%d port=%d "
7576+ "width=%d primitive=0x%02x",
7577+ phy_num, port_num, port_width, primitive);
75787578 break;
75797579 }
75807580
drivers/message/fusion/mptsas.c+4−4
@@ -129,7 +129,7 @@ static void mptsas_expander_delete(MPT_ADAPTER *ioc, · 128 unmodified lines
129129 static void mptsas_send_expander_event(struct fw_event_work *fw_event);
130130 static void mptsas_not_responding_devices(MPT_ADAPTER *ioc);
131131 static void mptsas_scan_sas_topology(MPT_ADAPTER *ioc);
132−static void mptsas_broadcast_primative_work(struct fw_event_work *fw_event);
132+static void mptsas_broadcast_primitive_work(struct fw_event_work *fw_event);
133133 static void mptsas_handle_queue_full_event(struct fw_event_work *fw_event);
134134 static void mptsas_volume_delete(MPT_ADAPTER *ioc, u8 id);
135135 void mptsas_schedule_target_reset(void *ioc);
@@ -1665,7 +1665,7 @@ mptsas_firmware_event_work(struct work_struct *work) · 1529 unmodified lines
16651665 mptsas_free_fw_event(ioc, fw_event);
16661666 break;
16671667 case MPI_EVENT_SAS_BROADCAST_PRIMITIVE:
1668− mptsas_broadcast_primative_work(fw_event);
1668+ mptsas_broadcast_primitive_work(fw_event);
16691669 break;
16701670 case MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE:
16711671 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
48264826 }
48274827
48284828 /**
4829− * mptsas_broadcast_primative_work - Handle broadcast primitives
4829+ * mptsas_broadcast_primitive_work - Handle broadcast primitives
48304830 * @work: work queue payload containing info describing the event
48314831 *
48324832 * this will be handled in workqueue context.
48334833 */
48344834 static void
4835−mptsas_broadcast_primative_work(struct fw_event_work *fw_event)
4835+mptsas_broadcast_primitive_work(struct fw_event_work *fw_event)
48364836 {
48374837 MPT_ADAPTER *ioc = fw_event->ioc;
48384838 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
518518 unsigned long *cpu_addr;
519519 int retval = 1;
520520
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);
522523 if (!cpu_addr) {
523524 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed");
524525 goto out;
@@ -526,7 +527,8 @@ static int twa_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) · 1 unmodified line
526527
527528 if ((unsigned long)cpu_addr % (TW_ALIGNMENT_9000)) {
528529 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);
530532 goto out;
531533 }
532534
@@ -1027,16 +1029,16 @@ out: · 494 unmodified lines
10271029 static void twa_free_device_extension(TW_Device_Extension *tw_dev)
10281030 {
10291031 if (tw_dev->command_packet_virt[0])
1030− pci_free_consistent(tw_dev->tw_pci_dev,
1031− sizeof(TW_Command_Full)*TW_Q_LENGTH,
1032− tw_dev->command_packet_virt[0],
1033− tw_dev->command_packet_phys[0]);
1032+ dma_free_coherent(&tw_dev->tw_pci_dev->dev,
1033+ sizeof(TW_Command_Full) * TW_Q_LENGTH,
1034+ tw_dev->command_packet_virt[0],
1035+ tw_dev->command_packet_phys[0]);
10341036
10351037 if (tw_dev->generic_buffer_virt[0])
1036− pci_free_consistent(tw_dev->tw_pci_dev,
1037− TW_SECTOR_SIZE*TW_Q_LENGTH,
1038− tw_dev->generic_buffer_virt[0],
1039− tw_dev->generic_buffer_phys[0]);
1038+ dma_free_coherent(&tw_dev->tw_pci_dev->dev,
1039+ TW_SECTOR_SIZE * TW_Q_LENGTH,
1040+ tw_dev->generic_buffer_virt[0],
1041+ tw_dev->generic_buffer_phys[0]);
10401042
10411043 kfree(tw_dev->event_queue[0]);
10421044 } /* 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
20152017 pci_set_master(pdev);
20162018 pci_try_set_mwi(pdev);
20172019
2018− if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))
2019− || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))
2020− if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
2021− || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
2022− TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask");
2023− retval = -ENODEV;
2024− goto out_disable_device;
2025− }
2020+ if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
2021+ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
2022+ TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask");
2023+ retval = -ENODEV;
2024+ goto out_disable_device;
2025+ }
20262026
20272027 host = scsi_host_alloc(&driver_template, sizeof(TW_Device_Extension));
20282028 if (!host) {
@@ -2237,14 +2237,12 @@ static int twa_resume(struct pci_dev *pdev) · 208 unmodified lines
22372237 pci_set_master(pdev);
22382238 pci_try_set_mwi(pdev);
22392239
2240− if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))
2241− || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))
2242− if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
2243− || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
2244− TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume");
2245− retval = -ENODEV;
2246− goto out_disable_device;
2247− }
2240+ if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
2241+ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
2242+ TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume");
2243+ retval = -ENODEV;
2244+ goto out_disable_device;
2245+ }
22482246
22492247 /* Initialize the card */
22502248 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
644644 unsigned long *cpu_addr;
645645 int retval = 1;
646646
647− cpu_addr = pci_zalloc_consistent(tw_dev->tw_pci_dev, size * TW_Q_LENGTH,
648− &dma_handle);
647+ cpu_addr = dma_zalloc_coherent(&tw_dev->tw_pci_dev->dev,
648+ size * TW_Q_LENGTH, &dma_handle, GFP_KERNEL);
649649 if (!cpu_addr) {
650650 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed");
651651 goto out;
@@ -899,19 +899,19 @@ out: · 247 unmodified lines
899899 static void twl_free_device_extension(TW_Device_Extension *tw_dev)
900900 {
901901 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,
903903 sizeof(TW_Command_Full)*TW_Q_LENGTH,
904904 tw_dev->command_packet_virt[0],
905905 tw_dev->command_packet_phys[0]);
906906
907907 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,
909909 TW_SECTOR_SIZE*TW_Q_LENGTH,
910910 tw_dev->generic_buffer_virt[0],
911911 tw_dev->generic_buffer_phys[0]);
912912
913913 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,
915915 sizeof(TW_Command_Apache_Header)*
916916 TW_Q_LENGTH,
917917 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
15711571 pci_set_master(pdev);
15721572 pci_try_set_mwi(pdev);
15731573
1574− if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))
1575− || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))
1576− if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
1577− || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
1578− TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");
1579− retval = -ENODEV;
1580− goto out_disable_device;
1581− }
1574+ if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
1575+ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
1576+ TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");
1577+ retval = -ENODEV;
1578+ goto out_disable_device;
1579+ }
15821580
15831581 host = scsi_host_alloc(&driver_template, sizeof(TW_Device_Extension));
15841582 if (!host) {
@@ -1805,14 +1803,12 @@ static int twl_resume(struct pci_dev *pdev) · 220 unmodified lines
18051803 pci_set_master(pdev);
18061804 pci_try_set_mwi(pdev);
18071805
1808− if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))
1809− || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))
1810− if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
1811− || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
1812− TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");
1813− retval = -ENODEV;
1814− goto out_disable_device;
1815− }
1806+ if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
1807+ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
1808+ TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");
1809+ retval = -ENODEV;
1810+ goto out_disable_device;
1811+ }
18161812
18171813 /* Initialize the card */
18181814 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
834834
835835 dprintk(KERN_NOTICE "3w-xxxx: tw_allocate_memory()\n");
836836
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);
838839 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");
840841 return 1;
841842 }
842843
843844 if ((unsigned long)cpu_addr % (tw_dev->tw_pci_dev->device == TW_DEVICE_ID ? TW_ALIGNMENT_6000 : TW_ALIGNMENT_7000)) {
844845 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);
846848 return 1;
847849 }
848850
@@ -1062,10 +1064,16 @@ static void tw_free_device_extension(TW_Device_Extension *tw_dev) · 213 unmodified lines
10621064
10631065 /* Free command packet and generic buffer memory */
10641066 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]);
10661071
10671072 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]);
10691077 } /* End tw_free_device_extension() */
10701078
10711079 /* 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
22602268
22612269 pci_set_master(pdev);
22622270
2263− retval = pci_set_dma_mask(pdev, TW_DMA_MASK);
2271+ retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
22642272 if (retval) {
22652273 printk(KERN_WARNING "3w-xxxx: Failed to set dma mask.");
22662274 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
230230 #define TW_IOCTL_TIMEOUT 25 /* 25 seconds */
231231 #define TW_IOCTL_CHRDEV_TIMEOUT 60 /* 60 seconds */
232232 #define TW_IOCTL_CHRDEV_FREE -1
233−#define TW_DMA_MASK DMA_BIT_MASK(32)
234233 #define TW_MAX_CDB_LEN 16
235234
236235 /* Bitmask macros to eliminate bitfields */
drivers/scsi/53c700.h+1−1
@@ -90,7 +90,7 @@ struct NCR_700_Device_Parameters { · 89 unmodified lines
9090 /* The SYNC negotiation sequence looks like:
9191 *
9292 * If DEV_NEGOTIATED_SYNC not set, tack and SDTR message on to the
93− * initial identify for the device and set DEV_BEGIN_SYNC_NEGOTATION
93+ * initial identify for the device and set DEV_BEGIN_SYNC_NEGOTIATION
9494 * If we get an SDTR reply, work out the SXFER parameters, squirrel
9595 * them away here, clear DEV_BEGIN_SYNC_NEGOTIATION and set
9696 * 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
201201 dma_addr_t blkp;
202202
203203 while (adapter->alloc_ccbs < adapter->initccbs) {
204− blk_pointer = pci_alloc_consistent(adapter->pci_device,
205− blk_size, &blkp);
204+ blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev,
205+ blk_size, &blkp, GFP_KERNEL);
206206 if (blk_pointer == NULL) {
207207 blogic_err("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n",
208208 adapter);
@@ -227,15 +227,16 @@ static void blogic_destroy_ccbs(struct blogic_adapter *adapter) · 18 unmodified lines
227227 next_ccb = ccb->next_all;
228228 if (ccb->allocgrp_head) {
229229 if (lastccb)
230− pci_free_consistent(adapter->pci_device,
230+ dma_free_coherent(&adapter->pci_device->dev,
231231 lastccb->allocgrp_size, lastccb,
232232 lastccb->allocgrp_head);
233233 lastccb = ccb;
234234 }
235235 }
236236 if (lastccb)
237− pci_free_consistent(adapter->pci_device, lastccb->allocgrp_size,
238− lastccb, lastccb->allocgrp_head);
237+ dma_free_coherent(&adapter->pci_device->dev,
238+ lastccb->allocgrp_size, lastccb,
239+ lastccb->allocgrp_head);
239240 }
240241
241242
@@ -256,8 +257,8 @@ static void blogic_create_addlccbs(struct blogic_adapter *adapter, · 14 unmodified lines
256257 if (addl_ccbs <= 0)
257258 return;
258259 while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) {
259− blk_pointer = pci_alloc_consistent(adapter->pci_device,
260− blk_size, &blkp);
260+ blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev,
261+ blk_size, &blkp, GFP_KERNEL);
261262 if (blk_pointer == NULL)
262263 break;
263264 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
318319 if (ccb->command != NULL)
319320 scsi_dma_unmap(ccb->command);
320321 if (dma_unmap)
321− pci_unmap_single(adapter->pci_device, ccb->sensedata,
322− ccb->sense_datalen, PCI_DMA_FROMDEVICE);
322+ dma_unmap_single(&adapter->pci_device->dev, ccb->sensedata,
323+ ccb->sense_datalen, DMA_FROM_DEVICE);
323324
324325 ccb->command = NULL;
325326 ccb->status = BLOGIC_CCB_FREE;
@@ -712,7 +713,7 @@ static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter) · 386 unmodified lines
712713 if (pci_enable_device(pci_device))
713714 continue;
714715
715− if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32)))
716+ if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
716717 continue;
717718
718719 bus = pci_device->bus->number;
@@ -895,7 +896,7 @@ static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter) · 176 unmodified lines
895896 if (pci_enable_device(pci_device))
896897 continue;
897898
898− if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32)))
899+ if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
899900 continue;
900901
901902 bus = pci_device->bus->number;
@@ -952,7 +953,7 @@ static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter) · 50 unmodified lines
952953 if (pci_enable_device(pci_device))
953954 continue;
954955
955− if (pci_set_dma_mask(pci_device, DMA_BIT_MASK(32)))
956+ if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
956957 continue;
957958
958959 bus = pci_device->bus->number;
@@ -2040,7 +2041,7 @@ static void blogic_relres(struct blogic_adapter *adapter) · 1081 unmodified lines
20402041 Release any allocated memory structs not released elsewhere
20412042 */
20422043 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,
20442045 adapter->mbox_space, adapter->mbox_space_handle);
20452046 pci_dev_put(adapter->pci_device);
20462047 adapter->mbox_space = NULL;
@@ -2092,8 +2093,9 @@ static bool blogic_initadapter(struct blogic_adapter *adapter) · 45 unmodified lines
20922093 Initialize the Outgoing and Incoming Mailbox pointers.
20932094 */
20942095 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_sz, &adapter->mbox_space_handle);
2096+ adapter->mbox_space = dma_alloc_coherent(&adapter->pci_device->dev,
2097+ adapter->mbox_sz, &adapter->mbox_space_handle,
2098+ GFP_KERNEL);
20972099 if (adapter->mbox_space == NULL)
20982100 return blogic_failure(adapter, "MAILBOX ALLOCATION");
20992101 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
31833185 memcpy(ccb->cdb, cdb, cdblen);
31843186 ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE;
31853187 ccb->command = command;
3186− sense_buf = pci_map_single(adapter->pci_device,
3188+ sense_buf = dma_map_single(&adapter->pci_device->dev,
31873189 command->sense_buffer, ccb->sense_datalen,
3188− PCI_DMA_FROMDEVICE);
3190+ DMA_FROM_DEVICE);
31893191 if (dma_mapping_error(&adapter->pci_device->dev, sense_buf)) {
31903192 blogic_err("DMA mapping for sense data buffer failed\n",
31913193 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
29442944 }
29452945
29462946 if (currSCCB->Lun == 0x00) {
2947− if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) {
2947+ if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
29482948
29492949 currTar_Info->TarStatus |=
29502950 (unsigned char)SYNC_SUPPORTED;
@@ -2953,8 +2953,8 @@ static void FPT_sdecm(unsigned char message, u32 port, unsigned char p_card) · 2 unmodified lines
29532953 ~EE_SYNC_MASK;
29542954 }
29552955
2956− else if ((currSCCB->Sccb_scsistat ==
2957− SELECT_WN_ST)) {
2956+ else if (currSCCB->Sccb_scsistat ==
2957+ SELECT_WN_ST) {
29582958
29592959 currTar_Info->TarStatus =
29602960 (currTar_Info->
drivers/scsi/Kconfig+35−0
@@ -42,6 +42,9 @@ config SCSI_DMA · 41 unmodified lines
4242 bool
4343 default n
4444
45+config SCSI_ESP_PIO
46+ bool
47+
4548 config SCSI_NETLINK
4649 bool
4750 default n
@@ -557,6 +560,36 @@ config SCSI_FLASHPOINT · 509 unmodified lines
557560 substantial, so users of MultiMaster Host Adapters may not
558561 wish to include it.
559562
563+config 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+
578+config 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+
560593 config VMWARE_PVSCSI
561594 tristate "VMware PVSCSI driver support"
562595 depends on PCI && SCSI && X86
@@ -1332,6 +1365,7 @@ config SCSI_ZORRO_ESP · 769 unmodified lines
13321365 tristate "Zorro ESP SCSI support"
13331366 depends on ZORRO && SCSI
13341367 select SCSI_SPI_ATTRS
1368+ select SCSI_ESP_PIO
13351369 help
13361370 Support for various NCR53C9x (ESP) based SCSI controllers on Zorro
13371371 expansion boards for the Amiga.
@@ -1374,6 +1408,7 @@ config SCSI_MAC_ESP · 36 unmodified lines
13741408 tristate "Macintosh NCR53c9[46] SCSI"
13751409 depends on MAC && SCSI
13761410 select SCSI_SPI_ATTRS
1411+ select SCSI_ESP_PIO
13771412 help
13781413 This is the NCR 53c9x SCSI controller found on most of the 68040
13791414 based Macintoshes.
drivers/scsi/Makefile+2−0
@@ -106,6 +106,8 @@ obj-$(CONFIG_SCSI_INIA100) += a100u2w.o · 105 unmodified lines
106106 obj-$(CONFIG_SCSI_QLOGICPTI) += qlogicpti.o
107107 obj-$(CONFIG_SCSI_MESH) += mesh.o
108108 obj-$(CONFIG_SCSI_MAC53C94) += mac53c94.o
109+obj-$(CONFIG_SCSI_MYRB) += myrb.o
110+obj-$(CONFIG_SCSI_MYRS) += myrs.o
109111 obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o
110112 obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o
111113 obj-$(CONFIG_SCSI_3W_SAS) += 3w-sas.o
drivers/scsi/NCR5380.c+100−67
@@ -131,6 +131,7 @@ · 130 unmodified lines
131131
132132 static int do_abort(struct Scsi_Host *);
133133 static void do_reset(struct Scsi_Host *);
134+static void bus_reset_cleanup(struct Scsi_Host *);
134135
135136 /**
136137 * initialize_SCp - init the scsi pointer field
@@ -513,16 +514,15 @@ static void complete_cmd(struct Scsi_Host *instance, · 376 unmodified lines
513514
514515 if (hostdata->sensing == cmd) {
515516 /* Autosense processing ends here */
516− if ((cmd->result & 0xff) != SAM_STAT_GOOD) {
517+ if (status_byte(cmd->result) != GOOD) {
517518 scsi_eh_restore_cmnd(cmd, &hostdata->ses);
518− set_host_byte(cmd, DID_ERROR);
519− } else
519+ } else {
520520 scsi_eh_restore_cmnd(cmd, &hostdata->ses);
521+ set_driver_byte(cmd, DRIVER_SENSE);
522+ }
521523 hostdata->sensing = NULL;
522524 }
523525
524− hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
525−
526526 cmd->scsi_done(cmd);
527527 }
528528
@@ -884,7 +884,14 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id) · 355 unmodified lines
884884 /* Probably Bus Reset */
885885 NCR5380_read(RESET_PARITY_INTERRUPT_REG);
886886
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+ }
888895 #ifdef SUN3_SCSI_VME
889896 dregs->csr |= CSR_DMA_ENABLE;
890897 #endif
@@ -902,20 +909,16 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id) · 11 unmodified lines
902909 return IRQ_RETVAL(handled);
903910 }
904911
905−/*
906− * Function : int NCR5380_select(struct Scsi_Host *instance,
907− * struct scsi_cmnd *cmd)
908− *
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+/**
913+ * NCR5380_select - attempt arbitration and selection for a given command
914+ * @instance: the Scsi_Host instance
915+ * @cmd: the scsi_cmnd to execute
912916 *
913− * Inputs : instance - instantiation of the 5380 driver on which this
914− * target lives, cmd - SCSI command to execute.
917+ * This routine establishes an I_T_L nexus for a SCSI command. This involves
918+ * ARBITRATION, SELECTION and MESSAGE OUT phases and an IDENTIFY message.
915919 *
916− * Returns cmd if selection failed but should be retried,
917− * NULL if selection failed and should not be retried, or
918− * NULL if selection succeeded (hostdata->connected == cmd).
920+ * Returns true if the operation should be retried.
921+ * Returns false if it should not be retried.
919922 *
920923 * Side effects :
921924 * 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
923926 * SELECT_ENABLE will be set appropriately, the NCR5380
924927 * will cease to drive any SCSI bus signals.
925928 *
926− * If successful : I_T_L or I_T_L_Q nexus will be established,
927− * instance->connected will be set to cmd.
929+ * If successful : the I_T_L nexus will be established, and
930+ * hostdata->connected will be set to cmd.
928931 * SELECT interrupt will be disabled.
929932 *
930933 * If failed (no target) : cmd->scsi_done() will be called, and the
931934 * cmd->result host byte set to DID_BAD_TARGET.
932935 */
933936
934−static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,
935− struct scsi_cmnd *cmd)
937+static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd)
936938 __releases(&hostdata->lock) __acquires(&hostdata->lock)
937939 {
938940 struct NCR5380_hostdata *hostdata = shost_priv(instance);
@@ -940,6 +942,9 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 1 unmodified line
940942 unsigned char *data;
941943 int len;
942944 int err;
945+ bool ret = true;
946+ bool can_disconnect = instance->irq != NO_IRQ &&
947+ cmd->cmnd[0] != REQUEST_SENSE;
943948
944949 NCR5380_dprint(NDEBUG_ARBITRATION, instance);
945950 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
948953 /*
949954 * Arbitration and selection phases are slow and involve dropping the
950955 * lock, so we have to watch out for EH. An exception handler may
951− * change 'selecting' to NULL. This function will then return NULL
956+ * change 'selecting' to NULL. This function will then return false
952957 * so that the caller will forget about 'cmd'. (During information
953958 * transfer phases, EH may change 'connected' to NULL.)
954959 */
@@ -984,7 +989,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 29 unmodified lines
984989 if (!hostdata->selecting) {
985990 /* Command was aborted */
986991 NCR5380_write(MODE_REG, MR_BASE);
987− goto out;
992+ return false;
988993 }
989994 if (err < 0) {
990995 NCR5380_write(MODE_REG, MR_BASE);
@@ -1033,7 +1038,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 42 unmodified lines
10331038 if (!hostdata->selecting) {
10341039 NCR5380_write(MODE_REG, MR_BASE);
10351040 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1036− goto out;
1041+ return false;
10371042 }
10381043
10391044 dsprintk(NDEBUG_ARBITRATION, instance, "won arbitration\n");
@@ -1116,13 +1121,16 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 76 unmodified lines
11161121 spin_lock_irq(&hostdata->lock);
11171122 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
11181123 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
1124+
11191125 /* Can't touch cmd if it has been reclaimed by the scsi ML */
1120− if (hostdata->selecting) {
1121− cmd->result = DID_BAD_TARGET << 16;
1122− complete_cmd(instance, cmd);
1123− dsprintk(NDEBUG_SELECTION, instance, "target did not respond within 250ms\n");
1124− cmd = NULL;
1125− }
1126+ if (!hostdata->selecting)
1127+ return false;
1128+
1129+ cmd->result = DID_BAD_TARGET << 16;
1130+ complete_cmd(instance, cmd);
1131+ dsprintk(NDEBUG_SELECTION, instance,
1132+ "target did not respond within 250ms\n");
1133+ ret = false;
11261134 goto out;
11271135 }
11281136
@@ -1155,12 +1163,12 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 26 unmodified lines
11551163 }
11561164 if (!hostdata->selecting) {
11571165 do_abort(instance);
1158− goto out;
1166+ return false;
11591167 }
11601168
11611169 dsprintk(NDEBUG_SELECTION, instance, "target %d selected, going into MESSAGE OUT phase.\n",
11621170 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);
11641172
11651173 len = 1;
11661174 data = tmp;
@@ -1171,7 +1179,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 4 unmodified lines
11711179 cmd->result = DID_ERROR << 16;
11721180 complete_cmd(instance, cmd);
11731181 dsprintk(NDEBUG_SELECTION, instance, "IDENTIFY message transfer failed\n");
1174− cmd = NULL;
1182+ ret = false;
11751183 goto out;
11761184 }
11771185
@@ -1186,13 +1194,13 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, · 8 unmodified lines
11861194
11871195 initialize_SCp(cmd);
11881196
1189− cmd = NULL;
1197+ ret = false;
11901198
11911199 out:
11921200 if (!hostdata->selecting)
11931201 return NULL;
11941202 hostdata->selecting = NULL;
1195− return cmd;
1203+ return ret;
11961204 }
11971205
11981206 /*
@@ -1711,6 +1719,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) · 512 unmodified lines
17111719 cmd->result = DID_ERROR << 16;
17121720 complete_cmd(instance, cmd);
17131721 hostdata->connected = NULL;
1722+ hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
17141723 return;
17151724 #endif
17161725 case PHASE_DATAIN:
@@ -1793,6 +1802,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) · 76 unmodified lines
17931802 cmd, scmd_id(cmd), cmd->device->lun);
17941803
17951804 hostdata->connected = NULL;
1805+ hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
17961806
17971807 cmd->result &= ~0xffff;
17981808 cmd->result |= cmd->SCp.Status;
@@ -1951,6 +1961,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) · 152 unmodified lines
19511961 NCR5380_transfer_pio(instance, &phase, &len, &data);
19521962 if (msgout == ABORT) {
19531963 hostdata->connected = NULL;
1964+ hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
19541965 cmd->result = DID_ERROR << 16;
19551966 complete_cmd(instance, cmd);
19561967 maybe_release_dma_irq(instance);
@@ -2014,8 +2025,11 @@ static void NCR5380_reselect(struct Scsi_Host *instance) · 57 unmodified lines
20142025 NCR5380_write(MODE_REG, MR_BASE);
20152026
20162027 target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask);
2017−
2018− dsprintk(NDEBUG_RESELECTION, instance, "reselect\n");
2028+ if (!target_mask || target_mask & (target_mask - 1)) {
2029+ shost_printk(KERN_WARNING, instance,
2030+ "reselect: bad target_mask 0x%02x\n", target_mask);
2031+ return;
2032+ }
20192033
20202034 /*
20212035 * 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
20292043 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY);
20302044 if (NCR5380_poll_politely(hostdata,
20312045 STATUS_REG, SR_SEL, 0, 2 * HZ) < 0) {
2046+ shost_printk(KERN_ERR, instance, "reselect: !SEL timeout\n");
20322047 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
20332048 return;
20342049 }
@@ -2040,6 +2055,10 @@ static void NCR5380_reselect(struct Scsi_Host *instance) · 5 unmodified lines
20402055
20412056 if (NCR5380_poll_politely(hostdata,
20422057 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");
20432062 do_abort(instance);
20442063 return;
20452064 }
@@ -2101,13 +2120,16 @@ static void NCR5380_reselect(struct Scsi_Host *instance) · 55 unmodified lines
21012120 dsprintk(NDEBUG_RESELECTION | NDEBUG_QUEUES, instance,
21022121 "reselect: removed %p from disconnected queue\n", tmp);
21032122 } else {
2123+ int target = ffs(target_mask) - 1;
2124+
21042125 shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d not in disconnected queue.\n",
21052126 target_mask, lun);
21062127 /*
21072128 * Since we have an established nexus that we can't do anything
21082129 * with, we must abort it.
21092130 */
2110− do_abort(instance);
2131+ if (do_abort(instance) == 0)
2132+ hostdata->busy[target] &= ~(1 << lun);
21112133 return;
21122134 }
21132135
@@ -2272,15 +2294,16 @@ static int NCR5380_abort(struct scsi_cmnd *cmd) · 158 unmodified lines
22722294 if (list_del_cmd(&hostdata->autosense, cmd)) {
22732295 dsprintk(NDEBUG_ABORT, instance,
22742296 "abort: removed %p from sense queue\n", cmd);
2275− set_host_byte(cmd, DID_ERROR);
22762297 complete_cmd(instance, cmd);
22772298 }
22782299
22792300 out:
22802301 if (result == FAILED)
22812302 dsprintk(NDEBUG_ABORT, instance, "abort: failed to abort %p\n", cmd);
2282− else
2303+ else {
2304+ hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
22832305 dsprintk(NDEBUG_ABORT, instance, "abort: successfully aborted %p\n", cmd);
2306+ }
22842307
22852308 queue_work(hostdata->work_q, &hostdata->main_task);
22862309 maybe_release_dma_irq(instance);
@@ -2290,31 +2313,12 @@ out: · 3 unmodified lines
22902313 }
22912314
22922315
2293−/**
2294− * NCR5380_host_reset - reset the SCSI host
2295− * @cmd: SCSI command undergoing EH
2296− *
2297− * Returns SUCCESS
2298− */
2299−
2300−static int NCR5380_host_reset(struct scsi_cmnd *cmd)
2316+static void bus_reset_cleanup(struct Scsi_Host *instance)
23012317 {
2302− struct Scsi_Host *instance = cmd->device->host;
23032318 struct NCR5380_hostdata *hostdata = shost_priv(instance);
23042319 int i;
2305− unsigned long flags;
23062320 struct NCR5380_cmd *ncmd;
23072321
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−
23182322 /* reset NCR registers */
23192323 NCR5380_write(MODE_REG, MR_BASE);
23202324 NCR5380_write(TARGET_COMMAND_REG, 0);
@@ -2326,11 +2330,6 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd) · 5 unmodified lines
23262330 * commands!
23272331 */
23282332
2329− if (list_del_cmd(&hostdata->unissued, cmd)) {
2330− cmd->result = DID_RESET << 16;
2331− cmd->scsi_done(cmd);
2332− }
2333−
23342333 if (hostdata->selecting) {
23352334 hostdata->selecting->result = DID_RESET << 16;
23362335 complete_cmd(instance, hostdata->selecting);
@@ -2348,7 +2347,6 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd) · 11 unmodified lines
23482347 list_for_each_entry(ncmd, &hostdata->autosense, list) {
23492348 struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);
23502349
2351− set_host_byte(cmd, DID_RESET);
23522350 cmd->scsi_done(cmd);
23532351 }
23542352 INIT_LIST_HEAD(&hostdata->autosense);
@@ -2365,6 +2363,41 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd) · 10 unmodified lines
23652363
23662364 queue_work(hostdata->work_q, &hostdata->main_task);
23672365 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+
2375+static 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+
23682401 spin_unlock_irqrestore(&hostdata->lock, flags);
23692402
23702403 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
275275 static void NCR5380_main(struct work_struct *work);
276276 static const char *NCR5380_info(struct Scsi_Host *instance);
277277 static void NCR5380_reselect(struct Scsi_Host *instance);
278−static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *, struct scsi_cmnd *);
278+static bool NCR5380_select(struct Scsi_Host *, struct scsi_cmnd *);
279279 static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
280280 static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
281281 static 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
10941094
10951095 if (pci_enable_device(pdev))
10961096 goto out;
1097− if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
1097+ if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
10981098 printk(KERN_WARNING "Unable to set 32bit DMA "
10991099 "on inia100 adapter, ignoring.\n");
11001100 goto out_disable_device;
@@ -1124,7 +1124,8 @@ static int inia100_probe_one(struct pci_dev *pdev, · 23 unmodified lines
11241124
11251125 /* Get total memory needed for SCB */
11261126 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);
11281129 if (!host->scb_virt) {
11291130 printk("inia100: SCB memory allocation error\n");
11301131 goto out_host_put;
@@ -1132,7 +1133,8 @@ static int inia100_probe_one(struct pci_dev *pdev, · 1 unmodified line
11321133
11331134 /* Get total memory needed for ESCB */
11341135 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);
11361138 if (!host->escb_virt) {
11371139 printk("inia100: ESCB memory allocation error\n");
11381140 goto out_free_scb_array;
@@ -1177,10 +1179,12 @@ static int inia100_probe_one(struct pci_dev *pdev, · 38 unmodified lines
11771179 out_free_irq:
11781180 free_irq(shost->irq, shost);
11791181 out_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),
11811184 host->escb_virt, host->escb_phys);
11821185 out_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),
11841188 host->scb_virt, host->scb_phys);
11851189 out_host_put:
11861190 scsi_host_put(shost);
@@ -1200,9 +1204,11 @@ static void inia100_remove_one(struct pci_dev *pdev) · 13 unmodified lines
12001204 scsi_remove_host(shost);
12011205
12021206 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),
12041209 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),
12061212 host->scb_virt, host->scb_phys);
12071213 release_region(shost->io_port, 256);
12081214
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
34803480
34813481 static void aac_srb_callback(void *context, struct fib * fibptr)
34823482 {
3483− struct aac_dev *dev;
34843483 struct aac_srb_reply *srbreply;
34853484 struct scsi_cmnd *scsicmd;
34863485
@@ -3491,8 +3490,6 @@ static void aac_srb_callback(void *context, struct fib * fibptr) · 4 unmodified lines
34913490
34923491 BUG_ON(fibptr == NULL);
34933492
3494− dev = fibptr->dev;
3495−
34963493 srbreply = (struct aac_srb_reply *) fib_data(fibptr);
34973494
34983495 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
39213918
39223919 static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *psg)
39233920 {
3924− struct aac_dev *dev;
39253921 unsigned long byte_count = 0;
39263922 int nseg;
39273923 struct scatterlist *sg;
39283924 int i;
39293925
3930− dev = (struct aac_dev *)scsicmd->device->host->hostdata;
39313926 // Get rid of old data
39323927 psg->count = 0;
39333928 psg->sg[0].addr = 0;
@@ -3963,14 +3958,12 @@ static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *psg) · 29 unmodified lines
39633958
39643959 static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg)
39653960 {
3966− struct aac_dev *dev;
39673961 unsigned long byte_count = 0;
39683962 u64 addr;
39693963 int nseg;
39703964 struct scatterlist *sg;
39713965 int i;
39723966
3973− dev = (struct aac_dev *)scsicmd->device->host->hostdata;
39743967 // Get rid of old data
39753968 psg->count = 0;
39763969 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
25862586 void aac_free_irq(struct aac_dev *dev)
25872587 {
25882588 int i;
2589− int cpu;
25902589
2591− cpu = cpumask_first(cpu_online_mask);
25922590 if (aac_is_src(dev)) {
25932591 if (dev->max_msix > 1) {
25942592 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
59495949 static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
59505950 {
59515951 struct asc_board *boardp = adv_dvc_varp->drv_ptr;
5952− u32 srb_tag;
59535952 adv_req_t *reqp;
59545953 adv_sgblk_t *sgblkp;
59555954 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
59655964 * completed. The adv_req_t structure actually contains the
59665965 * completed ADV_SCSI_REQ_Q structure.
59675966 */
5968− srb_tag = le32_to_cpu(scsiqp->srb_tag);
59695967 scp = scsi_host_find_tag(boardp->shost, scsiqp->srb_tag);
59705968
59715969 ASC_DBG(1, "scp 0x%p\n", scp);
@@ -6448,7 +6446,7 @@ static void AscIsrChipHalted(ASC_DVC_VAR *asc_dvc) · 476 unmodified lines
64486446 sdtr_data =
64496447 AscCalSDTRData(asc_dvc, ext_msg.xfer_period,
64506448 ext_msg.req_ack_offset);
6451− if ((sdtr_data == 0xFF)) {
6449+ if (sdtr_data == 0xFF) {
64526450
64536451 q_cntl |= QC_MSG_OUT;
64546452 asc_dvc->init_sdtr &= ~target_id;
drivers/scsi/aic7xxx/aic7770.c+0−6
@@ -42,15 +42,9 @@ · 41 unmodified lines
4242 * $FreeBSD$
4343 */
4444
45−#ifdef __linux__
4645 #include "aic7xxx_osm.h"
4746 #include "aic7xxx_inline.h"
4847 #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
5448
5549 #define ID_AIC7770 0x04907770
5650 #define ID_AHA_274x 0x04907771
drivers/scsi/aic7xxx/aic79xx.h+0−6
@@ -607,9 +607,6 @@ struct scb { · 606 unmodified lines
607607 ahd_io_ctx_t io_ctx;
608608 struct ahd_softc *ahd_softc;
609609 scb_flag flags;
610−#ifndef __linux__
611− bus_dmamap_t dmamap;
612−#endif
613610 struct scb_platform_data *platform_data;
614611 struct map_node *hscb_map;
615612 struct map_node *sg_map;
@@ -1056,9 +1053,6 @@ struct ahd_completion · 440 unmodified lines
10561053 struct ahd_softc {
10571054 bus_space_tag_t tags[2];
10581055 bus_space_handle_t bshs[2];
1059−#ifndef __linux__
1060− bus_dma_tag_t buffer_dmat; /* dmat for buffer I/O */
1061−#endif
10621056 struct scb_data scb_data;
10631057
10641058 struct hardware_scb *next_queued_hscb;
drivers/scsi/aic7xxx/aic79xx_core.c+0−44
@@ -40,16 +40,9 @@ · 39 unmodified lines
4040 * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#250 $
4141 */
4242
43−#ifdef __linux__
4443 #include "aic79xx_osm.h"
4544 #include "aic79xx_inline.h"
4645 #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−
5346
5447 /***************************** Lookup Tables **********************************/
5548 static const char *const ahd_chip_names[] =
@@ -59,7 +52,6 @@ static const char *const ahd_chip_names[] = · 3 unmodified lines
5952 "aic7902",
6053 "aic7901A"
6154 };
62−static const u_int num_chip_names = ARRAY_SIZE(ahd_chip_names);
6355
6456 /*
6557 * Hardware error codes.
@@ -6172,17 +6164,11 @@ ahd_free(struct ahd_softc *ahd) · 6106 unmodified lines
61726164 case 2:
61736165 ahd_dma_tag_destroy(ahd, ahd->shared_data_dmat);
61746166 case 1:
6175−#ifndef __linux__
6176− ahd_dma_tag_destroy(ahd, ahd->buffer_dmat);
6177−#endif
61786167 break;
61796168 case 0:
61806169 break;
61816170 }
61826171
6183−#ifndef __linux__
6184− ahd_dma_tag_destroy(ahd, ahd->parent_dmat);
6185−#endif
61866172 ahd_platform_free(ahd);
61876173 ahd_fini_scbdata(ahd);
61886174 for (i = 0; i < AHD_NUM_TARGETS; i++) {
@@ -6934,9 +6920,6 @@ ahd_alloc_scbs(struct ahd_softc *ahd) · 745 unmodified lines
69346920 for (i = 0; i < newcount; i++) {
69356921 struct scb_platform_data *pdata;
69366922 u_int col_tag;
6937−#ifndef __linux__
6938− int error;
6939−#endif
69406923
69416924 next_scb = kmalloc(sizeof(*next_scb), GFP_ATOMIC);
69426925 if (next_scb == NULL)
@@ -6970,15 +6953,6 @@ ahd_alloc_scbs(struct ahd_softc *ahd) · 27 unmodified lines
69706953 next_scb->sg_list_busaddr += sizeof(struct ahd_dma_seg);
69716954 next_scb->ahd_softc = ahd;
69726955 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
69826956 next_scb->hscb->tag = ahd_htole16(scb_data->numscbs);
69836957 col_tag = scb_data->numscbs ^ 0x100;
69846958 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
70917065 if ((AHD_TMODE_ENABLE & (0x1 << ahd->unit)) == 0)
70927066 ahd->features &= ~AHD_TARGETMODE;
70937067
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−
71127068 ahd->init_level++;
71137069
71147070 /*
drivers/scsi/aic7xxx/aic79xx_pci.c+0−8
@@ -41,14 +41,8 @@ · 40 unmodified lines
4141 * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#92 $
4242 */
4343
44−#ifdef __linux__
4544 #include "aic79xx_osm.h"
4645 #include "aic79xx_inline.h"
47−#else
48−#include <dev/aic7xxx/aic79xx_osm.h>
49−#include <dev/aic7xxx/aic79xx_inline.h>
50−#endif
51−
5246 #include "aic79xx_pci.h"
5347
5448 static inline uint64_t
@@ -294,13 +288,11 @@ ahd_find_pci_device(ahd_dev_softc_t pci) · 239 unmodified lines
294288 int
295289 ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry)
296290 {
297− struct scb_data *shared_scb_data;
298291 u_int command;
299292 uint32_t devconfig;
300293 uint16_t subvendor;
301294 int error;
302295
303− shared_scb_data = NULL;
304296 ahd->description = entry->name;
305297 /*
306298 * Record if this is an HP board.
drivers/scsi/aic7xxx/aic7xxx.h+0−6
@@ -568,9 +568,6 @@ struct scb { · 567 unmodified lines
568568 ahc_io_ctx_t io_ctx;
569569 struct ahc_softc *ahc_softc;
570570 scb_flag flags;
571−#ifndef __linux__
572− bus_dmamap_t dmamap;
573−#endif
574571 struct scb_platform_data *platform_data;
575572 struct sg_map_node *sg_map;
576573 struct ahc_dma_seg *sg_list;
@@ -906,9 +903,6 @@ typedef void ahc_callback_t (void *); · 329 unmodified lines
906903 struct ahc_softc {
907904 bus_space_tag_t tag;
908905 bus_space_handle_t bsh;
909−#ifndef __linux__
910− bus_dma_tag_t buffer_dmat; /* dmat for buffer I/O */
911−#endif
912906 struct scb_data *scb_data;
913907
914908 struct scb *next_queued_scb;
drivers/scsi/aic7xxx/aic7xxx_93cx6.c+0−6
@@ -64,15 +64,9 @@ · 63 unmodified lines
6464 * bit to be sent from the chip.
6565 */
6666
67−#ifdef __linux__
6867 #include "aic7xxx_osm.h"
6968 #include "aic7xxx_inline.h"
7069 #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
7670
7771 /*
7872 * 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
4040 * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#155 $
4141 */
4242
43−#ifdef __linux__
4443 #include "aic7xxx_osm.h"
4544 #include "aic7xxx_inline.h"
4645 #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
5246
5347 /***************************** Lookup Tables **********************************/
5448 static const char *const ahc_chip_names[] = {
@@ -67,7 +61,6 @@ static const char *const ahc_chip_names[] = { · 12 unmodified lines
6761 "aic7892",
6862 "aic7899"
6963 };
70−static const u_int num_chip_names = ARRAY_SIZE(ahc_chip_names);
7164
7265 /*
7366 * Hardware error codes.
@@ -4509,17 +4502,11 @@ ahc_free(struct ahc_softc *ahc) · 4435 unmodified lines
45094502 case 2:
45104503 ahc_dma_tag_destroy(ahc, ahc->shared_data_dmat);
45114504 case 1:
4512−#ifndef __linux__
4513− ahc_dma_tag_destroy(ahc, ahc->buffer_dmat);
4514−#endif
45154505 break;
45164506 case 0:
45174507 break;
45184508 }
45194509
4520−#ifndef __linux__
4521− ahc_dma_tag_destroy(ahc, ahc->parent_dmat);
4522−#endif
45234510 ahc_platform_free(ahc);
45244511 ahc_fini_scbdata(ahc);
45254512 for (i = 0; i < AHC_NUM_TARGETS; i++) {
@@ -5005,9 +4992,7 @@ ahc_alloc_scbs(struct ahc_softc *ahc) · 479 unmodified lines
50054992 newcount = min(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs));
50064993 for (i = 0; i < newcount; i++) {
50074994 struct scb_platform_data *pdata;
5008−#ifndef __linux__
5009− int error;
5010−#endif
4995+
50114996 pdata = kmalloc(sizeof(*pdata), GFP_ATOMIC);
50124997 if (pdata == NULL)
50134998 break;
@@ -5021,12 +5006,6 @@ ahc_alloc_scbs(struct ahc_softc *ahc) · 7 unmodified lines
50215006 next_scb->sg_list_phys = physaddr + sizeof(struct ahc_dma_seg);
50225007 next_scb->ahc_softc = ahc;
50235008 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
50305009 next_scb->hscb = &scb_data->hscbs[scb_data->numscbs];
50315010 next_scb->hscb->tag = ahc->scb_data->numscbs;
50325011 SLIST_INSERT_HEAD(&ahc->scb_data->free_scbs,
@@ -5325,24 +5304,6 @@ ahc_init(struct ahc_softc *ahc) · 292 unmodified lines
53255304 if ((AHC_TMODE_ENABLE & (0x1 << ahc->unit)) == 0)
53265305 ahc->features &= ~AHC_TARGETMODE;
53275306
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−
53465307 ahc->init_level++;
53475308
53485309 /*
drivers/scsi/aic7xxx/aic7xxx_pci.c+0−7
@@ -42,16 +42,9 @@ · 41 unmodified lines
4242 * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#79 $
4343 */
4444
45−#ifdef __linux__
4645 #include "aic7xxx_osm.h"
4746 #include "aic7xxx_inline.h"
4847 #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−
5548 #include "aic7xxx_pci.h"
5649
5750 static inline uint64_t
drivers/scsi/aic7xxx/aicasm/aicasm.h+0−4
@@ -42,11 +42,7 @@ · 41 unmodified lines
4242 * $FreeBSD$
4343 */
4444
45−#ifdef __linux__
4645 #include "../queue.h"
47−#else
48−#include <sys/queue.h>
49−#endif
5046
5147 #ifndef TRUE
5248 #define TRUE 1
drivers/scsi/aic7xxx/aicasm/aicasm_gram.y+0−4
@@ -52,11 +52,7 @@ · 51 unmodified lines
5252 #include <string.h>
5353 #include <sysexits.h>
5454
55−#ifdef __linux__
5655 #include "../queue.h"
57−#else
58−#include <sys/queue.h>
59−#endif
6056
6157 #include "aicasm.h"
6258 #include "aicasm_symbol.h"
drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y+0−4
@@ -52,11 +52,7 @@ · 51 unmodified lines
5252 #include <string.h>
5353 #include <sysexits.h>
5454
55−#ifdef __linux__
5655 #include "../queue.h"
57−#else
58−#include <sys/queue.h>
59−#endif
6056
6157 #include "aicasm.h"
6258 #include "aicasm_symbol.h"
drivers/scsi/aic7xxx/aicasm/aicasm_macro_scan.l+0−4
@@ -51,11 +51,7 @@ · 50 unmodified lines
5151 #include <stdio.h>
5252 #include <string.h>
5353 #include <sysexits.h>
54−#ifdef __linux__
5554 #include "../queue.h"
56−#else
57−#include <sys/queue.h>
58−#endif
5955
6056 #include "aicasm.h"
6157 #include "aicasm_symbol.h"
drivers/scsi/aic7xxx/aicasm/aicasm_scan.l+0−4
@@ -51,11 +51,7 @@ · 50 unmodified lines
5151 #include <stdio.h>
5252 #include <string.h>
5353 #include <sysexits.h>
54−#ifdef __linux__
5554 #include "../queue.h"
56−#else
57−#include <sys/queue.h>
58−#endif
5955
6056 #include "aicasm.h"
6157 #include "aicasm_symbol.h"
drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c+0−4
@@ -44,11 +44,7 @@ · 43 unmodified lines
4444
4545 #include <sys/types.h>
4646
47−#ifdef __linux__
4847 #include "aicdb.h"
49−#else
50−#include <db.h>
51−#endif
5248 #include <fcntl.h>
5349 #include <inttypes.h>
5450 #include <regex.h>
drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h+0−4
@@ -42,11 +42,7 @@ · 41 unmodified lines
4242 * $FreeBSD$
4343 */
4444
45−#ifdef __linux__
4645 #include "../queue.h"
47−#else
48−#include <sys/queue.h>
49−#endif
5046
5147 typedef enum {
5248 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
771771 goto Err_remove;
772772
773773 err = -ENODEV;
774− if (!pci_set_dma_mask(dev, DMA_BIT_MASK(64))
775− && !pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(64)))
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 {
774+ if (dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)) ||
775+ dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32))) {
781776 asd_printk("no suitable DMA mask for %s\n", pci_name(dev));
782777 goto Err_remove;
783778 }
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
724724 switch (pd->max_sas_lrate) {
725725 case SAS_LINK_RATE_6_0_GBPS:
726726 *speed_mask &= ~SAS_SPEED_60_DIS;
727+ /* fall through*/
727728 default:
728729 case SAS_LINK_RATE_3_0_GBPS:
729730 *speed_mask &= ~SAS_SPEED_30_DIS;
731+ /* fall through*/
730732 case SAS_LINK_RATE_1_5_GBPS:
731733 *speed_mask &= ~SAS_SPEED_15_DIS;
732734 }
@@ -734,6 +736,7 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd) · 1 unmodified line
734736 switch (pd->min_sas_lrate) {
735737 case SAS_LINK_RATE_6_0_GBPS:
736738 *speed_mask |= SAS_SPEED_30_DIS;
739+ /* fall through*/
737740 case SAS_LINK_RATE_3_0_GBPS:
738741 *speed_mask |= SAS_SPEED_15_DIS;
739742 default:
@@ -745,6 +748,7 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd) · 5 unmodified lines
745748 switch (pd->max_sata_lrate) {
746749 case SAS_LINK_RATE_3_0_GBPS:
747750 *speed_mask &= ~SATA_SPEED_30_DIS;
751+ /* fall through*/
748752 default:
749753 case SAS_LINK_RATE_1_5_GBPS:
750754 *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
803807
804808 /* link reset retries, this should be nominal */
805809 control_phy->link_reset_retries = 10;
810+ /* fall through */
806811
807812 case RELEASE_SPINUP_HOLD: /* 0x02 */
808813 /* 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
4242 spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags);
4343 }
4444
45−/* PCI_DMA_... to our direction translation.
45+/* DMA_... to our direction translation.
4646 */
4747 static const u8 data_dir_flags[] = {
48− [PCI_DMA_BIDIRECTIONAL] = DATA_DIR_BYRECIPIENT, /* UNSPECIFIED */
49− [PCI_DMA_TODEVICE] = DATA_DIR_OUT, /* OUTBOUND */
50− [PCI_DMA_FROMDEVICE] = DATA_DIR_IN, /* INBOUND */
51− [PCI_DMA_NONE] = DATA_DIR_NONE, /* NO TRANSFER */
48+ [DMA_BIDIRECTIONAL] = DATA_DIR_BYRECIPIENT, /* UNSPECIFIED */
49+ [DMA_TO_DEVICE] = DATA_DIR_OUT, /* OUTBOUND */
50+ [DMA_FROM_DEVICE] = DATA_DIR_IN, /* INBOUND */
51+ [DMA_NONE] = DATA_DIR_NONE, /* NO TRANSFER */
5252 };
5353
5454 static int asd_map_scatterlist(struct sas_task *task,
@@ -60,12 +60,12 @@ static int asd_map_scatterlist(struct sas_task *task, · 5 unmodified lines
6060 struct scatterlist *sc;
6161 int num_sg, res;
6262
63− if (task->data_dir == PCI_DMA_NONE)
63+ if (task->data_dir == DMA_NONE)
6464 return 0;
6565
6666 if (task->num_scatter == 0) {
6767 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,
6969 task->total_xfer_len,
7070 task->data_dir);
7171 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
7979 if (sas_protocol_ata(task->task_proto))
8080 num_sg = task->num_scatter;
8181 else
82− num_sg = pci_map_sg(asd_ha->pcidev, task->scatter,
82+ num_sg = dma_map_sg(&asd_ha->pcidev->dev, task->scatter,
8383 task->num_scatter, task->data_dir);
8484 if (num_sg == 0)
8585 return -ENOMEM;
@@ -126,8 +126,8 @@ static int asd_map_scatterlist(struct sas_task *task, · 40 unmodified lines
126126 return 0;
127127 err_unmap:
128128 if (sas_protocol_ata(task->task_proto))
129− pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter,
130− task->data_dir);
129+ dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter,
130+ task->num_scatter, task->data_dir);
131131 return res;
132132 }
133133
@@ -136,21 +136,21 @@ static void asd_unmap_scatterlist(struct asd_ascb *ascb) · 2 unmodified lines
136136 struct asd_ha_struct *asd_ha = ascb->ha;
137137 struct sas_task *task = ascb->uldd_task;
138138
139− if (task->data_dir == PCI_DMA_NONE)
139+ if (task->data_dir == DMA_NONE)
140140 return;
141141
142142 if (task->num_scatter == 0) {
143143 dma_addr_t dma = (dma_addr_t)
144144 le64_to_cpu(ascb->scb->ssp_task.sg_element[0].bus_addr);
145− pci_unmap_single(ascb->ha->pcidev, dma, task->total_xfer_len,
146− task->data_dir);
145+ dma_unmap_single(&ascb->ha->pcidev->dev, dma,
146+ task->total_xfer_len, task->data_dir);
147147 return;
148148 }
149149
150150 asd_free_coherent(asd_ha, ascb->sg_arr);
151151 if (task->task_proto != SAS_PROTOCOL_STP)
152− pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter,
153− task->data_dir);
152+ dma_unmap_sg(&asd_ha->pcidev->dev, task->scatter,
153+ task->num_scatter, task->data_dir);
154154 }
155155
156156 /* ---------- Task complete tasklet ---------- */
@@ -436,10 +436,10 @@ static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task, · 279 unmodified lines
436436 struct domain_device *dev = task->dev;
437437 struct scb *scb;
438438
439− pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_req, 1,
440− PCI_DMA_TODEVICE);
441− pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_resp, 1,
442− PCI_DMA_FROMDEVICE);
439+ dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_req, 1,
440+ DMA_TO_DEVICE);
441+ dma_map_sg(&asd_ha->pcidev->dev, &task->smp_task.smp_resp, 1,
442+ DMA_FROM_DEVICE);
443443
444444 scb = ascb->scb;
445445
@@ -471,10 +471,10 @@ static void asd_unbuild_smp_ascb(struct asd_ascb *a) · 25 unmodified lines
471471 struct sas_task *task = a->uldd_task;
472472
473473 BUG_ON(!task);
474− pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_req, 1,
475− PCI_DMA_TODEVICE);
476− pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_resp, 1,
477− PCI_DMA_FROMDEVICE);
474+ dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_req, 1,
475+ DMA_TO_DEVICE);
476+ dma_unmap_sg(&a->ha->pcidev->dev, &task->smp_task.smp_resp, 1,
477+ DMA_FROM_DEVICE);
478478 }
479479
480480 /* ---------- SSP ---------- */
drivers/scsi/am53c974.c+12−42
@@ -96,9 +96,7 @@ static void pci_esp_dma_drain(struct esp *esp); · 95 unmodified lines
9696
9797 static inline struct pci_esp_priv *pci_esp_get_priv(struct esp *esp)
9898 {
99− struct pci_dev *pdev = esp->dev;
100−
101− return pci_get_drvdata(pdev);
99+ return dev_get_drvdata(esp->dev);
102100 }
103101
104102 static 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
116114 return iowrite32(val, esp->regs + (reg * 4UL));
117115 }
118116
119−static 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−
125−static 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−
131−static 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−
137−static 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−
143117 static int pci_esp_irq_pending(struct esp *esp)
144118 {
145119 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
295269 static const struct esp_driver_ops pci_esp_ops = {
296270 .esp_write8 = pci_esp_write8,
297271 .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,
302272 .irq_pending = pci_esp_irq_pending,
303273 .reset_dma = pci_esp_reset_dma,
304274 .dma_drain = pci_esp_dma_drain,
@@ -375,18 +345,18 @@ static void dc390_read_eeprom(struct pci_dev *pdev, u16 *ptr) · 70 unmodified lines
375345
376346 static void dc390_check_eeprom(struct esp *esp)
377347 {
348+ struct pci_dev *pdev = to_pci_dev(esp->dev);
378349 u8 EEbuf[128];
379350 u16 *ptr = (u16 *)EEbuf, wval = 0;
380351 int i;
381352
382− dc390_read_eeprom((struct pci_dev *)esp->dev, ptr);
353+ dc390_read_eeprom(pdev, ptr);
383354
384355 for (i = 0; i < DC390_EEPROM_LEN; i++, ptr++)
385356 wval += *ptr;
386357
387358 /* no Tekram EEprom found */
388359 if (wval != 0x1234) {
389− struct pci_dev *pdev = esp->dev;
390360 dev_printk(KERN_INFO, &pdev->dev,
391361 "No valid Tekram EEprom found\n");
392362 return;
@@ -411,7 +381,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev, · 18 unmodified lines
411381 return -ENODEV;
412382 }
413383
414− if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
384+ if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
415385 dev_printk(KERN_INFO, &pdev->dev,
416386 "failed to set 32bit DMA mask\n");
417387 goto fail_disable_device;
@@ -435,7 +405,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev, · 17 unmodified lines
435405
436406 esp = shost_priv(shost);
437407 esp->host = shost;
438− esp->dev = pdev;
408+ esp->dev = &pdev->dev;
439409 esp->ops = &pci_esp_ops;
440410 /*
441411 * 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
467437
468438 pci_set_master(pdev);
469439
470− esp->command_block = pci_alloc_consistent(pdev, 16,
471− &esp->command_block_dma);
440+ esp->command_block = dma_alloc_coherent(&pdev->dev, 16,
441+ &esp->command_block_dma, GFP_KERNEL);
472442 if (!esp->command_block) {
473443 dev_printk(KERN_ERR, &pdev->dev,
474444 "failed to allocate command block\n");
@@ -498,7 +468,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev, · 23 unmodified lines
498468 /* Assume 40MHz clock */
499469 esp->cfreq = 40000000;
500470
501− err = scsi_esp_register(esp, &pdev->dev);
471+ err = scsi_esp_register(esp);
502472 if (err)
503473 goto fail_free_irq;
504474
@@ -508,8 +478,8 @@ fail_free_irq: · 3 unmodified lines
508478 free_irq(pdev->irq, esp);
509479 fail_unmap_command_block:
510480 pci_set_drvdata(pdev, NULL);
511− pci_free_consistent(pdev, 16, esp->command_block,
512− esp->command_block_dma);
481+ dma_free_coherent(&pdev->dev, 16, esp->command_block,
482+ esp->command_block_dma);
513483 fail_unmap_regs:
514484 pci_iounmap(pdev, esp->regs);
515485 fail_release_regions:
@@ -532,8 +502,8 @@ static void pci_esp_remove_one(struct pci_dev *pdev) · 16 unmodified lines
532502 scsi_esp_unregister(esp);
533503 free_irq(pdev->irq, esp);
534504 pci_set_drvdata(pdev, NULL);
535− pci_free_consistent(pdev, 16, esp->command_block,
536− esp->command_block_dma);
505+ dma_free_coherent(&pdev->dev, 16, esp->command_block,
506+ esp->command_block_dma);
537507 pci_iounmap(pdev, esp->regs);
538508 pci_release_regions(pdev);
539509 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
13171317
13181318 static void arcmsr_drain_donequeue(struct AdapterControlBlock *acb, struct CommandControlBlock *pCCB, bool error)
13191319 {
1320− int id, lun;
13211320 if ((pCCB->acb != acb) || (pCCB->startdone != ARCMSR_CCB_START)) {
13221321 if (pCCB->startdone == ARCMSR_CCB_ABORTED) {
13231322 struct scsi_cmnd *abortcmd = pCCB->pcmd;
13241323 if (abortcmd) {
1325− id = abortcmd->device->id;
1326− lun = abortcmd->device->lun;
13271324 abortcmd->result |= DID_ABORT << 16;
13281325 arcmsr_ccb_complete(pCCB);
13291326 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
17981795 writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, &reg->inbound_msgaddr0);
17991796 if (!arcmsr_hbaA_wait_msgint_ready(acb)) {
18001797 printk(KERN_NOTICE
1801− "arcmsr%d: wait 'stop adapter background rebulid' timeout\n"
1798+ "arcmsr%d: wait 'stop adapter background rebuild' timeout\n"
18021799 , acb->host->host_no);
18031800 }
18041801 }
@@ -1811,7 +1808,7 @@ static void arcmsr_hbaB_stop_bgrb(struct AdapterControlBlock *acb) · 6 unmodified lines
18111808
18121809 if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
18131810 printk(KERN_NOTICE
1814− "arcmsr%d: wait 'stop adapter background rebulid' timeout\n"
1811+ "arcmsr%d: wait 'stop adapter background rebuild' timeout\n"
18151812 , acb->host->host_no);
18161813 }
18171814 }
@@ -1824,7 +1821,7 @@ static void arcmsr_hbaC_stop_bgrb(struct AdapterControlBlock *pACB) · 6 unmodified lines
18241821 writel(ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE, &reg->inbound_doorbell);
18251822 if (!arcmsr_hbaC_wait_msgint_ready(pACB)) {
18261823 printk(KERN_NOTICE
1827− "arcmsr%d: wait 'stop adapter background rebulid' timeout\n"
1824+ "arcmsr%d: wait 'stop adapter background rebuild' timeout\n"
18281825 , pACB->host->host_no);
18291826 }
18301827 return;
@@ -1837,7 +1834,7 @@ static void arcmsr_hbaD_stop_bgrb(struct AdapterControlBlock *pACB) · 6 unmodified lines
18371834 pACB->acb_flags &= ~ACB_F_MSG_START_BGRB;
18381835 writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, reg->inbound_msgaddr0);
18391836 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' "
18411838 "timeout\n", pACB->host->host_no);
18421839 }
18431840
@@ -1850,7 +1847,7 @@ static void arcmsr_hbaE_stop_bgrb(struct AdapterControlBlock *pACB) · 6 unmodified lines
18501847 pACB->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE;
18511848 writel(pACB->out_doorbell, &reg->iobound_doorbell);
18521849 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' "
18541851 "timeout\n", pACB->host->host_no);
18551852 }
18561853 }
@@ -3927,7 +3924,7 @@ static void arcmsr_hbaA_start_bgrb(struct AdapterControlBlock *acb) · 2070 unmodified lines
39273924 writel(ARCMSR_INBOUND_MESG0_START_BGRB, &reg->inbound_msgaddr0);
39283925 if (!arcmsr_hbaA_wait_msgint_ready(acb)) {
39293926 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);
39313928 }
39323929 }
39333930
@@ -3938,7 +3935,7 @@ static void arcmsr_hbaB_start_bgrb(struct AdapterControlBlock *acb) · 4 unmodified lines
39383935 writel(ARCMSR_MESSAGE_START_BGRB, reg->drv2iop_doorbell);
39393936 if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
39403937 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);
39423939 }
39433940 }
39443941
@@ -3950,7 +3947,7 @@ static void arcmsr_hbaC_start_bgrb(struct AdapterControlBlock *pACB) · 5 unmodified lines
39503947 writel(ARCMSR_HBCMU_DRV2IOP_MESSAGE_CMD_DONE, &phbcmu->inbound_doorbell);
39513948 if (!arcmsr_hbaC_wait_msgint_ready(pACB)) {
39523949 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);
39543951 }
39553952 return;
39563953 }
@@ -3963,7 +3960,7 @@ static void arcmsr_hbaD_start_bgrb(struct AdapterControlBlock *pACB) · 6 unmodified lines
39633960 writel(ARCMSR_INBOUND_MESG0_START_BGRB, pmu->inbound_msgaddr0);
39643961 if (!arcmsr_hbaD_wait_msgint_ready(pACB)) {
39653962 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);
39673964 }
39683965 }
39693966
@@ -3977,7 +3974,7 @@ static void arcmsr_hbaE_start_bgrb(struct AdapterControlBlock *pACB) · 7 unmodified lines
39773974 writel(pACB->out_doorbell, &pmu->iobound_doorbell);
39783975 if (!arcmsr_hbaE_wait_msgint_ready(pACB)) {
39793976 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);
39813978 }
39823979 }
39833980
@@ -4135,9 +4132,9 @@ static void arcmsr_hardware_reset(struct AdapterControlBlock *acb) · 151 unmodified lines
41354132 pci_read_config_byte(acb->pdev, i, &value[i]);
41364133 }
41374134 /* hardware reset signal */
4138− if ((acb->dev_id == 0x1680)) {
4135+ if (acb->dev_id == 0x1680) {
41394136 writel(ARCMSR_ARC1680_BUS_RESET, &pmuA->reserved1[0]);
4140− } else if ((acb->dev_id == 0x1880)) {
4137+ } else if (acb->dev_id == 0x1880) {
41414138 do {
41424139 count++;
41434140 writel(0xF, &pmuC->write_sequence);
@@ -4161,7 +4158,7 @@ static void arcmsr_hardware_reset(struct AdapterControlBlock *acb) · 17 unmodified lines
41614158 } while (((readl(&pmuE->host_diagnostic_3xxx) &
41624159 ARCMSR_ARC1884_DiagWrite_ENABLE) == 0) && (count < 5));
41634160 writel(ARCMSR_ARC188X_RESET_ADAPTER, &pmuE->host_diagnostic_3xxx);
4164− } else if ((acb->dev_id == 0x1214)) {
4161+ } else if (acb->dev_id == 0x1214) {
41654162 writel(0x20, pmuD->reset_request);
41664163 } else {
41674164 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
11931193 for (k = 0; k < 16; k++) {
11941194 if (!atp_dev->id[j][k].prd_table)
11951195 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);
11971197 atp_dev->id[j][k].prd_table = NULL;
11981198 }
11991199 }
@@ -1205,7 +1205,7 @@ static int atp870u_init_tables(struct Scsi_Host *host) · 5 unmodified lines
12051205 int c,k;
12061206 for(c=0;c < 2;c++) {
12071207 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);
12091209 if (!atp_dev->id[c][k].prd_table) {
12101210 printk("atp870u_init_tables fail\n");
12111211 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
15091509 if (err)
15101510 goto fail;
15111511
1512− if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
1512+ if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
15131513 printk(KERN_ERR "atp870u: DMA mask required but not available.\n");
15141514 err = -EIO;
15151515 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
520520 **/
521521 tag_mem = &ctrl->ptag_state[tag].tag_mem_state;
522522 if (tag_mem->size) {
523− pci_free_consistent(ctrl->pdev, tag_mem->size,
523+ dma_free_coherent(&ctrl->pdev->dev, tag_mem->size,
524524 tag_mem->va, tag_mem->dma);
525525 tag_mem->size = 0;
526526 }
@@ -1269,12 +1269,12 @@ int beiscsi_check_supported_fw(struct be_ctrl_info *ctrl, · 742 unmodified lines
12691269 struct be_sge *sge = nonembedded_sgl(wrb);
12701270 int status = 0;
12711271
1272− nonemb_cmd.va = pci_alloc_consistent(ctrl->pdev,
1272+ nonemb_cmd.va = dma_alloc_coherent(&ctrl->pdev->dev,
12731273 sizeof(struct be_mgmt_controller_attributes),
1274− &nonemb_cmd.dma);
1274+ &nonemb_cmd.dma, GFP_KERNEL);
12751275 if (nonemb_cmd.va == NULL) {
12761276 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",
12781278 __func__);
12791279 return -ENOMEM;
12801280 }
@@ -1314,7 +1314,7 @@ int beiscsi_check_supported_fw(struct be_ctrl_info *ctrl, · 33 unmodified lines
13141314 "BG_%d : Failed in beiscsi_check_supported_fw\n");
13151315 mutex_unlock(&ctrl->mbox_lock);
13161316 if (nonemb_cmd.va)
1317− pci_free_consistent(ctrl->pdev, nonemb_cmd.size,
1317+ dma_free_coherent(&ctrl->pdev->dev, nonemb_cmd.size,
13181318 nonemb_cmd.va, nonemb_cmd.dma);
13191319
13201320 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
771771 status = beiscsi_get_initiator_name(phba, buf, false);
772772 if (status < 0) {
773773 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
774− "BS_%d : Retreiving Initiator Name Failed\n");
774+ "BS_%d : Retrieving Initiator Name Failed\n");
775775 status = 0;
776776 }
777777 }
@@ -1071,9 +1071,9 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, · 293 unmodified lines
10711071 else
10721072 req_memsize = sizeof(struct tcp_connect_and_offload_in_v1);
10731073
1074− nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev,
1074+ nonemb_cmd.va = dma_alloc_coherent(&phba->ctrl.pdev->dev,
10751075 req_memsize,
1076− &nonemb_cmd.dma);
1076+ &nonemb_cmd.dma, GFP_KERNEL);
10771077 if (nonemb_cmd.va == NULL) {
10781078
10791079 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
@@ -1091,7 +1091,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, · 11 unmodified lines
10911091 "BS_%d : mgmt_open_connection Failed for cid=%d\n",
10921092 beiscsi_ep->ep_cid);
10931093
1094− pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
1094+ dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
10951095 nonemb_cmd.va, nonemb_cmd.dma);
10961096 beiscsi_free_ep(beiscsi_ep);
10971097 return -EAGAIN;
@@ -1104,8 +1104,9 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, · 6 unmodified lines
11041104 "BS_%d : mgmt_open_connection Failed");
11051105
11061106 if (ret != -EBUSY)
1107− pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
1108− nonemb_cmd.va, nonemb_cmd.dma);
1107+ dma_free_coherent(&phba->ctrl.pdev->dev,
1108+ nonemb_cmd.size, nonemb_cmd.va,
1109+ nonemb_cmd.dma);
11091110
11101111 beiscsi_free_ep(beiscsi_ep);
11111112 return ret;
@@ -1118,7 +1119,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, · 6 unmodified lines
11181119 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
11191120 "BS_%d : mgmt_open_connection Success\n");
11201121
1121− pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
1122+ dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
11221123 nonemb_cmd.va, nonemb_cmd.dma);
11231124 return 0;
11241125 }
drivers/scsi/be2iscsi/be_main.c+31−43
@@ -511,18 +511,9 @@ static int beiscsi_enable_pci(struct pci_dev *pcidev) · 510 unmodified lines
511511 }
512512
513513 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));
515515 if (ret) {
516− ret = pci_set_dma_mask(pcidev, 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));
516+ ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
526517 if (ret) {
527518 dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n");
528519 goto pci_region_release;
@@ -550,9 +541,8 @@ static int be_ctrl_init(struct beiscsi_hba *phba, struct pci_dev *pdev) · 21 unmodified lines
550541 if (status)
551542 return status;
552543 mbox_mem_alloc->size = sizeof(struct be_mcc_mailbox) + 16;
553− mbox_mem_alloc->va = pci_alloc_consistent(pdev,
554− mbox_mem_alloc->size,
555− &mbox_mem_alloc->dma);
544+ mbox_mem_alloc->va = dma_alloc_coherent(&pdev->dev,
545+ mbox_mem_alloc->size, &mbox_mem_alloc->dma, GFP_KERNEL);
556546 if (!mbox_mem_alloc->va) {
557547 beiscsi_unmap_pci_function(phba);
558548 return -ENOMEM;
@@ -1866,7 +1856,6 @@ unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq, int budget) · 1307 unmodified lines
18661856 {
18671857 struct be_queue_info *cq;
18681858 struct sol_cqe *sol;
1869− struct dmsg_cqe *dmsg;
18701859 unsigned int total = 0;
18711860 unsigned int num_processed = 0;
18721861 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
19391928 "BM_%d : Received %s[%d] on CID : %d\n",
19401929 cqe_desc[code], code, cid);
19411930
1942− dmsg = (struct dmsg_cqe *)sol;
19431931 hwi_complete_drvr_msgs(beiscsi_conn, phba, sol);
19441932 break;
19451933 case UNSOL_HDR_NOTIFY:
@@ -2304,11 +2292,11 @@ static int hwi_write_buffer(struct iscsi_wrb *pwrb, struct iscsi_task *task) · 358 unmodified lines
23042292
23052293 /* Map addr only if there is data_count */
23062294 if (dsp_value) {
2307− io_task->mtask_addr = pci_map_single(phba->pcidev,
2295+ io_task->mtask_addr = dma_map_single(&phba->pcidev->dev,
23082296 task->data,
23092297 task->data_count,
2310− PCI_DMA_TODEVICE);
2311− if (pci_dma_mapping_error(phba->pcidev,
2298+ DMA_TO_DEVICE);
2299+ if (dma_mapping_error(&phba->pcidev->dev,
23122300 io_task->mtask_addr))
23132301 return -ENOMEM;
23142302 io_task->mtask_data_count = task->data_count;
@@ -2519,10 +2507,9 @@ static int beiscsi_alloc_mem(struct beiscsi_hba *phba) · 204 unmodified lines
25192507 BEISCSI_MAX_FRAGS_INIT);
25202508 curr_alloc_size = min(be_max_phys_size * 1024, alloc_size);
25212509 do {
2522− mem_arr->virtual_address = pci_alloc_consistent(
2523− phba->pcidev,
2524− curr_alloc_size,
2525− &bus_add);
2510+ mem_arr->virtual_address =
2511+ dma_alloc_coherent(&phba->pcidev->dev,
2512+ curr_alloc_size, &bus_add, GFP_KERNEL);
25262513 if (!mem_arr->virtual_address) {
25272514 if (curr_alloc_size <= BE_MIN_MEM_SIZE)
25282515 goto free_mem;
@@ -2560,7 +2547,7 @@ free_mem: · 31 unmodified lines
25602547 mem_descr->num_elements = j;
25612548 while ((i) || (j)) {
25622549 for (j = mem_descr->num_elements; j > 0; j--) {
2563− pci_free_consistent(phba->pcidev,
2550+ dma_free_coherent(&phba->pcidev->dev,
25642551 mem_descr->mem_array[j - 1].size,
25652552 mem_descr->mem_array[j - 1].
25662553 virtual_address,
@@ -3031,9 +3018,9 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, · 464 unmodified lines
30313018 eq = &phwi_context->be_eq[i].q;
30323019 mem = &eq->dma_mem;
30333020 phwi_context->be_eq[i].phba = phba;
3034− eq_vaddress = pci_alloc_consistent(phba->pcidev,
3021+ eq_vaddress = dma_alloc_coherent(&phba->pcidev->dev,
30353022 num_eq_pages * PAGE_SIZE,
3036− &paddr);
3023+ &paddr, GFP_KERNEL);
30373024 if (!eq_vaddress) {
30383025 ret = -ENOMEM;
30393026 goto create_eq_error;
@@ -3069,7 +3056,7 @@ create_eq_error: · 29 unmodified lines
30693056 eq = &phwi_context->be_eq[i].q;
30703057 mem = &eq->dma_mem;
30713058 if (mem->va)
3072− pci_free_consistent(phba->pcidev, num_eq_pages
3059+ dma_free_coherent(&phba->pcidev->dev, num_eq_pages
30733060 * PAGE_SIZE,
30743061 mem->va, mem->dma);
30753062 }
@@ -3097,9 +3084,9 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, · 21 unmodified lines
30973084 pbe_eq->cq = cq;
30983085 pbe_eq->phba = phba;
30993086 mem = &cq->dma_mem;
3100− cq_vaddress = pci_alloc_consistent(phba->pcidev,
3087+ cq_vaddress = dma_alloc_coherent(&phba->pcidev->dev,
31013088 num_cq_pages * PAGE_SIZE,
3102− &paddr);
3089+ &paddr, GFP_KERNEL);
31033090 if (!cq_vaddress) {
31043091 ret = -ENOMEM;
31053092 goto create_cq_error;
@@ -3134,7 +3121,7 @@ create_cq_error: · 28 unmodified lines
31343121 cq = &phwi_context->be_cq[i];
31353122 mem = &cq->dma_mem;
31363123 if (mem->va)
3137− pci_free_consistent(phba->pcidev, num_cq_pages
3124+ dma_free_coherent(&phba->pcidev->dev, num_cq_pages
31383125 * PAGE_SIZE,
31393126 mem->va, mem->dma);
31403127 }
@@ -3326,7 +3313,7 @@ static void be_queue_free(struct beiscsi_hba *phba, struct be_queue_info *q) · 185 unmodified lines
33263313 {
33273314 struct be_dma_mem *mem = &q->dma_mem;
33283315 if (mem->va) {
3329− pci_free_consistent(phba->pcidev, mem->size,
3316+ dma_free_coherent(&phba->pcidev->dev, mem->size,
33303317 mem->va, mem->dma);
33313318 mem->va = NULL;
33323319 }
@@ -3341,7 +3328,8 @@ static int be_queue_alloc(struct beiscsi_hba *phba, struct be_queue_info *q, · 8 unmodified lines
33413328 q->len = len;
33423329 q->entry_size = entry_size;
33433330 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);
33453333 if (!mem->va)
33463334 return -ENOMEM;
33473335 return 0;
@@ -3479,7 +3467,7 @@ static void be_mcc_queues_destroy(struct beiscsi_hba *phba) · 131 unmodified lines
34793467 &ctrl->ptag_state[tag].tag_state)) {
34803468 ptag_mem = &ctrl->ptag_state[tag].tag_mem_state;
34813469 if (ptag_mem->size) {
3482− pci_free_consistent(ctrl->pdev,
3470+ dma_free_coherent(&ctrl->pdev->dev,
34833471 ptag_mem->size,
34843472 ptag_mem->va,
34853473 ptag_mem->dma);
@@ -3880,7 +3868,7 @@ static void beiscsi_free_mem(struct beiscsi_hba *phba) · 394 unmodified lines
38803868 j = 0;
38813869 for (i = 0; i < SE_MEM_MAX; i++) {
38823870 for (j = mem_descr->num_elements; j > 0; j--) {
3883− pci_free_consistent(phba->pcidev,
3871+ dma_free_coherent(&phba->pcidev->dev,
38843872 mem_descr->mem_array[j - 1].size,
38853873 mem_descr->mem_array[j - 1].virtual_address,
38863874 (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
42554243 }
42564244
42574245 if (io_task->mtask_addr) {
4258− pci_unmap_single(phba->pcidev,
4246+ dma_unmap_single(&phba->pcidev->dev,
42594247 io_task->mtask_addr,
42604248 io_task->mtask_data_count,
4261− PCI_DMA_TODEVICE);
4249+ DMA_TO_DEVICE);
42624250 io_task->mtask_addr = 0;
42634251 }
42644252 }
@@ -4852,9 +4840,9 @@ static int beiscsi_bsg_request(struct bsg_job *job) · 587 unmodified lines
48524840
48534841 switch (bsg_req->msgcode) {
48544842 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,
48564844 job->request_payload.payload_len,
4857− &nonemb_cmd.dma);
4845+ &nonemb_cmd.dma, GFP_KERNEL);
48584846 if (nonemb_cmd.va == NULL) {
48594847 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
48604848 "BM_%d : Failed to allocate memory for "
@@ -4867,7 +4855,7 @@ static int beiscsi_bsg_request(struct bsg_job *job) · 6 unmodified lines
48674855 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
48684856 "BM_%d : MBX Tag Allocation Failed\n");
48694857
4870− pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
4858+ dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
48714859 nonemb_cmd.va, nonemb_cmd.dma);
48724860 return -EAGAIN;
48734861 }
@@ -4881,7 +4869,7 @@ static int beiscsi_bsg_request(struct bsg_job *job) · 7 unmodified lines
48814869 if (!test_bit(BEISCSI_HBA_ONLINE, &phba->state)) {
48824870 clear_bit(MCC_TAG_STATE_RUNNING,
48834871 &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,
48854873 nonemb_cmd.va, nonemb_cmd.dma);
48864874 return -EIO;
48874875 }
@@ -4898,7 +4886,7 @@ static int beiscsi_bsg_request(struct bsg_job *job) · 10 unmodified lines
48984886 bsg_reply->result = status;
48994887 bsg_job_done(job, bsg_reply->result,
49004888 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,
49024890 nonemb_cmd.va, nonemb_cmd.dma);
49034891 if (status || extd_status) {
49044892 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
@@ -5754,7 +5742,7 @@ free_twq: · 849 unmodified lines
57545742 beiscsi_cleanup_port(phba);
57555743 beiscsi_free_mem(phba);
57565744 free_port:
5757− pci_free_consistent(phba->pcidev,
5745+ dma_free_coherent(&phba->pcidev->dev,
57585746 phba->ctrl.mbox_mem_alloced.size,
57595747 phba->ctrl.mbox_mem_alloced.va,
57605748 phba->ctrl.mbox_mem_alloced.dma);
@@ -5798,7 +5786,7 @@ static void beiscsi_remove(struct pci_dev *pcidev) · 37 unmodified lines
57985786
57995787 /* ctrl uninit */
58005788 beiscsi_unmap_pci_function(phba);
5801− pci_free_consistent(phba->pcidev,
5789+ dma_free_coherent(&phba->pcidev->dev,
58025790 phba->ctrl.mbox_mem_alloced.size,
58035791 phba->ctrl.mbox_mem_alloced.va,
58045792 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
284284 return rc;
285285
286286 free_cmd:
287− pci_free_consistent(ctrl->pdev, nonemb_cmd->size,
287+ dma_free_coherent(&ctrl->pdev->dev, nonemb_cmd->size,
288288 nonemb_cmd->va, nonemb_cmd->dma);
289289 return rc;
290290 }
@@ -293,7 +293,8 @@ static int beiscsi_prep_nemb_cmd(struct beiscsi_hba *phba, · 2 unmodified lines
293293 struct be_dma_mem *cmd,
294294 u8 subsystem, u8 opcode, u32 size)
295295 {
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);
297298 if (!cmd->va) {
298299 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
299300 "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
315316 __beiscsi_mcc_compl_status(phba, tag, NULL, NULL);
316317 tag_mem = &phba->ctrl.ptag_state[tag].tag_mem_state;
317318 if (tag_mem->size) {
318− pci_free_consistent(phba->pcidev, tag_mem->size,
319+ dma_free_coherent(&phba->pcidev->dev, tag_mem->size,
319320 tag_mem->va, tag_mem->dma);
320321 tag_mem->size = 0;
321322 }
@@ -761,7 +762,7 @@ int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type, · 439 unmodified lines
761762 "BG_%d : Memory Allocation Failure\n");
762763
763764 /* Free the DMA memory for the IOCTL issuing */
764− pci_free_consistent(phba->ctrl.pdev,
765+ dma_free_coherent(&phba->ctrl.pdev->dev,
765766 nonemb_cmd.size,
766767 nonemb_cmd.va,
767768 nonemb_cmd.dma);
@@ -780,7 +781,7 @@ int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type, · 12 unmodified lines
780781 ioctl_size += sizeof(struct be_cmd_req_hdr);
781782
782783 /* 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,
784785 nonemb_cmd.va,
785786 nonemb_cmd.dma);
786787
@@ -869,7 +870,7 @@ static void beiscsi_boot_process_compl(struct beiscsi_hba *phba, · 82 unmodified lines
869870 status);
870871 boot_work = 0;
871872 }
872− pci_free_consistent(phba->ctrl.pdev, bs->nonemb_cmd.size,
873+ dma_free_coherent(&phba->ctrl.pdev->dev, bs->nonemb_cmd.size,
873874 bs->nonemb_cmd.va, bs->nonemb_cmd.dma);
874875 bs->nonemb_cmd.va = NULL;
875876 break;
@@ -1012,9 +1013,10 @@ unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba) · 136 unmodified lines
10121013
10131014 nonemb_cmd = &phba->boot_struct.nonemb_cmd;
10141015 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,
10161017 nonemb_cmd->size,
1017− &nonemb_cmd->dma);
1018+ &nonemb_cmd->dma,
1019+ GFP_KERNEL);
10181020 if (!nonemb_cmd->va) {
10191021 mutex_unlock(&ctrl->mbox_lock);
10201022 return 0;
@@ -1508,9 +1510,10 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba, · 487 unmodified lines
15081510 return -EINVAL;
15091511
15101512 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,
15121514 nonemb_cmd.size,
1513− &nonemb_cmd.dma);
1515+ &nonemb_cmd.dma,
1516+ GFP_KERNEL);
15141517 if (!nonemb_cmd.va) {
15151518 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_EH,
15161519 "BM_%d : invldt_cmds_params alloc failed\n");
@@ -1521,7 +1524,7 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba, · 4 unmodified lines
15211524 wrb = alloc_mcc_wrb(phba, &tag);
15221525 if (!wrb) {
15231526 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,
15251528 nonemb_cmd.va, nonemb_cmd.dma);
15261529 return -ENOMEM;
15271530 }
@@ -1548,7 +1551,7 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba, · 20 unmodified lines
15481551
15491552 rc = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd);
15501553 if (rc != -EBUSY)
1551− pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
1554+ dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size,
15521555 nonemb_cmd.va, nonemb_cmd.dma);
15531556 return rc;
15541557 }
drivers/scsi/bfa/bfa_defs_svc.h+1−1
@@ -1453,7 +1453,7 @@ union bfa_aen_data_u { · 1452 unmodified lines
14531453 struct bfa_aen_entry_s {
14541454 struct list_head qe;
14551455 enum bfa_aen_category aen_category;
1456− u32 aen_type;
1456+ int aen_type;
14571457 union bfa_aen_data_u aen_data;
14581458 u64 aen_tv_sec;
14591459 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
190190 fchs->ox_id = ox_id;
191191 }
192192
193−enum fc_parse_status
194−fc_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−
214193 static void
215194 fc_bls_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id)
216195 {
@@ -830,18 +809,6 @@ fc_rpsc_acc_build(struct fchs_s *fchs, struct fc_rpsc_acc_s *rpsc_acc, · 613 unmodified lines
830809 return sizeof(struct fc_rpsc_acc_s);
831810 }
832811
833−u16
834−fc_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−
845812 u16
846813 fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
847814 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
907874 return be16_to_cpu(prlo->payload_len);
908875 }
909876
910−u16
911−fc_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−
944877 u16
945878 fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
946879 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
971904 return be16_to_cpu(tprlo->payload_len);
972905 }
973906
974−u16
975−fc_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−
1003−enum fc_parse_status
1004−fc_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−
1015907 u16
1016908 fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id,
1017909 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
163163
164164 u16 fc_rrq_build(struct fchs_s *buf, struct fc_rrq_s *rrq, u32 d_id,
165165 u32 s_id, u16 ox_id, u16 rrq_oxid);
166−enum fc_parse_status fc_rrq_rsp_parse(struct fchs_s *buf, int len);
167166
168167 u16 fc_rspnid_build(struct fchs_s *fchs, void *pld, u32 s_id,
169168 u16 ox_id, u8 *name);
@@ -276,8 +275,6 @@ void fc_get_fc4type_bitmask(u8 fc4_type, u8 *bit_mask); · 106 unmodified lines
276275 void fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
277276 __be16 ox_id);
278277
279−enum fc_parse_status fc_els_rsp_parse(struct fchs_s *fchs, int len);
280−
281278 enum fc_parse_status fc_plogi_rsp_parse(struct fchs_s *fchs, int len,
282279 wwn_t port_name);
283280
@@ -297,8 +294,6 @@ u16 fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc, · 13 unmodified lines
297294 u16 fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc,
298295 u32 d_id, u32 s_id, __be16 ox_id, int num_pages);
299296
300−u16 fc_logo_rsp_parse(struct fchs_s *fchs, int len);
301−
302297 u16 fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
303298 u16 ox_id, wwn_t port_name, wwn_t node_name,
304299 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
308303 u16 fc_prlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
309304 u16 ox_id, int num_pages);
310305
311−u16 fc_prlo_rsp_parse(struct fchs_s *fchs, int len);
312−
313306 u16 fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
314307 u16 ox_id, int num_pages, enum fc_tprlo_type tprlo_type,
315308 u32 tpr_id);
316309
317−u16 fc_tprlo_rsp_parse(struct fchs_s *fchs, int len);
318−
319310 u16 fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
320311 __be16 ox_id, u32 reason_code, u32 reason_expl);
321312
drivers/scsi/bfa/bfad_im.h+1−1
@@ -143,7 +143,7 @@ struct bfad_im_s { · 142 unmodified lines
143143 static inline void bfad_im_post_vendor_event(struct bfa_aen_entry_s *entry,
144144 struct bfad_s *drv, int cnt,
145145 enum bfa_aen_category cat,
146− enum bfa_ioc_aen_event evt)
146+ int evt)
147147 {
148148 struct timespec64 ts;
149149
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
432432 struct fcoe_rcv_info *fr;
433433 struct fcoe_percpu_s *bg;
434434 struct sk_buff *tmp_skb;
435− unsigned short oxid;
436435
437436 interface = container_of(ptype, struct bnx2fc_interface,
438437 fcoe_packet_type);
@@ -466,8 +465,6 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, · 27 unmodified lines
466465 skb_set_transport_header(skb, sizeof(struct fcoe_hdr));
467466 fh = (struct fc_frame_header *) skb_transport_header(skb);
468467
469− oxid = ntohs(fh->fh_ox_id);
470−
471468 fr = fcoe_dev_from_skb(skb);
472469 fr->fr_dev = lport;
473470
drivers/scsi/csiostor/csio_init.c+2−5
@@ -210,11 +210,8 @@ csio_pci_init(struct pci_dev *pdev, int *bars) · 209 unmodified lines
210210 pci_set_master(pdev);
211211 pci_try_set_mwi(pdev);
212212
213− if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
214− pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
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 {
213+ if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
214+ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
218215 dev_err(&pdev->dev, "No suitable DMA available.\n");
219216 goto err_release_regions;
220217 }
drivers/scsi/csiostor/csio_lnode.c+3−3
@@ -1845,8 +1845,8 @@ csio_ln_fdmi_init(struct csio_lnode *ln) · 1844 unmodified lines
18451845 /* Allocate Dma buffers for FDMI response Payload */
18461846 dma_buf = &ln->mgmt_req->dma_buf;
18471847 dma_buf->len = 2048;
1848− dma_buf->vaddr = pci_alloc_consistent(hw->pdev, dma_buf->len,
1849− &dma_buf->paddr);
1848+ dma_buf->vaddr = dma_alloc_coherent(&hw->pdev->dev, dma_buf->len,
1849+ &dma_buf->paddr, GFP_KERNEL);
18501850 if (!dma_buf->vaddr) {
18511851 csio_err(hw, "Failed to alloc DMA buffer for FDMI!\n");
18521852 kfree(ln->mgmt_req);
@@ -1873,7 +1873,7 @@ csio_ln_fdmi_exit(struct csio_lnode *ln) · 20 unmodified lines
18731873
18741874 dma_buf = &ln->mgmt_req->dma_buf;
18751875 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,
18771877 dma_buf->paddr);
18781878
18791879 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
23492349 }
23502350
23512351 /* Allocate Dma buffers for DDP */
2352− ddp_desc->vaddr = pci_alloc_consistent(hw->pdev, unit_size,
2353− &ddp_desc->paddr);
2352+ ddp_desc->vaddr = dma_alloc_coherent(&hw->pdev->dev, unit_size,
2353+ &ddp_desc->paddr, GFP_KERNEL);
23542354 if (!ddp_desc->vaddr) {
23552355 csio_err(hw,
23562356 "SCSI response DMA buffer (ddp) allocation"
@@ -2372,8 +2372,8 @@ no_mem: · 15 unmodified lines
23722372 list_for_each(tmp, &scm->ddp_freelist) {
23732373 ddp_desc = (struct csio_dma_buf *) tmp;
23742374 tmp = csio_list_prev(tmp);
2375− pci_free_consistent(hw->pdev, ddp_desc->len, ddp_desc->vaddr,
2376− ddp_desc->paddr);
2375+ dma_free_coherent(&hw->pdev->dev, ddp_desc->len,
2376+ ddp_desc->vaddr, ddp_desc->paddr);
23772377 list_del_init(&ddp_desc->list);
23782378 kfree(ddp_desc);
23792379 }
@@ -2399,8 +2399,8 @@ csio_scsi_free_ddp_bufs(struct csio_scsim *scm, struct csio_hw *hw) · 19 unmodified lines
23992399 list_for_each(tmp, &scm->ddp_freelist) {
24002400 ddp_desc = (struct csio_dma_buf *) tmp;
24012401 tmp = csio_list_prev(tmp);
2402− pci_free_consistent(hw->pdev, ddp_desc->len, ddp_desc->vaddr,
2403− ddp_desc->paddr);
2402+ dma_free_coherent(&hw->pdev->dev, ddp_desc->len,
2403+ ddp_desc->vaddr, ddp_desc->paddr);
24042404 list_del_init(&ddp_desc->list);
24052405 kfree(ddp_desc);
24062406 }
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
124124
125125 while (n--) {
126126 buf->len = sge->sge_fl_buf_size[sreg];
127− buf->vaddr = pci_alloc_consistent(hw->pdev, buf->len,
128− &buf->paddr);
127+ buf->vaddr = dma_alloc_coherent(&hw->pdev->dev, buf->len,
128+ &buf->paddr, GFP_KERNEL);
129129 if (!buf->vaddr) {
130130 csio_err(hw, "Could only fill %d buffers!\n", n + 1);
131131 return -ENOMEM;
@@ -233,7 +233,8 @@ csio_wr_alloc_q(struct csio_hw *hw, uint32_t qsize, uint32_t wrsize, · 101 unmodified lines
233233
234234 q = wrm->q_arr[free_idx];
235235
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);
237238 if (!q->vstart) {
238239 csio_err(hw,
239240 "Failed to allocate DMA memory for "
@@ -1703,14 +1704,14 @@ csio_wrm_exit(struct csio_wrm *wrm, struct csio_hw *hw) · 1463 unmodified lines
17031704 buf = &q->un.fl.bufs[j];
17041705 if (!buf->vaddr)
17051706 continue;
1706− pci_free_consistent(hw->pdev, buf->len,
1707− buf->vaddr,
1708− buf->paddr);
1707+ dma_free_coherent(&hw->pdev->dev,
1708+ buf->len, buf->vaddr,
1709+ buf->paddr);
17091710 }
17101711 kfree(q->un.fl.bufs);
17111712 }
1712− pci_free_consistent(hw->pdev, q->size,
1713− q->vstart, q->pstart);
1713+ dma_free_coherent(&hw->pdev->dev, q->size,
1714+ q->vstart, q->pstart);
17141715 }
17151716 kfree(q);
17161717 }
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c+153−1
@@ -35,6 +35,11 @@ static unsigned int dbg_level; · 34 unmodified lines
3535
3636 #include "../libcxgbi.h"
3737
38+#ifdef CONFIG_CHELSIO_T4_DCB
39+#include <net/dcbevent.h>
40+#include "cxgb4_dcb.h"
41+#endif
42+
3843 #define DRV_MODULE_NAME "cxgb4i"
3944 #define DRV_MODULE_DESC "Chelsio T4-T6 iSCSI Driver"
4045 #define DRV_MODULE_VERSION "0.9.5-ko"
@@ -155,6 +160,15 @@ static struct iscsi_transport cxgb4i_iscsi_transport = { · 114 unmodified lines
155160 .session_recovery_timedout = iscsi_session_recovery_timedout,
156161 };
157162
163+#ifdef CONFIG_CHELSIO_T4_DCB
164+static int
165+cxgb4_dcb_change_notify(struct notifier_block *, unsigned long, void *);
166+
167+static struct notifier_block cxgb4_dcb_change = {
168+ .notifier_call = cxgb4_dcb_change_notify,
169+};
170+#endif
171+
158172 static struct scsi_transport_template *cxgb4i_stt;
159173
160174 /*
@@ -574,6 +588,9 @@ static inline int tx_flowc_wr_credits(int *nparamsp, int *flowclenp) · 413 unmodified lines
574588 int nparams, flowclen16, flowclen;
575589
576590 nparams = FLOWC_WR_NPARAMS_MIN;
591+#ifdef CONFIG_CHELSIO_T4_DCB
592+ nparams++;
593+#endif
577594 flowclen = offsetof(struct fw_flowc_wr, mnemval[nparams]);
578595 flowclen16 = DIV_ROUND_UP(flowclen, 16);
579596 flowclen = flowclen16 * 16;
@@ -595,6 +612,9 @@ static inline int send_tx_flowc_wr(struct cxgbi_sock *csk) · 15 unmodified lines
595612 struct fw_flowc_wr *flowc;
596613 int nparams, flowclen16, flowclen;
597614
615+#ifdef CONFIG_CHELSIO_T4_DCB
616+ u16 vlan = ((struct l2t_entry *)csk->l2t)->vlan;
617+#endif
598618 flowclen16 = tx_flowc_wr_credits(&nparams, &flowclen);
599619 skb = alloc_wr(flowclen, 0, GFP_ATOMIC);
600620 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
622642 flowc->mnemval[8].val = 0;
623643 flowc->mnemval[8].mnemonic = FW_FLOWC_MNEM_TXDATAPLEN_MAX;
624644 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
625656
626657 set_wr_txq(skb, CPL_PRIORITY_DATA, csk->port_id);
627658
@@ -1600,6 +1631,46 @@ static void release_offload_resources(struct cxgbi_sock *csk) · 972 unmodified lines
16001631 csk->dst = NULL;
16011632 }
16021633
1634+#ifdef CONFIG_CHELSIO_T4_DCB
1635+static inline u8 get_iscsi_dcb_state(struct net_device *ndev)
1636+{
1637+ return ndev->dcbnl_ops->getstate(ndev);
1638+}
1639+
1640+static int select_priority(int pri_mask)
1641+{
1642+ if (!pri_mask)
1643+ return 0;
1644+ return (ffs(pri_mask) - 1);
1645+}
1646+
1647+static 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+
16031674 static int init_act_open(struct cxgbi_sock *csk)
16041675 {
16051676 struct cxgbi_device *cdev = csk->cdev;
@@ -1613,7 +1684,9 @@ static int init_act_open(struct cxgbi_sock *csk) · 7 unmodified lines
16131684 unsigned int size, size6;
16141685 unsigned int linkspeed;
16151686 unsigned int rcv_winf, snd_winf;
1616−
1687+#ifdef CONFIG_CHELSIO_T4_DCB
1688+ u8 priority = 0;
1689+#endif
16171690 log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
16181691 "csk 0x%p,%u,0x%lx,%u.\n",
16191692 csk, csk->state, csk->flags, csk->tid);
@@ -1647,7 +1720,15 @@ static int init_act_open(struct cxgbi_sock *csk) · 27 unmodified lines
16471720 cxgbi_sock_set_flag(csk, CTPF_HAS_ATID);
16481721 cxgbi_sock_get(csk);
16491722
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
16501730 csk->l2t = cxgb4_l2t_get(lldi->l2t, n, ndev, 0);
1731+#endif
16511732 if (!csk->l2t) {
16521733 pr_err("%s, cannot alloc l2t.\n", ndev->name);
16531734 goto rel_resource_without_clip;
@@ -2146,6 +2227,70 @@ static int t4_uld_state_change(void *handle, enum cxgb4_state state) · 492 unmodified lines
21462227 return 0;
21472228 }
21482229
2230+#ifdef CONFIG_CHELSIO_T4_DCB
2231+static int
2232+cxgb4_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+
21492294 static int __init cxgb4i_init_module(void)
21502295 {
21512296 int rc;
@@ -2157,11 +2302,18 @@ static int __init cxgb4i_init_module(void) · 5 unmodified lines
21572302 return rc;
21582303 cxgb4_register_uld(CXGB4_ULD_ISCSI, &cxgb4i_uld_info);
21592304
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
21602309 return 0;
21612310 }
21622311
21632312 static void __exit cxgb4i_exit_module(void)
21642313 {
2314+#ifdef CONFIG_CHELSIO_T4_DCB
2315+ unregister_dcbevent_notifier(&cxgb4_dcb_change);
2316+#endif
21652317 cxgb4_unregister_uld(CXGB4_ULD_ISCSI);
21662318 cxgbi_device_unregister_all(CXGBI_FLAG_DEV_T4);
21672319 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
120120 int wr_max_cred;
121121 int wr_cred;
122122 int wr_una_cred;
123+#ifdef CONFIG_CHELSIO_T4_DCB
124+ u8 dcb_priority;
125+#endif
123126 unsigned char hcrc_len;
124127 unsigned char dcrc_len;
125128
drivers/scsi/dc395x.c+43−148
@@ -753,105 +753,6 @@ static inline struct ScsiReqBlk *find_cmd(struct scsi_cmnd *cmd, · 752 unmodified lines
753753 return NULL;
754754 }
755755
756−
757−static 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−
771−static 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−
778−static 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−
787−static 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−
796−static 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−
804−static 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−
819−static 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−
835−static 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−
845−static 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−
855756 /* Sets the timer to wake us up */
856757 static void waiting_set_timer(struct AdapterCtlBlk *acb, unsigned long to)
857758 {
@@ -923,7 +824,7 @@ static void waiting_process_next(struct AdapterCtlBlk *acb) · 65 unmodified lines
923824
924825 /* Try to send to the bus */
925826 if (!start_scsi(acb, pos, srb))
926− srb_waiting_to_going_move(pos, srb);
827+ list_move(&srb->list, &pos->srb_going_list);
927828 else
928829 waiting_set_timer(acb, HZ/50);
929830 break;
@@ -960,15 +861,15 @@ static void send_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb) · 30 unmodified lines
960861 if (dcb->max_command <= list_size(&dcb->srb_going_list) ||
961862 acb->active_dcb ||
962863 (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);
964865 waiting_process_next(acb);
965866 return;
966867 }
967868
968− if (!start_scsi(acb, dcb, srb))
969− srb_going_append(dcb, srb);
970− else {
971− srb_waiting_insert(dcb, srb);
869+ if (!start_scsi(acb, dcb, srb)) {
870+ list_add_tail(&srb->list, &dcb->srb_going_list);
871+ } else {
872+ list_add(&srb->list, &dcb->srb_waiting_list);
972873 waiting_set_timer(acb, HZ / 50);
973874 }
974875 }
@@ -1045,10 +946,8 @@ static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb, · 70 unmodified lines
1045946 sgp->length++;
1046947 }
1047948
1048− srb->sg_bus_addr = pci_map_single(dcb->acb->dev,
1049− srb->segment_x,
1050− SEGMENTX_LEN,
1051− PCI_DMA_TODEVICE);
949+ srb->sg_bus_addr = dma_map_single(&dcb->acb->dev->dev,
950+ srb->segment_x, SEGMENTX_LEN, DMA_TO_DEVICE);
1052951
1053952 dprintkdbg(DBG_SG, "build_srb: [n] map sg %p->%08x(%05x)\n",
1054953 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
11161015 cmd->scsi_done = done;
11171016 cmd->result = 0;
11181017
1119− srb = srb_get_free(acb);
1120− if (!srb)
1121− {
1018+ srb = list_first_entry_or_null(&acb->srb_free_list,
1019+ struct ScsiReqBlk, list);
1020+ if (!srb) {
11221021 /*
11231022 * Return 1 since we are unable to queue this command at this
11241023 * point in time.
@@ -1126,12 +1025,13 @@ static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct s · 1 unmodified line
11261025 dprintkdbg(DBG_0, "queue_command: No free srb's\n");
11271026 return 1;
11281027 }
1028+ list_del(&srb->list);
11291029
11301030 build_srb(cmd, dcb, srb);
11311031
11321032 if (!list_empty(&dcb->srb_waiting_list)) {
11331033 /* append to waiting queue */
1134− srb_waiting_append(dcb, srb);
1034+ list_add_tail(&srb->list, &dcb->srb_waiting_list);
11351035 waiting_process_next(acb);
11361036 } else {
11371037 /* process immediately */
@@ -1376,11 +1276,11 @@ static int dc395x_eh_abort(struct scsi_cmnd *cmd) · 238 unmodified lines
13761276
13771277 srb = find_cmd(cmd, &dcb->srb_waiting_list);
13781278 if (srb) {
1379− srb_waiting_remove(dcb, srb);
1279+ list_del(&srb->list);
13801280 pci_unmap_srb_sense(acb, srb);
13811281 pci_unmap_srb(acb, srb);
13821282 free_tag(dcb, srb);
1383− srb_free_insert(acb, srb);
1283+ list_add_tail(&srb->list, &acb->srb_free_list);
13841284 dprintkl(KERN_DEBUG, "eh_abort: Command was waiting\n");
13851285 cmd->result = DID_ABORT << 16;
13861286 return SUCCESS;
@@ -1969,14 +1869,15 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left) · 582 unmodified lines
19691869 xferred -= psge->length;
19701870 } else {
19711871 /* 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);
19721875 psge->length -= xferred;
19731876 psge->address += xferred;
19741877 srb->sg_index = idx;
1975− pci_dma_sync_single_for_device(srb->dcb->
1976− acb->dev,
1977− srb->sg_bus_addr,
1978− SEGMENTX_LEN,
1979− PCI_DMA_TODEVICE);
1878+ dma_sync_single_for_device(&srb->dcb->acb->dev->dev,
1879+ srb->sg_bus_addr, SEGMENTX_LEN,
1880+ DMA_TO_DEVICE);
19801881 break;
19811882 }
19821883 psge++;
@@ -3083,7 +2984,7 @@ static void disconnect(struct AdapterCtlBlk *acb) · 1100 unmodified lines
30832984 goto disc1;
30842985 }
30852986 free_tag(dcb, srb);
3086− srb_going_to_waiting_move(dcb, srb);
2987+ list_move(&srb->list, &dcb->srb_waiting_list);
30872988 dprintkdbg(DBG_KG,
30882989 "disconnect: (0x%p) Retry\n",
30892990 srb->cmd);
@@ -3148,7 +3049,7 @@ static void reselect(struct AdapterCtlBlk *acb) · 58 unmodified lines
31483049
31493050 srb->state = SRB_READY;
31503051 free_tag(dcb, srb);
3151− srb_going_to_waiting_move(dcb, srb);
3052+ list_move(&srb->list, &dcb->srb_waiting_list);
31523053 waiting_set_timer(acb, HZ / 20);
31533054
31543055 /* return; */
@@ -3271,9 +3172,8 @@ static void pci_unmap_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb) · 116 unmodified lines
32713172 /* unmap DC395x SG list */
32723173 dprintkdbg(DBG_SG, "pci_unmap_srb: list=%08x(%05x)\n",
32733174 srb->sg_bus_addr, SEGMENTX_LEN);
3274− pci_unmap_single(acb->dev, srb->sg_bus_addr,
3275− SEGMENTX_LEN,
3276− PCI_DMA_TODEVICE);
3175+ dma_unmap_single(&acb->dev->dev, srb->sg_bus_addr, SEGMENTX_LEN,
3176+ DMA_TO_DEVICE);
32773177 dprintkdbg(DBG_SG, "pci_unmap_srb: segs=%i buffer=%p\n",
32783178 scsi_sg_count(cmd), scsi_bufflen(cmd));
32793179 /* unmap the sg segments */
@@ -3291,8 +3191,8 @@ static void pci_unmap_srb_sense(struct AdapterCtlBlk *acb, · 11 unmodified lines
32913191 /* Unmap sense buffer */
32923192 dprintkdbg(DBG_SG, "pci_unmap_srb_sense: buffer=%08x\n",
32933193 srb->segment_x[0].address);
3294− pci_unmap_single(acb->dev, srb->segment_x[0].address,
3295− srb->segment_x[0].length, PCI_DMA_FROMDEVICE);
3194+ dma_unmap_single(&acb->dev->dev, srb->segment_x[0].address,
3195+ srb->segment_x[0].length, DMA_FROM_DEVICE);
32963196 /* Restore SG stuff */
32973197 srb->total_xfer_length = srb->xferred;
32983198 srb->segment_x[0].address =
@@ -3411,7 +3311,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 112 unmodified lines
34113311 tempcnt--;
34123312 dcb->max_command = tempcnt;
34133313 free_tag(dcb, srb);
3414− srb_going_to_waiting_move(dcb, srb);
3314+ list_move(&srb->list, &dcb->srb_waiting_list);
34153315 waiting_set_timer(acb, HZ / 20);
34163316 srb->adapter_status = 0;
34173317 srb->target_status = 0;
@@ -3447,14 +3347,12 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 29 unmodified lines
34473347 }
34483348 }
34493349
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−
34543350 ckc_only = 0;
34553351 /* Check Error Conditions */
34563352 ckc_e:
34573353
3354+ pci_unmap_srb(acb, srb);
3355+
34583356 if (cmd->cmnd[0] == INQUIRY) {
34593357 unsigned char *base = NULL;
34603358 struct ScsiInqData *ptr;
@@ -3498,16 +3396,14 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 37 unmodified lines
34983396 cmd->cmnd[0], srb->total_xfer_length);
34993397 }
35003398
3501− srb_going_remove(dcb, srb);
3502− /* 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 {
3399+ if (srb != acb->tmp_srb) {
3400+ /* Add to free list */
35063401 dprintkdbg(DBG_0, "srb_done: (0x%p) done result=0x%08x\n",
35073402 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");
35093406 }
3510− pci_unmap_srb(acb, srb);
35113407
35123408 cmd->scsi_done(cmd);
35133409 waiting_process_next(acb);
@@ -3535,9 +3431,9 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag, · 21 unmodified lines
35353431 result = MK_RES(0, did_flag, 0, 0);
35363432 printk("G:%p(%02i-%i) ", p,
35373433 p->device->id, (u8)p->device->lun);
3538− srb_going_remove(dcb, srb);
3434+ list_del(&srb->list);
35393435 free_tag(dcb, srb);
3540− srb_free_insert(acb, srb);
3436+ list_add_tail(&srb->list, &acb->srb_free_list);
35413437 p->result = result;
35423438 pci_unmap_srb_sense(acb, srb);
35433439 pci_unmap_srb(acb, srb);
@@ -3565,8 +3461,7 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag, · 21 unmodified lines
35653461 result = MK_RES(0, did_flag, 0, 0);
35663462 printk("W:%p<%02i-%i>", p, p->device->id,
35673463 (u8)p->device->lun);
3568− srb_waiting_remove(dcb, srb);
3569− srb_free_insert(acb, srb);
3464+ list_move_tail(&srb->list, &acb->srb_free_list);
35703465 p->result = result;
35713466 pci_unmap_srb_sense(acb, srb);
35723467 pci_unmap_srb(acb, srb);
@@ -3692,9 +3587,9 @@ static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 119 unmodified lines
36923587 srb->total_xfer_length = SCSI_SENSE_BUFFERSIZE;
36933588 srb->segment_x[0].length = SCSI_SENSE_BUFFERSIZE;
36943589 /* Map sense buffer */
3695− srb->segment_x[0].address =
3696− pci_map_single(acb->dev, cmd->sense_buffer,
3697− SCSI_SENSE_BUFFERSIZE, PCI_DMA_FROMDEVICE);
3590+ srb->segment_x[0].address = dma_map_single(&acb->dev->dev,
3591+ cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
3592+ DMA_FROM_DEVICE);
36983593 dprintkdbg(DBG_SG, "request_sense: map buffer %p->%08x(%05x)\n",
36993594 cmd->sense_buffer, srb->segment_x[0].address,
37003595 SCSI_SENSE_BUFFERSIZE);
@@ -3705,7 +3600,7 @@ static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · 4 unmodified lines
37053600 dprintkl(KERN_DEBUG,
37063601 "request_sense: (0x%p) failed <%02i-%i>\n",
37073602 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);
37093604 waiting_set_timer(acb, HZ / 100);
37103605 }
37113606 }
@@ -4392,7 +4287,7 @@ static void adapter_init_params(struct AdapterCtlBlk *acb) · 680 unmodified lines
43924287
43934288 /* link static array of srbs into the srb free list */
43944289 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);
43964291 }
43974292
43984293
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
369369 {
370370 struct esp_cmd_priv *spriv = ESP_CMD_PRIV(cmd);
371371 struct scatterlist *sg = scsi_sglist(cmd);
372− int dir = cmd->sc_data_direction;
373− int total, i;
372+ int total = 0, i;
374373
375− if (dir == DMA_NONE)
374+ if (cmd->sc_data_direction == DMA_NONE)
376375 return;
377376
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+ }
379392 spriv->cur_residue = sg_dma_len(sg);
380393 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]);
385394 spriv->tot_residue = total;
386395 }
387396
@@ -441,13 +450,8 @@ static void esp_advance_dma(struct esp *esp, struct esp_cmd_entry *ent, · 53 unmodified lines
441450
442451 static void esp_unmap_dma(struct esp *esp, struct scsi_cmnd *cmd)
443452 {
444− struct esp_cmd_priv *spriv = ESP_CMD_PRIV(cmd);
445− int dir = cmd->sc_data_direction;
446−
447− if (dir == DMA_NONE)
448− return;
449−
450− esp->ops->unmap_sg(esp, scsi_sglist(cmd), spriv->u.num_sg, dir);
453+ if (!(esp->flags & ESP_FLAG_NO_DMA_MAP))
454+ scsi_dma_unmap(cmd);
451455 }
452456
453457 static 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
478482 spriv->tot_residue = ent->saved_tot_residue;
479483 }
480484
481−static 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−
492485 static void esp_write_tgt_config3(struct esp *esp, int tgt)
493486 {
494487 if (esp->rev > ESP100A) {
@@ -624,6 +617,26 @@ static void esp_free_lun_tag(struct esp_cmd_entry *ent, · 129 unmodified lines
624617 }
625618 }
626619
620+static 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+
632+static 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+
627640 /* When a contingent allegiance conditon is created, we force feed a
628641 * REQUEST_SENSE command to the device to fetch the sense data. I
629642 * 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
645658 if (!ent->sense_ptr) {
646659 esp_log_autosense("Doing auto-sense for tgt[%d] lun[%d]\n",
647660 tgt, lun);
648−
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);
661+ esp_map_sense(esp, ent);
654662 }
655663 ent->saved_sense_ptr = ent->sense_ptr;
656664
@@ -717,10 +725,10 @@ static struct esp_cmd_entry *find_and_prep_issuable_command(struct esp *esp) · 60 unmodified lines
717725 static void esp_maybe_execute_command(struct esp *esp)
718726 {
719727 struct esp_target_data *tp;
720− struct esp_lun_data *lp;
721728 struct scsi_device *dev;
722729 struct scsi_cmnd *cmd;
723730 struct esp_cmd_entry *ent;
731+ bool select_and_stop = false;
724732 int tgt, lun, i;
725733 u32 val, start_cmd;
726734 u8 *p;
@@ -743,7 +751,6 @@ static void esp_maybe_execute_command(struct esp *esp) · 16 unmodified lines
743751 tgt = dev->id;
744752 lun = dev->lun;
745753 tp = &esp->target[tgt];
746− lp = dev->hostdata;
747754
748755 list_move(&ent->list, &esp->active_cmds);
749756
@@ -752,7 +759,8 @@ static void esp_maybe_execute_command(struct esp *esp) · 2 unmodified lines
752759 esp_map_dma(esp, cmd);
753760 esp_save_pointers(esp, ent);
754761
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;
756764
757765 p = esp->command_block;
758766
@@ -793,42 +801,22 @@ static void esp_maybe_execute_command(struct esp *esp) · 34 unmodified lines
793801 tp->flags &= ~ESP_TGT_CHECK_NEGO;
794802 }
795803
796− /* Process it like a slow command. */
797− if (tp->flags & (ESP_TGT_NEGO_WIDE | ESP_TGT_NEGO_SYNC))
798− esp->flags |= ESP_FLAG_DOING_SLOWCMD;
804+ /* If there are multiple message bytes, use Select and Stop */
805+ if (esp->msg_out_len)
806+ select_and_stop = true;
799807 }
800808
801809 build_identify:
802− /* If we don't have a lun-data struct yet, we're probing
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+ *p++ = IDENTIFY(tp->flags & ESP_TGT_DISCONNECT, lun);
810811
811812 if (ent->tag[0] && esp->rev == ESP100) {
812813 /* ESP100 lacks select w/atn3 command, use select
813814 * and stop instead.
814815 */
815− esp->flags |= ESP_FLAG_DOING_SLOWCMD;
816+ select_and_stop = true;
816817 }
817818
818− if (!(esp->flags & ESP_FLAG_DOING_SLOWCMD)) {
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 {
819+ if (select_and_stop) {
832820 esp->cmd_bytes_left = cmd->cmd_len;
833821 esp->cmd_bytes_ptr = &cmd->cmnd[0];
834822
@@ -843,6 +831,19 @@ build_identify: · 8 unmodified lines
843831
844832 start_cmd = ESP_CMD_SELAS;
845833 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;
846847 }
847848 val = tgt;
848849 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
902903 }
903904
904905 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) {
905− esp->ops->unmap_single(esp, ent->sense_dma,
906− SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
907− ent->sense_ptr = NULL;
906+ esp_unmap_sense(esp, ent);
908907
909908 /* Restore the message/status bytes to what we actually
910909 * 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
965964 cmd->scsi_done = done;
966965
967966 spriv = ESP_CMD_PRIV(cmd);
968− spriv->u.dma_addr = ~(dma_addr_t)0x0;
967+ spriv->num_sg = 0;
969968
970969 list_add_tail(&ent->list, &esp->queued_cmds);
971970
@@ -1252,14 +1251,10 @@ static int esp_finish_select(struct esp *esp) · 280 unmodified lines
12521251 esp_unmap_dma(esp, cmd);
12531252 esp_free_lun_tag(ent, cmd->device->hostdata);
12541253 tp->flags &= ~(ESP_TGT_NEGO_SYNC | ESP_TGT_NEGO_WIDE);
1255− esp->flags &= ~ESP_FLAG_DOING_SLOWCMD;
12561254 esp->cmd_bytes_ptr = NULL;
12571255 esp->cmd_bytes_left = 0;
12581256 } else {
1259− esp->ops->unmap_single(esp, ent->sense_dma,
1260− SCSI_SENSE_BUFFERSIZE,
1261− DMA_FROM_DEVICE);
1262− ent->sense_ptr = NULL;
1257+ esp_unmap_sense(esp, ent);
12631258 }
12641259
12651260 /* 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
13031298 esp_flush_fifo(esp);
13041299 }
13051300
1306− /* If we are doing a slow command, negotiation, etc.
1307− * we'll do the right thing as we transition to the
1308− * next phase.
1301+ /* If we are doing a Select And Stop command, negotiation, etc.
1302+ * we'll do the right thing as we transition to the next phase.
13091303 */
13101304 esp_event(esp, ESP_EVENT_CHECK_PHASE);
13111305 return 0;
@@ -1338,6 +1332,7 @@ static int esp_data_bytes_sent(struct esp *esp, struct esp_cmd_entry *ent, · 26 unmodified lines
13381332
13391333 bytes_sent = esp->data_dma_len;
13401334 bytes_sent -= ecount;
1335+ bytes_sent -= esp->send_cmd_residual;
13411336
13421337 /*
13431338 * 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
13581353 struct esp_cmd_priv *p = ESP_CMD_PRIV(cmd);
13591354 u8 *ptr;
13601355
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,
13621357 &offset, &count);
13631358 if (likely(ptr)) {
13641359 *(ptr + offset) = bval;
@@ -2039,11 +2034,8 @@ static void esp_reset_cleanup_one(struct esp *esp, struct esp_cmd_entry *ent) · 674 unmodified lines
20392034 esp_free_lun_tag(ent, cmd->device->hostdata);
20402035 cmd->result = DID_RESET << 16;
20412036
2042− if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) {
2043− esp->ops->unmap_single(esp, ent->sense_dma,
2044− SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
2045− ent->sense_ptr = NULL;
2046− }
2037+ if (ent->flags & ESP_CMD_FLAG_AUTOSENSE)
2038+ esp_unmap_sense(esp, ent);
20472039
20482040 cmd->scsi_done(cmd);
20492041 list_del(&ent->list);
@@ -2382,7 +2374,7 @@ static const char *esp_chip_names[] = { · 332 unmodified lines
23822374
23832375 static struct scsi_transport_template *esp_transport_template;
23842376
2385−int scsi_esp_register(struct esp *esp, struct device *dev)
2377+int scsi_esp_register(struct esp *esp)
23862378 {
23872379 static int instance;
23882380 int err;
@@ -2402,10 +2394,10 @@ int scsi_esp_register(struct esp *esp, struct device *dev) · 13 unmodified lines
24022394
24032395 esp_bootup_reset(esp);
24042396
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",
24062398 esp->host->unique_id, esp->regs, esp->dma_regs,
24072399 esp->host->irq);
2408− dev_printk(KERN_INFO, dev,
2400+ dev_printk(KERN_INFO, esp->dev,
24092401 "esp%u: is a %s, %u MHz (ccf=%u), SCSI ID %u\n",
24102402 esp->host->unique_id, esp_chip_names[esp->rev],
24112403 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
24132405 /* Let the SCSI bus reset settle. */
24142406 ssleep(esp_bus_reset_settle);
24152407
2416− err = scsi_add_host(esp->host, dev);
2408+ err = scsi_add_host(esp->host, esp->dev);
24172409 if (err)
24182410 return err;
24192411
@@ -2790,3 +2782,131 @@ MODULE_PARM_DESC(esp_debug, · 370 unmodified lines
27902782
27912783 module_init(esp_init);
27922784 module_exit(esp_exit);
2785+
2786+#ifdef CONFIG_SCSI_ESP_PIO
2787+static 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+
2805+static 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+
2824+void 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+}
2911+EXPORT_SYMBOL(esp_send_pio_cmd);
2912+#endif
drivers/scsi/esp_scsi.h+14−24
@@ -249,11 +249,7 @@ · 248 unmodified lines
249249 #define SYNC_DEFP_FAST 0x19 /* 10mb/s */
250250
251251 struct esp_cmd_priv {
252− union {
253− dma_addr_t dma_addr;
254− int num_sg;
255− } u;
256−
252+ int num_sg;
257253 int cur_residue;
258254 struct scatterlist *cur_sg;
259255 int tot_residue;
@@ -363,19 +359,6 @@ struct esp_driver_ops { · 103 unmodified lines
363359 void (*esp_write8)(struct esp *esp, u8 val, unsigned long reg);
364360 u8 (*esp_read8)(struct esp *esp, unsigned long reg);
365361
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−
379362 /* Return non-zero if there is an IRQ pending. Usually this
380363 * status bit lives in the DMA controller sitting in front of
381364 * the ESP. This has to be accurate or else the ESP interrupt
@@ -435,7 +418,7 @@ struct esp { · 53 unmodified lines
435418 const struct esp_driver_ops *ops;
436419
437420 struct Scsi_Host *host;
438− void *dev;
421+ struct device *dev;
439422
440423 struct esp_cmd_entry *active_cmd;
441424
@@ -490,11 +473,11 @@ struct esp { · 48 unmodified lines
490473 u32 flags;
491474 #define ESP_FLAG_DIFFERENTIAL 0x00000001
492475 #define ESP_FLAG_RESETTING 0x00000002
493−#define ESP_FLAG_DOING_SLOWCMD 0x00000004
494476 #define ESP_FLAG_WIDE_CAPABLE 0x00000008
495477 #define ESP_FLAG_QUICKIRQ_CHECK 0x00000010
496478 #define ESP_FLAG_DISABLE_SYNC 0x00000020
497479 #define ESP_FLAG_USE_FIFO 0x00000040
480+#define ESP_FLAG_NO_DMA_MAP 0x00000080
498481
499482 u8 select_state;
500483 #define ESP_SELECT_NONE 0x00 /* Not selecting */
@@ -532,7 +515,7 @@ struct esp { · 31 unmodified lines
532515 u32 min_period;
533516 u32 radelay;
534517
535− /* Slow command state. */
518+ /* ESP_CMD_SELAS command state */
536519 u8 *cmd_bytes_ptr;
537520 int cmd_bytes_left;
538521
@@ -540,6 +523,11 @@ struct esp { · 1 unmodified line
540523
541524 void *dma;
542525 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;
543531 };
544532
545533 /* A front-end driver for the ESP chip should do the following in
@@ -568,16 +556,18 @@ struct esp { · 22 unmodified lines
568556 * example, the DMA engine has to be reset before ESP can
569557 * be programmed.
570558 * 11) If necessary, call dev_set_drvdata() as needed.
571− * 12) Call scsi_esp_register() with prepared 'esp' structure
572− * and a device pointer if possible.
559+ * 12) Call scsi_esp_register() with prepared 'esp' structure.
573560 * 13) Check scsi_esp_register() return value, release all resources
574561 * if an error was returned.
575562 */
576563 extern struct scsi_host_template scsi_esp_template;
577−extern int scsi_esp_register(struct esp *, struct device *);
564+extern int scsi_esp_register(struct esp *);
578565
579566 extern void scsi_esp_unregister(struct esp *);
580567 extern irqreturn_t scsi_esp_intr(int, void *);
581568 extern void scsi_esp_cmd(struct esp *, u8);
582569
570+extern void esp_send_pio_cmd(struct esp *esp, u32 dma_addr, u32 esp_count,
571+ u32 dma_count, int write, u8 cmd);
572+
583573 #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
836836 u32 fcp_bytes_written = 0;
837837 unsigned long flags;
838838
839− pci_unmap_single(fnic->pdev, buf->dma_addr, buf->len,
840− PCI_DMA_FROMDEVICE);
839+ dma_unmap_single(&fnic->pdev->dev, buf->dma_addr, buf->len,
840+ DMA_FROM_DEVICE);
841841 skb = buf->os_buf;
842842 fp = (struct fc_frame *)skb;
843843 buf->os_buf = NULL;
@@ -977,9 +977,8 @@ int fnic_alloc_rq_frame(struct vnic_rq *rq) · 133 unmodified lines
977977 skb_reset_transport_header(skb);
978978 skb_reset_network_header(skb);
979979 skb_put(skb, len);
980− pa = pci_map_single(fnic->pdev, skb->data, len, PCI_DMA_FROMDEVICE);
981−
982− if (pci_dma_mapping_error(fnic->pdev, pa)) {
980+ pa = dma_map_single(&fnic->pdev->dev, skb->data, len, DMA_FROM_DEVICE);
981+ if (dma_mapping_error(&fnic->pdev->dev, pa)) {
983982 r = -ENOMEM;
984983 printk(KERN_ERR "PCI mapping failed with error %d\n", r);
985984 goto free_skb;
@@ -998,8 +997,8 @@ void fnic_free_rq_buf(struct vnic_rq *rq, struct vnic_rq_buf *buf) · 12 unmodified lines
998997 struct fc_frame *fp = buf->os_buf;
999998 struct fnic *fnic = vnic_dev_priv(rq->vdev);
1000999
1001− pci_unmap_single(fnic->pdev, buf->dma_addr, buf->len,
1002− PCI_DMA_FROMDEVICE);
1000+ dma_unmap_single(&fnic->pdev->dev, buf->dma_addr, buf->len,
1001+ DMA_FROM_DEVICE);
10031002
10041003 dev_kfree_skb(fp_skb(fp));
10051004 buf->os_buf = NULL;
@@ -1018,7 +1017,6 @@ void fnic_eth_send(struct fcoe_ctlr *fip, struct sk_buff *skb) · 12 unmodified lines
10181017 struct ethhdr *eth_hdr;
10191018 struct vlan_ethhdr *vlan_hdr;
10201019 unsigned long flags;
1021− int r;
10221020
10231021 if (!fnic->vlan_hw_insert) {
10241022 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
10381036 }
10391037 }
10401038
1041− pa = pci_map_single(fnic->pdev, skb->data, skb->len, PCI_DMA_TODEVICE);
1042−
1043− r = pci_dma_mapping_error(fnic->pdev, pa);
1044− if (r) {
1045− printk(KERN_ERR "PCI mapping failed with error %d\n", r);
1039+ pa = dma_map_single(&fnic->pdev->dev, skb->data, skb->len,
1040+ DMA_TO_DEVICE);
1041+ if (dma_mapping_error(&fnic->pdev->dev, pa)) {
1042+ printk(KERN_ERR "DMA mapping failed\n");
10461043 goto free_skb;
10471044 }
10481045
@@ -1058,7 +1055,7 @@ void fnic_eth_send(struct fcoe_ctlr *fip, struct sk_buff *skb) · 9 unmodified lines
10581055
10591056 irq_restore:
10601057 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);
10621059 free_skb:
10631060 kfree_skb(skb);
10641061 }
@@ -1115,9 +1112,8 @@ static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp) · 50 unmodified lines
11151112 if (FC_FCOE_VER)
11161113 FC_FCOE_ENCAPS_VER(fcoe_hdr, FC_FCOE_VER);
11171114
1118− pa = pci_map_single(fnic->pdev, eth_hdr, tot_len, PCI_DMA_TODEVICE);
1119−
1120− if (pci_dma_mapping_error(fnic->pdev, pa)) {
1115+ pa = dma_map_single(&fnic->pdev->dev, eth_hdr, tot_len, DMA_TO_DEVICE);
1116+ if (dma_mapping_error(&fnic->pdev->dev, pa)) {
11211117 ret = -ENOMEM;
11221118 printk(KERN_ERR "DMA map failed with error %d\n", ret);
11231119 goto free_skb_on_err;
@@ -1131,8 +1127,7 @@ static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp) · 7 unmodified lines
11311127 spin_lock_irqsave(&fnic->wq_lock[0], flags);
11321128
11331129 if (!vnic_wq_desc_avail(wq)) {
1134− pci_unmap_single(fnic->pdev, pa,
1135− tot_len, PCI_DMA_TODEVICE);
1130+ dma_unmap_single(&fnic->pdev->dev, pa, tot_len, DMA_TO_DEVICE);
11361131 ret = -1;
11371132 goto irq_restore;
11381133 }
@@ -1247,8 +1242,8 @@ static void fnic_wq_complete_frame_send(struct vnic_wq *wq, · 108 unmodified lines
12471242 struct fc_frame *fp = (struct fc_frame *)skb;
12481243 struct fnic *fnic = vnic_dev_priv(wq->vdev);
12491244
1250− pci_unmap_single(fnic->pdev, buf->dma_addr,
1251− buf->len, PCI_DMA_TODEVICE);
1245+ dma_unmap_single(&fnic->pdev->dev, buf->dma_addr, buf->len,
1246+ DMA_TO_DEVICE);
12521247 dev_kfree_skb_irq(fp_skb(fp));
12531248 buf->os_buf = NULL;
12541249 }
@@ -1290,8 +1285,8 @@ void fnic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf) · 35 unmodified lines
12901285 struct fc_frame *fp = buf->os_buf;
12911286 struct fnic *fnic = vnic_dev_priv(wq->vdev);
12921287
1293− pci_unmap_single(fnic->pdev, buf->dma_addr,
1294− buf->len, PCI_DMA_TODEVICE);
1288+ dma_unmap_single(&fnic->pdev->dev, buf->dma_addr, buf->len,
1289+ DMA_TO_DEVICE);
12951290
12961291 dev_kfree_skb(fp_skb(fp));
12971292 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
611611 * limitation for the device. Try 64-bit first, and
612612 * fail to 32-bit.
613613 */
614− err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
614+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
615615 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));
617617 if (err) {
618618 shost_printk(KERN_ERR, fnic->lport->host,
619619 "No usable DMA configuration "
620620 "aborting\n");
621621 goto err_out_release_regions;
622622 }
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− }
638623 }
639624
640625 /* 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
126126 struct scsi_cmnd *sc)
127127 {
128128 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,
130130 sizeof(io_req->sgl_list[0]) * io_req->sgl_cnt,
131− PCI_DMA_TODEVICE);
131+ DMA_TO_DEVICE);
132132 scsi_dma_unmap(sc);
133133
134134 if (io_req->sgl_cnt)
135135 mempool_free(io_req->sgl_list_alloc,
136136 fnic->io_sgl_pool[io_req->sgl_type]);
137137 if (io_req->sense_buf_pa)
138− pci_unmap_single(fnic->pdev, io_req->sense_buf_pa,
139− SCSI_SENSE_BUFFERSIZE, PCI_DMA_FROMDEVICE);
138+ dma_unmap_single(&fnic->pdev->dev, io_req->sense_buf_pa,
139+ SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
140140 }
141141
142142 /* 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
330330 int flags;
331331 u8 exch_flags;
332332 struct scsi_lun fc_lun;
333− int r;
334333
335334 if (sg_count) {
336335 /* 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
342341 desc++;
343342 }
344343
345− io_req->sgl_list_pa = pci_map_single
346− (fnic->pdev,
347− io_req->sgl_list,
348− sizeof(io_req->sgl_list[0]) * sg_count,
349− PCI_DMA_TODEVICE);
350−
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);
344+ io_req->sgl_list_pa = dma_map_single(&fnic->pdev->dev,
345+ io_req->sgl_list,
346+ sizeof(io_req->sgl_list[0]) * sg_count,
347+ DMA_TO_DEVICE);
348+ if (dma_mapping_error(&fnic->pdev->dev, io_req->sgl_list_pa)) {
349+ printk(KERN_ERR "DMA mapping failed\n");
354350 return SCSI_MLQUEUE_HOST_BUSY;
355351 }
356352 }
357353
358− io_req->sense_buf_pa = pci_map_single(fnic->pdev,
354+ io_req->sense_buf_pa = dma_map_single(&fnic->pdev->dev,
359355 sc->sense_buffer,
360356 SCSI_SENSE_BUFFERSIZE,
361− PCI_DMA_FROMDEVICE);
362−
363− r = pci_dma_mapping_error(fnic->pdev, io_req->sense_buf_pa);
364− if (r) {
365− pci_unmap_single(fnic->pdev, io_req->sgl_list_pa,
357+ DMA_FROM_DEVICE);
358+ if (dma_mapping_error(&fnic->pdev->dev, io_req->sense_buf_pa)) {
359+ dma_unmap_single(&fnic->pdev->dev, io_req->sgl_list_pa,
366360 sizeof(io_req->sgl_list[0]) * sg_count,
367− PCI_DMA_TODEVICE);
368− printk(KERN_ERR "PCI mapping failed with error %d\n", r);
361+ DMA_TO_DEVICE);
362+ printk(KERN_ERR "DMA mapping failed\n");
369363 return SCSI_MLQUEUE_HOST_BUSY;
370364 }
371365
@@ -2272,33 +2266,17 @@ clean_pending_aborts_end: · 1900 unmodified lines
22722266 static inline int
22732267 fnic_scsi_host_start_tag(struct fnic *fnic, struct scsi_cmnd *sc)
22742268 {
2275− struct blk_queue_tag *bqt = fnic->lport->host->bqt;
2276− int tag, ret = SCSI_NO_TAG;
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));
2269+ struct request_queue *q = sc->request->q;
2270+ struct request *dummy;
22912271
2292− bqt->tag_index[tag] = sc->request;
2293− sc->request->tag = tag;
2294− sc->tag = tag;
2295− if (!sc->request->special)
2296− sc->request->special = sc;
2272+ dummy = blk_mq_alloc_request(q, REQ_OP_WRITE, BLK_MQ_REQ_NOWAIT);
2273+ if (IS_ERR(dummy))
2274+ return SCSI_NO_TAG;
22972275
2298− ret = tag;
2276+ sc->tag = sc->request->tag = dummy->tag;
2277+ sc->request->special = sc;
22992278
2300−end:
2301− return ret;
2279+ return dummy->tag;
23022280 }
23032281
23042282 /**
@@ -2308,20 +2286,9 @@ end: · 3 unmodified lines
23082286 static inline void
23092287 fnic_scsi_host_end_tag(struct fnic *fnic, struct scsi_cmnd *sc)
23102288 {
2311− struct blk_queue_tag *bqt = fnic->lport->host->bqt;
2312− int tag = sc->request->tag;
2289+ struct request *dummy = sc->request->special;
23132290
2314− if (tag == SCSI_NO_TAG)
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;
2291+ blk_mq_free_request(dummy);
23252292 }
23262293
23272294 /*
@@ -2380,19 +2347,9 @@ int fnic_device_reset(struct scsi_cmnd *sc) · 52 unmodified lines
23802347 tag = sc->request->tag;
23812348 if (unlikely(tag < 0)) {
23822349 /*
2383− * XXX(hch): current the midlayer fakes up a struct
2384− * request for the explicit reset ioctls, and those
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.
2350+ * Really should fix the midlayer to pass in a proper
2351+ * request for ioctls...
23942352 */
2395−
23962353 tag = fnic_scsi_host_start_tag(fnic, sc);
23972354 if (unlikely(tag == SCSI_NO_TAG))
23982355 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
195195 {
196196 vnic_dev_desc_ring_size(ring, desc_count, desc_size);
197197
198− ring->descs_unaligned = pci_alloc_consistent(vdev->pdev,
198+ ring->descs_unaligned = dma_alloc_coherent(&vdev->pdev->dev,
199199 ring->size_unaligned,
200− &ring->base_addr_unaligned);
200+ &ring->base_addr_unaligned, GFP_KERNEL);
201201
202202 if (!ring->descs_unaligned) {
203203 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
221221 void vnic_dev_free_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring)
222222 {
223223 if (ring->descs) {
224− pci_free_consistent(vdev->pdev,
224+ dma_free_coherent(&vdev->pdev->dev,
225225 ring->size_unaligned,
226226 ring->descs_unaligned,
227227 ring->base_addr_unaligned);
@@ -298,9 +298,9 @@ int vnic_dev_fw_info(struct vnic_dev *vdev, · 70 unmodified lines
298298 int err = 0;
299299
300300 if (!vdev->fw_info) {
301− vdev->fw_info = pci_alloc_consistent(vdev->pdev,
301+ vdev->fw_info = dma_alloc_coherent(&vdev->pdev->dev,
302302 sizeof(struct vnic_devcmd_fw_info),
303− &vdev->fw_info_pa);
303+ &vdev->fw_info_pa, GFP_KERNEL);
304304 if (!vdev->fw_info)
305305 return -ENOMEM;
306306
@@ -361,8 +361,8 @@ int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats) · 54 unmodified lines
361361 int wait = 1000;
362362
363363 if (!vdev->stats) {
364− vdev->stats = pci_alloc_consistent(vdev->pdev,
365− sizeof(struct vnic_stats), &vdev->stats_pa);
364+ vdev->stats = dma_alloc_coherent(&vdev->pdev->dev,
365+ sizeof(struct vnic_stats), &vdev->stats_pa, GFP_KERNEL);
366366 if (!vdev->stats)
367367 return -ENOMEM;
368368 }
@@ -523,9 +523,9 @@ int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) · 154 unmodified lines
523523 int wait = 1000;
524524
525525 if (!vdev->notify) {
526− vdev->notify = pci_alloc_consistent(vdev->pdev,
526+ vdev->notify = dma_alloc_coherent(&vdev->pdev->dev,
527527 sizeof(struct vnic_devcmd_notify),
528− &vdev->notify_pa);
528+ &vdev->notify_pa, GFP_KERNEL);
529529 if (!vdev->notify)
530530 return -ENOMEM;
531531 }
@@ -647,21 +647,21 @@ void vnic_dev_unregister(struct vnic_dev *vdev) · 115 unmodified lines
647647 {
648648 if (vdev) {
649649 if (vdev->notify)
650− pci_free_consistent(vdev->pdev,
650+ dma_free_coherent(&vdev->pdev->dev,
651651 sizeof(struct vnic_devcmd_notify),
652652 vdev->notify,
653653 vdev->notify_pa);
654654 if (vdev->linkstatus)
655− pci_free_consistent(vdev->pdev,
655+ dma_free_coherent(&vdev->pdev->dev,
656656 sizeof(u32),
657657 vdev->linkstatus,
658658 vdev->linkstatus_pa);
659659 if (vdev->stats)
660− pci_free_consistent(vdev->pdev,
660+ dma_free_coherent(&vdev->pdev->dev,
661661 sizeof(struct vnic_stats),
662662 vdev->stats, vdev->stats_pa);
663663 if (vdev->fw_info)
664− pci_free_consistent(vdev->pdev,
664+ dma_free_coherent(&vdev->pdev->dev,
665665 sizeof(struct vnic_devcmd_fw_info),
666666 vdev->fw_info, vdev->fw_info_pa);
667667 kfree(vdev);
drivers/scsi/hisi_sas/hisi_sas.h+2−1
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #define HISI_SAS_MAX_DEVICES HISI_SAS_MAX_ITCT_ENTRIES
3535 #define HISI_SAS_RESET_BIT 0
3636 #define HISI_SAS_REJECT_CMD_BIT 1
37+#define HISI_SAS_RESERVED_IPTT_CNT 96
3738
3839 #define HISI_SAS_STATUS_BUF_SZ (sizeof(struct hisi_sas_status_buffer))
3940 #define HISI_SAS_COMMAND_TABLE_SZ (sizeof(union hisi_sas_command_table))
@@ -217,7 +218,7 @@ struct hisi_sas_hw { · 177 unmodified lines
217218 int (*hw_init)(struct hisi_hba *hisi_hba);
218219 void (*setup_itct)(struct hisi_hba *hisi_hba,
219220 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,
221222 struct domain_device *device);
222223 struct hisi_sas_device *(*alloc_dev)(struct domain_device *device);
223224 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
183183
184184 static void hisi_sas_slot_index_free(struct hisi_hba *hisi_hba, int slot_idx)
185185 {
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+ }
187194 }
188195
189196 static 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
193200 set_bit(slot_idx, bitmap);
194201 }
195202
196−static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba, int *slot_idx)
203+static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba,
204+ struct scsi_cmnd *scsi_cmnd)
197205 {
198− unsigned int index;
206+ int index;
199207 void *bitmap = hisi_hba->slot_index_tags;
208+ unsigned long flags;
209+
210+ if (scsi_cmnd)
211+ return scsi_cmnd->request->tag;
200212
213+ spin_lock_irqsave(&hisi_hba->lock, flags);
201214 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);
203216 if (index >= hisi_hba->slot_index_count) {
204− index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count,
205− 0);
206− if (index >= hisi_hba->slot_index_count)
217+ index = find_next_zero_bit(bitmap,
218+ 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);
207223 return -SAS_QUEUE_FULL;
224+ }
208225 }
209226 hisi_sas_slot_index_set(hisi_hba, index);
210− *slot_idx = index;
211227 hisi_hba->last_slot_index = index;
228+ spin_unlock_irqrestore(&hisi_hba->lock, flags);
212229
213− return 0;
230+ return index;
214231 }
215232
216233 static 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
249266
250267 memset(slot, 0, offsetof(struct hisi_sas_slot, buf));
251268
252− spin_lock_irqsave(&hisi_hba->lock, flags);
253269 hisi_sas_slot_index_free(hisi_hba, slot->idx);
254− spin_unlock_irqrestore(&hisi_hba->lock, flags);
255270 }
256271 EXPORT_SYMBOL_GPL(hisi_sas_slot_task_free);
257272
@@ -287,13 +302,13 @@ static int hisi_sas_task_prep(struct sas_task *task, · 29 unmodified lines
287302 int *pass)
288303 {
289304 struct domain_device *device = task->dev;
290− struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
305+ struct hisi_hba *hisi_hba;
291306 struct hisi_sas_device *sas_dev = device->lldd_dev;
292307 struct hisi_sas_port *port;
293308 struct hisi_sas_slot *slot;
294309 struct hisi_sas_cmd_hdr *cmd_hdr_base;
295310 struct asd_sas_port *sas_port = device->port;
296− struct device *dev = hisi_hba->dev;
311+ struct device *dev;
297312 int dlvry_queue_slot, dlvry_queue, rc, slot_idx;
298313 int n_elem = 0, n_elem_req = 0, n_elem_resp = 0;
299314 struct hisi_sas_dq *dq;
@@ -314,6 +329,9 @@ static int hisi_sas_task_prep(struct sas_task *task, · 14 unmodified lines
314329 return -ECOMM;
315330 }
316331
332+ hisi_hba = dev_to_hisi_hba(device);
333+ dev = hisi_hba->dev;
334+
317335 if (DEV_IS_GONE(sas_dev)) {
318336 if (sas_dev)
319337 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
381399 goto err_out_dma_unmap;
382400 }
383401
384− spin_lock_irqsave(&hisi_hba->lock, flags);
385402 if (hisi_hba->hw->slot_index_alloc)
386− rc = hisi_hba->hw->slot_index_alloc(hisi_hba, &slot_idx,
387− device);
388− else
389− rc = hisi_sas_slot_index_alloc(hisi_hba, &slot_idx);
390− spin_unlock_irqrestore(&hisi_hba->lock, flags);
391− if (rc)
403+ rc = hisi_hba->hw->slot_index_alloc(hisi_hba, device);
404+ else {
405+ struct scsi_cmnd *scsi_cmnd = NULL;
406+
407+ if (task->uldd_task) {
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)
392420 goto err_out_dma_unmap;
393421
422+ slot_idx = rc;
394423 slot = &hisi_hba->slot_info[slot_idx];
395424
396425 spin_lock_irqsave(&dq->lock, flags);
@@ -451,9 +480,7 @@ static int hisi_sas_task_prep(struct sas_task *task, · 54 unmodified lines
451480 return 0;
452481
453482 err_out_tag:
454− spin_lock_irqsave(&hisi_hba->lock, flags);
455483 hisi_sas_slot_index_free(hisi_hba, slot_idx);
456− spin_unlock_irqrestore(&hisi_hba->lock, flags);
457484 err_out_dma_unmap:
458485 if (!sas_protocol_ata(task->task_proto)) {
459486 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
904931 _r.maximum_linkrate = max;
905932 _r.minimum_linkrate = min;
906933
934+ sas_phy->phy->maximum_linkrate = max;
935+ sas_phy->phy->minimum_linkrate = min;
936+
907937 hisi_hba->hw->phy_disable(hisi_hba, phy_no);
908938 msleep(100);
909939 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
950980
951981 static void hisi_sas_task_done(struct sas_task *task)
952982 {
953− if (!del_timer(&task->slow_task->timer))
954− return;
983+ del_timer(&task->slow_task->timer);
955984 complete(&task->slow_task->completion);
956985 }
957986
@@ -960,13 +989,17 @@ static void hisi_sas_tmf_timedout(struct timer_list *t) · 2 unmodified lines
960989 struct sas_task_slow *slow = from_timer(slow, t, timer);
961990 struct sas_task *task = slow->task;
962991 unsigned long flags;
992+ bool is_completed = true;
963993
964994 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)) {
966996 task->task_state_flags |= SAS_TASK_STATE_ABORTED;
997+ is_completed = false;
998+ }
967999 spin_unlock_irqrestore(&task->task_state_lock, flags);
9681000
969− complete(&task->slow_task->completion);
1001+ if (!is_completed)
1002+ complete(&task->slow_task->completion);
9701003 }
9711004
9721005 #define TASK_TIMEOUT 20
@@ -1019,8 +1052,16 @@ static int hisi_sas_exec_internal_tmf_task(struct domain_device *device, · 46 unmodified lines
10191052 struct hisi_sas_slot *slot = task->lldd_task;
10201053
10211054 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);
10231063 slot->task = NULL;
1064+ }
10241065
10251066 goto ex_err;
10261067 } else
@@ -1396,6 +1437,17 @@ static int hisi_sas_abort_task(struct sas_task *task) · 369 unmodified lines
13961437
13971438 spin_lock_irqsave(&task->task_state_lock, flags);
13981439 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+ }
13991451 spin_unlock_irqrestore(&task->task_state_lock, flags);
14001452 rc = TMF_RESP_FUNC_COMPLETE;
14011453 goto out;
@@ -1451,12 +1503,19 @@ static int hisi_sas_abort_task(struct sas_task *task) · 49 unmodified lines
14511503 /* SMP */
14521504 struct hisi_sas_slot *slot = task->lldd_task;
14531505 u32 tag = slot->idx;
1506+ struct hisi_sas_cq *cq = &hisi_hba->cq[slot->dlvry_queue];
14541507
14551508 rc = hisi_sas_internal_task_abort(hisi_hba, device,
14561509 HISI_SAS_INT_ABT_CMD, tag);
14571510 if (((rc < 0) || (rc == TMF_RESP_FUNC_FAILED)) &&
1458− task->lldd_task)
1459− hisi_sas_do_release_task(hisi_hba, task, slot);
1511+ task->lldd_task) {
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+ }
14601519 }
14611520
14621521 out:
@@ -1705,14 +1764,11 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id, · 242 unmodified lines
17051764 port = to_hisi_sas_port(sas_port);
17061765
17071766 /* simply get a slot and send abort command */
1708− spin_lock_irqsave(&hisi_hba->lock, flags);
1709− rc = hisi_sas_slot_index_alloc(hisi_hba, &slot_idx);
1710− if (rc) {
1711− spin_unlock_irqrestore(&hisi_hba->lock, flags);
1767+ rc = hisi_sas_slot_index_alloc(hisi_hba, NULL);
1768+ if (rc < 0)
17121769 goto err_out;
1713− }
1714− spin_unlock_irqrestore(&hisi_hba->lock, flags);
17151770
1771+ slot_idx = rc;
17161772 slot = &hisi_hba->slot_info[slot_idx];
17171773
17181774 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
17481804 spin_lock_irqsave(&task->task_state_lock, flags);
17491805 task->task_state_flags |= SAS_TASK_AT_INITIATOR;
17501806 spin_unlock_irqrestore(&task->task_state_lock, flags);
1751−
17521807 WRITE_ONCE(slot->ready, 1);
17531808 /* send abort command to the chip */
17541809 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
17591814 return 0;
17601815
17611816 err_out_tag:
1762− spin_lock_irqsave(&hisi_hba->lock, flags);
17631817 hisi_sas_slot_index_free(hisi_hba, slot_idx);
1764− spin_unlock_irqrestore(&hisi_hba->lock, flags);
17651818 err_out:
17661819 dev_err(dev, "internal abort task prep: failed[%d]!\n", rc);
17671820
@@ -1823,8 +1876,16 @@ hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba, · 55 unmodified lines
18231876 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) {
18241877 struct hisi_sas_slot *slot = task->lldd_task;
18251878
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);
18271887 slot->task = NULL;
1888+ }
18281889 dev_err(dev, "internal task abort: timeout and not done.\n");
18291890 res = -EIO;
18301891 goto exit;
@@ -1861,10 +1922,6 @@ static void hisi_sas_port_formed(struct asd_sas_phy *sas_phy) · 30 unmodified lines
18611922 hisi_sas_port_notify_formed(sas_phy);
18621923 }
18631924
1864−static void hisi_sas_port_deformed(struct asd_sas_phy *sas_phy)
1865−{
1866−}
1867−
18681925 static int hisi_sas_write_gpio(struct sas_ha_struct *sha, u8 reg_type,
18691926 u8 reg_index, u8 reg_count, u8 *write_data)
18701927 {
@@ -1954,10 +2011,9 @@ static struct sas_domain_function_template hisi_sas_transport_ops = { · 83 unmodified lines
19542011 .lldd_I_T_nexus_reset = hisi_sas_I_T_nexus_reset,
19552012 .lldd_lu_reset = hisi_sas_lu_reset,
19562013 .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,
19582015 .lldd_port_formed = hisi_sas_port_formed,
1959− .lldd_port_deformed = hisi_sas_port_deformed,
1960− .lldd_write_gpio = hisi_sas_write_gpio,
2016+ .lldd_write_gpio = hisi_sas_write_gpio,
19612017 };
19622018
19632019 void 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
21202176 hisi_sas_init_mem(hisi_hba);
21212177
21222178 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;
21232181
21242182 hisi_hba->wq = create_singlethread_workqueue(dev_name(dev));
21252183 if (!hisi_hba->wq) {
@@ -2323,8 +2381,15 @@ int hisi_sas_probe(struct platform_device *pdev, · 197 unmodified lines
23232381 shost->max_channel = 1;
23242382 shost->max_cmd_len = 16;
23252383 shost->sg_tablesize = min_t(u16, SG_ALL, HISI_SAS_SGE_PAGE_CNT);
2326− shost->can_queue = hisi_hba->hw->max_command_entries;
2327− shost->cmd_per_lun = hisi_hba->hw->max_command_entries;
2384+ if (hisi_hba->hw->slot_index_alloc) {
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+ }
23282393
23292394 sha->sas_ha_name = DRV_NAME;
23302395 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
18091809 .scan_start = hisi_sas_scan_start,
18101810 .change_queue_depth = sas_change_queue_depth,
18111811 .bios_param = sas_bios_param,
1812− .can_queue = 1,
18131812 .this_id = -1,
18141813 .sg_tablesize = SG_ALL,
18151814 .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
770770
771771 /* This function needs to be protected from pre-emption. */
772772 static int
773−slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx,
773+slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba,
774774 struct domain_device *device)
775775 {
776776 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
778778 struct hisi_sas_device *sas_dev = device->lldd_dev;
779779 int sata_idx = sas_dev->sata_idx;
780780 int start, end;
781+ unsigned long flags;
781782
782783 if (!sata_dev) {
783784 /*
@@ -801,11 +802,14 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx, · 17 unmodified lines
801802 end = 64 * (sata_idx + 2);
802803 }
803804
805+ spin_lock_irqsave(&hisi_hba->lock, flags);
804806 while (1) {
805807 start = find_next_zero_bit(bitmap,
806808 hisi_hba->slot_index_count, start);
807− if (start >= end)
809+ if (start >= end) {
810+ spin_unlock_irqrestore(&hisi_hba->lock, flags);
808811 return -SAS_QUEUE_FULL;
812+ }
809813 /*
810814 * SAS IPTT bit0 should be 1, and SATA IPTT bit0 should be 0.
811815 */
@@ -815,8 +819,8 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx, · 3 unmodified lines
815819 }
816820
817821 set_bit(start, bitmap);
818− *slot_idx = start;
819− return 0;
822+ spin_unlock_irqrestore(&hisi_hba->lock, flags);
823+ return start;
820824 }
821825
822826 static 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
24832487 }
24842488
24852489 out:
2486− hisi_sas_slot_task_free(hisi_hba, task, slot);
24872490 sts = ts->stat;
24882491 spin_lock_irqsave(&task->task_state_lock, flags);
24892492 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {
@@ -2493,6 +2496,7 @@ out: · 3 unmodified lines
24932496 }
24942497 task->task_state_flags |= SAS_TASK_STATE_DONE;
24952498 spin_unlock_irqrestore(&task->task_state_lock, flags);
2499+ hisi_sas_slot_task_free(hisi_hba, task, slot);
24962500
24972501 if (!is_internal && (task->task_proto != SAS_PROTOCOL_SMP)) {
24982502 spin_lock_irqsave(&device->done_lock, flags);
@@ -3560,7 +3564,6 @@ static struct scsi_host_template sht_v2_hw = { · 1061 unmodified lines
35603564 .scan_start = hisi_sas_scan_start,
35613565 .change_queue_depth = sas_change_queue_depth,
35623566 .bios_param = sas_bios_param,
3563− .can_queue = 1,
35643567 .this_id = -1,
35653568 .sg_tablesize = SG_ALL,
35663569 .max_sectors = SCSI_DEFAULT_MAX_SECTORS,
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c+10−5
@@ -127,6 +127,7 @@ · 126 unmodified lines
127127 #define PHY_CTRL_RESET_OFF 0
128128 #define PHY_CTRL_RESET_MSK (0x1 << PHY_CTRL_RESET_OFF)
129129 #define SL_CFG (PORT_BASE + 0x84)
130+#define AIP_LIMIT (PORT_BASE + 0x90)
130131 #define SL_CONTROL (PORT_BASE + 0x94)
131132 #define SL_CONTROL_NOTIFY_EN_OFF 0
132133 #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
431432 (u32)((1ULL << hisi_hba->queue_count) - 1));
432433 hisi_sas_write32(hisi_hba, CFG_MAX_TAG, 0xfff0400);
433434 hisi_sas_write32(hisi_hba, HGC_SAS_TXFAIL_RETRY_CTRL, 0x108);
435+ hisi_sas_write32(hisi_hba, CFG_AGING_TIME, 0x1);
434436 hisi_sas_write32(hisi_hba, INT_COAL_EN, 0x1);
435437 hisi_sas_write32(hisi_hba, OQ_INT_COAL_TIME, 0x1);
436438 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
441443 hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK1, 0xfefefefe);
442444 hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK2, 0xfefefefe);
443445 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);
445447 else
446448 hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, 0xfffe20ff);
447449 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
495497
496498 /* used for 12G negotiate */
497499 hisi_sas_phy_write32(hisi_hba, i, COARSETUNE_TIME, 0x1e);
500+ hisi_sas_phy_write32(hisi_hba, i, AIP_LIMIT, 0x2ffff);
498501 }
499502
500503 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
17511754 }
17521755
17531756 out:
1754− hisi_sas_slot_task_free(hisi_hba, task, slot);
17551757 sts = ts->stat;
17561758 spin_lock_irqsave(&task->task_state_lock, flags);
17571759 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {
@@ -1761,6 +1763,7 @@ out: · 3 unmodified lines
17611763 }
17621764 task->task_state_flags |= SAS_TASK_STATE_DONE;
17631765 spin_unlock_irqrestore(&task->task_state_lock, flags);
1766+ hisi_sas_slot_task_free(hisi_hba, task, slot);
17641767
17651768 if (!is_internal && (task->task_proto != SAS_PROTOCOL_SMP)) {
17661769 spin_lock_irqsave(&device->done_lock, flags);
@@ -2098,7 +2101,6 @@ static struct scsi_host_template sht_v3_hw = { · 331 unmodified lines
20982101 .scan_start = hisi_sas_scan_start,
20992102 .change_queue_depth = sas_change_queue_depth,
21002103 .bios_param = sas_bios_param,
2101− .can_queue = 1,
21022104 .this_id = -1,
21032105 .sg_tablesize = SG_ALL,
21042106 .max_sectors = SCSI_DEFAULT_MAX_SECTORS,
@@ -2108,6 +2110,7 @@ static struct scsi_host_template sht_v3_hw = { · 3 unmodified lines
21082110 .target_destroy = sas_target_destroy,
21092111 .ioctl = sas_ioctl,
21102112 .shost_attrs = host_attrs,
2113+ .tag_alloc_policy = BLK_TAG_ALLOC_RR,
21112114 };
21122115
21132116 static 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
22452248 shost->max_channel = 1;
22462249 shost->max_cmd_len = 16;
22472250 shost->sg_tablesize = min_t(u16, SG_ALL, HISI_SAS_SGE_PAGE_CNT);
2248− shost->can_queue = hisi_hba->hw->max_command_entries;
2249− shost->cmd_per_lun = hisi_hba->hw->max_command_entries;
2251+ shost->can_queue = 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;
22502255
22512256 sha->sas_ha_name = DRV_NAME;
22522257 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
22402240
22412241 chain_block = h->ioaccel2_cmd_sg_list[c->cmdindex];
22422242 chain_size = le32_to_cpu(cp->sg[0].length);
2243− temp64 = pci_map_single(h->pdev, chain_block, chain_size,
2244− PCI_DMA_TODEVICE);
2243+ temp64 = dma_map_single(&h->pdev->dev, chain_block, chain_size,
2244+ DMA_TO_DEVICE);
22452245 if (dma_mapping_error(&h->pdev->dev, temp64)) {
22462246 /* prevent subsequent unmapping */
22472247 cp->sg->address = 0;
@@ -2261,7 +2261,7 @@ static void hpsa_unmap_ioaccel2_sg_chain_block(struct ctlr_info *h, · 13 unmodified lines
22612261 chain_sg = cp->sg;
22622262 temp64 = le64_to_cpu(chain_sg->address);
22632263 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);
22652265 }
22662266
22672267 static 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
22772277 chain_len = sizeof(*chain_sg) *
22782278 (le16_to_cpu(c->Header.SGTotal) - h->max_cmd_sg_entries);
22792279 chain_sg->Len = cpu_to_le32(chain_len);
2280− temp64 = pci_map_single(h->pdev, chain_block, chain_len,
2281− PCI_DMA_TODEVICE);
2280+ temp64 = dma_map_single(&h->pdev->dev, chain_block, chain_len,
2281+ DMA_TO_DEVICE);
22822282 if (dma_mapping_error(&h->pdev->dev, temp64)) {
22832283 /* prevent subsequent unmapping */
22842284 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
22972297 return;
22982298
22992299 chain_sg = &c->SG[h->max_cmd_sg_entries - 1];
2300− pci_unmap_single(h->pdev, le64_to_cpu(chain_sg->Addr),
2301− le32_to_cpu(chain_sg->Len), PCI_DMA_TODEVICE);
2300+ dma_unmap_single(&h->pdev->dev, le64_to_cpu(chain_sg->Addr),
2301+ le32_to_cpu(chain_sg->Len), DMA_TO_DEVICE);
23022302 }
23032303
23042304
@@ -2759,13 +2759,13 @@ static void complete_scsi_command(struct CommandList *cp) · 454 unmodified lines
27592759 return hpsa_cmd_free_and_done(h, cp, cmd);
27602760 }
27612761
2762−static void hpsa_pci_unmap(struct pci_dev *pdev,
2763− struct CommandList *c, int sg_used, int data_direction)
2762+static void hpsa_pci_unmap(struct pci_dev *pdev, struct CommandList *c,
2763+ int sg_used, enum dma_data_direction data_direction)
27642764 {
27652765 int i;
27662766
27672767 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),
27692769 le32_to_cpu(c->SG[i].Len),
27702770 data_direction);
27712771 }
@@ -2774,17 +2774,17 @@ static int hpsa_map_one(struct pci_dev *pdev, · 2 unmodified lines
27742774 struct CommandList *cp,
27752775 unsigned char *buf,
27762776 size_t buflen,
2777− int data_direction)
2777+ enum dma_data_direction data_direction)
27782778 {
27792779 u64 addr64;
27802780
2781− if (buflen == 0 || data_direction == PCI_DMA_NONE) {
2781+ if (buflen == 0 || data_direction == DMA_NONE) {
27822782 cp->Header.SGList = 0;
27832783 cp->Header.SGTotal = cpu_to_le16(0);
27842784 return 0;
27852785 }
27862786
2787− addr64 = pci_map_single(pdev, buf, buflen, data_direction);
2787+ addr64 = dma_map_single(&pdev->dev, buf, buflen, data_direction);
27882788 if (dma_mapping_error(&pdev->dev, addr64)) {
27892789 /* Prevent subsequent unmap of something never mapped */
27902790 cp->Header.SGList = 0;
@@ -2845,7 +2845,8 @@ static u32 lockup_detected(struct ctlr_info *h) · 54 unmodified lines
28452845
28462846 #define MAX_DRIVER_CMD_RETRIES 25
28472847 static 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)
28492850 {
28502851 int backoff_time = 10, retry_count = 0;
28512852 int rc;
@@ -2969,8 +2970,8 @@ static int hpsa_do_receive_diagnostic(struct ctlr_info *h, u8 *scsi3addr, · 117 unmodified lines
29692970 rc = -1;
29702971 goto out;
29712972 }
2972− rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
2973− PCI_DMA_FROMDEVICE, NO_TIMEOUT);
2973+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
2974+ NO_TIMEOUT);
29742975 if (rc)
29752976 goto out;
29762977 ei = c->err_info;
@@ -3022,8 +3023,8 @@ static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr, · 45 unmodified lines
30223023 rc = -1;
30233024 goto out;
30243025 }
3025− rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3026− PCI_DMA_FROMDEVICE, NO_TIMEOUT);
3026+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
3027+ NO_TIMEOUT);
30273028 if (rc)
30283029 goto out;
30293030 ei = c->err_info;
@@ -3306,8 +3307,8 @@ static int hpsa_get_raid_map(struct ctlr_info *h, · 276 unmodified lines
33063307 cmd_free(h, c);
33073308 return -1;
33083309 }
3309− rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3310− PCI_DMA_FROMDEVICE, NO_TIMEOUT);
3310+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
3311+ NO_TIMEOUT);
33113312 if (rc)
33123313 goto out;
33133314 ei = c->err_info;
@@ -3349,8 +3350,8 @@ static int hpsa_bmic_sense_subsystem_information(struct ctlr_info *h, · 35 unmodified lines
33493350 c->Request.CDB[2] = bmic_device_index & 0xff;
33503351 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
33513352
3352− rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3353− PCI_DMA_FROMDEVICE, NO_TIMEOUT);
3353+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
3354+ NO_TIMEOUT);
33543355 if (rc)
33553356 goto out;
33563357 ei = c->err_info;
@@ -3377,8 +3378,8 @@ static int hpsa_bmic_id_controller(struct ctlr_info *h, · 20 unmodified lines
33773378 if (rc)
33783379 goto out;
33793380
3380− rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3381− PCI_DMA_FROMDEVICE, NO_TIMEOUT);
3381+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
3382+ NO_TIMEOUT);
33823383 if (rc)
33833384 goto out;
33843385 ei = c->err_info;
@@ -3408,7 +3409,7 @@ static int hpsa_bmic_id_physical_device(struct ctlr_info *h, · 23 unmodified lines
34083409 c->Request.CDB[2] = bmic_device_index & 0xff;
34093410 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
34103411
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,
34123413 NO_TIMEOUT);
34133414 ei = c->err_info;
34143415 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
34843485 else
34853486 c->Request.CDB[5] = 0;
34863487
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,
34883489 NO_TIMEOUT);
34893490 if (rc)
34903491 goto out;
@@ -3731,8 +3732,8 @@ static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical, · 240 unmodified lines
37313732 }
37323733 if (extended_response)
37333734 c->Request.CDB[1] = extended_response;
3734− rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3735− PCI_DMA_FROMDEVICE, NO_TIMEOUT);
3735+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
3736+ NO_TIMEOUT);
37363737 if (rc)
37373738 goto out;
37383739 ei = c->err_info;
@@ -6320,8 +6321,8 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp) · 2581 unmodified lines
63206321
63216322 /* Fill in the scatter gather information */
63226323 if (iocommand.buf_size > 0) {
6323− temp64 = pci_map_single(h->pdev, buff,
6324− iocommand.buf_size, PCI_DMA_BIDIRECTIONAL);
6324+ temp64 = dma_map_single(&h->pdev->dev, buff,
6325+ iocommand.buf_size, DMA_BIDIRECTIONAL);
63256326 if (dma_mapping_error(&h->pdev->dev, (dma_addr_t) temp64)) {
63266327 c->SG[0].Addr = cpu_to_le64(0);
63276328 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
63356336 rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
63366337 NO_TIMEOUT);
63376338 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);
63396340 check_ioctl_unit_attention(h, c);
63406341 if (rc) {
63416342 rc = -EIO;
@@ -6381,13 +6382,9 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) · 39 unmodified lines
63816382 return -EINVAL;
63826383 if (!capable(CAP_SYS_RAWIO))
63836384 return -EPERM;
6384− ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
6385− if (!ioc) {
6386− status = -ENOMEM;
6387− goto cleanup1;
6388− }
6389− if (copy_from_user(ioc, argp, sizeof(*ioc))) {
6390− status = -EFAULT;
6385+ ioc = vmemdup_user(argp, sizeof(*ioc));
6386+ if (IS_ERR(ioc)) {
6387+ status = PTR_ERR(ioc);
63916388 goto cleanup1;
63926389 }
63936390 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
64476444 if (ioc->buf_size > 0) {
64486445 int i;
64496446 for (i = 0; i < sg_used; i++) {
6450− temp64 = pci_map_single(h->pdev, buff[i],
6451− buff_size[i], PCI_DMA_BIDIRECTIONAL);
6447+ temp64 = dma_map_single(&h->pdev->dev, buff[i],
6448+ buff_size[i], DMA_BIDIRECTIONAL);
64526449 if (dma_mapping_error(&h->pdev->dev,
64536450 (dma_addr_t) temp64)) {
64546451 c->SG[i].Addr = cpu_to_le64(0);
64556452 c->SG[i].Len = cpu_to_le32(0);
64566453 hpsa_pci_unmap(h->pdev, c, i,
6457− PCI_DMA_BIDIRECTIONAL);
6454+ DMA_BIDIRECTIONAL);
64586455 status = -ENOMEM;
64596456 goto cleanup0;
64606457 }
@@ -6467,7 +6464,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp) · 6 unmodified lines
64676464 status = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
64686465 NO_TIMEOUT);
64696466 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);
64716468 check_ioctl_unit_attention(h, c);
64726469 if (status) {
64736470 status = -EIO;
@@ -6505,7 +6502,7 @@ cleanup1: · 31 unmodified lines
65056502 kfree(buff);
65066503 }
65076504 kfree(buff_size);
6508− kfree(ioc);
6505+ kvfree(ioc);
65096506 return status;
65106507 }
65116508
@@ -6579,7 +6576,7 @@ static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h, · 67 unmodified lines
65796576 void *buff, size_t size, u16 page_code, unsigned char *scsi3addr,
65806577 int cmd_type)
65816578 {
6582− int pci_dir = XFER_NONE;
6579+ enum dma_data_direction dir = DMA_NONE;
65836580
65846581 c->cmd_type = CMD_IOCTL_PEND;
65856582 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
67856782
67866783 switch (GET_DIR(c->Request.type_attr_dir)) {
67876784 case XFER_READ:
6788− pci_dir = PCI_DMA_FROMDEVICE;
6785+ dir = DMA_FROM_DEVICE;
67896786 break;
67906787 case XFER_WRITE:
6791− pci_dir = PCI_DMA_TODEVICE;
6788+ dir = DMA_TO_DEVICE;
67926789 break;
67936790 case XFER_NONE:
6794− pci_dir = PCI_DMA_NONE;
6791+ dir = DMA_NONE;
67956792 break;
67966793 default:
6797− pci_dir = PCI_DMA_BIDIRECTIONAL;
6794+ dir = DMA_BIDIRECTIONAL;
67986795 }
6799− if (hpsa_map_one(h->pdev, c, buff, size, pci_dir))
6796+ if (hpsa_map_one(h->pdev, c, buff, size, dir))
68006797 return -1;
68016798 return 0;
68026799 }
@@ -6992,13 +6989,13 @@ static int hpsa_message(struct pci_dev *pdev, unsigned char opcode, · 189 unmodified lines
69926989 * CCISS commands, so they must be allocated from the lower 4GiB of
69936990 * memory.
69946991 */
6995− err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
6992+ err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
69966993 if (err) {
69976994 iounmap(vaddr);
69986995 return err;
69996996 }
70006997
7001− cmd = pci_alloc_consistent(pdev, cmd_sz, &paddr64);
6998+ cmd = dma_alloc_coherent(&pdev->dev, cmd_sz, &paddr64, GFP_KERNEL);
70026999 if (cmd == NULL) {
70037000 iounmap(vaddr);
70047001 return -ENOMEM;
@@ -7047,7 +7044,7 @@ static int hpsa_message(struct pci_dev *pdev, unsigned char opcode, · 42 unmodified lines
70477044 return -ETIMEDOUT;
70487045 }
70497046
7050− pci_free_consistent(pdev, cmd_sz, cmd, paddr64);
7047+ dma_free_coherent(&pdev->dev, cmd_sz, cmd, paddr64);
70517048
70527049 if (tag & HPSA_ERROR_BIT) {
70537050 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
79147911 kfree(h->cmd_pool_bits);
79157912 h->cmd_pool_bits = NULL;
79167913 if (h->cmd_pool) {
7917− pci_free_consistent(h->pdev,
7914+ dma_free_coherent(&h->pdev->dev,
79187915 h->nr_cmds * sizeof(struct CommandList),
79197916 h->cmd_pool,
79207917 h->cmd_pool_dhandle);
@@ -7922,7 +7919,7 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h) · 1 unmodified line
79227919 h->cmd_pool_dhandle = 0;
79237920 }
79247921 if (h->errinfo_pool) {
7925− pci_free_consistent(h->pdev,
7922+ dma_free_coherent(&h->pdev->dev,
79267923 h->nr_cmds * sizeof(struct ErrorInfo),
79277924 h->errinfo_pool,
79287925 h->errinfo_pool_dhandle);
@@ -7936,12 +7933,12 @@ static int hpsa_alloc_cmd_pool(struct ctlr_info *h) · 7 unmodified lines
79367933 h->cmd_pool_bits = kcalloc(DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG),
79377934 sizeof(unsigned long),
79387935 GFP_KERNEL);
7939− h->cmd_pool = pci_alloc_consistent(h->pdev,
7936+ h->cmd_pool = dma_alloc_coherent(&h->pdev->dev,
79407937 h->nr_cmds * sizeof(*h->cmd_pool),
7941− &(h->cmd_pool_dhandle));
7942− h->errinfo_pool = pci_alloc_consistent(h->pdev,
7938+ &h->cmd_pool_dhandle, GFP_KERNEL);
7939+ h->errinfo_pool = dma_alloc_coherent(&h->pdev->dev,
79437940 h->nr_cmds * sizeof(*h->errinfo_pool),
7944− &(h->errinfo_pool_dhandle));
7941+ &h->errinfo_pool_dhandle, GFP_KERNEL);
79457942 if ((h->cmd_pool_bits == NULL)
79467943 || (h->cmd_pool == NULL)
79477944 || (h->errinfo_pool == NULL)) {
@@ -8068,7 +8065,7 @@ static void hpsa_free_reply_queues(struct ctlr_info *h) · 120 unmodified lines
80688065 for (i = 0; i < h->nreply_queues; i++) {
80698066 if (!h->reply_queue[i].head)
80708067 continue;
8071− pci_free_consistent(h->pdev,
8068+ dma_free_coherent(&h->pdev->dev,
80728069 h->reply_queue_size,
80738070 h->reply_queue[i].head,
80748071 h->reply_queue[i].busaddr);
@@ -8594,11 +8591,11 @@ reinit_after_soft_reset: · 519 unmodified lines
85948591 number_of_controllers++;
85958592
85968593 /* 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));
85988595 if (rc == 0) {
85998596 dac = 1;
86008597 } else {
8601− rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
8598+ rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
86028599 if (rc == 0) {
86038600 dac = 0;
86048601 } else {
@@ -8797,8 +8794,8 @@ static void hpsa_flush_cache(struct ctlr_info *h) · 192 unmodified lines
87978794 RAID_CTLR_LUNID, TYPE_CMD)) {
87988795 goto out;
87998796 }
8800− rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
8801− PCI_DMA_TODEVICE, DEFAULT_TIMEOUT);
8797+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_TO_DEVICE,
8798+ DEFAULT_TIMEOUT);
88028799 if (rc)
88038800 goto out;
88048801 if (c->err_info->CommandStatus != 0)
@@ -8833,8 +8830,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h) · 28 unmodified lines
88338830 RAID_CTLR_LUNID, TYPE_CMD))
88348831 goto errout;
88358832
8836− rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
8837− PCI_DMA_FROMDEVICE, NO_TIMEOUT);
8833+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
8834+ NO_TIMEOUT);
88388835 if ((rc != 0) || (c->err_info->CommandStatus != 0))
88398836 goto errout;
88408837
@@ -8845,8 +8842,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h) · 4 unmodified lines
88458842 RAID_CTLR_LUNID, TYPE_CMD))
88468843 goto errout;
88478844
8848− rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
8849− PCI_DMA_TODEVICE, NO_TIMEOUT);
8845+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_TO_DEVICE,
8846+ NO_TIMEOUT);
88508847 if ((rc != 0) || (c->err_info->CommandStatus != 0))
88518848 goto errout;
88528849
@@ -8855,8 +8852,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h) · 2 unmodified lines
88558852 RAID_CTLR_LUNID, TYPE_CMD))
88568853 goto errout;
88578854
8858− rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
8859− PCI_DMA_FROMDEVICE, NO_TIMEOUT);
8855+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, DMA_FROM_DEVICE,
8856+ NO_TIMEOUT);
88608857 if ((rc != 0) || (c->err_info->CommandStatus != 0))
88618858 goto errout;
88628859
@@ -9228,9 +9225,9 @@ static int hpsa_alloc_ioaccel1_cmd_and_bft(struct ctlr_info *h) · 365 unmodified lines
92289225 BUILD_BUG_ON(sizeof(struct io_accel1_cmd) %
92299226 IOACCEL1_COMMANDLIST_ALIGNMENT);
92309227 h->ioaccel_cmd_pool =
9231− pci_alloc_consistent(h->pdev,
9228+ dma_alloc_coherent(&h->pdev->dev,
92329229 h->nr_cmds * sizeof(*h->ioaccel_cmd_pool),
9233− &(h->ioaccel_cmd_pool_dhandle));
9230+ &h->ioaccel_cmd_pool_dhandle, GFP_KERNEL);
92349231
92359232 h->ioaccel1_blockFetchTable =
92369233 kmalloc(((h->ioaccel_maxsg + 1) *
@@ -9281,9 +9278,9 @@ static int hpsa_alloc_ioaccel2_cmd_and_bft(struct ctlr_info *h) · 44 unmodified lines
92819278 BUILD_BUG_ON(sizeof(struct io_accel2_cmd) %
92829279 IOACCEL2_COMMANDLIST_ALIGNMENT);
92839280 h->ioaccel2_cmd_pool =
9284− pci_alloc_consistent(h->pdev,
9281+ dma_alloc_coherent(&h->pdev->dev,
92859282 h->nr_cmds * sizeof(*h->ioaccel2_cmd_pool),
9286− &(h->ioaccel2_cmd_pool_dhandle));
9283+ &h->ioaccel2_cmd_pool_dhandle, GFP_KERNEL);
92879284
92889285 h->ioaccel2_blockFetchTable =
92899286 kmalloc(((h->ioaccel_maxsg + 1) *
@@ -9356,9 +9353,10 @@ static int hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h) · 66 unmodified lines
93569353 h->reply_queue_size = h->max_commands * sizeof(u64);
93579354
93589355 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,
93609357 h->reply_queue_size,
9361− &(h->reply_queue[i].busaddr));
9358+ &h->reply_queue[i].busaddr,
9359+ GFP_KERNEL);
93629360 if (!h->reply_queue[i].head) {
93639361 rc = -ENOMEM;
93649362 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
22662266 /*
22672267 * Release the SCSI I_T Nexus to the emulated ibmvscsis Target Port
22682268 */
2269− target_wait_for_sess_cmds(se_sess);
22702269 target_remove_session(se_sess);
22712270 tport->ibmv_nexus = NULL;
22722271 kfree(nexus);
drivers/scsi/ips.c+42−39
@@ -208,7 +208,7 @@ module_param(ips, charp, 0); · 207 unmodified lines
208208
209209 #define IPS_DMA_DIR(scb) ((!scb->scsi_cmd || ips_is_passthru(scb->scsi_cmd) || \
210210 DMA_NONE == scb->scsi_cmd->sc_data_direction) ? \
211− PCI_DMA_BIDIRECTIONAL : \
211+ DMA_BIDIRECTIONAL : \
212212 scb->scsi_cmd->sc_data_direction)
213213
214214 #ifdef IPS_DEBUG
@@ -1529,11 +1529,12 @@ ips_alloc_passthru_buffer(ips_ha_t * ha, int length) · 1314 unmodified lines
15291529 if (ha->ioctl_data && length <= ha->ioctl_len)
15301530 return 0;
15311531 /* 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);
15331534 if (bigger_buf) {
15341535 /* free the old memory */
1535− pci_free_consistent(ha->pcidev, ha->ioctl_len, ha->ioctl_data,
1536− ha->ioctl_busaddr);
1536+ dma_free_coherent(&ha->pcidev->dev, ha->ioctl_len,
1537+ ha->ioctl_data, ha->ioctl_busaddr);
15371538 /* use the new memory */
15381539 ha->ioctl_data = (char *) bigger_buf;
15391540 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
16781679 } else if (!ha->flash_data) {
16791680 datasize = pt->CoppCP.cmd.flashfw.total_packets *
16801681 pt->CoppCP.cmd.flashfw.count;
1681− ha->flash_data = pci_alloc_consistent(ha->pcidev,
1682− datasize,
1683− &ha->flash_busaddr);
1682+ ha->flash_data = dma_alloc_coherent(&ha->pcidev->dev,
1683+ datasize, &ha->flash_busaddr, GFP_KERNEL);
16841684 if (!ha->flash_data){
16851685 printk(KERN_WARNING "Unable to allocate a flash buffer\n");
16861686 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
18581858
18591859 scb->data_len = ha->flash_datasize;
18601860 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,
18621862 IPS_DMA_DIR(scb));
18631863 scb->flags |= IPS_SCB_MAP_SINGLE;
18641864 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
18801880 if (ha->flash_data == ips_FlashData)
18811881 test_and_clear_bit(0, &ips_FlashDataInUse);
18821882 else if (ha->flash_data)
1883− pci_free_consistent(ha->pcidev, ha->flash_len, ha->flash_data,
1884− ha->flash_busaddr);
1883+ dma_free_coherent(&ha->pcidev->dev, ha->flash_len,
1884+ ha->flash_data, ha->flash_busaddr);
18851885 ha->flash_data = NULL;
18861886 }
18871887
@@ -3485,6 +3485,7 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb) · 1597 unmodified lines
34853485
34863486 case START_STOP:
34873487 scb->scsi_cmd->result = DID_OK << 16;
3488+ break;
34883489
34893490 case TEST_UNIT_READY:
34903491 case INQUIRY:
@@ -4212,7 +4213,7 @@ ips_free(ips_ha_t * ha) · 721 unmodified lines
42124213
42134214 if (ha) {
42144215 if (ha->enq) {
4215− pci_free_consistent(ha->pcidev, sizeof(IPS_ENQ),
4216+ dma_free_coherent(&ha->pcidev->dev, sizeof(IPS_ENQ),
42164217 ha->enq, ha->enq_busaddr);
42174218 ha->enq = NULL;
42184219 }
@@ -4221,7 +4222,7 @@ ips_free(ips_ha_t * ha) · 2 unmodified lines
42214222 ha->conf = NULL;
42224223
42234224 if (ha->adapt) {
4224− pci_free_consistent(ha->pcidev,
4225+ dma_free_coherent(&ha->pcidev->dev,
42254226 sizeof (IPS_ADAPTER) +
42264227 sizeof (IPS_IO_CMD), ha->adapt,
42274228 ha->adapt->hw_status_start);
@@ -4229,7 +4230,7 @@ ips_free(ips_ha_t * ha) · 1 unmodified line
42294230 }
42304231
42314232 if (ha->logical_drive_info) {
4232− pci_free_consistent(ha->pcidev,
4233+ dma_free_coherent(&ha->pcidev->dev,
42334234 sizeof (IPS_LD_INFO),
42344235 ha->logical_drive_info,
42354236 ha->logical_drive_info_dma_addr);
@@ -4243,7 +4244,7 @@ ips_free(ips_ha_t * ha) · 7 unmodified lines
42434244 ha->subsys = NULL;
42444245
42454246 if (ha->ioctl_data) {
4246− pci_free_consistent(ha->pcidev, ha->ioctl_len,
4247+ dma_free_coherent(&ha->pcidev->dev, ha->ioctl_len,
42474248 ha->ioctl_data, ha->ioctl_busaddr);
42484249 ha->ioctl_data = NULL;
42494250 ha->ioctl_datasize = 0;
@@ -4276,11 +4277,11 @@ static int · 26 unmodified lines
42764277 ips_deallocatescbs(ips_ha_t * ha, int cmds)
42774278 {
42784279 if (ha->scbs) {
4279− pci_free_consistent(ha->pcidev,
4280+ dma_free_coherent(&ha->pcidev->dev,
42804281 IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * cmds,
42814282 ha->scbs->sg_list.list,
42824283 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,
42844285 ha->scbs, ha->scbs->scb_busaddr);
42854286 ha->scbs = NULL;
42864287 } /* end if */
@@ -4307,17 +4308,16 @@ ips_allocatescbs(ips_ha_t * ha) · 20 unmodified lines
43074308 METHOD_TRACE("ips_allocatescbs", 1);
43084309
43094310 /* Allocate memory for the SCBs */
4310− ha->scbs =
4311− pci_alloc_consistent(ha->pcidev, ha->max_cmds * sizeof (ips_scb_t),
4312− &command_dma);
4311+ ha->scbs = dma_alloc_coherent(&ha->pcidev->dev,
4312+ ha->max_cmds * sizeof (ips_scb_t),
4313+ &command_dma, GFP_KERNEL);
43134314 if (ha->scbs == NULL)
43144315 return 0;
4315− ips_sg.list =
4316− pci_alloc_consistent(ha->pcidev,
4317− IPS_SGLIST_SIZE(ha) * IPS_MAX_SG *
4318− ha->max_cmds, &sg_dma);
4316+ ips_sg.list = dma_alloc_coherent(&ha->pcidev->dev,
4317+ IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * ha->max_cmds,
4318+ &sg_dma, GFP_KERNEL);
43194319 if (ips_sg.list == NULL) {
4320− pci_free_consistent(ha->pcidev,
4320+ dma_free_coherent(&ha->pcidev->dev,
43214321 ha->max_cmds * sizeof (ips_scb_t), ha->scbs,
43224322 command_dma);
43234323 return 0;
@@ -4446,8 +4446,8 @@ ips_freescb(ips_ha_t * ha, ips_scb_t * scb) · 122 unmodified lines
44464446 if (scb->flags & IPS_SCB_MAP_SG)
44474447 scsi_dma_unmap(scb->scsi_cmd);
44484448 else if (scb->flags & IPS_SCB_MAP_SINGLE)
4449− pci_unmap_single(ha->pcidev, scb->data_busaddr, scb->data_len,
4450− IPS_DMA_DIR(scb));
4449+ dma_unmap_single(&ha->pcidev->dev, scb->data_busaddr,
4450+ scb->data_len, IPS_DMA_DIR(scb));
44514451
44524452 /* check to make sure this is not our "special" scb */
44534453 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
45594559 dma_addr_t command_dma;
45604560
45614561 /* 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);
45634564 if (scb) {
45644565 memset(scb, 0, sizeof(ips_scb_t));
45654566 ips_init_scb(ha, scb);
@@ -4594,7 +4595,7 @@ ips_flush_and_reset(ips_ha_t *ha) · 28 unmodified lines
45944595 /* Now RESET and INIT the adapter */
45954596 (*ha->func.reset) (ha);
45964597
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);
45984599 return;
45994600 }
46004601
@@ -6926,29 +6927,30 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr) · 2325 unmodified lines
69266927 * are guaranteed to be < 4G.
69276928 */
69286929 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))) {
69306931 (ha)->flags |= IPS_HA_ENH_SG;
69316932 } 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) {
69336934 printk(KERN_WARNING "Unable to set DMA Mask\n");
69346935 return ips_abort_init(ha, index);
69356936 }
69366937 }
69376938 if(ips_cd_boot && !ips_FlashData){
6938− ips_FlashData = pci_alloc_consistent(pci_dev, PAGE_SIZE << 7,
6939− &ips_flashbusaddr);
6939+ ips_FlashData = dma_alloc_coherent(&pci_dev->dev,
6940+ PAGE_SIZE << 7, &ips_flashbusaddr, GFP_KERNEL);
69406941 }
69416942
6942− ha->enq = pci_alloc_consistent(pci_dev, sizeof (IPS_ENQ),
6943− &ha->enq_busaddr);
6943+ ha->enq = dma_alloc_coherent(&pci_dev->dev, sizeof (IPS_ENQ),
6944+ &ha->enq_busaddr, GFP_KERNEL);
69446945 if (!ha->enq) {
69456946 IPS_PRINTK(KERN_WARNING, pci_dev,
69466947 "Unable to allocate host inquiry structure\n");
69476948 return ips_abort_init(ha, index);
69486949 }
69496950
6950− ha->adapt = pci_alloc_consistent(pci_dev, sizeof (IPS_ADAPTER) +
6951− sizeof (IPS_IO_CMD), &dma_address);
6951+ ha->adapt = dma_alloc_coherent(&pci_dev->dev,
6952+ sizeof (IPS_ADAPTER) + sizeof (IPS_IO_CMD),
6953+ &dma_address, GFP_KERNEL);
69526954 if (!ha->adapt) {
69536955 IPS_PRINTK(KERN_WARNING, pci_dev,
69546956 "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
69596961
69606962
69616963
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);
69636966 if (!ha->logical_drive_info) {
69646967 IPS_PRINTK(KERN_WARNING, pci_dev,
69656968 "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
69977000 if (ips_ioctlsize < PAGE_SIZE)
69987001 ips_ioctlsize = PAGE_SIZE;
69997002
7000− ha->ioctl_data = pci_alloc_consistent(pci_dev, ips_ioctlsize,
7001− &ha->ioctl_busaddr);
7003+ ha->ioctl_data = dma_alloc_coherent(&pci_dev->dev, ips_ioctlsize,
7004+ &ha->ioctl_busaddr, GFP_KERNEL);
70027005 ha->ioctl_len = ips_ioctlsize;
70037006 if (!ha->ioctl_data) {
70047007 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
27172717 * the task management request.
27182718 * @task_request: the handle to the task request object to start.
27192719 */
2720−enum sci_task_status sci_controller_start_task(struct isci_host *ihost,
2721− struct isci_remote_device *idev,
2722− struct isci_request *ireq)
2720+enum sci_status sci_controller_start_task(struct isci_host *ihost,
2721+ struct isci_remote_device *idev,
2722+ struct isci_request *ireq)
27232723 {
27242724 enum sci_status status;
27252725
@@ -2728,7 +2728,7 @@ enum sci_task_status sci_controller_start_task(struct isci_host *ihost, · 2 unmodified lines
27282728 "%s: SCIC Controller starting task from invalid "
27292729 "state\n",
27302730 __func__);
2731− return SCI_TASK_FAILURE_INVALID_STATE;
2731+ return SCI_FAILURE_INVALID_STATE;
27322732 }
27332733
27342734 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
489489 struct isci_remote_device *idev,
490490 struct isci_request *ireq);
491491
492−enum sci_task_status sci_controller_start_task(
492+enum sci_status sci_controller_start_task(
493493 struct isci_host *ihost,
494494 struct isci_remote_device *idev,
495495 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
16261626
16271627 if (status == SCI_SUCCESS) {
16281628 if (ireq->stp.rsp.status & ATA_ERR)
1629− status = SCI_IO_FAILURE_RESPONSE_VALID;
1629+ status = SCI_FAILURE_IO_RESPONSE_VALID;
16301630 } else {
1631− status = SCI_IO_FAILURE_RESPONSE_VALID;
1631+ status = SCI_FAILURE_IO_RESPONSE_VALID;
16321632 }
16331633
16341634 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
258258 struct isci_tmf *tmf, unsigned long timeout_ms)
259259 {
260260 DECLARE_COMPLETION_ONSTACK(completion);
261− enum sci_task_status status = SCI_TASK_FAILURE;
261+ enum sci_status status = SCI_FAILURE;
262262 struct isci_request *ireq;
263263 int ret = TMF_RESP_FUNC_FAILED;
264264 unsigned long flags;
@@ -301,7 +301,7 @@ static int isci_task_execute_tmf(struct isci_host *ihost, · 36 unmodified lines
301301 /* start the TMF io. */
302302 status = sci_controller_start_task(ihost, idev, ireq);
303303
304− if (status != SCI_TASK_SUCCESS) {
304+ if (status != SCI_SUCCESS) {
305305 dev_dbg(&ihost->pdev->dev,
306306 "%s: start_io failed - status = 0x%x, request = %p\n",
307307 __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
800800 return rc;
801801
802802 return iscsi_conn_get_addr_param((struct sockaddr_storage *)
803− &addr, param, buf);
803+ &addr,
804+ (enum iscsi_param)param, buf);
804805 default:
805806 return iscsi_host_get_param(shost, param, buf);
806807 }
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
3838 return *(volatile u8 *)(esp->regs + reg);
3939 }
4040
41−static 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−
47−static 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−
53−static 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−
59−static 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−
6541 static int jazz_esp_irq_pending(struct esp *esp)
6642 {
6743 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
11793 static const struct esp_driver_ops jazz_esp_ops = {
11894 .esp_write8 = jazz_esp_write8,
11995 .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,
12496 .irq_pending = jazz_esp_irq_pending,
12597 .reset_dma = jazz_esp_reset_dma,
12698 .dma_drain = jazz_esp_dma_drain,
@@ -182,7 +154,7 @@ static int esp_jazz_probe(struct platform_device *dev) · 55 unmodified lines
182154
183155 dev_set_drvdata(&dev->dev, esp);
184156
185− err = scsi_esp_register(esp, &dev->dev);
157+ err = scsi_esp_register(esp);
186158 if (err)
187159 goto fail_free_irq;
188160
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
18721872 struct fc_lport *lport = shost_priv(shost);
18731873 struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));
18741874 struct fc_fcp_pkt *fsp;
1875− struct fc_rport_libfc_priv *rpriv;
18761875 int rval;
18771876 int rc = 0;
18781877 struct fc_stats *stats;
@@ -1894,8 +1893,6 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd) · 15 unmodified lines
18941893 goto out;
18951894 }
18961895
1897− rpriv = rport->dd_data;
1898−
18991896 if (!fc_fcp_lport_queue_ready(lport)) {
19001897 if (lport->qfull) {
19011898 if (fc_fcp_can_queue_ramp_down(lport))
@@ -2295,8 +2292,7 @@ int fc_setup_fcp(void) · 393 unmodified lines
22952292
22962293 void fc_destroy_fcp(void)
22972294 {
2298− if (scsi_pkt_cachep)
2299− kmem_cache_destroy(scsi_pkt_cachep);
2295+ kmem_cache_destroy(scsi_pkt_cachep);
23002296 }
23012297
23022298 /**
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
10381038 struct fc_els_ls_rjt *rjt;
10391039
10401040 rjt = fc_frame_payload_get(fp, sizeof(*rjt));
1041− FC_RPORT_DBG(rdata, "PLOGI ELS rejected, reason %x expl %x\n",
1042− rjt->er_reason, rjt->er_explan);
1041+ if (!rjt)
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);
10431046 fc_rport_error_retry(rdata, -FC_EX_ELS_RJT);
10441047 }
10451048 out:
@@ -1158,8 +1161,10 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, · 112 unmodified lines
11581161 op = fc_frame_payload_op(fp);
11591162 if (op == ELS_LS_ACC) {
11601163 pp = fc_frame_payload_get(fp, sizeof(*pp));
1161− if (!pp)
1164+ if (!pp) {
1165+ fc_rport_error_retry(rdata, -FC_EX_SEQ_ERR);
11621166 goto out;
1167+ }
11631168
11641169 resp_code = (pp->spp.spp_flags & FC_SPP_RESP_MASK);
11651170 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
11721177 fc_rport_error_retry(rdata, -FC_EX_SEQ_ERR);
11731178 goto out;
11741179 }
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);
11761182 goto out;
1183+ }
11771184
11781185 fcp_parm = ntohl(pp->spp.spp_params);
11791186 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
12111218
12121219 } else {
12131220 rjt = fc_frame_payload_get(fp, sizeof(*rjt));
1214− FC_RPORT_DBG(rdata, "PRLI ELS rejected, reason %x expl %x\n",
1215− rjt->er_reason, rjt->er_explan);
1221+ if (!rjt)
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);
12161226 fc_rport_error_retry(rdata, FC_EX_ELS_RJT);
12171227 }
12181228
drivers/scsi/libsas/sas_ata.c+1−1
@@ -654,7 +654,7 @@ void sas_probe_sata(struct asd_sas_port *port) · 653 unmodified lines
654654 /* if libata could not bring the link up, don't surface
655655 * the device
656656 */
657− if (ata_dev_disabled(sas_to_ata_dev(dev)))
657+ if (!ata_dev_enabled(sas_to_ata_dev(dev)))
658658 sas_fail_probe(dev, __func__, -ENODEV);
659659 }
660660
drivers/scsi/libsas/sas_discover.c+1−1
@@ -260,7 +260,7 @@ static void sas_suspend_devices(struct work_struct *work) · 259 unmodified lines
260260 * phy_list is not being mutated
261261 */
262262 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)
264264 si->dft->lldd_port_deformed(phy);
265265 phy->suspended = 1;
266266 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
4848 unsigned long flags;
4949
5050 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)) {
5252 task->task_state_flags |= SAS_TASK_STATE_ABORTED;
53+ complete(&task->slow_task->completion);
54+ }
5355 spin_unlock_irqrestore(&task->task_state_lock, flags);
54−
55− complete(&task->slow_task->completion);
5656 }
5757
5858 static void smp_task_done(struct sas_task *task)
5959 {
60− if (!del_timer(&task->slow_task->timer))
61− return;
60+ del_timer(&task->slow_task->timer);
6261 complete(&task->slow_task->completion);
6362 }
6463
@@ -2054,14 +2053,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) · 1989 unmodified lines
20542053 return res;
20552054 }
20562055
2057− /* delete the old link */
2058− if (SAS_ADDR(phy->attached_sas_addr) &&
2059− SAS_ADDR(sas_addr) != SAS_ADDR(phy->attached_sas_addr)) {
2060− SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n",
2061− SAS_ADDR(dev->sas_addr), phy_id,
2062− SAS_ADDR(phy->attached_sas_addr));
2063− sas_unregister_devs_sas_addr(dev, phy_id, last);
2064− }
2056+ /* we always have to delete the old device when we went here */
2057+ SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n",
2058+ SAS_ADDR(dev->sas_addr), phy_id,
2059+ SAS_ADDR(phy->attached_sas_addr));
2060+ sas_unregister_devs_sas_addr(dev, phy_id, last);
20652061
20662062 return sas_discover_new(dev, phy_id);
20672063 }
drivers/scsi/lpfc/lpfc.h+28−1
@@ -52,7 +52,7 @@ struct lpfc_sli2_slim; · 51 unmodified lines
5252 downloads using bsg */
5353
5454 #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 */
5656 #define LPFC_MAX_SG_SEG_CNT_DIF 512 /* sg element count per scsi cmnd */
5757 #define LPFC_MAX_SG_SEG_CNT 4096 /* sg element count per scsi cmnd */
5858 #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
583583 struct list_head ext_dmabuf_list;
584584 };
585585
586+struct 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+
586605 struct lpfc_hba {
587606 /* SCSI interface function jump table entries */
588607 int (*lpfc_new_scsi_buf)
@@ -790,6 +809,7 @@ struct lpfc_hba { · 201 unmodified lines
790809 uint32_t cfg_total_seg_cnt;
791810 uint32_t cfg_sg_seg_cnt;
792811 uint32_t cfg_nvme_seg_cnt;
812+ uint32_t cfg_scsi_seg_cnt;
793813 uint32_t cfg_sg_dma_buf_size;
794814 uint64_t cfg_soft_wwnn;
795815 uint64_t cfg_soft_wwpn;
@@ -833,6 +853,9 @@ struct lpfc_hba { · 37 unmodified lines
833853 #define LPFC_FDMI_SUPPORT 1 /* FDMI supported? */
834854 uint32_t cfg_enable_SmartSAN;
835855 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;
836859 uint32_t cfg_enable_fc4_type;
837860 uint32_t cfg_enable_bbcr; /* Enable BB Credit Recovery */
838861 uint32_t cfg_enable_dpp; /* Enable Direct Packet Push */
@@ -963,6 +986,7 @@ struct lpfc_hba { · 124 unmodified lines
963986 uint32_t intr_mode;
964987 #define LPFC_INTR_ERROR 0xFFFFFFFF
965988 struct list_head port_list;
989+ spinlock_t port_list_lock; /* lock for port_list mutations */
966990 struct lpfc_vport *pport; /* physical lpfc_vport pointer */
967991 uint16_t max_vpi; /* Maximum virtual nports */
968992 #define LPFC_MAX_VPI 0xFFFF /* Max number of VPI supported */
@@ -1092,6 +1116,9 @@ struct lpfc_hba { · 123 unmodified lines
10921116 struct unsol_rcv_ct_ctx ct_ctx[LPFC_CT_CTX_MAX];
10931117 uint32_t ctx_idx;
10941118
1119+ /* RAS Support */
1120+ struct lpfc_ras_fwlog ras_fwlog;
1121+
10951122 uint8_t menlo_flag; /* menlo generic flags */
10961123 #define HBA_MENLO_SUPPORT 0x1 /* HBA supports menlo commands */
10971124 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
53585358
53595359 /*
53605360 * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count
5361− * This value can be set to values between 64 and 4096. The default value is
5362− * 64, but may be increased to allow for larger Max I/O sizes. The scsi layer
5363− * will be allowed to request I/Os of sizes up to (MAX_SEG_COUNT * SEG_SIZE).
5361+ * This value can be set to values between 64 and 4096. The default value
5362+ * is 64, but may be increased to allow for larger Max I/O sizes. The scsi
5363+ * and nvme layers will allow I/O sizes up to (MAX_SEG_COUNT * SEG_SIZE).
53645364 * Because of the additional overhead involved in setting up T10-DIF,
53655365 * this parameter will be limited to 128 if BlockGuard is enabled under SLI4
53665366 * and will be limited to 512 if BlockGuard is enabled under SLI3.
53675367 */
5368−LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_MIN_SG_SEG_CNT,
5369− LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count");
5368+static uint lpfc_sg_seg_cnt = LPFC_DEFAULT_SG_SEG_CNT;
5369+module_param(lpfc_sg_seg_cnt, uint, 0444);
5370+MODULE_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+ **/
5381+static ssize_t
5382+lpfc_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+
5399+static 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+ **/
5415+static int
5416+lpfc_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+}
53705429
53715430 /*
53725431 * 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
53765435 */
53775436 LPFC_ATTR_R(enable_mds_diags, 0, 0, 1, "Enable MDS Diagnostics");
53785437
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+ */
5444+LPFC_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+ */
5452+LPFC_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+ */
5461+LPFC_ATTR_RW(ras_fwlog_func, 0, 0, 7, "Firmware Logging Enabled on Function");
5462+
53795463 /*
53805464 * lpfc_enable_bbcr: Enable BB Credit Recovery
53815465 * 0 = BB Credit Recovery disabled
@@ -5501,6 +5585,9 @@ struct device_attribute *lpfc_hba_attrs[] = { · 119 unmodified lines
55015585 &dev_attr_protocol,
55025586 &dev_attr_lpfc_xlane_supported,
55035587 &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,
55045591 &dev_attr_lpfc_enable_bbcr,
55055592 &dev_attr_lpfc_enable_dpp,
55065593 NULL,
@@ -6587,6 +6674,20 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) · 1080 unmodified lines
65876674 lpfc_sli_mode_init(phba, lpfc_sli_mode);
65886675 phba->cfg_enable_dss = 1;
65896676 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+
65906691 return;
65916692 }
65926693
drivers/scsi/lpfc/lpfc_bsg.c+339−5
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <linux/delay.h>
2828 #include <linux/list.h>
2929 #include <linux/bsg-lib.h>
30+#include <linux/vmalloc.h>
3031
3132 #include <scsi/scsi.h>
3233 #include <scsi/scsi_host.h>
@@ -2843,9 +2844,6 @@ diag_cmd_data_alloc(struct lpfc_hba *phba, · 2810 unmodified lines
28432844
28442845 if (nocopydata) {
28452846 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−
28492847 } else {
28502848 memset((uint8_t *)dmp->dma.virt, 0, cnt);
28512849 bpl->tus.f.bdeFlags = BUFF_TYPE_BDE_64I;
@@ -5308,6 +5306,330 @@ job_error: · 2456 unmodified lines
53085306 return rc;
53095307 }
53105308
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+ **/
5315+int
5316+lpfc_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+ **/
5336+static int
5337+lpfc_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+
5374+ras_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+ **/
5390+static void
5391+lpfc_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+ **/
5408+static int
5409+lpfc_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+ }
5463+ras_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+ **/
5481+static int
5482+lpfc_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+
5517+ras_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+ **/
5533+static int
5534+lpfc_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+
5625+ras_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+
53115633 /**
53125634 * lpfc_bsg_hst_vendor - process a vendor-specific fc_bsg_job
53135635 * @job: fc_bsg_job to handle
@@ -5355,6 +5677,18 @@ lpfc_bsg_hst_vendor(struct bsg_job *job) · 41 unmodified lines
53555677 case LPFC_BSG_VENDOR_FORCED_LINK_SPEED:
53565678 rc = lpfc_forced_link_speed(job);
53575679 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;
53585692 default:
53595693 rc = -EINVAL;
53605694 bsg_reply->reply_payload_rcv_len = 0;
@@ -5368,7 +5702,7 @@ lpfc_bsg_hst_vendor(struct bsg_job *job) · 7 unmodified lines
53685702
53695703 /**
53705704 * lpfc_bsg_request - handle a bsg request from the FC transport
5371− * @job: fc_bsg_job to handle
5705+ * @job: bsg_job to handle
53725706 **/
53735707 int
53745708 lpfc_bsg_request(struct bsg_job *job)
@@ -5402,7 +5736,7 @@ lpfc_bsg_request(struct bsg_job *job) · 27 unmodified lines
54025736
54035737 /**
54045738 * lpfc_bsg_timeout - handle timeout of a bsg request from the FC transport
5405− * @job: fc_bsg_job that has timed out
5739+ * @job: bsg_job that has timed out
54065740 *
54075741 * This function just aborts the job's IOCB. The aborted IOCB will return to
54085742 * 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
3838 #define LPFC_BSG_VENDOR_DIAG_MODE_END 10
3939 #define LPFC_BSG_VENDOR_LINK_DIAG_TEST 11
4040 #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
4145
4246 struct set_ct_event {
4347 uint32_t command;
@@ -296,6 +300,38 @@ struct forced_link_speed_support_reply { · 252 unmodified lines
296300 uint8_t supported;
297301 };
298302
303+struct lpfc_bsg_ras_req {
304+ uint32_t command;
305+};
306+
307+struct lpfc_bsg_get_fwlog_req {
308+ uint32_t command;
309+ uint32_t read_size;
310+ uint32_t read_offset;
311+};
312+
313+struct lpfc_bsg_get_ras_lwpd {
314+ uint32_t offset;
315+ uint32_t wrap_count;
316+};
317+
318+struct 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+
326+struct 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+
299335 /* driver only */
300336 #define SLI_CONFIG_NOT_HANDLED 0
301337 #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
545545 int lpfc_sli4_dump_page_a0(struct lpfc_hba *phba, struct lpfcMboxq *mbox);
546546 void lpfc_mbx_cmpl_rdp_page_a0(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb);
547547
548+/* RAS Interface */
549+void lpfc_sli4_ras_init(struct lpfc_hba *phba);
550+void lpfc_sli4_ras_setup(struct lpfc_hba *phba);
551+int lpfc_sli4_ras_fwlog_init(struct lpfc_hba *phba, uint32_t fwlog_level,
552+ uint32_t fwlog_enable);
553+int lpfc_check_fwlog_support(struct lpfc_hba *phba);
554+
548555 /* NVME interfaces. */
549556 void lpfc_nvme_unregister_port(struct lpfc_vport *vport,
550557 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
445445 struct lpfc_vport *vport_curr;
446446 unsigned long flags;
447447
448− spin_lock_irqsave(&phba->hbalock, flags);
448+ spin_lock_irqsave(&phba->port_list_lock, flags);
449449 list_for_each_entry(vport_curr, &phba->port_list, listentry) {
450450 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);
452452 return vport_curr;
453453 }
454454 }
455− spin_unlock_irqrestore(&phba->hbalock, flags);
455+ spin_unlock_irqrestore(&phba->port_list_lock, flags);
456456 return NULL;
457457 }
458458
@@ -471,11 +471,6 @@ lpfc_prep_node_fc4type(struct lpfc_vport *vport, uint32_t Did, uint8_t fc4_type) · 12 unmodified lines
471471 "Parse GID_FTrsp: did:x%x flg:x%x x%x",
472472 Did, ndlp->nlp_flag, vport->fc_flag);
473473
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−
479474 /* By default, the driver expects to support FCP FC4 */
480475 if (fc4_type == FC_TYPE_FCP)
481476 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
550550 struct lpfc_nodelist *ndlp;
551551 unsigned char *statep;
552552 struct nvme_fc_local_port *localport;
553− struct lpfc_nvmet_tgtport *tgtp;
554553 struct nvme_fc_remote_port *nrport = NULL;
555554 struct lpfc_nvme_rport *rport;
556555
@@ -654,7 +653,6 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) · 97 unmodified lines
654653 "\nOutstanding IO x%x\n", outio);
655654
656655 if (phba->nvmet_support && phba->targetport && (vport == phba->pport)) {
657− tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
658656 len += snprintf(buf + len, size - len,
659657 "\nNVME Targetport Entry ...\n");
660658
drivers/scsi/lpfc/lpfc_els.c+3−0
@@ -7673,8 +7673,11 @@ void · 7672 unmodified lines
76737673 lpfc_els_flush_all_cmd(struct lpfc_hba *phba)
76747674 {
76757675 struct lpfc_vport *vport;
7676+
7677+ spin_lock_irq(&phba->port_list_lock);
76767678 list_for_each_entry(vport, &phba->port_list, listentry)
76777679 lpfc_els_flush_cmd(vport);
7680+ spin_unlock_irq(&phba->port_list_lock);
76787681
76797682 return;
76807683 }
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
41934193
41944194 if (new_state == NLP_STE_MAPPED_NODE ||
41954195 new_state == NLP_STE_UNMAPPED_NODE) {
4196− if (ndlp->nlp_fc4_type & NLP_FC4_FCP ||
4196+ if (ndlp->nlp_fc4_type ||
41974197 ndlp->nlp_DID == Fabric_DID ||
41984198 ndlp->nlp_DID == NameServer_DID ||
41994199 ndlp->nlp_DID == FDMI_DID) {
@@ -5428,12 +5428,10 @@ static void · 1228 unmodified lines
54285428 lpfc_free_tx(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
54295429 {
54305430 LIST_HEAD(completions);
5431− struct lpfc_sli *psli;
54325431 IOCB_t *icmd;
54335432 struct lpfc_iocbq *iocb, *next_iocb;
54345433 struct lpfc_sli_ring *pring;
54355434
5436− psli = &phba->sli;
54375435 pring = lpfc_phba_elsring(phba);
54385436 if (unlikely(!pring))
54395437 return;
@@ -5938,14 +5936,14 @@ lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi) · 498 unmodified lines
59385936 }
59395937 }
59405938
5941− spin_lock_irqsave(&phba->hbalock, flags);
5939+ spin_lock_irqsave(&phba->port_list_lock, flags);
59425940 list_for_each_entry(vport, &phba->port_list, listentry) {
59435941 if (vport->vpi == i) {
5944− spin_unlock_irqrestore(&phba->hbalock, flags);
5942+ spin_unlock_irqrestore(&phba->port_list_lock, flags);
59455943 return vport;
59465944 }
59475945 }
5948− spin_unlock_irqrestore(&phba->hbalock, flags);
5946+ spin_unlock_irqrestore(&phba->port_list_lock, flags);
59495947 return NULL;
59505948 }
59515949
drivers/scsi/lpfc/lpfc_hw4.h+45−0
@@ -186,6 +186,7 @@ struct lpfc_sli_intf { · 185 unmodified lines
186186 #define LPFC_CTL_PDEV_CTL_FRL_ALL 0x00
187187 #define LPFC_CTL_PDEV_CTL_FRL_FC_FCOE 0x10
188188 #define LPFC_CTL_PDEV_CTL_FRL_NIC 0x20
189+#define LPFC_CTL_PDEV_CTL_DDL_RAS 0x1000000
189190
190191 #define LPFC_FW_DUMP_REQUEST (LPFC_CTL_PDEV_CTL_DD | LPFC_CTL_PDEV_CTL_FRST)
191192
@@ -964,6 +965,7 @@ struct mbox_header { · 772 unmodified lines
964965 /* Subsystem Definitions */
965966 #define LPFC_MBOX_SUBSYSTEM_NA 0x0
966967 #define LPFC_MBOX_SUBSYSTEM_COMMON 0x1
968+#define LPFC_MBOX_SUBSYSTEM_LOWLEVEL 0xB
967969 #define LPFC_MBOX_SUBSYSTEM_FCOE 0xC
968970
969971 /* Device Specific Definitions */
@@ -1030,6 +1032,9 @@ struct mbox_header { · 60 unmodified lines
10301032 #define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_STATE 0x22
10311033 #define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_LOOPBACK 0x23
10321034
1035+/* Low level Opcodes */
1036+#define LPFC_MBOX_OPCODE_SET_DIAG_LOG_OPTION 0x37
1037+
10331038 /* Mailbox command structures */
10341039 struct eq_context {
10351040 uint32_t word0;
@@ -1162,6 +1167,45 @@ struct lpfc_mbx_nop { · 126 unmodified lines
11621167 uint32_t context[2];
11631168 };
11641169
1170+
1171+
1172+struct 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+
11651209 struct cq_context {
11661210 uint32_t word0;
11671211 #define lpfc_cq_context_event_SHIFT 31
@@ -3868,6 +3912,7 @@ struct lpfc_mqe { · 2700 unmodified lines
38683912 struct lpfc_mbx_memory_dump_type3 mem_dump_type3;
38693913 struct lpfc_mbx_set_host_data set_host_data;
38703914 struct lpfc_mbx_nop nop;
3915+ struct lpfc_mbx_set_ras_fwlog ras_fwlog;
38713916 } un;
38723917 };
38733918
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
39563956 if (phba->sli_rev == LPFC_SLI_REV4) {
39573957 shost->dma_boundary =
39583958 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;
39603960 }
39613961
39623962 /*
@@ -3988,9 +3988,9 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev) · 25 unmodified lines
39883988 if (error)
39893989 goto out_put_shost;
39903990
3991− spin_lock_irq(&phba->hbalock);
3991+ spin_lock_irq(&phba->port_list_lock);
39923992 list_add_tail(&vport->listentry, &phba->port_list);
3993− spin_unlock_irq(&phba->hbalock);
3993+ spin_unlock_irq(&phba->port_list_lock);
39943994 return vport;
39953995
39963996 out_put_shost:
@@ -4016,9 +4016,9 @@ destroy_port(struct lpfc_vport *vport) · 19 unmodified lines
40164016 fc_remove_host(shost);
40174017 scsi_remove_host(shost);
40184018
4019− spin_lock_irq(&phba->hbalock);
4019+ spin_lock_irq(&phba->port_list_lock);
40204020 list_del_init(&vport->listentry);
4021− spin_unlock_irq(&phba->hbalock);
4021+ spin_unlock_irq(&phba->port_list_lock);
40224022
40234023 lpfc_cleanup(vport);
40244024 return;
@@ -5621,7 +5621,10 @@ lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba) · 1596 unmodified lines
56215621 /* Initialize ndlp management spinlock */
56225622 spin_lock_init(&phba->ndlp_lock);
56235623
5624+ /* Initialize port_list spinlock */
5625+ spin_lock_init(&phba->port_list_lock);
56245626 INIT_LIST_HEAD(&phba->port_list);
5627+
56255628 INIT_LIST_HEAD(&phba->work_list);
56265629 init_waitqueue_head(&phba->wait_4_mlo_m_q);
56275630
@@ -5919,8 +5922,6 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 291 unmodified lines
59195922 * There are going to be 2 reserved SGEs: 1 FCP cmnd + 1 FCP rsp
59205923 */
59215924 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;
59245925
59255926 /*
59265927 * 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
59425943 /* Total SGEs for scsi_sg_list and scsi_sg_prot_list */
59435944 phba->cfg_total_seg_cnt = LPFC_MAX_SGL_SEG_CNT;
59445945
5945− if (phba->cfg_sg_seg_cnt > LPFC_MAX_SG_SLI4_SEG_CNT_DIF)
5946− phba->cfg_sg_seg_cnt =
5947− LPFC_MAX_SG_SLI4_SEG_CNT_DIF;
5946+ /*
5947+ * If supporting DIF, reduce the seg count for scsi to
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+
59485956 } else {
59495957 /*
59505958 * 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
59585966
59595967 /* Total SGEs for scsi_sg_list */
59605968 phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra;
5969+ phba->cfg_scsi_seg_cnt = phba->cfg_sg_seg_cnt;
59615970
59625971 /*
59635972 * 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
59655974 */
59665975 }
59675976
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+
59685989 /* Initialize the host templates with the updated values. */
5969− lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt;
5970− lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt;
5971− lpfc_template_no_hr.sg_tablesize = phba->cfg_sg_seg_cnt;
5990+ lpfc_vport_template.sg_tablesize = phba->cfg_scsi_seg_cnt;
5991+ lpfc_template.sg_tablesize = phba->cfg_scsi_seg_cnt;
5992+ lpfc_template_no_hr.sg_tablesize = phba->cfg_scsi_seg_cnt;
59725993
59735994 if (phba->cfg_sg_dma_buf_size <= LPFC_MIN_SG_SLI4_BUF_SZ)
59745995 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
59775998 SLI4_PAGE_ALIGN(phba->cfg_sg_dma_buf_size);
59785999
59796000 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",
59816003 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);
59836006
59846007 /* Initialize buffer queue management fields */
59856008 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
62056228 if (phba->cfg_fof)
62066229 fof_vectors = 1;
62076230
6231+ /* Verify RAS support on adapter */
6232+ lpfc_sli4_ras_init(phba);
6233+
62086234 /* Verify all the SLI4 queues */
62096235 rc = lpfc_sli4_queue_verify(phba);
62106236 if (rc)
@@ -7967,7 +7993,7 @@ lpfc_sli4_read_config(struct lpfc_hba *phba) · 1756 unmodified lines
79677993 else
79687994 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
79697995 "3028 GET_FUNCTION_CONFIG: failed to find "
7970− "Resrouce Descriptor:x%x\n",
7996+ "Resource Descriptor:x%x\n",
79717997 LPFC_RSRC_DESC_TYPE_FCFCOE);
79727998
79737999 read_cfg_out:
@@ -10492,6 +10518,14 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phba) · 2518 unmodified lines
1049210518 /* Stop kthread signal shall trigger work_done one more time */
1049310519 kthread_stop(phba->worker_thread);
1049410520
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+
1049510529 /* Unset the queues shared with the hardware then release all
1049610530 * allocated resources.
1049710531 */
@@ -10737,6 +10771,7 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) · 239 unmodified lines
1073710771 phba->mds_diags_support = 1;
1073810772 else
1073910773 phba->mds_diags_support = 0;
10774+
1074010775 return 0;
1074110776 }
1074210777
@@ -10965,9 +11000,9 @@ lpfc_pci_remove_one_s3(struct pci_dev *pdev) · 222 unmodified lines
1096511000 kfree(phba->vpi_ids);
1096611001
1096711002 lpfc_stop_hba_timers(phba);
10968− spin_lock_irq(&phba->hbalock);
11003+ spin_lock_irq(&phba->port_list_lock);
1096911004 list_del_init(&vport->listentry);
10970− spin_unlock_irq(&phba->hbalock);
11005+ spin_unlock_irq(&phba->port_list_lock);
1097111006
1097211007 lpfc_debugfs_terminate(vport);
1097311008
@@ -11694,6 +11729,10 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) · 720 unmodified lines
1169411729
1169511730 /* Check if there are static vports to be created. */
1169611731 lpfc_create_static_vport(phba);
11732+
11733+ /* Enable RAS FW log support */
11734+ lpfc_sli4_ras_setup(phba);
11735+
1169711736 return 0;
1169811737
1169911738 out_disable_intr:
@@ -11773,9 +11812,9 @@ lpfc_pci_remove_one_s4(struct pci_dev *pdev) · 73 unmodified lines
1177311812 lpfc_sli4_hba_unset(phba);
1177411813
1177511814 lpfc_stop_hba_timers(phba);
11776− spin_lock_irq(&phba->hbalock);
11815+ spin_lock_irq(&phba->port_list_lock);
1177711816 list_del_init(&vport->listentry);
11778− spin_unlock_irq(&phba->hbalock);
11817+ spin_unlock_irq(&phba->port_list_lock);
1177911818
1178011819 /* Perform scsi free before driver resource_unset since scsi
1178111820 * buffers are released to their corresponding pools here.
@@ -12419,6 +12458,30 @@ lpfc_sli4_oas_verify(struct lpfc_hba *phba) · 637 unmodified lines
1241912458 return;
1242012459 }
1242112460
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+ **/
12468+void
12469+lpfc_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+
1242212485 /**
1242312486 * lpfc_fof_queue_setup - Set up all the fof queues
1242412487 * @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
23182318 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
23192319 spin_lock_irq(shost->host_lock);
23202320 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
2321+ ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME);
23212322 spin_unlock_irq(shost->host_lock);
23222323 lpfc_disc_set_adisc(vport, ndlp);
23232324
@@ -2395,6 +2396,7 @@ lpfc_device_recov_mapped_node(struct lpfc_vport *vport, · 71 unmodified lines
23952396 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
23962397 spin_lock_irq(shost->host_lock);
23972398 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
2399+ ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME);
23982400 spin_unlock_irq(shost->host_lock);
23992401 lpfc_disc_set_adisc(vport, ndlp);
24002402 return ndlp->nlp_state;
@@ -2652,6 +2654,7 @@ lpfc_device_recov_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, · 251 unmodified lines
26522654 lpfc_cancel_retry_delay_tmo(vport, ndlp);
26532655 spin_lock_irq(shost->host_lock);
26542656 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
2657+ ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME);
26552658 spin_unlock_irq(shost->host_lock);
26562659 return ndlp->nlp_state;
26572660 }
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
282282 vport = lport->vport;
283283
284284 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",
286286 lport, qidx, handle);
287287 kfree(handle);
288288 }
@@ -2235,13 +2235,11 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc) · 1946 unmodified lines
22352235 struct sli4_sge *sgl;
22362236 dma_addr_t pdma_phys_sgl;
22372237 uint16_t iotag, lxri = 0;
2238− int bcnt, num_posted, sgl_size;
2238+ int bcnt, num_posted;
22392239 LIST_HEAD(prep_nblist);
22402240 LIST_HEAD(post_nblist);
22412241 LIST_HEAD(nvme_nblist);
22422242
2243− sgl_size = phba->cfg_sg_dma_buf_size;
2244−
22452243 for (bcnt = 0; bcnt < num_to_alloc; bcnt++) {
22462244 lpfc_ncmd = kzalloc(sizeof(struct lpfc_nvme_buf), GFP_KERNEL);
22472245 if (!lpfc_ncmd)
@@ -2462,17 +2460,10 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) · 214 unmodified lines
24622460 nfcp_info.node_name = wwn_to_u64(vport->fc_nodename.u.wwn);
24632461 nfcp_info.port_name = wwn_to_u64(vport->fc_portname.u.wwn);
24642462
2465− /* Limit to LPFC_MAX_NVME_SEG_CNT.
2466− * For now need + 1 to get around NVME transport logic.
2463+ /* We need to tell the transport layer + 1 because it takes page
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
24672466 */
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− }
24762467 lpfc_nvme_template.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1;
24772468 lpfc_nvme_template.max_hw_queues = phba->cfg_nvme_io_channel;
24782469
drivers/scsi/lpfc/lpfc_nvmet.c+6−14
@@ -1339,15 +1339,14 @@ lpfc_nvmet_setup_io_context(struct lpfc_hba *phba) · 1338 unmodified lines
13391339 idx = 0;
13401340 }
13411341
1342− infop = phba->sli4_hba.nvmet_ctx_info;
1343− for (j = 0; j < phba->cfg_nvmet_mrq; j++) {
1344− for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) {
1342+ for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) {
1343+ for (j = 0; j < phba->cfg_nvmet_mrq; j++) {
1344+ infop = lpfc_get_ctx_list(phba, i, j);
13451345 lpfc_printf_log(phba, KERN_INFO, LOG_NVME | LOG_INIT,
13461346 "6408 TOTAL NVMET ctx for CPU %d "
13471347 "MRQ %d: cnt %d nextcpu %p\n",
13481348 i, j, infop->nvmet_ctx_list_cnt,
13491349 infop->nvmet_ctx_next_cpu);
1350− infop++;
13511350 }
13521351 }
13531352 return 0;
@@ -1373,17 +1372,10 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba) · 19 unmodified lines
13731372 pinfo.port_name = wwn_to_u64(vport->fc_portname.u.wwn);
13741373 pinfo.port_id = vport->fc_myDID;
13751374
1376− /* Limit to LPFC_MAX_NVME_SEG_CNT.
1377− * For now need + 1 to get around NVME transport logic.
1375+ /* We need to tell the transport layer + 1 because it takes page
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
13781378 */
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− }
13871379 lpfc_tgttemplate.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1;
13881380 lpfc_tgttemplate.max_hw_queues = phba->cfg_nvme_io_channel;
13891381 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
202202 static void
203203 lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
204204 {
205− struct lpfc_rport_data *rdata = lpfc_cmd->rdata;
206− struct lpfc_nodelist *pnode = rdata->pnode;
205+ struct lpfc_rport_data *rdata;
206+ struct lpfc_nodelist *pnode;
207207 struct scsi_cmnd *cmd = lpfc_cmd->pCmd;
208208 unsigned long flags;
209209 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
211211 unsigned long latency;
212212 int i;
213213
214− if (cmd->result)
214+ if (!vport->stat_data_enabled ||
215+ vport->stat_data_blocked ||
216+ (cmd->result))
215217 return;
216218
217219 latency = jiffies_to_msecs((long)jiffies - (long)lpfc_cmd->start_time);
220+ rdata = lpfc_cmd->rdata;
221+ pnode = rdata->pnode;
218222
219223 spin_lock_irqsave(shost->host_lock, flags);
220− if (!vport->stat_data_enabled ||
221− vport->stat_data_blocked ||
222− !pnode ||
223− !pnode->lat_data ||
224− (phba->bucket_type == LPFC_NO_BUCKET)) {
224+ if (!pnode ||
225+ !pnode->lat_data ||
226+ (phba->bucket_type == LPFC_NO_BUCKET)) {
225227 spin_unlock_irqrestore(shost->host_lock, flags);
226228 return;
227229 }
@@ -1050,7 +1052,7 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) · 822 unmodified lines
10501052 if (!found)
10511053 return NULL;
10521054
1053− if (lpfc_ndlp_check_qdepth(phba, ndlp) && lpfc_cmd) {
1055+ if (lpfc_ndlp_check_qdepth(phba, ndlp)) {
10541056 atomic_inc(&ndlp->cmd_pending);
10551057 lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH;
10561058 }
@@ -4158,9 +4160,17 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, · 3101 unmodified lines
41584160 }
41594161 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd);
41604162
4161− spin_lock_irqsave(&phba->hbalock, flags);
4162− lpfc_cmd->pCmd = NULL;
4163− spin_unlock_irqrestore(&phba->hbalock, flags);
4163+ /* If pCmd was set to NULL from abort path, do not call scsi_done */
4164+ if (xchg(&lpfc_cmd->pCmd, NULL) == NULL) {
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+ }
41644174
41654175 /* The sdev is not guaranteed to be valid post scsi_done upcall. */
41664176 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
392392 struct lpfc_register doorbell;
393393
394394 doorbell.word0 = 0;
395− bf_set(lpfc_eqcq_doorbell_eqci, &doorbell, 1);
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);
395+ bf_set(lpfc_if6_eq_doorbell_eqid, &doorbell, q->queue_id);
400396 writel(doorbell.word0, q->phba->sli4_hba.EQDBregaddr);
401397 }
402398
@@ -3797,6 +3793,7 @@ lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba, · 3394 unmodified lines
37973793 struct hbq_dmabuf *dmabuf;
37983794 struct lpfc_cq_event *cq_event;
37993795 unsigned long iflag;
3796+ int count = 0;
38003797
38013798 spin_lock_irqsave(&phba->hbalock, iflag);
38023799 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
38183815 if (irspiocbq)
38193816 lpfc_sli_sp_handle_rspiocb(phba, pring,
38203817 irspiocbq);
3818+ count++;
38213819 break;
38223820 case CQE_CODE_RECEIVE:
38233821 case CQE_CODE_RECEIVE_V1:
38243822 dmabuf = container_of(cq_event, struct hbq_dmabuf,
38253823 cq_event);
38263824 lpfc_sli4_handle_received_buffer(phba, dmabuf);
3825+ count++;
38273826 break;
38283827 default:
38293828 break;
38303829 }
3830+
3831+ /* Limit the number of events to 64 to avoid soft lockups */
3832+ if (count == 64)
3833+ break;
38313834 }
38323835 }
38333836
@@ -6145,6 +6148,271 @@ lpfc_set_features(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox, · 2311 unmodified lines
61456148 return;
61466149 }
61476150
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+ **/
6158+void
6159+lpfc_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+
6198+static int
6199+lpfc_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+
6248+free_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+ **/
6262+static void
6263+lpfc_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+
6291+disable_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+ **/
6306+int
6307+lpfc_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;
6392+mem_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+ **/
6405+void
6406+lpfc_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+
61486416 /**
61496417 * lpfc_sli4_alloc_resource_identifiers - Allocate all SLI4 resource extents.
61506418 * @phba: Pointer to HBA context object.
@@ -10266,8 +10534,12 @@ lpfc_sli_mbox_sys_flush(struct lpfc_hba *phba) · 4115 unmodified lines
1026610534 LPFC_MBOXQ_t *pmb;
1026710535 unsigned long iflag;
1026810536
10537+ /* Disable softirqs, including timers from obtaining phba->hbalock */
10538+ local_bh_disable();
10539+
1026910540 /* Flush all the mailbox commands in the mbox system */
1027010541 spin_lock_irqsave(&phba->hbalock, iflag);
10542+
1027110543 /* The pending mailbox command queue */
1027210544 list_splice_init(&phba->sli.mboxq, &completions);
1027310545 /* The outstanding active mailbox command */
@@ -10280,6 +10552,9 @@ lpfc_sli_mbox_sys_flush(struct lpfc_hba *phba) · 6 unmodified lines
1028010552 list_splice_init(&phba->sli.mboxq_cmpl, &completions);
1028110553 spin_unlock_irqrestore(&phba->hbalock, iflag);
1028210554
10555+ /* Enable softirqs again, done with phba->hbalock */
10556+ local_bh_enable();
10557+
1028310558 /* Return all flushed mailbox commands with MBX_NOT_FINISHED status */
1028410559 while (!list_empty(&completions)) {
1028510560 list_remove_head(&completions, pmb, LPFC_MBOXQ_t, list);
@@ -10419,6 +10694,9 @@ lpfc_sli_hba_down(struct lpfc_hba *phba) · 133 unmodified lines
1041910694
1042010695 lpfc_hba_down_prep(phba);
1042110696
10697+ /* Disable softirqs, including timers from obtaining phba->hbalock */
10698+ local_bh_disable();
10699+
1042210700 lpfc_fabric_abort_hba(phba);
1042310701
1042410702 spin_lock_irqsave(&phba->hbalock, flags);
@@ -10472,6 +10750,9 @@ lpfc_sli_hba_down(struct lpfc_hba *phba) · 47 unmodified lines
1047210750 kfree(buf_ptr);
1047310751 }
1047410752
10753+ /* Enable softirqs again, done with phba->hbalock */
10754+ local_bh_enable();
10755+
1047510756 /* Return any active mbox cmds */
1047610757 del_timer_sync(&psli->mbox_tmo);
1047710758
@@ -11775,6 +12056,9 @@ lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba, int mbx_action) · 1297 unmodified lines
1177512056 }
1177612057 timeout = msecs_to_jiffies(LPFC_MBOX_TMO * 1000) + jiffies;
1177712058
12059+ /* Disable softirqs, including timers from obtaining phba->hbalock */
12060+ local_bh_disable();
12061+
1177812062 spin_lock_irq(&phba->hbalock);
1177912063 psli->sli_flag |= LPFC_SLI_ASYNC_MBX_BLK;
1178012064
@@ -11788,6 +12072,9 @@ lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba, int mbx_action) · 7 unmodified lines
1178812072 1000) + jiffies;
1178912073 spin_unlock_irq(&phba->hbalock);
1179012074
12075+ /* Enable softirqs again, done with phba->hbalock */
12076+ local_bh_enable();
12077+
1179112078 while (phba->sli.mbox_active) {
1179212079 /* Check active mailbox complete status every 2ms */
1179312080 msleep(2);
@@ -11797,9 +12084,13 @@ lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba, int mbx_action) · 3 unmodified lines
1179712084 */
1179812085 break;
1179912086 }
11800− } else
12087+ } else {
1180112088 spin_unlock_irq(&phba->hbalock);
1180212089
12090+ /* Enable softirqs again, done with phba->hbalock */
12091+ local_bh_enable();
12092+ }
12093+
1180312094 lpfc_sli_mbox_sys_flush(phba);
1180412095 }
1180512096
@@ -13136,7 +13427,6 @@ static bool · 1330 unmodified lines
1313613427 lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
1313713428 {
1313813429 bool workposted = false;
13139− struct fc_frame_header *fc_hdr;
1314013430 struct lpfc_queue *hrq = phba->sli4_hba.hdr_rq;
1314113431 struct lpfc_queue *drq = phba->sli4_hba.dat_rq;
1314213432 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
1317313463 hrq->RQ_buf_posted--;
1317413464 memcpy(&dma_buf->cq_event.cqe.rcqe_cmpl, rcqe, sizeof(*rcqe));
1317513465
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−
1317913466 /* save off the frame for the word thread to process */
1318013467 list_add_tail(&dma_buf->cq_event.list,
1318113468 &phba->sli4_hba.sp_queue_event);
@@ -14558,13 +14845,10 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq, · 1376 unmodified lines
1455814845 int rc, length, status = 0;
1455914846 uint32_t shdr_status, shdr_add_status;
1456014847 union lpfc_sli4_cfg_shdr *shdr;
14561− uint32_t hw_page_size = phba->sli4_hba.pc_sli4_params.if_page_sz;
1456214848
1456314849 /* sanity check on queue memory */
1456414850 if (!cq || !eq)
1456514851 return -ENODEV;
14566− if (!phba->sli4_hba.pc_sli4_params.supported)
14567− hw_page_size = cq->page_size;
1456814852
1456914853 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
1457014854 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
886886 int lpfc_sli4_post_status_check(struct lpfc_hba *);
887887 uint8_t lpfc_sli_config_mbox_subsys_get(struct lpfc_hba *, LPFC_MBOXQ_t *);
888888 uint8_t lpfc_sli_config_mbox_opcode_get(struct lpfc_hba *, LPFC_MBOXQ_t *);
889+void lpfc_sli4_ras_dma_free(struct lpfc_hba *phba);
drivers/scsi/lpfc/lpfc_version.h+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 * included with this package. *
2121 *******************************************************************/
2222
23−#define LPFC_DRIVER_VERSION "12.0.0.6"
23+#define LPFC_DRIVER_VERSION "12.0.0.7"
2424 #define LPFC_DRIVER_NAME "lpfc"
2525
2626 /* 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
207207 struct lpfc_vport *vport;
208208 unsigned long flags;
209209
210− spin_lock_irqsave(&phba->hbalock, flags);
210+ spin_lock_irqsave(&phba->port_list_lock, flags);
211211 list_for_each_entry(vport, &phba->port_list, listentry) {
212212 if (vport == new_vport)
213213 continue;
@@ -215,11 +215,11 @@ lpfc_unique_wwpn(struct lpfc_hba *phba, struct lpfc_vport *new_vport) · 1 unmodified line
215215 if (memcmp(&vport->fc_sparam.portName,
216216 &new_vport->fc_sparam.portName,
217217 sizeof(struct lpfc_name)) == 0) {
218− spin_unlock_irqrestore(&phba->hbalock, flags);
218+ spin_unlock_irqrestore(&phba->port_list_lock, flags);
219219 return 0;
220220 }
221221 }
222− spin_unlock_irqrestore(&phba->hbalock, flags);
222+ spin_unlock_irqrestore(&phba->port_list_lock, flags);
223223 return 1;
224224 }
225225
@@ -825,9 +825,9 @@ skip_logo: · 599 unmodified lines
825825
826826 lpfc_free_vpi(phba, vport->vpi);
827827 vport->work_port_events = 0;
828− spin_lock_irq(&phba->hbalock);
828+ spin_lock_irq(&phba->port_list_lock);
829829 list_del_init(&vport->listentry);
830− spin_unlock_irq(&phba->hbalock);
830+ spin_unlock_irq(&phba->port_list_lock);
831831 lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
832832 "1828 Vport Deleted.\n");
833833 scsi_host_put(shost);
@@ -844,7 +844,7 @@ lpfc_create_vport_work_array(struct lpfc_hba *phba) · 10 unmodified lines
844844 GFP_KERNEL);
845845 if (vports == NULL)
846846 return NULL;
847− spin_lock_irq(&phba->hbalock);
847+ spin_lock_irq(&phba->port_list_lock);
848848 list_for_each_entry(port_iterator, &phba->port_list, listentry) {
849849 if (port_iterator->load_flag & FC_UNLOADING)
850850 continue;
@@ -856,7 +856,7 @@ lpfc_create_vport_work_array(struct lpfc_hba *phba) · 5 unmodified lines
856856 }
857857 vports[index++] = port_iterator;
858858 }
859− spin_unlock_irq(&phba->hbalock);
859+ spin_unlock_irq(&phba->port_list_lock);
860860 return vports;
861861 }
862862
drivers/scsi/mac_esp.c+11−206
@@ -52,14 +52,12 @@ struct mac_esp_priv { · 51 unmodified lines
5252 struct esp *esp;
5353 void __iomem *pdma_regs;
5454 void __iomem *pdma_io;
55− int error;
5655 };
5756 static struct esp *esp_chips[2];
5857 static DEFINE_SPINLOCK(esp_chips_lock);
5958
6059 #define MAC_ESP_GET_PRIV(esp) ((struct mac_esp_priv *) \
61− platform_get_drvdata((struct platform_device *) \
62− (esp->dev)))
60+ dev_get_drvdata((esp)->dev))
6361
6462 static inline void mac_esp_write8(struct esp *esp, u8 val, unsigned long reg)
6563 {
@@ -71,38 +69,6 @@ static inline u8 mac_esp_read8(struct esp *esp, unsigned long reg) · 5 unmodified lines
7169 return nubus_readb(esp->regs + reg * 16);
7270 }
7371
74−/* For pseudo DMA and PIO we need the virtual address
75− * so this address mapping is the identity mapping.
76− */
77−
78−static 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−
84−static 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−
94−static 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−
100−static void mac_esp_unmap_sg(struct esp *esp, struct scatterlist *sg,
101− int num_sg, int dir)
102−{
103− /* Nothing to do. */
104−}
105−
10672 static void mac_esp_reset_dma(struct esp *esp)
10773 {
10874 /* Nothing to do. */
@@ -120,12 +86,11 @@ static void mac_esp_dma_invalidate(struct esp *esp) · 11 unmodified lines
12086
12187 static int mac_esp_dma_error(struct esp *esp)
12288 {
123− return MAC_ESP_GET_PRIV(esp)->error;
89+ return esp->send_cmd_error;
12490 }
12591
12692 static inline int mac_esp_wait_for_empty_fifo(struct esp *esp)
12793 {
128− struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp);
12994 int i = 500000;
13095
13196 do {
@@ -140,7 +105,7 @@ static inline int mac_esp_wait_for_empty_fifo(struct esp *esp) · 8 unmodified lines
140105
141106 printk(KERN_ERR PFX "FIFO is not empty (sreg %02x)\n",
142107 esp_read8(ESP_STATUS));
143− mep->error = 1;
108+ esp->send_cmd_error = 1;
144109 return 1;
145110 }
146111
@@ -166,7 +131,7 @@ static inline int mac_esp_wait_for_dreq(struct esp *esp) · 19 unmodified lines
166131
167132 printk(KERN_ERR PFX "PDMA timeout (sreg %02x)\n",
168133 esp_read8(ESP_STATUS));
169− mep->error = 1;
134+ esp->send_cmd_error = 1;
170135 return 1;
171136 }
172137
@@ -233,7 +198,7 @@ static void mac_esp_send_pdma_cmd(struct esp *esp, u32 addr, u32 esp_count, · 60 unmodified lines
233198 {
234199 struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp);
235200
236− mep->error = 0;
201+ esp->send_cmd_error = 0;
237202
238203 if (!write)
239204 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
271236 } while (esp_count);
272237 }
273238
274−/*
275− * Programmed IO routines follow.
276− */
277−
278−static 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−
296−static 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−
347−static 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−
432239 static int mac_esp_irq_pending(struct esp *esp)
433240 {
434241 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
470277 static struct esp_driver_ops mac_esp_ops = {
471278 .esp_write8 = mac_esp_write8,
472279 .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,
477280 .irq_pending = mac_esp_irq_pending,
478281 .dma_length_limit = mac_esp_dma_length_limit,
479282 .reset_dma = mac_esp_reset_dma,
@@ -508,7 +311,7 @@ static int esp_mac_probe(struct platform_device *dev) · 28 unmodified lines
508311 esp = shost_priv(host);
509312
510313 esp->host = host;
511− esp->dev = dev;
314+ esp->dev = &dev->dev;
512315
513316 esp->command_block = kzalloc(16, GFP_KERNEL);
514317 if (!esp->command_block)
@@ -551,14 +354,16 @@ static int esp_mac_probe(struct platform_device *dev) · 36 unmodified lines
551354 mep->pdma_regs = NULL;
552355 break;
553356 }
357+ esp->fifo_reg = esp->regs + ESP_FDATA * 16;
554358
555359 esp->ops = &mac_esp_ops;
360+ esp->flags = ESP_FLAG_NO_DMA_MAP;
556361 if (mep->pdma_io == NULL) {
557362 printk(KERN_INFO PFX "using PIO for controller %d\n", dev->id);
558363 esp_write8(0, ESP_TCLOW);
559364 esp_write8(0, ESP_TCMED);
560− esp->flags = ESP_FLAG_DISABLE_SYNC;
561− mac_esp_ops.send_dma_cmd = mac_esp_send_pio_cmd;
365+ esp->flags |= ESP_FLAG_DISABLE_SYNC;
366+ mac_esp_ops.send_dma_cmd = esp_send_pio_cmd;
562367 } else {
563368 printk(KERN_INFO PFX "using PDMA for controller %d\n", dev->id);
564369 }
@@ -577,7 +382,7 @@ static int esp_mac_probe(struct platform_device *dev) · 12 unmodified lines
577382 esp_chips[dev->id] = esp;
578383 spin_unlock(&esp_chips_lock);
579384
580− err = scsi_esp_register(esp, &dev->dev);
385+ err = scsi_esp_register(esp);
581386 if (err)
582387 goto fail_free_irq;
583388
drivers/scsi/megaraid/megaraid_mbox.c+28−89
@@ -201,13 +201,6 @@ int mraid_debug_level = CL_ANN; · 200 unmodified lines
201201 module_param_named(debug_level, mraid_debug_level, int, 0);
202202 MODULE_PARM_DESC(debug_level, "Debug level for driver (default=0)");
203203
204−/*
205− * ### global data ###
206− */
207−static uint8_t megaraid_mbox_version[8] =
208− { 0x02, 0x20, 0x04, 0x06, 3, 7, 20, 5 };
209−
210−
211204 /*
212205 * PCI table for all supported controllers.
213206 */
@@ -457,10 +450,9 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 243 unmodified lines
457450
458451 // Setup the default DMA mask. This would be changed later on
459452 // depending on hardware capabilities
460− if (pci_set_dma_mask(adapter->pdev, DMA_BIT_MASK(32)) != 0) {
461−
453+ if (dma_set_mask(&adapter->pdev->dev, DMA_BIT_MASK(32))) {
462454 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__));
464456
465457 goto out_free_adapter;
466458 }
@@ -484,7 +476,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 17 unmodified lines
484476 // Start the mailbox based controller
485477 if (megaraid_init_mbox(adapter) != 0) {
486478 con_log(CL_ANN, (KERN_WARNING
487− "megaraid: maibox adapter did not initialize\n"));
479+ "megaraid: mailbox adapter did not initialize\n"));
488480
489481 goto out_free_adapter;
490482 }
@@ -878,11 +870,12 @@ megaraid_init_mbox(adapter_t *adapter) · 387 unmodified lines
878870 adapter->pdev->device == PCI_DEVICE_ID_PERC4_DI_EVERGLADES) ||
879871 (adapter->pdev->vendor == PCI_VENDOR_ID_DELL &&
880872 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))) {
882874 con_log(CL_ANN, (KERN_WARNING
883875 "megaraid: DMA mask for 64-bit failed\n"));
884876
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))) {
886879 con_log(CL_ANN, (KERN_WARNING
887880 "megaraid: 32-bit DMA mask failed\n"));
888881 goto out_free_sysfs_res;
@@ -950,7 +943,7 @@ megaraid_fini_mbox(adapter_t *adapter) · 61 unmodified lines
950943 * megaraid_alloc_cmd_packets - allocate shared mailbox
951944 * @adapter : soft state of the raid controller
952945 *
953− * Allocate and align the shared mailbox. This maibox is used to issue
946+ * Allocate and align the shared mailbox. This mailbox is used to issue
954947 * all the commands. For IO based controllers, the mailbox is also registered
955948 * with the FW. Allocate memory for all commands as well.
956949 * This is our big allocator.
@@ -975,9 +968,9 @@ megaraid_alloc_cmd_packets(adapter_t *adapter) · 18 unmodified lines
975968 * Allocate the common 16-byte aligned memory for the handshake
976969 * mailbox.
977970 */
978− raid_dev->una_mbox64 = pci_zalloc_consistent(adapter->pdev,
979− sizeof(mbox64_t),
980− &raid_dev->una_mbox64_dma);
971+ raid_dev->una_mbox64 = dma_zalloc_coherent(&adapter->pdev->dev,
972+ sizeof(mbox64_t), &raid_dev->una_mbox64_dma,
973+ GFP_KERNEL);
981974
982975 if (!raid_dev->una_mbox64) {
983976 con_log(CL_ANN, (KERN_WARNING
@@ -1003,8 +996,8 @@ megaraid_alloc_cmd_packets(adapter_t *adapter) · 19 unmodified lines
1003996 align;
1004997
1005998 // Allocate memory for commands issued internally
1006− adapter->ibuf = pci_zalloc_consistent(pdev, MBOX_IBUF_SIZE,
1007− &adapter->ibuf_dma_h);
999+ adapter->ibuf = dma_zalloc_coherent(&pdev->dev, MBOX_IBUF_SIZE,
1000+ &adapter->ibuf_dma_h, GFP_KERNEL);
10081001 if (!adapter->ibuf) {
10091002
10101003 con_log(CL_ANN, (KERN_WARNING
@@ -1082,7 +1075,7 @@ megaraid_alloc_cmd_packets(adapter_t *adapter) · 71 unmodified lines
10821075
10831076 scb->scp = NULL;
10841077 scb->state = SCB_FREE;
1085− scb->dma_direction = PCI_DMA_NONE;
1078+ scb->dma_direction = DMA_NONE;
10861079 scb->dma_type = MRAID_DMA_NONE;
10871080 scb->dev_channel = -1;
10881081 scb->dev_target = -1;
@@ -1098,10 +1091,10 @@ out_teardown_dma_pools: · 9 unmodified lines
10981091 out_free_scb_list:
10991092 kfree(adapter->kscb_list);
11001093 out_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,
11021095 adapter->ibuf_dma_h);
11031096 out_free_common_mbox:
1104− pci_free_consistent(adapter->pdev, sizeof(mbox64_t),
1097+ dma_free_coherent(&adapter->pdev->dev, sizeof(mbox64_t),
11051098 (caddr_t)raid_dev->una_mbox64, raid_dev->una_mbox64_dma);
11061099
11071100 return -1;
@@ -1123,10 +1116,10 @@ megaraid_free_cmd_packets(adapter_t *adapter) · 15 unmodified lines
11231116
11241117 kfree(adapter->kscb_list);
11251118
1126− pci_free_consistent(adapter->pdev, MBOX_IBUF_SIZE,
1119+ dma_free_coherent(&adapter->pdev->dev, MBOX_IBUF_SIZE,
11271120 (void *)adapter->ibuf, adapter->ibuf_dma_h);
11281121
1129− pci_free_consistent(adapter->pdev, sizeof(mbox64_t),
1122+ dma_free_coherent(&adapter->pdev->dev, sizeof(mbox64_t),
11301123 (caddr_t)raid_dev->una_mbox64, raid_dev->una_mbox64_dma);
11311124 return;
11321125 }
@@ -1428,12 +1421,6 @@ mbox_post_cmd(adapter_t *adapter, scb_t *scb) · 295 unmodified lines
14281421
14291422 adapter->outstanding_cmds++;
14301423
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−
14371424 mbox->busy = 1; // Set busy
14381425 mbox->poll = 0;
14391426 mbox->ack = 0;
@@ -2180,31 +2167,6 @@ megaraid_isr(int irq, void *devp) · 740 unmodified lines
21802167 }
21812168
21822169
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− */
2190−static void
2191−megaraid_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−
22082170 /**
22092171 * megaraid_mbox_dpc - the tasklet to complete the commands from completed list
22102172 * @devp : pointer to HBA soft state
@@ -2403,9 +2365,7 @@ megaraid_mbox_dpc(unsigned long devp) · 192 unmodified lines
24032365 megaraid_mbox_display_scb(adapter, scb);
24042366 }
24052367
2406− // Free our internal resources and call the mid-layer callback
2407− // routine
2408− megaraid_mbox_sync_scb(adapter, scb);
2368+ scsi_dma_unmap(scp);
24092369
24102370 // remove from local clist
24112371 list_del_init(&scb->list);
@@ -2577,7 +2537,6 @@ megaraid_reset_handler(struct scsi_cmnd *scp) · 165 unmodified lines
25772537 uint8_t raw_mbox[sizeof(mbox_t)];
25782538 int rval;
25792539 int recovery_window;
2580− int recovering;
25812540 int i;
25822541 uioc_t *kioc;
25832542
@@ -2591,7 +2550,6 @@ megaraid_reset_handler(struct scsi_cmnd *scp) · 7 unmodified lines
25912550 return FAILED;
25922551 }
25932552
2594−
25952553 // Under exceptional conditions, FW can take up to 3 minutes to
25962554 // complete command processing. Wait for additional 2 minutes for the
25972555 // 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
26402598
26412599 recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT;
26422600
2643− recovering = adapter->outstanding_cmds;
2644−
26452601 for (i = 0; i < recovery_window; i++) {
26462602
26472603 megaraid_ack_sequence(adapter);
@@ -2725,13 +2681,10 @@ static int · 77 unmodified lines
27252681 mbox_post_sync_cmd(adapter_t *adapter, uint8_t raw_mbox[])
27262682 {
27272683 mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter);
2728− mbox64_t *mbox64;
27292684 mbox_t *mbox;
27302685 uint8_t status;
27312686 int i;
27322687
2733−
2734− mbox64 = raid_dev->mbox64;
27352688 mbox = raid_dev->mbox;
27362689
27372690 /*
@@ -2948,9 +2901,8 @@ megaraid_mbox_product_info(adapter_t *adapter) · 210 unmodified lines
29482901 * Issue an ENQUIRY3 command to find out certain adapter parameters,
29492902 * e.g., max channels, max commands etc.
29502903 */
2951− pinfo = pci_zalloc_consistent(adapter->pdev, sizeof(mraid_pinfo_t),
2952− &pinfo_dma_h);
2953−
2904+ pinfo = dma_zalloc_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t),
2905+ &pinfo_dma_h, GFP_KERNEL);
29542906 if (pinfo == NULL) {
29552907 con_log(CL_ANN, (KERN_WARNING
29562908 "megaraid: out of memory, %s %d\n", __func__,
@@ -2971,7 +2923,7 @@ megaraid_mbox_product_info(adapter_t *adapter) · 14 unmodified lines
29712923
29722924 con_log(CL_ANN, (KERN_WARNING "megaraid: Inquiry3 failed\n"));
29732925
2974− pci_free_consistent(adapter->pdev, sizeof(mraid_pinfo_t),
2926+ dma_free_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t),
29752927 pinfo, pinfo_dma_h);
29762928
29772929 return -1;
@@ -3002,7 +2954,7 @@ megaraid_mbox_product_info(adapter_t *adapter) · 24 unmodified lines
30022954 con_log(CL_ANN, (KERN_WARNING
30032955 "megaraid: product info failed\n"));
30042956
3005− pci_free_consistent(adapter->pdev, sizeof(mraid_pinfo_t),
2957+ dma_free_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t),
30062958 pinfo, pinfo_dma_h);
30072959
30082960 return -1;
@@ -3038,7 +2990,7 @@ megaraid_mbox_product_info(adapter_t *adapter) · 29 unmodified lines
30382990 "megaraid: fw version:[%s] bios version:[%s]\n",
30392991 adapter->fw_version, adapter->bios_version));
30402992
3041− pci_free_consistent(adapter->pdev, sizeof(mraid_pinfo_t), pinfo,
2993+ dma_free_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t), pinfo,
30422994 pinfo_dma_h);
30432995
30442996 return 0;
@@ -3135,7 +3087,6 @@ megaraid_mbox_support_ha(adapter_t *adapter, uint16_t *init_id) · 90 unmodified lines
31353087 static int
31363088 megaraid_mbox_support_random_del(adapter_t *adapter)
31373089 {
3138− mbox_t *mbox;
31393090 uint8_t raw_mbox[sizeof(mbox_t)];
31403091 int rval;
31413092
@@ -3157,8 +3108,6 @@ megaraid_mbox_support_random_del(adapter_t *adapter) · 15 unmodified lines
31573108 return 0;
31583109 }
31593110
3160− mbox = (mbox_t *)raw_mbox;
3161−
31623111 memset((caddr_t)raw_mbox, 0, sizeof(mbox_t));
31633112
31643113 raw_mbox[0] = FC_DEL_LOGDRV;
@@ -3263,12 +3212,8 @@ megaraid_mbox_enum_raid_scsi(adapter_t *adapter) · 98 unmodified lines
32633212 static void
32643213 megaraid_mbox_flush_cache(adapter_t *adapter)
32653214 {
3266− mbox_t *mbox;
32673215 uint8_t raw_mbox[sizeof(mbox_t)];
32683216
3269−
3270− mbox = (mbox_t *)raw_mbox;
3271−
32723217 memset((caddr_t)raw_mbox, 0, sizeof(mbox_t));
32733218
32743219 raw_mbox[0] = FLUSH_ADAPTER;
@@ -3299,7 +3244,6 @@ megaraid_mbox_fire_sync_cmd(adapter_t *adapter) · 24 unmodified lines
32993244 mbox_t *mbox;
33003245 uint8_t raw_mbox[sizeof(mbox_t)];
33013246 mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter);
3302− mbox64_t *mbox64;
33033247 int status = 0;
33043248 int i;
33053249 uint32_t dword;
@@ -3310,7 +3254,6 @@ megaraid_mbox_fire_sync_cmd(adapter_t *adapter) · 4 unmodified lines
33103254
33113255 raw_mbox[0] = 0xFF;
33123256
3313− mbox64 = raid_dev->mbox64;
33143257 mbox = raid_dev->mbox;
33153258
33163259 /* Wait until mailbox is free */
@@ -3515,7 +3458,7 @@ megaraid_cmm_register(adapter_t *adapter) · 198 unmodified lines
35153458
35163459 scb->scp = NULL;
35173460 scb->state = SCB_FREE;
3518− scb->dma_direction = PCI_DMA_NONE;
3461+ scb->dma_direction = DMA_NONE;
35193462 scb->dma_type = MRAID_DMA_NONE;
35203463 scb->dev_channel = -1;
35213464 scb->dev_target = -1;
@@ -3653,7 +3596,7 @@ megaraid_mbox_mm_command(adapter_t *adapter, uioc_t *kioc) · 131 unmodified lines
36533596
36543597 scb->state = SCB_ACTIVE;
36553598 scb->dma_type = MRAID_DMA_NONE;
3656− scb->dma_direction = PCI_DMA_NONE;
3599+ scb->dma_direction = DMA_NONE;
36573600
36583601 ccb = (mbox_ccb_t *)scb->ccb;
36593602 mbox64 = (mbox64_t *)(unsigned long)kioc->cmdbuf;
@@ -3794,10 +3737,6 @@ megaraid_mbox_mm_done(adapter_t *adapter, scb_t *scb) · 134 unmodified lines
37943737 static int
37953738 gather_hbainfo(adapter_t *adapter, mraid_hba_info_t *hinfo)
37963739 {
3797− uint8_t dmajor;
3798−
3799− dmajor = megaraid_mbox_version[0];
3800−
38013740 hinfo->pci_vendor_id = adapter->pdev->vendor;
38023741 hinfo->pci_device_id = adapter->pdev->device;
38033742 hinfo->subsys_vendor_id = adapter->pdev->subsystem_vendor;
@@ -3843,8 +3782,8 @@ megaraid_sysfs_alloc_resources(adapter_t *adapter) · 39 unmodified lines
38433782
38443783 raid_dev->sysfs_mbox64 = kmalloc(sizeof(mbox64_t), GFP_KERNEL);
38453784
3846− raid_dev->sysfs_buffer = pci_alloc_consistent(adapter->pdev,
3847− PAGE_SIZE, &raid_dev->sysfs_buffer_dma);
3785+ raid_dev->sysfs_buffer = dma_alloc_coherent(&adapter->pdev->dev,
3786+ PAGE_SIZE, &raid_dev->sysfs_buffer_dma, GFP_KERNEL);
38483787
38493788 if (!raid_dev->sysfs_uioc || !raid_dev->sysfs_mbox64 ||
38503789 !raid_dev->sysfs_buffer) {
@@ -3881,7 +3820,7 @@ megaraid_sysfs_free_resources(adapter_t *adapter) · 30 unmodified lines
38813820 kfree(raid_dev->sysfs_mbox64);
38823821
38833822 if (raid_dev->sysfs_buffer) {
3884− pci_free_consistent(adapter->pdev, PAGE_SIZE,
3823+ dma_free_coherent(&adapter->pdev->dev, PAGE_SIZE,
38853824 raid_dev->sysfs_buffer, raid_dev->sysfs_buffer_dma);
38863825 }
38873826 }
drivers/scsi/megaraid/megaraid_mbox.h+1−1
@@ -117,7 +117,7 @@ · 116 unmodified lines
117117 * @raw_mbox : raw mailbox pointer
118118 * @mbox : mailbox
119119 * @mbox64 : extended mailbox
120− * @mbox_dma_h : maibox dma address
120+ * @mbox_dma_h : mailbox dma address
121121 * @sgl64 : 64-bit scatter-gather list
122122 * @sgl32 : 32-bit scatter-gather list
123123 * @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
13301330 device_id = MEGASAS_DEV_INDEX(scp);
13311331 pthru = (struct megasas_pthru_frame *)cmd->frame;
13321332
1333− if (scp->sc_data_direction == PCI_DMA_TODEVICE)
1333+ if (scp->sc_data_direction == DMA_TO_DEVICE)
13341334 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)
13361336 flags = MFI_FRAME_DIR_READ;
1337− else if (scp->sc_data_direction == PCI_DMA_NONE)
1337+ else if (scp->sc_data_direction == DMA_NONE)
13381338 flags = MFI_FRAME_DIR_NONE;
13391339
13401340 if (instance->flag_ieee == 1) {
@@ -1428,9 +1428,9 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp, · 87 unmodified lines
14281428 device_id = MEGASAS_DEV_INDEX(scp);
14291429 ldio = (struct megasas_io_frame *)cmd->frame;
14301430
1431− if (scp->sc_data_direction == PCI_DMA_TODEVICE)
1431+ if (scp->sc_data_direction == DMA_TO_DEVICE)
14321432 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)
14341434 flags = MFI_FRAME_DIR_READ;
14351435
14361436 if (instance->flag_ieee == 1) {
@@ -2240,9 +2240,9 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance, · 803 unmodified lines
22402240 sizeof(struct MR_LD_VF_AFFILIATION_111));
22412241 else {
22422242 new_affiliation_111 =
2243− pci_zalloc_consistent(instance->pdev,
2243+ dma_zalloc_coherent(&instance->pdev->dev,
22442244 sizeof(struct MR_LD_VF_AFFILIATION_111),
2245− &new_affiliation_111_h);
2245+ &new_affiliation_111_h, GFP_KERNEL);
22462246 if (!new_affiliation_111) {
22472247 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "
22482248 "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
23022302 }
23032303 out:
23042304 if (new_affiliation_111) {
2305− pci_free_consistent(instance->pdev,
2305+ dma_free_coherent(&instance->pdev->dev,
23062306 sizeof(struct MR_LD_VF_AFFILIATION_111),
23072307 new_affiliation_111,
23082308 new_affiliation_111_h);
@@ -2347,10 +2347,10 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance, · 38 unmodified lines
23472347 sizeof(struct MR_LD_VF_AFFILIATION));
23482348 else {
23492349 new_affiliation =
2350− pci_zalloc_consistent(instance->pdev,
2350+ dma_zalloc_coherent(&instance->pdev->dev,
23512351 (MAX_LOGICAL_DRIVES + 1) *
23522352 sizeof(struct MR_LD_VF_AFFILIATION),
2353− &new_affiliation_h);
2353+ &new_affiliation_h, GFP_KERNEL);
23542354 if (!new_affiliation) {
23552355 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "
23562356 "memory for new affiliation for scsi%d\n",
@@ -2470,7 +2470,7 @@ out: · 113 unmodified lines
24702470 }
24712471
24722472 if (new_affiliation)
2473− pci_free_consistent(instance->pdev,
2473+ dma_free_coherent(&instance->pdev->dev,
24742474 (MAX_LOGICAL_DRIVES + 1) *
24752475 sizeof(struct MR_LD_VF_AFFILIATION),
24762476 new_affiliation, new_affiliation_h);
@@ -2513,9 +2513,9 @@ int megasas_sriov_start_heartbeat(struct megasas_instance *instance, · 36 unmodified lines
25132513
25142514 if (initial) {
25152515 instance->hb_host_mem =
2516− pci_zalloc_consistent(instance->pdev,
2516+ dma_zalloc_coherent(&instance->pdev->dev,
25172517 sizeof(struct MR_CTRL_HB_HOST_MEM),
2518− &instance->hb_host_mem_h);
2518+ &instance->hb_host_mem_h, GFP_KERNEL);
25192519 if (!instance->hb_host_mem) {
25202520 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate"
25212521 " memory for heartbeat host memory for scsi%d\n",
@@ -4995,9 +4995,8 @@ megasas_init_adapter_mfi(struct megasas_instance *instance) · 2473 unmodified lines
49954995 context_sz = sizeof(u32);
49964996 reply_q_sz = context_sz * (instance->max_fw_cmds + 1);
49974997
4998− instance->reply_queue = pci_alloc_consistent(instance->pdev,
4999− reply_q_sz,
5000− &instance->reply_queue_h);
4998+ instance->reply_queue = dma_alloc_coherent(&instance->pdev->dev,
4999+ reply_q_sz, &instance->reply_queue_h, GFP_KERNEL);
50015000
50025001 if (!instance->reply_queue) {
50035002 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
50295028
50305029 fail_fw_init:
50315030
5032− pci_free_consistent(instance->pdev, reply_q_sz,
5031+ dma_free_coherent(&instance->pdev->dev, reply_q_sz,
50335032 instance->reply_queue, instance->reply_queue_h);
50345033 fail_reply_queue:
50355034 megasas_free_cmds(instance);
@@ -5533,7 +5532,7 @@ static int megasas_init_fw(struct megasas_instance *instance) · 497 unmodified lines
55335532
55345533 else {
55355534 if (instance->crash_dump_buf)
5536− pci_free_consistent(instance->pdev,
5535+ dma_free_coherent(&instance->pdev->dev,
55375536 CRASH_DMA_BUF_SIZE,
55385537 instance->crash_dump_buf,
55395538 instance->crash_dump_h);
@@ -5616,7 +5615,7 @@ static void megasas_release_mfi(struct megasas_instance *instance) · 76 unmodified lines
56165615 u32 reply_q_sz = sizeof(u32) *(instance->max_mfi_cmds + 1);
56175616
56185617 if (instance->reply_queue)
5619− pci_free_consistent(instance->pdev, reply_q_sz,
5618+ dma_free_coherent(&instance->pdev->dev, reply_q_sz,
56205619 instance->reply_queue, instance->reply_queue_h);
56215620
56225621 megasas_free_cmds(instance);
@@ -5655,10 +5654,9 @@ megasas_get_seq_num(struct megasas_instance *instance, · 32 unmodified lines
56555654 }
56565655
56575656 dcmd = &cmd->frame->dcmd;
5658− el_info = pci_zalloc_consistent(instance->pdev,
5659− sizeof(struct megasas_evt_log_info),
5660− &el_info_h);
5661−
5657+ el_info = dma_zalloc_coherent(&instance->pdev->dev,
5658+ sizeof(struct megasas_evt_log_info), &el_info_h,
5659+ GFP_KERNEL);
56625660 if (!el_info) {
56635661 megasas_return_cmd(instance, cmd);
56645662 return -ENOMEM;
@@ -5695,8 +5693,9 @@ megasas_get_seq_num(struct megasas_instance *instance, · 30 unmodified lines
56955693 eli->boot_seq_num = el_info->boot_seq_num;
56965694
56975695 dcmd_failed:
5698− pci_free_consistent(instance->pdev, sizeof(struct megasas_evt_log_info),
5699− el_info, el_info_h);
5696+ dma_free_coherent(&instance->pdev->dev,
5697+ sizeof(struct megasas_evt_log_info),
5698+ el_info, el_info_h);
57005699
57015700 megasas_return_cmd(instance, cmd);
57025701
@@ -6134,10 +6133,10 @@ static inline void megasas_set_adapter_type(struct megasas_instance *instance) · 431 unmodified lines
61346133
61356134 static inline int megasas_alloc_mfi_ctrl_mem(struct megasas_instance *instance)
61366135 {
6137− instance->producer = pci_alloc_consistent(instance->pdev, sizeof(u32),
6138− &instance->producer_h);
6139− instance->consumer = pci_alloc_consistent(instance->pdev, sizeof(u32),
6140− &instance->consumer_h);
6136+ instance->producer = dma_alloc_coherent(&instance->pdev->dev,
6137+ sizeof(u32), &instance->producer_h, GFP_KERNEL);
6138+ instance->consumer = dma_alloc_coherent(&instance->pdev->dev,
6139+ sizeof(u32), &instance->consumer_h, GFP_KERNEL);
61416140
61426141 if (!instance->producer || !instance->consumer) {
61436142 dev_err(&instance->pdev->dev,
@@ -6199,11 +6198,11 @@ static inline void megasas_free_ctrl_mem(struct megasas_instance *instance) · 55 unmodified lines
61996198 kfree(instance->reply_map);
62006199 if (instance->adapter_type == MFI_SERIES) {
62016200 if (instance->producer)
6202− pci_free_consistent(instance->pdev, sizeof(u32),
6201+ dma_free_coherent(&instance->pdev->dev, sizeof(u32),
62036202 instance->producer,
62046203 instance->producer_h);
62056204 if (instance->consumer)
6206− pci_free_consistent(instance->pdev, sizeof(u32),
6205+ dma_free_coherent(&instance->pdev->dev, sizeof(u32),
62076206 instance->consumer,
62086207 instance->consumer_h);
62096208 } else {
@@ -6224,10 +6223,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 14 unmodified lines
62246223 struct pci_dev *pdev = instance->pdev;
62256224 struct fusion_context *fusion = instance->ctrl_context;
62266225
6227− instance->evt_detail =
6228− pci_alloc_consistent(pdev,
6229− sizeof(struct megasas_evt_detail),
6230− &instance->evt_detail_h);
6226+ instance->evt_detail = dma_alloc_coherent(&pdev->dev,
6227+ sizeof(struct megasas_evt_detail),
6228+ &instance->evt_detail_h, GFP_KERNEL);
62316229
62326230 if (!instance->evt_detail) {
62336231 dev_err(&instance->pdev->dev,
@@ -6250,9 +6248,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 16 unmodified lines
62506248 }
62516249
62526250 instance->pd_list_buf =
6253− pci_alloc_consistent(pdev,
6251+ dma_alloc_coherent(&pdev->dev,
62546252 MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST),
6255− &instance->pd_list_buf_h);
6253+ &instance->pd_list_buf_h, GFP_KERNEL);
62566254
62576255 if (!instance->pd_list_buf) {
62586256 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
62606258 }
62616259
62626260 instance->ctrl_info_buf =
6263− pci_alloc_consistent(pdev,
6261+ dma_alloc_coherent(&pdev->dev,
62646262 sizeof(struct megasas_ctrl_info),
6265− &instance->ctrl_info_buf_h);
6263+ &instance->ctrl_info_buf_h, GFP_KERNEL);
62666264
62676265 if (!instance->ctrl_info_buf) {
62686266 dev_err(&pdev->dev,
@@ -6271,9 +6269,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 2 unmodified lines
62716269 }
62726270
62736271 instance->ld_list_buf =
6274− pci_alloc_consistent(pdev,
6272+ dma_alloc_coherent(&pdev->dev,
62756273 sizeof(struct MR_LD_LIST),
6276− &instance->ld_list_buf_h);
6274+ &instance->ld_list_buf_h, GFP_KERNEL);
62776275
62786276 if (!instance->ld_list_buf) {
62796277 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
62816279 }
62826280
62836281 instance->ld_targetid_list_buf =
6284− pci_alloc_consistent(pdev,
6285− sizeof(struct MR_LD_TARGETID_LIST),
6286− &instance->ld_targetid_list_buf_h);
6282+ dma_alloc_coherent(&pdev->dev,
6283+ sizeof(struct MR_LD_TARGETID_LIST),
6284+ &instance->ld_targetid_list_buf_h, GFP_KERNEL);
62876285
62886286 if (!instance->ld_targetid_list_buf) {
62896287 dev_err(&pdev->dev,
@@ -6293,21 +6291,20 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) · 3 unmodified lines
62936291
62946292 if (!reset_devices) {
62956293 instance->system_info_buf =
6296− pci_alloc_consistent(pdev,
6297− sizeof(struct MR_DRV_SYSTEM_INFO),
6298− &instance->system_info_h);
6294+ dma_alloc_coherent(&pdev->dev,
6295+ sizeof(struct MR_DRV_SYSTEM_INFO),
6296+ &instance->system_info_h, GFP_KERNEL);
62996297 instance->pd_info =
6300− pci_alloc_consistent(pdev,
6301− sizeof(struct MR_PD_INFO),
6302− &instance->pd_info_h);
6298+ dma_alloc_coherent(&pdev->dev,
6299+ sizeof(struct MR_PD_INFO),
6300+ &instance->pd_info_h, GFP_KERNEL);
63036301 instance->tgt_prop =
6304− pci_alloc_consistent(pdev,
6305− sizeof(struct MR_TARGET_PROPERTIES),
6306− &instance->tgt_prop_h);
6302+ dma_alloc_coherent(&pdev->dev,
6303+ sizeof(struct MR_TARGET_PROPERTIES),
6304+ &instance->tgt_prop_h, GFP_KERNEL);
63076305 instance->crash_dump_buf =
6308− pci_alloc_consistent(pdev,
6309− CRASH_DMA_BUF_SIZE,
6310− &instance->crash_dump_h);
6306+ dma_alloc_coherent(&pdev->dev, CRASH_DMA_BUF_SIZE,
6307+ &instance->crash_dump_h, GFP_KERNEL);
63116308
63126309 if (!instance->system_info_buf)
63136310 dev_err(&instance->pdev->dev,
@@ -6343,7 +6340,7 @@ void megasas_free_ctrl_dma_buffers(struct megasas_instance *instance) · 29 unmodified lines
63436340 struct fusion_context *fusion = instance->ctrl_context;
63446341
63456342 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),
63476344 instance->evt_detail,
63486345 instance->evt_detail_h);
63496346
@@ -6354,41 +6351,41 @@ void megasas_free_ctrl_dma_buffers(struct megasas_instance *instance) · 4 unmodified lines
63546351 fusion->ioc_init_request_phys);
63556352
63566353 if (instance->pd_list_buf)
6357− pci_free_consistent(pdev,
6354+ dma_free_coherent(&pdev->dev,
63586355 MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST),
63596356 instance->pd_list_buf,
63606357 instance->pd_list_buf_h);
63616358
63626359 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),
63646361 instance->ld_list_buf,
63656362 instance->ld_list_buf_h);
63666363
63676364 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),
63696366 instance->ld_targetid_list_buf,
63706367 instance->ld_targetid_list_buf_h);
63716368
63726369 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),
63746371 instance->ctrl_info_buf,
63756372 instance->ctrl_info_buf_h);
63766373
63776374 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),
63796376 instance->system_info_buf,
63806377 instance->system_info_h);
63816378
63826379 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),
63846381 instance->pd_info, instance->pd_info_h);
63856382
63866383 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),
63886385 instance->tgt_prop, instance->tgt_prop_h);
63896386
63906387 if (instance->crash_dump_buf)
6391− pci_free_consistent(pdev, CRASH_DMA_BUF_SIZE,
6388+ dma_free_coherent(&pdev->dev, CRASH_DMA_BUF_SIZE,
63926389 instance->crash_dump_buf,
63936390 instance->crash_dump_h);
63946391 }
@@ -6516,17 +6513,20 @@ static int megasas_probe_one(struct pci_dev *pdev, · 121 unmodified lines
65166513 if (instance->requestorId) {
65176514 if (instance->PlasmaFW111) {
65186515 instance->vf_affiliation_111 =
6519− pci_alloc_consistent(pdev, sizeof(struct MR_LD_VF_AFFILIATION_111),
6520− &instance->vf_affiliation_111_h);
6516+ dma_alloc_coherent(&pdev->dev,
6517+ sizeof(struct MR_LD_VF_AFFILIATION_111),
6518+ &instance->vf_affiliation_111_h,
6519+ GFP_KERNEL);
65216520 if (!instance->vf_affiliation_111)
65226521 dev_warn(&pdev->dev, "Can't allocate "
65236522 "memory for VF affiliation buffer\n");
65246523 } else {
65256524 instance->vf_affiliation =
6526− pci_alloc_consistent(pdev,
6527− (MAX_LOGICAL_DRIVES + 1) *
6528− sizeof(struct MR_LD_VF_AFFILIATION),
6529− &instance->vf_affiliation_h);
6525+ dma_alloc_coherent(&pdev->dev,
6526+ (MAX_LOGICAL_DRIVES + 1) *
6527+ sizeof(struct MR_LD_VF_AFFILIATION),
6528+ &instance->vf_affiliation_h,
6529+ GFP_KERNEL);
65306530 if (!instance->vf_affiliation)
65316531 dev_warn(&pdev->dev, "Can't allocate "
65326532 "memory for VF affiliation buffer\n");
@@ -6994,19 +6994,19 @@ skip_firing_dcmds: · 461 unmodified lines
69946994 }
69956995
69966996 if (instance->vf_affiliation)
6997− pci_free_consistent(pdev, (MAX_LOGICAL_DRIVES + 1) *
6997+ dma_free_coherent(&pdev->dev, (MAX_LOGICAL_DRIVES + 1) *
69986998 sizeof(struct MR_LD_VF_AFFILIATION),
69996999 instance->vf_affiliation,
70007000 instance->vf_affiliation_h);
70017001
70027002 if (instance->vf_affiliation_111)
7003− pci_free_consistent(pdev,
7003+ dma_free_coherent(&pdev->dev,
70047004 sizeof(struct MR_LD_VF_AFFILIATION_111),
70057005 instance->vf_affiliation_111,
70067006 instance->vf_affiliation_111_h);
70077007
70087008 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),
70107010 instance->hb_host_mem,
70117011 instance->hb_host_mem_h);
70127012
@@ -7254,7 +7254,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance, · 241 unmodified lines
72547254
72557255 /*
72567256 * We don't change the dma_coherent_mask, so
7257− * pci_alloc_consistent only returns 32bit addresses
7257+ * dma_alloc_coherent only returns 32bit addresses
72587258 */
72597259 if (instance->consistent_mask_64bit) {
72607260 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
75237523 get_user(user_sense_off, &cioc->sense_off))
75247524 return -EFAULT;
75257525
7526+ if (local_sense_off != user_sense_off)
7527+ return -EINVAL;
7528+
75267529 if (local_sense_len) {
75277530 void __user **sense_ioc_ptr =
75287531 (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
684684 array_size = sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) *
685685 MAX_MSIX_QUEUES_FUSION;
686686
687− fusion->rdpq_virt = pci_zalloc_consistent(instance->pdev, array_size,
688− &fusion->rdpq_phys);
687+ fusion->rdpq_virt = dma_zalloc_coherent(&instance->pdev->dev,
688+ array_size, &fusion->rdpq_phys, GFP_KERNEL);
689689 if (!fusion->rdpq_virt) {
690690 dev_err(&instance->pdev->dev,
691691 "Failed from %s %d\n", __func__, __LINE__);
@@ -813,7 +813,7 @@ megasas_free_rdpq_fusion(struct megasas_instance *instance) { · 121 unmodified lines
813813 dma_pool_destroy(fusion->reply_frames_desc_pool_align);
814814
815815 if (fusion->rdpq_virt)
816− pci_free_consistent(instance->pdev,
816+ dma_free_coherent(&instance->pdev->dev,
817817 sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) * MAX_MSIX_QUEUES_FUSION,
818818 fusion->rdpq_virt, fusion->rdpq_phys);
819819 }
@@ -2209,7 +2209,7 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len, · 1389 unmodified lines
22092209 cdb[0] = MEGASAS_SCSI_VARIABLE_LENGTH_CMD;
22102210 cdb[7] = MEGASAS_SCSI_ADDL_CDB_LEN;
22112211
2212− if (scp->sc_data_direction == PCI_DMA_FROMDEVICE)
2212+ if (scp->sc_data_direction == DMA_FROM_DEVICE)
22132213 cdb[9] = MEGASAS_SCSI_SERVICE_ACTION_READ32;
22142214 else
22152215 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
22382238 cdb[31] = (u8)(num_blocks & 0xff);
22392239
22402240 /* set SCSI IO EEDPFlags */
2241− if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) {
2241+ if (scp->sc_data_direction == DMA_FROM_DEVICE) {
22422242 io_request->EEDPFlags = cpu_to_le16(
22432243 MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG |
22442244 MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG |
@@ -2621,7 +2621,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, · 376 unmodified lines
26212621 scsi_buff_len = scsi_bufflen(scp);
26222622 io_request->DataLength = cpu_to_le32(scsi_buff_len);
26232623
2624− if (scp->sc_data_direction == PCI_DMA_FROMDEVICE)
2624+ if (scp->sc_data_direction == DMA_FROM_DEVICE)
26252625 io_info.isRead = 1;
26262626
26272627 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
30883088
30893089 io_request->SGLFlags = cpu_to_le16(MPI2_SGE_FLAGS_64_BIT_ADDRESSING);
30903090
3091− if (scp->sc_data_direction == PCI_DMA_TODEVICE)
3091+ if (scp->sc_data_direction == DMA_TO_DEVICE)
30923092 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)
30943094 io_request->Control |= cpu_to_le32(MPI2_SCSIIO_CONTROL_READ);
30953095
30963096 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
19151915 /* We use the PCI APIs for now until the generic one gets fixed
19161916 * enough or until we get some macio-specific versions
19171917 */
1918− dma_cmd_space = pci_zalloc_consistent(macio_get_pci_dev(mdev),
1919− ms->dma_cmd_size, &dma_cmd_bus);
1918+ dma_cmd_space = dma_zalloc_coherent(&macio_get_pci_dev(mdev)->dev,
1919+ ms->dma_cmd_size, &dma_cmd_bus, GFP_KERNEL);
19201920 if (dma_cmd_space == NULL) {
19211921 printk(KERN_ERR "mesh: can't allocate DMA table\n");
19221922 goto out_unmap;
@@ -1974,7 +1974,7 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) · 51 unmodified lines
19741974 */
19751975 mesh_shutdown(mdev);
19761976 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,
19781978 ms->dma_cmd_space, ms->dma_cmd_bus);
19791979 out_unmap:
19801980 iounmap(ms->dma);
@@ -2007,7 +2007,7 @@ static int mesh_remove(struct macio_dev *mdev) · 26 unmodified lines
20072007 iounmap(ms->dma);
20082008
20092009 /* 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,
20112011 ms->dma_cmd_space, ms->dma_cmd_bus);
20122012
20132013 /* 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
122122 if (!(status & MPT3_CMD_RESET))
123123 issue_reset = 1;
124124
125− pr_err(MPT3SAS_FMT "Command %s\n", ioc->name,
126− ((issue_reset == 0) ? "terminated due to Host Reset" : "Timeout"));
125+ ioc_err(ioc, "Command %s\n",
126+ issue_reset == 0 ? "terminated due to Host Reset" : "Timeout");
127127 _debug_dump_mf(mpi_request, sz);
128128
129129 return issue_reset;
@@ -336,9 +336,7 @@ _base_get_chain_buffer_dma_to_chain_buffer(struct MPT3SAS_ADAPTER *ioc, · 206 unmodified lines
336336 return ct->chain_buffer;
337337 }
338338 }
339− pr_info(MPT3SAS_FMT
340− "Provided chain_buffer_dma address is not in the lookup list\n",
341− ioc->name);
339+ ioc_info(ioc, "Provided chain_buffer_dma address is not in the lookup list\n");
342340 return NULL;
343341 }
344342
@@ -394,7 +392,7 @@ static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc, · 49 unmodified lines
394392 /* Get scsi_cmd using smid */
395393 scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
396394 if (scmd == NULL) {
397− pr_err(MPT3SAS_FMT "scmd is NULL\n", ioc->name);
395+ ioc_err(ioc, "scmd is NULL\n");
398396 return;
399397 }
400398
@@ -532,11 +530,11 @@ static int mpt3sas_remove_dead_ioc_func(void *arg) · 131 unmodified lines
532530 struct MPT3SAS_ADAPTER *ioc = (struct MPT3SAS_ADAPTER *)arg;
533531 struct pci_dev *pdev;
534532
535− if ((ioc == NULL))
533+ if (!ioc)
536534 return -1;
537535
538536 pdev = ioc->pdev;
539− if ((pdev == NULL))
537+ if (!pdev)
540538 return -1;
541539 pci_stop_and_remove_bus_device_locked(pdev);
542540 return 0;
@@ -566,8 +564,7 @@ _base_fault_reset_work(struct work_struct *work) · 23 unmodified lines
566564
567565 doorbell = mpt3sas_base_get_iocstate(ioc, 0);
568566 if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_MASK) {
569− pr_err(MPT3SAS_FMT "SAS host is non-operational !!!!\n",
570− ioc->name);
567+ ioc_err(ioc, "SAS host is non-operational !!!!\n");
571568
572569 /* It may be possible that EEH recovery can resolve some of
573570 * 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
600597 p = kthread_run(mpt3sas_remove_dead_ioc_func, ioc,
601598 "%s_dead_ioc_%d", ioc->driver_name, ioc->id);
602599 if (IS_ERR(p))
603− pr_err(MPT3SAS_FMT
604− "%s: Running mpt3sas_dead_ioc thread failed !!!!\n",
605− ioc->name, __func__);
600+ ioc_err(ioc, "%s: Running mpt3sas_dead_ioc thread failed !!!!\n",
601+ __func__);
606602 else
607− pr_err(MPT3SAS_FMT
608− "%s: Running mpt3sas_dead_ioc thread success !!!!\n",
609− ioc->name, __func__);
603+ ioc_err(ioc, "%s: Running mpt3sas_dead_ioc thread success !!!!\n",
604+ __func__);
610605 return; /* don't rearm timer */
611606 }
612607
@@ -614,8 +609,8 @@ _base_fault_reset_work(struct work_struct *work) · 1 unmodified line
614609
615610 if ((doorbell & MPI2_IOC_STATE_MASK) != MPI2_IOC_STATE_OPERATIONAL) {
616611 rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
617− pr_warn(MPT3SAS_FMT "%s: hard reset: %s\n", ioc->name,
618− __func__, (rc == 0) ? "success" : "failed");
612+ ioc_warn(ioc, "%s: hard reset: %s\n",
613+ __func__, rc == 0 ? "success" : "failed");
619614 doorbell = mpt3sas_base_get_iocstate(ioc, 0);
620615 if ((doorbell & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_FAULT)
621616 mpt3sas_base_fault_info(ioc, doorbell &
@@ -657,8 +652,7 @@ mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc) · 35 unmodified lines
657652 ioc->fault_reset_work_q =
658653 create_singlethread_workqueue(ioc->fault_reset_work_q_name);
659654 if (!ioc->fault_reset_work_q) {
660− pr_err(MPT3SAS_FMT "%s: failed (line=%d)\n",
661− ioc->name, __func__, __LINE__);
655+ ioc_err(ioc, "%s: failed (line=%d)\n", __func__, __LINE__);
662656 return;
663657 }
664658 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
700694 void
701695 mpt3sas_base_fault_info(struct MPT3SAS_ADAPTER *ioc , u16 fault_code)
702696 {
703− pr_err(MPT3SAS_FMT "fault_state(0x%04x)!\n",
704− ioc->name, fault_code);
697+ ioc_err(ioc, "fault_state(0x%04x)!\n", fault_code);
705698 }
706699
707700 /**
@@ -728,8 +721,7 @@ mpt3sas_halt_firmware(struct MPT3SAS_ADAPTER *ioc) · 20 unmodified lines
728721 mpt3sas_base_fault_info(ioc , doorbell);
729722 else {
730723 writel(0xC0FFEE00, &ioc->chip->Doorbell);
731− pr_err(MPT3SAS_FMT "Firmware is halted due to command timeout\n",
732− ioc->name);
724+ ioc_err(ioc, "Firmware is halted due to command timeout\n");
733725 }
734726
735727 if (ioc->fwfault_debug == 2)
@@ -956,8 +948,8 @@ _base_sas_ioc_info(struct MPT3SAS_ADAPTER *ioc, MPI2DefaultReply_t *mpi_reply, · 220 unmodified lines
956948 break;
957949 }
958950
959− pr_warn(MPT3SAS_FMT "ioc_status: %s(0x%04x), request(0x%p),(%s)\n",
960− ioc->name, desc, ioc_status, request_hdr, func_str);
951+ ioc_warn(ioc, "ioc_status: %s(0x%04x), request(0x%p),(%s)\n",
952+ desc, ioc_status, request_hdr, func_str);
961953
962954 _debug_dump_mf(request_hdr, frame_sz/4);
963955 }
@@ -1003,9 +995,9 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc, · 39 unmodified lines
1003995 {
1004996 Mpi2EventDataSasDiscovery_t *event_data =
1005997 (Mpi2EventDataSasDiscovery_t *)mpi_reply->EventData;
1006− pr_info(MPT3SAS_FMT "Discovery: (%s)", ioc->name,
1007− (event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED) ?
1008− "start" : "stop");
998+ ioc_info(ioc, "Discovery: (%s)",
999+ event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED ?
1000+ "start" : "stop");
10091001 if (event_data->DiscoveryStatus)
10101002 pr_cont(" discovery_status(0x%08x)",
10111003 le32_to_cpu(event_data->DiscoveryStatus));
@@ -1059,14 +1051,13 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc, · 47 unmodified lines
10591051 {
10601052 Mpi26EventDataPCIeEnumeration_t *event_data =
10611053 (Mpi26EventDataPCIeEnumeration_t *)mpi_reply->EventData;
1062− pr_info(MPT3SAS_FMT "PCIE Enumeration: (%s)", ioc->name,
1063− (event_data->ReasonCode ==
1064− MPI26_EVENT_PCIE_ENUM_RC_STARTED) ?
1065− "start" : "stop");
1054+ ioc_info(ioc, "PCIE Enumeration: (%s)",
1055+ event_data->ReasonCode == MPI26_EVENT_PCIE_ENUM_RC_STARTED ?
1056+ "start" : "stop");
10661057 if (event_data->EnumerationStatus)
1067− pr_info("enumeration_status(0x%08x)",
1068− le32_to_cpu(event_data->EnumerationStatus));
1069− pr_info("\n");
1058+ pr_cont("enumeration_status(0x%08x)",
1059+ le32_to_cpu(event_data->EnumerationStatus));
1060+ pr_cont("\n");
10701061 return;
10711062 }
10721063 case MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST:
@@ -1077,7 +1068,7 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc, · 4 unmodified lines
10771068 if (!desc)
10781069 return;
10791070
1080− pr_info(MPT3SAS_FMT "%s\n", ioc->name, desc);
1071+ ioc_info(ioc, "%s\n", desc);
10811072 }
10821073
10831074 /**
@@ -1128,11 +1119,9 @@ _base_sas_log_info(struct MPT3SAS_ADAPTER *ioc , u32 log_info) · 44 unmodified lines
11281119 break;
11291120 }
11301121
1131− pr_warn(MPT3SAS_FMT
1132− "log_info(0x%08x): originator(%s), code(0x%02x), sub_code(0x%04x)\n",
1133− ioc->name, log_info,
1134− originator_str, sas_loginfo.dw.code,
1135− sas_loginfo.dw.subcode);
1122+ ioc_warn(ioc, "log_info(0x%08x): originator(%s), code(0x%02x), sub_code(0x%04x)\n",
1123+ log_info,
1124+ originator_str, sas_loginfo.dw.code, sas_loginfo.dw.subcode);
11361125 }
11371126
11381127 /**
@@ -1152,8 +1141,8 @@ _base_display_reply_info(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, · 13 unmodified lines
11521141
11531142 mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply);
11541143 if (unlikely(!mpi_reply)) {
1155− pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",
1156− ioc->name, __FILE__, __LINE__, __func__);
1144+ ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
1145+ __FILE__, __LINE__, __func__);
11571146 return;
11581147 }
11591148 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
12491238 delayed_event_ack->EventContext = mpi_reply->EventContext;
12501239 list_add_tail(&delayed_event_ack->list,
12511240 &ioc->delayed_event_ack_list);
1252− dewtprintk(ioc, pr_info(MPT3SAS_FMT
1253− "DELAYED: EVENT ACK: event (0x%04x)\n",
1254− ioc->name, le16_to_cpu(mpi_reply->Event)));
1241+ dewtprintk(ioc,
1242+ ioc_info(ioc, "DELAYED: EVENT ACK: event (0x%04x)\n",
1243+ le16_to_cpu(mpi_reply->Event)));
12551244 goto out;
12561245 }
12571246
@@ -2270,7 +2259,7 @@ _base_build_sg_scmd(struct MPT3SAS_ADAPTER *ioc, · 1012 unmodified lines
22702259 sges_left = scsi_dma_map(scmd);
22712260 if (sges_left < 0) {
22722261 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",
22742263 scsi_bufflen(scmd));
22752264 return -ENOMEM;
22762265 }
@@ -2418,7 +2407,7 @@ _base_build_sg_scmd_ieee(struct MPT3SAS_ADAPTER *ioc, · 141 unmodified lines
24182407 sges_left = scsi_dma_map(scmd);
24192408 if (sges_left < 0) {
24202409 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",
24222411 scsi_bufflen(scmd));
24232412 return -ENOMEM;
24242413 }
@@ -2563,44 +2552,41 @@ _base_build_sg_ieee(struct MPT3SAS_ADAPTER *ioc, void *psge, · 138 unmodified lines
25632552 static int
25642553 _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
25652554 {
2555+ u64 required_mask, coherent_mask;
25662556 struct sysinfo s;
2567− u64 consistent_dma_mask;
25682557
25692558 if (ioc->is_mcpu_endpoint)
25702559 goto try_32bit;
25712560
2561+ required_mask = dma_get_required_mask(&pdev->dev);
2562+ if (sizeof(dma_addr_t) == 4 || required_mask == 32)
2563+ goto try_32bit;
2564+
25722565 if (ioc->dma_mask)
2573− consistent_dma_mask = DMA_BIT_MASK(64);
2566+ coherent_mask = DMA_BIT_MASK(64);
25742567 else
2575− consistent_dma_mask = DMA_BIT_MASK(32);
2576−
2577− if (sizeof(dma_addr_t) > 4) {
2578− const uint64_t required_mask =
2579− dma_get_required_mask(&pdev->dev);
2580− if ((required_mask > DMA_BIT_MASK(32)) &&
2581− !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
2582− !pci_set_consistent_dma_mask(pdev, consistent_dma_mask)) {
2583− ioc->base_add_sg_single = &_base_add_sg_single_64;
2584− ioc->sge_size = sizeof(Mpi2SGESimple64_t);
2585− ioc->dma_mask = 64;
2586− goto out;
2587− }
2588− }
2568+ coherent_mask = DMA_BIT_MASK(32);
2569+
2570+ if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) ||
2571+ dma_set_coherent_mask(&pdev->dev, coherent_mask))
2572+ goto try_32bit;
2573+
2574+ ioc->base_add_sg_single = &_base_add_sg_single_64;
2575+ ioc->sge_size = sizeof(Mpi2SGESimple64_t);
2576+ ioc->dma_mask = 64;
2577+ goto out;
25892578
25902579 try_32bit:
2591− if (!pci_set_dma_mask(pdev, 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
2580+ if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))
25972581 return -ENODEV;
25982582
2583+ ioc->base_add_sg_single = &_base_add_sg_single_32;
2584+ ioc->sge_size = sizeof(Mpi2SGESimple32_t);
2585+ ioc->dma_mask = 32;
25992586 out:
26002587 si_meminfo(&s);
2601− pr_info(MPT3SAS_FMT
2602− "%d BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (%ld kB)\n",
2603− ioc->name, ioc->dma_mask, convert_to_kb(s.totalram));
2588+ ioc_info(ioc, "%d BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (%ld kB)\n",
2589+ ioc->dma_mask, convert_to_kb(s.totalram));
26042590
26052591 return 0;
26062592 }
@@ -2639,8 +2625,7 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 32 unmodified lines
26392625
26402626 base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);
26412627 if (!base) {
2642− dfailprintk(ioc, pr_info(MPT3SAS_FMT "msix not supported\n",
2643− ioc->name));
2628+ dfailprintk(ioc, ioc_info(ioc, "msix not supported\n"));
26442629 return -EINVAL;
26452630 }
26462631
@@ -2658,9 +2643,8 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 11 unmodified lines
26582643 pci_read_config_word(ioc->pdev, base + 2, &message_control);
26592644 ioc->msix_vector_count = (message_control & 0x3FF) + 1;
26602645 }
2661− dinitprintk(ioc, pr_info(MPT3SAS_FMT
2662− "msix is supported, vector_count(%d)\n",
2663− ioc->name, ioc->msix_vector_count));
2646+ dinitprintk(ioc, ioc_info(ioc, "msix is supported, vector_count(%d)\n",
2647+ ioc->msix_vector_count));
26642648 return 0;
26652649 }
26662650
@@ -2702,8 +2686,8 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index) · 35 unmodified lines
27022686
27032687 reply_q = kzalloc(sizeof(struct adapter_reply_queue), GFP_KERNEL);
27042688 if (!reply_q) {
2705− pr_err(MPT3SAS_FMT "unable to allocate memory %d!\n",
2706− ioc->name, (int)sizeof(struct adapter_reply_queue));
2689+ ioc_err(ioc, "unable to allocate memory %zu!\n",
2690+ sizeof(struct adapter_reply_queue));
27072691 return -ENOMEM;
27082692 }
27092693 reply_q->ioc = ioc;
@@ -2719,7 +2703,7 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index) · 9 unmodified lines
27192703 r = request_irq(pci_irq_vector(pdev, index), _base_interrupt,
27202704 IRQF_SHARED, reply_q->name, reply_q);
27212705 if (r) {
2722− pr_err(MPT3SAS_FMT "unable to allocate interrupt %d!\n",
2706+ pr_err("%s: unable to allocate interrupt %d!\n",
27232707 reply_q->name, pci_irq_vector(pdev, index));
27242708 kfree(reply_q);
27252709 return -EBUSY;
@@ -2761,8 +2745,8 @@ _base_assign_reply_queues(struct MPT3SAS_ADAPTER *ioc) · 35 unmodified lines
27612745 const cpumask_t *mask = pci_irq_get_affinity(ioc->pdev,
27622746 reply_q->msix_index);
27632747 if (!mask) {
2764− pr_warn(MPT3SAS_FMT "no affinity for msi %x\n",
2765− ioc->name, reply_q->msix_index);
2748+ ioc_warn(ioc, "no affinity for msi %x\n",
2749+ reply_q->msix_index);
27662750 continue;
27672751 }
27682752
@@ -2833,9 +2817,8 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 64 unmodified lines
28332817 ioc->reply_queue_count = min_t(int, ioc->cpu_count,
28342818 ioc->msix_vector_count);
28352819
2836− printk(MPT3SAS_FMT "MSI-X vectors supported: %d, no of cores"
2837− ": %d, max_msix_vectors: %d\n", ioc->name, ioc->msix_vector_count,
2838− ioc->cpu_count, max_msix_vectors);
2820+ ioc_info(ioc, "MSI-X vectors supported: %d, no of cores: %d, max_msix_vectors: %d\n",
2821+ ioc->msix_vector_count, ioc->cpu_count, max_msix_vectors);
28392822
28402823 if (!ioc->rdpq_array_enable && max_msix_vectors == -1)
28412824 local_max_msix_vectors = (reset_devices) ? 1 : 8;
@@ -2857,9 +2840,9 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 15 unmodified lines
28572840 r = pci_alloc_irq_vectors(ioc->pdev, 1, ioc->reply_queue_count,
28582841 irq_flags);
28592842 if (r < 0) {
2860− dfailprintk(ioc, pr_info(MPT3SAS_FMT
2861− "pci_alloc_irq_vectors failed (r=%d) !!!\n",
2862− ioc->name, r));
2843+ dfailprintk(ioc,
2844+ ioc_info(ioc, "pci_alloc_irq_vectors failed (r=%d) !!!\n",
2845+ r));
28632846 goto try_ioapic;
28642847 }
28652848
@@ -2882,9 +2865,9 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines
28822865 ioc->reply_queue_count = 1;
28832866 r = pci_alloc_irq_vectors(ioc->pdev, 1, 1, PCI_IRQ_LEGACY);
28842867 if (r < 0) {
2885− dfailprintk(ioc, pr_info(MPT3SAS_FMT
2886− "pci_alloc_irq_vector(legacy) failed (r=%d) !!!\n",
2887− ioc->name, r));
2868+ dfailprintk(ioc,
2869+ ioc_info(ioc, "pci_alloc_irq_vector(legacy) failed (r=%d) !!!\n",
2870+ r));
28882871 } else
28892872 r = _base_request_irq(ioc, 0);
28902873
@@ -2900,8 +2883,7 @@ mpt3sas_base_unmap_resources(struct MPT3SAS_ADAPTER *ioc) · 9 unmodified lines
29002883 {
29012884 struct pci_dev *pdev = ioc->pdev;
29022885
2903− dexitprintk(ioc, printk(MPT3SAS_FMT "%s\n",
2904− ioc->name, __func__));
2886+ dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
29052887
29062888 _base_free_irq(ioc);
29072889 _base_disable_msix(ioc);
@@ -2939,13 +2921,11 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 31 unmodified lines
29392921 phys_addr_t chip_phys = 0;
29402922 struct adapter_reply_queue *reply_q;
29412923
2942− dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n",
2943− ioc->name, __func__));
2924+ dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
29442925
29452926 ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM);
29462927 if (pci_enable_device_mem(pdev)) {
2947− pr_warn(MPT3SAS_FMT "pci_enable_device_mem: failed\n",
2948− ioc->name);
2928+ ioc_warn(ioc, "pci_enable_device_mem: failed\n");
29492929 ioc->bars = 0;
29502930 return -ENODEV;
29512931 }
@@ -2953,8 +2933,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
29532933
29542934 if (pci_request_selected_regions(pdev, ioc->bars,
29552935 ioc->driver_name)) {
2956− pr_warn(MPT3SAS_FMT "pci_request_selected_regions: failed\n",
2957− ioc->name);
2936+ ioc_warn(ioc, "pci_request_selected_regions: failed\n");
29582937 ioc->bars = 0;
29592938 r = -ENODEV;
29602939 goto out_fail;
@@ -2967,8 +2946,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 6 unmodified lines
29672946
29682947
29692948 if (_base_config_dma_addressing(ioc, pdev) != 0) {
2970− pr_warn(MPT3SAS_FMT "no suitable DMA mask for %s\n",
2971− ioc->name, pci_name(pdev));
2949+ ioc_warn(ioc, "no suitable DMA mask for %s\n", pci_name(pdev));
29722950 r = -ENODEV;
29732951 goto out_fail;
29742952 }
@@ -2991,8 +2969,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines
29912969 }
29922970
29932971 if (ioc->chip == NULL) {
2994− pr_err(MPT3SAS_FMT "unable to map adapter memory! "
2995− " or resource not found\n", ioc->name);
2972+ ioc_err(ioc, "unable to map adapter memory! or resource not found\n");
29962973 r = -EINVAL;
29972974 goto out_fail;
29982975 }
@@ -3026,9 +3003,8 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 27 unmodified lines
30263003 ioc->combined_reply_index_count,
30273004 sizeof(resource_size_t *), GFP_KERNEL);
30283005 if (!ioc->replyPostRegisterIndex) {
3029− dfailprintk(ioc, printk(MPT3SAS_FMT
3030− "allocation for reply Post Register Index failed!!!\n",
3031− ioc->name));
3006+ dfailprintk(ioc,
3007+ ioc_warn(ioc, "allocation for reply Post Register Index failed!!!\n"));
30323008 r = -ENOMEM;
30333009 goto out_fail;
30343010 }
@@ -3053,15 +3029,15 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) · 18 unmodified lines
30533029 }
30543030
30553031 list_for_each_entry(reply_q, &ioc->reply_queue_list, list)
3056− pr_info(MPT3SAS_FMT "%s: IRQ %d\n",
3057− reply_q->name, ((ioc->msix_enable) ? "PCI-MSI-X enabled" :
3058− "IO-APIC enabled"),
3059− pci_irq_vector(ioc->pdev, reply_q->msix_index));
3032+ pr_info("%s: %s enabled: IRQ %d\n",
3033+ reply_q->name,
3034+ ioc->msix_enable ? "PCI-MSI-X" : "IO-APIC",
3035+ pci_irq_vector(ioc->pdev, reply_q->msix_index));
30603036
3061− pr_info(MPT3SAS_FMT "iomem(%pap), mapped(0x%p), size(%d)\n",
3062− ioc->name, &chip_phys, ioc->chip, memap_sz);
3063− pr_info(MPT3SAS_FMT "ioport(0x%016llx), size(%d)\n",
3064− ioc->name, (unsigned long long)pio_chip, pio_sz);
3037+ ioc_info(ioc, "iomem(%pap), mapped(0x%p), size(%d)\n",
3038+ &chip_phys, ioc->chip, memap_sz);
3039+ ioc_info(ioc, "ioport(0x%016llx), size(%d)\n",
3040+ (unsigned long long)pio_chip, pio_sz);
30653041
30663042 /* Save PCI configuration state for recovery from PCI AER/EEH errors */
30673043 pci_save_state(pdev);
@@ -3176,8 +3152,7 @@ mpt3sas_base_get_smid(struct MPT3SAS_ADAPTER *ioc, u8 cb_idx) · 108 unmodified lines
31763152 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
31773153 if (list_empty(&ioc->internal_free_list)) {
31783154 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
3179− pr_err(MPT3SAS_FMT "%s: smid not available\n",
3180− ioc->name, __func__);
3155+ ioc_err(ioc, "%s: smid not available\n", __func__);
31813156 return 0;
31823157 }
31833158
@@ -3545,89 +3520,85 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) · 361 unmodified lines
35453520 case MPI2_MFGPAGE_DEVID_SAS2008:
35463521 switch (ioc->pdev->subsystem_device) {
35473522 case MPT2SAS_INTEL_RMS2LL080_SSDID:
3548− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3549− MPT2SAS_INTEL_RMS2LL080_BRANDING);
3523+ ioc_info(ioc, "%s\n",
3524+ MPT2SAS_INTEL_RMS2LL080_BRANDING);
35503525 break;
35513526 case MPT2SAS_INTEL_RMS2LL040_SSDID:
3552− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3553− MPT2SAS_INTEL_RMS2LL040_BRANDING);
3527+ ioc_info(ioc, "%s\n",
3528+ MPT2SAS_INTEL_RMS2LL040_BRANDING);
35543529 break;
35553530 case MPT2SAS_INTEL_SSD910_SSDID:
3556− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3557− MPT2SAS_INTEL_SSD910_BRANDING);
3531+ ioc_info(ioc, "%s\n",
3532+ MPT2SAS_INTEL_SSD910_BRANDING);
35583533 break;
35593534 default:
3560− pr_info(MPT3SAS_FMT
3561− "Intel(R) Controller: Subsystem ID: 0x%X\n",
3562− ioc->name, ioc->pdev->subsystem_device);
3535+ ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n",
3536+ ioc->pdev->subsystem_device);
35633537 break;
35643538 }
35653539 case MPI2_MFGPAGE_DEVID_SAS2308_2:
35663540 switch (ioc->pdev->subsystem_device) {
35673541 case MPT2SAS_INTEL_RS25GB008_SSDID:
3568− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3569− MPT2SAS_INTEL_RS25GB008_BRANDING);
3542+ ioc_info(ioc, "%s\n",
3543+ MPT2SAS_INTEL_RS25GB008_BRANDING);
35703544 break;
35713545 case MPT2SAS_INTEL_RMS25JB080_SSDID:
3572− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3573− MPT2SAS_INTEL_RMS25JB080_BRANDING);
3546+ ioc_info(ioc, "%s\n",
3547+ MPT2SAS_INTEL_RMS25JB080_BRANDING);
35743548 break;
35753549 case MPT2SAS_INTEL_RMS25JB040_SSDID:
3576− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3577− MPT2SAS_INTEL_RMS25JB040_BRANDING);
3550+ ioc_info(ioc, "%s\n",
3551+ MPT2SAS_INTEL_RMS25JB040_BRANDING);
35783552 break;
35793553 case MPT2SAS_INTEL_RMS25KB080_SSDID:
3580− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3581− MPT2SAS_INTEL_RMS25KB080_BRANDING);
3554+ ioc_info(ioc, "%s\n",
3555+ MPT2SAS_INTEL_RMS25KB080_BRANDING);
35823556 break;
35833557 case MPT2SAS_INTEL_RMS25KB040_SSDID:
3584− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3585− MPT2SAS_INTEL_RMS25KB040_BRANDING);
3558+ ioc_info(ioc, "%s\n",
3559+ MPT2SAS_INTEL_RMS25KB040_BRANDING);
35863560 break;
35873561 case MPT2SAS_INTEL_RMS25LB040_SSDID:
3588− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3589− MPT2SAS_INTEL_RMS25LB040_BRANDING);
3562+ ioc_info(ioc, "%s\n",
3563+ MPT2SAS_INTEL_RMS25LB040_BRANDING);
35903564 break;
35913565 case MPT2SAS_INTEL_RMS25LB080_SSDID:
3592− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3593− MPT2SAS_INTEL_RMS25LB080_BRANDING);
3566+ ioc_info(ioc, "%s\n",
3567+ MPT2SAS_INTEL_RMS25LB080_BRANDING);
35943568 break;
35953569 default:
3596− pr_info(MPT3SAS_FMT
3597− "Intel(R) Controller: Subsystem ID: 0x%X\n",
3598− ioc->name, ioc->pdev->subsystem_device);
3570+ ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n",
3571+ ioc->pdev->subsystem_device);
35993572 break;
36003573 }
36013574 case MPI25_MFGPAGE_DEVID_SAS3008:
36023575 switch (ioc->pdev->subsystem_device) {
36033576 case MPT3SAS_INTEL_RMS3JC080_SSDID:
3604− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3605− MPT3SAS_INTEL_RMS3JC080_BRANDING);
3577+ ioc_info(ioc, "%s\n",
3578+ MPT3SAS_INTEL_RMS3JC080_BRANDING);
36063579 break;
36073580
36083581 case MPT3SAS_INTEL_RS3GC008_SSDID:
3609− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3610− MPT3SAS_INTEL_RS3GC008_BRANDING);
3582+ ioc_info(ioc, "%s\n",
3583+ MPT3SAS_INTEL_RS3GC008_BRANDING);
36113584 break;
36123585 case MPT3SAS_INTEL_RS3FC044_SSDID:
3613− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3614− MPT3SAS_INTEL_RS3FC044_BRANDING);
3586+ ioc_info(ioc, "%s\n",
3587+ MPT3SAS_INTEL_RS3FC044_BRANDING);
36153588 break;
36163589 case MPT3SAS_INTEL_RS3UC080_SSDID:
3617− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3618− MPT3SAS_INTEL_RS3UC080_BRANDING);
3590+ ioc_info(ioc, "%s\n",
3591+ MPT3SAS_INTEL_RS3UC080_BRANDING);
36193592 break;
36203593 default:
3621− pr_info(MPT3SAS_FMT
3622− "Intel(R) Controller: Subsystem ID: 0x%X\n",
3623− ioc->name, ioc->pdev->subsystem_device);
3594+ ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n",
3595+ ioc->pdev->subsystem_device);
36243596 break;
36253597 }
36263598 break;
36273599 default:
3628− pr_info(MPT3SAS_FMT
3629− "Intel(R) Controller: Subsystem ID: 0x%X\n",
3630− ioc->name, ioc->pdev->subsystem_device);
3600+ ioc_info(ioc, "Intel(R) Controller: Subsystem ID: 0x%X\n",
3601+ ioc->pdev->subsystem_device);
36313602 break;
36323603 }
36333604 break;
@@ -3636,57 +3607,54 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
36363607 case MPI2_MFGPAGE_DEVID_SAS2008:
36373608 switch (ioc->pdev->subsystem_device) {
36383609 case MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID:
3639− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3640− MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING);
3610+ ioc_info(ioc, "%s\n",
3611+ MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING);
36413612 break;
36423613 case MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID:
3643− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3644− MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING);
3614+ ioc_info(ioc, "%s\n",
3615+ MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING);
36453616 break;
36463617 case MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID:
3647− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3648− MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING);
3618+ ioc_info(ioc, "%s\n",
3619+ MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING);
36493620 break;
36503621 case MPT2SAS_DELL_PERC_H200_MODULAR_SSDID:
3651− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3652− MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING);
3622+ ioc_info(ioc, "%s\n",
3623+ MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING);
36533624 break;
36543625 case MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID:
3655− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3656− MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING);
3626+ ioc_info(ioc, "%s\n",
3627+ MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING);
36573628 break;
36583629 case MPT2SAS_DELL_PERC_H200_SSDID:
3659− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3660− MPT2SAS_DELL_PERC_H200_BRANDING);
3630+ ioc_info(ioc, "%s\n",
3631+ MPT2SAS_DELL_PERC_H200_BRANDING);
36613632 break;
36623633 case MPT2SAS_DELL_6GBPS_SAS_SSDID:
3663− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3664− MPT2SAS_DELL_6GBPS_SAS_BRANDING);
3634+ ioc_info(ioc, "%s\n",
3635+ MPT2SAS_DELL_6GBPS_SAS_BRANDING);
36653636 break;
36663637 default:
3667− pr_info(MPT3SAS_FMT
3668− "Dell 6Gbps HBA: Subsystem ID: 0x%X\n",
3669− ioc->name, ioc->pdev->subsystem_device);
3638+ ioc_info(ioc, "Dell 6Gbps HBA: Subsystem ID: 0x%X\n",
3639+ ioc->pdev->subsystem_device);
36703640 break;
36713641 }
36723642 break;
36733643 case MPI25_MFGPAGE_DEVID_SAS3008:
36743644 switch (ioc->pdev->subsystem_device) {
36753645 case MPT3SAS_DELL_12G_HBA_SSDID:
3676− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3677− MPT3SAS_DELL_12G_HBA_BRANDING);
3646+ ioc_info(ioc, "%s\n",
3647+ MPT3SAS_DELL_12G_HBA_BRANDING);
36783648 break;
36793649 default:
3680− pr_info(MPT3SAS_FMT
3681− "Dell 12Gbps HBA: Subsystem ID: 0x%X\n",
3682− ioc->name, ioc->pdev->subsystem_device);
3650+ ioc_info(ioc, "Dell 12Gbps HBA: Subsystem ID: 0x%X\n",
3651+ ioc->pdev->subsystem_device);
36833652 break;
36843653 }
36853654 break;
36863655 default:
3687− pr_info(MPT3SAS_FMT
3688− "Dell HBA: Subsystem ID: 0x%X\n", ioc->name,
3689− ioc->pdev->subsystem_device);
3656+ ioc_info(ioc, "Dell HBA: Subsystem ID: 0x%X\n",
3657+ ioc->pdev->subsystem_device);
36903658 break;
36913659 }
36923660 break;
@@ -3695,46 +3663,42 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
36953663 case MPI25_MFGPAGE_DEVID_SAS3008:
36963664 switch (ioc->pdev->subsystem_device) {
36973665 case MPT3SAS_CISCO_12G_8E_HBA_SSDID:
3698− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3699− MPT3SAS_CISCO_12G_8E_HBA_BRANDING);
3666+ ioc_info(ioc, "%s\n",
3667+ MPT3SAS_CISCO_12G_8E_HBA_BRANDING);
37003668 break;
37013669 case MPT3SAS_CISCO_12G_8I_HBA_SSDID:
3702− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3703− MPT3SAS_CISCO_12G_8I_HBA_BRANDING);
3670+ ioc_info(ioc, "%s\n",
3671+ MPT3SAS_CISCO_12G_8I_HBA_BRANDING);
37043672 break;
37053673 case MPT3SAS_CISCO_12G_AVILA_HBA_SSDID:
3706− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3707− MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING);
3674+ ioc_info(ioc, "%s\n",
3675+ MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING);
37083676 break;
37093677 default:
3710− pr_info(MPT3SAS_FMT
3711− "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n",
3712− ioc->name, ioc->pdev->subsystem_device);
3678+ ioc_info(ioc, "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n",
3679+ ioc->pdev->subsystem_device);
37133680 break;
37143681 }
37153682 break;
37163683 case MPI25_MFGPAGE_DEVID_SAS3108_1:
37173684 switch (ioc->pdev->subsystem_device) {
37183685 case MPT3SAS_CISCO_12G_AVILA_HBA_SSDID:
3719− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3720− MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING);
3686+ ioc_info(ioc, "%s\n",
3687+ MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING);
37213688 break;
37223689 case MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_SSDID:
3723− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3724− MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_BRANDING
3725− );
3690+ ioc_info(ioc, "%s\n",
3691+ MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_BRANDING);
37263692 break;
37273693 default:
3728− pr_info(MPT3SAS_FMT
3729− "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n",
3730− ioc->name, ioc->pdev->subsystem_device);
3694+ ioc_info(ioc, "Cisco 12Gbps SAS HBA: Subsystem ID: 0x%X\n",
3695+ ioc->pdev->subsystem_device);
37313696 break;
37323697 }
37333698 break;
37343699 default:
3735− pr_info(MPT3SAS_FMT
3736− "Cisco SAS HBA: Subsystem ID: 0x%X\n",
3737− ioc->name, ioc->pdev->subsystem_device);
3700+ ioc_info(ioc, "Cisco SAS HBA: Subsystem ID: 0x%X\n",
3701+ ioc->pdev->subsystem_device);
37383702 break;
37393703 }
37403704 break;
@@ -3743,43 +3707,40 @@ _base_display_OEMs_branding(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
37433707 case MPI2_MFGPAGE_DEVID_SAS2004:
37443708 switch (ioc->pdev->subsystem_device) {
37453709 case MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_SSDID:
3746− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3747− MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_BRANDING);
3710+ ioc_info(ioc, "%s\n",
3711+ MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_BRANDING);
37483712 break;
37493713 default:
3750− pr_info(MPT3SAS_FMT
3751− "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n",
3752− ioc->name, ioc->pdev->subsystem_device);
3714+ ioc_info(ioc, "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n",
3715+ ioc->pdev->subsystem_device);
37533716 break;
37543717 }
37553718 case MPI2_MFGPAGE_DEVID_SAS2308_2:
37563719 switch (ioc->pdev->subsystem_device) {
37573720 case MPT2SAS_HP_2_4_INTERNAL_SSDID:
3758− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3759− MPT2SAS_HP_2_4_INTERNAL_BRANDING);
3721+ ioc_info(ioc, "%s\n",
3722+ MPT2SAS_HP_2_4_INTERNAL_BRANDING);
37603723 break;
37613724 case MPT2SAS_HP_2_4_EXTERNAL_SSDID:
3762− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3763− MPT2SAS_HP_2_4_EXTERNAL_BRANDING);
3725+ ioc_info(ioc, "%s\n",
3726+ MPT2SAS_HP_2_4_EXTERNAL_BRANDING);
37643727 break;
37653728 case MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_SSDID:
3766− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3767− MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_BRANDING);
3729+ ioc_info(ioc, "%s\n",
3730+ MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_BRANDING);
37683731 break;
37693732 case MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_SSDID:
3770− pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3771− MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_BRANDING);
3733+ ioc_info(ioc, "%s\n",
3734+ MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_BRANDING);
37723735 break;
37733736 default:
3774− pr_info(MPT3SAS_FMT
3775− "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n",
3776− ioc->name, ioc->pdev->subsystem_device);
3737+ ioc_info(ioc, "HP 6Gbps SAS HBA: Subsystem ID: 0x%X\n",
3738+ ioc->pdev->subsystem_device);
37773739 break;
37783740 }
37793741 default:
3780− pr_info(MPT3SAS_FMT
3781− "HP SAS HBA: Subsystem ID: 0x%X\n",
3782− ioc->name, ioc->pdev->subsystem_device);
3742+ ioc_info(ioc, "HP SAS HBA: Subsystem ID: 0x%X\n",
3743+ ioc->pdev->subsystem_device);
37833744 break;
37843745 }
37853746 default:
@@ -3806,28 +3767,25 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) · 20 unmodified lines
38063767 u16 smid, ioc_status;
38073768 size_t data_length;
38083769
3809− dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
3810− __func__));
3770+ dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
38113771
38123772 if (ioc->base_cmds.status & MPT3_CMD_PENDING) {
3813− pr_err(MPT3SAS_FMT "%s: internal command already in use\n",
3814− ioc->name, __func__);
3773+ ioc_err(ioc, "%s: internal command already in use\n", __func__);
38153774 return -EAGAIN;
38163775 }
38173776
38183777 data_length = sizeof(Mpi2FWImageHeader_t);
3819− fwpkg_data = pci_alloc_consistent(ioc->pdev, data_length,
3820− &fwpkg_data_dma);
3778+ fwpkg_data = dma_alloc_coherent(&ioc->pdev->dev, data_length,
3779+ &fwpkg_data_dma, GFP_KERNEL);
38213780 if (!fwpkg_data) {
3822− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
3823− ioc->name, __FILE__, __LINE__, __func__);
3781+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
3782+ __FILE__, __LINE__, __func__);
38243783 return -ENOMEM;
38253784 }
38263785
38273786 smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);
38283787 if (!smid) {
3829− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
3830− ioc->name, __func__);
3788+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
38313789 r = -EAGAIN;
38323790 goto out;
38333791 }
@@ -3846,11 +3804,9 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) · 12 unmodified lines
38463804 /* Wait for 15 seconds */
38473805 wait_for_completion_timeout(&ioc->base_cmds.done,
38483806 FW_IMG_HDR_READ_TIMEOUT*HZ);
3849− pr_info(MPT3SAS_FMT "%s: complete\n",
3850− ioc->name, __func__);
3807+ ioc_info(ioc, "%s: complete\n", __func__);
38513808 if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) {
3852− pr_err(MPT3SAS_FMT "%s: timeout\n",
3853− ioc->name, __func__);
3809+ ioc_err(ioc, "%s: timeout\n", __func__);
38543810 _debug_dump_mf(mpi_request,
38553811 sizeof(Mpi25FWUploadRequest_t)/4);
38563812 r = -ETIME;
@@ -3864,13 +3820,11 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines
38643820 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
38653821 FWImgHdr = (Mpi2FWImageHeader_t *)fwpkg_data;
38663822 if (FWImgHdr->PackageVersion.Word) {
3867− pr_info(MPT3SAS_FMT "FW Package Version"
3868− "(%02d.%02d.%02d.%02d)\n",
3869− ioc->name,
3870− FWImgHdr->PackageVersion.Struct.Major,
3871− FWImgHdr->PackageVersion.Struct.Minor,
3872− FWImgHdr->PackageVersion.Struct.Unit,
3873− FWImgHdr->PackageVersion.Struct.Dev);
3823+ ioc_info(ioc, "FW Package Version (%02d.%02d.%02d.%02d)\n",
3824+ FWImgHdr->PackageVersion.Struct.Major,
3825+ FWImgHdr->PackageVersion.Struct.Minor,
3826+ FWImgHdr->PackageVersion.Struct.Unit,
3827+ FWImgHdr->PackageVersion.Struct.Dev);
38743828 }
38753829 } else {
38763830 _debug_dump_mf(&mpi_reply,
@@ -3881,7 +3835,7 @@ _base_display_fwpkg_version(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines
38813835 ioc->base_cmds.status = MPT3_CMD_NOT_USED;
38823836 out:
38833837 if (fwpkg_data)
3884− pci_free_consistent(ioc->pdev, data_length, fwpkg_data,
3838+ dma_free_coherent(&ioc->pdev->dev, data_length, fwpkg_data,
38853839 fwpkg_data_dma);
38863840 return r;
38873841 }
@@ -3900,18 +3854,17 @@ _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc) · 12 unmodified lines
39003854
39013855 bios_version = le32_to_cpu(ioc->bios_pg3.BiosVersion);
39023856 strncpy(desc, ioc->manu_pg0.ChipName, 16);
3903− pr_info(MPT3SAS_FMT "%s: FWVersion(%02d.%02d.%02d.%02d), "\
3904− "ChipRevision(0x%02x), BiosVersion(%02d.%02d.%02d.%02d)\n",
3905− ioc->name, desc,
3906− (ioc->facts.FWVersion.Word & 0xFF000000) >> 24,
3907− (ioc->facts.FWVersion.Word & 0x00FF0000) >> 16,
3908− (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8,
3909− ioc->facts.FWVersion.Word & 0x000000FF,
3910− ioc->pdev->revision,
3911− (bios_version & 0xFF000000) >> 24,
3912− (bios_version & 0x00FF0000) >> 16,
3913− (bios_version & 0x0000FF00) >> 8,
3914− bios_version & 0x000000FF);
3857+ ioc_info(ioc, "%s: FWVersion(%02d.%02d.%02d.%02d), ChipRevision(0x%02x), BiosVersion(%02d.%02d.%02d.%02d)\n",
3858+ desc,
3859+ (ioc->facts.FWVersion.Word & 0xFF000000) >> 24,
3860+ (ioc->facts.FWVersion.Word & 0x00FF0000) >> 16,
3861+ (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8,
3862+ ioc->facts.FWVersion.Word & 0x000000FF,
3863+ ioc->pdev->revision,
3864+ (bios_version & 0xFF000000) >> 24,
3865+ (bios_version & 0x00FF0000) >> 16,
3866+ (bios_version & 0x0000FF00) >> 8,
3867+ bios_version & 0x000000FF);
39153868
39163869 _base_display_OEMs_branding(ioc);
39173870
@@ -3920,82 +3873,81 @@ _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
39203873 i++;
39213874 }
39223875
3923− pr_info(MPT3SAS_FMT "Protocol=(", ioc->name);
3876+ ioc_info(ioc, "Protocol=(");
39243877
39253878 if (ioc->facts.ProtocolFlags & MPI2_IOCFACTS_PROTOCOL_SCSI_INITIATOR) {
3926− pr_info("Initiator");
3879+ pr_cont("Initiator");
39273880 i++;
39283881 }
39293882
39303883 if (ioc->facts.ProtocolFlags & MPI2_IOCFACTS_PROTOCOL_SCSI_TARGET) {
3931− pr_info("%sTarget", i ? "," : "");
3884+ pr_cont("%sTarget", i ? "," : "");
39323885 i++;
39333886 }
39343887
39353888 i = 0;
3936− pr_info("), ");
3937− pr_info("Capabilities=(");
3889+ pr_cont("), Capabilities=(");
39383890
39393891 if (!ioc->hide_ir_msg) {
39403892 if (ioc->facts.IOCCapabilities &
39413893 MPI2_IOCFACTS_CAPABILITY_INTEGRATED_RAID) {
3942− pr_info("Raid");
3894+ pr_cont("Raid");
39433895 i++;
39443896 }
39453897 }
39463898
39473899 if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_TLR) {
3948− pr_info("%sTLR", i ? "," : "");
3900+ pr_cont("%sTLR", i ? "," : "");
39493901 i++;
39503902 }
39513903
39523904 if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_MULTICAST) {
3953− pr_info("%sMulticast", i ? "," : "");
3905+ pr_cont("%sMulticast", i ? "," : "");
39543906 i++;
39553907 }
39563908
39573909 if (ioc->facts.IOCCapabilities &
39583910 MPI2_IOCFACTS_CAPABILITY_BIDIRECTIONAL_TARGET) {
3959− pr_info("%sBIDI Target", i ? "," : "");
3911+ pr_cont("%sBIDI Target", i ? "," : "");
39603912 i++;
39613913 }
39623914
39633915 if (ioc->facts.IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_EEDP) {
3964− pr_info("%sEEDP", i ? "," : "");
3916+ pr_cont("%sEEDP", i ? "," : "");
39653917 i++;
39663918 }
39673919
39683920 if (ioc->facts.IOCCapabilities &
39693921 MPI2_IOCFACTS_CAPABILITY_SNAPSHOT_BUFFER) {
3970− pr_info("%sSnapshot Buffer", i ? "," : "");
3922+ pr_cont("%sSnapshot Buffer", i ? "," : "");
39713923 i++;
39723924 }
39733925
39743926 if (ioc->facts.IOCCapabilities &
39753927 MPI2_IOCFACTS_CAPABILITY_DIAG_TRACE_BUFFER) {
3976− pr_info("%sDiag Trace Buffer", i ? "," : "");
3928+ pr_cont("%sDiag Trace Buffer", i ? "," : "");
39773929 i++;
39783930 }
39793931
39803932 if (ioc->facts.IOCCapabilities &
39813933 MPI2_IOCFACTS_CAPABILITY_EXTENDED_BUFFER) {
3982− pr_info("%sDiag Extended Buffer", i ? "," : "");
3934+ pr_cont("%sDiag Extended Buffer", i ? "," : "");
39833935 i++;
39843936 }
39853937
39863938 if (ioc->facts.IOCCapabilities &
39873939 MPI2_IOCFACTS_CAPABILITY_TASK_SET_FULL_HANDLING) {
3988− pr_info("%sTask Set Full", i ? "," : "");
3940+ pr_cont("%sTask Set Full", i ? "," : "");
39893941 i++;
39903942 }
39913943
39923944 iounit_pg1_flags = le32_to_cpu(ioc->iounit_pg1.Flags);
39933945 if (!(iounit_pg1_flags & MPI2_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE)) {
3994− pr_info("%sNCQ", i ? "," : "");
3946+ pr_cont("%sNCQ", i ? "," : "");
39953947 i++;
39963948 }
39973949
3998− pr_info(")\n");
3950+ pr_cont(")\n");
39993951 }
40003952
40013953 /**
@@ -4028,21 +3980,21 @@ mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc, · 26 unmodified lines
40283980 sizeof(Mpi2SasIOUnit1PhyData_t));
40293981 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
40303982 if (!sas_iounit_pg1) {
4031− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
4032− ioc->name, __FILE__, __LINE__, __func__);
3983+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
3984+ __FILE__, __LINE__, __func__);
40333985 goto out;
40343986 }
40353987 if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
40363988 sas_iounit_pg1, sz))) {
4037− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
4038− ioc->name, __FILE__, __LINE__, __func__);
3989+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
3990+ __FILE__, __LINE__, __func__);
40393991 goto out;
40403992 }
40413993 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
40423994 MPI2_IOCSTATUS_MASK;
40433995 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
4044− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
4045− ioc->name, __FILE__, __LINE__, __func__);
3996+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
3997+ __FILE__, __LINE__, __func__);
40463998 goto out;
40473999 }
40484000
@@ -4074,11 +4026,11 @@ mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc, · 25 unmodified lines
40744026 else
40754027 dmd_new =
40764028 dmd & MPI2_SASIOUNIT1_REPORT_MISSING_TIMEOUT_MASK;
4077− pr_info(MPT3SAS_FMT "device_missing_delay: old(%d), new(%d)\n",
4078− ioc->name, dmd_orignal, dmd_new);
4079− pr_info(MPT3SAS_FMT "ioc_missing_delay: old(%d), new(%d)\n",
4080− ioc->name, io_missing_delay_original,
4081− io_missing_delay);
4029+ ioc_info(ioc, "device_missing_delay: old(%d), new(%d)\n",
4030+ dmd_orignal, dmd_new);
4031+ ioc_info(ioc, "ioc_missing_delay: old(%d), new(%d)\n",
4032+ io_missing_delay_original,
4033+ io_missing_delay);
40824034 ioc->device_missing_delay = dmd_new;
40834035 ioc->io_missing_delay = io_missing_delay;
40844036 }
@@ -4189,33 +4141,32 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 104 unmodified lines
41894141 struct chain_tracker *ct;
41904142 struct reply_post_struct *rps;
41914143
4192− dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
4193− __func__));
4144+ dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
41944145
41954146 if (ioc->request) {
4196− pci_free_consistent(ioc->pdev, ioc->request_dma_sz,
4147+ dma_free_coherent(&ioc->pdev->dev, ioc->request_dma_sz,
41974148 ioc->request, ioc->request_dma);
4198− dexitprintk(ioc, pr_info(MPT3SAS_FMT
4199− "request_pool(0x%p): free\n",
4200− ioc->name, ioc->request));
4149+ dexitprintk(ioc,
4150+ ioc_info(ioc, "request_pool(0x%p): free\n",
4151+ ioc->request));
42014152 ioc->request = NULL;
42024153 }
42034154
42044155 if (ioc->sense) {
42054156 dma_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma);
42064157 dma_pool_destroy(ioc->sense_dma_pool);
4207− dexitprintk(ioc, pr_info(MPT3SAS_FMT
4208− "sense_pool(0x%p): free\n",
4209− ioc->name, ioc->sense));
4158+ dexitprintk(ioc,
4159+ ioc_info(ioc, "sense_pool(0x%p): free\n",
4160+ ioc->sense));
42104161 ioc->sense = NULL;
42114162 }
42124163
42134164 if (ioc->reply) {
42144165 dma_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma);
42154166 dma_pool_destroy(ioc->reply_dma_pool);
4216− dexitprintk(ioc, pr_info(MPT3SAS_FMT
4217− "reply_pool(0x%p): free\n",
4218− ioc->name, ioc->reply));
4167+ dexitprintk(ioc,
4168+ ioc_info(ioc, "reply_pool(0x%p): free\n",
4169+ ioc->reply));
42194170 ioc->reply = NULL;
42204171 }
42214172
@@ -4223,9 +4174,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
42234174 dma_pool_free(ioc->reply_free_dma_pool, ioc->reply_free,
42244175 ioc->reply_free_dma);
42254176 dma_pool_destroy(ioc->reply_free_dma_pool);
4226− dexitprintk(ioc, pr_info(MPT3SAS_FMT
4227− "reply_free_pool(0x%p): free\n",
4228− ioc->name, ioc->reply_free));
4177+ dexitprintk(ioc,
4178+ ioc_info(ioc, "reply_free_pool(0x%p): free\n",
4179+ ioc->reply_free));
42294180 ioc->reply_free = NULL;
42304181 }
42314182
@@ -4237,9 +4188,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
42374188 ioc->reply_post_free_dma_pool,
42384189 rps->reply_post_free,
42394190 rps->reply_post_free_dma);
4240− dexitprintk(ioc, pr_info(MPT3SAS_FMT
4241− "reply_post_free_pool(0x%p): free\n",
4242− ioc->name, rps->reply_post_free));
4191+ dexitprintk(ioc,
4192+ ioc_info(ioc, "reply_post_free_pool(0x%p): free\n",
4193+ rps->reply_post_free));
42434194 rps->reply_post_free = NULL;
42444195 }
42454196 } while (ioc->rdpq_array_enable &&
@@ -4267,10 +4218,10 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 21 unmodified lines
42674218 }
42684219
42694220 if (ioc->config_page) {
4270− dexitprintk(ioc, pr_info(MPT3SAS_FMT
4271− "config_page(0x%p): free\n", ioc->name,
4272− ioc->config_page));
4273− pci_free_consistent(ioc->pdev, ioc->config_page_sz,
4221+ dexitprintk(ioc,
4222+ ioc_info(ioc, "config_page(0x%p): free\n",
4223+ ioc->config_page));
4224+ dma_free_coherent(&ioc->pdev->dev, ioc->config_page_sz,
42744225 ioc->config_page, ioc->config_page_dma);
42754226 }
42764227
@@ -4338,8 +4289,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 61 unmodified lines
43384289 int i, j;
43394290 struct chain_tracker *ct;
43404291
4341− dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
4342− __func__));
4292+ dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
43434293
43444294
43454295 retry_sz = 0;
@@ -4368,10 +4318,8 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 22 unmodified lines
43684318 else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) {
43694319 sg_tablesize = min_t(unsigned short, sg_tablesize,
43704320 SG_MAX_SEGMENTS);
4371− pr_warn(MPT3SAS_FMT
4372− "sg_tablesize(%u) is bigger than kernel "
4373− "defined SG_CHUNK_SIZE(%u)\n", ioc->name,
4374− sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
4321+ ioc_warn(ioc, "sg_tablesize(%u) is bigger than kernel defined SG_CHUNK_SIZE(%u)\n",
4322+ sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
43754323 }
43764324 ioc->shost->sg_tablesize = sg_tablesize;
43774325 }
@@ -4381,9 +4329,8 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
43814329 if (ioc->internal_depth < INTERNAL_CMDS_COUNT) {
43824330 if (facts->RequestCredit <= (INTERNAL_CMDS_COUNT +
43834331 INTERNAL_SCSIIO_CMDS_COUNT)) {
4384− pr_err(MPT3SAS_FMT "IOC doesn't have enough Request \
4385− Credits, it has just %d number of credits\n",
4386− ioc->name, facts->RequestCredit);
4332+ ioc_err(ioc, "IOC doesn't have enough Request Credits, it has just %d number of credits\n",
4333+ facts->RequestCredit);
43874334 return -ENOMEM;
43884335 }
43894336 ioc->internal_depth = 10;
@@ -4482,11 +4429,12 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 92 unmodified lines
44824429 ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64;
44834430 }
44844431
4485− dinitprintk(ioc, pr_info(MPT3SAS_FMT "scatter gather: " \
4486− "sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), "
4487− "chains_per_io(%d)\n", ioc->name, ioc->max_sges_in_main_message,
4488− ioc->max_sges_in_chain_message, ioc->shost->sg_tablesize,
4489− ioc->chains_needed_per_io));
4432+ dinitprintk(ioc,
4433+ ioc_info(ioc, "scatter gather: sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), chains_per_io(%d)\n",
4434+ ioc->max_sges_in_main_message,
4435+ ioc->max_sges_in_chain_message,
4436+ ioc->shost->sg_tablesize,
4437+ ioc->chains_needed_per_io));
44904438
44914439 /* reply post queue, 16 byte align */
44924440 reply_post_free_sz = ioc->reply_post_queue_depth *
@@ -4501,48 +4449,40 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 8 unmodified lines
45014449 sizeof(struct reply_post_struct), GFP_KERNEL);
45024450
45034451 if (!ioc->reply_post) {
4504− pr_err(MPT3SAS_FMT "reply_post_free pool: kcalloc failed\n",
4505− ioc->name);
4452+ ioc_err(ioc, "reply_post_free pool: kcalloc failed\n");
45064453 goto out;
45074454 }
45084455 ioc->reply_post_free_dma_pool = dma_pool_create("reply_post_free pool",
45094456 &ioc->pdev->dev, sz, 16, 0);
45104457 if (!ioc->reply_post_free_dma_pool) {
4511− pr_err(MPT3SAS_FMT
4512− "reply_post_free pool: dma_pool_create failed\n",
4513− ioc->name);
4458+ ioc_err(ioc, "reply_post_free pool: dma_pool_create failed\n");
45144459 goto out;
45154460 }
45164461 i = 0;
45174462 do {
45184463 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,
45204465 GFP_KERNEL,
45214466 &ioc->reply_post[i].reply_post_free_dma);
45224467 if (!ioc->reply_post[i].reply_post_free) {
4523− pr_err(MPT3SAS_FMT
4524− "reply_post_free pool: dma_pool_alloc failed\n",
4525− ioc->name);
4468+ ioc_err(ioc, "reply_post_free pool: dma_pool_alloc failed\n");
45264469 goto out;
45274470 }
4528− memset(ioc->reply_post[i].reply_post_free, 0, sz);
4529− dinitprintk(ioc, pr_info(MPT3SAS_FMT
4530− "reply post free pool (0x%p): depth(%d),"
4531− "element_size(%d), pool_size(%d kB)\n", ioc->name,
4532− ioc->reply_post[i].reply_post_free,
4533− ioc->reply_post_queue_depth, 8, sz/1024));
4534− dinitprintk(ioc, pr_info(MPT3SAS_FMT
4535− "reply_post_free_dma = (0x%llx)\n", ioc->name,
4536− (unsigned long long)
4537− ioc->reply_post[i].reply_post_free_dma));
4471+ dinitprintk(ioc,
4472+ ioc_info(ioc, "reply post free pool (0x%p): depth(%d), element_size(%d), pool_size(%d kB)\n",
4473+ ioc->reply_post[i].reply_post_free,
4474+ ioc->reply_post_queue_depth,
4475+ 8, sz / 1024));
4476+ dinitprintk(ioc,
4477+ ioc_info(ioc, "reply_post_free_dma = (0x%llx)\n",
4478+ (u64)ioc->reply_post[i].reply_post_free_dma));
45384479 total_sz += sz;
45394480 } while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count));
45404481
45414482 if (ioc->dma_mask == 64) {
45424483 if (_base_change_consistent_dma_mask(ioc, ioc->pdev) != 0) {
4543− pr_warn(MPT3SAS_FMT
4544− "no suitable consistent DMA mask for %s\n",
4545− ioc->name, pci_name(ioc->pdev));
4484+ ioc_warn(ioc, "no suitable consistent DMA mask for %s\n",
4485+ pci_name(ioc->pdev));
45464486 goto out;
45474487 }
45484488 }
@@ -4554,9 +4494,9 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
45544494 * with some internal commands that could be outstanding
45554495 */
45564496 ioc->shost->can_queue = ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT;
4557− dinitprintk(ioc, pr_info(MPT3SAS_FMT
4558− "scsi host: can_queue depth (%d)\n",
4559− ioc->name, ioc->shost->can_queue));
4497+ dinitprintk(ioc,
4498+ ioc_info(ioc, "scsi host: can_queue depth (%d)\n",
4499+ ioc->shost->can_queue));
45604500
45614501
45624502 /* 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
45724512 sz += (ioc->internal_depth * ioc->request_sz);
45734513
45744514 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);
45764517 if (!ioc->request) {
4577− pr_err(MPT3SAS_FMT "request pool: pci_alloc_consistent " \
4578− "failed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), "
4579− "total(%d kB)\n", ioc->name, ioc->hba_queue_depth,
4580− ioc->chains_needed_per_io, ioc->request_sz, sz/1024);
4518+ ioc_err(ioc, "request pool: dma_alloc_coherent failed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), total(%d kB)\n",
4519+ ioc->hba_queue_depth, ioc->chains_needed_per_io,
4520+ ioc->request_sz, sz / 1024);
45814521 if (ioc->scsiio_depth < MPT3SAS_SAS_QUEUE_DEPTH)
45824522 goto out;
45834523 retry_sz = 64;
@@ -4587,10 +4527,9 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
45874527 }
45884528
45894529 if (retry_sz)
4590− pr_err(MPT3SAS_FMT "request pool: pci_alloc_consistent " \
4591− "succeed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), "
4592− "total(%d kb)\n", ioc->name, ioc->hba_queue_depth,
4593− ioc->chains_needed_per_io, ioc->request_sz, sz/1024);
4530+ ioc_err(ioc, "request pool: dma_alloc_coherent succeed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), total(%d kb)\n",
4531+ ioc->hba_queue_depth, ioc->chains_needed_per_io,
4532+ ioc->request_sz, sz / 1024);
45944533
45954534 /* hi-priority queue */
45964535 ioc->hi_priority = ioc->request + ((ioc->scsiio_depth + 1) *
@@ -4604,24 +4543,26 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines
46044543 ioc->internal_dma = ioc->hi_priority_dma + (ioc->hi_priority_depth *
46054544 ioc->request_sz);
46064545
4607− dinitprintk(ioc, pr_info(MPT3SAS_FMT
4608− "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,
4610− (ioc->hba_queue_depth * ioc->request_sz)/1024));
4546+ dinitprintk(ioc,
4547+ ioc_info(ioc, "request pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n",
4548+ ioc->request, ioc->hba_queue_depth,
4549+ ioc->request_sz,
4550+ (ioc->hba_queue_depth * ioc->request_sz) / 1024));
46114551
4612− dinitprintk(ioc, pr_info(MPT3SAS_FMT "request pool: dma(0x%llx)\n",
4613− ioc->name, (unsigned long long) ioc->request_dma));
4552+ dinitprintk(ioc,
4553+ ioc_info(ioc, "request pool: dma(0x%llx)\n",
4554+ (unsigned long long)ioc->request_dma));
46144555 total_sz += sz;
46154556
4616− dinitprintk(ioc, pr_info(MPT3SAS_FMT "scsiio(0x%p): depth(%d)\n",
4617− ioc->name, ioc->request, ioc->scsiio_depth));
4557+ dinitprintk(ioc,
4558+ ioc_info(ioc, "scsiio(0x%p): depth(%d)\n",
4559+ ioc->request, ioc->scsiio_depth));
46184560
46194561 ioc->chain_depth = min_t(u32, ioc->chain_depth, MAX_CHAIN_DEPTH);
46204562 sz = ioc->scsiio_depth * sizeof(struct chain_lookup);
46214563 ioc->chain_lookup = kzalloc(sz, GFP_KERNEL);
46224564 if (!ioc->chain_lookup) {
4623− pr_err(MPT3SAS_FMT "chain_lookup: __get_free_pages "
4624− "failed\n", ioc->name);
4565+ ioc_err(ioc, "chain_lookup: __get_free_pages failed\n");
46254566 goto out;
46264567 }
46274568
@@ -4629,8 +4570,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
46294570 for (i = 0; i < ioc->scsiio_depth; i++) {
46304571 ioc->chain_lookup[i].chains_per_smid = kzalloc(sz, GFP_KERNEL);
46314572 if (!ioc->chain_lookup[i].chains_per_smid) {
4632− pr_err(MPT3SAS_FMT "chain_lookup: "
4633− " kzalloc failed\n", ioc->name);
4573+ ioc_err(ioc, "chain_lookup: kzalloc failed\n");
46344574 goto out;
46354575 }
46364576 }
@@ -4639,29 +4579,27 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
46394579 ioc->hpr_lookup = kcalloc(ioc->hi_priority_depth,
46404580 sizeof(struct request_tracker), GFP_KERNEL);
46414581 if (!ioc->hpr_lookup) {
4642− pr_err(MPT3SAS_FMT "hpr_lookup: kcalloc failed\n",
4643− ioc->name);
4582+ ioc_err(ioc, "hpr_lookup: kcalloc failed\n");
46444583 goto out;
46454584 }
46464585 ioc->hi_priority_smid = ioc->scsiio_depth + 1;
4647− dinitprintk(ioc, pr_info(MPT3SAS_FMT
4648− "hi_priority(0x%p): depth(%d), start smid(%d)\n",
4649− ioc->name, ioc->hi_priority,
4650− ioc->hi_priority_depth, ioc->hi_priority_smid));
4586+ dinitprintk(ioc,
4587+ ioc_info(ioc, "hi_priority(0x%p): depth(%d), start smid(%d)\n",
4588+ ioc->hi_priority,
4589+ ioc->hi_priority_depth, ioc->hi_priority_smid));
46514590
46524591 /* initialize internal queue smid's */
46534592 ioc->internal_lookup = kcalloc(ioc->internal_depth,
46544593 sizeof(struct request_tracker), GFP_KERNEL);
46554594 if (!ioc->internal_lookup) {
4656− pr_err(MPT3SAS_FMT "internal_lookup: kcalloc failed\n",
4657− ioc->name);
4595+ ioc_err(ioc, "internal_lookup: kcalloc failed\n");
46584596 goto out;
46594597 }
46604598 ioc->internal_smid = ioc->hi_priority_smid + ioc->hi_priority_depth;
4661− dinitprintk(ioc, pr_info(MPT3SAS_FMT
4662− "internal(0x%p): depth(%d), start smid(%d)\n",
4663− ioc->name, ioc->internal,
4664− ioc->internal_depth, ioc->internal_smid));
4599+ dinitprintk(ioc,
4600+ ioc_info(ioc, "internal(0x%p): depth(%d), start smid(%d)\n",
4601+ ioc->internal,
4602+ ioc->internal_depth, ioc->internal_smid));
46654603 /*
46664604 * The number of NVMe page sized blocks needed is:
46674605 * (((sg_tablesize * 8) - 1) / (page_size - 8)) + 1
@@ -4685,17 +4623,14 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 17 unmodified lines
46854623 sz = sizeof(struct pcie_sg_list) * ioc->scsiio_depth;
46864624 ioc->pcie_sg_lookup = kzalloc(sz, GFP_KERNEL);
46874625 if (!ioc->pcie_sg_lookup) {
4688− pr_info(MPT3SAS_FMT
4689− "PCIe SGL lookup: kzalloc failed\n", ioc->name);
4626+ ioc_info(ioc, "PCIe SGL lookup: kzalloc failed\n");
46904627 goto out;
46914628 }
46924629 sz = nvme_blocks_needed * ioc->page_size;
46934630 ioc->pcie_sgl_dma_pool =
46944631 dma_pool_create("PCIe SGL pool", &ioc->pdev->dev, sz, 16, 0);
46954632 if (!ioc->pcie_sgl_dma_pool) {
4696− pr_info(MPT3SAS_FMT
4697− "PCIe SGL pool: dma_pool_create failed\n",
4698− ioc->name);
4633+ ioc_info(ioc, "PCIe SGL pool: dma_pool_create failed\n");
46994634 goto out;
47004635 }
47014636
@@ -4708,9 +4643,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 6 unmodified lines
47084643 ioc->pcie_sgl_dma_pool, GFP_KERNEL,
47094644 &ioc->pcie_sg_lookup[i].pcie_sgl_dma);
47104645 if (!ioc->pcie_sg_lookup[i].pcie_sgl) {
4711− pr_info(MPT3SAS_FMT
4712− "PCIe SGL pool: dma_pool_alloc failed\n",
4713− ioc->name);
4646+ ioc_info(ioc, "PCIe SGL pool: dma_pool_alloc failed\n");
47144647 goto out;
47154648 }
47164649 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
47244657 }
47254658 }
47264659
4727− dinitprintk(ioc, pr_info(MPT3SAS_FMT "PCIe sgl pool depth(%d), "
4728− "element_size(%d), pool_size(%d kB)\n", ioc->name,
4729− ioc->scsiio_depth, sz, (sz * ioc->scsiio_depth)/1024));
4730− dinitprintk(ioc, pr_info(MPT3SAS_FMT "Number of chains can "
4731− "fit in a PRP page(%d)\n", ioc->name,
4732− ioc->chains_per_prp_buffer));
4660+ dinitprintk(ioc,
4661+ ioc_info(ioc, "PCIe sgl pool depth(%d), element_size(%d), pool_size(%d kB)\n",
4662+ ioc->scsiio_depth, sz,
4663+ (sz * ioc->scsiio_depth) / 1024));
4664+ dinitprintk(ioc,
4665+ ioc_info(ioc, "Number of chains can fit in a PRP page(%d)\n",
4666+ ioc->chains_per_prp_buffer));
47334667 total_sz += sz * ioc->scsiio_depth;
47344668 }
47354669
47364670 ioc->chain_dma_pool = dma_pool_create("chain pool", &ioc->pdev->dev,
47374671 ioc->chain_segment_sz, 16, 0);
47384672 if (!ioc->chain_dma_pool) {
4739− pr_err(MPT3SAS_FMT "chain_dma_pool: dma_pool_create failed\n",
4740− ioc->name);
4673+ ioc_err(ioc, "chain_dma_pool: dma_pool_create failed\n");
47414674 goto out;
47424675 }
47434676 for (i = 0; i < ioc->scsiio_depth; i++) {
@@ -4748,8 +4681,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines
47484681 ioc->chain_dma_pool, GFP_KERNEL,
47494682 &ct->chain_buffer_dma);
47504683 if (!ct->chain_buffer) {
4751− pr_err(MPT3SAS_FMT "chain_lookup: "
4752− " pci_pool_alloc failed\n", ioc->name);
4684+ ioc_err(ioc, "chain_lookup: pci_pool_alloc failed\n");
47534685 _base_release_memory_pools(ioc);
47544686 goto out;
47554687 }
@@ -4757,25 +4689,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
47574689 total_sz += ioc->chain_segment_sz;
47584690 }
47594691
4760− dinitprintk(ioc, pr_info(MPT3SAS_FMT
4761− "chain pool depth(%d), frame_size(%d), pool_size(%d kB)\n",
4762− ioc->name, ioc->chain_depth, ioc->chain_segment_sz,
4763− ((ioc->chain_depth * ioc->chain_segment_sz))/1024));
4692+ dinitprintk(ioc,
4693+ ioc_info(ioc, "chain pool depth(%d), frame_size(%d), pool_size(%d kB)\n",
4694+ ioc->chain_depth, ioc->chain_segment_sz,
4695+ (ioc->chain_depth * ioc->chain_segment_sz) / 1024));
47644696
47654697 /* sense buffers, 4 byte align */
47664698 sz = ioc->scsiio_depth * SCSI_SENSE_BUFFERSIZE;
47674699 ioc->sense_dma_pool = dma_pool_create("sense pool", &ioc->pdev->dev, sz,
47684700 4, 0);
47694701 if (!ioc->sense_dma_pool) {
4770− pr_err(MPT3SAS_FMT "sense pool: dma_pool_create failed\n",
4771− ioc->name);
4702+ ioc_err(ioc, "sense pool: dma_pool_create failed\n");
47724703 goto out;
47734704 }
47744705 ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL,
47754706 &ioc->sense_dma);
47764707 if (!ioc->sense) {
4777− pr_err(MPT3SAS_FMT "sense pool: dma_pool_alloc failed\n",
4778− ioc->name);
4708+ ioc_err(ioc, "sense pool: dma_pool_alloc failed\n");
47794709 goto out;
47804710 }
47814711 /* 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
47974727 dma_pool_create("sense pool", &ioc->pdev->dev, sz,
47984728 roundup_pow_of_two(sz), 0);
47994729 if (!ioc->sense_dma_pool) {
4800− pr_err(MPT3SAS_FMT "sense pool: pci_pool_create failed\n",
4801− ioc->name);
4730+ ioc_err(ioc, "sense pool: pci_pool_create failed\n");
48024731 goto out;
48034732 }
48044733 ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL,
48054734 &ioc->sense_dma);
48064735 if (!ioc->sense) {
4807− pr_err(MPT3SAS_FMT "sense pool: pci_pool_alloc failed\n",
4808− ioc->name);
4736+ ioc_err(ioc, "sense pool: pci_pool_alloc failed\n");
48094737 goto out;
48104738 }
48114739 }
4812− dinitprintk(ioc, pr_info(MPT3SAS_FMT
4813− "sense pool(0x%p): depth(%d), element_size(%d), pool_size"
4814− "(%d kB)\n", ioc->name, ioc->sense, ioc->scsiio_depth,
4815− SCSI_SENSE_BUFFERSIZE, sz/1024));
4816− dinitprintk(ioc, pr_info(MPT3SAS_FMT "sense_dma(0x%llx)\n",
4817− ioc->name, (unsigned long long)ioc->sense_dma));
4740+ dinitprintk(ioc,
4741+ ioc_info(ioc, "sense pool(0x%p): depth(%d), element_size(%d), pool_size(%d kB)\n",
4742+ ioc->sense, ioc->scsiio_depth,
4743+ SCSI_SENSE_BUFFERSIZE, sz / 1024));
4744+ dinitprintk(ioc,
4745+ ioc_info(ioc, "sense_dma(0x%llx)\n",
4746+ (unsigned long long)ioc->sense_dma));
48184747 total_sz += sz;
48194748
48204749 /* reply pool, 4 byte align */
@@ -4822,25 +4751,24 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
48224751 ioc->reply_dma_pool = dma_pool_create("reply pool", &ioc->pdev->dev, sz,
48234752 4, 0);
48244753 if (!ioc->reply_dma_pool) {
4825− pr_err(MPT3SAS_FMT "reply pool: dma_pool_create failed\n",
4826− ioc->name);
4754+ ioc_err(ioc, "reply pool: dma_pool_create failed\n");
48274755 goto out;
48284756 }
48294757 ioc->reply = dma_pool_alloc(ioc->reply_dma_pool, GFP_KERNEL,
48304758 &ioc->reply_dma);
48314759 if (!ioc->reply) {
4832− pr_err(MPT3SAS_FMT "reply pool: dma_pool_alloc failed\n",
4833− ioc->name);
4760+ ioc_err(ioc, "reply pool: dma_pool_alloc failed\n");
48344761 goto out;
48354762 }
48364763 ioc->reply_dma_min_address = (u32)(ioc->reply_dma);
48374764 ioc->reply_dma_max_address = (u32)(ioc->reply_dma) + sz;
4838− dinitprintk(ioc, pr_info(MPT3SAS_FMT
4839− "reply pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n",
4840− ioc->name, ioc->reply,
4841− ioc->reply_free_queue_depth, ioc->reply_sz, sz/1024));
4842− dinitprintk(ioc, pr_info(MPT3SAS_FMT "reply_dma(0x%llx)\n",
4843− ioc->name, (unsigned long long)ioc->reply_dma));
4765+ dinitprintk(ioc,
4766+ ioc_info(ioc, "reply pool(0x%p): depth(%d), frame_size(%d), pool_size(%d kB)\n",
4767+ ioc->reply, ioc->reply_free_queue_depth,
4768+ ioc->reply_sz, sz / 1024));
4769+ dinitprintk(ioc,
4770+ ioc_info(ioc, "reply_dma(0x%llx)\n",
4771+ (unsigned long long)ioc->reply_dma));
48444772 total_sz += sz;
48454773
48464774 /* reply free queue, 16 byte align */
@@ -4848,24 +4776,22 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
48484776 ioc->reply_free_dma_pool = dma_pool_create("reply_free pool",
48494777 &ioc->pdev->dev, sz, 16, 0);
48504778 if (!ioc->reply_free_dma_pool) {
4851− pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_create failed\n",
4852− ioc->name);
4779+ ioc_err(ioc, "reply_free pool: dma_pool_create failed\n");
48534780 goto out;
48544781 }
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,
48564783 &ioc->reply_free_dma);
48574784 if (!ioc->reply_free) {
4858− pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_alloc failed\n",
4859− ioc->name);
4785+ ioc_err(ioc, "reply_free pool: dma_pool_alloc failed\n");
48604786 goto out;
48614787 }
4862− memset(ioc->reply_free, 0, sz);
4863− dinitprintk(ioc, pr_info(MPT3SAS_FMT "reply_free pool(0x%p): " \
4864− "depth(%d), element_size(%d), pool_size(%d kB)\n", ioc->name,
4865− ioc->reply_free, ioc->reply_free_queue_depth, 4, sz/1024));
4866− dinitprintk(ioc, pr_info(MPT3SAS_FMT
4867− "reply_free_dma (0x%llx)\n",
4868− ioc->name, (unsigned long long)ioc->reply_free_dma));
4788+ dinitprintk(ioc,
4789+ ioc_info(ioc, "reply_free pool(0x%p): depth(%d), element_size(%d), pool_size(%d kB)\n",
4790+ ioc->reply_free, ioc->reply_free_queue_depth,
4791+ 4, sz / 1024));
4792+ dinitprintk(ioc,
4793+ ioc_info(ioc, "reply_free_dma (0x%llx)\n",
4794+ (unsigned long long)ioc->reply_free_dma));
48694795 total_sz += sz;
48704796
48714797 if (ioc->rdpq_array_enable) {
@@ -4876,8 +4802,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines
48764802 &ioc->pdev->dev, reply_post_free_array_sz, 16, 0);
48774803 if (!ioc->reply_post_free_array_dma_pool) {
48784804 dinitprintk(ioc,
4879− pr_info(MPT3SAS_FMT "reply_post_free_array pool: "
4880− "dma_pool_create failed\n", ioc->name));
4805+ ioc_info(ioc, "reply_post_free_array pool: dma_pool_create failed\n"));
48814806 goto out;
48824807 }
48834808 ioc->reply_post_free_array =
@@ -4885,34 +4810,31 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
48854810 GFP_KERNEL, &ioc->reply_post_free_array_dma);
48864811 if (!ioc->reply_post_free_array) {
48874812 dinitprintk(ioc,
4888− pr_info(MPT3SAS_FMT "reply_post_free_array pool: "
4889− "dma_pool_alloc failed\n", ioc->name));
4813+ ioc_info(ioc, "reply_post_free_array pool: dma_pool_alloc failed\n"));
48904814 goto out;
48914815 }
48924816 }
48934817 ioc->config_page_sz = 512;
4894− ioc->config_page = pci_alloc_consistent(ioc->pdev,
4895− ioc->config_page_sz, &ioc->config_page_dma);
4818+ ioc->config_page = dma_alloc_coherent(&ioc->pdev->dev,
4819+ ioc->config_page_sz, &ioc->config_page_dma, GFP_KERNEL);
48964820 if (!ioc->config_page) {
4897− pr_err(MPT3SAS_FMT
4898− "config page: dma_pool_alloc failed\n",
4899− ioc->name);
4821+ ioc_err(ioc, "config page: dma_pool_alloc failed\n");
49004822 goto out;
49014823 }
4902− dinitprintk(ioc, pr_info(MPT3SAS_FMT
4903− "config page(0x%p): size(%d)\n",
4904− ioc->name, ioc->config_page, ioc->config_page_sz));
4905− dinitprintk(ioc, pr_info(MPT3SAS_FMT "config_page_dma(0x%llx)\n",
4906− ioc->name, (unsigned long long)ioc->config_page_dma));
4824+ dinitprintk(ioc,
4825+ ioc_info(ioc, "config page(0x%p): size(%d)\n",
4826+ ioc->config_page, ioc->config_page_sz));
4827+ dinitprintk(ioc,
4828+ ioc_info(ioc, "config_page_dma(0x%llx)\n",
4829+ (unsigned long long)ioc->config_page_dma));
49074830 total_sz += ioc->config_page_sz;
49084831
4909− pr_info(MPT3SAS_FMT "Allocated physical memory: size(%d kB)\n",
4910− ioc->name, total_sz/1024);
4911− pr_info(MPT3SAS_FMT
4912− "Current Controller Queue Depth(%d),Max Controller Queue Depth(%d)\n",
4913− ioc->name, ioc->shost->can_queue, facts->RequestCredit);
4914− pr_info(MPT3SAS_FMT "Scatter Gather Elements per IO(%d)\n",
4915− ioc->name, ioc->shost->sg_tablesize);
4832+ ioc_info(ioc, "Allocated physical memory: size(%d kB)\n",
4833+ total_sz / 1024);
4834+ ioc_info(ioc, "Current Controller Queue Depth(%d),Max Controller Queue Depth(%d)\n",
4835+ ioc->shost->can_queue, facts->RequestCredit);
4836+ ioc_info(ioc, "Scatter Gather Elements per IO(%d)\n",
4837+ ioc->shost->sg_tablesize);
49164838 return 0;
49174839
49184840 out:
@@ -4990,9 +4912,9 @@ _base_wait_for_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) · 71 unmodified lines
49904912 do {
49914913 int_status = readl(&ioc->chip->HostInterruptStatus);
49924914 if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) {
4993− dhsprintk(ioc, pr_info(MPT3SAS_FMT
4994− "%s: successful count(%d), timeout(%d)\n",
4995− ioc->name, __func__, count, timeout));
4915+ dhsprintk(ioc,
4916+ ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
4917+ __func__, count, timeout));
49964918 return 0;
49974919 }
49984920
@@ -5000,9 +4922,8 @@ _base_wait_for_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) · 1 unmodified line
50004922 count++;
50014923 } while (--cntdn);
50024924
5003− pr_err(MPT3SAS_FMT
5004− "%s: failed due to timeout count(%d), int_status(%x)!\n",
5005− ioc->name, __func__, count, int_status);
4925+ ioc_err(ioc, "%s: failed due to timeout count(%d), int_status(%x)!\n",
4926+ __func__, count, int_status);
50064927 return -EFAULT;
50074928 }
50084929
@@ -5017,9 +4938,9 @@ _base_spin_on_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) · 8 unmodified lines
50174938 do {
50184939 int_status = readl(&ioc->chip->HostInterruptStatus);
50194940 if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) {
5020− dhsprintk(ioc, pr_info(MPT3SAS_FMT
5021− "%s: successful count(%d), timeout(%d)\n",
5022− ioc->name, __func__, count, timeout));
4941+ dhsprintk(ioc,
4942+ ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
4943+ __func__, count, timeout));
50234944 return 0;
50244945 }
50254946
@@ -5027,9 +4948,8 @@ _base_spin_on_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout) · 1 unmodified line
50274948 count++;
50284949 } while (--cntdn);
50294950
5030− pr_err(MPT3SAS_FMT
5031− "%s: failed due to timeout count(%d), int_status(%x)!\n",
5032− ioc->name, __func__, count, int_status);
4951+ ioc_err(ioc, "%s: failed due to timeout count(%d), int_status(%x)!\n",
4952+ __func__, count, int_status);
50334953 return -EFAULT;
50344954
50354955 }
@@ -5056,9 +4976,9 @@ _base_wait_for_doorbell_ack(struct MPT3SAS_ADAPTER *ioc, int timeout) · 20 unmodified lines
50564976 do {
50574977 int_status = readl(&ioc->chip->HostInterruptStatus);
50584978 if (!(int_status & MPI2_HIS_SYS2IOC_DB_STATUS)) {
5059− dhsprintk(ioc, pr_info(MPT3SAS_FMT
5060− "%s: successful count(%d), timeout(%d)\n",
5061− ioc->name, __func__, count, timeout));
4979+ dhsprintk(ioc,
4980+ ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
4981+ __func__, count, timeout));
50624982 return 0;
50634983 } else if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) {
50644984 doorbell = readl(&ioc->chip->Doorbell);
@@ -5075,9 +4995,8 @@ _base_wait_for_doorbell_ack(struct MPT3SAS_ADAPTER *ioc, int timeout) · 10 unmodified lines
50754995 } while (--cntdn);
50764996
50774997 out:
5078− pr_err(MPT3SAS_FMT
5079− "%s: failed due to timeout count(%d), int_status(%x)!\n",
5080− ioc->name, __func__, count, int_status);
4998+ ioc_err(ioc, "%s: failed due to timeout count(%d), int_status(%x)!\n",
4999+ __func__, count, int_status);
50815000 return -EFAULT;
50825001 }
50835002
@@ -5099,9 +5018,9 @@ _base_wait_for_doorbell_not_used(struct MPT3SAS_ADAPTER *ioc, int timeout) · 15 unmodified lines
50995018 do {
51005019 doorbell_reg = readl(&ioc->chip->Doorbell);
51015020 if (!(doorbell_reg & MPI2_DOORBELL_USED)) {
5102− dhsprintk(ioc, pr_info(MPT3SAS_FMT
5103− "%s: successful count(%d), timeout(%d)\n",
5104− ioc->name, __func__, count, timeout));
5021+ dhsprintk(ioc,
5022+ ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
5023+ __func__, count, timeout));
51055024 return 0;
51065025 }
51075026
@@ -5109,9 +5028,8 @@ _base_wait_for_doorbell_not_used(struct MPT3SAS_ADAPTER *ioc, int timeout) · 1 unmodified line
51095028 count++;
51105029 } while (--cntdn);
51115030
5112− pr_err(MPT3SAS_FMT
5113− "%s: failed due to timeout count(%d), doorbell_reg(%x)!\n",
5114− ioc->name, __func__, count, doorbell_reg);
5031+ ioc_err(ioc, "%s: failed due to timeout count(%d), doorbell_reg(%x)!\n",
5032+ __func__, count, doorbell_reg);
51155033 return -EFAULT;
51165034 }
51175035
@@ -5130,8 +5048,7 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout) · 12 unmodified lines
51305048 int r = 0;
51315049
51325050 if (reset_type != MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET) {
5133− pr_err(MPT3SAS_FMT "%s: unknown reset_type\n",
5134− ioc->name, __func__);
5051+ ioc_err(ioc, "%s: unknown reset_type\n", __func__);
51355052 return -EFAULT;
51365053 }
51375054
@@ -5139,7 +5056,7 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout) · 1 unmodified line
51395056 MPI2_IOCFACTS_CAPABILITY_EVENT_REPLAY))
51405057 return -EFAULT;
51415058
5142− pr_info(MPT3SAS_FMT "sending message unit reset !!\n", ioc->name);
5059+ ioc_info(ioc, "sending message unit reset !!\n");
51435060
51445061 writel(reset_type << MPI2_DOORBELL_FUNCTION_SHIFT,
51455062 &ioc->chip->Doorbell);
@@ -5149,15 +5066,14 @@ _base_send_ioc_reset(struct MPT3SAS_ADAPTER *ioc, u8 reset_type, int timeout) · 3 unmodified lines
51495066 }
51505067 ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, timeout);
51515068 if (ioc_state) {
5152− pr_err(MPT3SAS_FMT
5153− "%s: failed going to ready state (ioc_state=0x%x)\n",
5154− ioc->name, __func__, ioc_state);
5069+ ioc_err(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n",
5070+ __func__, ioc_state);
51555071 r = -EFAULT;
51565072 goto out;
51575073 }
51585074 out:
5159− pr_info(MPT3SAS_FMT "message unit reset: %s\n",
5160− ioc->name, ((r == 0) ? "SUCCESS" : "FAILED"));
5075+ ioc_info(ioc, "message unit reset: %s\n",
5076+ r == 0 ? "SUCCESS" : "FAILED");
51615077 return r;
51625078 }
51635079
@@ -5183,9 +5099,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 19 unmodified lines
51835099
51845100 /* make sure doorbell is not in use */
51855101 if ((readl(&ioc->chip->Doorbell) & MPI2_DOORBELL_USED)) {
5186− pr_err(MPT3SAS_FMT
5187− "doorbell is in use (line=%d)\n",
5188− ioc->name, __LINE__);
5102+ ioc_err(ioc, "doorbell is in use (line=%d)\n", __LINE__);
51895103 return -EFAULT;
51905104 }
51915105
@@ -5200,17 +5114,15 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 8 unmodified lines
52005114 &ioc->chip->Doorbell);
52015115
52025116 if ((_base_spin_on_doorbell_int(ioc, 5))) {
5203− pr_err(MPT3SAS_FMT
5204− "doorbell handshake int failed (line=%d)\n",
5205− ioc->name, __LINE__);
5117+ ioc_err(ioc, "doorbell handshake int failed (line=%d)\n",
5118+ __LINE__);
52065119 return -EFAULT;
52075120 }
52085121 writel(0, &ioc->chip->HostInterruptStatus);
52095122
52105123 if ((_base_wait_for_doorbell_ack(ioc, 5))) {
5211− pr_err(MPT3SAS_FMT
5212− "doorbell handshake ack failed (line=%d)\n",
5213− ioc->name, __LINE__);
5124+ ioc_err(ioc, "doorbell handshake ack failed (line=%d)\n",
5125+ __LINE__);
52145126 return -EFAULT;
52155127 }
52165128
@@ -5222,17 +5134,15 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 5 unmodified lines
52225134 }
52235135
52245136 if (failed) {
5225− pr_err(MPT3SAS_FMT
5226− "doorbell handshake sending request failed (line=%d)\n",
5227− ioc->name, __LINE__);
5137+ ioc_err(ioc, "doorbell handshake sending request failed (line=%d)\n",
5138+ __LINE__);
52285139 return -EFAULT;
52295140 }
52305141
52315142 /* now wait for the reply */
52325143 if ((_base_wait_for_doorbell_int(ioc, timeout))) {
5233− pr_err(MPT3SAS_FMT
5234− "doorbell handshake int failed (line=%d)\n",
5235− ioc->name, __LINE__);
5144+ ioc_err(ioc, "doorbell handshake int failed (line=%d)\n",
5145+ __LINE__);
52365146 return -EFAULT;
52375147 }
52385148
@@ -5241,9 +5151,8 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, · 2 unmodified lines
52415151 & MPI2_DOORBELL_DATA_MASK);
52425152 writel(0, &ioc->chip->HostInterruptStatus);
52435153 if ((_base_wait_for_doorbell_int(ioc, 5))) {
5244− pr_err(MPT3SAS_FMT
5245− "doorbell handshake int failed (line=%d)\n",
5246− ioc->name, __LINE__);
5154+ ioc_err(ioc, "doorbell handshake int failed (line=%d)\n",
5155+ __LINE__);
52475156 return -EFAULT;
52485157 }
52495158 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
52525161
52535162 for (i = 2; i < default_reply->MsgLength * 2; i++) {
52545163 if ((_base_wait_for_doorbell_int(ioc, 5))) {
5255− pr_err(MPT3SAS_FMT
5256− "doorbell handshake int failed (line=%d)\n",
5257− ioc->name, __LINE__);
5164+ ioc_err(ioc, "doorbell handshake int failed (line=%d)\n",
5165+ __LINE__);
52585166 return -EFAULT;
52595167 }
52605168 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
52675175
52685176 _base_wait_for_doorbell_int(ioc, 5);
52695177 if (_base_wait_for_doorbell_not_used(ioc, 5) != 0) {
5270− dhsprintk(ioc, pr_info(MPT3SAS_FMT
5271− "doorbell is in use (line=%d)\n", ioc->name, __LINE__));
5178+ dhsprintk(ioc,
5179+ ioc_info(ioc, "doorbell is in use (line=%d)\n",
5180+ __LINE__));
52725181 }
52735182 writel(0, &ioc->chip->HostInterruptStatus);
52745183
@@ -5308,14 +5217,12 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc, · 33 unmodified lines
53085217 void *request;
53095218 u16 wait_state_count;
53105219
5311− dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
5312− __func__));
5220+ dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
53135221
53145222 mutex_lock(&ioc->base_cmds.mutex);
53155223
53165224 if (ioc->base_cmds.status != MPT3_CMD_NOT_USED) {
5317− pr_err(MPT3SAS_FMT "%s: base_cmd in use\n",
5318− ioc->name, __func__);
5225+ ioc_err(ioc, "%s: base_cmd in use\n", __func__);
53195226 rc = -EAGAIN;
53205227 goto out;
53215228 }
@@ -5324,23 +5231,20 @@ mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines
53245231 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
53255232 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
53265233 if (wait_state_count++ == 10) {
5327− pr_err(MPT3SAS_FMT
5328− "%s: failed due to ioc not operational\n",
5329− ioc->name, __func__);
5234+ ioc_err(ioc, "%s: failed due to ioc not operational\n",
5235+ __func__);
53305236 rc = -EFAULT;
53315237 goto out;
53325238 }
53335239 ssleep(1);
53345240 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
5335− pr_info(MPT3SAS_FMT
5336− "%s: waiting for operational state(count=%d)\n",
5337− ioc->name, __func__, wait_state_count);
5241+ ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
5242+ __func__, wait_state_count);
53385243 }
53395244
53405245 smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);
53415246 if (!smid) {
5342− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
5343− ioc->name, __func__);
5247+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
53445248 rc = -EAGAIN;
53455249 goto out;
53465250 }
@@ -5408,14 +5312,12 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc, · 61 unmodified lines
54085312 void *request;
54095313 u16 wait_state_count;
54105314
5411− dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
5412− __func__));
5315+ dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
54135316
54145317 mutex_lock(&ioc->base_cmds.mutex);
54155318
54165319 if (ioc->base_cmds.status != MPT3_CMD_NOT_USED) {
5417− pr_err(MPT3SAS_FMT "%s: base_cmd in use\n",
5418− ioc->name, __func__);
5320+ ioc_err(ioc, "%s: base_cmd in use\n", __func__);
54195321 rc = -EAGAIN;
54205322 goto out;
54215323 }
@@ -5424,24 +5326,20 @@ mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines
54245326 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
54255327 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
54265328 if (wait_state_count++ == 10) {
5427− pr_err(MPT3SAS_FMT
5428− "%s: failed due to ioc not operational\n",
5429− ioc->name, __func__);
5329+ ioc_err(ioc, "%s: failed due to ioc not operational\n",
5330+ __func__);
54305331 rc = -EFAULT;
54315332 goto out;
54325333 }
54335334 ssleep(1);
54345335 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
5435− pr_info(MPT3SAS_FMT
5436− "%s: waiting for operational state(count=%d)\n",
5437− ioc->name,
5438− __func__, wait_state_count);
5336+ ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
5337+ __func__, wait_state_count);
54395338 }
54405339
54415340 smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);
54425341 if (!smid) {
5443− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
5444− ioc->name, __func__);
5342+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
54455343 rc = -EAGAIN;
54465344 goto out;
54475345 }
@@ -5495,8 +5393,7 @@ _base_get_port_facts(struct MPT3SAS_ADAPTER *ioc, int port) · 47 unmodified lines
54955393 struct mpt3sas_port_facts *pfacts;
54965394 int mpi_reply_sz, mpi_request_sz, r;
54975395
5498− dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
5499− __func__));
5396+ dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
55005397
55015398 mpi_reply_sz = sizeof(Mpi2PortFactsReply_t);
55025399 mpi_request_sz = sizeof(Mpi2PortFactsRequest_t);
@@ -5507,8 +5404,7 @@ _base_get_port_facts(struct MPT3SAS_ADAPTER *ioc, int port) · 4 unmodified lines
55075404 (u32 *)&mpi_request, mpi_reply_sz, (u16 *)&mpi_reply, 5);
55085405
55095406 if (r != 0) {
5510− pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n",
5511− ioc->name, __func__, r);
5407+ ioc_err(ioc, "%s: handshake failed (r=%d)\n", __func__, r);
55125408 return r;
55135409 }
55145410
@@ -5536,26 +5432,26 @@ _base_wait_for_iocstate(struct MPT3SAS_ADAPTER *ioc, int timeout) · 21 unmodified lines
55365432 u32 ioc_state;
55375433 int rc;
55385434
5539− dinitprintk(ioc, printk(MPT3SAS_FMT "%s\n", ioc->name,
5540− __func__));
5435+ dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
55415436
55425437 if (ioc->pci_error_recovery) {
5543− dfailprintk(ioc, printk(MPT3SAS_FMT
5544− "%s: host in pci error recovery\n", ioc->name, __func__));
5438+ dfailprintk(ioc,
5439+ ioc_info(ioc, "%s: host in pci error recovery\n",
5440+ __func__));
55455441 return -EFAULT;
55465442 }
55475443
55485444 ioc_state = mpt3sas_base_get_iocstate(ioc, 0);
5549− dhsprintk(ioc, printk(MPT3SAS_FMT "%s: ioc_state(0x%08x)\n",
5550− ioc->name, __func__, ioc_state));
5445+ dhsprintk(ioc,
5446+ ioc_info(ioc, "%s: ioc_state(0x%08x)\n",
5447+ __func__, ioc_state));
55515448
55525449 if (((ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_READY) ||
55535450 (ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_OPERATIONAL)
55545451 return 0;
55555452
55565453 if (ioc_state & MPI2_DOORBELL_USED) {
5557− dhsprintk(ioc, printk(MPT3SAS_FMT
5558− "unexpected doorbell active!\n", ioc->name));
5454+ dhsprintk(ioc, ioc_info(ioc, "unexpected doorbell active!\n"));
55595455 goto issue_diag_reset;
55605456 }
55615457
@@ -5567,9 +5463,9 @@ _base_wait_for_iocstate(struct MPT3SAS_ADAPTER *ioc, int timeout) · 5 unmodified lines
55675463
55685464 ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, timeout);
55695465 if (ioc_state) {
5570− dfailprintk(ioc, printk(MPT3SAS_FMT
5571− "%s: failed going to ready state (ioc_state=0x%x)\n",
5572− ioc->name, __func__, ioc_state));
5466+ dfailprintk(ioc,
5467+ ioc_info(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n",
5468+ __func__, ioc_state));
55735469 return -EFAULT;
55745470 }
55755471
@@ -5592,14 +5488,13 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines
55925488 struct mpt3sas_facts *facts;
55935489 int mpi_reply_sz, mpi_request_sz, r;
55945490
5595− dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
5596− __func__));
5491+ dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
55975492
55985493 r = _base_wait_for_iocstate(ioc, 10);
55995494 if (r) {
5600− dfailprintk(ioc, printk(MPT3SAS_FMT
5601− "%s: failed getting to correct state\n",
5602− ioc->name, __func__));
5495+ dfailprintk(ioc,
5496+ ioc_info(ioc, "%s: failed getting to correct state\n",
5497+ __func__));
56035498 return r;
56045499 }
56055500 mpi_reply_sz = sizeof(Mpi2IOCFactsReply_t);
@@ -5610,8 +5505,7 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines
56105505 (u32 *)&mpi_request, mpi_reply_sz, (u16 *)&mpi_reply, 5);
56115506
56125507 if (r != 0) {
5613− pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n",
5614− ioc->name, __func__, r);
5508+ ioc_err(ioc, "%s: handshake failed (r=%d)\n", __func__, r);
56155509 return r;
56165510 }
56175511
@@ -5663,20 +5557,20 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc) · 45 unmodified lines
56635557 */
56645558 ioc->page_size = 1 << facts->CurrentHostPageSize;
56655559 if (ioc->page_size == 1) {
5666− pr_info(MPT3SAS_FMT "CurrentHostPageSize is 0: Setting "
5667− "default host page size to 4k\n", ioc->name);
5560+ ioc_info(ioc, "CurrentHostPageSize is 0: Setting default host page size to 4k\n");
56685561 ioc->page_size = 1 << MPT3SAS_HOST_PAGE_SIZE_4K;
56695562 }
5670− dinitprintk(ioc, pr_info(MPT3SAS_FMT "CurrentHostPageSize(%d)\n",
5671− ioc->name, facts->CurrentHostPageSize));
5672−
5673− dinitprintk(ioc, pr_info(MPT3SAS_FMT
5674− "hba queue depth(%d), max chains per io(%d)\n",
5675− ioc->name, facts->RequestCredit,
5676− facts->MaxChainDepth));
5677− dinitprintk(ioc, pr_info(MPT3SAS_FMT
5678− "request frame size(%d), reply frame size(%d)\n", ioc->name,
5679− facts->IOCRequestFrameSize * 4, facts->ReplyFrameSize * 4));
5563+ dinitprintk(ioc,
5564+ ioc_info(ioc, "CurrentHostPageSize(%d)\n",
5565+ facts->CurrentHostPageSize));
5566+
5567+ dinitprintk(ioc,
5568+ ioc_info(ioc, "hba queue depth(%d), max chains per io(%d)\n",
5569+ facts->RequestCredit, facts->MaxChainDepth));
5570+ dinitprintk(ioc,
5571+ ioc_info(ioc, "request frame size(%d), reply frame size(%d)\n",
5572+ facts->IOCRequestFrameSize * 4,
5573+ facts->ReplyFrameSize * 4));
56805574 return 0;
56815575 }
56825576
@@ -5696,8 +5590,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc) · 13 unmodified lines
56965590 u16 ioc_status;
56975591 u32 reply_post_free_array_sz = 0;
56985592
5699− dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
5700− __func__));
5593+ dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
57015594
57025595 memset(&mpi_request, 0, sizeof(Mpi2IOCInitRequest_t));
57035596 mpi_request.Function = MPI2_FUNCTION_IOC_INIT;
@@ -5763,15 +5656,14 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc) · 59 unmodified lines
57635656 sizeof(Mpi2IOCInitReply_t), (u16 *)&mpi_reply, 10);
57645657
57655658 if (r != 0) {
5766− pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n",
5767− ioc->name, __func__, r);
5659+ ioc_err(ioc, "%s: handshake failed (r=%d)\n", __func__, r);
57685660 return r;
57695661 }
57705662
57715663 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK;
57725664 if (ioc_status != MPI2_IOCSTATUS_SUCCESS ||
57735665 mpi_reply.IOCLogInfo) {
5774− pr_err(MPT3SAS_FMT "%s: failed\n", ioc->name, __func__);
5666+ ioc_err(ioc, "%s: failed\n", __func__);
57755667 r = -EIO;
57765668 }
57775669
@@ -5842,18 +5734,16 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc) · 64 unmodified lines
58425734 u16 smid;
58435735 u16 ioc_status;
58445736
5845− pr_info(MPT3SAS_FMT "sending port enable !!\n", ioc->name);
5737+ ioc_info(ioc, "sending port enable !!\n");
58465738
58475739 if (ioc->port_enable_cmds.status & MPT3_CMD_PENDING) {
5848− pr_err(MPT3SAS_FMT "%s: internal command already in use\n",
5849− ioc->name, __func__);
5740+ ioc_err(ioc, "%s: internal command already in use\n", __func__);
58505741 return -EAGAIN;
58515742 }
58525743
58535744 smid = mpt3sas_base_get_smid(ioc, ioc->port_enable_cb_idx);
58545745 if (!smid) {
5855− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
5856− ioc->name, __func__);
5746+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
58575747 return -EAGAIN;
58585748 }
58595749
@@ -5867,8 +5757,7 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines
58675757 mpt3sas_base_put_smid_default(ioc, smid);
58685758 wait_for_completion_timeout(&ioc->port_enable_cmds.done, 300*HZ);
58695759 if (!(ioc->port_enable_cmds.status & MPT3_CMD_COMPLETE)) {
5870− pr_err(MPT3SAS_FMT "%s: timeout\n",
5871− ioc->name, __func__);
5760+ ioc_err(ioc, "%s: timeout\n", __func__);
58725761 _debug_dump_mf(mpi_request,
58735762 sizeof(Mpi2PortEnableRequest_t)/4);
58745763 if (ioc->port_enable_cmds.status & MPT3_CMD_RESET)
@@ -5881,16 +5770,15 @@ _base_send_port_enable(struct MPT3SAS_ADAPTER *ioc) · 6 unmodified lines
58815770 mpi_reply = ioc->port_enable_cmds.reply;
58825771 ioc_status = le16_to_cpu(mpi_reply->IOCStatus) & MPI2_IOCSTATUS_MASK;
58835772 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5884− pr_err(MPT3SAS_FMT "%s: failed with (ioc_status=0x%08x)\n",
5885− ioc->name, __func__, ioc_status);
5773+ ioc_err(ioc, "%s: failed with (ioc_status=0x%08x)\n",
5774+ __func__, ioc_status);
58865775 r = -EFAULT;
58875776 goto out;
58885777 }
58895778
58905779 out:
58915780 ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED;
5892− pr_info(MPT3SAS_FMT "port enable: %s\n", ioc->name, ((r == 0) ?
5893− "SUCCESS" : "FAILED"));
5781+ ioc_info(ioc, "port enable: %s\n", r == 0 ? "SUCCESS" : "FAILED");
58945782 return r;
58955783 }
58965784
@@ -5906,18 +5794,16 @@ mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc) · 9 unmodified lines
59065794 Mpi2PortEnableRequest_t *mpi_request;
59075795 u16 smid;
59085796
5909− pr_info(MPT3SAS_FMT "sending port enable !!\n", ioc->name);
5797+ ioc_info(ioc, "sending port enable !!\n");
59105798
59115799 if (ioc->port_enable_cmds.status & MPT3_CMD_PENDING) {
5912− pr_err(MPT3SAS_FMT "%s: internal command already in use\n",
5913− ioc->name, __func__);
5800+ ioc_err(ioc, "%s: internal command already in use\n", __func__);
59145801 return -EAGAIN;
59155802 }
59165803
59175804 smid = mpt3sas_base_get_smid(ioc, ioc->port_enable_cb_idx);
59185805 if (!smid) {
5919− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
5920− ioc->name, __func__);
5806+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
59215807 return -EAGAIN;
59225808 }
59235809
@@ -6020,19 +5906,16 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc) · 96 unmodified lines
60205906 int r = 0;
60215907 int i;
60225908
6023− dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
6024− __func__));
5909+ dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
60255910
60265911 if (ioc->base_cmds.status & MPT3_CMD_PENDING) {
6027− pr_err(MPT3SAS_FMT "%s: internal command already in use\n",
6028− ioc->name, __func__);
5912+ ioc_err(ioc, "%s: internal command already in use\n", __func__);
60295913 return -EAGAIN;
60305914 }
60315915
60325916 smid = mpt3sas_base_get_smid(ioc, ioc->base_cb_idx);
60335917 if (!smid) {
6034− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
6035− ioc->name, __func__);
5918+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
60365919 return -EAGAIN;
60375920 }
60385921 ioc->base_cmds.status = MPT3_CMD_PENDING;
@@ -6049,8 +5932,7 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc) · 10 unmodified lines
60495932 mpt3sas_base_put_smid_default(ioc, smid);
60505933 wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ);
60515934 if (!(ioc->base_cmds.status & MPT3_CMD_COMPLETE)) {
6052− pr_err(MPT3SAS_FMT "%s: timeout\n",
6053− ioc->name, __func__);
5935+ ioc_err(ioc, "%s: timeout\n", __func__);
60545936 _debug_dump_mf(mpi_request,
60555937 sizeof(Mpi2EventNotificationRequest_t)/4);
60565938 if (ioc->base_cmds.status & MPT3_CMD_RESET)
@@ -6058,8 +5940,7 @@ _base_event_notification(struct MPT3SAS_ADAPTER *ioc) · 1 unmodified line
60585940 else
60595941 r = -ETIME;
60605942 } else
6061− dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s: complete\n",
6062− ioc->name, __func__));
5943+ dinitprintk(ioc, ioc_info(ioc, "%s: complete\n", __func__));
60635944 ioc->base_cmds.status = MPT3_CMD_NOT_USED;
60645945 return r;
60655946 }
@@ -6115,18 +5996,16 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc) · 49 unmodified lines
61155996 u32 count;
61165997 u32 hcb_size;
61175998
6118− pr_info(MPT3SAS_FMT "sending diag reset !!\n", ioc->name);
5999+ ioc_info(ioc, "sending diag reset !!\n");
61196000
6120− drsprintk(ioc, pr_info(MPT3SAS_FMT "clear interrupts\n",
6121− ioc->name));
6001+ drsprintk(ioc, ioc_info(ioc, "clear interrupts\n"));
61226002
61236003 count = 0;
61246004 do {
61256005 /* Write magic sequence to WriteSequence register
61266006 * Loop until in diagnostic mode
61276007 */
6128− drsprintk(ioc, pr_info(MPT3SAS_FMT
6129− "write magic sequence\n", ioc->name));
6008+ drsprintk(ioc, ioc_info(ioc, "write magic sequence\n"));
61306009 writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, &ioc->chip->WriteSequence);
61316010 writel(MPI2_WRSEQ_1ST_KEY_VALUE, &ioc->chip->WriteSequence);
61326011 writel(MPI2_WRSEQ_2ND_KEY_VALUE, &ioc->chip->WriteSequence);
@@ -6142,16 +6021,15 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc) · 9 unmodified lines
61426021 goto out;
61436022
61446023 host_diagnostic = readl(&ioc->chip->HostDiagnostic);
6145− drsprintk(ioc, pr_info(MPT3SAS_FMT
6146− "wrote magic sequence: count(%d), host_diagnostic(0x%08x)\n",
6147− ioc->name, count, host_diagnostic));
6024+ drsprintk(ioc,
6025+ ioc_info(ioc, "wrote magic sequence: count(%d), host_diagnostic(0x%08x)\n",
6026+ count, host_diagnostic));
61486027
61496028 } while ((host_diagnostic & MPI2_DIAG_DIAG_WRITE_ENABLE) == 0);
61506029
61516030 hcb_size = readl(&ioc->chip->HCBSize);
61526031
6153− drsprintk(ioc, pr_info(MPT3SAS_FMT "diag reset: issued\n",
6154− ioc->name));
6032+ drsprintk(ioc, ioc_info(ioc, "diag reset: issued\n"));
61556033 writel(host_diagnostic | MPI2_DIAG_RESET_ADAPTER,
61566034 &ioc->chip->HostDiagnostic);
61576035
@@ -6174,43 +6052,38 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines
61746052
61756053 if (host_diagnostic & MPI2_DIAG_HCB_MODE) {
61766054
6177− drsprintk(ioc, pr_info(MPT3SAS_FMT
6178− "restart the adapter assuming the HCB Address points to good F/W\n",
6179− ioc->name));
6055+ drsprintk(ioc,
6056+ ioc_info(ioc, "restart the adapter assuming the HCB Address points to good F/W\n"));
61806057 host_diagnostic &= ~MPI2_DIAG_BOOT_DEVICE_SELECT_MASK;
61816058 host_diagnostic |= MPI2_DIAG_BOOT_DEVICE_SELECT_HCDW;
61826059 writel(host_diagnostic, &ioc->chip->HostDiagnostic);
61836060
6184− drsprintk(ioc, pr_info(MPT3SAS_FMT
6185− "re-enable the HCDW\n", ioc->name));
6061+ drsprintk(ioc, ioc_info(ioc, "re-enable the HCDW\n"));
61866062 writel(hcb_size | MPI2_HCB_SIZE_HCB_ENABLE,
61876063 &ioc->chip->HCBSize);
61886064 }
61896065
6190− drsprintk(ioc, pr_info(MPT3SAS_FMT "restart the adapter\n",
6191− ioc->name));
6066+ drsprintk(ioc, ioc_info(ioc, "restart the adapter\n"));
61926067 writel(host_diagnostic & ~MPI2_DIAG_HOLD_IOC_RESET,
61936068 &ioc->chip->HostDiagnostic);
61946069
6195− drsprintk(ioc, pr_info(MPT3SAS_FMT
6196− "disable writes to the diagnostic register\n", ioc->name));
6070+ drsprintk(ioc,
6071+ ioc_info(ioc, "disable writes to the diagnostic register\n"));
61976072 writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, &ioc->chip->WriteSequence);
61986073
6199− drsprintk(ioc, pr_info(MPT3SAS_FMT
6200− "Wait for FW to go to the READY state\n", ioc->name));
6074+ drsprintk(ioc, ioc_info(ioc, "Wait for FW to go to the READY state\n"));
62016075 ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, 20);
62026076 if (ioc_state) {
6203− pr_err(MPT3SAS_FMT
6204− "%s: failed going to ready state (ioc_state=0x%x)\n",
6205− ioc->name, __func__, ioc_state);
6077+ ioc_err(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n",
6078+ __func__, ioc_state);
62066079 goto out;
62076080 }
62086081
6209− pr_info(MPT3SAS_FMT "diag reset: SUCCESS\n", ioc->name);
6082+ ioc_info(ioc, "diag reset: SUCCESS\n");
62106083 return 0;
62116084
62126085 out:
6213− pr_err(MPT3SAS_FMT "diag reset: FAILED\n", ioc->name);
6086+ ioc_err(ioc, "diag reset: FAILED\n");
62146087 return -EFAULT;
62156088 }
62166089
@@ -6228,15 +6101,15 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) · 11 unmodified lines
62286101 int rc;
62296102 int count;
62306103
6231− dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
6232− __func__));
6104+ dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
62336105
62346106 if (ioc->pci_error_recovery)
62356107 return 0;
62366108
62376109 ioc_state = mpt3sas_base_get_iocstate(ioc, 0);
6238− dhsprintk(ioc, pr_info(MPT3SAS_FMT "%s: ioc_state(0x%08x)\n",
6239− ioc->name, __func__, ioc_state));
6110+ dhsprintk(ioc,
6111+ ioc_info(ioc, "%s: ioc_state(0x%08x)\n",
6112+ __func__, ioc_state));
62406113
62416114 /* if in RESET state, it should move to READY state shortly */
62426115 count = 0;
@@ -6244,9 +6117,8 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) · 1 unmodified line
62446117 while ((ioc_state & MPI2_IOC_STATE_MASK) !=
62456118 MPI2_IOC_STATE_READY) {
62466119 if (count++ == 10) {
6247− pr_err(MPT3SAS_FMT
6248− "%s: failed going to ready state (ioc_state=0x%x)\n",
6249− ioc->name, __func__, ioc_state);
6120+ ioc_err(ioc, "%s: failed going to ready state (ioc_state=0x%x)\n",
6121+ __func__, ioc_state);
62506122 return -EFAULT;
62516123 }
62526124 ssleep(1);
@@ -6258,9 +6130,7 @@ _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) · 5 unmodified lines
62586130 return 0;
62596131
62606132 if (ioc_state & MPI2_DOORBELL_USED) {
6261− dhsprintk(ioc, pr_info(MPT3SAS_FMT
6262− "unexpected doorbell active!\n",
6263− ioc->name));
6133+ dhsprintk(ioc, ioc_info(ioc, "unexpected doorbell active!\n"));
62646134 goto issue_diag_reset;
62656135 }
62666136
@@ -6304,8 +6174,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc) · 37 unmodified lines
63046174 struct adapter_reply_queue *reply_q;
63056175 Mpi2ReplyDescriptorsUnion_t *reply_post_free_contig;
63066176
6307− dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
6308− __func__));
6177+ dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
63096178
63106179 /* clean the delayed target reset list */
63116180 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
64656334 void
64666335 mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc)
64676336 {
6468− dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
6469− __func__));
6337+ dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
64706338
64716339 /* synchronizing freeing resource with pci_access_mutex lock */
64726340 mutex_lock(&ioc->pci_access_mutex);
@@ -6494,8 +6362,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) · 21 unmodified lines
64946362 int r, i;
64956363 int cpu_id, last_cpu_id = 0;
64966364
6497− dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
6498− __func__));
6365+ dinitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
64996366
65006367 /* setup cpu_msix_table */
65016368 ioc->cpu_count = num_online_cpus();
@@ -6505,9 +6372,8 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
65056372 ioc->cpu_msix_table = kzalloc(ioc->cpu_msix_table_sz, GFP_KERNEL);
65066373 ioc->reply_queue_count = 1;
65076374 if (!ioc->cpu_msix_table) {
6508− dfailprintk(ioc, pr_info(MPT3SAS_FMT
6509− "allocation for cpu_msix_table failed!!!\n",
6510− ioc->name));
6375+ dfailprintk(ioc,
6376+ ioc_info(ioc, "allocation for cpu_msix_table failed!!!\n"));
65116377 r = -ENOMEM;
65126378 goto out_free_resources;
65136379 }
@@ -6516,9 +6382,8 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
65166382 ioc->reply_post_host_index = kcalloc(ioc->cpu_msix_table_sz,
65176383 sizeof(resource_size_t *), GFP_KERNEL);
65186384 if (!ioc->reply_post_host_index) {
6519− dfailprintk(ioc, pr_info(MPT3SAS_FMT "allocation "
6520− "for reply_post_host_index failed!!!\n",
6521− ioc->name));
6385+ dfailprintk(ioc,
6386+ ioc_info(ioc, "allocation for reply_post_host_index failed!!!\n"));
65226387 r = -ENOMEM;
65236388 goto out_free_resources;
65246389 }
@@ -6747,8 +6612,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) · 222 unmodified lines
67476612 void
67486613 mpt3sas_base_detach(struct MPT3SAS_ADAPTER *ioc)
67496614 {
6750− dexitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
6751− __func__));
6615+ dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__));
67526616
67536617 mpt3sas_base_stop_watchdog(ioc);
67546618 mpt3sas_base_free_resources(ioc);
@@ -6781,8 +6645,7 @@ static void _base_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 26 unmodified lines
67816645 {
67826646 mpt3sas_scsih_pre_reset_handler(ioc);
67836647 mpt3sas_ctl_pre_reset_handler(ioc);
6784− dtmprintk(ioc, pr_info(MPT3SAS_FMT
6785− "%s: MPT3_IOC_PRE_RESET\n", ioc->name, __func__));
6648+ dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_PRE_RESET\n", __func__));
67866649 }
67876650
67886651 /**
@@ -6793,8 +6656,7 @@ static void _base_after_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines
67936656 {
67946657 mpt3sas_scsih_after_reset_handler(ioc);
67956658 mpt3sas_ctl_after_reset_handler(ioc);
6796− dtmprintk(ioc, pr_info(MPT3SAS_FMT
6797− "%s: MPT3_IOC_AFTER_RESET\n", ioc->name, __func__));
6659+ dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_AFTER_RESET\n", __func__));
67986660 if (ioc->transport_cmds.status & MPT3_CMD_PENDING) {
67996661 ioc->transport_cmds.status |= MPT3_CMD_RESET;
68006662 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
68356697 {
68366698 mpt3sas_scsih_reset_done_handler(ioc);
68376699 mpt3sas_ctl_reset_done_handler(ioc);
6838− dtmprintk(ioc, pr_info(MPT3SAS_FMT
6839− "%s: MPT3_IOC_DONE_RESET\n", ioc->name, __func__));
6700+ dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_DONE_RESET\n", __func__));
68406701 }
68416702
68426703 /**
@@ -6883,12 +6744,10 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, · 40 unmodified lines
68836744 u32 ioc_state;
68846745 u8 is_fault = 0, is_trigger = 0;
68856746
6886− dtmprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name,
6887− __func__));
6747+ dtmprintk(ioc, ioc_info(ioc, "%s: enter\n", __func__));
68886748
68896749 if (ioc->pci_error_recovery) {
6890− pr_err(MPT3SAS_FMT "%s: pci error recovery reset\n",
6891− ioc->name, __func__);
6750+ ioc_err(ioc, "%s: pci error recovery reset\n", __func__);
68926751 r = 0;
68936752 goto out_unlocked;
68946753 }
@@ -6942,8 +6801,9 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, · 47 unmodified lines
69426801 _base_reset_done_handler(ioc);
69436802
69446803 out:
6945− dtmprintk(ioc, pr_info(MPT3SAS_FMT "%s: %s\n",
6946− ioc->name, __func__, ((r == 0) ? "SUCCESS" : "FAILED")));
6804+ dtmprintk(ioc,
6805+ ioc_info(ioc, "%s: %s\n",
6806+ __func__, r == 0 ? "SUCCESS" : "FAILED"));
69476807
69486808 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
69496809 ioc->shost_recovery = 0;
@@ -6959,7 +6819,6 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, · 9 unmodified lines
69596819 mpt3sas_trigger_master(ioc,
69606820 MASTER_TRIGGER_ADAPTER_RESET);
69616821 }
6962− dtmprintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,
6963− __func__));
6822+ dtmprintk(ioc, ioc_info(ioc, "%s: exit\n", __func__));
69646823 return r;
69656824 }
drivers/scsi/mpt3sas/mpt3sas_base.h+8−1
@@ -158,7 +158,14 @@ struct mpt3sas_nvme_cmd { · 157 unmodified lines
158158 /*
159159 * logging format
160160 */
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__)
162169
163170 /*
164171 * 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
175175 if (!desc)
176176 return;
177177
178− pr_info(MPT3SAS_FMT
179− "%s: %s(%d), action(%d), form(0x%08x), smid(%d)\n",
180− ioc->name, calling_function_name, desc,
181− mpi_request->Header.PageNumber, mpi_request->Action,
182− le32_to_cpu(mpi_request->PageAddress), smid);
178+ ioc_info(ioc, "%s: %s(%d), action(%d), form(0x%08x), smid(%d)\n",
179+ calling_function_name, desc,
180+ mpi_request->Header.PageNumber, mpi_request->Action,
181+ le32_to_cpu(mpi_request->PageAddress), smid);
183182
184183 if (!mpi_reply)
185184 return;
186185
187186 if (mpi_reply->IOCStatus || mpi_reply->IOCLogInfo)
188− pr_info(MPT3SAS_FMT
189− "\tiocstatus(0x%04x), loginfo(0x%08x)\n",
190− ioc->name, le16_to_cpu(mpi_reply->IOCStatus),
191− le32_to_cpu(mpi_reply->IOCLogInfo));
187+ ioc_info(ioc, "\tiocstatus(0x%04x), loginfo(0x%08x)\n",
188+ le16_to_cpu(mpi_reply->IOCStatus),
189+ le32_to_cpu(mpi_reply->IOCLogInfo));
192190 }
193191
194192 /**
@@ -210,9 +208,8 @@ _config_alloc_config_dma_memory(struct MPT3SAS_ADAPTER *ioc, · 15 unmodified lines
210208 mem->page = dma_alloc_coherent(&ioc->pdev->dev, mem->sz,
211209 &mem->page_dma, GFP_KERNEL);
212210 if (!mem->page) {
213− pr_err(MPT3SAS_FMT
214− "%s: dma_alloc_coherent failed asking for (%d) bytes!!\n",
215− ioc->name, __func__, mem->sz);
211+ ioc_err(ioc, "%s: dma_alloc_coherent failed asking for (%d) bytes!!\n",
212+ __func__, mem->sz);
216213 r = -ENOMEM;
217214 }
218215 } else { /* use tmp buffer if less than 512 bytes */
@@ -313,8 +310,7 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 94 unmodified lines
313310
314311 mutex_lock(&ioc->config_cmds.mutex);
315312 if (ioc->config_cmds.status != MPT3_CMD_NOT_USED) {
316− pr_err(MPT3SAS_FMT "%s: config_cmd in use\n",
317− ioc->name, __func__);
313+ ioc_err(ioc, "%s: config_cmd in use\n", __func__);
318314 mutex_unlock(&ioc->config_cmds.mutex);
319315 return -EAGAIN;
320316 }
@@ -362,34 +358,30 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 41 unmodified lines
362358 r = -EFAULT;
363359 goto free_mem;
364360 }
365− pr_info(MPT3SAS_FMT "%s: attempting retry (%d)\n",
366− ioc->name, __func__, retry_count);
361+ ioc_info(ioc, "%s: attempting retry (%d)\n",
362+ __func__, retry_count);
367363 }
368364 wait_state_count = 0;
369365 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
370366 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
371367 if (wait_state_count++ == MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT) {
372− pr_err(MPT3SAS_FMT
373− "%s: failed due to ioc not operational\n",
374− ioc->name, __func__);
368+ ioc_err(ioc, "%s: failed due to ioc not operational\n",
369+ __func__);
375370 ioc->config_cmds.status = MPT3_CMD_NOT_USED;
376371 r = -EFAULT;
377372 goto free_mem;
378373 }
379374 ssleep(1);
380375 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
381− pr_info(MPT3SAS_FMT
382− "%s: waiting for operational state(count=%d)\n",
383− ioc->name, __func__, wait_state_count);
376+ ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
377+ __func__, wait_state_count);
384378 }
385379 if (wait_state_count)
386− pr_info(MPT3SAS_FMT "%s: ioc is operational\n",
387− ioc->name, __func__);
380+ ioc_info(ioc, "%s: ioc is operational\n", __func__);
388381
389382 smid = mpt3sas_base_get_smid(ioc, ioc->config_cb_idx);
390383 if (!smid) {
391− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
392− ioc->name, __func__);
384+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
393385 ioc->config_cmds.status = MPT3_CMD_NOT_USED;
394386 r = -EAGAIN;
395387 goto free_mem;
@@ -429,12 +421,10 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 33 unmodified lines
429421 (mpi_reply->Header.PageType & 0xF)) {
430422 _debug_dump_mf(mpi_request, ioc->request_sz/4);
431423 _debug_dump_reply(mpi_reply, ioc->request_sz/4);
432− panic(KERN_WARNING MPT3SAS_FMT "%s: Firmware BUG:" \
433− " mpi_reply mismatch: Requested PageType(0x%02x)" \
434− " Reply PageType(0x%02x)\n", \
435− ioc->name, __func__,
436− (mpi_request->Header.PageType & 0xF),
437− (mpi_reply->Header.PageType & 0xF));
424+ panic("%s: %s: Firmware BUG: mpi_reply mismatch: Requested PageType(0x%02x) Reply PageType(0x%02x)\n",
425+ ioc->name, __func__,
426+ mpi_request->Header.PageType & 0xF,
427+ mpi_reply->Header.PageType & 0xF);
438428 }
439429
440430 if (((mpi_request->Header.PageType & 0xF) ==
@@ -442,19 +432,18 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 1 unmodified line
442432 mpi_request->ExtPageType != mpi_reply->ExtPageType) {
443433 _debug_dump_mf(mpi_request, ioc->request_sz/4);
444434 _debug_dump_reply(mpi_reply, ioc->request_sz/4);
445− panic(KERN_WARNING MPT3SAS_FMT "%s: Firmware BUG:" \
446− " mpi_reply mismatch: Requested ExtPageType(0x%02x)"
447− " Reply ExtPageType(0x%02x)\n",
448− ioc->name, __func__, mpi_request->ExtPageType,
449− mpi_reply->ExtPageType);
435+ panic("%s: %s: Firmware BUG: mpi_reply mismatch: Requested ExtPageType(0x%02x) Reply ExtPageType(0x%02x)\n",
436+ ioc->name, __func__,
437+ mpi_request->ExtPageType,
438+ mpi_reply->ExtPageType);
450439 }
451440 ioc_status = le16_to_cpu(mpi_reply->IOCStatus)
452441 & MPI2_IOCSTATUS_MASK;
453442 }
454443
455444 if (retry_count)
456− pr_info(MPT3SAS_FMT "%s: retry (%d) completed!!\n", \
457− ioc->name, __func__, retry_count);
445+ ioc_info(ioc, "%s: retry (%d) completed!!\n",
446+ __func__, retry_count);
458447
459448 if ((ioc_status == MPI2_IOCSTATUS_SUCCESS) &&
460449 config_page && mpi_request->Action ==
@@ -469,14 +458,10 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 8 unmodified lines
469458 _debug_dump_reply(mpi_reply, ioc->request_sz/4);
470459 _debug_dump_config(p, min_t(u16, mem.sz,
471460 config_page_sz)/4);
472− panic(KERN_WARNING MPT3SAS_FMT
473− "%s: Firmware BUG:" \
474− " config page mismatch:"
475− " Requested PageType(0x%02x)"
476− " Reply PageType(0x%02x)\n",
477− ioc->name, __func__,
478− (mpi_request->Header.PageType & 0xF),
479− (p[3] & 0xF));
461+ panic("%s: %s: Firmware BUG: config page mismatch: Requested PageType(0x%02x) Reply PageType(0x%02x)\n",
462+ ioc->name, __func__,
463+ mpi_request->Header.PageType & 0xF,
464+ p[3] & 0xF);
480465 }
481466
482467 if (((mpi_request->Header.PageType & 0xF) ==
@@ -486,13 +471,9 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 3 unmodified lines
486471 _debug_dump_reply(mpi_reply, ioc->request_sz/4);
487472 _debug_dump_config(p, min_t(u16, mem.sz,
488473 config_page_sz)/4);
489− panic(KERN_WARNING MPT3SAS_FMT
490− "%s: Firmware BUG:" \
491− " config page mismatch:"
492− " Requested ExtPageType(0x%02x)"
493− " Reply ExtPageType(0x%02x)\n",
494− ioc->name, __func__,
495− mpi_request->ExtPageType, p[6]);
474+ panic("%s: %s: Firmware BUG: config page mismatch: Requested ExtPageType(0x%02x) Reply ExtPageType(0x%02x)\n",
475+ ioc->name, __func__,
476+ mpi_request->ExtPageType, p[6]);
496477 }
497478 }
498479 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
185185 if (!desc)
186186 return;
187187
188− pr_info(MPT3SAS_FMT "%s: %s, smid(%d)\n",
189− ioc->name, calling_function_name, desc, smid);
188+ ioc_info(ioc, "%s: %s, smid(%d)\n", calling_function_name, desc, smid);
190189
191190 if (!mpi_reply)
192191 return;
193192
194193 if (mpi_reply->IOCStatus || mpi_reply->IOCLogInfo)
195− pr_info(MPT3SAS_FMT
196− "\tiocstatus(0x%04x), loginfo(0x%08x)\n",
197− ioc->name, le16_to_cpu(mpi_reply->IOCStatus),
198− le32_to_cpu(mpi_reply->IOCLogInfo));
194+ ioc_info(ioc, "\tiocstatus(0x%04x), loginfo(0x%08x)\n",
195+ le16_to_cpu(mpi_reply->IOCStatus),
196+ le32_to_cpu(mpi_reply->IOCLogInfo));
199197
200198 if (mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST ||
201199 mpi_request->Function ==
@@ -208,38 +206,32 @@ _ctl_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid, · 6 unmodified lines
208206 sas_device = mpt3sas_get_sdev_by_handle(ioc,
209207 le16_to_cpu(scsi_reply->DevHandle));
210208 if (sas_device) {
211− pr_warn(MPT3SAS_FMT "\tsas_address(0x%016llx), phy(%d)\n",
212− ioc->name, (unsigned long long)
213− sas_device->sas_address, sas_device->phy);
214− pr_warn(MPT3SAS_FMT
215− "\tenclosure_logical_id(0x%016llx), slot(%d)\n",
216− ioc->name, (unsigned long long)
217− sas_device->enclosure_logical_id, sas_device->slot);
209+ ioc_warn(ioc, "\tsas_address(0x%016llx), phy(%d)\n",
210+ (u64)sas_device->sas_address,
211+ sas_device->phy);
212+ ioc_warn(ioc, "\tenclosure_logical_id(0x%016llx), slot(%d)\n",
213+ (u64)sas_device->enclosure_logical_id,
214+ sas_device->slot);
218215 sas_device_put(sas_device);
219216 }
220217 if (!sas_device) {
221218 pcie_device = mpt3sas_get_pdev_by_handle(ioc,
222219 le16_to_cpu(scsi_reply->DevHandle));
223220 if (pcie_device) {
224− pr_warn(MPT3SAS_FMT
225− "\tWWID(0x%016llx), port(%d)\n", ioc->name,
226− (unsigned long long)pcie_device->wwid,
227− pcie_device->port_num);
221+ ioc_warn(ioc, "\tWWID(0x%016llx), port(%d)\n",
222+ (unsigned long long)pcie_device->wwid,
223+ pcie_device->port_num);
228224 if (pcie_device->enclosure_handle != 0)
229− pr_warn(MPT3SAS_FMT
230− "\tenclosure_logical_id(0x%016llx), slot(%d)\n",
231− ioc->name, (unsigned long long)
232− pcie_device->enclosure_logical_id,
233− pcie_device->slot);
225+ ioc_warn(ioc, "\tenclosure_logical_id(0x%016llx), slot(%d)\n",
226+ (u64)pcie_device->enclosure_logical_id,
227+ pcie_device->slot);
234228 pcie_device_put(pcie_device);
235229 }
236230 }
237231 if (scsi_reply->SCSIState || scsi_reply->SCSIStatus)
238− pr_info(MPT3SAS_FMT
239− "\tscsi_state(0x%02x), scsi_status"
240− "(0x%02x)\n", ioc->name,
241− scsi_reply->SCSIState,
242− scsi_reply->SCSIStatus);
232+ ioc_info(ioc, "\tscsi_state(0x%02x), scsi_status(0x%02x)\n",
233+ scsi_reply->SCSIState,
234+ scsi_reply->SCSIStatus);
243235 }
244236 }
245237
@@ -466,8 +458,7 @@ void mpt3sas_ctl_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 220 unmodified lines
466458 int i;
467459 u8 issue_reset;
468460
469− dtmprintk(ioc, pr_info(MPT3SAS_FMT
470− "%s: MPT3_IOC_PRE_RESET\n", ioc->name, __func__));
461+ dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_PRE_RESET\n", __func__));
471462 for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) {
472463 if (!(ioc->diag_buffer_status[i] &
473464 MPT3_DIAG_BUFFER_IS_REGISTERED))
@@ -487,8 +478,7 @@ void mpt3sas_ctl_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 13 unmodified lines
487478 */
488479 void mpt3sas_ctl_after_reset_handler(struct MPT3SAS_ADAPTER *ioc)
489480 {
490− dtmprintk(ioc, pr_info(MPT3SAS_FMT
491− "%s: MPT3_IOC_AFTER_RESET\n", ioc->name, __func__));
481+ dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_AFTER_RESET\n", __func__));
492482 if (ioc->ctl_cmds.status & MPT3_CMD_PENDING) {
493483 ioc->ctl_cmds.status |= MPT3_CMD_RESET;
494484 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
506496 {
507497 int i;
508498
509− dtmprintk(ioc, pr_info(MPT3SAS_FMT
510− "%s: MPT3_IOC_DONE_RESET\n", ioc->name, __func__));
499+ dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_DONE_RESET\n", __func__));
511500
512501 for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) {
513502 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
612601 }
613602
614603 if (!found) {
615− dctlprintk(ioc, pr_info(MPT3SAS_FMT
616− "%s: handle(0x%04x), lun(%d), no active mid!!\n",
617− ioc->name,
618− desc, le16_to_cpu(tm_request->DevHandle), lun));
604+ dctlprintk(ioc,
605+ ioc_info(ioc, "%s: handle(0x%04x), lun(%d), no active mid!!\n",
606+ desc, le16_to_cpu(tm_request->DevHandle),
607+ lun));
619608 tm_reply = ioc->ctl_cmds.reply;
620609 tm_reply->DevHandle = tm_request->DevHandle;
621610 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
631620 return 1;
632621 }
633622
634− dctlprintk(ioc, pr_info(MPT3SAS_FMT
635− "%s: handle(0x%04x), lun(%d), task_mid(%d)\n", ioc->name,
636− desc, le16_to_cpu(tm_request->DevHandle), lun,
637− le16_to_cpu(tm_request->TaskMID)));
623+ dctlprintk(ioc,
624+ ioc_info(ioc, "%s: handle(0x%04x), lun(%d), task_mid(%d)\n",
625+ desc, le16_to_cpu(tm_request->DevHandle), lun,
626+ le16_to_cpu(tm_request->TaskMID)));
638627 return 0;
639628 }
640629
@@ -672,8 +661,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 31 unmodified lines
672661 issue_reset = 0;
673662
674663 if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {
675− pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n",
676− ioc->name, __func__);
664+ ioc_err(ioc, "%s: ctl_cmd in use\n", __func__);
677665 ret = -EAGAIN;
678666 goto out;
679667 }
@@ -682,28 +670,23 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 2 unmodified lines
682670 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
683671 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
684672 if (wait_state_count++ == 10) {
685− pr_err(MPT3SAS_FMT
686− "%s: failed due to ioc not operational\n",
687− ioc->name, __func__);
673+ ioc_err(ioc, "%s: failed due to ioc not operational\n",
674+ __func__);
688675 ret = -EFAULT;
689676 goto out;
690677 }
691678 ssleep(1);
692679 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
693− pr_info(MPT3SAS_FMT
694− "%s: waiting for operational state(count=%d)\n",
695− ioc->name,
696− __func__, wait_state_count);
680+ ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
681+ __func__, wait_state_count);
697682 }
698683 if (wait_state_count)
699− pr_info(MPT3SAS_FMT "%s: ioc is operational\n",
700− ioc->name, __func__);
684+ ioc_info(ioc, "%s: ioc is operational\n", __func__);
701685
702686 mpi_request = kzalloc(ioc->request_sz, GFP_KERNEL);
703687 if (!mpi_request) {
704− pr_err(MPT3SAS_FMT
705− "%s: failed obtaining a memory for mpi_request\n",
706− ioc->name, __func__);
688+ ioc_err(ioc, "%s: failed obtaining a memory for mpi_request\n",
689+ __func__);
707690 ret = -ENOMEM;
708691 goto out;
709692 }
@@ -726,8 +709,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 16 unmodified lines
726709 if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) {
727710 smid = mpt3sas_base_get_smid_hpr(ioc, ioc->ctl_cb_idx);
728711 if (!smid) {
729− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
730− ioc->name, __func__);
712+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
731713 ret = -EAGAIN;
732714 goto out;
733715 }
@@ -762,8 +744,8 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 28 unmodified lines
762744
763745 /* obtain dma-able memory for data transfer */
764746 if (data_out_sz) /* WRITE */ {
765− data_out = pci_alloc_consistent(ioc->pdev, data_out_sz,
766− &data_out_dma);
747+ data_out = dma_alloc_coherent(&ioc->pdev->dev, data_out_sz,
748+ &data_out_dma, GFP_KERNEL);
767749 if (!data_out) {
768750 pr_err("failure at %s:%d/%s()!\n", __FILE__,
769751 __LINE__, __func__);
@@ -782,8 +764,8 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 12 unmodified lines
782764 }
783765
784766 if (data_in_sz) /* READ */ {
785− data_in = pci_alloc_consistent(ioc->pdev, data_in_sz,
786− &data_in_dma);
767+ data_in = dma_alloc_coherent(&ioc->pdev->dev, data_in_sz,
768+ &data_in_dma, GFP_KERNEL);
787769 if (!data_in) {
788770 pr_err("failure at %s:%d/%s()!\n", __FILE__,
789771 __LINE__, __func__);
@@ -823,9 +805,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 33 unmodified lines
823805 ioc->build_nvme_prp(ioc, smid, nvme_encap_request,
824806 data_out_dma, data_out_sz, data_in_dma, data_in_sz);
825807 if (test_bit(device_handle, ioc->device_remove_in_progress)) {
826− dtmprintk(ioc, pr_info(MPT3SAS_FMT "handle(0x%04x) :"
827− "ioctl failed due to device removal in progress\n",
828− ioc->name, device_handle));
808+ dtmprintk(ioc,
809+ ioc_info(ioc, "handle(0x%04x): ioctl failed due to device removal in progress\n",
810+ device_handle));
829811 mpt3sas_base_free_smid(ioc, smid);
830812 ret = -EINVAL;
831813 goto out;
@@ -843,9 +825,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 11 unmodified lines
843825 mpt3sas_base_get_sense_buffer_dma(ioc, smid);
844826 memset(ioc->ctl_cmds.sense, 0, SCSI_SENSE_BUFFERSIZE);
845827 if (test_bit(device_handle, ioc->device_remove_in_progress)) {
846− dtmprintk(ioc, pr_info(MPT3SAS_FMT
847− "handle(0x%04x) :ioctl failed due to device removal in progress\n",
848− ioc->name, device_handle));
828+ dtmprintk(ioc,
829+ ioc_info(ioc, "handle(0x%04x) :ioctl failed due to device removal in progress\n",
830+ device_handle));
849831 mpt3sas_base_free_smid(ioc, smid);
850832 ret = -EINVAL;
851833 goto out;
@@ -863,10 +845,10 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 11 unmodified lines
863845 Mpi2SCSITaskManagementRequest_t *tm_request =
864846 (Mpi2SCSITaskManagementRequest_t *)request;
865847
866− dtmprintk(ioc, pr_info(MPT3SAS_FMT
867− "TASK_MGMT: handle(0x%04x), task_type(0x%02x)\n",
868− ioc->name,
869− le16_to_cpu(tm_request->DevHandle), tm_request->TaskType));
848+ dtmprintk(ioc,
849+ ioc_info(ioc, "TASK_MGMT: handle(0x%04x), task_type(0x%02x)\n",
850+ le16_to_cpu(tm_request->DevHandle),
851+ tm_request->TaskType));
870852 ioc->got_task_abort_from_ioctl = 1;
871853 if (tm_request->TaskType ==
872854 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
881863 ioc->got_task_abort_from_ioctl = 0;
882864
883865 if (test_bit(device_handle, ioc->device_remove_in_progress)) {
884− dtmprintk(ioc, pr_info(MPT3SAS_FMT
885− "handle(0x%04x) :ioctl failed due to device removal in progress\n",
886− ioc->name, device_handle));
866+ dtmprintk(ioc,
867+ ioc_info(ioc, "handle(0x%04x) :ioctl failed due to device removal in progress\n",
868+ device_handle));
887869 mpt3sas_base_free_smid(ioc, smid);
888870 ret = -EINVAL;
889871 goto out;
@@ -929,9 +911,9 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 39 unmodified lines
929911 case MPI2_FUNCTION_SATA_PASSTHROUGH:
930912 {
931913 if (test_bit(device_handle, ioc->device_remove_in_progress)) {
932− dtmprintk(ioc, pr_info(MPT3SAS_FMT
933− "handle(0x%04x) :ioctl failed due to device removal in progress\n",
934− ioc->name, device_handle));
914+ dtmprintk(ioc,
915+ ioc_info(ioc, "handle(0x%04x) :ioctl failed due to device removal in progress\n",
916+ device_handle));
935917 mpt3sas_base_free_smid(ioc, smid);
936918 ret = -EINVAL;
937919 goto out;
@@ -1017,12 +999,10 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, · 79 unmodified lines
1017999 Mpi2SCSITaskManagementReply_t *tm_reply =
10181000 (Mpi2SCSITaskManagementReply_t *)mpi_reply;
10191001
1020− pr_info(MPT3SAS_FMT "TASK_MGMT: " \
1021− "IOCStatus(0x%04x), IOCLogInfo(0x%08x), "
1022− "TerminationCount(0x%08x)\n", ioc->name,
1023− le16_to_cpu(tm_reply->IOCStatus),
1024− le32_to_cpu(tm_reply->IOCLogInfo),
1025− le32_to_cpu(tm_reply->TerminationCount));
1002+ ioc_info(ioc, "TASK_MGMT: IOCStatus(0x%04x), IOCLogInfo(0x%08x), TerminationCount(0x%08x)\n",
1003+ le16_to_cpu(tm_reply->IOCStatus),
1004+ le32_to_cpu(tm_reply->IOCLogInfo),
1005+ le32_to_cpu(tm_reply->TerminationCount));
10261006 }
10271007
10281008 /* 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
10541034 MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH || mpi_request->Function ==
10551035 MPI2_FUNCTION_NVME_ENCAPSULATED)) {
10561036 if (karg.sense_data_ptr == NULL) {
1057− pr_info(MPT3SAS_FMT "Response buffer provided"
1058− " by application is NULL; Response data will"
1059− " not be returned.\n", ioc->name);
1037+ ioc_info(ioc, "Response buffer provided by application is NULL; Response data will not be returned\n");
10601038 goto out;
10611039 }
10621040 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
10791057 mpi_request->Function ==
10801058 MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH ||
10811059 mpi_request->Function == MPI2_FUNCTION_SATA_PASSTHROUGH)) {
1082− pr_info(MPT3SAS_FMT "issue target reset: handle = (0x%04x)\n",
1083− ioc->name,
1084− le16_to_cpu(mpi_request->FunctionDependent1));
1060+ ioc_info(ioc, "issue target reset: handle = (0x%04x)\n",
1061+ le16_to_cpu(mpi_request->FunctionDependent1));
10851062 mpt3sas_halt_firmware(ioc);
10861063 pcie_device = mpt3sas_get_pdev_by_handle(ioc,
10871064 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
11061083
11071084 /* free memory associated with sg buffers */
11081085 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,
11101087 data_in_dma);
11111088
11121089 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,
11141091 data_out_dma);
11151092
11161093 kfree(mpi_request);
@@ -1128,8 +1105,8 @@ _ctl_getiocinfo(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 11 unmodified lines
11281105 {
11291106 struct mpt3_ioctl_iocinfo karg;
11301107
1131− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name,
1132− __func__));
1108+ dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
1109+ __func__));
11331110
11341111 memset(&karg, 0 , sizeof(karg));
11351112 if (ioc->pfacts)
@@ -1188,8 +1165,8 @@ _ctl_eventquery(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 52 unmodified lines
11881165 return -EFAULT;
11891166 }
11901167
1191− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name,
1192− __func__));
1168+ dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
1169+ __func__));
11931170
11941171 karg.event_entries = MPT3SAS_CTL_EVENT_LOG_SIZE;
11951172 memcpy(karg.event_types, ioc->event_type,
@@ -1219,8 +1196,8 @@ _ctl_eventenable(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 23 unmodified lines
12191196 return -EFAULT;
12201197 }
12211198
1222− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name,
1223− __func__));
1199+ dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
1200+ __func__));
12241201
12251202 memcpy(ioc->event_type, karg.event_types,
12261203 MPI2_EVENT_NOTIFY_EVENTMASK_WORDS * sizeof(u32));
@@ -1259,8 +1236,8 @@ _ctl_eventreport(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 32 unmodified lines
12591236 return -EFAULT;
12601237 }
12611238
1262− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name,
1263− __func__));
1239+ dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
1240+ __func__));
12641241
12651242 number_bytes = karg.hdr.max_data_size -
12661243 sizeof(struct mpt3_ioctl_header);
@@ -1306,12 +1283,11 @@ _ctl_do_reset(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 39 unmodified lines
13061283 ioc->is_driver_loading)
13071284 return -EAGAIN;
13081285
1309− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name,
1310− __func__));
1286+ dctlprintk(ioc, ioc_info(ioc, "%s: enter\n",
1287+ __func__));
13111288
13121289 retval = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
1313− pr_info(MPT3SAS_FMT "host reset: %s\n",
1314− ioc->name, ((!retval) ? "SUCCESS" : "FAILED"));
1290+ ioc_info(ioc, "host reset: %s\n", ((!retval) ? "SUCCESS" : "FAILED"));
13151291 return 0;
13161292 }
13171293
@@ -1440,8 +1416,8 @@ _ctl_btdh_mapping(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 122 unmodified lines
14401416 return -EFAULT;
14411417 }
14421418
1443− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
1444− __func__));
1419+ dctlprintk(ioc, ioc_info(ioc, "%s\n",
1420+ __func__));
14451421
14461422 rc = _ctl_btdh_search_sas_device(ioc, &karg);
14471423 if (!rc)
@@ -1512,53 +1488,46 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 64 unmodified lines
15121488 u32 ioc_state;
15131489 u8 issue_reset = 0;
15141490
1515− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
1516− __func__));
1491+ dctlprintk(ioc, ioc_info(ioc, "%s\n",
1492+ __func__));
15171493
15181494 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
15191495 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
1520− pr_err(MPT3SAS_FMT
1521− "%s: failed due to ioc not operational\n",
1522− ioc->name, __func__);
1496+ ioc_err(ioc, "%s: failed due to ioc not operational\n",
1497+ __func__);
15231498 rc = -EAGAIN;
15241499 goto out;
15251500 }
15261501
15271502 if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {
1528− pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n",
1529− ioc->name, __func__);
1503+ ioc_err(ioc, "%s: ctl_cmd in use\n", __func__);
15301504 rc = -EAGAIN;
15311505 goto out;
15321506 }
15331507
15341508 buffer_type = diag_register->buffer_type;
15351509 if (!_ctl_diag_capability(ioc, buffer_type)) {
1536− pr_err(MPT3SAS_FMT
1537− "%s: doesn't have capability for buffer_type(0x%02x)\n",
1538− ioc->name, __func__, buffer_type);
1510+ ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
1511+ __func__, buffer_type);
15391512 return -EPERM;
15401513 }
15411514
15421515 if (ioc->diag_buffer_status[buffer_type] &
15431516 MPT3_DIAG_BUFFER_IS_REGISTERED) {
1544− pr_err(MPT3SAS_FMT
1545− "%s: already has a registered buffer for buffer_type(0x%02x)\n",
1546− ioc->name, __func__,
1547− buffer_type);
1517+ ioc_err(ioc, "%s: already has a registered buffer for buffer_type(0x%02x)\n",
1518+ __func__, buffer_type);
15481519 return -EINVAL;
15491520 }
15501521
15511522 if (diag_register->requested_buffer_size % 4) {
1552− pr_err(MPT3SAS_FMT
1553− "%s: the requested_buffer_size is not 4 byte aligned\n",
1554− ioc->name, __func__);
1523+ ioc_err(ioc, "%s: the requested_buffer_size is not 4 byte aligned\n",
1524+ __func__);
15551525 return -EINVAL;
15561526 }
15571527
15581528 smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx);
15591529 if (!smid) {
1560− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
1561− ioc->name, __func__);
1530+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
15621531 rc = -EAGAIN;
15631532 goto out;
15641533 }
@@ -1580,9 +1549,9 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 15 unmodified lines
15801549 if (request_data) {
15811550 request_data_dma = ioc->diag_buffer_dma[buffer_type];
15821551 if (request_data_sz != ioc->diag_buffer_sz[buffer_type]) {
1583− pci_free_consistent(ioc->pdev,
1584− ioc->diag_buffer_sz[buffer_type],
1585− request_data, request_data_dma);
1552+ dma_free_coherent(&ioc->pdev->dev,
1553+ ioc->diag_buffer_sz[buffer_type],
1554+ request_data, request_data_dma);
15861555 request_data = NULL;
15871556 }
15881557 }
@@ -1590,12 +1559,11 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
15901559 if (request_data == NULL) {
15911560 ioc->diag_buffer_sz[buffer_type] = 0;
15921561 ioc->diag_buffer_dma[buffer_type] = 0;
1593− request_data = pci_alloc_consistent(
1594− ioc->pdev, request_data_sz, &request_data_dma);
1562+ request_data = dma_alloc_coherent(&ioc->pdev->dev,
1563+ request_data_sz, &request_data_dma, GFP_KERNEL);
15951564 if (request_data == NULL) {
1596− pr_err(MPT3SAS_FMT "%s: failed allocating memory" \
1597− " for diag buffers, requested size(%d)\n",
1598− ioc->name, __func__, request_data_sz);
1565+ ioc_err(ioc, "%s: failed allocating memory for diag buffers, requested size(%d)\n",
1566+ __func__, request_data_sz);
15991567 mpt3sas_base_free_smid(ioc, smid);
16001568 return -ENOMEM;
16011569 }
@@ -1612,11 +1580,11 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 10 unmodified lines
16121580 mpi_request->VF_ID = 0; /* TODO */
16131581 mpi_request->VP_ID = 0;
16141582
1615− dctlprintk(ioc, pr_info(MPT3SAS_FMT
1616− "%s: diag_buffer(0x%p), dma(0x%llx), sz(%d)\n",
1617− ioc->name, __func__, request_data,
1618− (unsigned long long)request_data_dma,
1619− le32_to_cpu(mpi_request->BufferLength)));
1583+ dctlprintk(ioc,
1584+ ioc_info(ioc, "%s: diag_buffer(0x%p), dma(0x%llx), sz(%d)\n",
1585+ __func__, request_data,
1586+ (unsigned long long)request_data_dma,
1587+ le32_to_cpu(mpi_request->BufferLength)));
16201588
16211589 for (i = 0; i < MPT3_PRODUCT_SPECIFIC_DWORDS; i++)
16221590 mpi_request->ProductSpecific[i] =
@@ -1637,8 +1605,7 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 14 unmodified lines
16371605
16381606 /* process the completed Reply Message Frame */
16391607 if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) {
1640− pr_err(MPT3SAS_FMT "%s: no reply message\n",
1641− ioc->name, __func__);
1608+ ioc_err(ioc, "%s: no reply message\n", __func__);
16421609 rc = -EFAULT;
16431610 goto out;
16441611 }
@@ -1649,13 +1616,11 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 4 unmodified lines
16491616 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
16501617 ioc->diag_buffer_status[buffer_type] |=
16511618 MPT3_DIAG_BUFFER_IS_REGISTERED;
1652− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: success\n",
1653− ioc->name, __func__));
1619+ dctlprintk(ioc, ioc_info(ioc, "%s: success\n", __func__));
16541620 } else {
1655− pr_info(MPT3SAS_FMT
1656− "%s: ioc_status(0x%04x) log_info(0x%08x)\n",
1657− ioc->name, __func__,
1658− ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
1621+ ioc_info(ioc, "%s: ioc_status(0x%04x) log_info(0x%08x)\n",
1622+ __func__,
1623+ ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
16591624 rc = -EFAULT;
16601625 }
16611626
@@ -1666,7 +1631,7 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, · 4 unmodified lines
16661631 out:
16671632
16681633 if (rc && request_data)
1669− pci_free_consistent(ioc->pdev, request_data_sz,
1634+ dma_free_coherent(&ioc->pdev->dev, request_data_sz,
16701635 request_data, request_data_dma);
16711636
16721637 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
16891654 memset(&diag_register, 0, sizeof(struct mpt3_diag_register));
16901655
16911656 if (bits_to_register & 1) {
1692− pr_info(MPT3SAS_FMT "registering trace buffer support\n",
1693− ioc->name);
1657+ ioc_info(ioc, "registering trace buffer support\n");
16941658 ioc->diag_trigger_master.MasterData =
16951659 (MASTER_TRIGGER_FW_FAULT + MASTER_TRIGGER_ADAPTER_RESET);
16961660 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
17011665 }
17021666
17031667 if (bits_to_register & 2) {
1704− pr_info(MPT3SAS_FMT "registering snapshot buffer support\n",
1705− ioc->name);
1668+ ioc_info(ioc, "registering snapshot buffer support\n");
17061669 diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_SNAPSHOT;
17071670 /* register for 2MB buffers */
17081671 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
17111674 }
17121675
17131676 if (bits_to_register & 4) {
1714− pr_info(MPT3SAS_FMT "registering extended buffer support\n",
1715− ioc->name);
1677+ ioc_info(ioc, "registering extended buffer support\n");
17161678 diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_EXTENDED;
17171679 /* register for 2MB buffers */
17181680 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
17681730 return -EFAULT;
17691731 }
17701732
1771− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
1772− __func__));
1733+ dctlprintk(ioc, ioc_info(ioc, "%s\n",
1734+ __func__));
17731735
17741736 buffer_type = karg.unique_id & 0x000000ff;
17751737 if (!_ctl_diag_capability(ioc, buffer_type)) {
1776− pr_err(MPT3SAS_FMT
1777− "%s: doesn't have capability for buffer_type(0x%02x)\n",
1778− ioc->name, __func__, buffer_type);
1738+ ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
1739+ __func__, buffer_type);
17791740 return -EPERM;
17801741 }
17811742
17821743 if ((ioc->diag_buffer_status[buffer_type] &
17831744 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
1784− pr_err(MPT3SAS_FMT
1785− "%s: buffer_type(0x%02x) is not registered\n",
1786− ioc->name, __func__, buffer_type);
1745+ ioc_err(ioc, "%s: buffer_type(0x%02x) is not registered\n",
1746+ __func__, buffer_type);
17871747 return -EINVAL;
17881748 }
17891749 if ((ioc->diag_buffer_status[buffer_type] &
17901750 MPT3_DIAG_BUFFER_IS_RELEASED) == 0) {
1791− pr_err(MPT3SAS_FMT
1792− "%s: buffer_type(0x%02x) has not been released\n",
1793− ioc->name, __func__, buffer_type);
1751+ ioc_err(ioc, "%s: buffer_type(0x%02x) has not been released\n",
1752+ __func__, buffer_type);
17941753 return -EINVAL;
17951754 }
17961755
17971756 if (karg.unique_id != ioc->unique_id[buffer_type]) {
1798− pr_err(MPT3SAS_FMT
1799− "%s: unique_id(0x%08x) is not registered\n",
1800− ioc->name, __func__, karg.unique_id);
1757+ ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n",
1758+ __func__, karg.unique_id);
18011759 return -EINVAL;
18021760 }
18031761
18041762 request_data = ioc->diag_buffer[buffer_type];
18051763 if (!request_data) {
1806− pr_err(MPT3SAS_FMT
1807− "%s: doesn't have memory allocated for buffer_type(0x%02x)\n",
1808− ioc->name, __func__, buffer_type);
1764+ ioc_err(ioc, "%s: doesn't have memory allocated for buffer_type(0x%02x)\n",
1765+ __func__, buffer_type);
18091766 return -ENOMEM;
18101767 }
18111768
18121769 request_data_sz = ioc->diag_buffer_sz[buffer_type];
18131770 request_data_dma = ioc->diag_buffer_dma[buffer_type];
1814− pci_free_consistent(ioc->pdev, request_data_sz,
1815− request_data, request_data_dma);
1771+ dma_free_coherent(&ioc->pdev->dev, request_data_sz,
1772+ request_data, request_data_dma);
18161773 ioc->diag_buffer[buffer_type] = NULL;
18171774 ioc->diag_buffer_status[buffer_type] = 0;
18181775 return 0;
@@ -1841,41 +1798,37 @@ _ctl_diag_query(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 22 unmodified lines
18411798 return -EFAULT;
18421799 }
18431800
1844− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
1845− __func__));
1801+ dctlprintk(ioc, ioc_info(ioc, "%s\n",
1802+ __func__));
18461803
18471804 karg.application_flags = 0;
18481805 buffer_type = karg.buffer_type;
18491806
18501807 if (!_ctl_diag_capability(ioc, buffer_type)) {
1851− pr_err(MPT3SAS_FMT
1852− "%s: doesn't have capability for buffer_type(0x%02x)\n",
1853− ioc->name, __func__, buffer_type);
1808+ ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
1809+ __func__, buffer_type);
18541810 return -EPERM;
18551811 }
18561812
18571813 if ((ioc->diag_buffer_status[buffer_type] &
18581814 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
1859− pr_err(MPT3SAS_FMT
1860− "%s: buffer_type(0x%02x) is not registered\n",
1861− ioc->name, __func__, buffer_type);
1815+ ioc_err(ioc, "%s: buffer_type(0x%02x) is not registered\n",
1816+ __func__, buffer_type);
18621817 return -EINVAL;
18631818 }
18641819
18651820 if (karg.unique_id & 0xffffff00) {
18661821 if (karg.unique_id != ioc->unique_id[buffer_type]) {
1867− pr_err(MPT3SAS_FMT
1868− "%s: unique_id(0x%08x) is not registered\n",
1869− ioc->name, __func__, karg.unique_id);
1822+ ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n",
1823+ __func__, karg.unique_id);
18701824 return -EINVAL;
18711825 }
18721826 }
18731827
18741828 request_data = ioc->diag_buffer[buffer_type];
18751829 if (!request_data) {
1876− pr_err(MPT3SAS_FMT
1877− "%s: doesn't have buffer for buffer_type(0x%02x)\n",
1878− ioc->name, __func__, buffer_type);
1830+ ioc_err(ioc, "%s: doesn't have buffer for buffer_type(0x%02x)\n",
1831+ __func__, buffer_type);
18791832 return -ENOMEM;
18801833 }
18811834
@@ -1897,9 +1850,8 @@ _ctl_diag_query(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 15 unmodified lines
18971850 karg.diagnostic_flags = ioc->diagnostic_flags[buffer_type];
18981851
18991852 if (copy_to_user(arg, &karg, sizeof(struct mpt3_diag_query))) {
1900− pr_err(MPT3SAS_FMT
1901− "%s: unable to write mpt3_diag_query data @ %p\n",
1902− ioc->name, __func__, arg);
1853+ ioc_err(ioc, "%s: unable to write mpt3_diag_query data @ %p\n",
1854+ __func__, arg);
19031855 return -EFAULT;
19041856 }
19051857 return 0;
@@ -1923,8 +1875,8 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, · 17 unmodified lines
19231875 u32 ioc_state;
19241876 int rc;
19251877
1926− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
1927− __func__));
1878+ dctlprintk(ioc, ioc_info(ioc, "%s\n",
1879+ __func__));
19281880
19291881 rc = 0;
19301882 *issue_reset = 0;
@@ -1935,24 +1887,22 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, · 4 unmodified lines
19351887 MPT3_DIAG_BUFFER_IS_REGISTERED)
19361888 ioc->diag_buffer_status[buffer_type] |=
19371889 MPT3_DIAG_BUFFER_IS_RELEASED;
1938− dctlprintk(ioc, pr_info(MPT3SAS_FMT
1939− "%s: skipping due to FAULT state\n", ioc->name,
1940− __func__));
1890+ dctlprintk(ioc,
1891+ ioc_info(ioc, "%s: skipping due to FAULT state\n",
1892+ __func__));
19411893 rc = -EAGAIN;
19421894 goto out;
19431895 }
19441896
19451897 if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {
1946− pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n",
1947− ioc->name, __func__);
1898+ ioc_err(ioc, "%s: ctl_cmd in use\n", __func__);
19481899 rc = -EAGAIN;
19491900 goto out;
19501901 }
19511902
19521903 smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx);
19531904 if (!smid) {
1954− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
1955− ioc->name, __func__);
1905+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
19561906 rc = -EAGAIN;
19571907 goto out;
19581908 }
@@ -1982,8 +1932,7 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, · 23 unmodified lines
19821932
19831933 /* process the completed Reply Message Frame */
19841934 if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) {
1985− pr_err(MPT3SAS_FMT "%s: no reply message\n",
1986− ioc->name, __func__);
1935+ ioc_err(ioc, "%s: no reply message\n", __func__);
19871936 rc = -EFAULT;
19881937 goto out;
19891938 }
@@ -1994,13 +1943,11 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type, · 4 unmodified lines
19941943 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
19951944 ioc->diag_buffer_status[buffer_type] |=
19961945 MPT3_DIAG_BUFFER_IS_RELEASED;
1997− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: success\n",
1998− ioc->name, __func__));
1946+ dctlprintk(ioc, ioc_info(ioc, "%s: success\n", __func__));
19991947 } else {
2000− pr_info(MPT3SAS_FMT
2001− "%s: ioc_status(0x%04x) log_info(0x%08x)\n",
2002− ioc->name, __func__,
2003− ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
1948+ ioc_info(ioc, "%s: ioc_status(0x%04x) log_info(0x%08x)\n",
1949+ __func__,
1950+ ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
20041951 rc = -EFAULT;
20051952 }
20061953
@@ -2033,47 +1980,41 @@ _ctl_diag_release(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 26 unmodified lines
20331980 return -EFAULT;
20341981 }
20351982
2036− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
2037− __func__));
1983+ dctlprintk(ioc, ioc_info(ioc, "%s\n",
1984+ __func__));
20381985
20391986 buffer_type = karg.unique_id & 0x000000ff;
20401987 if (!_ctl_diag_capability(ioc, buffer_type)) {
2041− pr_err(MPT3SAS_FMT
2042− "%s: doesn't have capability for buffer_type(0x%02x)\n",
2043− ioc->name, __func__, buffer_type);
1988+ ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
1989+ __func__, buffer_type);
20441990 return -EPERM;
20451991 }
20461992
20471993 if ((ioc->diag_buffer_status[buffer_type] &
20481994 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
2049− pr_err(MPT3SAS_FMT
2050− "%s: buffer_type(0x%02x) is not registered\n",
2051− ioc->name, __func__, buffer_type);
1995+ ioc_err(ioc, "%s: buffer_type(0x%02x) is not registered\n",
1996+ __func__, buffer_type);
20521997 return -EINVAL;
20531998 }
20541999
20552000 if (karg.unique_id != ioc->unique_id[buffer_type]) {
2056− pr_err(MPT3SAS_FMT
2057− "%s: unique_id(0x%08x) is not registered\n",
2058− ioc->name, __func__, karg.unique_id);
2001+ ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n",
2002+ __func__, karg.unique_id);
20592003 return -EINVAL;
20602004 }
20612005
20622006 if (ioc->diag_buffer_status[buffer_type] &
20632007 MPT3_DIAG_BUFFER_IS_RELEASED) {
2064− pr_err(MPT3SAS_FMT
2065− "%s: buffer_type(0x%02x) is already released\n",
2066− ioc->name, __func__,
2067− buffer_type);
2008+ ioc_err(ioc, "%s: buffer_type(0x%02x) is already released\n",
2009+ __func__, buffer_type);
20682010 return 0;
20692011 }
20702012
20712013 request_data = ioc->diag_buffer[buffer_type];
20722014
20732015 if (!request_data) {
2074− pr_err(MPT3SAS_FMT
2075− "%s: doesn't have memory allocated for buffer_type(0x%02x)\n",
2076− ioc->name, __func__, buffer_type);
2016+ ioc_err(ioc, "%s: doesn't have memory allocated for buffer_type(0x%02x)\n",
2017+ __func__, buffer_type);
20772018 return -ENOMEM;
20782019 }
20792020
@@ -2084,9 +2025,8 @@ _ctl_diag_release(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 4 unmodified lines
20842025 MPT3_DIAG_BUFFER_IS_RELEASED;
20852026 ioc->diag_buffer_status[buffer_type] &=
20862027 ~MPT3_DIAG_BUFFER_IS_DIAG_RESET;
2087− pr_err(MPT3SAS_FMT
2088− "%s: buffer_type(0x%02x) was released due to host reset\n",
2089− ioc->name, __func__, buffer_type);
2028+ ioc_err(ioc, "%s: buffer_type(0x%02x) was released due to host reset\n",
2029+ __func__, buffer_type);
20902030 return 0;
20912031 }
20922032
@@ -2124,38 +2064,34 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 31 unmodified lines
21242064 return -EFAULT;
21252065 }
21262066
2127− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
2128− __func__));
2067+ dctlprintk(ioc, ioc_info(ioc, "%s\n",
2068+ __func__));
21292069
21302070 buffer_type = karg.unique_id & 0x000000ff;
21312071 if (!_ctl_diag_capability(ioc, buffer_type)) {
2132− pr_err(MPT3SAS_FMT
2133− "%s: doesn't have capability for buffer_type(0x%02x)\n",
2134− ioc->name, __func__, buffer_type);
2072+ ioc_err(ioc, "%s: doesn't have capability for buffer_type(0x%02x)\n",
2073+ __func__, buffer_type);
21352074 return -EPERM;
21362075 }
21372076
21382077 if (karg.unique_id != ioc->unique_id[buffer_type]) {
2139− pr_err(MPT3SAS_FMT
2140− "%s: unique_id(0x%08x) is not registered\n",
2141− ioc->name, __func__, karg.unique_id);
2078+ ioc_err(ioc, "%s: unique_id(0x%08x) is not registered\n",
2079+ __func__, karg.unique_id);
21422080 return -EINVAL;
21432081 }
21442082
21452083 request_data = ioc->diag_buffer[buffer_type];
21462084 if (!request_data) {
2147− pr_err(MPT3SAS_FMT
2148− "%s: doesn't have buffer for buffer_type(0x%02x)\n",
2149− ioc->name, __func__, buffer_type);
2085+ ioc_err(ioc, "%s: doesn't have buffer for buffer_type(0x%02x)\n",
2086+ __func__, buffer_type);
21502087 return -ENOMEM;
21512088 }
21522089
21532090 request_size = ioc->diag_buffer_sz[buffer_type];
21542091
21552092 if ((karg.starting_offset % 4) || (karg.bytes_to_read % 4)) {
2156− pr_err(MPT3SAS_FMT "%s: either the starting_offset " \
2157− "or bytes_to_read are not 4 byte aligned\n", ioc->name,
2158− __func__);
2093+ ioc_err(ioc, "%s: either the starting_offset or bytes_to_read are not 4 byte aligned\n",
2094+ __func__);
21592095 return -EINVAL;
21602096 }
21612097
@@ -2163,10 +2099,10 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 1 unmodified line
21632099 return -EINVAL;
21642100
21652101 diag_data = (void *)(request_data + karg.starting_offset);
2166− dctlprintk(ioc, pr_info(MPT3SAS_FMT
2167− "%s: diag_buffer(%p), offset(%d), sz(%d)\n",
2168− ioc->name, __func__,
2169− diag_data, karg.starting_offset, karg.bytes_to_read));
2102+ dctlprintk(ioc,
2103+ ioc_info(ioc, "%s: diag_buffer(%p), offset(%d), sz(%d)\n",
2104+ __func__, diag_data, karg.starting_offset,
2105+ karg.bytes_to_read));
21702106
21712107 /* Truncate data on requests that are too large */
21722108 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
21772113
21782114 if (copy_to_user((void __user *)uarg->diagnostic_data,
21792115 diag_data, copy_size)) {
2180− pr_err(MPT3SAS_FMT
2181− "%s: Unable to write mpt_diag_read_buffer_t data @ %p\n",
2182− ioc->name, __func__, diag_data);
2116+ ioc_err(ioc, "%s: Unable to write mpt_diag_read_buffer_t data @ %p\n",
2117+ __func__, diag_data);
21832118 return -EFAULT;
21842119 }
21852120
21862121 if ((karg.flags & MPT3_FLAGS_REREGISTER) == 0)
21872122 return 0;
21882123
2189− dctlprintk(ioc, pr_info(MPT3SAS_FMT
2190− "%s: Reregister buffer_type(0x%02x)\n",
2191− ioc->name, __func__, buffer_type));
2124+ dctlprintk(ioc,
2125+ ioc_info(ioc, "%s: Reregister buffer_type(0x%02x)\n",
2126+ __func__, buffer_type));
21922127 if ((ioc->diag_buffer_status[buffer_type] &
21932128 MPT3_DIAG_BUFFER_IS_RELEASED) == 0) {
2194− dctlprintk(ioc, pr_info(MPT3SAS_FMT
2195− "%s: buffer_type(0x%02x) is still registered\n",
2196− ioc->name, __func__, buffer_type));
2129+ dctlprintk(ioc,
2130+ ioc_info(ioc, "%s: buffer_type(0x%02x) is still registered\n",
2131+ __func__, buffer_type));
21972132 return 0;
21982133 }
21992134 /* Get a free request frame and save the message context.
22002135 */
22012136
22022137 if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {
2203− pr_err(MPT3SAS_FMT "%s: ctl_cmd in use\n",
2204− ioc->name, __func__);
2138+ ioc_err(ioc, "%s: ctl_cmd in use\n", __func__);
22052139 rc = -EAGAIN;
22062140 goto out;
22072141 }
22082142
22092143 smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx);
22102144 if (!smid) {
2211− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
2212− ioc->name, __func__);
2145+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
22132146 rc = -EAGAIN;
22142147 goto out;
22152148 }
@@ -2247,8 +2180,7 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 31 unmodified lines
22472180
22482181 /* process the completed Reply Message Frame */
22492182 if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) {
2250− pr_err(MPT3SAS_FMT "%s: no reply message\n",
2251− ioc->name, __func__);
2183+ ioc_err(ioc, "%s: no reply message\n", __func__);
22522184 rc = -EFAULT;
22532185 goto out;
22542186 }
@@ -2259,13 +2191,11 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg) · 4 unmodified lines
22592191 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
22602192 ioc->diag_buffer_status[buffer_type] |=
22612193 MPT3_DIAG_BUFFER_IS_REGISTERED;
2262− dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: success\n",
2263− ioc->name, __func__));
2194+ dctlprintk(ioc, ioc_info(ioc, "%s: success\n", __func__));
22642195 } else {
2265− pr_info(MPT3SAS_FMT
2266− "%s: ioc_status(0x%04x) log_info(0x%08x)\n",
2267− ioc->name, __func__,
2268− ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
2196+ ioc_info(ioc, "%s: ioc_status(0x%04x) log_info(0x%08x)\n",
2197+ __func__, ioc_status,
2198+ le32_to_cpu(mpi_reply->IOCLogInfo));
22692199 rc = -EFAULT;
22702200 }
22712201
@@ -2450,8 +2380,9 @@ _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg, · 178 unmodified lines
24502380 ret = _ctl_diag_read_buffer(ioc, arg);
24512381 break;
24522382 default:
2453− dctlprintk(ioc, pr_info(MPT3SAS_FMT
2454− "unsupported ioctl opcode(0x%08x)\n", ioc->name, cmd));
2383+ dctlprintk(ioc,
2384+ ioc_info(ioc, "unsupported ioctl opcode(0x%08x)\n",
2385+ cmd));
24552386 break;
24562387 }
24572388
@@ -2840,8 +2771,8 @@ _ctl_logging_level_store(struct device *cdev, struct device_attribute *attr, · 382 unmodified lines
28402771 return -EINVAL;
28412772
28422773 ioc->logging_level = val;
2843− pr_info(MPT3SAS_FMT "logging_level=%08xh\n", ioc->name,
2844− ioc->logging_level);
2774+ ioc_info(ioc, "logging_level=%08xh\n",
2775+ ioc->logging_level);
28452776 return strlen(buf);
28462777 }
28472778 static 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
28772808 return -EINVAL;
28782809
28792810 ioc->fwfault_debug = val;
2880− pr_info(MPT3SAS_FMT "fwfault_debug=%d\n", ioc->name,
2881− ioc->fwfault_debug);
2811+ ioc_info(ioc, "fwfault_debug=%d\n",
2812+ ioc->fwfault_debug);
28822813 return strlen(buf);
28832814 }
28842815 static 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
29582889 ssize_t rc = 0;
29592890
29602891 if (!ioc->is_warpdrive) {
2961− pr_err(MPT3SAS_FMT "%s: BRM attribute is only for"
2962− " warpdrive\n", ioc->name, __func__);
2892+ ioc_err(ioc, "%s: BRM attribute is only for warpdrive\n",
2893+ __func__);
29632894 goto out;
29642895 }
29652896 /* 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
29732904 sz = offsetof(Mpi2IOUnitPage3_t, GPIOVal) + (sizeof(u16) * 36);
29742905 io_unit_pg3 = kzalloc(sz, GFP_KERNEL);
29752906 if (!io_unit_pg3) {
2976− pr_err(MPT3SAS_FMT "%s: failed allocating memory "
2977− "for iounit_pg3: (%d) bytes\n", ioc->name, __func__, sz);
2907+ ioc_err(ioc, "%s: failed allocating memory for iounit_pg3: (%d) bytes\n",
2908+ __func__, sz);
29782909 goto out;
29792910 }
29802911
29812912 if (mpt3sas_config_get_iounit_pg3(ioc, &mpi_reply, io_unit_pg3, sz) !=
29822913 0) {
2983− pr_err(MPT3SAS_FMT
2984− "%s: failed reading iounit_pg3\n", ioc->name,
2985− __func__);
2914+ ioc_err(ioc, "%s: failed reading iounit_pg3\n",
2915+ __func__);
29862916 goto out;
29872917 }
29882918
29892919 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK;
29902920 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
2991− pr_err(MPT3SAS_FMT "%s: iounit_pg3 failed with "
2992− "ioc_status(0x%04x)\n", ioc->name, __func__, ioc_status);
2921+ ioc_err(ioc, "%s: iounit_pg3 failed with ioc_status(0x%04x)\n",
2922+ __func__, ioc_status);
29932923 goto out;
29942924 }
29952925
29962926 if (io_unit_pg3->GPIOCount < 25) {
2997− pr_err(MPT3SAS_FMT "%s: iounit_pg3->GPIOCount less than "
2998− "25 entries, detected (%d) entries\n", ioc->name, __func__,
2999− io_unit_pg3->GPIOCount);
2927+ ioc_err(ioc, "%s: iounit_pg3->GPIOCount less than 25 entries, detected (%d) entries\n",
2928+ __func__, io_unit_pg3->GPIOCount);
30002929 goto out;
30012930 }
30022931
@@ -3039,17 +2968,15 @@ _ctl_host_trace_buffer_size_show(struct device *cdev, · 36 unmodified lines
30392968 struct DIAG_BUFFER_START *request_data;
30402969
30412970 if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) {
3042− pr_err(MPT3SAS_FMT
3043− "%s: host_trace_buffer is not registered\n",
3044− ioc->name, __func__);
2971+ ioc_err(ioc, "%s: host_trace_buffer is not registered\n",
2972+ __func__);
30452973 return 0;
30462974 }
30472975
30482976 if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
30492977 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
3050− pr_err(MPT3SAS_FMT
3051− "%s: host_trace_buffer is not registered\n",
3052− ioc->name, __func__);
2978+ ioc_err(ioc, "%s: host_trace_buffer is not registered\n",
2979+ __func__);
30532980 return 0;
30542981 }
30552982
@@ -3089,17 +3016,15 @@ _ctl_host_trace_buffer_show(struct device *cdev, struct device_attribute *attr, · 33 unmodified lines
30893016 u32 size;
30903017
30913018 if (!ioc->diag_buffer[MPI2_DIAG_BUF_TYPE_TRACE]) {
3092− pr_err(MPT3SAS_FMT
3093− "%s: host_trace_buffer is not registered\n",
3094− ioc->name, __func__);
3019+ ioc_err(ioc, "%s: host_trace_buffer is not registered\n",
3020+ __func__);
30953021 return 0;
30963022 }
30973023
30983024 if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
30993025 MPT3_DIAG_BUFFER_IS_REGISTERED) == 0) {
3100− pr_err(MPT3SAS_FMT
3101− "%s: host_trace_buffer is not registered\n",
3102− ioc->name, __func__);
3026+ ioc_err(ioc, "%s: host_trace_buffer is not registered\n",
3027+ __func__);
31033028 return 0;
31043029 }
31053030
@@ -3188,8 +3113,7 @@ _ctl_host_trace_buffer_enable_store(struct device *cdev, · 82 unmodified lines
31883113 MPT3_DIAG_BUFFER_IS_RELEASED) == 0))
31893114 goto out;
31903115 memset(&diag_register, 0, sizeof(struct mpt3_diag_register));
3191− pr_info(MPT3SAS_FMT "posting host trace buffers\n",
3192− ioc->name);
3116+ ioc_info(ioc, "posting host trace buffers\n");
31933117 diag_register.buffer_type = MPI2_DIAG_BUF_TYPE_TRACE;
31943118 diag_register.requested_buffer_size = (1024 * 1024);
31953119 diag_register.unique_id = 0x7075900;
@@ -3205,8 +3129,7 @@ _ctl_host_trace_buffer_enable_store(struct device *cdev, · 9 unmodified lines
32053129 if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
32063130 MPT3_DIAG_BUFFER_IS_RELEASED))
32073131 goto out;
3208− pr_info(MPT3SAS_FMT "releasing host trace buffer\n",
3209− ioc->name);
3132+ ioc_info(ioc, "releasing host trace buffer\n");
32103133 mpt3sas_send_diag_release(ioc, MPI2_DIAG_BUF_TYPE_TRACE,
32113134 &issue_reset);
32123135 }
@@ -3658,8 +3581,10 @@ mpt3sas_ctl_exit(ushort hbas_to_enumerate) · 445 unmodified lines
36583581 if ((ioc->diag_buffer_status[i] &
36593582 MPT3_DIAG_BUFFER_IS_RELEASED))
36603583 continue;
3661− pci_free_consistent(ioc->pdev, ioc->diag_buffer_sz[i],
3662− ioc->diag_buffer[i], ioc->diag_buffer_dma[i]);
3584+ dma_free_coherent(&ioc->pdev->dev,
3585+ ioc->diag_buffer_sz[i],
3586+ ioc->diag_buffer[i],
3587+ ioc->diag_buffer_dma[i]);
36633588 ioc->diag_buffer[i] = NULL;
36643589 ioc->diag_buffer_status[i] = 0;
36653590 }
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
418418
419419 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
420420 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
421− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name,
422− __FILE__, __LINE__, __func__);
421+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
422+ __FILE__, __LINE__, __func__);
423423 return -ENXIO;
424424 }
425425
@@ -442,10 +442,8 @@ _scsih_get_sas_address(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 16 unmodified lines
442442 return -ENXIO;
443443
444444 /* else error case */
445− pr_err(MPT3SAS_FMT
446− "handle(0x%04x), ioc_status(0x%04x), failure at %s:%d/%s()!\n",
447− ioc->name, handle, ioc_status,
448− __FILE__, __LINE__, __func__);
445+ ioc_err(ioc, "handle(0x%04x), ioc_status(0x%04x), failure at %s:%d/%s()!\n",
446+ handle, ioc_status, __FILE__, __LINE__, __func__);
449447 return -EIO;
450448 }
451449
@@ -508,10 +506,9 @@ _scsih_determine_boot_device(struct MPT3SAS_ADAPTER *ioc, void *device, · 56 unmodified lines
508506 (ioc->bios_pg2.ReqBootDeviceForm &
509507 MPI2_BIOSPAGE2_FORM_MASK),
510508 &ioc->bios_pg2.RequestedBootDevice)) {
511− dinitprintk(ioc, pr_info(MPT3SAS_FMT
512− "%s: req_boot_device(0x%016llx)\n",
513− ioc->name, __func__,
514− (unsigned long long)sas_address));
509+ dinitprintk(ioc,
510+ ioc_info(ioc, "%s: req_boot_device(0x%016llx)\n",
511+ __func__, (u64)sas_address));
515512 ioc->req_boot_device.device = device;
516513 ioc->req_boot_device.channel = channel;
517514 }
@@ -523,10 +520,9 @@ _scsih_determine_boot_device(struct MPT3SAS_ADAPTER *ioc, void *device, · 5 unmodified lines
523520 (ioc->bios_pg2.ReqAltBootDeviceForm &
524521 MPI2_BIOSPAGE2_FORM_MASK),
525522 &ioc->bios_pg2.RequestedAltBootDevice)) {
526− dinitprintk(ioc, pr_info(MPT3SAS_FMT
527− "%s: req_alt_boot_device(0x%016llx)\n",
528− ioc->name, __func__,
529− (unsigned long long)sas_address));
523+ dinitprintk(ioc,
524+ ioc_info(ioc, "%s: req_alt_boot_device(0x%016llx)\n",
525+ __func__, (u64)sas_address));
530526 ioc->req_alt_boot_device.device = device;
531527 ioc->req_alt_boot_device.channel = channel;
532528 }
@@ -538,10 +534,9 @@ _scsih_determine_boot_device(struct MPT3SAS_ADAPTER *ioc, void *device, · 5 unmodified lines
538534 (ioc->bios_pg2.CurrentBootDeviceForm &
539535 MPI2_BIOSPAGE2_FORM_MASK),
540536 &ioc->bios_pg2.CurrentBootDevice)) {
541− dinitprintk(ioc, pr_info(MPT3SAS_FMT
542− "%s: current_boot_device(0x%016llx)\n",
543− ioc->name, __func__,
544− (unsigned long long)sas_address));
537+ dinitprintk(ioc,
538+ ioc_info(ioc, "%s: current_boot_device(0x%016llx)\n",
539+ __func__, (u64)sas_address));
545540 ioc->current_boot_device.device = device;
546541 ioc->current_boot_device.channel = channel;
547542 }
@@ -752,19 +747,16 @@ _scsih_display_enclosure_chassis_info(struct MPT3SAS_ADAPTER *ioc, · 204 unmodified lines
752747 sas_device->chassis_slot);
753748 } else {
754749 if (sas_device->enclosure_handle != 0)
755− pr_info(MPT3SAS_FMT
756− "enclosure logical id(0x%016llx), slot(%d) \n",
757− ioc->name, (unsigned long long)
758− sas_device->enclosure_logical_id,
759− sas_device->slot);
750+ ioc_info(ioc, "enclosure logical id(0x%016llx), slot(%d)\n",
751+ (u64)sas_device->enclosure_logical_id,
752+ sas_device->slot);
760753 if (sas_device->connector_name[0] != '\0')
761− pr_info(MPT3SAS_FMT
762− "enclosure level(0x%04x), connector name( %s)\n",
763− ioc->name, sas_device->enclosure_level,
764− sas_device->connector_name);
754+ ioc_info(ioc, "enclosure level(0x%04x), connector name( %s)\n",
755+ sas_device->enclosure_level,
756+ sas_device->connector_name);
765757 if (sas_device->is_chassis_slot_valid)
766− pr_info(MPT3SAS_FMT "chassis slot(0x%04x)\n",
767− ioc->name, sas_device->chassis_slot);
758+ ioc_info(ioc, "chassis slot(0x%04x)\n",
759+ sas_device->chassis_slot);
768760 }
769761 }
770762
@@ -784,10 +776,8 @@ _scsih_sas_device_remove(struct MPT3SAS_ADAPTER *ioc, · 13 unmodified lines
784776
785777 if (!sas_device)
786778 return;
787− pr_info(MPT3SAS_FMT
788− "removing handle(0x%04x), sas_addr(0x%016llx)\n",
789− ioc->name, sas_device->handle,
790− (unsigned long long) sas_device->sas_address);
779+ ioc_info(ioc, "removing handle(0x%04x), sas_addr(0x%016llx)\n",
780+ sas_device->handle, (u64)sas_device->sas_address);
791781
792782 _scsih_display_enclosure_chassis_info(ioc, sas_device, NULL, NULL);
793783
@@ -872,10 +862,10 @@ _scsih_sas_device_add(struct MPT3SAS_ADAPTER *ioc, · 78 unmodified lines
872862 {
873863 unsigned long flags;
874864
875− dewtprintk(ioc, pr_info(MPT3SAS_FMT
876− "%s: handle(0x%04x), sas_addr(0x%016llx)\n",
877− ioc->name, __func__, sas_device->handle,
878− (unsigned long long)sas_device->sas_address));
865+ dewtprintk(ioc,
866+ ioc_info(ioc, "%s: handle(0x%04x), sas_addr(0x%016llx)\n",
867+ __func__, sas_device->handle,
868+ (u64)sas_device->sas_address));
879869
880870 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,
881871 NULL, NULL));
@@ -923,10 +913,10 @@ _scsih_sas_device_init_add(struct MPT3SAS_ADAPTER *ioc, · 41 unmodified lines
923913 {
924914 unsigned long flags;
925915
926− dewtprintk(ioc, pr_info(MPT3SAS_FMT
927− "%s: handle(0x%04x), sas_addr(0x%016llx)\n", ioc->name,
928− __func__, sas_device->handle,
929− (unsigned long long)sas_device->sas_address));
916+ dewtprintk(ioc,
917+ ioc_info(ioc, "%s: handle(0x%04x), sas_addr(0x%016llx)\n",
918+ __func__, sas_device->handle,
919+ (u64)sas_device->sas_address));
930920
931921 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,
932922 NULL, NULL));
@@ -1073,21 +1063,16 @@ _scsih_pcie_device_remove(struct MPT3SAS_ADAPTER *ioc, · 140 unmodified lines
10731063
10741064 if (!pcie_device)
10751065 return;
1076− pr_info(MPT3SAS_FMT
1077− "removing handle(0x%04x), wwid(0x%016llx)\n",
1078− ioc->name, pcie_device->handle,
1079− (unsigned long long) pcie_device->wwid);
1066+ ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n",
1067+ pcie_device->handle, (u64)pcie_device->wwid);
10801068 if (pcie_device->enclosure_handle != 0)
1081− pr_info(MPT3SAS_FMT
1082− "removing enclosure logical id(0x%016llx), slot(%d)\n",
1083− ioc->name,
1084− (unsigned long long)pcie_device->enclosure_logical_id,
1085− pcie_device->slot);
1069+ ioc_info(ioc, "removing enclosure logical id(0x%016llx), slot(%d)\n",
1070+ (u64)pcie_device->enclosure_logical_id,
1071+ pcie_device->slot);
10861072 if (pcie_device->connector_name[0] != '\0')
1087− pr_info(MPT3SAS_FMT
1088− "removing enclosure level(0x%04x), connector name( %s)\n",
1089− ioc->name, pcie_device->enclosure_level,
1090− pcie_device->connector_name);
1073+ ioc_info(ioc, "removing enclosure level(0x%04x), connector name( %s)\n",
1074+ pcie_device->enclosure_level,
1075+ pcie_device->connector_name);
10911076
10921077 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
10931078 if (!list_empty(&pcie_device->list)) {
@@ -1146,20 +1131,21 @@ _scsih_pcie_device_add(struct MPT3SAS_ADAPTER *ioc, · 52 unmodified lines
11461131 {
11471132 unsigned long flags;
11481133
1149− dewtprintk(ioc, pr_info(MPT3SAS_FMT
1150− "%s: handle (0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,
1151− pcie_device->handle, (unsigned long long)pcie_device->wwid));
1134+ dewtprintk(ioc,
1135+ ioc_info(ioc, "%s: handle (0x%04x), wwid(0x%016llx)\n",
1136+ __func__,
1137+ pcie_device->handle, (u64)pcie_device->wwid));
11521138 if (pcie_device->enclosure_handle != 0)
1153− dewtprintk(ioc, pr_info(MPT3SAS_FMT
1154− "%s: enclosure logical id(0x%016llx), slot( %d)\n",
1155− ioc->name, __func__,
1156− (unsigned long long)pcie_device->enclosure_logical_id,
1157− pcie_device->slot));
1139+ dewtprintk(ioc,
1140+ ioc_info(ioc, "%s: enclosure logical id(0x%016llx), slot( %d)\n",
1141+ __func__,
1142+ (u64)pcie_device->enclosure_logical_id,
1143+ pcie_device->slot));
11581144 if (pcie_device->connector_name[0] != '\0')
1159− dewtprintk(ioc, pr_info(MPT3SAS_FMT
1160− "%s: enclosure level(0x%04x), connector name( %s)\n",
1161− ioc->name, __func__, pcie_device->enclosure_level,
1162− pcie_device->connector_name));
1145+ dewtprintk(ioc,
1146+ ioc_info(ioc, "%s: enclosure level(0x%04x), connector name( %s)\n",
1147+ __func__, pcie_device->enclosure_level,
1148+ pcie_device->connector_name));
11631149
11641150 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
11651151 pcie_device_get(pcie_device);
@@ -1191,20 +1177,21 @@ _scsih_pcie_device_init_add(struct MPT3SAS_ADAPTER *ioc, · 25 unmodified lines
11911177 {
11921178 unsigned long flags;
11931179
1194− dewtprintk(ioc, pr_info(MPT3SAS_FMT
1195− "%s: handle (0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,
1196− pcie_device->handle, (unsigned long long)pcie_device->wwid));
1180+ dewtprintk(ioc,
1181+ ioc_info(ioc, "%s: handle (0x%04x), wwid(0x%016llx)\n",
1182+ __func__,
1183+ pcie_device->handle, (u64)pcie_device->wwid));
11971184 if (pcie_device->enclosure_handle != 0)
1198− dewtprintk(ioc, pr_info(MPT3SAS_FMT
1199− "%s: enclosure logical id(0x%016llx), slot( %d)\n",
1200− ioc->name, __func__,
1201− (unsigned long long)pcie_device->enclosure_logical_id,
1202− pcie_device->slot));
1185+ dewtprintk(ioc,
1186+ ioc_info(ioc, "%s: enclosure logical id(0x%016llx), slot( %d)\n",
1187+ __func__,
1188+ (u64)pcie_device->enclosure_logical_id,
1189+ pcie_device->slot));
12031190 if (pcie_device->connector_name[0] != '\0')
1204− dewtprintk(ioc, pr_info(MPT3SAS_FMT
1205− "%s: enclosure level(0x%04x), connector name( %s)\n",
1206− ioc->name, __func__, pcie_device->enclosure_level,
1207− pcie_device->connector_name));
1191+ dewtprintk(ioc,
1192+ ioc_info(ioc, "%s: enclosure level(0x%04x), connector name( %s)\n",
1193+ __func__, pcie_device->enclosure_level,
1194+ pcie_device->connector_name));
12081195
12091196 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
12101197 pcie_device_get(pcie_device);
@@ -1304,9 +1291,10 @@ _scsih_raid_device_add(struct MPT3SAS_ADAPTER *ioc, · 93 unmodified lines
13041291 {
13051292 unsigned long flags;
13061293
1307− dewtprintk(ioc, pr_info(MPT3SAS_FMT
1308− "%s: handle(0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,
1309− raid_device->handle, (unsigned long long)raid_device->wwid));
1294+ dewtprintk(ioc,
1295+ ioc_info(ioc, "%s: handle(0x%04x), wwid(0x%016llx)\n",
1296+ __func__,
1297+ raid_device->handle, (u64)raid_device->wwid));
13101298
13111299 spin_lock_irqsave(&ioc->raid_device_lock, flags);
13121300 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
18571845
18581846 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
18591847 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
1860− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1861− ioc->name, __FILE__, __LINE__, __func__);
1848+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1849+ __FILE__, __LINE__, __func__);
18621850 return;
18631851 }
18641852
18651853 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
18661854 MPI2_IOCSTATUS_MASK;
18671855 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
1868− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1869− ioc->name, __FILE__, __LINE__, __func__);
1856+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1857+ __FILE__, __LINE__, __func__);
18701858 return;
18711859 }
18721860
@@ -1952,8 +1940,8 @@ scsih_get_resync(struct device *dev) · 79 unmodified lines
19521940 if (mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, &vol_pg0,
19531941 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle,
19541942 sizeof(Mpi2RaidVolPage0_t))) {
1955− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1956− ioc->name, __FILE__, __LINE__, __func__);
1943+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1944+ __FILE__, __LINE__, __func__);
19571945 percent_complete = 0;
19581946 goto out;
19591947 }
@@ -2006,8 +1994,8 @@ scsih_get_state(struct device *dev) · 46 unmodified lines
20061994 if (mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, &vol_pg0,
20071995 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle,
20081996 sizeof(Mpi2RaidVolPage0_t))) {
2009− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
2010− ioc->name, __FILE__, __LINE__, __func__);
1997+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1998+ __FILE__, __LINE__, __func__);
20111999 goto out;
20122000 }
20132001
@@ -2103,9 +2091,9 @@ _scsih_get_volume_capabilities(struct MPT3SAS_ADAPTER *ioc, · 89 unmodified lines
21032091
21042092 if ((mpt3sas_config_get_number_pds(ioc, raid_device->handle,
21052093 &num_pds)) || !num_pds) {
2106− dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2107− "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__,
2108− __func__));
2094+ dfailprintk(ioc,
2095+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2096+ __FILE__, __LINE__, __func__));
21092097 return 1;
21102098 }
21112099
@@ -2114,17 +2102,17 @@ _scsih_get_volume_capabilities(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines
21142102 sizeof(Mpi2RaidVol0PhysDisk_t));
21152103 vol_pg0 = kzalloc(sz, GFP_KERNEL);
21162104 if (!vol_pg0) {
2117− dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2118− "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__,
2119− __func__));
2105+ dfailprintk(ioc,
2106+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2107+ __FILE__, __LINE__, __func__));
21202108 return 1;
21212109 }
21222110
21232111 if ((mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, vol_pg0,
21242112 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, raid_device->handle, sz))) {
2125− dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2126− "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__,
2127− __func__));
2113+ dfailprintk(ioc,
2114+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2115+ __FILE__, __LINE__, __func__));
21282116 kfree(vol_pg0);
21292117 return 1;
21302118 }
@@ -2215,16 +2203,16 @@ scsih_slave_configure(struct scsi_device *sdev) · 84 unmodified lines
22152203 raid_device = mpt3sas_raid_device_find_by_handle(ioc, handle);
22162204 spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
22172205 if (!raid_device) {
2218− dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2219− "failure at %s:%d/%s()!\n", ioc->name, __FILE__,
2220− __LINE__, __func__));
2206+ dfailprintk(ioc,
2207+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2208+ __FILE__, __LINE__, __func__));
22212209 return 1;
22222210 }
22232211
22242212 if (_scsih_get_volume_capabilities(ioc, raid_device)) {
2225− dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2226− "failure at %s:%d/%s()!\n", ioc->name, __FILE__,
2227− __LINE__, __func__));
2213+ dfailprintk(ioc,
2214+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2215+ __FILE__, __LINE__, __func__));
22282216 return 1;
22292217 }
22302218
@@ -2308,16 +2296,16 @@ scsih_slave_configure(struct scsi_device *sdev) · 77 unmodified lines
23082296 if (sas_target_priv_data->flags & MPT_TARGET_FLAGS_RAID_COMPONENT) {
23092297 if (mpt3sas_config_get_volume_handle(ioc, handle,
23102298 &volume_handle)) {
2311− dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2312− "failure at %s:%d/%s()!\n", ioc->name,
2313− __FILE__, __LINE__, __func__));
2299+ dfailprintk(ioc,
2300+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2301+ __FILE__, __LINE__, __func__));
23142302 return 1;
23152303 }
23162304 if (volume_handle && mpt3sas_config_get_volume_wwid(ioc,
23172305 volume_handle, &volume_wwid)) {
2318− dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2319− "failure at %s:%d/%s()!\n", ioc->name,
2320− __FILE__, __LINE__, __func__));
2306+ dfailprintk(ioc,
2307+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2308+ __FILE__, __LINE__, __func__));
23212309 return 1;
23222310 }
23232311 }
@@ -2329,9 +2317,9 @@ scsih_slave_configure(struct scsi_device *sdev) · 5 unmodified lines
23292317 sas_device_priv_data->sas_target->sas_address);
23302318 if (!pcie_device) {
23312319 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
2332− dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2333− "failure at %s:%d/%s()!\n", ioc->name, __FILE__,
2334− __LINE__, __func__));
2320+ dfailprintk(ioc,
2321+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2322+ __FILE__, __LINE__, __func__));
23352323 return 1;
23362324 }
23372325
@@ -2377,9 +2365,9 @@ scsih_slave_configure(struct scsi_device *sdev) · 39 unmodified lines
23772365 sas_device_priv_data->sas_target->sas_address);
23782366 if (!sas_device) {
23792367 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
2380− dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2381− "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__,
2382− __func__));
2368+ dfailprintk(ioc,
2369+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2370+ __FILE__, __LINE__, __func__));
23832371 return 1;
23842372 }
23852373
@@ -2515,8 +2503,7 @@ _scsih_response_code(struct MPT3SAS_ADAPTER *ioc, u8 response_code) · 129 unmodified lines
25152503 desc = "unknown";
25162504 break;
25172505 }
2518− pr_warn(MPT3SAS_FMT "response_code(0x%01x): %s\n",
2519− ioc->name, response_code, desc);
2506+ ioc_warn(ioc, "response_code(0x%01x): %s\n", response_code, desc);
25202507 }
25212508
25222509 /**
@@ -2640,22 +2627,19 @@ mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, u64 lun, · 117 unmodified lines
26402627 lockdep_assert_held(&ioc->tm_cmds.mutex);
26412628
26422629 if (ioc->tm_cmds.status != MPT3_CMD_NOT_USED) {
2643− pr_info(MPT3SAS_FMT "%s: tm_cmd busy!!!\n",
2644− __func__, ioc->name);
2630+ ioc_info(ioc, "%s: tm_cmd busy!!!\n", __func__);
26452631 return FAILED;
26462632 }
26472633
26482634 if (ioc->shost_recovery || ioc->remove_host ||
26492635 ioc->pci_error_recovery) {
2650− pr_info(MPT3SAS_FMT "%s: host reset in progress!\n",
2651− __func__, ioc->name);
2636+ ioc_info(ioc, "%s: host reset in progress!\n", __func__);
26522637 return FAILED;
26532638 }
26542639
26552640 ioc_state = mpt3sas_base_get_iocstate(ioc, 0);
26562641 if (ioc_state & MPI2_DOORBELL_USED) {
2657− dhsprintk(ioc, pr_info(MPT3SAS_FMT
2658− "unexpected doorbell active!\n", ioc->name));
2642+ dhsprintk(ioc, ioc_info(ioc, "unexpected doorbell active!\n"));
26592643 rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
26602644 return (!rc) ? SUCCESS : FAILED;
26612645 }
@@ -2669,14 +2653,13 @@ mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, u64 lun, · 7 unmodified lines
26692653
26702654 smid = mpt3sas_base_get_smid_hpr(ioc, ioc->tm_cb_idx);
26712655 if (!smid) {
2672− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
2673− ioc->name, __func__);
2656+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
26742657 return FAILED;
26752658 }
26762659
2677− dtmprintk(ioc, pr_info(MPT3SAS_FMT
2678− "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));
2660+ dtmprintk(ioc,
2661+ ioc_info(ioc, "sending tm: handle(0x%04x), task_type(0x%02x), smid(%d), timeout(%d), tr_method(0x%x)\n",
2662+ handle, type, smid_task, timeout, tr_method));
26802663 ioc->tm_cmds.status = MPT3_CMD_PENDING;
26812664 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
26822665 ioc->tm_cmds.smid = smid;
@@ -2709,11 +2692,11 @@ mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, u64 lun, · 26 unmodified lines
27092692 if (ioc->tm_cmds.status & MPT3_CMD_REPLY_VALID) {
27102693 mpt3sas_trigger_master(ioc, MASTER_TRIGGER_TASK_MANAGMENT);
27112694 mpi_reply = ioc->tm_cmds.reply;
2712− dtmprintk(ioc, pr_info(MPT3SAS_FMT "complete tm: " \
2713− "ioc_status(0x%04x), loginfo(0x%08x), term_count(0x%08x)\n",
2714− ioc->name, le16_to_cpu(mpi_reply->IOCStatus),
2715− le32_to_cpu(mpi_reply->IOCLogInfo),
2716− le32_to_cpu(mpi_reply->TerminationCount)));
2695+ dtmprintk(ioc,
2696+ ioc_info(ioc, "complete tm: ioc_status(0x%04x), loginfo(0x%08x), term_count(0x%08x)\n",
2697+ le16_to_cpu(mpi_reply->IOCStatus),
2698+ le32_to_cpu(mpi_reply->IOCLogInfo),
2699+ le32_to_cpu(mpi_reply->TerminationCount)));
27172700 if (ioc->logging_level & MPT_DEBUG_TM) {
27182701 _scsih_response_code(ioc, mpi_reply->ResponseCode);
27192702 if (mpi_reply->IOCStatus)
@@ -3060,13 +3043,11 @@ scsih_host_reset(struct scsi_cmnd *scmd) · 340 unmodified lines
30603043 struct MPT3SAS_ADAPTER *ioc = shost_priv(scmd->device->host);
30613044 int r, retval;
30623045
3063− pr_info(MPT3SAS_FMT "attempting host reset! scmd(%p)\n",
3064− ioc->name, scmd);
3046+ ioc_info(ioc, "attempting host reset! scmd(%p)\n", scmd);
30653047 scsi_print_command(scmd);
30663048
30673049 if (ioc->is_driver_loading || ioc->remove_host) {
3068− pr_info(MPT3SAS_FMT "Blocking the host reset\n",
3069− ioc->name);
3050+ ioc_info(ioc, "Blocking the host reset\n");
30703051 r = FAILED;
30713052 goto out;
30723053 }
@@ -3074,8 +3055,8 @@ scsih_host_reset(struct scsi_cmnd *scmd) · 1 unmodified line
30743055 retval = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
30753056 r = (retval < 0) ? FAILED : SUCCESS;
30763057 out:
3077− pr_info(MPT3SAS_FMT "host reset: %s scmd(%p)\n",
3078− ioc->name, ((r == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
3058+ ioc_info(ioc, "host reset: %s scmd(%p)\n",
3059+ r == SUCCESS ? "SUCCESS" : "FAILED", scmd);
30793060
30803061 return r;
30813062 }
@@ -3567,18 +3548,16 @@ _scsih_tm_tr_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 485 unmodified lines
35673548 u8 tr_method = 0;
35683549
35693550 if (ioc->pci_error_recovery) {
3570− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3571− "%s: host in pci error recovery: handle(0x%04x)\n",
3572− __func__, ioc->name,
3573− handle));
3551+ dewtprintk(ioc,
3552+ ioc_info(ioc, "%s: host in pci error recovery: handle(0x%04x)\n",
3553+ __func__, handle));
35743554 return;
35753555 }
35763556 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
35773557 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
3578− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3579− "%s: host is not operational: handle(0x%04x)\n",
3580− __func__, ioc->name,
3581− handle));
3558+ dewtprintk(ioc,
3559+ ioc_info(ioc, "%s: host is not operational: handle(0x%04x)\n",
3560+ __func__, handle));
35823561 return;
35833562 }
35843563
@@ -3614,39 +3593,31 @@ _scsih_tm_tr_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 29 unmodified lines
36143593 tr_method = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET;
36153594 }
36163595 if (sas_target_priv_data) {
3617− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3618− "setting delete flag: handle(0x%04x), sas_addr(0x%016llx)\n",
3619− ioc->name, handle,
3620− (unsigned long long)sas_address));
3596+ dewtprintk(ioc,
3597+ ioc_info(ioc, "setting delete flag: handle(0x%04x), sas_addr(0x%016llx)\n",
3598+ handle, (u64)sas_address));
36213599 if (sas_device) {
36223600 if (sas_device->enclosure_handle != 0)
3623− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3624− "setting delete flag:enclosure logical "
3625− "id(0x%016llx), slot(%d)\n", ioc->name,
3626− (unsigned long long)
3627− sas_device->enclosure_logical_id,
3628− sas_device->slot));
3601+ dewtprintk(ioc,
3602+ ioc_info(ioc, "setting delete flag:enclosure logical id(0x%016llx), slot(%d)\n",
3603+ (u64)sas_device->enclosure_logical_id,
3604+ sas_device->slot));
36293605 if (sas_device->connector_name[0] != '\0')
3630− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3631− "setting delete flag: enclosure "
3632− "level(0x%04x), connector name( %s)\n",
3633− ioc->name, sas_device->enclosure_level,
3634− sas_device->connector_name));
3606+ dewtprintk(ioc,
3607+ ioc_info(ioc, "setting delete flag: enclosure level(0x%04x), connector name( %s)\n",
3608+ sas_device->enclosure_level,
3609+ sas_device->connector_name));
36353610 } else if (pcie_device) {
36363611 if (pcie_device->enclosure_handle != 0)
3637− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3638− "setting delete flag: logical "
3639− "id(0x%016llx), slot(%d)\n", ioc->name,
3640− (unsigned long long)
3641− pcie_device->enclosure_logical_id,
3642− pcie_device->slot));
3612+ dewtprintk(ioc,
3613+ ioc_info(ioc, "setting delete flag: logical id(0x%016llx), slot(%d)\n",
3614+ (u64)pcie_device->enclosure_logical_id,
3615+ pcie_device->slot));
36433616 if (pcie_device->connector_name[0] != '\0')
3644− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3645− "setting delete flag:, enclosure "
3646− "level(0x%04x), "
3647− "connector name( %s)\n", ioc->name,
3648− pcie_device->enclosure_level,
3649− pcie_device->connector_name));
3617+ dewtprintk(ioc,
3618+ ioc_info(ioc, "setting delete flag:, enclosure level(0x%04x), connector name( %s)\n",
3619+ pcie_device->enclosure_level,
3620+ pcie_device->connector_name));
36503621 }
36513622 _scsih_ublock_io_device(ioc, sas_address);
36523623 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
36603631 INIT_LIST_HEAD(&delayed_tr->list);
36613632 delayed_tr->handle = handle;
36623633 list_add_tail(&delayed_tr->list, &ioc->delayed_tr_list);
3663− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3664− "DELAYED:tr:handle(0x%04x), (open)\n",
3665− ioc->name, handle));
3634+ dewtprintk(ioc,
3635+ ioc_info(ioc, "DELAYED:tr:handle(0x%04x), (open)\n",
3636+ handle));
36663637 goto out;
36673638 }
36683639
3669− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3670− "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3671− ioc->name, handle, smid,
3672− ioc->tm_tr_cb_idx));
3640+ dewtprintk(ioc,
3641+ ioc_info(ioc, "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3642+ handle, smid, ioc->tm_tr_cb_idx));
36733643 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
36743644 memset(mpi_request, 0, sizeof(Mpi2SCSITaskManagementRequest_t));
36753645 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
37173687 struct _sc_list *delayed_sc;
37183688
37193689 if (ioc->pci_error_recovery) {
3720− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3721− "%s: host in pci error recovery\n", __func__,
3722− ioc->name));
3690+ dewtprintk(ioc,
3691+ ioc_info(ioc, "%s: host in pci error recovery\n",
3692+ __func__));
37233693 return 1;
37243694 }
37253695 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
37263696 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
3727− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3728− "%s: host is not operational\n", __func__, ioc->name));
3697+ dewtprintk(ioc,
3698+ ioc_info(ioc, "%s: host is not operational\n",
3699+ __func__));
37293700 return 1;
37303701 }
37313702 if (unlikely(!mpi_reply)) {
3732− pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",
3733− ioc->name, __FILE__, __LINE__, __func__);
3703+ ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
3704+ __FILE__, __LINE__, __func__);
37343705 return 1;
37353706 }
37363707 mpi_request_tm = mpt3sas_base_get_msg_frame(ioc, smid);
37373708 handle = le16_to_cpu(mpi_request_tm->DevHandle);
37383709 if (handle != le16_to_cpu(mpi_reply->DevHandle)) {
3739− dewtprintk(ioc, pr_err(MPT3SAS_FMT
3740− "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n",
3741− ioc->name, handle,
3742− le16_to_cpu(mpi_reply->DevHandle), smid));
3710+ dewtprintk(ioc,
3711+ ioc_err(ioc, "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n",
3712+ handle,
3713+ le16_to_cpu(mpi_reply->DevHandle), smid));
37433714 return 0;
37443715 }
37453716
37463717 mpt3sas_trigger_master(ioc, MASTER_TRIGGER_TASK_MANAGMENT);
3747− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3748− "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), "
3749− "loginfo(0x%08x), completed(%d)\n", ioc->name,
3750− handle, smid, le16_to_cpu(mpi_reply->IOCStatus),
3751− le32_to_cpu(mpi_reply->IOCLogInfo),
3752− le32_to_cpu(mpi_reply->TerminationCount)));
3718+ dewtprintk(ioc,
3719+ ioc_info(ioc, "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), loginfo(0x%08x), completed(%d)\n",
3720+ handle, smid, le16_to_cpu(mpi_reply->IOCStatus),
3721+ le32_to_cpu(mpi_reply->IOCLogInfo),
3722+ le32_to_cpu(mpi_reply->TerminationCount)));
37533723
37543724 smid_sas_ctrl = mpt3sas_base_get_smid(ioc, ioc->tm_sas_control_cb_idx);
37553725 if (!smid_sas_ctrl) {
@@ -3759,16 +3729,15 @@ _scsih_tm_tr_complete(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, · 3 unmodified lines
37593729 INIT_LIST_HEAD(&delayed_sc->list);
37603730 delayed_sc->handle = le16_to_cpu(mpi_request_tm->DevHandle);
37613731 list_add_tail(&delayed_sc->list, &ioc->delayed_sc_list);
3762− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3763− "DELAYED:sc:handle(0x%04x), (open)\n",
3764− ioc->name, handle));
3732+ dewtprintk(ioc,
3733+ ioc_info(ioc, "DELAYED:sc:handle(0x%04x), (open)\n",
3734+ handle));
37653735 return _scsih_check_for_pending_tm(ioc, smid);
37663736 }
37673737
3768− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3769− "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3770− ioc->name, handle, smid_sas_ctrl,
3771− ioc->tm_sas_control_cb_idx));
3738+ dewtprintk(ioc,
3739+ ioc_info(ioc, "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3740+ handle, smid_sas_ctrl, ioc->tm_sas_control_cb_idx));
37723741 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid_sas_ctrl);
37733742 memset(mpi_request, 0, sizeof(Mpi2SasIoUnitControlRequest_t));
37743743 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
38033772 mpt3sas_base_get_reply_virt_addr(ioc, reply);
38043773
38053774 if (likely(mpi_reply)) {
3806− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3807− "sc_complete:handle(0x%04x), (open) "
3808− "smid(%d), ioc_status(0x%04x), loginfo(0x%08x)\n",
3809− ioc->name, le16_to_cpu(mpi_reply->DevHandle), smid,
3810− le16_to_cpu(mpi_reply->IOCStatus),
3811− le32_to_cpu(mpi_reply->IOCLogInfo)));
3775+ dewtprintk(ioc,
3776+ ioc_info(ioc, "sc_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), loginfo(0x%08x)\n",
3777+ le16_to_cpu(mpi_reply->DevHandle), smid,
3778+ le16_to_cpu(mpi_reply->IOCStatus),
3779+ le32_to_cpu(mpi_reply->IOCLogInfo)));
38123780 if (le16_to_cpu(mpi_reply->IOCStatus) ==
38133781 MPI2_IOCSTATUS_SUCCESS) {
38143782 clear_bit(le16_to_cpu(mpi_reply->DevHandle),
38153783 ioc->device_remove_in_progress);
38163784 }
38173785 } else {
3818− pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",
3819− ioc->name, __FILE__, __LINE__, __func__);
3786+ ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
3787+ __FILE__, __LINE__, __func__);
38203788 }
38213789 return mpt3sas_check_for_pending_internal_cmds(ioc, smid);
38223790 }
@@ -3839,9 +3807,9 @@ _scsih_tm_tr_volume_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 16 unmodified lines
38393807 struct _tr_list *delayed_tr;
38403808
38413809 if (ioc->pci_error_recovery) {
3842− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3843− "%s: host reset in progress!\n",
3844− __func__, ioc->name));
3810+ dewtprintk(ioc,
3811+ ioc_info(ioc, "%s: host reset in progress!\n",
3812+ __func__));
38453813 return;
38463814 }
38473815
@@ -3853,16 +3821,15 @@ _scsih_tm_tr_volume_send(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 5 unmodified lines
38533821 INIT_LIST_HEAD(&delayed_tr->list);
38543822 delayed_tr->handle = handle;
38553823 list_add_tail(&delayed_tr->list, &ioc->delayed_tr_volume_list);
3856− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3857− "DELAYED:tr:handle(0x%04x), (open)\n",
3858− ioc->name, handle));
3824+ dewtprintk(ioc,
3825+ ioc_info(ioc, "DELAYED:tr:handle(0x%04x), (open)\n",
3826+ handle));
38593827 return;
38603828 }
38613829
3862− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3863− "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3864− ioc->name, handle, smid,
3865− ioc->tm_tr_volume_cb_idx));
3830+ dewtprintk(ioc,
3831+ ioc_info(ioc, "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3832+ handle, smid, ioc->tm_tr_volume_cb_idx));
38663833 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
38673834 memset(mpi_request, 0, sizeof(Mpi2SCSITaskManagementRequest_t));
38683835 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
38923859 mpt3sas_base_get_reply_virt_addr(ioc, reply);
38933860
38943861 if (ioc->shost_recovery || ioc->pci_error_recovery) {
3895− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3896− "%s: host reset in progress!\n",
3897− __func__, ioc->name));
3862+ dewtprintk(ioc,
3863+ ioc_info(ioc, "%s: host reset in progress!\n",
3864+ __func__));
38983865 return 1;
38993866 }
39003867 if (unlikely(!mpi_reply)) {
3901− pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",
3902− ioc->name, __FILE__, __LINE__, __func__);
3868+ ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
3869+ __FILE__, __LINE__, __func__);
39033870 return 1;
39043871 }
39053872
39063873 mpi_request_tm = mpt3sas_base_get_msg_frame(ioc, smid);
39073874 handle = le16_to_cpu(mpi_request_tm->DevHandle);
39083875 if (handle != le16_to_cpu(mpi_reply->DevHandle)) {
3909− dewtprintk(ioc, pr_err(MPT3SAS_FMT
3910− "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n",
3911− ioc->name, handle,
3912− le16_to_cpu(mpi_reply->DevHandle), smid));
3876+ dewtprintk(ioc,
3877+ ioc_err(ioc, "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n",
3878+ handle, le16_to_cpu(mpi_reply->DevHandle),
3879+ smid));
39133880 return 0;
39143881 }
39153882
3916− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3917− "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), "
3918− "loginfo(0x%08x), completed(%d)\n", ioc->name,
3919− handle, smid, le16_to_cpu(mpi_reply->IOCStatus),
3920− le32_to_cpu(mpi_reply->IOCLogInfo),
3921− le32_to_cpu(mpi_reply->TerminationCount)));
3883+ dewtprintk(ioc,
3884+ ioc_info(ioc, "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), loginfo(0x%08x), completed(%d)\n",
3885+ handle, smid, le16_to_cpu(mpi_reply->IOCStatus),
3886+ le32_to_cpu(mpi_reply->IOCLogInfo),
3887+ le32_to_cpu(mpi_reply->TerminationCount)));
39223888
39233889 return _scsih_check_for_pending_tm(ioc, smid);
39243890 }
@@ -3948,10 +3914,9 @@ _scsih_issue_delayed_event_ack(struct MPT3SAS_ADAPTER *ioc, u16 smid, U16 event, · 23 unmodified lines
39483914 ioc->internal_lookup[i].cb_idx = ioc->base_cb_idx;
39493915 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
39503916
3951− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3952− "EVENT ACK: event(0x%04x), smid(%d), cb(%d)\n",
3953− ioc->name, le16_to_cpu(event), smid,
3954− ioc->base_cb_idx));
3917+ dewtprintk(ioc,
3918+ ioc_info(ioc, "EVENT ACK: event(0x%04x), smid(%d), cb(%d)\n",
3919+ le16_to_cpu(event), smid, ioc->base_cb_idx));
39553920 ack_request = mpt3sas_base_get_msg_frame(ioc, smid);
39563921 memset(ack_request, 0, sizeof(Mpi2EventAckRequest_t));
39573922 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
39813946 unsigned long flags;
39823947
39833948 if (ioc->remove_host) {
3984− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3985− "%s: host has been removed\n",
3986− __func__, ioc->name));
3949+ dewtprintk(ioc,
3950+ ioc_info(ioc, "%s: host has been removed\n",
3951+ __func__));
39873952 return;
39883953 } else if (ioc->pci_error_recovery) {
3989− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3990− "%s: host in pci error recovery\n",
3991− __func__, ioc->name));
3954+ dewtprintk(ioc,
3955+ ioc_info(ioc, "%s: host in pci error recovery\n",
3956+ __func__));
39923957 return;
39933958 }
39943959 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
39953960 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
3996− dewtprintk(ioc, pr_info(MPT3SAS_FMT
3997− "%s: host is not operational\n",
3998− __func__, ioc->name));
3961+ dewtprintk(ioc,
3962+ ioc_info(ioc, "%s: host is not operational\n",
3963+ __func__));
39993964 return;
40003965 }
40013966
@@ -4007,10 +3972,9 @@ _scsih_issue_delayed_sas_io_unit_ctrl(struct MPT3SAS_ADAPTER *ioc, · 5 unmodified lines
40073972 ioc->internal_lookup[i].cb_idx = ioc->tm_sas_control_cb_idx;
40083973 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
40093974
4010− dewtprintk(ioc, pr_info(MPT3SAS_FMT
4011− "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
4012− ioc->name, handle, smid,
4013− ioc->tm_sas_control_cb_idx));
3975+ dewtprintk(ioc,
3976+ ioc_info(ioc, "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3977+ handle, smid, ioc->tm_sas_control_cb_idx));
40143978 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
40153979 memset(mpi_request, 0, sizeof(Mpi2SasIoUnitControlRequest_t));
40163980 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
41714135 MPI2_EVENT_SAS_TOPO_ES_RESPONDING) {
41724136 if (le16_to_cpu(local_event_data->ExpanderDevHandle) ==
41734137 expander_handle) {
4174− dewtprintk(ioc, pr_info(MPT3SAS_FMT
4175− "setting ignoring flag\n", ioc->name));
4138+ dewtprintk(ioc,
4139+ ioc_info(ioc, "setting ignoring flag\n"));
41764140 fw_event->ignore = 1;
41774141 }
41784142 }
@@ -4243,9 +4207,8 @@ _scsih_check_pcie_topo_remove_events(struct MPT3SAS_ADAPTER *ioc, · 64 unmodified lines
42434207 MPI2_EVENT_SAS_TOPO_ES_RESPONDING) {
42444208 if (le16_to_cpu(local_event_data->SwitchDevHandle) ==
42454209 switch_handle) {
4246− dewtprintk(ioc, pr_info(MPT3SAS_FMT
4247− "setting ignoring flag for switch event\n",
4248− ioc->name));
4210+ dewtprintk(ioc,
4211+ ioc_info(ioc, "setting ignoring flag for switch event\n"));
42494212 fw_event->ignore = 1;
42504213 }
42514214 }
@@ -4274,10 +4237,9 @@ _scsih_set_volume_delete_flag(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 22 unmodified lines
42744237 sas_target_priv_data =
42754238 raid_device->starget->hostdata;
42764239 sas_target_priv_data->deleted = 1;
4277− dewtprintk(ioc, pr_info(MPT3SAS_FMT
4278− "setting delete flag: handle(0x%04x), "
4279− "wwid(0x%016llx)\n", ioc->name, handle,
4280− (unsigned long long) raid_device->wwid));
4240+ dewtprintk(ioc,
4241+ ioc_info(ioc, "setting delete flag: handle(0x%04x), wwid(0x%016llx)\n",
4242+ handle, (u64)raid_device->wwid));
42814243 }
42824244 spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
42834245 }
@@ -4379,9 +4341,9 @@ _scsih_check_ir_config_unhide_events(struct MPT3SAS_ADAPTER *ioc, · 95 unmodified lines
43794341 INIT_LIST_HEAD(&delayed_tr->list);
43804342 delayed_tr->handle = handle;
43814343 list_add_tail(&delayed_tr->list, &ioc->delayed_tr_list);
4382− dewtprintk(ioc, pr_info(MPT3SAS_FMT
4383− "DELAYED:tr:handle(0x%04x), (open)\n", ioc->name,
4384− handle));
4344+ dewtprintk(ioc,
4345+ ioc_info(ioc, "DELAYED:tr:handle(0x%04x), (open)\n",
4346+ handle));
43854347 } else
43864348 _scsih_tm_tr_send(ioc, handle);
43874349 }
@@ -4424,15 +4386,14 @@ _scsih_temp_threshold_events(struct MPT3SAS_ADAPTER *ioc, · 36 unmodified lines
44244386 Mpi2EventDataTemperature_t *event_data)
44254387 {
44264388 if (ioc->temp_sensors_count >= event_data->SensorNum) {
4427− pr_err(MPT3SAS_FMT "Temperature Threshold flags %s%s%s%s"
4428− " exceeded for Sensor: %d !!!\n", ioc->name,
4429− ((le16_to_cpu(event_data->Status) & 0x1) == 1) ? "0 " : " ",
4430− ((le16_to_cpu(event_data->Status) & 0x2) == 2) ? "1 " : " ",
4431− ((le16_to_cpu(event_data->Status) & 0x4) == 4) ? "2 " : " ",
4432− ((le16_to_cpu(event_data->Status) & 0x8) == 8) ? "3 " : " ",
4433− event_data->SensorNum);
4434− pr_err(MPT3SAS_FMT "Current Temp In Celsius: %d\n",
4435− ioc->name, event_data->CurrentTemperature);
4389+ ioc_err(ioc, "Temperature Threshold flags %s%s%s%s exceeded for Sensor: %d !!!\n",
4390+ le16_to_cpu(event_data->Status) & 0x1 ? "0 " : " ",
4391+ le16_to_cpu(event_data->Status) & 0x2 ? "1 " : " ",
4392+ le16_to_cpu(event_data->Status) & 0x4 ? "2 " : " ",
4393+ le16_to_cpu(event_data->Status) & 0x8 ? "3 " : " ",
4394+ event_data->SensorNum);
4395+ ioc_err(ioc, "Current Temp In Celsius: %d\n",
4396+ event_data->CurrentTemperature);
44364397 }
44374398 }
44384399
@@ -4480,8 +4441,7 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc) · 41 unmodified lines
44804441 scmd->result = DID_RESET << 16;
44814442 scmd->scsi_done(scmd);
44824443 }
4483− dtmprintk(ioc, pr_info(MPT3SAS_FMT "completing %d cmds\n",
4484− ioc->name, count));
4444+ dtmprintk(ioc, ioc_info(ioc, "completing %d cmds\n", count));
44854445 }
44864446
44874447 /**
@@ -4680,8 +4640,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) · 192 unmodified lines
46804640
46814641 smid = mpt3sas_base_get_smid_scsiio(ioc, ioc->scsi_io_cb_idx, scmd);
46824642 if (!smid) {
4683− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
4684− ioc->name, __func__);
4643+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
46854644 _scsih_set_satl_pending(scmd, false);
46864645 goto out;
46874646 }
@@ -4919,37 +4878,28 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, · 231 unmodified lines
49194878 scsi_print_command(scmd);
49204879
49214880 if (priv_target->flags & MPT_TARGET_FLAGS_VOLUME) {
4922− pr_warn(MPT3SAS_FMT "\t%s wwid(0x%016llx)\n", ioc->name,
4923− device_str, (unsigned long long)priv_target->sas_address);
4881+ ioc_warn(ioc, "\t%s wwid(0x%016llx)\n",
4882+ device_str, (u64)priv_target->sas_address);
49244883 } else if (priv_target->flags & MPT_TARGET_FLAGS_PCIE_DEVICE) {
49254884 pcie_device = mpt3sas_get_pdev_from_target(ioc, priv_target);
49264885 if (pcie_device) {
4927− pr_info(MPT3SAS_FMT "\twwid(0x%016llx), port(%d)\n",
4928− ioc->name,
4929− (unsigned long long)pcie_device->wwid,
4930− pcie_device->port_num);
4886+ ioc_info(ioc, "\twwid(0x%016llx), port(%d)\n",
4887+ (u64)pcie_device->wwid, pcie_device->port_num);
49314888 if (pcie_device->enclosure_handle != 0)
4932− pr_info(MPT3SAS_FMT
4933− "\tenclosure logical id(0x%016llx), "
4934− "slot(%d)\n", ioc->name,
4935− (unsigned long long)
4936− pcie_device->enclosure_logical_id,
4937− pcie_device->slot);
4889+ ioc_info(ioc, "\tenclosure logical id(0x%016llx), slot(%d)\n",
4890+ (u64)pcie_device->enclosure_logical_id,
4891+ pcie_device->slot);
49384892 if (pcie_device->connector_name[0])
4939− pr_info(MPT3SAS_FMT
4940− "\tenclosure level(0x%04x),"
4941− "connector name( %s)\n",
4942− ioc->name, pcie_device->enclosure_level,
4943− pcie_device->connector_name);
4893+ ioc_info(ioc, "\tenclosure level(0x%04x), connector name( %s)\n",
4894+ pcie_device->enclosure_level,
4895+ pcie_device->connector_name);
49444896 pcie_device_put(pcie_device);
49454897 }
49464898 } else {
49474899 sas_device = mpt3sas_get_sdev_from_target(ioc, priv_target);
49484900 if (sas_device) {
4949− pr_warn(MPT3SAS_FMT
4950− "\tsas_address(0x%016llx), phy(%d)\n",
4951− ioc->name, (unsigned long long)
4952− sas_device->sas_address, sas_device->phy);
4901+ ioc_warn(ioc, "\tsas_address(0x%016llx), phy(%d)\n",
4902+ (u64)sas_device->sas_address, sas_device->phy);
49534903
49544904 _scsih_display_enclosure_chassis_info(ioc, sas_device,
49554905 NULL, NULL);
@@ -4958,30 +4908,23 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, · 2 unmodified lines
49584908 }
49594909 }
49604910
4961− pr_warn(MPT3SAS_FMT
4962− "\thandle(0x%04x), ioc_status(%s)(0x%04x), smid(%d)\n",
4963− ioc->name, le16_to_cpu(mpi_reply->DevHandle),
4964− desc_ioc_state, ioc_status, smid);
4965− pr_warn(MPT3SAS_FMT
4966− "\trequest_len(%d), underflow(%d), resid(%d)\n",
4967− ioc->name, scsi_bufflen(scmd), scmd->underflow,
4968− scsi_get_resid(scmd));
4969− pr_warn(MPT3SAS_FMT
4970− "\ttag(%d), transfer_count(%d), sc->result(0x%08x)\n",
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);
4911+ ioc_warn(ioc, "\thandle(0x%04x), ioc_status(%s)(0x%04x), smid(%d)\n",
4912+ le16_to_cpu(mpi_reply->DevHandle),
4913+ desc_ioc_state, ioc_status, smid);
4914+ ioc_warn(ioc, "\trequest_len(%d), underflow(%d), resid(%d)\n",
4915+ scsi_bufflen(scmd), scmd->underflow, scsi_get_resid(scmd));
4916+ ioc_warn(ioc, "\ttag(%d), transfer_count(%d), sc->result(0x%08x)\n",
4917+ le16_to_cpu(mpi_reply->TaskTag),
4918+ le32_to_cpu(mpi_reply->TransferCount), scmd->result);
4919+ ioc_warn(ioc, "\tscsi_status(%s)(0x%02x), scsi_state(%s)(0x%02x)\n",
4920+ desc_scsi_status, scsi_status, desc_scsi_state, scsi_state);
49774921
49784922 if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID) {
49794923 struct sense_info data;
49804924 _scsih_normalize_sense(scmd->sense_buffer, &data);
4981− pr_warn(MPT3SAS_FMT
4982− "\t[sense_key,asc,ascq]: [0x%02x,0x%02x,0x%02x], count(%d)\n",
4983− ioc->name, data.skey,
4984− data.asc, data.ascq, le32_to_cpu(mpi_reply->SenseCount));
4925+ ioc_warn(ioc, "\t[sense_key,asc,ascq]: [0x%02x,0x%02x,0x%02x], count(%d)\n",
4926+ data.skey, data.asc, data.ascq,
4927+ le32_to_cpu(mpi_reply->SenseCount));
49854928 }
49864929 if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) {
49874930 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
50164959 mpi_request.Flags = MPI2_SEP_REQ_FLAGS_DEVHANDLE_ADDRESS;
50174960 if ((mpt3sas_base_scsi_enclosure_processor(ioc, &mpi_reply,
50184961 &mpi_request)) != 0) {
5019− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name,
5020− __FILE__, __LINE__, __func__);
4962+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
4963+ __FILE__, __LINE__, __func__);
50214964 goto out;
50224965 }
50234966 sas_device->pfa_led_on = 1;
50244967
50254968 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {
5026− dewtprintk(ioc, pr_info(MPT3SAS_FMT
5027− "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",
5028− ioc->name, le16_to_cpu(mpi_reply.IOCStatus),
5029− le32_to_cpu(mpi_reply.IOCLogInfo)));
4969+ dewtprintk(ioc,
4970+ ioc_info(ioc, "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",
4971+ le16_to_cpu(mpi_reply.IOCStatus),
4972+ le32_to_cpu(mpi_reply.IOCLogInfo)));
50304973 goto out;
50314974 }
50324975 out:
@@ -5056,16 +4999,16 @@ _scsih_turn_off_pfa_led(struct MPT3SAS_ADAPTER *ioc, · 23 unmodified lines
50564999 mpi_request.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS;
50575000 if ((mpt3sas_base_scsi_enclosure_processor(ioc, &mpi_reply,
50585001 &mpi_request)) != 0) {
5059− printk(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name,
5060− __FILE__, __LINE__, __func__);
5002+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5003+ __FILE__, __LINE__, __func__);
50615004 return;
50625005 }
50635006
50645007 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {
5065− dewtprintk(ioc, printk(MPT3SAS_FMT
5066− "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",
5067− ioc->name, le16_to_cpu(mpi_reply.IOCStatus),
5068− le32_to_cpu(mpi_reply.IOCLogInfo)));
5008+ dewtprintk(ioc,
5009+ ioc_info(ioc, "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",
5010+ le16_to_cpu(mpi_reply.IOCStatus),
5011+ le32_to_cpu(mpi_reply.IOCLogInfo)));
50695012 return;
50705013 }
50715014 }
@@ -5133,8 +5076,8 @@ _scsih_smart_predicted_fault(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 61 unmodified lines
51335076 sizeof(Mpi2EventDataSasDeviceStatusChange_t);
51345077 event_reply = kzalloc(sz, GFP_KERNEL);
51355078 if (!event_reply) {
5136− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5137− ioc->name, __FILE__, __LINE__, __func__);
5079+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5080+ __FILE__, __LINE__, __func__);
51385081 goto out;
51395082 }
51405083
@@ -5424,16 +5367,16 @@ _scsih_sas_host_refresh(struct MPT3SAS_ADAPTER *ioc) · 283 unmodified lines
54245367 u16 attached_handle;
54255368 u8 link_rate;
54265369
5427− dtmprintk(ioc, pr_info(MPT3SAS_FMT
5428− "updating handles for sas_host(0x%016llx)\n",
5429− ioc->name, (unsigned long long)ioc->sas_hba.sas_address));
5370+ dtmprintk(ioc,
5371+ ioc_info(ioc, "updating handles for sas_host(0x%016llx)\n",
5372+ (u64)ioc->sas_hba.sas_address));
54305373
54315374 sz = offsetof(Mpi2SasIOUnitPage0_t, PhyData) + (ioc->sas_hba.num_phys
54325375 * sizeof(Mpi2SasIOUnit0PhyData_t));
54335376 sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL);
54345377 if (!sas_iounit_pg0) {
5435− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5436− ioc->name, __FILE__, __LINE__, __func__);
5378+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5379+ __FILE__, __LINE__, __func__);
54375380 return;
54385381 }
54395382
@@ -5483,15 +5426,15 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 43 unmodified lines
54835426
54845427 mpt3sas_config_get_number_hba_phys(ioc, &num_phys);
54855428 if (!num_phys) {
5486− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5487− ioc->name, __FILE__, __LINE__, __func__);
5429+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5430+ __FILE__, __LINE__, __func__);
54885431 return;
54895432 }
54905433 ioc->sas_hba.phy = kcalloc(num_phys,
54915434 sizeof(struct _sas_phy), GFP_KERNEL);
54925435 if (!ioc->sas_hba.phy) {
5493− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5494− ioc->name, __FILE__, __LINE__, __func__);
5436+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5437+ __FILE__, __LINE__, __func__);
54955438 goto out;
54965439 }
54975440 ioc->sas_hba.num_phys = num_phys;
@@ -5501,21 +5444,21 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
55015444 sizeof(Mpi2SasIOUnit0PhyData_t));
55025445 sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL);
55035446 if (!sas_iounit_pg0) {
5504− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5505− ioc->name, __FILE__, __LINE__, __func__);
5447+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5448+ __FILE__, __LINE__, __func__);
55065449 return;
55075450 }
55085451 if ((mpt3sas_config_get_sas_iounit_pg0(ioc, &mpi_reply,
55095452 sas_iounit_pg0, sz))) {
5510− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5511− ioc->name, __FILE__, __LINE__, __func__);
5453+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5454+ __FILE__, __LINE__, __func__);
55125455 goto out;
55135456 }
55145457 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
55155458 MPI2_IOCSTATUS_MASK;
55165459 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5517− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5518− ioc->name, __FILE__, __LINE__, __func__);
5460+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5461+ __FILE__, __LINE__, __func__);
55195462 goto out;
55205463 }
55215464
@@ -5524,21 +5467,21 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
55245467 sizeof(Mpi2SasIOUnit1PhyData_t));
55255468 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
55265469 if (!sas_iounit_pg1) {
5527− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5528− ioc->name, __FILE__, __LINE__, __func__);
5470+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5471+ __FILE__, __LINE__, __func__);
55295472 goto out;
55305473 }
55315474 if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
55325475 sas_iounit_pg1, sz))) {
5533− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5534− ioc->name, __FILE__, __LINE__, __func__);
5476+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5477+ __FILE__, __LINE__, __func__);
55355478 goto out;
55365479 }
55375480 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
55385481 MPI2_IOCSTATUS_MASK;
55395482 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5540− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5541− ioc->name, __FILE__, __LINE__, __func__);
5483+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5484+ __FILE__, __LINE__, __func__);
55425485 goto out;
55435486 }
55445487
@@ -5557,15 +5500,15 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 12 unmodified lines
55575500 for (i = 0; i < ioc->sas_hba.num_phys ; i++) {
55585501 if ((mpt3sas_config_get_phy_pg0(ioc, &mpi_reply, &phy_pg0,
55595502 i))) {
5560− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5561− ioc->name, __FILE__, __LINE__, __func__);
5503+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5504+ __FILE__, __LINE__, __func__);
55625505 goto out;
55635506 }
55645507 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
55655508 MPI2_IOCSTATUS_MASK;
55665509 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5567− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5568− ioc->name, __FILE__, __LINE__, __func__);
5510+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5511+ __FILE__, __LINE__, __func__);
55695512 goto out;
55705513 }
55715514
@@ -5579,18 +5522,17 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines
55795522 }
55805523 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
55815524 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, ioc->sas_hba.handle))) {
5582− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5583− ioc->name, __FILE__, __LINE__, __func__);
5525+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5526+ __FILE__, __LINE__, __func__);
55845527 goto out;
55855528 }
55865529 ioc->sas_hba.enclosure_handle =
55875530 le16_to_cpu(sas_device_pg0.EnclosureHandle);
55885531 ioc->sas_hba.sas_address = le64_to_cpu(sas_device_pg0.SASAddress);
5589− pr_info(MPT3SAS_FMT
5590− "host_add: handle(0x%04x), sas_addr(0x%016llx), phys(%d)\n",
5591− ioc->name, ioc->sas_hba.handle,
5592− (unsigned long long) ioc->sas_hba.sas_address,
5593− ioc->sas_hba.num_phys) ;
5532+ ioc_info(ioc, "host_add: handle(0x%04x), sas_addr(0x%016llx), phys(%d)\n",
5533+ ioc->sas_hba.handle,
5534+ (u64)ioc->sas_hba.sas_address,
5535+ ioc->sas_hba.num_phys);
55945536
55955537 if (ioc->sas_hba.enclosure_handle) {
55965538 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
56395581
56405582 if ((mpt3sas_config_get_expander_pg0(ioc, &mpi_reply, &expander_pg0,
56415583 MPI2_SAS_EXPAND_PGAD_FORM_HNDL, handle))) {
5642− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5643− ioc->name, __FILE__, __LINE__, __func__);
5584+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5585+ __FILE__, __LINE__, __func__);
56445586 return -1;
56455587 }
56465588
56475589 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
56485590 MPI2_IOCSTATUS_MASK;
56495591 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5650− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5651− ioc->name, __FILE__, __LINE__, __func__);
5592+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5593+ __FILE__, __LINE__, __func__);
56525594 return -1;
56535595 }
56545596
@@ -5656,8 +5598,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 1 unmodified line
56565598 parent_handle = le16_to_cpu(expander_pg0.ParentDevHandle);
56575599 if (_scsih_get_sas_address(ioc, parent_handle, &sas_address_parent)
56585600 != 0) {
5659− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5660− ioc->name, __FILE__, __LINE__, __func__);
5601+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5602+ __FILE__, __LINE__, __func__);
56615603 return -1;
56625604 }
56635605 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
56845626 sas_expander = kzalloc(sizeof(struct _sas_node),
56855627 GFP_KERNEL);
56865628 if (!sas_expander) {
5687− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5688− ioc->name, __FILE__, __LINE__, __func__);
5629+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5630+ __FILE__, __LINE__, __func__);
56895631 return -1;
56905632 }
56915633
@@ -5694,18 +5636,17 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 2 unmodified lines
56945636 sas_expander->sas_address_parent = sas_address_parent;
56955637 sas_expander->sas_address = sas_address;
56965638
5697− pr_info(MPT3SAS_FMT "expander_add: handle(0x%04x)," \
5698− " parent(0x%04x), sas_addr(0x%016llx), phys(%d)\n", ioc->name,
5699− handle, parent_handle, (unsigned long long)
5700− sas_expander->sas_address, sas_expander->num_phys);
5639+ ioc_info(ioc, "expander_add: handle(0x%04x), parent(0x%04x), sas_addr(0x%016llx), phys(%d)\n",
5640+ handle, parent_handle,
5641+ (u64)sas_expander->sas_address, sas_expander->num_phys);
57015642
57025643 if (!sas_expander->num_phys)
57035644 goto out_fail;
57045645 sas_expander->phy = kcalloc(sas_expander->num_phys,
57055646 sizeof(struct _sas_phy), GFP_KERNEL);
57065647 if (!sas_expander->phy) {
5707− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5708− ioc->name, __FILE__, __LINE__, __func__);
5648+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5649+ __FILE__, __LINE__, __func__);
57095650 rc = -1;
57105651 goto out_fail;
57115652 }
@@ -5714,8 +5655,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 2 unmodified lines
57145655 mpt3sas_port = mpt3sas_transport_port_add(ioc, handle,
57155656 sas_address_parent);
57165657 if (!mpt3sas_port) {
5717− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5718− ioc->name, __FILE__, __LINE__, __func__);
5658+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5659+ __FILE__, __LINE__, __func__);
57195660 rc = -1;
57205661 goto out_fail;
57215662 }
@@ -5724,8 +5665,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 2 unmodified lines
57245665 for (i = 0 ; i < sas_expander->num_phys ; i++) {
57255666 if ((mpt3sas_config_get_expander_pg1(ioc, &mpi_reply,
57265667 &expander_pg1, i, handle))) {
5727− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5728− ioc->name, __FILE__, __LINE__, __func__);
5668+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5669+ __FILE__, __LINE__, __func__);
57295670 rc = -1;
57305671 goto out_fail;
57315672 }
@@ -5735,8 +5676,8 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 3 unmodified lines
57355676 if ((mpt3sas_transport_add_expander_phy(ioc,
57365677 &sas_expander->phy[i], expander_pg1,
57375678 sas_expander->parent_dev))) {
5738− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5739− ioc->name, __FILE__, __LINE__, __func__);
5679+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5680+ __FILE__, __LINE__, __func__);
57405681 rc = -1;
57415682 goto out_fail;
57425683 }
@@ -5883,9 +5824,8 @@ _scsih_check_access_status(struct MPT3SAS_ADAPTER *ioc, u64 sas_address, · 140 unmodified lines
58835824 if (!rc)
58845825 return 0;
58855826
5886− pr_err(MPT3SAS_FMT
5887− "discovery errors(%s): sas_address(0x%016llx), handle(0x%04x)\n",
5888− ioc->name, desc, (unsigned long long)sas_address, handle);
5827+ ioc_err(ioc, "discovery errors(%s): sas_address(0x%016llx), handle(0x%04x)\n",
5828+ desc, (u64)sas_address, handle);
58895829 return rc;
58905830 }
58915831
@@ -5979,9 +5919,8 @@ _scsih_check_device(struct MPT3SAS_ADAPTER *ioc, · 87 unmodified lines
59795919 /* check if device is present */
59805920 if (!(le16_to_cpu(sas_device_pg0.Flags) &
59815921 MPI2_SAS_DEVICE0_FLAGS_DEVICE_PRESENT)) {
5982− pr_err(MPT3SAS_FMT
5983− "device is not present handle(0x%04x), flags!!!\n",
5984− ioc->name, handle);
5922+ ioc_err(ioc, "device is not present handle(0x%04x), flags!!!\n",
5923+ handle);
59855924 goto out_unlock;
59865925 }
59875926
@@ -6028,16 +5967,16 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, · 40 unmodified lines
60285967
60295968 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
60305969 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
6031− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6032− ioc->name, __FILE__, __LINE__, __func__);
5970+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5971+ __FILE__, __LINE__, __func__);
60335972 return -1;
60345973 }
60355974
60365975 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
60375976 MPI2_IOCSTATUS_MASK;
60385977 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
6039− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6040− ioc->name, __FILE__, __LINE__, __func__);
5978+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5979+ __FILE__, __LINE__, __func__);
60415980 return -1;
60425981 }
60435982
@@ -6051,8 +5990,8 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, · 7 unmodified lines
60515990 /* check if device is present */
60525991 if (!(le16_to_cpu(sas_device_pg0.Flags) &
60535992 MPI2_SAS_DEVICE0_FLAGS_DEVICE_PRESENT)) {
6054− pr_err(MPT3SAS_FMT "device is not present handle(0x04%x)!!!\n",
6055− ioc->name, handle);
5993+ ioc_err(ioc, "device is not present handle(0x04%x)!!!\n",
5994+ handle);
60565995 return -1;
60575996 }
60585997
@@ -6074,16 +6013,15 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, · 15 unmodified lines
60746013 mpt3sas_scsih_enclosure_find_by_handle(ioc,
60756014 le16_to_cpu(sas_device_pg0.EnclosureHandle));
60766015 if (enclosure_dev == NULL)
6077− pr_info(MPT3SAS_FMT "Enclosure handle(0x%04x)"
6078− "doesn't match with enclosure device!\n",
6079− ioc->name, sas_device_pg0.EnclosureHandle);
6016+ ioc_info(ioc, "Enclosure handle(0x%04x) doesn't match with enclosure device!\n",
6017+ sas_device_pg0.EnclosureHandle);
60806018 }
60816019
60826020 sas_device = kzalloc(sizeof(struct _sas_device),
60836021 GFP_KERNEL);
60846022 if (!sas_device) {
6085− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6086− ioc->name, __FILE__, __LINE__, __func__);
6023+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6024+ __FILE__, __LINE__, __func__);
60876025 return 0;
60886026 }
60896027
@@ -6092,8 +6030,8 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, · 2 unmodified lines
60926030 if (_scsih_get_sas_address(ioc,
60936031 le16_to_cpu(sas_device_pg0.ParentDevHandle),
60946032 &sas_device->sas_address_parent) != 0)
6095− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6096− ioc->name, __FILE__, __LINE__, __func__);
6033+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6034+ __FILE__, __LINE__, __func__);
60976035 sas_device->enclosure_handle =
60986036 le16_to_cpu(sas_device_pg0.EnclosureHandle);
60996037 if (sas_device->enclosure_handle != 0)
@@ -6158,11 +6096,10 @@ _scsih_remove_device(struct MPT3SAS_ADAPTER *ioc, · 58 unmodified lines
61586096 sas_device->pfa_led_on = 0;
61596097 }
61606098
6161− dewtprintk(ioc, pr_info(MPT3SAS_FMT
6162− "%s: enter: handle(0x%04x), sas_addr(0x%016llx)\n",
6163− ioc->name, __func__,
6164− sas_device->handle, (unsigned long long)
6165− sas_device->sas_address));
6099+ dewtprintk(ioc,
6100+ ioc_info(ioc, "%s: enter: handle(0x%04x), sas_addr(0x%016llx)\n",
6101+ __func__,
6102+ sas_device->handle, (u64)sas_device->sas_address));
61666103
61676104 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,
61686105 NULL, NULL));
@@ -6180,18 +6117,15 @@ _scsih_remove_device(struct MPT3SAS_ADAPTER *ioc, · 11 unmodified lines
61806117 sas_device->sas_address,
61816118 sas_device->sas_address_parent);
61826119
6183− pr_info(MPT3SAS_FMT
6184− "removing handle(0x%04x), sas_addr(0x%016llx)\n",
6185− ioc->name, sas_device->handle,
6186− (unsigned long long) sas_device->sas_address);
6120+ ioc_info(ioc, "removing handle(0x%04x), sas_addr(0x%016llx)\n",
6121+ sas_device->handle, (u64)sas_device->sas_address);
61876122
61886123 _scsih_display_enclosure_chassis_info(ioc, sas_device, NULL, NULL);
61896124
6190− dewtprintk(ioc, pr_info(MPT3SAS_FMT
6191− "%s: exit: handle(0x%04x), sas_addr(0x%016llx)\n",
6192− ioc->name, __func__,
6193− sas_device->handle, (unsigned long long)
6194− sas_device->sas_address));
6125+ dewtprintk(ioc,
6126+ ioc_info(ioc, "%s: exit: handle(0x%04x), sas_addr(0x%016llx)\n",
6127+ __func__,
6128+ sas_device->handle, (u64)sas_device->sas_address));
61956129 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,
61966130 NULL, NULL));
61976131 }
@@ -6231,8 +6165,7 @@ _scsih_sas_topology_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 33 unmodified lines
62316165 status_str = "unknown status";
62326166 break;
62336167 }
6234− pr_info(MPT3SAS_FMT "sas topology change: (%s)\n",
6235− ioc->name, status_str);
6168+ ioc_info(ioc, "sas topology change: (%s)\n", status_str);
62366169 pr_info("\thandle(0x%04x), enclosure_handle(0x%04x) " \
62376170 "start_phy(%02d), count(%d)\n",
62386171 le16_to_cpu(event_data->ExpanderDevHandle),
@@ -6309,8 +6242,7 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, · 70 unmodified lines
63096242 _scsih_sas_host_refresh(ioc);
63106243
63116244 if (fw_event->ignore) {
6312− dewtprintk(ioc, pr_info(MPT3SAS_FMT
6313− "ignoring expander event\n", ioc->name));
6245+ dewtprintk(ioc, ioc_info(ioc, "ignoring expander event\n"));
63146246 return 0;
63156247 }
63166248
@@ -6339,8 +6271,8 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, · 22 unmodified lines
63396271 /* handle siblings events */
63406272 for (i = 0; i < event_data->NumEntries; i++) {
63416273 if (fw_event->ignore) {
6342− dewtprintk(ioc, pr_info(MPT3SAS_FMT
6343− "ignoring expander event\n", ioc->name));
6274+ dewtprintk(ioc,
6275+ ioc_info(ioc, "ignoring expander event\n"));
63446276 return 0;
63456277 }
63466278 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
64646396 reason_str = "unknown reason";
64656397 break;
64666398 }
6467− pr_info(MPT3SAS_FMT "device status change: (%s)\n"
6468− "\thandle(0x%04x), sas address(0x%016llx), tag(%d)",
6469− ioc->name, reason_str, le16_to_cpu(event_data->DevHandle),
6470− (unsigned long long)le64_to_cpu(event_data->SASAddress),
6471− le16_to_cpu(event_data->TaskTag));
6399+ ioc_info(ioc, "device status change: (%s)\thandle(0x%04x), sas address(0x%016llx), tag(%d)",
6400+ reason_str, le16_to_cpu(event_data->DevHandle),
6401+ (u64)le64_to_cpu(event_data->SASAddress),
6402+ le16_to_cpu(event_data->TaskTag));
64726403 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,
6474− event_data->ASC, event_data->ASCQ);
6475− pr_info("\n");
6404+ pr_cont(", ASC(0x%x), ASCQ(0x%x)\n",
6405+ event_data->ASC, event_data->ASCQ);
6406+ pr_cont("\n");
64766407 }
64776408
64786409 /**
@@ -6605,20 +6536,16 @@ _scsih_check_pcie_access_status(struct MPT3SAS_ADAPTER *ioc, u64 wwid, · 126 unmodified lines
66056536 desc = "nvme failure status";
66066537 break;
66076538 default:
6608− pr_err(MPT3SAS_FMT
6609− " NVMe discovery error(0x%02x): wwid(0x%016llx),"
6610− "handle(0x%04x)\n", ioc->name, access_status,
6611− (unsigned long long)wwid, handle);
6539+ ioc_err(ioc, "NVMe discovery error(0x%02x): wwid(0x%016llx), handle(0x%04x)\n",
6540+ access_status, (u64)wwid, handle);
66126541 return rc;
66136542 }
66146543
66156544 if (!rc)
66166545 return rc;
66176546
6618− pr_info(MPT3SAS_FMT
6619− "NVMe discovery error(%s): wwid(0x%016llx), handle(0x%04x)\n",
6620− ioc->name, desc,
6621− (unsigned long long)wwid, handle);
6547+ ioc_info(ioc, "NVMe discovery error(%s): wwid(0x%016llx), handle(0x%04x)\n",
6548+ desc, (u64)wwid, handle);
66226549 return rc;
66236550 }
66246551
@@ -6634,22 +6561,22 @@ _scsih_pcie_device_remove_from_sml(struct MPT3SAS_ADAPTER *ioc, · 9 unmodified lines
66346561 {
66356562 struct MPT3SAS_TARGET *sas_target_priv_data;
66366563
6637− dewtprintk(ioc, pr_info(MPT3SAS_FMT
6638− "%s: enter: handle(0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,
6639− pcie_device->handle, (unsigned long long)
6640− pcie_device->wwid));
6564+ dewtprintk(ioc,
6565+ ioc_info(ioc, "%s: enter: handle(0x%04x), wwid(0x%016llx)\n",
6566+ __func__,
6567+ pcie_device->handle, (u64)pcie_device->wwid));
66416568 if (pcie_device->enclosure_handle != 0)
6642− dewtprintk(ioc, pr_info(MPT3SAS_FMT
6643− "%s: enter: enclosure logical id(0x%016llx), slot(%d)\n",
6644− ioc->name, __func__,
6645− (unsigned long long)pcie_device->enclosure_logical_id,
6646− pcie_device->slot));
6569+ dewtprintk(ioc,
6570+ ioc_info(ioc, "%s: enter: enclosure logical id(0x%016llx), slot(%d)\n",
6571+ __func__,
6572+ (u64)pcie_device->enclosure_logical_id,
6573+ pcie_device->slot));
66476574 if (pcie_device->connector_name[0] != '\0')
6648− dewtprintk(ioc, pr_info(MPT3SAS_FMT
6649− "%s: enter: enclosure level(0x%04x), connector name( %s)\n",
6650− ioc->name, __func__,
6651− pcie_device->enclosure_level,
6652− pcie_device->connector_name));
6575+ dewtprintk(ioc,
6576+ ioc_info(ioc, "%s: enter: enclosure level(0x%04x), connector name(%s)\n",
6577+ __func__,
6578+ pcie_device->enclosure_level,
6579+ pcie_device->connector_name));
66536580
66546581 if (pcie_device->starget && pcie_device->starget->hostdata) {
66556582 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
66586585 sas_target_priv_data->handle = MPT3SAS_INVALID_DEVICE_HANDLE;
66596586 }
66606587
6661− pr_info(MPT3SAS_FMT
6662− "removing handle(0x%04x), wwid (0x%016llx)\n",
6663− ioc->name, pcie_device->handle,
6664− (unsigned long long) pcie_device->wwid);
6588+ ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n",
6589+ pcie_device->handle, (u64)pcie_device->wwid);
66656590 if (pcie_device->enclosure_handle != 0)
6666− pr_info(MPT3SAS_FMT
6667− "removing : enclosure logical id(0x%016llx), slot(%d)\n",
6668− ioc->name,
6669− (unsigned long long)pcie_device->enclosure_logical_id,
6670− pcie_device->slot);
6591+ ioc_info(ioc, "removing : enclosure logical id(0x%016llx), slot(%d)\n",
6592+ (u64)pcie_device->enclosure_logical_id,
6593+ pcie_device->slot);
66716594 if (pcie_device->connector_name[0] != '\0')
6672− pr_info(MPT3SAS_FMT
6673− "removing: enclosure level(0x%04x), connector name( %s)\n",
6674− ioc->name, pcie_device->enclosure_level,
6675− pcie_device->connector_name);
6595+ ioc_info(ioc, "removing: enclosure level(0x%04x), connector name( %s)\n",
6596+ pcie_device->enclosure_level,
6597+ pcie_device->connector_name);
66766598
66776599 if (pcie_device->starget)
66786600 scsi_remove_target(&pcie_device->starget->dev);
6679− dewtprintk(ioc, pr_info(MPT3SAS_FMT
6680− "%s: exit: handle(0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,
6681− pcie_device->handle, (unsigned long long)
6682− pcie_device->wwid));
6601+ dewtprintk(ioc,
6602+ ioc_info(ioc, "%s: exit: handle(0x%04x), wwid(0x%016llx)\n",
6603+ __func__,
6604+ pcie_device->handle, (u64)pcie_device->wwid));
66836605 if (pcie_device->enclosure_handle != 0)
6684− dewtprintk(ioc, pr_info(MPT3SAS_FMT
6685− "%s: exit: enclosure logical id(0x%016llx), slot(%d)\n",
6686− ioc->name, __func__,
6687− (unsigned long long)pcie_device->enclosure_logical_id,
6688− pcie_device->slot));
6606+ dewtprintk(ioc,
6607+ ioc_info(ioc, "%s: exit: enclosure logical id(0x%016llx), slot(%d)\n",
6608+ __func__,
6609+ (u64)pcie_device->enclosure_logical_id,
6610+ pcie_device->slot));
66896611 if (pcie_device->connector_name[0] != '\0')
6690− dewtprintk(ioc, pr_info(MPT3SAS_FMT
6691− "%s: exit: enclosure level(0x%04x), connector name( %s)\n",
6692− ioc->name, __func__, pcie_device->enclosure_level,
6693− pcie_device->connector_name));
6612+ dewtprintk(ioc,
6613+ ioc_info(ioc, "%s: exit: enclosure level(0x%04x), connector name( %s)\n",
6614+ __func__,
6615+ pcie_device->enclosure_level,
6616+ pcie_device->connector_name));
66946617
66956618 kfree(pcie_device->serial_number);
66966619 }
@@ -6760,9 +6683,8 @@ _scsih_pcie_check_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 63 unmodified lines
67606683 /* check if device is present */
67616684 if (!(le32_to_cpu(pcie_device_pg0.Flags) &
67626685 MPI26_PCIEDEV0_FLAGS_DEVICE_PRESENT)) {
6763− pr_info(MPT3SAS_FMT
6764− "device is not present handle(0x%04x), flags!!!\n",
6765− ioc->name, handle);
6686+ ioc_info(ioc, "device is not present handle(0x%04x), flags!!!\n",
6687+ handle);
67666688 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
67676689 pcie_device_put(pcie_device);
67686690 return;
@@ -6806,16 +6728,15 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 37 unmodified lines
68066728
68076729 if ((mpt3sas_config_get_pcie_device_pg0(ioc, &mpi_reply,
68086730 &pcie_device_pg0, MPI26_PCIE_DEVICE_PGAD_FORM_HANDLE, handle))) {
6809− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6810− ioc->name, __FILE__, __LINE__, __func__);
6731+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6732+ __FILE__, __LINE__, __func__);
68116733 return 0;
68126734 }
68136735 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
68146736 MPI2_IOCSTATUS_MASK;
68156737 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
6816− pr_err(MPT3SAS_FMT
6817− "failure at %s:%d/%s()!\n",
6818− ioc->name, __FILE__, __LINE__, __func__);
6738+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6739+ __FILE__, __LINE__, __func__);
68196740 return 0;
68206741 }
68216742
@@ -6825,9 +6746,8 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 3 unmodified lines
68256746 /* check if device is present */
68266747 if (!(le32_to_cpu(pcie_device_pg0.Flags) &
68276748 MPI26_PCIEDEV0_FLAGS_DEVICE_PRESENT)) {
6828− pr_err(MPT3SAS_FMT
6829− "device is not present handle(0x04%x)!!!\n",
6830− ioc->name, handle);
6749+ ioc_err(ioc, "device is not present handle(0x04%x)!!!\n",
6750+ handle);
68316751 return 0;
68326752 }
68336753
@@ -6848,8 +6768,8 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 14 unmodified lines
68486768
68496769 pcie_device = kzalloc(sizeof(struct _pcie_device), GFP_KERNEL);
68506770 if (!pcie_device) {
6851− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6852− ioc->name, __FILE__, __LINE__, __func__);
6771+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6772+ __FILE__, __LINE__, __func__);
68536773 return 0;
68546774 }
68556775
@@ -6890,16 +6810,16 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 34 unmodified lines
68906810 /* TODO -- Add device name once FW supports it */
68916811 if (mpt3sas_config_get_pcie_device_pg2(ioc, &mpi_reply,
68926812 &pcie_device_pg2, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle)) {
6893− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6894− ioc->name, __FILE__, __LINE__, __func__);
6813+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6814+ __FILE__, __LINE__, __func__);
68956815 kfree(pcie_device);
68966816 return 0;
68976817 }
68986818
68996819 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK;
69006820 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
6901− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6902− ioc->name, __FILE__, __LINE__, __func__);
6821+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6822+ __FILE__, __LINE__, __func__);
69036823 kfree(pcie_device);
69046824 return 0;
69056825 }
@@ -6956,8 +6876,7 @@ _scsih_pcie_topology_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 50 unmodified lines
69566876 status_str = "unknown status";
69576877 break;
69586878 }
6959− pr_info(MPT3SAS_FMT "pcie topology change: (%s)\n",
6960− ioc->name, status_str);
6879+ ioc_info(ioc, "pcie topology change: (%s)\n", status_str);
69616880 pr_info("\tswitch_handle(0x%04x), enclosure_handle(0x%04x)"
69626881 "start_port(%02d), count(%d)\n",
69636882 le16_to_cpu(event_data->SwitchDevHandle),
@@ -7030,16 +6949,15 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc, · 66 unmodified lines
70306949 return;
70316950
70326951 if (fw_event->ignore) {
7033− dewtprintk(ioc, pr_info(MPT3SAS_FMT "ignoring switch event\n",
7034− ioc->name));
6952+ dewtprintk(ioc, ioc_info(ioc, "ignoring switch event\n"));
70356953 return;
70366954 }
70376955
70386956 /* handle siblings events */
70396957 for (i = 0; i < event_data->NumEntries; i++) {
70406958 if (fw_event->ignore) {
7041− dewtprintk(ioc, pr_info(MPT3SAS_FMT
7042− "ignoring switch event\n", ioc->name));
6959+ dewtprintk(ioc,
6960+ ioc_info(ioc, "ignoring switch event\n"));
70436961 return;
70446962 }
70456963 if (ioc->remove_host || ioc->pci_error_recovery)
@@ -7084,9 +7002,9 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc, · 38 unmodified lines
70847002 if (!test_bit(handle, ioc->pend_os_device_add))
70857003 break;
70867004
7087− dewtprintk(ioc, pr_info(MPT3SAS_FMT
7088− "handle(0x%04x) device not found: convert "
7089− "event to a device add\n", ioc->name, handle));
7005+ dewtprintk(ioc,
7006+ ioc_info(ioc, "handle(0x%04x) device not found: convert event to a device add\n",
7007+ handle));
70907008 event_data->PortEntry[i].PortStatus &= 0xF0;
70917009 event_data->PortEntry[i].PortStatus |=
70927010 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
71697087 break;
71707088 }
71717089
7172− pr_info(MPT3SAS_FMT "PCIE device status change: (%s)\n"
7173− "\thandle(0x%04x), WWID(0x%016llx), tag(%d)",
7174− ioc->name, reason_str, le16_to_cpu(event_data->DevHandle),
7175− (unsigned long long)le64_to_cpu(event_data->WWID),
7176− le16_to_cpu(event_data->TaskTag));
7090+ ioc_info(ioc, "PCIE device status change: (%s)\n"
7091+ "\thandle(0x%04x), WWID(0x%016llx), tag(%d)",
7092+ reason_str, le16_to_cpu(event_data->DevHandle),
7093+ (u64)le64_to_cpu(event_data->WWID),
7094+ le16_to_cpu(event_data->TaskTag));
71777095 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",
71797097 event_data->ASC, event_data->ASCQ);
7180− pr_info("\n");
7098+ pr_cont("\n");
71817099 }
71827100
71837101 /**
@@ -7255,12 +7173,12 @@ _scsih_sas_enclosure_dev_status_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 71 unmodified lines
72557173 break;
72567174 }
72577175
7258− pr_info(MPT3SAS_FMT "enclosure status change: (%s)\n"
7259− "\thandle(0x%04x), enclosure logical id(0x%016llx)"
7260− " number slots(%d)\n", ioc->name, reason_str,
7261− le16_to_cpu(event_data->EnclosureHandle),
7262− (unsigned long long)le64_to_cpu(event_data->EnclosureLogicalID),
7263− le16_to_cpu(event_data->StartSlot));
7176+ ioc_info(ioc, "enclosure status change: (%s)\n"
7177+ "\thandle(0x%04x), enclosure logical id(0x%016llx) number slots(%d)\n",
7178+ reason_str,
7179+ le16_to_cpu(event_data->EnclosureHandle),
7180+ (u64)le64_to_cpu(event_data->EnclosureLogicalID),
7181+ le16_to_cpu(event_data->StartSlot));
72647182 }
72657183
72667184 /**
@@ -7298,9 +7216,8 @@ _scsih_sas_enclosure_dev_status_change_event(struct MPT3SAS_ADAPTER *ioc, · 31 unmodified lines
72987216 kzalloc(sizeof(struct _enclosure_node),
72997217 GFP_KERNEL);
73007218 if (!enclosure_dev) {
7301− pr_info(MPT3SAS_FMT
7302− "failure at %s:%d/%s()!\n", ioc->name,
7303− __FILE__, __LINE__, __func__);
7219+ ioc_info(ioc, "failure at %s:%d/%s()!\n",
7220+ __FILE__, __LINE__, __func__);
73047221 return;
73057222 }
73067223 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
73587275 u8 task_abort_retries;
73597276
73607277 mutex_lock(&ioc->tm_cmds.mutex);
7361− pr_info(MPT3SAS_FMT
7362− "%s: enter: phy number(%d), width(%d)\n",
7363− ioc->name, __func__, event_data->PhyNum,
7364− event_data->PortWidth);
7278+ ioc_info(ioc, "%s: enter: phy number(%d), width(%d)\n",
7279+ __func__, event_data->PhyNum, event_data->PortWidth);
73657280
73667281 _scsih_block_io_all_device(ioc);
73677282
@@ -7371,12 +7286,12 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
73717286
73727287 /* sanity checks for retrying this loop */
73737288 if (max_retries++ == 5) {
7374− dewtprintk(ioc, pr_info(MPT3SAS_FMT "%s: giving up\n",
7375− ioc->name, __func__));
7289+ dewtprintk(ioc, ioc_info(ioc, "%s: giving up\n", __func__));
73767290 goto out;
73777291 } else if (max_retries > 1)
7378− dewtprintk(ioc, pr_info(MPT3SAS_FMT "%s: %d retry\n",
7379− ioc->name, __func__, max_retries - 1));
7292+ dewtprintk(ioc,
7293+ ioc_info(ioc, "%s: %d retry\n",
7294+ __func__, max_retries - 1));
73807295
73817296 termination_count = 0;
73827297 query_count = 0;
@@ -7443,9 +7358,9 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 60 unmodified lines
74437358 task_abort_retries = 0;
74447359 tm_retry:
74457360 if (task_abort_retries++ == 60) {
7446− dewtprintk(ioc, pr_info(MPT3SAS_FMT
7447− "%s: ABORT_TASK: giving up\n", ioc->name,
7448− __func__));
7361+ dewtprintk(ioc,
7362+ ioc_info(ioc, "%s: ABORT_TASK: giving up\n",
7363+ __func__));
74497364 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
74507365 goto broadcast_aen_retry;
74517366 }
@@ -7474,9 +7389,10 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 22 unmodified lines
74747389 }
74757390
74767391 if (ioc->broadcast_aen_pending) {
7477− dewtprintk(ioc, pr_info(MPT3SAS_FMT
7478− "%s: loop back due to pending AEN\n",
7479− ioc->name, __func__));
7392+ dewtprintk(ioc,
7393+ ioc_info(ioc,
7394+ "%s: loop back due to pending AEN\n",
7395+ __func__));
74807396 ioc->broadcast_aen_pending = 0;
74817397 goto broadcast_aen_retry;
74827398 }
@@ -7485,9 +7401,9 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines
74857401 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
74867402 out_no_lock:
74877403
7488− dewtprintk(ioc, pr_info(MPT3SAS_FMT
7489− "%s - exit, query_count = %d termination_count = %d\n",
7490− ioc->name, __func__, query_count, termination_count));
7404+ dewtprintk(ioc,
7405+ ioc_info(ioc, "%s - exit, query_count = %d termination_count = %d\n",
7406+ __func__, query_count, termination_count));
74917407
74927408 ioc->broadcast_aen_busy = 0;
74937409 if (!ioc->shost_recovery)
@@ -7509,13 +7425,13 @@ _scsih_sas_discovery_event(struct MPT3SAS_ADAPTER *ioc, · 15 unmodified lines
75097425 (Mpi2EventDataSasDiscovery_t *) fw_event->event_data;
75107426
75117427 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) {
7512− pr_info(MPT3SAS_FMT "discovery event: (%s)", ioc->name,
7513− (event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED) ?
7514− "start" : "stop");
7428+ ioc_info(ioc, "discovery event: (%s)",
7429+ event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED ?
7430+ "start" : "stop");
75157431 if (event_data->DiscoveryStatus)
7516− pr_info("discovery_status(0x%08x)",
7517− le32_to_cpu(event_data->DiscoveryStatus));
7518− pr_info("\n");
7432+ pr_cont("discovery_status(0x%08x)",
7433+ le32_to_cpu(event_data->DiscoveryStatus));
7434+ pr_cont("\n");
75197435 }
75207436
75217437 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
75457461
75467462 switch (event_data->ReasonCode) {
75477463 case MPI25_EVENT_SAS_DISC_ERR_SMP_FAILED:
7548− pr_warn(MPT3SAS_FMT "SMP command sent to the expander"
7549− "(handle:0x%04x, sas_address:0x%016llx,"
7550− "physical_port:0x%02x) has failed",
7551− ioc->name, le16_to_cpu(event_data->DevHandle),
7552− (unsigned long long)le64_to_cpu(event_data->SASAddress),
7553− event_data->PhysicalPort);
7464+ ioc_warn(ioc, "SMP command sent to the expander (handle:0x%04x, sas_address:0x%016llx, physical_port:0x%02x) has failed\n",
7465+ le16_to_cpu(event_data->DevHandle),
7466+ (u64)le64_to_cpu(event_data->SASAddress),
7467+ event_data->PhysicalPort);
75547468 break;
75557469 case MPI25_EVENT_SAS_DISC_ERR_SMP_TIMEOUT:
7556− pr_warn(MPT3SAS_FMT "SMP command sent to the expander"
7557− "(handle:0x%04x, sas_address:0x%016llx,"
7558− "physical_port:0x%02x) has timed out",
7559− ioc->name, le16_to_cpu(event_data->DevHandle),
7560− (unsigned long long)le64_to_cpu(event_data->SASAddress),
7561− event_data->PhysicalPort);
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",
7471+ le16_to_cpu(event_data->DevHandle),
7472+ (u64)le64_to_cpu(event_data->SASAddress),
7473+ event_data->PhysicalPort);
75627474 break;
75637475 default:
75647476 break;
@@ -7581,11 +7493,10 @@ _scsih_pcie_enumeration_event(struct MPT3SAS_ADAPTER *ioc, · 16 unmodified lines
75817493 if (!(ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK))
75827494 return;
75837495
7584− pr_info(MPT3SAS_FMT "pcie enumeration event: (%s) Flag 0x%02x",
7585− ioc->name,
7586− (event_data->ReasonCode == MPI26_EVENT_PCIE_ENUM_RC_STARTED) ?
7587− "started" : "completed",
7588− event_data->Flags);
7496+ ioc_info(ioc, "pcie enumeration event: (%s) Flag 0x%02x",
7497+ (event_data->ReasonCode == MPI26_EVENT_PCIE_ENUM_RC_STARTED) ?
7498+ "started" : "completed",
7499+ event_data->Flags);
75897500 if (event_data->EnumerationStatus)
75907501 pr_cont("enumeration_status(0x%08x)",
75917502 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
76177528 mutex_lock(&ioc->scsih_cmds.mutex);
76187529
76197530 if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) {
7620− pr_err(MPT3SAS_FMT "%s: scsih_cmd in use\n",
7621− ioc->name, __func__);
7531+ ioc_err(ioc, "%s: scsih_cmd in use\n", __func__);
76227532 rc = -EAGAIN;
76237533 goto out;
76247534 }
@@ -7626,8 +7536,7 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num) · 1 unmodified line
76267536
76277537 smid = mpt3sas_base_get_smid(ioc, ioc->scsih_cb_idx);
76287538 if (!smid) {
7629− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
7630− ioc->name, __func__);
7539+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
76317540 ioc->scsih_cmds.status = MPT3_CMD_NOT_USED;
76327541 rc = -EAGAIN;
76337542 goto out;
@@ -7641,9 +7550,9 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num) · 7 unmodified lines
76417550 mpi_request->Action = MPI2_RAID_ACTION_PHYSDISK_HIDDEN;
76427551 mpi_request->PhysDiskNum = phys_disk_num;
76437552
7644− dewtprintk(ioc, pr_info(MPT3SAS_FMT "IR RAID_ACTION: turning fast "\
7645− "path on for handle(0x%04x), phys_disk_num (0x%02x)\n", ioc->name,
7646− handle, phys_disk_num));
7553+ dewtprintk(ioc,
7554+ ioc_info(ioc, "IR RAID_ACTION: turning fast path on for handle(0x%04x), phys_disk_num (0x%02x)\n",
7555+ handle, phys_disk_num));
76477556
76487557 init_completion(&ioc->scsih_cmds.done);
76497558 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
76687577 log_info = 0;
76697578 ioc_status &= MPI2_IOCSTATUS_MASK;
76707579 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
7671− dewtprintk(ioc, pr_info(MPT3SAS_FMT
7672− "IR RAID_ACTION: failed: ioc_status(0x%04x), "
7673− "loginfo(0x%08x)!!!\n", ioc->name, ioc_status,
7674− log_info));
7580+ dewtprintk(ioc,
7581+ ioc_info(ioc, "IR RAID_ACTION: failed: ioc_status(0x%04x), loginfo(0x%08x)!!!\n",
7582+ ioc_status, log_info));
76757583 rc = -EFAULT;
76767584 } else
7677− dewtprintk(ioc, pr_info(MPT3SAS_FMT
7678− "IR RAID_ACTION: completed successfully\n",
7679− ioc->name));
7585+ dewtprintk(ioc,
7586+ ioc_info(ioc, "IR RAID_ACTION: completed successfully\n"));
76807587 }
76817588
76827589 out:
@@ -7721,9 +7628,8 @@ _scsih_sas_volume_add(struct MPT3SAS_ADAPTER *ioc, · 38 unmodified lines
77217628
77227629 mpt3sas_config_get_volume_wwid(ioc, handle, &wwid);
77237630 if (!wwid) {
7724− pr_err(MPT3SAS_FMT
7725− "failure at %s:%d/%s()!\n", ioc->name,
7726− __FILE__, __LINE__, __func__);
7631+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
7632+ __FILE__, __LINE__, __func__);
77277633 return;
77287634 }
77297635
@@ -7736,9 +7642,8 @@ _scsih_sas_volume_add(struct MPT3SAS_ADAPTER *ioc, · 6 unmodified lines
77367642
77377643 raid_device = kzalloc(sizeof(struct _raid_device), GFP_KERNEL);
77387644 if (!raid_device) {
7739− pr_err(MPT3SAS_FMT
7740− "failure at %s:%d/%s()!\n", ioc->name,
7741− __FILE__, __LINE__, __func__);
7645+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
7646+ __FILE__, __LINE__, __func__);
77427647 return;
77437648 }
77447649
@@ -7781,9 +7686,8 @@ _scsih_sas_volume_delete(struct MPT3SAS_ADAPTER *ioc, u16 handle) · 36 unmodified lines
77817686 sas_target_priv_data = starget->hostdata;
77827687 sas_target_priv_data->deleted = 1;
77837688 }
7784− pr_info(MPT3SAS_FMT "removing handle(0x%04x), wwid(0x%016llx)\n",
7785− ioc->name, raid_device->handle,
7786− (unsigned long long) raid_device->wwid);
7689+ ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n",
7690+ raid_device->handle, (u64)raid_device->wwid);
77877691 list_del(&raid_device->list);
77887692 kfree(raid_device);
77897693 }
@@ -7925,16 +7829,16 @@ _scsih_sas_pd_add(struct MPT3SAS_ADAPTER *ioc, · 135 unmodified lines
79257829
79267830 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
79277831 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
7928− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
7929− ioc->name, __FILE__, __LINE__, __func__);
7832+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
7833+ __FILE__, __LINE__, __func__);
79307834 return;
79317835 }
79327836
79337837 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
79347838 MPI2_IOCSTATUS_MASK;
79357839 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
7936− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
7937− ioc->name, __FILE__, __LINE__, __func__);
7840+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
7841+ __FILE__, __LINE__, __func__);
79387842 return;
79397843 }
79407844
@@ -7964,10 +7868,10 @@ _scsih_sas_ir_config_change_event_debug(struct MPT3SAS_ADAPTER *ioc, · 23 unmodified lines
79647868
79657869 element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0];
79667870
7967− pr_info(MPT3SAS_FMT "raid config change: (%s), elements(%d)\n",
7968− ioc->name, (le32_to_cpu(event_data->Flags) &
7969− MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG) ?
7970− "foreign" : "native", event_data->NumElements);
7871+ ioc_info(ioc, "raid config change: (%s), elements(%d)\n",
7872+ le32_to_cpu(event_data->Flags) & MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG ?
7873+ "foreign" : "native",
7874+ event_data->NumElements);
79717875 for (i = 0; i < event_data->NumElements; i++, element++) {
79727876 switch (element->ReasonCode) {
79737877 case MPI2_EVENT_IR_CHANGE_RC_ADDED:
@@ -8123,10 +8027,11 @@ _scsih_sas_ir_volume_event(struct MPT3SAS_ADAPTER *ioc, · 149 unmodified lines
81238027 handle = le16_to_cpu(event_data->VolDevHandle);
81248028 state = le32_to_cpu(event_data->NewValue);
81258029 if (!ioc->hide_ir_msg)
8126− dewtprintk(ioc, pr_info(MPT3SAS_FMT
8127− "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n",
8128− ioc->name, __func__, handle,
8129− le32_to_cpu(event_data->PreviousValue), state));
8030+ dewtprintk(ioc,
8031+ ioc_info(ioc, "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n",
8032+ __func__, handle,
8033+ le32_to_cpu(event_data->PreviousValue),
8034+ state));
81308035 switch (state) {
81318036 case MPI2_RAID_VOL_STATE_MISSING:
81328037 case MPI2_RAID_VOL_STATE_FAILED:
@@ -8146,17 +8051,15 @@ _scsih_sas_ir_volume_event(struct MPT3SAS_ADAPTER *ioc, · 13 unmodified lines
81468051
81478052 mpt3sas_config_get_volume_wwid(ioc, handle, &wwid);
81488053 if (!wwid) {
8149− pr_err(MPT3SAS_FMT
8150− "failure at %s:%d/%s()!\n", ioc->name,
8151− __FILE__, __LINE__, __func__);
8054+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
8055+ __FILE__, __LINE__, __func__);
81528056 break;
81538057 }
81548058
81558059 raid_device = kzalloc(sizeof(struct _raid_device), GFP_KERNEL);
81568060 if (!raid_device) {
8157− pr_err(MPT3SAS_FMT
8158− "failure at %s:%d/%s()!\n", ioc->name,
8159− __FILE__, __LINE__, __func__);
8061+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
8062+ __FILE__, __LINE__, __func__);
81608063 break;
81618064 }
81628065
@@ -8207,10 +8110,11 @@ _scsih_sas_ir_physical_disk_event(struct MPT3SAS_ADAPTER *ioc, · 44 unmodified lines
82078110 state = le32_to_cpu(event_data->NewValue);
82088111
82098112 if (!ioc->hide_ir_msg)
8210− dewtprintk(ioc, pr_info(MPT3SAS_FMT
8211− "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n",
8212− ioc->name, __func__, handle,
8213− le32_to_cpu(event_data->PreviousValue), state));
8113+ dewtprintk(ioc,
8114+ ioc_info(ioc, "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n",
8115+ __func__, handle,
8116+ le32_to_cpu(event_data->PreviousValue),
8117+ state));
82148118
82158119 switch (state) {
82168120 case MPI2_RAID_PD_STATE_ONLINE:
@@ -8231,16 +8135,16 @@ _scsih_sas_ir_physical_disk_event(struct MPT3SAS_ADAPTER *ioc, · 14 unmodified lines
82318135 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply,
82328136 &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE,
82338137 handle))) {
8234− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
8235− ioc->name, __FILE__, __LINE__, __func__);
8138+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
8139+ __FILE__, __LINE__, __func__);
82368140 return;
82378141 }
82388142
82398143 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
82408144 MPI2_IOCSTATUS_MASK;
82418145 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
8242− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
8243− ioc->name, __FILE__, __LINE__, __func__);
8146+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
8147+ __FILE__, __LINE__, __func__);
82448148 return;
82458149 }
82468150
@@ -8294,11 +8198,10 @@ _scsih_sas_ir_operation_status_event_debug(struct MPT3SAS_ADAPTER *ioc, · 47 unmodified lines
82948198 if (!reason_str)
82958199 return;
82968200
8297− pr_info(MPT3SAS_FMT "raid operational status: (%s)" \
8298− "\thandle(0x%04x), percent complete(%d)\n",
8299− ioc->name, reason_str,
8300− le16_to_cpu(event_data->VolDevHandle),
8301− event_data->PercentComplete);
8201+ ioc_info(ioc, "raid operational status: (%s)\thandle(0x%04x), percent complete(%d)\n",
8202+ reason_str,
8203+ le16_to_cpu(event_data->VolDevHandle),
8204+ event_data->PercentComplete);
83028205 }
83038206
83048207 /**
@@ -8379,9 +8282,8 @@ Mpi2SasDevicePage0_t *sas_device_pg0) · 74 unmodified lines
83798282 mpt3sas_scsih_enclosure_find_by_handle(ioc,
83808283 le16_to_cpu(sas_device_pg0->EnclosureHandle));
83818284 if (enclosure_dev == NULL)
8382− pr_info(MPT3SAS_FMT "Enclosure handle(0x%04x)"
8383− "doesn't match with enclosure device!\n",
8384− ioc->name, sas_device_pg0->EnclosureHandle);
8285+ ioc_info(ioc, "Enclosure handle(0x%04x) doesn't match with enclosure device!\n",
8286+ sas_device_pg0->EnclosureHandle);
83858287 }
83868288 spin_lock_irqsave(&ioc->sas_device_lock, flags);
83878289 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
84758377 enclosure_dev =
84768378 kzalloc(sizeof(struct _enclosure_node), GFP_KERNEL);
84778379 if (!enclosure_dev) {
8478− pr_err(MPT3SAS_FMT
8479− "failure at %s:%d/%s()!\n", ioc->name,
8380+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
84808381 __FILE__, __LINE__, __func__);
84818382 return;
84828383 }
@@ -8513,7 +8414,7 @@ _scsih_search_responding_sas_devices(struct MPT3SAS_ADAPTER *ioc) · 30 unmodified lines
85138414 u16 handle;
85148415 u32 device_info;
85158416
8516− pr_info(MPT3SAS_FMT "search for end-devices: start\n", ioc->name);
8417+ ioc_info(ioc, "search for end-devices: start\n");
85178418
85188419 if (list_empty(&ioc->sas_device_list))
85198420 goto out;
@@ -8534,8 +8435,7 @@ _scsih_search_responding_sas_devices(struct MPT3SAS_ADAPTER *ioc) · 14 unmodified lines
85348435 }
85358436
85368437 out:
8537− pr_info(MPT3SAS_FMT "search for end-devices: complete\n",
8538− ioc->name);
8438+ ioc_info(ioc, "search for end-devices: complete\n");
85398439 }
85408440
85418441 /**
@@ -8628,7 +8528,7 @@ _scsih_search_responding_pcie_devices(struct MPT3SAS_ADAPTER *ioc) · 86 unmodified lines
86288528 u16 handle;
86298529 u32 device_info;
86308530
8631− pr_info(MPT3SAS_FMT "search for end-devices: start\n", ioc->name);
8531+ ioc_info(ioc, "search for end-devices: start\n");
86328532
86338533 if (list_empty(&ioc->pcie_device_list))
86348534 goto out;
@@ -8640,10 +8540,9 @@ _scsih_search_responding_pcie_devices(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
86408540 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
86418541 MPI2_IOCSTATUS_MASK;
86428542 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
8643− pr_info(MPT3SAS_FMT "\tbreak from %s: "
8644− "ioc_status(0x%04x), loginfo(0x%08x)\n", ioc->name,
8645− __func__, ioc_status,
8646− le32_to_cpu(mpi_reply.IOCLogInfo));
8543+ ioc_info(ioc, "\tbreak from %s: ioc_status(0x%04x), loginfo(0x%08x)\n",
8544+ __func__, ioc_status,
8545+ le32_to_cpu(mpi_reply.IOCLogInfo));
86478546 break;
86488547 }
86498548 handle = le16_to_cpu(pcie_device_pg0.DevHandle);
@@ -8653,8 +8552,7 @@ _scsih_search_responding_pcie_devices(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
86538552 _scsih_mark_responding_pcie_device(ioc, &pcie_device_pg0);
86548553 }
86558554 out:
8656− pr_info(MPT3SAS_FMT "search for PCIe end-devices: complete\n",
8657− ioc->name);
8555+ ioc_info(ioc, "search for PCIe end-devices: complete\n");
86588556 }
86598557
86608558 /**
@@ -8735,8 +8633,7 @@ _scsih_search_responding_raid_devices(struct MPT3SAS_ADAPTER *ioc) · 74 unmodified lines
87358633 if (!ioc->ir_firmware)
87368634 return;
87378635
8738− pr_info(MPT3SAS_FMT "search for raid volumes: start\n",
8739− ioc->name);
8636+ ioc_info(ioc, "search for raid volumes: start\n");
87408637
87418638 if (list_empty(&ioc->raid_device_list))
87428639 goto out;
@@ -8779,8 +8676,7 @@ _scsih_search_responding_raid_devices(struct MPT3SAS_ADAPTER *ioc) · 36 unmodified lines
87798676 }
87808677 }
87818678 out:
8782− pr_info(MPT3SAS_FMT "search for responding raid volumes: complete\n",
8783− ioc->name);
8679+ ioc_info(ioc, "search for responding raid volumes: complete\n");
87848680 }
87858681
87868682 /**
@@ -8852,7 +8748,7 @@ _scsih_search_responding_expanders(struct MPT3SAS_ADAPTER *ioc) · 65 unmodified lines
88528748 u64 sas_address;
88538749 u16 handle;
88548750
8855− pr_info(MPT3SAS_FMT "search for expanders: start\n", ioc->name);
8751+ ioc_info(ioc, "search for expanders: start\n");
88568752
88578753 if (list_empty(&ioc->sas_expander_list))
88588754 goto out;
@@ -8875,7 +8771,7 @@ _scsih_search_responding_expanders(struct MPT3SAS_ADAPTER *ioc) · 16 unmodified lines
88758771 }
88768772
88778773 out:
8878− pr_info(MPT3SAS_FMT "search for expanders: complete\n", ioc->name);
8774+ ioc_info(ioc, "search for expanders: complete\n");
88798775 }
88808776
88818777 /**
@@ -8893,12 +8789,10 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc) · 11 unmodified lines
88938789 unsigned long flags;
88948790 LIST_HEAD(head);
88958791
8896− pr_info(MPT3SAS_FMT "removing unresponding devices: start\n",
8897− ioc->name);
8792+ ioc_info(ioc, "removing unresponding devices: start\n");
88988793
88998794 /* removing unresponding end devices */
8900− pr_info(MPT3SAS_FMT "removing unresponding devices: end-devices\n",
8901− ioc->name);
8795+ ioc_info(ioc, "removing unresponding devices: end-devices\n");
89028796 /*
89038797 * Iterate, pulling off devices marked as non-responding. We become the
89048798 * 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
89228816 sas_device_put(sas_device);
89238817 }
89248818
8925− pr_info(MPT3SAS_FMT
8926− " Removing unresponding devices: pcie end-devices\n"
8927− , ioc->name);
8819+ ioc_info(ioc, "Removing unresponding devices: pcie end-devices\n");
89288820 INIT_LIST_HEAD(&head);
89298821 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
89308822 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
89448836
89458837 /* removing unresponding volumes */
89468838 if (ioc->ir_firmware) {
8947− pr_info(MPT3SAS_FMT "removing unresponding devices: volumes\n",
8948− ioc->name);
8839+ ioc_info(ioc, "removing unresponding devices: volumes\n");
89498840 list_for_each_entry_safe(raid_device, raid_device_next,
89508841 &ioc->raid_device_list, list) {
89518842 if (!raid_device->responding)
@@ -8957,8 +8848,7 @@ _scsih_remove_unresponding_devices(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
89578848 }
89588849
89598850 /* removing unresponding expanders */
8960− pr_info(MPT3SAS_FMT "removing unresponding devices: expanders\n",
8961− ioc->name);
8851+ ioc_info(ioc, "removing unresponding devices: expanders\n");
89628852 spin_lock_irqsave(&ioc->sas_node_lock, flags);
89638853 INIT_LIST_HEAD(&tmp_list);
89648854 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
89748864 _scsih_expander_node_remove(ioc, sas_expander);
89758865 }
89768866
8977− pr_info(MPT3SAS_FMT "removing unresponding devices: complete\n",
8978− ioc->name);
8867+ ioc_info(ioc, "removing unresponding devices: complete\n");
89798868
89808869 /* unblock devices */
89818870 _scsih_ublock_io_all_device(ioc);
@@ -8992,8 +8881,8 @@ _scsih_refresh_expander_links(struct MPT3SAS_ADAPTER *ioc, · 10 unmodified lines
89928881 for (i = 0 ; i < sas_expander->num_phys ; i++) {
89938882 if ((mpt3sas_config_get_expander_pg1(ioc, &mpi_reply,
89948883 &expander_pg1, i, handle))) {
8995− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
8996− ioc->name, __FILE__, __LINE__, __func__);
8884+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
8885+ __FILE__, __LINE__, __func__);
89978886 return;
89988887 }
89998888
@@ -9029,11 +8918,11 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 29 unmodified lines
90298918 u8 retry_count;
90308919 unsigned long flags;
90318920
9032− pr_info(MPT3SAS_FMT "scan devices: start\n", ioc->name);
8921+ ioc_info(ioc, "scan devices: start\n");
90338922
90348923 _scsih_sas_host_refresh(ioc);
90358924
9036− pr_info(MPT3SAS_FMT "\tscan devices: expanders start\n", ioc->name);
8925+ ioc_info(ioc, "\tscan devices: expanders start\n");
90378926
90388927 /* expanders */
90398928 handle = 0xFFFF;
@@ -9042,10 +8931,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
90428931 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
90438932 MPI2_IOCSTATUS_MASK;
90448933 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9045− pr_info(MPT3SAS_FMT "\tbreak from expander scan: " \
9046− "ioc_status(0x%04x), loginfo(0x%08x)\n",
9047− ioc->name, ioc_status,
9048− le32_to_cpu(mpi_reply.IOCLogInfo));
8934+ ioc_info(ioc, "\tbreak from expander scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
8935+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
90498936 break;
90508937 }
90518938 handle = le16_to_cpu(expander_pg0.DevHandle);
@@ -9057,25 +8944,22 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
90578944 _scsih_refresh_expander_links(ioc, expander_device,
90588945 handle);
90598946 else {
9060− pr_info(MPT3SAS_FMT "\tBEFORE adding expander: " \
9061− "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name,
9062− handle, (unsigned long long)
9063− le64_to_cpu(expander_pg0.SASAddress));
8947+ ioc_info(ioc, "\tBEFORE adding expander: handle (0x%04x), sas_addr(0x%016llx)\n",
8948+ handle,
8949+ (u64)le64_to_cpu(expander_pg0.SASAddress));
90648950 _scsih_expander_add(ioc, handle);
9065− pr_info(MPT3SAS_FMT "\tAFTER adding expander: " \
9066− "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name,
9067− handle, (unsigned long long)
9068− le64_to_cpu(expander_pg0.SASAddress));
8951+ ioc_info(ioc, "\tAFTER adding expander: handle (0x%04x), sas_addr(0x%016llx)\n",
8952+ handle,
8953+ (u64)le64_to_cpu(expander_pg0.SASAddress));
90698954 }
90708955 }
90718956
9072− pr_info(MPT3SAS_FMT "\tscan devices: expanders complete\n",
9073− ioc->name);
8957+ ioc_info(ioc, "\tscan devices: expanders complete\n");
90748958
90758959 if (!ioc->ir_firmware)
90768960 goto skip_to_sas;
90778961
9078− pr_info(MPT3SAS_FMT "\tscan devices: phys disk start\n", ioc->name);
8962+ ioc_info(ioc, "\tscan devices: phys disk start\n");
90798963
90808964 /* phys disk */
90818965 phys_disk_num = 0xFF;
@@ -9085,10 +8969,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
90858969 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
90868970 MPI2_IOCSTATUS_MASK;
90878971 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9088− pr_info(MPT3SAS_FMT "\tbreak from phys disk scan: "\
9089− "ioc_status(0x%04x), loginfo(0x%08x)\n",
9090− ioc->name, ioc_status,
9091− le32_to_cpu(mpi_reply.IOCLogInfo));
8972+ ioc_info(ioc, "\tbreak from phys disk scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
8973+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
90928974 break;
90938975 }
90948976 phys_disk_num = pd_pg0.PhysDiskNum;
@@ -9105,19 +8987,16 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 10 unmodified lines
91058987 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
91068988 MPI2_IOCSTATUS_MASK;
91078989 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9108− pr_info(MPT3SAS_FMT "\tbreak from phys disk scan " \
9109− "ioc_status(0x%04x), loginfo(0x%08x)\n",
9110− ioc->name, ioc_status,
9111− le32_to_cpu(mpi_reply.IOCLogInfo));
8990+ ioc_info(ioc, "\tbreak from phys disk scan ioc_status(0x%04x), loginfo(0x%08x)\n",
8991+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
91128992 break;
91138993 }
91148994 parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle);
91158995 if (!_scsih_get_sas_address(ioc, parent_handle,
91168996 &sas_address)) {
9117− pr_info(MPT3SAS_FMT "\tBEFORE adding phys disk: " \
9118− " handle (0x%04x), sas_addr(0x%016llx)\n",
9119− ioc->name, handle, (unsigned long long)
9120− le64_to_cpu(sas_device_pg0.SASAddress));
8997+ ioc_info(ioc, "\tBEFORE adding phys disk: handle (0x%04x), sas_addr(0x%016llx)\n",
8998+ handle,
8999+ (u64)le64_to_cpu(sas_device_pg0.SASAddress));
91219000 mpt3sas_transport_update_links(ioc, sas_address,
91229001 handle, sas_device_pg0.PhyNum,
91239002 MPI2_SAS_NEG_LINK_RATE_1_5);
@@ -9131,17 +9010,15 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 7 unmodified lines
91319010 1)) {
91329011 ssleep(1);
91339012 }
9134− pr_info(MPT3SAS_FMT "\tAFTER adding phys disk: " \
9135− " handle (0x%04x), sas_addr(0x%016llx)\n",
9136− ioc->name, handle, (unsigned long long)
9137− le64_to_cpu(sas_device_pg0.SASAddress));
9013+ ioc_info(ioc, "\tAFTER adding phys disk: handle (0x%04x), sas_addr(0x%016llx)\n",
9014+ handle,
9015+ (u64)le64_to_cpu(sas_device_pg0.SASAddress));
91389016 }
91399017 }
91409018
9141− pr_info(MPT3SAS_FMT "\tscan devices: phys disk complete\n",
9142− ioc->name);
9019+ ioc_info(ioc, "\tscan devices: phys disk complete\n");
91439020
9144− pr_info(MPT3SAS_FMT "\tscan devices: volumes start\n", ioc->name);
9021+ ioc_info(ioc, "\tscan devices: volumes start\n");
91459022
91469023 /* volumes */
91479024 handle = 0xFFFF;
@@ -9150,10 +9027,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 2 unmodified lines
91509027 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
91519028 MPI2_IOCSTATUS_MASK;
91529029 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9153− pr_info(MPT3SAS_FMT "\tbreak from volume scan: " \
9154− "ioc_status(0x%04x), loginfo(0x%08x)\n",
9155− ioc->name, ioc_status,
9156− le32_to_cpu(mpi_reply.IOCLogInfo));
9030+ ioc_info(ioc, "\tbreak from volume scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9031+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
91579032 break;
91589033 }
91599034 handle = le16_to_cpu(volume_pg1.DevHandle);
@@ -9170,10 +9045,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 10 unmodified lines
91709045 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
91719046 MPI2_IOCSTATUS_MASK;
91729047 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9173− pr_info(MPT3SAS_FMT "\tbreak from volume scan: " \
9174− "ioc_status(0x%04x), loginfo(0x%08x)\n",
9175− ioc->name, ioc_status,
9176− le32_to_cpu(mpi_reply.IOCLogInfo));
9048+ ioc_info(ioc, "\tbreak from volume scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9049+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
91779050 break;
91789051 }
91799052 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
91829055 memset(&element, 0, sizeof(Mpi2EventIrConfigElement_t));
91839056 element.ReasonCode = MPI2_EVENT_IR_CHANGE_RC_ADDED;
91849057 element.VolDevHandle = volume_pg1.DevHandle;
9185− pr_info(MPT3SAS_FMT
9186− "\tBEFORE adding volume: handle (0x%04x)\n",
9187− ioc->name, volume_pg1.DevHandle);
9058+ ioc_info(ioc, "\tBEFORE adding volume: handle (0x%04x)\n",
9059+ volume_pg1.DevHandle);
91889060 _scsih_sas_volume_add(ioc, &element);
9189− pr_info(MPT3SAS_FMT
9190− "\tAFTER adding volume: handle (0x%04x)\n",
9191− ioc->name, volume_pg1.DevHandle);
9061+ ioc_info(ioc, "\tAFTER adding volume: handle (0x%04x)\n",
9062+ volume_pg1.DevHandle);
91929063 }
91939064 }
91949065
9195− pr_info(MPT3SAS_FMT "\tscan devices: volumes complete\n",
9196− ioc->name);
9066+ ioc_info(ioc, "\tscan devices: volumes complete\n");
91979067
91989068 skip_to_sas:
91999069
9200− pr_info(MPT3SAS_FMT "\tscan devices: end devices start\n",
9201− ioc->name);
9070+ ioc_info(ioc, "\tscan devices: end devices start\n");
92029071
92039072 /* sas devices */
92049073 handle = 0xFFFF;
@@ -9208,10 +9077,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
92089077 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
92099078 MPI2_IOCSTATUS_MASK;
92109079 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9211− pr_info(MPT3SAS_FMT "\tbreak from end device scan:"\
9212− " ioc_status(0x%04x), loginfo(0x%08x)\n",
9213− ioc->name, ioc_status,
9214− le32_to_cpu(mpi_reply.IOCLogInfo));
9080+ ioc_info(ioc, "\tbreak from end device scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9081+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
92159082 break;
92169083 }
92179084 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
92269093 }
92279094 parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle);
92289095 if (!_scsih_get_sas_address(ioc, parent_handle, &sas_address)) {
9229− pr_info(MPT3SAS_FMT "\tBEFORE adding end device: " \
9230− "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name,
9231− handle, (unsigned long long)
9232− le64_to_cpu(sas_device_pg0.SASAddress));
9096+ ioc_info(ioc, "\tBEFORE adding end device: handle (0x%04x), sas_addr(0x%016llx)\n",
9097+ handle,
9098+ (u64)le64_to_cpu(sas_device_pg0.SASAddress));
92339099 mpt3sas_transport_update_links(ioc, sas_address, handle,
92349100 sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);
92359101 retry_count = 0;
@@ -9241,16 +9107,13 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
92419107 0)) {
92429108 ssleep(1);
92439109 }
9244− pr_info(MPT3SAS_FMT "\tAFTER adding end device: " \
9245− "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name,
9246− handle, (unsigned long long)
9247− le64_to_cpu(sas_device_pg0.SASAddress));
9110+ ioc_info(ioc, "\tAFTER adding end device: handle (0x%04x), sas_addr(0x%016llx)\n",
9111+ handle,
9112+ (u64)le64_to_cpu(sas_device_pg0.SASAddress));
92489113 }
92499114 }
9250− pr_info(MPT3SAS_FMT "\tscan devices: end devices complete\n",
9251− ioc->name);
9252− pr_info(MPT3SAS_FMT "\tscan devices: pcie end devices start\n",
9253− ioc->name);
9115+ ioc_info(ioc, "\tscan devices: end devices complete\n");
9116+ ioc_info(ioc, "\tscan devices: pcie end devices start\n");
92549117
92559118 /* pcie devices */
92569119 handle = 0xFFFF;
@@ -9260,10 +9123,8 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 3 unmodified lines
92609123 ioc_status = le16_to_cpu(mpi_reply.IOCStatus)
92619124 & MPI2_IOCSTATUS_MASK;
92629125 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9263− pr_info(MPT3SAS_FMT "\tbreak from pcie end device"
9264− " scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9265− ioc->name, ioc_status,
9266− le32_to_cpu(mpi_reply.IOCLogInfo));
9126+ ioc_info(ioc, "\tbreak from pcie end device scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9127+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
92679128 break;
92689129 }
92699130 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
92809141 parent_handle = le16_to_cpu(pcie_device_pg0.ParentDevHandle);
92819142 _scsih_pcie_add_device(ioc, handle);
92829143
9283− pr_info(MPT3SAS_FMT "\tAFTER adding pcie end device: "
9284− "handle (0x%04x), wwid(0x%016llx)\n", ioc->name,
9285− handle,
9286− (unsigned long long) le64_to_cpu(pcie_device_pg0.WWID));
9144+ ioc_info(ioc, "\tAFTER adding pcie end device: handle (0x%04x), wwid(0x%016llx)\n",
9145+ handle, (u64)le64_to_cpu(pcie_device_pg0.WWID));
92879146 }
9288− pr_info(MPT3SAS_FMT "\tpcie devices: pcie end devices complete\n",
9289− ioc->name);
9290− pr_info(MPT3SAS_FMT "scan devices: complete\n", ioc->name);
9147+ ioc_info(ioc, "\tpcie devices: pcie end devices complete\n");
9148+ ioc_info(ioc, "scan devices: complete\n");
92919149 }
92929150
92939151 /**
@@ -9298,8 +9156,7 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc) · 4 unmodified lines
92989156 */
92999157 void mpt3sas_scsih_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc)
93009158 {
9301− dtmprintk(ioc, pr_info(MPT3SAS_FMT
9302− "%s: MPT3_IOC_PRE_RESET\n", ioc->name, __func__));
9159+ dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_PRE_RESET\n", __func__));
93039160 }
93049161
93059162 /**
@@ -9311,8 +9168,7 @@ void mpt3sas_scsih_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc) · 5 unmodified lines
93119168 void
93129169 mpt3sas_scsih_after_reset_handler(struct MPT3SAS_ADAPTER *ioc)
93139170 {
9314− dtmprintk(ioc, pr_info(MPT3SAS_FMT
9315− "%s: MPT3_IOC_AFTER_RESET\n", ioc->name, __func__));
9171+ dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_AFTER_RESET\n", __func__));
93169172 if (ioc->scsih_cmds.status & MPT3_CMD_PENDING) {
93179173 ioc->scsih_cmds.status |= MPT3_CMD_RESET;
93189174 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
93409196 void
93419197 mpt3sas_scsih_reset_done_handler(struct MPT3SAS_ADAPTER *ioc)
93429198 {
9343− dtmprintk(ioc, pr_info(MPT3SAS_FMT
9344− "%s: MPT3_IOC_DONE_RESET\n", ioc->name, __func__));
9199+ dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_DONE_RESET\n", __func__));
93459200 if ((!ioc->is_driver_loading) && !(disable_discovery > 0 &&
93469201 !ioc->sas_hba.num_phys)) {
93479202 _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
93969251 if (missing_delay[0] != -1 && missing_delay[1] != -1)
93979252 mpt3sas_base_update_missing_delay(ioc, missing_delay[0],
93989253 missing_delay[1]);
9399− dewtprintk(ioc, pr_info(MPT3SAS_FMT
9400− "port enable: complete from worker thread\n",
9401− ioc->name));
9254+ dewtprintk(ioc,
9255+ ioc_info(ioc, "port enable: complete from worker thread\n"));
94029256 break;
94039257 case MPT3SAS_TURN_ON_PFA_LED:
94049258 _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
94969350 mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply);
94979351
94989352 if (unlikely(!mpi_reply)) {
9499− pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",
9500− ioc->name, __FILE__, __LINE__, __func__);
9353+ ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
9354+ __FILE__, __LINE__, __func__);
95019355 return 1;
95029356 }
95039357
@@ -9564,30 +9418,16 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, · 60 unmodified lines
95649418
95659419 switch (le32_to_cpu(*log_code)) {
95669420 case MPT2_WARPDRIVE_LC_SSDT:
9567− pr_warn(MPT3SAS_FMT "WarpDrive Warning: "
9568− "IO Throttling has occurred in the WarpDrive "
9569− "subsystem. Check WarpDrive documentation for "
9570− "additional details.\n", ioc->name);
9421+ ioc_warn(ioc, "WarpDrive Warning: IO Throttling has occurred in the WarpDrive subsystem. Check WarpDrive documentation for additional details.\n");
95719422 break;
95729423 case MPT2_WARPDRIVE_LC_SSDLW:
9573− pr_warn(MPT3SAS_FMT "WarpDrive Warning: "
9574− "Program/Erase Cycles for the WarpDrive subsystem "
9575− "in degraded range. Check WarpDrive documentation "
9576− "for additional details.\n", ioc->name);
9424+ ioc_warn(ioc, "WarpDrive Warning: Program/Erase Cycles for the WarpDrive subsystem in degraded range. Check WarpDrive documentation for additional details.\n");
95779425 break;
95789426 case MPT2_WARPDRIVE_LC_SSDLF:
9579− pr_err(MPT3SAS_FMT "WarpDrive Fatal Error: "
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);
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");
95849428 break;
95859429 case MPT2_WARPDRIVE_LC_BRMF:
9586− pr_err(MPT3SAS_FMT "WarpDrive Fatal Error: "
9587− "The Backup Rail Monitor has failed on the "
9588− "WarpDrive subsystem. Check WarpDrive "
9589− "documentation for additional details.\n",
9590− ioc->name);
9430+ ioc_err(ioc, "WarpDrive Fatal Error: The Backup Rail Monitor has failed on the WarpDrive subsystem. Check WarpDrive documentation for additional details.\n");
95919431 break;
95929432 }
95939433
@@ -9613,9 +9453,8 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, · 19 unmodified lines
96139453 (Mpi26EventDataActiveCableExcept_t *) mpi_reply->EventData;
96149454 switch (ActiveCableEventData->ReasonCode) {
96159455 case MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER:
9616− pr_notice(MPT3SAS_FMT
9617− "Currently an active cable with ReceptacleID %d\n",
9618− ioc->name, ActiveCableEventData->ReceptacleID);
9456+ ioc_notice(ioc, "Currently an active cable with ReceptacleID %d\n",
9457+ ActiveCableEventData->ReceptacleID);
96199458 pr_notice("cannot be powered and devices connected\n");
96209459 pr_notice("to this active cable will not be seen\n");
96219460 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
96239462 break;
96249463
96259464 case MPI26_EVENT_ACTIVE_CABLE_DEGRADED:
9626− pr_notice(MPT3SAS_FMT
9627− "Currently a cable with ReceptacleID %d\n",
9628− ioc->name, ActiveCableEventData->ReceptacleID);
9465+ ioc_notice(ioc, "Currently a cable with ReceptacleID %d\n",
9466+ ActiveCableEventData->ReceptacleID);
96299467 pr_notice(
96309468 "is not running at optimal speed(12 Gb/s rate)\n");
96319469 break;
@@ -9640,8 +9478,8 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, · 8 unmodified lines
96409478 sz = le16_to_cpu(mpi_reply->EventDataLength) * 4;
96419479 fw_event = alloc_fw_event_work(sz);
96429480 if (!fw_event) {
9643− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
9644− ioc->name, __FILE__, __LINE__, __func__);
9481+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
9482+ __FILE__, __LINE__, __func__);
96459483 return 1;
96469484 }
96479485
@@ -9690,11 +9528,9 @@ _scsih_expander_node_remove(struct MPT3SAS_ADAPTER *ioc, · 42 unmodified lines
96909528 mpt3sas_transport_port_remove(ioc, sas_expander->sas_address,
96919529 sas_expander->sas_address_parent);
96929530
9693− pr_info(MPT3SAS_FMT
9694− "expander_remove: handle(0x%04x), sas_addr(0x%016llx)\n",
9695− ioc->name,
9696− sas_expander->handle, (unsigned long long)
9697− sas_expander->sas_address);
9531+ ioc_info(ioc, "expander_remove: handle(0x%04x), sas_addr(0x%016llx)\n",
9532+ sas_expander->handle, (unsigned long long)
9533+ sas_expander->sas_address);
96989534
96999535 spin_lock_irqsave(&ioc->sas_node_lock, flags);
97009536 list_del(&sas_expander->list);
@@ -9729,16 +9565,14 @@ _scsih_ir_shutdown(struct MPT3SAS_ADAPTER *ioc) · 28 unmodified lines
97299565 mutex_lock(&ioc->scsih_cmds.mutex);
97309566
97319567 if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) {
9732− pr_err(MPT3SAS_FMT "%s: scsih_cmd in use\n",
9733− ioc->name, __func__);
9568+ ioc_err(ioc, "%s: scsih_cmd in use\n", __func__);
97349569 goto out;
97359570 }
97369571 ioc->scsih_cmds.status = MPT3_CMD_PENDING;
97379572
97389573 smid = mpt3sas_base_get_smid(ioc, ioc->scsih_cb_idx);
97399574 if (!smid) {
9740− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
9741− ioc->name, __func__);
9575+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
97429576 ioc->scsih_cmds.status = MPT3_CMD_NOT_USED;
97439577 goto out;
97449578 }
@@ -9751,24 +9585,22 @@ _scsih_ir_shutdown(struct MPT3SAS_ADAPTER *ioc) · 6 unmodified lines
97519585 mpi_request->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED;
97529586
97539587 if (!ioc->hide_ir_msg)
9754− pr_info(MPT3SAS_FMT "IR shutdown (sending)\n", ioc->name);
9588+ ioc_info(ioc, "IR shutdown (sending)\n");
97559589 init_completion(&ioc->scsih_cmds.done);
97569590 mpt3sas_base_put_smid_default(ioc, smid);
97579591 wait_for_completion_timeout(&ioc->scsih_cmds.done, 10*HZ);
97589592
97599593 if (!(ioc->scsih_cmds.status & MPT3_CMD_COMPLETE)) {
9760− pr_err(MPT3SAS_FMT "%s: timeout\n",
9761− ioc->name, __func__);
9594+ ioc_err(ioc, "%s: timeout\n", __func__);
97629595 goto out;
97639596 }
97649597
97659598 if (ioc->scsih_cmds.status & MPT3_CMD_REPLY_VALID) {
97669599 mpi_reply = ioc->scsih_cmds.reply;
97679600 if (!ioc->hide_ir_msg)
9768− pr_info(MPT3SAS_FMT "IR shutdown "
9769− "(complete): ioc_status(0x%04x), loginfo(0x%08x)\n",
9770− ioc->name, le16_to_cpu(mpi_reply->IOCStatus),
9771− le32_to_cpu(mpi_reply->IOCLogInfo));
9601+ ioc_info(ioc, "IR shutdown (complete): ioc_status(0x%04x), loginfo(0x%08x)\n",
9602+ le16_to_cpu(mpi_reply->IOCStatus),
9603+ le32_to_cpu(mpi_reply->IOCLogInfo));
97729604 }
97739605
97749606 out:
@@ -9817,9 +9649,8 @@ static void scsih_remove(struct pci_dev *pdev) · 42 unmodified lines
98179649 sas_target_priv_data->deleted = 1;
98189650 scsi_remove_target(&raid_device->starget->dev);
98199651 }
9820− pr_info(MPT3SAS_FMT "removing handle(0x%04x), wwid(0x%016llx)\n",
9821− ioc->name, raid_device->handle,
9822− (unsigned long long) raid_device->wwid);
9652+ ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n",
9653+ raid_device->handle, (u64)raid_device->wwid);
98239654 _scsih_raid_device_remove(ioc, raid_device);
98249655 }
98259656 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
1023010061 rc = mpt3sas_port_enable(ioc);
1023110062
1023210063 if (rc != 0)
10233− pr_info(MPT3SAS_FMT "port enable: FAILED\n", ioc->name);
10064+ ioc_info(ioc, "port enable: FAILED\n");
1023410065 }
1023510066
1023610067 /**
@@ -10255,9 +10086,7 @@ scsih_scan_finished(struct Scsi_Host *shost, unsigned long time) · 18 unmodified lines
1025510086
1025610087 if (time >= (300 * HZ)) {
1025710088 ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED;
10258− pr_info(MPT3SAS_FMT
10259− "port enable: FAILED with timeout (timeout=300s)\n",
10260− ioc->name);
10089+ ioc_info(ioc, "port enable: FAILED with timeout (timeout=300s)\n");
1026110090 ioc->is_driver_loading = 0;
1026210091 return 1;
1026310092 }
@@ -10266,16 +10095,15 @@ scsih_scan_finished(struct Scsi_Host *shost, unsigned long time) · 2 unmodified lines
1026610095 return 0;
1026710096
1026810097 if (ioc->start_scan_failed) {
10269− pr_info(MPT3SAS_FMT
10270− "port enable: FAILED with (ioc_status=0x%08x)\n",
10271− ioc->name, ioc->start_scan_failed);
10098+ ioc_info(ioc, "port enable: FAILED with (ioc_status=0x%08x)\n",
10099+ ioc->start_scan_failed);
1027210100 ioc->is_driver_loading = 0;
1027310101 ioc->wait_for_discovery_to_complete = 0;
1027410102 ioc->remove_host = 1;
1027510103 return 1;
1027610104 }
1027710105
10278− pr_info(MPT3SAS_FMT "port enable: SUCCESS\n", ioc->name);
10106+ ioc_info(ioc, "port enable: SUCCESS\n");
1027910107 ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED;
1028010108
1028110109 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
1058610414 if (ioc->is_mcpu_endpoint) {
1058710415 /* mCPU MPI support 64K max IO */
1058810416 shost->max_sectors = 128;
10589− pr_info(MPT3SAS_FMT
10590− "The max_sectors value is set to %d\n",
10591− ioc->name, shost->max_sectors);
10417+ ioc_info(ioc, "The max_sectors value is set to %d\n",
10418+ shost->max_sectors);
1059210419 } else {
1059310420 if (max_sectors != 0xFFFF) {
1059410421 if (max_sectors < 64) {
1059510422 shost->max_sectors = 64;
10596− pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
10597− "for max_sectors, range is 64 to 32767. " \
10598− "Assigning value of 64.\n", \
10599− ioc->name, max_sectors);
10423+ ioc_warn(ioc, "Invalid value %d passed for max_sectors, range is 64 to 32767. Assigning value of 64.\n",
10424+ max_sectors);
1060010425 } else if (max_sectors > 32767) {
1060110426 shost->max_sectors = 32767;
10602− pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
10603− "for max_sectors, range is 64 to 32767." \
10604− "Assigning default value of 32767.\n", \
10605− ioc->name, max_sectors);
10427+ ioc_warn(ioc, "Invalid value %d passed for max_sectors, range is 64 to 32767.Assigning default value of 32767.\n",
10428+ max_sectors);
1060610429 } else {
1060710430 shost->max_sectors = max_sectors & 0xFFFE;
10608− pr_info(MPT3SAS_FMT
10609− "The max_sectors value is set to %d\n",
10610− ioc->name, shost->max_sectors);
10431+ ioc_info(ioc, "The max_sectors value is set to %d\n",
10432+ shost->max_sectors);
1061110433 }
1061210434 }
1061310435 }
@@ -10627,16 +10449,16 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 13 unmodified lines
1062710449 ioc->firmware_event_thread = alloc_ordered_workqueue(
1062810450 ioc->firmware_event_name, 0);
1062910451 if (!ioc->firmware_event_thread) {
10630− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
10631− ioc->name, __FILE__, __LINE__, __func__);
10452+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
10453+ __FILE__, __LINE__, __func__);
1063210454 rv = -ENODEV;
1063310455 goto out_thread_fail;
1063410456 }
1063510457
1063610458 ioc->is_driver_loading = 1;
1063710459 if ((mpt3sas_base_attach(ioc))) {
10638− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
10639− ioc->name, __FILE__, __LINE__, __func__);
10460+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
10461+ __FILE__, __LINE__, __func__);
1064010462 rv = -ENODEV;
1064110463 goto out_attach_fail;
1064210464 }
@@ -10657,8 +10479,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 14 unmodified lines
1065710479
1065810480 rv = scsi_add_host(shost, &pdev->dev);
1065910481 if (rv) {
10660− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
10661− ioc->name, __FILE__, __LINE__, __func__);
10482+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
10483+ __FILE__, __LINE__, __func__);
1066210484 goto out_add_shost_fail;
1066310485 }
1066410486
@@ -10695,9 +10517,8 @@ scsih_suspend(struct pci_dev *pdev, pm_message_t state) · 30 unmodified lines
1069510517 flush_scheduled_work();
1069610518 scsi_block_requests(shost);
1069710519 device_state = pci_choose_state(pdev, state);
10698− pr_info(MPT3SAS_FMT
10699− "pdev=0x%p, slot=%s, entering operating state [D%d]\n",
10700− ioc->name, pdev, pci_name(pdev), device_state);
10520+ ioc_info(ioc, "pdev=0x%p, slot=%s, entering operating state [D%d]\n",
10521+ pdev, pci_name(pdev), device_state);
1070110522
1070210523 pci_save_state(pdev);
1070310524 mpt3sas_base_free_resources(ioc);
@@ -10719,9 +10540,8 @@ scsih_resume(struct pci_dev *pdev) · 15 unmodified lines
1071910540 pci_power_t device_state = pdev->current_state;
1072010541 int r;
1072110542
10722− pr_info(MPT3SAS_FMT
10723− "pdev=0x%p, slot=%s, previous operating state [D%d]\n",
10724− ioc->name, pdev, pci_name(pdev), device_state);
10543+ ioc_info(ioc, "pdev=0x%p, slot=%s, previous operating state [D%d]\n",
10544+ pdev, pci_name(pdev), device_state);
1072510545
1072610546 pci_set_power_state(pdev, PCI_D0);
1072710547 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
1075310573 struct Scsi_Host *shost = pci_get_drvdata(pdev);
1075410574 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
1075510575
10756− pr_info(MPT3SAS_FMT "PCI error: detected callback, state(%d)!!\n",
10757− ioc->name, state);
10576+ ioc_info(ioc, "PCI error: detected callback, state(%d)!!\n", state);
1075810577
1075910578 switch (state) {
1076010579 case pci_channel_io_normal:
@@ -10791,8 +10610,7 @@ scsih_pci_slot_reset(struct pci_dev *pdev) · 30 unmodified lines
1079110610 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
1079210611 int rc;
1079310612
10794− pr_info(MPT3SAS_FMT "PCI error: slot reset callback!!\n",
10795− ioc->name);
10613+ ioc_info(ioc, "PCI error: slot reset callback!!\n");
1079610614
1079710615 ioc->pci_error_recovery = 0;
1079810616 ioc->pdev = pdev;
@@ -10803,8 +10621,8 @@ scsih_pci_slot_reset(struct pci_dev *pdev) · 4 unmodified lines
1080310621
1080410622 rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
1080510623
10806− pr_warn(MPT3SAS_FMT "hard reset: %s\n", ioc->name,
10807− (rc == 0) ? "success" : "failed");
10624+ ioc_warn(ioc, "hard reset: %s\n",
10625+ (rc == 0) ? "success" : "failed");
1080810626
1080910627 if (!rc)
1081010628 return PCI_ERS_RESULT_RECOVERED;
@@ -10826,7 +10644,7 @@ scsih_pci_resume(struct pci_dev *pdev) · 15 unmodified lines
1082610644 struct Scsi_Host *shost = pci_get_drvdata(pdev);
1082710645 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
1082810646
10829− pr_info(MPT3SAS_FMT "PCI error: resume callback!!\n", ioc->name);
10647+ ioc_info(ioc, "PCI error: resume callback!!\n");
1083010648
1083110649 mpt3sas_base_start_watchdog(ioc);
1083210650 scsi_unblock_requests(ioc->shost);
@@ -10842,8 +10660,7 @@ scsih_pci_mmio_enabled(struct pci_dev *pdev) · 9 unmodified lines
1084210660 struct Scsi_Host *shost = pci_get_drvdata(pdev);
1084310661 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
1084410662
10845− pr_info(MPT3SAS_FMT "PCI error: mmio enabled callback!!\n",
10846− ioc->name);
10663+ ioc_info(ioc, "PCI error: mmio enabled callback!!\n");
1084710664
1084810665 /* TODO - dump whatever for debugging purposes */
1084910666
drivers/scsi/mpt3sas/mpt3sas_transport.c+159−196
@@ -146,25 +146,22 @@ _transport_set_identify(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 145 unmodified lines
146146 u32 ioc_status;
147147
148148 if (ioc->shost_recovery || ioc->pci_error_recovery) {
149− pr_info(MPT3SAS_FMT "%s: host reset in progress!\n",
150− __func__, ioc->name);
149+ ioc_info(ioc, "%s: host reset in progress!\n", __func__);
151150 return -EFAULT;
152151 }
153152
154153 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
155154 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
156− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
157− ioc->name, __FILE__, __LINE__, __func__);
155+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
156+ __FILE__, __LINE__, __func__);
158157 return -ENXIO;
159158 }
160159
161160 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
162161 MPI2_IOCSTATUS_MASK;
163162 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
164− pr_err(MPT3SAS_FMT
165− "handle(0x%04x), ioc_status(0x%04x)\nfailure at %s:%d/%s()!\n",
166− ioc->name, handle, ioc_status,
167− __FILE__, __LINE__, __func__);
163+ ioc_err(ioc, "handle(0x%04x), ioc_status(0x%04x) failure at %s:%d/%s()!\n",
164+ handle, ioc_status, __FILE__, __LINE__, __func__);
168165 return -EIO;
169166 }
170167
@@ -310,16 +307,14 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 139 unmodified lines
310307 u16 wait_state_count;
311308
312309 if (ioc->shost_recovery || ioc->pci_error_recovery) {
313− pr_info(MPT3SAS_FMT "%s: host reset in progress!\n",
314− __func__, ioc->name);
310+ ioc_info(ioc, "%s: host reset in progress!\n", __func__);
315311 return -EFAULT;
316312 }
317313
318314 mutex_lock(&ioc->transport_cmds.mutex);
319315
320316 if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {
321− pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n",
322− ioc->name, __func__);
317+ ioc_err(ioc, "%s: transport_cmds in use\n", __func__);
323318 rc = -EAGAIN;
324319 goto out;
325320 }
@@ -329,26 +324,22 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
329324 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
330325 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
331326 if (wait_state_count++ == 10) {
332− pr_err(MPT3SAS_FMT
333− "%s: failed due to ioc not operational\n",
334− ioc->name, __func__);
327+ ioc_err(ioc, "%s: failed due to ioc not operational\n",
328+ __func__);
335329 rc = -EFAULT;
336330 goto out;
337331 }
338332 ssleep(1);
339333 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
340− pr_info(MPT3SAS_FMT
341− "%s: waiting for operational state(count=%d)\n",
342− ioc->name, __func__, wait_state_count);
334+ ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
335+ __func__, wait_state_count);
343336 }
344337 if (wait_state_count)
345− pr_info(MPT3SAS_FMT "%s: ioc is operational\n",
346− ioc->name, __func__);
338+ ioc_info(ioc, "%s: ioc is operational\n", __func__);
347339
348340 smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);
349341 if (!smid) {
350− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
351− ioc->name, __func__);
342+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
352343 rc = -EAGAIN;
353344 goto out;
354345 }
@@ -359,9 +350,8 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 4 unmodified lines
359350
360351 data_out_sz = sizeof(struct rep_manu_request);
361352 data_in_sz = sizeof(struct rep_manu_reply);
362− data_out = pci_alloc_consistent(ioc->pdev, data_out_sz + data_in_sz,
363− &data_out_dma);
364−
353+ data_out = dma_alloc_coherent(&ioc->pdev->dev, data_out_sz + data_in_sz,
354+ &data_out_dma, GFP_KERNEL);
365355 if (!data_out) {
366356 pr_err("failure at %s:%d/%s()!\n", __FILE__,
367357 __LINE__, __func__);
@@ -388,16 +378,15 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 20 unmodified lines
388378 ioc->build_sg(ioc, psge, data_out_dma, data_out_sz, data_in_dma,
389379 data_in_sz);
390380
391− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
392− "report_manufacture - send to sas_addr(0x%016llx)\n",
393− ioc->name, (unsigned long long)sas_address));
381+ dtransportprintk(ioc,
382+ ioc_info(ioc, "report_manufacture - send to sas_addr(0x%016llx)\n",
383+ (u64)sas_address));
394384 init_completion(&ioc->transport_cmds.done);
395385 mpt3sas_base_put_smid_default(ioc, smid);
396386 wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
397387
398388 if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
399− pr_err(MPT3SAS_FMT "%s: timeout\n",
400− ioc->name, __func__);
389+ ioc_err(ioc, "%s: timeout\n", __func__);
401390 _debug_dump_mf(mpi_request,
402391 sizeof(Mpi2SmpPassthroughRequest_t)/4);
403392 if (!(ioc->transport_cmds.status & MPT3_CMD_RESET))
@@ -405,17 +394,16 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
405394 goto issue_host_reset;
406395 }
407396
408− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
409− "report_manufacture - complete\n", ioc->name));
397+ dtransportprintk(ioc, ioc_info(ioc, "report_manufacture - complete\n"));
410398
411399 if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) {
412400 u8 *tmp;
413401
414402 mpi_reply = ioc->transport_cmds.reply;
415403
416− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
417− "report_manufacture - reply data transfer size(%d)\n",
418− ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength)));
404+ dtransportprintk(ioc,
405+ ioc_info(ioc, "report_manufacture - reply data transfer size(%d)\n",
406+ le16_to_cpu(mpi_reply->ResponseDataLength)));
419407
420408 if (le16_to_cpu(mpi_reply->ResponseDataLength) !=
421409 sizeof(struct rep_manu_reply))
@@ -439,8 +427,8 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 17 unmodified lines
439427 manufacture_reply->component_revision_id;
440428 }
441429 } else
442− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
443− "report_manufacture - no reply\n", ioc->name));
430+ dtransportprintk(ioc,
431+ ioc_info(ioc, "report_manufacture - no reply\n"));
444432
445433 issue_host_reset:
446434 if (issue_reset)
@@ -448,7 +436,7 @@ _transport_expander_report_manufacture(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
448436 out:
449437 ioc->transport_cmds.status = MPT3_CMD_NOT_USED;
450438 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,
452440 data_out, data_out_dma);
453441
454442 mutex_unlock(&ioc->transport_cmds.mutex);
@@ -643,8 +631,8 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 188 unmodified lines
643631 mpt3sas_port = kzalloc(sizeof(struct _sas_port),
644632 GFP_KERNEL);
645633 if (!mpt3sas_port) {
646− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
647− ioc->name, __FILE__, __LINE__, __func__);
634+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
635+ __FILE__, __LINE__, __func__);
648636 return NULL;
649637 }
650638
@@ -655,22 +643,21 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 4 unmodified lines
655643 spin_unlock_irqrestore(&ioc->sas_node_lock, flags);
656644
657645 if (!sas_node) {
658− pr_err(MPT3SAS_FMT
659− "%s: Could not find parent sas_address(0x%016llx)!\n",
660− ioc->name, __func__, (unsigned long long)sas_address);
646+ ioc_err(ioc, "%s: Could not find parent sas_address(0x%016llx)!\n",
647+ __func__, (u64)sas_address);
661648 goto out_fail;
662649 }
663650
664651 if ((_transport_set_identify(ioc, handle,
665652 &mpt3sas_port->remote_identify))) {
666− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
667− ioc->name, __FILE__, __LINE__, __func__);
653+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
654+ __FILE__, __LINE__, __func__);
668655 goto out_fail;
669656 }
670657
671658 if (mpt3sas_port->remote_identify.device_type == SAS_PHY_UNUSED) {
672− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
673− ioc->name, __FILE__, __LINE__, __func__);
659+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
660+ __FILE__, __LINE__, __func__);
674661 goto out_fail;
675662 }
676663
@@ -687,20 +674,20 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 10 unmodified lines
687674 }
688675
689676 if (!mpt3sas_port->num_phys) {
690− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
691− ioc->name, __FILE__, __LINE__, __func__);
677+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
678+ __FILE__, __LINE__, __func__);
692679 goto out_fail;
693680 }
694681
695682 if (!sas_node->parent_dev) {
696− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
697− ioc->name, __FILE__, __LINE__, __func__);
683+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
684+ __FILE__, __LINE__, __func__);
698685 goto out_fail;
699686 }
700687 port = sas_port_alloc_num(sas_node->parent_dev);
701688 if ((sas_port_add(port))) {
702− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
703− ioc->name, __FILE__, __LINE__, __func__);
689+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
690+ __FILE__, __LINE__, __func__);
704691 goto out_fail;
705692 }
706693
@@ -729,17 +716,17 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, · 22 unmodified lines
729716 sas_device = mpt3sas_get_sdev_by_addr(ioc,
730717 mpt3sas_port->remote_identify.sas_address);
731718 if (!sas_device) {
732− dfailprintk(ioc, printk(MPT3SAS_FMT
733− "failure at %s:%d/%s()!\n",
734− ioc->name, __FILE__, __LINE__, __func__));
719+ dfailprintk(ioc,
720+ ioc_info(ioc, "failure at %s:%d/%s()!\n",
721+ __FILE__, __LINE__, __func__));
735722 goto out_fail;
736723 }
737724 sas_device->pend_sas_rphy_add = 1;
738725 }
739726
740727 if ((sas_rphy_add(rphy))) {
741− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
742− ioc->name, __FILE__, __LINE__, __func__);
728+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
729+ __FILE__, __LINE__, __func__);
743730 }
744731
745732 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
861848 INIT_LIST_HEAD(&mpt3sas_phy->port_siblings);
862849 phy = sas_phy_alloc(parent_dev, phy_index);
863850 if (!phy) {
864− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
865− ioc->name, __FILE__, __LINE__, __func__);
851+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
852+ __FILE__, __LINE__, __func__);
866853 return -1;
867854 }
868855 if ((_transport_set_identify(ioc, mpt3sas_phy->handle,
869856 &mpt3sas_phy->identify))) {
870− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
871− ioc->name, __FILE__, __LINE__, __func__);
857+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
858+ __FILE__, __LINE__, __func__);
872859 sas_phy_free(phy);
873860 return -1;
874861 }
@@ -890,8 +877,8 @@ mpt3sas_transport_add_host_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy · 15 unmodified lines
890877 phy_pg0.ProgrammedLinkRate >> 4);
891878
892879 if ((sas_phy_add(phy))) {
893− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
894− ioc->name, __FILE__, __LINE__, __func__);
880+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
881+ __FILE__, __LINE__, __func__);
895882 sas_phy_free(phy);
896883 return -1;
897884 }
@@ -929,14 +916,14 @@ mpt3sas_transport_add_expander_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy · 31 unmodified lines
929916 INIT_LIST_HEAD(&mpt3sas_phy->port_siblings);
930917 phy = sas_phy_alloc(parent_dev, phy_index);
931918 if (!phy) {
932− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
933− ioc->name, __FILE__, __LINE__, __func__);
919+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
920+ __FILE__, __LINE__, __func__);
934921 return -1;
935922 }
936923 if ((_transport_set_identify(ioc, mpt3sas_phy->handle,
937924 &mpt3sas_phy->identify))) {
938− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
939− ioc->name, __FILE__, __LINE__, __func__);
925+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
926+ __FILE__, __LINE__, __func__);
940927 sas_phy_free(phy);
941928 return -1;
942929 }
@@ -960,8 +947,8 @@ mpt3sas_transport_add_expander_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy · 17 unmodified lines
960947 expander_pg1.ProgrammedLinkRate >> 4);
961948
962949 if ((sas_phy_add(phy))) {
963− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
964− ioc->name, __FILE__, __LINE__, __func__);
950+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
951+ __FILE__, __LINE__, __func__);
965952 sas_phy_free(phy);
966953 return -1;
967954 }
@@ -1098,16 +1085,14 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 130 unmodified lines
10981085 u16 wait_state_count;
10991086
11001087 if (ioc->shost_recovery || ioc->pci_error_recovery) {
1101− pr_info(MPT3SAS_FMT "%s: host reset in progress!\n",
1102− __func__, ioc->name);
1088+ ioc_info(ioc, "%s: host reset in progress!\n", __func__);
11031089 return -EFAULT;
11041090 }
11051091
11061092 mutex_lock(&ioc->transport_cmds.mutex);
11071093
11081094 if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {
1109− pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n",
1110− ioc->name, __func__);
1095+ ioc_err(ioc, "%s: transport_cmds in use\n", __func__);
11111096 rc = -EAGAIN;
11121097 goto out;
11131098 }
@@ -1117,26 +1102,22 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
11171102 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
11181103 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
11191104 if (wait_state_count++ == 10) {
1120− pr_err(MPT3SAS_FMT
1121− "%s: failed due to ioc not operational\n",
1122− ioc->name, __func__);
1105+ ioc_err(ioc, "%s: failed due to ioc not operational\n",
1106+ __func__);
11231107 rc = -EFAULT;
11241108 goto out;
11251109 }
11261110 ssleep(1);
11271111 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
1128− pr_info(MPT3SAS_FMT
1129− "%s: waiting for operational state(count=%d)\n",
1130− ioc->name, __func__, wait_state_count);
1112+ ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
1113+ __func__, wait_state_count);
11311114 }
11321115 if (wait_state_count)
1133− pr_info(MPT3SAS_FMT "%s: ioc is operational\n",
1134− ioc->name, __func__);
1116+ ioc_info(ioc, "%s: ioc is operational\n", __func__);
11351117
11361118 smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);
11371119 if (!smid) {
1138− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
1139− ioc->name, __func__);
1120+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
11401121 rc = -EAGAIN;
11411122 goto out;
11421123 }
@@ -1146,7 +1127,8 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
11461127
11471128 sz = sizeof(struct phy_error_log_request) +
11481129 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);
11501132 if (!data_out) {
11511133 pr_err("failure at %s:%d/%s()!\n", __FILE__,
11521134 __LINE__, __func__);
@@ -1179,17 +1161,16 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 26 unmodified lines
11791161 data_out_dma + sizeof(struct phy_error_log_request),
11801162 sizeof(struct phy_error_log_reply));
11811163
1182− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
1183− "phy_error_log - send to sas_addr(0x%016llx), phy(%d)\n",
1184− ioc->name, (unsigned long long)phy->identify.sas_address,
1185− phy->number));
1164+ dtransportprintk(ioc,
1165+ ioc_info(ioc, "phy_error_log - send to sas_addr(0x%016llx), phy(%d)\n",
1166+ (u64)phy->identify.sas_address,
1167+ phy->number));
11861168 init_completion(&ioc->transport_cmds.done);
11871169 mpt3sas_base_put_smid_default(ioc, smid);
11881170 wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
11891171
11901172 if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
1191− pr_err(MPT3SAS_FMT "%s: timeout\n",
1192− ioc->name, __func__);
1173+ ioc_err(ioc, "%s: timeout\n", __func__);
11931174 _debug_dump_mf(mpi_request,
11941175 sizeof(Mpi2SmpPassthroughRequest_t)/4);
11951176 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
11971178 goto issue_host_reset;
11981179 }
11991180
1200− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
1201− "phy_error_log - complete\n", ioc->name));
1181+ dtransportprintk(ioc, ioc_info(ioc, "phy_error_log - complete\n"));
12021182
12031183 if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) {
12041184
12051185 mpi_reply = ioc->transport_cmds.reply;
12061186
1207− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
1208− "phy_error_log - reply data transfer size(%d)\n",
1209− ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength)));
1187+ dtransportprintk(ioc,
1188+ ioc_info(ioc, "phy_error_log - reply data transfer size(%d)\n",
1189+ le16_to_cpu(mpi_reply->ResponseDataLength)));
12101190
12111191 if (le16_to_cpu(mpi_reply->ResponseDataLength) !=
12121192 sizeof(struct phy_error_log_reply))
@@ -1215,9 +1195,9 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines
12151195 phy_error_log_reply = data_out +
12161196 sizeof(struct phy_error_log_request);
12171197
1218− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
1219− "phy_error_log - function_result(%d)\n",
1220− ioc->name, phy_error_log_reply->function_result));
1198+ dtransportprintk(ioc,
1199+ ioc_info(ioc, "phy_error_log - function_result(%d)\n",
1200+ phy_error_log_reply->function_result));
12211201
12221202 phy->invalid_dword_count =
12231203 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
12291209 be32_to_cpu(phy_error_log_reply->phy_reset_problem);
12301210 rc = 0;
12311211 } else
1232− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
1233− "phy_error_log - no reply\n", ioc->name));
1212+ dtransportprintk(ioc,
1213+ ioc_info(ioc, "phy_error_log - no reply\n"));
12341214
12351215 issue_host_reset:
12361216 if (issue_reset)
@@ -1238,7 +1218,7 @@ _transport_get_expander_phy_error_log(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
12381218 out:
12391219 ioc->transport_cmds.status = MPT3_CMD_NOT_USED;
12401220 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);
12421222
12431223 mutex_unlock(&ioc->transport_cmds.mutex);
12441224 return rc;
@@ -1273,17 +1253,16 @@ _transport_get_linkerrors(struct sas_phy *phy) · 28 unmodified lines
12731253 /* get hba phy error logs */
12741254 if ((mpt3sas_config_get_phy_pg1(ioc, &mpi_reply, &phy_pg1,
12751255 phy->number))) {
1276− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1277− ioc->name, __FILE__, __LINE__, __func__);
1256+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1257+ __FILE__, __LINE__, __func__);
12781258 return -ENXIO;
12791259 }
12801260
12811261 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo)
1282− pr_info(MPT3SAS_FMT
1283− "phy(%d), ioc_status (0x%04x), loginfo(0x%08x)\n",
1284− ioc->name, phy->number,
1285− le16_to_cpu(mpi_reply.IOCStatus),
1286− le32_to_cpu(mpi_reply.IOCLogInfo));
1262+ ioc_info(ioc, "phy(%d), ioc_status (0x%04x), loginfo(0x%08x)\n",
1263+ phy->number,
1264+ le16_to_cpu(mpi_reply.IOCStatus),
1265+ le32_to_cpu(mpi_reply.IOCLogInfo));
12871266
12881267 phy->invalid_dword_count = le32_to_cpu(phy_pg1.InvalidDwordCount);
12891268 phy->running_disparity_error_count =
@@ -1411,16 +1390,14 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 121 unmodified lines
14111390 u16 wait_state_count;
14121391
14131392 if (ioc->shost_recovery || ioc->pci_error_recovery) {
1414− pr_info(MPT3SAS_FMT "%s: host reset in progress!\n",
1415− __func__, ioc->name);
1393+ ioc_info(ioc, "%s: host reset in progress!\n", __func__);
14161394 return -EFAULT;
14171395 }
14181396
14191397 mutex_lock(&ioc->transport_cmds.mutex);
14201398
14211399 if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {
1422− pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n",
1423− ioc->name, __func__);
1400+ ioc_err(ioc, "%s: transport_cmds in use\n", __func__);
14241401 rc = -EAGAIN;
14251402 goto out;
14261403 }
@@ -1430,26 +1407,22 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
14301407 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
14311408 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
14321409 if (wait_state_count++ == 10) {
1433− pr_err(MPT3SAS_FMT
1434− "%s: failed due to ioc not operational\n",
1435− ioc->name, __func__);
1410+ ioc_err(ioc, "%s: failed due to ioc not operational\n",
1411+ __func__);
14361412 rc = -EFAULT;
14371413 goto out;
14381414 }
14391415 ssleep(1);
14401416 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
1441− pr_info(MPT3SAS_FMT
1442− "%s: waiting for operational state(count=%d)\n",
1443− ioc->name, __func__, wait_state_count);
1417+ ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
1418+ __func__, wait_state_count);
14441419 }
14451420 if (wait_state_count)
1446− pr_info(MPT3SAS_FMT "%s: ioc is operational\n",
1447− ioc->name, __func__);
1421+ ioc_info(ioc, "%s: ioc is operational\n", __func__);
14481422
14491423 smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);
14501424 if (!smid) {
1451− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
1452− ioc->name, __func__);
1425+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
14531426 rc = -EAGAIN;
14541427 goto out;
14551428 }
@@ -1459,7 +1432,8 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
14591432
14601433 sz = sizeof(struct phy_control_request) +
14611434 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);
14631437 if (!data_out) {
14641438 pr_err("failure at %s:%d/%s()!\n", __FILE__,
14651439 __LINE__, __func__);
@@ -1497,17 +1471,16 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 31 unmodified lines
14971471 data_out_dma + sizeof(struct phy_control_request),
14981472 sizeof(struct phy_control_reply));
14991473
1500− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
1501− "phy_control - send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n",
1502− ioc->name, (unsigned long long)phy->identify.sas_address,
1503− phy->number, phy_operation));
1474+ dtransportprintk(ioc,
1475+ ioc_info(ioc, "phy_control - send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n",
1476+ (u64)phy->identify.sas_address,
1477+ phy->number, phy_operation));
15041478 init_completion(&ioc->transport_cmds.done);
15051479 mpt3sas_base_put_smid_default(ioc, smid);
15061480 wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
15071481
15081482 if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
1509− pr_err(MPT3SAS_FMT "%s: timeout\n",
1510− ioc->name, __func__);
1483+ ioc_err(ioc, "%s: timeout\n", __func__);
15111484 _debug_dump_mf(mpi_request,
15121485 sizeof(Mpi2SmpPassthroughRequest_t)/4);
15131486 if (!(ioc->transport_cmds.status & MPT3_CMD_RESET))
@@ -1515,16 +1488,15 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
15151488 goto issue_host_reset;
15161489 }
15171490
1518− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
1519− "phy_control - complete\n", ioc->name));
1491+ dtransportprintk(ioc, ioc_info(ioc, "phy_control - complete\n"));
15201492
15211493 if (ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID) {
15221494
15231495 mpi_reply = ioc->transport_cmds.reply;
15241496
1525− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
1526− "phy_control - reply data transfer size(%d)\n",
1527− ioc->name, le16_to_cpu(mpi_reply->ResponseDataLength)));
1497+ dtransportprintk(ioc,
1498+ ioc_info(ioc, "phy_control - reply data transfer size(%d)\n",
1499+ le16_to_cpu(mpi_reply->ResponseDataLength)));
15281500
15291501 if (le16_to_cpu(mpi_reply->ResponseDataLength) !=
15301502 sizeof(struct phy_control_reply))
@@ -1533,14 +1505,14 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 2 unmodified lines
15331505 phy_control_reply = data_out +
15341506 sizeof(struct phy_control_request);
15351507
1536− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
1537− "phy_control - function_result(%d)\n",
1538− ioc->name, phy_control_reply->function_result));
1508+ dtransportprintk(ioc,
1509+ ioc_info(ioc, "phy_control - function_result(%d)\n",
1510+ phy_control_reply->function_result));
15391511
15401512 rc = 0;
15411513 } else
1542− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
1543− "phy_control - no reply\n", ioc->name));
1514+ dtransportprintk(ioc,
1515+ ioc_info(ioc, "phy_control - no reply\n"));
15441516
15451517 issue_host_reset:
15461518 if (issue_reset)
@@ -1548,7 +1520,8 @@ _transport_expander_phy_control(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
15481520 out:
15491521 ioc->transport_cmds.status = MPT3_CMD_NOT_USED;
15501522 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);
15521525
15531526 mutex_unlock(&ioc->transport_cmds.mutex);
15541527 return rc;
@@ -1591,16 +1564,15 @@ _transport_phy_reset(struct sas_phy *phy, int hard_reset) · 36 unmodified lines
15911564 mpi_request.PhyNum = phy->number;
15921565
15931566 if ((mpt3sas_base_sas_iounit_control(ioc, &mpi_reply, &mpi_request))) {
1594− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1595− ioc->name, __FILE__, __LINE__, __func__);
1567+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1568+ __FILE__, __LINE__, __func__);
15961569 return -ENXIO;
15971570 }
15981571
15991572 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo)
1600− pr_info(MPT3SAS_FMT
1601− "phy(%d), ioc_status(0x%04x), loginfo(0x%08x)\n",
1602− ioc->name, phy->number, le16_to_cpu(mpi_reply.IOCStatus),
1603− le32_to_cpu(mpi_reply.IOCLogInfo));
1573+ ioc_info(ioc, "phy(%d), ioc_status(0x%04x), loginfo(0x%08x)\n",
1574+ phy->number, le16_to_cpu(mpi_reply.IOCStatus),
1575+ le32_to_cpu(mpi_reply.IOCLogInfo));
16041576
16051577 return 0;
16061578 }
@@ -1647,23 +1619,23 @@ _transport_phy_enable(struct sas_phy *phy, int enable) · 40 unmodified lines
16471619 sizeof(Mpi2SasIOUnit0PhyData_t));
16481620 sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL);
16491621 if (!sas_iounit_pg0) {
1650− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1651− ioc->name, __FILE__, __LINE__, __func__);
1622+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1623+ __FILE__, __LINE__, __func__);
16521624 rc = -ENOMEM;
16531625 goto out;
16541626 }
16551627 if ((mpt3sas_config_get_sas_iounit_pg0(ioc, &mpi_reply,
16561628 sas_iounit_pg0, sz))) {
1657− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1658− ioc->name, __FILE__, __LINE__, __func__);
1629+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1630+ __FILE__, __LINE__, __func__);
16591631 rc = -ENXIO;
16601632 goto out;
16611633 }
16621634 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
16631635 MPI2_IOCSTATUS_MASK;
16641636 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
1665− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1666− ioc->name, __FILE__, __LINE__, __func__);
1637+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1638+ __FILE__, __LINE__, __func__);
16671639 rc = -EIO;
16681640 goto out;
16691641 }
@@ -1672,10 +1644,8 @@ _transport_phy_enable(struct sas_phy *phy, int enable) · 2 unmodified lines
16721644 for (i = 0, discovery_active = 0; i < ioc->sas_hba.num_phys ; i++) {
16731645 if (sas_iounit_pg0->PhyData[i].PortFlags &
16741646 MPI2_SASIOUNIT0_PORTFLAGS_DISCOVERY_IN_PROGRESS) {
1675− pr_err(MPT3SAS_FMT "discovery is active on " \
1676− "port = %d, phy = %d: unable to enable/disable "
1677− "phys, try again later!\n", ioc->name,
1678− sas_iounit_pg0->PhyData[i].Port, i);
1647+ ioc_err(ioc, "discovery is active on port = %d, phy = %d: unable to enable/disable phys, try again later!\n",
1648+ sas_iounit_pg0->PhyData[i].Port, i);
16791649 discovery_active = 1;
16801650 }
16811651 }
@@ -1690,23 +1660,23 @@ _transport_phy_enable(struct sas_phy *phy, int enable) · 8 unmodified lines
16901660 sizeof(Mpi2SasIOUnit1PhyData_t));
16911661 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
16921662 if (!sas_iounit_pg1) {
1693− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1694− ioc->name, __FILE__, __LINE__, __func__);
1663+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1664+ __FILE__, __LINE__, __func__);
16951665 rc = -ENOMEM;
16961666 goto out;
16971667 }
16981668 if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
16991669 sas_iounit_pg1, sz))) {
1700− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1701− ioc->name, __FILE__, __LINE__, __func__);
1670+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1671+ __FILE__, __LINE__, __func__);
17021672 rc = -ENXIO;
17031673 goto out;
17041674 }
17051675 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
17061676 MPI2_IOCSTATUS_MASK;
17071677 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
1708− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1709− ioc->name, __FILE__, __LINE__, __func__);
1678+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1679+ __FILE__, __LINE__, __func__);
17101680 rc = -EIO;
17111681 goto out;
17121682 }
@@ -1798,23 +1768,23 @@ _transport_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates) · 85 unmodified lines
17981768 sizeof(Mpi2SasIOUnit1PhyData_t));
17991769 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
18001770 if (!sas_iounit_pg1) {
1801− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1802− ioc->name, __FILE__, __LINE__, __func__);
1771+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1772+ __FILE__, __LINE__, __func__);
18031773 rc = -ENOMEM;
18041774 goto out;
18051775 }
18061776 if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
18071777 sas_iounit_pg1, sz))) {
1808− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1809− ioc->name, __FILE__, __LINE__, __func__);
1778+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1779+ __FILE__, __LINE__, __func__);
18101780 rc = -ENXIO;
18111781 goto out;
18121782 }
18131783 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
18141784 MPI2_IOCSTATUS_MASK;
18151785 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
1816− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1817− ioc->name, __FILE__, __LINE__, __func__);
1786+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1787+ __FILE__, __LINE__, __func__);
18181788 rc = -EIO;
18191789 goto out;
18201790 }
@@ -1833,8 +1803,8 @@ _transport_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates) · 12 unmodified lines
18331803
18341804 if (mpt3sas_config_set_sas_iounit_pg1(ioc, &mpi_reply, sas_iounit_pg1,
18351805 sz)) {
1836− pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1837− ioc->name, __FILE__, __LINE__, __func__);
1806+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
1807+ __FILE__, __LINE__, __func__);
18381808 rc = -ENXIO;
18391809 goto out;
18401810 }
@@ -1922,8 +1892,7 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 81 unmodified lines
19221892 unsigned int reslen = 0;
19231893
19241894 if (ioc->shost_recovery || ioc->pci_error_recovery) {
1925− pr_info(MPT3SAS_FMT "%s: host reset in progress!\n",
1926− __func__, ioc->name);
1895+ ioc_info(ioc, "%s: host reset in progress!\n", __func__);
19271896 rc = -EFAULT;
19281897 goto job_done;
19291898 }
@@ -1933,8 +1902,8 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 3 unmodified lines
19331902 goto job_done;
19341903
19351904 if (ioc->transport_cmds.status != MPT3_CMD_NOT_USED) {
1936− pr_err(MPT3SAS_FMT "%s: transport_cmds in use\n", ioc->name,
1937− __func__);
1905+ ioc_err(ioc, "%s: transport_cmds in use\n",
1906+ __func__);
19381907 rc = -EAGAIN;
19391908 goto out;
19401909 }
@@ -1959,26 +1928,22 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 18 unmodified lines
19591928 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
19601929 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
19611930 if (wait_state_count++ == 10) {
1962− pr_err(MPT3SAS_FMT
1963− "%s: failed due to ioc not operational\n",
1964− ioc->name, __func__);
1931+ ioc_err(ioc, "%s: failed due to ioc not operational\n",
1932+ __func__);
19651933 rc = -EFAULT;
19661934 goto unmap_in;
19671935 }
19681936 ssleep(1);
19691937 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
1970− pr_info(MPT3SAS_FMT
1971− "%s: waiting for operational state(count=%d)\n",
1972− ioc->name, __func__, wait_state_count);
1938+ ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
1939+ __func__, wait_state_count);
19731940 }
19741941 if (wait_state_count)
1975− pr_info(MPT3SAS_FMT "%s: ioc is operational\n",
1976− ioc->name, __func__);
1942+ ioc_info(ioc, "%s: ioc is operational\n", __func__);
19771943
19781944 smid = mpt3sas_base_get_smid(ioc, ioc->transport_cb_idx);
19791945 if (!smid) {
1980− pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
1981− ioc->name, __func__);
1946+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
19821947 rc = -EAGAIN;
19831948 goto unmap_in;
19841949 }
@@ -1999,16 +1964,15 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 14 unmodified lines
19991964 ioc->build_sg(ioc, psge, dma_addr_out, dma_len_out - 4, dma_addr_in,
20001965 dma_len_in - 4);
20011966
2002− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
2003− "%s - sending smp request\n", ioc->name, __func__));
1967+ dtransportprintk(ioc,
1968+ ioc_info(ioc, "%s: sending smp request\n", __func__));
20041969
20051970 init_completion(&ioc->transport_cmds.done);
20061971 mpt3sas_base_put_smid_default(ioc, smid);
20071972 wait_for_completion_timeout(&ioc->transport_cmds.done, 10*HZ);
20081973
20091974 if (!(ioc->transport_cmds.status & MPT3_CMD_COMPLETE)) {
2010− pr_err(MPT3SAS_FMT "%s : timeout\n",
2011− __func__, ioc->name);
1975+ ioc_err(ioc, "%s: timeout\n", __func__);
20121976 _debug_dump_mf(mpi_request,
20131977 sizeof(Mpi2SmpPassthroughRequest_t)/4);
20141978 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
20181982 }
20191983 }
20201984
2021− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
2022− "%s - complete\n", ioc->name, __func__));
1985+ dtransportprintk(ioc, ioc_info(ioc, "%s - complete\n", __func__));
20231986
20241987 if (!(ioc->transport_cmds.status & MPT3_CMD_REPLY_VALID)) {
2025− dtransportprintk(ioc, pr_info(MPT3SAS_FMT
2026− "%s - no reply\n", ioc->name, __func__));
1988+ dtransportprintk(ioc,
1989+ ioc_info(ioc, "%s: no reply\n", __func__));
20271990 rc = -ENXIO;
20281991 goto unmap_in;
20291992 }
@@ -2031,9 +1994,9 @@ _transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, · 1 unmodified line
20311994 mpi_reply = ioc->transport_cmds.reply;
20321995
20331996 dtransportprintk(ioc,
2034− pr_info(MPT3SAS_FMT "%s - reply data transfer size(%d)\n",
2035− ioc->name, __func__,
2036− le16_to_cpu(mpi_reply->ResponseDataLength)));
1997+ ioc_info(ioc, "%s: reply data transfer size(%d)\n",
1998+ __func__,
1999+ le16_to_cpu(mpi_reply->ResponseDataLength)));
20372000
20382001 memcpy(job->reply, mpi_reply, sizeof(*mpi_reply));
20392002 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
7272 u16 sz, event_data_sz;
7373 unsigned long flags;
7474
75− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n",
76− ioc->name, __func__));
75+ dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: enter\n", __func__));
7776
7877 sz = offsetof(Mpi2EventNotificationReply_t, EventData) +
7978 sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T) + 4;
@@ -85,23 +84,23 @@ _mpt3sas_raise_sigio(struct MPT3SAS_ADAPTER *ioc, · 5 unmodified lines
8584 mpi_reply->EventDataLength = cpu_to_le16(event_data_sz);
8685 memcpy(&mpi_reply->EventData, event_data,
8786 sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
88− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
89− "%s: add to driver event log\n",
90− ioc->name, __func__));
87+ dTriggerDiagPrintk(ioc,
88+ ioc_info(ioc, "%s: add to driver event log\n",
89+ __func__));
9190 mpt3sas_ctl_add_to_event_log(ioc, mpi_reply);
9291 kfree(mpi_reply);
9392 out:
9493
9594 /* clearing the diag_trigger_active flag */
9695 spin_lock_irqsave(&ioc->diag_trigger_lock, flags);
97− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
98− "%s: clearing diag_trigger_active flag\n",
99− ioc->name, __func__));
96+ dTriggerDiagPrintk(ioc,
97+ ioc_info(ioc, "%s: clearing diag_trigger_active flag\n",
98+ __func__));
10099 ioc->diag_trigger_active = 0;
101100 spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags);
102101
103− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,
104− __func__));
102+ dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
103+ __func__));
105104 }
106105
107106 /**
@@ -115,22 +114,22 @@ mpt3sas_process_trigger_data(struct MPT3SAS_ADAPTER *ioc, · 7 unmodified lines
115114 {
116115 u8 issue_reset = 0;
117116
118− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n",
119− ioc->name, __func__));
117+ dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: enter\n", __func__));
120118
121119 /* release the diag buffer trace */
122120 if ((ioc->diag_buffer_status[MPI2_DIAG_BUF_TYPE_TRACE] &
123121 MPT3_DIAG_BUFFER_IS_RELEASED) == 0) {
124− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
125− "%s: release trace diag buffer\n", ioc->name, __func__));
122+ dTriggerDiagPrintk(ioc,
123+ ioc_info(ioc, "%s: release trace diag buffer\n",
124+ __func__));
126125 mpt3sas_send_diag_release(ioc, MPI2_DIAG_BUF_TYPE_TRACE,
127126 &issue_reset);
128127 }
129128
130129 _mpt3sas_raise_sigio(ioc, event_data);
131130
132− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,
133− __func__));
131+ dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
132+ __func__));
134133 }
135134
136135 /**
@@ -168,9 +167,9 @@ mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, u32 trigger_bitmask) · 31 unmodified lines
168167
169168 by_pass_checks:
170169
171− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
172− "%s: enter - trigger_bitmask = 0x%08x\n",
173− ioc->name, __func__, trigger_bitmask));
170+ dTriggerDiagPrintk(ioc,
171+ ioc_info(ioc, "%s: enter - trigger_bitmask = 0x%08x\n",
172+ __func__, trigger_bitmask));
174173
175174 /* don't send trigger if an trigger is currently active */
176175 if (ioc->diag_trigger_active) {
@@ -182,9 +181,9 @@ mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, u32 trigger_bitmask) · 5 unmodified lines
182181 if (ioc->diag_trigger_master.MasterData & trigger_bitmask) {
183182 found_match = 1;
184183 ioc->diag_trigger_active = 1;
185− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
186− "%s: setting diag_trigger_active flag\n",
187− ioc->name, __func__));
184+ dTriggerDiagPrintk(ioc,
185+ ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
186+ __func__));
188187 }
189188 spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags);
190189
@@ -202,8 +201,8 @@ mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, u32 trigger_bitmask) · 11 unmodified lines
202201 mpt3sas_send_trigger_data_event(ioc, &event_data);
203202
204203 out:
205− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,
206− __func__));
204+ dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
205+ __func__));
207206 }
208207
209208 /**
@@ -239,9 +238,9 @@ mpt3sas_trigger_event(struct MPT3SAS_ADAPTER *ioc, u16 event, · 29 unmodified lines
239238 return;
240239 }
241240
242− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
243− "%s: enter - event = 0x%04x, log_entry_qualifier = 0x%04x\n",
244− ioc->name, __func__, event, log_entry_qualifier));
241+ dTriggerDiagPrintk(ioc,
242+ ioc_info(ioc, "%s: enter - event = 0x%04x, log_entry_qualifier = 0x%04x\n",
243+ __func__, event, log_entry_qualifier));
245244
246245 /* don't send trigger if an trigger is currently active */
247246 if (ioc->diag_trigger_active) {
@@ -263,26 +262,26 @@ mpt3sas_trigger_event(struct MPT3SAS_ADAPTER *ioc, u16 event, · 15 unmodified lines
263262 }
264263 found_match = 1;
265264 ioc->diag_trigger_active = 1;
266− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
267− "%s: setting diag_trigger_active flag\n",
268− ioc->name, __func__));
265+ dTriggerDiagPrintk(ioc,
266+ ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
267+ __func__));
269268 }
270269 spin_unlock_irqrestore(&ioc->diag_trigger_lock, flags);
271270
272271 if (!found_match)
273272 goto out;
274273
275− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
276− "%s: setting diag_trigger_active flag\n",
277− ioc->name, __func__));
274+ dTriggerDiagPrintk(ioc,
275+ ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
276+ __func__));
278277 memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
279278 event_data.trigger_type = MPT3SAS_TRIGGER_EVENT;
280279 event_data.u.event.EventValue = event;
281280 event_data.u.event.LogEntryQualifier = log_entry_qualifier;
282281 mpt3sas_send_trigger_data_event(ioc, &event_data);
283282 out:
284− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,
285− __func__));
283+ dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
284+ __func__));
286285 }
287286
288287 /**
@@ -319,9 +318,9 @@ mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, u8 asc, · 30 unmodified lines
319318 return;
320319 }
321320
322− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
323− "%s: enter - sense_key = 0x%02x, asc = 0x%02x, ascq = 0x%02x\n",
324− ioc->name, __func__, sense_key, asc, ascq));
321+ dTriggerDiagPrintk(ioc,
322+ ioc_info(ioc, "%s: enter - sense_key = 0x%02x, asc = 0x%02x, ascq = 0x%02x\n",
323+ __func__, sense_key, asc, ascq));
325324
326325 /* don't send trigger if an trigger is currently active */
327326 if (ioc->diag_trigger_active) {
@@ -347,9 +346,9 @@ mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, u8 asc, · 19 unmodified lines
347346 if (!found_match)
348347 goto out;
349348
350− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
351− "%s: setting diag_trigger_active flag\n",
352− ioc->name, __func__));
349+ dTriggerDiagPrintk(ioc,
350+ ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
351+ __func__));
353352 memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
354353 event_data.trigger_type = MPT3SAS_TRIGGER_SCSI;
355354 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
357356 event_data.u.scsi.ASCQ = ascq;
358357 mpt3sas_send_trigger_data_event(ioc, &event_data);
359358 out:
360− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,
361− __func__));
359+ dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
360+ __func__));
362361 }
363362
364363 /**
@@ -393,9 +392,9 @@ mpt3sas_trigger_mpi(struct MPT3SAS_ADAPTER *ioc, u16 ioc_status, u32 loginfo) · 28 unmodified lines
393392 return;
394393 }
395394
396− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
397− "%s: enter - ioc_status = 0x%04x, loginfo = 0x%08x\n",
398− ioc->name, __func__, ioc_status, loginfo));
395+ dTriggerDiagPrintk(ioc,
396+ ioc_info(ioc, "%s: enter - ioc_status = 0x%04x, loginfo = 0x%08x\n",
397+ __func__, ioc_status, loginfo));
399398
400399 /* don't send trigger if an trigger is currently active */
401400 if (ioc->diag_trigger_active) {
@@ -420,15 +419,15 @@ mpt3sas_trigger_mpi(struct MPT3SAS_ADAPTER *ioc, u16 ioc_status, u32 loginfo) · 18 unmodified lines
420419 if (!found_match)
421420 goto out;
422421
423− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
424− "%s: setting diag_trigger_active flag\n",
425− ioc->name, __func__));
422+ dTriggerDiagPrintk(ioc,
423+ ioc_info(ioc, "%s: setting diag_trigger_active flag\n",
424+ __func__));
426425 memset(&event_data, 0, sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
427426 event_data.trigger_type = MPT3SAS_TRIGGER_MPI;
428427 event_data.u.mpi.IOCStatus = ioc_status;
429428 event_data.u.mpi.IocLogInfo = loginfo;
430429 mpt3sas_send_trigger_data_event(ioc, &event_data);
431430 out:
432− dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT "%s: exit\n", ioc->name,
433− __func__));
431+ dTriggerDiagPrintk(ioc, ioc_info(ioc, "%s: exit\n",
432+ __func__));
434433 }
drivers/scsi/mpt3sas/mpt3sas_warpdrive.c+27−43
@@ -127,20 +127,17 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 126 unmodified lines
127127 return;
128128
129129 if (ioc->mfg_pg10_hide_flag == MFG_PAGE10_EXPOSE_ALL_DISKS) {
130− pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "
131− "globally as drives are exposed\n", ioc->name);
130+ ioc_info(ioc, "WarpDrive : Direct IO is disabled globally as drives are exposed\n");
132131 return;
133132 }
134133 if (mpt3sas_get_num_volumes(ioc) > 1) {
135134 _warpdrive_disable_ddio(ioc);
136− pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "
137− "globally as number of drives > 1\n", ioc->name);
135+ ioc_info(ioc, "WarpDrive : Direct IO is disabled globally as number of drives > 1\n");
138136 return;
139137 }
140138 if ((mpt3sas_config_get_number_pds(ioc, raid_device->handle,
141139 &num_pds)) || !num_pds) {
142− pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "
143− "Failure in computing number of drives\n", ioc->name);
140+ ioc_info(ioc, "WarpDrive : Direct IO is disabled Failure in computing number of drives\n");
144141 return;
145142 }
146143
@@ -148,15 +145,13 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line
148145 sizeof(Mpi2RaidVol0PhysDisk_t));
149146 vol_pg0 = kzalloc(sz, GFP_KERNEL);
150147 if (!vol_pg0) {
151− pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "
152− "Memory allocation failure for RVPG0\n", ioc->name);
148+ ioc_info(ioc, "WarpDrive : Direct IO is disabled Memory allocation failure for RVPG0\n");
153149 return;
154150 }
155151
156152 if ((mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, vol_pg0,
157153 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, raid_device->handle, sz))) {
158− pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "
159− "Failure in retrieving RVPG0\n", ioc->name);
154+ ioc_info(ioc, "WarpDrive : Direct IO is disabled Failure in retrieving RVPG0\n");
160155 kfree(vol_pg0);
161156 return;
162157 }
@@ -166,10 +161,8 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
166161 * assumed for WARPDRIVE, disable direct I/O
167162 */
168163 if (num_pds > MPT_MAX_WARPDRIVE_PDS) {
169− pr_warn(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "
170− "for the drive with handle(0x%04x): num_mem=%d, "
171− "max_mem_allowed=%d\n", ioc->name, raid_device->handle,
172− num_pds, MPT_MAX_WARPDRIVE_PDS);
164+ ioc_warn(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x): num_mem=%d, max_mem_allowed=%d\n",
165+ raid_device->handle, num_pds, MPT_MAX_WARPDRIVE_PDS);
173166 kfree(vol_pg0);
174167 return;
175168 }
@@ -179,22 +172,18 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 3 unmodified lines
179172 vol_pg0->PhysDisk[count].PhysDiskNum) ||
180173 le16_to_cpu(pd_pg0.DevHandle) ==
181174 MPT3SAS_INVALID_DEVICE_HANDLE) {
182− pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is "
183− "disabled for the drive with handle(0x%04x) member"
184− "handle retrieval failed for member number=%d\n",
185− ioc->name, raid_device->handle,
186− vol_pg0->PhysDisk[count].PhysDiskNum);
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",
176+ raid_device->handle,
177+ vol_pg0->PhysDisk[count].PhysDiskNum);
187178 goto out_error;
188179 }
189180 /* Disable direct I/O if member drive lba exceeds 4 bytes */
190181 dev_max_lba = le64_to_cpu(pd_pg0.DeviceMaxLBA);
191182 if (dev_max_lba >> 32) {
192− pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is "
193− "disabled for the drive with handle(0x%04x) member"
194− " handle (0x%04x) unsupported max lba 0x%016llx\n",
195− ioc->name, raid_device->handle,
196− le16_to_cpu(pd_pg0.DevHandle),
197− (unsigned long long)dev_max_lba);
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",
184+ raid_device->handle,
185+ le16_to_cpu(pd_pg0.DevHandle),
186+ (u64)dev_max_lba);
198187 goto out_error;
199188 }
200189
@@ -206,41 +195,36 @@ mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, · 5 unmodified lines
206195 * not RAID0
207196 */
208197 if (raid_device->volume_type != MPI2_RAID_VOL_TYPE_RAID0) {
209− pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "
210− "for the drive with handle(0x%04x): type=%d, "
211− "s_sz=%uK, blk_size=%u\n", ioc->name,
212− raid_device->handle, raid_device->volume_type,
213− (le32_to_cpu(vol_pg0->StripeSize) *
214− le16_to_cpu(vol_pg0->BlockSize)) / 1024,
215− le16_to_cpu(vol_pg0->BlockSize));
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",
199+ raid_device->handle, raid_device->volume_type,
200+ (le32_to_cpu(vol_pg0->StripeSize) *
201+ le16_to_cpu(vol_pg0->BlockSize)) / 1024,
202+ le16_to_cpu(vol_pg0->BlockSize));
216203 goto out_error;
217204 }
218205
219206 stripe_sz = le32_to_cpu(vol_pg0->StripeSize);
220207 stripe_exp = find_first_bit(&stripe_sz, 32);
221208 if (stripe_exp == 32) {
222− pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "
223− "for the drive with handle(0x%04x) invalid stripe sz %uK\n",
224− ioc->name, raid_device->handle,
225− (le32_to_cpu(vol_pg0->StripeSize) *
226− le16_to_cpu(vol_pg0->BlockSize)) / 1024);
209+ ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x) invalid stripe sz %uK\n",
210+ raid_device->handle,
211+ (le32_to_cpu(vol_pg0->StripeSize) *
212+ le16_to_cpu(vol_pg0->BlockSize)) / 1024);
227213 goto out_error;
228214 }
229215 raid_device->stripe_exponent = stripe_exp;
230216 block_sz = le16_to_cpu(vol_pg0->BlockSize);
231217 block_exp = find_first_bit(&block_sz, 16);
232218 if (block_exp == 16) {
233− pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled "
234− "for the drive with handle(0x%04x) invalid block sz %u\n",
235− ioc->name, raid_device->handle,
236− le16_to_cpu(vol_pg0->BlockSize));
219+ ioc_info(ioc, "WarpDrive : Direct IO is disabled for the drive with handle(0x%04x) invalid block sz %u\n",
220+ raid_device->handle, le16_to_cpu(vol_pg0->BlockSize));
237221 goto out_error;
238222 }
239223 raid_device->block_exponent = block_exp;
240224 raid_device->direct_io_enabled = 1;
241225
242− pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is Enabled for the drive"
243− " with handle(0x%04x)\n", ioc->name, raid_device->handle);
226+ ioc_info(ioc, "WarpDrive : Direct IO is Enabled for the drive with handle(0x%04x)\n",
227+ raid_device->handle);
244228 /*
245229 * WARPDRIVE: Though the following fields are not used for direct IO,
246230 * 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
403403 {
404404 int rc;
405405
406− if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
407− rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
408− if (rc) {
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));
406+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
407+ if (rc) {
408+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
418409 if (rc) {
419410 dev_printk(KERN_ERR, &pdev->dev,
420411 "32-bit DMA enable failed\n");
421412 return rc;
422413 }
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− }
429414 }
430415
431416 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
336336 * DMA-map SMP request, response buffers
337337 */
338338 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);
340340 if (!elem)
341341 return -ENOMEM;
342342 req_len = sg_dma_len(sg_req);
343343
344344 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);
346346 if (!elem) {
347347 rc = -ENOMEM;
348348 goto err_out;
@@ -416,10 +416,10 @@ static int mvs_task_prep_smp(struct mvs_info *mvi, · 67 unmodified lines
416416
417417 err_out_2:
418418 dma_unmap_sg(mvi->dev, &tei->task->smp_task.smp_resp, 1,
419− PCI_DMA_FROMDEVICE);
419+ DMA_FROM_DEVICE);
420420 err_out:
421421 dma_unmap_sg(mvi->dev, &tei->task->smp_task.smp_req, 1,
422− PCI_DMA_TODEVICE);
422+ DMA_TO_DEVICE);
423423 return rc;
424424 }
425425
@@ -904,9 +904,9 @@ static void mvs_slot_task_free(struct mvs_info *mvi, struct sas_task *task, · 478 unmodified lines
904904 switch (task->task_proto) {
905905 case SAS_PROTOCOL_SMP:
906906 dma_unmap_sg(mvi->dev, &task->smp_task.smp_resp, 1,
907− PCI_DMA_FROMDEVICE);
907+ DMA_FROM_DEVICE);
908908 dma_unmap_sg(mvi->dev, &task->smp_task.smp_req, 1,
909− PCI_DMA_TODEVICE);
909+ DMA_TO_DEVICE);
910910 break;
911911
912912 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
143143
144144 case RESOURCE_UNCACHED_MEMORY:
145145 size = round_up(size, 8);
146− res->virt_addr = pci_zalloc_consistent(mhba->pdev, size,
147− &res->bus_addr);
146+ res->virt_addr = dma_zalloc_coherent(&mhba->pdev->dev, size,
147+ &res->bus_addr, GFP_KERNEL);
148148 if (!res->virt_addr) {
149149 dev_err(&mhba->pdev->dev,
150150 "unable to allocate consistent mem,"
@@ -175,7 +175,7 @@ static void mvumi_release_mem_resource(struct mvumi_hba *mhba) · 24 unmodified lines
175175 list_for_each_entry_safe(res, tmp, &mhba->res_list, entry) {
176176 switch (res->type) {
177177 case RESOURCE_UNCACHED_MEMORY:
178− pci_free_consistent(mhba->pdev, res->size,
178+ dma_free_coherent(&mhba->pdev->dev, res->size,
179179 res->virt_addr, res->bus_addr);
180180 break;
181181 case RESOURCE_CACHED_MEMORY:
@@ -211,14 +211,14 @@ static int mvumi_make_sgl(struct mvumi_hba *mhba, struct scsi_cmnd *scmd, · 29 unmodified lines
211211 dma_addr_t busaddr;
212212
213213 sg = scsi_sglist(scmd);
214− *sg_count = pci_map_sg(mhba->pdev, sg, sgnum,
215− (int) scmd->sc_data_direction);
214+ *sg_count = dma_map_sg(&mhba->pdev->dev, sg, sgnum,
215+ scmd->sc_data_direction);
216216 if (*sg_count > mhba->max_sge) {
217217 dev_err(&mhba->pdev->dev,
218218 "sg count[0x%x] is bigger than max sg[0x%x].\n",
219219 *sg_count, mhba->max_sge);
220− pci_unmap_sg(mhba->pdev, sg, sgnum,
221− (int) scmd->sc_data_direction);
220+ dma_unmap_sg(&mhba->pdev->dev, sg, sgnum,
221+ scmd->sc_data_direction);
222222 return -1;
223223 }
224224 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
246246 if (size == 0)
247247 return 0;
248248
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);
250251 if (!virt_addr)
251252 return -1;
252253
@@ -274,8 +275,8 @@ static struct mvumi_cmd *mvumi_create_internal_cmd(struct mvumi_hba *mhba, · 21 unmodified lines
274275 }
275276 INIT_LIST_HEAD(&cmd->queue_pointer);
276277
277− cmd->frame = pci_alloc_consistent(mhba->pdev,
278− mhba->ib_max_size, &cmd->frame_phys);
278+ cmd->frame = dma_alloc_coherent(&mhba->pdev->dev, mhba->ib_max_size,
279+ &cmd->frame_phys, GFP_KERNEL);
279280 if (!cmd->frame) {
280281 dev_err(&mhba->pdev->dev, "failed to allocate memory for FW"
281282 " 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
287288 if (mvumi_internal_cmd_sgl(mhba, cmd, buf_size)) {
288289 dev_err(&mhba->pdev->dev, "failed to allocate memory"
289290 " 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,
291292 cmd->frame, cmd->frame_phys);
292293 kfree(cmd);
293294 return NULL;
@@ -313,10 +314,10 @@ static void mvumi_delete_internal_cmd(struct mvumi_hba *mhba, · 19 unmodified lines
313314 phy_addr = (dma_addr_t) m_sg->baseaddr_l |
314315 (dma_addr_t) ((m_sg->baseaddr_h << 16) << 16);
315316
316− pci_free_consistent(mhba->pdev, size, cmd->data_buf,
317+ dma_free_coherent(&mhba->pdev->dev, size, cmd->data_buf,
317318 phy_addr);
318319 }
319− pci_free_consistent(mhba->pdev, mhba->ib_max_size,
320+ dma_free_coherent(&mhba->pdev->dev, mhba->ib_max_size,
320321 cmd->frame, cmd->frame_phys);
321322 kfree(cmd);
322323 }
@@ -663,16 +664,17 @@ static void mvumi_restore_bar_addr(struct mvumi_hba *mhba) · 340 unmodified lines
663664 }
664665 }
665666
666−static unsigned int mvumi_pci_set_master(struct pci_dev *pdev)
667+static int mvumi_pci_set_master(struct pci_dev *pdev)
667668 {
668− unsigned int ret = 0;
669+ int ret = 0;
670+
669671 pci_set_master(pdev);
670672
671673 if (IS_DMA64) {
672− if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))
673− ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
674+ if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)))
675+ ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
674676 } else
675− ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
677+ ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
676678
677679 return ret;
678680 }
@@ -771,7 +773,7 @@ static void mvumi_release_fw(struct mvumi_hba *mhba) · 92 unmodified lines
771773 mvumi_free_cmds(mhba);
772774 mvumi_release_mem_resource(mhba);
773775 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,
775777 mhba->handshake_page, mhba->handshake_page_phys);
776778 kfree(mhba->regs);
777779 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
13391341 }
13401342
13411343 if (scsi_bufflen(scmd))
1342− pci_unmap_sg(mhba->pdev, scsi_sglist(scmd),
1344+ dma_unmap_sg(&mhba->pdev->dev, scsi_sglist(scmd),
13431345 scsi_sg_count(scmd),
1344− (int) scmd->sc_data_direction);
1346+ scmd->sc_data_direction);
13451347 cmd->scmd->scsi_done(scmd);
13461348 mvumi_return_cmd(mhba, cmd);
13471349 }
@@ -2148,9 +2150,9 @@ static enum blk_eh_timer_return mvumi_timed_out(struct scsi_cmnd *scmd) · 800 unmodified lines
21482150 scmd->result = (DRIVER_INVALID << 24) | (DID_ABORT << 16);
21492151 scmd->SCp.ptr = NULL;
21502152 if (scsi_bufflen(scmd)) {
2151− pci_unmap_sg(mhba->pdev, scsi_sglist(scmd),
2153+ dma_unmap_sg(&mhba->pdev->dev, scsi_sglist(scmd),
21522154 scsi_sg_count(scmd),
2153− (int)scmd->sc_data_direction);
2155+ scmd->sc_data_direction);
21542156 }
21552157 mvumi_return_cmd(mhba, cmd);
21562158 spin_unlock_irqrestore(mhba->shost->host_lock, flags);
@@ -2362,8 +2364,8 @@ static int mvumi_init_fw(struct mvumi_hba *mhba) · 205 unmodified lines
23622364 ret = -ENOMEM;
23632365 goto fail_alloc_mem;
23642366 }
2365− mhba->handshake_page = pci_alloc_consistent(mhba->pdev, HSP_MAX_SIZE,
2366− &mhba->handshake_page_phys);
2367+ mhba->handshake_page = dma_alloc_coherent(&mhba->pdev->dev,
2368+ HSP_MAX_SIZE, &mhba->handshake_page_phys, GFP_KERNEL);
23672369 if (!mhba->handshake_page) {
23682370 dev_err(&mhba->pdev->dev,
23692371 "failed to allocate memory for handshake\n");
@@ -2383,7 +2385,7 @@ static int mvumi_init_fw(struct mvumi_hba *mhba) · 13 unmodified lines
23832385
23842386 fail_ready_state:
23852387 mvumi_release_mem_resource(mhba);
2386− pci_free_consistent(mhba->pdev, HSP_MAX_SIZE,
2388+ dma_free_coherent(&mhba->pdev->dev, HSP_MAX_SIZE,
23872389 mhba->handshake_page, mhba->handshake_page_phys);
23882390 fail_alloc_page:
23892391 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
24802482 if (ret)
24812483 return ret;
24822484
2483− pci_set_master(pdev);
2484−
2485− if (IS_DMA64) {
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− }
2485+ ret = mvumi_pci_set_master(pdev);
2486+ if (ret)
2487+ goto fail_set_dma_mask;
24972488
24982489 host = scsi_host_alloc(&mvumi_template, sizeof(*mhba));
24992490 if (!host) {
@@ -2627,19 +2618,11 @@ static int __maybe_unused mvumi_resume(struct pci_dev *pdev) · 127 unmodified lines
26272618 dev_err(&pdev->dev, "enable device failed\n");
26282619 return ret;
26292620 }
2630− pci_set_master(pdev);
2631− if (IS_DMA64) {
2632− ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
2633− if (ret) {
2634− ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
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− }
2621+
2622+ ret = mvumi_pci_set_master(pdev);
2623+ ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
2624+ if (ret)
2625+ goto fail;
26432626 ret = pci_request_regions(mhba->pdev, MV_DRIVER_NAME);
26442627 if (ret)
26452628 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+
27+static struct raid_template *myrb_raid_template;
28+
29+static void myrb_monitor(struct work_struct *work);
30+static inline void myrb_translate_devstate(void *DeviceState);
31+
32+static inline int myrb_logical_channel(struct Scsi_Host *shost)
33+{
34+ return shost->max_channel - 1;
35+}
36+
37+static 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+
49+static 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+
61+static 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+
73+static 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+ */
90+static 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+ */
140+static 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+ */
152+static 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+ */
163+static 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+ */
185+static 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+ */
207+static 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+ */
229+static 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+
262+static 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+ */
285+static 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+ */
341+static 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+ */
388+static 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+ */
439+static 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+ */
472+static 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+ */
533+static 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+ */
580+static 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+ */
671+static 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+ */
781+static 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+ */
808+static 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+ */
913+static 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+
1150+out:
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+
1187+out_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+ */
1199+static 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+ */
1235+static 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+
1255+static 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+
1264+static 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+
1338+static 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+
1361+static void
1362+myrb_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+
1398+static 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+
1407+static 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+
1420+static 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+ }
1622+submit:
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+
1630+static 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+
1646+static 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+
1692+static 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+
1728+static 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+
1742+static 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+
1768+static void myrb_slave_destroy(struct scsi_device *sdev)
1769+{
1770+ kfree(sdev->hostdata);
1771+}
1772+
1773+static 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+
1785+static 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+
1830+static 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+}
1896+static DEVICE_ATTR_RW(raid_state);
1897+
1898+static 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+}
1918+static DEVICE_ATTR_RO(raid_level);
1919+
1920+static 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+
1942+static 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+}
2045+static DEVICE_ATTR_RW(rebuild);
2046+
2047+static 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+
2153+static ssize_t consistency_check_show(struct device *dev,
2154+ struct device_attribute *attr, char *buf)
2155+{
2156+ return rebuild_show(dev, attr, buf);
2157+}
2158+static DEVICE_ATTR_RW(consistency_check);
2159+
2160+static 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+}
2168+static DEVICE_ATTR_RO(ctlr_num);
2169+
2170+static 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+}
2178+static DEVICE_ATTR_RO(firmware);
2179+
2180+static 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+}
2188+static DEVICE_ATTR_RO(model);
2189+
2190+static 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+}
2207+static DEVICE_ATTR_WO(flush_cache);
2208+
2209+static 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+
2217+static 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+
2225+struct 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+ */
2245+static 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+ */
2256+static 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+ */
2283+static 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+
2314+struct 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+
2321+static 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+
2398+static 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+
2409+static 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+ */
2488+bool 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+
2543+static 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+
2548+static 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+
2553+static inline void DAC960_LA_gen_intr(void __iomem *base)
2554+{
2555+ writeb(DAC960_LA_IDB_GEN_IRQ, base + DAC960_LA_IDB_OFFSET);
2556+}
2557+
2558+static inline void DAC960_LA_reset_ctrl(void __iomem *base)
2559+{
2560+ writeb(DAC960_LA_IDB_CTRL_RESET, base + DAC960_LA_IDB_OFFSET);
2561+}
2562+
2563+static 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+
2568+static 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+
2575+static 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+
2582+static 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+
2587+static 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+
2592+static 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+
2598+static 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+
2605+static 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+
2612+static 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+
2620+static 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+
2628+static 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+
2635+static 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+
2648+static 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+
2657+static inline unsigned char DAC960_LA_read_status_cmd_ident(void __iomem *base)
2658+{
2659+ return readb(base + DAC960_LA_STSID_OFFSET);
2660+}
2661+
2662+static inline unsigned short DAC960_LA_read_status(void __iomem *base)
2663+{
2664+ return readw(base + DAC960_LA_STS_OFFSET);
2665+}
2666+
2667+static inline bool
2668+DAC960_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+
2684+static inline unsigned short
2685+DAC960_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+
2722+static 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+
2765+static 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+
2811+struct 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+ */
2820+static 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+
2825+static 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+
2830+static inline void DAC960_PG_gen_intr(void __iomem *base)
2831+{
2832+ writel(DAC960_PG_IDB_GEN_IRQ, base + DAC960_PG_IDB_OFFSET);
2833+}
2834+
2835+static inline void DAC960_PG_reset_ctrl(void __iomem *base)
2836+{
2837+ writel(DAC960_PG_IDB_CTRL_RESET, base + DAC960_PG_IDB_OFFSET);
2838+}
2839+
2840+static 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+
2845+static 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+
2852+static 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+
2859+static 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+
2864+static 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+
2869+static 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+
2875+static 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+
2882+static 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+
2889+static 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+
2897+static 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+
2904+static 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+
2911+static 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+
2924+static 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+
2933+static inline unsigned char
2934+DAC960_PG_read_status_cmd_ident(void __iomem *base)
2935+{
2936+ return readb(base + DAC960_PG_STSID_OFFSET);
2937+}
2938+
2939+static inline unsigned short
2940+DAC960_PG_read_status(void __iomem *base)
2941+{
2942+ return readw(base + DAC960_PG_STS_OFFSET);
2943+}
2944+
2945+static inline bool
2946+DAC960_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+
2961+static inline unsigned short
2962+DAC960_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+
3001+static 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+
3043+static 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