18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Aic94xx SAS/SATA driver SAS definitions and hardware interface header file. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2005 Adaptec, Inc. All rights reserved. 68c2ecf20Sopenharmony_ci * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifndef _AIC94XX_SAS_H_ 108c2ecf20Sopenharmony_ci#define _AIC94XX_SAS_H_ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <scsi/libsas.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/* ---------- DDBs ---------- */ 158c2ecf20Sopenharmony_ci/* DDBs are device descriptor blocks which describe a device in the 168c2ecf20Sopenharmony_ci * domain that this sequencer can maintain low-level connections for 178c2ecf20Sopenharmony_ci * us. They are be 64 bytes. 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_ci#define ASD_MAX_DDBS 128 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_cistruct asd_ddb_ssp_smp_target_port { 228c2ecf20Sopenharmony_ci u8 conn_type; /* byte 0 */ 238c2ecf20Sopenharmony_ci#define DDB_TP_CONN_TYPE 0x81 /* Initiator port and addr frame type 0x01 */ 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci u8 conn_rate; 268c2ecf20Sopenharmony_ci __be16 init_conn_tag; 278c2ecf20Sopenharmony_ci u8 dest_sas_addr[8]; /* bytes 4-11 */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci __le16 send_queue_head; 308c2ecf20Sopenharmony_ci u8 sq_suspended; 318c2ecf20Sopenharmony_ci u8 ddb_type; /* DDB_TYPE_TARGET */ 328c2ecf20Sopenharmony_ci#define DDB_TYPE_UNUSED 0xFF 338c2ecf20Sopenharmony_ci#define DDB_TYPE_TARGET 0xFE 348c2ecf20Sopenharmony_ci#define DDB_TYPE_INITIATOR 0xFD 358c2ecf20Sopenharmony_ci#define DDB_TYPE_PM_PORT 0xFC 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci __le16 _r_a; 388c2ecf20Sopenharmony_ci __be16 awt_def; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci u8 compat_features; /* byte 20 */ 418c2ecf20Sopenharmony_ci u8 pathway_blocked_count; 428c2ecf20Sopenharmony_ci __be16 arb_wait_time; 438c2ecf20Sopenharmony_ci __be32 more_compat_features; /* byte 24 */ 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci u8 conn_mask; 468c2ecf20Sopenharmony_ci u8 flags; /* concurrent conn:2,2 and open:0(1) */ 478c2ecf20Sopenharmony_ci#define CONCURRENT_CONN_SUPP 0x04 488c2ecf20Sopenharmony_ci#define OPEN_REQUIRED 0x01 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci u16 _r_b; 518c2ecf20Sopenharmony_ci __le16 exec_queue_tail; 528c2ecf20Sopenharmony_ci __le16 send_queue_tail; 538c2ecf20Sopenharmony_ci __le16 sister_ddb; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci __le16 _r_c; 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci u8 max_concurrent_conn; 588c2ecf20Sopenharmony_ci u8 num_concurrent_conn; 598c2ecf20Sopenharmony_ci u8 num_contexts; 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci u8 _r_d; 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci __le16 active_task_count; 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci u8 _r_e[9]; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci u8 itnl_reason; /* I_T nexus loss reason */ 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci __le16 _r_f; 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci __le16 itnl_timeout; 728c2ecf20Sopenharmony_ci#define ITNL_TIMEOUT_CONST 0x7D0 /* 2 seconds */ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci __le32 itnl_timestamp; 758c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_cistruct asd_ddb_stp_sata_target_port { 788c2ecf20Sopenharmony_ci u8 conn_type; /* byte 0 */ 798c2ecf20Sopenharmony_ci u8 conn_rate; 808c2ecf20Sopenharmony_ci __be16 init_conn_tag; 818c2ecf20Sopenharmony_ci u8 dest_sas_addr[8]; /* bytes 4-11 */ 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci __le16 send_queue_head; 848c2ecf20Sopenharmony_ci u8 sq_suspended; 858c2ecf20Sopenharmony_ci u8 ddb_type; /* DDB_TYPE_TARGET */ 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci __le16 _r_a; 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci __be16 awt_def; 908c2ecf20Sopenharmony_ci u8 compat_features; /* byte 20 */ 918c2ecf20Sopenharmony_ci u8 pathway_blocked_count; 928c2ecf20Sopenharmony_ci __be16 arb_wait_time; 938c2ecf20Sopenharmony_ci __be32 more_compat_features; /* byte 24 */ 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci u8 conn_mask; 968c2ecf20Sopenharmony_ci u8 flags; /* concurrent conn:2,2 and open:0(1) */ 978c2ecf20Sopenharmony_ci#define SATA_MULTIPORT 0x80 988c2ecf20Sopenharmony_ci#define SUPPORTS_AFFIL 0x40 998c2ecf20Sopenharmony_ci#define STP_AFFIL_POL 0x20 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci u8 _r_b; 1028c2ecf20Sopenharmony_ci u8 flags2; /* STP close policy:0 */ 1038c2ecf20Sopenharmony_ci#define STP_CL_POL_NO_TX 0x00 1048c2ecf20Sopenharmony_ci#define STP_CL_POL_BTW_CMDS 0x01 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci __le16 exec_queue_tail; 1078c2ecf20Sopenharmony_ci __le16 send_queue_tail; 1088c2ecf20Sopenharmony_ci __le16 sister_ddb; 1098c2ecf20Sopenharmony_ci __le16 ata_cmd_scbptr; 1108c2ecf20Sopenharmony_ci __le32 sata_tag_alloc_mask; 1118c2ecf20Sopenharmony_ci __le16 active_task_count; 1128c2ecf20Sopenharmony_ci __le16 _r_c; 1138c2ecf20Sopenharmony_ci __le32 sata_sactive; 1148c2ecf20Sopenharmony_ci u8 num_sata_tags; 1158c2ecf20Sopenharmony_ci u8 sata_status; 1168c2ecf20Sopenharmony_ci u8 sata_ending_status; 1178c2ecf20Sopenharmony_ci u8 itnl_reason; /* I_T nexus loss reason */ 1188c2ecf20Sopenharmony_ci __le16 ncq_data_scb_ptr; 1198c2ecf20Sopenharmony_ci __le16 itnl_timeout; 1208c2ecf20Sopenharmony_ci __le32 itnl_timestamp; 1218c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci/* This struct asd_ddb_init_port, describes the device descriptor block 1248c2ecf20Sopenharmony_ci * of an initiator port (when the sequencer is operating in target mode). 1258c2ecf20Sopenharmony_ci * Bytes [0,11] and [20,27] are from the OPEN address frame. 1268c2ecf20Sopenharmony_ci * The sequencer allocates an initiator port DDB entry. 1278c2ecf20Sopenharmony_ci */ 1288c2ecf20Sopenharmony_cistruct asd_ddb_init_port { 1298c2ecf20Sopenharmony_ci u8 conn_type; /* byte 0 */ 1308c2ecf20Sopenharmony_ci u8 conn_rate; 1318c2ecf20Sopenharmony_ci __be16 init_conn_tag; /* BE */ 1328c2ecf20Sopenharmony_ci u8 dest_sas_addr[8]; 1338c2ecf20Sopenharmony_ci __le16 send_queue_head; /* LE, byte 12 */ 1348c2ecf20Sopenharmony_ci u8 sq_suspended; 1358c2ecf20Sopenharmony_ci u8 ddb_type; /* DDB_TYPE_INITIATOR */ 1368c2ecf20Sopenharmony_ci __le16 _r_a; 1378c2ecf20Sopenharmony_ci __be16 awt_def; /* BE */ 1388c2ecf20Sopenharmony_ci u8 compat_features; 1398c2ecf20Sopenharmony_ci u8 pathway_blocked_count; 1408c2ecf20Sopenharmony_ci __be16 arb_wait_time; /* BE */ 1418c2ecf20Sopenharmony_ci __be32 more_compat_features; /* BE */ 1428c2ecf20Sopenharmony_ci u8 conn_mask; 1438c2ecf20Sopenharmony_ci u8 flags; /* == 5 */ 1448c2ecf20Sopenharmony_ci u16 _r_b; 1458c2ecf20Sopenharmony_ci __le16 exec_queue_tail; /* execution queue tail */ 1468c2ecf20Sopenharmony_ci __le16 send_queue_tail; 1478c2ecf20Sopenharmony_ci __le16 sister_ddb; 1488c2ecf20Sopenharmony_ci __le16 init_resp_timeout; /* initiator response timeout */ 1498c2ecf20Sopenharmony_ci __le32 _r_c; 1508c2ecf20Sopenharmony_ci __le16 active_tasks; /* active task count */ 1518c2ecf20Sopenharmony_ci __le16 init_list; /* initiator list link pointer */ 1528c2ecf20Sopenharmony_ci __le32 _r_d; 1538c2ecf20Sopenharmony_ci u8 max_conn_to[3]; /* from Conn-Disc mode page, in us, LE */ 1548c2ecf20Sopenharmony_ci u8 itnl_reason; /* I_T nexus loss reason */ 1558c2ecf20Sopenharmony_ci __le16 bus_inact_to; /* from Conn-Disc mode page, in 100 us, LE */ 1568c2ecf20Sopenharmony_ci __le16 itnl_to; /* from the Protocol Specific Port Ctrl MP */ 1578c2ecf20Sopenharmony_ci __le32 itnl_timestamp; 1588c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci/* This struct asd_ddb_sata_tag, describes a look-up table to be used 1618c2ecf20Sopenharmony_ci * by the sequencers. SATA II, IDENTIFY DEVICE data, word 76, bit 8: 1628c2ecf20Sopenharmony_ci * NCQ support. This table is used by the sequencers to find the 1638c2ecf20Sopenharmony_ci * corresponding SCB, given a SATA II tag value. 1648c2ecf20Sopenharmony_ci */ 1658c2ecf20Sopenharmony_cistruct asd_ddb_sata_tag { 1668c2ecf20Sopenharmony_ci __le16 scb_pointer[32]; 1678c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci/* This struct asd_ddb_sata_pm_table, describes a port number to 1708c2ecf20Sopenharmony_ci * connection handle look-up table. SATA targets attached to a port 1718c2ecf20Sopenharmony_ci * multiplier require a 4-bit port number value. There is one DDB 1728c2ecf20Sopenharmony_ci * entry of this type for each SATA port multiplier (sister DDB). 1738c2ecf20Sopenharmony_ci * Given a SATA PM port number, this table gives us the SATA PM Port 1748c2ecf20Sopenharmony_ci * DDB of the SATA port multiplier port (i.e. the SATA target 1758c2ecf20Sopenharmony_ci * discovered on the port). 1768c2ecf20Sopenharmony_ci */ 1778c2ecf20Sopenharmony_cistruct asd_ddb_sata_pm_table { 1788c2ecf20Sopenharmony_ci __le16 ddb_pointer[16]; 1798c2ecf20Sopenharmony_ci __le16 _r_a[16]; 1808c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci/* This struct asd_ddb_sata_pm_port, describes the SATA port multiplier 1838c2ecf20Sopenharmony_ci * port format DDB. 1848c2ecf20Sopenharmony_ci */ 1858c2ecf20Sopenharmony_cistruct asd_ddb_sata_pm_port { 1868c2ecf20Sopenharmony_ci u8 _r_a[15]; 1878c2ecf20Sopenharmony_ci u8 ddb_type; 1888c2ecf20Sopenharmony_ci u8 _r_b[13]; 1898c2ecf20Sopenharmony_ci u8 pm_port_flags; 1908c2ecf20Sopenharmony_ci#define PM_PORT_MASK 0xF0 1918c2ecf20Sopenharmony_ci#define PM_PORT_SET 0x02 1928c2ecf20Sopenharmony_ci u8 _r_c[6]; 1938c2ecf20Sopenharmony_ci __le16 sister_ddb; 1948c2ecf20Sopenharmony_ci __le16 ata_cmd_scbptr; 1958c2ecf20Sopenharmony_ci __le32 sata_tag_alloc_mask; 1968c2ecf20Sopenharmony_ci __le16 active_task_count; 1978c2ecf20Sopenharmony_ci __le16 parent_ddb; 1988c2ecf20Sopenharmony_ci __le32 sata_sactive; 1998c2ecf20Sopenharmony_ci u8 num_sata_tags; 2008c2ecf20Sopenharmony_ci u8 sata_status; 2018c2ecf20Sopenharmony_ci u8 sata_ending_status; 2028c2ecf20Sopenharmony_ci u8 _r_d[9]; 2038c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_ci/* This struct asd_ddb_seq_shared, describes a DDB shared by the 2068c2ecf20Sopenharmony_ci * central and link sequencers. port_map_by_links is indexed phy 2078c2ecf20Sopenharmony_ci * number [0,7]; each byte is a bit mask of all the phys that are in 2088c2ecf20Sopenharmony_ci * the same port as the indexed phy. 2098c2ecf20Sopenharmony_ci */ 2108c2ecf20Sopenharmony_cistruct asd_ddb_seq_shared { 2118c2ecf20Sopenharmony_ci __le16 q_free_ddb_head; 2128c2ecf20Sopenharmony_ci __le16 q_free_ddb_tail; 2138c2ecf20Sopenharmony_ci __le16 q_free_ddb_cnt; 2148c2ecf20Sopenharmony_ci __le16 q_used_ddb_head; 2158c2ecf20Sopenharmony_ci __le16 q_used_ddb_tail; 2168c2ecf20Sopenharmony_ci __le16 shared_mem_lock; 2178c2ecf20Sopenharmony_ci __le16 smp_conn_tag; 2188c2ecf20Sopenharmony_ci __le16 est_nexus_buf_cnt; 2198c2ecf20Sopenharmony_ci __le16 est_nexus_buf_thresh; 2208c2ecf20Sopenharmony_ci u32 _r_a; 2218c2ecf20Sopenharmony_ci u8 settable_max_contexts; 2228c2ecf20Sopenharmony_ci u8 _r_b[23]; 2238c2ecf20Sopenharmony_ci u8 conn_not_active; 2248c2ecf20Sopenharmony_ci u8 phy_is_up; 2258c2ecf20Sopenharmony_ci u8 _r_c[8]; 2268c2ecf20Sopenharmony_ci u8 port_map_by_links[8]; 2278c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci/* ---------- SG Element ---------- */ 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci/* This struct sg_el, describes the hardware scatter gather buffer 2328c2ecf20Sopenharmony_ci * element. All entries are little endian. In an SCB, there are 2 of 2338c2ecf20Sopenharmony_ci * this, plus one more, called a link element of this indicating a 2348c2ecf20Sopenharmony_ci * sublist if needed. 2358c2ecf20Sopenharmony_ci * 2368c2ecf20Sopenharmony_ci * A link element has only the bus address set and the flags (DS) bit 2378c2ecf20Sopenharmony_ci * valid. The bus address points to the start of the sublist. 2388c2ecf20Sopenharmony_ci * 2398c2ecf20Sopenharmony_ci * If a sublist is needed, then that sublist should also include the 2 2408c2ecf20Sopenharmony_ci * sg_el embedded in the SCB, in which case next_sg_offset is 32, 2418c2ecf20Sopenharmony_ci * since sizeof(sg_el) = 16; EOS should be 1 and EOL 0 in this case. 2428c2ecf20Sopenharmony_ci */ 2438c2ecf20Sopenharmony_cistruct sg_el { 2448c2ecf20Sopenharmony_ci __le64 bus_addr; 2458c2ecf20Sopenharmony_ci __le32 size; 2468c2ecf20Sopenharmony_ci __le16 _r; 2478c2ecf20Sopenharmony_ci u8 next_sg_offs; 2488c2ecf20Sopenharmony_ci u8 flags; 2498c2ecf20Sopenharmony_ci#define ASD_SG_EL_DS_MASK 0x30 2508c2ecf20Sopenharmony_ci#define ASD_SG_EL_DS_OCM 0x10 2518c2ecf20Sopenharmony_ci#define ASD_SG_EL_DS_HM 0x00 2528c2ecf20Sopenharmony_ci#define ASD_SG_EL_LIST_MASK 0xC0 2538c2ecf20Sopenharmony_ci#define ASD_SG_EL_LIST_EOL 0x40 2548c2ecf20Sopenharmony_ci#define ASD_SG_EL_LIST_EOS 0x80 2558c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci/* ---------- SCBs ---------- */ 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci/* An SCB (sequencer control block) is comprised of a common header 2608c2ecf20Sopenharmony_ci * and a task part, for a total of 128 bytes. All fields are in LE 2618c2ecf20Sopenharmony_ci * order, unless otherwise noted. 2628c2ecf20Sopenharmony_ci */ 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci/* This struct scb_header, defines the SCB header format. 2658c2ecf20Sopenharmony_ci */ 2668c2ecf20Sopenharmony_cistruct scb_header { 2678c2ecf20Sopenharmony_ci __le64 next_scb; 2688c2ecf20Sopenharmony_ci __le16 index; /* transaction context */ 2698c2ecf20Sopenharmony_ci u8 opcode; 2708c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ci/* SCB opcodes: Execution queue 2738c2ecf20Sopenharmony_ci */ 2748c2ecf20Sopenharmony_ci#define INITIATE_SSP_TASK 0x00 2758c2ecf20Sopenharmony_ci#define INITIATE_LONG_SSP_TASK 0x01 2768c2ecf20Sopenharmony_ci#define INITIATE_BIDIR_SSP_TASK 0x02 2778c2ecf20Sopenharmony_ci#define SCB_ABORT_TASK 0x03 2788c2ecf20Sopenharmony_ci#define INITIATE_SSP_TMF 0x04 2798c2ecf20Sopenharmony_ci#define SSP_TARG_GET_DATA 0x05 2808c2ecf20Sopenharmony_ci#define SSP_TARG_GET_DATA_GOOD 0x06 2818c2ecf20Sopenharmony_ci#define SSP_TARG_SEND_RESP 0x07 2828c2ecf20Sopenharmony_ci#define QUERY_SSP_TASK 0x08 2838c2ecf20Sopenharmony_ci#define INITIATE_ATA_TASK 0x09 2848c2ecf20Sopenharmony_ci#define INITIATE_ATAPI_TASK 0x0a 2858c2ecf20Sopenharmony_ci#define CONTROL_ATA_DEV 0x0b 2868c2ecf20Sopenharmony_ci#define INITIATE_SMP_TASK 0x0c 2878c2ecf20Sopenharmony_ci#define SMP_TARG_SEND_RESP 0x0f 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci/* SCB opcodes: Send Queue 2908c2ecf20Sopenharmony_ci */ 2918c2ecf20Sopenharmony_ci#define SSP_TARG_SEND_DATA 0x40 2928c2ecf20Sopenharmony_ci#define SSP_TARG_SEND_DATA_GOOD 0x41 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ci/* SCB opcodes: Link Queue 2958c2ecf20Sopenharmony_ci */ 2968c2ecf20Sopenharmony_ci#define CONTROL_PHY 0x80 2978c2ecf20Sopenharmony_ci#define SEND_PRIMITIVE 0x81 2988c2ecf20Sopenharmony_ci#define INITIATE_LINK_ADM_TASK 0x82 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci/* SCB opcodes: other 3018c2ecf20Sopenharmony_ci */ 3028c2ecf20Sopenharmony_ci#define EMPTY_SCB 0xc0 3038c2ecf20Sopenharmony_ci#define INITIATE_SEQ_ADM_TASK 0xc1 3048c2ecf20Sopenharmony_ci#define EST_ICL_TARG_WINDOW 0xc2 3058c2ecf20Sopenharmony_ci#define COPY_MEM 0xc3 3068c2ecf20Sopenharmony_ci#define CLEAR_NEXUS 0xc4 3078c2ecf20Sopenharmony_ci#define INITIATE_DDB_ADM_TASK 0xc6 3088c2ecf20Sopenharmony_ci#define ESTABLISH_NEXUS_ESCB 0xd0 3098c2ecf20Sopenharmony_ci 3108c2ecf20Sopenharmony_ci#define LUN_SIZE 8 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci#define EFB_MASK 0x80 3138c2ecf20Sopenharmony_ci#define TASK_PRIO_MASK 0x78 3148c2ecf20Sopenharmony_ci#define TASK_ATTR_MASK 0x07 3158c2ecf20Sopenharmony_ci/* ---------- SCB tasks ---------- */ 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci/* This is both ssp_task and long_ssp_task 3188c2ecf20Sopenharmony_ci */ 3198c2ecf20Sopenharmony_cistruct initiate_ssp_task { 3208c2ecf20Sopenharmony_ci u8 proto_conn_rate; /* proto:6,4, conn_rate:3,0 */ 3218c2ecf20Sopenharmony_ci __le32 total_xfer_len; 3228c2ecf20Sopenharmony_ci struct ssp_frame_hdr ssp_frame; 3238c2ecf20Sopenharmony_ci struct ssp_command_iu ssp_cmd; 3248c2ecf20Sopenharmony_ci __le16 sister_scb; /* 0xFFFF */ 3258c2ecf20Sopenharmony_ci __le16 conn_handle; /* index to DDB for the intended target */ 3268c2ecf20Sopenharmony_ci u8 data_dir; /* :1,0 */ 3278c2ecf20Sopenharmony_ci#define DATA_DIR_NONE 0x00 3288c2ecf20Sopenharmony_ci#define DATA_DIR_IN 0x01 3298c2ecf20Sopenharmony_ci#define DATA_DIR_OUT 0x02 3308c2ecf20Sopenharmony_ci#define DATA_DIR_BYRECIPIENT 0x03 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_ci u8 _r_a; 3338c2ecf20Sopenharmony_ci u8 retry_count; 3348c2ecf20Sopenharmony_ci u8 _r_b[5]; 3358c2ecf20Sopenharmony_ci struct sg_el sg_element[3]; /* 2 real and 1 link */ 3368c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci/* This defines both ata_task and atapi_task. 3398c2ecf20Sopenharmony_ci * ata: C bit of FIS should be 1, 3408c2ecf20Sopenharmony_ci * atapi: C bit of FIS should be 1, and command register should be 0xA0, 3418c2ecf20Sopenharmony_ci * to indicate a packet command. 3428c2ecf20Sopenharmony_ci */ 3438c2ecf20Sopenharmony_cistruct initiate_ata_task { 3448c2ecf20Sopenharmony_ci u8 proto_conn_rate; 3458c2ecf20Sopenharmony_ci __le32 total_xfer_len; 3468c2ecf20Sopenharmony_ci struct host_to_dev_fis fis; 3478c2ecf20Sopenharmony_ci __le32 data_offs; 3488c2ecf20Sopenharmony_ci u8 atapi_packet[16]; 3498c2ecf20Sopenharmony_ci u8 _r_a[12]; 3508c2ecf20Sopenharmony_ci __le16 sister_scb; 3518c2ecf20Sopenharmony_ci __le16 conn_handle; 3528c2ecf20Sopenharmony_ci u8 ata_flags; /* CSMI:6,6, DTM:4,4, QT:3,3, data dir:1,0 */ 3538c2ecf20Sopenharmony_ci#define CSMI_TASK 0x40 3548c2ecf20Sopenharmony_ci#define DATA_XFER_MODE_DMA 0x10 3558c2ecf20Sopenharmony_ci#define ATA_Q_TYPE_MASK 0x08 3568c2ecf20Sopenharmony_ci#define ATA_Q_TYPE_UNTAGGED 0x00 3578c2ecf20Sopenharmony_ci#define ATA_Q_TYPE_NCQ 0x08 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_ci u8 _r_b; 3608c2ecf20Sopenharmony_ci u8 retry_count; 3618c2ecf20Sopenharmony_ci u8 _r_c; 3628c2ecf20Sopenharmony_ci u8 flags; 3638c2ecf20Sopenharmony_ci#define STP_AFFIL_POLICY 0x20 3648c2ecf20Sopenharmony_ci#define SET_AFFIL_POLICY 0x10 3658c2ecf20Sopenharmony_ci#define RET_PARTIAL_SGLIST 0x02 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci u8 _r_d[3]; 3688c2ecf20Sopenharmony_ci struct sg_el sg_element[3]; 3698c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_cistruct initiate_smp_task { 3728c2ecf20Sopenharmony_ci u8 proto_conn_rate; 3738c2ecf20Sopenharmony_ci u8 _r_a[40]; 3748c2ecf20Sopenharmony_ci struct sg_el smp_req; 3758c2ecf20Sopenharmony_ci __le16 sister_scb; 3768c2ecf20Sopenharmony_ci __le16 conn_handle; 3778c2ecf20Sopenharmony_ci u8 _r_c[8]; 3788c2ecf20Sopenharmony_ci struct sg_el smp_resp; 3798c2ecf20Sopenharmony_ci u8 _r_d[32]; 3808c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 3818c2ecf20Sopenharmony_ci 3828c2ecf20Sopenharmony_cistruct control_phy { 3838c2ecf20Sopenharmony_ci u8 phy_id; 3848c2ecf20Sopenharmony_ci u8 sub_func; 3858c2ecf20Sopenharmony_ci#define DISABLE_PHY 0x00 3868c2ecf20Sopenharmony_ci#define ENABLE_PHY 0x01 3878c2ecf20Sopenharmony_ci#define RELEASE_SPINUP_HOLD 0x02 3888c2ecf20Sopenharmony_ci#define ENABLE_PHY_NO_SAS_OOB 0x03 3898c2ecf20Sopenharmony_ci#define ENABLE_PHY_NO_SATA_OOB 0x04 3908c2ecf20Sopenharmony_ci#define PHY_NO_OP 0x05 3918c2ecf20Sopenharmony_ci#define EXECUTE_HARD_RESET 0x81 3928c2ecf20Sopenharmony_ci 3938c2ecf20Sopenharmony_ci u8 func_mask; 3948c2ecf20Sopenharmony_ci u8 speed_mask; 3958c2ecf20Sopenharmony_ci u8 hot_plug_delay; 3968c2ecf20Sopenharmony_ci u8 port_type; 3978c2ecf20Sopenharmony_ci u8 flags; 3988c2ecf20Sopenharmony_ci#define DEV_PRES_TIMER_OVERRIDE_ENABLE 0x01 3998c2ecf20Sopenharmony_ci#define DISABLE_PHY_IF_OOB_FAILS 0x02 4008c2ecf20Sopenharmony_ci 4018c2ecf20Sopenharmony_ci __le32 timeout_override; 4028c2ecf20Sopenharmony_ci u8 link_reset_retries; 4038c2ecf20Sopenharmony_ci u8 _r_a[47]; 4048c2ecf20Sopenharmony_ci __le16 conn_handle; 4058c2ecf20Sopenharmony_ci u8 _r_b[56]; 4068c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_cistruct control_ata_dev { 4098c2ecf20Sopenharmony_ci u8 proto_conn_rate; 4108c2ecf20Sopenharmony_ci __le32 _r_a; 4118c2ecf20Sopenharmony_ci struct host_to_dev_fis fis; 4128c2ecf20Sopenharmony_ci u8 _r_b[32]; 4138c2ecf20Sopenharmony_ci __le16 sister_scb; 4148c2ecf20Sopenharmony_ci __le16 conn_handle; 4158c2ecf20Sopenharmony_ci u8 ata_flags; /* 0 */ 4168c2ecf20Sopenharmony_ci u8 _r_c[55]; 4178c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 4188c2ecf20Sopenharmony_ci 4198c2ecf20Sopenharmony_cistruct empty_scb { 4208c2ecf20Sopenharmony_ci u8 num_valid; 4218c2ecf20Sopenharmony_ci __le32 _r_a; 4228c2ecf20Sopenharmony_ci#define ASD_EDBS_PER_SCB 7 4238c2ecf20Sopenharmony_ci/* header+data+CRC+DMA suffix data */ 4248c2ecf20Sopenharmony_ci#define ASD_EDB_SIZE (24+1024+4+16) 4258c2ecf20Sopenharmony_ci struct sg_el eb[ASD_EDBS_PER_SCB]; 4268c2ecf20Sopenharmony_ci#define ELEMENT_NOT_VALID 0xC0 4278c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 4288c2ecf20Sopenharmony_ci 4298c2ecf20Sopenharmony_cistruct initiate_link_adm { 4308c2ecf20Sopenharmony_ci u8 phy_id; 4318c2ecf20Sopenharmony_ci u8 sub_func; 4328c2ecf20Sopenharmony_ci#define GET_LINK_ERROR_COUNT 0x00 4338c2ecf20Sopenharmony_ci#define RESET_LINK_ERROR_COUNT 0x01 4348c2ecf20Sopenharmony_ci#define ENABLE_NOTIFY_SPINUP_INTS 0x02 4358c2ecf20Sopenharmony_ci 4368c2ecf20Sopenharmony_ci u8 _r_a[57]; 4378c2ecf20Sopenharmony_ci __le16 conn_handle; 4388c2ecf20Sopenharmony_ci u8 _r_b[56]; 4398c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 4408c2ecf20Sopenharmony_ci 4418c2ecf20Sopenharmony_cistruct copy_memory { 4428c2ecf20Sopenharmony_ci u8 _r_a; 4438c2ecf20Sopenharmony_ci __le16 xfer_len; 4448c2ecf20Sopenharmony_ci __le16 _r_b; 4458c2ecf20Sopenharmony_ci __le64 src_busaddr; 4468c2ecf20Sopenharmony_ci u8 src_ds; /* See definition of sg_el */ 4478c2ecf20Sopenharmony_ci u8 _r_c[45]; 4488c2ecf20Sopenharmony_ci __le16 conn_handle; 4498c2ecf20Sopenharmony_ci __le64 _r_d; 4508c2ecf20Sopenharmony_ci __le64 dest_busaddr; 4518c2ecf20Sopenharmony_ci u8 dest_ds; /* See definition of sg_el */ 4528c2ecf20Sopenharmony_ci u8 _r_e[39]; 4538c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 4548c2ecf20Sopenharmony_ci 4558c2ecf20Sopenharmony_cistruct abort_task { 4568c2ecf20Sopenharmony_ci u8 proto_conn_rate; 4578c2ecf20Sopenharmony_ci __le32 _r_a; 4588c2ecf20Sopenharmony_ci struct ssp_frame_hdr ssp_frame; 4598c2ecf20Sopenharmony_ci struct ssp_tmf_iu ssp_task; 4608c2ecf20Sopenharmony_ci __le16 sister_scb; 4618c2ecf20Sopenharmony_ci __le16 conn_handle; 4628c2ecf20Sopenharmony_ci u8 flags; /* ovrd_itnl_timer:3,3, suspend_data_trans:2,2 */ 4638c2ecf20Sopenharmony_ci#define SUSPEND_DATA_TRANS 0x04 4648c2ecf20Sopenharmony_ci 4658c2ecf20Sopenharmony_ci u8 _r_b; 4668c2ecf20Sopenharmony_ci u8 retry_count; 4678c2ecf20Sopenharmony_ci u8 _r_c[5]; 4688c2ecf20Sopenharmony_ci __le16 index; /* Transaction context of task to be queried */ 4698c2ecf20Sopenharmony_ci __le16 itnl_to; 4708c2ecf20Sopenharmony_ci u8 _r_d[44]; 4718c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 4728c2ecf20Sopenharmony_ci 4738c2ecf20Sopenharmony_cistruct clear_nexus { 4748c2ecf20Sopenharmony_ci u8 nexus; 4758c2ecf20Sopenharmony_ci#define NEXUS_ADAPTER 0x00 4768c2ecf20Sopenharmony_ci#define NEXUS_PORT 0x01 4778c2ecf20Sopenharmony_ci#define NEXUS_I_T 0x02 4788c2ecf20Sopenharmony_ci#define NEXUS_I_T_L 0x03 4798c2ecf20Sopenharmony_ci#define NEXUS_TAG 0x04 4808c2ecf20Sopenharmony_ci#define NEXUS_TRANS_CX 0x05 4818c2ecf20Sopenharmony_ci#define NEXUS_SATA_TAG 0x06 4828c2ecf20Sopenharmony_ci#define NEXUS_T_L 0x07 4838c2ecf20Sopenharmony_ci#define NEXUS_L 0x08 4848c2ecf20Sopenharmony_ci#define NEXUS_T_TAG 0x09 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_ci __le32 _r_a; 4878c2ecf20Sopenharmony_ci u8 flags; 4888c2ecf20Sopenharmony_ci#define SUSPEND_TX 0x80 4898c2ecf20Sopenharmony_ci#define RESUME_TX 0x40 4908c2ecf20Sopenharmony_ci#define SEND_Q 0x04 4918c2ecf20Sopenharmony_ci#define EXEC_Q 0x02 4928c2ecf20Sopenharmony_ci#define NOTINQ 0x01 4938c2ecf20Sopenharmony_ci 4948c2ecf20Sopenharmony_ci u8 _r_b[3]; 4958c2ecf20Sopenharmony_ci u8 conn_mask; 4968c2ecf20Sopenharmony_ci u8 _r_c[19]; 4978c2ecf20Sopenharmony_ci struct ssp_tmf_iu ssp_task; /* LUN and TAG */ 4988c2ecf20Sopenharmony_ci __le16 _r_d; 4998c2ecf20Sopenharmony_ci __le16 conn_handle; 5008c2ecf20Sopenharmony_ci __le64 _r_e; 5018c2ecf20Sopenharmony_ci __le16 index; /* Transaction context of task to be cleared */ 5028c2ecf20Sopenharmony_ci __le16 context; /* Clear nexus context */ 5038c2ecf20Sopenharmony_ci u8 _r_f[44]; 5048c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 5058c2ecf20Sopenharmony_ci 5068c2ecf20Sopenharmony_cistruct initiate_ssp_tmf { 5078c2ecf20Sopenharmony_ci u8 proto_conn_rate; 5088c2ecf20Sopenharmony_ci __le32 _r_a; 5098c2ecf20Sopenharmony_ci struct ssp_frame_hdr ssp_frame; 5108c2ecf20Sopenharmony_ci struct ssp_tmf_iu ssp_task; 5118c2ecf20Sopenharmony_ci __le16 sister_scb; 5128c2ecf20Sopenharmony_ci __le16 conn_handle; 5138c2ecf20Sopenharmony_ci u8 flags; /* itnl override and suspend data tx */ 5148c2ecf20Sopenharmony_ci#define OVERRIDE_ITNL_TIMER 8 5158c2ecf20Sopenharmony_ci 5168c2ecf20Sopenharmony_ci u8 _r_b; 5178c2ecf20Sopenharmony_ci u8 retry_count; 5188c2ecf20Sopenharmony_ci u8 _r_c[5]; 5198c2ecf20Sopenharmony_ci __le16 index; /* Transaction context of task to be queried */ 5208c2ecf20Sopenharmony_ci __le16 itnl_to; 5218c2ecf20Sopenharmony_ci u8 _r_d[44]; 5228c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 5238c2ecf20Sopenharmony_ci 5248c2ecf20Sopenharmony_ci/* Transmits an arbitrary primitive on the link. 5258c2ecf20Sopenharmony_ci * Used for NOTIFY and BROADCAST. 5268c2ecf20Sopenharmony_ci */ 5278c2ecf20Sopenharmony_cistruct send_prim { 5288c2ecf20Sopenharmony_ci u8 phy_id; 5298c2ecf20Sopenharmony_ci u8 wait_transmit; /* :0,0 */ 5308c2ecf20Sopenharmony_ci u8 xmit_flags; 5318c2ecf20Sopenharmony_ci#define XMTPSIZE_MASK 0xF0 5328c2ecf20Sopenharmony_ci#define XMTPSIZE_SINGLE 0x10 5338c2ecf20Sopenharmony_ci#define XMTPSIZE_REPEATED 0x20 5348c2ecf20Sopenharmony_ci#define XMTPSIZE_CONT 0x20 5358c2ecf20Sopenharmony_ci#define XMTPSIZE_TRIPLE 0x30 5368c2ecf20Sopenharmony_ci#define XMTPSIZE_REDUNDANT 0x60 5378c2ecf20Sopenharmony_ci#define XMTPSIZE_INF 0 5388c2ecf20Sopenharmony_ci 5398c2ecf20Sopenharmony_ci#define XMTCONTEN 0x04 5408c2ecf20Sopenharmony_ci#define XMTPFRM 0x02 /* Transmit at the next frame boundary */ 5418c2ecf20Sopenharmony_ci#define XMTPIMM 0x01 /* Transmit immediately */ 5428c2ecf20Sopenharmony_ci 5438c2ecf20Sopenharmony_ci __le16 _r_a; 5448c2ecf20Sopenharmony_ci u8 prim[4]; /* K, D0, D1, D2 */ 5458c2ecf20Sopenharmony_ci u8 _r_b[50]; 5468c2ecf20Sopenharmony_ci __le16 conn_handle; 5478c2ecf20Sopenharmony_ci u8 _r_c[56]; 5488c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 5498c2ecf20Sopenharmony_ci 5508c2ecf20Sopenharmony_ci/* This describes both SSP Target Get Data and SSP Target Get Data And 5518c2ecf20Sopenharmony_ci * Send Good Response SCBs. Used when the sequencer is operating in 5528c2ecf20Sopenharmony_ci * target mode... 5538c2ecf20Sopenharmony_ci */ 5548c2ecf20Sopenharmony_cistruct ssp_targ_get_data { 5558c2ecf20Sopenharmony_ci u8 proto_conn_rate; 5568c2ecf20Sopenharmony_ci __le32 total_xfer_len; 5578c2ecf20Sopenharmony_ci struct ssp_frame_hdr ssp_frame; 5588c2ecf20Sopenharmony_ci struct xfer_rdy_iu xfer_rdy; 5598c2ecf20Sopenharmony_ci u8 lun[LUN_SIZE]; 5608c2ecf20Sopenharmony_ci __le64 _r_a; 5618c2ecf20Sopenharmony_ci __le16 sister_scb; 5628c2ecf20Sopenharmony_ci __le16 conn_handle; 5638c2ecf20Sopenharmony_ci u8 data_dir; /* 01b */ 5648c2ecf20Sopenharmony_ci u8 _r_b; 5658c2ecf20Sopenharmony_ci u8 retry_count; 5668c2ecf20Sopenharmony_ci u8 _r_c[5]; 5678c2ecf20Sopenharmony_ci struct sg_el sg_element[3]; 5688c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 5698c2ecf20Sopenharmony_ci 5708c2ecf20Sopenharmony_ci/* ---------- The actual SCB struct ---------- */ 5718c2ecf20Sopenharmony_ci 5728c2ecf20Sopenharmony_cistruct scb { 5738c2ecf20Sopenharmony_ci struct scb_header header; 5748c2ecf20Sopenharmony_ci union { 5758c2ecf20Sopenharmony_ci struct initiate_ssp_task ssp_task; 5768c2ecf20Sopenharmony_ci struct initiate_ata_task ata_task; 5778c2ecf20Sopenharmony_ci struct initiate_smp_task smp_task; 5788c2ecf20Sopenharmony_ci struct control_phy control_phy; 5798c2ecf20Sopenharmony_ci struct control_ata_dev control_ata_dev; 5808c2ecf20Sopenharmony_ci struct empty_scb escb; 5818c2ecf20Sopenharmony_ci struct initiate_link_adm link_adm; 5828c2ecf20Sopenharmony_ci struct copy_memory cp_mem; 5838c2ecf20Sopenharmony_ci struct abort_task abort_task; 5848c2ecf20Sopenharmony_ci struct clear_nexus clear_nexus; 5858c2ecf20Sopenharmony_ci struct initiate_ssp_tmf ssp_tmf; 5868c2ecf20Sopenharmony_ci }; 5878c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 5888c2ecf20Sopenharmony_ci 5898c2ecf20Sopenharmony_ci/* ---------- Done List ---------- */ 5908c2ecf20Sopenharmony_ci/* The done list entry opcode field is defined below. 5918c2ecf20Sopenharmony_ci * The mnemonic encoding and meaning is as follows: 5928c2ecf20Sopenharmony_ci * TC - Task Complete, status was received and acknowledged 5938c2ecf20Sopenharmony_ci * TF - Task Failed, indicates an error prior to receiving acknowledgment 5948c2ecf20Sopenharmony_ci * for the command: 5958c2ecf20Sopenharmony_ci * - no conn, 5968c2ecf20Sopenharmony_ci * - NACK or R_ERR received in response to this command, 5978c2ecf20Sopenharmony_ci * - credit blocked or not available, or in the case of SMP request, 5988c2ecf20Sopenharmony_ci * - no SMP response was received. 5998c2ecf20Sopenharmony_ci * In these four cases it is known that the target didn't receive the 6008c2ecf20Sopenharmony_ci * command. 6018c2ecf20Sopenharmony_ci * TI - Task Interrupted, error after the command was acknowledged. It is 6028c2ecf20Sopenharmony_ci * known that the command was received by the target. 6038c2ecf20Sopenharmony_ci * TU - Task Unacked, command was transmitted but neither ACK (R_OK) nor NAK 6048c2ecf20Sopenharmony_ci * (R_ERR) was received due to loss of signal, broken connection, loss of 6058c2ecf20Sopenharmony_ci * dword sync or other reason. The application client should send the 6068c2ecf20Sopenharmony_ci * appropriate task query. 6078c2ecf20Sopenharmony_ci * TA - Task Aborted, see TF. 6088c2ecf20Sopenharmony_ci * _RESP - The completion includes an empty buffer containing status. 6098c2ecf20Sopenharmony_ci * TO - Timeout. 6108c2ecf20Sopenharmony_ci */ 6118c2ecf20Sopenharmony_ci#define TC_NO_ERROR 0x00 6128c2ecf20Sopenharmony_ci#define TC_UNDERRUN 0x01 6138c2ecf20Sopenharmony_ci#define TC_OVERRUN 0x02 6148c2ecf20Sopenharmony_ci#define TF_OPEN_TO 0x03 6158c2ecf20Sopenharmony_ci#define TF_OPEN_REJECT 0x04 6168c2ecf20Sopenharmony_ci#define TI_BREAK 0x05 6178c2ecf20Sopenharmony_ci#define TI_PROTO_ERR 0x06 6188c2ecf20Sopenharmony_ci#define TC_SSP_RESP 0x07 6198c2ecf20Sopenharmony_ci#define TI_PHY_DOWN 0x08 6208c2ecf20Sopenharmony_ci#define TF_PHY_DOWN 0x09 6218c2ecf20Sopenharmony_ci#define TC_LINK_ADM_RESP 0x0a 6228c2ecf20Sopenharmony_ci#define TC_CSMI 0x0b 6238c2ecf20Sopenharmony_ci#define TC_ATA_RESP 0x0c 6248c2ecf20Sopenharmony_ci#define TU_PHY_DOWN 0x0d 6258c2ecf20Sopenharmony_ci#define TU_BREAK 0x0e 6268c2ecf20Sopenharmony_ci#define TI_SATA_TO 0x0f 6278c2ecf20Sopenharmony_ci#define TI_NAK 0x10 6288c2ecf20Sopenharmony_ci#define TC_CONTROL_PHY 0x11 6298c2ecf20Sopenharmony_ci#define TF_BREAK 0x12 6308c2ecf20Sopenharmony_ci#define TC_RESUME 0x13 6318c2ecf20Sopenharmony_ci#define TI_ACK_NAK_TO 0x14 6328c2ecf20Sopenharmony_ci#define TF_SMPRSP_TO 0x15 6338c2ecf20Sopenharmony_ci#define TF_SMP_XMIT_RCV_ERR 0x16 6348c2ecf20Sopenharmony_ci#define TC_PARTIAL_SG_LIST 0x17 6358c2ecf20Sopenharmony_ci#define TU_ACK_NAK_TO 0x18 6368c2ecf20Sopenharmony_ci#define TU_SATA_TO 0x19 6378c2ecf20Sopenharmony_ci#define TF_NAK_RECV 0x1a 6388c2ecf20Sopenharmony_ci#define TA_I_T_NEXUS_LOSS 0x1b 6398c2ecf20Sopenharmony_ci#define TC_ATA_R_ERR_RECV 0x1c 6408c2ecf20Sopenharmony_ci#define TF_TMF_NO_CTX 0x1d 6418c2ecf20Sopenharmony_ci#define TA_ON_REQ 0x1e 6428c2ecf20Sopenharmony_ci#define TF_TMF_NO_TAG 0x1f 6438c2ecf20Sopenharmony_ci#define TF_TMF_TAG_FREE 0x20 6448c2ecf20Sopenharmony_ci#define TF_TMF_TASK_DONE 0x21 6458c2ecf20Sopenharmony_ci#define TF_TMF_NO_CONN_HANDLE 0x22 6468c2ecf20Sopenharmony_ci#define TC_TASK_CLEARED 0x23 6478c2ecf20Sopenharmony_ci#define TI_SYNCS_RECV 0x24 6488c2ecf20Sopenharmony_ci#define TU_SYNCS_RECV 0x25 6498c2ecf20Sopenharmony_ci#define TF_IRTT_TO 0x26 6508c2ecf20Sopenharmony_ci#define TF_NO_SMP_CONN 0x27 6518c2ecf20Sopenharmony_ci#define TF_IU_SHORT 0x28 6528c2ecf20Sopenharmony_ci#define TF_DATA_OFFS_ERR 0x29 6538c2ecf20Sopenharmony_ci#define TF_INV_CONN_HANDLE 0x2a 6548c2ecf20Sopenharmony_ci#define TF_REQUESTED_N_PENDING 0x2b 6558c2ecf20Sopenharmony_ci 6568c2ecf20Sopenharmony_ci/* 0xc1 - 0xc7: empty buffer received, 6578c2ecf20Sopenharmony_ci 0xd1 - 0xd7: establish nexus empty buffer received 6588c2ecf20Sopenharmony_ci*/ 6598c2ecf20Sopenharmony_ci/* This is the ESCB mask */ 6608c2ecf20Sopenharmony_ci#define ESCB_RECVD 0xC0 6618c2ecf20Sopenharmony_ci 6628c2ecf20Sopenharmony_ci 6638c2ecf20Sopenharmony_ci/* This struct done_list_struct defines the done list entry. 6648c2ecf20Sopenharmony_ci * All fields are LE. 6658c2ecf20Sopenharmony_ci */ 6668c2ecf20Sopenharmony_cistruct done_list_struct { 6678c2ecf20Sopenharmony_ci __le16 index; /* aka transaction context */ 6688c2ecf20Sopenharmony_ci u8 opcode; 6698c2ecf20Sopenharmony_ci u8 status_block[4]; 6708c2ecf20Sopenharmony_ci u8 toggle; /* bit 0 */ 6718c2ecf20Sopenharmony_ci#define DL_TOGGLE_MASK 0x01 6728c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 6738c2ecf20Sopenharmony_ci 6748c2ecf20Sopenharmony_ci/* ---------- PHYS ---------- */ 6758c2ecf20Sopenharmony_ci 6768c2ecf20Sopenharmony_cistruct asd_phy { 6778c2ecf20Sopenharmony_ci struct asd_sas_phy sas_phy; 6788c2ecf20Sopenharmony_ci struct asd_phy_desc *phy_desc; /* hw profile */ 6798c2ecf20Sopenharmony_ci 6808c2ecf20Sopenharmony_ci struct sas_identify_frame *identify_frame; 6818c2ecf20Sopenharmony_ci struct asd_dma_tok *id_frm_tok; 6828c2ecf20Sopenharmony_ci struct asd_port *asd_port; 6838c2ecf20Sopenharmony_ci 6848c2ecf20Sopenharmony_ci u8 frame_rcvd[ASD_EDB_SIZE]; 6858c2ecf20Sopenharmony_ci}; 6868c2ecf20Sopenharmony_ci 6878c2ecf20Sopenharmony_ci 6888c2ecf20Sopenharmony_ci#define ASD_SCB_SIZE sizeof(struct scb) 6898c2ecf20Sopenharmony_ci#define ASD_DDB_SIZE sizeof(struct asd_ddb_ssp_smp_target_port) 6908c2ecf20Sopenharmony_ci 6918c2ecf20Sopenharmony_ci/* Define this to 0 if you do not want NOTIFY (ENABLE SPINIP) sent. 6928c2ecf20Sopenharmony_ci * Default: 0x10 (it's a mask) 6938c2ecf20Sopenharmony_ci */ 6948c2ecf20Sopenharmony_ci#define ASD_NOTIFY_ENABLE_SPINUP 0x10 6958c2ecf20Sopenharmony_ci 6968c2ecf20Sopenharmony_ci/* If enabled, set this to the interval between transmission 6978c2ecf20Sopenharmony_ci * of NOTIFY (ENABLE SPINUP). In units of 200 us. 6988c2ecf20Sopenharmony_ci */ 6998c2ecf20Sopenharmony_ci#define ASD_NOTIFY_TIMEOUT 2500 7008c2ecf20Sopenharmony_ci 7018c2ecf20Sopenharmony_ci/* Initial delay after OOB, before we transmit NOTIFY (ENABLE SPINUP). 7028c2ecf20Sopenharmony_ci * If 0, transmit immediately. In milliseconds. 7038c2ecf20Sopenharmony_ci */ 7048c2ecf20Sopenharmony_ci#define ASD_NOTIFY_DOWN_COUNT 0 7058c2ecf20Sopenharmony_ci 7068c2ecf20Sopenharmony_ci/* Device present timer timeout constant, 10 ms. */ 7078c2ecf20Sopenharmony_ci#define ASD_DEV_PRESENT_TIMEOUT 0x2710 7088c2ecf20Sopenharmony_ci 7098c2ecf20Sopenharmony_ci#define ASD_SATA_INTERLOCK_TIMEOUT 0 7108c2ecf20Sopenharmony_ci 7118c2ecf20Sopenharmony_ci/* How long to wait before shutting down an STP connection, unless 7128c2ecf20Sopenharmony_ci * an STP target sent frame(s). 50 usec. 7138c2ecf20Sopenharmony_ci * IGNORED by the sequencer (i.e. value 0 always). 7148c2ecf20Sopenharmony_ci */ 7158c2ecf20Sopenharmony_ci#define ASD_STP_SHUTDOWN_TIMEOUT 0x0 7168c2ecf20Sopenharmony_ci 7178c2ecf20Sopenharmony_ci/* ATA soft reset timer timeout. 5 usec. */ 7188c2ecf20Sopenharmony_ci#define ASD_SRST_ASSERT_TIMEOUT 0x05 7198c2ecf20Sopenharmony_ci 7208c2ecf20Sopenharmony_ci/* 31 sec */ 7218c2ecf20Sopenharmony_ci#define ASD_RCV_FIS_TIMEOUT 0x01D905C0 7228c2ecf20Sopenharmony_ci 7238c2ecf20Sopenharmony_ci#define ASD_ONE_MILLISEC_TIMEOUT 0x03e8 7248c2ecf20Sopenharmony_ci 7258c2ecf20Sopenharmony_ci/* COMINIT timer */ 7268c2ecf20Sopenharmony_ci#define ASD_TEN_MILLISEC_TIMEOUT 0x2710 7278c2ecf20Sopenharmony_ci#define ASD_COMINIT_TIMEOUT ASD_TEN_MILLISEC_TIMEOUT 7288c2ecf20Sopenharmony_ci 7298c2ecf20Sopenharmony_ci/* 1 sec */ 7308c2ecf20Sopenharmony_ci#define ASD_SMP_RCV_TIMEOUT 0x000F4240 7318c2ecf20Sopenharmony_ci 7328c2ecf20Sopenharmony_ci#endif 733