mpt2sas_base.h 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096
  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/mpt2sas/mpt2_base.h
  6. * Copyright (C) 2007-2010 LSI Corporation
  7. * (mailto:DL-MPTFusionLinux@lsi.com)
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * NO WARRANTY
  20. * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
  21. * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
  22. * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
  23. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
  24. * solely responsible for determining the appropriateness of using and
  25. * distributing the Program and assumes all risks associated with its
  26. * exercise of rights under this Agreement, including but not limited to
  27. * the risks and costs of program errors, damage to or loss of data,
  28. * programs or equipment, and unavailability or interruption of operations.
  29. * DISCLAIMER OF LIABILITY
  30. * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
  31. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  32. * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
  33. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  34. * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  35. * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
  36. * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
  37. * You should have received a copy of the GNU General Public License
  38. * along with this program; if not, write to the Free Software
  39. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
  40. * USA.
  41. */
  42. #ifndef MPT2SAS_BASE_H_INCLUDED
  43. #define MPT2SAS_BASE_H_INCLUDED
  44. #include "mpi/mpi2_type.h"
  45. #include "mpi/mpi2.h"
  46. #include "mpi/mpi2_ioc.h"
  47. #include "mpi/mpi2_cnfg.h"
  48. #include "mpi/mpi2_init.h"
  49. #include "mpi/mpi2_raid.h"
  50. #include "mpi/mpi2_tool.h"
  51. #include "mpi/mpi2_sas.h"
  52. #include <scsi/scsi.h>
  53. #include <scsi/scsi_cmnd.h>
  54. #include <scsi/scsi_device.h>
  55. #include <scsi/scsi_host.h>
  56. #include <scsi/scsi_tcq.h>
  57. #include <scsi/scsi_transport_sas.h>
  58. #include <scsi/scsi_dbg.h>
  59. #include <scsi/scsi_eh.h>
  60. #include "mpt2sas_debug.h"
  61. /* driver versioning info */
  62. #define MPT2SAS_DRIVER_NAME "mpt2sas"
  63. #define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>"
  64. #define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver"
  65. #define MPT2SAS_DRIVER_VERSION "08.100.00.02"
  66. #define MPT2SAS_MAJOR_VERSION 08
  67. #define MPT2SAS_MINOR_VERSION 100
  68. #define MPT2SAS_BUILD_VERSION 00
  69. #define MPT2SAS_RELEASE_VERSION 02
  70. /*
  71. * Set MPT2SAS_SG_DEPTH value based on user input.
  72. */
  73. #ifdef CONFIG_SCSI_MPT2SAS_MAX_SGE
  74. #if CONFIG_SCSI_MPT2SAS_MAX_SGE < 16
  75. #define MPT2SAS_SG_DEPTH 16
  76. #elif CONFIG_SCSI_MPT2SAS_MAX_SGE > 128
  77. #define MPT2SAS_SG_DEPTH 128
  78. #else
  79. #define MPT2SAS_SG_DEPTH CONFIG_SCSI_MPT2SAS_MAX_SGE
  80. #endif
  81. #else
  82. #define MPT2SAS_SG_DEPTH 128 /* MAX_HW_SEGMENTS */
  83. #endif
  84. /*
  85. * Generic Defines
  86. */
  87. #define MPT2SAS_SATA_QUEUE_DEPTH 32
  88. #define MPT2SAS_SAS_QUEUE_DEPTH 254
  89. #define MPT2SAS_RAID_QUEUE_DEPTH 128
  90. #define MPT_NAME_LENGTH 32 /* generic length of strings */
  91. #define MPT_STRING_LENGTH 64
  92. #define MPT_MAX_CALLBACKS 16
  93. #define CAN_SLEEP 1
  94. #define NO_SLEEP 0
  95. #define INTERNAL_CMDS_COUNT 10 /* reserved cmds */
  96. #define MPI2_HIM_MASK 0xFFFFFFFF /* mask every bit*/
  97. #define MPT2SAS_INVALID_DEVICE_HANDLE 0xFFFF
  98. /*
  99. * reset phases
  100. */
  101. #define MPT2_IOC_PRE_RESET 1 /* prior to host reset */
  102. #define MPT2_IOC_AFTER_RESET 2 /* just after host reset */
  103. #define MPT2_IOC_DONE_RESET 3 /* links re-initialized */
  104. /*
  105. * logging format
  106. */
  107. #define MPT2SAS_FMT "%s: "
  108. #define MPT2SAS_INFO_FMT KERN_INFO MPT2SAS_FMT
  109. #define MPT2SAS_NOTE_FMT KERN_NOTICE MPT2SAS_FMT
  110. #define MPT2SAS_WARN_FMT KERN_WARNING MPT2SAS_FMT
  111. #define MPT2SAS_ERR_FMT KERN_ERR MPT2SAS_FMT
  112. /*
  113. * Dell HBA branding
  114. */
  115. #define MPT2SAS_DELL_BRANDING_SIZE 32
  116. #define MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING "Dell 6Gbps SAS HBA"
  117. #define MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING "Dell PERC H200 Adapter"
  118. #define MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING "Dell PERC H200 Integrated"
  119. #define MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING "Dell PERC H200 Modular"
  120. #define MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING "Dell PERC H200 Embedded"
  121. #define MPT2SAS_DELL_PERC_H200_BRANDING "Dell PERC H200"
  122. #define MPT2SAS_DELL_6GBPS_SAS_BRANDING "Dell 6Gbps SAS"
  123. /*
  124. * Dell HBA SSDIDs
  125. */
  126. #define MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID 0x1F1C
  127. #define MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID 0x1F1D
  128. #define MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID 0x1F1E
  129. #define MPT2SAS_DELL_PERC_H200_MODULAR_SSDID 0x1F1F
  130. #define MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID 0x1F20
  131. #define MPT2SAS_DELL_PERC_H200_SSDID 0x1F21
  132. #define MPT2SAS_DELL_6GBPS_SAS_SSDID 0x1F22
  133. /*
  134. * Intel HBA branding
  135. */
  136. #define MPT2SAS_INTEL_RMS2LL080_BRANDING \
  137. "Intel Integrated RAID Module RMS2LL080"
  138. #define MPT2SAS_INTEL_RMS2LL040_BRANDING \
  139. "Intel Integrated RAID Module RMS2LL040"
  140. /*
  141. * Intel HBA SSDIDs
  142. */
  143. #define MPT2SAS_INTEL_RMS2LL080_SSDID 0x350E
  144. #define MPT2SAS_INTEL_RMS2LL040_SSDID 0x350F
  145. /*
  146. * HP HBA branding
  147. */
  148. #define MPT2SAS_HP_3PAR_SSVID 0x1590
  149. #define MPT2SAS_HP_2_4_INTERNAL_BRANDING "HP H220 Host Bus Adapter"
  150. #define MPT2SAS_HP_2_4_EXTERNAL_BRANDING "HP H221 Host Bus Adapter"
  151. #define MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_BRANDING "HP H222 Host Bus Adapter"
  152. #define MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_BRANDING "HP H220i Host Bus Adapter"
  153. #define MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_BRANDING "HP H210i Host Bus Adapter"
  154. /*
  155. * HO HBA SSDIDs
  156. */
  157. #define MPT2SAS_HP_2_4_INTERNAL_SSDID 0x0041
  158. #define MPT2SAS_HP_2_4_EXTERNAL_SSDID 0x0042
  159. #define MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_SSDID 0x0043
  160. #define MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_SSDID 0x0044
  161. #define MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_SSDID 0x0046
  162. /*
  163. * WarpDrive Specific Log codes
  164. */
  165. #define MPT2_WARPDRIVE_LOGENTRY (0x8002)
  166. #define MPT2_WARPDRIVE_LC_SSDT (0x41)
  167. #define MPT2_WARPDRIVE_LC_SSDLW (0x43)
  168. #define MPT2_WARPDRIVE_LC_SSDLF (0x44)
  169. #define MPT2_WARPDRIVE_LC_BRMF (0x4D)
  170. /*
  171. * per target private data
  172. */
  173. #define MPT_TARGET_FLAGS_RAID_COMPONENT 0x01
  174. #define MPT_TARGET_FLAGS_VOLUME 0x02
  175. #define MPT_TARGET_FLAGS_DELETED 0x04
  176. /**
  177. * struct MPT2SAS_TARGET - starget private hostdata
  178. * @starget: starget object
  179. * @sas_address: target sas address
  180. * @raid_device: raid_device pointer to access volume data
  181. * @handle: device handle
  182. * @num_luns: number luns
  183. * @flags: MPT_TARGET_FLAGS_XXX flags
  184. * @deleted: target flaged for deletion
  185. * @tm_busy: target is busy with TM request.
  186. */
  187. struct MPT2SAS_TARGET {
  188. struct scsi_target *starget;
  189. u64 sas_address;
  190. struct _raid_device *raid_device;
  191. u16 handle;
  192. int num_luns;
  193. u32 flags;
  194. u8 deleted;
  195. u8 tm_busy;
  196. };
  197. /*
  198. * per device private data
  199. */
  200. #define MPT_DEVICE_FLAGS_INIT 0x01
  201. #define MPT_DEVICE_TLR_ON 0x02
  202. /**
  203. * struct MPT2SAS_DEVICE - sdev private hostdata
  204. * @sas_target: starget private hostdata
  205. * @lun: lun number
  206. * @flags: MPT_DEVICE_XXX flags
  207. * @configured_lun: lun is configured
  208. * @block: device is in SDEV_BLOCK state
  209. * @tlr_snoop_check: flag used in determining whether to disable TLR
  210. */
  211. /* OEM Identifiers */
  212. #define MFG10_OEM_ID_INVALID (0x00000000)
  213. #define MFG10_OEM_ID_DELL (0x00000001)
  214. #define MFG10_OEM_ID_FSC (0x00000002)
  215. #define MFG10_OEM_ID_SUN (0x00000003)
  216. #define MFG10_OEM_ID_IBM (0x00000004)
  217. /* GENERIC Flags 0*/
  218. #define MFG10_GF0_OCE_DISABLED (0x00000001)
  219. #define MFG10_GF0_R1E_DRIVE_COUNT (0x00000002)
  220. #define MFG10_GF0_R10_DISPLAY (0x00000004)
  221. #define MFG10_GF0_SSD_DATA_SCRUB_DISABLE (0x00000008)
  222. #define MFG10_GF0_SINGLE_DRIVE_R0 (0x00000010)
  223. /* OEM Specific Flags will come from OEM specific header files */
  224. typedef struct _MPI2_CONFIG_PAGE_MAN_10 {
  225. MPI2_CONFIG_PAGE_HEADER Header; /* 00h */
  226. U8 OEMIdentifier; /* 04h */
  227. U8 Reserved1; /* 05h */
  228. U16 Reserved2; /* 08h */
  229. U32 Reserved3; /* 0Ch */
  230. U32 GenericFlags0; /* 10h */
  231. U32 GenericFlags1; /* 14h */
  232. U32 Reserved4; /* 18h */
  233. U32 OEMSpecificFlags0; /* 1Ch */
  234. U32 OEMSpecificFlags1; /* 20h */
  235. U32 Reserved5[18]; /* 24h-60h*/
  236. } MPI2_CONFIG_PAGE_MAN_10,
  237. MPI2_POINTER PTR_MPI2_CONFIG_PAGE_MAN_10,
  238. Mpi2ManufacturingPage10_t, MPI2_POINTER pMpi2ManufacturingPage10_t;
  239. #define MFG_PAGE10_HIDE_SSDS_MASK (0x00000003)
  240. #define MFG_PAGE10_HIDE_ALL_DISKS (0x00)
  241. #define MFG_PAGE10_EXPOSE_ALL_DISKS (0x01)
  242. #define MFG_PAGE10_HIDE_IF_VOL_PRESENT (0x02)
  243. struct MPT2SAS_DEVICE {
  244. struct MPT2SAS_TARGET *sas_target;
  245. unsigned int lun;
  246. u32 flags;
  247. u8 configured_lun;
  248. u8 block;
  249. u8 tlr_snoop_check;
  250. };
  251. #define MPT2_CMD_NOT_USED 0x8000 /* free */
  252. #define MPT2_CMD_COMPLETE 0x0001 /* completed */
  253. #define MPT2_CMD_PENDING 0x0002 /* pending */
  254. #define MPT2_CMD_REPLY_VALID 0x0004 /* reply is valid */
  255. #define MPT2_CMD_RESET 0x0008 /* host reset dropped the command */
  256. /**
  257. * struct _internal_cmd - internal commands struct
  258. * @mutex: mutex
  259. * @done: completion
  260. * @reply: reply message pointer
  261. * @sense: sense data
  262. * @status: MPT2_CMD_XXX status
  263. * @smid: system message id
  264. */
  265. struct _internal_cmd {
  266. struct mutex mutex;
  267. struct completion done;
  268. void *reply;
  269. void *sense;
  270. u16 status;
  271. u16 smid;
  272. };
  273. /**
  274. * struct _sas_device - attached device information
  275. * @list: sas device list
  276. * @starget: starget object
  277. * @sas_address: device sas address
  278. * @device_name: retrieved from the SAS IDENTIFY frame.
  279. * @handle: device handle
  280. * @sas_address_parent: sas address of parent expander or sas host
  281. * @enclosure_handle: enclosure handle
  282. * @enclosure_logical_id: enclosure logical identifier
  283. * @volume_handle: volume handle (valid when hidden raid member)
  284. * @volume_wwid: volume unique identifier
  285. * @device_info: bitfield provides detailed info about the device
  286. * @id: target id
  287. * @channel: target channel
  288. * @slot: number number
  289. * @phy: phy identifier provided in sas device page 0
  290. * @responding: used in _scsih_sas_device_mark_responding
  291. */
  292. struct _sas_device {
  293. struct list_head list;
  294. struct scsi_target *starget;
  295. u64 sas_address;
  296. u64 device_name;
  297. u16 handle;
  298. u64 sas_address_parent;
  299. u16 enclosure_handle;
  300. u64 enclosure_logical_id;
  301. u16 volume_handle;
  302. u64 volume_wwid;
  303. u32 device_info;
  304. int id;
  305. int channel;
  306. u16 slot;
  307. u8 phy;
  308. u8 responding;
  309. };
  310. /**
  311. * struct _raid_device - raid volume link list
  312. * @list: sas device list
  313. * @starget: starget object
  314. * @sdev: scsi device struct (volumes are single lun)
  315. * @wwid: unique identifier for the volume
  316. * @handle: device handle
  317. * @block_size: Block size of the volume
  318. * @id: target id
  319. * @channel: target channel
  320. * @volume_type: the raid level
  321. * @device_info: bitfield provides detailed info about the hidden components
  322. * @num_pds: number of hidden raid components
  323. * @responding: used in _scsih_raid_device_mark_responding
  324. * @percent_complete: resync percent complete
  325. * @direct_io_enabled: Whether direct io to PDs are allowed or not
  326. * @stripe_exponent: X where 2powX is the stripe sz in blocks
  327. * @max_lba: Maximum number of LBA in the volume
  328. * @stripe_sz: Stripe Size of the volume
  329. * @device_info: Device info of the volume member disk
  330. * @pd_handle: Array of handles of the physical drives for direct I/O in le16
  331. */
  332. #define MPT_MAX_WARPDRIVE_PDS 8
  333. struct _raid_device {
  334. struct list_head list;
  335. struct scsi_target *starget;
  336. struct scsi_device *sdev;
  337. u64 wwid;
  338. u16 handle;
  339. u16 block_sz;
  340. int id;
  341. int channel;
  342. u8 volume_type;
  343. u8 num_pds;
  344. u8 responding;
  345. u8 percent_complete;
  346. u8 direct_io_enabled;
  347. u8 stripe_exponent;
  348. u64 max_lba;
  349. u32 stripe_sz;
  350. u32 device_info;
  351. u16 pd_handle[MPT_MAX_WARPDRIVE_PDS];
  352. };
  353. /**
  354. * struct _boot_device - boot device info
  355. * @is_raid: flag to indicate whether this is volume
  356. * @device: holds pointer for either struct _sas_device or
  357. * struct _raid_device
  358. */
  359. struct _boot_device {
  360. u8 is_raid;
  361. void *device;
  362. };
  363. /**
  364. * struct _sas_port - wide/narrow sas port information
  365. * @port_list: list of ports belonging to expander
  366. * @num_phys: number of phys belonging to this port
  367. * @remote_identify: attached device identification
  368. * @rphy: sas transport rphy object
  369. * @port: sas transport wide/narrow port object
  370. * @phy_list: _sas_phy list objects belonging to this port
  371. */
  372. struct _sas_port {
  373. struct list_head port_list;
  374. u8 num_phys;
  375. struct sas_identify remote_identify;
  376. struct sas_rphy *rphy;
  377. struct sas_port *port;
  378. struct list_head phy_list;
  379. };
  380. /**
  381. * struct _sas_phy - phy information
  382. * @port_siblings: list of phys belonging to a port
  383. * @identify: phy identification
  384. * @remote_identify: attached device identification
  385. * @phy: sas transport phy object
  386. * @phy_id: unique phy id
  387. * @handle: device handle for this phy
  388. * @attached_handle: device handle for attached device
  389. * @phy_belongs_to_port: port has been created for this phy
  390. */
  391. struct _sas_phy {
  392. struct list_head port_siblings;
  393. struct sas_identify identify;
  394. struct sas_identify remote_identify;
  395. struct sas_phy *phy;
  396. u8 phy_id;
  397. u16 handle;
  398. u16 attached_handle;
  399. u8 phy_belongs_to_port;
  400. };
  401. /**
  402. * struct _sas_node - sas_host/expander information
  403. * @list: list of expanders
  404. * @parent_dev: parent device class
  405. * @num_phys: number phys belonging to this sas_host/expander
  406. * @sas_address: sas address of this sas_host/expander
  407. * @handle: handle for this sas_host/expander
  408. * @sas_address_parent: sas address of parent expander or sas host
  409. * @enclosure_handle: handle for this a member of an enclosure
  410. * @device_info: bitwise defining capabilities of this sas_host/expander
  411. * @responding: used in _scsih_expander_device_mark_responding
  412. * @phy: a list of phys that make up this sas_host/expander
  413. * @sas_port_list: list of ports attached to this sas_host/expander
  414. */
  415. struct _sas_node {
  416. struct list_head list;
  417. struct device *parent_dev;
  418. u8 num_phys;
  419. u64 sas_address;
  420. u16 handle;
  421. u64 sas_address_parent;
  422. u16 enclosure_handle;
  423. u64 enclosure_logical_id;
  424. u8 responding;
  425. struct _sas_phy *phy;
  426. struct list_head sas_port_list;
  427. };
  428. /**
  429. * enum reset_type - reset state
  430. * @FORCE_BIG_HAMMER: issue diagnostic reset
  431. * @SOFT_RESET: issue message_unit_reset, if fails to to big hammer
  432. */
  433. enum reset_type {
  434. FORCE_BIG_HAMMER,
  435. SOFT_RESET,
  436. };
  437. /**
  438. * struct chain_tracker - firmware chain tracker
  439. * @chain_buffer: chain buffer
  440. * @chain_buffer_dma: physical address
  441. * @tracker_list: list of free request (ioc->free_chain_list)
  442. */
  443. struct chain_tracker {
  444. void *chain_buffer;
  445. dma_addr_t chain_buffer_dma;
  446. struct list_head tracker_list;
  447. };
  448. /**
  449. * struct scsiio_tracker - scsi mf request tracker
  450. * @smid: system message id
  451. * @scmd: scsi request pointer
  452. * @cb_idx: callback index
  453. * @direct_io: To indicate whether I/O is direct (WARPDRIVE)
  454. * @chain_list: list of chains associated to this IO
  455. * @tracker_list: list of free request (ioc->free_list)
  456. */
  457. struct scsiio_tracker {
  458. u16 smid;
  459. struct scsi_cmnd *scmd;
  460. u8 cb_idx;
  461. u8 direct_io;
  462. struct list_head chain_list;
  463. struct list_head tracker_list;
  464. };
  465. /**
  466. * struct request_tracker - firmware request tracker
  467. * @smid: system message id
  468. * @cb_idx: callback index
  469. * @tracker_list: list of free request (ioc->free_list)
  470. */
  471. struct request_tracker {
  472. u16 smid;
  473. u8 cb_idx;
  474. struct list_head tracker_list;
  475. };
  476. /**
  477. * struct _tr_list - target reset list
  478. * @handle: device handle
  479. * @state: state machine
  480. */
  481. struct _tr_list {
  482. struct list_head list;
  483. u16 handle;
  484. u16 state;
  485. };
  486. typedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr);
  487. /* IOC Facts and Port Facts converted from little endian to cpu */
  488. union mpi2_version_union {
  489. MPI2_VERSION_STRUCT Struct;
  490. u32 Word;
  491. };
  492. struct mpt2sas_facts {
  493. u16 MsgVersion;
  494. u16 HeaderVersion;
  495. u8 IOCNumber;
  496. u8 VP_ID;
  497. u8 VF_ID;
  498. u16 IOCExceptions;
  499. u16 IOCStatus;
  500. u32 IOCLogInfo;
  501. u8 MaxChainDepth;
  502. u8 WhoInit;
  503. u8 NumberOfPorts;
  504. u8 MaxMSIxVectors;
  505. u16 RequestCredit;
  506. u16 ProductID;
  507. u32 IOCCapabilities;
  508. union mpi2_version_union FWVersion;
  509. u16 IOCRequestFrameSize;
  510. u16 Reserved3;
  511. u16 MaxInitiators;
  512. u16 MaxTargets;
  513. u16 MaxSasExpanders;
  514. u16 MaxEnclosures;
  515. u16 ProtocolFlags;
  516. u16 HighPriorityCredit;
  517. u16 MaxReplyDescriptorPostQueueDepth;
  518. u8 ReplyFrameSize;
  519. u8 MaxVolumes;
  520. u16 MaxDevHandle;
  521. u16 MaxPersistentEntries;
  522. u16 MinDevHandle;
  523. };
  524. struct mpt2sas_port_facts {
  525. u8 PortNumber;
  526. u8 VP_ID;
  527. u8 VF_ID;
  528. u8 PortType;
  529. u16 MaxPostedCmdBuffers;
  530. };
  531. /**
  532. * enum mutex_type - task management mutex type
  533. * @TM_MUTEX_OFF: mutex is not required becuase calling function is acquiring it
  534. * @TM_MUTEX_ON: mutex is required
  535. */
  536. enum mutex_type {
  537. TM_MUTEX_OFF = 0,
  538. TM_MUTEX_ON = 1,
  539. };
  540. /**
  541. * struct MPT2SAS_ADAPTER - per adapter struct
  542. * @list: ioc_list
  543. * @shost: shost object
  544. * @id: unique adapter id
  545. * @pci_irq: irq number
  546. * @name: generic ioc string
  547. * @tmp_string: tmp string used for logging
  548. * @pdev: pci pdev object
  549. * @chip: memory mapped register space
  550. * @chip_phys: physical addrss prior to mapping
  551. * @logging_level: see mpt2sas_debug.h
  552. * @fwfault_debug: debuging FW timeouts
  553. * @ir_firmware: IR firmware present
  554. * @bars: bitmask of BAR's that must be configured
  555. * @mask_interrupts: ignore interrupt
  556. * @fault_reset_work_q_name: fw fault work queue
  557. * @fault_reset_work_q: ""
  558. * @fault_reset_work: ""
  559. * @firmware_event_name: fw event work queue
  560. * @firmware_event_thread: ""
  561. * @fw_events_off: flag to turn off fw event handling
  562. * @fw_event_lock:
  563. * @fw_event_list: list of fw events
  564. * @aen_event_read_flag: event log was read
  565. * @broadcast_aen_busy: broadcast aen waiting to be serviced
  566. * @shost_recovery: host reset in progress
  567. * @ioc_reset_in_progress_lock:
  568. * @ioc_link_reset_in_progress: phy/hard reset in progress
  569. * @ignore_loginfos: ignore loginfos during task management
  570. * @remove_host: flag for when driver unloads, to avoid sending dev resets
  571. * @pci_error_recovery: flag to prevent ioc access until slot reset completes
  572. * @wait_for_port_enable_to_complete:
  573. * @msix_enable: flag indicating msix is enabled
  574. * @msix_vector_count: number msix vectors
  575. * @msix_table: virt address to the msix table
  576. * @msix_table_backup: backup msix table
  577. * @scsi_io_cb_idx: shost generated commands
  578. * @tm_cb_idx: task management commands
  579. * @scsih_cb_idx: scsih internal commands
  580. * @transport_cb_idx: transport internal commands
  581. * @ctl_cb_idx: clt internal commands
  582. * @base_cb_idx: base internal commands
  583. * @config_cb_idx: base internal commands
  584. * @tm_tr_cb_idx : device removal target reset handshake
  585. * @tm_tr_volume_cb_idx : volume removal target reset
  586. * @base_cmds:
  587. * @transport_cmds:
  588. * @scsih_cmds:
  589. * @tm_cmds:
  590. * @ctl_cmds:
  591. * @config_cmds:
  592. * @base_add_sg_single: handler for either 32/64 bit sgl's
  593. * @event_type: bits indicating which events to log
  594. * @event_context: unique id for each logged event
  595. * @event_log: event log pointer
  596. * @event_masks: events that are masked
  597. * @facts: static facts data
  598. * @pfacts: static port facts data
  599. * @manu_pg0: static manufacturing page 0
  600. * @manu_pg10: static manufacturing page 10
  601. * @bios_pg2: static bios page 2
  602. * @bios_pg3: static bios page 3
  603. * @ioc_pg8: static ioc page 8
  604. * @iounit_pg0: static iounit page 0
  605. * @iounit_pg1: static iounit page 1
  606. * @sas_hba: sas host object
  607. * @sas_expander_list: expander object list
  608. * @sas_node_lock:
  609. * @sas_device_list: sas device object list
  610. * @sas_device_init_list: sas device object list (used only at init time)
  611. * @sas_device_lock:
  612. * @io_missing_delay: time for IO completed by fw when PDR enabled
  613. * @device_missing_delay: time for device missing by fw when PDR enabled
  614. * @sas_id : used for setting volume target IDs
  615. * @pd_handles : bitmask for PD handles
  616. * @pd_handles_sz : size of pd_handle bitmask
  617. * @config_page_sz: config page size
  618. * @config_page: reserve memory for config page payload
  619. * @config_page_dma:
  620. * @hba_queue_depth: hba request queue depth
  621. * @sge_size: sg element size for either 32/64 bit
  622. * @scsiio_depth: SCSI_IO queue depth
  623. * @request_sz: per request frame size
  624. * @request: pool of request frames
  625. * @request_dma:
  626. * @request_dma_sz:
  627. * @scsi_lookup: firmware request tracker list
  628. * @scsi_lookup_lock:
  629. * @free_list: free list of request
  630. * @chain: pool of chains
  631. * @pending_io_count:
  632. * @reset_wq:
  633. * @chain_dma:
  634. * @max_sges_in_main_message: number sg elements in main message
  635. * @max_sges_in_chain_message: number sg elements per chain
  636. * @chains_needed_per_io: max chains per io
  637. * @chain_offset_value_for_main_message: location 1st sg in main
  638. * @chain_depth: total chains allocated
  639. * @hi_priority_smid:
  640. * @hi_priority:
  641. * @hi_priority_dma:
  642. * @hi_priority_depth:
  643. * @hpr_lookup:
  644. * @hpr_free_list:
  645. * @internal_smid:
  646. * @internal:
  647. * @internal_dma:
  648. * @internal_depth:
  649. * @internal_lookup:
  650. * @internal_free_list:
  651. * @sense: pool of sense
  652. * @sense_dma:
  653. * @sense_dma_pool:
  654. * @reply_depth: hba reply queue depth:
  655. * @reply_sz: per reply frame size:
  656. * @reply: pool of replys:
  657. * @reply_dma:
  658. * @reply_dma_pool:
  659. * @reply_free_queue_depth: reply free depth
  660. * @reply_free: pool for reply free queue (32 bit addr)
  661. * @reply_free_dma:
  662. * @reply_free_dma_pool:
  663. * @reply_free_host_index: tail index in pool to insert free replys
  664. * @reply_post_queue_depth: reply post queue depth
  665. * @reply_post_free: pool for reply post (64bit descriptor)
  666. * @reply_post_free_dma:
  667. * @reply_post_free_dma_pool:
  668. * @reply_post_host_index: head index in the pool where FW completes IO
  669. * @delayed_tr_list: target reset link list
  670. * @delayed_tr_volume_list: volume target reset link list
  671. */
  672. struct MPT2SAS_ADAPTER {
  673. struct list_head list;
  674. struct Scsi_Host *shost;
  675. u8 id;
  676. u32 pci_irq;
  677. char name[MPT_NAME_LENGTH];
  678. char tmp_string[MPT_STRING_LENGTH];
  679. struct pci_dev *pdev;
  680. Mpi2SystemInterfaceRegs_t __iomem *chip;
  681. resource_size_t chip_phys;
  682. int logging_level;
  683. int fwfault_debug;
  684. u8 ir_firmware;
  685. int bars;
  686. u8 mask_interrupts;
  687. /* fw fault handler */
  688. char fault_reset_work_q_name[20];
  689. struct workqueue_struct *fault_reset_work_q;
  690. struct delayed_work fault_reset_work;
  691. /* fw event handler */
  692. char firmware_event_name[20];
  693. struct workqueue_struct *firmware_event_thread;
  694. spinlock_t fw_event_lock;
  695. struct list_head fw_event_list;
  696. /* misc flags */
  697. int aen_event_read_flag;
  698. u8 broadcast_aen_busy;
  699. u16 broadcast_aen_pending;
  700. u8 shost_recovery;
  701. struct mutex reset_in_progress_mutex;
  702. struct completion shost_recovery_done;
  703. spinlock_t ioc_reset_in_progress_lock;
  704. u8 ioc_link_reset_in_progress;
  705. int ioc_reset_in_progress_status;
  706. u8 ignore_loginfos;
  707. u8 remove_host;
  708. u8 pci_error_recovery;
  709. u8 wait_for_port_enable_to_complete;
  710. u8 msix_enable;
  711. u16 msix_vector_count;
  712. u32 *msix_table;
  713. u32 *msix_table_backup;
  714. u32 ioc_reset_count;
  715. /* internal commands, callback index */
  716. u8 scsi_io_cb_idx;
  717. u8 tm_cb_idx;
  718. u8 transport_cb_idx;
  719. u8 scsih_cb_idx;
  720. u8 ctl_cb_idx;
  721. u8 base_cb_idx;
  722. u8 config_cb_idx;
  723. u8 tm_tr_cb_idx;
  724. u8 tm_tr_volume_cb_idx;
  725. u8 tm_sas_control_cb_idx;
  726. struct _internal_cmd base_cmds;
  727. struct _internal_cmd transport_cmds;
  728. struct _internal_cmd scsih_cmds;
  729. struct _internal_cmd tm_cmds;
  730. struct _internal_cmd ctl_cmds;
  731. struct _internal_cmd config_cmds;
  732. MPT_ADD_SGE base_add_sg_single;
  733. /* event log */
  734. u32 event_type[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
  735. u32 event_context;
  736. void *event_log;
  737. u32 event_masks[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
  738. /* static config pages */
  739. struct mpt2sas_facts facts;
  740. struct mpt2sas_port_facts *pfacts;
  741. Mpi2ManufacturingPage0_t manu_pg0;
  742. Mpi2BiosPage2_t bios_pg2;
  743. Mpi2BiosPage3_t bios_pg3;
  744. Mpi2IOCPage8_t ioc_pg8;
  745. Mpi2IOUnitPage0_t iounit_pg0;
  746. Mpi2IOUnitPage1_t iounit_pg1;
  747. struct _boot_device req_boot_device;
  748. struct _boot_device req_alt_boot_device;
  749. struct _boot_device current_boot_device;
  750. /* sas hba, expander, and device list */
  751. struct _sas_node sas_hba;
  752. struct list_head sas_expander_list;
  753. spinlock_t sas_node_lock;
  754. struct list_head sas_device_list;
  755. struct list_head sas_device_init_list;
  756. spinlock_t sas_device_lock;
  757. struct list_head raid_device_list;
  758. spinlock_t raid_device_lock;
  759. u8 io_missing_delay;
  760. u16 device_missing_delay;
  761. int sas_id;
  762. void *pd_handles;
  763. u16 pd_handles_sz;
  764. /* config page */
  765. u16 config_page_sz;
  766. void *config_page;
  767. dma_addr_t config_page_dma;
  768. /* scsiio request */
  769. u16 hba_queue_depth;
  770. u16 sge_size;
  771. u16 scsiio_depth;
  772. u16 request_sz;
  773. u8 *request;
  774. dma_addr_t request_dma;
  775. u32 request_dma_sz;
  776. struct scsiio_tracker *scsi_lookup;
  777. ulong scsi_lookup_pages;
  778. spinlock_t scsi_lookup_lock;
  779. struct list_head free_list;
  780. int pending_io_count;
  781. wait_queue_head_t reset_wq;
  782. /* chain */
  783. struct chain_tracker *chain_lookup;
  784. struct list_head free_chain_list;
  785. struct dma_pool *chain_dma_pool;
  786. ulong chain_pages;
  787. u16 max_sges_in_main_message;
  788. u16 max_sges_in_chain_message;
  789. u16 chains_needed_per_io;
  790. u16 chain_offset_value_for_main_message;
  791. u32 chain_depth;
  792. /* hi-priority queue */
  793. u16 hi_priority_smid;
  794. u8 *hi_priority;
  795. dma_addr_t hi_priority_dma;
  796. u16 hi_priority_depth;
  797. struct request_tracker *hpr_lookup;
  798. struct list_head hpr_free_list;
  799. /* internal queue */
  800. u16 internal_smid;
  801. u8 *internal;
  802. dma_addr_t internal_dma;
  803. u16 internal_depth;
  804. struct request_tracker *internal_lookup;
  805. struct list_head internal_free_list;
  806. /* sense */
  807. u8 *sense;
  808. dma_addr_t sense_dma;
  809. struct dma_pool *sense_dma_pool;
  810. /* reply */
  811. u16 reply_sz;
  812. u8 *reply;
  813. dma_addr_t reply_dma;
  814. u32 reply_dma_max_address;
  815. u32 reply_dma_min_address;
  816. struct dma_pool *reply_dma_pool;
  817. /* reply free queue */
  818. u16 reply_free_queue_depth;
  819. __le32 *reply_free;
  820. dma_addr_t reply_free_dma;
  821. struct dma_pool *reply_free_dma_pool;
  822. u32 reply_free_host_index;
  823. /* reply post queue */
  824. u16 reply_post_queue_depth;
  825. Mpi2ReplyDescriptorsUnion_t *reply_post_free;
  826. dma_addr_t reply_post_free_dma;
  827. struct dma_pool *reply_post_free_dma_pool;
  828. u32 reply_post_host_index;
  829. struct list_head delayed_tr_list;
  830. struct list_head delayed_tr_volume_list;
  831. /* diag buffer support */
  832. u8 *diag_buffer[MPI2_DIAG_BUF_TYPE_COUNT];
  833. u32 diag_buffer_sz[MPI2_DIAG_BUF_TYPE_COUNT];
  834. dma_addr_t diag_buffer_dma[MPI2_DIAG_BUF_TYPE_COUNT];
  835. u8 diag_buffer_status[MPI2_DIAG_BUF_TYPE_COUNT];
  836. u32 unique_id[MPI2_DIAG_BUF_TYPE_COUNT];
  837. Mpi2ManufacturingPage10_t manu_pg10;
  838. u32 product_specific[MPI2_DIAG_BUF_TYPE_COUNT][23];
  839. u32 diagnostic_flags[MPI2_DIAG_BUF_TYPE_COUNT];
  840. u32 ring_buffer_offset;
  841. u32 ring_buffer_sz;
  842. u8 is_warpdrive;
  843. u8 hide_ir_msg;
  844. u8 mfg_pg10_hide_flag;
  845. u8 hide_drives;
  846. };
  847. typedef u8 (*MPT_CALLBACK)(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
  848. u32 reply);
  849. /* base shared API */
  850. extern struct list_head mpt2sas_ioc_list;
  851. void mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER *ioc);
  852. void mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER *ioc);
  853. int mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc);
  854. void mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc);
  855. int mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc);
  856. void mpt2sas_base_free_resources(struct MPT2SAS_ADAPTER *ioc);
  857. int mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
  858. enum reset_type type);
  859. void *mpt2sas_base_get_msg_frame(struct MPT2SAS_ADAPTER *ioc, u16 smid);
  860. void *mpt2sas_base_get_sense_buffer(struct MPT2SAS_ADAPTER *ioc, u16 smid);
  861. void mpt2sas_base_build_zero_len_sge(struct MPT2SAS_ADAPTER *ioc, void *paddr);
  862. __le32 mpt2sas_base_get_sense_buffer_dma(struct MPT2SAS_ADAPTER *ioc,
  863. u16 smid);
  864. /* hi-priority queue */
  865. u16 mpt2sas_base_get_smid_hpr(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx);
  866. u16 mpt2sas_base_get_smid_scsiio(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx,
  867. struct scsi_cmnd *scmd);
  868. u16 mpt2sas_base_get_smid(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx);
  869. void mpt2sas_base_free_smid(struct MPT2SAS_ADAPTER *ioc, u16 smid);
  870. void mpt2sas_base_put_smid_scsi_io(struct MPT2SAS_ADAPTER *ioc, u16 smid,
  871. u16 handle);
  872. void mpt2sas_base_put_smid_hi_priority(struct MPT2SAS_ADAPTER *ioc, u16 smid);
  873. void mpt2sas_base_put_smid_target_assist(struct MPT2SAS_ADAPTER *ioc, u16 smid,
  874. u16 io_index);
  875. void mpt2sas_base_put_smid_default(struct MPT2SAS_ADAPTER *ioc, u16 smid);
  876. void mpt2sas_base_initialize_callback_handler(void);
  877. u8 mpt2sas_base_register_callback_handler(MPT_CALLBACK cb_func);
  878. void mpt2sas_base_release_callback_handler(u8 cb_idx);
  879. u8 mpt2sas_base_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
  880. u32 reply);
  881. void *mpt2sas_base_get_reply_virt_addr(struct MPT2SAS_ADAPTER *ioc, u32 phys_addr);
  882. u32 mpt2sas_base_get_iocstate(struct MPT2SAS_ADAPTER *ioc, int cooked);
  883. void mpt2sas_base_fault_info(struct MPT2SAS_ADAPTER *ioc , u16 fault_code);
  884. int mpt2sas_base_sas_iounit_control(struct MPT2SAS_ADAPTER *ioc,
  885. Mpi2SasIoUnitControlReply_t *mpi_reply, Mpi2SasIoUnitControlRequest_t
  886. *mpi_request);
  887. int mpt2sas_base_scsi_enclosure_processor(struct MPT2SAS_ADAPTER *ioc,
  888. Mpi2SepReply_t *mpi_reply, Mpi2SepRequest_t *mpi_request);
  889. void mpt2sas_base_validate_event_type(struct MPT2SAS_ADAPTER *ioc, u32 *event_type);
  890. void mpt2sas_halt_firmware(struct MPT2SAS_ADAPTER *ioc);
  891. /* scsih shared API */
  892. u8 mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
  893. u32 reply);
  894. int mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle,
  895. uint channel, uint id, uint lun, u8 type, u16 smid_task,
  896. ulong timeout, unsigned long serial_number, enum mutex_type m_type);
  897. void mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle);
  898. void mpt2sas_scsih_clear_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle);
  899. void mpt2sas_expander_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address);
  900. void mpt2sas_device_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address);
  901. struct _sas_node *mpt2sas_scsih_expander_find_by_handle(struct MPT2SAS_ADAPTER *ioc,
  902. u16 handle);
  903. struct _sas_node *mpt2sas_scsih_expander_find_by_sas_address(struct MPT2SAS_ADAPTER
  904. *ioc, u64 sas_address);
  905. struct _sas_device *mpt2sas_scsih_sas_device_find_by_sas_address(
  906. struct MPT2SAS_ADAPTER *ioc, u64 sas_address);
  907. void mpt2sas_scsih_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase);
  908. /* config shared API */
  909. u8 mpt2sas_config_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
  910. u32 reply);
  911. int mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER *ioc, u8 *num_phys);
  912. int mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER *ioc,
  913. Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage0_t *config_page);
  914. int mpt2sas_config_get_manufacturing_pg10(struct MPT2SAS_ADAPTER *ioc,
  915. Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage10_t *config_page);
  916. int mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  917. *mpi_reply, Mpi2BiosPage2_t *config_page);
  918. int mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  919. *mpi_reply, Mpi2BiosPage3_t *config_page);
  920. int mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  921. *mpi_reply, Mpi2IOUnitPage0_t *config_page);
  922. int mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  923. *mpi_reply, Mpi2SasDevicePage0_t *config_page, u32 form, u32 handle);
  924. int mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  925. *mpi_reply, Mpi2SasDevicePage1_t *config_page, u32 form, u32 handle);
  926. int mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  927. *mpi_reply, Mpi2SasIOUnitPage0_t *config_page, u16 sz);
  928. int mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  929. *mpi_reply, Mpi2IOUnitPage1_t *config_page);
  930. int mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  931. *mpi_reply, Mpi2IOUnitPage1_t *config_page);
  932. int mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  933. *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz);
  934. int mpt2sas_config_set_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc,
  935. Mpi2ConfigReply_t *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz);
  936. int mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  937. *mpi_reply, Mpi2IOCPage8_t *config_page);
  938. int mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  939. *mpi_reply, Mpi2ExpanderPage0_t *config_page, u32 form, u32 handle);
  940. int mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  941. *mpi_reply, Mpi2ExpanderPage1_t *config_page, u32 phy_number, u16 handle);
  942. int mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  943. *mpi_reply, Mpi2SasEnclosurePage0_t *config_page, u32 form, u32 handle);
  944. int mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  945. *mpi_reply, Mpi2SasPhyPage0_t *config_page, u32 phy_number);
  946. int mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  947. *mpi_reply, Mpi2SasPhyPage1_t *config_page, u32 phy_number);
  948. int mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  949. *mpi_reply, Mpi2RaidVolPage1_t *config_page, u32 form, u32 handle);
  950. int mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 *num_pds);
  951. int mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  952. *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 form, u32 handle, u16 sz);
  953. int mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
  954. *mpi_reply, Mpi2RaidPhysDiskPage0_t *config_page, u32 form,
  955. u32 form_specific);
  956. int mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle,
  957. u16 *volume_handle);
  958. int mpt2sas_config_get_volume_wwid(struct MPT2SAS_ADAPTER *ioc, u16 volume_handle,
  959. u64 *wwid);
  960. /* ctl shared API */
  961. extern struct device_attribute *mpt2sas_host_attrs[];
  962. extern struct device_attribute *mpt2sas_dev_attrs[];
  963. void mpt2sas_ctl_init(void);
  964. void mpt2sas_ctl_exit(void);
  965. u8 mpt2sas_ctl_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
  966. u32 reply);
  967. void mpt2sas_ctl_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase);
  968. u8 mpt2sas_ctl_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
  969. u32 reply);
  970. void mpt2sas_ctl_add_to_event_log(struct MPT2SAS_ADAPTER *ioc,
  971. Mpi2EventNotificationReply_t *mpi_reply);
  972. void mpt2sas_enable_diag_buffer(struct MPT2SAS_ADAPTER *ioc,
  973. u8 bits_to_regsiter);
  974. /* transport shared API */
  975. u8 mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
  976. u32 reply);
  977. struct _sas_port *mpt2sas_transport_port_add(struct MPT2SAS_ADAPTER *ioc,
  978. u16 handle, u64 sas_address);
  979. void mpt2sas_transport_port_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address,
  980. u64 sas_address_parent);
  981. int mpt2sas_transport_add_host_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy
  982. *mpt2sas_phy, Mpi2SasPhyPage0_t phy_pg0, struct device *parent_dev);
  983. int mpt2sas_transport_add_expander_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy
  984. *mpt2sas_phy, Mpi2ExpanderPage1_t expander_pg1, struct device *parent_dev);
  985. void mpt2sas_transport_update_links(struct MPT2SAS_ADAPTER *ioc,
  986. u64 sas_address, u16 handle, u8 phy_number, u8 link_rate);
  987. extern struct sas_function_template mpt2sas_transport_functions;
  988. extern struct scsi_transport_template *mpt2sas_transport_template;
  989. extern int scsi_internal_device_block(struct scsi_device *sdev);
  990. extern u8 mpt2sas_stm_zero_smid_handler(struct MPT2SAS_ADAPTER *ioc,
  991. u8 msix_index, u32 reply);
  992. extern int scsi_internal_device_unblock(struct scsi_device *sdev);
  993. #endif /* MPT2SAS_BASE_H_INCLUDED */