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