aic94xx_sas.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Aic94xx SAS/SATA driver SAS definitions and hardware interface header file.
  4. *
  5. * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
  6. * Copyright (C) 2005 Luben Tuikov <[email protected]>
  7. */
  8. #ifndef _AIC94XX_SAS_H_
  9. #define _AIC94XX_SAS_H_
  10. #include <scsi/libsas.h>
  11. /* ---------- DDBs ---------- */
  12. /* DDBs are device descriptor blocks which describe a device in the
  13. * domain that this sequencer can maintain low-level connections for
  14. * us. They are be 64 bytes.
  15. */
  16. #define ASD_MAX_DDBS 128
  17. struct asd_ddb_ssp_smp_target_port {
  18. u8 conn_type; /* byte 0 */
  19. #define DDB_TP_CONN_TYPE 0x81 /* Initiator port and addr frame type 0x01 */
  20. u8 conn_rate;
  21. __be16 init_conn_tag;
  22. u8 dest_sas_addr[8]; /* bytes 4-11 */
  23. __le16 send_queue_head;
  24. u8 sq_suspended;
  25. u8 ddb_type; /* DDB_TYPE_TARGET */
  26. #define DDB_TYPE_UNUSED 0xFF
  27. #define DDB_TYPE_TARGET 0xFE
  28. #define DDB_TYPE_INITIATOR 0xFD
  29. #define DDB_TYPE_PM_PORT 0xFC
  30. __le16 _r_a;
  31. __be16 awt_def;
  32. u8 compat_features; /* byte 20 */
  33. u8 pathway_blocked_count;
  34. __be16 arb_wait_time;
  35. __be32 more_compat_features; /* byte 24 */
  36. u8 conn_mask;
  37. u8 flags; /* concurrent conn:2,2 and open:0(1) */
  38. #define CONCURRENT_CONN_SUPP 0x04
  39. #define OPEN_REQUIRED 0x01
  40. u16 _r_b;
  41. __le16 exec_queue_tail;
  42. __le16 send_queue_tail;
  43. __le16 sister_ddb;
  44. __le16 _r_c;
  45. u8 max_concurrent_conn;
  46. u8 num_concurrent_conn;
  47. u8 num_contexts;
  48. u8 _r_d;
  49. __le16 active_task_count;
  50. u8 _r_e[9];
  51. u8 itnl_reason; /* I_T nexus loss reason */
  52. __le16 _r_f;
  53. __le16 itnl_timeout;
  54. #define ITNL_TIMEOUT_CONST 0x7D0 /* 2 seconds */
  55. __le32 itnl_timestamp;
  56. } __attribute__ ((packed));
  57. struct asd_ddb_stp_sata_target_port {
  58. u8 conn_type; /* byte 0 */
  59. u8 conn_rate;
  60. __be16 init_conn_tag;
  61. u8 dest_sas_addr[8]; /* bytes 4-11 */
  62. __le16 send_queue_head;
  63. u8 sq_suspended;
  64. u8 ddb_type; /* DDB_TYPE_TARGET */
  65. __le16 _r_a;
  66. __be16 awt_def;
  67. u8 compat_features; /* byte 20 */
  68. u8 pathway_blocked_count;
  69. __be16 arb_wait_time;
  70. __be32 more_compat_features; /* byte 24 */
  71. u8 conn_mask;
  72. u8 flags; /* concurrent conn:2,2 and open:0(1) */
  73. #define SATA_MULTIPORT 0x80
  74. #define SUPPORTS_AFFIL 0x40
  75. #define STP_AFFIL_POL 0x20
  76. u8 _r_b;
  77. u8 flags2; /* STP close policy:0 */
  78. #define STP_CL_POL_NO_TX 0x00
  79. #define STP_CL_POL_BTW_CMDS 0x01
  80. __le16 exec_queue_tail;
  81. __le16 send_queue_tail;
  82. __le16 sister_ddb;
  83. __le16 ata_cmd_scbptr;
  84. __le32 sata_tag_alloc_mask;
  85. __le16 active_task_count;
  86. __le16 _r_c;
  87. __le32 sata_sactive;
  88. u8 num_sata_tags;
  89. u8 sata_status;
  90. u8 sata_ending_status;
  91. u8 itnl_reason; /* I_T nexus loss reason */
  92. __le16 ncq_data_scb_ptr;
  93. __le16 itnl_timeout;
  94. __le32 itnl_timestamp;
  95. } __attribute__ ((packed));
  96. /* This struct asd_ddb_init_port, describes the device descriptor block
  97. * of an initiator port (when the sequencer is operating in target mode).
  98. * Bytes [0,11] and [20,27] are from the OPEN address frame.
  99. * The sequencer allocates an initiator port DDB entry.
  100. */
  101. struct asd_ddb_init_port {
  102. u8 conn_type; /* byte 0 */
  103. u8 conn_rate;
  104. __be16 init_conn_tag; /* BE */
  105. u8 dest_sas_addr[8];
  106. __le16 send_queue_head; /* LE, byte 12 */
  107. u8 sq_suspended;
  108. u8 ddb_type; /* DDB_TYPE_INITIATOR */
  109. __le16 _r_a;
  110. __be16 awt_def; /* BE */
  111. u8 compat_features;
  112. u8 pathway_blocked_count;
  113. __be16 arb_wait_time; /* BE */
  114. __be32 more_compat_features; /* BE */
  115. u8 conn_mask;
  116. u8 flags; /* == 5 */
  117. u16 _r_b;
  118. __le16 exec_queue_tail; /* execution queue tail */
  119. __le16 send_queue_tail;
  120. __le16 sister_ddb;
  121. __le16 init_resp_timeout; /* initiator response timeout */
  122. __le32 _r_c;
  123. __le16 active_tasks; /* active task count */
  124. __le16 init_list; /* initiator list link pointer */
  125. __le32 _r_d;
  126. u8 max_conn_to[3]; /* from Conn-Disc mode page, in us, LE */
  127. u8 itnl_reason; /* I_T nexus loss reason */
  128. __le16 bus_inact_to; /* from Conn-Disc mode page, in 100 us, LE */
  129. __le16 itnl_to; /* from the Protocol Specific Port Ctrl MP */
  130. __le32 itnl_timestamp;
  131. } __attribute__ ((packed));
  132. /* This struct asd_ddb_sata_tag, describes a look-up table to be used
  133. * by the sequencers. SATA II, IDENTIFY DEVICE data, word 76, bit 8:
  134. * NCQ support. This table is used by the sequencers to find the
  135. * corresponding SCB, given a SATA II tag value.
  136. */
  137. struct asd_ddb_sata_tag {
  138. __le16 scb_pointer[32];
  139. } __attribute__ ((packed));
  140. /* This struct asd_ddb_sata_pm_table, describes a port number to
  141. * connection handle look-up table. SATA targets attached to a port
  142. * multiplier require a 4-bit port number value. There is one DDB
  143. * entry of this type for each SATA port multiplier (sister DDB).
  144. * Given a SATA PM port number, this table gives us the SATA PM Port
  145. * DDB of the SATA port multiplier port (i.e. the SATA target
  146. * discovered on the port).
  147. */
  148. struct asd_ddb_sata_pm_table {
  149. __le16 ddb_pointer[16];
  150. __le16 _r_a[16];
  151. } __attribute__ ((packed));
  152. /* This struct asd_ddb_sata_pm_port, describes the SATA port multiplier
  153. * port format DDB.
  154. */
  155. struct asd_ddb_sata_pm_port {
  156. u8 _r_a[15];
  157. u8 ddb_type;
  158. u8 _r_b[13];
  159. u8 pm_port_flags;
  160. #define PM_PORT_MASK 0xF0
  161. #define PM_PORT_SET 0x02
  162. u8 _r_c[6];
  163. __le16 sister_ddb;
  164. __le16 ata_cmd_scbptr;
  165. __le32 sata_tag_alloc_mask;
  166. __le16 active_task_count;
  167. __le16 parent_ddb;
  168. __le32 sata_sactive;
  169. u8 num_sata_tags;
  170. u8 sata_status;
  171. u8 sata_ending_status;
  172. u8 _r_d[9];
  173. } __attribute__ ((packed));
  174. /* This struct asd_ddb_seq_shared, describes a DDB shared by the
  175. * central and link sequencers. port_map_by_links is indexed phy
  176. * number [0,7]; each byte is a bit mask of all the phys that are in
  177. * the same port as the indexed phy.
  178. */
  179. struct asd_ddb_seq_shared {
  180. __le16 q_free_ddb_head;
  181. __le16 q_free_ddb_tail;
  182. __le16 q_free_ddb_cnt;
  183. __le16 q_used_ddb_head;
  184. __le16 q_used_ddb_tail;
  185. __le16 shared_mem_lock;
  186. __le16 smp_conn_tag;
  187. __le16 est_nexus_buf_cnt;
  188. __le16 est_nexus_buf_thresh;
  189. u32 _r_a;
  190. u8 settable_max_contexts;
  191. u8 _r_b[23];
  192. u8 conn_not_active;
  193. u8 phy_is_up;
  194. u8 _r_c[8];
  195. u8 port_map_by_links[8];
  196. } __attribute__ ((packed));
  197. /* ---------- SG Element ---------- */
  198. /* This struct sg_el, describes the hardware scatter gather buffer
  199. * element. All entries are little endian. In an SCB, there are 2 of
  200. * this, plus one more, called a link element of this indicating a
  201. * sublist if needed.
  202. *
  203. * A link element has only the bus address set and the flags (DS) bit
  204. * valid. The bus address points to the start of the sublist.
  205. *
  206. * If a sublist is needed, then that sublist should also include the 2
  207. * sg_el embedded in the SCB, in which case next_sg_offset is 32,
  208. * since sizeof(sg_el) = 16; EOS should be 1 and EOL 0 in this case.
  209. */
  210. struct sg_el {
  211. __le64 bus_addr;
  212. __le32 size;
  213. __le16 _r;
  214. u8 next_sg_offs;
  215. u8 flags;
  216. #define ASD_SG_EL_DS_MASK 0x30
  217. #define ASD_SG_EL_DS_OCM 0x10
  218. #define ASD_SG_EL_DS_HM 0x00
  219. #define ASD_SG_EL_LIST_MASK 0xC0
  220. #define ASD_SG_EL_LIST_EOL 0x40
  221. #define ASD_SG_EL_LIST_EOS 0x80
  222. } __attribute__ ((packed));
  223. /* ---------- SCBs ---------- */
  224. /* An SCB (sequencer control block) is comprised of a common header
  225. * and a task part, for a total of 128 bytes. All fields are in LE
  226. * order, unless otherwise noted.
  227. */
  228. /* This struct scb_header, defines the SCB header format.
  229. */
  230. struct scb_header {
  231. __le64 next_scb;
  232. __le16 index; /* transaction context */
  233. u8 opcode;
  234. } __attribute__ ((packed));
  235. /* SCB opcodes: Execution queue
  236. */
  237. #define INITIATE_SSP_TASK 0x00
  238. #define INITIATE_LONG_SSP_TASK 0x01
  239. #define INITIATE_BIDIR_SSP_TASK 0x02
  240. #define SCB_ABORT_TASK 0x03
  241. #define INITIATE_SSP_TMF 0x04
  242. #define SSP_TARG_GET_DATA 0x05
  243. #define SSP_TARG_GET_DATA_GOOD 0x06
  244. #define SSP_TARG_SEND_RESP 0x07
  245. #define QUERY_SSP_TASK 0x08
  246. #define INITIATE_ATA_TASK 0x09
  247. #define INITIATE_ATAPI_TASK 0x0a
  248. #define CONTROL_ATA_DEV 0x0b
  249. #define INITIATE_SMP_TASK 0x0c
  250. #define SMP_TARG_SEND_RESP 0x0f
  251. /* SCB opcodes: Send Queue
  252. */
  253. #define SSP_TARG_SEND_DATA 0x40
  254. #define SSP_TARG_SEND_DATA_GOOD 0x41
  255. /* SCB opcodes: Link Queue
  256. */
  257. #define CONTROL_PHY 0x80
  258. #define SEND_PRIMITIVE 0x81
  259. #define INITIATE_LINK_ADM_TASK 0x82
  260. /* SCB opcodes: other
  261. */
  262. #define EMPTY_SCB 0xc0
  263. #define INITIATE_SEQ_ADM_TASK 0xc1
  264. #define EST_ICL_TARG_WINDOW 0xc2
  265. #define COPY_MEM 0xc3
  266. #define CLEAR_NEXUS 0xc4
  267. #define INITIATE_DDB_ADM_TASK 0xc6
  268. #define ESTABLISH_NEXUS_ESCB 0xd0
  269. #define LUN_SIZE 8
  270. #define EFB_MASK 0x80
  271. #define TASK_PRIO_MASK 0x78
  272. #define TASK_ATTR_MASK 0x07
  273. /* ---------- SCB tasks ---------- */
  274. /* This is both ssp_task and long_ssp_task
  275. */
  276. struct initiate_ssp_task {
  277. u8 proto_conn_rate; /* proto:6,4, conn_rate:3,0 */
  278. __le32 total_xfer_len;
  279. struct ssp_frame_hdr ssp_frame;
  280. struct ssp_command_iu ssp_cmd;
  281. __le16 sister_scb; /* 0xFFFF */
  282. __le16 conn_handle; /* index to DDB for the intended target */
  283. u8 data_dir; /* :1,0 */
  284. #define DATA_DIR_NONE 0x00
  285. #define DATA_DIR_IN 0x01
  286. #define DATA_DIR_OUT 0x02
  287. #define DATA_DIR_BYRECIPIENT 0x03
  288. u8 _r_a;
  289. u8 retry_count;
  290. u8 _r_b[5];
  291. struct sg_el sg_element[3]; /* 2 real and 1 link */
  292. } __attribute__ ((packed));
  293. /* This defines both ata_task and atapi_task.
  294. * ata: C bit of FIS should be 1,
  295. * atapi: C bit of FIS should be 1, and command register should be 0xA0,
  296. * to indicate a packet command.
  297. */
  298. struct initiate_ata_task {
  299. u8 proto_conn_rate;
  300. __le32 total_xfer_len;
  301. struct host_to_dev_fis fis;
  302. __le32 data_offs;
  303. u8 atapi_packet[16];
  304. u8 _r_a[12];
  305. __le16 sister_scb;
  306. __le16 conn_handle;
  307. u8 ata_flags; /* CSMI:6,6, DTM:4,4, QT:3,3, data dir:1,0 */
  308. #define CSMI_TASK 0x40
  309. #define DATA_XFER_MODE_DMA 0x10
  310. #define ATA_Q_TYPE_MASK 0x08
  311. #define ATA_Q_TYPE_UNTAGGED 0x00
  312. #define ATA_Q_TYPE_NCQ 0x08
  313. u8 _r_b;
  314. u8 retry_count;
  315. u8 _r_c;
  316. u8 flags;
  317. #define STP_AFFIL_POLICY 0x20
  318. #define SET_AFFIL_POLICY 0x10
  319. #define RET_PARTIAL_SGLIST 0x02
  320. u8 _r_d[3];
  321. struct sg_el sg_element[3];
  322. } __attribute__ ((packed));
  323. struct initiate_smp_task {
  324. u8 proto_conn_rate;
  325. u8 _r_a[40];
  326. struct sg_el smp_req;
  327. __le16 sister_scb;
  328. __le16 conn_handle;
  329. u8 _r_c[8];
  330. struct sg_el smp_resp;
  331. u8 _r_d[32];
  332. } __attribute__ ((packed));
  333. struct control_phy {
  334. u8 phy_id;
  335. u8 sub_func;
  336. #define DISABLE_PHY 0x00
  337. #define ENABLE_PHY 0x01
  338. #define RELEASE_SPINUP_HOLD 0x02
  339. #define ENABLE_PHY_NO_SAS_OOB 0x03
  340. #define ENABLE_PHY_NO_SATA_OOB 0x04
  341. #define PHY_NO_OP 0x05
  342. #define EXECUTE_HARD_RESET 0x81
  343. u8 func_mask;
  344. u8 speed_mask;
  345. u8 hot_plug_delay;
  346. u8 port_type;
  347. u8 flags;
  348. #define DEV_PRES_TIMER_OVERRIDE_ENABLE 0x01
  349. #define DISABLE_PHY_IF_OOB_FAILS 0x02
  350. __le32 timeout_override;
  351. u8 link_reset_retries;
  352. u8 _r_a[47];
  353. __le16 conn_handle;
  354. u8 _r_b[56];
  355. } __attribute__ ((packed));
  356. struct control_ata_dev {
  357. u8 proto_conn_rate;
  358. __le32 _r_a;
  359. struct host_to_dev_fis fis;
  360. u8 _r_b[32];
  361. __le16 sister_scb;
  362. __le16 conn_handle;
  363. u8 ata_flags; /* 0 */
  364. u8 _r_c[55];
  365. } __attribute__ ((packed));
  366. struct empty_scb {
  367. u8 num_valid;
  368. __le32 _r_a;
  369. #define ASD_EDBS_PER_SCB 7
  370. /* header+data+CRC+DMA suffix data */
  371. #define ASD_EDB_SIZE (24+1024+4+16)
  372. struct sg_el eb[ASD_EDBS_PER_SCB];
  373. #define ELEMENT_NOT_VALID 0xC0
  374. } __attribute__ ((packed));
  375. struct initiate_link_adm {
  376. u8 phy_id;
  377. u8 sub_func;
  378. #define GET_LINK_ERROR_COUNT 0x00
  379. #define RESET_LINK_ERROR_COUNT 0x01
  380. #define ENABLE_NOTIFY_SPINUP_INTS 0x02
  381. u8 _r_a[57];
  382. __le16 conn_handle;
  383. u8 _r_b[56];
  384. } __attribute__ ((packed));
  385. struct copy_memory {
  386. u8 _r_a;
  387. __le16 xfer_len;
  388. __le16 _r_b;
  389. __le64 src_busaddr;
  390. u8 src_ds; /* See definition of sg_el */
  391. u8 _r_c[45];
  392. __le16 conn_handle;
  393. __le64 _r_d;
  394. __le64 dest_busaddr;
  395. u8 dest_ds; /* See definition of sg_el */
  396. u8 _r_e[39];
  397. } __attribute__ ((packed));
  398. struct abort_task {
  399. u8 proto_conn_rate;
  400. __le32 _r_a;
  401. struct ssp_frame_hdr ssp_frame;
  402. struct ssp_tmf_iu ssp_task;
  403. __le16 sister_scb;
  404. __le16 conn_handle;
  405. u8 flags; /* ovrd_itnl_timer:3,3, suspend_data_trans:2,2 */
  406. #define SUSPEND_DATA_TRANS 0x04
  407. u8 _r_b;
  408. u8 retry_count;
  409. u8 _r_c[5];
  410. __le16 index; /* Transaction context of task to be queried */
  411. __le16 itnl_to;
  412. u8 _r_d[44];
  413. } __attribute__ ((packed));
  414. struct clear_nexus {
  415. u8 nexus;
  416. #define NEXUS_ADAPTER 0x00
  417. #define NEXUS_PORT 0x01
  418. #define NEXUS_I_T 0x02
  419. #define NEXUS_I_T_L 0x03
  420. #define NEXUS_TAG 0x04
  421. #define NEXUS_TRANS_CX 0x05
  422. #define NEXUS_SATA_TAG 0x06
  423. #define NEXUS_T_L 0x07
  424. #define NEXUS_L 0x08
  425. #define NEXUS_T_TAG 0x09
  426. __le32 _r_a;
  427. u8 flags;
  428. #define SUSPEND_TX 0x80
  429. #define RESUME_TX 0x40
  430. #define SEND_Q 0x04
  431. #define EXEC_Q 0x02
  432. #define NOTINQ 0x01
  433. u8 _r_b[3];
  434. u8 conn_mask;
  435. u8 _r_c[19];
  436. struct ssp_tmf_iu ssp_task; /* LUN and TAG */
  437. __le16 _r_d;
  438. __le16 conn_handle;
  439. __le64 _r_e;
  440. __le16 index; /* Transaction context of task to be cleared */
  441. __le16 context; /* Clear nexus context */
  442. u8 _r_f[44];
  443. } __attribute__ ((packed));
  444. struct initiate_ssp_tmf {
  445. u8 proto_conn_rate;
  446. __le32 _r_a;
  447. struct ssp_frame_hdr ssp_frame;
  448. struct ssp_tmf_iu ssp_task;
  449. __le16 sister_scb;
  450. __le16 conn_handle;
  451. u8 flags; /* itnl override and suspend data tx */
  452. #define OVERRIDE_ITNL_TIMER 8
  453. u8 _r_b;
  454. u8 retry_count;
  455. u8 _r_c[5];
  456. __le16 index; /* Transaction context of task to be queried */
  457. __le16 itnl_to;
  458. u8 _r_d[44];
  459. } __attribute__ ((packed));
  460. /* Transmits an arbitrary primitive on the link.
  461. * Used for NOTIFY and BROADCAST.
  462. */
  463. struct send_prim {
  464. u8 phy_id;
  465. u8 wait_transmit; /* :0,0 */
  466. u8 xmit_flags;
  467. #define XMTPSIZE_MASK 0xF0
  468. #define XMTPSIZE_SINGLE 0x10
  469. #define XMTPSIZE_REPEATED 0x20
  470. #define XMTPSIZE_CONT 0x20
  471. #define XMTPSIZE_TRIPLE 0x30
  472. #define XMTPSIZE_REDUNDANT 0x60
  473. #define XMTPSIZE_INF 0
  474. #define XMTCONTEN 0x04
  475. #define XMTPFRM 0x02 /* Transmit at the next frame boundary */
  476. #define XMTPIMM 0x01 /* Transmit immediately */
  477. __le16 _r_a;
  478. u8 prim[4]; /* K, D0, D1, D2 */
  479. u8 _r_b[50];
  480. __le16 conn_handle;
  481. u8 _r_c[56];
  482. } __attribute__ ((packed));
  483. /* This describes both SSP Target Get Data and SSP Target Get Data And
  484. * Send Good Response SCBs. Used when the sequencer is operating in
  485. * target mode...
  486. */
  487. struct ssp_targ_get_data {
  488. u8 proto_conn_rate;
  489. __le32 total_xfer_len;
  490. struct ssp_frame_hdr ssp_frame;
  491. struct xfer_rdy_iu xfer_rdy;
  492. u8 lun[LUN_SIZE];
  493. __le64 _r_a;
  494. __le16 sister_scb;
  495. __le16 conn_handle;
  496. u8 data_dir; /* 01b */
  497. u8 _r_b;
  498. u8 retry_count;
  499. u8 _r_c[5];
  500. struct sg_el sg_element[3];
  501. } __attribute__ ((packed));
  502. /* ---------- The actual SCB struct ---------- */
  503. struct scb {
  504. struct scb_header header;
  505. union {
  506. struct initiate_ssp_task ssp_task;
  507. struct initiate_ata_task ata_task;
  508. struct initiate_smp_task smp_task;
  509. struct control_phy control_phy;
  510. struct control_ata_dev control_ata_dev;
  511. struct empty_scb escb;
  512. struct initiate_link_adm link_adm;
  513. struct copy_memory cp_mem;
  514. struct abort_task abort_task;
  515. struct clear_nexus clear_nexus;
  516. struct initiate_ssp_tmf ssp_tmf;
  517. };
  518. } __attribute__ ((packed));
  519. /* ---------- Done List ---------- */
  520. /* The done list entry opcode field is defined below.
  521. * The mnemonic encoding and meaning is as follows:
  522. * TC - Task Complete, status was received and acknowledged
  523. * TF - Task Failed, indicates an error prior to receiving acknowledgment
  524. * for the command:
  525. * - no conn,
  526. * - NACK or R_ERR received in response to this command,
  527. * - credit blocked or not available, or in the case of SMP request,
  528. * - no SMP response was received.
  529. * In these four cases it is known that the target didn't receive the
  530. * command.
  531. * TI - Task Interrupted, error after the command was acknowledged. It is
  532. * known that the command was received by the target.
  533. * TU - Task Unacked, command was transmitted but neither ACK (R_OK) nor NAK
  534. * (R_ERR) was received due to loss of signal, broken connection, loss of
  535. * dword sync or other reason. The application client should send the
  536. * appropriate task query.
  537. * TA - Task Aborted, see TF.
  538. * _RESP - The completion includes an empty buffer containing status.
  539. * TO - Timeout.
  540. */
  541. #define TC_NO_ERROR 0x00
  542. #define TC_UNDERRUN 0x01
  543. #define TC_OVERRUN 0x02
  544. #define TF_OPEN_TO 0x03
  545. #define TF_OPEN_REJECT 0x04
  546. #define TI_BREAK 0x05
  547. #define TI_PROTO_ERR 0x06
  548. #define TC_SSP_RESP 0x07
  549. #define TI_PHY_DOWN 0x08
  550. #define TF_PHY_DOWN 0x09
  551. #define TC_LINK_ADM_RESP 0x0a
  552. #define TC_CSMI 0x0b
  553. #define TC_ATA_RESP 0x0c
  554. #define TU_PHY_DOWN 0x0d
  555. #define TU_BREAK 0x0e
  556. #define TI_SATA_TO 0x0f
  557. #define TI_NAK 0x10
  558. #define TC_CONTROL_PHY 0x11
  559. #define TF_BREAK 0x12
  560. #define TC_RESUME 0x13
  561. #define TI_ACK_NAK_TO 0x14
  562. #define TF_SMPRSP_TO 0x15
  563. #define TF_SMP_XMIT_RCV_ERR 0x16
  564. #define TC_PARTIAL_SG_LIST 0x17
  565. #define TU_ACK_NAK_TO 0x18
  566. #define TU_SATA_TO 0x19
  567. #define TF_NAK_RECV 0x1a
  568. #define TA_I_T_NEXUS_LOSS 0x1b
  569. #define TC_ATA_R_ERR_RECV 0x1c
  570. #define TF_TMF_NO_CTX 0x1d
  571. #define TA_ON_REQ 0x1e
  572. #define TF_TMF_NO_TAG 0x1f
  573. #define TF_TMF_TAG_FREE 0x20
  574. #define TF_TMF_TASK_DONE 0x21
  575. #define TF_TMF_NO_CONN_HANDLE 0x22
  576. #define TC_TASK_CLEARED 0x23
  577. #define TI_SYNCS_RECV 0x24
  578. #define TU_SYNCS_RECV 0x25
  579. #define TF_IRTT_TO 0x26
  580. #define TF_NO_SMP_CONN 0x27
  581. #define TF_IU_SHORT 0x28
  582. #define TF_DATA_OFFS_ERR 0x29
  583. #define TF_INV_CONN_HANDLE 0x2a
  584. #define TF_REQUESTED_N_PENDING 0x2b
  585. /* 0xc1 - 0xc7: empty buffer received,
  586. 0xd1 - 0xd7: establish nexus empty buffer received
  587. */
  588. /* This is the ESCB mask */
  589. #define ESCB_RECVD 0xC0
  590. /* This struct done_list_struct defines the done list entry.
  591. * All fields are LE.
  592. */
  593. struct done_list_struct {
  594. __le16 index; /* aka transaction context */
  595. u8 opcode;
  596. u8 status_block[4];
  597. u8 toggle; /* bit 0 */
  598. #define DL_TOGGLE_MASK 0x01
  599. } __attribute__ ((packed));
  600. /* ---------- PHYS ---------- */
  601. struct asd_phy {
  602. struct asd_sas_phy sas_phy;
  603. struct asd_phy_desc *phy_desc; /* hw profile */
  604. struct sas_identify_frame *identify_frame;
  605. struct asd_dma_tok *id_frm_tok;
  606. struct asd_port *asd_port;
  607. u8 frame_rcvd[ASD_EDB_SIZE];
  608. };
  609. #define ASD_SCB_SIZE sizeof(struct scb)
  610. #define ASD_DDB_SIZE sizeof(struct asd_ddb_ssp_smp_target_port)
  611. /* Define this to 0 if you do not want NOTIFY (ENABLE SPINIP) sent.
  612. * Default: 0x10 (it's a mask)
  613. */
  614. #define ASD_NOTIFY_ENABLE_SPINUP 0x10
  615. /* If enabled, set this to the interval between transmission
  616. * of NOTIFY (ENABLE SPINUP). In units of 200 us.
  617. */
  618. #define ASD_NOTIFY_TIMEOUT 2500
  619. /* Initial delay after OOB, before we transmit NOTIFY (ENABLE SPINUP).
  620. * If 0, transmit immediately. In milliseconds.
  621. */
  622. #define ASD_NOTIFY_DOWN_COUNT 0
  623. /* Device present timer timeout constant, 10 ms. */
  624. #define ASD_DEV_PRESENT_TIMEOUT 0x2710
  625. #define ASD_SATA_INTERLOCK_TIMEOUT 0
  626. /* How long to wait before shutting down an STP connection, unless
  627. * an STP target sent frame(s). 50 usec.
  628. * IGNORED by the sequencer (i.e. value 0 always).
  629. */
  630. #define ASD_STP_SHUTDOWN_TIMEOUT 0x0
  631. /* ATA soft reset timer timeout. 5 usec. */
  632. #define ASD_SRST_ASSERT_TIMEOUT 0x05
  633. /* 31 sec */
  634. #define ASD_RCV_FIS_TIMEOUT 0x01D905C0
  635. #define ASD_ONE_MILLISEC_TIMEOUT 0x03e8
  636. /* COMINIT timer */
  637. #define ASD_TEN_MILLISEC_TIMEOUT 0x2710
  638. #define ASD_COMINIT_TIMEOUT ASD_TEN_MILLISEC_TIMEOUT
  639. /* 1 sec */
  640. #define ASD_SMP_RCV_TIMEOUT 0x000F4240
  641. #endif