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