mpt3sas_base.h 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465
  1. /*
  2. * This is the Fusion MPT base driver providing common API layer interface
  3. * for access to MPT (Message Passing Technology) firmware.
  4. *
  5. * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.h
  6. * Copyright (C) 2012-2014 LSI Corporation
  7. * Copyright (C) 2013-2014 Avago Technologies
  8. * (mailto: MPT-FusionLinux.pdl@avagotech.com)
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version 2
  13. * of the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * NO WARRANTY
  21. * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
  22. * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
  23. * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
  24. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
  25. * solely responsible for determining the appropriateness of using and
  26. * distributing the Program and assumes all risks associated with its
  27. * exercise of rights under this Agreement, including but not limited to
  28. * the risks and costs of program errors, damage to or loss of data,
  29. * programs or equipment, and unavailability or interruption of operations.
  30. * DISCLAIMER OF LIABILITY
  31. * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
  32. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33. * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
  34. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  35. * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  36. * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
  37. * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
  38. * You should have received a copy of the GNU General Public License
  39. * along with this program; if not, write to the Free Software
  40. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
  41. * USA.
  42. */
  43. #ifndef MPT3SAS_BASE_H_INCLUDED
  44. #define MPT3SAS_BASE_H_INCLUDED
  45. #include "mpi/mpi2_type.h"
  46. #include "mpi/mpi2.h"
  47. #include "mpi/mpi2_ioc.h"
  48. #include "mpi/mpi2_cnfg.h"
  49. #include "mpi/mpi2_init.h"
  50. #include "mpi/mpi2_raid.h"
  51. #include "mpi/mpi2_tool.h"
  52. #include "mpi/mpi2_sas.h"
  53. #include <scsi/scsi.h>
  54. #include <scsi/scsi_cmnd.h>
  55. #include <scsi/scsi_device.h>
  56. #include <scsi/scsi_host.h>
  57. #include <scsi/scsi_tcq.h>
  58. #include <scsi/scsi_transport_sas.h>
  59. #include <scsi/scsi_dbg.h>
  60. #include <scsi/scsi_eh.h>
  61. #include <linux/pci.h>
  62. #include <linux/poll.h>
  63. #include "mpt3sas_debug.h"
  64. #include "mpt3sas_trigger_diag.h"
  65. /* driver versioning info */
  66. #define MPT3SAS_DRIVER_NAME "mpt3sas"
  67. #define MPT3SAS_AUTHOR "Avago Technologies <MPT-FusionLinux.pdl@avagotech.com>"
  68. #define MPT3SAS_DESCRIPTION "LSI MPT Fusion SAS 3.0 Device Driver"
  69. #define MPT3SAS_DRIVER_VERSION "13.100.00.00"
  70. #define MPT3SAS_MAJOR_VERSION 13
  71. #define MPT3SAS_MINOR_VERSION 100
  72. #define MPT3SAS_BUILD_VERSION 0
  73. #define MPT3SAS_RELEASE_VERSION 00
  74. #define MPT2SAS_DRIVER_NAME "mpt2sas"
  75. #define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver"
  76. #define MPT2SAS_DRIVER_VERSION "20.102.00.00"
  77. #define MPT2SAS_MAJOR_VERSION 20
  78. #define MPT2SAS_MINOR_VERSION 102
  79. #define MPT2SAS_BUILD_VERSION 0
  80. #define MPT2SAS_RELEASE_VERSION 00
  81. /*
  82. * Set MPT3SAS_SG_DEPTH value based on user input.
  83. */
  84. #define MPT_MAX_PHYS_SEGMENTS SG_CHUNK_SIZE
  85. #define MPT_MIN_PHYS_SEGMENTS 16
  86. #ifdef CONFIG_SCSI_MPT3SAS_MAX_SGE
  87. #define MPT3SAS_SG_DEPTH CONFIG_SCSI_MPT3SAS_MAX_SGE
  88. #else
  89. #define MPT3SAS_SG_DEPTH MPT_MAX_PHYS_SEGMENTS
  90. #endif
  91. #ifdef CONFIG_SCSI_MPT2SAS_MAX_SGE
  92. #define MPT2SAS_SG_DEPTH CONFIG_SCSI_MPT2SAS_MAX_SGE
  93. #else
  94. #define MPT2SAS_SG_DEPTH MPT_MAX_PHYS_SEGMENTS
  95. #endif
  96. /*
  97. * Generic Defines
  98. */
  99. #define MPT3SAS_SATA_QUEUE_DEPTH 32
  100. #define MPT3SAS_SAS_QUEUE_DEPTH 254
  101. #define MPT3SAS_RAID_QUEUE_DEPTH 128
  102. #define MPT3SAS_RAID_MAX_SECTORS 8192
  103. #define MPT_NAME_LENGTH 32 /* generic length of strings */
  104. #define MPT_STRING_LENGTH 64
  105. #define MPT_MAX_CALLBACKS 32
  106. #define INTERNAL_CMDS_COUNT 10 /* reserved cmds */
  107. /* reserved for issuing internally framed scsi io cmds */
  108. #define INTERNAL_SCSIIO_CMDS_COUNT 3
  109. #define MPI3_HIM_MASK 0xFFFFFFFF /* mask every bit*/
  110. #define MPT3SAS_INVALID_DEVICE_HANDLE 0xFFFF
  111. #define MAX_CHAIN_ELEMT_SZ 16
  112. #define DEFAULT_NUM_FWCHAIN_ELEMTS 8
  113. /*
  114. * reset phases
  115. */
  116. #define MPT3_IOC_PRE_RESET 1 /* prior to host reset */
  117. #define MPT3_IOC_AFTER_RESET 2 /* just after host reset */
  118. #define MPT3_IOC_DONE_RESET 3 /* links re-initialized */
  119. /*
  120. * logging format
  121. */
  122. #define MPT3SAS_FMT "%s: "
  123. /*
  124. * WarpDrive Specific Log codes
  125. */
  126. #define MPT2_WARPDRIVE_LOGENTRY (0x8002)
  127. #define MPT2_WARPDRIVE_LC_SSDT (0x41)
  128. #define MPT2_WARPDRIVE_LC_SSDLW (0x43)
  129. #define MPT2_WARPDRIVE_LC_SSDLF (0x44)
  130. #define MPT2_WARPDRIVE_LC_BRMF (0x4D)
  131. /*
  132. * per target private data
  133. */
  134. #define MPT_TARGET_FLAGS_RAID_COMPONENT 0x01
  135. #define MPT_TARGET_FLAGS_VOLUME 0x02
  136. #define MPT_TARGET_FLAGS_DELETED 0x04
  137. #define MPT_TARGET_FASTPATH_IO 0x08
  138. #define SAS2_PCI_DEVICE_B0_REVISION (0x01)
  139. #define SAS3_PCI_DEVICE_C0_REVISION (0x02)
  140. /*
  141. * Intel HBA branding
  142. */
  143. #define MPT2SAS_INTEL_RMS25JB080_BRANDING \
  144. "Intel(R) Integrated RAID Module RMS25JB080"
  145. #define MPT2SAS_INTEL_RMS25JB040_BRANDING \
  146. "Intel(R) Integrated RAID Module RMS25JB040"
  147. #define MPT2SAS_INTEL_RMS25KB080_BRANDING \
  148. "Intel(R) Integrated RAID Module RMS25KB080"
  149. #define MPT2SAS_INTEL_RMS25KB040_BRANDING \
  150. "Intel(R) Integrated RAID Module RMS25KB040"
  151. #define MPT2SAS_INTEL_RMS25LB040_BRANDING \
  152. "Intel(R) Integrated RAID Module RMS25LB040"
  153. #define MPT2SAS_INTEL_RMS25LB080_BRANDING \
  154. "Intel(R) Integrated RAID Module RMS25LB080"
  155. #define MPT2SAS_INTEL_RMS2LL080_BRANDING \
  156. "Intel Integrated RAID Module RMS2LL080"
  157. #define MPT2SAS_INTEL_RMS2LL040_BRANDING \
  158. "Intel Integrated RAID Module RMS2LL040"
  159. #define MPT2SAS_INTEL_RS25GB008_BRANDING \
  160. "Intel(R) RAID Controller RS25GB008"
  161. #define MPT2SAS_INTEL_SSD910_BRANDING \
  162. "Intel(R) SSD 910 Series"
  163. #define MPT3SAS_INTEL_RMS3JC080_BRANDING \
  164. "Intel(R) Integrated RAID Module RMS3JC080"
  165. #define MPT3SAS_INTEL_RS3GC008_BRANDING \
  166. "Intel(R) RAID Controller RS3GC008"
  167. #define MPT3SAS_INTEL_RS3FC044_BRANDING \
  168. "Intel(R) RAID Controller RS3FC044"
  169. #define MPT3SAS_INTEL_RS3UC080_BRANDING \
  170. "Intel(R) RAID Controller RS3UC080"
  171. /*
  172. * Intel HBA SSDIDs
  173. */
  174. #define MPT2SAS_INTEL_RMS25JB080_SSDID 0x3516
  175. #define MPT2SAS_INTEL_RMS25JB040_SSDID 0x3517
  176. #define MPT2SAS_INTEL_RMS25KB080_SSDID 0x3518
  177. #define MPT2SAS_INTEL_RMS25KB040_SSDID 0x3519
  178. #define MPT2SAS_INTEL_RMS25LB040_SSDID 0x351A
  179. #define MPT2SAS_INTEL_RMS25LB080_SSDID 0x351B
  180. #define MPT2SAS_INTEL_RMS2LL080_SSDID 0x350E
  181. #define MPT2SAS_INTEL_RMS2LL040_SSDID 0x350F
  182. #define MPT2SAS_INTEL_RS25GB008_SSDID 0x3000
  183. #define MPT2SAS_INTEL_SSD910_SSDID 0x3700
  184. #define MPT3SAS_INTEL_RMS3JC080_SSDID 0x3521
  185. #define MPT3SAS_INTEL_RS3GC008_SSDID 0x3522
  186. #define MPT3SAS_INTEL_RS3FC044_SSDID 0x3523
  187. #define MPT3SAS_INTEL_RS3UC080_SSDID 0x3524
  188. /*
  189. * Dell HBA branding
  190. */
  191. #define MPT2SAS_DELL_BRANDING_SIZE 32
  192. #define MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING "Dell 6Gbps SAS HBA"
  193. #define MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING "Dell PERC H200 Adapter"
  194. #define MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING "Dell PERC H200 Integrated"
  195. #define MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING "Dell PERC H200 Modular"
  196. #define MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING "Dell PERC H200 Embedded"
  197. #define MPT2SAS_DELL_PERC_H200_BRANDING "Dell PERC H200"
  198. #define MPT2SAS_DELL_6GBPS_SAS_BRANDING "Dell 6Gbps SAS"
  199. #define MPT3SAS_DELL_12G_HBA_BRANDING \
  200. "Dell 12Gbps HBA"
  201. /*
  202. * Dell HBA SSDIDs
  203. */
  204. #define MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID 0x1F1C
  205. #define MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID 0x1F1D
  206. #define MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID 0x1F1E
  207. #define MPT2SAS_DELL_PERC_H200_MODULAR_SSDID 0x1F1F
  208. #define MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID 0x1F20
  209. #define MPT2SAS_DELL_PERC_H200_SSDID 0x1F21
  210. #define MPT2SAS_DELL_6GBPS_SAS_SSDID 0x1F22
  211. #define MPT3SAS_DELL_12G_HBA_SSDID 0x1F46
  212. /*
  213. * Cisco HBA branding
  214. */
  215. #define MPT3SAS_CISCO_12G_8E_HBA_BRANDING \
  216. "Cisco 9300-8E 12G SAS HBA"
  217. #define MPT3SAS_CISCO_12G_8I_HBA_BRANDING \
  218. "Cisco 9300-8i 12G SAS HBA"
  219. #define MPT3SAS_CISCO_12G_AVILA_HBA_BRANDING \
  220. "Cisco 12G Modular SAS Pass through Controller"
  221. #define MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_BRANDING \
  222. "UCS C3X60 12G SAS Pass through Controller"
  223. /*
  224. * Cisco HBA SSSDIDs
  225. */
  226. #define MPT3SAS_CISCO_12G_8E_HBA_SSDID 0x14C
  227. #define MPT3SAS_CISCO_12G_8I_HBA_SSDID 0x154
  228. #define MPT3SAS_CISCO_12G_AVILA_HBA_SSDID 0x155
  229. #define MPT3SAS_CISCO_12G_COLUSA_MEZZANINE_HBA_SSDID 0x156
  230. /*
  231. * status bits for ioc->diag_buffer_status
  232. */
  233. #define MPT3_DIAG_BUFFER_IS_REGISTERED (0x01)
  234. #define MPT3_DIAG_BUFFER_IS_RELEASED (0x02)
  235. #define MPT3_DIAG_BUFFER_IS_DIAG_RESET (0x04)
  236. /*
  237. * HP HBA branding
  238. */
  239. #define MPT2SAS_HP_3PAR_SSVID 0x1590
  240. #define MPT2SAS_HP_2_4_INTERNAL_BRANDING \
  241. "HP H220 Host Bus Adapter"
  242. #define MPT2SAS_HP_2_4_EXTERNAL_BRANDING \
  243. "HP H221 Host Bus Adapter"
  244. #define MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_BRANDING \
  245. "HP H222 Host Bus Adapter"
  246. #define MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_BRANDING \
  247. "HP H220i Host Bus Adapter"
  248. #define MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_BRANDING \
  249. "HP H210i Host Bus Adapter"
  250. /*
  251. * HO HBA SSDIDs
  252. */
  253. #define MPT2SAS_HP_2_4_INTERNAL_SSDID 0x0041
  254. #define MPT2SAS_HP_2_4_EXTERNAL_SSDID 0x0042
  255. #define MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_SSDID 0x0043
  256. #define MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_SSDID 0x0044
  257. #define MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_SSDID 0x0046
  258. /*
  259. * Combined Reply Queue constants,
  260. * There are twelve Supplemental Reply Post Host Index Registers
  261. * and each register is at offset 0x10 bytes from the previous one.
  262. */
  263. #define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT 12
  264. #define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET (0x10)
  265. /* OEM Identifiers */
  266. #define MFG10_OEM_ID_INVALID (0x00000000)
  267. #define MFG10_OEM_ID_DELL (0x00000001)
  268. #define MFG10_OEM_ID_FSC (0x00000002)
  269. #define MFG10_OEM_ID_SUN (0x00000003)
  270. #define MFG10_OEM_ID_IBM (0x00000004)
  271. /* GENERIC Flags 0*/
  272. #define MFG10_GF0_OCE_DISABLED (0x00000001)
  273. #define MFG10_GF0_R1E_DRIVE_COUNT (0x00000002)
  274. #define MFG10_GF0_R10_DISPLAY (0x00000004)
  275. #define MFG10_GF0_SSD_DATA_SCRUB_DISABLE (0x00000008)
  276. #define MFG10_GF0_SINGLE_DRIVE_R0 (0x00000010)
  277. #define VIRTUAL_IO_FAILED_RETRY (0x32010081)
  278. /* OEM Specific Flags will come from OEM specific header files */
  279. struct Mpi2ManufacturingPage10_t {
  280. MPI2_CONFIG_PAGE_HEADER Header; /* 00h */
  281. U8 OEMIdentifier; /* 04h */
  282. U8 Reserved1; /* 05h */
  283. U16 Reserved2; /* 08h */
  284. U32 Reserved3; /* 0Ch */
  285. U32 GenericFlags0; /* 10h */
  286. U32 GenericFlags1; /* 14h */
  287. U32 Reserved4; /* 18h */
  288. U32 OEMSpecificFlags0; /* 1Ch */
  289. U32 OEMSpecificFlags1; /* 20h */
  290. U32 Reserved5[18]; /* 24h - 60h*/
  291. };
  292. /* Miscellaneous options */
  293. struct Mpi2ManufacturingPage11_t {
  294. MPI2_CONFIG_PAGE_HEADER Header; /* 00h */
  295. __le32 Reserved1; /* 04h */
  296. u8 Reserved2; /* 08h */
  297. u8 EEDPTagMode; /* 09h */
  298. u8 Reserved3; /* 0Ah */
  299. u8 Reserved4; /* 0Bh */
  300. __le32 Reserved5[23]; /* 0Ch-60h*/
  301. };
  302. /**
  303. * struct MPT3SAS_TARGET - starget private hostdata
  304. * @starget: starget object
  305. * @sas_address: target sas address
  306. * @raid_device: raid_device pointer to access volume data
  307. * @handle: device handle
  308. * @num_luns: number luns
  309. * @flags: MPT_TARGET_FLAGS_XXX flags
  310. * @deleted: target flaged for deletion
  311. * @tm_busy: target is busy with TM request.
  312. * @sdev: The sas_device associated with this target
  313. */
  314. struct MPT3SAS_TARGET {
  315. struct scsi_target *starget;
  316. u64 sas_address;
  317. struct _raid_device *raid_device;
  318. u16 handle;
  319. int num_luns;
  320. u32 flags;
  321. u8 deleted;
  322. u8 tm_busy;
  323. struct _sas_device *sdev;
  324. };
  325. /*
  326. * per device private data
  327. */
  328. #define MPT_DEVICE_FLAGS_INIT 0x01
  329. #define MPT_DEVICE_TLR_ON 0x02
  330. #define MFG_PAGE10_HIDE_SSDS_MASK (0x00000003)
  331. #define MFG_PAGE10_HIDE_ALL_DISKS (0x00)
  332. #define MFG_PAGE10_EXPOSE_ALL_DISKS (0x01)
  333. #define MFG_PAGE10_HIDE_IF_VOL_PRESENT (0x02)
  334. /**
  335. * struct MPT3SAS_DEVICE - sdev private hostdata
  336. * @sas_target: starget private hostdata
  337. * @lun: lun number
  338. * @flags: MPT_DEVICE_XXX flags
  339. * @configured_lun: lun is configured
  340. * @block: device is in SDEV_BLOCK state
  341. * @tlr_snoop_check: flag used in determining whether to disable TLR
  342. * @eedp_enable: eedp support enable bit
  343. * @eedp_type: 0(type_1), 1(type_2), 2(type_3)
  344. * @eedp_block_length: block size
  345. * @ata_command_pending: SATL passthrough outstanding for device
  346. */
  347. struct MPT3SAS_DEVICE {
  348. struct MPT3SAS_TARGET *sas_target;
  349. unsigned int lun;
  350. u32 flags;
  351. u8 configured_lun;
  352. u8 block;
  353. u8 tlr_snoop_check;
  354. u8 ignore_delay_remove;
  355. /*
  356. * Bug workaround for SATL handling: the mpt2/3sas firmware
  357. * doesn't return BUSY or TASK_SET_FULL for subsequent
  358. * commands while a SATL pass through is in operation as the
  359. * spec requires, it simply does nothing with them until the
  360. * pass through completes, causing them possibly to timeout if
  361. * the passthrough is a long executing command (like format or
  362. * secure erase). This variable allows us to do the right
  363. * thing while a SATL command is pending.
  364. */
  365. unsigned long ata_command_pending;
  366. };
  367. #define MPT3_CMD_NOT_USED 0x8000 /* free */
  368. #define MPT3_CMD_COMPLETE 0x0001 /* completed */
  369. #define MPT3_CMD_PENDING 0x0002 /* pending */
  370. #define MPT3_CMD_REPLY_VALID 0x0004 /* reply is valid */
  371. #define MPT3_CMD_RESET 0x0008 /* host reset dropped the command */
  372. /**
  373. * struct _internal_cmd - internal commands struct
  374. * @mutex: mutex
  375. * @done: completion
  376. * @reply: reply message pointer
  377. * @sense: sense data
  378. * @status: MPT3_CMD_XXX status
  379. * @smid: system message id
  380. */
  381. struct _internal_cmd {
  382. struct mutex mutex;
  383. struct completion done;
  384. void *reply;
  385. void *sense;
  386. u16 status;
  387. u16 smid;
  388. };
  389. /**
  390. * struct _sas_device - attached device information
  391. * @list: sas device list
  392. * @starget: starget object
  393. * @sas_address: device sas address
  394. * @device_name: retrieved from the SAS IDENTIFY frame.
  395. * @handle: device handle
  396. * @sas_address_parent: sas address of parent expander or sas host
  397. * @enclosure_handle: enclosure handle
  398. * @enclosure_logical_id: enclosure logical identifier
  399. * @volume_handle: volume handle (valid when hidden raid member)
  400. * @volume_wwid: volume unique identifier
  401. * @device_info: bitfield provides detailed info about the device
  402. * @id: target id
  403. * @channel: target channel
  404. * @slot: number number
  405. * @phy: phy identifier provided in sas device page 0
  406. * @responding: used in _scsih_sas_device_mark_responding
  407. * @fast_path: fast path feature enable bit
  408. * @pfa_led_on: flag for PFA LED status
  409. * @pend_sas_rphy_add: flag to check if device is in sas_rphy_add()
  410. * addition routine.
  411. */
  412. struct _sas_device {
  413. struct list_head list;
  414. struct scsi_target *starget;
  415. u64 sas_address;
  416. u64 device_name;
  417. u16 handle;
  418. u64 sas_address_parent;
  419. u16 enclosure_handle;
  420. u64 enclosure_logical_id;
  421. u16 volume_handle;
  422. u64 volume_wwid;
  423. u32 device_info;
  424. int id;
  425. int channel;
  426. u16 slot;
  427. u8 phy;
  428. u8 responding;
  429. u8 fast_path;
  430. u8 pfa_led_on;
  431. u8 pend_sas_rphy_add;
  432. u8 enclosure_level;
  433. u8 connector_name[5];
  434. struct kref refcount;
  435. };
  436. static inline void sas_device_get(struct _sas_device *s)
  437. {
  438. kref_get(&s->refcount);
  439. }
  440. static inline void sas_device_free(struct kref *r)
  441. {
  442. kfree(container_of(r, struct _sas_device, refcount));
  443. }
  444. static inline void sas_device_put(struct _sas_device *s)
  445. {
  446. kref_put(&s->refcount, sas_device_free);
  447. }
  448. /**
  449. * struct _raid_device - raid volume link list
  450. * @list: sas device list
  451. * @starget: starget object
  452. * @sdev: scsi device struct (volumes are single lun)
  453. * @wwid: unique identifier for the volume
  454. * @handle: device handle
  455. * @block_size: Block size of the volume
  456. * @id: target id
  457. * @channel: target channel
  458. * @volume_type: the raid level
  459. * @device_info: bitfield provides detailed info about the hidden components
  460. * @num_pds: number of hidden raid components
  461. * @responding: used in _scsih_raid_device_mark_responding
  462. * @percent_complete: resync percent complete
  463. * @direct_io_enabled: Whether direct io to PDs are allowed or not
  464. * @stripe_exponent: X where 2powX is the stripe sz in blocks
  465. * @block_exponent: X where 2powX is the block sz in bytes
  466. * @max_lba: Maximum number of LBA in the volume
  467. * @stripe_sz: Stripe Size of the volume
  468. * @device_info: Device info of the volume member disk
  469. * @pd_handle: Array of handles of the physical drives for direct I/O in le16
  470. */
  471. #define MPT_MAX_WARPDRIVE_PDS 8
  472. struct _raid_device {
  473. struct list_head list;
  474. struct scsi_target *starget;
  475. struct scsi_device *sdev;
  476. u64 wwid;
  477. u16 handle;
  478. u16 block_sz;
  479. int id;
  480. int channel;
  481. u8 volume_type;
  482. u8 num_pds;
  483. u8 responding;
  484. u8 percent_complete;
  485. u8 direct_io_enabled;
  486. u8 stripe_exponent;
  487. u8 block_exponent;
  488. u64 max_lba;
  489. u32 stripe_sz;
  490. u32 device_info;
  491. u16 pd_handle[MPT_MAX_WARPDRIVE_PDS];
  492. };
  493. /**
  494. * struct _boot_device - boot device info
  495. * @is_raid: flag to indicate whether this is volume
  496. * @device: holds pointer for either struct _sas_device or
  497. * struct _raid_device
  498. */
  499. struct _boot_device {
  500. u8 is_raid;
  501. void *device;
  502. };
  503. /**
  504. * struct _sas_port - wide/narrow sas port information
  505. * @port_list: list of ports belonging to expander
  506. * @num_phys: number of phys belonging to this port
  507. * @remote_identify: attached device identification
  508. * @rphy: sas transport rphy object
  509. * @port: sas transport wide/narrow port object
  510. * @phy_list: _sas_phy list objects belonging to this port
  511. */
  512. struct _sas_port {
  513. struct list_head port_list;
  514. u8 num_phys;
  515. struct sas_identify remote_identify;
  516. struct sas_rphy *rphy;
  517. struct sas_port *port;
  518. struct list_head phy_list;
  519. };
  520. /**
  521. * struct _sas_phy - phy information
  522. * @port_siblings: list of phys belonging to a port
  523. * @identify: phy identification
  524. * @remote_identify: attached device identification
  525. * @phy: sas transport phy object
  526. * @phy_id: unique phy id
  527. * @handle: device handle for this phy
  528. * @attached_handle: device handle for attached device
  529. * @phy_belongs_to_port: port has been created for this phy
  530. */
  531. struct _sas_phy {
  532. struct list_head port_siblings;
  533. struct sas_identify identify;
  534. struct sas_identify remote_identify;
  535. struct sas_phy *phy;
  536. u8 phy_id;
  537. u16 handle;
  538. u16 attached_handle;
  539. u8 phy_belongs_to_port;
  540. };
  541. /**
  542. * struct _sas_node - sas_host/expander information
  543. * @list: list of expanders
  544. * @parent_dev: parent device class
  545. * @num_phys: number phys belonging to this sas_host/expander
  546. * @sas_address: sas address of this sas_host/expander
  547. * @handle: handle for this sas_host/expander
  548. * @sas_address_parent: sas address of parent expander or sas host
  549. * @enclosure_handle: handle for this a member of an enclosure
  550. * @device_info: bitwise defining capabilities of this sas_host/expander
  551. * @responding: used in _scsih_expander_device_mark_responding
  552. * @phy: a list of phys that make up this sas_host/expander
  553. * @sas_port_list: list of ports attached to this sas_host/expander
  554. */
  555. struct _sas_node {
  556. struct list_head list;
  557. struct device *parent_dev;
  558. u8 num_phys;
  559. u64 sas_address;
  560. u16 handle;
  561. u64 sas_address_parent;
  562. u16 enclosure_handle;
  563. u64 enclosure_logical_id;
  564. u8 responding;
  565. struct _sas_phy *phy;
  566. struct list_head sas_port_list;
  567. };
  568. /**
  569. * enum reset_type - reset state
  570. * @FORCE_BIG_HAMMER: issue diagnostic reset
  571. * @SOFT_RESET: issue message_unit_reset, if fails to to big hammer
  572. */
  573. enum reset_type {
  574. FORCE_BIG_HAMMER,
  575. SOFT_RESET,
  576. };
  577. /**
  578. * struct chain_tracker - firmware chain tracker
  579. * @chain_buffer: chain buffer
  580. * @chain_buffer_dma: physical address
  581. * @tracker_list: list of free request (ioc->free_chain_list)
  582. */
  583. struct chain_tracker {
  584. void *chain_buffer;
  585. dma_addr_t chain_buffer_dma;
  586. struct list_head tracker_list;
  587. };
  588. /**
  589. * struct scsiio_tracker - scsi mf request tracker
  590. * @smid: system message id
  591. * @scmd: scsi request pointer
  592. * @cb_idx: callback index
  593. * @direct_io: To indicate whether I/O is direct (WARPDRIVE)
  594. * @tracker_list: list of free request (ioc->free_list)
  595. * @msix_io: IO's msix
  596. */
  597. struct scsiio_tracker {
  598. u16 smid;
  599. struct scsi_cmnd *scmd;
  600. u8 cb_idx;
  601. u8 direct_io;
  602. struct list_head chain_list;
  603. struct list_head tracker_list;
  604. u16 msix_io;
  605. };
  606. /**
  607. * struct request_tracker - firmware request tracker
  608. * @smid: system message id
  609. * @cb_idx: callback index
  610. * @tracker_list: list of free request (ioc->free_list)
  611. */
  612. struct request_tracker {
  613. u16 smid;
  614. u8 cb_idx;
  615. struct list_head tracker_list;
  616. };
  617. /**
  618. * struct _tr_list - target reset list
  619. * @handle: device handle
  620. * @state: state machine
  621. */
  622. struct _tr_list {
  623. struct list_head list;
  624. u16 handle;
  625. u16 state;
  626. };
  627. /**
  628. * struct _sc_list - delayed SAS_IO_UNIT_CONTROL message list
  629. * @handle: device handle
  630. */
  631. struct _sc_list {
  632. struct list_head list;
  633. u16 handle;
  634. };
  635. /**
  636. * struct _event_ack_list - delayed event acknowledgment list
  637. * @Event: Event ID
  638. * @EventContext: used to track the event uniquely
  639. */
  640. struct _event_ack_list {
  641. struct list_head list;
  642. u16 Event;
  643. u32 EventContext;
  644. };
  645. /**
  646. * struct adapter_reply_queue - the reply queue struct
  647. * @ioc: per adapter object
  648. * @msix_index: msix index into vector table
  649. * @vector: irq vector
  650. * @reply_post_host_index: head index in the pool where FW completes IO
  651. * @reply_post_free: reply post base virt address
  652. * @name: the name registered to request_irq()
  653. * @busy: isr is actively processing replies on another cpu
  654. * @list: this list
  655. */
  656. struct adapter_reply_queue {
  657. struct MPT3SAS_ADAPTER *ioc;
  658. u8 msix_index;
  659. unsigned int vector;
  660. u32 reply_post_host_index;
  661. Mpi2ReplyDescriptorsUnion_t *reply_post_free;
  662. char name[MPT_NAME_LENGTH];
  663. atomic_t busy;
  664. cpumask_var_t affinity_hint;
  665. struct list_head list;
  666. };
  667. typedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr);
  668. /* SAS3.0 support */
  669. typedef int (*MPT_BUILD_SG_SCMD)(struct MPT3SAS_ADAPTER *ioc,
  670. struct scsi_cmnd *scmd, u16 smid);
  671. typedef void (*MPT_BUILD_SG)(struct MPT3SAS_ADAPTER *ioc, void *psge,
  672. dma_addr_t data_out_dma, size_t data_out_sz,
  673. dma_addr_t data_in_dma, size_t data_in_sz);
  674. typedef void (*MPT_BUILD_ZERO_LEN_SGE)(struct MPT3SAS_ADAPTER *ioc,
  675. void *paddr);
  676. /* IOC Facts and Port Facts converted from little endian to cpu */
  677. union mpi3_version_union {
  678. MPI2_VERSION_STRUCT Struct;
  679. u32 Word;
  680. };
  681. struct mpt3sas_facts {
  682. u16 MsgVersion;
  683. u16 HeaderVersion;
  684. u8 IOCNumber;
  685. u8 VP_ID;
  686. u8 VF_ID;
  687. u16 IOCExceptions;
  688. u16 IOCStatus;
  689. u32 IOCLogInfo;
  690. u8 MaxChainDepth;
  691. u8 WhoInit;
  692. u8 NumberOfPorts;
  693. u8 MaxMSIxVectors;
  694. u16 RequestCredit;
  695. u16 ProductID;
  696. u32 IOCCapabilities;
  697. union mpi3_version_union FWVersion;
  698. u16 IOCRequestFrameSize;
  699. u16 IOCMaxChainSegmentSize;
  700. u16 MaxInitiators;
  701. u16 MaxTargets;
  702. u16 MaxSasExpanders;
  703. u16 MaxEnclosures;
  704. u16 ProtocolFlags;
  705. u16 HighPriorityCredit;
  706. u16 MaxReplyDescriptorPostQueueDepth;
  707. u8 ReplyFrameSize;
  708. u8 MaxVolumes;
  709. u16 MaxDevHandle;
  710. u16 MaxPersistentEntries;
  711. u16 MinDevHandle;
  712. };
  713. struct mpt3sas_port_facts {
  714. u8 PortNumber;
  715. u8 VP_ID;
  716. u8 VF_ID;
  717. u8 PortType;
  718. u16 MaxPostedCmdBuffers;
  719. };
  720. struct reply_post_struct {
  721. Mpi2ReplyDescriptorsUnion_t *reply_post_free;
  722. dma_addr_t reply_post_free_dma;
  723. };
  724. typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc);
  725. /**
  726. * struct MPT3SAS_ADAPTER - per adapter struct
  727. * @list: ioc_list
  728. * @shost: shost object
  729. * @id: unique adapter id
  730. * @cpu_count: number online cpus
  731. * @name: generic ioc string
  732. * @tmp_string: tmp string used for logging
  733. * @pdev: pci pdev object
  734. * @pio_chip: physical io register space
  735. * @chip: memory mapped register space
  736. * @chip_phys: physical addrss prior to mapping
  737. * @logging_level: see mpt3sas_debug.h
  738. * @fwfault_debug: debuging FW timeouts
  739. * @ir_firmware: IR firmware present
  740. * @bars: bitmask of BAR's that must be configured
  741. * @mask_interrupts: ignore interrupt
  742. * @dma_mask: used to set the consistent dma mask
  743. * @fault_reset_work_q_name: fw fault work queue
  744. * @fault_reset_work_q: ""
  745. * @fault_reset_work: ""
  746. * @firmware_event_name: fw event work queue
  747. * @firmware_event_thread: ""
  748. * @fw_event_lock:
  749. * @fw_event_list: list of fw events
  750. * @aen_event_read_flag: event log was read
  751. * @broadcast_aen_busy: broadcast aen waiting to be serviced
  752. * @shost_recovery: host reset in progress
  753. * @ioc_reset_in_progress_lock:
  754. * @ioc_link_reset_in_progress: phy/hard reset in progress
  755. * @ignore_loginfos: ignore loginfos during task management
  756. * @remove_host: flag for when driver unloads, to avoid sending dev resets
  757. * @pci_error_recovery: flag to prevent ioc access until slot reset completes
  758. * @wait_for_discovery_to_complete: flag set at driver load time when
  759. * waiting on reporting devices
  760. * @is_driver_loading: flag set at driver load time
  761. * @port_enable_failed: flag set when port enable has failed
  762. * @start_scan: flag set from scan_start callback, cleared from _mpt3sas_fw_work
  763. * @start_scan_failed: means port enable failed, return's the ioc_status
  764. * @msix_enable: flag indicating msix is enabled
  765. * @msix_vector_count: number msix vectors
  766. * @cpu_msix_table: table for mapping cpus to msix index
  767. * @cpu_msix_table_sz: table size
  768. * @schedule_dead_ioc_flush_running_cmds: callback to flush pending commands
  769. * @scsi_io_cb_idx: shost generated commands
  770. * @tm_cb_idx: task management commands
  771. * @scsih_cb_idx: scsih internal commands
  772. * @transport_cb_idx: transport internal commands
  773. * @ctl_cb_idx: clt internal commands
  774. * @base_cb_idx: base internal commands
  775. * @config_cb_idx: base internal commands
  776. * @tm_tr_cb_idx : device removal target reset handshake
  777. * @tm_tr_volume_cb_idx : volume removal target reset
  778. * @base_cmds:
  779. * @transport_cmds:
  780. * @scsih_cmds:
  781. * @tm_cmds:
  782. * @ctl_cmds:
  783. * @config_cmds:
  784. * @base_add_sg_single: handler for either 32/64 bit sgl's
  785. * @event_type: bits indicating which events to log
  786. * @event_context: unique id for each logged event
  787. * @event_log: event log pointer
  788. * @event_masks: events that are masked
  789. * @facts: static facts data
  790. * @pfacts: static port facts data
  791. * @manu_pg0: static manufacturing page 0
  792. * @manu_pg10: static manufacturing page 10
  793. * @manu_pg11: static manufacturing page 11
  794. * @bios_pg2: static bios page 2
  795. * @bios_pg3: static bios page 3
  796. * @ioc_pg8: static ioc page 8
  797. * @iounit_pg0: static iounit page 0
  798. * @iounit_pg1: static iounit page 1
  799. * @iounit_pg8: static iounit page 8
  800. * @sas_hba: sas host object
  801. * @sas_expander_list: expander object list
  802. * @sas_node_lock:
  803. * @sas_device_list: sas device object list
  804. * @sas_device_init_list: sas device object list (used only at init time)
  805. * @sas_device_lock:
  806. * @io_missing_delay: time for IO completed by fw when PDR enabled
  807. * @device_missing_delay: time for device missing by fw when PDR enabled
  808. * @sas_id : used for setting volume target IDs
  809. * @blocking_handles: bitmask used to identify which devices need blocking
  810. * @pd_handles : bitmask for PD handles
  811. * @pd_handles_sz : size of pd_handle bitmask
  812. * @config_page_sz: config page size
  813. * @config_page: reserve memory for config page payload
  814. * @config_page_dma:
  815. * @hba_queue_depth: hba request queue depth
  816. * @sge_size: sg element size for either 32/64 bit
  817. * @scsiio_depth: SCSI_IO queue depth
  818. * @request_sz: per request frame size
  819. * @request: pool of request frames
  820. * @request_dma:
  821. * @request_dma_sz:
  822. * @scsi_lookup: firmware request tracker list
  823. * @scsi_lookup_lock:
  824. * @free_list: free list of request
  825. * @pending_io_count:
  826. * @reset_wq:
  827. * @chain: pool of chains
  828. * @chain_dma:
  829. * @max_sges_in_main_message: number sg elements in main message
  830. * @max_sges_in_chain_message: number sg elements per chain
  831. * @chains_needed_per_io: max chains per io
  832. * @chain_depth: total chains allocated
  833. * @chain_segment_sz: gives the max number of
  834. * SGEs accommodate on single chain buffer
  835. * @hi_priority_smid:
  836. * @hi_priority:
  837. * @hi_priority_dma:
  838. * @hi_priority_depth:
  839. * @hpr_lookup:
  840. * @hpr_free_list:
  841. * @internal_smid:
  842. * @internal:
  843. * @internal_dma:
  844. * @internal_depth:
  845. * @internal_lookup:
  846. * @internal_free_list:
  847. * @sense: pool of sense
  848. * @sense_dma:
  849. * @sense_dma_pool:
  850. * @reply_depth: hba reply queue depth:
  851. * @reply_sz: per reply frame size:
  852. * @reply: pool of replys:
  853. * @reply_dma:
  854. * @reply_dma_pool:
  855. * @reply_free_queue_depth: reply free depth
  856. * @reply_free: pool for reply free queue (32 bit addr)
  857. * @reply_free_dma:
  858. * @reply_free_dma_pool:
  859. * @reply_free_host_index: tail index in pool to insert free replys
  860. * @reply_post_queue_depth: reply post queue depth
  861. * @reply_post_struct: struct for reply_post_free physical & virt address
  862. * @rdpq_array_capable: FW supports multiple reply queue addresses in ioc_init
  863. * @rdpq_array_enable: rdpq_array support is enabled in the driver
  864. * @rdpq_array_enable_assigned: this ensures that rdpq_array_enable flag
  865. * is assigned only ones
  866. * @reply_queue_count: number of reply queue's
  867. * @reply_queue_list: link list contaning the reply queue info
  868. * @msix96_vector: 96 MSI-X vector support
  869. * @replyPostRegisterIndex: index of next position in Reply Desc Post Queue
  870. * @delayed_tr_list: target reset link list
  871. * @delayed_tr_volume_list: volume target reset link list
  872. * @delayed_sc_list:
  873. * @delayed_event_ack_list:
  874. * @temp_sensors_count: flag to carry the number of temperature sensors
  875. * @pci_access_mutex: Mutex to synchronize ioctl,sysfs show path and
  876. * pci resource handling. PCI resource freeing will lead to free
  877. * vital hardware/memory resource, which might be in use by cli/sysfs
  878. * path functions resulting in Null pointer reference followed by kernel
  879. * crash. To avoid the above race condition we use mutex syncrhonization
  880. * which ensures the syncrhonization between cli/sysfs_show path.
  881. */
  882. struct MPT3SAS_ADAPTER {
  883. struct list_head list;
  884. struct Scsi_Host *shost;
  885. u8 id;
  886. int cpu_count;
  887. char name[MPT_NAME_LENGTH];
  888. char driver_name[MPT_NAME_LENGTH];
  889. char tmp_string[MPT_STRING_LENGTH];
  890. struct pci_dev *pdev;
  891. Mpi2SystemInterfaceRegs_t __iomem *chip;
  892. resource_size_t chip_phys;
  893. int logging_level;
  894. int fwfault_debug;
  895. u8 ir_firmware;
  896. int bars;
  897. u8 mask_interrupts;
  898. int dma_mask;
  899. /* fw fault handler */
  900. char fault_reset_work_q_name[20];
  901. struct workqueue_struct *fault_reset_work_q;
  902. struct delayed_work fault_reset_work;
  903. /* fw event handler */
  904. char firmware_event_name[20];
  905. struct workqueue_struct *firmware_event_thread;
  906. spinlock_t fw_event_lock;
  907. struct list_head fw_event_list;
  908. /* misc flags */
  909. int aen_event_read_flag;
  910. u8 broadcast_aen_busy;
  911. u16 broadcast_aen_pending;
  912. u8 shost_recovery;
  913. struct mutex reset_in_progress_mutex;
  914. spinlock_t ioc_reset_in_progress_lock;
  915. u8 ioc_link_reset_in_progress;
  916. u8 ioc_reset_in_progress_status;
  917. u8 ignore_loginfos;
  918. u8 remove_host;
  919. u8 pci_error_recovery;
  920. u8 wait_for_discovery_to_complete;
  921. u8 is_driver_loading;
  922. u8 port_enable_failed;
  923. u8 start_scan;
  924. u16 start_scan_failed;
  925. u8 msix_enable;
  926. u16 msix_vector_count;
  927. u8 *cpu_msix_table;
  928. u16 cpu_msix_table_sz;
  929. resource_size_t __iomem **reply_post_host_index;
  930. u32 ioc_reset_count;
  931. MPT3SAS_FLUSH_RUNNING_CMDS schedule_dead_ioc_flush_running_cmds;
  932. u32 non_operational_loop;
  933. /* internal commands, callback index */
  934. u8 scsi_io_cb_idx;
  935. u8 tm_cb_idx;
  936. u8 transport_cb_idx;
  937. u8 scsih_cb_idx;
  938. u8 ctl_cb_idx;
  939. u8 base_cb_idx;
  940. u8 port_enable_cb_idx;
  941. u8 config_cb_idx;
  942. u8 tm_tr_cb_idx;
  943. u8 tm_tr_volume_cb_idx;
  944. u8 tm_sas_control_cb_idx;
  945. struct _internal_cmd base_cmds;
  946. struct _internal_cmd port_enable_cmds;
  947. struct _internal_cmd transport_cmds;
  948. struct _internal_cmd scsih_cmds;
  949. struct _internal_cmd tm_cmds;
  950. struct _internal_cmd ctl_cmds;
  951. struct _internal_cmd config_cmds;
  952. MPT_ADD_SGE base_add_sg_single;
  953. /* function ptr for either IEEE or MPI sg elements */
  954. MPT_BUILD_SG_SCMD build_sg_scmd;
  955. MPT_BUILD_SG build_sg;
  956. MPT_BUILD_ZERO_LEN_SGE build_zero_len_sge;
  957. u16 sge_size_ieee;
  958. u16 hba_mpi_version_belonged;
  959. /* function ptr for MPI sg elements only */
  960. MPT_BUILD_SG build_sg_mpi;
  961. MPT_BUILD_ZERO_LEN_SGE build_zero_len_sge_mpi;
  962. /* event log */
  963. u32 event_type[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
  964. u32 event_context;
  965. void *event_log;
  966. u32 event_masks[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
  967. /* static config pages */
  968. struct mpt3sas_facts facts;
  969. struct mpt3sas_port_facts *pfacts;
  970. Mpi2ManufacturingPage0_t manu_pg0;
  971. struct Mpi2ManufacturingPage10_t manu_pg10;
  972. struct Mpi2ManufacturingPage11_t manu_pg11;
  973. Mpi2BiosPage2_t bios_pg2;
  974. Mpi2BiosPage3_t bios_pg3;
  975. Mpi2IOCPage8_t ioc_pg8;
  976. Mpi2IOUnitPage0_t iounit_pg0;
  977. Mpi2IOUnitPage1_t iounit_pg1;
  978. Mpi2IOUnitPage8_t iounit_pg8;
  979. struct _boot_device req_boot_device;
  980. struct _boot_device req_alt_boot_device;
  981. struct _boot_device current_boot_device;
  982. /* sas hba, expander, and device list */
  983. struct _sas_node sas_hba;
  984. struct list_head sas_expander_list;
  985. spinlock_t sas_node_lock;
  986. struct list_head sas_device_list;
  987. struct list_head sas_device_init_list;
  988. spinlock_t sas_device_lock;
  989. struct list_head raid_device_list;
  990. spinlock_t raid_device_lock;
  991. u8 io_missing_delay;
  992. u16 device_missing_delay;
  993. int sas_id;
  994. void *blocking_handles;
  995. void *pd_handles;
  996. u16 pd_handles_sz;
  997. /* config page */
  998. u16 config_page_sz;
  999. void *config_page;
  1000. dma_addr_t config_page_dma;
  1001. /* scsiio request */
  1002. u16 hba_queue_depth;
  1003. u16 sge_size;
  1004. u16 scsiio_depth;
  1005. u16 request_sz;
  1006. u8 *request;
  1007. dma_addr_t request_dma;
  1008. u32 request_dma_sz;
  1009. struct scsiio_tracker *scsi_lookup;
  1010. ulong scsi_lookup_pages;
  1011. spinlock_t scsi_lookup_lock;
  1012. struct list_head free_list;
  1013. int pending_io_count;
  1014. wait_queue_head_t reset_wq;
  1015. /* chain */
  1016. struct chain_tracker *chain_lookup;
  1017. struct list_head free_chain_list;
  1018. struct dma_pool *chain_dma_pool;
  1019. ulong chain_pages;
  1020. u16 max_sges_in_main_message;
  1021. u16 max_sges_in_chain_message;
  1022. u16 chains_needed_per_io;
  1023. u32 chain_depth;
  1024. u16 chain_segment_sz;
  1025. /* hi-priority queue */
  1026. u16 hi_priority_smid;
  1027. u8 *hi_priority;
  1028. dma_addr_t hi_priority_dma;
  1029. u16 hi_priority_depth;
  1030. struct request_tracker *hpr_lookup;
  1031. struct list_head hpr_free_list;
  1032. /* internal queue */
  1033. u16 internal_smid;
  1034. u8 *internal;
  1035. dma_addr_t internal_dma;
  1036. u16 internal_depth;
  1037. struct request_tracker *internal_lookup;
  1038. struct list_head internal_free_list;
  1039. /* sense */
  1040. u8 *sense;
  1041. dma_addr_t sense_dma;
  1042. struct dma_pool *sense_dma_pool;
  1043. /* reply */
  1044. u16 reply_sz;
  1045. u8 *reply;
  1046. dma_addr_t reply_dma;
  1047. u32 reply_dma_max_address;
  1048. u32 reply_dma_min_address;
  1049. struct dma_pool *reply_dma_pool;
  1050. /* reply free queue */
  1051. u16 reply_free_queue_depth;
  1052. __le32 *reply_free;
  1053. dma_addr_t reply_free_dma;
  1054. struct dma_pool *reply_free_dma_pool;
  1055. u32 reply_free_host_index;
  1056. /* reply post queue */
  1057. u16 reply_post_queue_depth;
  1058. struct reply_post_struct *reply_post;
  1059. u8 rdpq_array_capable;
  1060. u8 rdpq_array_enable;
  1061. u8 rdpq_array_enable_assigned;
  1062. struct dma_pool *reply_post_free_dma_pool;
  1063. u8 reply_queue_count;
  1064. struct list_head reply_queue_list;
  1065. u8 msix96_vector;
  1066. /* reply post register index */
  1067. resource_size_t **replyPostRegisterIndex;
  1068. struct list_head delayed_tr_list;
  1069. struct list_head delayed_tr_volume_list;
  1070. struct list_head delayed_sc_list;
  1071. struct list_head delayed_event_ack_list;
  1072. u8 temp_sensors_count;
  1073. struct mutex pci_access_mutex;
  1074. /* diag buffer support */
  1075. u8 *diag_buffer[MPI2_DIAG_BUF_TYPE_COUNT];
  1076. u32 diag_buffer_sz[MPI2_DIAG_BUF_TYPE_COUNT];
  1077. dma_addr_t diag_buffer_dma[MPI2_DIAG_BUF_TYPE_COUNT];
  1078. u8 diag_buffer_status[MPI2_DIAG_BUF_TYPE_COUNT];
  1079. u32 unique_id[MPI2_DIAG_BUF_TYPE_COUNT];
  1080. u32 product_specific[MPI2_DIAG_BUF_TYPE_COUNT][23];
  1081. u32 diagnostic_flags[MPI2_DIAG_BUF_TYPE_COUNT];
  1082. u32 ring_buffer_offset;
  1083. u32 ring_buffer_sz;
  1084. u8 is_warpdrive;
  1085. u8 hide_ir_msg;
  1086. u8 mfg_pg10_hide_flag;
  1087. u8 hide_drives;
  1088. spinlock_t diag_trigger_lock;
  1089. u8 diag_trigger_active;
  1090. struct SL_WH_MASTER_TRIGGER_T diag_trigger_master;
  1091. struct SL_WH_EVENT_TRIGGERS_T diag_trigger_event;
  1092. struct SL_WH_SCSI_TRIGGERS_T diag_trigger_scsi;
  1093. struct SL_WH_MPI_TRIGGERS_T diag_trigger_mpi;
  1094. };
  1095. typedef u8 (*MPT_CALLBACK)(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
  1096. u32 reply);
  1097. /* base shared API */
  1098. extern struct list_head mpt3sas_ioc_list;
  1099. extern char driver_name[MPT_NAME_LENGTH];
  1100. /* spinlock on list operations over IOCs
  1101. * Case: when multiple warpdrive cards(IOCs) are in use
  1102. * Each IOC will added to the ioc list structure on initialization.
  1103. * Watchdog threads run at regular intervals to check IOC for any
  1104. * fault conditions which will trigger the dead_ioc thread to
  1105. * deallocate pci resource, resulting deleting the IOC netry from list,
  1106. * this deletion need to protected by spinlock to enusre that
  1107. * ioc removal is syncrhonized, if not synchronized it might lead to
  1108. * list_del corruption as the ioc list is traversed in cli path.
  1109. */
  1110. extern spinlock_t gioc_lock;
  1111. void mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc);
  1112. void mpt3sas_base_stop_watchdog(struct MPT3SAS_ADAPTER *ioc);
  1113. int mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc);
  1114. void mpt3sas_base_detach(struct MPT3SAS_ADAPTER *ioc);
  1115. int mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc);
  1116. void mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc);
  1117. int mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc,
  1118. enum reset_type type);
  1119. void *mpt3sas_base_get_msg_frame(struct MPT3SAS_ADAPTER *ioc, u16 smid);
  1120. void *mpt3sas_base_get_sense_buffer(struct MPT3SAS_ADAPTER *ioc, u16 smid);
  1121. __le32 mpt3sas_base_get_sense_buffer_dma(struct MPT3SAS_ADAPTER *ioc,
  1122. u16 smid);
  1123. void mpt3sas_base_sync_reply_irqs(struct MPT3SAS_ADAPTER *ioc);
  1124. /* hi-priority queue */
  1125. u16 mpt3sas_base_get_smid_hpr(struct MPT3SAS_ADAPTER *ioc, u8 cb_idx);
  1126. u16 mpt3sas_base_get_smid_scsiio(struct MPT3SAS_ADAPTER *ioc, u8 cb_idx,
  1127. struct scsi_cmnd *scmd);
  1128. u16 mpt3sas_base_get_smid(struct MPT3SAS_ADAPTER *ioc, u8 cb_idx);
  1129. void mpt3sas_base_free_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid);
  1130. void mpt3sas_base_put_smid_scsi_io(struct MPT3SAS_ADAPTER *ioc, u16 smid,
  1131. u16 handle);
  1132. void mpt3sas_base_put_smid_fast_path(struct MPT3SAS_ADAPTER *ioc, u16 smid,
  1133. u16 handle);
  1134. void mpt3sas_base_put_smid_hi_priority(struct MPT3SAS_ADAPTER *ioc,
  1135. u16 smid, u16 msix_task);
  1136. void mpt3sas_base_put_smid_default(struct MPT3SAS_ADAPTER *ioc, u16 smid);
  1137. void mpt3sas_base_initialize_callback_handler(void);
  1138. u8 mpt3sas_base_register_callback_handler(MPT_CALLBACK cb_func);
  1139. void mpt3sas_base_release_callback_handler(u8 cb_idx);
  1140. u8 mpt3sas_base_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
  1141. u32 reply);
  1142. u8 mpt3sas_port_enable_done(struct MPT3SAS_ADAPTER *ioc, u16 smid,
  1143. u8 msix_index, u32 reply);
  1144. void *mpt3sas_base_get_reply_virt_addr(struct MPT3SAS_ADAPTER *ioc,
  1145. u32 phys_addr);
  1146. u32 mpt3sas_base_get_iocstate(struct MPT3SAS_ADAPTER *ioc, int cooked);
  1147. void mpt3sas_base_fault_info(struct MPT3SAS_ADAPTER *ioc , u16 fault_code);
  1148. int mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc,
  1149. Mpi2SasIoUnitControlReply_t *mpi_reply,
  1150. Mpi2SasIoUnitControlRequest_t *mpi_request);
  1151. int mpt3sas_base_scsi_enclosure_processor(struct MPT3SAS_ADAPTER *ioc,
  1152. Mpi2SepReply_t *mpi_reply, Mpi2SepRequest_t *mpi_request);
  1153. void mpt3sas_base_validate_event_type(struct MPT3SAS_ADAPTER *ioc,
  1154. u32 *event_type);
  1155. void mpt3sas_halt_firmware(struct MPT3SAS_ADAPTER *ioc);
  1156. void mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc,
  1157. u16 device_missing_delay, u8 io_missing_delay);
  1158. int mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc);
  1159. /* scsih shared API */
  1160. u8 mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index,
  1161. u32 reply);
  1162. void mpt3sas_scsih_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase);
  1163. int mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle,
  1164. uint channel, uint id, uint lun, u8 type, u16 smid_task,
  1165. ulong timeout);
  1166. int mpt3sas_scsih_issue_locked_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle,
  1167. uint channel, uint id, uint lun, u8 type, u16 smid_task,
  1168. ulong timeout);
  1169. void mpt3sas_scsih_set_tm_flag(struct MPT3SAS_ADAPTER *ioc, u16 handle);
  1170. void mpt3sas_scsih_clear_tm_flag(struct MPT3SAS_ADAPTER *ioc, u16 handle);
  1171. void mpt3sas_expander_remove(struct MPT3SAS_ADAPTER *ioc, u64 sas_address);
  1172. void mpt3sas_device_remove_by_sas_address(struct MPT3SAS_ADAPTER *ioc,
  1173. u64 sas_address);
  1174. u8 mpt3sas_check_for_pending_internal_cmds(struct MPT3SAS_ADAPTER *ioc,
  1175. u16 smid);
  1176. struct _sas_node *mpt3sas_scsih_expander_find_by_handle(
  1177. struct MPT3SAS_ADAPTER *ioc, u16 handle);
  1178. struct _sas_node *mpt3sas_scsih_expander_find_by_sas_address(
  1179. struct MPT3SAS_ADAPTER *ioc, u64 sas_address);
  1180. struct _sas_device *mpt3sas_get_sdev_by_addr(
  1181. struct MPT3SAS_ADAPTER *ioc, u64 sas_address);
  1182. struct _sas_device *__mpt3sas_get_sdev_by_addr(
  1183. struct MPT3SAS_ADAPTER *ioc, u64 sas_address);
  1184. void mpt3sas_port_enable_complete(struct MPT3SAS_ADAPTER *ioc);
  1185. struct _raid_device *
  1186. mpt3sas_raid_device_find_by_handle(struct MPT3SAS_ADAPTER *ioc, u16 handle);
  1187. /* config shared API */
  1188. u8 mpt3sas_config_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
  1189. u32 reply);
  1190. int mpt3sas_config_get_number_hba_phys(struct MPT3SAS_ADAPTER *ioc,
  1191. u8 *num_phys);
  1192. int mpt3sas_config_get_manufacturing_pg0(struct MPT3SAS_ADAPTER *ioc,
  1193. Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage0_t *config_page);
  1194. int mpt3sas_config_get_manufacturing_pg7(struct MPT3SAS_ADAPTER *ioc,
  1195. Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage7_t *config_page,
  1196. u16 sz);
  1197. int mpt3sas_config_get_manufacturing_pg10(struct MPT3SAS_ADAPTER *ioc,
  1198. Mpi2ConfigReply_t *mpi_reply,
  1199. struct Mpi2ManufacturingPage10_t *config_page);
  1200. int mpt3sas_config_get_manufacturing_pg11(struct MPT3SAS_ADAPTER *ioc,
  1201. Mpi2ConfigReply_t *mpi_reply,
  1202. struct Mpi2ManufacturingPage11_t *config_page);
  1203. int mpt3sas_config_set_manufacturing_pg11(struct MPT3SAS_ADAPTER *ioc,
  1204. Mpi2ConfigReply_t *mpi_reply,
  1205. struct Mpi2ManufacturingPage11_t *config_page);
  1206. int mpt3sas_config_get_bios_pg2(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  1207. *mpi_reply, Mpi2BiosPage2_t *config_page);
  1208. int mpt3sas_config_get_bios_pg3(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  1209. *mpi_reply, Mpi2BiosPage3_t *config_page);
  1210. int mpt3sas_config_get_iounit_pg0(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  1211. *mpi_reply, Mpi2IOUnitPage0_t *config_page);
  1212. int mpt3sas_config_get_sas_device_pg0(struct MPT3SAS_ADAPTER *ioc,
  1213. Mpi2ConfigReply_t *mpi_reply, Mpi2SasDevicePage0_t *config_page,
  1214. u32 form, u32 handle);
  1215. int mpt3sas_config_get_sas_device_pg1(struct MPT3SAS_ADAPTER *ioc,
  1216. Mpi2ConfigReply_t *mpi_reply, Mpi2SasDevicePage1_t *config_page,
  1217. u32 form, u32 handle);
  1218. int mpt3sas_config_get_sas_iounit_pg0(struct MPT3SAS_ADAPTER *ioc,
  1219. Mpi2ConfigReply_t *mpi_reply, Mpi2SasIOUnitPage0_t *config_page,
  1220. u16 sz);
  1221. int mpt3sas_config_get_iounit_pg1(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  1222. *mpi_reply, Mpi2IOUnitPage1_t *config_page);
  1223. int mpt3sas_config_get_iounit_pg3(struct MPT3SAS_ADAPTER *ioc,
  1224. Mpi2ConfigReply_t *mpi_reply, Mpi2IOUnitPage3_t *config_page, u16 sz);
  1225. int mpt3sas_config_set_iounit_pg1(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  1226. *mpi_reply, Mpi2IOUnitPage1_t *config_page);
  1227. int mpt3sas_config_get_iounit_pg8(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  1228. *mpi_reply, Mpi2IOUnitPage8_t *config_page);
  1229. int mpt3sas_config_get_sas_iounit_pg1(struct MPT3SAS_ADAPTER *ioc,
  1230. Mpi2ConfigReply_t *mpi_reply, Mpi2SasIOUnitPage1_t *config_page,
  1231. u16 sz);
  1232. int mpt3sas_config_set_sas_iounit_pg1(struct MPT3SAS_ADAPTER *ioc,
  1233. Mpi2ConfigReply_t *mpi_reply, Mpi2SasIOUnitPage1_t *config_page,
  1234. u16 sz);
  1235. int mpt3sas_config_get_ioc_pg8(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  1236. *mpi_reply, Mpi2IOCPage8_t *config_page);
  1237. int mpt3sas_config_get_expander_pg0(struct MPT3SAS_ADAPTER *ioc,
  1238. Mpi2ConfigReply_t *mpi_reply, Mpi2ExpanderPage0_t *config_page,
  1239. u32 form, u32 handle);
  1240. int mpt3sas_config_get_expander_pg1(struct MPT3SAS_ADAPTER *ioc,
  1241. Mpi2ConfigReply_t *mpi_reply, Mpi2ExpanderPage1_t *config_page,
  1242. u32 phy_number, u16 handle);
  1243. int mpt3sas_config_get_enclosure_pg0(struct MPT3SAS_ADAPTER *ioc,
  1244. Mpi2ConfigReply_t *mpi_reply, Mpi2SasEnclosurePage0_t *config_page,
  1245. u32 form, u32 handle);
  1246. int mpt3sas_config_get_phy_pg0(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  1247. *mpi_reply, Mpi2SasPhyPage0_t *config_page, u32 phy_number);
  1248. int mpt3sas_config_get_phy_pg1(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  1249. *mpi_reply, Mpi2SasPhyPage1_t *config_page, u32 phy_number);
  1250. int mpt3sas_config_get_raid_volume_pg1(struct MPT3SAS_ADAPTER *ioc,
  1251. Mpi2ConfigReply_t *mpi_reply, Mpi2RaidVolPage1_t *config_page, u32 form,
  1252. u32 handle);
  1253. int mpt3sas_config_get_number_pds(struct MPT3SAS_ADAPTER *ioc, u16 handle,
  1254. u8 *num_pds);
  1255. int mpt3sas_config_get_raid_volume_pg0(struct MPT3SAS_ADAPTER *ioc,
  1256. Mpi2ConfigReply_t *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 form,
  1257. u32 handle, u16 sz);
  1258. int mpt3sas_config_get_phys_disk_pg0(struct MPT3SAS_ADAPTER *ioc,
  1259. Mpi2ConfigReply_t *mpi_reply, Mpi2RaidPhysDiskPage0_t *config_page,
  1260. u32 form, u32 form_specific);
  1261. int mpt3sas_config_get_volume_handle(struct MPT3SAS_ADAPTER *ioc, u16 pd_handle,
  1262. u16 *volume_handle);
  1263. int mpt3sas_config_get_volume_wwid(struct MPT3SAS_ADAPTER *ioc,
  1264. u16 volume_handle, u64 *wwid);
  1265. /* ctl shared API */
  1266. extern struct device_attribute *mpt3sas_host_attrs[];
  1267. extern struct device_attribute *mpt3sas_dev_attrs[];
  1268. void mpt3sas_ctl_init(ushort hbas_to_enumerate);
  1269. void mpt3sas_ctl_exit(ushort hbas_to_enumerate);
  1270. u8 mpt3sas_ctl_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
  1271. u32 reply);
  1272. void mpt3sas_ctl_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase);
  1273. u8 mpt3sas_ctl_event_callback(struct MPT3SAS_ADAPTER *ioc,
  1274. u8 msix_index, u32 reply);
  1275. void mpt3sas_ctl_add_to_event_log(struct MPT3SAS_ADAPTER *ioc,
  1276. Mpi2EventNotificationReply_t *mpi_reply);
  1277. void mpt3sas_enable_diag_buffer(struct MPT3SAS_ADAPTER *ioc,
  1278. u8 bits_to_regsiter);
  1279. int mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type,
  1280. u8 *issue_reset);
  1281. /* transport shared API */
  1282. extern struct scsi_transport_template *mpt3sas_transport_template;
  1283. u8 mpt3sas_transport_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
  1284. u32 reply);
  1285. struct _sas_port *mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc,
  1286. u16 handle, u64 sas_address);
  1287. void mpt3sas_transport_port_remove(struct MPT3SAS_ADAPTER *ioc, u64 sas_address,
  1288. u64 sas_address_parent);
  1289. int mpt3sas_transport_add_host_phy(struct MPT3SAS_ADAPTER *ioc, struct _sas_phy
  1290. *mpt3sas_phy, Mpi2SasPhyPage0_t phy_pg0, struct device *parent_dev);
  1291. int mpt3sas_transport_add_expander_phy(struct MPT3SAS_ADAPTER *ioc,
  1292. struct _sas_phy *mpt3sas_phy, Mpi2ExpanderPage1_t expander_pg1,
  1293. struct device *parent_dev);
  1294. void mpt3sas_transport_update_links(struct MPT3SAS_ADAPTER *ioc,
  1295. u64 sas_address, u16 handle, u8 phy_number, u8 link_rate);
  1296. extern struct sas_function_template mpt3sas_transport_functions;
  1297. extern struct scsi_transport_template *mpt3sas_transport_template;
  1298. extern int scsi_internal_device_block(struct scsi_device *sdev);
  1299. extern int scsi_internal_device_unblock(struct scsi_device *sdev,
  1300. enum scsi_device_state new_state);
  1301. /* trigger data externs */
  1302. void mpt3sas_send_trigger_data_event(struct MPT3SAS_ADAPTER *ioc,
  1303. struct SL_WH_TRIGGERS_EVENT_DATA_T *event_data);
  1304. void mpt3sas_process_trigger_data(struct MPT3SAS_ADAPTER *ioc,
  1305. struct SL_WH_TRIGGERS_EVENT_DATA_T *event_data);
  1306. void mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc,
  1307. u32 tigger_bitmask);
  1308. void mpt3sas_trigger_event(struct MPT3SAS_ADAPTER *ioc, u16 event,
  1309. u16 log_entry_qualifier);
  1310. void mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key,
  1311. u8 asc, u8 ascq);
  1312. void mpt3sas_trigger_mpi(struct MPT3SAS_ADAPTER *ioc, u16 ioc_status,
  1313. u32 loginfo);
  1314. /* warpdrive APIs */
  1315. u8 mpt3sas_get_num_volumes(struct MPT3SAS_ADAPTER *ioc);
  1316. void mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc,
  1317. struct _raid_device *raid_device);
  1318. u8
  1319. mpt3sas_scsi_direct_io_get(struct MPT3SAS_ADAPTER *ioc, u16 smid);
  1320. void
  1321. mpt3sas_scsi_direct_io_set(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 direct_io);
  1322. void
  1323. mpt3sas_setup_direct_io(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
  1324. struct _raid_device *raid_device, Mpi2SCSIIORequest_t *mpi_request,
  1325. u16 smid);
  1326. #endif /* MPT3SAS_BASE_H_INCLUDED */