brintos

brintos / linux-shallow public Read only

0
0
Text · 24.3 KiB · 582d22d Raw
966 lines · c
1/*2 * This file is provided under a dual BSD/GPLv2 license.  When using or3 * redistributing this file, you may do so under either license.4 *5 * GPL LICENSE SUMMARY6 *7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of version 2 of the GNU General Public License as11 * published by the Free Software Foundation.12 *13 * This program is distributed in the hope that it will be useful, but14 * WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU16 * General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.21 * The full GNU General Public License is included in this distribution22 * in the file called LICENSE.GPL.23 *24 * BSD LICENSE25 *26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.27 * All rights reserved.28 *29 * Redistribution and use in source and binary forms, with or without30 * modification, are permitted provided that the following conditions31 * are met:32 *33 *   * Redistributions of source code must retain the above copyright34 *     notice, this list of conditions and the following disclaimer.35 *   * Redistributions in binary form must reproduce the above copyright36 *     notice, this list of conditions and the following disclaimer in37 *     the documentation and/or other materials provided with the38 *     distribution.39 *   * Neither the name of Intel Corporation nor the names of its40 *     contributors may be used to endorse or promote products derived41 *     from this software without specific prior written permission.42 *43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS44 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT45 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR46 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT47 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,48 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT49 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,50 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY51 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.54 */55 56#ifndef _SCU_TASK_CONTEXT_H_57#define _SCU_TASK_CONTEXT_H_58 59/**60 * This file contains the structures and constants for the SCU hardware task61 *    context.62 *63 *64 */65 66 67/**68 * enum scu_ssp_task_type - This enumberation defines the various SSP task69 *    types the SCU hardware will accept. The definition for the various task70 *    types the SCU hardware will accept can be found in the DS specification.71 *72 *73 */74typedef enum {75	SCU_TASK_TYPE_IOREAD,           /* /< IO READ direction or no direction */76	SCU_TASK_TYPE_IOWRITE,          /* /< IO Write direction */77	SCU_TASK_TYPE_SMP_REQUEST,      /* /< SMP Request type */78	SCU_TASK_TYPE_RESPONSE,         /* /< Driver generated response frame (targt mode) */79	SCU_TASK_TYPE_RAW_FRAME,        /* /< Raw frame request type */80	SCU_TASK_TYPE_PRIMITIVE         /* /< Request for a primitive to be transmitted */81} scu_ssp_task_type;82 83/**84 * enum scu_sata_task_type - This enumeration defines the various SATA task85 *    types the SCU hardware will accept. The definition for the various task86 *    types the SCU hardware will accept can be found in the DS specification.87 *88 *89 */90typedef enum {91	SCU_TASK_TYPE_DMA_IN,           /* /< Read request */92	SCU_TASK_TYPE_FPDMAQ_READ,      /* /< NCQ read request */93	SCU_TASK_TYPE_PACKET_DMA_IN,    /* /< Packet read request */94	SCU_TASK_TYPE_SATA_RAW_FRAME,   /* /< Raw frame request */95	RESERVED_4,96	RESERVED_5,97	RESERVED_6,98	RESERVED_7,99	SCU_TASK_TYPE_DMA_OUT,          /* /< Write request */100	SCU_TASK_TYPE_FPDMAQ_WRITE,     /* /< NCQ write Request */101	SCU_TASK_TYPE_PACKET_DMA_OUT    /* /< Packet write request */102} scu_sata_task_type;103 104 105/**106 *107 *108 * SCU_CONTEXT_TYPE109 */110#define SCU_TASK_CONTEXT_TYPE  0111#define SCU_RNC_CONTEXT_TYPE   1112 113/**114 *115 *116 * SCU_TASK_CONTEXT_VALIDITY117 */118#define SCU_TASK_CONTEXT_INVALID          0119#define SCU_TASK_CONTEXT_VALID            1120 121/**122 *123 *124 * SCU_COMMAND_CODE125 */126#define SCU_COMMAND_CODE_INITIATOR_NEW_TASK   0127#define SCU_COMMAND_CODE_ACTIVE_TASK          1128#define SCU_COMMAND_CODE_PRIMITIVE_SEQ_TASK   2129#define SCU_COMMAND_CODE_TARGET_RAW_FRAMES    3130 131/**132 *133 *134 * SCU_TASK_PRIORITY135 */136/**137 *138 *139 * This priority is used when there is no priority request for this request.140 */141#define SCU_TASK_PRIORITY_NORMAL          0142 143/**144 *145 *146 * This priority indicates that the task should be scheduled to the head of the147 * queue.  The task will NOT be executed if the TX is suspended for the remote148 * node.149 */150#define SCU_TASK_PRIORITY_HEAD_OF_Q       1151 152/**153 *154 *155 * This priority indicates that the task will be executed before all156 * SCU_TASK_PRIORITY_NORMAL and SCU_TASK_PRIORITY_HEAD_OF_Q tasks. The task157 * WILL be executed if the TX is suspended for the remote node.158 */159#define SCU_TASK_PRIORITY_HIGH            2160 161/**162 *163 *164 * This task priority is reserved and should not be used.165 */166#define SCU_TASK_PRIORITY_RESERVED        3167 168#define SCU_TASK_INITIATOR_MODE           1169#define SCU_TASK_TARGET_MODE              0170 171#define SCU_TASK_REGULAR                  0172#define SCU_TASK_ABORTED                  1173 174/* direction bit defintion */175/**176 *177 *178 * SATA_DIRECTION179 */180#define SCU_SATA_WRITE_DATA_DIRECTION     0181#define SCU_SATA_READ_DATA_DIRECTION      1182 183/**184 *185 *186 * SCU_COMMAND_CONTEXT_MACROS These macros provide the mask and shift187 * operations to construct the various SCU commands188 */189#define SCU_CONTEXT_COMMAND_REQUEST_TYPE_SHIFT           21190#define SCU_CONTEXT_COMMAND_REQUEST_TYPE_MASK            0x00E00000191#define scu_get_command_request_type(x)	\192	((x) & SCU_CONTEXT_COMMAND_REQUEST_TYPE_MASK)193 194#define SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_SHIFT        18195#define SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_MASK         0x001C0000196#define scu_get_command_request_subtype(x) \197	((x) & SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_MASK)198 199#define SCU_CONTEXT_COMMAND_REQUEST_FULLTYPE_MASK	 \200	(\201		SCU_CONTEXT_COMMAND_REQUEST_TYPE_MASK		  \202		| SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_MASK	    \203	)204#define scu_get_command_request_full_type(x) \205	((x) & SCU_CONTEXT_COMMAND_REQUEST_FULLTYPE_MASK)206 207#define SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT  16208#define SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_MASK   0x00010000209#define scu_get_command_protocl_engine_group(x)	\210	((x) & SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_MASK)211 212#define SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT           12213#define SCU_CONTEXT_COMMAND_LOGICAL_PORT_MASK            0x00007000214#define scu_get_command_reqeust_logical_port(x)	\215	((x) & SCU_CONTEXT_COMMAND_LOGICAL_PORT_MASK)216 217 218#define MAKE_SCU_CONTEXT_COMMAND_TYPE(type) \219	((u32)(type) << SCU_CONTEXT_COMMAND_REQUEST_TYPE_SHIFT)220 221/**222 * MAKE_SCU_CONTEXT_COMMAND_TYPE() -223 *224 * SCU_COMMAND_TYPES These constants provide the grouping of the different SCU225 * command types.226 */227#define SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC    MAKE_SCU_CONTEXT_COMMAND_TYPE(0)228#define SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_TC    MAKE_SCU_CONTEXT_COMMAND_TYPE(1)229#define SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC   MAKE_SCU_CONTEXT_COMMAND_TYPE(2)230#define SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC   MAKE_SCU_CONTEXT_COMMAND_TYPE(3)231#define SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC  MAKE_SCU_CONTEXT_COMMAND_TYPE(6)232 233#define MAKE_SCU_CONTEXT_COMMAND_REQUEST(type, command)	\234	((type) | ((command) << SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_SHIFT))235 236/**237 *238 *239 * SCU_REQUEST_TYPES These constants are the various request types that can be240 * posted to the SCU hardware.241 */242#define SCU_CONTEXT_COMMAND_REQUST_POST_TC \243	(MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC, 0))244 245#define SCU_CONTEXT_COMMAND_REQUEST_POST_TC_ABORT \246	(MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC, 1))247 248#define SCU_CONTEXT_COMMAND_REQUST_DUMP_TC \249	(MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_TC, 0))250 251#define SCU_CONTEXT_COMMAND_POST_RNC_32	\252	(MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC, 0))253 254#define SCU_CONTEXT_COMMAND_POST_RNC_96	\255	(MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC, 1))256 257#define SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE	\258	(MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC, 2))259 260#define SCU_CONTEXT_COMMAND_DUMP_RNC_32	\261	(MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC, 0))262 263#define SCU_CONTEXT_COMMAND_DUMP_RNC_96	\264	(MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC, 1))265 266#define SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX	\267	(MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 0))268 269#define SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX_RX \270	(MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 1))271 272#define SCU_CONTEXT_COMMAND_POST_RNC_RESUME \273	(MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 2))274 275#define SCU_CONTEXT_IT_NEXUS_LOSS_TIMER_ENABLE \276	(MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 3))277 278#define SCU_CONTEXT_IT_NEXUS_LOSS_TIMER_DISABLE	\279	(MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 4))280 281/**282 *283 *284 * SCU_TASK_CONTEXT_PROTOCOL SCU Task context protocol types this is uesd to285 * program the SCU Task context protocol field in word 0x00.286 */287#define SCU_TASK_CONTEXT_PROTOCOL_SMP    0x00288#define SCU_TASK_CONTEXT_PROTOCOL_SSP    0x01289#define SCU_TASK_CONTEXT_PROTOCOL_STP    0x02290#define SCU_TASK_CONTEXT_PROTOCOL_NONE   0x07291 292/**293 * struct ssp_task_context - This is the SCU hardware definition for an SSP294 *    request.295 *296 *297 */298struct ssp_task_context {299	/* OFFSET 0x18 */300	u32 reserved00:24;301	u32 frame_type:8;302 303	/* OFFSET 0x1C */304	u32 reserved01;305 306	/* OFFSET 0x20 */307	u32 fill_bytes:2;308	u32 reserved02:6;309	u32 changing_data_pointer:1;310	u32 retransmit:1;311	u32 retry_data_frame:1;312	u32 tlr_control:2;313	u32 reserved03:19;314 315	/* OFFSET 0x24 */316	u32 uiRsvd4;317 318	/* OFFSET 0x28 */319	u32 target_port_transfer_tag:16;320	u32 tag:16;321 322	/* OFFSET 0x2C */323	u32 data_offset;324};325 326/**327 * struct stp_task_context - This is the SCU hardware definition for an STP328 *    request.329 *330 *331 */332struct stp_task_context {333	/* OFFSET 0x18 */334	u32 fis_type:8;335	u32 pm_port:4;336	u32 reserved0:3;337	u32 control:1;338	u32 command:8;339	u32 features:8;340 341	/* OFFSET 0x1C */342	u32 reserved1;343 344	/* OFFSET 0x20 */345	u32 reserved2;346 347	/* OFFSET 0x24 */348	u32 reserved3;349 350	/* OFFSET 0x28 */351	u32 ncq_tag:5;352	u32 reserved4:27;353 354	/* OFFSET 0x2C */355	u32 data_offset; /* TODO: What is this used for? */356};357 358/**359 * struct smp_task_context - This is the SCU hardware definition for an SMP360 *    request.361 *362 *363 */364struct smp_task_context {365	/* OFFSET 0x18 */366	u32 response_length:8;367	u32 function_result:8;368	u32 function:8;369	u32 frame_type:8;370 371	/* OFFSET 0x1C */372	u32 smp_response_ufi:12;373	u32 reserved1:20;374 375	/* OFFSET 0x20 */376	u32 reserved2;377 378	/* OFFSET 0x24 */379	u32 reserved3;380 381	/* OFFSET 0x28 */382	u32 reserved4;383 384	/* OFFSET 0x2C */385	u32 reserved5;386};387 388/**389 * struct primitive_task_context - This is the SCU hardware definition used390 *    when the driver wants to send a primitive on the link.391 *392 *393 */394struct primitive_task_context {395	/* OFFSET 0x18 */396	/**397	 * This field is the control word and it must be 0.398	 */399	u32 control; /* /< must be set to 0 */400 401	/* OFFSET 0x1C */402	/**403	 * This field specifies the primitive that is to be transmitted.404	 */405	u32 sequence;406 407	/* OFFSET 0x20 */408	u32 reserved0;409 410	/* OFFSET 0x24 */411	u32 reserved1;412 413	/* OFFSET 0x28 */414	u32 reserved2;415 416	/* OFFSET 0x2C */417	u32 reserved3;418};419 420/**421 * The union of the protocols that can be selected in the SCU task context422 *    field.423 *424 * protocol_context425 */426union protocol_context {427	struct ssp_task_context ssp;428	struct stp_task_context stp;429	struct smp_task_context smp;430	struct primitive_task_context primitive;431	u32 words[6];432};433 434/**435 * struct scu_sgl_element - This structure represents a single SCU defined SGL436 *    element. SCU SGLs contain a 64 bit address with the maximum data transfer437 *    being 24 bits in size.  The SGL can not cross a 4GB boundary.438 *439 * struct scu_sgl_element440 */441struct scu_sgl_element {442	/**443	 * This field is the upper 32 bits of the 64 bit physical address.444	 */445	u32 address_upper;446 447	/**448	 * This field is the lower 32 bits of the 64 bit physical address.449	 */450	u32 address_lower;451 452	/**453	 * This field is the number of bytes to transfer.454	 */455	u32 length:24;456 457	/**458	 * This field is the address modifier to be used when a virtual function is459	 * requesting a data transfer.460	 */461	u32 address_modifier:8;462 463};464 465#define SCU_SGL_ELEMENT_PAIR_A   0466#define SCU_SGL_ELEMENT_PAIR_B   1467 468/**469 * struct scu_sgl_element_pair - This structure is the SCU hardware definition470 *    of a pair of SGL elements. The SCU hardware always works on SGL pairs.471 *    They are refered to in the DS specification as SGL A and SGL B.  Each SGL472 *    pair is followed by the address of the next pair.473 *474 *475 */476struct scu_sgl_element_pair {477	/* OFFSET 0x60-0x68 */478	/**479	 * This field is the SGL element A of the SGL pair.480	 */481	struct scu_sgl_element A;482 483	/* OFFSET 0x6C-0x74 */484	/**485	 * This field is the SGL element B of the SGL pair.486	 */487	struct scu_sgl_element B;488 489	/* OFFSET 0x78-0x7C */490	/**491	 * This field is the upper 32 bits of the 64 bit address to the next SGL492	 * element pair.493	 */494	u32 next_pair_upper;495 496	/**497	 * This field is the lower 32 bits of the 64 bit address to the next SGL498	 * element pair.499	 */500	u32 next_pair_lower;501 502};503 504/**505 * struct transport_snapshot - This structure is the SCU hardware scratch area506 *    for the task context. This is set to 0 by the driver but can be read by507 *    issuing a dump TC request to the SCU.508 *509 *510 */511struct transport_snapshot {512	/* OFFSET 0x48 */513	u32 xfer_rdy_write_data_length;514 515	/* OFFSET 0x4C */516	u32 data_offset;517 518	/* OFFSET 0x50 */519	u32 data_transfer_size:24;520	u32 reserved_50_0:8;521 522	/* OFFSET 0x54 */523	u32 next_initiator_write_data_offset;524 525	/* OFFSET 0x58 */526	u32 next_initiator_write_data_xfer_size:24;527	u32 reserved_58_0:8;528};529 530/**531 * struct scu_task_context - This structure defines the contents of the SCU532 *    silicon task context. It lays out all of the fields according to the533 *    expected order and location for the Storage Controller unit.534 *535 *536 */537struct scu_task_context {538	/* OFFSET 0x00 ------ */539	/**540	 * This field must be encoded to one of the valid SCU task priority values541	 *    - SCU_TASK_PRIORITY_NORMAL542	 *    - SCU_TASK_PRIORITY_HEAD_OF_Q543	 *    - SCU_TASK_PRIORITY_HIGH544	 */545	u32 priority:2;546 547	/**548	 * This field must be set to true if this is an initiator generated request.549	 * Until target mode is supported all task requests are initiator requests.550	 */551	u32 initiator_request:1;552 553	/**554	 * This field must be set to one of the valid connection rates valid values555	 * are 0x8, 0x9, and 0xA.556	 */557	u32 connection_rate:4;558 559	/**560	 * This field muse be programed when generating an SMP response since the SMP561	 * connection remains open until the SMP response is generated.562	 */563	u32 protocol_engine_index:3;564 565	/**566	 * This field must contain the logical port for the task request.567	 */568	u32 logical_port_index:3;569 570	/**571	 * This field must be set to one of the SCU_TASK_CONTEXT_PROTOCOL values572	 *    - SCU_TASK_CONTEXT_PROTOCOL_SMP573	 *    - SCU_TASK_CONTEXT_PROTOCOL_SSP574	 *    - SCU_TASK_CONTEXT_PROTOCOL_STP575	 *    - SCU_TASK_CONTEXT_PROTOCOL_NONE576	 */577	u32 protocol_type:3;578 579	/**580	 * This filed must be set to the TCi allocated for this task581	 */582	u32 task_index:12;583 584	/**585	 * This field is reserved and must be set to 0x00586	 */587	u32 reserved_00_0:1;588 589	/**590	 * For a normal task request this must be set to 0.  If this is an abort of591	 * this task request it must be set to 1.592	 */593	u32 abort:1;594 595	/**596	 * This field must be set to true for the SCU hardware to process the task.597	 */598	u32 valid:1;599 600	/**601	 * This field must be set to SCU_TASK_CONTEXT_TYPE602	 */603	u32 context_type:1;604 605	/* OFFSET 0x04 */606	/**607	 * This field contains the RNi that is the target of this request.608	 */609	u32 remote_node_index:12;610 611	/**612	 * This field is programmed if this is a mirrored request, which we are not613	 * using, in which case it is the RNi for the mirrored target.614	 */615	u32 mirrored_node_index:12;616 617	/**618	 * This field is programmed with the direction of the SATA reqeust619	 *    - SCU_SATA_WRITE_DATA_DIRECTION620	 *    - SCU_SATA_READ_DATA_DIRECTION621	 */622	u32 sata_direction:1;623 624	/**625	 * This field is programmsed with one of the following SCU_COMMAND_CODE626	 *    - SCU_COMMAND_CODE_INITIATOR_NEW_TASK627	 *    - SCU_COMMAND_CODE_ACTIVE_TASK628	 *    - SCU_COMMAND_CODE_PRIMITIVE_SEQ_TASK629	 *    - SCU_COMMAND_CODE_TARGET_RAW_FRAMES630	 */631	u32 command_code:2;632 633	/**634	 * This field is set to true if the remote node should be suspended.635	 * This bit is only valid for SSP & SMP target devices.636	 */637	u32 suspend_node:1;638 639	/**640	 * This field is programmed with one of the following command type codes641	 *642	 * For SAS requests use the scu_ssp_task_type643	 *    - SCU_TASK_TYPE_IOREAD644	 *    - SCU_TASK_TYPE_IOWRITE645	 *    - SCU_TASK_TYPE_SMP_REQUEST646	 *    - SCU_TASK_TYPE_RESPONSE647	 *    - SCU_TASK_TYPE_RAW_FRAME648	 *    - SCU_TASK_TYPE_PRIMITIVE649	 *650	 * For SATA requests use the scu_sata_task_type651	 *    - SCU_TASK_TYPE_DMA_IN652	 *    - SCU_TASK_TYPE_FPDMAQ_READ653	 *    - SCU_TASK_TYPE_PACKET_DMA_IN654	 *    - SCU_TASK_TYPE_SATA_RAW_FRAME655	 *    - SCU_TASK_TYPE_DMA_OUT656	 *    - SCU_TASK_TYPE_FPDMAQ_WRITE657	 *    - SCU_TASK_TYPE_PACKET_DMA_OUT658	 */659	u32 task_type:4;660 661	/* OFFSET 0x08 */662	/**663	 * This field is reserved and the must be set to 0x00664	 */665	u32 link_layer_control:8; /* presently all reserved */666 667	/**668	 * This field is set to true when TLR is to be enabled669	 */670	u32 ssp_tlr_enable:1;671 672	/**673	 * This is field specifies if the SCU DMAs a response frame to host674	 * memory for good response frames when operating in target mode.675	 */676	u32 dma_ssp_target_good_response:1;677 678	/**679	 * This field indicates if the SCU should DMA the response frame to680	 * host memory.681	 */682	u32 do_not_dma_ssp_good_response:1;683 684	/**685	 * This field is set to true when strict ordering is to be enabled686	 */687	u32 strict_ordering:1;688 689	/**690	 * This field indicates the type of endianess to be utilized for the691	 * frame.  command, task, and response frames utilized control_frame692	 * set to 1.693	 */694	u32 control_frame:1;695 696	/**697	 * This field is reserved and the driver should set to 0x00698	 */699	u32 tl_control_reserved:3;700 701	/**702	 * This field is set to true when the SCU hardware task timeout control is to703	 * be enabled704	 */705	u32 timeout_enable:1;706 707	/**708	 * This field is reserved and the driver should set it to 0x00709	 */710	u32 pts_control_reserved:7;711 712	/**713	 * This field should be set to true when block guard is to be enabled714	 */715	u32 block_guard_enable:1;716 717	/**718	 * This field is reserved and the driver should set to 0x00719	 */720	u32 sdma_control_reserved:7;721 722	/* OFFSET 0x0C */723	/**724	 * This field is the address modifier for this io request it should be725	 * programmed with the virtual function that is making the request.726	 */727	u32 address_modifier:16;728 729	/**730	 * @todo What we support mirrored SMP response frame?731	 */732	u32 mirrored_protocol_engine:3;  /* mirrored protocol Engine Index */733 734	/**735	 * If this is a mirrored request the logical port index for the mirrored RNi736	 * must be programmed.737	 */738	u32 mirrored_logical_port:4;  /* mirrored local port index */739 740	/**741	 * This field is reserved and the driver must set it to 0x00742	 */743	u32 reserved_0C_0:8;744 745	/**746	 * This field must be set to true if the mirrored request processing is to be747	 * enabled.748	 */749	u32 mirror_request_enable:1;  /* Mirrored request Enable */750 751	/* OFFSET 0x10 */752	/**753	 * This field is the command iu length in dwords754	 */755	u32 ssp_command_iu_length:8;756 757	/**758	 * This is the target TLR enable bit it must be set to 0 when creatning the759	 * task context.760	 */761	u32 xfer_ready_tlr_enable:1;762 763	/**764	 * This field is reserved and the driver must set it to 0x00765	 */766	u32 reserved_10_0:7;767 768	/**769	 * This is the maximum burst size that the SCU hardware will send in one770	 * connection its value is (N x 512) and N must be a multiple of 2.  If the771	 * value is 0x00 then maximum burst size is disabled.772	 */773	u32 ssp_max_burst_size:16;774 775	/* OFFSET 0x14 */776	/**777	 * This filed is set to the number of bytes to be transfered in the request.778	 */779	u32 transfer_length_bytes:24; /* In terms of bytes */780 781	/**782	 * This field is reserved and the driver should set it to 0x00783	 */784	u32 reserved_14_0:8;785 786	/* OFFSET 0x18-0x2C */787	/**788	 * This union provides for the protocol specif part of the SCU Task Context.789	 */790	union protocol_context type;791 792	/* OFFSET 0x30-0x34 */793	/**794	 * This field is the upper 32 bits of the 64 bit physical address of the795	 * command iu buffer796	 */797	u32 command_iu_upper;798 799	/**800	 * This field is the lower 32 bits of the 64 bit physical address of the801	 * command iu buffer802	 */803	u32 command_iu_lower;804 805	/* OFFSET 0x38-0x3C */806	/**807	 * This field is the upper 32 bits of the 64 bit physical address of the808	 * response iu buffer809	 */810	u32 response_iu_upper;811 812	/**813	 * This field is the lower 32 bits of the 64 bit physical address of the814	 * response iu buffer815	 */816	u32 response_iu_lower;817 818	/* OFFSET 0x40 */819	/**820	 * This field is set to the task phase of the SCU hardware. The driver must821	 * set this to 0x01822	 */823	u32 task_phase:8;824 825	/**826	 * This field is set to the transport layer task status.  The driver must set827	 * this to 0x00828	 */829	u32 task_status:8;830 831	/**832	 * This field is used during initiator write TLR833	 */834	u32 previous_extended_tag:4;835 836	/**837	 * This field is set the maximum number of retries for a STP non-data FIS838	 */839	u32 stp_retry_count:2;840 841	/**842	 * This field is reserved and the driver must set it to 0x00843	 */844	u32 reserved_40_1:2;845 846	/**847	 * This field is used by the SCU TL to determine when to take a snapshot when848	 * transmitting read data frames.849	 *    - 0x00 The entire IO850	 *    - 0x01 32k851	 *    - 0x02 64k852	 *    - 0x04 128k853	 *    - 0x08 256k854	 */855	u32 ssp_tlr_threshold:4;856 857	/**858	 * This field is reserved and the driver must set it to 0x00859	 */860	u32 reserved_40_2:4;861 862	/* OFFSET 0x44 */863	u32 write_data_length; /* read only set to 0 */864 865	/* OFFSET 0x48-0x58 */866	struct transport_snapshot snapshot; /* read only set to 0 */867 868	/* OFFSET 0x5C */869	u32 blk_prot_en:1;870	u32 blk_sz:2;871	u32 blk_prot_func:2;872	u32 reserved_5C_0:9;873	u32 active_sgl_element:2;  /* read only set to 0 */874	u32 sgl_exhausted:1;  /* read only set to 0 */875	u32 payload_data_transfer_error:4;  /* read only set to 0 */876	u32 frame_buffer_offset:11; /* read only set to 0 */877 878	/* OFFSET 0x60-0x7C */879	/**880	 * This field is the first SGL element pair found in the TC data structure.881	 */882	struct scu_sgl_element_pair sgl_pair_ab;883	/* OFFSET 0x80-0x9C */884	/**885	 * This field is the second SGL element pair found in the TC data structure.886	 */887	struct scu_sgl_element_pair sgl_pair_cd;888 889	/* OFFSET 0xA0-BC */890	struct scu_sgl_element_pair sgl_snapshot_ac;891 892	/* OFFSET 0xC0 */893	u32 active_sgl_element_pair; /* read only set to 0 */894 895	/* OFFSET 0xC4-0xCC */896	u32 reserved_C4_CC[3];897 898	/* OFFSET 0xD0 */899	u32 interm_crc_val:16;900	u32 init_crc_seed:16;901 902	/* OFFSET 0xD4 */903	u32 app_tag_verify:16;904	u32 app_tag_gen:16;905 906	/* OFFSET 0xD8 */907	u32 ref_tag_seed_verify;908 909	/* OFFSET 0xDC */910	u32 UD_bytes_immed_val:13;911	u32 reserved_DC_0:3;912	u32 DIF_bytes_immed_val:4;913	u32 reserved_DC_1:12;914 915	/* OFFSET 0xE0 */916	u32 bgc_blk_sz:13;917	u32 reserved_E0_0:3;918	u32 app_tag_gen_mask:16;919 920	/* OFFSET 0xE4 */921	union {922		u16 bgctl;923		struct {924			u16 crc_verify:1;925			u16 app_tag_chk:1;926			u16 ref_tag_chk:1;927			u16 op:2;928			u16 legacy:1;929			u16 invert_crc_seed:1;930			u16 ref_tag_gen:1;931			u16 fixed_ref_tag:1;932			u16 invert_crc:1;933			u16 app_ref_f_detect:1;934			u16 uninit_dif_check_err:1;935			u16 uninit_dif_bypass:1;936			u16 app_f_detect:1;937			u16 reserved_0:2;938		} bgctl_f;939	};940 941	u16 app_tag_verify_mask;942 943	/* OFFSET 0xE8 */944	u32 blk_guard_err:8;945	u32 reserved_E8_0:24;946 947	/* OFFSET 0xEC */948	u32 ref_tag_seed_gen;949 950	/* OFFSET 0xF0 */951	u32 intermediate_crc_valid_snapshot:16;952	u32 reserved_F0_0:16;953 954	/* OFFSET 0xF4 */955	u32 reference_tag_seed_for_verify_function_snapshot;956 957	/* OFFSET 0xF8 */958	u32 snapshot_of_reserved_dword_DC_of_tc;959 960	/* OFFSET 0xFC */961	u32 reference_tag_seed_for_generate_function_snapshot;962 963} __packed;964 965#endif /* _SCU_TASK_CONTEXT_H_ */966