atioctl.h 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255
  1. /* linux/drivers/scsi/esas2r/atioctl.h
  2. * ATTO IOCTL Handling
  3. *
  4. * Copyright (c) 2001-2013 ATTO Technology, Inc.
  5. * (mailto:linuxdrivers@attotech.com)
  6. */
  7. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
  8. /*
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; version 2 of the License.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * NO WARRANTY
  19. * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
  20. * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
  21. * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
  22. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
  23. * solely responsible for determining the appropriateness of using and
  24. * distributing the Program and assumes all risks associated with its
  25. * exercise of rights under this Agreement, including but not limited to
  26. * the risks and costs of program errors, damage to or loss of data,
  27. * programs or equipment, and unavailability or interruption of operations.
  28. *
  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. *
  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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  41. */
  42. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
  43. #include "atvda.h"
  44. #ifndef ATIOCTL_H
  45. #define ATIOCTL_H
  46. #define EXPRESS_IOCTL_SIGNATURE "Express"
  47. #define EXPRESS_IOCTL_SIGNATURE_SIZE 8
  48. /* structure definitions for IOCTls */
  49. struct __packed atto_express_ioctl_header {
  50. u8 signature[EXPRESS_IOCTL_SIGNATURE_SIZE];
  51. u8 return_code;
  52. #define IOCTL_SUCCESS 0
  53. #define IOCTL_ERR_INVCMD 101
  54. #define IOCTL_INIT_FAILED 102
  55. #define IOCTL_NOT_IMPLEMENTED 103
  56. #define IOCTL_BAD_CHANNEL 104
  57. #define IOCTL_TARGET_OVERRUN 105
  58. #define IOCTL_TARGET_NOT_ENABLED 106
  59. #define IOCTL_BAD_FLASH_IMGTYPE 107
  60. #define IOCTL_OUT_OF_RESOURCES 108
  61. #define IOCTL_GENERAL_ERROR 109
  62. #define IOCTL_INVALID_PARAM 110
  63. u8 channel;
  64. u8 retries;
  65. u8 pad[5];
  66. };
  67. /*
  68. * NOTE - if channel == 0xFF, the request is
  69. * handled on the adapter it came in on.
  70. */
  71. #define MAX_NODE_NAMES 256
  72. struct __packed atto_firmware_rw_request {
  73. u8 function;
  74. #define FUNC_FW_DOWNLOAD 0x09
  75. #define FUNC_FW_UPLOAD 0x12
  76. u8 img_type;
  77. #define FW_IMG_FW 0x01
  78. #define FW_IMG_BIOS 0x02
  79. #define FW_IMG_NVR 0x03
  80. #define FW_IMG_RAW 0x04
  81. #define FW_IMG_FM_API 0x05
  82. #define FW_IMG_FS_API 0x06
  83. u8 pad[2];
  84. u32 img_offset;
  85. u32 img_size;
  86. u8 image[0x80000];
  87. };
  88. struct __packed atto_param_rw_request {
  89. u16 code;
  90. char data_buffer[512];
  91. };
  92. #define MAX_CHANNEL 256
  93. struct __packed atto_channel_list {
  94. u32 num_channels;
  95. u8 channel[MAX_CHANNEL];
  96. };
  97. struct __packed atto_channel_info {
  98. u8 major_rev;
  99. u8 minor_rev;
  100. u8 IRQ;
  101. u8 revision_id;
  102. u8 pci_bus;
  103. u8 pci_dev_func;
  104. u8 core_rev;
  105. u8 host_no;
  106. u16 device_id;
  107. u16 vendor_id;
  108. u16 ven_dev_id;
  109. u8 pad[3];
  110. u32 hbaapi_rev;
  111. };
  112. /*
  113. * CSMI control codes
  114. * class independent
  115. */
  116. #define CSMI_CC_GET_DRVR_INFO 1
  117. #define CSMI_CC_GET_CNTLR_CFG 2
  118. #define CSMI_CC_GET_CNTLR_STS 3
  119. #define CSMI_CC_FW_DOWNLOAD 4
  120. /* RAID class */
  121. #define CSMI_CC_GET_RAID_INFO 10
  122. #define CSMI_CC_GET_RAID_CFG 11
  123. /* HBA class */
  124. #define CSMI_CC_GET_PHY_INFO 20
  125. #define CSMI_CC_SET_PHY_INFO 21
  126. #define CSMI_CC_GET_LINK_ERRORS 22
  127. #define CSMI_CC_SMP_PASSTHRU 23
  128. #define CSMI_CC_SSP_PASSTHRU 24
  129. #define CSMI_CC_STP_PASSTHRU 25
  130. #define CSMI_CC_GET_SATA_SIG 26
  131. #define CSMI_CC_GET_SCSI_ADDR 27
  132. #define CSMI_CC_GET_DEV_ADDR 28
  133. #define CSMI_CC_TASK_MGT 29
  134. #define CSMI_CC_GET_CONN_INFO 30
  135. /* PHY class */
  136. #define CSMI_CC_PHY_CTRL 60
  137. /*
  138. * CSMI status codes
  139. * class independent
  140. */
  141. #define CSMI_STS_SUCCESS 0
  142. #define CSMI_STS_FAILED 1
  143. #define CSMI_STS_BAD_CTRL_CODE 2
  144. #define CSMI_STS_INV_PARAM 3
  145. #define CSMI_STS_WRITE_ATTEMPTED 4
  146. /* RAID class */
  147. #define CSMI_STS_INV_RAID_SET 1000
  148. /* HBA class */
  149. #define CSMI_STS_PHY_CHANGED CSMI_STS_SUCCESS
  150. #define CSMI_STS_PHY_UNCHANGEABLE 2000
  151. #define CSMI_STS_INV_LINK_RATE 2001
  152. #define CSMI_STS_INV_PHY 2002
  153. #define CSMI_STS_INV_PHY_FOR_PORT 2003
  154. #define CSMI_STS_PHY_UNSELECTABLE 2004
  155. #define CSMI_STS_SELECT_PHY_OR_PORT 2005
  156. #define CSMI_STS_INV_PORT 2006
  157. #define CSMI_STS_PORT_UNSELECTABLE 2007
  158. #define CSMI_STS_CONNECTION_FAILED 2008
  159. #define CSMI_STS_NO_SATA_DEV 2009
  160. #define CSMI_STS_NO_SATA_SIGNATURE 2010
  161. #define CSMI_STS_SCSI_EMULATION 2011
  162. #define CSMI_STS_NOT_AN_END_DEV 2012
  163. #define CSMI_STS_NO_SCSI_ADDR 2013
  164. #define CSMI_STS_NO_DEV_ADDR 2014
  165. /* CSMI class independent structures */
  166. struct atto_csmi_get_driver_info {
  167. char name[81];
  168. char description[81];
  169. u16 major_rev;
  170. u16 minor_rev;
  171. u16 build_rev;
  172. u16 release_rev;
  173. u16 csmi_major_rev;
  174. u16 csmi_minor_rev;
  175. #define CSMI_MAJOR_REV_0_81 0
  176. #define CSMI_MINOR_REV_0_81 81
  177. #define CSMI_MAJOR_REV CSMI_MAJOR_REV_0_81
  178. #define CSMI_MINOR_REV CSMI_MINOR_REV_0_81
  179. };
  180. struct atto_csmi_get_pci_bus_addr {
  181. u8 bus_num;
  182. u8 device_num;
  183. u8 function_num;
  184. u8 reserved;
  185. };
  186. struct atto_csmi_get_cntlr_cfg {
  187. u32 base_io_addr;
  188. struct {
  189. u32 base_memaddr_lo;
  190. u32 base_memaddr_hi;
  191. };
  192. u32 board_id;
  193. u16 slot_num;
  194. #define CSMI_SLOT_NUM_UNKNOWN 0xFFFF
  195. u8 cntlr_class;
  196. #define CSMI_CNTLR_CLASS_HBA 5
  197. u8 io_bus_type;
  198. #define CSMI_BUS_TYPE_PCI 3
  199. #define CSMI_BUS_TYPE_PCMCIA 4
  200. union {
  201. struct atto_csmi_get_pci_bus_addr pci_addr;
  202. u8 reserved[32];
  203. };
  204. char serial_num[81];
  205. u16 major_rev;
  206. u16 minor_rev;
  207. u16 build_rev;
  208. u16 release_rev;
  209. u16 bios_major_rev;
  210. u16 bios_minor_rev;
  211. u16 bios_build_rev;
  212. u16 bios_release_rev;
  213. u32 cntlr_flags;
  214. #define CSMI_CNTLRF_SAS_HBA 0x00000001
  215. #define CSMI_CNTLRF_SAS_RAID 0x00000002
  216. #define CSMI_CNTLRF_SATA_HBA 0x00000004
  217. #define CSMI_CNTLRF_SATA_RAID 0x00000008
  218. #define CSMI_CNTLRF_FWD_SUPPORT 0x00010000
  219. #define CSMI_CNTLRF_FWD_ONLINE 0x00020000
  220. #define CSMI_CNTLRF_FWD_SRESET 0x00040000
  221. #define CSMI_CNTLRF_FWD_HRESET 0x00080000
  222. #define CSMI_CNTLRF_FWD_RROM 0x00100000
  223. u16 rrom_major_rev;
  224. u16 rrom_minor_rev;
  225. u16 rrom_build_rev;
  226. u16 rrom_release_rev;
  227. u16 rrom_biosmajor_rev;
  228. u16 rrom_biosminor_rev;
  229. u16 rrom_biosbuild_rev;
  230. u16 rrom_biosrelease_rev;
  231. u8 reserved2[7];
  232. };
  233. struct atto_csmi_get_cntlr_sts {
  234. u32 status;
  235. #define CSMI_CNTLR_STS_GOOD 1
  236. #define CSMI_CNTLR_STS_FAILED 2
  237. #define CSMI_CNTLR_STS_OFFLINE 3
  238. #define CSMI_CNTLR_STS_POWEROFF 4
  239. u32 offline_reason;
  240. #define CSMI_OFFLINE_NO_REASON 0
  241. #define CSMI_OFFLINE_INITIALIZING 1
  242. #define CSMI_OFFLINE_BUS_DEGRADED 2
  243. #define CSMI_OFFLINE_BUS_FAILURE 3
  244. u8 reserved[28];
  245. };
  246. struct atto_csmi_fw_download {
  247. u32 buffer_len;
  248. u32 download_flags;
  249. #define CSMI_FWDF_VALIDATE 0x00000001
  250. #define CSMI_FWDF_SOFT_RESET 0x00000002
  251. #define CSMI_FWDF_HARD_RESET 0x00000004
  252. u8 reserved[32];
  253. u16 status;
  254. #define CSMI_FWD_STS_SUCCESS 0
  255. #define CSMI_FWD_STS_FAILED 1
  256. #define CSMI_FWD_STS_USING_RROM 2
  257. #define CSMI_FWD_STS_REJECT 3
  258. #define CSMI_FWD_STS_DOWNREV 4
  259. u16 severity;
  260. #define CSMI_FWD_SEV_INFO 0
  261. #define CSMI_FWD_SEV_WARNING 1
  262. #define CSMI_FWD_SEV_ERROR 2
  263. #define CSMI_FWD_SEV_FATAL 3
  264. };
  265. /* CSMI RAID class structures */
  266. struct atto_csmi_get_raid_info {
  267. u32 num_raid_sets;
  268. u32 max_drivesper_set;
  269. u8 reserved[92];
  270. };
  271. struct atto_csmi_raid_drives {
  272. char model[40];
  273. char firmware[8];
  274. char serial_num[40];
  275. u8 sas_addr[8];
  276. u8 lun[8];
  277. u8 drive_sts;
  278. #define CSMI_DRV_STS_OK 0
  279. #define CSMI_DRV_STS_REBUILDING 1
  280. #define CSMI_DRV_STS_FAILED 2
  281. #define CSMI_DRV_STS_DEGRADED 3
  282. u8 drive_usage;
  283. #define CSMI_DRV_USE_NOT_USED 0
  284. #define CSMI_DRV_USE_MEMBER 1
  285. #define CSMI_DRV_USE_SPARE 2
  286. u8 reserved[30]; /* spec says 22 */
  287. };
  288. struct atto_csmi_get_raid_cfg {
  289. u32 raid_set_index;
  290. u32 capacity;
  291. u32 stripe_size;
  292. u8 raid_type;
  293. u8 status;
  294. u8 information;
  295. u8 drive_cnt;
  296. u8 reserved[20];
  297. struct atto_csmi_raid_drives drives[1];
  298. };
  299. /* CSMI HBA class structures */
  300. struct atto_csmi_phy_entity {
  301. u8 ident_frame[0x1C];
  302. u8 port_id;
  303. u8 neg_link_rate;
  304. u8 min_link_rate;
  305. u8 max_link_rate;
  306. u8 phy_change_cnt;
  307. u8 auto_discover;
  308. #define CSMI_DISC_NOT_SUPPORTED 0x00
  309. #define CSMI_DISC_NOT_STARTED 0x01
  310. #define CSMI_DISC_IN_PROGRESS 0x02
  311. #define CSMI_DISC_COMPLETE 0x03
  312. #define CSMI_DISC_ERROR 0x04
  313. u8 reserved[2];
  314. u8 attach_ident_frame[0x1C];
  315. };
  316. struct atto_csmi_get_phy_info {
  317. u8 number_of_phys;
  318. u8 reserved[3];
  319. struct atto_csmi_phy_entity
  320. phy[32];
  321. };
  322. struct atto_csmi_set_phy_info {
  323. u8 phy_id;
  324. u8 neg_link_rate;
  325. #define CSMI_NEG_RATE_NEGOTIATE 0x00
  326. #define CSMI_NEG_RATE_PHY_DIS 0x01
  327. u8 prog_minlink_rate;
  328. u8 prog_maxlink_rate;
  329. u8 signal_class;
  330. #define CSMI_SIG_CLASS_UNKNOWN 0x00
  331. #define CSMI_SIG_CLASS_DIRECT 0x01
  332. #define CSMI_SIG_CLASS_SERVER 0x02
  333. #define CSMI_SIG_CLASS_ENCLOSURE 0x03
  334. u8 reserved[3];
  335. };
  336. struct atto_csmi_get_link_errors {
  337. u8 phy_id;
  338. u8 reset_cnts;
  339. #define CSMI_RESET_CNTS_NO 0x00
  340. #define CSMI_RESET_CNTS_YES 0x01
  341. u8 reserved[2];
  342. u32 inv_dw_cnt;
  343. u32 disp_err_cnt;
  344. u32 loss_ofdw_sync_cnt;
  345. u32 phy_reseterr_cnt;
  346. /*
  347. * The following field has been added by ATTO for ease of
  348. * implementation of additional statistics. Drivers must validate
  349. * the length of the IOCTL payload prior to filling them in so CSMI
  350. * complaint applications function correctly.
  351. */
  352. u32 crc_err_cnt;
  353. };
  354. struct atto_csmi_smp_passthru {
  355. u8 phy_id;
  356. u8 port_id;
  357. u8 conn_rate;
  358. u8 reserved;
  359. u8 dest_sas_addr[8];
  360. u32 req_len;
  361. u8 smp_req[1020];
  362. u8 conn_sts;
  363. u8 reserved2[3];
  364. u32 rsp_len;
  365. u8 smp_rsp[1020];
  366. };
  367. struct atto_csmi_ssp_passthru_sts {
  368. u8 conn_sts;
  369. u8 reserved[3];
  370. u8 data_present;
  371. u8 status;
  372. u16 rsp_length;
  373. u8 rsp[256];
  374. u32 data_bytes;
  375. };
  376. struct atto_csmi_ssp_passthru {
  377. u8 phy_id;
  378. u8 port_id;
  379. u8 conn_rate;
  380. u8 reserved;
  381. u8 dest_sas_addr[8];
  382. u8 lun[8];
  383. u8 cdb_len;
  384. u8 add_cdb_len;
  385. u8 reserved2[2];
  386. u8 cdb[16];
  387. u32 flags;
  388. #define CSMI_SSPF_DD_READ 0x00000001
  389. #define CSMI_SSPF_DD_WRITE 0x00000002
  390. #define CSMI_SSPF_DD_UNSPECIFIED 0x00000004
  391. #define CSMI_SSPF_TA_SIMPLE 0x00000000
  392. #define CSMI_SSPF_TA_HEAD_OF_Q 0x00000010
  393. #define CSMI_SSPF_TA_ORDERED 0x00000020
  394. #define CSMI_SSPF_TA_ACA 0x00000040
  395. u8 add_cdb[24];
  396. u32 data_len;
  397. struct atto_csmi_ssp_passthru_sts sts;
  398. };
  399. struct atto_csmi_stp_passthru_sts {
  400. u8 conn_sts;
  401. u8 reserved[3];
  402. u8 sts_fis[20];
  403. u32 scr[16];
  404. u32 data_bytes;
  405. };
  406. struct atto_csmi_stp_passthru {
  407. u8 phy_id;
  408. u8 port_id;
  409. u8 conn_rate;
  410. u8 reserved;
  411. u8 dest_sas_addr[8];
  412. u8 reserved2[4];
  413. u8 command_fis[20];
  414. u32 flags;
  415. #define CSMI_STPF_DD_READ 0x00000001
  416. #define CSMI_STPF_DD_WRITE 0x00000002
  417. #define CSMI_STPF_DD_UNSPECIFIED 0x00000004
  418. #define CSMI_STPF_PIO 0x00000010
  419. #define CSMI_STPF_DMA 0x00000020
  420. #define CSMI_STPF_PACKET 0x00000040
  421. #define CSMI_STPF_DMA_QUEUED 0x00000080
  422. #define CSMI_STPF_EXECUTE_DIAG 0x00000100
  423. #define CSMI_STPF_RESET_DEVICE 0x00000200
  424. u32 data_len;
  425. struct atto_csmi_stp_passthru_sts sts;
  426. };
  427. struct atto_csmi_get_sata_sig {
  428. u8 phy_id;
  429. u8 reserved[3];
  430. u8 reg_dth_fis[20];
  431. };
  432. struct atto_csmi_get_scsi_addr {
  433. u8 sas_addr[8];
  434. u8 sas_lun[8];
  435. u8 host_index;
  436. u8 path_id;
  437. u8 target_id;
  438. u8 lun;
  439. };
  440. struct atto_csmi_get_dev_addr {
  441. u8 host_index;
  442. u8 path_id;
  443. u8 target_id;
  444. u8 lun;
  445. u8 sas_addr[8];
  446. u8 sas_lun[8];
  447. };
  448. struct atto_csmi_task_mgmt {
  449. u8 host_index;
  450. u8 path_id;
  451. u8 target_id;
  452. u8 lun;
  453. u32 flags;
  454. #define CSMI_TMF_TASK_IU 0x00000001
  455. #define CSMI_TMF_HARD_RST 0x00000002
  456. #define CSMI_TMF_SUPPRESS_RSLT 0x00000004
  457. u32 queue_tag;
  458. u32 reserved;
  459. u8 task_mgt_func;
  460. u8 reserved2[7];
  461. u32 information;
  462. #define CSMI_TM_INFO_TEST 1
  463. #define CSMI_TM_INFO_EXCEEDED 2
  464. #define CSMI_TM_INFO_DEMAND 3
  465. #define CSMI_TM_INFO_TRIGGER 4
  466. struct atto_csmi_ssp_passthru_sts sts;
  467. };
  468. struct atto_csmi_get_conn_info {
  469. u32 pinout;
  470. #define CSMI_CON_UNKNOWN 0x00000001
  471. #define CSMI_CON_SFF_8482 0x00000002
  472. #define CSMI_CON_SFF_8470_LANE_1 0x00000100
  473. #define CSMI_CON_SFF_8470_LANE_2 0x00000200
  474. #define CSMI_CON_SFF_8470_LANE_3 0x00000400
  475. #define CSMI_CON_SFF_8470_LANE_4 0x00000800
  476. #define CSMI_CON_SFF_8484_LANE_1 0x00010000
  477. #define CSMI_CON_SFF_8484_LANE_2 0x00020000
  478. #define CSMI_CON_SFF_8484_LANE_3 0x00040000
  479. #define CSMI_CON_SFF_8484_LANE_4 0x00080000
  480. u8 connector[16];
  481. u8 location;
  482. #define CSMI_CON_INTERNAL 0x02
  483. #define CSMI_CON_EXTERNAL 0x04
  484. #define CSMI_CON_SWITCHABLE 0x08
  485. #define CSMI_CON_AUTO 0x10
  486. u8 reserved[15];
  487. };
  488. /* CSMI PHY class structures */
  489. struct atto_csmi_character {
  490. u8 type_flags;
  491. #define CSMI_CTF_POS_DISP 0x01
  492. #define CSMI_CTF_NEG_DISP 0x02
  493. #define CSMI_CTF_CTRL_CHAR 0x04
  494. u8 value;
  495. };
  496. struct atto_csmi_pc_ctrl {
  497. u8 type;
  498. #define CSMI_PC_TYPE_UNDEFINED 0x00
  499. #define CSMI_PC_TYPE_SATA 0x01
  500. #define CSMI_PC_TYPE_SAS 0x02
  501. u8 rate;
  502. u8 reserved[6];
  503. u32 vendor_unique[8];
  504. u32 tx_flags;
  505. #define CSMI_PC_TXF_PREEMP_DIS 0x00000001
  506. signed char tx_amplitude;
  507. signed char tx_preemphasis;
  508. signed char tx_slew_rate;
  509. signed char tx_reserved[13];
  510. u8 tx_vendor_unique[64];
  511. u32 rx_flags;
  512. #define CSMI_PC_RXF_EQ_DIS 0x00000001
  513. signed char rx_threshold;
  514. signed char rx_equalization_gain;
  515. signed char rx_reserved[14];
  516. u8 rx_vendor_unique[64];
  517. u32 pattern_flags;
  518. #define CSMI_PC_PATF_FIXED 0x00000001
  519. #define CSMI_PC_PATF_DIS_SCR 0x00000002
  520. #define CSMI_PC_PATF_DIS_ALIGN 0x00000004
  521. #define CSMI_PC_PATF_DIS_SSC 0x00000008
  522. u8 fixed_pattern;
  523. #define CSMI_PC_FP_CJPAT 0x00000001
  524. #define CSMI_PC_FP_ALIGN 0x00000002
  525. u8 user_pattern_len;
  526. u8 pattern_reserved[6];
  527. struct atto_csmi_character user_pattern_buffer[16];
  528. };
  529. struct atto_csmi_phy_ctrl {
  530. u32 function;
  531. #define CSMI_PC_FUNC_GET_SETUP 0x00000100
  532. u8 phy_id;
  533. u16 len_of_cntl;
  534. u8 num_of_cntls;
  535. u8 reserved[4];
  536. u32 link_flags;
  537. #define CSMI_PHY_ACTIVATE_CTRL 0x00000001
  538. #define CSMI_PHY_UPD_SPINUP_RATE 0x00000002
  539. #define CSMI_PHY_AUTO_COMWAKE 0x00000004
  540. u8 spinup_rate;
  541. u8 link_reserved[7];
  542. u32 vendor_unique[8];
  543. struct atto_csmi_pc_ctrl control[1];
  544. };
  545. union atto_ioctl_csmi {
  546. struct atto_csmi_get_driver_info drvr_info;
  547. struct atto_csmi_get_cntlr_cfg cntlr_cfg;
  548. struct atto_csmi_get_cntlr_sts cntlr_sts;
  549. struct atto_csmi_fw_download fw_dwnld;
  550. struct atto_csmi_get_raid_info raid_info;
  551. struct atto_csmi_get_raid_cfg raid_cfg;
  552. struct atto_csmi_get_phy_info get_phy_info;
  553. struct atto_csmi_set_phy_info set_phy_info;
  554. struct atto_csmi_get_link_errors link_errs;
  555. struct atto_csmi_smp_passthru smp_pass_thru;
  556. struct atto_csmi_ssp_passthru ssp_pass_thru;
  557. struct atto_csmi_stp_passthru stp_pass_thru;
  558. struct atto_csmi_task_mgmt tsk_mgt;
  559. struct atto_csmi_get_sata_sig sata_sig;
  560. struct atto_csmi_get_scsi_addr scsi_addr;
  561. struct atto_csmi_get_dev_addr dev_addr;
  562. struct atto_csmi_get_conn_info conn_info[32];
  563. struct atto_csmi_phy_ctrl phy_ctrl;
  564. };
  565. struct atto_csmi {
  566. u32 control_code;
  567. u32 status;
  568. union atto_ioctl_csmi data;
  569. };
  570. struct atto_module_info {
  571. void *adapter;
  572. void *pci_dev;
  573. void *scsi_host;
  574. unsigned short host_no;
  575. union {
  576. struct {
  577. u64 node_name;
  578. u64 port_name;
  579. };
  580. u64 sas_addr;
  581. };
  582. };
  583. #define ATTO_FUNC_GET_ADAP_INFO 0x00
  584. #define ATTO_VER_GET_ADAP_INFO0 0
  585. #define ATTO_VER_GET_ADAP_INFO ATTO_VER_GET_ADAP_INFO0
  586. struct __packed atto_hba_get_adapter_info {
  587. struct {
  588. u16 vendor_id;
  589. u16 device_id;
  590. u16 ss_vendor_id;
  591. u16 ss_device_id;
  592. u8 class_code[3];
  593. u8 rev_id;
  594. u8 bus_num;
  595. u8 dev_num;
  596. u8 func_num;
  597. u8 link_width_max;
  598. u8 link_width_curr;
  599. #define ATTO_GAI_PCILW_UNKNOWN 0x00
  600. u8 link_speed_max;
  601. u8 link_speed_curr;
  602. #define ATTO_GAI_PCILS_UNKNOWN 0x00
  603. #define ATTO_GAI_PCILS_GEN1 0x01
  604. #define ATTO_GAI_PCILS_GEN2 0x02
  605. #define ATTO_GAI_PCILS_GEN3 0x03
  606. u8 interrupt_mode;
  607. #define ATTO_GAI_PCIIM_UNKNOWN 0x00
  608. #define ATTO_GAI_PCIIM_LEGACY 0x01
  609. #define ATTO_GAI_PCIIM_MSI 0x02
  610. #define ATTO_GAI_PCIIM_MSIX 0x03
  611. u8 msi_vector_cnt;
  612. u8 reserved[19];
  613. } pci;
  614. u8 adap_type;
  615. #define ATTO_GAI_AT_EPCIU320 0x00
  616. #define ATTO_GAI_AT_ESASRAID 0x01
  617. #define ATTO_GAI_AT_ESASRAID2 0x02
  618. #define ATTO_GAI_AT_ESASHBA 0x03
  619. #define ATTO_GAI_AT_ESASHBA2 0x04
  620. #define ATTO_GAI_AT_CELERITY 0x05
  621. #define ATTO_GAI_AT_CELERITY8 0x06
  622. #define ATTO_GAI_AT_FASTFRAME 0x07
  623. #define ATTO_GAI_AT_ESASHBA3 0x08
  624. #define ATTO_GAI_AT_CELERITY16 0x09
  625. #define ATTO_GAI_AT_TLSASHBA 0x0A
  626. #define ATTO_GAI_AT_ESASHBA4 0x0B
  627. u8 adap_flags;
  628. #define ATTO_GAI_AF_DEGRADED 0x01
  629. #define ATTO_GAI_AF_SPT_SUPP 0x02
  630. #define ATTO_GAI_AF_DEVADDR_SUPP 0x04
  631. #define ATTO_GAI_AF_PHYCTRL_SUPP 0x08
  632. #define ATTO_GAI_AF_TEST_SUPP 0x10
  633. #define ATTO_GAI_AF_DIAG_SUPP 0x20
  634. #define ATTO_GAI_AF_VIRT_SES 0x40
  635. #define ATTO_GAI_AF_CONN_CTRL 0x80
  636. u8 num_ports;
  637. u8 num_phys;
  638. u8 drvr_rev_major;
  639. u8 drvr_rev_minor;
  640. u8 drvr_revsub_minor;
  641. u8 drvr_rev_build;
  642. char drvr_rev_ascii[16];
  643. char drvr_name[32];
  644. char firmware_rev[16];
  645. char flash_rev[16];
  646. char model_name_short[16];
  647. char model_name[32];
  648. u32 num_targets;
  649. u32 num_targsper_bus;
  650. u32 num_lunsper_targ;
  651. u8 num_busses;
  652. u8 num_connectors;
  653. u8 adap_flags2;
  654. #define ATTO_GAI_AF2_FCOE_SUPP 0x01
  655. #define ATTO_GAI_AF2_NIC_SUPP 0x02
  656. #define ATTO_GAI_AF2_LOCATE_SUPP 0x04
  657. #define ATTO_GAI_AF2_ADAP_CTRL_SUPP 0x08
  658. #define ATTO_GAI_AF2_DEV_INFO_SUPP 0x10
  659. #define ATTO_GAI_AF2_NPIV_SUPP 0x20
  660. #define ATTO_GAI_AF2_MP_SUPP 0x40
  661. u8 num_temp_sensors;
  662. u32 num_targets_backend;
  663. u32 tunnel_flags;
  664. #define ATTO_GAI_TF_MEM_RW 0x00000001
  665. #define ATTO_GAI_TF_TRACE 0x00000002
  666. #define ATTO_GAI_TF_SCSI_PASS_THRU 0x00000004
  667. #define ATTO_GAI_TF_GET_DEV_ADDR 0x00000008
  668. #define ATTO_GAI_TF_PHY_CTRL 0x00000010
  669. #define ATTO_GAI_TF_CONN_CTRL 0x00000020
  670. #define ATTO_GAI_TF_GET_DEV_INFO 0x00000040
  671. u8 reserved3[0x138];
  672. };
  673. #define ATTO_FUNC_GET_ADAP_ADDR 0x01
  674. #define ATTO_VER_GET_ADAP_ADDR0 0
  675. #define ATTO_VER_GET_ADAP_ADDR ATTO_VER_GET_ADAP_ADDR0
  676. struct __packed atto_hba_get_adapter_address {
  677. u8 addr_type;
  678. #define ATTO_GAA_AT_PORT 0x00
  679. #define ATTO_GAA_AT_NODE 0x01
  680. #define ATTO_GAA_AT_CURR_MAC 0x02
  681. #define ATTO_GAA_AT_PERM_MAC 0x03
  682. #define ATTO_GAA_AT_VNIC 0x04
  683. u8 port_id;
  684. u16 addr_len;
  685. u8 address[256];
  686. };
  687. #define ATTO_FUNC_MEM_RW 0x02
  688. #define ATTO_VER_MEM_RW0 0
  689. #define ATTO_VER_MEM_RW ATTO_VER_MEM_RW0
  690. struct __packed atto_hba_memory_read_write {
  691. u8 mem_func;
  692. u8 mem_type;
  693. union {
  694. u8 pci_index;
  695. u8 i2c_dev;
  696. };
  697. u8 i2c_status;
  698. u32 length;
  699. u64 address;
  700. u8 reserved[48];
  701. };
  702. #define ATTO_FUNC_TRACE 0x03
  703. #define ATTO_VER_TRACE0 0
  704. #define ATTO_VER_TRACE1 1
  705. #define ATTO_VER_TRACE ATTO_VER_TRACE1
  706. struct __packed atto_hba_trace {
  707. u8 trace_func;
  708. #define ATTO_TRC_TF_GET_INFO 0x00
  709. #define ATTO_TRC_TF_ENABLE 0x01
  710. #define ATTO_TRC_TF_DISABLE 0x02
  711. #define ATTO_TRC_TF_SET_MASK 0x03
  712. #define ATTO_TRC_TF_UPLOAD 0x04
  713. #define ATTO_TRC_TF_RESET 0x05
  714. u8 trace_type;
  715. #define ATTO_TRC_TT_DRIVER 0x00
  716. #define ATTO_TRC_TT_FWCOREDUMP 0x01
  717. u8 reserved[2];
  718. u32 current_offset;
  719. u32 total_length;
  720. u32 trace_mask;
  721. u8 reserved2[48];
  722. };
  723. #define ATTO_FUNC_SCSI_PASS_THRU 0x04
  724. #define ATTO_VER_SCSI_PASS_THRU0 0
  725. #define ATTO_VER_SCSI_PASS_THRU ATTO_VER_SCSI_PASS_THRU0
  726. struct __packed atto_hba_scsi_pass_thru {
  727. u8 cdb[32];
  728. u8 cdb_length;
  729. u8 req_status;
  730. #define ATTO_SPT_RS_SUCCESS 0x00
  731. #define ATTO_SPT_RS_FAILED 0x01
  732. #define ATTO_SPT_RS_OVERRUN 0x02
  733. #define ATTO_SPT_RS_UNDERRUN 0x03
  734. #define ATTO_SPT_RS_NO_DEVICE 0x04
  735. #define ATTO_SPT_RS_NO_LUN 0x05
  736. #define ATTO_SPT_RS_TIMEOUT 0x06
  737. #define ATTO_SPT_RS_BUS_RESET 0x07
  738. #define ATTO_SPT_RS_ABORTED 0x08
  739. #define ATTO_SPT_RS_BUSY 0x09
  740. #define ATTO_SPT_RS_DEGRADED 0x0A
  741. u8 scsi_status;
  742. u8 sense_length;
  743. u32 flags;
  744. #define ATTO_SPTF_DATA_IN 0x00000001
  745. #define ATTO_SPTF_DATA_OUT 0x00000002
  746. #define ATTO_SPTF_SIMPLE_Q 0x00000004
  747. #define ATTO_SPTF_HEAD_OF_Q 0x00000008
  748. #define ATTO_SPTF_ORDERED_Q 0x00000010
  749. u32 timeout;
  750. u32 target_id;
  751. u8 lun[8];
  752. u32 residual_length;
  753. u8 sense_data[0xFC];
  754. u8 reserved[0x28];
  755. };
  756. #define ATTO_FUNC_GET_DEV_ADDR 0x05
  757. #define ATTO_VER_GET_DEV_ADDR0 0
  758. #define ATTO_VER_GET_DEV_ADDR ATTO_VER_GET_DEV_ADDR0
  759. struct __packed atto_hba_get_device_address {
  760. u8 addr_type;
  761. #define ATTO_GDA_AT_PORT 0x00
  762. #define ATTO_GDA_AT_NODE 0x01
  763. #define ATTO_GDA_AT_MAC 0x02
  764. #define ATTO_GDA_AT_PORTID 0x03
  765. #define ATTO_GDA_AT_UNIQUE 0x04
  766. u8 reserved;
  767. u16 addr_len;
  768. u32 target_id;
  769. u8 address[256];
  770. };
  771. /* The following functions are supported by firmware but do not have any
  772. * associated driver structures
  773. */
  774. #define ATTO_FUNC_PHY_CTRL 0x06
  775. #define ATTO_FUNC_CONN_CTRL 0x0C
  776. #define ATTO_FUNC_ADAP_CTRL 0x0E
  777. #define ATTO_VER_ADAP_CTRL0 0
  778. #define ATTO_VER_ADAP_CTRL ATTO_VER_ADAP_CTRL0
  779. struct __packed atto_hba_adap_ctrl {
  780. u8 adap_func;
  781. #define ATTO_AC_AF_HARD_RST 0x00
  782. #define ATTO_AC_AF_GET_STATE 0x01
  783. #define ATTO_AC_AF_GET_TEMP 0x02
  784. u8 adap_state;
  785. #define ATTO_AC_AS_UNKNOWN 0x00
  786. #define ATTO_AC_AS_OK 0x01
  787. #define ATTO_AC_AS_RST_SCHED 0x02
  788. #define ATTO_AC_AS_RST_IN_PROG 0x03
  789. #define ATTO_AC_AS_RST_DISC 0x04
  790. #define ATTO_AC_AS_DEGRADED 0x05
  791. #define ATTO_AC_AS_DISABLED 0x06
  792. #define ATTO_AC_AS_TEMP 0x07
  793. u8 reserved[2];
  794. union {
  795. struct {
  796. u8 temp_sensor;
  797. u8 temp_state;
  798. #define ATTO_AC_TS_UNSUPP 0x00
  799. #define ATTO_AC_TS_UNKNOWN 0x01
  800. #define ATTO_AC_TS_INIT_FAILED 0x02
  801. #define ATTO_AC_TS_NORMAL 0x03
  802. #define ATTO_AC_TS_OUT_OF_RANGE 0x04
  803. #define ATTO_AC_TS_FAULT 0x05
  804. signed short temp_value;
  805. signed short temp_lower_lim;
  806. signed short temp_upper_lim;
  807. char temp_desc[32];
  808. u8 reserved2[20];
  809. };
  810. };
  811. };
  812. #define ATTO_FUNC_GET_DEV_INFO 0x0F
  813. #define ATTO_VER_GET_DEV_INFO0 0
  814. #define ATTO_VER_GET_DEV_INFO ATTO_VER_GET_DEV_INFO0
  815. struct __packed atto_hba_sas_device_info {
  816. #define ATTO_SDI_MAX_PHYS_WIDE_PORT 16
  817. u8 phy_id[ATTO_SDI_MAX_PHYS_WIDE_PORT]; /* IDs of parent exp/adapt */
  818. #define ATTO_SDI_PHY_ID_INV ATTO_SAS_PHY_ID_INV
  819. u32 exp_target_id;
  820. u32 sas_port_mask;
  821. u8 sas_level;
  822. #define ATTO_SDI_SAS_LVL_INV 0xFF
  823. u8 slot_num;
  824. #define ATTO_SDI_SLOT_NUM_INV ATTO_SLOT_NUM_INV
  825. u8 dev_type;
  826. #define ATTO_SDI_DT_END_DEVICE 0
  827. #define ATTO_SDI_DT_EXPANDER 1
  828. #define ATTO_SDI_DT_PORT_MULT 2
  829. u8 ini_flags;
  830. u8 tgt_flags;
  831. u8 link_rate; /* SMP_RATE_XXX */
  832. u8 loc_flags;
  833. #define ATTO_SDI_LF_DIRECT 0x01
  834. #define ATTO_SDI_LF_EXPANDER 0x02
  835. #define ATTO_SDI_LF_PORT_MULT 0x04
  836. u8 pm_port;
  837. u8 reserved[0x60];
  838. };
  839. union atto_hba_device_info {
  840. struct atto_hba_sas_device_info sas_dev_info;
  841. };
  842. struct __packed atto_hba_get_device_info {
  843. u32 target_id;
  844. u8 info_type;
  845. #define ATTO_GDI_IT_UNKNOWN 0x00
  846. #define ATTO_GDI_IT_SAS 0x01
  847. #define ATTO_GDI_IT_FC 0x02
  848. #define ATTO_GDI_IT_FCOE 0x03
  849. u8 reserved[11];
  850. union atto_hba_device_info dev_info;
  851. };
  852. struct atto_ioctl {
  853. u8 version;
  854. u8 function; /* ATTO_FUNC_XXX */
  855. u8 status;
  856. #define ATTO_STS_SUCCESS 0x00
  857. #define ATTO_STS_FAILED 0x01
  858. #define ATTO_STS_INV_VERSION 0x02
  859. #define ATTO_STS_OUT_OF_RSRC 0x03
  860. #define ATTO_STS_INV_FUNC 0x04
  861. #define ATTO_STS_UNSUPPORTED 0x05
  862. #define ATTO_STS_INV_ADAPTER 0x06
  863. #define ATTO_STS_INV_DRVR_VER 0x07
  864. #define ATTO_STS_INV_PARAM 0x08
  865. #define ATTO_STS_TIMEOUT 0x09
  866. #define ATTO_STS_NOT_APPL 0x0A
  867. #define ATTO_STS_DEGRADED 0x0B
  868. u8 flags;
  869. #define HBAF_TUNNEL 0x01
  870. u32 data_length;
  871. u8 reserved2[56];
  872. union {
  873. u8 byte[1];
  874. struct atto_hba_get_adapter_info get_adap_info;
  875. struct atto_hba_get_adapter_address get_adap_addr;
  876. struct atto_hba_scsi_pass_thru scsi_pass_thru;
  877. struct atto_hba_get_device_address get_dev_addr;
  878. struct atto_hba_adap_ctrl adap_ctrl;
  879. struct atto_hba_get_device_info get_dev_info;
  880. struct atto_hba_trace trace;
  881. } data;
  882. };
  883. struct __packed atto_ioctl_vda_scsi_cmd {
  884. #define ATTO_VDA_SCSI_VER0 0
  885. #define ATTO_VDA_SCSI_VER ATTO_VDA_SCSI_VER0
  886. u8 cdb[16];
  887. u32 flags;
  888. u32 data_length;
  889. u32 residual_length;
  890. u16 target_id;
  891. u8 sense_len;
  892. u8 scsi_stat;
  893. u8 reserved[8];
  894. u8 sense_data[80];
  895. };
  896. struct __packed atto_ioctl_vda_flash_cmd {
  897. #define ATTO_VDA_FLASH_VER0 0
  898. #define ATTO_VDA_FLASH_VER ATTO_VDA_FLASH_VER0
  899. u32 flash_addr;
  900. u32 data_length;
  901. u8 sub_func;
  902. u8 reserved[15];
  903. union {
  904. struct {
  905. u32 flash_size;
  906. u32 page_size;
  907. u8 prod_info[32];
  908. } info;
  909. struct {
  910. char file_name[16]; /* 8.3 fname, NULL term, wc=* */
  911. u32 file_size;
  912. } file;
  913. } data;
  914. };
  915. struct __packed atto_ioctl_vda_diag_cmd {
  916. #define ATTO_VDA_DIAG_VER0 0
  917. #define ATTO_VDA_DIAG_VER ATTO_VDA_DIAG_VER0
  918. u64 local_addr;
  919. u32 data_length;
  920. u8 sub_func;
  921. u8 flags;
  922. u8 reserved[3];
  923. };
  924. struct __packed atto_ioctl_vda_cli_cmd {
  925. #define ATTO_VDA_CLI_VER0 0
  926. #define ATTO_VDA_CLI_VER ATTO_VDA_CLI_VER0
  927. u32 cmd_rsp_len;
  928. };
  929. struct __packed atto_ioctl_vda_smp_cmd {
  930. #define ATTO_VDA_SMP_VER0 0
  931. #define ATTO_VDA_SMP_VER ATTO_VDA_SMP_VER0
  932. u64 dest;
  933. u32 cmd_rsp_len;
  934. };
  935. struct __packed atto_ioctl_vda_cfg_cmd {
  936. #define ATTO_VDA_CFG_VER0 0
  937. #define ATTO_VDA_CFG_VER ATTO_VDA_CFG_VER0
  938. u32 data_length;
  939. u8 cfg_func;
  940. u8 reserved[11];
  941. union {
  942. u8 bytes[112];
  943. struct atto_vda_cfg_init init;
  944. } data;
  945. };
  946. struct __packed atto_ioctl_vda_mgt_cmd {
  947. #define ATTO_VDA_MGT_VER0 0
  948. #define ATTO_VDA_MGT_VER ATTO_VDA_MGT_VER0
  949. u8 mgt_func;
  950. u8 scan_generation;
  951. u16 dev_index;
  952. u32 data_length;
  953. u8 reserved[8];
  954. union {
  955. u8 bytes[112];
  956. struct atto_vda_devinfo dev_info;
  957. struct atto_vda_grp_info grp_info;
  958. struct atto_vdapart_info part_info;
  959. struct atto_vda_dh_info dh_info;
  960. struct atto_vda_metrics_info metrics_info;
  961. struct atto_vda_schedule_info sched_info;
  962. struct atto_vda_n_vcache_info nvcache_info;
  963. struct atto_vda_buzzer_info buzzer_info;
  964. struct atto_vda_adapter_info adapter_info;
  965. struct atto_vda_temp_info temp_info;
  966. struct atto_vda_fan_info fan_info;
  967. } data;
  968. };
  969. struct __packed atto_ioctl_vda_gsv_cmd {
  970. #define ATTO_VDA_GSV_VER0 0
  971. #define ATTO_VDA_GSV_VER ATTO_VDA_GSV_VER0
  972. u8 rsp_len;
  973. u8 reserved[7];
  974. u8 version_info[1];
  975. #define ATTO_VDA_VER_UNSUPPORTED 0xFF
  976. };
  977. struct __packed atto_ioctl_vda {
  978. u8 version;
  979. u8 function; /* VDA_FUNC_XXXX */
  980. u8 status; /* ATTO_STS_XXX */
  981. u8 vda_status; /* RS_XXX (if status == ATTO_STS_SUCCESS) */
  982. u32 data_length;
  983. u8 reserved[8];
  984. union {
  985. struct atto_ioctl_vda_scsi_cmd scsi;
  986. struct atto_ioctl_vda_flash_cmd flash;
  987. struct atto_ioctl_vda_diag_cmd diag;
  988. struct atto_ioctl_vda_cli_cmd cli;
  989. struct atto_ioctl_vda_smp_cmd smp;
  990. struct atto_ioctl_vda_cfg_cmd cfg;
  991. struct atto_ioctl_vda_mgt_cmd mgt;
  992. struct atto_ioctl_vda_gsv_cmd gsv;
  993. u8 cmd_info[256];
  994. } cmd;
  995. union {
  996. u8 data[1];
  997. struct atto_vda_devinfo2 dev_info2;
  998. } data;
  999. };
  1000. struct __packed atto_ioctl_smp {
  1001. u8 version;
  1002. #define ATTO_SMP_VERSION0 0
  1003. #define ATTO_SMP_VERSION1 1
  1004. #define ATTO_SMP_VERSION2 2
  1005. #define ATTO_SMP_VERSION ATTO_SMP_VERSION2
  1006. u8 function;
  1007. #define ATTO_SMP_FUNC_DISC_SMP 0x00
  1008. #define ATTO_SMP_FUNC_DISC_TARG 0x01
  1009. #define ATTO_SMP_FUNC_SEND_CMD 0x02
  1010. #define ATTO_SMP_FUNC_DISC_TARG_DIRECT 0x03
  1011. #define ATTO_SMP_FUNC_SEND_CMD_DIRECT 0x04
  1012. #define ATTO_SMP_FUNC_DISC_SMP_DIRECT 0x05
  1013. u8 status; /* ATTO_STS_XXX */
  1014. u8 smp_status; /* if status == ATTO_STS_SUCCESS */
  1015. #define ATTO_SMP_STS_SUCCESS 0x00
  1016. #define ATTO_SMP_STS_FAILURE 0x01
  1017. #define ATTO_SMP_STS_RESCAN 0x02
  1018. #define ATTO_SMP_STS_NOT_FOUND 0x03
  1019. u16 target_id;
  1020. u8 phy_id;
  1021. u8 dev_index;
  1022. u64 smp_sas_addr;
  1023. u64 targ_sas_addr;
  1024. u32 req_length;
  1025. u32 rsp_length;
  1026. u8 flags;
  1027. #define ATTO_SMPF_ROOT_EXP 0x01 /* expander direct attached */
  1028. u8 reserved[31];
  1029. union {
  1030. u8 byte[1];
  1031. u32 dword[1];
  1032. } data;
  1033. };
  1034. struct __packed atto_express_ioctl {
  1035. struct atto_express_ioctl_header header;
  1036. union {
  1037. struct atto_firmware_rw_request fwrw;
  1038. struct atto_param_rw_request prw;
  1039. struct atto_channel_list chanlist;
  1040. struct atto_channel_info chaninfo;
  1041. struct atto_ioctl ioctl_hba;
  1042. struct atto_module_info modinfo;
  1043. struct atto_ioctl_vda ioctl_vda;
  1044. struct atto_ioctl_smp ioctl_smp;
  1045. struct atto_csmi csmi;
  1046. } data;
  1047. };
  1048. /* The struct associated with the code is listed after the definition */
  1049. #define EXPRESS_IOCTL_MIN 0x4500
  1050. #define EXPRESS_IOCTL_RW_FIRMWARE 0x4500 /* FIRMWARERW */
  1051. #define EXPRESS_IOCTL_READ_PARAMS 0x4501 /* PARAMRW */
  1052. #define EXPRESS_IOCTL_WRITE_PARAMS 0x4502 /* PARAMRW */
  1053. #define EXPRESS_IOCTL_FC_API 0x4503 /* internal */
  1054. #define EXPRESS_IOCTL_GET_CHANNELS 0x4504 /* CHANNELLIST */
  1055. #define EXPRESS_IOCTL_CHAN_INFO 0x4505 /* CHANNELINFO */
  1056. #define EXPRESS_IOCTL_DEFAULT_PARAMS 0x4506 /* PARAMRW */
  1057. #define EXPRESS_ADDR_MEMORY 0x4507 /* MEMADDR */
  1058. #define EXPRESS_RW_MEMORY 0x4508 /* MEMRW */
  1059. #define EXPRESS_TSDK_DUMP 0x4509 /* TSDKDUMP */
  1060. #define EXPRESS_IOCTL_SMP 0x450A /* IOCTL_SMP */
  1061. #define EXPRESS_CSMI 0x450B /* CSMI */
  1062. #define EXPRESS_IOCTL_HBA 0x450C /* IOCTL_HBA */
  1063. #define EXPRESS_IOCTL_VDA 0x450D /* IOCTL_VDA */
  1064. #define EXPRESS_IOCTL_GET_ID 0x450E /* GET_ID */
  1065. #define EXPRESS_IOCTL_GET_MOD_INFO 0x450F /* MODULE_INFO */
  1066. #define EXPRESS_IOCTL_MAX 0x450F
  1067. #endif