Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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