Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
scu_task_context.h
Go to the documentation of this file.
1 /*
2  * This file is provided under a dual BSD/GPLv2 license. When using or
3  * redistributing this file, you may do so under either license.
4  *
5  * GPL LICENSE SUMMARY
6  *
7  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of version 2 of the GNU General Public License as
11  * published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21  * The full GNU General Public License is included in this distribution
22  * in the file called LICENSE.GPL.
23  *
24  * BSD LICENSE
25  *
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 without
30  * modification, are permitted provided that the following conditions
31  * are met:
32  *
33  * * Redistributions of source code must retain the above copyright
34  * notice, this list of conditions and the following disclaimer.
35  * * Redistributions in binary form must reproduce the above copyright
36  * notice, this list of conditions and the following disclaimer in
37  * the documentation and/or other materials provided with the
38  * distribution.
39  * * Neither the name of Intel Corporation nor the names of its
40  * contributors may be used to endorse or promote products derived
41  * from this software without specific prior written permission.
42  *
43  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53  * 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 
74 typedef 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 */
82 
90 typedef 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 */
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 */
103 
104 
110 #define SCU_TASK_CONTEXT_TYPE 0
111 #define SCU_RNC_CONTEXT_TYPE 1
112 
118 #define SCU_TASK_CONTEXT_INVALID 0
119 #define SCU_TASK_CONTEXT_VALID 1
120 
126 #define SCU_COMMAND_CODE_INITIATOR_NEW_TASK 0
127 #define SCU_COMMAND_CODE_ACTIVE_TASK 1
128 #define SCU_COMMAND_CODE_PRIMITIVE_SEQ_TASK 2
129 #define SCU_COMMAND_CODE_TARGET_RAW_FRAMES 3
130 
141 #define SCU_TASK_PRIORITY_NORMAL 0
142 
150 #define SCU_TASK_PRIORITY_HEAD_OF_Q 1
151 
159 #define SCU_TASK_PRIORITY_HIGH 2
160 
166 #define SCU_TASK_PRIORITY_RESERVED 3
167 
168 #define SCU_TASK_INITIATOR_MODE 1
169 #define SCU_TASK_TARGET_MODE 0
170 
171 #define SCU_TASK_REGULAR 0
172 #define SCU_TASK_ABORTED 1
173 
174 /* direction bit defintion */
180 #define SCU_SATA_WRITE_DATA_DIRECTION 0
181 #define SCU_SATA_READ_DATA_DIRECTION 1
182 
189 #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_SHIFT 21
190 #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_MASK 0x00E00000
191 #define scu_get_command_request_type(x) \
192  ((x) & SCU_CONTEXT_COMMAND_REQUEST_TYPE_MASK)
193 
194 #define SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_SHIFT 18
195 #define SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_MASK 0x001C0000
196 #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 16
208 #define SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_MASK 0x00010000
209 #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 12
213 #define SCU_CONTEXT_COMMAND_LOGICAL_PORT_MASK 0x00007000
214 #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 
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 
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 
287 #define SCU_TASK_CONTEXT_PROTOCOL_SMP 0x00
288 #define SCU_TASK_CONTEXT_PROTOCOL_SSP 0x01
289 #define SCU_TASK_CONTEXT_PROTOCOL_STP 0x02
290 #define SCU_TASK_CONTEXT_PROTOCOL_NONE 0x07
291 
299  /* OFFSET 0x18 */
302 
303  /* OFFSET 0x1C */
305 
306  /* OFFSET 0x20 */
314 
315  /* OFFSET 0x24 */
317 
318  /* OFFSET 0x28 */
320  u32 tag:16;
321 
322  /* OFFSET 0x2C */
324 };
325 
333  /* OFFSET 0x18 */
340 
341  /* OFFSET 0x1C */
343 
344  /* OFFSET 0x20 */
346 
347  /* OFFSET 0x24 */
349 
350  /* OFFSET 0x28 */
353 
354  /* OFFSET 0x2C */
355  u32 data_offset; /* TODO: What is this used for? */
356 };
357 
365  /* OFFSET 0x18 */
368  u32 function:8;
370 
371  /* OFFSET 0x1C */
374 
375  /* OFFSET 0x20 */
377 
378  /* OFFSET 0x24 */
380 
381  /* OFFSET 0x28 */
383 
384  /* OFFSET 0x2C */
386 };
387 
395  /* OFFSET 0x18 */
399  u32 control; /* /< must be set to 0 */
400 
401  /* OFFSET 0x1C */
406 
407  /* OFFSET 0x20 */
409 
410  /* OFFSET 0x24 */
412 
413  /* OFFSET 0x28 */
415 
416  /* OFFSET 0x2C */
418 };
419 
431  u32 words[6];
432 };
433 
446 
451 
456 
462 
463 };
464 
465 #define SCU_SGL_ELEMENT_PAIR_A 0
466 #define SCU_SGL_ELEMENT_PAIR_B 1
467 
477  /* OFFSET 0x60-0x68 */
482 
483  /* OFFSET 0x6C-0x74 */
488 
489  /* OFFSET 0x78-0x7C */
495 
501 
502 };
503 
512  /* OFFSET 0x48 */
514 
515  /* OFFSET 0x4C */
517 
518  /* OFFSET 0x50 */
521 
522  /* OFFSET 0x54 */
524 
525  /* OFFSET 0x58 */
528 };
529 
538  /* OFFSET 0x00 ------ */
546 
552 
558 
564 
569 
578 
583 
588 
594 
599 
604 
605  /* OFFSET 0x04 */
610 
616 
623 
632 
638 
660 
661  /* OFFSET 0x08 */
665  u32 link_layer_control:8; /* presently all reserved */
666 
671 
677 
683 
688 
695 
700 
706 
711 
716 
721 
722  /* OFFSET 0x0C */
728 
732  u32 mirrored_protocol_engine:3; /* mirrored protocol Engine Index */
733 
738  u32 mirrored_logical_port:4; /* mirrored local port index */
739 
744 
749  u32 mirror_request_enable:1; /* Mirrored request Enable */
750 
751  /* OFFSET 0x10 */
756 
762 
767 
774 
775  /* OFFSET 0x14 */
779  u32 transfer_length_bytes:24; /* In terms of bytes */
780 
785 
786  /* OFFSET 0x18-0x2C */
791 
792  /* OFFSET 0x30-0x34 */
798 
804 
805  /* OFFSET 0x38-0x3C */
811 
817 
818  /* OFFSET 0x40 */
824 
830 
835 
840 
845 
856 
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 */
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 */
883  /* OFFSET 0x80-0x9C */
888 
889  /* OFFSET 0xA0-BC */
891 
892  /* OFFSET 0xC0 */
893  u32 active_sgl_element_pair; /* read only set to 0 */
894 
895  /* OFFSET 0xC4-0xCC */
897 
898  /* OFFSET 0xD0 */
901 
902  /* OFFSET 0xD4 */
905 
906  /* OFFSET 0xD8 */
908 
909  /* OFFSET 0xDC */
914 
915  /* OFFSET 0xE0 */
919 
920  /* OFFSET 0xE4 */
921  union {
923  struct {
927  u16 op:2;
938  } bgctl_f;
939  };
940 
942 
943  /* OFFSET 0xE8 */
946 
947  /* OFFSET 0xEC */
949 
950  /* OFFSET 0xF0 */
953 
954  /* OFFSET 0xF4 */
956 
957  /* OFFSET 0xF8 */
959 
960  /* OFFSET 0xFC */
962 
963 } __packed;
964 
965 #endif /* _SCU_TASK_CONTEXT_H_ */