Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is provided under a dual BSD/GPLv2 license.  When using or
0003  * redistributing this file, you may do so under either license.
0004  *
0005  * GPL LICENSE SUMMARY
0006  *
0007  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
0008  *
0009  * This program is free software; you can redistribute it and/or modify
0010  * it under the terms of version 2 of the GNU General Public License as
0011  * published by the Free Software Foundation.
0012  *
0013  * This program is distributed in the hope that it will be useful, but
0014  * WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU General Public License
0019  * along with this program; if not, write to the Free Software
0020  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
0021  * The full GNU General Public License is included in this distribution
0022  * in the file called LICENSE.GPL.
0023  *
0024  * BSD LICENSE
0025  *
0026  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
0027  * All rights reserved.
0028  *
0029  * Redistribution and use in source and binary forms, with or without
0030  * modification, are permitted provided that the following conditions
0031  * are met:
0032  *
0033  *   * Redistributions of source code must retain the above copyright
0034  *     notice, this list of conditions and the following disclaimer.
0035  *   * Redistributions in binary form must reproduce the above copyright
0036  *     notice, this list of conditions and the following disclaimer in
0037  *     the documentation and/or other materials provided with the
0038  *     distribution.
0039  *   * Neither the name of Intel Corporation nor the names of its
0040  *     contributors may be used to endorse or promote products derived
0041  *     from this software without specific prior written permission.
0042  *
0043  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0044  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0045  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0046  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0047  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0048  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0049  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0050  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0051  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0052  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0053  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0054  */
0055 
0056 #ifndef _SCU_TASK_CONTEXT_H_
0057 #define _SCU_TASK_CONTEXT_H_
0058 
0059 /**
0060  * This file contains the structures and constants for the SCU hardware task
0061  *    context.
0062  *
0063  *
0064  */
0065 
0066 
0067 /**
0068  * enum scu_ssp_task_type - This enumberation defines the various SSP task
0069  *    types the SCU hardware will accept. The definition for the various task
0070  *    types the SCU hardware will accept can be found in the DS specification.
0071  *
0072  *
0073  */
0074 typedef enum {
0075     SCU_TASK_TYPE_IOREAD,           /* /< IO READ direction or no direction */
0076     SCU_TASK_TYPE_IOWRITE,          /* /< IO Write direction */
0077     SCU_TASK_TYPE_SMP_REQUEST,      /* /< SMP Request type */
0078     SCU_TASK_TYPE_RESPONSE,         /* /< Driver generated response frame (targt mode) */
0079     SCU_TASK_TYPE_RAW_FRAME,        /* /< Raw frame request type */
0080     SCU_TASK_TYPE_PRIMITIVE         /* /< Request for a primitive to be transmitted */
0081 } scu_ssp_task_type;
0082 
0083 /**
0084  * enum scu_sata_task_type - This enumeration defines the various SATA task
0085  *    types the SCU hardware will accept. The definition for the various task
0086  *    types the SCU hardware will accept can be found in the DS specification.
0087  *
0088  *
0089  */
0090 typedef enum {
0091     SCU_TASK_TYPE_DMA_IN,           /* /< Read request */
0092     SCU_TASK_TYPE_FPDMAQ_READ,      /* /< NCQ read request */
0093     SCU_TASK_TYPE_PACKET_DMA_IN,    /* /< Packet read request */
0094     SCU_TASK_TYPE_SATA_RAW_FRAME,   /* /< Raw frame request */
0095     RESERVED_4,
0096     RESERVED_5,
0097     RESERVED_6,
0098     RESERVED_7,
0099     SCU_TASK_TYPE_DMA_OUT,          /* /< Write request */
0100     SCU_TASK_TYPE_FPDMAQ_WRITE,     /* /< NCQ write Request */
0101     SCU_TASK_TYPE_PACKET_DMA_OUT    /* /< Packet write request */
0102 } scu_sata_task_type;
0103 
0104 
0105 /**
0106  *
0107  *
0108  * SCU_CONTEXT_TYPE
0109  */
0110 #define SCU_TASK_CONTEXT_TYPE  0
0111 #define SCU_RNC_CONTEXT_TYPE   1
0112 
0113 /**
0114  *
0115  *
0116  * SCU_TASK_CONTEXT_VALIDITY
0117  */
0118 #define SCU_TASK_CONTEXT_INVALID          0
0119 #define SCU_TASK_CONTEXT_VALID            1
0120 
0121 /**
0122  *
0123  *
0124  * SCU_COMMAND_CODE
0125  */
0126 #define SCU_COMMAND_CODE_INITIATOR_NEW_TASK   0
0127 #define SCU_COMMAND_CODE_ACTIVE_TASK          1
0128 #define SCU_COMMAND_CODE_PRIMITIVE_SEQ_TASK   2
0129 #define SCU_COMMAND_CODE_TARGET_RAW_FRAMES    3
0130 
0131 /**
0132  *
0133  *
0134  * SCU_TASK_PRIORITY
0135  */
0136 /**
0137  *
0138  *
0139  * This priority is used when there is no priority request for this request.
0140  */
0141 #define SCU_TASK_PRIORITY_NORMAL          0
0142 
0143 /**
0144  *
0145  *
0146  * This priority indicates that the task should be scheduled to the head of the
0147  * queue.  The task will NOT be executed if the TX is suspended for the remote
0148  * node.
0149  */
0150 #define SCU_TASK_PRIORITY_HEAD_OF_Q       1
0151 
0152 /**
0153  *
0154  *
0155  * This priority indicates that the task will be executed before all
0156  * SCU_TASK_PRIORITY_NORMAL and SCU_TASK_PRIORITY_HEAD_OF_Q tasks. The task
0157  * WILL be executed if the TX is suspended for the remote node.
0158  */
0159 #define SCU_TASK_PRIORITY_HIGH            2
0160 
0161 /**
0162  *
0163  *
0164  * This task priority is reserved and should not be used.
0165  */
0166 #define SCU_TASK_PRIORITY_RESERVED        3
0167 
0168 #define SCU_TASK_INITIATOR_MODE           1
0169 #define SCU_TASK_TARGET_MODE              0
0170 
0171 #define SCU_TASK_REGULAR                  0
0172 #define SCU_TASK_ABORTED                  1
0173 
0174 /* direction bit defintion */
0175 /**
0176  *
0177  *
0178  * SATA_DIRECTION
0179  */
0180 #define SCU_SATA_WRITE_DATA_DIRECTION     0
0181 #define SCU_SATA_READ_DATA_DIRECTION      1
0182 
0183 /**
0184  *
0185  *
0186  * SCU_COMMAND_CONTEXT_MACROS These macros provide the mask and shift
0187  * operations to construct the various SCU commands
0188  */
0189 #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_SHIFT           21
0190 #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_MASK            0x00E00000
0191 #define scu_get_command_request_type(x) \
0192     ((x) & SCU_CONTEXT_COMMAND_REQUEST_TYPE_MASK)
0193 
0194 #define SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_SHIFT        18
0195 #define SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_MASK         0x001C0000
0196 #define scu_get_command_request_subtype(x) \
0197     ((x) & SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_MASK)
0198 
0199 #define SCU_CONTEXT_COMMAND_REQUEST_FULLTYPE_MASK    \
0200     (\
0201         SCU_CONTEXT_COMMAND_REQUEST_TYPE_MASK         \
0202         | SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_MASK      \
0203     )
0204 #define scu_get_command_request_full_type(x) \
0205     ((x) & SCU_CONTEXT_COMMAND_REQUEST_FULLTYPE_MASK)
0206 
0207 #define SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT  16
0208 #define SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_MASK   0x00010000
0209 #define scu_get_command_protocl_engine_group(x) \
0210     ((x) & SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_MASK)
0211 
0212 #define SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT           12
0213 #define SCU_CONTEXT_COMMAND_LOGICAL_PORT_MASK            0x00007000
0214 #define scu_get_command_reqeust_logical_port(x) \
0215     ((x) & SCU_CONTEXT_COMMAND_LOGICAL_PORT_MASK)
0216 
0217 
0218 #define MAKE_SCU_CONTEXT_COMMAND_TYPE(type) \
0219     ((u32)(type) << SCU_CONTEXT_COMMAND_REQUEST_TYPE_SHIFT)
0220 
0221 /**
0222  * MAKE_SCU_CONTEXT_COMMAND_TYPE() -
0223  *
0224  * SCU_COMMAND_TYPES These constants provide the grouping of the different SCU
0225  * command types.
0226  */
0227 #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC    MAKE_SCU_CONTEXT_COMMAND_TYPE(0)
0228 #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_TC    MAKE_SCU_CONTEXT_COMMAND_TYPE(1)
0229 #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC   MAKE_SCU_CONTEXT_COMMAND_TYPE(2)
0230 #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC   MAKE_SCU_CONTEXT_COMMAND_TYPE(3)
0231 #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC  MAKE_SCU_CONTEXT_COMMAND_TYPE(6)
0232 
0233 #define MAKE_SCU_CONTEXT_COMMAND_REQUEST(type, command) \
0234     ((type) | ((command) << SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_SHIFT))
0235 
0236 /**
0237  *
0238  *
0239  * SCU_REQUEST_TYPES These constants are the various request types that can be
0240  * posted to the SCU hardware.
0241  */
0242 #define SCU_CONTEXT_COMMAND_REQUST_POST_TC \
0243     (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC, 0))
0244 
0245 #define SCU_CONTEXT_COMMAND_REQUEST_POST_TC_ABORT \
0246     (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC, 1))
0247 
0248 #define SCU_CONTEXT_COMMAND_REQUST_DUMP_TC \
0249     (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_TC, 0))
0250 
0251 #define SCU_CONTEXT_COMMAND_POST_RNC_32 \
0252     (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC, 0))
0253 
0254 #define SCU_CONTEXT_COMMAND_POST_RNC_96 \
0255     (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC, 1))
0256 
0257 #define SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE \
0258     (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC, 2))
0259 
0260 #define SCU_CONTEXT_COMMAND_DUMP_RNC_32 \
0261     (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC, 0))
0262 
0263 #define SCU_CONTEXT_COMMAND_DUMP_RNC_96 \
0264     (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC, 1))
0265 
0266 #define SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX \
0267     (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 0))
0268 
0269 #define SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX_RX \
0270     (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 1))
0271 
0272 #define SCU_CONTEXT_COMMAND_POST_RNC_RESUME \
0273     (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 2))
0274 
0275 #define SCU_CONTEXT_IT_NEXUS_LOSS_TIMER_ENABLE \
0276     (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 3))
0277 
0278 #define SCU_CONTEXT_IT_NEXUS_LOSS_TIMER_DISABLE \
0279     (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 4))
0280 
0281 /**
0282  *
0283  *
0284  * SCU_TASK_CONTEXT_PROTOCOL SCU Task context protocol types this is uesd to
0285  * program the SCU Task context protocol field in word 0x00.
0286  */
0287 #define SCU_TASK_CONTEXT_PROTOCOL_SMP    0x00
0288 #define SCU_TASK_CONTEXT_PROTOCOL_SSP    0x01
0289 #define SCU_TASK_CONTEXT_PROTOCOL_STP    0x02
0290 #define SCU_TASK_CONTEXT_PROTOCOL_NONE   0x07
0291 
0292 /**
0293  * struct ssp_task_context - This is the SCU hardware definition for an SSP
0294  *    request.
0295  *
0296  *
0297  */
0298 struct ssp_task_context {
0299     /* OFFSET 0x18 */
0300     u32 reserved00:24;
0301     u32 frame_type:8;
0302 
0303     /* OFFSET 0x1C */
0304     u32 reserved01;
0305 
0306     /* OFFSET 0x20 */
0307     u32 fill_bytes:2;
0308     u32 reserved02:6;
0309     u32 changing_data_pointer:1;
0310     u32 retransmit:1;
0311     u32 retry_data_frame:1;
0312     u32 tlr_control:2;
0313     u32 reserved03:19;
0314 
0315     /* OFFSET 0x24 */
0316     u32 uiRsvd4;
0317 
0318     /* OFFSET 0x28 */
0319     u32 target_port_transfer_tag:16;
0320     u32 tag:16;
0321 
0322     /* OFFSET 0x2C */
0323     u32 data_offset;
0324 };
0325 
0326 /**
0327  * struct stp_task_context - This is the SCU hardware definition for an STP
0328  *    request.
0329  *
0330  *
0331  */
0332 struct stp_task_context {
0333     /* OFFSET 0x18 */
0334     u32 fis_type:8;
0335     u32 pm_port:4;
0336     u32 reserved0:3;
0337     u32 control:1;
0338     u32 command:8;
0339     u32 features:8;
0340 
0341     /* OFFSET 0x1C */
0342     u32 reserved1;
0343 
0344     /* OFFSET 0x20 */
0345     u32 reserved2;
0346 
0347     /* OFFSET 0x24 */
0348     u32 reserved3;
0349 
0350     /* OFFSET 0x28 */
0351     u32 ncq_tag:5;
0352     u32 reserved4:27;
0353 
0354     /* OFFSET 0x2C */
0355     u32 data_offset; /* TODO: What is this used for? */
0356 };
0357 
0358 /**
0359  * struct smp_task_context - This is the SCU hardware definition for an SMP
0360  *    request.
0361  *
0362  *
0363  */
0364 struct smp_task_context {
0365     /* OFFSET 0x18 */
0366     u32 response_length:8;
0367     u32 function_result:8;
0368     u32 function:8;
0369     u32 frame_type:8;
0370 
0371     /* OFFSET 0x1C */
0372     u32 smp_response_ufi:12;
0373     u32 reserved1:20;
0374 
0375     /* OFFSET 0x20 */
0376     u32 reserved2;
0377 
0378     /* OFFSET 0x24 */
0379     u32 reserved3;
0380 
0381     /* OFFSET 0x28 */
0382     u32 reserved4;
0383 
0384     /* OFFSET 0x2C */
0385     u32 reserved5;
0386 };
0387 
0388 /**
0389  * struct primitive_task_context - This is the SCU hardware definition used
0390  *    when the driver wants to send a primitive on the link.
0391  *
0392  *
0393  */
0394 struct primitive_task_context {
0395     /* OFFSET 0x18 */
0396     /**
0397      * This field is the control word and it must be 0.
0398      */
0399     u32 control; /* /< must be set to 0 */
0400 
0401     /* OFFSET 0x1C */
0402     /**
0403      * This field specifies the primitive that is to be transmitted.
0404      */
0405     u32 sequence;
0406 
0407     /* OFFSET 0x20 */
0408     u32 reserved0;
0409 
0410     /* OFFSET 0x24 */
0411     u32 reserved1;
0412 
0413     /* OFFSET 0x28 */
0414     u32 reserved2;
0415 
0416     /* OFFSET 0x2C */
0417     u32 reserved3;
0418 };
0419 
0420 /**
0421  * The union of the protocols that can be selected in the SCU task context
0422  *    field.
0423  *
0424  * protocol_context
0425  */
0426 union protocol_context {
0427     struct ssp_task_context ssp;
0428     struct stp_task_context stp;
0429     struct smp_task_context smp;
0430     struct primitive_task_context primitive;
0431     u32 words[6];
0432 };
0433 
0434 /**
0435  * struct scu_sgl_element - This structure represents a single SCU defined SGL
0436  *    element. SCU SGLs contain a 64 bit address with the maximum data transfer
0437  *    being 24 bits in size.  The SGL can not cross a 4GB boundary.
0438  *
0439  * struct scu_sgl_element
0440  */
0441 struct scu_sgl_element {
0442     /**
0443      * This field is the upper 32 bits of the 64 bit physical address.
0444      */
0445     u32 address_upper;
0446 
0447     /**
0448      * This field is the lower 32 bits of the 64 bit physical address.
0449      */
0450     u32 address_lower;
0451 
0452     /**
0453      * This field is the number of bytes to transfer.
0454      */
0455     u32 length:24;
0456 
0457     /**
0458      * This field is the address modifier to be used when a virtual function is
0459      * requesting a data transfer.
0460      */
0461     u32 address_modifier:8;
0462 
0463 };
0464 
0465 #define SCU_SGL_ELEMENT_PAIR_A   0
0466 #define SCU_SGL_ELEMENT_PAIR_B   1
0467 
0468 /**
0469  * struct scu_sgl_element_pair - This structure is the SCU hardware definition
0470  *    of a pair of SGL elements. The SCU hardware always works on SGL pairs.
0471  *    They are refered to in the DS specification as SGL A and SGL B.  Each SGL
0472  *    pair is followed by the address of the next pair.
0473  *
0474  *
0475  */
0476 struct scu_sgl_element_pair {
0477     /* OFFSET 0x60-0x68 */
0478     /**
0479      * This field is the SGL element A of the SGL pair.
0480      */
0481     struct scu_sgl_element A;
0482 
0483     /* OFFSET 0x6C-0x74 */
0484     /**
0485      * This field is the SGL element B of the SGL pair.
0486      */
0487     struct scu_sgl_element B;
0488 
0489     /* OFFSET 0x78-0x7C */
0490     /**
0491      * This field is the upper 32 bits of the 64 bit address to the next SGL
0492      * element pair.
0493      */
0494     u32 next_pair_upper;
0495 
0496     /**
0497      * This field is the lower 32 bits of the 64 bit address to the next SGL
0498      * element pair.
0499      */
0500     u32 next_pair_lower;
0501 
0502 };
0503 
0504 /**
0505  * struct transport_snapshot - This structure is the SCU hardware scratch area
0506  *    for the task context. This is set to 0 by the driver but can be read by
0507  *    issuing a dump TC request to the SCU.
0508  *
0509  *
0510  */
0511 struct transport_snapshot {
0512     /* OFFSET 0x48 */
0513     u32 xfer_rdy_write_data_length;
0514 
0515     /* OFFSET 0x4C */
0516     u32 data_offset;
0517 
0518     /* OFFSET 0x50 */
0519     u32 data_transfer_size:24;
0520     u32 reserved_50_0:8;
0521 
0522     /* OFFSET 0x54 */
0523     u32 next_initiator_write_data_offset;
0524 
0525     /* OFFSET 0x58 */
0526     u32 next_initiator_write_data_xfer_size:24;
0527     u32 reserved_58_0:8;
0528 };
0529 
0530 /**
0531  * struct scu_task_context - This structure defines the contents of the SCU
0532  *    silicon task context. It lays out all of the fields according to the
0533  *    expected order and location for the Storage Controller unit.
0534  *
0535  *
0536  */
0537 struct scu_task_context {
0538     /* OFFSET 0x00 ------ */
0539     /**
0540      * This field must be encoded to one of the valid SCU task priority values
0541      *    - SCU_TASK_PRIORITY_NORMAL
0542      *    - SCU_TASK_PRIORITY_HEAD_OF_Q
0543      *    - SCU_TASK_PRIORITY_HIGH
0544      */
0545     u32 priority:2;
0546 
0547     /**
0548      * This field must be set to true if this is an initiator generated request.
0549      * Until target mode is supported all task requests are initiator requests.
0550      */
0551     u32 initiator_request:1;
0552 
0553     /**
0554      * This field must be set to one of the valid connection rates valid values
0555      * are 0x8, 0x9, and 0xA.
0556      */
0557     u32 connection_rate:4;
0558 
0559     /**
0560      * This field muse be programed when generating an SMP response since the SMP
0561      * connection remains open until the SMP response is generated.
0562      */
0563     u32 protocol_engine_index:3;
0564 
0565     /**
0566      * This field must contain the logical port for the task request.
0567      */
0568     u32 logical_port_index:3;
0569 
0570     /**
0571      * This field must be set to one of the SCU_TASK_CONTEXT_PROTOCOL values
0572      *    - SCU_TASK_CONTEXT_PROTOCOL_SMP
0573      *    - SCU_TASK_CONTEXT_PROTOCOL_SSP
0574      *    - SCU_TASK_CONTEXT_PROTOCOL_STP
0575      *    - SCU_TASK_CONTEXT_PROTOCOL_NONE
0576      */
0577     u32 protocol_type:3;
0578 
0579     /**
0580      * This filed must be set to the TCi allocated for this task
0581      */
0582     u32 task_index:12;
0583 
0584     /**
0585      * This field is reserved and must be set to 0x00
0586      */
0587     u32 reserved_00_0:1;
0588 
0589     /**
0590      * For a normal task request this must be set to 0.  If this is an abort of
0591      * this task request it must be set to 1.
0592      */
0593     u32 abort:1;
0594 
0595     /**
0596      * This field must be set to true for the SCU hardware to process the task.
0597      */
0598     u32 valid:1;
0599 
0600     /**
0601      * This field must be set to SCU_TASK_CONTEXT_TYPE
0602      */
0603     u32 context_type:1;
0604 
0605     /* OFFSET 0x04 */
0606     /**
0607      * This field contains the RNi that is the target of this request.
0608      */
0609     u32 remote_node_index:12;
0610 
0611     /**
0612      * This field is programmed if this is a mirrored request, which we are not
0613      * using, in which case it is the RNi for the mirrored target.
0614      */
0615     u32 mirrored_node_index:12;
0616 
0617     /**
0618      * This field is programmed with the direction of the SATA reqeust
0619      *    - SCU_SATA_WRITE_DATA_DIRECTION
0620      *    - SCU_SATA_READ_DATA_DIRECTION
0621      */
0622     u32 sata_direction:1;
0623 
0624     /**
0625      * This field is programmsed with one of the following SCU_COMMAND_CODE
0626      *    - SCU_COMMAND_CODE_INITIATOR_NEW_TASK
0627      *    - SCU_COMMAND_CODE_ACTIVE_TASK
0628      *    - SCU_COMMAND_CODE_PRIMITIVE_SEQ_TASK
0629      *    - SCU_COMMAND_CODE_TARGET_RAW_FRAMES
0630      */
0631     u32 command_code:2;
0632 
0633     /**
0634      * This field is set to true if the remote node should be suspended.
0635      * This bit is only valid for SSP & SMP target devices.
0636      */
0637     u32 suspend_node:1;
0638 
0639     /**
0640      * This field is programmed with one of the following command type codes
0641      *
0642      * For SAS requests use the scu_ssp_task_type
0643      *    - SCU_TASK_TYPE_IOREAD
0644      *    - SCU_TASK_TYPE_IOWRITE
0645      *    - SCU_TASK_TYPE_SMP_REQUEST
0646      *    - SCU_TASK_TYPE_RESPONSE
0647      *    - SCU_TASK_TYPE_RAW_FRAME
0648      *    - SCU_TASK_TYPE_PRIMITIVE
0649      *
0650      * For SATA requests use the scu_sata_task_type
0651      *    - SCU_TASK_TYPE_DMA_IN
0652      *    - SCU_TASK_TYPE_FPDMAQ_READ
0653      *    - SCU_TASK_TYPE_PACKET_DMA_IN
0654      *    - SCU_TASK_TYPE_SATA_RAW_FRAME
0655      *    - SCU_TASK_TYPE_DMA_OUT
0656      *    - SCU_TASK_TYPE_FPDMAQ_WRITE
0657      *    - SCU_TASK_TYPE_PACKET_DMA_OUT
0658      */
0659     u32 task_type:4;
0660 
0661     /* OFFSET 0x08 */
0662     /**
0663      * This field is reserved and the must be set to 0x00
0664      */
0665     u32 link_layer_control:8; /* presently all reserved */
0666 
0667     /**
0668      * This field is set to true when TLR is to be enabled
0669      */
0670     u32 ssp_tlr_enable:1;
0671 
0672     /**
0673      * This is field specifies if the SCU DMAs a response frame to host
0674      * memory for good response frames when operating in target mode.
0675      */
0676     u32 dma_ssp_target_good_response:1;
0677 
0678     /**
0679      * This field indicates if the SCU should DMA the response frame to
0680      * host memory.
0681      */
0682     u32 do_not_dma_ssp_good_response:1;
0683 
0684     /**
0685      * This field is set to true when strict ordering is to be enabled
0686      */
0687     u32 strict_ordering:1;
0688 
0689     /**
0690      * This field indicates the type of endianess to be utilized for the
0691      * frame.  command, task, and response frames utilized control_frame
0692      * set to 1.
0693      */
0694     u32 control_frame:1;
0695 
0696     /**
0697      * This field is reserved and the driver should set to 0x00
0698      */
0699     u32 tl_control_reserved:3;
0700 
0701     /**
0702      * This field is set to true when the SCU hardware task timeout control is to
0703      * be enabled
0704      */
0705     u32 timeout_enable:1;
0706 
0707     /**
0708      * This field is reserved and the driver should set it to 0x00
0709      */
0710     u32 pts_control_reserved:7;
0711 
0712     /**
0713      * This field should be set to true when block guard is to be enabled
0714      */
0715     u32 block_guard_enable:1;
0716 
0717     /**
0718      * This field is reserved and the driver should set to 0x00
0719      */
0720     u32 sdma_control_reserved:7;
0721 
0722     /* OFFSET 0x0C */
0723     /**
0724      * This field is the address modifier for this io request it should be
0725      * programmed with the virtual function that is making the request.
0726      */
0727     u32 address_modifier:16;
0728 
0729     /**
0730      * @todo What we support mirrored SMP response frame?
0731      */
0732     u32 mirrored_protocol_engine:3;  /* mirrored protocol Engine Index */
0733 
0734     /**
0735      * If this is a mirrored request the logical port index for the mirrored RNi
0736      * must be programmed.
0737      */
0738     u32 mirrored_logical_port:4;  /* mirrored local port index */
0739 
0740     /**
0741      * This field is reserved and the driver must set it to 0x00
0742      */
0743     u32 reserved_0C_0:8;
0744 
0745     /**
0746      * This field must be set to true if the mirrored request processing is to be
0747      * enabled.
0748      */
0749     u32 mirror_request_enable:1;  /* Mirrored request Enable */
0750 
0751     /* OFFSET 0x10 */
0752     /**
0753      * This field is the command iu length in dwords
0754      */
0755     u32 ssp_command_iu_length:8;
0756 
0757     /**
0758      * This is the target TLR enable bit it must be set to 0 when creatning the
0759      * task context.
0760      */
0761     u32 xfer_ready_tlr_enable:1;
0762 
0763     /**
0764      * This field is reserved and the driver must set it to 0x00
0765      */
0766     u32 reserved_10_0:7;
0767 
0768     /**
0769      * This is the maximum burst size that the SCU hardware will send in one
0770      * connection its value is (N x 512) and N must be a multiple of 2.  If the
0771      * value is 0x00 then maximum burst size is disabled.
0772      */
0773     u32 ssp_max_burst_size:16;
0774 
0775     /* OFFSET 0x14 */
0776     /**
0777      * This filed is set to the number of bytes to be transfered in the request.
0778      */
0779     u32 transfer_length_bytes:24; /* In terms of bytes */
0780 
0781     /**
0782      * This field is reserved and the driver should set it to 0x00
0783      */
0784     u32 reserved_14_0:8;
0785 
0786     /* OFFSET 0x18-0x2C */
0787     /**
0788      * This union provides for the protocol specif part of the SCU Task Context.
0789      */
0790     union protocol_context type;
0791 
0792     /* OFFSET 0x30-0x34 */
0793     /**
0794      * This field is the upper 32 bits of the 64 bit physical address of the
0795      * command iu buffer
0796      */
0797     u32 command_iu_upper;
0798 
0799     /**
0800      * This field is the lower 32 bits of the 64 bit physical address of the
0801      * command iu buffer
0802      */
0803     u32 command_iu_lower;
0804 
0805     /* OFFSET 0x38-0x3C */
0806     /**
0807      * This field is the upper 32 bits of the 64 bit physical address of the
0808      * response iu buffer
0809      */
0810     u32 response_iu_upper;
0811 
0812     /**
0813      * This field is the lower 32 bits of the 64 bit physical address of the
0814      * response iu buffer
0815      */
0816     u32 response_iu_lower;
0817 
0818     /* OFFSET 0x40 */
0819     /**
0820      * This field is set to the task phase of the SCU hardware. The driver must
0821      * set this to 0x01
0822      */
0823     u32 task_phase:8;
0824 
0825     /**
0826      * This field is set to the transport layer task status.  The driver must set
0827      * this to 0x00
0828      */
0829     u32 task_status:8;
0830 
0831     /**
0832      * This field is used during initiator write TLR
0833      */
0834     u32 previous_extended_tag:4;
0835 
0836     /**
0837      * This field is set the maximum number of retries for a STP non-data FIS
0838      */
0839     u32 stp_retry_count:2;
0840 
0841     /**
0842      * This field is reserved and the driver must set it to 0x00
0843      */
0844     u32 reserved_40_1:2;
0845 
0846     /**
0847      * This field is used by the SCU TL to determine when to take a snapshot when
0848      * tranmitting read data frames.
0849      *    - 0x00 The entire IO
0850      *    - 0x01 32k
0851      *    - 0x02 64k
0852      *    - 0x04 128k
0853      *    - 0x08 256k
0854      */
0855     u32 ssp_tlr_threshold:4;
0856 
0857     /**
0858      * This field is reserved and the driver must set it to 0x00
0859      */
0860     u32 reserved_40_2:4;
0861 
0862     /* OFFSET 0x44 */
0863     u32 write_data_length; /* read only set to 0 */
0864 
0865     /* OFFSET 0x48-0x58 */
0866     struct transport_snapshot snapshot; /* read only set to 0 */
0867 
0868     /* OFFSET 0x5C */
0869     u32 blk_prot_en:1;
0870     u32 blk_sz:2;
0871     u32 blk_prot_func:2;
0872     u32 reserved_5C_0:9;
0873     u32 active_sgl_element:2;  /* read only set to 0 */
0874     u32 sgl_exhausted:1;  /* read only set to 0 */
0875     u32 payload_data_transfer_error:4;  /* read only set to 0 */
0876     u32 frame_buffer_offset:11; /* read only set to 0 */
0877 
0878     /* OFFSET 0x60-0x7C */
0879     /**
0880      * This field is the first SGL element pair found in the TC data structure.
0881      */
0882     struct scu_sgl_element_pair sgl_pair_ab;
0883     /* OFFSET 0x80-0x9C */
0884     /**
0885      * This field is the second SGL element pair found in the TC data structure.
0886      */
0887     struct scu_sgl_element_pair sgl_pair_cd;
0888 
0889     /* OFFSET 0xA0-BC */
0890     struct scu_sgl_element_pair sgl_snapshot_ac;
0891 
0892     /* OFFSET 0xC0 */
0893     u32 active_sgl_element_pair; /* read only set to 0 */
0894 
0895     /* OFFSET 0xC4-0xCC */
0896     u32 reserved_C4_CC[3];
0897 
0898     /* OFFSET 0xD0 */
0899     u32 interm_crc_val:16;
0900     u32 init_crc_seed:16;
0901 
0902     /* OFFSET 0xD4 */
0903     u32 app_tag_verify:16;
0904     u32 app_tag_gen:16;
0905 
0906     /* OFFSET 0xD8 */
0907     u32 ref_tag_seed_verify;
0908 
0909     /* OFFSET 0xDC */
0910     u32 UD_bytes_immed_val:13;
0911     u32 reserved_DC_0:3;
0912     u32 DIF_bytes_immed_val:4;
0913     u32 reserved_DC_1:12;
0914 
0915     /* OFFSET 0xE0 */
0916     u32 bgc_blk_sz:13;
0917     u32 reserved_E0_0:3;
0918     u32 app_tag_gen_mask:16;
0919 
0920     /* OFFSET 0xE4 */
0921     union {
0922         u16 bgctl;
0923         struct {
0924             u16 crc_verify:1;
0925             u16 app_tag_chk:1;
0926             u16 ref_tag_chk:1;
0927             u16 op:2;
0928             u16 legacy:1;
0929             u16 invert_crc_seed:1;
0930             u16 ref_tag_gen:1;
0931             u16 fixed_ref_tag:1;
0932             u16 invert_crc:1;
0933             u16 app_ref_f_detect:1;
0934             u16 uninit_dif_check_err:1;
0935             u16 uninit_dif_bypass:1;
0936             u16 app_f_detect:1;
0937             u16 reserved_0:2;
0938         } bgctl_f;
0939     };
0940 
0941     u16 app_tag_verify_mask;
0942 
0943     /* OFFSET 0xE8 */
0944     u32 blk_guard_err:8;
0945     u32 reserved_E8_0:24;
0946 
0947     /* OFFSET 0xEC */
0948     u32 ref_tag_seed_gen;
0949 
0950     /* OFFSET 0xF0 */
0951     u32 intermediate_crc_valid_snapshot:16;
0952     u32 reserved_F0_0:16;
0953 
0954     /* OFFSET 0xF4 */
0955     u32 reference_tag_seed_for_verify_function_snapshot;
0956 
0957     /* OFFSET 0xF8 */
0958     u32 snapshot_of_reserved_dword_DC_of_tc;
0959 
0960     /* OFFSET 0xFC */
0961     u32 reference_tag_seed_for_generate_function_snapshot;
0962 
0963 } __packed;
0964 
0965 #endif /* _SCU_TASK_CONTEXT_H_ */