/* SPDX-License-Identifier: GPL-2.0-only */ /* * Aic94xx SAS/SATA driver SAS definitions and hardware interface header file. * * Copyright (C) 2005 Adaptec, Inc. All rights reserved. * Copyright (C) 2005 Luben Tuikov <[email protected]> */ #ifndef _AIC94XX_SAS_H_ #define _AIC94XX_SAS_H_ #include <scsi/libsas.h> /* ---------- DDBs ---------- */ /* DDBs are device descriptor blocks which describe a device in the * domain that this sequencer can maintain low-level connections for * us. They are be 64 bytes. */ #define ASD_MAX_DDBS … struct asd_ddb_ssp_smp_target_port { … } __attribute__ ((packed)); struct asd_ddb_stp_sata_target_port { … } __attribute__ ((packed)); /* This struct asd_ddb_init_port, describes the device descriptor block * of an initiator port (when the sequencer is operating in target mode). * Bytes [0,11] and [20,27] are from the OPEN address frame. * The sequencer allocates an initiator port DDB entry. */ struct asd_ddb_init_port { … } __attribute__ ((packed)); /* This struct asd_ddb_sata_tag, describes a look-up table to be used * by the sequencers. SATA II, IDENTIFY DEVICE data, word 76, bit 8: * NCQ support. This table is used by the sequencers to find the * corresponding SCB, given a SATA II tag value. */ struct asd_ddb_sata_tag { … } __attribute__ ((packed)); /* This struct asd_ddb_sata_pm_table, describes a port number to * connection handle look-up table. SATA targets attached to a port * multiplier require a 4-bit port number value. There is one DDB * entry of this type for each SATA port multiplier (sister DDB). * Given a SATA PM port number, this table gives us the SATA PM Port * DDB of the SATA port multiplier port (i.e. the SATA target * discovered on the port). */ struct asd_ddb_sata_pm_table { … } __attribute__ ((packed)); /* This struct asd_ddb_sata_pm_port, describes the SATA port multiplier * port format DDB. */ struct asd_ddb_sata_pm_port { … } __attribute__ ((packed)); /* This struct asd_ddb_seq_shared, describes a DDB shared by the * central and link sequencers. port_map_by_links is indexed phy * number [0,7]; each byte is a bit mask of all the phys that are in * the same port as the indexed phy. */ struct asd_ddb_seq_shared { … } __attribute__ ((packed)); /* ---------- SG Element ---------- */ /* This struct sg_el, describes the hardware scatter gather buffer * element. All entries are little endian. In an SCB, there are 2 of * this, plus one more, called a link element of this indicating a * sublist if needed. * * A link element has only the bus address set and the flags (DS) bit * valid. The bus address points to the start of the sublist. * * If a sublist is needed, then that sublist should also include the 2 * sg_el embedded in the SCB, in which case next_sg_offset is 32, * since sizeof(sg_el) = 16; EOS should be 1 and EOL 0 in this case. */ struct sg_el { … } __attribute__ ((packed)); /* ---------- SCBs ---------- */ /* An SCB (sequencer control block) is comprised of a common header * and a task part, for a total of 128 bytes. All fields are in LE * order, unless otherwise noted. */ /* This struct scb_header, defines the SCB header format. */ struct scb_header { … } __attribute__ ((packed)); /* SCB opcodes: Execution queue */ #define INITIATE_SSP_TASK … #define INITIATE_LONG_SSP_TASK … #define INITIATE_BIDIR_SSP_TASK … #define SCB_ABORT_TASK … #define INITIATE_SSP_TMF … #define SSP_TARG_GET_DATA … #define SSP_TARG_GET_DATA_GOOD … #define SSP_TARG_SEND_RESP … #define QUERY_SSP_TASK … #define INITIATE_ATA_TASK … #define INITIATE_ATAPI_TASK … #define CONTROL_ATA_DEV … #define INITIATE_SMP_TASK … #define SMP_TARG_SEND_RESP … /* SCB opcodes: Send Queue */ #define SSP_TARG_SEND_DATA … #define SSP_TARG_SEND_DATA_GOOD … /* SCB opcodes: Link Queue */ #define CONTROL_PHY … #define SEND_PRIMITIVE … #define INITIATE_LINK_ADM_TASK … /* SCB opcodes: other */ #define EMPTY_SCB … #define INITIATE_SEQ_ADM_TASK … #define EST_ICL_TARG_WINDOW … #define COPY_MEM … #define CLEAR_NEXUS … #define INITIATE_DDB_ADM_TASK … #define ESTABLISH_NEXUS_ESCB … #define LUN_SIZE … #define EFB_MASK … #define TASK_PRIO_MASK … #define TASK_ATTR_MASK … /* ---------- SCB tasks ---------- */ /* This is both ssp_task and long_ssp_task */ struct initiate_ssp_task { … } __attribute__ ((packed)); /* This defines both ata_task and atapi_task. * ata: C bit of FIS should be 1, * atapi: C bit of FIS should be 1, and command register should be 0xA0, * to indicate a packet command. */ struct initiate_ata_task { … } __attribute__ ((packed)); struct initiate_smp_task { … } __attribute__ ((packed)); struct control_phy { … } __attribute__ ((packed)); struct control_ata_dev { … } __attribute__ ((packed)); struct empty_scb { … } __attribute__ ((packed)); struct initiate_link_adm { … } __attribute__ ((packed)); struct copy_memory { … } __attribute__ ((packed)); struct abort_task { … } __attribute__ ((packed)); struct clear_nexus { … } __attribute__ ((packed)); struct initiate_ssp_tmf { … } __attribute__ ((packed)); /* Transmits an arbitrary primitive on the link. * Used for NOTIFY and BROADCAST. */ struct send_prim { … } __attribute__ ((packed)); /* This describes both SSP Target Get Data and SSP Target Get Data And * Send Good Response SCBs. Used when the sequencer is operating in * target mode... */ struct ssp_targ_get_data { … } __attribute__ ((packed)); /* ---------- The actual SCB struct ---------- */ struct scb { … } __attribute__ ((packed)); /* ---------- Done List ---------- */ /* The done list entry opcode field is defined below. * The mnemonic encoding and meaning is as follows: * TC - Task Complete, status was received and acknowledged * TF - Task Failed, indicates an error prior to receiving acknowledgment * for the command: * - no conn, * - NACK or R_ERR received in response to this command, * - credit blocked or not available, or in the case of SMP request, * - no SMP response was received. * In these four cases it is known that the target didn't receive the * command. * TI - Task Interrupted, error after the command was acknowledged. It is * known that the command was received by the target. * TU - Task Unacked, command was transmitted but neither ACK (R_OK) nor NAK * (R_ERR) was received due to loss of signal, broken connection, loss of * dword sync or other reason. The application client should send the * appropriate task query. * TA - Task Aborted, see TF. * _RESP - The completion includes an empty buffer containing status. * TO - Timeout. */ #define TC_NO_ERROR … #define TC_UNDERRUN … #define TC_OVERRUN … #define TF_OPEN_TO … #define TF_OPEN_REJECT … #define TI_BREAK … #define TI_PROTO_ERR … #define TC_SSP_RESP … #define TI_PHY_DOWN … #define TF_PHY_DOWN … #define TC_LINK_ADM_RESP … #define TC_CSMI … #define TC_ATA_RESP … #define TU_PHY_DOWN … #define TU_BREAK … #define TI_SATA_TO … #define TI_NAK … #define TC_CONTROL_PHY … #define TF_BREAK … #define TC_RESUME … #define TI_ACK_NAK_TO … #define TF_SMPRSP_TO … #define TF_SMP_XMIT_RCV_ERR … #define TC_PARTIAL_SG_LIST … #define TU_ACK_NAK_TO … #define TU_SATA_TO … #define TF_NAK_RECV … #define TA_I_T_NEXUS_LOSS … #define TC_ATA_R_ERR_RECV … #define TF_TMF_NO_CTX … #define TA_ON_REQ … #define TF_TMF_NO_TAG … #define TF_TMF_TAG_FREE … #define TF_TMF_TASK_DONE … #define TF_TMF_NO_CONN_HANDLE … #define TC_TASK_CLEARED … #define TI_SYNCS_RECV … #define TU_SYNCS_RECV … #define TF_IRTT_TO … #define TF_NO_SMP_CONN … #define TF_IU_SHORT … #define TF_DATA_OFFS_ERR … #define TF_INV_CONN_HANDLE … #define TF_REQUESTED_N_PENDING … /* 0xc1 - 0xc7: empty buffer received, 0xd1 - 0xd7: establish nexus empty buffer received */ /* This is the ESCB mask */ #define ESCB_RECVD … /* This struct done_list_struct defines the done list entry. * All fields are LE. */ struct done_list_struct { … } __attribute__ ((packed)); /* ---------- PHYS ---------- */ struct asd_phy { … }; #define ASD_SCB_SIZE … #define ASD_DDB_SIZE … /* Define this to 0 if you do not want NOTIFY (ENABLE SPINIP) sent. * Default: 0x10 (it's a mask) */ #define ASD_NOTIFY_ENABLE_SPINUP … /* If enabled, set this to the interval between transmission * of NOTIFY (ENABLE SPINUP). In units of 200 us. */ #define ASD_NOTIFY_TIMEOUT … /* Initial delay after OOB, before we transmit NOTIFY (ENABLE SPINUP). * If 0, transmit immediately. In milliseconds. */ #define ASD_NOTIFY_DOWN_COUNT … /* Device present timer timeout constant, 10 ms. */ #define ASD_DEV_PRESENT_TIMEOUT … #define ASD_SATA_INTERLOCK_TIMEOUT … /* How long to wait before shutting down an STP connection, unless * an STP target sent frame(s). 50 usec. * IGNORED by the sequencer (i.e. value 0 always). */ #define ASD_STP_SHUTDOWN_TIMEOUT … /* ATA soft reset timer timeout. 5 usec. */ #define ASD_SRST_ASSERT_TIMEOUT … /* 31 sec */ #define ASD_RCV_FIS_TIMEOUT … #define ASD_ONE_MILLISEC_TIMEOUT … /* COMINIT timer */ #define ASD_TEN_MILLISEC_TIMEOUT … #define ASD_COMINIT_TIMEOUT … /* 1 sec */ #define ASD_SMP_RCV_TIMEOUT … #endif